Changeset 1195 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include
- Timestamp:
- 08/10/06 17:08:57 (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/OgreKdRenderable.h
r1173 r1195 12 12 13 13 #include "OgreKdTree.h" 14 #include "HierarchyInterface.h"15 14 16 15 namespace Ogre -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1192 r1195 27 27 #include <stack> 28 28 29 #include "HierarchyInterface.h" 29 30 30 31 … … 210 211 211 212 // Gets this node's parent (NULL if this is the root). 212 Node *getParent(void) const { return mParent; }; 213 // Gets the nodes left & right child nodes, or NULL if not present 214 // or node is leaf 215 virtual Node *getLeftChild(void) const = 0; 216 virtual Node *getRightChild(void) const = 0; 217 218 // returns the level the node is on 219 int getLevel(void) const { return mLevel; }; 220 213 KdTree::Node *getParent(void) const { return mParent; }; 214 215 // Gets the nodes left & right child nodes, or NULL if not present or node is leaf 216 virtual KdTree::Node *getLeftChild(void) const = 0; 217 virtual KdTree::Node *getRightChild(void) const = 0; 218 219 // add contained objects to render queue 221 220 virtual void queueVisibleObjects(unsigned long currentFrame, 222 221 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes) = 0; 222 223 // add contained geometry (Entities) to list 224 virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList) = 0; 223 225 226 // create (when necessary), setup and return wire bounding box representing the node 224 227 WireBoundingBox * getWireBoundingBox() 225 228 { … … 238 241 239 242 return mWBB; 240 241 243 } 244 245 // returns the level the node is on 246 int getLevel(void) const { return mLevel; }; 242 247 243 248 // functions for the CHC hierarchy interface … … 270 275 */ 271 276 virtual void _updateBounds(bool recurse = true) = 0; 272 277 278 /** bounding box of the node**/ 273 279 AxisAlignedBox mAABB; 274 280 275 // for the CHC hierarchy interface 276 /** the real extent of the node. */ 281 /** mounding box of all objects inside the node */ 277 282 AxisAlignedBox mWorldAABB; 278 283 protected: … … 283 288 WireBoundingBox * mWBB; 284 289 290 // for the CHC hierarchy interface 285 291 unsigned int mLastRendered; 286 292 unsigned int mLastVisited; … … 317 323 318 324 // a branch should have at least one child 319 virtual Node * getLeftChild() const { return mLeft; };320 virtual Node * getRightChild() const { return mRight; };325 virtual KdTree::Node * getLeftChild() const { return mLeft; }; 326 virtual KdTree::Node * getRightChild() const { return mRight; }; 321 327 322 328 virtual void queueVisibleObjects(unsigned long currentFrame, … … 327 333 queue->addRenderable(getWireBoundingBox()); 328 334 } 335 336 // a branch has no geometry, do nothing 337 virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList) { } 329 338 330 339 // branches do not posses geometry => just merge child aabbs … … 369 378 370 379 // a leaf never has children 371 virtual Node * getLeftChild() const { return 0; };372 virtual Node * getRightChild() const { return 0; };380 virtual KdTree::Node * getLeftChild() const { return 0; }; 381 virtual KdTree::Node * getRightChild() const { return 0; }; 373 382 374 383 virtual void queueVisibleObjects(unsigned long currentFrame, 375 384 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes); 376 385 386 virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList); 387 377 388 // update the world aabb based on the contained geometry 378 389 virtual void _updateBounds(bool recurse = true); … … 394 405 struct SplitCandidate 395 406 { 396 SplitCandidate(PlaneEventList * e, int n, AxisAlignedBox& a, KdTree::Branch * p, Real c, Real d, SplitInfo * b, PlaneEvent::Side s): 397 events(e), nObjects(n), aabb(a), parent(p), cost(c), decrease(d), best(b), side(s) { }; 407 SplitCandidate(PlaneEventList * e, int n, AxisAlignedBox& a, 408 KdTree::Branch * p, Real c, Real d, SplitInfo * b, PlaneEvent::Side s): 409 events(e), nObjects(n), aabb(a), parent(p), cost(c), decrease(d), best(b), side(s) 410 { }; 398 411 399 412 bool operator < (const SplitCandidate& rhs) const … … 504 517 505 518 // test visibility of objects and add to render queue 506 void queueVisibleObjects(Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes = false); 519 void queueVisibleObjects(Camera* cam, RenderQueue* queue, bool onlyShadowCasters, 520 bool showBoxes, KdTree::NodeList& visibleNodes); 521 522 // find visible nodes & place in list 523 //void findVisibleNodes(NodeList& visibleNodes, Camera * cam); 507 524 508 525 // self-explanatory ... … … 536 553 537 554 // recursive rendering function 538 void recQueueVisibleObjects(KdTree::Node * node, unsigned long currentFrame, 539 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes); 555 void recQueueVisibleObjects(KdTree::Node * node, unsigned long currentFrame, Camera* cam, 556 RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, KdTree::NodeList& visibleNodes); 557 558 // recursively find visible nodes 559 //void recFindVisibleNodes(KdTree::Node * node, NodeList& visibleNodes, Camera * cam); 540 560 541 561 // the root node of the kdtree
Note: See TracChangeset
for help on using the changeset viewer.