BrendonButler / BrendonButler/entropy
[Feature] Implement 2D orthographic renderer
- Dominant language
- Java
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the Feature
A standalone 2D renderer will be created that can work independently of the 3D renderer. This will render screen-space elements such as HUDs, menus, dialog boxes, and other UI components. Ideally this renderer will be combined with the 3D renderer in a compositor/rendering pipeline to create HUD elements for the 3D game. Additionally, it should be able to render an entire 2D game environment (_this is not essential at this moment, but is the goal_).
The renderer will include:
- A `Render2D` class in the `rendering.orthographic` package, responsible for drawing textured quads
- A `Render2DBatch`/`Render2D.Batch`/`RenderBatch2D` interface that defines the structure for render batches
- A `UIRenderBatch` for batching HUD and menu renders
- A `Camera2D` for screen-space projection
- Basic shader support for UI effects (e.g., transparency, color tinting)
This renderer will be invoked by the compositor in the appropriate render stage and should support rendering to both the default framebuffer and custom targets.
### Benefits of the Feature
1. Enables rendering of HUDs and UI elements independently of 3D camera transformations
2. Provides a reusable rendering path for future 2D games
3. Simplifies layout and positioning using screen coordinates
4. Improves performance by avoiding depth testing and complex shaders
5. Establishes a clean separation between 2D and 3D rendering logic
6. Supports modular integration with the compositor and shader manager
### Additional Information
[OpenGL Orthographic Projection Overview](https://learnopengl.com/Getting-started/Coordinate-Systems)
LWJGL Matrix4f `ortho2D` usage: `new Matrix4f().ortho2D(0, windowWidth, windowHeight, 0)`
Consider future integration with NanoVG or custom font/text rendering
Additional batches will need to be made in the future:
| Batch Name | Purpose |
|-------------|---------|
| SpriteRenderBatch | World-space 2D |
| TextRenderBatch | Glyph rendering |
| MeshRenderBatch | 3D models |
Contributor guide
Assessment
This issue has not been assessed yet.