How jlisowskyy/opengl-rendering-engine works
Project Type & Purpose
• This is a C++ OpenGL rendering engine featuring deferred shading, model loading, real-time lighting (with Blinn-Phong), an IMGUI-based UI, and scene management. Key functionalities include rendering (shaders, lighting, overlays), scene handling (saving/loading configurations), and engine management.
Key Components
a. Core Engine Layer:
• Engine Core: Located in src/libcgp/engine. Contains components such as process_loop, view management, light manager, global lighting, and g_buffer management.
• Window & Input Handling: Under src/libcgp/window, including mouse operations and window management (as well as overlays for debugging).
b. Resource & Scene Management:
• Managers: The object_mgr, resource_mgr, and settings_mgr found in src/libcgp/mgr.
• Scene Serialization: The scene_serializer under src/libcgp/serialization manages saving and loading scene configurations.
• Predefined test scenes and model definitions: Represented in the scenes and models directories.
c. Rendering Pipeline:
• Deferred Shading Pipeline: Implemented via the shaders in src/shaders (e.g., deferred_shading, g_buffer shaders) and integrated in the engine.
• Shader & Mesh Handling: Located in src/libcgp/primitives (shader, mesh, model, texture).
d. UI Layer:
• IMGUI Integration: The engine includes an IMGUI-based editor interface, possibly interacting with both the window components and engine overlays (src/libcgp/window/overlay).
e. External Dependencies & Libraries:
f. Asset Compiler & Resources:
• The asset_compiler directory suggests a pre-build step for processing assets.
• Resources and models directories provide assets for rendered scenes.
Relationships & Data Flow
• The Flow starts from the entry points (main_debug.cpp, main_editor.cpp, main_game.cpp in src/) which initialize the engine.
• The Engine Core interacts with the window management, the resource and object managers, and the deferred shading pipeline.
• The UI components (IMGUI overlays) interact directly with engine settings and runtime modifications (e.g., lighting, world time).
• External dependencies provide foundational capabilities (e.g., GLFW for windowing, GLM for mathematics) and are integrated into the engine’s core via CMake configuration.
• Scene management components (scene_serializer, resource_mgr) facilitate loading/saving and handling of views, which are then rendered via the deferred shading pipeline.
Architectural Patterns & Design Principles
• Modular Structure: The project is separated into distinct modules (engine, managers, primitives, window, serialization) which eases maintenance and upgrades.
• Separation of Concerns: There is a clear distinction between the core engine logic, rendering pipeline, resource management, and the UI.
• Reusability & Extensibility: Having well-defined managers for resources and objects, as well as externalized dependencies, encourages reusability and clean integration of additional features (e.g., new rendering techniques or input methods).