Skip to content

Entities

Entities are the scene objects managed by the EntityManager. All entity types inherit from the CRTP base Entity<T> which provides component attachment, lookup, and lifecycle hooks.

Object

The standard renderable scene object. Created with a name, position, and scale.

cpp
auto* obj = scene->add_entity<Object>(
    "MyObject",
    glm::vec3(0.0f, 1.0f, -5.0f),  // position
    glm::vec3(1.0f)                  // scale
);

obj->add_component<TransformComponent>();
obj->add_component<MeshComponent>()->attach_model("cube");
obj->add_component<ResourceComponent>()->attach_shader("pbr");
obj->add_component<MaterialComponent>();

// Called by RenderSystem at start
obj->start(render_target);

Override update() and fixed_update(float dt) to add per-object logic.

Camera

An entity that provides projection and view data to the render pipeline. Exactly one camera entity with a CameraComponent should exist per scene.

cpp
auto* cam = scene->add_entity<Camera>("MainCamera");
cam->add_component<CameraComponent>(/* fov_degrees */ 60.0f);

GeometryPass iterates all Camera entities each frame and calls camera->update().

Scene

Abstract base for all scenes. Subclass it and implement start() and update().

cpp
class MyScene : public Scene {
public:
    MyScene() : Scene("MyScene") {}
    void start()  override { /* add entities, load resources */ }
    void update() override { /* per-frame logic */ }
};

Scene API

cpp
// Add an entity (returns raw pointer managed by EntityManager)
template <typename T, typename... Args>
T* add_entity(Args&&... args);

// Persistence
void save();   // serializes via SceneSerializer
void load();   // deserializes via SceneSerializer

SceneID     get_id()   const;
std::string get_name() const;

Scenes are registered with SceneManager::add_scene<T>().

Skybox

Represents a cubemap environment rendered as a background.

cpp
auto* skybox = scene->add_entity<Skybox>("Sky");
skybox->cubemap_id = "sky_cube";   // ResourceDescriptorID
skybox->shader_id  = "skybox_shader";
skybox->add_component<MeshComponent>();
skybox->add_component<ResourceComponent>();

SkyboxPass automatically handles rendering all active Skybox entities.

PostProcessing

A full-screen quad entity driven by PostProcessPass. Created automatically by the pass during setup(). You typically do not create it manually.

cpp
// Created by PostProcessPass internally:
auto* pp = EntityManager::get()->add_entity<PostProcessing>("HDR", "shaders::hdr");

Text

A text entity for on-screen or world-space font rendering.

cpp
auto* text = scene->add_entity<Text>("Label", "Hello, World!");
// configure font, size, position via components

TextPass iterates all Text entities and renders glyphs via the font atlas.

Layer / Overlay

Layer and Overlay are thin entity types used to group rendering order. Overlays are rendered on top of all layers.

SceneManager

Owns the list of all registered scenes. Only the first scene in the list is treated as the active scene.

cpp
auto mgr = SceneManager::get();

mgr->add_scene<MyScene>();

Scene* active = mgr->get_active_scene();

Scene Serialization

Scenes can be saved and loaded via SceneSerializer. The serializer writes entity and component state to a file. Register a custom serializer on the scene before calling save() / load():

cpp
scene->set_serializer(create_ref<MySceneSerializer>(scene_ref));
scene->save();
scene->load();

The default SceneSerializer handles all built-in component types automatically.