Tesseract-Engine/src/Componenets/Transform.h

48 lines
921 B
C
Raw Normal View History

2024-12-25 23:58:56 +00:00
// Transform.h
#pragma once
#include "Component.h"
2024-12-25 23:58:56 +00:00
#include <glm/glm.hpp>
#include <yaml-cpp/yaml.h>
2024-12-25 23:58:56 +00:00
class TransformComponent : public Component
2024-12-25 23:58:56 +00:00
{
public:
glm::vec3 position;
glm::vec3 rotation;
glm::vec3 scale;
2024-12-25 23:58:56 +00:00
glm::vec3 GetPosition() const
{
2024-12-28 03:43:17 +00:00
return position;
}
void SetPosition(float x, float y, float z)
{
position = {x, y, z};
2024-12-28 03:43:17 +00:00
}
glm::vec3 GetRotation() const
{
2024-12-28 03:43:17 +00:00
return rotation;
}
void SetRotation(float x, float y, float z)
{
rotation = {x, y, z};
2024-12-28 03:43:17 +00:00
}
TransformComponent();
virtual const std::string &GetName() const override;
static const std::string &GetStaticName();
virtual void Update(float deltaTime) override;
2024-12-25 23:58:56 +00:00
// Serialization methods
virtual YAML::Node Serialize() override;
virtual void Deserialize(const YAML::Node &node) override;
2024-12-25 23:58:56 +00:00
private:
static const std::string name;
};