cat3d
A tiny OpenGL 3D engine library written in and for C++.
Public Member Functions | Static Public Attributes | List of all members
cat3d::util::transform Class Reference

Transformation class to manage 3D space transforms. More...

#include <transform.hpp>

Public Member Functions

void reset ()
 Resets the transform back to the identity matrix.
 
glm::mat4 to_mat4 () const
 Convert the transform to a GLM matrix. More...
 
void set_pos (glm::vec3 p)
 Set the transform's position. More...
 
glm::vec3 get_pos () const
 Get the transform's position. More...
 
transformmove (glm::vec3 p)
 Translate the transform through space. More...
 
void set_rotation (glm::vec3 angles)
 Set the transform's rotation. More...
 
glm::vec3 get_rotation () const
 Get the transform's rotation. More...
 
transformrotate (glm::vec3 angles)
 Rotate by the given euler angle displacement. More...
 
void set_scale (glm::vec3 s)
 Set the transform's scale. More...
 
glm::vec3 get_scale () const
 Get the transform's scale. More...
 
transformscale (glm::vec3 s)
 Scale the transform. More...
 
transform operator* (const transform &other) const
 Combine two transforms. More...
 
transformoperator*= (const transform &other)
 Combine another transform with this one. More...
 

Static Public Attributes

static const transform identity
 A copy of the identity matrix.
 

Detailed Description

Transformation class to manage 3D space transforms.

Member Function Documentation

◆ get_pos()

glm::vec3 cat3d::util::transform::get_pos ( ) const

Get the transform's position.

Returns
glm::vec3

◆ get_rotation()

glm::vec3 cat3d::util::transform::get_rotation ( ) const

Get the transform's rotation.

Returns
glm::vec3 Euler angles representing the current rotation

◆ get_scale()

glm::vec3 cat3d::util::transform::get_scale ( ) const

Get the transform's scale.

Returns
glm::vec3

◆ move()

transform& cat3d::util::transform::move ( glm::vec3  p)

Translate the transform through space.

Parameters
pThe displacement to move
Returns
transform& *this

◆ operator*()

transform cat3d::util::transform::operator* ( const transform other) const

Combine two transforms.

Parameters
other
Returns
transform The new transform

◆ operator*=()

transform& cat3d::util::transform::operator*= ( const transform other)

Combine another transform with this one.

Parameters
other
Returns
transform& *this

◆ rotate()

transform& cat3d::util::transform::rotate ( glm::vec3  angles)

Rotate by the given euler angle displacement.

Parameters
anglesEuler angles to rotate by
Returns
transform& *this

◆ scale()

transform& cat3d::util::transform::scale ( glm::vec3  s)

Scale the transform.

Parameters
s
Returns
transform& *this

◆ set_pos()

void cat3d::util::transform::set_pos ( glm::vec3  p)

Set the transform's position.

Parameters
p

◆ set_rotation()

void cat3d::util::transform::set_rotation ( glm::vec3  angles)

Set the transform's rotation.

Parameters
anglesEuler angles to rotate

◆ set_scale()

void cat3d::util::transform::set_scale ( glm::vec3  s)

Set the transform's scale.

Parameters
s

◆ to_mat4()

glm::mat4 cat3d::util::transform::to_mat4 ( ) const

Convert the transform to a GLM matrix.

Returns
glm::mat4

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