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

#include <vec3.h>

Detailed Description

A 3D vector.

Internally represented as a __m128 for performance and alignment reasons.

See also
Math::vector
Math::point

Inherited by Game::AngularVelocity, Game::Position, Game::Scale, and Game::Velocity.

Public Member Functions

 vec3 ()=default
 default constructor, NOTE: does NOT setup components!
 
 vec3 (scalar x, scalar y, scalar z)
 construct from values
 
 vec3 (scalar v)
 construct from single value
 
 vec3 (const vec3 &rhs)=default
 copy constructor
 
 vec3 (const __m128 &rhs)
 construct from SSE 128 byte float array
 
void operator= (const __m128 &rhs)
 assign an vmVector4
 
void operator+= (const vec3 &rhs)
 inplace add
 
void operator-= (const vec3 &rhs)
 inplace sub
 
void operator*= (scalar s)
 inplace scalar multiply
 
void operator*= (const vec3 &rhs)
 muliply by a vector component-wise
 
void operator/= (const vec3 &rhs)
 divide by a vector component-wise
 
bool operator== (const vec3 &rhs) const
 equality operator
 
bool operator!= (const vec3 &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 stream (scalar *ptr) const
 stream content to 16-byte-aligned memory circumventing the write-cache
 
void set (scalar x, scalar y, scalar z)
 set content
 
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 [3] 
 
};  
 

Constructor & Destructor Documentation

◆ vec3() [1/5]

Math::vec3::vec3 ( )
default

default constructor, NOTE: does NOT setup components!

◆ vec3() [2/5]

__forceinline Math::vec3::vec3 ( scalar x,
scalar y,
scalar z )

construct from values

◆ vec3() [3/5]

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

construct from single value

◆ vec3() [4/5]

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

copy constructor

◆ vec3() [5/5]

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

construct from SSE 128 byte float array

Member Function Documentation

◆ load()

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

load content from 16-byte-aligned memory

Load 4 floats from 16-byte-aligned memory.

◆ loadu()

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

load content from unaligned memory

Load 4 floats from unaligned memory.

◆ operator!=()

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

inequality operator

◆ operator*=() [1/2]

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

muliply by a vector component-wise

◆ operator*=() [2/2]

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

inplace scalar multiply

◆ operator+=()

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

inplace add

◆ operator-=()

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

inplace sub

◆ operator/=()

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

divide by a vector component-wise

◆ operator=()

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

assign an vmVector4

◆ operator==()

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

equality operator

◆ operator[]() [1/2]

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

read-only access to indexed component

◆ operator[]() [2/2]

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

read-only access to indexed component

◆ set()

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

set content

◆ store()

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

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

Store to 16-byte-aligned float pointer.

◆ storeu()

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

write content to unaligned memory through the write cache

Store to non-aligned float pointer.

◆ stream()

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

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

Member Data Documentation

◆ [union]

union { ... } Math::vec3

◆ __w

float Math::vec3::__w

◆ v

float Math::vec3::v[3]

◆ vec

__m128 Math::vec3::vec

◆ x

float Math::vec3::x

◆ y

float Math::vec3::y

◆ z

float Math::vec3::z

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