Changeset 3399 in orxonox.OLD for orxonox/branches/nico/src/camera.cc
- Timestamp:
- Feb 6, 2005, 11:27:25 PM (19 years ago)
- Location:
- orxonox/branches/nico
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/nico
- Property svn:externals set to
-
orxonox/branches/nico/src/camera.cc
r3238 r3399 42 42 this->t = 0.0; 43 43 44 this->actualPlace.r.x = 0.0; 45 this->actualPlace.r.y = 10.0; 46 this->actualPlace.r.z = -5.0; 44 45 this->setDrawable (false); 47 46 } 48 47 … … 67 66 //printf("time is: t=%f\n", t ); 68 67 updateDesiredPlace(); 69 jump(NULL);68 //jump(NULL); 70 69 } 71 70 … … 83 82 case ELLIPTICAL: 84 83 { 84 /* 85 85 //r = actual_place.r 86 86 Orxonox *orx = Orxonox::getInstance(); … … 95 95 { 96 96 Vector *start = new Vector(0.0, 1.0, 0.0); 97 //r = /*actual_place.r*/ *start - plFocus.r;98 97 r = *(new Vector(0.0, 5.0, 0.0)); 99 98 … … 120 119 //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z ); 121 120 rAbs = r.len(); 122 if(t < 30 .0) /* FIXME!!*/121 if(t < 30) 123 122 { 124 123 ka = rAbs / deltaTime*deltaTime; 125 124 } 126 /* this is the new length of the vector */ 127 //float len = ka * powf((deltaTime - t), 2); 128 129 /* calc the rotation */ 130 /* 131 Vector axis(0.0, 0.0, 1.0); 132 if(t < 30.0) 133 a0 = PI/4 - atanf(fabs(r.x) / fabs(r.y)); 134 printf("a0 = %f\n", a0); 135 float angle = a0/deltaTime * (deltaTime - t); 136 printf("angle is: %f\n", angle); 137 Quaternion q(angle, axis); 138 */ 139 //r = q.apply(r); 140 //r = r * (len/r.len()); 141 142 //res->quatSlerp(from, to, t/deltaTime, res); 125 143 126 res->quatSlerp(to, from, t/deltaTime, res); 144 127 145 128 Vector ursp(0.0, 0.0, 0.0); 146 desiredPlace.r = /*plFocus.r -*/ursp - res->apply(r);129 desiredPlace.r = ursp - res->apply(r); 147 130 148 131 printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z); 149 132 //plLastBPlace = *bound->get_placement(); 133 150 134 } 135 */ 151 136 } 152 137 break; 153 138 case SMOTH_FOLLOW: 154 139 { 140 /* 155 141 Placement *plBound = bound->getPlacement(); 156 142 Location lcBound; … … 160 146 Vector vDirection(0.0, 0.0, 1.0); 161 147 vDirection = plBound->w.apply(vDirection); 162 desiredPlace.r = (vDirection * ((lcBound.dist-10.0) /* / l*/)) + Vector(0,0,5.0);148 desiredPlace.r = (vDirection * ((lcBound.dist-10.0))) + Vector(0,0,5.0); 163 149 } 150 */ 164 151 break; 165 152 } … … 167 154 case STICKY: 168 155 { 156 /* 169 157 if(bound != null) 170 158 { … … 175 163 desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset; 176 164 } 165 */ 177 166 break; 178 167 } 179 168 /* the camera is handled like an entity and rolls on the track */ 180 169 case NORMAL: 181 Location lookat;182 170 if( bound != NULL && world != NULL ) 183 171 { 184 bound->getLookat (&lookat); 185 world->calcCameraPos (&lookat, &desiredPlace); 172 //FIXME: camera should be made via relative coordinates 173 Vector* cameraOffset = new Vector (-10, 5, 0); 174 this->setRelCoor (cameraOffset); 186 175 } 187 176 else 188 177 { 178 /* 189 179 desiredPlace.r = Vector (0,0,0); 190 180 desiredPlace.w = Quaternion (); 181 */ 191 182 } 192 183 break; … … 237 228 // rotation 238 229 float matrix[4][4]; 239 actualPlace.w.conjugate().matrix (matrix);230 //this->absDirection.conjugate().matrix (matrix); 240 231 /* orientation and */ 241 glMultMatrixf ((float*)matrix); 232 //glMultMatrixf ((float*)matrix); 233 242 234 /* translation */ 243 glTranslatef (-actualPlace.r.x, -actualPlace.r.y,- actualPlace.r.z);244 //Placement *plBound = bound->get_placement(); 235 //glTranslatef (this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z ); 236 245 237 246 238 // ===== second camera control calculation option 247 /*248 gluLookAt(actual_place.r.x, actual_place.r.y, actual_place.r.z,249 plBound->r.x, plBound->r.y, plBound->r.z,250 0.0, 0.0, 1.0);251 */239 240 gluLookAt(this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z, 241 this->parent->getAbsCoor ().x, this->parent->getAbsCoor ().y, this->parent->getAbsCoor ().z, 242 0.0, 1.0, 0.0); 243 252 244 253 245 glMatrixMode (GL_MODELVIEW); … … 255 247 } 256 248 257 /** 258 \brief set the camera position 259 \param plc: The Placement to set the camera to 260 261 This will set the actual and desired placement of the camera to plc 262 */ 263 void Camera::jump (Placement* plc = NULL) 264 { 265 if( plc == NULL) 266 { 267 actualPlace = desiredPlace; 268 //printf("Camera|jump: camer@ %f, %f, %f\n\n", actual_place.r.x, actual_place.r.y, actual_place.r.z); 269 } 270 else 271 { 272 desiredPlace = *plc; 273 actualPlace = *plc; 274 } 275 } 249 276 250 277 251 /**
Note: See TracChangeset
for help on using the changeset viewer.