Changeset 62
- Timestamp:
- Dec 15, 2004, 12:51:55 AM (20 years ago)
- Location:
- Swollen
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Swollen/doc/contract2_hours.txt
r48 r62 4 4 5 5 6 7 15 December, Tuesday (4 hours) 8 - added -texture <filename> option for bedslope image 9 - other code cleanups related to handling georeferenced data 10 - small amount of work on background thread for data read 11 6 12 14 December, Monday (6 hours) 7 13 - visit to GA, swollen now compiling on-site under Windows/Visual Studio .NET 8 14 - added command line params for tweaking transparency (see "swollen -help") 15 - added -nosky option to omit surrounding sky map 16 17 18 19 total = 113 hours (3.0 weeks) 20 subtotal = 8 hours 21 9 22 10 23 12 December, Saturday (4 hours) … … 17 30 7 December, Wednesday (4 hours) 18 31 - new distro released 32 19 33 20 34 … … 36 50 - searching for "popping" triangles in cairns sww file 37 51 - gdal installation and recompilation (support for georef tiff) 52 38 53 39 54 … … 59 74 60 75 76 61 77 total = 79 hours (2 weeks) 62 78 subtotal = 33 hours … … 80 96 15 October, Friday (3 hours) 81 97 - memory leaks 98 82 99 83 100 -
Swollen/doc/contract2_priorities.txt
r60 r62 95 95 "sww file couldn't read" [1] 96 96 - add -version command line flag synced with Subversion revision number (useful for debugging) [?] 97 - prune -help documentation removing irrelevant options [?] 97 98 98 99 -
Swollen/include/swwreader.h
r61 r62 68 68 virtual osg::ref_ptr<osg::DrawElementsUShort> getBedslopeIndexArray() {return _bedslopeindices;} 69 69 virtual osg::ref_ptr<osg::Vec3Array> getBedslopeCentroidArray() {return _bedslopecentroids;} 70 virtual osg::ref_ptr<osg::Vec2Array> getBedslopeTextureCoords() {return _bedslopetexcoords;} 70 virtual osg::ref_ptr<osg::Vec2Array> getBedslopeTextureCoords(); 71 72 virtual void setBedslopeTexture( std::string filename ); 73 virtual osg::Image* getBedslopeTexture(); 74 71 75 72 76 // stage … … 90 94 virtual void setHeightMin( float value ) {_heightmin = value;} 91 95 virtual void setHeightMax( float value ) {_heightmax = value;} 92 93 96 94 97 virtual triangle_list getConnectivity(unsigned int index) {return _connectivity.at(index);} … … 134 137 osg::ref_ptr<osg::Vec4Array> _stagecolors; 135 138 139 // optional bedslope texture map 140 std::string* _bedslopetexture; 141 136 142 // bedslope vertex scale and shift factors (for normalizing to unit cube) 137 143 float _xscale, _yscale, _zscale, _scale; -
Swollen/swollen/bedslope.cpp
r45 r62 5 5 #include <osg/BoundingBox> 6 6 #include <osg/Texture2D> 7 #include <osgDB/Registry>8 #include <osgDB/ReadFile>9 7 #include <osg/TexEnv> 10 8 … … 15 13 BedSlope::BedSlope(SWWReader* sww) 16 14 { 17 18 15 // persistent 19 16 _sww = sww; … … 41 38 texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT); 42 39 texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT); 43 texture->setImage( osgDB::readImageFile("bedslope.jpg"));40 texture->setImage( _sww->getBedslopeTexture() ); 44 41 45 42 _stateset = new osg::StateSet; -
Swollen/swollen/main.cpp
r60 r62 39 39 arguments.getApplicationUsage()->addCommandLineOption("-help","Display this information"); 40 40 arguments.getApplicationUsage()->addCommandLineOption("-scale <float>","Vertical scale factor"); 41 arguments.getApplicationUsage()->addCommandLineOption("-tps <rate>"," timesteps per second");42 arguments.getApplicationUsage()->addCommandLineOption("-hmin <float>"," height below which transparency is set to zero");41 arguments.getApplicationUsage()->addCommandLineOption("-tps <rate>","Timesteps per second"); 42 arguments.getApplicationUsage()->addCommandLineOption("-hmin <float>","Height below which transparency is set to zero"); 43 43 arguments.getApplicationUsage()->addCommandLineOption("-hmax <float>","Height above which transparency is set to alphamax"); 44 arguments.getApplicationUsage()->addCommandLineOption("-alphamin <float>","transparency value at hmin"); 45 arguments.getApplicationUsage()->addCommandLineOption("-alphamax <float>","maximum transparency clamp value"); 46 arguments.getApplicationUsage()->addCommandLineOption("-nosky","omit background sky"); 44 arguments.getApplicationUsage()->addCommandLineOption("-alphamin <float>","Transparency value at hmin"); 45 arguments.getApplicationUsage()->addCommandLineOption("-alphamax <float>","Maximum transparency clamp value"); 46 arguments.getApplicationUsage()->addCommandLineOption("-nosky","Omit background sky"); 47 arguments.getApplicationUsage()->addCommandLineOption("-texture <file>","Image to use for bedslope topography"); 47 48 48 49 // construct the viewer. … … 89 90 float vscale; 90 91 if( !arguments.read("-scale",vscale) ) vscale = 1.0; 92 93 std::string bedslopetexture; 94 if( arguments.read("-texture",bedslopetexture) ) sww->setBedslopeTexture( bedslopetexture ); 91 95 92 96 float tmpfloat; -
Swollen/swollen/watersurface.cpp
r61 r62 36 36 _node->setStateSet(_stateset); 37 37 38 // FIXME: if set to true, wireframe doesn't work - need to dirty to force update? 39 _geom->setUseDisplayList( false ); 38 _geom->setUseDisplayList( true ); 40 39 41 40 // initial geometry -
Swollen/swwreader/Makefile
r6 r62 11 11 OSG_INCLUDE = ${OSGHOME}/include 12 12 LOCAL_INCLUDE = $(TOPDIR)/include 13 INCLUDES = -I $(LOCAL_INCLUDE) -I $(NETCDF_INCLUDE) -I $(OSG_INCLUDE) 13 GDAL_INCLUDE = `gdal-config --cflags` 14 INCLUDES = -I $(LOCAL_INCLUDE) -I $(NETCDF_INCLUDE) -I $(OSG_INCLUDE) $(GDAL_INCLUDE) 14 15 15 16 CARBON_LIB = -framework Carbon … … 17 18 NETCDF_LIBS = -lnetcdf 18 19 X_LIBS = -lX11 20 GDAL_LIBS = `gdal-config --libs` 19 21 OTHER_LIBS = -lm -lstdc++ -lobjc 20 LIBS += -losg -l OpenThreads $(NETCDF_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) $(CARBON_LIB)22 LIBS += -losg -losgDB -lOpenThreads $(NETCDF_LIBS) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) $(CARBON_LIB) $(GDAL_LIBS) 21 23 LIBDIRS = -L/usr/lib -L/usr/X11R6/lib -L/sw/lib -L/usr/local/lib 22 24 -
Swollen/swwreader/swwreader.cpp
r61 r62 3 3 4 4 Reader of SWW files from within OpenSceneGraph. 5 6 An SWW file is the visualization output of the pyVolution7 Shallow Water Wave equation solver. SWW files contain bedslope8 geometry and a sequence of stages at known timesteps. The9 internal format is NetCDF:10 11 netcdf demo.sww {12 dimensions:13 number_of_volumes = <integer> ;14 number_of_vertices = 3 ;15 number_of_points = <integer> ;16 number_of_timesteps = UNLIMITED ;17 variables:18 float x(number_of_points) ;19 float y(number_of_points) ;20 float z(number_of_points) ;21 int volumes(number_of_volumes, number_of_vertices) ;22 float time(number_of_timesteps) ;23 float stage(number_of_timesteps, number_of_points) ;24 5 25 6 copyright (C) 2004 Geoscience Australia … … 32 13 #include <osg/Notify> 33 14 15 #include <osgDB/Registry> 16 #include <osgDB/ReadFile> 17 34 18 #include <stdlib.h> 35 19 #include <stdio.h> 20 #include <gdal_priv.h> 36 21 37 22 … … 148 133 149 134 135 // default texture map 136 _bedslopetexture = new std::string("bedslope.jpg"); 137 138 150 139 osg::notify(osg::INFO) << "[SWWReader] xmin: " << xmin << std::endl; 151 140 osg::notify(osg::INFO) << "[SWWReader] xmax: " << xmax << std::endl; … … 186 175 187 176 188 // bedslope texture coords based on (x,y) locations scaled by extents into range [0,1]189 _bedslopetexcoords = new osg::Vec2Array;190 for( iv=0; iv < _npoints; iv++ )191 _bedslopetexcoords->push_back( osg::Vec2( (_px[iv]-_xoffset)*_xscale, (_py[iv]-_yoffset)*_yscale ) );192 193 194 177 // calculate bedslope primitive normal and centroid arrays 195 178 _bedslopenormals = new osg::Vec3Array; … … 226 209 _status.push_back( nc_close(_ncid) ); 227 210 delete[]( _px, _py, _pz, _ptime, _pvolumes, _pstage ); 211 } 212 213 214 215 void SWWReader::setBedslopeTexture( std::string filename ) 216 { 217 osg::notify(osg::INFO) << "[SWWReader::setBedslopetexture] filename: " << filename << std::endl; 218 _bedslopetexture = new std::string(filename); 219 220 // attempt to extract geospatial metadata from image file 221 GDALDataset *poDataset; 222 GDALAllRegister(); 223 poDataset = (GDALDataset *) GDALOpen( filename.c_str(), GA_ReadOnly ); 224 if( poDataset == NULL ) 225 osg::notify(osg::INFO) << "[SWWReader::setBedslopetexture] GDAL unable to open file: " << filename << std::endl; 226 else 227 { 228 // extract metadata 229 double adfGeoTransform[6]; 230 231 printf( "Driver: %s/%s\n", 232 poDataset->GetDriver()->GetDescription(), 233 poDataset->GetDriver()->GetMetadataItem( GDAL_DMD_LONGNAME ) ); 234 235 printf( "Size is %dx%dx%d\n", 236 poDataset->GetRasterXSize(), poDataset->GetRasterYSize(), 237 poDataset->GetRasterCount() ); 238 239 if( poDataset->GetProjectionRef() != NULL ) 240 printf( "Projection is `%s'\n", poDataset->GetProjectionRef() ); 241 242 if( poDataset->GetGeoTransform( adfGeoTransform ) == CE_None ) 243 { 244 printf( "Origin = (%.6f,%.6f)\n", 245 adfGeoTransform[0], adfGeoTransform[3] ); 246 247 printf( "Pixel Size = (%.6f,%.6f)\n", 248 adfGeoTransform[1], adfGeoTransform[5] ); 249 } 250 } 251 252 } 253 254 255 256 osg::Image* SWWReader::getBedslopeTexture() 257 { 258 return osgDB::readImageFile( _bedslopetexture->c_str() ); 259 } 260 261 262 263 osg::ref_ptr<osg::Vec2Array> SWWReader::getBedslopeTextureCoords() 264 { 265 266 // bedslope texture coords based on (x,y) locations scaled by extents into range [0,1] 267 _bedslopetexcoords = new osg::Vec2Array; 268 for( unsigned int iv=0; iv < _npoints; iv++ ) 269 _bedslopetexcoords->push_back( osg::Vec2( (_px[iv]-_xoffset)*_xscale, (_py[iv]-_yoffset)*_yscale ) ); 270 271 return _bedslopetexcoords; 228 272 } 229 273
Note: See TracChangeset
for help on using the changeset viewer.