Nebula
Loading...
Searching...
No Matches
Math::vec4 Struct Reference

#include <vec4.h>

Detailed Description

A 4D vector.

See also
Math::vector
Math::point

Inherited by Util::Color.

Public Member Functions

 vec4 ()=default
 default constructor, NOTE: does NOT setup components!
 
 vec4 (scalar x, scalar y, scalar z, scalar w)
 construct from values
 
 vec4 (scalar v)
 construct from single value
 
 vec4 (const vec4 &rhs)=default
 copy constructor
 
 vec4 (const vec3 &rhs, float w)
 copy constructor from vec3
 
 vec4 (const __m128 &rhs)
 construct from SSE 128 byte float array
 
void operator= (const __m128 &rhs)
 assign an vmVector4
 
void operator+= (const vec4 &rhs)
 inplace add
 
void operator-= (const vec4 &rhs)
 inplace sub
 
void operator*= (scalar s)
 inplace scalar multiply
 
void operator*= (const vec4 &rhs)
 muliply by a vector component-wise
 
void operator/= (const vec4 &rhs)
 divide by a vector component-wise
 
bool operator== (const vec4 &rhs) const
 equality operator
 
bool operator!= (const vec4 &rhs) const
 inequality operator
 
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 store3 (scalar *ptr) const
 write content to 16-byte-aligned memory through the write cache
 
void storeu3 (scalar *ptr) const
 write content to unaligned memory through the write cache
 
void stream (scalar *ptr) const
 stream content to 16-byte-aligned memory circumventing the write-cache
 
void load_float3 (const void *ptr, float w)
 load 3 floats into x,y,z from unaligned memory
 
void load_ubyte4n (const void *ptr)
 load from UByte4N packed vector
 
void load_byte4n (const void *ptr)
 load from Byte4N packed vector
 
void set (scalar x, scalar y, scalar z, scalar w)
 set content
 
template<int X, int Y, int Z, int W>
vec4 swizzle (const vec4 &v)
 swizzle vector
 
scalaroperator[] (const int index)
 read-only access to indexed component
 
scalar operator[] (const int index) const
 read-only access to indexed component
 

Public Attributes

union { 
 
   struct { 
 
      float   x 
 
      float   y 
 
      float   z 
 
      float   w 
 
   }  
 
   __m128   vec 
 
   float   v [4] 
 
};  
 

Constructor & Destructor Documentation

◆ vec4() [1/6]

Math::vec4::vec4 ( )
default

default constructor, NOTE: does NOT setup components!

◆ vec4() [2/6]

__forceinline Math::vec4::vec4 ( scalar x,
scalar y,
scalar z,
scalar w )

construct from values

◆ vec4() [3/6]

__forceinline Math::vec4::vec4 ( scalar v)
explicit

construct from single value

◆ vec4() [4/6]

Math::vec4::vec4 ( const vec4 & rhs)
default

copy constructor

◆ vec4() [5/6]

__forceinline Math::vec4::vec4 ( const vec3 & rhs,
float w )

copy constructor from vec3

◆ vec4() [6/6]

__forceinline Math::vec4::vec4 ( const __m128 & rhs)

construct from SSE 128 byte float array

Member Function Documentation

◆ load()

__forceinline void Math::vec4::load ( const scalar * ptr)

load content from 16-byte-aligned memory

Load 4 floats from 16-byte-aligned memory.

◆ load_byte4n()

void Math::vec4::load_byte4n ( const void * ptr)

load from Byte4N packed vector

◆ load_float3()

__forceinline void Math::vec4::load_float3 ( const void * ptr,
float w )

load 3 floats into x,y,z from unaligned memory

◆ load_ubyte4n()

void Math::vec4::load_ubyte4n ( const void * ptr)

load from UByte4N packed vector

◆ loadu()

__forceinline void Math::vec4::loadu ( const scalar * ptr)

load content from unaligned memory

Load 4 floats from unaligned memory.

◆ operator!=()

__forceinline bool Math::vec4::operator!= ( const vec4 & rhs) const

inequality operator

◆ operator*=() [1/2]

__forceinline void Math::vec4::operator*= ( const vec4 & rhs)

muliply by a vector component-wise

◆ operator*=() [2/2]

__forceinline void Math::vec4::operator*= ( scalar s)

inplace scalar multiply

◆ operator+=()

__forceinline void Math::vec4::operator+= ( const vec4 & rhs)

inplace add

◆ operator-=()

__forceinline void Math::vec4::operator-= ( const vec4 & rhs)

inplace sub

◆ operator/=()

__forceinline void Math::vec4::operator/= ( const vec4 & rhs)

divide by a vector component-wise

◆ operator=()

__forceinline void Math::vec4::operator= ( const __m128 & rhs)

assign an vmVector4

◆ operator==()

__forceinline bool Math::vec4::operator== ( const vec4 & rhs) const

equality operator

◆ operator[]() [1/2]

__forceinline scalar & Math::vec4::operator[] ( const int index)

read-only access to indexed component

◆ operator[]() [2/2]

__forceinline scalar Math::vec4::operator[] ( const int index) const

read-only access to indexed component

◆ set()

__forceinline void Math::vec4::set ( scalar x,
scalar y,
scalar z,
scalar w )

set content

◆ store()

__forceinline void Math::vec4::store ( scalar * ptr) const

write content to 16-byte-aligned memory through the write cache

Store to 16-byte-aligned float pointer.

◆ store3()

__forceinline void Math::vec4::store3 ( scalar * ptr) const

write content to 16-byte-aligned memory through the write cache

◆ storeu()

__forceinline void Math::vec4::storeu ( scalar * ptr) const

write content to unaligned memory through the write cache

Store to non-aligned float pointer.

◆ storeu3()

__forceinline void Math::vec4::storeu3 ( scalar * ptr) const

write content to unaligned memory through the write cache

◆ stream()

__forceinline void Math::vec4::stream ( scalar * ptr) const

stream content to 16-byte-aligned memory circumventing the write-cache

◆ swizzle()

template<int X, int Y, int Z, int W>
vec4 Math::vec4::swizzle ( const vec4 & v)
inline

swizzle vector

Member Data Documentation

◆ [union]

union { ... } Math::vec4

◆ v

float Math::vec4::v[4]

◆ vec

__m128 Math::vec4::vec

◆ w

float Math::vec4::w

◆ x

float Math::vec4::x

◆ y

float Math::vec4::y

◆ z

float Math::vec4::z

The documentation for this struct was generated from the following files: