resonance 1.0.1
Loading...
Searching...
No Matches
vector3.h
Go to the documentation of this file.
1#pragma once
2
12struct Vector3 {
13 float x;
14 float y;
15 float z;
16 float w = 1.0f; // +0x0c Padding for quadword access, set to 1.0 on construction.
17};
18
19namespace Rnd {
20
33void Add(const float *pA, const float *pB, float *pOut);
34
47void Subtract(const float *pA, const float *pB, float *pOut);
48
49} // namespace Rnd
50
66void Vec3Scale(const float *pSrc, float flScale, float *pOut);
67
78void NegateVec3(const float *pSrc, float *pOut);
79
93void Vec3Normalize(const float *pSrc, float *pOut);
94
96constexpr int kVec3PaddingFloat = 3;
97
109inline void CrossVec3(const float *pA, const float *pB, float *pOut) {
110 const float flX = (pA[1] * pB[2]) - (pA[2] * pB[1]);
111 const float flY = (pA[2] * pB[0]) - (pA[0] * pB[2]);
112 const float flZ = (pA[0] * pB[1]) - (pA[1] * pB[0]);
114 pOut[0] = flX;
115 pOut[1] = flY;
116 pOut[2] = flZ;
117}
The rendering engine.
Definition animhelper.h:3
void Subtract(const float *pA, const float *pB, float *pOut)
Subtract one three-component vector from another.
void Add(const Vector2 &a, const Vector2 &b, Vector2 &out)
Add two two-component vectors.
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12
float w
Definition vector3.h:16
float x
Definition vector3.h:13
float y
Definition vector3.h:14
float z
Definition vector3.h:15
void CrossVec3(const float *pA, const float *pB, float *pOut)
Take the cross product of two three-component vectors.
Definition vector3.h:109
void Vec3Scale(const float *pSrc, float flScale, float *pOut)
Multiply a three-component vector by a scalar.
void NegateVec3(const float *pSrc, float *pOut)
Negate a three-component vector.
void Vec3Normalize(const float *pSrc, float *pOut)
Scale a three-component vector to unit length.
constexpr int kVec3PaddingFloat
Index of the padding float that follows the three components of a quadword vector.
Definition vector3.h:96