Changeset 2772 for GTP/trunk/App/Demos
- Timestamp:
- 06/18/08 18:02:05 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/CHC_revisited
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.h
r2771 r2772 345 345 */ 346 346 virtual ~BvhInterior() { if (mBack) delete mBack; if (mFront) delete mFront;} 347 /** Returns split axis of this interior node.348 */349 //inline int GetAxis() { return (int)mAxis; }350 /** Returns position of the split axis.351 */352 //inline float GetPosition() {return (float)mPosition;}353 347 354 348 355 349 protected: 356 350 357 /// the position of the split plane358 //float mPosition;359 360 351 BvhNode *mBack; 361 352 BvhNode *mFront; -
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.cpp
r2771 r2772 10 10 CHCPlusPlusTraverser::CHCPlusPlusTraverser() 11 11 { 12 } 13 14 15 void CHCPlusPlusTraverser::HandleQueryResult(OcclusionQuery *query) 16 { 17 // wait until result available 18 int visiblePixels = query->GetQueryResult(); 19 20 int visible = visiblePixels > mVisibilityThreshold; 21 22 BvhNode *node = query->GetFrontNode(); 23 24 if (visible) 25 { 26 // node was previously invisible 27 if (!node->IsVisible()) 28 node->SetAssumedVisibleFrameId(mFrameId + mAssumedVisibleFrames); 29 else 30 // randomize first invokation 31 node->SetAssumedVisibleFrameId(mFrameId + Random(mAssumedVisibleFrames + 1)); 32 33 mBvh->MakeParentsVisible(node); 34 TraverseNode(node); 35 } 36 else 37 { 38 ++ mStats.mNumQueryCulledNodes; 39 } 40 41 node->SetVisible(visible); 12 42 } 13 43 … … 35 65 mQueryQueue.pop(); 36 66 37 // wait until result available 38 int visiblePixels = query->GetQueryResult(); 39 40 if (visiblePixels > mVisibilityThreshold) 41 { 42 BvhNode *node = query->GetFrontNode(); 43 44 node->SetVisible(true); 45 mBvh->MakeParentsVisible(node); 46 TraverseNode(node); 47 } 48 else 49 { 50 ++ mStats.mNumQueryCulledNodes; 51 } 67 HandleQueryResult(query); 52 68 } 53 69 … … 78 94 // identify nodes that we cannot skip queries for 79 95 const bool testFeasible = (!wasVisible || (node->IsVirtualLeaf() && (node->GetAssumedVisibleFrameId() <= mFrameId))); 80 81 96 82 97 // update node's visited flag … … 86 101 if (testFeasible) 87 102 { 88 // reset node's visibility classification89 node->SetVisible(false);90 91 103 if (!wasVisible) 92 104 { … … 129 141 } 130 142 143 131 144 ////////////// 132 145 //-- issue remaining previously visible node queries … … 146 159 mQueryQueue.pop(); 147 160 148 // wait until result available 149 int visiblePixels = query->GetQueryResult(); 150 151 if (visiblePixels > mVisibilityThreshold) 152 { 153 BvhNode *node = query->GetFrontNode(); 154 155 node->SetVisible(true); 156 mBvh->MakeParentsVisible(node); 157 } 158 else 159 { 160 ++ mStats.mNumQueryCulledNodes; 161 } 161 HandleQueryResult(query); 162 162 } 163 163 } -
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.h
r2771 r2772 26 26 27 27 void IssueMultiQueries(); 28 /** Handles the result of an occlusion query. 29 */ 30 void HandleQueryResult(OcclusionQuery *query); 28 31 29 32 -
GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h
r2765 r2772 31 31 32 32 unsigned int GetQueryId() const; 33 /** Returns the first added node.33 /** Returns the first node of the multiquery 34 34 */ 35 35 inline BvhNode *GetFrontNode() const { return mNodes[0]; } … … 40 40 */ 41 41 inline void AddNode(BvhNode *node) { mNodes.push_back(node); } 42 /** Convenience method that sets up a single node query. 43 */ 44 inline void SetNode(BvhNode *node) { Reset(); AddNode(node); } 42 45 43 46 44 47 protected: 45 48 … … 47 50 48 51 49 /////// /////52 /////// 50 53 //-- members 51 54 52 float mPFail;55 //float mPFail; 53 56 /// all nodes that are tested with the same query 54 57 BvhNodeContainer mNodes; 55 58 // the query associated with this test 56 59 unsigned int mQueryId; 57 /// type of the query58 bool mIsVisibleQuery;59 60 }; 60 61 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp
r2771 r2772 128 128 129 129 OcclusionQuery *query = mQueryHandler.RequestQuery(); 130 query->Reset(); 131 query-> AddNode(node);130 131 query->SetNode(node); 132 132 133 133 query->BeginQuery(); 134 134 135 135 if (wasVisible) 136 {137 node->SetAssumedVisibleFrameId(mFrameId + 10);138 136 ++ mStats.mNumPreviouslyVisibleNodeQueries; 139 }140 137 141 138 // if this node is a previous visible leaf: -
GTP/trunk/App/Demos/Vis/CHC_revisited/common.cpp
r2764 r2772 59 59 60 60 61 void Randomize( constunsigned int seed)61 void Randomize(unsigned int seed) 62 62 { 63 63 srand(seed);
Note: See TracChangeset
for help on using the changeset viewer.