Bunch of changes + fixes

This commit is contained in:
2026-09-26 01:49:45 -07:00
parent e05926ad74
commit b24945ec9d
9 changed files with 40 additions and 19 deletions
+4 -5
View File
@@ -13,18 +13,17 @@ class Scene {
Scene();
~Scene();
// Every entity gets a TagComponent (named `name`) and a TransformComponent.
Entity createEntity(const std::string& name = {});
void destroyEntity(Entity entity);
Entity createCamera(const std::string& name = "Camera");
/** Calls `fn(Entity)` for every live entity. Defined in entity.hpp. */
template <typename Fn>
void forEachEntity(Fn&& fn);
// 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; }
Entity getActiveCamera();
void setActiveCamera(Entity camera);
private:
friend class Entity;
+3 -2
View File
@@ -17,8 +17,9 @@ enum class ClearFlags : u8 {
struct SceneView {
SceneHandle scene = INVALID_HANDLE;
RenderTargetHandle target = INVALID_HANDLE;
Entity camera;
RenderTargetHandle target =
INVALID_HANDLE; // null implies render to swapchain
Entity camera; // null implies use scene's active camera
vec4 viewport{0.0f, 0.0f, 1.0f, 1.0f};