A DirectX-based render pipeline integrated into a game-engine context, utilising single vertex and constant buffers for performance.
Had some issues involving camera movement (which resulted in additional features not present), but a small demo was able to be created to showcase the engine.
In the above example, this was created in just 12 lines of code (excluding spaces and braces which can go on the same line) due to the engine using a structure similar to Unity, with scenes managing entities (GameObjects) and entities managing their own lifetime with OnEnabled, OnDisabled, OnUpdate etc. methods available. This structure ensures that nothing is called before components they rely on are ready.
Charon is multithreaded with rendering and scene managers operating on separate threads (this means that a long render won’t impact on the game loop and vice versa), with thread safety protection in place via
std::mutex to ensure there are no errors.
When a new model is added, the system checks to see if an identical model already exists- this results in a lower memory footprint (though a new model can be forcefully created if we intend to manipulate it later on). The model is then added to the scene and a flag raised that tells the render manager that the buffers require updating.
The buffers (vertex and index) are not updated on each frame or object, instead they are updated when needed, triggered by the aforementioned flag- there is only a single vertex and index buffer for the entire render pipeline, this approach was more difficult to achieve but was well worth the efficiency benefits. The constant buffer is updated when each and every object is rendered, using the WVP (world view projection) matrix created whenever the object’s position, rotation, or scale is updated (again, for efficiency).