Graphyc Programming
Graphics engine developed from scratch using C++ and OpenGL in collaboration with Daniel de Castro Isasi.
The development of this engine involved using the RAII programming idiom for the classes that make up the project. It includes integrated editing tools with ImGui and a threading system for heavy tasks.
The duration of this project is 9 months from September 2024 to May 2025.
These are the features of the engine:
The engine can render using two different techniques, the forward rendering and the deferred rendering.
On one hand there is the forward rendering which can be lit or unlit where each object in the scene is drawn directly to the screen,
one by one, with lighting effects calculated for each pixel of that object in a single pass.
On the other hand, we have the deferred rendering.
This is a screen-space lighting technique in 3D computer graphics that separates the rendering process into two phases: geometry and lighting. Using this
we avoid to calculating the lighting of the scene per object and process it per pixel on the screen.
The engine can render three types of lights (point light, spot light and directional light) and blend them. It has the ability to render as much light as your computer is capable of processing.
To cast shadows we used two different techniques: shadow mapping for the directional light and spotlight, and point shadow for the point light.
The shadow map technique renders the scene from the light's point of view to store depth in a texture, then compares fragment depth against it during
rendering to decide if a point is lit or in shadow.
The point shadow technique uses a cube shadow map by rendering the scene from a point light in all six directions,
then compares fragment distance to the stored depth to determine shadowing.
There is a cubemap that serves as a skybox, this was added just for stylistic reasons.
Portals are gateways connected where we have one entry portal and one exit portal and each one renders what the other is seeing so when you are about to go through the portal you can see where you are going to teleport.
The ECS implementation stores each component type in its own contiguous array, indexed by entity ID, with missing components represented using std::optional. A hash map links component type hashes to their respective arrays, keeping all components of the same type grouped together for cache efficiency. When a new entity is created, all component arrays expand to include a slot for it, and when an entity is deleted, its slots are cleared and its ID is queued for reuse, ensuring consistent management of components and entities.
There is a class that streamlines the process of loading, compiling, linking, and using GLSL shaders. It reads the source code of vertex, fragment, and optionally geometry shaders from external files, compiles each one while checking for compilation errors, and then links them into a complete shader program. If any stage fails, it outputs an error message and terminates the program to avoid undefined behavior. Once linked successfully, the shader program can be use and uniforms can be conveniently set.