Changeset 2360 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Timestamp:
- 05/09/07 10:24:25 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2289 r2360 67 67 mUseFromPointQueries(false), 68 68 mQueryMode(NODE_QUERIES), 69 mResetMaterialForQueries(false) 69 mResetMaterialForQueries(false), 70 mRenderPvsForViz(false) 70 71 { 71 72 Ogre::LogManager::getSingleton(). … … 180 181 float max_z = mOptions.scale.z * mOptions.pageSize; 181 182 182 float maxAxis = std::max(max_x, max_y); 183 maxAxis = std::max(maxAxis, max_z); 184 resize(AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis)); 185 //resize(AxisAlignedBox( 0, 0, 0, max_x, max_y, max_z )); 183 if (1) 184 { 185 // keep octree equal at all sides so nodes adapt better to small objects 186 float maxAxis = std::max(max_x, max_y); 187 maxAxis = std::max(maxAxis, max_z); 188 resize(AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis)); 189 } 190 else 191 { 192 resize(AxisAlignedBox( 0, 0, 0, max_x, max_y, max_z)); 193 } 186 194 187 195 setupTerrainMaterial(); … … 631 639 } 632 640 633 // add bounding boxes of rendered objects 634 if (0) 635 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 636 { 637 getRenderQueue()->addRenderable(*it); 638 } 639 640 // show current view cell geometry 641 if (mCurrentViewCell)// && mCurrentViewCell->GetMesh()) 642 { 643 //const bool showSingleViewCell = true; 644 if (mViewCellsGeometryLoaded) 645 { 646 ShowViewCellsGeometry(); 647 } 648 649 ////////// 650 //-- set PVS of view cell visible 651 652 GtpVisibilityPreprocessor::ObjectPvsIterator pit = 653 mCurrentViewCell->GetPvs().GetIterator(); 654 655 MailPvsObjects(); 656 657 while (pit.HasMoreEntries()) 658 { 659 RenderPvsEntry(pit.Next()); 660 } 661 } 662 #if 0 663 if (mRenderNodesForViz || mRenderNodesContentForViz) 664 { 665 // HACK: change node material so it is better suited for visualization 666 MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 667 nodeMat->setAmbient(1, 1, 0); 668 nodeMat->setLightingEnabled(true); 669 nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 670 671 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 672 { 673 if (mRenderNodesForViz) 641 if (mRenderPvsForViz) 642 { 643 // show current view cell geometry 644 if (mCurrentViewCell)// && mCurrentViewCell->GetMesh()) 645 { 646 //const bool showSingleViewCell = true; 647 if (mViewCellsGeometryLoaded) 674 648 { 675 // render the visible leaf nodes 676 if ((*it)->numAttachedObjects() && 677 !(*it)->numChildren() && 678 ((*it)->getAttachedObject(0)->getMovableType() == "Entity") && 679 (*it)->getAttachedObject(0)->isVisible()) 649 ShowViewCellsGeometry(); 650 } 651 652 ////////// 653 //-- set PVS of view cell visible 654 655 GtpVisibilityPreprocessor::ObjectPvsIterator pit = 656 mCurrentViewCell->GetPvs().GetIterator(); 657 658 MailPvsObjects(); 659 660 while (pit.HasMoreEntries()) 661 { 662 RenderPvsEntry(pit.Next()); 663 } 664 } 665 } 666 else 667 { 668 // add bounding boxes of rendered objects 669 if (1) 670 { 671 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 672 { 673 getRenderQueue()->addRenderable(*it); 674 } 675 } 676 if (mRenderNodesForViz || mRenderNodesContentForViz) 677 { 678 // HACK: change node material so it is better suited for visualization 679 MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 680 nodeMat->setAmbient(1, 1, 0); 681 nodeMat->setLightingEnabled(true); 682 nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 683 684 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 685 { 686 if (mRenderNodesForViz) 680 687 { 681 //getRenderQueue()->addRenderable((*it)); 688 // render the visible leaf nodes 689 if ((*it)->numAttachedObjects() && 690 !(*it)->numChildren() && 691 ((*it)->getAttachedObject(0)->getMovableType() == "Entity") && 692 (*it)->getAttachedObject(0)->isVisible()) 693 { 694 getRenderQueue()->addRenderable((*it)); 695 //(*it)->_addToRenderQueue(cam, getRenderQueue(), false); 696 } 697 698 // render bounding boxes of nodes 699 if (0) (*it)->_addBoundingBoxToQueue(getRenderQueue()); 700 } 701 702 // add renderables itself 703 if (mRenderNodesContentForViz) 704 { 682 705 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 683 706 } 684 685 // add bounding boxes instead of node itself686 if (0) (*it)->_addBoundingBoxToQueue(getRenderQueue());687 707 } 688 689 // add renderables itself 690 if (mRenderNodesContentForViz) 691 { 692 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 693 } 694 } 695 } 696 #endif 708 } 709 } 697 710 } 698 711 //----------------------------------------------------------------------- … … 994 1007 return true; 995 1008 } 1009 if (key == "RenderPvsForViz") 1010 { 1011 mRenderPvsForViz = (*static_cast<const bool *>(val)); 1012 return true; 1013 } 996 1014 if (key == "SkyBoxEnabled") 997 1015 { … … 1016 1034 if (key == "DelayRenderTransparents") 1017 1035 { 1018 //LoadScene(mFilename, mViewCellsFilename);1019 1036 mDelayRenderTransparents = (*static_cast<const bool *>(val)); 1020 1037 return true; … … 1925 1942 ivReader.setLog(log); 1926 1943 } 1927 1928 //viennaNode->translate(Vector3(-300, -300, 0));1929 1944 1930 1945 if (ivReader.loadFile(filename.c_str())) -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r2332 r2360 189 189 void OctreeHierarchyInterface::DetermineVisibilityRatio(GtpVisibility::HierarchyNode *node) const 190 190 { 191 #if 0 191 192 Octree *octant = static_cast<Octree *>(node); 192 193 … … 229 230 octant->setNumLeaves(numLeaves); 230 231 octant->setNumVisibleLeaves(numVisibleLeaves); 232 #endif 231 233 } 232 234 //----------------------------------------------------------------------- … … 285 287 bool OctreeHierarchyInterface::IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 286 288 { 287 #ifdef GTP_VISIBILITY_MODIFIED_OGRE288 //return static_cast<Octree *>(node)->getVisibilityRatio() > 0.9f;289 289 return static_cast<Octree *>(node)->isOctreeFullyVisible(); 290 } 291 //----------------------------------------------------------------------- 292 float OctreeHierarchyInterface::GetNodeVisibilityRatio(GtpVisibility::HierarchyNode *node) const 293 { 294 #if 0 295 return static_cast<Octree *>(node)->getVisibilityRatio(); 290 296 #else 291 return true; 292 #endif 293 } 294 //----------------------------------------------------------------------- 295 float OctreeHierarchyInterface::GetNodeVisibilityRatio(GtpVisibility::HierarchyNode *node) const 296 { 297 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 298 return static_cast<Octree *>(node)->getVisibilityRatio(); 299 //return static_cast<Octree *>(node)->isOctreeFullyVisible(); 300 #else 301 return true; 297 return 1.0f; 302 298 #endif 303 299 }
Note: See TracChangeset
for help on using the changeset viewer.