- Timestamp:
- 03/15/06 08:59:33 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r685 r694 31 31 environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish); 32 32 environment->GetBoolValue("Preprocessor.computeVisibility", mComputeVisibility); 33 environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 34 35 Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl; 33 36 Debug << "load polygons as meshes: " << mLoadPolygonsAsMeshes << endl; 34 37 … … 226 229 environment->GetFloatValue("Simulation.vcOverhead", vcOverhead); 227 230 environment->GetFloatValue("Simulation.moveSpeed", moveSpeed); 228 231 229 232 mRenderSimulator = 230 233 new RenderSimulator(mViewCellsManager, objRenderCost, vcOverhead, moveSpeed); … … 240 243 // renderer->makeCurrent(); 241 244 } 242 243 244 environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);245 245 246 246 return true; -
GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.cpp
r639 r694 141 141 // non-intersecting, otherwise polygon-plane intersections of bsp tree 142 142 // approaches are not eliminating any rays intersecting the polygon! 143 const float thresh = 1 ? 1e-6f : 0.0f;143 const float thresh = 1e-6f; 144 144 145 145 // segment is not intersecting plane: fond out if on front or back side -
GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
r658 r694 15 15 16 16 17 // HACK 18 static void RotateMesh(Mesh *mesh) 19 { 20 VertexContainer::iterator it, it_end = mesh->mVertices.end(); 21 22 const float angle = 30.0f * PI / 180.0f; 23 const Matrix4x4 rot = RotationYMatrix(angle); 24 25 for (it = mesh->mVertices.begin(); it != it_end; ++ it) 26 { 27 (*it) = rot * (*it); 28 } 29 } 30 31 17 32 struct ltstr 18 33 { … … 22 37 } 23 38 }; 24 25 39 26 40 bool … … 40 54 float x,y,z; 41 55 int i; 42 43 56 44 57 if ((file = fopen(filename.c_str(),"rt")) == NULL) … … 145 158 if (meshGrouping != 0 && 146 159 currentMesh->mFaces.size() >= meshGrouping) { 160 if (1) 161 RotateMesh(currentMesh); 147 162 currentMesh->Preprocess(); 148 163 // make an instance of this mesh … … 160 175 161 176 if (currentMesh->mVertices.size()) { 177 if (1) 178 RotateMesh(currentMesh); 179 cout << "here9999" << endl; 162 180 currentMesh->Preprocess(); 163 181 MeshInstance *mi = new MeshInstance(currentMesh); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r693 r694 345 345 Debug << "max memory: " << mMaxMemory << endl; 346 346 Debug << "refining view cells: " << mRefineViewCells << endl; 347 Debug << "********* view cell tree options ***************\n"; 347 348 348 349 MergeCandidate::sRenderCostWeight = mRenderCostWeight; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r684 r694 2127 2127 if (extSide < 0) 2128 2128 node = in->GetBack(); 2129 else 2129 else //if (extSide > 0) 2130 2130 node = in->GetFront(); 2131 2131 //else break; 2132 2132 2133 continue; // no far child 2133 2134 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r693 r694 17 17 18 18 #define SAMPLE_AFTER_SUBDIVISION 1 19 19 #define TEST_EMPTY_VIEW_CELLS 0 20 20 21 21 ViewCellsManager::ViewCellsManager(): … … 145 145 146 146 cout << "collecting empty view cells" << endl; 147 int i = 0;147 148 148 for (it = leaves.begin(); it != it_end; ++ it) 149 149 { 150 150 if ((*it)->GetPvs().Empty()) 151 151 { 152 ++ i;153 152 mEmptyViewCells.push_back(*it); 154 153 } 155 154 } 156 cout << "view cells found: " << i << endl; 157 } 158 159 160 void ViewCellsManager::TestEmptyViewCells() 161 { 162 mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), mEmptyViewCells); 163 155 Debug << "empty view cells found: " << (int)mEmptyViewCells.size() << endl; 156 } 157 158 159 void ViewCellsManager::TestEmptyViewCells(const ObjectContainer &obj) 160 { 164 161 ViewCellContainer::const_iterator it, it_end = mEmptyViewCells.end(); 165 162 … … 170 167 if (!(*it)->GetPvs().Empty()) 171 168 { 172 sprintf(buf, "empty-viewcells-%09d.x3d", (*it)->GetId());169 sprintf(buf, "empty-viewcells-%09d.x3d", i/*(*it)->GetId()*/); 173 170 Exporter *exporter = Exporter::GetExporter(buf); 174 171 175 172 if (exporter && i < 20) 176 173 { 177 Debug << "view cell " << (*it)->GetId() << " not empty, pvs: " << (*it)->GetPvs().GetSize() << endl; 174 Ray *pray = (*it)->mPiercingRays[0]; 175 Debug << "view cell " << (*it)->GetId() << " not empty, pvs: " << (*it)->GetPvs().GetSize() << " " << pray->intersections.size() << endl; 176 177 exporter->ExportRays((*it)->mPiercingRays); 178 179 exporter->SetFilled(); 180 exporter->SetForcedMaterial(RgbColor(0,0,1)); 181 182 for (int j = 0; j < (int)pray->intersections.size(); ++ j) 183 { 184 if (pray->intersections[j].mObject) 185 exporter->ExportIntersectable(pray->intersections[j].mObject); 186 } 187 188 //exporter->SetWireframe(); 189 exporter->SetForcedMaterial(RgbColor(0,1,0)); 190 exporter->ExportGeometry(obj); 191 192 exporter->SetFilled(); 193 194 exporter->SetForcedMaterial(RgbColor(1,0,0)); 178 195 ExportViewCellGeometry(exporter, *it); 196 197 delete exporter; 179 198 } 180 199 200 181 201 ++ i; 182 202 } 183 203 } 184 Debug << "\n found " << i << " new view cells (" << " of " <<mEmptyViewCells.size() << ")" << endl << endl;204 Debug << "\nSampled " << i << " new view cells (" << " of " << (int)mEmptyViewCells.size() << ")" << endl << endl; 185 205 } 186 206 … … 289 309 290 310 // should we use directional samples? 291 bool dirSamples = mSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION;311 bool dirSamples = (mSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION); 292 312 293 313 while (numSamples < n) … … 296 316 VssRayContainer constructionSamples; 297 317 298 const int samplingType = 299 dirSamples ?318 const int samplingType = mSamplingType; 319 /*dirSamples ? 300 320 Preprocessor::DIRECTION_BASED_DISTRIBUTION : 301 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 321 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION;*/ 302 322 303 323 if (0) … … 327 347 VssRayContainer postProcessSamples; 328 348 329 //-- construction rays => we use uniform samples for this349 //-- construction rays 330 350 CastPassSamples(mPostProcessSamples, 331 Preprocessor::DIRECTION_BASED_DISTRIBUTION,351 mSamplingType, 332 352 postProcessSamples); 333 353 … … 359 379 360 380 // only for testing 361 CollectEmptyViewCells(); 381 if (TEST_EMPTY_VIEW_CELLS) 382 CollectEmptyViewCells(); 362 383 363 384 … … 495 516 496 517 // find empty view cells bug 497 TestEmptyViewCells(); 518 if (TEST_EMPTY_VIEW_CELLS) 519 TestEmptyViewCells(preprocessor->mObjects); 498 520 } 499 521 … … 1083 1105 { 1084 1106 ViewCell *viewcell = *it; 1107 1085 1108 if (viewcell->GetValid()) 1086 1109 { 1110 // HACK 1111 if (TEST_EMPTY_VIEW_CELLS) 1112 for (int i = 0; i < mEmptyViewCells.size(); ++i) 1113 { 1114 if (viewcell == mEmptyViewCells[i]) 1115 { 1116 viewcell->mPiercingRays.push_back(new Ray(ray)); 1117 Debug << "empty view cell ray found: " << ray.mOriginObject << ", " << ray.mTerminationObject << endl; 1118 } 1119 } 1120 1087 1121 // if ray not outside of view space 1088 1122 float contribution; … … 1773 1807 newVol += lVol; 1774 1808 subdivVol += (*it)->GetVolume(); 1809 1810 float thres = 0.9; 1811 if ((lVol < ((*it)->GetVolume() * thres)) || 1812 (lVol * thres > ((*it)->GetVolume()))) 1813 Debug << "warning: " << lVol << " " << (*it)->GetVolume() << endl; 1775 1814 } 1776 1815 … … 3032 3071 MergeViewCells(postProcessRays, objects); 3033 3072 3034 3035 Debug << "here4" << endl;3036 3073 // only for testing 3037 3074 TestSubdivision(); … … 3341 3378 Debug << "\nOutput view cells: " << endl; 3342 3379 3380 const bool sortViewCells = true; 3381 3343 3382 // sort view cells to visualize the largest view cells 3344 if ( 0)3383 if (sortViewCells) 3345 3384 stable_sort(mViewCells.begin(), mViewCells.end(), vc_gt); 3346 3385 … … 3354 3393 cout << "creating output for view cell " << i << " ... "; 3355 3394 3356 3357 3395 ViewCell *vc; 3358 3396 3359 if ( 0) // largest view cell pvs first3397 if (sortViewCells) // largest view cell pvs first 3360 3398 vc = mViewCells[i]; 3361 3399 else … … 3370 3408 if (1 || mExportRays) 3371 3409 { 3410 // output rays stored with the view cells during subdivision 3372 3411 if (0) 3373 3412 { … … 3408 3447 } 3409 3448 3410 3449 // associate new rays with output view cell 3411 3450 if (1) 3412 3451 { … … 3598 3637 0.00000001f); 3599 3638 3600 //Debug << " heregeo size: " << geom.Size() << endl;3601 //Debug << " heresize b: " << back.Size() << " f: " << front.Size() << endl;3639 //Debug << "geo size: " << geom.Size() << endl; 3640 //Debug << "size b: " << back.Size() << " f: " << front.Size() << endl; 3602 3641 if (back.Valid()) 3603 3642 { 3604 3643 exporter->ExportPolygons(back.GetPolys()); 3605 3644 } 3606 //else Debug << "here2 size: " << back.Size() << endl;3645 3607 3646 } 3608 3647 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r693 r694 504 504 // HACK in order to detect empty view cells 505 505 void CollectEmptyViewCells(); 506 void TestEmptyViewCells( );506 void TestEmptyViewCells(const ObjectContainer &obj); 507 507 508 508 ViewCellContainer mEmptyViewCells; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r685 r694 1028 1028 1029 1029 if (frontData.mProbability < -0.00001) 1030 Debug << " here2error f: " << frontData.mProbability << endl;1030 Debug << "fatal error f: " << frontData.mProbability << endl; 1031 1031 if (backData.mProbability < -0.00001) 1032 Debug << " here2error b: " << backData.mProbability << endl;1032 Debug << "fatal error b: " << backData.mProbability << endl; 1033 1033 1034 1034 // clamp because of precision issues … … 2903 2903 } 2904 2904 2905 2905 2906 BspLeaf *VspBspTree::GetRandomLeaf(const bool onlyUnmailed) 2906 2907 { … … 2938 2939 } 2939 2940 2941 2940 2942 int VspBspTree::ComputePvsSize(const RayInfoContainer &rays) const 2941 2943 { … … 2970 2972 return pvsSize; 2971 2973 } 2974 2972 2975 2973 2976 float VspBspTree::GetEpsilon() const … … 3039 3042 3040 3043 float t; 3041 //const float thresh = 1 ? 1e-6f : 0.0f; 3042 const float thresh = 0.01f; 3043 3044 const float thresh = 1e-6f; // matt: change this 3045 3044 3046 while (1) 3045 3047 { … … 3072 3074 farChild = in->GetBack(); // plane splits ray 3073 3075 } 3074 else // one of the ray end points on the plane3076 else // one of the ray end points is on the plane 3075 3077 { // NOTE: what to do if ray is coincident with plane? 3076 3078 if (extSide < 0) 3077 3079 node = in->GetBack(); 3078 else 3080 else //if (extSide > 0) 3079 3081 node = in->GetFront(); 3080 3082 //else break; // coincident => count no intersections 3083 3081 3084 continue; // no far child 3082 3085 } … … 3367 3370 3368 3371 vector<BspLeaf *> neighbors; 3369 if ( 0)3372 if (1) 3370 3373 FindNeighbors(leaf, neighbors, true); 3371 3374 else -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r678 r694 587 587 inline bool LocalTerminationCriteriaMet(const VspBspTraversalData &data) const; 588 588 589 /** Returns true if global tree can be terminated. 590 */ 589 591 inline bool GlobalTerminationCriteriaMet(const VspBspTraversalData &data) const; 590 592 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r693 r694 34 34 environment->GetBoolValue("VssPreprocessor.testBeamSampling", mTestBeamSampling); 35 35 environment->GetBoolValue("VssPreprocessor.enlargeViewSpace", mEnlargeViewSpace); 36 36 environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 37 37 38 useViewspacePlane = mUseViewSpaceBox; //hack 38 39 … … 41 42 Debug << "use view space box=" << mUseViewSpaceBox << endl; 42 43 Debug << "enlarge view space=" << mEnlargeViewSpace << endl; 43 Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl;44 45 44 Debug << "*********** end vss preprocessor options **************" << endl; 46 45 … … 102 101 // cast ray to KD tree to find intersection with other objects 103 102 Intersectable *objectA, *objectB; 104 Vector3 pointA, pointB; 103 // change matt 104 Vector3 pointA; 105 Vector3 pointB; 106 105 107 float bsize = Magnitude(box.Size()); 106 108 … … 126 128 } 127 129 128 129 if ( mDetectEmptyViewSpace) {130 // matt: point A could be undefined? 131 if (1 && mDetectEmptyViewSpace) { 130 132 SetupRay(ray, pointA, -direction); 131 133 } else … … 153 155 } 154 156 157 //bool thesame = objectA && (objectA == objectB); 158 155 159 // if (objectA == NULL && objectB != NULL) { 156 if ( mDetectEmptyViewSpace)160 if (1 && mDetectEmptyViewSpace) 157 161 { 158 162 // cast again to ensure that there is no objectA … … 171 175 172 176 bool validSample = (objectA != objectB); 177 178 //if (validSample && thesame) Debug << "warning!!" << endl; 173 179 174 180 if (0 && mDetectEmptyViewSpace) -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r685 r694 14 14 #include "RssTree.h" 15 15 #include "Beam.h" 16 16 17 17 18 … … 210 211 } 211 212 213 212 214 void 213 215 X3dExporter::ExportMeshInstance(MeshInstance *object) … … 218 220 ExportMesh(object->GetMesh()); 219 221 } 222 220 223 221 224 void -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
r693 r694 54 54 static SAXParser::ValSchemes valScheme = SAXParser::Val_Auto; 55 55 56 56 #define ROTATE_SCENE 1 57 57 58 58 … … 83 83 StrX lname(name); 84 84 string element(lname.LocalForm()); 85 85 86 if (element == "Shape") 86 87 EndShape(); 87 88 } 88 89 89 // HACK 90 void RotateMesh(Mesh *mesh)91 { 92 VertexContainer:: const_iterator it, it_end = mesh->mVertices.end();90 91 static void RotateMesh(Mesh *mesh) 92 { 93 VertexContainer::iterator it, it_end = mesh->mVertices.end(); 93 94 94 95 const float angle = 30.0f * PI / 180.0f; 95 const Matrix4x4 rot = RotationYMatrix( 30);96 const Matrix4x4 rot = RotationYMatrix(angle); 96 97 97 98 for (it = mesh->mVertices.begin(); it != it_end; ++ it) 98 99 { 99 const Vector3 pt = rot * (*it);100 (*it) = rot * (*it); 100 101 } 101 102 } … … 124 125 125 126 mesh->mFaces.push_back(new Face(vc)); 126 if (0)127 //if (ROTATE_SCENE) 127 128 RotateMesh(mesh); 128 129 mesh->Preprocess(); … … 142 143 { 143 144 // HACK 144 if (0)145 //if (ROTATE_SCENE) 145 146 RotateMesh(mCurrentMesh); 146 147 mCurrentMesh->Preprocess(); … … 156 157 delete mCurrentMesh; 157 158 } 159 158 160 mCurrentMesh = NULL; 159 161 } … … 246 248 247 249 248 while (1)250 while (1) 249 251 { 250 252 float x = (float)strtod(ptr, &endptr); … … 298 300 StartIndexedFaceSet(attributes); 299 301 } 300 302 301 303 if (element == "Shape") { 302 cout <<"+";304 cout << "+"; 303 305 mCurrentMesh = new Mesh; 304 306 } … … 503 505 StrX lname(name); 504 506 string element(lname.LocalForm()); 507 505 508 if (element == "Shape") 506 509 EndShape(); -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.h
r657 r694 14 14 bool ParseFile(const string filename, SceneGraphNode **root, const bool loadPolygonsAsMeshes = false); 15 15 bool ParseFile(const string filename, ViewCellsManager &viewCells); 16 16 17 18 17 19 /// height of a loaded view cell 18 20 float mViewCellHeight;
Note: See TracChangeset
for help on using the changeset viewer.