Changeset 944 for GTP/trunk/Lib
- Timestamp:
- 05/10/06 18:33:35 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBoundingBoxConverter.cpp
r938 r944 19 19 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 20 20 const_iterator iit, iit_end = iboxes.end(); 21 std::stringstream d; d << "here75557\n"; 22 LogManager::getSingleton().logMessage(d.str());21 22 23 23 for (iit = iboxes.begin(); iit != iit_end; ++ iit) 24 24 { 25 25 const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 26 26 const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 27 std::stringstream d; d << "here77\n"; 28 LogManager::getSingleton().logMessage(d.str());27 28 29 29 Entity *ent = FindCorrespondingObject(currentBox); 30 30 … … 53 53 AxisAlignedBox mybox = EnlargeBox(box); 54 54 //AxisAlignedBox dummy(Vector3(-50000, -50000, -50000), Vector3(50000, 50000, 50000)); 55 std::stringstream d; d << "here3 idenbtiy 8888\n"; 56 LogManager::getSingleton().logMessage(d.str()); 55 57 56 //-- get intersecting scene nodes 58 57 mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r938 r944 168 168 } 169 169 // add bounding boxes of rendered objects 170 if ( 1)170 if (0) 171 171 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 172 172 { … … 561 561 if (mViewCellsLoaded) 562 562 { 563 LogManager::getSingleton().logMessage("here3");564 563 mUseViewCells = *static_cast<const bool *>(val); 565 564 … … 1014 1013 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 1015 1014 Entity *ent = omi->GetMesh(); 1016 LogManager::getSingleton().logMessage("here999");1015 1017 1016 ent->setVisible(visible); 1018 1017 } … … 1036 1035 // load the view cells assigning the found objects to the pvss 1037 1036 mViewCellsManager = 1038 GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, env, &bconverter);1037 GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, env, false, &bconverter); 1039 1038 1040 1039 if (!mViewCellsManager) … … 1055 1054 // set everything visible for savety 1056 1055 SetObjectsVisible(true); 1057 LogManager::getSingleton().logMessage("here7"); 1056 1058 1057 return; 1059 1058 } 1060 LogManager::getSingleton().logMessage("here8");1059 1061 1060 GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 1062 1061 oit_end = vc->GetPvs().mEntries.end(); … … 1069 1068 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance*>((*oit).first); 1070 1069 omi->GetMesh()->setVisible(load); 1071 GtpVisibilityPreprocessor::Debug << "here45" << omi->GetId() << endl;1070 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 1072 1071 } 1073 1072 } … … 1089 1088 1090 1089 mElementaryViewCell = newElementary; 1091 LogManager::getSingleton().logMessage("unloading");1090 //LogManager::getSingleton().logMessage("unloading"); 1092 1091 //-- unload old pvs 1093 1092 applyViewCellPvs(mCurrentViewCell, false); … … 1110 1109 viewCell = newElementary; 1111 1110 } 1112 LogManager::getSingleton().logMessage("loading");1111 //LogManager::getSingleton().logMessage("loading"); 1113 1112 //-- load new pvs 1114 if (0)applyViewCellPvs(viewCell, true);1113 applyViewCellPvs(viewCell, true); 1115 1114 1116 1115 // store pvs -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r938 r944 54 54 { 55 55 Octree *octree = static_cast<Octree *>(node); 56 56 57 // HACK: if there are subtrees, they are empty => we are not interested in them 57 58 return octree->numNodes() == (int)octree->mNodes.size(); … … 70 71 const Vector3 pos = (bmax - bmin) * 0.5 + bmin; 71 72 73 /* std::stringstream d; 74 d << "a: " << (mCameraPosition - pos).squaredLength() 75 << " b: " << (mCullCamera->getDerivedPosition() - pos).squaredLength(); 76 LogManager::getSingleton().logMessage(d.str());*/ 72 77 return (mCameraPosition - pos).squaredLength(); 73 //return (mCullCamera->getDerivedPosition() - pos).squaredLength();74 78 } 75 79 //----------------------------------------------------------------------- -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp
r938 r944 12 12 PlatformOcclusionQuery::~PlatformOcclusionQuery() 13 13 { 14 // hardwareocclusion query is deleted by Ogre 14 15 //delete mHardwareOcclusionQuery; 15 16 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp
r938 r944 32 32 argv[1] = fname; 33 33 34 GtpVisibilityPreprocessor::Debug << "here4 loading environment from: " << argv[1] << endl; 34 GtpVisibilityPreprocessor::Debug << "loading environment from: " << argv[1] << endl; 35 return GtpVisibilityPreprocessor::environment->Parse(argc, argv, false); 35 36 */ 36 37 //-- parse environment 37 38 return mEnvironment->ReadEnvFile(filename.c_str()); 38 //return GtpVisibilityPreprocessor::environment->Parse(argc, argv, false);39 39 } 40 40 //----------------------------------------------------------------------- -
GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells
r942 r944 42 42 -view_cells_evaluation_samples_per_pass=1000000 \ 43 43 -vsp_bsp_node_queue_type=2 \ 44 -view_cells_filename=$LOG_PREFIX /vienna-visibility.xml44 -view_cells_filename=$LOG_PREFIX-visibility.xml 45 45 46 46 mv debug.log $LOG_PREFIX-$METHOD-debug.log -
GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env
r942 r944 259 259 # filename ../data/vienna/viewcells-large-sel.x3d 260 260 # filename ../scripts/viewcells_vienna.xml 261 filename D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/scripts/vienna _visibility.xml261 filename D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/scripts/vienna-visibility.xml 262 262 } 263 263 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r938 r944 356 356 { 357 357 environment->GetStringValue("ViewCells.filename", buf); 358 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, environment );358 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, environment, true); 359 359 } 360 360 else -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r938 r944 1861 1861 1862 1862 1863 bool ViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects) 1863 bool ViewCellsManager::ExportViewCells(const string filename, 1864 const bool exportPvs, 1865 const ObjectContainer &objects) 1864 1866 { 1865 1867 return false; … … 1880 1882 // active view cells 1881 1883 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 1884 1882 1885 for (it = mViewCells.begin(); it != it_end; ++ it) 1883 1886 { … … 4727 4730 ObjectContainer *objects, 4728 4731 Environment *env, 4732 const bool finalizeViewCells, 4729 4733 BoundingBoxConverter *bconverter) 4734 4730 4735 { 4731 4736 ViewCellsParser parser; … … 4733 4738 ViewCellsManager *vm = NULL; 4734 4739 4735 Debug << "here23 filename: " << filename << endl;4736 //BoundingBoxConverter bconverter;4737 4738 4740 if (parser.ParseFile(filename, &vm, objects, bconverter, env)) 4739 {Debug << "here25 filename: " << filename << endl; 4741 { 4742 long startTime = GetTime(); 4743 4740 4744 //vm->PrepareLoadedViewCells(); 4741 4745 vm->ResetViewCells(); … … 4745 4749 4746 4750 // create the meshes and compute volumes 4747 vm->FinalizeViewCells(true); 4748 4749 vm->mViewCellsTree->AssignRandomColors(); 4750 Debug << (int)vm->mViewCells.size() << " view cells loaded" << endl; 4751 if (finalizeViewCells) 4752 { 4753 vm->FinalizeViewCells(true); 4754 vm->mViewCellsTree->AssignRandomColors(); 4755 } 4756 4757 Debug << (int)vm->mViewCells.size() << " view cells loaded in " 4758 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 4751 4759 } 4752 4760 else … … 4785 4793 4786 4794 //-- export the view cells and the pvs 4787 stream << "<ViewCells>" << endl; 4795 const int numViewCells = mCurrentViewCellsStats.viewCells; 4796 4797 stream << "<ViewCells number=\"" << numViewCells << "\" />" << endl; 4788 4798 4789 4799 mViewCellsTree->Export(stream, exportPvs); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r938 r944 432 432 ObjectContainer *objects, 433 433 Environment *env, 434 const bool finalizeViewCells, 434 435 BoundingBoxConverter *bconverter = NULL); 435 436 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r938 r944 126 126 // go one up in the tree 127 127 if (mCurrentBspNode->GetParent()) 128 { Debug<< "]";128 { cout << "]"; 129 129 mCurrentBspNode = mCurrentBspNode->GetParent(); 130 130 } … … 136 136 // go one up in the tree 137 137 if (mCurrentViewCell->GetParent()) 138 { Debug<< "]";138 { cout << "]"; 139 139 mCurrentViewCell = mCurrentViewCell->GetParent(); 140 140 } … … 159 159 // all bounding boxes gathered in this step => 160 160 // associate object ids with bounding boxes 161 long startTime = GetTime(); 162 161 163 if (mBoundingBoxConverter) 162 164 mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, *mObjects); 165 166 Debug << "\nconverted bounding boxes to objects in" 167 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 163 168 } 164 169 … … 190 195 if (element == "Interior") 191 196 { 192 Debug<< "[";197 cout << "["; 193 198 StartBspInterior(attributes); 194 199 } … … 196 201 if (element == "Leaf") 197 202 { 198 Debug << "l"; 199 Debug << "leaf" << endl; 203 cout << "l"; 200 204 StartBspLeaf(attributes); 201 205 } … … 212 216 if (element == "ViewCells") 213 217 { 214 Debug<< "parsing view cells" << endl;218 cout << "parsing view cells" << endl; 215 219 mParseViewCells = true; 216 220 } … … 218 222 if (element == "Hierarchy") 219 223 { 220 Debug<< "parsing spatial hierarchy" << endl;224 cout << "parsing spatial hierarchy" << endl; 221 225 mParseViewCells = false; 222 226 StartHierarchy(attributes); … … 226 230 if (element == "ViewSpaceBox") 227 231 { 228 Debug<< "v";232 cout << "v"; 229 233 StartViewSpaceBox(attributes); 230 234 } … … 233 237 if (element == "BoundingBox") 234 238 { 235 Debug<< "b";239 cout << "b"; 236 240 StartBoundingBox(attributes); 237 241 } … … 259 263 if (element == "Interior") 260 264 { 261 Debug<< "[";265 cout << "["; 262 266 StartViewCellInterior(attributes); 263 267 } … … 265 269 if (element == "Leaf") 266 270 { 267 Debug<< "l";271 cout << "l"; 268 272 StartViewCellLeaf(attributes); 269 273 } … … 399 403 mViewSpaceBox = AxisAlignedBox3(bmin, bmax); 400 404 401 Debug << " view space box: " << mViewSpaceBox << endl;405 Debug << "\nview space box: " << mViewSpaceBox << endl; 402 406 } 403 407 … … 437 441 mIBoundingBoxes.push_back(IndexedBoundingBox(id, box)); 438 442 439 Debug << "view space box: " << mViewSpaceBox << endl;443 //Debug << "bbox: " << box << endl; 440 444 } 441 445 … … 624 628 625 629 mVspBspTree->mBox = mViewSpaceBox; 626 Debug << "creating vsp bsp view cells manager" << endl;627 630 } 628 631 else if (strcmp(name, "vspKdTree") == 0) 629 632 { 630 633 // TODO 634 Debug << "view cell type: VspKd" << endl; 631 635 mVspKdTree = new VspKdTree(); 632 636 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, mEnvironment); -
GTP/trunk/Lib/Vis/README_ONLINE_MODULE.txt
r902 r944 4 4 ONLINE VISIBILITY (CHC + VIEW CELLS) 5 5 6 1) Requirements: 7 WindowsXP 8 svn 6 1) 7 8 Requirements: 9 10 WindowsXP 11 svn 9 12 10 13 2) check out gametools repository 11 in the following it is assumed that your repository is located in d:\svn\gametools (not required, just replace your path) 14 15 in the following it is assumed that your repository is located in d:\svn\gametools (not required, just replace your path) 12 16 13 3) add following environment variables:17 3) 14 18 15 OGRE_PATH: points to directory where ogre.sln is located (i.e., the 19 add following environment variables: 20 21 OGRE_PATH: points to directory where ogre.sln is located (i.e., the 16 22 directory OGRE), e.g. D:\svn\gametools\OGRE\trunk\ogrenew 17 23 18 4) copy the ogre_dependencies and ogre_changes_12 into the ogrenew directory 24 4) 25 26 copy the directories 27 28 D:\svn\gametools\OGRE\trunk\ogre_dependencies 29 D:\svn\gametools\OGRE\trunk\ogre_changes\Ogre1.2 30 31 into the ogrenew directory. 32 33 Further copy the files 34 35 D:\svn\gametools\OGRE\trunk\resources\terrain.cfg 36 D:\svn\gametools\OGRE\trunk\resources\terrainCulling.cfg into the 37 38 D:\svn\gametools\OGRE\trunk\ogrenew\Samples\Common\bin\Release 39 40 directory. 41 42 The absolute filenames in terrainCulling.cfg must be 43 changed accordingly 44 45 5) add following directories to 46 47 D:\svn\gametools\OGRE\trunk\ogrenew\Samples\Common\bin\Release\resources.cfg 48 49 FileSystem=d:/svn/gametools/OGRE/trunk/resources/materials/textures 50 FileSystem=d:/svn/gametools/OGRE/trunk/resources/materials/scripts 51 FileSystem=d:/svn/gametools/OGRE/trunk/resources/overlays 52 FileSystem=d:/svn/gametools/OGRE/trunk/resources/models 53 FileSystem=d:/svn/gametools/OGRE/trunk/resources/models/trees 54 19 55 20 56 5) Set preprocessor flag GTP_VISIBILITY_MODIFIED_OGRE to the example projects you want to use 21 57 22 5) open scripts GTP\trunk\Lib\Vis\shared\GtpVisibility.sln and build all58 6) open scripts GTP\trunk\Lib\Vis\shared\GtpVisibility.sln and build all 23 59 24 60 25 6) start TerrainExampleApplication for testing 26 27 28 29 30 31 32 33 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// 34 35 FOR USING THE PREPROCESSED VIEW CELLS: 36 37 the same as above, before step 6) change in the code: 38 39 in 40 41 D:\svn\gametools\GTP\trunk\App\Demos\Vis\HillyTerrain\OGRE\TestCullingTerrainApplication.cpp 42 43 replace 44 45 bool TestCullingTerrainApplication::msShowHillyTerrain = true; 46 47 with 48 49 bool TestCullingTerrainApplication::msShowHillyTerrain = false; 50 51 52 Then the vienna model is loaded together with the view cells. The 53 usage of the view cells is toggled using key "V". 61 7) start TerrainExampleApplication for testing
Note: See TracChangeset
for help on using the changeset viewer.