Changeset 3636 in orxonox.OLD for orxonox/trunk/src/camera.cc
- Timestamp:
- Mar 23, 2005, 12:46:37 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/camera.cc
r3635 r3636 34 34 { 35 35 this->target = new CameraTarget(); 36 37 this->setFovy(60); 38 this->setAspectRatio(1.2f); 39 this->setClipRegion(.1, 2000); 36 40 } 37 41 … … 58 62 } 59 63 64 65 /** 66 \brief sets a new AspectRatio 67 \param aspectRatio the new aspect ratio to set (width / height) 68 */ 69 void Camera::setAspectRatio(float aspectRatio) 70 { 71 this->aspectRatio = aspectRatio; 72 } 73 74 /** 75 \brief sets the Field of View to fofy 76 \param fovy new field of view factor (in degrees) 77 */ 78 void Camera::setFovy(float fovy) 79 { 80 this->fovy = fovy; 81 } 82 83 /** 84 \brief Sets a new clipping region 85 \param nearClip The near clip plane 86 \param farClip The far clip plane 87 */ 88 void Camera::setClipRegion(float nearClip, float farClip) 89 { 90 this->nearClip = nearClip; 91 this->farClip = farClip; 92 } 93 94 95 96 60 97 /** 61 98 \brief initialize rendering perspective according to this camera … … 66 103 void Camera::apply () 67 104 { 105 // switching to Projection Matrix 68 106 glMatrixMode (GL_PROJECTION); 69 107 glLoadIdentity (); 70 108 71 gluPerspective(60, 1.2f, 0.1, 2000); 72 float matrix[4][4]; 109 // setting up the perspective 110 gluPerspective(this->fovy, 111 this->aspectRatio, 112 this->nearClip, 113 this->farClip); 73 114 115 // speed-up feature 74 116 Vector cameraPosition = this->getAbsCoor(); 75 117 Vector targetPosition = this->target->getAbsCoor(); 76 118 119 // Setting the Camera Eye, lookAt and up Vectors 77 120 gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z, 78 121 targetPosition.x, targetPosition.y, targetPosition.z, 79 122 0.0, 1.0, 0.0); 123 124 // switching back to Modeling Matrix 80 125 glMatrixMode (GL_MODELVIEW); 81 glLoadIdentity ();82 126 } 83 127
Note: See TracChangeset
for help on using the changeset viewer.