- Timestamp:
- Dec 19, 2006, 8:41:14 PM (18 years ago)
- Location:
- branches/camera/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/camera/src/world_entities/camera.cc
r10103 r10105 19 19 #include "glincl.h" 20 20 #include "vector.h" 21 #include <iostream.h>22 21 #include "state.h" 23 22 #include "shell_command.h" … … 145 144 this->upVector = this->getAbsDirV(); 146 145 147 148 149 150 146 // iteration for fovy 151 147 float tmpFovy = (this->toFovy - this->fovy); 152 148 if (tmpFovy > 0.01) 153 149 this->fovy += tmpFovy * fabsf(dt); 150 151 152 153 154 //iterate(float dt, translate, target) 155 154 156 } 155 157 … … 225 227 } 226 228 227 /* 228 Vector* Camera::translate(Vector* newPos, float speed) 229 { 230 glTranslatef(Vector); 231 232 } 233 234 235 float Camera::iterate(float dt, Vector target) 236 { 237 Vector tmpVec = (this->getAbsCorr() - target); 238 if (tmpVec > 0.01) 239 Vector ret = this->getAbsCorr; 240 ret += tmpVec * fabsf(dt); 241 return ret; 242 } 243 */ 244 void Camera::Rotate() 245 { 246 this->fovy=this->fovy+1; 247 } 229 248 230 249 231 … … 309 291 310 292 311 Vector translateTo(0,0,0); 312 Vector rotateBy(0,0,0); 313 float speed=1; 293 294 314 295 315 296 CameraTarget::CameraTarget() … … 317 298 this->registerObject(this, CameraTarget::_objectList); 318 299 // this->setParentMode(PNODE_MOVEMENT); 300 this->speed=1; 301 translateTo.x=0; 302 translateTo.y=0; 303 translateTo.z=0; 304 rotateBy.x=0; 305 rotateBy.y=0; 306 rotateBy.z=0; 319 307 320 308 … … 347 335 348 336 349 Vector* CameraTarget::translate(Vector* newPos, float speed) 350 { 351 //glTranslatef(Vector); 352 353 } 354 337 void CameraTarget::translate(Vector* newPos, float speed, float dt) 338 { 339 if (translateTo.x >= this->getAbsCoorX()) 340 { 341 iterate(dt, &(State::getCameraNode()->getAbsCoor()), newPos ); 342 glTranslatef(translateTo.x, translateTo.y, translateTo.z); 343 } 344 } 345 346 Vector * CameraTarget::rotate(Vector* newPos, float speed) 347 { 348 349 } 350 351 void CameraTarget::jump(Vector* newPos) 352 { 353 354 } 355 355 356 356 void CameraTarget::changeSpeed(float speed) -
branches/camera/src/world_entities/camera.h
r10103 r10105 93 93 CameraTarget(); 94 94 virtual ~CameraTarget() {} 95 float speed; 95 96 96 97 public: 98 Vector translateTo; 99 Vector rotateBy; 97 100 void detach(); 98 101 void atach(PNode* object); 99 Vector iterate(float dt, Vector* target,Vector* cam);100 Vector* translate(Vector* newPos, float speed);102 Vector iterate(float dt, const Vector* target, const Vector* cam); 103 void translate(Vector* newPos, float speed, float dt); 101 104 void changeSpeed(float speed); 105 Vector* rotate(Vector* newPos, float speed); 106 void jump(Vector* newPos); 102 107 }; 103 108
Note: See TracChangeset
for help on using the changeset viewer.