Changeset 3639 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Mar 23, 2005, 1:37:54 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/camera.cc
r3638 r3639 33 33 Camera::Camera(void) 34 34 { 35 this->setClassName("Camera"); 35 36 this->target = new CameraTarget(); 37 38 this->toRelCoor = new Vector; 36 39 37 40 this->setFovy(60); 38 41 this->setAspectRatio(1.2f); 39 42 this->setClipRegion(.1, 2000); 43 this->setViewMode(VIEW_NORMAL); 44 40 45 } 41 46 … … 45 50 Camera::~Camera(void) 46 51 { 47 48 52 } 49 53 … … 95 99 } 96 100 101 void Camera::setViewMode(ViewMode mode) 102 { 103 switch (mode) 104 { 105 default: 106 case VIEW_NORMAL: 107 this->toFovy = 60.0; 108 *this->toRelCoor = Vector (-10, 5, 0); 109 break; 110 case VIEW_BEHIND: 111 this->toFovy = 90.0; 112 *this->toRelCoor = Vector (-6, 2, 0); 113 break; 114 case VIEW_FRONT: 115 this->toFovy = 95.0; 116 *this->toRelCoor = Vector (10, 5, 0); 117 break; 118 case VIEW_LEFT: 119 this->toFovy = 90; 120 *this->toRelCoor = Vector (0, 5, -10); 121 break; 122 case VIEW_RIGHT: 123 this->toFovy = 90; 124 *this->toRelCoor = Vector (0, 5, 10); 125 break; 126 } 127 } 128 129 130 /** 131 \brief Updates the position of the camera. 132 \param dt The time that elapsed. 133 */ 134 void Camera::tick(float dt) 135 { 136 dt /= 1000; 137 this->fovy += (this->toFovy - this->fovy) * dt; 138 } 139 140 97 141 /** 98 142 \brief initialize rendering perspective according to this camera … … 137 181 CameraTarget::CameraTarget() 138 182 { 183 this->setClassName("CameraTarget"); 139 184 this->setMode(PNODE_MOVEMENT); 140 185 } -
orxonox/trunk/src/camera.h
r3636 r3639 12 12 class CameraTarget; 13 13 14 enum ViewMode{VIEW_NORMAL, VIEW_BEHIND, VIEW_FRONT, VIEW_LEFT, VIEW_RIGHT}; 14 15 15 16 //! Camera … … 26 27 float nearClip; //!< The near clipping plane. 27 28 float farClip; //!< The far clipping plane. 29 30 Vector* toRelCoor; 31 float toFovy; 28 32 29 33 public: … … 38 42 void setClipRegion(float nearClip, float farClip); 39 43 44 void setViewMode(ViewMode mode); 45 void tick(float dt); 40 46 void apply (void); 41 47 }; -
orxonox/trunk/src/story_entities/world.cc
r3637 r3639 372 372 this->localCamera->lookAt(LightManager::getInstance()->getLight(0)); 373 373 this->localCamera->setParent(this->localPlayer); 374 Vector* cameraOffset = new Vector (-10, 5, 0);375 this->localCamera->setRelCoor (cameraOffset);376 374 377 375 // Create SkySphere … … 754 752 /* update tick the rest */ 755 753 this->trackManager->tick(dt); 754 this->localCamera->tick(dt); 756 755 } 757 756 this->lastFrame = currentFrame;
Note: See TracChangeset
for help on using the changeset viewer.