Changeset 2558 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/22/07 18:19:15 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformHierarchyInterface.h
r2555 r2558 146 146 virtual void TraverseNode2(GtpVisibility::HierarchyNode *node) {}; 147 147 148 virtual GtpVisibility::OcclusionQuery *IssueMultiQuery( 149 const GtpVisibility::HierarchyNodeContainer &nodes); 150 148 151 protected: 149 152 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityPredictor.h
r2557 r2558 15 15 { 16 16 public: 17 17 18 VisibilityPredictor(); 19 18 20 void HandleProbablyVisibleObjects(GtpVisibilityPreprocessor::ViewCell *vc); 19 21 void UpdateVisibility(GtpVisibilityPreprocessor::ViewCell *vc); 20 22 21 VisibilityPredictor(); 23 void IssueMultiQuery(const vector<Entity *> &mEntities); 24 22 25 23 26 protected: 24 27 25 GtpVisibility::HierarchyNodeContainer m NodeBuffer;28 GtpVisibility::HierarchyNodeContainer mEntityBuffer; 26 29 }; 27 30 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp
r2556 r2558 302 302 return mTestGeometryBounds; 303 303 } 304 //----------------------------------------------------------------------- 305 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueMultiQuery( 306 const GtpVisibility::HierarchyNodeContainer &nodes) 307 { 308 // get next available test id 309 GtpVisibility::OcclusionQuery *query = GetNextOcclusionQuery(); 310 311 //-- the actual query test 312 query->BeginQuery(); 313 314 GtpVisibility::HierarchyNodeContainer::const_iterator nit, nit_end = nodes.end(); 315 316 mIsBoundingBoxQuery = true; 317 318 for (nit = nodes.begin(); nit != nodes.end(); ++ nit) 319 { 320 // this information is used e.g., by the scene graph, because the bounding box 321 // must be treated differently to the scene geometry during rendering 322 RenderBoundingBox(GetBoundingBox(*nit)); 323 } 324 325 mIsBoundingBoxQuery = false; 326 327 query->EndQuery(); 328 329 return query; 330 } 304 331 305 332 } // namespace Ogre -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityPredictor.cpp
r2557 r2558 9 9 namespace Ogre 10 10 { 11 struct EntityQuery 12 { 13 GtpVisibility::OcclusionQuery *mQuery; 14 vector<Entity *> mEntities; 15 }; 16 17 typedef std::queue<EntityQuery> EntityQueryQueue; 18 11 19 VisibilityPredictor::VisibilityPredictor() 12 20 { … … 15 23 void VisibilityPredictor::HandleProbablyVisibleObjects(GtpVisibilityPreprocessor::ViewCell *vc) 16 24 { 17 GtpVisibility::QueryQueue queryQueue;18 GtpVisibility::HierarchyNodeContainer invisibleNodes;25 EntityQueryQueue queryQueue; 26 vector<Entity *> invisibleEntities; 19 27 20 28 // use multiqueries for the objects that are probably invisible … … 37 45 { 38 46 // collect entities for multiqueries 39 //invisibleNodes.push_back(node);47 invisibleEntities.push_back(*eit); 40 48 41 if ((int)invisible Nodes.size() >= maxInvisibleNodesSize)49 if ((int)invisibleEntities.size() >= maxInvisibleNodesSize) 42 50 { 43 51 // issue the batched queries 44 //IssueBatchedQuery(invisibleNodes); 52 IssueMultiQuery(invisibleEntities); 53 invisibleEntities.clear(); 45 54 } 46 55 } … … 52 61 53 62 // fetch multiquery result 54 queryQueue.front(). second->GetQueryResult(visiblePixels, false);63 queryQueue.front().mQuery->GetQueryResult(visiblePixels, false); 55 64 56 // collect nodes assoziated with current multiquery 57 GtpVisibility::HierarchyNode *node = queryQueue.front().first; 65 size_t n = queryQueue.front().mEntities.size(); 58 66 59 67 // tested visible 60 68 if (visiblePixels > 0) 61 69 { 62 // render nodes 63 64 // we have to store and test individual nodes later 65 mNodeBuffer.push_back(node); 70 // render nodes assoziated with current multiquery 71 for (size_t i = 0; i < n; ++ i) 72 { 73 Entity *ent = queryQueue.front().mEntities[i]; 74 // render entity 75 76 // we have to store the entity and test it individually later 77 mEntityBuffer.push_back(ent); 78 } 66 79 } 67 80 … … 73 86 void VisibilityPredictor::UpdateVisibility(GtpVisibilityPreprocessor::ViewCell *vc) 74 87 { 75 GtpVisibility::HierarchyNodeContainer::const_iterator nit, nit_end = m NodeBuffer.end();88 GtpVisibility::HierarchyNodeContainer::const_iterator nit, nit_end = mEntityBuffer.end(); 76 89 77 90 // test individual nodes 78 for (nit = m NodeBuffer.begin(); nit != nit_end; ++ nit)91 for (nit = mEntityBuffer.begin(); nit != nit_end; ++ nit) 79 92 { 80 93 … … 82 95 83 96 // fetch query results, update PVS of view cell 84 for (nit = m NodeBuffer.begin(); nit != nit_end; ++ nit)97 for (nit = mEntityBuffer.begin(); nit != nit_end; ++ nit) 85 98 { 86 99 87 100 } 88 101 89 mNodeBuffer.clear(); 102 mEntityBuffer.clear(); 103 } 104 105 106 void VisibilityPredictor::IssueMultiQuery(const vector<Entity *> &mEntities) 107 { 90 108 } 91 109 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h
r2555 r2558 21 21 22 22 typedef std::vector<HierarchyNode *> HierarchyNodeContainer; 23 24 25 class MultiQuery 26 { 27 OcclusionQuery *mQuery; 28 HierarchyNodeContainer *mNodes; 29 }; 30 23 31 24 32
Note: See TracChangeset
for help on using the changeset viewer.