Changeset 86
- Timestamp:
- 05/06/05 01:39:32 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r85 r86 36 36 @returns occlusion query for this node 37 37 */ 38 virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node) = 0; 38 virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node, 39 const bool wasVisible = false) = 0; 39 40 /** Sets the root of the scene hierarchy. 40 41 @param root the hierarchy root … … 105 106 */ 106 107 unsigned int GetNumRenderedNodes(); 108 /** Optimization when issuing occlusion test: test is done with actual geometry 109 rather than the bounding box 110 @param useOptimization if the optimization should be used 111 */ 112 void SetUseOptimization(bool useOptimization); 107 113 108 114 protected: 109 115 116 bool mUseOptimization; 110 117 unsigned int mFrameId; 111 118 -
trunk/VUT/GtpVisibility/include/OcclusionQuery.h
r59 r86 9 9 { 10 10 public: 11 // OcclusionQuery();12 11 virtual ~OcclusionQuery() {}; 13 12 /** Returns the result of an occlusion query in terms of visible pixels. 14 @returns number of visible pixels 13 @param queryResult the number of visible pixels if the result was available 14 @param waitForResult if we should wait for the result until available 15 @returns if the result was already available 15 16 */ 16 virtual unsigned int GetQueryResult() const = 0; 17 /** Returns true if the result of the query is available, false otherwise. 18 @returns if result is available 19 */ 20 virtual bool ResultAvailable() const = 0; 17 virtual bool GetQueryResult(unsigned int &queryResult, 18 const bool waitForResult) const = 0; 21 19 /** Begins occlusion query. 22 20 @remark the query counts the number of visible pixels between it's begin and end -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r85 r86 1 1 #include "CoherentHierarchicalCullingManager.h" 2 //#include <windows.h>2 #include <windows.h> 3 3 4 4 namespace GtpVisibility { … … 8 8 { 9 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 //OutputDebugString("Coherent Culling\n");10 // OutputDebugString("Coherent Culling\n"); 11 11 12 12 QueryQueue queryQueue; 13 13 unsigned int visiblePixels = 0; 14 bool isAvailable = false; 15 14 16 //-- PART 1: process finished occlusion queries 15 17 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 16 18 { 17 19 while (!queryQueue.empty() && 18 (queryQueue.front().second->ResultAvailable() || mHierarchyInterface->GetQueue()->empty())) 20 queryQueue.front().second->GetQueryResult(visiblePixels, 21 mHierarchyInterface->GetQueue()->empty())) 19 22 { 20 23 HierarchyNode *node = queryQueue.front().first; 21 22 // wait until result available 23 unsigned int visiblePixels = queryQueue.front().second->GetQueryResult(); 24 24 25 25 queryQueue.pop(); 26 26 … … 67 67 68 68 // identify nodes that we cannot skip queries for 69 bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || mHierarchyInterface->IsLeaf(node); 69 bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || 70 mHierarchyInterface->IsLeaf(node); 70 71 71 72 // reset node's visibility classification … … 78 79 if (mustQuery) 79 80 { 80 queryQueue.push(QueryPair(node, mHierarchyInterface->IssueOcclusionQuery(node))); 81 queryQueue.push(QueryPair(node, 82 mHierarchyInterface->IssueOcclusionQuery(node, wasVisible))); 81 83 } 82 84 -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r85 r86 1 1 #include "FrustumCullingManager.h" 2 //#include <windows.h>2 #include <windows.h> 3 3 4 4 namespace GtpVisibility { -
trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
r85 r86 8 8 HierarchyInterface::HierarchyInterface(): 9 9 mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0), 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0) 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true) 11 11 { 12 12 mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); … … 64 64 return mNumRenderedNodes; 65 65 } 66 67 void HierarchyInterface::SetUseOptimization(bool useOptimization) 68 { 69 mUseOptimization = useOptimization; 70 } 71 66 72 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r85 r86 1 1 #include "StopAndWaitCullingManager.h" 2 //#include <windows.h>2 #include <windows.h> 3 3 4 4 namespace GtpVisibility { … … 35 35 } 36 36 37 unsigned int visiblePixels = 0; 38 39 mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult(visiblePixels, true); 40 37 41 // node visible 38 if (mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult() > 39 mVisibilityThreshold) 42 if (visiblePixels > mVisibilityThreshold) 40 43 { 41 44 mHierarchyInterface->TraverseNode(node); -
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r85 r86 65 65 /** Issue a occlusion query for this node. 66 66 @param node the current hierarchy node 67 @param wasVisible if the node was visible in the last frame 67 68 @returns occlusion query for this node 68 69 */ 69 GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::HierarchyNode *node); 70 GtpVisibility::OcclusionQuery *IssueOcclusionQuery( 71 GtpVisibility::HierarchyNode *node, const bool wasVisible); 70 72 71 73 protected: -
trunk/VUT/Ogre/include/OgrePlatformOcclusionQuery.h
r59 r86 20 20 virtual ~PlatformOcclusionQuery(); 21 21 22 virtual unsigned int GetQueryResult() const;23 virtual bool ResultAvailable() const;22 virtual bool GetQueryResult(unsigned int &queryResult, 23 const bool waitForResult) const; 24 24 virtual void BeginQuery() const; 25 25 virtual void EndQuery() const; -
trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h
r85 r86 16 16 17 17 SolidHalfBoundingBox(); 18 /** Sets up the first or second half of a solid boundingbox.18 /** Sets up the first or second half of a the solid box. 19 19 @param aab the axis aligned bounding box 20 20 @param isFirstHalf if it is the first or the second half … … 22 22 void SetupBoundingBox(const AxisAlignedBox& aabb, const bool isFirstHalf); 23 23 24 protected: 25 /** Builds the wireframe line list. 24 /** Builds the wireframe line list. 26 25 @param aab the axis aligned bounding box for setting up the vertices 27 26 @param first or second half of the box 28 27 */ 29 28 void SetupBoundingBoxVertices(const AxisAlignedBox& aab, const bool isFirstHalf); 29 30 protected: 31 30 32 /** 31 33 Sets the material used for occlusion queries. -
trunk/VUT/Ogre/resources/VisibilityDemo.overlay
r84 r86 10 10 top 5 11 11 width 450 12 height 5512 height 60 13 13 material Core/StatsBlockCenter 14 14 border_size 1 1 1 1 … … 69 69 left 155 70 70 top 20 71 width 90 72 height 30 73 font_name TrebuchetMSBold 74 char_height 16 75 caption : 76 colour_top 0.5 0.7 0.5 77 colour_bottom 0.3 0.5 0.3 78 } 79 element TextArea(Example/Visibility/UseOptimization) 80 { 81 metrics_mode pixels 82 left 5 83 top 35 84 width 90 85 height 30 86 font_name TrebuchetMSBold 87 char_height 16 88 caption [O] Optimization 89 colour_top 0.5 0.7 0.5 90 colour_bottom 0.3 0.5 0.3 91 } 92 element TextArea(Example/Visibility/UseOptimizationInfo) 93 { 94 metrics_mode pixels 95 left 155 96 top 35 71 97 width 90 72 98 height 30 -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r85 r86 57 57 GtpVisibility::HierarchyNode *node2) const 58 58 { 59 // matt: change this (inefficient) 60 AxisAlignedBox box1, box2; 61 62 static_cast<Octree *>(node1)->_getCullBounds(&box1); 63 static_cast<Octree *>(node2)->_getCullBounds(&box2); 64 65 return GetSquaredViewDepth(mCamera, &box1) > GetSquaredViewDepth(mCamera, &box2); 59 return GetSquaredViewDepth(mCamera, &static_cast<Octree *>(node1)->mBox) > 60 GetSquaredViewDepth(mCamera, &static_cast<Octree *>(node2)->mBox); 66 61 } 67 62 //----------------------------------------------------------------------- … … 70 65 { 71 66 Vector3 mid = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum(); 72 return (cam->getDerivedPosition() - mid).squaredLength(); 67 // use nearest point rather than midpoint 68 Vector3 camPos = cam->getDerivedPosition(); 69 70 Vector3 minPos(camPos.x < mid.x ? box->getMinimum().x : box->getMaximum().x, 71 camPos.y < mid.y ? box->getMinimum().y : box->getMaximum().y, 72 camPos.z < mid.z ? box->getMinimum().z : box->getMaximum().z); 73 74 return (camPos - minPos).squaredLength(); 73 75 } 74 76 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r85 r86 6 6 #include "OgrePlatformHierarchyInterface.h" 7 7 #include "OgrePlatformOcclusionQuery.h" 8 #include <windows.h> 8 9 9 10 namespace Ogre { … … 33 34 void PlatformHierarchyInterface::RenderBoundingBox(AxisAlignedBox *box) 34 35 { 36 static RenderOperation ro; 37 38 //TODO: this should be the full bounding box 39 SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox(); 40 41 mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY); 42 mSceneManager->useRenderableViewProjMode(halfbox); 43 mSceneManager->setPass(halfbox->getTechnique()->getPass(0)); 44 35 45 // Render two halfes of the bounding box (using triangle fans) 36 46 for(int halfIdx = 0; halfIdx < 2; ++halfIdx) 37 47 { 38 //TODO: this should be the full bounding box 39 SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox(); 40 halfbox->SetupBoundingBox(*box, halfIdx == 1); 48 halfbox->SetupBoundingBoxVertices(*box, halfIdx == 1); 41 49 42 mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY);43 44 static RenderOperation ro;45 46 mSceneManager->useRenderableViewProjMode(halfbox);47 mSceneManager->setPass(GetSolidHalfBoundingBox()->getTechnique()->getPass(0));48 50 halfbox->getRenderOperation(ro); 49 51 ro.srcRenderable = halfbox; 50 mRenderSystem->_render(ro); 52 mRenderSystem->_render(ro); 51 53 } 52 54 } … … 70 72 { 71 73 GtpVisibility::HierarchyInterface::InitFrame(root); 74 mPreviousNode = NULL; 72 75 SetCamera(cam); 73 76 } … … 94 97 //----------------------------------------------------------------------- 95 98 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 96 GtpVisibility::HierarchyNode *node )99 GtpVisibility::HierarchyNode *node, const bool wasVisible) 97 100 { 98 101 // get next available test id … … 102 105 query->BeginQuery(); 103 106 104 RenderBoundingBox(GetBoundingBox(node)); 107 // if leaf and was visible => will be rendered anyway, thus we 108 // can also test with the real geometry 109 if(mUseOptimization && wasVisible && IsLeaf(node)) 110 { 111 // OutputDebugString("Using optimization!!\n"); 112 RenderNode(node); 113 } 114 else 115 { 116 // OutputDebugString("Not optimized!!\n"); 117 RenderBoundingBox(GetBoundingBox(node)); 118 } 105 119 106 120 query->EndQuery(); -
trunk/VUT/Ogre/src/OgrePlatformOcclusionQuery.cpp
r59 r86 1 1 #include "OgrePlatformOcclusionQuery.h" 2 2 #include <windows.h> 3 3 namespace Ogre { 4 4 … … 24 24 } 25 25 //----------------------------------------------------------------------- 26 unsigned int PlatformOcclusionQuery::GetQueryResult() const 26 bool PlatformOcclusionQuery::GetQueryResult(unsigned int &visiblePixels, 27 const bool waitForResult) const 27 28 { 28 unsigned int visiblePixels = 0; 29 // wait if result not available 30 mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); 31 32 return visiblePixels; 33 } 34 //----------------------------------------------------------------------- 35 bool PlatformOcclusionQuery::ResultAvailable() const 36 { 37 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 38 return mHardwareOcclusionQuery->resultAvailable(); 39 #else 40 return true; 41 #endif 29 return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult); 42 30 } 43 31 -
trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp
r85 r86 26 26 Vector3 vmin = aab.getMinimum(); 27 27 28 Real sqLen = std::max(vmax.squaredLength(), vmin.squaredLength());29 mRadius = Math::Sqrt(sqLen);28 //Real sqLen = std::max(vmax.squaredLength(), vmin.squaredLength()); 29 //mRadius = Math::Sqrt(sqLen); 30 30 31 31 Real maxx = vmax.x; … … 90 90 91 91 // setup the bounding box of this SimpleRenderable 92 setBoundingBox(aabb);92 //setBoundingBox(aabb); 93 93 } 94 94 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r74 r86 18 18 19 19 //mDisplayNodes = true; 20 mShowBoundingBoxes = true;21 mShowBoxes = true;22 //mMaxDepth = 20;20 //mShowBoundingBoxes = true; 21 //mShowBoxes = true; 22 mMaxDepth = 20; 23 23 } 24 24 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
r75 r86 20 20 { 21 21 mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val)); 22 22 return true; 23 } 24 if (key == "UseOptimization") 25 { 26 mHierarchyInterface->SetUseOptimization(*static_cast<const bool *>(val)); 23 27 return true; 24 28 } … … 53 57 return true; 54 58 } 59 55 60 return false; 56 61 } -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r85 r86 12 12 //namespace GtpVisibility { 13 13 //----------------------------------------------------------------------- 14 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( GtpVisibility::VisibilityManager *visManager)15 :mVisibilityManager(visManager)14 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 15 GtpVisibility::VisibilityManager *visManager): mVisibilityManager(visManager) 16 16 { 17 17 mHierarchyInterface = 18 18 new OctreeHierarchyInterface(this, mDestRenderSystem); 19 19 20 setVisibilityManager(visManager);21 20 //mShowBoxes = true; 22 21 //mDisplayNodes = true; -
trunk/VUT/chcdemo/HierarchyNode.h
r10 r86 34 34 35 35 /** This class represents a node in a k-d tree hierarchy. A 36 node has two children. The node can be either an interior node (i.e., left and right child37 NULL) or a leaf node, which holds the actual geometry.36 node has two children. The node can be either an interior node (i.e., left and right child 37 NULL) or a leaf node, which holds the actual geometry. 38 38 */ 39 39 -
trunk/VUT/chcdemo/RenderTraverser.cpp
r43 r86 56 56 57 57 /** 58 This is the standard render traversal algorithm doing only frustum culling58 This is the standard render traversal algorithm doing only frustum culling 59 59 */ 60 60 void RenderTraverser::RenderCullFrustum() … … 144 144 { 145 145 while(!queryQueue.empty() && 146 (ResultAvailable(queryQueue.front()) || 146 (ResultAvailable(queryQueue.front()) || mDistanceQueue.empty())) 147 147 { 148 148 HierarchyNode *node = queryQueue.front(); … … 327 327 } 328 328 329 void RenderTraverser::IssueOcclusionQuery(HierarchyNode *node, bool wasVisible)329 void RenderTraverser::IssueOcclusionQuery(HierarchyNode *node, const bool wasVisible) 330 330 { 331 331 // get next available test id -
trunk/VUT/work/TestCulling/SceneContentGenerator.cpp
r85 r86 20 20 mMaxPos(Vector3(70.0f, 70.0f, 600.0f)), 21 21 mMinAngle(Vector3(0.0f, 0.0f, 0.0f)), 22 mMaxAngle(Vector3(360, 360, 360)) 22 mMaxAngle(Vector3(360, 360, 360)), 23 mScale(0.05, 0.05, 0.05) 23 24 { 24 25 } … … 67 68 68 69 currentObject->attachObject(ent); 69 currentObject->setScale( 0.1f, 0.1f, 0.1f);70 currentObject->setScale(mScale); 70 71 71 72 currentObject->yaw(Degree(rotation.x)); … … 106 107 return mCount; 107 108 } 109 //----------------------------------------------------------------------- 110 void SceneContentGenerator::SetScale(Vector3 scale) 111 { 112 mScale = scale; 113 } 108 114 } // namespace Ogre -
trunk/VUT/work/TestCulling/SceneContentGenerator.h
r85 r86 35 35 void SetMaxPos(Vector3 maxPos); 36 36 int GetObjectCount(); 37 void SetScale(Vector3 scale); 37 38 38 39 protected: … … 42 43 Vector3 mMaxPos; 43 44 Vector3 mMinPos; 44 45 Vector3 mScale; 46 45 47 SceneManager *mSceneMgr; 46 48 int mCount; // The number of objects on the screen -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r85 r86 54 54 55 55 mSceneContentGenerator = new SceneContentGenerator(mSceneMgr); 56 mSceneContentGenerator->GenerateScene(3 30, "robot.mesh");56 mSceneContentGenerator->GenerateScene(3000, "sphere.mesh"); 57 57 58 58 // Create a skybox … … 101 101 CEGUI::Renderer *renderer, 102 102 SceneContentGenerator *sceneContentGenerator) 103 : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 104 mShutdownRequested(false) 105 { 106 107 // Setup default variables 108 //mOgreHead = NULL; 109 mLMouseDown = false; 110 mRMouseDown = false; 111 mSceneMgr = sceneManager; 112 113 mSceneContentGenerator = sceneContentGenerator; 114 103 : ExampleFrameListener(win, cam, false, true), 104 mSceneMgr(sceneManager), 105 mGUIRenderer(renderer), 106 mShutdownRequested(false), 107 mUseOptimization(false), 108 mLMouseDown(false), 109 mRMouseDown(false), 110 mSceneContentGenerator(sceneContentGenerator), 111 mVisibilityThreshold(0), 112 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 113 { 115 114 // Reduce move speed 116 115 mMoveSpeed = 50; 117 116 mRotateSpeed *= 2; 118 119 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 120 mVisibilityThreshold = 0; 121 117 122 118 // Register this so that we get mouse events. 123 119 mEventProcessor->addMouseListener(this); … … 137 133 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 138 134 mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo"); 135 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 139 136 140 137 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 146 143 mRenderedNodesInfo->setCaption(": 0"); 147 144 mNumObjectsInfo->setCaption(": 0"); 145 mUseOptimizationInfo->setCaption(": true"); 148 146 149 147 setAlgorithm(mCurrentAlgorithm); 148 toggleUseOptimization(); 150 149 151 150 pOver->show(); … … 226 225 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 227 226 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 227 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 228 228 //KEY_PRESSED(KC_T, 1, change); 229 229 … … 250 250 251 251 setAlgorithm(mCurrentAlgorithm); 252 } 253 //----------------------------------------------------------------------- 254 void MouseQueryListener::toggleUseOptimization() 255 { 256 mUseOptimization = !mUseOptimization; 257 258 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 259 260 if(mUseOptimization) 261 mUseOptimizationInfo->setCaption(": true"); 262 else 263 mUseOptimizationInfo->setCaption(": false"); 264 } 265 //----------------------------------------------------------------------- 266 void MouseQueryListener::toggleShowOctree() 267 { 268 mShowOctree = !mShowOctree; 269 270 mSceneMgr->setOption("ShowOctree", &mShowOctree); 252 271 } 253 272 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r85 r86 64 64 void changeThreshold(int incr); 65 65 void changeStats(); 66 void toggleUseOptimization(); 67 void toggleShowOctree(); 66 68 67 69 protected: … … 83 85 OverlayElement *mRenderedNodesInfo; 84 86 OverlayElement *mNumObjectsInfo; 87 OverlayElement *mUseOptimizationInfo; 85 88 86 89 SceneContentGenerator *mSceneContentGenerator; 90 91 bool mUseOptimization; 92 bool mShowOctree; 87 93 }; 88 94 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r85 r86 96 96 97 97 mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 98 99 mTerrainContentGenerator->GenerateScene(500, "ninja.mesh"); 98 100 mTerrainContentGenerator->GenerateScene(500, "robot.mesh"); 101 99 102 // no limitations needed anymore: the user can set 100 103 // objects also on peaks of terrain … … 137 140 CEGUI::Renderer *renderer, 138 141 TerrainContentGenerator *sceneGenerator): 139 ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 140 mShutdownRequested(false) 141 { 142 // Setup default variables 143 mCurrentObject = NULL; 144 mLMouseDown = false; 145 mRMouseDown = false; 146 mSceneMgr = sceneManager; 147 mTerrainContentGenerator = sceneGenerator; 148 149 // Reduce move speed 142 ExampleFrameListener(win, cam, false, true), 143 mGUIRenderer(renderer), 144 mShutdownRequested(false), 145 mUseOptimization(false), 146 mLMouseDown(false), 147 mRMouseDown(false), 148 mSceneMgr(sceneManager), 149 mCurrentObject(NULL), 150 mTerrainContentGenerator(sceneGenerator), 151 mVisibilityThreshold(0), 152 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 153 { 154 // Reduce move speed 150 155 mMoveSpeed = 50; 151 156 mRotateSpeed *= 2; 152 153 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;154 mVisibilityThreshold = 0;155 157 156 158 // Register this so that we get mouse events. … … 173 175 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 174 176 mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo"); 177 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 175 178 176 179 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 182 185 mRenderedNodesInfo->setCaption(": 0"); 183 186 mNumObjectsInfo->setCaption(": 0"); 187 mUseOptimizationInfo->setCaption(": true"); 184 188 185 189 setAlgorithm(mCurrentAlgorithm); 190 toggleUseOptimization(); 191 toggleShowOctree(); 186 192 187 193 pOver->show(); … … 293 299 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 294 300 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 301 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 302 KEY_PRESSED(KC_S, 0.3, toggleShowOctree()); 295 303 //KEY_PRESSED(KC_T, 1, change); 296 304 … … 321 329 void MouseQueryListener::setAlgorithm(int algorithm) 322 330 { 331 //OutputDebugString("changing algorithm\n"); 323 332 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 324 333 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); … … 347 356 sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount()); 348 357 mNumObjectsInfo->setCaption(str); 358 } 359 //----------------------------------------------------------------------- 360 void MouseQueryListener::toggleUseOptimization() 361 { 362 mUseOptimization = !mUseOptimization; 363 364 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 365 366 if(mUseOptimization) 367 mUseOptimizationInfo->setCaption(": true"); 368 else 369 mUseOptimizationInfo->setCaption(": false"); 370 } 371 //----------------------------------------------------------------------- 372 void MouseQueryListener::toggleShowOctree() 373 { 374 mShowOctree = !mShowOctree; 375 376 mSceneMgr->setOption("ShowOctree", &mShowOctree); 349 377 } 350 378 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r85 r86 63 63 void changeThreshold(int incr); 64 64 void changeStats(); 65 void toggleUseOptimization(); 66 void toggleShowOctree(); 65 67 66 68 protected: … … 80 82 OverlayElement *mTraversedNodesInfo; 81 83 OverlayElement *mHierarchyNodesInfo; 82 //OverlayElement *mSceneNodesInfo;84 OverlayElement *mUseOptimizationInfo; 83 85 OverlayElement *mRenderedNodesInfo; 84 86 OverlayElement *mNumObjectsInfo; … … 89 91 RayQueryExecutor *mRayQueryExecutor; 90 92 TerrainContentGenerator *mTerrainContentGenerator; 93 94 bool mUseOptimization; 95 bool mShowOctree; 91 96 }; 92 97
Note: See TracChangeset
for help on using the changeset viewer.