# dentrix-dev/dentrix_editor architecture

> Architecture diagram of the GitHub repository dentrix-dev/dentrix_editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dentrix-dev/dentrix_editor
- Repository: https://github.com/dentrix-dev/dentrix_editor

## Overview

##### Project type and purpose
- This is a native C++ desktop 3D-model viewer/editor built with Qt for the GUI and OpenGL for rendering.
- The “DentrixCore” directory contains your rendering engine (camera, scene graph, mesh loader, shader manager). “DentrixUI” contains the Qt-based user interface (main window and GL widget). External runtime resources include GLSL shaders and OBJ model files under “shaders/” and “models/”.

##### File structure
- Top level:
- main.cpp – application entry point, initializes Qt, constructs MainWindow and GLWidget
- CMakeLists.txt + cmake/CPM.cmake – build configuration and dependency management
- libs/glm – header-only math library for vectors, matrices, quaternions
- DentrixCore:
- camera.* – camera abstraction
- scene.* – scene graph and object management
- mesh.* – OBJ loader & mesh representation
- shader.* – shader compilation, program management
- DentrixUI:
- mainwindow.* + .ui – Qt Designer UI for menus, controls
- glwidget.* – QOpenGLWidget subclass, bridges Qt’s GL context to DentrixCore renderer
- models/ and shaders/ hold runtime assets loaded by the core engine.

##### README for additional insights
- Build instructions via CMake → make, or use Qt Creator

##### Elements
- “Application Launcher”
- “UI Layer (Qt)”
- “Render Engine (DentrixCore)”
- “GLM Math Library”
- “Runtime Assets”
- “Build System”
- “External Frameworks”
– Input events: UI → Core
– Rendering calls: Core → OpenGL → GPU
– Asset loading: Filesystem → Core
- UI = blue rectangles
- Core engine = green rectangles
- External libs = grey rounded rectangles
- Build system = purple parallelogram
- Labels:

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Launcher
    AL["Application Launcher\n(main.cpp)"]:::core
    click AL "https://github.com/dentrix-dev/dentrix_editor/blob/main/main.cpp"

    %% UI Layer
    subgraph "UI Layer (Qt)"
        MW["MainWindow\n(.h/.cpp/.ui)"]:::ui
        click MW "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixUI/mainwindow.h"
        click MW "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixUI/mainwindow.cpp"
        click MW "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixUI/mainwindow.ui"

        GW["GLWidget\n(.h/.cpp)"]:::ui
        click GW "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixUI/glwidget.h"
        click GW "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixUI/glwidget.cpp"
    end

    %% Core Engine
    subgraph "Render Engine (DentrixCore)"
        CAM["Camera\n(camera.h/.cpp)"]:::core
        click CAM "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/camera.h"
        click CAM "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/camera.cpp"

        SC["Scene Graph\n(scene.h/.cpp)"]:::core
        click SC "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/scene.h"
        click SC "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/scene.cpp"

        MS["Mesh Loader & Representation\n(mesh.h/.cpp)"]:::core
        click MS "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/mesh.h"
        click MS "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/mesh.cpp"

        SH["Shader Manager\n(shader.h/.cpp)"]:::core
        click SH "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/shader.h"
        click SH "https://github.com/dentrix-dev/dentrix_editor/blob/main/DentrixCore/shader.cpp"
    end

    %% External Math Library
    GLM["GLM Math Library\n(libs/glm/)"]:::ext
    click GLM "https://github.com/dentrix-dev/dentrix_editor/tree/main/libs/glm/"

    %% Runtime Assets
    RTM["Models\n(models/)"]:::runtime
    click RTM "https://github.com/dentrix-dev/dentrix_editor/tree/main/models/"
    RTS["Shaders\n(shaders/)"]:::runtime
    click RTS "https://github.com/dentrix-dev/dentrix_editor/tree/main/shaders/"

    %% Build System
    BS["Build System\n(CMakeLists.txt,\ncmake/CPM.cmake)"]:::build
    click BS "https://github.com/dentrix-dev/dentrix_editor/blob/main/CMakeLists.txt"
    click BS "https://github.com/dentrix-dev/dentrix_editor/blob/main/cmake/CPM.cmake"

    %% External Frameworks
    subgraph "External Frameworks/Platforms"
        QT["Qt Framework"]:::framework
        OPENGL["OpenGL"]:::framework
        OS["OS Windowing"]:::framework
    end

    %% Runtime Flow
    AL -->|"initialize QApplication"| MW
    MW -->|"embed GLWidget"| GW
    GW -->|"load OBJ"| MS
    MS -->|"add to Scene"| SC
    GW -->|"call render()"| SH
    SH -->|"draw calls"| OPENGL
    SC -->|"update via Camera"| CAM
    CAM -->|"view/projection matrices\n(via GLM)"| GLM
    RTM -->|"OBJ files"| MS
    RTS -->|"shader files"| SH
    MW -->|"user input events"| CAM

    %% Build-time Dependencies
    BS -->|"compiles"| AL
    BS -->|"compiles"| MW
    BS -->|"compiles"| GW
    BS -->|"compiles"| CAM
    BS -->|"compiles"| SC
    BS -->|"compiles"| MS
    BS -->|"compiles"| SH
    BS -->|"integrates"| GLM
    BS -->|"links"| QT
    BS -->|"links"| OPENGL

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef ext fill:#D3D3D3,stroke:#000
    classDef runtime fill:#FFA500,stroke:#000
    classDef build fill:#DDA0DD,stroke:#000
    classDef framework fill:#FFF,stroke:#000,stroke-dasharray:5 5
```
