aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/VuVector.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-08-03 12:58:37 +0200
committeraap <aap@papnet.eu>2020-08-03 17:32:06 +0200
commitabb640c6b6b1c4c1b699d18509c8a344e2be2dd5 (patch)
tree58cecb7517dfd70a4ce5e2f646ff23aa4fa4084d /src/math/VuVector.h
parenta786dd45a4ebc6b91936b5e46d0ef0a9befc05af (diff)
VU0 collision
Diffstat (limited to 'src/math/VuVector.h')
-rw-r--r--src/math/VuVector.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/math/VuVector.h b/src/math/VuVector.h
new file mode 100644
index 00000000..f90818e0
--- /dev/null
+++ b/src/math/VuVector.h
@@ -0,0 +1,41 @@
+#pragma once
+
+class TYPEALIGN(16) CVuVector : public CVector
+{
+public:
+ float w;
+ CVuVector(void) {}
+ CVuVector(float x, float y, float z) : CVector(x, y, z) {}
+ CVuVector(float x, float y, float z, float w) : CVector(x, y, z), w(w) {}
+ CVuVector(const CVector &v) : CVector(v.x, v.y, v.z) {}
+#ifdef RWCORE_H
+ CVuVector(const RwV3d &v) : CVector(v.x, v.y, v.z) {}
+
+ operator RwV3d (void) const {
+ RwV3d vecRw = { this->x, this->y, this->z };
+ return vecRw;
+ }
+
+ operator RwV3d *(void) {
+ return (RwV3d*)this;
+ }
+#endif
+/*
+ void Normalise(void) {
+ float sq = MagnitudeSqr();
+ // TODO: VU0 code
+ if(sq > 0.0f){
+ float invsqrt = RecipSqrt(sq);
+ x *= invsqrt;
+ y *= invsqrt;
+ z *= invsqrt;
+ }else
+ x = 1.0f;
+ }
+*/
+};
+
+void TransformPoint(CVuVector &out, const CMatrix &mat, const CVuVector &in);
+void TransformPoint(CVuVector &out, const CMatrix &mat, const RwV3d &in);
+void TransformPoints(CVuVector *out, int n, const CMatrix &mat, const RwV3d *in, int stride);
+void TransformPoints(CVuVector *out, int n, const CMatrix &mat, const CVuVector *in);