Changeset 1182 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include
- Timestamp:
- 08/03/06 17:25:01 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1177 r1182 276 276 /** Returns real extent of the kdtree, i.e., the merged extent of the bounding boxes. 277 277 */ 278 AxisAlignedBox _getWorldAABB(void) const { return m WorldAABB; };278 AxisAlignedBox _getWorldAABB(void) const { return mAABB; }; 279 279 /** Updates bound of the real aabb of kdtree 280 280 */ … … 424 424 friend class KdTreeHierarchyInterface; 425 425 426 typedef KdTree::Node * NodePtr; 427 typedef KdTree::Branch * BranchPtr; 426 428 typedef KdTree::Leaf * LeafPtr; 427 429 typedef std::set<LeafPtr> LeafSet; 430 431 typedef struct Stats_ 432 { 433 unsigned int mNumNodes; 434 unsigned int mNumLeaves; 435 unsigned int mNumSceneNodes; 436 437 void clear(void) 438 { 439 mNumNodes = 0; 440 mNumLeaves = 0; 441 mNumSceneNodes = 0; 442 }; 443 } Stats; 428 444 429 445 enum RenderMethod … … 446 462 447 463 // DEBUG 448 void dump(); 449 void calcCost(); 464 void dump(void); 465 Real calcCost(void); 466 467 NodePtr getRoot(void) const { return mKdRoot; }; 450 468 451 469 // insert a new scene node into an existing kd-tree … … 461 479 462 480 // self-explanatory ... 463 int getMaxDepth() { return mMaxDepth; }; 464 AxisAlignedBox getBox() { if (mKdRoot) return mKdRoot->mAABB; else return AxisAlignedBox(); }; 481 int getMaxDepth(void) { return mMaxDepth; }; 482 Stats getStats(void) const { return mStats; }; 483 AxisAlignedBox getBox(void) { if (mKdRoot) return mKdRoot->mAABB; else return AxisAlignedBox(); }; 465 484 void setBuildMethod(BuildMethod bm) { mBuildMethod = bm; } 466 485 protected: … … 501 520 Log * mBuildLog; 502 521 522 // statistical information 523 Stats mStats; 524 503 525 // DEBUG 504 526 void KdTree::dump(KdTree::Node * node); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h
r1177 r1182 32 32 virtual const String& getTypeName(void) const; 33 33 34 35 /************************************************************************/ 36 /* Functions overridden form SceneManager for KdTree */ 37 /************************************************************************/ 38 34 39 /** Override from SceneManager to create SceneNodes as instance of KdTreeSceneNode 35 40 */ … … 39 44 virtual SceneNode* createSceneNode(const String& name); 40 45 46 /** Override from Scenemanager, employ kd-tree based culling or CHC 47 */ 48 virtual void _findVisibleObjects(Camera *cam, bool onlyShadowCasters); 49 50 virtual bool setOption(const String& strKey, const void* pValue); 51 virtual bool getOption(const String& strKey, void* pDestValue); 52 53 bool getOptionValues(const String & key, StringVector &refValueList); 54 bool getOptionKeys(StringVector &refKeys); 55 56 /** Overide from scene manager to destroy kdtree properly (before the scene graph is destroyed) 57 */ 58 virtual void clearScene() 59 { 60 // DEBUG 61 //if (mKdTree) 62 // mKdTree->dump(); 63 64 // must happen before actual scene is cleared 65 OGRE_DELETE(mKdTree); 66 67 SceneManager::clearScene(); 68 } 69 70 /************************************************************************/ 71 /* Functions overridden from SceneManager for CHC */ 72 /************************************************************************/ 73 41 74 /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 42 75 */ 43 76 Entity* createEntity(const String& entityName, const String& meshName); 44 77 78 /** Override from scene manager to set up culling manager 79 */ 80 virtual void _updateSceneGraph(Camera* cam); 81 82 /** Override from SceneManager, employ normal rendering or CHC 83 */ 84 virtual void _renderVisibleObjects(); 85 86 /** Override pass so we can do the z-fail pass. 87 */ 88 const Pass* _setPass(Pass* pass); 89 90 /** Render a queue group. 91 Override so we can handle delayed rendering of transparent objects 92 */ 93 void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 94 QueuedRenderableCollection::OrganisationMode om); 95 96 /** Override from scene manager 97 */ 98 void _renderQueueGroupObjects(RenderQueueGroup* pGroup, 99 QueuedRenderableCollection::OrganisationMode om); 100 101 /** Override from SceneManager so we can skip all but first pass for depth pass. 102 */ 103 bool validatePassForRendering(Pass* pass); 104 105 /** Override from SceneManager because idontknow 106 */ 107 void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 108 QueuedRenderableCollection::OrganisationMode om); 109 void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 110 QueuedRenderableCollection::OrganisationMode om); 111 112 113 /************************************************************************/ 114 /* Functions which are specific to the KdTree */ 115 /************************************************************************/ 116 45 117 /** Update the KdTree with the node (more or less disabled now) 46 118 */ 47 119 virtual void _updateNode(KdTreeSceneNode *node); // TODO: 48 120 49 /** Override from scene manager to st up culling manager 50 */ 51 virtual void _updateSceneGraph(Camera* cam); 52 /** Override from Scenemanager, employ kd-tree based culling 53 or CHC 54 */ 55 virtual void _findVisibleObjects(Camera *cam, bool onlyShadowCasters); 56 //virtual void _renderVisibleObjects(); 121 /** Show or hide the bounding boxes of KdTree nodes - obsolete, use options 122 */ 123 virtual void setShowBoxes(bool showboxes); 124 /** Tell if show boxes is enabled - obsolete, use options 125 */ 126 virtual bool getShowBoxes(void) const; 127 128 /************************************************************************/ 129 /* Functions for CHC */ 130 /************************************************************************/ 57 131 58 132 /** Render a list of scenenodes … … 61 135 bool onlyShadowCasters, int leavePassesInQueue); 62 136 63 virtual void setShowBoxes(bool showboxes);64 virtual bool getShowBoxes(void) const;65 66 virtual bool setOption(const String& strKey, const void* pValue);67 virtual bool getOption(const String& strKey, void* pDestValue);68 69 bool getOptionValues(const String & key, StringVector &refValueList);70 bool getOptionKeys(StringVector &refKeys);71 72 137 /** Sets the visibility manager. 73 138 @param visManager the visibility manager … … 86 151 KdTreeHierarchyInterface *GetHierarchyInterface(); 87 152 88 89 ///** Render a queue group. 90 //Override so we can handle delayed rendering of transparent objects 91 //*/ 92 //void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 93 // QueuedRenderableCollection::OrganisationMode om); 94 95 ///** Writes out stats into the Ogre log file. 96 //*/ 97 //void WriteLog(); 98 99 ///** Override pass so we can do the z-fail pass. 100 //*/ 101 //const Pass* _setPass(Pass* pass); 102 103 ///** Override from SceneManager so we can skip all but first pass for depth pass. 104 //*/ 105 //bool validatePassForRendering(Pass* pass); 106 107 virtual void clearScene() 108 { 109 // DEBUG must happen before scene is cleared 110 // might be a solution to detach problem 111 //if (mKdTree) 112 // mKdTree->dump(); 113 114 OGRE_DELETE(mKdTree); 115 116 SceneManager::clearScene(); 117 } 153 /** Creates material for depth pass, e.g., a pass that only fills the depth buffer. 154 */ 155 void InitDepthPass(); 156 /** Creates material for item buffer. 157 */ 158 void InitItemBufferPass(); 159 /** Fills render queue so that a visualization can be rendered. 160 */ 161 void PrepareVisualization(Camera *cam); 162 /** Initialises necessary parameters for hierarchical visibility culling. 163 */ 164 void InitVisibilityCulling(Camera *cam); 165 166 /** Writes out stats into the Ogre log file. 167 */ 168 void WriteLog(); 169 170 118 171 119 172 protected: 173 /************************************************************************/ 174 /* CHC-specific options & members */ 175 /************************************************************************/ 176 // pointer to the visibility manager 120 177 GtpVisibility::VisibilityManager *mVisibilityManager; 121 178 179 // the hierarchy interface for CHC 122 180 KdTreeHierarchyInterface *mHierarchyInterface; 123 181 124 /// consecutive number for sub-entities 182 // if hierarchical culling is currently in use 183 bool mIsHierarchicalCulling; 184 185 // if a visualization of the hierarchical culling is shown 186 bool mShowVisualization; 187 188 // if the culled nodes are indicated in the visualization 189 bool mVisualizeCulledNodes; 190 191 // consecutive number for sub-entities 125 192 int mCurrentEntityId; 126 193 127 // /flag for passes which should not be deleted from queue during first traversal194 // flag for passes which should not be deleted from queue during first traversal 128 195 int mLeavePassesInQueue; 196 197 // if symbols for the nodes are shown in the visualization 198 bool mRenderNodesForViz; 199 // if content of the nodes is shown in the visualization 200 bool mRenderNodesContentForViz; 201 /// render transparents after the hierarchical traversal 202 bool mDelayRenderTransparents; 129 203 204 // if transparent object are considered for item buffer visibility 205 bool mRenderTransparentsForItemBuffer; 206 // Always execute the vertex program of a pass, e.g., for the depth pass or item buffer 207 bool mExecuteVertexProgramForAllPasses; 208 209 // the depth pass (no lighting, just filling the depth buffer) 210 Pass *mDepthPass; 211 // use a depth pass (i.e., fill only the depth buffer in the first pass) 212 bool mUseDepthPass; 213 // flag indicating if we currently render the depth pass 214 bool mIsDepthPassPhase; 215 // if depth write should be enabled 216 bool mEnableDepthWrite; 217 // if transparents are skipped during rendering 218 bool mSkipTransparents; 219 220 // the item buffer pass (render items color-coded) 221 Pass *mItemBufferPass; 222 // if we use an item buffer for rendering (i.e., object ids as color codes 223 bool mUseItemBuffer; 224 // if we currently render the item buffer 225 bool mIsItemBufferPhase; 226 227 /************************************************************************/ 228 /* Kd-Tree specific options & members */ 229 /************************************************************************/ 230 // maximum depth of the kdtree 130 231 int mMaxDepth; 131 232 233 // the kdtree which holds the scene 132 234 KdTree *mKdTree; 133 235 236 // if bounding boxes of kdtree nodes are shown 134 237 bool mShowBoxes; 135 238 239 // the method/algorithm used when rendering the scene 136 240 KdTree::RenderMethod mRenderMethod; 137 241 242 // the method of building the tree 138 243 KdTree::BuildMethod mBuildMethod; 139 244 #ifdef KDTREE_DEBUG 245 // bounding boxes of kd nodes will be highlighted on this level of the kd tree 140 246 int mHighlighLevel; 247 // if all bounding boxes shall be displayed, not only the highlighted level 141 248 bool mShowAllBoxes; 142 249 #endif
Note: See TracChangeset
for help on using the changeset viewer.