- Timestamp:
- 05/25/05 18:28:46 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/CullingManager.h
r87 r112 43 43 /** basic initializations on beginning of each frame, e.g., 44 44 resets statistics. 45 @param visualizeCulledNodes 45 46 */ 46 void InitFrame(); 47 void InitFrame(bool visualizeCulledNodes); 48 49 /** Some visualization of culled nodes are shown, depending 50 on the type of hierarchy. 51 @param showVisualization if true, culled nodes are visualized 52 */ 53 void SetVisualizeCulledNodes(bool visualizeCulledNodes); 47 54 48 55 protected: … … 54 61 55 62 HierarchyInterface *mHierarchyInterface; 63 bool mVisualizeCulledNodes; 56 64 }; 57 65 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r111 r112 5 5 6 6 namespace GtpVisibility { 7 8 enum CullingType {QUERY_CULLED, FRUSTUM_CULLED}; 7 9 8 10 /** Class which implements a hierarchy interface for a scene hierarchy. … … 109 111 */ 110 112 void SetUseOptimization(bool useOptimization); 113 //bool mIsShadowPass; 111 114 112 bool mDummy; 115 /** Visualization of a culled node, dependent on the culling type. 116 @param type can be one of FRUSTUM_CULLED, QUERY_CULLED 117 */ 118 virtual void VisualizeCulledNode(HierarchyNode *node, 119 CullingType type) = NULL; 113 120 114 121 protected: -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r111 r112 8 8 { 9 9 //InitFrame(); 10 11 10 QueryQueue queryQueue; 12 11 unsigned int visiblePixels = 0; … … 30 29 } 31 30 else 32 { 33 if (mHierarchyInterface->mDummy) 31 { //if (mHierarchyInterface->mIsShadowPass) 34 32 mNumQueryCulledNodes ++; 33 34 if(mVisualizeCulledNodes) 35 { 36 mHierarchyInterface->VisualizeCulledNode(node, QUERY_CULLED); 37 } 35 38 } 36 39 } … … 45 48 46 49 if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 47 { if (mHierarchyInterface->mDummy)50 {//if (mHierarchyInterface->mIsShadowPass) 48 51 mNumFrustumCulledNodes ++; 52 53 if(mVisualizeCulledNodes) 54 { 55 mHierarchyInterface->VisualizeCulledNode(node, QUERY_CULLED); 56 } 49 57 } 50 58 else -
trunk/VUT/GtpVisibility/src/CullingManager.cpp
r87 r112 6 6 CullingManager::CullingManager(): 7 7 mHierarchyInterface(NULL), mVisibilityThreshold(0), mNumQueryCulledNodes(0), 8 mNumFrustumCulledNodes(0), mNumQueriesIssued(0) 8 mNumFrustumCulledNodes(0), mNumQueriesIssued(0), 9 mVisualizeCulledNodes(false) 9 10 { 10 11 } … … 35 36 } 36 37 //----------------------------------------------------------------------- 37 void CullingManager::InitFrame() 38 void CullingManager::SetVisualizeCulledNodes(bool visualizeCulledNodes) 39 { 40 mVisualizeCulledNodes = visualizeCulledNodes; 41 } 42 //----------------------------------------------------------------------- 43 void CullingManager::InitFrame(bool visualizeCulledNodes) 38 44 { 39 45 mNumFrustumCulledNodes = mNumQueryCulledNodes = mNumQueriesIssued = 0; 46 mVisualizeCulledNodes = visualizeCulledNodes; 40 47 } 41 48 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r111 r112 11 11 while (!mHierarchyInterface->GetQueue()->empty()) 12 12 { 13 if (mHierarchyInterface->mDummy)14 Ogre::LogManager::getSingleton().logMessage("shadow pass");15 // elseOgre::LogManager::getSingleton().logMessage("no shadow pass");16 13 HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 17 14 mHierarchyInterface->GetQueue()->pop(); … … 22 19 23 20 if (!mHierarchyInterface->CheckFrustumVisible(node)) 24 { if (mHierarchyInterface->mDummy)21 {//if (mHierarchyInterface->mIsShadowPass) 25 22 mNumFrustumCulledNodes ++; 26 23 } -
trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
r111 r112 8 8 HierarchyInterface::HierarchyInterface(): 9 9 mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0), 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true) ,11 mDummy(false)10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true) 11 //, mIsShadowPass(false) 12 12 { 13 13 mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r111 r112 21 21 22 22 if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 23 { if (mHierarchyInterface->mDummy)23 {//if (mHierarchyInterface->mIsShadowPass) 24 24 mNumFrustumCulledNodes ++; 25 25 } … … 46 46 } 47 47 else 48 { 49 if (mHierarchyInterface->mDummy) 48 { //if (mHierarchyInterface->mIsShadowPass) 50 49 mNumQueryCulledNodes ++; 51 50 } -
trunk/VUT/Ogre/include/OgreOctreeHierarchyInterface.h
r87 r112 43 43 unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const; 44 44 45 void VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 46 GtpVisibility::CullingType type); 47 45 48 protected: 46 49 /** Returns pointer to the bounding box of the node. -
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r111 r112 86 86 87 87 protected: 88 /** materials for visualizing frustum and query culled nodes */ 89 void CreateCulledNodeMaterials(); 90 88 91 /** A pass that prepares an occlusion query. 89 92 @remark disables depth write, colour write, lighting, -
trunk/VUT/Ogre/include/OgreSceneNodeHierarchyInterface.h
r87 r112 35 35 36 36 AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node); 37 38 void VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 39 GtpVisibility::CullingType type); 37 40 }; 38 41 -
trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
r100 r112 60 60 bool mUseVisibilityCulling; 61 61 bool mShowVisualization; 62 bool mRenderNodesForViz; 63 bool mVisualizeCulledNodes; 62 64 }; 63 65 -
trunk/VUT/Ogre/include/OgreVisibilitySceneManager.h
r103 r112 59 59 bool mUseVisibilityCulling; 60 60 bool mShowVisualization; 61 62 bool mVisualizeCulledNodes; 61 63 }; 62 64 } // namespace Ogre -
trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
r103 r112 63 63 bool mShowVisualization; 64 64 bool mRenderNodesForViz; 65 bool mVisualizeCulledNodes; 65 66 }; 66 67 -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r103 r112 142 142 return &mBox; 143 143 } 144 //----------------------------------------------------------------------- 145 void OctreeHierarchyInterface::VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 146 GtpVisibility::CullingType type) 147 { 148 WireBoundingBox *box = static_cast<Octree *>(node)->getWireBoundingBox(); 144 149 150 if (type == GtpVisibility::FRUSTUM_CULLED) 151 { 152 box->setMaterial("FrustumCulledNodesMaterial"); 153 } 154 else // type == GtpVisibility::QUERY_CULLED 155 { 156 box->setMaterial("QueryCulledNodesMaterial"); 157 } 158 static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 159 //LogManager::getSingleton().logMessage("pushing box"); 160 } 145 161 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r111 r112 12 12 mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false) 13 13 { 14 CreateCulledNodeMaterials(); 15 16 } 17 //----------------------------------------------------------------------- 18 void PlatformHierarchyInterface::CreateCulledNodeMaterials() 19 { 20 // material for frustum culled nodes 21 MaterialPtr mat = MaterialManager::getSingleton().getByName("FrustumCulledNodesMaterial"); 22 MaterialPtr baseWhite = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting"); 23 if (mat.isNull()) 24 { 25 mat = MaterialManager::getSingleton().create("FrustumCulledNodesMaterial", 26 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)); 32 } 33 34 // material for query culled nodes 35 MaterialPtr mat2 = MaterialManager::getSingleton().getByName("QueryCulledNodesMaterial"); 36 37 if (mat2.isNull()) 38 { 39 mat2 = MaterialManager::getSingleton().create("QueryCulledNodesMaterial", 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)); 45 } 14 46 } 15 47 //----------------------------------------------------------------------- … … 162 194 // Set colour write mode off 163 195 mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false); 164 // Set colour write mode pff165 mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false);166 196 } 167 197 //----------------------------------------------------------------------- … … 177 207 { 178 208 mOnlyShadowCasters = onlyShadowCasters; 179 mDummy= mOnlyShadowCasters ;209 //mIsShadowPass = mOnlyShadowCasters ; 180 210 } 181 211 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
r111 r112 87 87 { 88 88 Matrix3 mat; 89 mat.FromEulerAnglesYXZ(Degree(rotation.x),//.valueRadians(), 90 Degree(rotation.y),//.valueRadians(), 91 Degree(rotation.z));//.valueRadians()); 89 mat.FromEulerAnglesYXZ(Degree(rotation.x), Degree(rotation.y), 90 Degree(rotation.z)); 92 91 93 92 return GenerateSceneObject(position, Quaternion(mat), objName); -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r103 r112 124 124 return &mBox; 125 125 } 126 //----------------------------------------------------------------------- 127 void SceneNodeHierarchyInterface::VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 128 GtpVisibility::CullingType type) 129 { 130 // TODO 131 } 126 132 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r103 r112 12 12 VisibilityOctreeSceneManager::VisibilityOctreeSceneManager( 13 13 GtpVisibility::VisibilityManager *visManager) 14 : mVisibilityManager(visManager), mUseVisibilityCulling(true), 15 mShowVisualization(false) 14 : 15 mVisibilityManager(visManager), 16 mUseVisibilityCulling(true), 17 mShowVisualization(false), 18 mRenderNodesForViz(false), 19 mVisualizeCulledNodes(false) 16 20 { 17 21 mHierarchyInterface = … … 37 41 mCullCamera ? getCamera("CullCamera") : NULL); 38 42 39 // call initframe to reset culling manager stats40 mVisibilityManager->GetCullingManager()->InitFrame();41 42 // standard terrain scenemanager rendering without hierarchical culling43 if (!mUseVisibilityCulling || mShowVisualization)44 { 45 OctreeSceneManager::_renderVisibleObjects();46 return;47 } 43 if (!mShowVisualization) 44 { 45 // two cameras (one for culling, one for rendering) 46 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 47 mCullCamera ? getCamera("CullCamera") : NULL); 48 49 // call initframe to reset culling manager stats 50 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 51 } 48 52 49 53 //-- hierarchical culling … … 136 140 return true; 137 141 } 142 if (key == "RenderNodesForViz") 143 { 144 mRenderNodesForViz = (*static_cast<const bool *>(val)); 145 return true; 146 } 147 if (key == "SkyBoxEnabled") 148 { 149 mSkyBoxEnabled = (*static_cast<const bool *>(val)); 150 return true; 151 } 152 if (key == "SkyPlaneEnabled") 153 { 154 mSkyPlaneEnabled = (*static_cast<const bool *>(val)); 155 return true; 156 } 157 if (key == "SkyDomeEnabled") 158 { 159 mSkyDomeEnabled = (*static_cast<const bool *>(val)); 160 return true; 161 } 162 if (key == "VisualizeCulledNodes") 163 { 164 mVisualizeCulledNodes = (*static_cast<const bool *>(val)); 165 return true; 166 } 138 167 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 139 168 setOption(key, val) || OctreeSceneManager::setOption(key, val); -
trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
r111 r112 38 38 void VisibilitySceneManager::_renderVisibleObjects() 39 39 { 40 // two cameras (one for culling, one for rendering) 41 mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 40 if (!mShowVisualization) 41 { 42 // two cameras (one for culling, one for rendering) 43 mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress); 42 44 43 // call initframe to reset culling manager stats 44 mVisibilityManager->GetCullingManager()->InitFrame(); 45 // call initframe to reset culling manager stats 46 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 47 } 45 48 46 49 // standard terrain scenemanager rendering without hierarchical culling … … 48 51 { 49 52 SceneManager::_renderVisibleObjects(); 53 50 54 return; 51 55 } 52 56 53 57 //-- hierarchical culling 54 58 // the objects of different layers (e.g., background, scene, -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r111 r112 19 19 mUseVisibilityCulling(true), 20 20 mShowVisualization(false), 21 mRenderNodesForViz(false) 21 mRenderNodesForViz(false), 22 mVisualizeCulledNodes(false) 22 23 { 23 24 mHierarchyInterface = … … 66 67 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 67 68 { 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"); 68 79 getRenderQueue()->addRenderable(*it); 69 80 … … 85 96 void VisibilityTerrainSceneManager::_renderVisibleObjects() 86 97 { 87 88 98 if (!mShowVisualization) 89 99 { … … 93 103 94 104 // call initframe to reset culling manager stats 95 mVisibilityManager->GetCullingManager()->InitFrame( );96 } 97 105 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 106 } 107 98 108 // standard terrain scenemanager rendering without hierarchical culling 99 109 if (!mUseVisibilityCulling || mShowVisualization) … … 184 194 { 185 195 mSkyDomeEnabled = (*static_cast<const bool *>(val)); 196 return true; 197 } 198 if (key == "VisualizeCulledNodes") 199 { 200 mVisualizeCulledNodes = (*static_cast<const bool *>(val)); 186 201 return true; 187 202 } -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r111 r112 113 113 mUseVisibilityCulling(true), 114 114 mUseOptimization(true), 115 mShowVisualization(false) 115 mShowVisualization(false), 116 mVisualizeCulledNodes(false) 116 117 { 117 118 // Reduce move speed … … 293 294 294 295 mSceneMgr->setOption("ShowVisualization", &mShowVisualization); 296 mSceneMgr->setOption("VisualizeCulledNodes", &mVisualizeCulledNodes); 295 297 } 296 298 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r107 r112 97 97 bool mShowVisualization; 98 98 99 bool mVisualizeCulledNodes; 100 99 101 Camera *mVizCamera; 100 102 }; -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r111 r112 93 93 // Set ambient light 94 94 //mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 95 mSceneMgr->setAmbientLight(ColourValue(0. 0, 0.0, 0.0));95 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 96 96 97 97 //-- create light … … 99 99 mSunLight->setType(Light::LT_DIRECTIONAL); 100 100 //mSunLight->setType(Light::LT_SPOTLIGHT); 101 //mSunLight->setSpotlightRange(Degree(30), Degree(50)); 102 101 103 mSunLight->setPosition(707, 2000, 500); 102 104 mSunLight->setCastShadows(true); 103 105 104 //mSunLight->setSpotlightRange(Degree(30), Degree(50)); 105 106 Vector3 dir(0.5, 0.1, 0.5); 106 Vector3 dir(0.5, 0.5, 0.5); 107 107 dir.normalise(); 108 mSunLight->setDirection(Vector3::NEGATIVE_UNIT_Y); 108 mSunLight->setDirection(dir); 109 //mSunLight->setDirection(Vector3::NEGATIVE_UNIT_Y); 109 110 110 111 mSunLight->setDiffuseColour(1, 1, 1); … … 130 131 setupGui(); 131 132 132 //mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE);133 134 133 // Floor plane 135 Plane plane;134 /*Plane plane; 136 135 plane.normal = Vector3::UNIT_Y; 137 136 plane.d = -60; … … 142 141 pPlaneEnt->setMaterialName("Examples/Rockwall"); 143 142 pPlaneEnt->setCastShadows(true); 144 mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); 143 mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);*/ 145 144 146 145 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_HWRENDER_TO_TEXTURE)) … … 154 153 mSceneMgr->setShadowTextureSettings(512, 2); 155 154 } 156 mSceneMgr->setShadowColour(ColourValue(0, 0, 0)); 157 // mSceneMgr->setShowDebugShadows(true); 155 //mSceneMgr->setShadowColour(ColourValue(0, 0, 0)); 156 mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 157 // mSceneMgr->setShowDebugShadows(true); 158 158 159 159 … … 175 175 176 176 // the objects are generated on the whole terrain 177 mTerrainContentGenerator->GenerateScene(1500, "athene");178 //mTerrainContentGenerator->GenerateScene(1500, "robot");177 //mTerrainContentGenerator->GenerateScene(1500, "athene"); 178 mTerrainContentGenerator->GenerateScene(1500, "robot"); 179 179 // mTerrainContentGenerator->GenerateScene(500, "ninja"); 180 180 } … … 245 245 mRecord(false), 246 246 mTimeElapsed(0), 247 mUseShadows(false) 247 mUseShadows(false), 248 mVisualizeCulledNodes(false) 248 249 { 249 250 // Reduce move speed … … 704 705 { 705 706 mShowVisualization = !mShowVisualization; 707 mVisualizeCulledNodes = !mVisualizeCulledNodes; 706 708 707 709 // create viewport with priority VIZ_VIEWPORT_Z_ORDER: … … 718 720 mVizCamera->setAspectRatio(Real(vizvp->getActualWidth()) / 719 721 Real(vizvp->getActualHeight())); 722 723 mSceneMgr->setOption("VisualizeCulledNodes", &mVisualizeCulledNodes); 720 724 //vizvp->setClearEveryFrame(false); 721 725 … … 732 736 { 733 737 mWindow->removeViewport(VIZ_VIEWPORT_Z_ORDER); 734 // if octree was enabled for visualization purpose 738 // if octree was enabled for visualization purpose, reset now 735 739 mSceneMgr->setOption("ShowOctree", &mShowOctree); 736 740 } -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r111 r112 165 165 Real mTimeElapsed; 166 166 bool mUseShadows; 167 168 bool mVisualizeCulledNodes; 167 169 }; 168 170 -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h
r103 r112 111 111 */ 112 112 void _renderOctant(Camera* cam, Octree *octree, bool onlyShadowCasters); 113 114 /** Returns stored list of boxes */ 115 BoxList *getBoxes(); 113 116 #endif // GTP_VISIBILITY_MODIFIED_OGRE 114 117 -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp
r103 r112 1167 1167 } 1168 1168 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 1169 //----------------------------------------------------------------------- 1170 BoxList *OctreeSceneManager::getBoxes() 1171 { 1172 return &mBoxes; 1173 } 1169 1174 //----------------------------------------------------------------------- 1170 1175 void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant, bool onlyShadowCasters)
Note: See TracChangeset
for help on using the changeset viewer.