Changeset 111
- Timestamp:
- 05/24/05 17:55:14 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r87 r111 110 110 void SetUseOptimization(bool useOptimization); 111 111 112 bool mDummy; 113 112 114 protected: 113 115 … … 124 126 HierarchyNode *mSceneRoot; 125 127 HierarchyNode *mPreviousNode; 128 129 126 130 }; 127 131 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r96 r111 7 7 void CoherentHierarchicalCullingManager::RenderScene() 8 8 { 9 InitFrame();9 //InitFrame(); 10 10 11 11 QueryQueue queryQueue; … … 31 31 else 32 32 { 33 if (mHierarchyInterface->mDummy) 33 34 mNumQueryCulledNodes ++; 34 35 } … … 44 45 45 46 if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 46 { 47 { if (mHierarchyInterface->mDummy) 47 48 mNumFrustumCulledNodes ++; 48 49 } -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r96 r111 7 7 void FrustumCullingManager::RenderScene() 8 8 { 9 InitFrame();9 //InitFrame(); 10 10 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"); 13 16 HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 14 17 mHierarchyInterface->GetQueue()->pop(); … … 19 22 20 23 if (!mHierarchyInterface->CheckFrustumVisible(node)) 21 { 24 {if (mHierarchyInterface->mDummy) 22 25 mNumFrustumCulledNodes ++; 23 26 } -
trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
r86 r111 8 8 HierarchyInterface::HierarchyInterface(): 9 9 mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0), 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true) 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true), 11 mDummy(false) 11 12 { 12 13 mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r103 r111 1 1 #include "StopAndWaitCullingManager.h" 2 2 #include <OgreLogManager.h> 3 4 3 5 4 namespace GtpVisibility { … … 8 7 void StopAndWaitCullingManager::RenderScene() 9 8 { 10 InitFrame();9 //InitFrame(); 11 10 12 11 while (!mHierarchyInterface->GetQueue()->empty()) … … 22 21 23 22 if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 24 { 23 {if (mHierarchyInterface->mDummy) 25 24 mNumFrustumCulledNodes ++; 26 25 } … … 48 47 else 49 48 { 49 if (mHierarchyInterface->mDummy) 50 50 mNumQueryCulledNodes ++; 51 51 } -
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r103 r111 82 82 */ 83 83 void SetOnlyShadowCasters(bool onlyShadowCasters); 84 /** see set */ 85 bool GetOnlyShadowCasters(); 84 86 85 87 protected: -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r103 r111 177 177 { 178 178 mOnlyShadowCasters = onlyShadowCasters; 179 mDummy = mOnlyShadowCasters ; 180 } 181 //----------------------------------------------------------------------- 182 bool PlatformHierarchyInterface::GetOnlyShadowCasters() 183 { 184 return mOnlyShadowCasters; 179 185 } 180 186 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
r110 r111 72 72 createChildSceneNode(String(name) + "Node", position); 73 73 74 //ent->setCastShadows(false); 74 75 currentObject->attachObject(ent); 75 76 currentObject->setScale(mScale); -
trunk/VUT/Ogre/src/OgreTerrainContentGenerator.cpp
r110 r111 76 76 if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) 77 77 { 78 queryResult.y += mOffset;79 78 // reject if height is too high 80 79 if (queryResult.y < mMaxPos.y) 81 80 { 81 // add offset so object is over terrain 82 queryResult.y += mOffset; 83 82 84 return SceneContentGenerator::GenerateSceneObject(queryResult, rotation, objName); 83 85 } -
trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
r103 r111 25 25 void VisibilitySceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 26 26 { 27 mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 27 28 // does nothing if hierarchical culling is used => 28 29 // we interleave identification and rendering of objects -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r107 r111 85 85 void VisibilityTerrainSceneManager::_renderVisibleObjects() 86 86 { 87 87 88 if (!mShowVisualization) 88 89 { -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r107 r111 57 57 58 58 // Create a skybox 59 //mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 2000, false);59 mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 2000, true); 60 60 ColourValue fadeColour(0.1, 0.1, 0.6); 61 61 mWindow->getViewport(0)->setBackgroundColour(fadeColour); -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r110 r111 52 52 //mCamera->setPosition(707, 5000, 528); 53 53 mCamNode->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329)); 54 55 54 mCamNode->attachObject(mCamera); 56 55 … … 97 96 98 97 //-- create light 99 mSunLight = mSceneMgr->createLight("MainLight"); 100 mSunLight->setType(Light::LT_POINT); 101 mSunLight->setPosition(-707, 4000, -500); 98 mSunLight = mSceneMgr->createLight("SunLight"); 99 mSunLight->setType(Light::LT_DIRECTIONAL); 100 //mSunLight->setType(Light::LT_SPOTLIGHT); 101 mSunLight->setPosition(707, 2000, 500); 102 mSunLight->setCastShadows(true); 103 102 104 //mSunLight->setSpotlightRange(Degree(30), Degree(50)); 103 105 104 Vector3 dir; 105 dir = -mSunLight->getPosition(); 106 Vector3 dir(0.5, 0.1, 0.5); 106 107 dir.normalise(); 107 mSunLight->setDirection(dir); 108 mSunLight->setDiffuseColour(0.8, 0.8, 0.8); 109 mSunLight->setSpecularColour(0.9, 0.9, 1); 110 111 //mSunLight->setCastShadows(true); 108 mSunLight->setDirection(Vector3::NEGATIVE_UNIT_Y); 109 110 mSunLight->setDiffuseColour(1, 1, 1); 111 mSunLight->setSpecularColour(1, 1, 1); 112 112 113 113 // --Fog … … 130 130 setupGui(); 131 131 132 //mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 133 134 // Floor plane 135 Plane plane; 136 plane.normal = Vector3::UNIT_Y; 137 plane.d = -60; 138 MeshManager::getSingleton().createPlane("Myplane", 139 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane, 140 5000,5000,100,100,true,1,5,5,Vector3::UNIT_Z); 141 Entity* pPlaneEnt = mSceneMgr->createEntity( "plane", "Myplane" ); 142 pPlaneEnt->setMaterialName("Examples/Rockwall"); 143 pPlaneEnt->setCastShadows(true); 144 mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); 145 146 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_HWRENDER_TO_TEXTURE)) 147 { 148 // In D3D, use a 1024x1024 shadow texture 149 mSceneMgr->setShadowTextureSettings(1024, 2); 150 } 151 else 152 { 153 // Use 512x512 texture in GL since we can't go higher than the window res 154 mSceneMgr->setShadowTextureSettings(512, 2); 155 } 156 mSceneMgr->setShadowColour(ColourValue(0, 0, 0)); 157 // mSceneMgr->setShowDebugShadows(true); 158 159 132 160 //-- terrain content setup 133 161 … … 144 172 // => there is much occlusion 145 173 mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 50.0f, 3000.0f)); 146 mTerrainContentGenerator->SetOffset( 50);174 mTerrainContentGenerator->SetOffset(0); 147 175 148 176 // the objects are generated on the whole terrain 149 177 mTerrainContentGenerator->GenerateScene(1500, "athene"); 178 //mTerrainContentGenerator->GenerateScene(1500, "robot"); 150 179 // mTerrainContentGenerator->GenerateScene(500, "ninja"); 151 180 } … … 215 244 mCurrentFrame(0), 216 245 mRecord(false), 217 mTimeElapsed(0) 246 mTimeElapsed(0), 247 mUseShadows(false) 218 248 { 219 249 // Reduce move speed … … 292 322 // Get results, create a node/entity on the position 293 323 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject( 294 mouseRay.getOrigin(), Vector3(0,0,0), "robot .mesh");324 mouseRay.getOrigin(), Vector3(0,0,0), "robot"); 295 325 296 326 mLMouseDown = true; … … 434 464 KEY_PRESSED(KC_F2, 0.3, toggleRecord()); 435 465 KEY_PRESSED(KC_F3, 0.3, mTerrainContentGenerator->WriteObjects(objects_outfile)); 466 KEY_PRESSED(KC_F4, 0.3, toggleUseShadows()); 436 467 //KEY_PRESSED(KC_F3, 0.3, writeFrames()); 437 468 //KEY_PRESSED(KC_F4, 0.3, loadFrames()); … … 706 737 } 707 738 //----------------------------------------------------------------------- 739 void MouseQueryListener::toggleUseShadows() 740 { 741 mUseShadows = !mUseShadows; 742 743 //mSunLight->setCastShadows(mUseShadows); 744 745 if (mUseShadows) 746 { 747 mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE); 748 } 749 else 750 { 751 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 752 } 753 754 } 755 //----------------------------------------------------------------------- 708 756 void MouseQueryListener::toggleRenderNodesForViz() 709 757 { -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r109 r111 113 113 void loadFrames(); 114 114 115 void toggleUseShadows(); 116 115 117 protected: 116 118 void Clamp2Terrain(); … … 162 164 bool mRecord; 163 165 Real mTimeElapsed; 166 bool mUseShadows; 164 167 }; 165 168
Note: See TracChangeset
for help on using the changeset viewer.