1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "client/math/Camera.h"
- Camera::Camera(const Ray& ray) : ray(ray) {
- }
- const Vector& Camera::getBack() const {
- return back;
- }
- const Vector& Camera::getRight() const {
- return right;
- }
- const Vector& Camera::getUp() const {
- return up;
- }
- const Vector& Camera::getFlatBack() const {
- return flatBack;
- }
- const Vector& Camera::getFlatRight() const {
- return flatRight;
- }
- const Vector& Camera::getFlatUp() const {
- return flatUp;
- }
- const Vector& Camera::getPosition() const {
- return position;
- }
- void Camera::update(float lag) {
- back = ray.getDirection(lag);
- right.setInverse(back).cross(0.0f, 1.0f, 0.0f).normalize();
- up.set(back).cross(right).normalize();
-
- flatBack.set(back).setY(0.0f).normalize();
- flatRight.setInverse(back).cross(0.0f, 1.0f, 0.0f).normalize();
- flatUp.set(0.0f, 1.0f, 0.0f);
-
- position = ray.getPosition(lag);
- }
|