root/OpenSceneGraph/trunk/src/osgPlugins/txp/TXPNode.h
@
8437
| Revision 8437, 3.4 kB (checked in by robert, 5 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | // -*-c++-*- |
| 2 | /*************************************************************************** |
| 3 | * December 2003 |
| 4 | * |
| 5 | * This TerraPage loader was re-written in a fashion to use PagedLOD |
| 6 | * to manage paging entirely, also includes a version of Terrex's smart mesh |
| 7 | * adapted to work with PagedLOD. The essential code by Boris Bralo is still present, |
| 8 | * slight modified. |
| 9 | * nick at terrex dot com |
| 10 | * |
| 11 | * Ported to PagedLOD technology by Trajce Nikolov (Nick) & Robert Osfield |
| 12 | *****************************************************************************/ |
| 13 | |
| 14 | /*************************************************************************** |
| 15 | * OpenSceneGraph loader for Terrapage format database |
| 16 | * by Boris Bralo 2002 |
| 17 | * |
| 18 | * based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh |
| 19 | * |
| 20 | * This loader is based on/modified from Terrain Experts Performer Loader, |
| 21 | * and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net |
| 22 | * |
| 23 | * That loader is redistributed under the terms listed on Terrain Experts |
| 24 | * website (www.terrex.com/www/pages/technology/technologypage.htm) |
| 25 | * |
| 26 | * "TerraPage is provided as an Open Source format for use by anyone... |
| 27 | * We supply the TerraPage C++ source code free of charge. Anyone |
| 28 | * can use it and redistribute it as needed (including our competitors). |
| 29 | * We do, however, ask that you keep the TERREX copyrights intact." |
| 30 | * |
| 31 | * Copyright Terrain Experts Inc. 1999. |
| 32 | * All Rights Reserved. |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | #ifndef __TXPNODE_H_ |
| 36 | #define __TXPNODE_H_ |
| 37 | |
| 38 | #include <osg/Group> |
| 39 | #include <osg/NodeVisitor> |
| 40 | #include <osg/NodeCallback> |
| 41 | #include <osg/ref_ptr> |
| 42 | |
| 43 | #include "TXPArchive.h" |
| 44 | #include "TXPPageManager.h" |
| 45 | |
| 46 | namespace txp |
| 47 | { |
| 48 | |
| 49 | class TXPNode : public osg::Group |
| 50 | { |
| 51 | public: |
| 52 | |
| 53 | TXPNode(); |
| 54 | |
| 55 | /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ |
| 56 | TXPNode(const TXPNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); |
| 57 | |
| 58 | META_Node(txp, TXPNode); |
| 59 | |
| 60 | virtual void traverse(osg::NodeVisitor& nv); |
| 61 | |
| 62 | void setArchiveName(const std::string& archiveName); |
| 63 | void setOptions(const std::string& options); |
| 64 | |
| 65 | const std::string& getOptions() const; |
| 66 | const std::string& getArchiveName() const; |
| 67 | |
| 68 | //modified by Brad Anderegg on May-27-08 |
| 69 | //because the TXPArchives are kept in an std::map and referenced later |
| 70 | //we do not want to create a new one, so we pass it in. |
| 71 | //If NULL is passed into loadArchive it will do the same thing it used to. |
| 72 | bool loadArchive(TXPArchive*); |
| 73 | |
| 74 | TXPArchive* getArchive(); |
| 75 | |
| 76 | void setArchive( TXPArchive* archive ) |
| 77 | { |
| 78 | _archive = archive; |
| 79 | } |
| 80 | |
| 81 | virtual osg::BoundingSphere computeBound() const; |
| 82 | |
| 83 | protected: |
| 84 | |
| 85 | virtual ~TXPNode(); |
| 86 | |
| 87 | void updateEye(osg::NodeVisitor& nv); |
| 88 | void updateSceneGraph(); |
| 89 | |
| 90 | // Create a page lod for lod 0 with givin grid location (x,y) |
| 91 | osg::Node* addPagedLODTile(int x, int y); |
| 92 | |
| 93 | std::string _archiveName; |
| 94 | std::string _options; |
| 95 | |
| 96 | OpenThreads::Mutex _mutex; |
| 97 | |
| 98 | osg::ref_ptr<TXPArchive> _archive; |
| 99 | osg::ref_ptr<TXPPageManager> _pageManager; |
| 100 | |
| 101 | double _originX; |
| 102 | double _originY; |
| 103 | osg::BoundingBox _extents; |
| 104 | |
| 105 | std::vector<osg::Node*> _nodesToAdd; |
| 106 | std::vector<osg::Node*> _nodesToRemove; |
| 107 | |
| 108 | }; |
| 109 | |
| 110 | |
| 111 | } // namespace |
| 112 | |
| 113 | #endif // __TXPNODE_H_ |
Note: See TracBrowser
for help on using the browser.
