Changeset 2700 for GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
- Timestamp:
- 05/23/08 14:49:21 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2699 r2700 254 254 { 255 255 Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 256 //tri.mVertices[0] *= 10; tri.mVertices[1] *= 10; tri.mVertices[2] *= 10;257 256 258 257 samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3)); … … 527 526 cout << "finished loading" << endl; 528 527 } 529 528 530 529 return result; 531 530 } … … 663 662 cout << "loading objects from " << buf << endl; 664 663 665 // load scene objects which are the entitiesused as pvs entries664 // load scene objects used as pvs entries 666 665 ObjectContainer pvsObjects; 667 666 if (0) LoadObjects(buf, pvsObjects, mObjects); 668 667 669 const bool finalizeViewCells = false;668 const bool finalizeViewCells = true; 670 669 cout << "loading view cells from " << buf << endl; 671 670 … … 690 689 mViewCellsManager = CreateViewCellsManager(buf); 691 690 691 // default view space is the extent of the scene 692 AxisAlignedBox3 viewSpaceBox; 693 692 694 if (mUseViewSpaceBox) 693 695 { 694 // default view space is the extent of the scene 695 AxisAlignedBox3 viewSpaceBox = mSceneGraph->GetBox(); 696 viewSpaceBox = mSceneGraph->GetBox(); 696 697 697 698 // use a small box outside of the scene 698 699 viewSpaceBox.Scale(Vector3(0.15f, 0.3f, 0.5f)); 700 //viewSpaceBox.Translate(Vector3(Magnitude(mSceneGraph->GetBox().Size()) * 0.5f, 0, 0)); 699 701 viewSpaceBox.Translate(Vector3(Magnitude(mSceneGraph->GetBox().Size()) * 0.3f, 0, 0)); 700 702 mViewCellsManager->SetViewSpaceBox(viewSpaceBox); 701 703 } 702 703 704 else 705 { 706 viewSpaceBox = mSceneGraph->GetBox(); 707 mViewCellsManager->SetViewSpaceBox(viewSpaceBox); 708 } 709 704 710 bool loadVcGeometry; 705 711 Environment::GetSingleton()->GetBoolValue("ViewCells.loadGeometry", loadVcGeometry); … … 1037 1043 GetIntValue("Preprocessor.rayCastMethod", rayCastMethod); 1038 1044 1039 // first buildup the tree for havran ray caster if it is used 1045 #ifdef USE_HAVRAN_RAYCASTER 1046 1040 1047 if ((rayCastMethod == 2) || (rayCastMethod == 3)) 1041 { 1042 HavranRayCaster *hr = 0; 1043 1044 if (rayCastMethod == 3) 1045 hr = reinterpret_cast<HavranDynRayCaster*>(mRayCaster); 1046 else 1047 hr = reinterpret_cast<HavranRayCaster*>(mRayCaster); 1048 1049 hr->Build(this->mObjects); 1050 } 1051 1052 // #ifdef USE_HAVRAN_RAYCASTER 1053 // if ((rayCastMethod == 2) || (rayCastMethod == 3)) 1054 // { 1055 // HavranRayCaster *hr = 0; 1056 1057 // if (rayCastMethod == 3) 1058 // hr = reinterpret_cast<HavranDynRayCaster*>(mRayCaster); 1059 // else 1060 // hr = reinterpret_cast<HavranRayCaster*>(mRayCaster); 1061 1062 // string ktbFilename = internKdTree; 1063 // int l = (int)ktbFilename.length(); 1064 // ktbFilename[l-1] = 't'; 1065 // ktbFilename[l-2] = 'b'; 1066 // ktbFilename[l-3] = 'k'; 1067 1068 // cout << "Trying to load tree from file " << ktbFilename << endl; 1069 // if (hr->ImportBinTree(ktbFilename, this->mObjects)) { 1070 // cout << "Loading failed - building kd-tree" << endl; 1071 // hr->Build(this->mObjects); 1072 // cout << "Exporting kd-tree to file " << ktbFilename << endl; 1073 // hr->ExportBinTree(ktbFilename); 1074 // } 1075 // else 1076 // cout << " done." << endl; 1077 // } 1078 // #endif 1048 { 1049 HavranRayCaster *hr = 0; 1050 1051 if (rayCastMethod == 3) 1052 hr = reinterpret_cast<HavranDynRayCaster*>(mRayCaster); 1053 else 1054 hr = reinterpret_cast<HavranRayCaster*>(mRayCaster); 1055 1056 string ktbFilename = internKdTree; 1057 int l = (int)ktbFilename.length(); 1058 ktbFilename[l-1] = 't'; 1059 ktbFilename[l-2] = 'b'; 1060 ktbFilename[l-3] = 'k'; 1061 1062 cout << "Trying to load tree from file " << ktbFilename << endl; 1063 if (hr->ImportBinTree(ktbFilename, this->mObjects)) { 1064 cout << "Loading failed - building kd-tree" << endl; 1065 hr->Build(this->mObjects); 1066 cout << "Exporting kd-tree to file " << ktbFilename << endl; 1067 hr->ExportBinTree(ktbFilename); 1068 } 1069 else 1070 cout << " done." << endl; 1071 } 1072 #endif 1079 1073 1080 1074 … … 1679 1673 1680 1674 1681 void Preprocessor::ObjectMoved(SceneGraphLeaf *object) 1682 { 1683 // first invalidate all PVS from which this object is visible 1684 ViewCellContainer::const_iterator vit, vit_end = mViewCellsManager->GetViewCells().end(); 1685 1686 AxisAlignedBox3 box = object->GetBox(); 1687 1688 ObjectContainer objects; 1689 1690 if (0) 1691 { 1692 // simplified computation taking only the objects intersecting the box 1675 /** Object has moved - must dynamically update all affected PVSs */ 1676 void 1677 Preprocessor::ObjectMoved(SceneGraphLeaf *object) 1678 { 1679 // first invalidate all PVS from which this object is visible 1680 ViewCellContainer::const_iterator vit, vit_end = mViewCellsManager->GetViewCells().end(); 1681 1682 AxisAlignedBox3 box = object->GetBox(); 1683 1684 ObjectContainer objects; 1685 1686 if (0) 1687 { 1688 // simplified computation taking only the objects intersecting the box 1693 1689 KdNode::NewMail(); 1694 1690
Note: See TracChangeset
for help on using the changeset viewer.