Changeset 94 for trunk/VUT/work
- Timestamp:
- 05/12/05 18:55:25 (20 years ago)
- Location:
- trunk/VUT/work
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/SceneContentGenerator.cpp
r87 r94 6 6 */ 7 7 #include "SceneContentGenerator.h" 8 #include <windows.h>9 8 10 9 namespace Ogre { -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r93 r94 17 17 18 18 #define WIN32_LEAN_AND_MEAN 19 #include "windows.h"19 #include <windows.h> 20 20 21 21 … … 28 28 { 29 29 // Create the camera 30 mCamera = mSceneMgr->createCamera(" PlayerCam");30 mCamera = mSceneMgr->createCamera("CullCamera"); 31 31 32 32 // Position it at 500 in Z direction … … 112 112 mShowOctree(false), 113 113 mUseCulling(true), 114 mUseOptimization( false),114 mUseOptimization(true), 115 115 mUseCullCamera(false) 116 116 { -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r93 r94 97 97 bool mUseCullCamera; 98 98 99 Camera *m CullCamera;99 Camera *mVisualizationCamera; 100 100 }; 101 101 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r93 r94 17 17 18 18 #define WIN32_LEAN_AND_MEAN 19 #include "windows.h"19 #include <windows.h> 20 20 21 21 … … 27 27 if(mTerrainContentGenerator) 28 28 delete mTerrainContentGenerator; 29 //if(m CullCamera) delete mCullCamera;29 //if(mVisualizationCamera) delete mVisualizationCamera; 30 30 } 31 31 //----------------------------------------------------------------------- … … 33 33 { 34 34 // Create the camera 35 mCamera = mSceneMgr->createCamera(" PlayerCam");35 mCamera = mSceneMgr->createCamera("CullCamera"); 36 36 37 37 // Set a nice viewpoint … … 40 40 41 41 //--create cull camera 42 m CullCamera = mSceneMgr->createCamera("CullCamera");43 m CullCamera->setPosition(707, 2500, 528);44 m CullCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));45 46 m CullCamera->setNearClipDistance(1);42 mVisualizationCamera = mSceneMgr->createCamera("VisualizationCamera"); 43 mVisualizationCamera->setPosition(707, 2500, 528); 44 mVisualizationCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329)); 45 46 mVisualizationCamera->setNearClipDistance(1); 47 47 mCamera->setNearClipDistance(1); 48 48 … … 50 50 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE)) 51 51 { 52 m CullCamera->setFarClipDistance(0);52 mVisualizationCamera->setFarClipDistance(0); 53 53 mCamera->setFarClipDistance(0); 54 54 } 55 55 else 56 56 { 57 m CullCamera->setFarClipDistance(1000);57 mVisualizationCamera->setFarClipDistance(1000); 58 58 mCamera->setFarClipDistance(1000); 59 59 } … … 79 79 mWindow->getViewport(0)->setBackgroundColour(fadeColour); 80 80 //mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000); 81 mWindow->addViewport(mCullCamera, 10, 0.5, 0.5, 1, 1); 82 81 83 82 // Create a skybox 84 83 mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 5000, false); … … 133 132 { 134 133 mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, 135 mGUIRenderer, mTerrainContentGenerator, m CullCamera);134 mGUIRenderer, mTerrainContentGenerator, mVisualizationCamera); 136 135 mFrameListener->showDebugOverlay(true); 137 136 mRoot->addFrameListener(mFrameListener); … … 150 149 CEGUI::Renderer *renderer, 151 150 TerrainContentGenerator *sceneGenerator, 152 Camera * cullCamera):151 Camera *vizCamera): 153 152 ExampleFrameListener(win, cam, false, true), 154 153 mGUIRenderer(renderer), … … 163 162 mShowOctree(false), 164 163 mUseCulling(true), 165 mUseOptimization( false),164 mUseOptimization(true), 166 165 mUseCullCamera(false), 167 m CullCamera(cullCamera)166 mVisualizationCamera(vizCamera) 168 167 { 169 168 // Reduce move speed … … 293 292 bool MouseQueryListener::frameStarted(const FrameEvent &evt) 294 293 { 294 clamp2Terrain(mCamera); 295 clamp2Terrain(mVisualizationCamera); 296 297 return ExampleFrameListener::frameStarted(evt); 298 } 299 void MouseQueryListener::clamp2Terrain(Camera *cam) 300 { 295 301 // clamp to terrain 296 Vector3 camPos = mCamera->getPosition();302 Vector3 camPos = cam->getPosition(); 297 303 Vector3 queryResult; 298 304 299 300 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y))305 if(mRayQueryExecutor->executeRayQuery(&queryResult, 306 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y)) 301 307 { 302 mCamera->setPosition(mCamera->getPosition().x, queryResult.y + 10,303 mCamera->getPosition().z);308 cam->setPosition(cam->getPosition().x, queryResult.y + 10, 309 cam->getPosition().z); 304 310 } 305 306 camPos = mCullCamera->getPosition();307 308 if(mRayQueryExecutor->executeRayQuery(&queryResult,309 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y))310 {311 mCullCamera->setPosition(mCullCamera->getPosition().x, queryResult.y + 10,312 mCullCamera->getPosition().z);313 }314 315 return ExampleFrameListener::frameStarted(evt);316 311 } 317 312 //----------------------------------------------------------------------- … … 332 327 KEY_PRESSED(KC_C, 0.3, toggleUseCulling()); 333 328 KEY_PRESSED(KC_V, 0.3, toggleCullCamera()); 334 KEY_PRESSED(KC_X, 0.3, fixCullCamera());329 KEY_PRESSED(KC_X, 0.3, FixVizCamera()); 335 330 336 331 updateStats(); 332 //if(mWindow->getViewport(1)) mWindow->getViewport(1)->update(); 337 333 338 334 return ExampleFrameListener::frameStarted(evt) && ExampleFrameListener::frameEnded(evt); … … 420 416 { 421 417 mUseCullCamera = !mUseCullCamera; 418 419 if(mUseCullCamera) 420 { 421 mWindow->addViewport(mVisualizationCamera, 10, 0.5, 0.5, 1, 1); 422 mWindow->getViewport(1)->setClearEveryFrame(true); 423 } 424 else 425 mWindow->removeViewport(10); 426 422 427 mSceneMgr->setOption("CullCamera", &mUseCullCamera); 423 428 } 424 429 //----------------------------------------------------------------------- 425 void MouseQueryListener::fixCullCamera() 426 { 427 mCullCamera->setPosition(mCamera->getPosition()); 428 mCullCamera->setOrientation(mCamera->getOrientation()); 430 void MouseQueryListener::FixVizCamera() 431 { 432 mVisualizationCamera->setPosition(mCamera->getPosition()); 433 mVisualizationCamera->setOrientation(mCamera->getOrientation()); 434 clamp2Terrain(mVisualizationCamera); 429 435 } 430 436 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r93 r94 30 30 31 31 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 32 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera * cullCamera);32 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera); 33 33 34 34 ~MouseQueryListener(); … … 67 67 void toggleUseCulling(); 68 68 void toggleCullCamera(); 69 void fixCullCamera();69 void FixVizCamera(); 70 70 71 71 protected: 72 void clamp2Terrain(Camera *cam); 73 72 74 bool mLMouseDown, mRMouseDown; // True if the mouse buttons are down 73 75 SceneManager *mSceneMgr; // A pointer to the scene manager … … 101 103 bool mUseCullCamera; 102 104 103 Camera *m CullCamera;105 Camera *mVisualizationCamera; 104 106 }; 105 107 … … 127 129 TerrainContentGenerator *mTerrainContentGenerator; 128 130 129 Camera *m CullCamera;131 Camera *mVisualizationCamera; 130 132 131 133 private:
Note: See TracChangeset
for help on using the changeset viewer.