Changeset 1250 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 08/21/06 17:05:45 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1220 r1250 213 213 virtual bool isEmpty() const = 0; 214 214 virtual bool hasGeometry() const = 0; 215 216 virtual void mergeLeaves(std::set<Leaf *>& leaves) = 0; 215 217 216 218 // Gets this node's parent (NULL if this is the root). … … 223 225 // add contained objects to render queue 224 226 virtual void queueVisibleObjects(unsigned long currentFrame, 225 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes ) = 0;227 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false) = 0; 226 228 227 229 // add contained geometry (Entities) to list … … 326 328 virtual bool hasGeometry() const { return false; }; 327 329 330 virtual void mergeLeaves(std::set<Leaf *>& leaves) 331 { 332 for (std::set<Leaf *>::iterator it = mLeaves.begin(); it != mLeaves.end(); it++) 333 leaves.insert(*it); 334 } 335 328 336 // a branch should have at least one child 329 337 virtual KdTree::Node * getLeftChild() const { return mLeft; }; … … 331 339 332 340 virtual void queueVisibleObjects(unsigned long currentFrame, 333 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes )341 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false) 334 342 { 335 343 if (showBoxes) 336 344 if (mLevel == mOwner->getHiLiteLevel() || mOwner->getShowAllBoxes()) 337 345 queue->addRenderable(getWireBoundingBox()); 346 347 if (fullVis) 348 for (std::set<Leaf *>::iterator it = mLeaves.begin(); it != mLeaves.end(); it ++) 349 (*it)->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, fullVis); 338 350 } 339 351 … … 347 359 mWorldAABB.setNull(); 348 360 361 // merge box & leaves 349 362 if (mLeft) 363 { 350 364 mWorldAABB.merge(mLeft->mWorldAABB); 365 mLeft->mergeLeaves(mLeaves); 366 } 351 367 if (mRight) 368 { 352 369 mWorldAABB.merge(mRight->mWorldAABB); 370 mRight->mergeLeaves(mLeaves); 371 } 353 372 354 373 // update parent recursively … … 361 380 Plane * mSplitPlane; 362 381 PlaneEvent::Side mPlaneSide; 382 protected: 383 std::set<Leaf *> mLeaves; 363 384 }; 364 385 … … 373 394 374 395 // a leaf is a leaf, dammit 375 virtual bool isLeaf() const { return true; } ;396 virtual bool isLeaf() const { return true; } 376 397 377 398 // a leaf is empty when it does not posses renderables 378 virtual bool isEmpty() const { return mKdRenderables.empty(); } ;399 virtual bool isEmpty() const { return mKdRenderables.empty(); } 379 400 380 401 // a leaf has geometry when it has renderables 381 virtual bool hasGeometry() const { return !mKdRenderables.empty(); }; 402 virtual bool hasGeometry() const { return !mKdRenderables.empty(); } 403 404 // a leaf adds itself to the leaf set 405 virtual void mergeLeaves(std::set<Leaf *>& leaves) { leaves.insert(this); } 382 406 383 407 // a leaf never has children … … 386 410 387 411 virtual void queueVisibleObjects(unsigned long currentFrame, 388 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes );412 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false); 389 413 390 414 virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h
r1212 r1250 51 51 // enhanced visibility 52 52 NodeVisibility getVisibilityEnhanced(const AxisAlignedBox& box) const; 53 54 // DEBUG 55 //mutable unsigned int mNumVisQueries; 53 56 protected: 54 57 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
r1211 r1250 1188 1188 bool showBoxes, KdTree::NodeList& visibleNodes) 1189 1189 { 1190 // debug 1191 //cam->mNumVisQueries = 0; 1192 1190 1193 if (mKdRoot) 1191 1194 recQueueVisibleObjects(mKdRoot, Root::getSingleton().getCurrentFrameNumber(), 1192 1195 cam, queue, onlyShadowCasters, showBoxes, visibleNodes); 1196 1197 //mBuildLog->logMessage("Frame # " + StringConverter::toString(Root::getSingleton().getCurrentFrameNumber()) + 1198 // " ," + StringConverter::toString(cam->mNumVisQueries) + " vis queries"); 1193 1199 } 1194 1200 … … 1207 1213 visibleNodes.push_back(node); 1208 1214 1209 node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes); 1210 1211 if (node->getLeftChild()) 1212 recQueueVisibleObjects(node->getLeftChild(), currentFrame, 1213 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 1214 (fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false); 1215 if (node->getRightChild()) 1216 recQueueVisibleObjects(node->getRightChild(), currentFrame, 1217 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 1218 (fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false); 1215 bool v = (fullVis || vis == KdTreeCamera::KDNV_FULL); 1216 node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, v); 1217 1218 if (!v) 1219 { 1220 1221 if (node->getLeftChild()) 1222 recQueueVisibleObjects(node->getLeftChild(), currentFrame, 1223 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v); 1224 if (node->getRightChild()) 1225 recQueueVisibleObjects(node->getRightChild(), currentFrame, 1226 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v); 1227 } 1219 1228 } 1220 1229 } … … 1366 1375 //------------------------------------------------------------------------- 1367 1376 void KdTree::Leaf::queueVisibleObjects(unsigned long currentFrame, 1368 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes )1377 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis) 1369 1378 { 1370 1379 KdRenderableList::iterator it = mKdRenderables.begin(); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp
r1212 r1250 28 28 { 29 29 mEnhancedVisMode = enhanced; 30 //if (mEnhancedVisMode)31 // getVisibility = getVisibilityEnhanced;32 //else33 // getVisibility = getVisibilitySimple;34 30 } 35 31 … … 43 39 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilityEnhanced(const AxisAlignedBox& box) const 44 40 { 41 //++ mNumVisQueries; 45 42 // Null boxes always invisible 46 43 if ( box.isNull() ) … … 101 98 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilitySimple(const AxisAlignedBox& box) const 102 99 { 100 //++ mNumVisQueries; 101 103 102 // dummy 104 103 FrustumPlane* culledBy = 0;
Note: See TracChangeset
for help on using the changeset viewer.