CCamera.h
上传用户:jinmajixie
上传日期:2022-07-12
资源大小:435k
文件大小:1k
源码类别:

OpenGL

开发平台:

Visual C++

  1. #ifndef CCAMERA_H
  2. #define CCAMERA_H
  3. #include "main.h"
  4. /*******************************************************************************
  5. * CAMERA
  6. *******************************************************************************/
  7. class CCamera
  8. {
  9. public:
  10. CCamera();
  11. CVector *position_p; // attached position
  12. CVector *rotation_p; // attached rotation
  13. // CVector *lookat_p; // attached 'look at' point
  14. CVector look_vector; // looking vector calculated from position and rotation
  15. CVector lookat_point; // 'look at' point calculated from position and rotation
  16. bool AttachCameraPosition(CVector *p);
  17. bool AttachCameraRotation(CVector *r);
  18. CVector GetPosition();
  19. void SetglLookAt();
  20. // void SetglLookAtX(int q);
  21. float GetX() { return position_p->x; }
  22. float GetY() { return position_p->y; }
  23. float GetZ() { return position_p->z; }
  24. void AddX(float f) { position_p->x += f; lookat_point.x += f; }
  25. void AddY(float f) { position_p->y += f; lookat_point.y += f; }
  26. void AddZ(float f) { position_p->z += f; lookat_point.z += f; }
  27. };
  28. #endif