#include <types.hpp>
|
| void | updateMatrix () const |
| | recalculates the model matrix
|
| |
| | TransformComponent ()=default |
| | default concstructor for TransformComponent
|
| |
| | TransformComponent (const glm::vec2 &position, float rotation, float scaling) |
| | constructor for TransformComponent with all fields
|
| |
| const glm::vec2 | getForward () const |
| | gives the forward vector of an object. Can be used for cannons and bullets, for example
|
| |
| void | move (const glm::vec2 &direction) |
| | changes the object's position: (x, y) -> (x + direction.x, y + direction.y)
|
| |
| void | rotate (float angle_delta) |
| | rotates the object
|
| |
| void | scale (float scale_coef) |
| | scales the object
|
| |
|
| void | setPosition (const glm::vec2 &new_position) |
| | sets the new object's position on the grid
|
| |
| void | setRotation (const float new_angle) |
| | sets the new object's rotation in radians, clockwise
|
| |
| void | setScale (float new_scale) |
| | sets the new object's scaling coefficients
|
| |
|
| glm::vec2 | position {0.0f, 0.0f} |
| | global position of the object on the grid
|
| |
| float | rotation {0.0f} |
| | rotation angle of the object, clockwise
|
| |
| float | scaling {1.0f} |
| | scaling coefficient
|
| |
| bool | dirty {true} |
| | should we update model_matrix or not
|
| |
| glm::mat3 | modelMatrix {1.0f} |
| | model matrix for MVP-rendering
|
| |
◆ TransformComponent() [1/2]
| phys2d::TransformComponent::TransformComponent |
( |
| ) |
|
|
default |
◆ TransformComponent() [2/2]
| phys2d::TransformComponent::TransformComponent |
( |
const glm::vec2 & |
position, |
|
|
float |
rotation, |
|
|
float |
scaling |
|
) |
| |
◆ getForward()
| const glm::vec2 phys2d::TransformComponent::getForward |
( |
| ) |
const |
gives the forward vector of an object. Can be used for cannons and bullets, for example
- Parameters
-
- Return values
-
◆ move()
| void phys2d::TransformComponent::move |
( |
const glm::vec2 & |
direction | ) |
|
changes the object's position: (x, y) -> (x + direction.x, y + direction.y)
- Note
- (0, 0) - center of the screen
-
x-axis is horizontal
-
y-axis is vertical
- Parameters
-
| direction | vector of movement |
- Return values
-
◆ rotate()
| void phys2d::TransformComponent::rotate |
( |
float |
angle_delta | ) |
|
rotates the object
- Parameters
-
| angle_delta | value of rotation, given in radians, rotates clockwise |
- Return values
-
◆ scale()
| void phys2d::TransformComponent::scale |
( |
float |
scale_coef | ) |
|
scales the object
- Parameters
-
| scale_coef | scaling coef to multiply |
- Return values
-
◆ setPosition()
| void phys2d::TransformComponent::setPosition |
( |
const glm::vec2 & |
new_position | ) |
|
sets the new object's position on the grid
- Parameters
-
| new_position | new position where the object will be located |
- Return values
-
◆ setRotation()
| void phys2d::TransformComponent::setRotation |
( |
const float |
new_angle | ) |
|
sets the new object's rotation in radians, clockwise
- Parameters
-
| new_angle | new angle of the rotation of the object, in radians |
- Return values
-
◆ setScale()
| void phys2d::TransformComponent::setScale |
( |
float |
new_scale | ) |
|
sets the new object's scaling coefficients
- Parameters
-
| new_scale | new scale of the object |
- Return values
-
◆ updateMatrix()
| void phys2d::TransformComponent::updateMatrix |
( |
| ) |
const |
recalculates the model matrix
- Parameters
-
- Return values
-
◆ dirty
| bool phys2d::TransformComponent::dirty {true} |
|
mutable |
should we update model_matrix or not
◆ modelMatrix
| glm::mat3 phys2d::TransformComponent::modelMatrix {1.0f} |
|
mutable |
model matrix for MVP-rendering
◆ position
| glm::vec2 phys2d::TransformComponent::position {0.0f, 0.0f} |
global position of the object on the grid
◆ rotation
| float phys2d::TransformComponent::rotation {0.0f} |
rotation angle of the object, clockwise
◆ scaling
| float phys2d::TransformComponent::scaling {1.0f} |
The documentation for this struct was generated from the following file:
- /home/runner/work/Cheese-Engine/Cheese-Engine/inc/types.hpp