mirror of
https://github.com/zeldaret/ss
synced 2026-08-04 01:03:19 -04:00
Formatting + dtk Update
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include <egg/math/eggMatrix.h>
|
||||
#include <rvl/GX.h>
|
||||
#include <rvl/MTX.h>
|
||||
@@ -21,8 +19,7 @@ void Matrix34f::makeIdentity() {
|
||||
m[0][0] = 1.0f;
|
||||
} // namespace EGG
|
||||
|
||||
Matrix34f::Matrix34f(f32 xx, f32 xy, f32 xz, f32 xw, f32 yx, f32 yy, f32 yz, f32 yw, f32 zx, f32 zy,
|
||||
f32 zz, f32 zw) {
|
||||
Matrix34f::Matrix34f(f32 xx, f32 xy, f32 xz, f32 xw, f32 yx, f32 yy, f32 yz, f32 yw, f32 zx, f32 zy, f32 zz, f32 zw) {
|
||||
m[0][0] = xx;
|
||||
m[0][1] = xy;
|
||||
m[0][2] = xz;
|
||||
@@ -242,17 +239,17 @@ void Matrix34f::makeT(const Vector3f &t) {
|
||||
}
|
||||
|
||||
void Matrix34f::fromQuat(const Quatf &q) {
|
||||
m[0][0] = (1.0f - 2.0f * q.y * q.y - 2.0f * q.z * q.z);
|
||||
m[0][0] = 1.0f - (2.0f * q.y * q.y) - (2.0f * q.z * q.z);
|
||||
m[0][1] = (2.0f * q.x * q.y) - (2.0f * q.w * q.z);
|
||||
m[0][2] = (2.0f * q.x * q.z) + (2.0f * q.w * q.y);
|
||||
|
||||
m[1][0] = (2.0f * q.x * q.y) + (2.0f * q.w * q.z);
|
||||
m[1][1] = (1.0f - 2.0f * q.x * q.x) - (2.0f * q.z * q.z);
|
||||
m[1][1] = 1.0f - (2.0f * q.x * q.x) - (2.0f * q.z * q.z);
|
||||
m[1][2] = (2.0f * q.y * q.z) - (2.0f * q.w * q.x);
|
||||
|
||||
m[2][0] = (2.0f * q.x * q.z) - (2.0f * q.w * q.y);
|
||||
m[2][1] = (2.0f * q.y * q.z) + (2.0f * q.w * q.x);
|
||||
m[2][2] = (1.0f - 2.0f * q.x * q.x) - (2.0f * q.y * q.y);
|
||||
m[2][2] = 1.0f - (2.0f * q.x * q.x) - (2.0f * q.y * q.y);
|
||||
|
||||
m[2][3] = 0.0f;
|
||||
m[1][3] = 0.0f;
|
||||
@@ -335,7 +332,7 @@ void Matrix34f::toQuat(Quatf &q) const {
|
||||
q.multScalar(Math<f32>::inv(q.length()));
|
||||
}
|
||||
|
||||
void Matrix34f::slerpTo(const Matrix34f &m2, Matrix34f &out, f32 t) const {
|
||||
void Matrix34f::slerpTo(const Matrix34f &m2, Matrix34f &out, f32 t) {
|
||||
Quatf q1, q2, q3;
|
||||
m2.toQuat(q1);
|
||||
toQuat(q2);
|
||||
@@ -365,7 +362,6 @@ void Matrix34f::multiplyTo(const Matrix34f &m2, Matrix34f &to) const {
|
||||
|
||||
void Matrix34f::dump() {}
|
||||
|
||||
const Matrix34f Matrix34f::ident(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f);
|
||||
const Matrix34f Matrix34f::ident(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -212,23 +212,19 @@ void Quatf::limitSlerpTo(const Quatf &q2, f32 t, f32 t2, Quatf &out) const {
|
||||
|
||||
/* 8049bbb0 */
|
||||
void Quatf::makeVectorRotation(Vector3f &from, Vector3f &to) {
|
||||
// f32 dot = from.dot(to);
|
||||
|
||||
Vector3f cross = from.cross(to);
|
||||
f32 t0 = (from.dot(to) + 1) * 2.0f;
|
||||
|
||||
f32 t0 = (from.dot(to) + 1.0f) * 2.0f;
|
||||
|
||||
f32 v = t0;
|
||||
if (v <= 0.0f) {
|
||||
v = 0.0f;
|
||||
if (t0 < 0.0f) {
|
||||
t0 = 0.0f;
|
||||
}
|
||||
t0 = Math<f32>::sqrt(v);
|
||||
const f32 s = Math<f32>::sqrt(t0);
|
||||
|
||||
if (t0 <= Math<f32>::epsilon()) {
|
||||
if (s <= Math<f32>::epsilon()) {
|
||||
setUnit();
|
||||
} else {
|
||||
f32 inv = Math<f32>::inv(t0);
|
||||
set(t0 * 0.5f, cross.x * inv, cross.y * inv, cross.z * inv);
|
||||
const f32 inv = 1.0f / s;
|
||||
set(s * 0.5f, cross.x * inv, cross.y * inv, cross.z * inv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user