How mouadhaikal/vulkan-renderer works
Project Type & Purpose
• Type: A native, cross-platform real-time rendering engine written in C++17, using Vulkan for low-level GPU control.
• Purpose: Load 3D assets, manage scene state, run a render loop with advanced features (normal mapping, MSAA, mipmapping, Blinn-Phong lighting) and expose an interactive GUI layer via ImGui/ImPlot.
File Structure
• Top-level directories:
• / & src/: C++ modules (App, Camera, Renderer, Scene, etc.)
• shaders/: GLSL & SPIR-V shader assets + compile scripts
• assets/: models & textures
• vendor/: external libraries (Assimp, stb_image, ImGui)
• docs/: screenshots & recordings
• Key config/build files: CMakeLists.txt, buildAndRun.sh
• Patterns:
• “App” module orchestrates subsystems
• Scene graph (scene.hpp/cpp) holds Model, Mesh, Material
• Renderer module handles Vulkan setup, swapchain, pipelines
• InputHandler + GUI modules feed into App event loop
• TextureManager abstracts GPU texture uploads
Extract Insights from README
• Core dependencies: Vulkan SDK, GLFW (window + input), Assimp (model loading), stb_image (texture loading), ImGui/ImPlot (GUI).
• Runtime flow:
• Initialization: asset import → GPU resource creation → pipeline setup
• Shutdown: cleanup Vulkan resources
• Features to highlight: docking UI, tangent-space normal mapping, multiple light types, MSAA, mipmapping.
Main Components & Relationships
A. Application Layer
• App (core orchestrator)
• InputHandler ← GLFW
• GUI ← ImGui/ImPlot
• Logger
B. Domain/Scene Layer
• Scene Graph
• Model, Mesh, Material
C. Resource Management
• AssetLoader (Assimp) → Mesh + Material
• TextureManager (stb_image) → GPU textures + mipmaps
• ShaderCompiler (glslc → SPIR-V)
D. Rendering Infrastructure
• Renderer
– Vulkan Instance, Devices, Swapchain
– RenderPass, Framebuffers
– GraphicsPipeline (vertex + fragment shaders)
– CommandBuffers, DescriptorSets
• GPU Hardware
E. External Services & Build
• CMake build system
• Shell scripts (buildAndRun.sh, shaders/compile.sh)
• Platform (Windows, Linux)
• Input flow: User → GLFW → InputHandler → App
• Data flow: Assimp→Scene → Renderer → GPU → Framebuffer
• Control flow: App triggers ResourceManager, Renderer, GUI each frame
• Build flow: GLSL → glslc → SPIR-V → embedded in pipeline
Architectural Patterns
• Layered architecture: Presentation (GUI, Input), Application (App), Domain (Scene/Assets), Infrastructure (Renderer, GPU).
• Resource encapsulation: TextureManager & AssetLoader isolate file I/O and GPU uploads.
• Pipeline abstraction: Renderer module wraps Vulkan boilerplate and exposes renderFrame().