17 ExpectNear(component.
GetScale(), glm::vec2(1));
28 ExpectNear(component.
GetPosition(), glm::vec2(10, 20));
30 ExpectNear(component.
GetScale(), glm::vec2(2, 3));
34 ExpectNear(component.
GetWorldMatrix() * glm::vec4(1, 2, 0, 1), glm::vec4(4, 22, 0, 1));
35 ExpectNear(component.
GetWorldMatrix() * glm::vec4(1, 2, 0, 0), glm::vec4(-6, 2, 0, 0));
36 glm::mat4 expected(1);
37 expected[0] = glm::vec4(0, 2, 0, 0);
38 expected[1] = glm::vec4(-3, 0, 0, 0);
39 expected[3] = glm::vec4(10, 20, 0, 1);
87 glm::mat4 expected(1);
90 expected[3] = glm::vec4(4, 22, 0, 1);
99 expected[3] = glm::vec4(14, 32, 0, 1);
119 ExpectNear(child.
GetScale(), glm::vec2(2, 3));
Represents a hierarchical 2D transform component.
const glm::vec2 & GetScale() const
Gets the current scale.
void UpdateWorldMatrix()
Recomputes the world transformation matrix.
glm::vec2 GetWorldScale() const
Returns the accumulated world-space scale.
const glm::vec2 & GetPosition() const
Gets the current position.
glm::vec2 GetWorldPosition() const
Returns the world-space position of this component.
void AttachTo(SceneComponent2D *parent)
Attaches this scene component to a parent scene component.
void SetScale(const glm::vec2 &scale)
Sets the scale in each dimension.
float GetRotation() const
Gets the current rotation angle (in degrees).
const glm::mat4 & GetWorldMatrix()
Returns the world transformation matrix.
void SetRotation(float angleDegrees)
Sets the rotation angle in degrees.
void SetPosition(const glm::vec2 &position)
Sets the local position of this component.
void ExpectNear(const glm::vec< N, T, Q > &actual, const glm::vec< N, T, Q > &expected, float tolerance=1e-5f)
TEST(SceneComponent2D, DefaultsToIdentity)