wavelength 1.0.0
Loading...
Searching...
No Matches
vector3.h File Reference
#include "os/prnstream.h"
Include dependency graph for vector3.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Vector3
 Three-component vector, padded to a PlayStation 2 quadword. More...

Namespaces

namespace  Rnd

Functions

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 kPrnModeFull.
void Rnd::Add (const float *pA, const float *pB, float *pOut)
 Add two three-component vectors.
void Rnd::Subtract (const float *pA, const float *pB, float *pOut)
 Subtract one three-component vector from another.
void Vec3Normalize (const float *pSrc, float *pOut)
 Scale a three-component vector to unit length.
void CrossVec3 (const float *pA, const float *pB, float *pOut)
 Take the cross product of two three-component vectors.

Variables

constexpr int kVec3PaddingFloat = 3
 Index of the padding float that follows the three components of a quadword vector.

Function Documentation

◆ operator<<()

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 kPrnModeFull.

Parameters
streamThe stream to write to.
vectorThe vector.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x00292ed8
Ghidra address:
PAL: 0x0029c8a0

◆ Vec3Normalize()

void Vec3Normalize ( const float * pSrc,
float * pOut )

Scale a three-component vector to unit length.

The vector unit takes the reciprocal square root of the dot of the first three components with themselves, then scales those three by it. Both the load and the store move a whole quadword. The fourth word of the destination therefore receives the fourth word of the source unchanged. A zero-length input is not guarded against.

Parameters
pSrcThe vector to normalise.
pOutReceives the unit vector, and may alias pSrc.

◆ CrossVec3()

void CrossVec3 ( const float * pA,
const float * pB,
float * pOut )
inline

Take the cross product of two three-component vectors.

The image has no out-of-line copy. Every caller inlines the VU0 vopmula.xyz and vopmsub.xyz pair, which writes only the three components and therefore leaves the fourth word of pA in the result.

Parameters
pAThe first vector.
pBThe second vector.
pOutReceives pA cross pB, and may alias either input.

Variable Documentation

◆ kVec3PaddingFloat

int kVec3PaddingFloat = 3
constexpr

Index of the padding float that follows the three components of a quadword vector.