CG-Project2
Loading...
Searching...
No Matches
systems::transform Namespace Reference

All the methods to manipulate the Transform component. More...

Functions

void updatePosition (const unsigned int &id, const glm::vec3 &position)
 Updates the position of the given entity.
void updateScale (const unsigned int &id, const glm::vec3 &scale)
 Updates the scale of the given entity.
void updateRotation (const unsigned int &id, const glm::vec3 &rotation)
 Updates the rotation of the given entity.
void addPosition (const unsigned int &id, const glm::vec3 &offset)
 Adds an offset to the position of the given entity.
void addScale (const unsigned int &id, const glm::vec3 &offset)
 Adds an offset to the scale of the given entity.
void addRotation (const unsigned int &id, const glm::vec3 &offset)
 Adds an offset to the rotation of the given entity.
glm::vec3 getPosition (const unsigned int &id)
 Retrieves the position of the given entity.
glm::vec3 getScale (const unsigned int &id)
 Retrieves the scale of the given entity.
glm::vec3 getRotation (const unsigned int &id)
 Retrieves the rotation of the given entity.
glm::mat4 getModelMatrix (const unsigned int &id)
 Retrieves the model matrix of the given entity.
void updateModelMatrix (const unsigned int &id)
 Updates the model matrix of the given entity.
void updateAllModelMatrix ()
 Updates all model matrix of each entity with the Transform component.

Detailed Description

All the methods to manipulate the Transform component.

Note
It calls the Transform component methods already defined.
See also
Transform

Function Documentation

◆ addPosition()

void systems::transform::addPosition ( const unsigned int & id,
const glm::vec3 & offset )

Adds an offset to the position of the given entity.

Parameters
idthe entity id
offsetthe position offset to be added

◆ addRotation()

void systems::transform::addRotation ( const unsigned int & id,
const glm::vec3 & offset )

Adds an offset to the rotation of the given entity.

It works the same way of updateRotation.

See also
systems::transform::updateRotation()
Parameters
idthe entity id
offsetthe rotation offset to be added

◆ addScale()

void systems::transform::addScale ( const unsigned int & id,
const glm::vec3 & offset )

Adds an offset to the scale of the given entity.

Parameters
idthe entity id
offsetthe scale offset to be added

◆ getModelMatrix()

glm::mat4 systems::transform::getModelMatrix ( const unsigned int & id)

Retrieves the model matrix of the given entity.

If the model matrix is dirty it will be updated by the component automatically.

Parameters
idthe entity id
Returns
the entity model matrix

◆ getPosition()

glm::vec3 systems::transform::getPosition ( const unsigned int & id)

Retrieves the position of the given entity.

Parameters
idthe entity id
Returns
the entity position

◆ getRotation()

glm::vec3 systems::transform::getRotation ( const unsigned int & id)

Retrieves the rotation of the given entity.

Parameters
idthe entity id
Returns
the entity rotation in Euler angle.

◆ getScale()

glm::vec3 systems::transform::getScale ( const unsigned int & id)

Retrieves the scale of the given entity.

Parameters
idthe entity id
Returns
the entity scale

◆ updateModelMatrix()

void systems::transform::updateModelMatrix ( const unsigned int & id)

Updates the model matrix of the given entity.

If the model matrix is dirty it will update the model matrix and also the entity collider if it has one.

Parameters
idthe entity id

◆ updatePosition()

void systems::transform::updatePosition ( const unsigned int & id,
const glm::vec3 & position )

Updates the position of the given entity.

Parameters
idthe entity id
positionthe entity new position

◆ updateRotation()

void systems::transform::updateRotation ( const unsigned int & id,
const glm::vec3 & rotation )

Updates the rotation of the given entity.

It takes an Euler angle glm::vec3 in degrees and it will be converted in radians by the component.

Parameters
idthe entity id
rotationthe entity new rotation in degrees

◆ updateScale()

void systems::transform::updateScale ( const unsigned int & id,
const glm::vec3 & scale )

Updates the scale of the given entity.

Parameters
idthe entity id
scalethe entity new scale