How ark-tik/proceduralmeshgenerator works
Based on your project’s file tree and README, ProceduralMeshGenerator is a C++-based tool designed to help 3D artists automatically generate multiple variations of a base humanoid model. It leverages several third-party libraries (Assimp for model importing, GLAD/GLFW for OpenGL context and windowing, GLM for mathematical operations, freetype for font handling) and even integrates an immediate-mode GUI via ImGui to possibly allow interactive vertex selection and model adjustments.
Project Type and Purpose
• This is a desktop procedural mesh generation tool with a focus on 3D model manipulation and rendering.
• The expected use-case involves processing 3D models, altering them procedurally (potentially at the level of mesh, body parts, and textures), and rendering these variants for a 3D artist’s review.
• The README and file structure indicate that while it is still a work in progress, the tool already has distinct components for model processing, real-time rendering via OpenGL (using GLFW and GLAD), shader management, camera control, and interaction hooks (like triangle picking for vertex selection).
Core Components
a. Application Core/Engine:
• Application Module: Likely housed in Application.cpp, acting as the entry point, handling the initialization and overall control flow.
• Renderer: Includes Renderer.cpp and Shader*.cpp files, managing the rendering pipeline, shader compilation, and rendering passes.
• Mesh, Model, and BodyPart Modules: Essential for building and manipulating the 3D models; Mesh.cpp, Model.cpp, and BodyPart.cpp represent the procedural generation logic.
• Camera: Manages the viewpoint and projection parameters (see Camera.cpp) for rendering the scene.
• Utility Modules: Including CheckGLErrors (for error handling) and TrianglePicking (for user interaction with 3D geometry).
b. Graphics and Rendering:
• Dependencies for OpenGL initialization: GLAD and GLFW ensure context management.
• Shader System: Represent the shader source files (both vertex and fragment shaders) as key parts of the graphics pipeline.
• Mathematical Library: GLM supplies math operations (vectors, matrices) that underpin transformations, lighting, and camera calculations.
• Image and Texture Loading: stb_image (embedded inside src/expat/stb_image) likely handles texture loading.
c. External and Auxiliary Dependencies:
• Assimp: For importing external 3D models (could be used to load the base humanoid model or parts of it).
• freetype: For handling text outputs (possibly for UI or debugging overlays).
• ImGui: Found under src/expat/imgui, enabling GUI interaction for manipulation and possibly debugging.
• Additional resources and shaders: The “res” and “src/shaders” directories house assets, materials, and shader programs.
Relationships and Interactions
• The Application module initializes the system and orchestrates interactions among the core engine components.
• The Renderer interacts with the Mesh/Model data structures and uses GLAD/GLFW to control the OpenGL rendering context.
• The Camera module sets up view and projection matrices that the Renderer passes to the shaders.
• User interactions (handled by the ImGui interface and TrianglePicking) provide inputs which modify the procedural generation logic—altering body parts and meshes.
• External libraries (Assimp, freetype, GLM) provide additional functionality that integrates directly within these components.
Architectural Patterns and Design Principles
• Layered Architecture: Separate the system into clear layers such as Input/UI, Core Processing & Procedural Generation, Render Engine, and External Library Integration.
• Modular Design: Each component (e.g., Mesh, Renderer, Camera) is encapsulated in its own module, which promotes maintainability and extensibility.
• Separation of Concerns: The use of dedicated shader sources, external dependency structures, and specialized utilities like error-checking fosters a robust design.