mirror of
https://github.com/thunderbrewhq/typhoon.git
synced 2026-05-04 22:33:51 +00:00
feat: sync with Whoa implementation
This commit is contained in:
parent
254ba545f5
commit
6a31dc3ea4
19 changed files with 988 additions and 774 deletions
|
|
@ -8,6 +8,17 @@ class C2iVector {
|
|||
// Member variables
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
|
||||
// Member functions
|
||||
C2iVector()
|
||||
: C2iVector(0) {};
|
||||
C2iVector(int32_t a)
|
||||
: C2iVector(a, a) {};
|
||||
C2iVector(const C2iVector& v)
|
||||
: C2iVector(v.x, v.y) {};
|
||||
C2iVector(int32_t x, int32_t y)
|
||||
: x(x)
|
||||
, y(y) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ C3Vector& C3Vector::operator/=(const C3Vector& a) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
C3Vector C3Vector::operator-() {
|
||||
C3Vector C3Vector::operator-() const {
|
||||
return { -this->x, -this->y, -this->z };
|
||||
}
|
||||
|
||||
|
|
@ -234,10 +234,18 @@ C3Vector operator*(float l, const C3Vector& r) {
|
|||
return { l * r.x, l * r.y, l * r.z };
|
||||
}
|
||||
|
||||
C3Vector operator*(const C3Vector& l, const C33Matrix& r) {
|
||||
float x = l.x * r.a0 + l.y * r.b0 + l.z * r.c0;
|
||||
float y = l.x * r.a1 + l.y * r.b1 + l.z * r.c1;
|
||||
float z = l.x * r.a2 + l.y * r.b2 + l.z * r.c2;
|
||||
|
||||
return { x, y, z };
|
||||
}
|
||||
|
||||
C3Vector operator*(const C3Vector& l, const C44Matrix& r) {
|
||||
float x = r.c0 * l.z + r.b0 * l.y + r.a0 * l.x + r.d0;
|
||||
float y = r.c1 * l.z + r.b1 * l.y + r.a1 * l.x + r.d1;
|
||||
float z = r.c2 * l.z + r.b2 * l.y + r.a2 * l.x + r.d2;
|
||||
float x = l.x * r.a0 + l.y * r.b0 + l.z * r.c0 + r.d0;
|
||||
float y = l.x * r.a1 + l.y * r.b1 + l.z * r.c1 + r.d1;
|
||||
float z = l.x * r.a2 + l.y * r.b2 + l.z * r.c2 + r.d2;
|
||||
|
||||
return { x, y, z };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "tempest/vector/C2Vector.hpp"
|
||||
#include "tempest/vector/CImVector.hpp"
|
||||
|
||||
class C33Matrix;
|
||||
class C44Matrix;
|
||||
|
||||
class C3Vector {
|
||||
|
|
@ -63,7 +64,7 @@ class C3Vector {
|
|||
C3Vector& operator/=(float a);
|
||||
C3Vector& operator/=(const C3Vector& a);
|
||||
|
||||
C3Vector operator-();
|
||||
C3Vector operator-() const;
|
||||
|
||||
float& operator[](uint32_t sub);
|
||||
const float& operator[](uint32_t sub) const;
|
||||
|
|
@ -85,6 +86,7 @@ C3Vector operator-(const C3Vector& l, const C3Vector& r);
|
|||
|
||||
C3Vector operator*(const C3Vector& l, float r);
|
||||
C3Vector operator*(float l, const C3Vector& r);
|
||||
C3Vector operator*(const C3Vector& l, const C33Matrix& r);
|
||||
C3Vector operator*(const C3Vector& l, const C44Matrix& r);
|
||||
|
||||
bool operator==(const C3Vector& l, const C3Vector& r);
|
||||
|
|
|
|||
26
tempest/vector/C3iVector.hpp
Normal file
26
tempest/vector/C3iVector.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef TEMPEST_VECTOR_C_3IVECTOR_HPP
|
||||
#define TEMPEST_VECTOR_C_3IVECTOR_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class C3iVector {
|
||||
public:
|
||||
// Member variables
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
|
||||
// Member functions
|
||||
C3iVector()
|
||||
: C3iVector(0) {};
|
||||
C3iVector(int32_t a)
|
||||
: C3iVector(a, a, a) {};
|
||||
C3iVector(const C3iVector& v)
|
||||
: C3iVector(v.x, v.y, v.z) {};
|
||||
C3iVector(int32_t x, int32_t y, int32_t z)
|
||||
: x(x)
|
||||
, y(y)
|
||||
, z(z) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue