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

#include <mat4.h>

Detailed Description

A 4x4 single point precision float matrix.

Public Member Functions

 mat4 ()
 default constructor. returns identity matrix
 
 mat4 (const mat4 &rhs)=default
 copy constructor
 
 mat4 (const vec4 &row0, const vec4 &row1, const vec4 &row2, const vec4 &row3)
 construct from components
 
 mat4 (float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
 construct from individual values
 
bool operator== (const mat4 &rhs) const
 equality operator
 
bool operator!= (const mat4 &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 store3 (scalar *ptr) const
 write 3 columns 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 (const vec4 &r0, const vec4 &r1, const vec4 &r2, const vec4 &r3)
 set content from row vectors
 
void set (float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
 set content from individual values
 
void get_scale (vec4 &scale) const
 extracts scale components to target vector
 
void translate (const vec3 &t)
 add a translation to pos_component
 
void translate (const float x, const float y, const float z)
 add a translation to pos_component
 
vec4 get_x () const
 
vec4 get_y () const
 
vec4 get_z () const
 
vec4 get_w () const
 
void scale (const vec3 &v)
 scale matrix
 
void scale (const float x, const float y, const float z)
 scale matrix
 

Public Attributes

union { 
 
   struct { 
 
      vec4   x_axis 
 
      vec4   y_axis 
 
      vec4   z_axis 
 
      vec4   position 
 
   }  
 
   struct { 
 
      float   _11 
 
      float   _12 
 
      float   _13 
 
      float   _14 
 
      float   _21 
 
      float   _22 
 
      float   _23 
 
      float   _24 
 
      float   _31 
 
      float   _32 
 
      float   _33 
 
      float   _34 
 
      float   _41 
 
      float   _42 
 
      float   _43 
 
      float   _44 
 
   }  
 float accessors
 
   float   m [4][4] 
 
   vec4   r [4] 
 as a two-dimensional array More...
 
   struct { 
 
      vec4   row0 
 
      vec4   row1 
 
      vec4   row2 
 
      vec4   row3 
 
   }  
 array accessible rows
 
};  
 we use aliasing to represent the matrix in may different ways
 

Static Public Attributes

static const mat4 identity = mat4(_id_x, _id_y, _id_z, _id_w)
 

Constructor & Destructor Documentation

◆ mat4() [1/4]

__forceinline Math::mat4::mat4 ( )

default constructor. returns identity matrix

◆ mat4() [2/4]

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

copy constructor

◆ mat4() [3/4]

__forceinline Math::mat4::mat4 ( const vec4 & row0,
const vec4 & row1,
const vec4 & row2,
const vec4 & row3 )

construct from components

◆ mat4() [4/4]

__forceinline Math::mat4::mat4 ( float m00,
float m01,
float m02,
float m03,
float m10,
float m11,
float m12,
float m13,
float m20,
float m21,
float m22,
float m23,
float m30,
float m31,
float m32,
float m33 )

construct from individual values

Member Function Documentation

◆ get_scale()

__forceinline void Math::mat4::get_scale ( vec4 & scale) const

extracts scale components to target vector

◆ get_w()

__forceinline vec4 Math::mat4::get_w ( ) const

◆ get_x()

__forceinline vec4 Math::mat4::get_x ( ) const

◆ get_y()

__forceinline vec4 Math::mat4::get_y ( ) const

◆ get_z()

__forceinline vec4 Math::mat4::get_z ( ) const

◆ load()

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

load content from 16-byte-aligned memory

◆ loadu()

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

load content from unaligned memory

◆ operator!=()

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

inequality operator

◆ operator==()

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

equality operator

◆ scale() [1/2]

void Math::mat4::scale ( const float x,
const float y,
const float z )

scale matrix

◆ scale() [2/2]

__forceinline void Math::mat4::scale ( const vec3 & v)

scale matrix

◆ set() [1/2]

__forceinline void Math::mat4::set ( const vec4 & r0,
const vec4 & r1,
const vec4 & r2,
const vec4 & r3 )

set content from row vectors

◆ set() [2/2]

__forceinline void Math::mat4::set ( float m00,
float m01,
float m02,
float m03,
float m10,
float m11,
float m12,
float m13,
float m20,
float m21,
float m22,
float m23,
float m30,
float m31,
float m32,
float m33 )

set content from individual values

◆ store()

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

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

◆ store3()

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

write 3 columns to 16-byte aligned memory through the write cache

◆ storeu()

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

write content to unaligned memory through the write cache

◆ stream()

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

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

◆ translate() [1/2]

void Math::mat4::translate ( const float x,
const float y,
const float z )

add a translation to pos_component

◆ translate() [2/2]

__forceinline void Math::mat4::translate ( const vec3 & t)

add a translation to pos_component

Member Data Documentation

◆ [union]

union { ... } Math::mat4

we use aliasing to represent the matrix in may different ways

◆ _11

float Math::mat4::_11

◆ _12

float Math::mat4::_12

◆ _13

float Math::mat4::_13

◆ _14

float Math::mat4::_14

◆ _21

float Math::mat4::_21

◆ _22

float Math::mat4::_22

◆ _23

float Math::mat4::_23

◆ _24

float Math::mat4::_24

◆ _31

float Math::mat4::_31

◆ _32

float Math::mat4::_32

◆ _33

float Math::mat4::_33

◆ _34

float Math::mat4::_34

◆ _41

float Math::mat4::_41

◆ _42

float Math::mat4::_42

◆ _43

float Math::mat4::_43

◆ _44

float Math::mat4::_44

◆ identity

const mat4 Math::mat4::identity = mat4(_id_x, _id_y, _id_z, _id_w)
static

◆ m

float Math::mat4::m[4][4]

◆ position

vec4 Math::mat4::position

◆ r

vec4 Math::mat4::r[4]

as a two-dimensional array

SIMD accessors

◆ row0

vec4 Math::mat4::row0

◆ row1

vec4 Math::mat4::row1

◆ row2

vec4 Math::mat4::row2

◆ row3

vec4 Math::mat4::row3

◆ x_axis

vec4 Math::mat4::x_axis

◆ y_axis

vec4 Math::mat4::y_axis

◆ z_axis

vec4 Math::mat4::z_axis

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