Changeset 85
- Timestamp:
- 05/04/05 17:58:13 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r74 r85 118 118 DistanceQueue *mDistanceQueue; 119 119 HierarchyNode *mSceneRoot; 120 //HierarchyNode *mCurrentNode;120 HierarchyNode *mPreviousNode; 121 121 }; 122 122 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r74 r85 1 1 #include "CoherentHierarchicalCullingManager.h" 2 //#include <windows.h> 2 3 3 4 namespace GtpVisibility { … … 6 7 void CoherentHierarchicalCullingManager::RenderScene() 7 8 { 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 //OutputDebugString("Coherent Culling\n"); 11 8 12 QueryQueue queryQueue; 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 13 11 14 //-- PART 1: process finished occlusion queries 12 15 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) … … 31 34 mNumQueryCulledNodes ++; 32 35 } 33 } 36 } 34 37 35 38 //-- PART 2: hierarchical traversal -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r74 r85 1 1 #include "FrustumCullingManager.h" 2 3 #include <windows.h> 2 //#include <windows.h> 4 3 5 4 namespace GtpVisibility { … … 9 8 { 10 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 11 10 //OutputDebugString("Frustum Culling\n"); 11 12 12 while (!mHierarchyInterface->GetQueue()->empty()) 13 13 { -
trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
r74 r85 8 8 HierarchyInterface::HierarchyInterface(): 9 9 mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0), 10 mSceneRoot(0), m CurrentTestIdx(0)10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0) 11 11 { 12 12 mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); … … 26 26 { 27 27 mFrameId ++; 28 mCurrentTestIdx = 0; 28 29 mNumTraversedNodes = 0; 29 30 mNumRenderedNodes = 0; -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r74 r85 1 1 #include "StopAndWaitCullingManager.h" 2 //#include <windows.h> 2 3 3 4 namespace GtpVisibility { … … 7 8 { 8 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 //OutputDebugString("Stop and Wait Culling\n"); 9 11 10 12 while (!mHierarchyInterface->GetQueue()->empty()) -
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r71 r85 77 77 */ 78 78 void RenderBoundingBox(AxisAlignedBox *box); 79 /** Returns one half of the bounding box. 80 @param half the half index of the bouding box (0 or 1) 79 /** Returns pointer to current renderable half bounding box geometry 81 80 */ 82 SolidHalfBoundingBox *GetSolidHalfBoundingBox( int half);81 SolidHalfBoundingBox *GetSolidHalfBoundingBox(); 83 82 84 /** two halfesof an aabb.83 /** one renderable half of an aabb. 85 84 */ 86 SolidHalfBoundingBox *m HalfBoundingBox[2];85 SolidHalfBoundingBox *mSolidHalfBoundingBox; 87 86 88 87 SceneManager *mSceneManager; … … 91 90 Camera *mCamera; 92 91 AxisAlignedBox mBox; 93 92 94 93 std::vector<PlatformOcclusionQuery *> mOcclusionQueries; 95 94 }; -
trunk/VUT/Ogre/include/OgreSceneNodeHierarchyInterface.h
r74 r85 36 36 37 37 AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node); 38 39 protected:40 41 42 38 }; 43 39 -
trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h
r59 r85 15 15 public: 16 16 17 SolidHalfBoundingBox(bool isFirstHalf); 18 void setupBoundingBox(const AxisAlignedBox& aabb); 19 /** Override this method to prevent parent transforms (rotation,translation,scale) 20 and to make it public. 17 SolidHalfBoundingBox(); 18 /** Sets up the first or second half of a solid bounding box. 19 @param aab the axis aligned bounding box 20 @param isFirstHalf if it is the first or the second half 21 */ 22 void SetupBoundingBox(const AxisAlignedBox& aabb, const bool isFirstHalf); 23 24 protected: 25 /** Builds the wireframe line list. 26 @param aab the axis aligned bounding box for setting up the vertices 27 @param first or second half of the box 21 28 */ 22 void getWorldTransforms(Matrix4* xform) const; 23 24 protected: 25 26 /** Builds the wireframe line list. 27 @param aab the axis aligned bounding box for setting up the list. 28 */ 29 void setupBoundingBoxVertices(const AxisAlignedBox& aab); 29 void SetupBoundingBoxVertices(const AxisAlignedBox& aab, const bool isFirstHalf); 30 30 /** 31 31 Sets the material used for occlusion queries. … … 33 33 uses no lighting, no depth write, and no colours 34 34 */ 35 void setOcclusionQueryMaterial();35 void SetOcclusionQueryMaterial(); 36 36 /** Whether this half box is the first or the second half of the bounding box. 37 37 */ -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r74 r85 140 140 AxisAlignedBox *OctreeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 141 141 { 142 static_cast<Octree *>(node)->_getCullBounds(&mBox); 142 if(node != mPreviousNode) 143 { 144 mPreviousNode = node; 145 static_cast<Octree *>(node)->_getCullBounds(&mBox); 146 } 143 147 144 148 return &mBox; -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r74 r85 11 11 //----------------------------------------------------------------------- 12 12 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 13 mSceneManager(sm), mRenderSystem(rsys) 14 { 15 mHalfBoundingBox[0] = mHalfBoundingBox[1] = NULL; 13 mSceneManager(sm), mRenderSystem(rsys), mSolidHalfBoundingBox(NULL) 14 { 16 15 } 17 16 //----------------------------------------------------------------------- … … 19 18 { 20 19 DeleteQueries(); 21 22 if (mHalfBoundingBox[0])23 delete mHalfBoundingBox[0];24 20 25 if (mHalfBoundingBox[1])26 delete m HalfBoundingBox[1];21 if(mSolidHalfBoundingBox) 22 delete mSolidHalfBoundingBox; 27 23 } 28 24 //----------------------------------------------------------------------- … … 38 34 { 39 35 // Render two halfes of the bounding box (using triangle fans) 40 for(int half = 0; half < 2; half ++)36 for(int halfIdx = 0; halfIdx < 2; ++halfIdx) 41 37 { 42 static Matrix4 xform[256]; 43 //TODO: this should be full bounding box 44 SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox(half); 45 halfbox->setupBoundingBox(*box); 46 38 //TODO: this should be the full bounding box 39 SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox(); 40 halfbox->SetupBoundingBox(*box, halfIdx == 1); 41 47 42 mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY); 48 43 … … 50 45 51 46 mSceneManager->useRenderableViewProjMode(halfbox); 52 mSceneManager->setPass( halfbox->getTechnique()->getPass(0));47 mSceneManager->setPass(GetSolidHalfBoundingBox()->getTechnique()->getPass(0)); 53 48 halfbox->getRenderOperation(ro); 54 ro.srcRenderable = halfbox; 49 ro.srcRenderable = halfbox; 55 50 mRenderSystem->_render(ro); 56 57 // matt: change this58 // mSceneManager->myrenderSingleObject(getSolidHalfBoundingBox(half),59 // getSolidHalfBoundingBox(half)->getTechnique()->getPass(0), true);60 51 } 61 }62 //-----------------------------------------------------------------------63 SolidHalfBoundingBox *PlatformHierarchyInterface::GetSolidHalfBoundingBox(int half)64 {65 if(!mHalfBoundingBox[half])66 mHalfBoundingBox[half] = new Ogre::SolidHalfBoundingBox(half == 1);67 68 return mHalfBoundingBox[half];69 52 } 70 53 //----------------------------------------------------------------------- … … 100 83 } 101 84 //----------------------------------------------------------------------- 102 bool PlatformHierarchyInterface::CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects) 85 bool PlatformHierarchyInterface::CheckFrustumVisible(GtpVisibility::HierarchyNode *node, 86 bool &intersects) 103 87 { 104 88 #ifdef GTP_VISIBILITY_MODIFIED_OGRE … … 109 93 } 110 94 //----------------------------------------------------------------------- 111 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery(GtpVisibility::HierarchyNode *node) 95 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 96 GtpVisibility::HierarchyNode *node) 112 97 { 113 98 // get next available test id … … 123 108 return query; 124 109 } 110 //----------------------------------------------------------------------- 111 SolidHalfBoundingBox *PlatformHierarchyInterface::GetSolidHalfBoundingBox() 112 { 113 if(!mSolidHalfBoundingBox) 114 mSolidHalfBoundingBox = new SolidHalfBoundingBox; 115 116 return mSolidHalfBoundingBox; 117 } 125 118 126 119 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r74 r85 123 123 AxisAlignedBox *SceneNodeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 124 124 { 125 SceneNode *sceneNode = static_cast<SceneNode *>(node); 125 if(node != mPreviousNode) 126 { 127 mPreviousNode = node; 128 129 mBox = static_cast<SceneNode *>(node)->_getWorldAABB(); 130 } 131 126 132 return &mBox; 127 133 } -
trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp
r59 r85 12 12 #define POSITION_BINDING 0 13 13 //----------------------------------------------------------------------- 14 SolidHalfBoundingBox::SolidHalfBoundingBox(bool isFirstHalf) 15 :WireBoundingBox(), mIsFirstHalf(isFirstHalf) 14 SolidHalfBoundingBox::SolidHalfBoundingBox() 16 15 { 17 setOcclusionQueryMaterial();16 SetOcclusionQueryMaterial(); 18 17 19 18 mRenderOp.vertexData->vertexCount = 8; … … 21 20 } 22 21 //----------------------------------------------------------------------- 23 void SolidHalfBoundingBox::setupBoundingBoxVertices(const AxisAlignedBox& aab) { 24 22 void SolidHalfBoundingBox::SetupBoundingBoxVertices(const AxisAlignedBox& aab, 23 const bool isFirstHalf) 24 { 25 25 Vector3 vmax = aab.getMaximum(); 26 26 Vector3 vmin = aab.getMinimum(); 27 28 27 29 28 Real sqLen = std::max(vmax.squaredLength(), vmin.squaredLength()); 30 29 mRadius = Math::Sqrt(sqLen); … … 38 37 Real minz = vmin.z; 39 38 40 // fill in the Vertex buffer: 12 lines with 2 endpoints each make up a box39 // fill the vertex buffer: 12 lines with 2 endpoints each make up a box 41 40 HardwareVertexBufferSharedPtr vbuf = 42 41 mRenderOp.vertexData->vertexBufferBinding->getBuffer(POSITION_BINDING); … … 55 54 56 55 // fan 1 57 if( mIsFirstHalf)56 if(isFirstHalf) 58 57 { 59 58 *pPos++ = minx; *pPos++ = maxy; *pPos++ = maxz; //011 … … 66 65 *pPos++ = minx; *pPos++ = miny; *pPos++ = minz; //000 67 66 *pPos++ = minx; *pPos++ = miny; *pPos++ = maxz; //001 68 69 67 } 70 68 else … … 84 82 vbuf->unlock(); 85 83 } 86 87 void SolidHalfBoundingBox::setupBoundingBox(const AxisAlignedBox& aabb) 84 //----------------------------------------------------------------------- 85 void SolidHalfBoundingBox::SetupBoundingBox(const AxisAlignedBox& aabb, 86 const bool isFirstHalf) 88 87 { 89 88 // init the vertices to the aabb 90 S olidHalfBoundingBox::setupBoundingBoxVertices(aabb);89 SetupBoundingBoxVertices(aabb, isFirstHalf); 91 90 92 91 // setup the bounding box of this SimpleRenderable 93 92 setBoundingBox(aabb); 94 93 } 95 // Override this method to prevent parent transforms (rotation,translation,scale) 96 void SolidHalfBoundingBox::getWorldTransforms( Matrix4* xform ) const 97 { 98 // return identity matrix to prevent parent transforms 99 *xform = Matrix4::IDENTITY; 100 } 101 102 void SolidHalfBoundingBox::setOcclusionQueryMaterial( void ) 94 //----------------------------------------------------------------------- 95 void SolidHalfBoundingBox::SetOcclusionQueryMaterial( void ) 103 96 { 104 97 m_pMaterial = MaterialManager::getSingleton().getByName("OcclusionQuery"); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r74 r85 19 19 20 20 setVisibilityManager(visManager); 21 mShowBoxes = true;21 //mShowBoxes = true; 22 22 //mDisplayNodes = true; 23 mShowBoundingBoxes = true;23 //mShowBoundingBoxes = true; 24 24 mMaxDepth = 20; 25 25 } -
trunk/VUT/scripts/GtpVisibility.sln
r78 r85 17 17 ProjectSection(ProjectDependencies) = postProject 18 18 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 19 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 19 20 EndProjectSection 20 21 EndProject … … 22 23 ProjectSection(ProjectDependencies) = postProject 23 24 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 25 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 24 26 EndProjectSection 25 27 EndProject -
trunk/VUT/work/TestCulling/SceneContentGenerator.cpp
r82 r85 101 101 mMaxPos = maxPos; 102 102 } 103 103 //----------------------------------------------------------------------- 104 int SceneContentGenerator::GetObjectCount() 105 { 106 return mCount; 107 } 104 108 } // namespace Ogre -
trunk/VUT/work/TestCulling/SceneContentGenerator.h
r82 r85 34 34 void SetMinPos(Vector3 minPos); 35 35 void SetMaxPos(Vector3 maxPos); 36 36 int GetObjectCount(); 37 37 38 protected: 38 39 -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r84 r85 39 39 }*/ 40 40 //----------------------------------------------------------------------- 41 TestCullingApplication::~TestCullingApplication() 42 { 43 delete mSceneContentGenerator; 44 } 45 //----------------------------------------------------------------------- 41 46 void TestCullingApplication::createScene(void) 42 47 { … … 48 53 //l->setPosition(20,80,50); 49 54 50 SceneContentGenerator contentGenerator(mSceneMgr);51 contentGenerator.GenerateScene(330, "robot.mesh");55 mSceneContentGenerator = new SceneContentGenerator(mSceneMgr); 56 mSceneContentGenerator->GenerateScene(330, "robot.mesh"); 52 57 53 58 // Create a skybox … … 60 65 } 61 66 //----------------------------------------------------------------------- 62 void TestCullingApplication::setupGui( void)67 void TestCullingApplication::setupGui() 63 68 { 64 69 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE); … … 74 79 } 75 80 //----------------------------------------------------------------------- 76 void TestCullingApplication::createFrameListener(void) 77 { 78 mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer); 81 void TestCullingApplication::createFrameListener() 82 { 83 mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, 84 mGUIRenderer, mSceneContentGenerator); 79 85 mFrameListener->showDebugOverlay(true); 80 86 mRoot->addFrameListener(mFrameListener); … … 91 97 /***********************************************/ 92 98 //----------------------------------------------------------------------- 93 MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer) 99 MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, 100 SceneManager *sceneManager, 101 CEGUI::Renderer *renderer, 102 SceneContentGenerator *sceneContentGenerator) 94 103 : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 95 104 mShutdownRequested(false) … … 102 111 mSceneMgr = sceneManager; 103 112 113 mSceneContentGenerator = sceneContentGenerator; 114 104 115 // Reduce move speed 105 116 mMoveSpeed = 50; … … 107 118 108 119 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 109 m Threshold = 0;120 mVisibilityThreshold = 0; 110 121 111 122 // Register this so that we get mouse events. … … 135 146 mRenderedNodesInfo->setCaption(": 0"); 136 147 mNumObjectsInfo->setCaption(": 0"); 148 149 setAlgorithm(mCurrentAlgorithm); 137 150 138 151 pOver->show(); … … 170 183 if (e->getButtonID() & InputEvent::BUTTON0_MASK) 171 184 { 172 CEGUI::MouseCursor::getSingleton().show( 185 CEGUI::MouseCursor::getSingleton().show(); 173 186 mLMouseDown = false; 174 187 } … … 176 189 else if (e->getButtonID() & InputEvent::BUTTON1_MASK) 177 190 { 178 CEGUI::MouseCursor::getSingleton().show( 191 CEGUI::MouseCursor::getSingleton().show(); 179 192 mRMouseDown = false; 180 193 } … … 209 222 timeDelay -= evt.timeSinceLastFrame; 210 223 211 KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());224 KEY_PRESSED(KC_SPACE, 0.3, nextAlgorithm()); 212 225 213 226 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); … … 222 235 void MouseQueryListener::changeThreshold(int incr) 223 236 { 224 mThreshold += incr; if(mThreshold < 0) mThreshold = 0; 225 226 char str[100]; sprintf(str,": %d", mThreshold); 227 228 mSceneMgr->setOption("Threshold", &mThreshold); 237 mVisibilityThreshold += incr; 238 if(mVisibilityThreshold < 0) mVisibilityThreshold = 0; 239 240 char str[100]; sprintf(str,": %d", mVisibilityThreshold); 241 242 mSceneMgr->setOption("Threshold", &mVisibilityThreshold); 229 243 mThresholdInfo->setCaption(str); 230 244 } 231 245 //----------------------------------------------------------------------- 232 void MouseQueryListener::changeAlgorithm() 233 { 234 mCurrentAlgorithm = ++mCurrentAlgorithm % GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 235 246 void MouseQueryListener::nextAlgorithm() 247 { 248 mCurrentAlgorithm = ++mCurrentAlgorithm % 249 GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 250 251 setAlgorithm(mCurrentAlgorithm); 252 } 253 //----------------------------------------------------------------------- 254 void MouseQueryListener::setAlgorithm(int algorithm) 255 { 236 256 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 237 257 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); … … 258 278 mRenderedNodesInfo->setCaption(str); 259 279 260 sprintf(str,": %d", m TerrainContentGenerator->GetObjectCount());280 sprintf(str,": %d", mSceneContentGenerator->GetObjectCount()); 261 281 mNumObjectsInfo->setCaption(str); 262 282 } -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r84 r85 6 6 #include "ExampleApplication.h" 7 7 #include "VisibilityEnvironment.h" 8 8 #include "SceneContentGenerator.h" 9 9 10 10 Real timeDelay = 0; … … 30 30 31 31 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 32 CEGUI::Renderer *renderer );32 CEGUI::Renderer *renderer, SceneContentGenerator *sceneContentGenerator); 33 33 34 34 … … 60 60 void keyClicked(KeyEvent* e); 61 61 62 void changeAlgorithm(); 62 void nextAlgorithm(); 63 void setAlgorithm(int algorithm); 63 64 void changeThreshold(int incr); 64 65 void changeStats(); … … 72 73 bool mShutdownRequested; 73 74 int mCurrentAlgorithm; 74 int m Threshold;75 int mVisibilityThreshold; 75 76 76 77 OverlayElement *mAlgorithmInfo; … … 82 83 OverlayElement *mRenderedNodesInfo; 83 84 OverlayElement *mNumObjectsInfo; 85 86 SceneContentGenerator *mSceneContentGenerator; 84 87 }; 85 88 … … 87 90 class TestCullingApplication : public ExampleApplication 88 91 { 92 public: 93 ~TestCullingApplication(); 94 89 95 protected: 90 void createScene(void); 91 void createFrameListener(void); 92 void setupGui(void); 93 /** generates a the scene hierarchy with random values 94 @param number of objects to generate 95 */ 96 void GenerateScene(int numObjects); 97 98 /** generates a new scene object 99 @param tranlationRatio ratio between minimal and maximal possible translation 100 @param rotationRatio ratio between minimal and maximal possible rotation 101 @idx the index of the new object 102 @entName the name of the object entity 103 */ 104 void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 105 const int idx, const String &entName); 106 96 void createScene(); 97 void createFrameListener(); 98 void setupGui(); 99 107 100 //virtual void createCamera(void); 108 101 … … 116 109 Vector3 mMaxAngle; 117 110 111 SceneContentGenerator *mSceneContentGenerator; 112 118 113 private: 119 114 void chooseSceneManager(void); -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp
r84 r85 53 53 { 54 54 mMinPos = Vector3(0.0f, 5000.0f, 0.0f); 55 mMaxPos = Vector3( 1000.0f, 5000.0f, 1000.0f);55 mMaxPos = Vector3(3000.0f, 5000.0f, 3000.0f); 56 56 57 57 mMinAngle = Vector3(0.0f, 0.0f, 0.0f); … … 87 87 mMaxHeight = maxHeight; 88 88 } 89 //-----------------------------------------------------------------------90 int TerrainContentGenerator::GetObjectCount()91 {92 return mCount;93 }94 89 95 90 } // namespace Ogre -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h
r84 r85 34 34 35 35 void SetMaxHeight(Real maxHeight); 36 int GetObjectCount(); 37 36 38 37 protected: 39 38 RayQueryExecutor *mRayQueryExecutor; -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r84 r85 86 86 87 87 // Set a nice viewpoint 88 mCamera->setPosition(707, 2500,528);88 mCamera->setPosition(707, 2500, 528); 89 89 mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329)); 90 90 … … 96 96 97 97 mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 98 mTerrainContentGenerator->GenerateScene( 300, "robot.mesh");98 mTerrainContentGenerator->GenerateScene(500, "robot.mesh"); 99 99 // no limitations needed anymore: the user can set 100 100 // objects also on peaks of terrain … … 151 151 mRotateSpeed *= 2; 152 152 153 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING ,154 m Threshold = 0;153 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 154 mVisibilityThreshold = 0; 155 155 156 156 // Register this so that we get mouse events. … … 182 182 mRenderedNodesInfo->setCaption(": 0"); 183 183 mNumObjectsInfo->setCaption(": 0"); 184 185 setAlgorithm(mCurrentAlgorithm); 184 186 185 187 pOver->show(); … … 287 289 timeDelay -= evt.timeSinceLastFrame; 288 290 289 KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());291 KEY_PRESSED(KC_SPACE, 0.3, nextAlgorithm()); 290 292 291 293 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); … … 300 302 void MouseQueryListener::changeThreshold(int incr) 301 303 { 302 mThreshold += incr; if(mThreshold < 0) mThreshold = 0; 303 304 char str[100]; sprintf(str,": %d", mThreshold); 305 306 mSceneMgr->setOption("Threshold", &mThreshold); 304 mVisibilityThreshold += incr; 305 if(mVisibilityThreshold < 0) mVisibilityThreshold = 0; 306 307 char str[100]; sprintf(str,": %d", mVisibilityThreshold); 308 309 mSceneMgr->setOption("Threshold", &mVisibilityThreshold); 307 310 mThresholdInfo->setCaption(str); 308 311 } 309 312 //----------------------------------------------------------------------- 310 void MouseQueryListener:: changeAlgorithm()313 void MouseQueryListener::nextAlgorithm() 311 314 { 312 315 mCurrentAlgorithm = ++mCurrentAlgorithm % 313 316 GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 314 317 318 setAlgorithm(mCurrentAlgorithm); 319 } 320 //----------------------------------------------------------------------- 321 void MouseQueryListener::setAlgorithm(int algorithm) 322 { 315 323 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 316 324 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r84 r85 59 59 void keyClicked(KeyEvent* e); 60 60 61 void changeAlgorithm(); 61 void nextAlgorithm(); 62 void setAlgorithm(int algorithm); 62 63 void changeThreshold(int incr); 63 64 void changeStats(); … … 71 72 bool mShutdownRequested; 72 73 int mCurrentAlgorithm; 73 int m Threshold;74 int mVisibilityThreshold; 74 75 75 76 OverlayElement *mAlgorithmInfo; … … 97 98 98 99 protected: 99 void createScene( void);100 void createFrameListener( void);101 void setupGui( void);102 virtual void createCamera( void);100 void createScene(); 101 void createFrameListener(); 102 void setupGui(); 103 virtual void createCamera(); 103 104 104 105 CEGUI::OgreCEGUIRenderer *mGUIRenderer;
Note: See TracChangeset
for help on using the changeset viewer.