summaryrefslogtreecommitdiffstats
path: root/src/math/Vector.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-02-03 20:47:16 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2021-02-03 20:47:16 +0100
commitf6c8225dac38d605041c3e791a9df091ec95d834 (patch)
treeae63ae1dcad2c55177322eaced71daa597884df7 /src/math/Vector.cpp
parentMerge branch 'lcs-dev' into lcs (diff)
parentMerge pull request #997 from Fire-Head/lcs (diff)
downloadre3-f6c8225dac38d605041c3e791a9df091ec95d834.tar
re3-f6c8225dac38d605041c3e791a9df091ec95d834.tar.gz
re3-f6c8225dac38d605041c3e791a9df091ec95d834.tar.bz2
re3-f6c8225dac38d605041c3e791a9df091ec95d834.tar.lz
re3-f6c8225dac38d605041c3e791a9df091ec95d834.tar.xz
re3-f6c8225dac38d605041c3e791a9df091ec95d834.tar.zst
re3-f6c8225dac38d605041c3e791a9df091ec95d834.zip
Diffstat (limited to 'src/math/Vector.cpp')
-rw-r--r--src/math/Vector.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/math/Vector.cpp b/src/math/Vector.cpp
index ee76e555..e29d4335 100644
--- a/src/math/Vector.cpp
+++ b/src/math/Vector.cpp
@@ -44,3 +44,18 @@ operator*(const CMatrix &mat, const CVector &vec)
mat.ry * vec.x + mat.fy * vec.y + mat.uy * vec.z + mat.py,
mat.rz * vec.x + mat.fz * vec.y + mat.uz * vec.z + mat.pz);
}
+
+void
+RwV3dTransformPoints(CVector * pointsOut, const CVector * pointsIn, RwInt32 numPoints, const RwMatrix * matrix)
+{
+ while(numPoints--){
+ float x = pointsIn->x*matrix->right.x + pointsIn->y*matrix->up.x + pointsIn->z*matrix->at.x + matrix->pos.x;
+ float y = pointsIn->x*matrix->right.y + pointsIn->y*matrix->up.y + pointsIn->z*matrix->at.y + matrix->pos.y;
+ float z = pointsIn->x*matrix->right.z + pointsIn->y*matrix->up.z + pointsIn->z*matrix->at.z + matrix->pos.z;
+ pointsOut->x = x;
+ pointsOut->y = y;
+ pointsOut->z = z;
+ pointsOut++;
+ pointsIn++;
+ }
+}