Changeset 1291 for GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
- Timestamp:
- 08/28/06 18:42:33 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1288 r1291 41 41 int n = 200; 42 42 43 if (0){ 44 // form grid of boxes 45 for (int i = 0; i < n; ++ i) 46 { 47 for (int j = 0; j < n; ++ j) 43 if (0) 44 { 45 // form grid of boxes 46 for (int i = 0; i < n; ++ i) 48 47 { 49 const Vector3 scale2((float)j * 0.8f / n + 0.1f, 0.05f, (float)i * 0.8f / (float)n + 0.1f); 50 51 const Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 52 53 const Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 54 AxisAlignedBox3 box(pt2, pt2 + boxSize); 48 for (int j = 0; j < n; ++ j) 49 { 50 const Vector3 scale2((float)j * 0.8f / n + 0.1f, 0.05f, (float)i * 0.8f / (float)n + 0.1f); 51 52 const Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 53 54 const Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 55 AxisAlignedBox3 box(pt2, pt2 + boxSize); 56 Mesh *mesh = CreateMeshFromBox(box); 57 58 mesh->Preprocess(); 59 60 MeshInstance *mi = new MeshInstance(mesh); 61 scene->mRoot->mGeometry.push_back(mi); 62 } 63 } 64 65 for (int i = 0; i < n; ++ i) 66 { 67 for (int j = 0; j < n; ++ j) 68 { 69 const Vector3 scale2(0.15f, (float)j * 0.8f / n + 0.1f, (float)i * 0.8f / (float)n + 0.1f); 70 71 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 72 73 Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 74 AxisAlignedBox3 box(pt2, pt2 + boxSize); 75 Mesh *mesh = CreateMeshFromBox(box); 76 77 mesh->Preprocess(); 78 79 MeshInstance *mi = new MeshInstance(mesh); 80 scene->mRoot->mGeometry.push_back(mi); 81 } 82 } 83 84 for (int i = 0; i < n; ++ i) 85 { 86 const Vector3 scale2(2, 0.2f, (float)i * 0.8f / (float)n + 0.1f); 87 88 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 89 90 //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 91 Vector3 boxSize = sceneBox.Size() * Vector3(0.005f, 0.02f, 0.005f); 92 93 AxisAlignedBox3 box(pt2 + 0.1f, pt2 + boxSize); 55 94 Mesh *mesh = CreateMeshFromBox(box); 56 95 57 96 mesh->Preprocess(); 58 97 59 98 MeshInstance *mi = new MeshInstance(mesh); 60 99 scene->mRoot->mGeometry.push_back(mi); 61 100 } 62 } 63 64 for (int i = 0; i < n; ++ i) 65 { 66 for (int j = 0; j < n; ++ j) 67 { 68 const Vector3 scale2(0.15f, (float)j * 0.8f / n + 0.1f, (float)i * 0.8f / (float)n + 0.1f); 69 70 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 71 72 Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 73 AxisAlignedBox3 box(pt2, pt2 + boxSize); 74 Mesh *mesh = CreateMeshFromBox(box); 75 76 mesh->Preprocess(); 77 78 MeshInstance *mi = new MeshInstance(mesh); 79 scene->mRoot->mGeometry.push_back(mi); 80 } 81 } 82 83 for (int i = 0; i < n; ++ i) 84 { 85 const Vector3 scale2(2, 0.2f, (float)i * 0.8f / (float)n + 0.1f); 86 87 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 88 89 //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 90 Vector3 boxSize = sceneBox.Size() * Vector3(0.005f, 0.02f, 0.005f); 91 92 AxisAlignedBox3 box(pt2 + 0.1f, pt2 + boxSize); 93 Mesh *mesh = CreateMeshFromBox(box); 94 95 mesh->Preprocess(); 96 97 MeshInstance *mi = new MeshInstance(mesh); 98 scene->mRoot->mGeometry.push_back(mi); 99 } 100 101 scene->mRoot->UpdateBox(); 102 } 103 101 102 scene->mRoot->UpdateBox(); 103 } 104 104 105 if (1) 105 106 { … … 111 112 Plane3 cuttingPlane(Vector3(1, 0, 0), pt); 112 113 Mesh *planeMesh = new Mesh(); 113 114 114 115 Polygon3 *poly = sceneBox.CrossSection(cuttingPlane); 115 116 IncludePolyInMesh(*poly, *planeMesh); 116 117 117 118 planeMesh->Preprocess(); 118 119 119 120 MeshInstance *planeMi = new MeshInstance(planeMesh); 120 121 scene->mRoot->mGeometry.push_back(planeMi); … … 145 146 Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 146 147 Environment::GetSingleton()->GetBoolValue("Preprocessor.exportVisibility", mExportVisibility ); 147 //#if GTP_INTERNAL // choose other ray cast method148 148 Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", mRayCastMethod); 149 //#endif 149 150 150 char buffer[256]; 151 151 Environment::GetSingleton()->GetStringValue("Preprocessor.visibilityFile", buffer); … … 163 163 Preprocessor::~Preprocessor() 164 164 { 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 165 cout << "cleaning up" << endl; 166 167 cout << "Deleting view cells manager ... \n"; 168 DEL_PTR(mViewCellsManager); 169 cout << "done.\n"; 170 171 cout << "Deleting bsp tree ... \n"; 172 DEL_PTR(mBspTree); 173 cout << "done.\n"; 174 175 cout << "Deleting kd tree...\n"; 176 DEL_PTR(mKdTree); 177 cout << "done.\n"; 178 179 cout << "Deleting vsp tree...\n"; 180 DEL_PTR(mVspTree); 181 cout << "done.\n"; 182 183 cout << "Deleting hierarchy manager...\n"; 184 DEL_PTR(mHierarchyManager); 185 cout << "done.\n"; 186 187 cout << "Deleting vspbsp tree...\n"; 188 DEL_PTR(mVspBspTree); 189 cout << "done.\n"; 190 191 cout << "Deleting scene graph...\n"; 192 DEL_PTR(mSceneGraph); 193 cout << "done.\n"; 194 195 DEL_PTR(mRenderSimulator); 196 DEL_PTR(renderer); 197 197 } 198 198 … … 461 461 if (strcmp(name, "osp") == 0) 462 462 { 463 Debug << "hierarchy manager: osp" << endl; 463 464 // HACK for testing if per kd evaluation works!! 464 465 const bool ishack = true; … … 470 471 else if (strcmp(name, "bvh") == 0) 471 472 { 473 Debug << "hierarchy manager: bvh" << endl; 472 474 hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV); 475 } 476 else // only view space partition 477 { 478 Debug << "hierarchy manager: obj" << endl; 479 hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::NO_OBJ_SUBDIV); 473 480 } 474 481
Note: See TracChangeset
for help on using the changeset viewer.