Changeset 139 for trunk/VUT/work/TestCullingTerrain
- Timestamp:
- 06/20/05 08:13:57 (20 years ago)
- Location:
- trunk/VUT/work/TestCullingTerrain
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r137 r139 75 75 mCullCamera(false), 76 76 mRecord(false), 77 m UseShadows(false),77 mShowShadows(false), 78 78 mShowHelp(false), 79 79 mDisplayCameraDetails(false), … … 159 159 mSceneMgr->setOption("ShowOctree", &mShowOctree); 160 160 mSceneMgr->setOption("CullCamera", &mCullCamera); 161 mSceneMgr->setOption(" ShowVisualization", &mShowVisualization);161 mSceneMgr->setOption("PrepareVisualization", &mShowVisualization); 162 162 163 163 // TODO: change this (does not work with other scene manager plugins) … … 257 257 } 258 258 259 // mInputDevice->capture(); 259 if (mDisplayCameraDetails) 260 { 261 // Print camera details 262 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + 263 " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation())); 264 } 260 265 261 266 //-- IMPORTANT: must be set, otherwise terrain is not rendered correctly … … 706 711 void TerrainFrameListener::toggleShowViz() 707 712 { 708 mShowVisualization = !mShowVisualization; 709 mVisualizeCulledNodes = !mVisualizeCulledNodes; 710 713 mVisualizeCulledNodes = mShowVisualization = !mShowVisualization; 714 711 715 // create viewport with priority VIZ_VIEWPORT_Z_ORDER: 712 716 // will be rendered over standard viewport … … 721 725 // Alter the camera aspect ratio to match the viewport 722 726 mVizCamera->setAspectRatio(Real(vizvp->getActualWidth()) / 723 Real(vizvp->getActualHeight()));727 Real(vizvp->getActualHeight())); 724 728 725 729 mSceneMgr->setOption("VisualizeCulledNodes", &mVisualizeCulledNodes); … … 733 737 mSceneMgr->setSkyPlane(true, plane, "Examples/TransparentTest", 4000, 75, false); 734 738 */ 735 736 739 } 737 740 else 738 741 { 742 // remove visualization viewport 739 743 mWindow->removeViewport(VIZ_VIEWPORT_Z_ORDER); 740 // if octree was enabled for visualization purpose, reset now 744 745 // octree bounding boxes are shown for visualization purpose, reset now 741 746 mSceneMgr->setOption("ShowOctree", &mShowOctree); 742 747 } 743 748 } 744 749 //----------------------------------------------------------------------- 745 void TerrainFrameListener::toggle UseShadows()746 { 747 m UseShadows = !mUseShadows;748 749 mSunLight->setCastShadows(m UseShadows);750 751 if (m UseShadows)750 void TerrainFrameListener::toggleShowShadows() 751 { 752 mShowShadows = !mShowShadows; 753 754 mSunLight->setCastShadows(mShowShadows); 755 756 if (mShowShadows) 752 757 { 753 758 mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE); 759 //mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_MODULATIVE); 760 //mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); 754 761 } 755 762 else … … 805 812 break; 806 813 case KC_S: 807 toggle UseShadows();814 toggleShowShadows(); 808 815 break; 809 816 … … 857 864 break; 858 865 } 859 860 if (mDisplayCameraDetails)861 {862 // Print camera details863 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) +864 " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation()));865 }866 866 867 867 CEGUI::System::getSingleton().injectKeyDown(e->getKey()); -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r135 r139 98 98 void toggleShowStats(); 99 99 100 void toggle UseShadows();100 void toggleShowShadows(); 101 101 void toggleDisplayCameraDetails(); 102 102 void takeScreenShot(); … … 175 175 bool mCullCamera; 176 176 bool mRecord; 177 bool m UseShadows;177 bool mShowShadows; 178 178 bool mVisualizeCulledNodes; 179 179 bool mShowHelp; -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r137 r139 84 84 { 85 85 // Set ambient light 86 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 86 mAmbientLight = ColourValue(0.5, 0.5, 0.5); 87 mSceneMgr->setAmbientLight(mAmbientLight); 87 88 88 89 //-- create light … … 100 101 mSunLight->setDirection(dir); 101 102 //mSunLight->setDirection(Vector3::NEGATIVE_UNIT_Y); 102 103 103 mSunLight->setDiffuseColour(1, 1, 1); 104 104 mSunLight->setSpecularColour(1, 1, 1); … … 137 137 */ 138 138 mSceneMgr->setShadowTextureSettings(1024, 2); 139 /* if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_HWRENDER_TO_TEXTURE))140 { // In D3D, use a 1024x1024 shadow texture141 mSceneMgr->setShadowTextureSettings(1024, 2); } else {142 // Use 512x512 texture in GL since we can't go higher than the window res143 mSceneMgr->setShadowTextureSettings(512, 2);}144 */145 146 //mSceneMgr->setShadowColour(ColourValue(0, 0, 0));147 139 mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 148 // 140 //mSceneMgr->setShowDebugShadows(true); 149 141 150 142 … … 220 212 const bool nShowViz = !showViz; 221 213 222 // ambient light must be full for visualization 214 mSavedShadowTechnique = mSceneMgr->getShadowTechnique(); 215 mSavedAmbientLight = mSceneMgr->getAmbientLight(); 216 217 // -- ambient light must be full for visualization, shadows disabled 223 218 if (showViz) 224 219 { 225 220 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); 226 } 227 else 228 { 229 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 230 } 231 232 mSceneMgr->setOption("ShowVisualization", &showViz); 221 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 222 } 223 224 mSceneMgr->setOption("PrepareVisualization", &showViz); 233 225 mSceneMgr->setOption("SkyBoxEnabled", &nShowViz); 234 226 //mSceneMgr->setOption("SkyPlaneEnabled", &showViz); … … 239 231 void VisualizationRenderTargetListener::postRenderTargetUpdate(const RenderTargetEvent &evt) 240 232 { 233 // reset values 234 mSceneMgr->setShadowTechnique(mSavedShadowTechnique); 235 mSceneMgr->setAmbientLight(mSavedAmbientLight); 236 241 237 RenderTargetListener::postRenderTargetUpdate(evt); 242 238 } -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r133 r139 3 3 4 4 #include "CEGUIForwardRefs.h" 5 #include <OgreRenderTargetListener.h> 5 6 #include "ExampleApplication.h" 7 6 8 #include "OgreTerrainContentGenerator.h" 7 8 #include <OgreRenderTargetListener.h>9 9 #include "TerrainFrameListener.h" 10 10 … … 19 19 20 20 SceneManager *mSceneMgr; 21 22 ShadowTechnique mSavedShadowTechnique; 23 ColourValue mSavedAmbientLight; 21 24 }; 22 25 … … 54 57 SceneNode *mCamNode; 55 58 Light *mSunLight; 56 VisualizationRenderTargetListener *mRenderTargetListener;57 59 58 60 TerrainFrameListener *mTerrainFrameListener; 61 ColourValue mAmbientLight; 62 //VisualizationRenderTargetListener *mVizRenderTargetListener; 59 63 60 64 private:
Note: See TracChangeset
for help on using the changeset viewer.