Changeset 3282 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Timestamp:
- 01/16/09 17:32:00 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h
r3274 r3282 88 88 */ 89 89 inline float GetDistance() const; 90 /** Returns id of the first scene entity in the node. 91 */ 92 inline int GetFirstEntity() const; 93 /** Returns id of the last scene entity in the node. 94 */ 95 inline int GetLastEntity() const; 90 96 91 97 … … 505 511 void RenderBoundsForViz(BvhNode *node, RenderState *state, bool useTightBounds); 506 512 507 513 508 514 protected: 509 515 … … 527 533 */ 528 534 void Init(); 535 529 536 530 537 ///////////// … … 844 851 845 852 853 inline int BvhNode::GetFirstEntity() const 854 { 855 return mFirst; 856 } 857 858 859 inline int BvhNode::GetLastEntity() const 860 { 861 return mLast; 862 } 863 864 846 865 inline BvhNode *BvhInterior::GetBack() 847 866 { … … 856 875 857 876 877 878 ////////////////////////////// 879 880 858 881 inline int Bvh::GetNumNodes() const 859 882 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhExporter.cpp
r3279 r3282 59 59 BvhInterior *interior = static_cast<BvhInterior *>(node); 60 60 61 ConstructTriangleRangeMap(bvh, interior->Get Front(), first, m);61 ConstructTriangleRangeMap(bvh, interior->GetBack(), first, m); 62 62 int newFirst = m + 1; 63 ConstructTriangleRangeMap(bvh, interior->Get Back(), newFirst, last);63 ConstructTriangleRangeMap(bvh, interior->GetFront(), newFirst, last); 64 64 65 65 mTriangleRangeMap[node] = pair<int, int>(first, last); … … 69 69 //first = currentIdx; 70 70 last = first + bvh->CountTriangles(node) - 1; 71 //cout << "x " << node->GetFirstEntity() << " " << node->GetLastEntity() << " " << first << " " << last << endl; 71 72 //currentIdx = last; 72 73 73 mTriangleRangeMap[node] = pair<int, int>(first, last); 74 74 } … … 109 109 BvhNode *node = *it; 110 110 111 int f = mTriangleRangeMap[node].first;112 int l = mTriangleRangeMap[node].second;111 const int f = mTriangleRangeMap[node].first; 112 const int l = mTriangleRangeMap[node].second; 113 113 114 114 for (int i = f; i <= l; ++ i) 115 {116 115 triangles.push_back(i); 117 }118 116 } 119 117 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r3269 r3282 140 140 Bvh *bvh = new Bvh(staticEntities, dynamicEntities, maxDepthForTestingChildren); 141 141 142 BvhConstructor bvhConstructor(bvh->mGeometry, 143 0, 142 BvhConstructor bvhConstructor(bvh->mGeometry, 0, 144 143 (int)bvh->mStaticGeometrySize - 1); 145 144 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
r3276 r3282 40 40 if (delData) 41 41 { 42 DEL_ARRAY_PTR(mVertices);42 //DEL_ARRAY_PTR(mVertices); 43 43 DEL_ARRAY_PTR(mNormals); 44 44 DEL_ARRAY_PTR(mTexCoords); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp
r3281 r3282 2 2 #include "ViewCellsTree.h" 3 3 #include "Bvh.h" 4 #include "SceneEntity.h" 4 5 #include <stack> 5 6 … … 120 121 nodes.push_back(n); 121 122 122 if (!n->Is VirtualLeaf())123 if (!n->IsLeaf() && !n->IsVirtualLeaf()) 123 124 { 124 125 BvhInterior *interior = static_cast<BvhInterior *>(n); … … 157 158 ofstream outstream("test.log"); 158 159 160 BvhNode *f = ((BvhInterior *)bvh->GetStaticRoot())->GetFront(); 161 BvhNode *b = ((BvhInterior *)bvh->GetStaticRoot())->GetBack(); 162 163 outstream << "front: " << f->GetFirstEntity() << " " << f->GetLastEntity() << endl; 164 outstream << "back: " << b->GetFirstEntity() << " " << b->GetLastEntity() << endl; 165 159 166 for (size_t i = 0; i < nodes.size(); ++ i) 160 167 { 161 if (nodes[i]->GetId() >= nodes.size()) 162 cout << "id " << nodes[i]->GetId() << endl; 163 164 outstream << "id " << nodes[i]->GetId() << endl; 165 } 166 167 cout << "nodes: " << nodes.size() << endl; 168 169 168 BvhNode *n = nodes[i]; 169 //if (nodes[i]->GetId() >= nodes.size()) cout << "id " << nodes[i]->GetId() << endl; 170 if (n->IsVirtualLeaf()) 171 { 172 int geometrySize; 173 AxisAlignedBox3 box; 174 SceneEntity **ent = bvh->GetGeometry(n, geometrySize); 175 box = SceneEntity::ComputeBoundingBox(ent, geometrySize); 176 177 outstream << n->GetFirstEntity() << " " << n->GetLastEntity() << " " << n->GetBox() << " " << box << endl; 178 179 } 180 } 181 170 182 outstream.close(); 171 183 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3279 r3282 603 603 //LoadModel("sibenik.dem", dynamicObjects); 604 604 605 if ( 1) LoadPompeiiFloor();605 if (0) LoadPompeiiFloor(); 606 606 607 607 #if 0 … … 672 672 673 673 674 //ObjExporter().Export(model_path + "my pompeii.obj", bvh);675 //BvhExporter().Export(model_path + "my pompeii.bv", bvh);674 //ObjExporter().Export(model_path + "mytest.obj", bvh); 675 //BvhExporter().Export(model_path + "mytest.bv", bvh); 676 676 677 677
Note: See TracChangeset
for help on using the changeset viewer.