This commit is contained in:
2026-09-24 05:31:38 +00:00
parent 6a50cdb4e8
commit 97267f1a26
3 changed files with 30 additions and 2 deletions
+16
View File
@@ -1,5 +1,7 @@
#pragma once
#include <iostream>
#include <ostream>
#include <sophia/handles.hpp>
#include <string>
@@ -28,6 +30,20 @@ struct TransformComponent {
glm::mat3 normalMatrix() const {
return glm::mat3{glm::transpose(glm::inverse(mat4()))};
}
friend std::ostream& operator<<(std::ostream& os,
const TransformComponent& transform) {
os << "TransformComponent {\n"
<< " Position: (" << transform.position.x << ", "
<< transform.position.y << ", " << transform.position.z << ")\n"
<< " Rotation (w, x, y, z): (" << transform.rotation.w << ", "
<< transform.rotation.x << ", " << transform.rotation.y << ", "
<< transform.rotation.z << ")\n"
<< " Scale: (" << transform.scale.x << ", " << transform.scale.y << ", "
<< transform.scale.z << ")\n"
<< "}";
return os;
}
};
struct MeshComponent {
+7 -2
View File
@@ -1,6 +1,7 @@
#pragma once
#include <entt/entt.hpp>
#include <string>
namespace sophia {
@@ -12,13 +13,17 @@ class Scene {
Scene();
~Scene();
// The camera a render request uses when it doesn't name one. Null until set.
void createEntity(const std::string& name = {});
void destroyEntity(Entity entity);
// The camera a render request uses when it doesn't name one. Null until
// set.
entt::entity getActiveCamera() const { return activeCamera; }
void setActiveCamera(entt::entity camera) { activeCamera = camera; }
private:
friend class Entity;
friend class SceneRenderer; // !TEMP remove this
friend class SceneRenderer; // !TEMP remove this
entt::registry registry;
entt::entity activeCamera = entt::null;