NW4F G3d
Loading...
Searching...
No Matches
g3d_Vector4.h
Go to the documentation of this file.
1#ifndef NW_G3D_MATH_VECTOR4_H_
2#define NW_G3D_MATH_VECTOR4_H_
3
4#include <nw/g3d/g3d_config.h>
5
6namespace nw { namespace g3d { namespace math {
7
8struct Vec4_t
9{
10 enum { DIM = 4, DIM_PS = DIM / 2 };
11
12 union
13 {
14 struct
15 {
16 float x, y, z, w;
17 };
18 float a[DIM];
19#if defined( __ghs__ )
20 f32x2 ps[DIM_PS];
21#endif // defined( __ghs__ )
22 };
23};
24
25class Vec4 : public Vec4_t
26{
27public:
28 static Vec4 Make(float x, float y, float z, float w);
29 static Vec4* Cast(float* a);
30 static const Vec4* Cast(const float* a);
31
32 Vec4& Set(float x, float y, float z, float w);
33 Vec4& Set(const float* a);
34 Vec4& Set(const Vec4& v);
35 Vec4& Zero();
36 Vec4& Neg(const Vec4& v);
37 Vec4& Rcp(const Vec4& v);
38
39 Vec4& Add(const Vec4& lhs, const Vec4& rhs);
40 Vec4& Sub(const Vec4& lhs, const Vec4& rhs);
41 Vec4& Mul(const Vec4& lhs, const Vec4& rhs);
42 Vec4& Div(const Vec4& lhs, const Vec4& rhs);
43 Vec4& Mul(const Vec4& lhs, float rhs);
44 Vec4& Div(const Vec4& lhs, float rhs);
45
46 static float Length(const Vec4& v);
47 static float LengthSq(const Vec4& v);
48 static float Distance(const Vec4& lhs, const Vec4& rhs);
49 static float DistanceSq(const Vec4& lhs, const Vec4& rhs);
50 static float Dot(const Vec4& lhs, const Vec4& rhs);
51 float Normalize(const Vec4& v);
52};
53
54} } } // namespace nw::g3d::math
55
56#include "inl/g3d_Vector4-inl.h"
57
58#endif // NW_G3D_MATH_VECTOR4_H_
Definition g3d_Vector4.h:26
Vec4 & Div(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:142
Vec4 & Set(const Vec4 &v)
Definition g3d_Vector4-inl.h:45
Vec4 & Mul(const Vec4 &lhs, float rhs)
Definition g3d_Vector4-inl.h:151
static float DistanceSq(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:196
Vec4 & Sub(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:112
Vec4 & Add(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:97
Vec4 & Zero()
Definition g3d_Vector4-inl.h:55
static Vec4 * Cast(float *a)
Definition g3d_Vector4-inl.h:12
Vec4 & Neg(const Vec4 &v)
Definition g3d_Vector4-inl.h:65
Vec4 & Set(const float *a)
Definition g3d_Vector4-inl.h:34
Vec4 & Mul(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:127
static float Distance(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:188
Vec4 & Set(float x, float y, float z, float w)
Definition g3d_Vector4-inl.h:24
static float Dot(const Vec4 &lhs, const Vec4 &rhs)
Definition g3d_Vector4-inl.h:204
Vec4 & Rcp(const Vec4 &v)
Definition g3d_Vector4-inl.h:80
static Vec4 Make(float x, float y, float z, float w)
Definition g3d_Vector4-inl.h:6
static float LengthSq(const Vec4 &v)
Definition g3d_Vector4-inl.h:182
float Normalize(const Vec4 &v)
Definition g3d_Vector4-inl.h:217
Vec4 & Div(const Vec4 &lhs, float rhs)
Definition g3d_Vector4-inl.h:166
static float Length(const Vec4 &v)
Definition g3d_Vector4-inl.h:176
static const Vec4 * Cast(const float *a)
Definition g3d_Vector4-inl.h:18
Definition g3d_MathCommon.h:6
Definition g3d_GfxManage.cpp:10
Definition g3d_Vector4.h:9
float x
Definition g3d_Vector4.h:16
float w
Definition g3d_Vector4.h:16
float a[DIM]
Definition g3d_Vector4.h:18
float y
Definition g3d_Vector4.h:16
float z
Definition g3d_Vector4.h:16
@ DIM
Definition g3d_Vector4.h:10
@ DIM_PS
Definition g3d_Vector4.h:10