Render components #23

Open
UnflavoredMeson/Primal_Plus_Plus
opened 2026-11-24 20:15:54 +00:00 by UnflavoredMeson · 0 comments
Owner

Why

The renderer (S6) reads what to draw from ECS components. In the fork it had its own camera, light and render-item objects first, and was converted later. Defining the components now lets the renderer read them from day one.

Decided

  • render::MeshRenderer (geometry content id, materials), the four light components (directional, point, spot, ambient) and render::Camera, in Engine/EngineAPI/RenderComponents.h, reflected.
  • A light belongs to a light set by a key in its component.
  • They are the only way to draw something: no graphics::Camera/graphics::Light handles in the game API. Plain entities may have them; actors' parts (S8) write them.
  • LOD by distance to the surface's camera.

Read first

  • Renderer, sections 3 and 9.
  • Engine/EngineAPI/Camera.h, Light.h, GeometryComponent.h on master (what they replace).

Steps

  • 1. Write the components and reflect them.
  • 2. Write tests that create entities with each and read them back through the reflection registry.
  • 3. Note in Docs/ which fields the renderer will read, for S6-01.

Done when

  • The components are reflected and tested; 0 warnings; tidy 0.

Claude can help with

  • Comparing the field lists with what D3D12's light code reads today.

Learn

  • Why data components plus a reader beat handle-based APIs for a renderer.
## Why The renderer (S6) reads what to draw from ECS components. In the fork it had its own camera, light and render-item objects first, and was converted later. Defining the components now lets the renderer read them from day one. ## Decided - `render::MeshRenderer` (geometry content id, materials), the four light components (directional, point, spot, ambient) and `render::Camera`, in `Engine/EngineAPI/RenderComponents.h`, reflected. - A light belongs to a light set by a key in its component. - They are the only way to draw something: no `graphics::Camera`/`graphics::Light` handles in the game API. Plain entities may have them; actors' parts (S8) write them. - LOD by distance to the surface's camera. ## Read first - [Renderer](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/Renderer), sections 3 and 9. - `Engine/EngineAPI/Camera.h`, `Light.h`, `GeometryComponent.h` on `master` (what they replace). ## Steps - [ ] 1. Write the components and reflect them. - [ ] 2. Write tests that create entities with each and read them back through the reflection registry. - [ ] 3. Note in `Docs/` which fields the renderer will read, for S6-01. ## Done when - [ ] The components are reflected and tested; 0 warnings; tidy 0. ## Claude can help with - Comparing the field lists with what D3D12's light code reads today. ## Learn - Why data components plus a reader beat handle-based APIs for a renderer.
Sign in to join this conversation.
No assignees
No project
Blocks Depends on
#19 Archetype ECS
UnflavoredMeson/Primal_Plus_Plus
#21 Reflection generator PrimalReflectGen
UnflavoredMeson/Primal_Plus_Plus
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
UnflavoredMeson/Primal_Plus_Plus#23
No description provided.