1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| class Camera
{
public:
Camera(float, float, float);
virtual ~Camera();
void onResize(int, int);
virtual void moveMouse(int, int) = 0;
void useMouseToMoveCamera(bool);
bool isUseMouseToMoveCamera() const;
void setMouseSensitivity(float);
void setDistance(float);
void setMaxRotationX(float);
const Matrix4<float> &getViewMatrix() const;
const Matrix4<float> &getProjectionMatrix() const;
const Frustum<float> *getFrustum() const;
const Point3<float> &getPosition() const;
const Point3<float> &getView() const;
const Vector3<float> &getUp() const;
void moveTo(const Point3<float> &);
void moveX(float);
void moveZ(float);
void rotate(float, float, float, float);
virtual void onKeyDown(unsigned int, int, int){};
virtual void onKeyUp(unsigned int, int, int){};
virtual void moveCamera(){};
void onMouseMove(int, int);
void update();
#ifdef _DEBUG
void drawFrustum(const Matrix4<float> &) const;
#endif
private:
Camera(Camera const &);
Camera& operator=(Camera const &);
Matrix4<float> mView, mProjection;
float angle, nearPlane, farPlane;
Frustum<float> *frustum;
Point3<float> position, view;
Vector3<float> up;
float currentRotationX, maxRotationX;
float distance; //distance between the camera and the rotation point (0 : first person camera | >0 : third person camera)
bool bUseMouse; //true if the cursor is used to move the camera
bool needCameraUpdate; //true if the camera should be updated
float mouseSensitivity;
int middleScreenX, middleScreenY, oldMouseX, oldMouseY;
#ifdef _DEBUG
unsigned int bufferIDs[1], vertexArrayObject;
enum //buffer IDs indexes
{
VAO_VERTEX_POSITION = 0,
};
enum //shader input
{
SHADER_VERTEX_POSITION = 0,
};
unsigned int cameraShader;
int mProjectionLoc, mViewLoc; //Si je supprime quelques attributs, je n'ai plus de problème !
#endif
}; |