TazGraph Project v0.1.0
|
TazGraph uses a custom ECS where entities (such as nodes, links, and emptyEntities) are composed of components. Components are plain data-only structures, like TransformComponent
and PollingComponent
.
The ECS is managed by **GECSManager
**, which handles creation, removal, update, and drawing of entities. Entity processing is based on groups (EntityGroups
) for rendering and update.
There are two scenes implemented:
MainMenuScene
Graph
Each scene controls its own logic, similar to a game state system. In the Graph
Scene:
All rendering logic is handled in Graph::draw()
.
GLSL shader programs are loaded and set up using the resource manager. Uniforms (e.g. camera matrix, rotation) are passed before rendering:
Before batching begins, the renderers are prepared. This includes setting up internal buffers and clearing previous frame data.
Entities are grouped and passed to the appropriate renderer via renderBatch. This uses multithreading to fill buffers (meshElements & meshArrays) efficiently.
After batching, each renderer draws its instances and clears its buffers:
Repeat for each renderer (e.g. _LineRenderer, _PlaneModelRenderer, _LightRenderer) in your preferred draw order.
Not all Entity Components can draw with all renderers (e.g. Sprite Component is used to specifically draw for PlaneModelRenderer). The draw function in the component indicates the renderers used:
void draw(size_t v_index,
PlaneModelRenderer
& batch, TazGraphEngine::Window& window) { ... }
Renderers in TazGraph are grouped by the attributes they support, which directly affects the shaders they use. This design makes rendering highly memory-efficient, but each renderer is tailored for a specific use case.
Each renderer sets a fixed number of per-vertex and per-instance attributes. For example, the PlaneColorRenderer
expects shaders with the following layout:
Your GLSL shader must match the expected attribute layout of the renderer you're using.
Currently, the engine includes the following specific renderers:
PlaneColorRenderer
– for flat-colored, instanced 3D planesPlaneModelRenderer
– for textured plane instancesLightRenderer
– for planes with lighting and shadingLineRenderer
– for simple colored lines (typically used for links)To create a new renderer - for example, a textured plane with shading - you need to implement a new renderer class that matches the data layout and rendering logic required for that effect.
In the following folder: TazGraphEngine/Renderers/PlaneRenderers/PlaneLitTextRenderer
use one of the existing renderers as a base, then write glsl shader to match the renderer under TazGraph/Src/Shaders
, implement a draw
function in a component that uses that renderer and then pass that renderer as argument for renderBatch
in Graph::draw()
.
Currently TazGraph has the ability to process txt and python files with a specific format. Developers are able to implement their own processing of files, by creating more functions inside TazGraph/Src/Map