Changeset 40 for trunk/VUT/OcclusionCullingSceneManager/include
- Timestamp:
- 04/06/05 18:36:40 (20 years ago)
- Location:
- trunk/VUT/OcclusionCullingSceneManager/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h
r39 r40 10 10 11 11 #include "OgrePrerequisites.h" 12 #include "OgreOcclusionCulling SceneTraverser.h"12 #include "OgreOcclusionCullingTerrainSceneTraverser.h" 13 13 //#include "OgreSolidHalfBoundingBox.h" 14 14 … … 16 16 17 17 namespace Ogre { 18 template <typename T> class octreeless19 {20 public:21 myless(Camera *cam) { mCamera = cam; }22 //bool operator() (HierarchyNode *v1, HierarchyNode *v2) const23 bool operator() (T v1, T v2) const24 {25 v1->getCullBounds(&mAabb);26 return mAabb->getSquaredViewDepth(mCamera) > v2->getSquaredViewDepth(mCamera);27 }28 29 private:30 Camera *mCamera;31 AxisAlignedBox mAabb;32 };33 34 18 /** 35 19 Class which implements a scene mangager which uses occlusion queries for culling occluded objects … … 41 25 ~OcclusionCullingTerrainSceneManager(); 42 26 43 //void _renderVisibleObjects(void); 44 //void _findVisibleObjects(Camera* cam, bool onlyShadowCasters); 45 46 //void _updateSceneGraph(Camera* cam); 27 void _renderVisibleObjects(void); 28 void _findVisibleObjects(Camera* cam, bool onlyShadowCasters); 29 void _updateSceneGraph(Camera* cam); 47 30 48 31 /** Sets the given option for the SceneManager … … 62 45 bool getOptionKeys( StringVector &refKeys ); 63 46 47 /** Renders one octant of an octree, i.e., renders current octant 48 node and does not traverse deeper into the tree. 49 @remark Note that OctreeNode instances are NOT part of the octree 50 hierarchy, instead one octant of an Octree contains many OctreeNode instances. 51 @param octree the octree to be rendered 52 @param cam current camera 53 */ 54 void _renderOctant(Camera* cam, Octree *octree); 55 64 56 protected: 65 OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser; 57 //OcclusionCullingTerrainSceneTraverser *mOcclusionCullingTerrainSceneTraverser; 58 OcclusionCullingSceneTraverser *mOcclusionCullingTerrainSceneTraverser; 66 59 }; 67 60 -
trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneTraverser.h
r39 r40 8 8 9 9 namespace Ogre { 10 void Octree::_getCullBounds( AxisAlignedBox *b ) 10 /** 11 This class implements the compare operator for the priority queue 12 especially for octree hierarchies using getCullBounds for bounding 13 box computation. A lower distance has a higher value in the queue. 14 */ 15 template <typename T> class octreeless 16 { 17 public: 18 octreeless(Camera *cam) { mCamera = cam; } 19 20 bool operator() (T v1, T v2) const 21 { 22 AxisAlignedBox box1, box2; 23 v1->_getCullBounds(&box1); 24 v2->_getCullBounds(&box2); 25 26 return getSquaredViewDepth(mCamera, &box1) > getSquaredViewDepth(mCamera, &box2); 27 } 28 29 private: 30 Real getSquaredViewDepth(const Ogre::Camera* cam, const Ogre::AxisAlignedBox* box) const 31 { 32 Vector3 mid = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum(); 33 return (cam->getDerivedPosition() - mid).squaredLength(); 34 } 35 36 Camera *mCamera; 37 //AxisAlignedBox mBox1, mBox2; 38 //Ogre::Vector3 min, max, mid, dist; 39 }; 40 11 41 typedef pair<Octree *, HardwareOcclusionQuery *> OctreeQueryPair; 12 typedef priority_queue<Octree *, vector<Octree *>, myless<vector<Octree *>::value_type> > OctreePriorityQueue;42 typedef priority_queue<Octree *, vector<Octree *>, octreeless<vector<Octree *>::value_type> > OctreePriorityQueue; 13 43 //typedef queue<QueryPair> QueryQueue; 14 44 15 class OcclusionCullingTerrainSceneTraverser: OcclusionCullingSceneTraverser45 class OcclusionCullingTerrainSceneTraverser: public OcclusionCullingSceneTraverser 16 46 { 47 public: 48 OcclusionCullingTerrainSceneTraverser(SceneManager *sm, RenderSystem *rsys); 17 49 void renderScene( Camera *cam, Octree *root ); 50 51 protected: 52 /** Renders the scene with view frustum culling only. */ 18 53 void renderCullFrustum( Camera *cam ); 19 void pullUpVisibility( Octree *node ); 20 void traverseNode( Camera *cam, Octree *node ); 54 /** Renders the scene with the hierarchical stop and wait algorithm. */ 55 void renderStopAndWait( Camera *cam ); 56 /** Renders the scene with the coherent hierarchical algorithm and the query queye. */ 57 void renderCoherentWithQueue( Camera *cam ); 58 /** Issue a occlusion query for this node. */ 59 60 void pullUpVisibility( Octree *octree ); 61 void traverseOctree( Camera *cam, Octree *octree ); 62 void renderOctree( Camera *cam, Octree *octree ); 21 63 22 protected:23 64 OctreePriorityQueue *mDistanceQueue; 24 65 };
Note: See TracChangeset
for help on using the changeset viewer.