Changeset 3272 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Timestamp:
- 01/13/09 10:43:20 (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/BvhExporter.cpp
r3261 r3272 61 61 62 62 ConstructTriangleRangeMap(bvh, interior->GetFront(), first, m); 63 ConstructTriangleRangeMap(bvh, interior->GetBack(), m, last); 63 int newFirst = m + 1; 64 ConstructTriangleRangeMap(bvh, interior->GetBack(), newFirst, last); 64 65 65 66 mTriangleRangeMap[node] = pair<int, int>(first, last); … … 68 69 { 69 70 //first = currentIdx; 70 last = first + bvh->CountTriangles(node) ;71 last = first + bvh->CountTriangles(node) - 1; 71 72 //currentIdx = last; 72 73 … … 91 92 buffer[0] = MAGIC; 92 93 buffer[1] = BVH_VERSION * 1000; 93 //buffer[2] = triangles.size();94 94 buffer[3] = 0; // construction method 95 95 buffer[4] = 1; // termination leaves 96 96 buffer[5] = bvh->CountNumNodes(bvh->GetStaticRoot()); 97 97 98 fwrite(buffer, sizeof(int), 6, fw); 99 100 int first, last; 98 int first = 0, last; 101 99 ConstructTriangleRangeMap(bvh, bvh->GetStaticRoot(), first, last); 102 100 103 Bvh NodeContainer nodes;104 bvh->Collect Nodes(bvh->GetStaticRoot(), nodes);101 BvhLeafContainer nodes; 102 bvh->CollectLeaves(bvh->GetStaticRoot(), nodes); 105 103 106 104 vector<int> triangles; 107 105 108 Bvh NodeContainer::const_iterator it, it_end = nodes.end();106 BvhLeafContainer::const_iterator it, it_end = nodes.end(); 109 107 110 108 for (it = nodes.begin(); it != it_end; ++ it) … … 113 111 114 112 int f = mTriangleRangeMap[node].first; 115 int b= mTriangleRangeMap[node].second;113 int l = mTriangleRangeMap[node].second; 116 114 117 for (int i = f; i < b; ++ i)115 for (int i = f; i <= l; ++ i) 118 116 { 119 117 triangles.push_back(i); … … 121 119 } 122 120 121 buffer[2] = (int)triangles.size(); 122 fwrite(buffer, sizeof(int), 6, fw); 123 123 124 cout << "writing " << (int)triangles.size() << " triangle ids ..." << endl; 124 125 125 126 // export sorted triangle IDs 126 for ( int i = 0; i < (int)triangles.size(); ++i)127 for (size_t i = 0; i < triangles.size(); ++ i) 127 128 { 128 129 fwrite(&triangles[i], sizeof(int), 1, fw); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ObjExporter.cpp
r3261 r3272 25 25 Vector3 *vertices = geom->GetVertices(numVertices); 26 26 27 char str[100]; 28 27 29 //cout << "vtx: " << numVertices << endl; 28 30 for (int i = 0; i < numVertices; ++ i) 29 31 { 30 32 Vector3 v = vertices[i]; 31 ostream << "v " << v.x << " " << v.y << " " << v.z << endl; 33 sprintf(str, "v %f %f %f\n", v.x, v.z, -v.y); 34 ostream << str; 32 35 } 33 36 … … 73 76 { 74 77 ShapeContainer::iterator sit, send; 75 76 78 entities[i]->GetLODLevel(0, sit, send); 77 79 … … 79 81 { 80 82 Geometry *geom = (*sit)->GetGeometry(); 83 84 int dummy; 85 if (!geom->GetVertices(dummy)) 86 { 87 cerr << "error: geometry was deleted on loading, exporting obj failed" << endl; 88 return false; 89 } 90 81 91 numVertices += WriteGeometry(geom, ostream); 82 92 } … … 89 99 for (int i = 0; i < numVertices; i += 3) 90 100 { 91 ostream << "f " << i << " " << i + 1 << " " << i + 2<< endl;101 ostream << "f " << i + 2 << " " << i + 2 << " " << i + 3 << endl; 92 102 } 93 103 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3271 r3272 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/SceneEntityConverter.cpp
r3271 r3272 115 115 } 116 116 117 117 118 Geometry *geom = new Geometry(vertices, normals, tex, 6, true, NULL); 118 119 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3271 r3272 109 109 110 110 // scale the sky dome so no intersection with the scene is visible 111 //const float scaleFactor = 80.0f;112 const float scaleFactor = 1000.0f;111 const float scaleFactor = 80.0f; 112 //const float scaleFactor = 1000.0f; 113 113 114 114 position.z -= 3.0f * scaleFactor; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3271 r3272 595 595 //LoadModel("sibenik.dem", dynamicObjects); 596 596 597 #if 1598 597 599 598 AxisAlignedBox3 pompeiiBox = SceneEntity::ComputeBoundingBox(staticObjects); 600 599 600 cout << "here34 " << pompeiiBox << endl; 601 602 #if 0 601 603 // todo: dispose texture 602 604 Texture *floorTex = new Texture(model_path + "stairs.c.01.tif"); … … 722 724 723 725 724 //ObjExporter().Export(model_path + "my city.obj", bvh);725 //BvhExporter().Export(model_path + "my city.bvh", bvh);726 //ObjExporter().Export(model_path + "myvienna.obj", bvh); 727 //BvhExporter().Export(model_path + "myvienna.bv", bvh); 726 728 727 729 … … 1366 1368 ((PvsCollectionRenderer *)traverser)->SetViewCell(usePvs ? viewCell : NULL); 1367 1369 1370 //for (size_t i = 0; i < staticObjects.size(); ++ i) 1371 // staticObjects[i]->Render(&renderState); 1372 1368 1373 // actually render the scene geometry using the specified algorithm 1369 1374 traverser->RenderScene();
Note: See TracChangeset
for help on using the changeset viewer.