Changeset 3274 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Timestamp:
- 01/13/09 16:40:27 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3271 r3274 355 355 356 356 357 int Bvh::CountNumVirtualNodes(BvhNode *node) const 358 { 359 int numNodes = 0; 360 361 stack<BvhNode *> tStack; 362 363 tStack.push(node); 364 365 while (!tStack.empty()) 366 { 367 BvhNode *node = tStack.top(); 368 tStack.pop(); 369 370 ++ numNodes; 371 372 if (!node->IsVirtualLeaf()) 373 { 374 BvhInterior *interior = static_cast<BvhInterior *>(node); 375 376 tStack.push(interior->mFront); 377 tStack.push(interior->mBack); 378 } 379 } 380 381 return numNodes; 382 } 383 384 357 385 void Bvh::CollectNodes(BvhNode *node, BvhNodeContainer &nodes) 358 386 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h
r3267 r3274 359 359 */ 360 360 inline int GetNumNodes() const; 361 /** Counts the number of bvh nodes under this node361 /** Counts the number of nodes in this subtree 362 362 */ 363 363 int CountNumNodes(BvhNode *node) const; 364 /** Counts the number of virtual nodes in this subtree 365 */ 366 int CountNumVirtualNodes(BvhNode *node) const; 367 364 368 /** Returns number of bvh leaves. 365 369 */ -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhExporter.cpp
r3273 r3274 22 22 int buffer[4]; 23 23 24 if (node->Is Leaf())24 if (node->IsVirtualLeaf()) 25 25 { 26 26 BvhLeaf *leaf = (BvhLeaf*)node; … … 55 55 int &last) 56 56 { 57 if (!node->Is Leaf())57 if (!node->IsVirtualLeaf()) 58 58 { 59 59 int m; … … 94 94 buffer[3] = 0; // construction method 95 95 buffer[4] = 1; // termination leaves 96 buffer[5] = bvh->CountNum Nodes(bvh->GetStaticRoot());96 buffer[5] = bvh->CountNumVirtualNodes(bvh->GetStaticRoot()); 97 97 98 98 int first = 0, last; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
r3259 r3274 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/ObjExporter.cpp
r3273 r3274 3 3 #include "Shape.h" 4 4 #include "Geometry.h" 5 #include "Transform3.h" 5 6 6 7 … … 20 21 21 22 22 int ObjExporter::WriteGeometry(Geometry *geom, ofstream &ostream )23 int ObjExporter::WriteGeometry(Geometry *geom, ofstream &ostream, Transform3 *trafo) 23 24 { 24 25 int numVertices; … … 30 31 for (int i = 0; i < numVertices; ++ i) 31 32 { 32 Vector3 v = vertices[i]; 33 Vector3 v = trafo->GetMatrix() * vertices[i]; 34 33 35 sprintf(str, "v %f %f %f\n", v.x, v.z, -v.y); 34 36 ostream << str; … … 75 77 for (int i = 0; i < geometrySize; ++ i) 76 78 { 79 Transform3 *trafo = entities[i]->GetTransform(); 80 77 81 ShapeContainer::iterator sit, send; 78 82 entities[i]->GetLODLevel(0, sit, send); … … 89 93 } 90 94 91 numVertices += WriteGeometry(geom, ostream );95 numVertices += WriteGeometry(geom, ostream, trafo); 92 96 } 93 97 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ObjExporter.h
r3261 r3274 21 21 public: 22 22 23 int WriteGeometry(Geometry *geom, std::ofstream &ostream );23 int WriteGeometry(Geometry *geom, std::ofstream &ostream, Transform3 *trafo); 24 24 }; 25 25 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3272 r3274 382 382 } 383 383 384 //const bool delGeometry = true;385 const bool delGeometry = false;384 const bool delGeometry = true; 385 //const bool delGeometry = false; 386 386 return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, NULL);//tangents); 387 387 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3273 r3274 600 600 AxisAlignedBox3 pompeiiBox = SceneEntity::ComputeBoundingBox(staticObjects); 601 601 602 cout << "here34 " << pompeiiBox << endl; 603 604 #if 0 602 #if 1 605 603 // todo: dispose texture 606 604 Texture *floorTex = new Texture(model_path + "stairs.c.01.tif"); … … 726 724 727 725 728 ObjExporter().Export(model_path + "my vienna.obj", bvh);729 BvhExporter().Export(model_path + "my vienna.bv", bvh);726 ObjExporter().Export(model_path + "mypompeii.obj", bvh); 727 BvhExporter().Export(model_path + "mypompeii.bv", bvh); 730 728 731 729
Note: See TracChangeset
for help on using the changeset viewer.