wavelength 1.0.0
Loading...
Searching...
No Matches
vector3.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/prnstream.h"
4
14struct Vector3 {
15 float x;
16 float y;
17 float z;
18 float w = 1.0f; // +0x0c Padding for quadword access, set to 1.0 on construction.
19};
20
31PrnStream &operator<<(PrnStream &stream, const Vector3 &vector);
32
33namespace Rnd {
34
45void Add(const float *pA, const float *pB, float *pOut);
46
57void Subtract(const float *pA, const float *pB, float *pOut);
58
59} // namespace Rnd
60
72void Vec3Normalize(const float *pSrc, float *pOut);
73
75constexpr int kVec3PaddingFloat = 3;
76
88inline void CrossVec3(const float *pA, const float *pB, float *pOut) {
89 const float flX = (pA[1] * pB[2]) - (pA[2] * pB[1]);
90 const float flY = (pA[2] * pB[0]) - (pA[0] * pB[2]);
91 const float flZ = (pA[0] * pB[1]) - (pA[1] * pB[0]);
93 pOut[0] = flX;
94 pOut[1] = flY;
95 pOut[2] = flZ;
96}
Text output stream.
Definition prnstream.h:16
Definition gfxtunnel.h:41
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:14
float w
Definition vector3.h:18
float x
Definition vector3.h:15
float y
Definition vector3.h:16
float z
Definition vector3.h:17
void CrossVec3(const float *pA, const float *pB, float *pOut)
Take the cross product of two three-component vectors.
Definition vector3.h:88
void Vec3Normalize(const float *pSrc, float *pOut)
Scale a three-component vector to unit length.
PrnStream & operator<<(PrnStream &stream, const Vector3 &vector)
Write a vector as (x: y: z:), adding w: before the parenthesis when the stream's mDumpLevel is kPrnM...
constexpr int kVec3PaddingFloat
Index of the padding float that follows the three components of a quadword vector.
Definition vector3.h:75