- Timestamp:
- 05/20/05 20:28:30 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/SceneContentGenerator.cpp
r104 r106 15 15 //----------------------------------------------------------------------- 16 16 SceneContentGenerator::SceneContentGenerator(SceneManager *sm): 17 mSceneMgr(sm), m Count(0),17 mSceneMgr(sm), mObjectCount(0), 18 18 mMinPos(Vector3(-70.0f, -70.0f, 0.0f)), 19 19 mMaxPos(Vector3(70.0f, 70.0f, 600.0f)), … … 32 32 Vector3 translationRatio; 33 33 34 int currentCount = m Count;34 int currentCount = mObjectCount; 35 35 int limit = 0; 36 36 37 37 //-- create random values between zero and one 38 while ((m Count - currentCount < numObjects) && (limit < 50000))38 while ((mObjectCount - currentCount < numObjects) && (limit < 50000)) 39 39 { 40 40 rotationRatio.x = rand() / (float) RAND_MAX; … … 59 59 { 60 60 char name[25]; 61 sprintf(name, "Entity%d", m Count++);61 sprintf(name, "Entity%d", mObjectCount++); 62 62 63 63 Entity *ent = mSceneMgr->createEntity(name, objName); … … 98 98 int SceneContentGenerator::GetObjectCount() 99 99 { 100 return m Count;100 return mObjectCount; 101 101 } 102 102 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCulling/SceneContentGenerator.h
r86 r106 46 46 47 47 SceneManager *mSceneMgr; 48 int m Count; // The number of objects on the screen48 int mObjectCount; // The number of objects on the screen 49 49 }; 50 50 -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp
r104 r106 69 69 { 70 70 Vector3 queryResult; 71 71 Vector3 pos(position.x, 5000, position.z); 72 72 if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) 73 73 { -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h
r104 r106 22 22 }; 23 23 24 /** Class which fills a terrain with content in a random fashion 24 /** 25 Class which randomly fills a terrain with objects. 25 26 */ 26 27 class TerrainContentGenerator: public SceneContentGenerator … … 30 31 ~TerrainContentGenerator(); 31 32 33 /** 34 Generates objects and places it on the terrain 35 */ 32 36 SceneNode *GenerateSceneObject(const Vector3 &position, 33 37 const Vector3 &rotation, const String &objName); 34 38 39 /** maximum height where objects can be put into the terrain */ 35 40 void SetMaxHeight(Real maxHeight); 36 41 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r105 r106 192 192 mCamNode(camNode), 193 193 mCullCamera(false), 194 m Direction(Vector3::ZERO),195 m Distance(0)194 mState(WALKTHROUGH), 195 mCurrentFrame(1) 196 196 { 197 197 // Reduce move speed … … 241 241 mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 242 242 243 // Create the walking list244 /*Vector3 queryResult;245 mWalkList.push_back(Vector3(1550.0f, 5000.0f, 250.0f));246 mWalkList.push_back(Vector3(100.0f, 5000.0f, 750.0f));247 248 mTerrainContentGenerator->GenerateSceneObject(mCamera->getPosition(), Vector3::ZERO, "knot.mesh");249 mTerrainContentGenerator->GenerateSceneObject(Vector3(1550.0f, 5000.0f, 250.0f), Vector3::ZERO, "knot.mesh");250 mTerrainContentGenerator->GenerateSceneObject(Vector3(100.0f, 5000.0f, 750.0f), Vector3::ZERO, "knot.mesh");251 */252 243 pOver->show(); 253 244 } … … 337 328 switch (mState) 338 329 { 339 case STATE_RECORD: 330 case REPLAY: 331 SetCurrentCameraPath(mCamNode); 332 mCamNode->setPosition(mCameraPath[mCurrentFrame].position); 333 mCamNode->setOrientation(mCameraPath[mCurrentFrame].orientation); 334 (mCurrentFrame++) % mCameraPath.size(); 335 break; 336 case WALKTHROUGH: 340 337 Clamp2Terrain(); 341 case STATE_REPLAY: 342 343 mCamera->setPosition(mPosition[mCurrentFrame]); 344 mCamera->setOrientation( 345 case STATE_: 346 347 348 // save for walkthrough 349 if(mState == STATE_RECORD) 350 { 351 mPositions.push_back(mCamera->GetPosition()); 352 mOrientations.push_back(mCamera->GetOrientation()); 353 } 354 355 338 339 case RECORD: 340 AddCameraPath(mCamNode); 341 break; 342 default: 343 break; 344 }; 345 356 346 if (mShowVisualization) 357 347 { … … 413 403 KEY_PRESSED(KC_3, 0, zoomVizCamera(50)); 414 404 KEY_PRESSED(KC_4, 0, zoomVizCamera(-50)); 415 405 KEY_PRESSED(KC_F1, 0, setState(RECORD)); 406 KEY_PRESSED(KC_F2, 0, setState(REPLAY)); 407 KEY_PRESSED(KC_F3, 0, setState(WALKTHROUGH)); 416 408 updateStats(); 417 409 … … 593 585 e->consume(); 594 586 } 587 //----------------------------------------------------------------------- 588 void MouseQueryListener::AddCameraPath(SceneNode *camNode) 589 { 590 frame_info info; 591 info.orientation = mCamNode->getOrientation(); 592 info.position = mCamNode->getPosition(); 593 mCameraPath.push_back(info); 594 } 595 //----------------------------------------------------------------------- 596 void MouseQueryListener::SetCurrentCameraPath(SceneNode *camNode) 597 { 598 mCamNode->setPosition(mCameraPath[mCurrentFrame].position); 599 mCamNode->setOrientation(mCameraPath[mCurrentFrame].orientation); 600 (mCurrentFrame++) % mCameraPath.size(); 601 } 602 595 603 /**************************************************************/ 596 604 /* VisualizationRenderTargetListener implementation */ 597 605 /**************************************************************/ 606 598 607 VisualizationRenderTargetListener::VisualizationRenderTargetListener(SceneManager *sceneMgr) 599 608 :RenderTargetListener(), mSceneMgr(sceneMgr) -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r105 r106 8 8 #include "VisibilityEnvironment.h" 9 9 #include <OgreRenderTargetListener.h> 10 #include <vector .h>10 #include <vector> 11 11 12 12 Real timeDelay = 0; … … 26 26 "Coherent Hierarchical Culling" 27 27 }; 28 typedef struct frame_info 28 29 /** The information about camera position and orienation per frame */ 30 typedef struct 29 31 { 32 Vector3 position; 33 Quaternion orientation; 34 } frame_info; 30 35 31 } 32 Position 33 typedef std::pair<Vector3 frame_pair 36 34 37 class VisualizationRenderTargetListener: public RenderTargetListener 35 38 { … … 47 50 { 48 51 public: 49 52 50 53 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 51 54 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera, … … 92 95 void zoomVizCamera(int zoom); 93 96 void moveCamera(); 97 void AddCameraPath(SceneNode *camNode); 98 void SetCurrentCameraPath(SceneNode *camNode); 99 100 enum {WALKTHROUGH, REPLAY} State; 94 101 95 102 96 103 protected: 97 104 void Clamp2Terrain(); 98 99 bool NextLocation(); 100 105 101 106 bool mLMouseDown, mRMouseDown; // True if the mouse buttons are down 102 107 SceneManager *mSceneMgr; // A pointer to the scene manager … … 107 112 int mCurrentAlgorithm; 108 113 int mVisibilityThreshold; 109 114 110 115 OverlayElement *mAlgorithmInfo; 111 116 OverlayElement *mThresholdInfo; … … 120 125 121 126 SceneNode *mCurrentObject; // The newly created object 122 int m Count;// The number of robots on the screen127 int mObjectCount; // The number of robots on the screen 123 128 124 129 RayQueryExecutor *mRayQueryExecutor; … … 136 141 Camera *mVizCamera; 137 142 SceneNode *mCamNode; 138 Real mWalkSpeed; 139 Real mDistance; 140 Vector3 mDestination; 141 Vector3 mDirection; 142 143 143 144 //std::deque<Vector3> mWalkList; // The list of points we are walking to 144 vector< 145 std::vector<Ogre::Vector3> mPositions; 146 std::vector<Ogre::Quaternion> mOrientations; 147 145 std::vector<frame_info> mCameraPath; 146 147 int mCurrentFrame; 148 // the current application state 149 int mState; 148 150 }; 149 151
Note: See TracChangeset
for help on using the changeset viewer.