Add offscreen render targets and rename AssetRegistry to ResourceRegistry #8

Merged
burkkyy merged 26 commits from dev into main 2026-09-25 20:39:26 -07:00
3 changed files with 30 additions and 2 deletions
Showing only changes of commit 97267f1a26 - Show all commits
+16
View File
@@ -1,5 +1,7 @@
#pragma once #pragma once
#include <iostream>
#include <ostream>
#include <sophia/handles.hpp> #include <sophia/handles.hpp>
#include <string> #include <string>
@@ -28,6 +30,20 @@ struct TransformComponent {
glm::mat3 normalMatrix() const { glm::mat3 normalMatrix() const {
return glm::mat3{glm::transpose(glm::inverse(mat4()))}; 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 { struct MeshComponent {
+7 -2
View File
@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <entt/entt.hpp> #include <entt/entt.hpp>
#include <string>
namespace sophia { namespace sophia {
@@ -12,13 +13,17 @@ class Scene {
Scene(); 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; } entt::entity getActiveCamera() const { return activeCamera; }
void setActiveCamera(entt::entity camera) { activeCamera = camera; } void setActiveCamera(entt::entity camera) { activeCamera = camera; }
private: private:
friend class Entity; friend class Entity;
friend class SceneRenderer; // !TEMP remove this friend class SceneRenderer; // !TEMP remove this
entt::registry registry; entt::registry registry;
entt::entity activeCamera = entt::null; entt::entity activeCamera = entt::null;
+7
View File
@@ -24,6 +24,13 @@ void SceneRenderer::render(const Scene& scene, Entity camera,
auto& registry = scene.registry; auto& registry = scene.registry;
auto view = registry.view<MeshComponent, TransformComponent>();
for (auto entity : view) {
auto& transform = view.get<TransformComponent>(entity);
log::info(transform);
}
// Get all mesh // Get all mesh
// For each mesh, get all entities(ES) that have a transform and that mesh // For each mesh, get all entities(ES) that have a transform and that mesh
// For e in ES: add e's transform component to a list // For e in ES: add e's transform component to a list