novolis-rendering / design-two-d.md
2D rendering (`Novolis.Rendering.TwoD`)
Compile-time friendly rendering
dotnetgraphicsrenderingnovolis
Orthographic 2D renderer for platformers (Mario-style): backgrounds, sprite animation, static polygons with colliders, HUD, and menus.
Packages
| Package | Role |
|---|---|
| `Novolis.Rendering.TwoD` | Host-neutral scene, collision, HUD, menus |
| `Novolis.Rendering.Backends.TwoD.Silk` | Silk.NET OpenGL draw + window loop + PNG load |
Path tracing packages (Novolis.Rendering.Runtime, Backends.Cpu, etc.) stay separate. Apps can use both stacks if needed.
Conventions
- World space: BCL
Vector3on the XZ plane (Y = 0). - Screen HUD/menus: pixel coordinates, origin top-left.
- No
Vector2in public API.
Mario-style checklist
| Feature | API |
|---|---|
| Background image | `TwoDScenePrimitives.AddBackground` + `SilkTwoDPngLoader` |
| Character animation | `TwoDAnimatedSprite` + `TwoDAnimationClip.FromRow` |
| Platforms / blocks | `TwoDScene.AddPlatform` or `TwoDStaticPolygon` |
| Collision | `TwoDCollisionWorld.MoveCircle` |
| HUD | `TwoDHud.AddText` / `AddSprite` |
| Menus | `TwoDMenuStack.Push` + `SilkTwoDGame` menu keys |
Layered grid export
TwoDSceneGridRasterizer / TwoDScene.ToLayeredGrids() produce per-TwoDDrawLayer DenseGrid<Rgba32> buffers for unit tests and ASCII debug (TwoDLayerGridSet.ToAscii). No Silk/OpenGL required.
Related
- design.md — path tracing stack
- gameengine-2d-scene-rendering.md — historical Raylib placement note