summaryrefslogtreecommitdiffstats
path: root/src/math/VuVector.h
blob: f90818e0d1f457325fe740baa126dcfa4d8d00b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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);