Rot + Scale!
This commit is contained in:
@@ -8,7 +8,17 @@ namespace cve {
|
||||
|
||||
struct Transform2dComponent {
|
||||
glm::vec2 translation{}; // Position offset
|
||||
glm::mat2 mat2() { return glm::mat2{1.f}; };
|
||||
glm::vec2 scale{1.f, 1.f};
|
||||
float rotation;
|
||||
|
||||
glm::mat2 mat2() {
|
||||
const float s = glm::sin(rotation);
|
||||
const float c = glm::cos(rotation);
|
||||
glm::mat2 rotMatrix{{c, s}, {-s, c}};
|
||||
|
||||
glm::mat2 scaleMat{{scale.x, .0f}, {.0f, scale.y}};
|
||||
return rotMatrix*scaleMat;
|
||||
};
|
||||
};
|
||||
|
||||
class CveGameObject {
|
||||
|
||||
Reference in New Issue
Block a user