# ustc-cg/ustc_cg_24 architecture

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

- Interactive diagram: https://gitdiagram.com/ustc-cg/ustc_cg_24
- Repository: https://github.com/ustc-cg/ustc_cg_24

## Overview

1. Two major frameworks (Framework2D and Framework3D) that seem to act as libraries or reusable components for rendering and interactive assignments.
2. A large number of homework assignments (organized under Homeworks), which make use of these frameworks (and sometimes have their own demos, experiments, and tests).
3. Supporting “Softwares” and documentation directories to help students set up the development environment (e.g., CMake configurations, Git instructions, etc).

##### Main System Components
- Framework3D: A more complex system with several libraries (GCore, RCore, SCore), GUI components (including a node-based editor and USD view engine), and a modular “Nodes” system for 3D graphics. There are clear separations for core components (materials, mesh operations, transformations) and rendering pipelines (render delegate, render passes, and shader modules).
- Homework Assignments: These directories (with multiple assignments, e.g., mini_draw, image_warping, poisson_image_editing, character_animation, etc) are self-contained projects that use the provided frameworks to achieve a range of computer graphics tasks. They are also structured with their own CMake files and sometimes include sample data, documentation, and demos.
- Software and Documentation: Contains supporting material for setting up build environments (CMake, Git, Visual Studio) and guides on using Clang-uml and project conventions.

##### Detail Relationships and Interactions
- Third-party dependencies are integrated at the framework level (both “third_party” and “external”), and the CMake build system ties them together. Diagramming the build configuration flow (from CMakeLists.txt in the root and within each project) can help highlight how components are compiled and linked.

##### Architectural Patterns and Design Principles
- Clear dependency management with CMake: Illustrate how the build and configuration system ties together the various modules and external libraries.

##### Relevant Technologies and Libraries
- C++ as the implementation language, with heavy use of CMake for build configuration.
- OpenGL and shader-based rendering (indirectly indicated via use of GLAD, GLFW, and shader sources in Framework3D).
- ImGui and custom node-editing interfaces in the GUI modules.
- External libraries like Eigen, OpenMesh, stb_image, and various others that provide mathematical, rendering, and utility functions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Framework2D"
        F2D["Framework2D"]:::framework2d
        subgraph "Modules"
            VINC["View Components (Include)"]:::framework2d
            VSRC["View Components (Source)"]:::framework2d
            ASGN["Assignments"]:::framework2d
            DEMO["Demo"]:::framework2d
            TP["Third-party Integrations"]:::framework2d
        end
    end

    subgraph "Framework3D"
        F3D["Framework3D"]:::framework3d
        subgraph "Core Libraries"
            GC["GCore"]:::framework3d
            RC["RCore"]:::framework3d
            SC["SCore"]:::framework3d
        end
        subgraph "GUI and Node System"
            GUI["GUI"]:::framework3d
            ND["Nodes"]:::framework3d
        end
        EXT["External Dependencies"]:::framework3d
    end

    HW["Homework Assignments"]:::homework
    SD["Software and Documentation"]:::software
    CMAKE["CMake Build System"]:::build

    %% Relationships for Framework2D
    F2D -->|"contains"| VINC
    F2D -->|"contains"| VSRC
    F2D -->|"contains"| ASGN
    F2D -->|"contains"| DEMO
    F2D -->|"contains"| TP

    %% Relationships for Framework3D
    F3D -->|"contains"| GC
    F3D -->|"contains"| RC
    F3D -->|"contains"| SC
    F3D -->|"contains"| GUI
    F3D -->|"contains"| ND
    F3D -->|"contains"| EXT

    %% Build system connects components
    CMAKE -->|"builds"| F2D
    CMAKE -->|"builds"| F3D
    CMAKE -->|"builds"| HW
    CMAKE -->|"builds"| SD

    %% Homework dependencies on frameworks
    HW -->|"uses"| F2D
    HW -->|"uses"| F3D

    %% Click Events for Framework2D
    click F2D "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework2D"
    click VINC "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework2D/include/view"
    click VSRC "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework2D/src/view"
    click ASGN "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework2D/src/assignments"
    click DEMO "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework2D/src/demo"
    click TP "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework2D/third_party"

    %% Click Events for Framework3D
    click F3D "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D"
    click GC "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D/include/GCore"
    click RC "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D/include/RCore"
    click SC "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D/include/SCore"
    click GUI "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D/include/GUI"
    click ND "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D/include/Nodes"
    click EXT "https://github.com/ustc-cg/ustc_cg_24/tree/main/Framework3D/external"

    %% Click Events for Homework and Software
    click HW "https://github.com/ustc-cg/ustc_cg_24/tree/main/Homeworks"
    click SD "https://github.com/ustc-cg/ustc_cg_24/tree/main/Softwares"

    %% Styles
    classDef framework2d fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
    classDef framework3d fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef homework fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef software fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef build fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
```
