Nebula
|
#include <vector.h>
A vector is a 3D direction in space.
Represented as a __m128 with the W component being 0 at all times. Useful for representing normal vectors and directions.
Public Member Functions | |
vector () | |
default constructor | |
vector (scalar x, scalar y, scalar z) | |
construct from values | |
vector (scalar v) | |
construct from single value | |
vector (const vector &rhs) | |
copy constructor | |
vector (const vec3 &rhs) | |
construct from vec3 | |
vector (const vec4 &rhs) | |
construct from vec4 | |
vector (const __m128 &rhs) | |
construct from SSE 128 byte float array | |
void | load (const scalar *ptr) |
load content from 16-byte-aligned memory | |
void | loadu (const scalar *ptr) |
load content from unaligned memory | |
void | store (scalar *ptr) const |
write content to 16-byte-aligned memory through the write cache | |
void | storeu (scalar *ptr) const |
write content to unaligned memory through the write cache | |
void | operator= (const vector &rhs) |
assignment operator | |
void | operator= (const __m128 &rhs) |
assign an vmVector4 | |
void | operator+= (const vector &rhs) |
inplace add | |
void | operator-= (const vector &rhs) |
inplace sub | |
void | operator*= (scalar s) |
inplace scalar multiply | |
bool | operator== (const vector &rhs) const |
equality operator | |
bool | operator!= (const vector &rhs) const |
inequality operator | |
float | operator[] (int index) const |
float & | operator[] (int index) |
operator vec4 () const | |
convert to vec4 | |
operator vec3 () const | |
convert to vec3 | |
void | set (scalar x, scalar y, scalar z) |
set content | |
Static Public Member Functions | |
static vector | nullvec () |
create a null vector | |
static vector | onevec () |
create a 1,1,1 vector | |
static vector | upvec () |
create the up vector | |
Public Attributes | ||
union { | ||
__m128 vec | ||
struct { | ||
float x | ||
float y | ||
float z | ||
} | ||
}; | ||
__forceinline Math::vector::vector | ( | ) |
default constructor
__forceinline Math::vector::vector | ( | scalar | v | ) |
construct from single value
__forceinline Math::vector::vector | ( | const vector & | rhs | ) |
copy constructor
__forceinline Math::vector::vector | ( | const __m128 & | rhs | ) |
construct from SSE 128 byte float array
__forceinline void Math::vector::load | ( | const scalar * | ptr | ) |
load content from 16-byte-aligned memory
Load 4 floats from 16-byte-aligned memory.
__forceinline void Math::vector::loadu | ( | const scalar * | ptr | ) |
load content from unaligned memory
Load 4 floats from unaligned memory.
|
static |
create a null vector
|
static |
create a 1,1,1 vector
__forceinline bool Math::vector::operator!= | ( | const vector & | rhs | ) | const |
inequality operator
__forceinline void Math::vector::operator*= | ( | scalar | s | ) |
inplace scalar multiply
__forceinline void Math::vector::operator+= | ( | const vector & | rhs | ) |
inplace add
__forceinline void Math::vector::operator-= | ( | const vector & | rhs | ) |
inplace sub
__forceinline void Math::vector::operator= | ( | const __m128 & | rhs | ) |
assign an vmVector4
__forceinline void Math::vector::operator= | ( | const vector & | rhs | ) |
assignment operator
__forceinline bool Math::vector::operator== | ( | const vector & | rhs | ) | const |
equality operator
__forceinline float & Math::vector::operator[] | ( | int | index | ) |
__forceinline float Math::vector::operator[] | ( | int | index | ) | const |
__forceinline void Math::vector::store | ( | scalar * | ptr | ) | const |
write content to 16-byte-aligned memory through the write cache
Store to 16-byte-aligned float pointer.
__forceinline void Math::vector::storeu | ( | scalar * | ptr | ) | const |
write content to unaligned memory through the write cache
Store to non-aligned float pointer.
|
static |
create the up vector
union { ... } Math::vector |
__m128 Math::vector::vec |
float Math::vector::x |
float Math::vector::y |
float Math::vector::z |