Changeset 115 for trunk/VUT/work
- Timestamp:
- 05/30/05 03:20:23 (20 years ago)
- Location:
- trunk/VUT/work
- Files:
-
- 4 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/TestCulling.vcproj
r107 r115 13 13 <Configuration 14 14 Name="Debug|Win32" 15 OutputDirectory=".\ bin\$(ConfigurationName)"15 OutputDirectory=".\lib\$(ConfigurationName)" 16 16 IntermediateDirectory=".\obj\$(ConfigurationName)" 17 17 ConfigurationType="1" … … 21 21 Name="VCCLCompilerTool" 22 22 Optimization="0" 23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../include;../../GtpVisibility/include "23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../include;../../GtpVisibility/include;../../Ogre/include" 24 24 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 25 25 MinimalRebuild="TRUE" … … 34 34 <Tool 35 35 Name="VCLinkerTool" 36 AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib "36 AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib Plugin_VisibilitySceneManager.lib" 37 37 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe" 38 38 LinkIncremental="2" 39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib" "39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"$(GAMETOOLS_PATH)\trunk\VUT\Ogre\lib\$(ConfigurationName)"" 40 40 GenerateDebugInformation="TRUE" 41 41 ProgramDatabaseFile="$(OutDir)/TestCulling.pdb" -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r112 r115 81 81 void TestCullingApplication::createFrameListener() 82 82 { 83 mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr,83 mFrameListener= new TerrainMouseQueryListener(mWindow, mCamera, mSceneMgr, 84 84 mGUIRenderer, mSceneContentGenerator); 85 85 mFrameListener->showDebugOverlay(true); … … 94 94 95 95 /***********************************************/ 96 /* MouseQueryListener implementation */96 /* TerrainMouseQueryListener implementation */ 97 97 /***********************************************/ 98 98 //----------------------------------------------------------------------- 99 MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam,99 TerrainMouseQueryListener::TerrainMouseQueryListener(RenderWindow* win, Camera* cam, 100 100 SceneManager *sceneManager, 101 101 CEGUI::Renderer *renderer, … … 111 111 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 112 112 mShowOctree(false), 113 mUse VisibilityCulling(true),113 mUseDepthPass(false), 114 114 mUseOptimization(true), 115 115 mShowVisualization(false), … … 154 154 155 155 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 156 mSceneMgr->setOption("Use VisibilityCulling", &mUseVisibilityCulling);156 mSceneMgr->setOption("UseDepthPass", &mUseDepthPass); 157 157 mSceneMgr->setOption("ShowVizualisation", &mShowVisualization); 158 158 mSceneMgr->setOption("ShowOctree", &mShowOctree); … … 161 161 } 162 162 //----------------------------------------------------------------------- 163 MouseQueryListener::~MouseQueryListener( )164 { 165 } 166 //----------------------------------------------------------------------- 167 void MouseQueryListener::mouseMoved (MouseEvent *e)163 TerrainMouseQueryListener::~TerrainMouseQueryListener( ) 164 { 165 } 166 //----------------------------------------------------------------------- 167 void TerrainMouseQueryListener::mouseMoved (MouseEvent *e) 168 168 { 169 169 // Update CEGUI with the mouse motion … … 171 171 } 172 172 //----------------------------------------------------------------------- 173 void MouseQueryListener::mousePressed(MouseEvent* e)173 void TerrainMouseQueryListener::mousePressed(MouseEvent* e) 174 174 { 175 175 // Left mouse button down … … 187 187 188 188 //----------------------------------------------------------------------- 189 void MouseQueryListener::mouseReleased(MouseEvent* e)189 void TerrainMouseQueryListener::mouseReleased(MouseEvent* e) 190 190 { 191 191 // Left mouse button up … … 203 203 } 204 204 //----------------------------------------------------------------------- 205 void MouseQueryListener::mouseDragged (MouseEvent *e)205 void TerrainMouseQueryListener::mouseDragged (MouseEvent *e) 206 206 { 207 207 // If we are dragging the left mouse button. … … 218 218 } 219 219 //----------------------------------------------------------------------- 220 bool MouseQueryListener::frameStarted(const FrameEvent &evt)220 bool TerrainMouseQueryListener::frameStarted(const FrameEvent &evt) 221 221 { 222 222 return ExampleFrameListener::frameStarted(evt); 223 223 } 224 224 //----------------------------------------------------------------------- 225 bool MouseQueryListener::frameEnded(const FrameEvent& evt)225 bool TerrainMouseQueryListener::frameEnded(const FrameEvent& evt) 226 226 { 227 227 if (mShutdownRequested) … … 236 236 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 237 237 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 238 KEY_PRESSED(KC_C, 0.3, toggleUse VisibilityCulling());238 KEY_PRESSED(KC_C, 0.3, toggleUseDepthPass()); 239 239 KEY_PRESSED(KC_V, 0.3, toggleShowViz()); 240 240 … … 244 244 } 245 245 //----------------------------------------------------------------------- 246 void MouseQueryListener::changeThreshold(int incr)246 void TerrainMouseQueryListener::changeThreshold(int incr) 247 247 { 248 248 mVisibilityThreshold += incr; … … 255 255 } 256 256 //----------------------------------------------------------------------- 257 void MouseQueryListener::nextAlgorithm()257 void TerrainMouseQueryListener::nextAlgorithm() 258 258 { 259 259 mCurrentAlgorithm = ++mCurrentAlgorithm % … … 263 263 } 264 264 //----------------------------------------------------------------------- 265 void MouseQueryListener::toggleUseOptimization()265 void TerrainMouseQueryListener::toggleUseOptimization() 266 266 { 267 267 mUseOptimization = !mUseOptimization; … … 275 275 } 276 276 //----------------------------------------------------------------------- 277 void MouseQueryListener::toggleShowOctree()277 void TerrainMouseQueryListener::toggleShowOctree() 278 278 { 279 279 mShowOctree = !mShowOctree; … … 282 282 } 283 283 //----------------------------------------------------------------------- 284 void MouseQueryListener::toggleUseVisibilityCulling()285 { 286 mUse VisibilityCulling = !mUseVisibilityCulling;287 288 mSceneMgr->setOption("Use VisibilityCulling", &mUseVisibilityCulling);289 } 290 //----------------------------------------------------------------------- 291 void MouseQueryListener::toggleShowViz()284 void TerrainMouseQueryListener::toggleUseDepthPass() 285 { 286 mUseDepthPass = !mUseDepthPass; 287 288 mSceneMgr->setOption("UseDepthPass", &mUseDepthPass); 289 } 290 //----------------------------------------------------------------------- 291 void TerrainMouseQueryListener::toggleShowViz() 292 292 { 293 293 mShowVisualization = !mShowVisualization; … … 297 297 } 298 298 //----------------------------------------------------------------------- 299 void MouseQueryListener::setAlgorithm(int algorithm)299 void TerrainMouseQueryListener::setAlgorithm(int algorithm) 300 300 { 301 301 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 303 303 } 304 304 //----------------------------------------------------------------------- 305 void MouseQueryListener::updateStats()305 void TerrainMouseQueryListener::updateStats() 306 306 { 307 307 unsigned int opt = 0; … … 330 330 } 331 331 //----------------------------------------------------------------------- 332 void MouseQueryListener::keyPressed(KeyEvent* e)332 void TerrainMouseQueryListener::keyPressed(KeyEvent* e) 333 333 { 334 334 if(e->getKey() == KC_ESCAPE) … … 344 344 } 345 345 //----------------------------------------------------------------------- 346 void MouseQueryListener::keyReleased(KeyEvent* e)346 void TerrainMouseQueryListener::keyReleased(KeyEvent* e) 347 347 { 348 348 CEGUI::System::getSingleton().injectKeyUp(e->getKey()); … … 350 350 } 351 351 //----------------------------------------------------------------------- 352 void MouseQueryListener::keyClicked(KeyEvent* e)352 void TerrainMouseQueryListener::keyClicked(KeyEvent* e) 353 353 { 354 354 // Do nothing -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r112 r115 25 25 }; 26 26 27 class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener27 class TerrainMouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener 28 28 { 29 29 public: 30 30 31 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,31 TerrainMouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 32 32 CEGUI::Renderer *renderer, SceneContentGenerator *sceneContentGenerator); 33 33 34 34 35 ~ MouseQueryListener( );35 ~TerrainMouseQueryListener( ); 36 36 37 37 bool frameStarted(const FrameEvent& evt); … … 66 66 void toggleUseOptimization(); 67 67 void toggleShowOctree(); 68 void toggleUse VisibilityCulling();68 void toggleUseDepthPass(); 69 69 void toggleShowViz(); 70 70 … … 94 94 bool mUseOptimization; 95 95 bool mShowOctree; 96 bool mUse VisibilityCulling;96 bool mUseDepthPass; 97 97 bool mShowVisualization; 98 98 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj
r107 r115 34 34 <Tool 35 35 Name="VCLinkerTool" 36 AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib"36 AdditionalDependencies="Plugin_OctreeSceneManager.lib Plugin_VisibilitySceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib" 37 37 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingTerrain.exe" 38 38 LinkIncremental="2" 39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$( OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib""39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(GAMETOOLS_PATH)\trunk\VUT\Ogre\lib\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib"" 40 40 GenerateDebugInformation="TRUE" 41 41 ProgramDatabaseFile="$(OutDir)/TestCullingTerrain.pdb" … … 122 122 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> 123 123 <File 124 RelativePath=".\TerrainMouseQueryListener.cpp"> 125 </File> 126 <File 124 127 RelativePath=".\TestCullingTerrainApplication.cpp"> 125 128 </File> … … 130 133 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> 131 134 <File 135 RelativePath=".\TerrainMouseQueryListener.h"> 136 </File> 137 <File 132 138 RelativePath=".\TestCullingTerrainApplication.h"> 133 139 </File> -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r114 r115 1 /**2 \file3 TestCullingTerrainApplication.cpp4 \brief5 Tests the visibility culling algorithm6 */7 8 1 #include <OgreNoMemoryMacros.h> 9 2 #include <CEGUI/CEGUI.h> … … 14 7 15 8 #include <Ogre.h> 16 #include "OgreReferenceAppLayer.h"9 //#include "OgreReferenceAppLayer.h" 17 10 //#include "OgreRefAppWorld.h" 18 11 #include "TestCullingTerrainApplication.h" 19 12 13 20 14 #define WIN32_LEAN_AND_MEAN 21 15 #include <windows.h> 22 23 #define VIZ_VIEWPORT_Z_ORDER 1024 25 const char* frame_outfile = "frame.out";26 const char* objects_outfile = "objects.out";27 16 28 17 /*******************************************************/ … … 201 190 void TestCullingTerrainApplication::createFrameListener() 202 191 { 203 m FrameListener= newMouseQueryListener(mWindow, mCamera, mSceneMgr,192 mTerrainFrameListener = new TerrainMouseQueryListener(mWindow, mCamera, mSceneMgr, 204 193 mGUIRenderer, mTerrainContentGenerator, mVizCamera, mCamNode); 205 m FrameListener->showDebugOverlay(true);206 mRoot->addFrameListener(m FrameListener);194 mTerrainFrameListener->showDebugOverlay(true); 195 mRoot->addFrameListener(mTerrainFrameListener); 207 196 } 208 197 //----------------------------------------------------------------------- … … 211 200 mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE); 212 201 } 213 /***********************************************/ 214 /* MouseQueryListener implementation */ 215 /***********************************************/ 216 //----------------------------------------------------------------------- 217 MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, 218 SceneManager *sceneManager, 219 CEGUI::Renderer *renderer, 220 TerrainContentGenerator *sceneGenerator, 221 Camera *vizCamera, 222 SceneNode *camNode): 223 ExampleFrameListener(win, cam, false, true), 224 mGUIRenderer(renderer), 225 mShutdownRequested(false), 226 mLMouseDown(false), 227 mRMouseDown(false), 228 mSceneMgr(sceneManager), 229 mCurrentObject(NULL), 230 mTerrainContentGenerator(sceneGenerator), 231 mVisibilityThreshold(0), 232 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 233 mShowOctree(false), 234 mUseVisibilityCulling(true), 235 mUseOptimization(true), 236 mVizCamera(vizCamera), 237 mShowVisualization(false), 238 mNodeVizMode(NODEVIZ_NONE), 239 mVizCameraHeight(Real(2500.0)), 240 mCamNode(camNode), 241 mCullCamera(false), 242 mAppState(WALKTHROUGH), 243 mCurrentFrame(0), 244 mRecord(false), 245 mTimeElapsed(0), 246 mUseShadows(false), 247 mVisualizeCulledNodes(false) 248 { 249 // Reduce move speed 250 mMoveSpeed = 50; 251 mRotateSpeed *= 2; 252 253 // Register this so that we get mouse events. 254 mEventProcessor->addMouseListener(this); 255 mEventProcessor->addMouseMotionListener(this); 256 mEventProcessor->addKeyListener(this); 257 258 mRayQueryExecutor = new RayQueryExecutor(mSceneMgr); 259 260 // show overlay 261 Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay"); 262 263 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 264 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 265 266 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 267 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 268 mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo"); 269 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 270 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 271 mObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ObjectsInfo"); 272 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 273 mQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueriesIssuedInfo"); 274 275 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 276 mThresholdInfo->setCaption(": 0"); 277 mFrustumCulledNodesInfo->setCaption(": 0"); 278 mQueryCulledNodesInfo->setCaption(": 0"); 279 mTraversedNodesInfo->setCaption(": 0"); 280 mHierarchyNodesInfo->setCaption(": 0"); 281 mRenderedNodesInfo->setCaption(": 0"); 282 mObjectsInfo->setCaption(": 0"); 283 mUseOptimizationInfo->setCaption(": true"); 284 mQueriesIssuedInfo->setCaption(": 0"); 285 286 setAlgorithm(mCurrentAlgorithm); 287 288 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 289 mSceneMgr->setOption("UseVisibilityCulling", &mUseVisibilityCulling); 290 mSceneMgr->setOption("ShowOctree", &mShowOctree); 291 mSceneMgr->setOption("CullCamera", &mCullCamera); 292 mSceneMgr->setOption("ShowVisualization", &mShowVisualization); 293 294 pOver->show(); 295 } 296 //----------------------------------------------------------------------- 297 MouseQueryListener::~MouseQueryListener() 298 { 299 delete mRayQueryExecutor; 300 } 301 //----------------------------------------------------------------------- 302 void MouseQueryListener::mouseMoved(MouseEvent *e) 303 { 304 // Update CEGUI with the mouse motion 305 CEGUI::System::getSingleton().injectMouseMove(e->getRelX() * 306 mGUIRenderer->getWidth(), e->getRelY() * mGUIRenderer->getHeight()); 307 } 308 //----------------------------------------------------------------------- 309 void MouseQueryListener::mousePressed(MouseEvent* e) 310 { 311 // Left mouse button down 312 if (e->getButtonID() & InputEvent::BUTTON0_MASK) 313 { 314 CEGUI::MouseCursor::getSingleton().hide(); 315 316 // Setup the ray scene query 317 Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY()); 318 319 Vector3 queryResult; 320 321 // Get results, create a node/entity on the position 322 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject( 323 mouseRay.getOrigin(), Vector3(0,0,0), "robot"); 324 325 mLMouseDown = true; 326 } 327 // Right mouse button down 328 else if (e->getButtonID() & InputEvent::BUTTON1_MASK) 329 { 330 CEGUI::MouseCursor::getSingleton().hide(); 331 mRMouseDown = true; 332 } 333 } // mousePressed 334 //----------------------------------------------------------------------- 335 void MouseQueryListener::mouseReleased(MouseEvent* e) 336 { 337 // Left mouse button up 338 if (e->getButtonID() & InputEvent::BUTTON0_MASK) 339 { 340 CEGUI::MouseCursor::getSingleton().show(); 341 mLMouseDown = false; 342 } 343 // Right mouse button up 344 else if (e->getButtonID() & InputEvent::BUTTON1_MASK) 345 { 346 CEGUI::MouseCursor::getSingleton().show(); 347 mRMouseDown = false; 348 } 349 } 350 //----------------------------------------------------------------------- 351 void MouseQueryListener::mouseDragged(MouseEvent *e) 352 { 353 // If we are dragging the left mouse button. 354 if (mLMouseDown) 355 { 356 Vector3 queryResult; 357 Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY()); 358 359 if (mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay)) 360 { 361 if (mCurrentObject) 362 { 363 mCurrentObject->setPosition(queryResult); 364 } 365 } 366 } 367 // If we are dragging the right mouse button. 368 if (mRMouseDown) 369 { 370 //mCamera->yaw(-e->getRelX() * mRotateSpeed); 371 //mCamera->pitch(-e->getRelY() * mRotateSpeed); 372 mCamNode->yaw(-e->getRelX() * mRotateSpeed); 373 mCamNode->pitch(-e->getRelY() * mRotateSpeed); 374 } 375 } 376 //----------------------------------------------------------------------- 377 bool MouseQueryListener::frameStarted(const FrameEvent &evt) 378 { 379 switch (mAppState) 380 { 381 case REPLAY: 382 setCurrentFrameInfo(evt.timeSinceLastFrame); 383 break; 384 case WALKTHROUGH: 385 if (mRecord) 386 { 387 addFrameInfo(mCamNode, evt.timeSinceLastFrame); 388 // print recording message 389 mWindow->setDebugText("Recording frame " + 390 StringConverter::toString(mFrameInfo.size() - 1)); 391 } 392 393 Clamp2Terrain(); 394 break; 395 default: 396 break; 397 }; 398 399 if (mShowVisualization) 400 { 401 // important for visualization => draw octree bounding boxes 402 mSceneMgr->setOption("ShowOctree", &mShowVisualization); 403 // also render nodew content? 404 //mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 405 406 // -- setup visualization camera 407 mVizCamera->setPosition(0, 0, 0); 408 mVizCamera->setOrientation(Quaternion::IDENTITY); 409 410 Vector3 camPos = mCamNode->getPosition(); 411 mVizCamera->setPosition(camPos.x, mVizCameraHeight, camPos.z); 412 413 // point down -Z axis 414 mVizCamera->pitch(Radian(Degree(270.0))); 415 416 // rotation arounnd X axis 417 mVizCamera->yaw(Math::ATan2(-mCamera->getDerivedDirection().x, 418 -mCamera->getDerivedDirection().z)); 419 420 // move by a constant so view plane is on bottom of viewport 421 mVizCamera->moveRelative(Vector3(0, 800, 0)); 422 } 423 424 return ExampleFrameListener::frameStarted(evt); 425 } 426 //----------------------------------------------------------------------- 427 void MouseQueryListener::Clamp2Terrain() 428 { 429 // clamp to terrain 430 Vector3 camPos = mCamNode->getPosition(); 431 Vector3 queryResult; 432 433 if (mRayQueryExecutor->executeRayQuery(&queryResult, 434 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y)) 435 { 436 mCamNode->setPosition(camPos.x, queryResult.y + 10, camPos.z); 437 } 438 } 439 //----------------------------------------------------------------------- 440 bool MouseQueryListener::frameEnded(const FrameEvent& evt) 441 { 442 if (mShutdownRequested) 443 return false; 444 445 if (timeDelay >= 0) 446 timeDelay -= evt.timeSinceLastFrame; 447 448 KEY_PRESSED(KC_SPACE, 0.3, nextAlgorithm()); 449 450 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 451 KEY_PRESSED(KC_T, 0.3, toggleShowOctree()); 452 KEY_PRESSED(KC_C, 0.3, toggleUseVisibilityCulling()); 453 KEY_PRESSED(KC_1, 0.3, toggleShowViz()); 454 KEY_PRESSED(KC_2, 0.3, nextNodeVizMode()); 455 456 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 457 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 458 459 KEY_PRESSED(KC_4, 0, zoomVizCamera(50)); 460 KEY_PRESSED(KC_5, 0, zoomVizCamera(-50)); 461 462 KEY_PRESSED(KC_F1, 0.3, nextAppState()); 463 KEY_PRESSED(KC_F2, 0.3, toggleRecord()); 464 KEY_PRESSED(KC_F3, 0.3, mTerrainContentGenerator->WriteObjects(objects_outfile)); 465 KEY_PRESSED(KC_F4, 0.3, toggleUseShadows()); 466 //KEY_PRESSED(KC_F3, 0.3, writeFrames()); 467 //KEY_PRESSED(KC_F4, 0.3, loadFrames()); 468 469 updateStats(); 470 471 //return ExampleFrameListener::frameStarted(evt) && ExampleFrameListener::frameEnded(evt); 472 return ExampleFrameListener::frameEnded(evt); 473 } 474 //----------------------------------------------------------------------- 475 void MouseQueryListener::moveCamera() 476 { 477 mCamNode->yaw(mRotX); 478 mCamNode->pitch(mRotY); 479 mCamNode->translate(mCamNode->getLocalAxes(), mTranslateVector); 480 } 481 //----------------------------------------------------------------------- 482 void MouseQueryListener::writeFrames() 483 { 484 std::ofstream ofstr(frame_outfile); 485 486 std::vector<frame_info>::const_iterator it, it_end; 487 488 it_end = mFrameInfo.end(); 489 for(it = mFrameInfo.begin(); it < it_end; ++it) 490 { 491 ofstr << StringConverter::toString((*it).position) << " " 492 << StringConverter::toString((*it).orientation) << " " 493 << StringConverter::toString((*it).timeElapsed) << "\n"; 494 } 495 ofstr.close(); 496 } 497 //----------------------------------------------------------------------- 498 void MouseQueryListener::loadFrames() 499 { 500 std::ifstream ifstr(frame_outfile); 501 char line[256]; 502 frame_info info; 503 504 // reset current values 505 mFrameInfo.clear(); 506 mCurrentFrame = 0; 507 508 while (!ifstr.eof()) 509 { 510 ifstr.getline(line, 256); 511 sscanf(line, "%f %f %f %f %f %f %f %f", &info.position.x, &info.position.y, &info.position.z, 512 &info.orientation.w, &info.orientation.x, &info.orientation.y, &info.orientation.z, 513 &info.timeElapsed); 514 515 mFrameInfo.push_back(info); 516 517 /* 518 std::stringstream d; 519 d << StringConverter::toString(info.position) << " " << StringConverter::toString(info.orientation); 520 LogManager::getSingleton().logMessage(d.str()); 521 */ 522 } 523 ifstr.close(); 524 } 525 //----------------------------------------------------------------------- 526 void MouseQueryListener::setAppState(int state) 527 { 528 mAppState = state; 529 } 530 //----------------------------------------------------------------------- 531 void MouseQueryListener::nextAppState() 532 { 533 mCurrentFrame = 0; 534 535 // if last state was replay state 536 if (mAppState == REPLAY) 537 { 538 // reset debug text and write frame info to file 539 mWindow->setDebugText(""); 540 writeFrames(); 541 542 //-- write out stats 543 std::stringstream d; 544 d << "Algorithm: " << mCurrentAlgorithmCaptions[mCurrentAlgorithm] << "\n" 545 << "avg. FPS: " << mWindow->getAverageFPS() << "\n" 546 << "best FPS: " << mWindow->getBestFPS() << "\n" 547 << "worst FPS: " << mWindow->getWorstFPS() << "\n" 548 << "best frame time: " << mWindow->getBestFrameTime() << "\n" 549 << "worst frame time: " << mWindow->getWorstFrameTime(); 550 551 LogManager::getSingleton().logMessage(d.str()); 552 } 553 554 //-- set the next státe 555 mAppState = (mAppState + 1) % STATE_NUM; 556 557 // replay recorded walkthrough 558 if (mAppState == REPLAY) 559 { 560 // no recording during replay 561 mRecord = false; 562 563 // load recorded walkthrough 564 if (mFrameInfo.size() == 0) 565 { 566 loadFrames(); 567 } 568 569 // if there are no recorded frames => set next state 570 if (mFrameInfo.size() == 0) 571 { 572 nextAppState(); 573 } 574 else 575 { 576 mWindow->setDebugText("Replay"); 577 578 // reset, because we measure fps stats during walkthrough 579 mWindow->resetStatistics(); 580 581 //-- initialise frame data 582 mTimeElapsed = 0; 583 584 mCamNode->setPosition(mFrameInfo[0].position); 585 mCamNode->setOrientation(mFrameInfo[0].orientation); 586 } 587 } 588 589 } 590 //----------------------------------------------------------------------- 591 void MouseQueryListener::toggleRecord() 592 { 593 mRecord = !mRecord; 594 595 // clear previous camera path 596 if (mRecord) 597 mFrameInfo.clear(); 598 else 599 mWindow->setDebugText(""); 600 } 601 //----------------------------------------------------------------------- 602 void MouseQueryListener::changeThreshold(int incr) 603 { 604 mVisibilityThreshold += incr; 605 if(mVisibilityThreshold < 0) mVisibilityThreshold = 0; 606 607 char str[100]; sprintf(str,": %d", mVisibilityThreshold); 608 609 mSceneMgr->setOption("Threshold", &mVisibilityThreshold); 610 mThresholdInfo->setCaption(str); 611 } 612 //----------------------------------------------------------------------- 613 bool MouseQueryListener::processUnbufferedKeyInput(const FrameEvent& evt) 614 { 615 if (mInputDevice->isKeyDown(KC_RIGHT)) 616 { 617 mCamNode->yaw(-mRotScale); 618 return true; 619 } 620 if (mInputDevice->isKeyDown(KC_LEFT)) 621 { 622 mCamNode->yaw(mRotScale); 623 return true; 624 } 625 626 return ExampleFrameListener::processUnbufferedKeyInput(evt); 627 } 628 //----------------------------------------------------------------------- 629 void MouseQueryListener::zoomVizCamera(int zoom) 630 { 631 mVizCameraHeight += zoom; 632 if(mVizCameraHeight < 0) mVizCameraHeight = 0; 633 } 634 //----------------------------------------------------------------------- 635 void MouseQueryListener::nextAlgorithm() 636 { 637 mCurrentAlgorithm = (mCurrentAlgorithm + 1) % 638 GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 639 640 setAlgorithm(mCurrentAlgorithm); 641 } 642 //----------------------------------------------------------------------- 643 void MouseQueryListener::setAlgorithm(int algorithm) 644 { 645 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 646 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 647 } 648 //----------------------------------------------------------------------- 649 void MouseQueryListener::updateStats() 650 { 651 unsigned int opt = 0; 652 char str[100]; 653 654 mSceneMgr->getOption("NumFrustumCulledNodes", &opt); sprintf(str,": %d", opt); 655 mFrustumCulledNodesInfo->setCaption(str); 656 657 mSceneMgr->getOption("NumQueriesIssued", &opt); sprintf(str,": %d", opt); 658 mQueriesIssuedInfo->setCaption(str); 659 660 mSceneMgr->getOption("NumQueryCulledNodes", &opt); sprintf(str,": %d", opt); 661 mQueryCulledNodesInfo->setCaption(str); 662 663 mSceneMgr->getOption("NumTraversedNodes", &opt); sprintf(str,": %d", opt); 664 mTraversedNodesInfo->setCaption(str); 665 666 mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt); 667 mHierarchyNodesInfo->setCaption(str); 668 669 mSceneMgr->getOption("NumRenderedNodes", &opt); sprintf(str,": %d", opt); 670 mRenderedNodesInfo->setCaption(str); 671 672 sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount()); 673 mObjectsInfo->setCaption(str); 674 } 675 //----------------------------------------------------------------------- 676 void MouseQueryListener::toggleUseOptimization() 677 { 678 mUseOptimization = !mUseOptimization; 679 680 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 681 682 if (mUseOptimization) 683 mUseOptimizationInfo->setCaption(": true"); 684 else 685 mUseOptimizationInfo->setCaption(": false"); 686 } 687 //----------------------------------------------------------------------- 688 void MouseQueryListener::toggleShowOctree() 689 { 690 mShowOctree = !mShowOctree; 691 692 mSceneMgr->setOption("ShowOctree", &mShowOctree); 693 } 694 //----------------------------------------------------------------------- 695 void MouseQueryListener::toggleUseVisibilityCulling() 696 { 697 mUseVisibilityCulling = !mUseVisibilityCulling; 698 699 mSceneMgr->setOption("UseVisibilityCulling", &mUseVisibilityCulling); 700 } 701 //----------------------------------------------------------------------- 702 void MouseQueryListener::toggleShowViz() 703 { 704 mShowVisualization = !mShowVisualization; 705 mVisualizeCulledNodes = !mVisualizeCulledNodes; 706 707 // create viewport with priority VIZ_VIEWPORT_Z_ORDER: 708 // will be rendered over standard viewport 709 if (mShowVisualization) 710 { 711 Viewport *vizvp = mWindow->addViewport(mVizCamera, 712 VIZ_VIEWPORT_Z_ORDER, 0.6, 0.6, 0.4, 0.4); 713 714 vizvp->setBackgroundColour(ColourValue(0.0, 0.3, 0.2, 1)); 715 716 vizvp->setOverlaysEnabled(false); 717 // Alter the camera aspect ratio to match the viewport 718 mVizCamera->setAspectRatio(Real(vizvp->getActualWidth()) / 719 Real(vizvp->getActualHeight())); 720 721 mSceneMgr->setOption("VisualizeCulledNodes", &mVisualizeCulledNodes); 722 //vizvp->setClearEveryFrame(false); 723 724 // Create a skyplane (for visualization background) 725 /* 726 Plane plane; 727 plane.d = -1000; 728 plane.normal = Vector3::UNIT_Y; 729 mSceneMgr->setSkyPlane(true, plane, "Examples/TransparentTest", 4000, 75, false); 730 */ 731 732 } 733 else 734 { 735 mWindow->removeViewport(VIZ_VIEWPORT_Z_ORDER); 736 // if octree was enabled for visualization purpose, reset now 737 mSceneMgr->setOption("ShowOctree", &mShowOctree); 738 } 739 } 740 //----------------------------------------------------------------------- 741 void MouseQueryListener::toggleUseShadows() 742 { 743 mUseShadows = !mUseShadows; 744 745 //mSunLight->setCastShadows(mUseShadows); 746 747 if (mUseShadows) 748 { 749 mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE); 750 } 751 else 752 { 753 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 754 } 755 756 } 757 //----------------------------------------------------------------------- 758 void MouseQueryListener::nextNodeVizMode() 759 { 760 mNodeVizMode = (mNodeVizMode + 1) % NODEVIZ_MODES_NUM; 761 762 //bool renderNodesForViz = (mNodeVizMode == NODEVIZ_RENDER_NODES) || (mNodeVizMode == NODEVIZ_RENDER_NODES_AND_CONTENT); 763 bool renderNodesContentForViz = mNodeVizMode == NODEVIZ_RENDER_GEOMETRY; 764 765 //mSceneMgr->setOption("RenderNodesForViz", &renderNodesForViz); 766 mSceneMgr->setOption("RenderNodesContentForViz", &renderNodesContentForViz); 767 } 768 //----------------------------------------------------------------------- 769 void MouseQueryListener::keyPressed(KeyEvent* e) 770 { 771 if(e->getKey() == KC_ESCAPE) 772 { 773 mShutdownRequested = true; 774 e->consume(); 775 return; 776 } 777 778 CEGUI::System::getSingleton().injectKeyDown(e->getKey()); 779 CEGUI::System::getSingleton().injectChar(e->getKeyChar()); 780 e->consume(); 781 } 782 //----------------------------------------------------------------------- 783 void MouseQueryListener::keyReleased(KeyEvent* e) 784 { 785 CEGUI::System::getSingleton().injectKeyUp(e->getKey()); 786 e->consume(); 787 } 788 //----------------------------------------------------------------------- 789 void MouseQueryListener::keyClicked(KeyEvent* e) 790 { 791 // Do nothing 792 e->consume(); 793 } 794 //----------------------------------------------------------------------- 795 void MouseQueryListener::addFrameInfo(SceneNode *camNode, Real timeElapsed) 796 { 797 frame_info info; 798 info.orientation = mCamNode->getOrientation(); 799 info.position = mCamNode->getPosition(); 800 info.timeElapsed = timeElapsed; 801 802 mFrameInfo.push_back(info); 803 } 804 //----------------------------------------------------------------------- 805 void MouseQueryListener::setCurrentFrameInfo(Real timeElapsed) 806 { 807 //-- find current frame relative to elapsed frame time 808 mTimeElapsed -= timeElapsed; 809 810 while ((mTimeElapsed <= 0) && (mCurrentFrame < (int)mFrameInfo.size() - 1)) 811 { 812 mTimeElapsed += mFrameInfo[mCurrentFrame ++].timeElapsed; 813 } 814 815 frame_info new_frame = mFrameInfo[mCurrentFrame]; 816 frame_info old_frame = mFrameInfo[mCurrentFrame - 1]; 817 818 //-- interpolate frames 819 Real factor = 1; 820 821 if (old_frame.timeElapsed > 0) 822 factor = mTimeElapsed / old_frame.timeElapsed; 823 824 Vector3 camPos = old_frame.position + factor * (new_frame.position - old_frame.position); 825 Quaternion camOrienation = Quaternion::Slerp(factor, old_frame.orientation, 826 new_frame.orientation, true); 827 828 mCamNode->setPosition(camPos); 829 mCamNode->setOrientation(camOrienation); 830 831 // stop replay after a full walkthrough 832 if (mCurrentFrame == (int)mFrameInfo.size() - 1) 833 { 834 nextAppState(); 835 } 836 } 202 837 203 838 204 /**************************************************************/ -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r114 r115 1 /** 2 \file 3 TestCullingTerrainApplication.h 4 */ 1 #ifndef _TestCullingTerrainApplication_H__ 2 #define _TestCullingTerrainApplication_H__ 3 5 4 #include "CEGUIForwardRefs.h" 6 5 #include "ExampleApplication.h" 7 6 #include "OgreTerrainContentGenerator.h" 8 #include "VisibilityEnvironment.h" 7 9 8 #include <OgreRenderTargetListener.h> 10 #include <vector> 11 12 Real timeDelay = 0; 13 #define KEY_PRESSED(_key,_timeDelay, _macro) \ 14 { \ 15 if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \ 16 { \ 17 timeDelay = _timeDelay; \ 18 _macro ; \ 19 } \ 20 } 21 22 String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 23 { 24 "View Frustum Culling", 25 "Stop and Wait Culling", 26 "Coherent Hierarchical Culling" 27 }; 28 29 /** The information about camera position and orienation per frame */ 30 typedef struct 31 { 32 Vector3 position; 33 Quaternion orientation; 34 Real timeElapsed; 35 } frame_info; 36 9 #include "TerrainMouseQueryListener.h" 37 10 38 11 class VisualizationRenderTargetListener: public RenderTargetListener … … 46 19 47 20 SceneManager *mSceneMgr; 48 };49 50 class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener51 {52 public:53 54 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,55 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera,56 SceneNode *camNode);57 58 ~MouseQueryListener();59 60 bool frameStarted(const FrameEvent& evt);61 bool frameEnded(const FrameEvent& evt);62 bool processUnbufferedKeyInput(const FrameEvent& evt);63 64 65 /* MouseListener callbacks. */66 virtual void mouseClicked(MouseEvent* e) { }67 virtual void mouseEntered(MouseEvent* e) { }68 virtual void mouseExited(MouseEvent* e) { }69 70 // This is when the mouse button goes DOWN.71 virtual void mousePressed(MouseEvent* e);72 73 // This is when the mouse button is let UP.74 virtual void mouseReleased(MouseEvent* e);75 76 /* MouseMotionListener callbacks */77 virtual void mouseMoved (MouseEvent *e);78 79 // This is when the mouse is clicked, held and dragged.80 virtual void mouseDragged (MouseEvent *e);81 82 void keyPressed(KeyEvent* e);83 84 void keyReleased(KeyEvent* e);85 void keyClicked(KeyEvent* e);86 87 enum {WALKTHROUGH, REPLAY, STATE_NUM};88 89 // visualization modes for scene nodes90 //enum {NODEVIZ_NONE, NODEVIZ_RENDER_NODES,91 // NODEVIZ_RENDER_NODES_AND_CONTENT, NODEVIZ_MODES_NUM};92 enum {NODEVIZ_NONE, NODEVIZ_RENDER_GEOMETRY, NODEVIZ_MODES_NUM};93 94 void nextAlgorithm();95 void changeThreshold(int incr);96 void updateStats();97 98 void toggleUseOptimization();99 void toggleShowOctree();100 void toggleUseVisibilityCulling();101 void toggleShowViz();102 void nextNodeVizMode();103 void toggleRecord();104 105 void zoomVizCamera(int zoom);106 107 void addFrameInfo(SceneNode *camNode, Real timeElapsed);108 void setCurrentFrameInfo(Real timeElapsed);109 110 void setAppState(int state);111 void nextAppState();112 113 void setAlgorithm(int algorithm);114 115 void moveCamera();116 117 void writeFrames();118 void loadFrames();119 120 void toggleUseShadows();121 122 protected:123 void Clamp2Terrain();124 125 bool mLMouseDown, mRMouseDown; // True if the mouse buttons are down126 SceneManager *mSceneMgr; // A pointer to the scene manager127 128 CEGUI::Renderer *mGUIRenderer; // cegui renderer129 130 bool mShutdownRequested;131 int mCurrentAlgorithm;132 int mVisibilityThreshold;133 134 OverlayElement *mAlgorithmInfo;135 OverlayElement *mThresholdInfo;136 OverlayElement *mFrustumCulledNodesInfo;137 OverlayElement *mQueryCulledNodesInfo;138 OverlayElement *mTraversedNodesInfo;139 OverlayElement *mHierarchyNodesInfo;140 OverlayElement *mUseOptimizationInfo;141 OverlayElement *mRenderedNodesInfo;142 OverlayElement *mObjectsInfo;143 OverlayElement *mQueriesIssuedInfo;144 145 SceneNode *mCurrentObject; // the newly created object146 int mObjectCount; // The number of objects on the screen147 148 RayQueryExecutor *mRayQueryExecutor;149 TerrainContentGenerator *mTerrainContentGenerator;150 151 bool mUseOptimization;152 bool mShowOctree;153 bool mUseVisibilityCulling;154 bool mShowVisualization;155 int mNodeVizMode;156 bool mCullCamera;157 158 Real mVizCameraHeight;159 160 Camera *mVizCamera;161 SceneNode *mCamNode;162 163 //std::deque<Vector3> mWalkList; // The list of points we are walking to164 std::vector<frame_info> mFrameInfo;165 166 int mCurrentFrame;167 // the current application state168 int mAppState;169 bool mRecord;170 Real mTimeElapsed;171 bool mUseShadows;172 173 bool mVisualizeCulledNodes;174 21 }; 175 22 … … 209 56 VisualizationRenderTargetListener *mRenderTargetListener; 210 57 58 TerrainMouseQueryListener *mTerrainFrameListener; 59 211 60 private: 212 61 void chooseSceneManager(void); 213 62 }; 63 64 #endif // TestCullingTerrainApplication -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreHardwareOcclusionQuery.h
r92 r115 96 96 * Pulls the hardware occlusion query too see if there is a result. 97 97 * @retval NumOfFragments will get the resulting number of fragments. 98 * @param waitForResult if true, the query will wait until a result is available99 * @return True if success or false if not.100 * @Remarks Hardware occlusion is an assyncronius process the result may take a frame or so.101 * one idea is to test pass1 and if not visible skip pass2. Also note that objects102 * not visible must be tested evrey frame. Visable objects don't need testing every frame.103 * Testing non visable objects can be don unlit, no texture with low LOD object.104 * 0 will generate all the levels till 1x1. [default: 0]105 */106 #ifdef GTP_VISIBILITY_MODIFIED_OGRE107 virtual bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ) = 0;108 #else109 virtual bool pullOcclusionQuery( unsigned int* NumOfFragments ) = 0;110 #endif111 /**112 * Pulls the hardware occlusion query too see if there is a result.113 * @retval NumOfFragments will get the resulting number of fragments.114 * @param waitForResult if true, the query will wait until a result is available115 98 * @return True if success or false if not. 116 99 * @Remarks In DX9 mode specifying OCCLUSIONQUERY_FLUSH as the flag, will case the driver to flush whatever API calls are batched. 117 100 * In OpenGL mode it makes no difference if you specify OCCLUSIONQUERY_FLUSH or OCCLUSIONQUERY_NOFLUSH. 118 101 */ 119 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 120 virtual bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 121 const HW_OCCLUSIONQUERY flag ) = 0; 122 #else 123 virtual bool pullOcclusionQuery( unsigned int* NumOfFragments, 124 const HW_OCCLUSIONQUERY flag ) = 0; 125 #endif 102 virtual bool pullOcclusionQuery(unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag = HWOCCLUSIONQUERY_FLUSH) = 0; 103 126 104 /** 127 105 * Let's you get the last pixel count with out doing the hardware occlusion test … … 143 121 virtual void setSkipRate( int skip ) = 0; 144 122 virtual int getSkipRate() = 0; 123 124 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 125 /** 126 Pulls occlusion query. 127 @param NumOfFragments number of visible fragments if query result was available. 128 Last query result if query result was not yet available. 129 130 @param waitForResult if true, the function waits until the result is available. 131 Otherwise the function returns immediately, not waiting for the result. 132 @returns true if query result was available, false if result was not yet available 133 */ 134 virtual bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 135 const HW_OCCLUSIONQUERY flag = HWOCCLUSIONQUERY_FLUSH ) = 0; 136 #endif // GTP_VISIBILITY_MODIFIED_OGRE 137 145 138 //---------------------------------------------------------------------- 146 139 // Private members -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h
r74 r115 128 128 @param node scene node to be rendered 129 129 @param cam current camera 130 @param leaveTransparentsInQueue if only solid objects should be rendered 130 131 */ 131 void _renderSceneNode( Camera *cam, SceneNode *node);132 /** deletes all queues which we were currently processing133 @remark clears render queueafter rendering scene node132 void _renderSceneNode(Camera *cam, SceneNode *node, bool leaveTransparentsInQueue = false); 133 /** deletes all processed queues 134 @remark clears render queues after rendering scene node 134 135 */ 135 void _deleteRenderedQueueGroups( );136 void _deleteRenderedQueueGroups(bool leaveTransparentsInQueue); 136 137 /** Internal method used by _renderVisibleObjects to deal with renderables 137 138 which override the camera's own view / projection materices. -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
r99 r115 59 59 #include "OgreDataStream.h" 60 60 #include "OgreStaticGeometry.h" 61 #include <windows.h> //matt: remove later 61 62 62 // This class implements the most basic scene manager 63 63 … … 665 665 if (lastUsedVertexProgram) 666 666 { 667 //matt: remove later668 //OutputDebugString("unbinding vertex program\n");669 670 667 mDestRenderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM); 671 668 lastUsedVertexProgram = false; … … 990 987 const String& groupName) 991 988 { 992 mSkyPlaneEnabled = enable;993 989 if (enable) 994 990 { … … 1061 1057 1062 1058 } 1059 mSkyPlaneEnabled = enable; 1063 1060 } 1064 1061 //----------------------------------------------------------------------- … … 1071 1068 const String& groupName) 1072 1069 { 1073 mSkyBoxEnabled = enable;1074 1070 if (enable) 1075 1071 { … … 1143 1139 1144 1140 } 1145 1141 mSkyBoxEnabled = enable; 1146 1142 } 1147 1143 //----------------------------------------------------------------------- … … 1157 1153 const String& groupName) 1158 1154 { 1159 mSkyDomeEnabled = enable;1160 1155 if (enable) 1161 1156 { … … 1164 1159 { 1165 1160 OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 1166 "Sky dome material '" + materialName + " not found.",1161 "Sky dome material '" + materialName + "' not found.", 1167 1162 "SceneManager::setSkyDome"); 1168 1163 } … … 1208 1203 1209 1204 } 1205 mSkyDomeEnabled = enable; 1210 1206 } 1211 1207 //----------------------------------------------------------------------- … … 2658 2654 { 2659 2655 Light* l = i->second; 2656 if (l->isVisible()) 2657 { 2660 2658 if (l->getType() == Light::LT_DIRECTIONAL) 2661 2659 { … … 2675 2673 2676 2674 } 2675 } 2677 2676 } 2678 2677 … … 4180 4179 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 4181 4180 //----------------------------------------------------------------------- 4182 void SceneManager::_renderSceneNode( Camera *cam, SceneNode *node)4181 void SceneManager::_renderSceneNode(Camera *cam, SceneNode *node, bool leaveTransparentsInQueue) 4183 4182 { 4184 4183 node->_findVisibleObjects(cam, getRenderQueue(), false, mDisplayNodes, false); … … 4186 4185 4187 4186 // delete all rendered objects from renderqueue 4188 _deleteRenderedQueueGroups( );4189 } 4190 //----------------------------------------------------------------------- 4191 void SceneManager::_deleteRenderedQueueGroups( )4187 _deleteRenderedQueueGroups(leaveTransparentsInQueue); 4188 } 4189 //----------------------------------------------------------------------- 4190 void SceneManager::_deleteRenderedQueueGroups(bool leaveTransparentsInQueue) 4192 4191 { 4193 4192 RenderQueue::QueueGroupIterator queueIt = getRenderQueue()->_getQueueGroupIterator(); … … 4200 4199 4201 4200 if (isRenderQueueToBeProcessed(qId)) 4201 { 4202 if (leaveTransparentsInQueue) 4203 { 4204 pGroup->clearSolids(); 4205 } 4206 else 4207 { 4202 4208 pGroup->clear(); 4209 } 4210 } 4203 4211 } 4204 4212 -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h
r112 r115 105 105 /** Renders one octant of an octree, i.e., renders current octant 106 106 node and does not traverse deeper into the tree. 107 107 108 @remark Note that OctreeNode instances are NOT part of the octree 108 109 hierarchy, instead one octant of an Octree contains many OctreeNode instances. 109 @param octree the octree to be rendered110 110 111 @param cam current camera 112 @param octree the octant to be rendered (without children) 113 @param onlyShadowCasters if only shadow casters are rendered 114 @param leaveTransparentsInQueue if transparemt should be left in queue for later processing 111 115 */ 112 void _renderOctant(Camera* cam, Octree *octree, bool onlyShadowCasters );116 void _renderOctant(Camera* cam, Octree *octree, bool onlyShadowCasters, bool leaveTransparentsInQueue = false); 113 117 114 118 /** Returns stored list of boxes */ … … 214 218 IntersectionSceneQuery* createIntersectionQuery(unsigned long mask); 215 219 220 216 221 protected: 217 222 -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
r61 r115 109 109 mDepth = 0; 110 110 111 //matt: remove later112 //char msg[100];113 //sprintf(msg, "creating new octant in depth %d", mDepth);114 //OutputDebugString(msg);115 116 111 #endif //GTP_VISIBILITY_MODIFIED_OGRE 117 112 mNumNodes = 0; … … 171 166 172 167 mWireBoundingBox->setupBoundingBox(mBox); 173 174 // matt: change this back175 //AxisAlignedBox box; _getCullBounds(&box);176 //mWireBoundingBox->setupBoundingBox(box);177 178 168 return mWireBoundingBox; 179 169 } -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp
r112 r115 39 39 #include <OgreOctreeCamera.h> 40 40 #include <OgreRenderSystem.h> 41 #include <windows.h> 41 42 42 43 43 extern "C" … … 508 508 } 509 509 510 //matt: remove later511 //OutputDebugString("adding octree node\n");512 513 514 510 _addOctreeNode( n, octant -> mChildren[ x ][ y ][ z ], ++depth ); 515 511 … … 1173 1169 } 1174 1170 //----------------------------------------------------------------------- 1175 void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant, bool onlyShadowCasters) 1171 void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant, bool onlyShadowCasters, 1172 bool leaveTransparentsInQueue)//, bool useZPassQueue) 1176 1173 { 1177 1174 //Add stuff to be rendered; … … 1188 1185 { 1189 1186 sn->_addToRenderQueue(cam, getRenderQueue(), onlyShadowCasters); 1190 //node->_findVisibleObjects(cam, getRenderQueue(), false, mDisplayNodes, false);1191 1187 mVisible.push_back(sn); 1192 1188 … … 1207 1203 if (mShowBoxes) 1208 1204 { 1205 octant->getWireBoundingBox()->setMaterial("BaseWhiteNoLighting"); 1206 1209 1207 getRenderQueue()->addRenderable(octant->getWireBoundingBox()); 1210 1208 mBoxes.push_back(octant->getWireBoundingBox()); 1211 1209 } 1212 1210 1211 //-- the actual rendering 1213 1212 SceneManager::_renderVisibleObjects(); 1214 1215 1213 // delete all rendered objects from the render queue 1216 _deleteRenderedQueueGroups( );1214 _deleteRenderedQueueGroups(leaveTransparentsInQueue); 1217 1215 } 1218 1216 #endif // GTP_VISIBILITY_MODIFIED_OGRE -
trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/include/OgreD3D9HardwareOcclusionQuery.h
r92 r115 33 33 namespace Ogre { 34 34 35 36 37 35 // If you use multiple rendering passes you can test only the first pass and all other passes don't have to be rendered 38 // if the first pass resultet has too few pixels visable.36 // if the first pass resultet has too few pixels visible. 39 37 40 38 // Be sure to render all occlluder first and whats out so the RenderQue don't switch places on … … 46 44 * 47 45 * @author Lee Sandberg, email lee@abcmedia.se 46 * 47 * Updated on 12/7/2004 by Chris McGuirk 48 48 */ 49 49 class D3D9HardwareOcclusionQuery : public HardwareOcclusionQuery … … 71 71 void beginOcclusionQuery(); 72 72 void endOcclusionQuery(); 73 bool pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag = HWOCCLUSIONQUERY_FLUSH); 74 unsigned int getLastQuerysPixelcount() { return mPixelCount; } 73 75 74 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 75 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 76 const HW_OCCLUSIONQUERY flag ); 77 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ); 78 #else 79 bool pullOcclusionQuery( unsigned int* NumOfFragments ); 80 bool pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ); 81 #endif // GTP_VISIBILITY_MODIFIED_OGRE 82 83 unsigned int getLastQuerysPixelcount() { return m_uintPixelCount; } 84 85 // This functions are optional, it's a simple filter that simply skips some hardware occlusion tests on visable objects only 86 // It's easy to use if you don't have to keep track on which objects are visable (can be skipped) and what objects arn't visable.. 87 // (None visable objects and object you introduce for the first time have allways to be tested allthough the cheepest possible 88 // LOD (Level Of Detail) mesh and material wize). 76 // These functions are optional, it's a simple filter that simply skips some hardware occlusion tests on visible objects only 77 // It's easy to use if you don't have to keep track of which objects are visible (can be skipped) and what objects arn't visible.. 78 // (None visible objects and object you introduce for the first time have always to be tested although the cheapest possible 79 // LOD (Level Of Detail) mesh and material-wise). 89 80 90 81 /** 91 82 * 92 * Remarks This function allows you to set how often the hardware occlusion really aresent to the driver83 * Remarks This function allows you to set how often the hardware occlusion query is sent to the driver 93 84 * if you set it to 0 every hw occlusion test is acctually made. If you set it to 1 only the half of your queries are sent 94 * for all visable objects. 2 will result in 25% of all queries to acctualy be sent. 95 * New and none visable objects will be tested all the time. 96 * This functionality is here because this class can keep track on visable and none visable objects for you. 85 * 2 will result in 25% of all queries to acctualy be sent. 86 * This functionality is here because this class can keep track on visible and none visible objects for you. 97 87 * Once you you set the SkipRate for any hardware occlusion instance it effects all others. 98 88 */ 99 89 90 void setSkipRate( int skip ) { mSkipInterval = skip; } // Using 2 only 50 % of the tests are actully made and 3 results in only 33% of the tests. So on. 91 int getSkipRate() { return mSkipInterval; } 100 92 101 void setSkipRate( int skip ) { m_Skip = skip; } // Using 2 only 50 % of the tests are actually made and 3 results in only 33% of the tests. So on. 102 int getSkipRate() { return m_Skip; }103 93 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 94 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag = HWOCCLUSIONQUERY_FLUSH ); 95 #endif // GTP_VISIBILITY_MODIFIED_OGRE 104 96 //---------------------------------------------------------------------- 105 97 // Protected members … … 107 99 protected: 108 100 109 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 110 const DWORD queryFlag ); 111 112 unsigned int m_uintPixelCount; 113 IDirect3DQuery9* m_pD3DQuery; 114 IDirect3DDevice9* m_pD3DDevice; // d3d device 115 bool m_bOcclusionQuery; 116 int m_SkipCounter; // m_SkipConter = m_SkipConter % m_Skip; if ( m_SkipConter == 0 && m_uintPixelCount !=0 ) TestHWOcclusion else just return 117 static int m_Skip; // This is shared by all instancies 118 bool m_bHWOcclusionSupport; 101 unsigned int mPixelCount; 102 IDirect3DQuery9* mpQuery; 103 IDirect3DDevice9* mpDevice; 104 int mSkipCounter; 105 int mSkipInterval; 106 bool mHasOcclusionSupport; 119 107 }; 120 108 -
trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9HardwareOcclusionQuery.cpp
r97 r115 29 29 namespace Ogre { 30 30 31 int D3D9HardwareOcclusionQuery::m_Skip = 0;32 33 31 /** 34 32 * This is a class that is the DirectX9 implementation of … … 36 34 * 37 35 * @author Lee Sandberg 36 * 37 * Updated on 12/7/2004 by Chris McGuirk 38 38 */ 39 39 40 40 /** 41 41 * Default object constructor 42 *43 42 */ 44 43 D3D9HardwareOcclusionQuery::D3D9HardwareOcclusionQuery( IDirect3DDevice9* pD3DDevice ) 45 44 { 46 m_pD3DDevice = pD3DDevice; 47 m_uintPixelCount = 0; 48 m_SkipCounter = 0; 49 m_bHWOcclusionSupport = false; 45 mpDevice = pD3DDevice; 46 mPixelCount = 0; 47 mSkipCounter = 0; 48 mSkipInterval = 0; 49 mHasOcclusionSupport = false; 50 50 51 HRESULT hr = m_pD3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &m_pD3DQuery); 51 // create the occlusion query 52 HRESULT hr = mpDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &mpQuery); 53 52 54 if ( hr != D3D_OK ) 53 55 { 54 //OGRE_EXCEPT(hr, "D3D9HardwareOcclusionQuery couldn't create hardware occlusion query object.", 55 // "D3D9HardwareOcclusionQuery::D3D9HardwareOcclusionQuery"); 56 m_bHWOcclusionSupport = false; 56 mHasOcclusionSupport = false; 57 57 } 58 58 else 59 59 { 60 m_bHWOcclusionSupport = true;60 mHasOcclusionSupport = true; 61 61 } 62 62 } 63 64 63 65 64 /** … … 68 67 D3D9HardwareOcclusionQuery::~D3D9HardwareOcclusionQuery() 69 68 { 70 SAFE_RELEASE( m_pD3DQuery);69 SAFE_RELEASE(mpQuery); 71 70 } 72 71 73 #ifndef GTP_VISIBILITY_MODIFIED_OGRE74 72 //------------------------------------------------------------------ 75 73 // Occlusion query functions (see base class documentation for this) … … 77 75 void D3D9HardwareOcclusionQuery::beginOcclusionQuery() 78 76 { 79 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 77 // Make it fail silently if hardware occlusion isn't supported 78 if(mHasOcclusionSupport) 80 79 { 81 if ( m_SkipCounter == m_Skip ) { m_SkipCounter = 0; }; // Counter starts at 0 again at m_Skip 82 83 if ( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 80 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 81 // Counter starts at 0 again at mSkipInterval 82 if(mSkipCounter == mSkipInterval) 83 #else 84 if (mSkipCounter >= mSkipInterval) // otherwise no query ever issued if mSkipInterval = 0 ! 85 #endif // GTP_VISIBILITY_MODIFIED_OGRE 84 86 { 85 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 87 mSkipCounter = 0; 88 } 89 //std::stringstream d; d << "count: " << mSkipCounter; 90 //LogManager::getSingleton().logMessage(d.str()); 91 if (mSkipCounter == 0) 92 { 93 mpQuery->Issue(D3DISSUE_BEGIN); 86 94 } 87 95 } 96 88 97 } 89 90 void D3D9HardwareOcclusionQuery::endOcclusionQuery() 91 { 92 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 98 99 void D3D9HardwareOcclusionQuery::endOcclusionQuery() 93 100 { 94 if (m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 95 { 96 m_pD3DQuery->Issue(D3DISSUE_END); 97 } 98 m_SkipCounter++; // The skip counter is increased 101 // Make it fail silently if hardware occlusion isn't supported 102 if(mHasOcclusionSupport) 103 { 104 if(mSkipCounter == 0) 105 { 106 mpQuery->Issue(D3DISSUE_END); 107 } 108 109 // The skip counter is increased 110 mSkipCounter++; 99 111 } 100 112 } 101 113 102 114 //------------------------------------------------------------------ 103 // This version of pullOcclusionQuery cases the DX9 API/Driver to flush all commands to the 3D card 104 // to allow a fast result from the query, but at the cost of poorer batching of API calls to the card. 105 // Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 106 //-- 107 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments) 108 { 109 HRESULT hr; 110 111 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 112 { 113 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), D3DGETDATA_FLUSH ); 114 115 if ( hr != S_OK ) 116 { 117 return false; 118 } 119 else 120 { 121 m_uintPixelCount = *NumOfFragments; 122 return true; 123 } 124 } 125 else 126 { 127 m_uintPixelCount = 100000; // Fails quitlly if hardware occlusion is not supported - every object is visable 128 return true; 129 } 130 } 131 132 //------------------------------------------------------------------ 133 // This version of pullOcclusionQuery cases the DX9 API/Driver to not flush all commands to the 3D card 115 // This version of pullOcclusionQuery causes the DX9 API/Driver to not flush all commands to the 3D card 134 116 // to allow a fast result from the query, but the batching of API calls to the card will be normal. 135 // But the query wont be processed until the card recives the query in the nexrbatch.117 // But the query wont be processed until the card recives the query in the next batch. 136 118 // Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 137 119 //-- … … 140 122 HRESULT hr; 141 123 142 // TO DO: USE lockOpts= D3D9Mappings::get(options); instead of RS_OCCLUSIONQUERY enum 124 // Make it fail silently if hardware occlusion isn't supported 125 if(mHasOcclusionSupport) 126 { 127 DWORD d3dFlags = (flag == HWOCCLUSIONQUERY_FLUSH) ? D3DGETDATA_FLUSH : 0; 128 129 // run until success (http://www.gamedev.net/reference/programming/features/occlusionculling/page2.asp) 130 while(hr = mpQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), d3dFlags) == S_FALSE); 143 131 144 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 145 { 146 147 switch( flag ) 148 { 149 case HWOCCLUSIONQUERY_FLUSH : 150 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), D3DGETDATA_FLUSH ); 151 break; 152 153 case HWOCCLUSIONQUERY_NOFLUSH : 154 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), 0 ); 155 break; 156 }; 157 158 159 160 if ( hr != S_OK ) 161 { 162 return false; 132 mPixelCount = *NumOfFragments; 163 133 } 164 134 else 165 135 { 166 m_uintPixelCount = *NumOfFragments;167 return true;136 // fail silently if not supported, assume visible i suppose 137 mPixelCount = 100000; 168 138 } 169 } 170 else 171 { 172 m_uintPixelCount = 100000; // Fails quitlly if hardware occlusion is not supported - every object is visable 139 173 140 return true; 174 141 } 175 } 176 # else //GTP_VISIBILITY_MODIFIED_OGRE142 143 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 177 144 //------------------------------------------------------------------ 178 void D3D9HardwareOcclusionQuery::beginOcclusionQuery() 179 { 180 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 145 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 146 const HW_OCCLUSIONQUERY flag ) 181 147 { 182 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 148 HRESULT hr = S_OK; 149 DWORD queryFlag = (flag == HWOCCLUSIONQUERY_FLUSH) ? D3DGETDATA_FLUSH : 0; 150 151 if (mHasOcclusionSupport) // In case hardware occlusion isn't supported 152 { 153 do 154 { 155 hr = mpQuery->GetData(NumOfFragments, sizeof(NumOfFragments), queryFlag); 156 } 157 while(waitForResult && (hr == S_FALSE)); 158 159 mPixelCount = *NumOfFragments; 160 } 161 else 162 { 163 mPixelCount = 100000; // every object is visible 164 } 165 166 return hr == S_OK; 183 167 } 184 }185 //------------------------------------------------------------------186 void D3D9HardwareOcclusionQuery::endOcclusionQuery()187 {188 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported189 {190 m_pD3DQuery->Issue(D3DISSUE_END);191 }192 }193 //------------------------------------------------------------------194 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult )195 {196 return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH);197 }198 199 //------------------------------------------------------------------200 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult,201 const HW_OCCLUSIONQUERY flag )202 {203 DWORD queryFlag = flag == HWOCCLUSIONQUERY_FLUSH ? D3DGETDATA_FLUSH : 0;204 // TO DO: USE lockOpts= D3D9Mappings::get(options); instead of RS_OCCLUSIONQUERY enum205 206 return pullOcclusionQuery(NumOfFragments, waitForResult, queryFlag);207 }208 209 //------------------------------------------------------------------210 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult,211 const DWORD queryFlag )212 {213 HRESULT hr = S_OK;214 215 if( m_bHWOcclusionSupport ) // In case hardware occlusion isn't supported216 {217 do218 {219 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), queryFlag );220 }221 while(waitForResult && (hr == S_FALSE));222 223 m_uintPixelCount = *NumOfFragments;224 }225 else226 {227 m_uintPixelCount = 100000; // every object is visible228 }229 230 return hr == S_OK;231 }232 168 233 169 234 170 #endif // GTP_VISIBILITY_MODIFIED_OGRE 235 171 236 } // namespace OGre 172 173 } -
trunk/VUT/work/ogre_changes/RenderSystems/GL/include/OgreGLHardwareOcclusionQuery.h
r92 r115 88 88 void beginOcclusionQuery(); 89 89 void endOcclusionQuery(); 90 91 #ifdef GTP_VISIBILITY_MODIFIED_OGRE92 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult,93 const HW_OCCLUSIONQUERY flag );94 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult );95 #else96 bool pullOcclusionQuery( unsigned int* NumOfFragments );97 90 bool pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ); 98 #endif // GTP_VISIBILITY_MODIFIED_OGRE 99 100 unsigned int getLastQuerysPixelcount() { return m_uintPixelCount; } 91 unsigned int getLastQuerysPixelcount() { return mPixelCount; } 101 92 102 93 // This functions are optional, it's a simple filter that simply skipps some hardware occlusion tests on visable objects only … … 115 106 */ 116 107 117 void setSkipRate( int skip ) { m _Skip= skip; } // Using 2 only 50 % of the tests are actully made and 3 results in only 33% of the tests. So on.118 int getSkipRate() { return m _Skip; }108 void setSkipRate( int skip ) { mSkipInterval = skip; } // Using 2 only 50 % of the tests are actully made and 3 results in only 33% of the tests. So on. 109 int getSkipRate() { return mSkipInterval; } 119 110 120 111 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 112 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag = HWOCCLUSIONQUERY_FLUSH ); 113 #endif // GTP_VISIBILITY_MODIFIED_OGRE 121 114 //---------------------------------------------------------------------- 122 115 // Protected members … … 124 117 protected: 125 118 126 unsigned int m _uintPixelCount;127 unsigned int m_uintQuery[1];119 unsigned int mPixelCount; 120 GLuint mQueryID; 128 121 bool m_bOcclusionQuery; 129 int m _SkipCounter; // m_SkipConter = m_SkipConter % m_Skip; if ( m_SkipConter == 0 && m_uintPixelCount !=0 ) TestHWOcclusion else just return130 static int m_Skip; // This is shared by all instancies131 bool m _bHWOcclusionSupport;122 int mSkipCounter; 123 int mSkipInterval; 124 bool mHasOcclusionSupport; 132 125 }; 133 134 126 135 127 } -
trunk/VUT/work/ogre_changes/RenderSystems/GL/include/OgreGLPrerequisites.h
r97 r115 70 70 extern GL_SecondaryColorPointerEXT_Func glSecondaryColorPointerEXT_ptr; 71 71 72 // Pointer to glSecondaryColor3fEXT function 73 typedef void (APIENTRY *GL_SecondaryColor3fEXT_Func)(GLfloat, GLfloat, GLfloat); 74 extern GL_SecondaryColor3fEXT_Func glSecondaryColor3fEXT_ptr; 75 72 76 // Pointer to glGenBuffersARB function 73 77 typedef void (APIENTRY *GL_GenBuffersARB_Func)(GLsizei, GLuint*); … … 208 212 extern GL_GetOcclusionQueryuivNV_Func glGetOcclusionQueryuivNV_ptr; 209 213 210 #ifdef GTP_VISIBILITY_MODIFIED_OGRE211 // Pointer to glGenQueriesARB function212 typedef void (APIENTRY *GL_GenQueriesARB_Func) (GLsizei n, GLuint *ids);213 extern GL_GenQueriesARB_Func glGenQueriesARB_ptr;214 215 // Pointer to glDeleteQueriesARB function216 typedef void (APIENTRY *GL_DeleteQueriesARB_Func) (GLsizei n, const GLuint *ids);217 extern GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr;218 219 // Pointer to glIsQueryARB function220 typedef GLboolean (APIENTRY *GL_IsQueryARB_Func) (GLuint id);221 extern GL_IsQueryARB_Func glIsQueryARB_ptr;222 223 // Pointer to glBeginQueryARB function224 typedef void (APIENTRY *GL_BeginQueryARB_Func) (GLenum target, GLuint id);225 extern GL_BeginQueryARB_Func glBeginQueryARB_ptr;226 227 // Pointer to glEndQueryARB function228 typedef void (APIENTRY *GL_EndQueryARB_Func) (GLenum target);229 extern GL_EndQueryARB_Func glEndQueryARB_ptr;230 231 // Pointer to glGetQueryivARB function232 typedef void (APIENTRY *GL_GetQueryivARB_Func) (GLuint id, GLenum pname, GLint *params);233 extern GL_GetQueryivARB_Func glGetQueryivARB_ptr;234 235 // Pointer to glGetQueryObjectivARB function236 typedef void (APIENTRY *GL_GetQueryObjectivARB_Func) (GLuint id, GLenum pname, GLint *params);237 extern GL_GetQueryObjectivARB_Func glGetQueryObjectivARB_ptr;238 239 // Pointer to glGetQueryObjectuivARB function240 typedef void (APIENTRY *GL_GetQueryObjectuivARB_Func) (GLuint id, GLenum pname, GLuint *params);241 extern GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr;242 243 #endif // GTP_VISIBILITY_MODIFIED_OGRE244 245 214 extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB_ptr; 246 215 extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB_ptr; … … 253 222 }; 254 223 224 // Pointer to glGenQueriesARB function 225 typedef void (APIENTRY *GL_GenQueriesARB_Func) (GLuint n, GLuint *ids); 226 extern GL_GenQueriesARB_Func glGenQueriesARB_ptr; 227 228 // Pointer to glDeleteQueriesARB function 229 typedef void (APIENTRY *GL_DeleteQueriesARB_Func) (GLuint n, const GLuint *ids); 230 extern GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr; 231 232 // Pointer to glBeginQueryARB function 233 typedef void (APIENTRY *GL_BeginQueryARB_Func) (GLenum target, GLuint id); 234 extern GL_BeginQueryARB_Func glBeginQueryARB_ptr; 235 236 // Pointer to glEndQueryARB function 237 typedef void (APIENTRY *GL_EndQueryARB_Func) (GLenum target); 238 extern GL_EndQueryARB_Func glEndQueryARB_ptr; 239 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 240 // Pointer to glGetQueryivARB function 241 typedef void (APIENTRY *GL_GetQueryivARB_Func) (GLuint id, GLenum pname, GLint *params); 242 extern GL_GetQueryivARB_Func glGetQueryivARB_ptr; 243 244 // Pointer to glGetQueryObjectivARB function 245 typedef void (APIENTRY *GL_GetQueryObjectivARB_Func) (GLuint id, GLenum pname, GLint *params); 246 extern GL_GetQueryObjectivARB_Func glGetQueryObjectivARB_ptr; 247 #endif // GTP_VISIBILITY_MODIFIED_OGRE 248 // Pointer to glGetQueryObjectuivARB function 249 typedef void (APIENTRY *GL_GetQueryObjectuivARB_Func) (GLuint id, GLenum pname, GLuint *params); 250 extern GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr; 255 251 256 252 -
trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLHardwareOcclusionQuery.cpp
r99 r115 27 27 #include "OgreException.h" 28 28 29 29 30 namespace Ogre { 30 31 int GLHardwareOcclusionQuery::m_Skip = 0;32 31 33 32 /** … … 36 35 * 37 36 * @author Lee Sandberg email: lee@abcmedia.se 37 * 38 * Updated on 12/7/2004 by Chris McGuirk 39 * - Implemented ARB_occlusion_query 38 40 */ 39 41 40 /* Functions used;41 42 glGenOcclusionQueriesNV_ptr( 1, m_uintQuery );43 glDeleteOcclusionQueriesNV_ptr( 1, &m_uintQuery[0] );44 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] );45 glEndOcclusionQueryNV_ptr();46 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments );47 48 TO DO: change this to the new ARB functions...49 50 */51 52 #ifndef GTP_VISIBILITY_MODIFIED_OGRE53 42 /** 54 43 * Default object constructor … … 57 46 GLHardwareOcclusionQuery::GLHardwareOcclusionQuery() 58 47 { 59 m_uintPixelCount = 0; 60 m_SkipCounter = 0; 48 mPixelCount = 0; 49 mSkipCounter = 0; 50 mSkipInterval = 0; 61 51 62 52 // Check for hardware occlusion support 63 if( glDeleteOcclusionQueriesNV_ptr != 0 ) // This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported. 53 // This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported. 54 //if (glGenQueriesARB_ptr != 0) 55 if (glGenOcclusionQueriesNV_ptr != 0) 64 56 { 65 m _bHWOcclusionSupport = true;57 mHasOcclusionSupport = true; 66 58 } 67 59 else 68 60 { 69 m _bHWOcclusionSupport = false;61 mHasOcclusionSupport = false; 70 62 } 71 63 72 if( m_bHWOcclusionSupport)64 if(mHasOcclusionSupport) 73 65 { 74 glGenOcclusionQueriesNV_ptr( 1, m_uintQuery ); 66 //glGenQueriesARB_ptr(1, &mQueryID ); 67 glGenOcclusionQueriesNV_ptr(1, &mQueryID); 75 68 } 76 69 } 77 78 70 79 71 /** … … 82 74 GLHardwareOcclusionQuery::~GLHardwareOcclusionQuery() 83 75 { 84 if( m _bHWOcclusionSupport )76 if( mHasOcclusionSupport ) 85 77 { 86 glDeleteOcclusionQueriesNV_ptr( 1, &m_uintQuery[0] ); 78 //glDeleteQueriesARB_ptr(1, &mQueryID); 79 glDeleteOcclusionQueriesNV_ptr(1, &mQueryID); 87 80 } 88 81 } … … 93 86 void GLHardwareOcclusionQuery::beginOcclusionQuery() 94 87 { 95 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 88 // Make it fail silently if hardware occlusion isn't supported 89 if(mHasOcclusionSupport) 96 90 { 97 if ( m_SkipCounter == m_Skip ) { m_SkipCounter = 0; }; // Counter starts at 0 again at m_Skip 98 if ( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 91 // Counter starts at 0 again at mSkipInterval 92 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 93 if(mSkipCounter == mSkipInterval) 94 #else 95 if (mSkipCounter >= mSkipInterval) // otherwise no query ever issued if mSkipInterval = 0 ! 96 #endif // GTP_VISIBILITY_MODIFIED_OGRE 97 { 98 mSkipCounter = 0; 99 } 100 101 if (mSkipCounter == 0) 99 102 { 100 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 103 //glBeginQueryARB_ptr(GL_SAMPLES_PASSED_ARB, mQueryID); 104 glBeginOcclusionQueryNV_ptr(mQueryID); 101 105 } 102 106 } … … 105 109 void GLHardwareOcclusionQuery::endOcclusionQuery() 106 110 { 107 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 111 // Make it fail silently if hardware occlusion isn't supported 112 if(mHasOcclusionSupport) 108 113 { 109 if( m _SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped114 if( mSkipCounter == 0) 110 115 { 116 //glEndQueryARB_ptr(GL_SAMPLES_PASSED_ARB); 111 117 glEndOcclusionQueryNV_ptr(); 112 118 } 113 m_SkipCounter++;114 }115 }116 119 117 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments) 118 { 119 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 120 { 121 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 120 mSkipCounter++; 122 121 } 123 else124 {125 *NumOfFragments = 100000; // Fails quitlly -> every object tested is visable.126 }127 128 m_uintPixelCount = *NumOfFragments;129 130 return true;131 122 } 132 123 133 124 //------------------------------------------------------------------ 134 // OpenGL dosn't use the flag, but to fulfil the abstract interface we need to include this function. 135 // Using this function in OpenGL mode simple works the same way as calling the other function without the flag parameter, 136 // but in DX9 it works differentlly, see notes in the DX9 implementation. 137 //-- 125 // OpenGL dosn't use the flag paramter. 126 //------------------------------------------------------------------ 138 127 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ) 139 128 { 140 if( m _bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported129 if( mHasOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 141 130 { 142 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 131 //glGetQueryObjectuivARB_ptr(mQueryID, GL_QUERY_RESULT_ARB, NumOfFragments); 132 glGetOcclusionQueryuivNV_ptr(mQueryID, GL_PIXEL_COUNT_NV, NumOfFragments); 143 133 } 144 134 else … … 147 137 } 148 138 149 m _uintPixelCount = *NumOfFragments;139 mPixelCount = *NumOfFragments; 150 140 151 141 return true; 152 142 } 153 143 154 #else // GTP_VISIBILITY_MODIFIED_OGRE 155 156 //------------------------------------------------------------------ 157 GLHardwareOcclusionQuery::GLHardwareOcclusionQuery() 158 { 159 m_uintPixelCount = 0; 160 m_SkipCounter = 0; 161 162 // Check for hardware occlusion support 163 if ( glDeleteOcclusionQueriesNV_ptr != 0 ) // This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported. 164 //if ( glDeleteQueriesARB_ptr != 0 ) 165 { 166 m_bHWOcclusionSupport = true; 167 } 168 else 169 { 170 m_bHWOcclusionSupport = false; 171 } 172 173 if ( m_bHWOcclusionSupport ) 174 { 175 glGenOcclusionQueriesNV_ptr( 1, m_uintQuery ); 176 //glGenQueriesARB_ptr(1, m_uintQuery); 177 } 178 } 179 180 181 //------------------------------------------------------------------ 182 GLHardwareOcclusionQuery::~GLHardwareOcclusionQuery() 183 { 184 if ( m_bHWOcclusionSupport ) 185 { 186 glDeleteOcclusionQueriesNV_ptr( 1, &m_uintQuery[0] ); 187 //glDeleteQueriesARB_ptr(1, &m_uintQuery[0]); 188 } 189 } 190 191 //------------------------------------------------------------------ 192 void GLHardwareOcclusionQuery::beginOcclusionQuery() 193 { 194 if ( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 195 { 196 // do the actual occlusion query for this node 197 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 198 //glBeginQueryARB_ptr(GL_SAMPLES_PASSED_ARB, m_uintQuery[0]); 199 } 200 } 201 202 void GLHardwareOcclusionQuery::endOcclusionQuery() 203 { 204 if ( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 205 { 206 glEndOcclusionQueryNV_ptr(); 207 //glEndQueryARB_ptr(GL_SAMPLES_PASSED_ARB); 208 } 209 } 210 //------------------------------------------------------------------ 211 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult) 144 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 145 //------------------------------------------------------------------ 146 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag) 212 147 { 213 148 unsigned int isAvailable = GL_TRUE; 214 //int isAvailable = GL_TRUE;215 149 216 if( m_bHWOcclusionSupport)150 if (mHasOcclusionSupport) 217 151 { 218 152 if (!waitForResult) 219 153 { 220 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable ); 221 //glGetQueryivARB_ptr(m_uintQuery[0], GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable); 154 // use nv queries rather that arb because they are faster (no flush) 155 //glGetQueryivARB_ptr(mQueryID, GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable); 156 glGetOcclusionQueryuivNV_ptr(mQueryID, GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable); 222 157 } 223 158 224 159 if (isAvailable == GL_TRUE) 225 160 { 226 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments);227 //glGetQueryObjectuivARB_ptr( m_uintQuery[0], GL_QUERY_RESULT_ARB, NumOfFragments);161 //glGetQueryObjectuivARB_ptr(mQueryID, GL_QUERY_RESULT_ARB, NumOfFragments); 162 glGetOcclusionQueryuivNV_ptr(mQueryID, GL_PIXEL_COUNT_NV, NumOfFragments); 228 163 } 229 164 } … … 234 169 } 235 170 236 m_uintPixelCount = *NumOfFragments;171 mPixelCount = *NumOfFragments; 237 172 238 173 return isAvailable == GL_TRUE; 239 174 } 240 175 241 //------------------------------------------------------------------ 242 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag ) 243 { 244 return pullOcclusionQuery(NumOfFragments, waitForResult); 176 #endif // GTP_VIBILITY_MODIFIED_OGRE 245 177 } 246 247 #endif // GTP_VISIBILITY_MODIFIED_OGRE248 249 250 }251 252 -
trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp
r97 r115 58 58 GL_ClientActiveTextureARB_Func glClientActiveTextureARB_ptr; 59 59 GL_SecondaryColorPointerEXT_Func glSecondaryColorPointerEXT_ptr; 60 GL_SecondaryColor3fEXT_Func glSecondaryColor3fEXT_ptr; 60 61 GL_GenBuffersARB_Func glGenBuffersARB_ptr; 61 62 GL_BindBufferARB_Func glBindBufferARB_ptr; … … 97 98 GL_EndOcclusionQueryNV_Func glEndOcclusionQueryNV_ptr; 98 99 GL_GetOcclusionQueryuivNV_Func glGetOcclusionQueryuivNV_ptr; 99 100 #ifdef GTP_VISIBILITY_MODIFIED_OGRE101 100 GL_GenQueriesARB_Func glGenQueriesARB_ptr; 102 101 GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr; 103 GL_IsQueryARB_Func glIsQueryARB_ptr;104 102 GL_BeginQueryARB_Func glBeginQueryARB_ptr; 105 103 GL_EndQueryARB_Func glEndQueryARB_ptr; 104 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 106 105 GL_GetQueryivARB_Func glGetQueryivARB_ptr; 107 106 GL_GetQueryObjectivARB_Func glGetQueryObjectivARB_ptr; 107 #endif // GTP_VISIBILITY_MODIFIED_OGRE 108 108 GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr; 109 #endif // GTP_VISIBILITY_MODIFIED_OGRE110 109 111 110 namespace Ogre { … … 191 190 glClientActiveTextureARB_ptr = 0; 192 191 glSecondaryColorPointerEXT_ptr = 0; 192 glSecondaryColor3fEXT_ptr = 0; 193 193 glGenBuffersARB_ptr = 0; 194 194 glBindBufferARB_ptr = 0; … … 220 220 glEndOcclusionQueryNV_ptr = 0; 221 221 glGetOcclusionQueryuivNV_ptr = 0; 222 223 #ifdef GTP_VISIBILITY_MODIFIED_OGRE224 222 glGenQueriesARB_ptr = 0; 225 223 glDeleteQueriesARB_ptr = 0; 226 glIsQueryARB_ptr = 0;227 224 glBeginQueryARB_ptr = 0; 228 225 glEndQueryARB_ptr = 0; 226 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 229 227 glGetQueryivARB_ptr = 0; 230 228 glGetQueryObjectivARB_ptr = 0; 229 #endif // GTP_VISIBILITY_MODIFIED_OGRE 231 230 glGetQueryObjectuivARB_ptr = 0; 232 #endif // GTP_VISIBILITY_MODIFIED_OGRE233 231 234 232 mCurrentLights = 0; … … 543 541 glSecondaryColorPointerEXT_ptr = 544 542 (GL_SecondaryColorPointerEXT_Func)mGLSupport->getProcAddress("glSecondaryColorPointerEXT"); 543 glSecondaryColor3fEXT_ptr = 544 (GL_SecondaryColor3fEXT_Func)mGLSupport->getProcAddress("glSecondaryColor3fEXT"); 545 545 glGenBuffersARB_ptr = 546 546 (GL_GenBuffersARB_Func)mGLSupport->getProcAddress("glGenBuffersARB"); … … 622 622 glGetOcclusionQueryuivNV_ptr = 623 623 (GL_GetOcclusionQueryuivNV_Func)mGLSupport->getProcAddress("glGetOcclusionQueryuivNV"); 624 glGetQueryObjectivARB_ptr = 625 (GL_GetQueryObjectivARB_Func)mGLSupport->getProcAddress("glGetQueryObjectivARB"); 626 glGetQueryObjectuivARB_ptr = 627 (GL_GetQueryObjectuivARB_Func)mGLSupport->getProcAddress("glGetQueryObjectuivARB"); 628 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 624 629 625 glGenQueriesARB_ptr = 630 626 (GL_GenQueriesARB_Func)mGLSupport->getProcAddress("glGenQueriesARB"); 631 627 glDeleteQueriesARB_ptr = 632 628 (GL_DeleteQueriesARB_Func)mGLSupport->getProcAddress("glDeleteQueriesARB"); 633 glIsQueryARB_ptr =634 (GL_IsQueryARB_Func)mGLSupport->getProcAddress("glIsQueryARB");635 629 glBeginQueryARB_ptr = 636 630 (GL_BeginQueryARB_Func)mGLSupport->getProcAddress("glBeginQueryARB"); 637 631 glEndQueryARB_ptr = 638 632 (GL_EndQueryARB_Func)mGLSupport->getProcAddress("glEndQueryARB"); 633 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 639 634 glGetQueryivARB_ptr = 640 635 (GL_GetQueryivARB_Func)mGLSupport->getProcAddress("glGetQueryivARB"); 641 636 glGetQueryObjectivARB_ptr = 642 637 (GL_GetQueryObjectivARB_Func)mGLSupport->getProcAddress("glGetQueryObjectivARB"); 638 #endif // GTP_VISIBILITY_MODIFIED_OGRE 643 639 glGetQueryObjectuivARB_ptr = 644 640 (GL_GetQueryObjectuivARB_Func)mGLSupport->getProcAddress("glGetQueryObjectuivARB"); 645 #endif // GTP_VISIBILITY_MODIFIED_OGRE646 641 647 642 mCapabilities->log(LogManager::getSingleton().getDefaultLog()); … … 1857 1852 cv1[2] = bm.colourArg1.b; 1858 1853 cv1[3] = bm.colourArg1.a; 1854 mManualBlendColours[stage][0] = bm.colourArg1; 1855 1859 1856 1860 1857 cv2[0] = bm.colourArg2.r; … … 1862 1859 cv2[2] = bm.colourArg2.b; 1863 1860 cv2[3] = bm.colourArg2.a; 1861 mManualBlendColours[stage][1] = bm.colourArg2; 1864 1862 } 1865 1863 1866 1864 if (bm.blendType == LBT_ALPHA) 1867 1865 { 1868 cv1[0] = 0;1869 cv1[1] = 0;1870 cv1[2] = 0;1866 cv1[0] = mManualBlendColours[stage][0].r; 1867 cv1[1] = mManualBlendColours[stage][0].g; 1868 cv1[2] = mManualBlendColours[stage][0].b; 1871 1869 cv1[3] = bm.alphaArg1; 1872 1870 1873 cv2[0] = 0;1874 cv2[1] = 0;1875 cv2[2] = 0;1871 cv2[0] = mManualBlendColours[stage][1].r; 1872 cv2[1] = mManualBlendColours[stage][1].g; 1873 cv2[2] = mManualBlendColours[stage][1].b; 1876 1874 cv2[3] = bm.alphaArg2; 1877 1875 } … … 2249 2247 } 2250 2248 glColor4f(1,1,1,1); 2249 glSecondaryColor3fEXT_ptr(0.0f, 0.0f, 0.0f); 2251 2250 2252 2251 // UnGuard … … 2537 2536 glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); 2538 2537 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); 2538 glEnable(GL_COLOR_SUM); 2539 2539 2540 // Check for FSAA 2540 2541 // Enable the extension if it was enabled by the GLSupport -
trunk/VUT/work/ogre_changes/Samples/Common/include/ExampleFrameListener.h
r100 r115 300 300 return true; 301 301 } 302 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 303 virtual void moveCamera() // made virtual by matt (16.05.05) 304 #else 302 305 303 void moveCamera() 306 #endif // GTP_VISIBILTIY_MODIFIED_OGRE307 304 { 308 305
Note: See TracChangeset
for help on using the changeset viewer.