|
@@ -1,27 +1,22 @@
|
|
|
#include "math/View.h"
|
|
|
|
|
|
-const Matrix& View::update(float lengthAngle, float widthAngle,
|
|
|
- const Vector3& pos) {
|
|
|
+void View::updateDirections(float lengthAngle, float widthAngle) {
|
|
|
back.setAngles(lengthAngle, widthAngle);
|
|
|
right = back.cross(Vector3(0.0f, 1.0f, 0.0f));
|
|
|
right.normalize();
|
|
|
up = right.cross(back);
|
|
|
up.normalize();
|
|
|
back = -back;
|
|
|
-
|
|
|
- view.set(0, Vector4(right[0], right[1], right[2], right.dot(-pos)));
|
|
|
- view.set(1, Vector4(up[0], up[1], up[2], up.dot(-pos)));
|
|
|
- view.set(2, Vector4(back[0], back[1], back[2], back.dot(-pos)));
|
|
|
- view.set(3, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
|
|
|
- return view;
|
|
|
}
|
|
|
|
|
|
-const Matrix& View::update(const Quaternion& q, const Vector3& pos) {
|
|
|
+void View::updateDirections(const Quaternion& q) {
|
|
|
up = q * Vector3(0.0f, 1.0f, 0.0f);
|
|
|
back = q * Vector3(-1.0f, 0.0f, 0.0f);
|
|
|
right = up.cross(back);
|
|
|
right.normalize();
|
|
|
+}
|
|
|
|
|
|
+const Matrix& View::updateMatrix(const Vector3& pos) {
|
|
|
view.set(0, Vector4(right[0], right[1], right[2], right.dot(-pos)));
|
|
|
view.set(1, Vector4(up[0], up[1], up[2], up.dot(-pos)));
|
|
|
view.set(2, Vector4(back[0], back[1], back[2], back.dot(-pos)));
|