- Timestamp:
- 05/27/05 11:56:51 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/PreprocessingManager.h
r71 r113 90 90 @remark the scene traverser is dependent on the type of hierarchyInterface the scene consists of. 91 91 */ 92 virtual void SetSceneTraverser( HierarchyInterface *hierarchyInterface) {92 virtual void SetSceneTraverser(HierarchyInterface *hierarchyInterface) { 93 93 mSceneTraverser = hierarchyInterface; 94 94 } -
trunk/VUT/GtpVisibility/include/QueryManager.h
r71 r113 25 25 onm different hierarchy types, while reusing the implementation of the query methods. 26 26 */ 27 QueryManager( HierarchyInterface *hierarchyInterface);27 QueryManager(HierarchyInterface *hierarchyInterface); 28 28 29 29 /** … … 64 64 65 65 /** 66 Ray shooting int reface: finds an intersection with objects in the scene.66 Ray shooting interface: finds an intersection with objects in the scene. 67 67 68 68 @param ray The given input ray (assuming the ray direction is normalized) … … 84 84 @remark the scene traverser depends on the type of hierarchyInterface the scene consists of. 85 85 */ 86 void SetSceneTraverser(HierarchyInterface *hierarchyInterface 86 void SetSceneTraverser(HierarchyInterface *hierarchyInterface); 87 87 88 88 protected: -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r112 r113 53 53 if(mVisualizeCulledNodes) 54 54 { 55 mHierarchyInterface->VisualizeCulledNode(node, QUERY_CULLED);55 mHierarchyInterface->VisualizeCulledNode(node, FRUSTUM_CULLED); 56 56 } 57 57 } -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r112 r113 21 21 {//if (mHierarchyInterface->mIsShadowPass) 22 22 mNumFrustumCulledNodes ++; 23 24 if(mVisualizeCulledNodes) 25 { 26 mHierarchyInterface->VisualizeCulledNode(node, FRUSTUM_CULLED); 27 } 23 28 } 24 29 else -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r112 r113 23 23 {//if (mHierarchyInterface->mIsShadowPass) 24 24 mNumFrustumCulledNodes ++; 25 if(mVisualizeCulledNodes) 26 { 27 mHierarchyInterface->VisualizeCulledNode(node, FRUSTUM_CULLED); 28 } 25 29 } 26 30 else … … 48 52 { //if (mHierarchyInterface->mIsShadowPass) 49 53 mNumQueryCulledNodes ++; 54 if(mVisualizeCulledNodes) 55 { 56 mHierarchyInterface->VisualizeCulledNode(node, QUERY_CULLED); 57 } 50 58 } 51 59 } -
trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
r112 r113 60 60 bool mUseVisibilityCulling; 61 61 bool mShowVisualization; 62 bool mRenderNodesForViz;63 62 bool mVisualizeCulledNodes; 63 64 int mRenderNodesForViz; 64 65 }; 65 66 -
trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
r112 r113 50 50 */ 51 51 GtpVisibility::VisibilityManager *getVisibilityManager(); 52 52 53 53 protected: 54 54 … … 63 63 bool mShowVisualization; 64 64 bool mRenderNodesForViz; 65 bool mRenderNodesContentForViz; 65 66 bool mVisualizeCulledNodes; 66 67 }; -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r112 r113 3 3 #include <OgreOctree.h> 4 4 #include <OgreLogManager.h> 5 5 #include <OgreStringConverter.h> 6 6 #include <windows.h> 7 7 … … 156 156 box->setMaterial("QueryCulledNodesMaterial"); 157 157 } 158 158 159 static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 159 //LogManager::getSingleton().logMessage("pushing box");160 160 } 161 161 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r112 r113 12 12 mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false) 13 13 { 14 CreateCulledNodeMaterials();15 16 14 } 17 15 //----------------------------------------------------------------------- … … 20 18 // material for frustum culled nodes 21 19 MaterialPtr mat = MaterialManager::getSingleton().getByName("FrustumCulledNodesMaterial"); 22 MaterialPtr baseWhite = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting");20 23 21 if (mat.isNull()) 24 22 { 25 23 mat = MaterialManager::getSingleton().create("FrustumCulledNodesMaterial", 26 24 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 27 28 //baseWhite.get()->copyDetailsTo(mat); 29 //mat->setColourWriteEnabled(true); 30 mat->setLightingEnabled(false); 31 //mat->setAmbient(ColourValue(1,0,0)); 25 mat->createTechnique()->createPass(); 26 27 mat->getTechnique(0)->getPass(0)->setAmbient(1,0,0); 28 mat->getTechnique(0)->getPass(0)->setLightingEnabled(true); 29 //mat->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false); 30 31 mat->load(); 32 32 } 33 33 34 34 // material for query culled nodes 35 MaterialPtr mat2= MaterialManager::getSingleton().getByName("QueryCulledNodesMaterial");36 37 if (mat 2.isNull())38 { 39 mat 2= MaterialManager::getSingleton().create("QueryCulledNodesMaterial",35 mat = MaterialManager::getSingleton().getByName("QueryCulledNodesMaterial"); 36 37 if (mat.isNull()) 38 { 39 mat = MaterialManager::getSingleton().create("QueryCulledNodesMaterial", 40 40 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 41 //baseWhite.get()->copyDetailsTo(mat2); 42 // mat2->setColourWriteEnabled(true); 43 mat2->setLightingEnabled(false); 44 //mat2->setAmbient(ColourValue(0,0,1)); 41 mat->createTechnique()->createPass(); 42 43 mat->getTechnique(0)->getPass(0)->setAmbient(0,0,1); 44 mat->getTechnique(0)->getPass(0)->setLightingEnabled(true); 45 mat->load(); 45 46 } 46 47 } … … 126 127 SetCullCamera(cam); 127 128 } 129 130 CreateCulledNodeMaterials(); 128 131 } 129 132 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r112 r113 142 142 if (key == "RenderNodesForViz") 143 143 { 144 mRenderNodesForViz = (*static_cast<const bool*>(val));144 mRenderNodesForViz = (*static_cast<const int *>(val)); 145 145 return true; 146 146 } -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r112 r113 20 20 mShowVisualization(false), 21 21 mRenderNodesForViz(false), 22 mRenderNodesContentForViz(false), 22 23 mVisualizeCulledNodes(false) 23 24 { … … 39 40 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 40 41 { 42 // only shadow casters will be rendered in shadow texture pass 41 43 mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 44 42 45 // does nothing if hierarchical culling is used => 43 46 // we interleave identification and rendering of objects … … 64 67 // ignore 65 68 } 66 67 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it)69 70 if (mRenderNodesForViz || mRenderNodesContentForViz) 68 71 { 69 MaterialPtr mp = (*it)->getMaterial(); 70 71 mp.get()->setLightingEnabled(false); 72 mp.get()->setAmbient(ColourValue(1,0,0)); 73 mp.get()->setDiffuse(ColourValue(1,1,1)); 74 mp.get()->setSpecular(ColourValue(1,1,1)); 75 76 mp.get()->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 77 //*mp = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting"); 78 //(*it)->setMaterialName("BaseWhiteNoLighting"); 79 getRenderQueue()->addRenderable(*it); 80 81 if (mRenderNodesForViz) 72 // change node material so it is better suited for visualization 73 MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 74 nodeMat->setAmbient(1, 1, 0); 75 nodeMat->setLightingEnabled(true); 76 nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 77 78 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 82 79 { 83 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 80 if (mRenderNodesForViz) 81 { 82 getRenderQueue()->addRenderable(*it); 83 } 84 if (mRenderNodesContentForViz) 85 { 86 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 87 } 84 88 } 85 89 } … … 109 113 if (!mUseVisibilityCulling || mShowVisualization) 110 114 { 115 //mDestRenderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM); 116 //mDestRenderSystem->unbindGpuProgram(GPT_FRAGMENT_PROGRAM); 111 117 TerrainSceneManager::_renderVisibleObjects(); 112 118 … … 179 185 { 180 186 mRenderNodesForViz = (*static_cast<const bool *>(val)); 187 return true; 188 } 189 if (key == "RenderNodesContentForViz") 190 { 191 mRenderNodesContentForViz = (*static_cast<const bool *>(val)); 181 192 return true; 182 193 } -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r112 r113 92 92 { 93 93 // Set ambient light 94 //mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));95 94 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 96 95 97 96 //-- create light 98 97 mSunLight = mSceneMgr->createLight("SunLight"); … … 104 103 mSunLight->setCastShadows(true); 105 104 106 Vector3 dir(0.5, 0.5, 0.5);105 Vector3 dir(0.5, 1, 0.5); 107 106 dir.normalise(); 108 107 mSunLight->setDirection(dir); … … 237 236 mVizCamera(vizCamera), 238 237 mShowVisualization(false), 239 m RenderNodesForViz(false),238 mNodeVizMode(NODEVIZ_NONE), 240 239 mVizCameraHeight(Real(2500.0)), 241 240 mCamNode(camNode), … … 292 291 mSceneMgr->setOption("CullCamera", &mCullCamera); 293 292 mSceneMgr->setOption("ShowVisualization", &mShowVisualization); 294 mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 295 293 296 294 pOver->show(); 297 295 } … … 403 401 // important for visualization => draw octree bounding boxes 404 402 mSceneMgr->setOption("ShowOctree", &mShowVisualization); 405 // also render geometry?406 mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz);403 // also render nodew content? 404 //mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 407 405 408 406 // -- setup visualization camera … … 454 452 KEY_PRESSED(KC_C, 0.3, toggleUseVisibilityCulling()); 455 453 KEY_PRESSED(KC_1, 0.3, toggleShowViz()); 456 KEY_PRESSED(KC_2, 0.3, toggleRenderNodesForViz());454 KEY_PRESSED(KC_2, 0.3, nextNodeVizMode()); 457 455 458 456 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 459 457 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 460 458 461 KEY_PRESSED(KC_ 3, 0, zoomVizCamera(50));462 KEY_PRESSED(KC_ 4, 0, zoomVizCamera(-50));459 KEY_PRESSED(KC_4, 0, zoomVizCamera(50)); 460 KEY_PRESSED(KC_5, 0, zoomVizCamera(-50)); 463 461 464 462 KEY_PRESSED(KC_F1, 0.3, nextAppState()); … … 758 756 } 759 757 //----------------------------------------------------------------------- 760 void MouseQueryListener::toggleRenderNodesForViz() 761 { 762 mRenderNodesForViz = !mRenderNodesForViz; 763 764 mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 758 void MouseQueryListener::nextNodeVizMode() 759 { 760 mNodeVizMode = (mNodeVizMode + 1) % NODEVIZ_MODES_NUM; 761 762 bool renderNodesForViz = 763 (mNodeVizMode == NODEVIZ_RENDER_NODES) || 764 (mNodeVizMode == NODEVIZ_RENDER_NODES_AND_CONTENT); 765 bool renderNodesContentForViz = mNodeVizMode == NODEVIZ_RENDER_NODES_AND_CONTENT; 766 767 mSceneMgr->setOption("RenderNodesForViz", &renderNodesForViz); 768 mSceneMgr->setOption("RenderNodesContentForViz", &renderNodesContentForViz); 765 769 } 766 770 //----------------------------------------------------------------------- … … 848 852 const bool nShowViz = !showViz; 849 853 854 // ambient light must be full for visualization 855 if (showViz) 856 { 857 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); 858 } 859 else 860 { 861 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 862 } 863 850 864 mSceneMgr->setOption("ShowVisualization", &showViz); 851 865 mSceneMgr->setOption("SkyBoxEnabled", &nShowViz); -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r112 r113 87 87 enum {WALKTHROUGH, REPLAY, STATE_NUM}; 88 88 89 // visualization modes for scene nodes 90 enum {NODEVIZ_NONE, NODEVIZ_RENDER_NODES, 91 NODEVIZ_RENDER_NODES_AND_CONTENT, NODEVIZ_MODES_NUM}; 92 89 93 void nextAlgorithm(); 90 94 void changeThreshold(int incr); … … 95 99 void toggleUseVisibilityCulling(); 96 100 void toggleShowViz(); 97 void toggleRenderNodesForViz();101 void nextNodeVizMode(); 98 102 void toggleRecord(); 99 103 … … 148 152 bool mUseVisibilityCulling; 149 153 bool mShowVisualization; 150 bool mRenderNodesForViz;154 int mNodeVizMode; 151 155 bool mCullCamera; 152 156
Note: See TracChangeset
for help on using the changeset viewer.