diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-08-08 12:08:21 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-08-08 12:08:21 +0200 |
commit | 9bc105c92346494bc4c36bcebd0a4a86bf9d6a86 (patch) | |
tree | b0582e41c8bc4d5fa0979d8a453b0a2d128f012c /src/math/VuVector.h | |
parent | submodules? (diff) | |
parent | Merge pull request #680 from ShFil119/actions (diff) | |
download | re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.tar re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.tar.gz re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.tar.bz2 re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.tar.lz re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.tar.xz re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.tar.zst re3-9bc105c92346494bc4c36bcebd0a4a86bf9d6a86.zip |
Diffstat (limited to 'src/math/VuVector.h')
-rw-r--r-- | src/math/VuVector.h | 41 |
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); |