Copperfield Engine 0.1
C++ Game Engine
Loading...
Searching...
No Matches
coma::Mat4 Class Reference

represents mathematical matrix with 4 cols and 4 rows More...

#include <matrix_4.h>

Public Member Functions

Mat4 Multiply (const Mat4 &other) const
 
float Determinant () const
 
Mat4 Adjoint () const
 
bool GetInverse (Mat4 *out) const
 
bool Inverse ()
 
Mat4 Transpose () const
 
Mat3 getSubMatrix (int r, int c) const
 
Vec4 Transform (const Vec4 &v)
 
Mat4 Projection () const
 
Vec3 TransformVec3 (Vec3 *vector)
 
Vec4 GetColum (int colum) const
 
Vec4 GetLine (int line) const
 

Static Public Member Functions

static Mat4 Identity ()
 
static Mat4 Translate (const Vec3 &distance)
 
static Mat4 Translate (float x, float y, float z)
 
static Mat4 Scale (const Vec3 &scale)
 
static Mat4 Scale (float x, float y, float z)
 
static Mat4 RotateX (float radians)
 
static Mat4 RotateY (float radians)
 
static Mat4 RotateZ (float radians)
 
static Mat4 GetTransform (const Vec3 &translate, const Vec3 &scale, const Vec3 &rotation)
 
static Mat4 GetTransform (const Vec3 &translate, const Vec3 &scale, float rotateX, float rotateY, float rotateZ)
 
static Mat4 GetTransform (float trans_x, float trans_y, float trans_z, float scale_x, float scale_y, float scale_Z, float rotateX, float rotateY, float rotateZ)
 
static Mat4 LookAtZeroCheck (const Vec3 &position, const Vec3 &target)
 Like LoockAt but checking that no divisions by 0 are made. More...
 
static Mat4 LookAt (const Vec3 &position, const Vec3 &target, const Vec3 &upDir=Vec3::up)
 Calculate the view matrix based on the position and a target. More...
 
static Mat4 PerspectiveMatrix (float fov, float aspect, float near, float far)
 
static Mat4 OrthoMatrix (float right, float left, float top, float bottom, float near, float far)
 

Detailed Description

represents mathematical matrix with 4 cols and 4 rows

Member Function Documentation

◆ Adjoint()

Mat4 coma::Mat4::Adjoint ( ) const
inline
Returns

◆ Determinant()

float coma::Mat4::Determinant ( ) const
inline
Returns

◆ GetColum()

Vec4 coma::Mat4::GetColum ( int  colum) const
inline
Parameters
colum
Returns

◆ GetInverse()

bool coma::Mat4::GetInverse ( Mat4 out) const
inline
Parameters
out
Returns

◆ GetLine()

Vec4 coma::Mat4::GetLine ( int  line) const
inline
Parameters
line
Returns

◆ getSubMatrix()

Mat3 coma::Mat4::getSubMatrix ( int  r,
int  c 
) const
inline
Parameters
r
c
Returns

◆ GetTransform() [1/3]

Mat4 coma::Mat4::GetTransform ( const Vec3 translate,
const Vec3 scale,
const Vec3 rotation 
)
inlinestatic
Parameters
translate
scale
rotation
Returns

◆ GetTransform() [2/3]

Mat4 coma::Mat4::GetTransform ( const Vec3 translate,
const Vec3 scale,
float  rotateX,
float  rotateY,
float  rotateZ 
)
inlinestatic
Parameters
translate
scale
rotateX
rotateY
rotateZ
Returns

◆ GetTransform() [3/3]

Mat4 coma::Mat4::GetTransform ( float  trans_x,
float  trans_y,
float  trans_z,
float  scale_x,
float  scale_y,
float  scale_Z,
float  rotateX,
float  rotateY,
float  rotateZ 
)
inlinestatic
Parameters
trans_x
trans_y
trans_z
scale_x
scale_y
scale_Z
rotateX
rotateY
rotateZ
Returns

◆ Identity()

Mat4 coma::Mat4::Identity ( )
inlinestatic
Returns

◆ Inverse()

bool coma::Mat4::Inverse ( )
inline
Returns

◆ LookAt()

static Mat4 coma::Mat4::LookAt ( const Vec3 position,
const Vec3 target,
const Vec3 upDir = Vec3::up 
)
inlinestatic

Calculate the view matrix based on the position and a target.

Parameters
positionMy position
targetThe position I want to look at.
upDirSpecifies the direction of the up vector.
Returns
Returns the view matrix at the given direction.

◆ LookAtZeroCheck()

static Mat4 coma::Mat4::LookAtZeroCheck ( const Vec3 position,
const Vec3 target 
)
inlinestatic

Like LoockAt but checking that no divisions by 0 are made.

Parameters
positionMy position
targetThe position I want to look at.
Returns
Returns the view matrix at the given direction.

◆ Multiply()

Mat4 coma::Mat4::Multiply ( const Mat4 other) const
inline
Parameters
other
Returns

◆ OrthoMatrix()

Mat4 coma::Mat4::OrthoMatrix ( float  right,
float  left,
float  top,
float  bottom,
float  near,
float  far 
)
inlinestatic
Parameters
right
left
top
bottom
near
far
Returns

◆ PerspectiveMatrix()

Mat4 coma::Mat4::PerspectiveMatrix ( float  fov,
float  aspect,
float  near,
float  far 
)
inlinestatic
Parameters
fov
aspect
near
far
Returns

◆ Projection()

Mat4 coma::Mat4::Projection ( ) const
inline
Returns

◆ RotateX()

Mat4 coma::Mat4::RotateX ( float  radians)
inlinestatic
Parameters
radians
Returns

◆ RotateY()

Mat4 coma::Mat4::RotateY ( float  radians)
inlinestatic
Parameters
radians
Returns

◆ RotateZ()

Mat4 coma::Mat4::RotateZ ( float  radians)
inlinestatic
Parameters
radians
Returns

◆ Scale() [1/2]

Mat4 coma::Mat4::Scale ( const Vec3 scale)
inlinestatic
Parameters
scale
Returns

◆ Scale() [2/2]

Mat4 coma::Mat4::Scale ( float  x,
float  y,
float  z 
)
inlinestatic
Parameters
x
y
z
Returns

◆ Transform()

Vec4 coma::Mat4::Transform ( const Vec4 v)
inline
Parameters
v
Returns

◆ TransformVec3()

Vec3 coma::Mat4::TransformVec3 ( Vec3 vector)
inline
Parameters
vector
Returns

◆ Translate() [1/2]

Mat4 coma::Mat4::Translate ( const Vec3 distance)
inlinestatic
Parameters
distance
Returns

◆ Translate() [2/2]

Mat4 coma::Mat4::Translate ( float  x,
float  y,
float  z 
)
inlinestatic
Parameters
x
y
z
Returns

◆ Transpose()

Mat4 coma::Mat4::Transpose ( ) const
inline
Returns