vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::Transform Struct Reference

Local position, rotation and scale of an entity. More...

#include <transform.h>

Static Public Member Functions

static glm::mat4 computeModelMatrix (const Transform &transform)
 Compute the model matrix from transform data.
static Transform fromModelMatrix (const glm::mat4 &model)
 Recover the TRS that computeModelMatrix() would have built model from.
static glm::mat4 computeView (const Transform &transform)
 Compute the view matrix from a transform.

Public Attributes

glm::vec3 position = {0.0f, 0.0f, 0.0f}
 Local position.
glm::quat rotation = {1.0f, 0.0f, 0.0f, 0.0f}
 Local rotation.
glm::vec3 scale = {1.0f, 1.0f, 1.0f}
 Local scale.

Detailed Description

Local position, rotation and scale of an entity.

For pure quat/axis math, use core/math/ (rotation.h, axes.h).

Member Function Documentation

◆ computeModelMatrix()

glm::mat4 Vkm::Engine::Transform::computeModelMatrix ( const Transform & transform)
inlinestatic

Compute the model matrix from transform data.

Parameters
transformLocal TRS to compose, without intermediate matrix products.
Returns
translation * rotation * scale.

◆ fromModelMatrix()

Transform Vkm::Engine::Transform::fromModelMatrix ( const glm::mat4 & model)
inlinestatic

Recover the TRS that computeModelMatrix() would have built model from.

Exact for chains of translations, rotations and uniform scales. Shear (a non-uniformly scaled joint with a rotated child) is dropped. A zero-scaled axis returns zero scale, rotation from the surviving axes.

Parameters
modelModel matrix to decompose.
Returns
Its position, rotation and scale.

◆ computeView()

glm::mat4 Vkm::Engine::Transform::computeView ( const Transform & transform)
inlinestatic

Compute the view matrix from a transform.

Parameters
transformCamera pose; looks along its forward (-Z).
Returns
World-to-view matrix.

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