-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.cpp
More file actions
30 lines (21 loc) · 750 Bytes
/
Copy pathCamera.cpp
File metadata and controls
30 lines (21 loc) · 750 Bytes
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
#include "Camera.h"
#include <cstdio>
Camera::Camera() {}
Camera::~Camera() {}
const M3DMatrix44f& Camera::getCameraMatrix() {
cameraStack.GetMatrix(mCamera);
return mCamera;
}
const M3DMatrix44f& Camera::getCameraRotOnlyMatrix() {
cameraRotOnlyStack.GetMatrix(mCameraRotOnly);
return mCameraRotOnly;
}
void Camera::update(GLfloat camXRot, GLfloat camYRot, GLfloat camZPos, GLfloat camYPos, GLfloat camXPos) {
cameraStack.LoadIdentity();
cameraStack.Rotate(camXRot, 1.0f, 0.0f, 0.0f);
cameraStack.Rotate(camYRot, 0.0f, 1.0f, 0.0f);
cameraRotOnlyStack.LoadIdentity();
cameraRotOnlyStack.Rotate(camXRot, 1.0f, 0.0f, 0.0f);
cameraRotOnlyStack.Rotate(camYRot, 0.0f, 1.0f, 0.0f);
cameraStack.Translate(-camXPos, -camYPos, -camZPos);
}