Changeset 11122
- Timestamp:
- 02/26/10 10:23:28 (3 years ago)
- Location:
- OpenSceneGraph/trunk/src/osgPlugins/txp
- Files:
-
- 5 modified
-
ReaderWriterTXP.cpp (modified) (8 diffs)
-
ReaderWriterTXP.h (modified) (1 diff)
-
TXPNode.cpp (modified) (1 diff)
-
TXPNode.h (modified) (1 diff)
-
TXPParser.h (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/txp/ReaderWriterTXP.cpp
r11037 r11122 59 59 //the txpNode. 60 60 int id = ++_archiveId; 61 TXPArchive*archive = getArchive(id,osgDB::getFilePath(fileName));61 osg::ref_ptr< TXPArchive > archive = getArchive(id,osgDB::getFilePath(fileName)); 62 62 63 63 if (archive != NULL) … … 70 70 } 71 71 72 txpNode->loadArchive(archive );73 72 txpNode->loadArchive(archive.get()); 73 74 74 return txpNode.get(); 75 75 } … … 86 86 unsigned int id; 87 87 sscanf(name.c_str(),"tile%d_%dx%d_%u",&lod,&x,&y,&id); 88 TXPArchive*archive = getArchive(id,osgDB::getFilePath(file));88 osg::ref_ptr< TXPArchive > archive = getArchive(id,osgDB::getFilePath(file)); 89 89 90 90 // The way this is done a 'tile' should only be created for lod 0 only, … … 107 107 108 108 std::vector<TXPArchive::TileLocationInfo> childrenLoc; 109 osg::ref_ptr<osg::Node> tileContent = getTileContent(info,x,y,lod,archive , childrenLoc);109 osg::ref_ptr<osg::Node> tileContent = getTileContent(info,x,y,lod,archive.get(), childrenLoc); 110 110 111 111 tileContent->setName("TileContent"); … … 199 199 unsigned int id; 200 200 sscanf(name.c_str(),"subtiles%d_%dx%d_%u",&lod,&x,&y,&id); 201 TXPArchive*archive = getArchive(id,osgDB::getFilePath(file));201 osg::ref_ptr< TXPArchive > archive = getArchive(id,osgDB::getFilePath(file)); 202 202 203 203 int majorVersion, minorVersion; … … 259 259 continue; 260 260 261 osg::ref_ptr<osg::Node> tileContent = getTileContent(info, loc, archive , childrenChildLoc);261 osg::ref_ptr<osg::Node> tileContent = getTileContent(info, loc, archive.get(), childrenChildLoc); 262 262 263 263 tileContent->setName("TileContent"); … … 361 361 continue; 362 362 363 osg::ref_ptr<osg::Node> tileContent = getTileContent(info,tileX,tileY,tileLOD,archive , childrenLoc);363 osg::ref_ptr<osg::Node> tileContent = getTileContent(info,tileX,tileY,tileLOD,archive.get(), childrenLoc); 364 364 365 365 tileContent->setName("TileContent"); … … 564 564 } 565 565 566 TXPArchive *ReaderWriterTXP::getArchive(int id, const std::string& dir)567 { 568 TXPArchive*archive = NULL;566 osg::ref_ptr< TXPArchive > ReaderWriterTXP::getArchive(int id, const std::string& dir) 567 { 568 osg::ref_ptr< TXPArchive > archive = NULL; 569 569 570 570 std::map< int,osg::ref_ptr<TXPArchive> >::iterator iter = _archives.find(id); -
OpenSceneGraph/trunk/src/osgPlugins/txp/ReaderWriterTXP.h
r11037 r11122 82 82 ReadResult local_readNode(const std::string& file, const osgDB::ReaderWriter::Options* options); 83 83 84 TXPArchive *getArchive(int id, const std::string&);84 osg::ref_ptr< TXPArchive > getArchive(int id, const std::string&); 85 85 86 86 osg::Node* getTileContent(const TXPArchive::TileInfo &info, int x, int y, int lod, TXPArchive* archive, std::vector<TXPArchive::TileLocationInfo>& childrenLoc); -
OpenSceneGraph/trunk/src/osgPlugins/txp/TXPNode.cpp
r11037 r11122 97 97 } 98 98 } 99 }100 101 TXPArchive* TXPNode::getArchive()102 {103 return _archive.get();104 99 } 105 100 -
OpenSceneGraph/trunk/src/osgPlugins/txp/TXPNode.h
r8437 r11122 72 72 bool loadArchive(TXPArchive*); 73 73 74 TXPArchive* getArchive() ;74 TXPArchive* getArchive() { return _archive.get(); } 75 75 76 76 void setArchive( TXPArchive* archive ) -
OpenSceneGraph/trunk/src/osgPlugins/txp/TXPParser.h
r5309 r11122 80 80 81 81 GeodeGroup() : osg::Group(), _geode(NULL) 82 {}82 {} 83 83 84 84 GeodeGroup(const GeodeGroup& gg,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): 85 85 osg::Group(gg, copyop), _geode(gg._geode) 86 {}86 {} 87 87 88 88 META_Node(txp, GeodeGroup); … … 118 118 } 119 119 120 // Gets the archive121 inline TXPArchive* getArchive()122 {123 return _archive;124 }125 120 // Gets the archive 121 inline TXPArchive* getArchive() 122 { 123 return _archive.get(); 124 } 125 126 126 // Scene parser 127 127 osg::Group *parseScene( … … 130 130 std::map<int,osg::ref_ptr<osg::Node> > &models, 131 131 double realMinRange, double realMaxRange, double usedMaxRange); 132 132 133 133 // Returns the current Top Group 134 134 inline osg::Group* getCurrTop() … … 149 149 } 150 150 151 // Ensure material is loaded152 inline void loadMaterial( int ix )153 {154 _archive->loadMaterial( ix );155 }151 // Ensure material is loaded 152 inline void loadMaterial( int ix ) 153 { 154 _archive->loadMaterial( ix ); 155 } 156 156 157 157 // New to TerraPage 2.0 - local materials … … 270 270 271 271 // gets tile center, from the top lod node 272 inline const osg::Vec3 getTileCenter() const273 {274 return _tileCenter;275 }276 277 inline void setCurrentNode( osg::Node* node )278 {279 _currentNode = node;280 }272 inline const osg::Vec3 getTileCenter() const 273 { 274 return _tileCenter; 275 } 276 277 inline void setCurrentNode( osg::Node* node ) 278 { 279 _currentNode = node; 280 } 281 281 282 282 // After parsing this will return the number of trpgChildRef node found. … … 303 303 304 304 // THE archive 305 TXPArchive *_archive;305 osg::ref_ptr< TXPArchive > _archive; 306 306 307 307 // Current parent … … 324 324 325 325 // Materials 326 typedef std::map<int,osg::ref_ptr<osg::StateSet> >* MaterialMapType;327 MaterialMapType _materialMap;326 typedef std::map<int,osg::ref_ptr<osg::StateSet> >* MaterialMapType; 327 MaterialMapType _materialMap; 328 328 329 329 // Local materials … … 331 331 332 332 // Model list 333 typedef std::map<int,osg::ref_ptr<osg::Node> > OSGModelsMapType;333 typedef std::map<int,osg::ref_ptr<osg::Node> > OSGModelsMapType; 334 334 OSGModelsMapType* _models; 335 335 … … 384 384 385 385 geomRead(TXPParser *in_parse) : _parse(in_parse) 386 {}386 {} 387 387 void *Parse(trpgToken tok,trpgReadBuffer &buf); 388 388 protected: … … 396 396 public: 397 397 groupRead(TXPParser *in_parse) : _parse(in_parse) 398 {}398 {} 399 399 void *Parse(trpgToken tok,trpgReadBuffer &buf); 400 400 protected: … … 407 407 public: 408 408 attachRead(TXPParser *in_parse) : _parse(in_parse) 409 {}409 {} 410 410 void *Parse(trpgToken tok,trpgReadBuffer &buf); 411 411 protected: … … 456 456 public: 457 457 lodRead(TXPParser *in_parse) : _parse(in_parse) 458 {}458 {} 459 459 void *Parse(trpgToken tok,trpgReadBuffer &buf); 460 460 protected: … … 467 467 public: 468 468 tileHeaderRead(TXPParser *in_parse) : _parse(in_parse) 469 {}469 {} 470 470 void *Parse(trpgToken tok,trpgReadBuffer &buf); 471 471 protected: … … 479 479 public: 480 480 modelRefRead(TXPParser *in_parse) : _parse(in_parse) 481 {}481 {} 482 482 void *Parse(trpgToken tok,trpgReadBuffer &buf); 483 483 protected: … … 490 490 public: 491 491 billboardRead(TXPParser *in_parse) : _parse(in_parse) 492 {}492 {} 493 493 void *Parse(trpgToken tok,trpgReadBuffer &buf); 494 494 protected: … … 501 501 public: 502 502 lightRead(TXPParser *in_parse) : _parse(in_parse) 503 {}503 {} 504 504 void *Parse(trpgToken tok,trpgReadBuffer &buf); 505 505 protected: … … 512 512 public: 513 513 layerRead(TXPParser *in_parse) : _parse(in_parse) 514 {}514 {} 515 515 void *Parse(trpgToken tok,trpgReadBuffer &buf); 516 516 protected: … … 523 523 public: 524 524 labelRead(TXPParser *in_parse) : _parse(in_parse) 525 {}525 {} 526 526 void *Parse(trpgToken tok,trpgReadBuffer &buf); 527 527 protected:
