# dante-leoncini/whisk3d-editor architecture

> Architecture diagram of the GitHub repository dante-leoncini/whisk3d-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dante-leoncini/whisk3d-editor
- Repository: https://github.com/dante-leoncini/whisk3d-editor

## Overview

#### Purpose and entry points
Whisk3D is a pre-alpha, native cross-platform retro 2D/3D creation environment: modeling, animation, rendering, and game development on constrained hardware. The desktop/native application starts in `main/app/main.cpp`, with application construction and UI initialization split through `main/app/constructor.cpp` and `main/app/W3dInitUI.cpp`. The root build graph is CMake-driven (`CMakeLists.txt`).

#### Application shell and scene state
The app layer owns startup, global interaction wiring, docking, controls, and editor state. `main/W3dEscena.h` / `main/W3dEscena.cpp` appear to define the central scene/editor context, while `main/app/W3dDock.cpp` manages dockable workspace structure. This is the boundary between platform event delivery and the editor/runtime subsystems.

#### Scene, object, and editing model
`main/objects/Scene.cpp` and `main/objects/Collection.cpp` organize scene content; concrete object capabilities include cameras, curves, instances, LOD, particles, mirrors, primitives, and 2D UI elements. Editing is mode-specific: mesh edits are in `main/edit/MeshEdit.cpp`, skeletal work in `main/edit/BoneEdit.cpp`, and painting in `main/edit/WeightPaint.cpp`. Undo is a separate cross-cutting command/history layer in `main/undo/Undo.cpp`.

#### Editor workspace and input flow
The editor is composed of specialized viewports/panels rather than a web UI. `main/ui/ViewPorts/ViewPorts.cpp` coordinates workspace views, `main/ui/ViewPorts/ViewPort3D.cpp` provides the 3D editing surface, and `main/ui/ViewPorts/Outliner.cpp` exposes scene hierarchy. Input and picking pass from application controls into viewport interaction (`main/app/controles.cpp`, `main/ui/ViewPorts/Pick3D.cpp`), then mutate the scene/edit model, typically under undo control.

#### Rendering and asset presentation
The render subsystem consumes scene/object state and draws the 3D workspace plus editor overlays. Its main boundary is `main/render/render.cpp`, with render settings in `main/render/OpcionesRender.cpp` and UI composition in `main/render/UIOverlay.cpp`. Texture, font, skin-atlas, and video resources are handled as asset-format/runtime services under `main/io/Textura2D.cpp`, `main/io/Fuente2D.cpp`, and `main/io/SkinAtlas.cpp`; shipped UI skin resources reside in `res/Skins/Whisk3D/`.

#### Project I/O, interchange, and game output
Whisk3D has a native project/container format plus import/export boundaries. Native loading/saving is centered on `main/importers/import_w3d.cpp`, `main/io/GuardarW3D.cpp`, and `main/io/W3dContenedor.cpp`. Interchange supports OBJ, glTF, and FBX through `main/importers/import_obj.cpp`, `main/importers/import_gltf.cpp`, and `main/importers/import_fbx.cpp`, with glTF export at `main/importers/export_gltf.cpp`. Game compilation is a distinct output path in `main/io/CompilarJuego.cpp`.

#### Scripting and runtime simulation
Embedded Lua supports game behavior and compilation. `main/script/W3dScript.cpp` hosts scripting, `main/script/BindsJuego.cpp` exposes game bindings, and `main/script/SimJuego.cpp` runs game simulation. Lua is vendored in `thirdparty/lua/`; this separates authoring-time scene editing from executable game logic.

#### Platforms and infrastructure
The core is C++/CMake with SDL2 (`thirdparty/SDL2`) and OpenGL-family platform shims. Platform packaging/adaptation lives under `platform/`: Android uses Gradle plus JNI (`platform/android/app/build.gradle`, `platform/android/jni/Android.mk`); Web uses a WebGL-oriented build script (`platform/web/build_web.sh`); Linux, Windows, and macOS have dedicated build/package paths. No backend, account, or network service is indicated; projects and assets are local files.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_app_entry["Native app entry<br/>C++ entry point<br/>[main.cpp]"]
  node_app_init["App construction &amp; UI init<br/>application bootstrap<br/>[constructor.cpp]"]
  node_scene_context["Scene editor context<br/>editor state<br/>[W3dEscena.cpp]"]
  node_docking["Dockable workspace<br/>UI layout<br/>[W3dDock.cpp]"]
  node_controls["Controls &amp; input<br/>interaction layer<br/>[controles.cpp]"]
end

subgraph group_editor["Editor &amp; Scene"]
  node_scene_model["Scene &amp; collections<br/>scene model<br/>[Scene.cpp]"]
  node_edit_modes["Mesh editing<br/>editing mode<br/>[MeshEdit.cpp]"]
  node_undo["Undo history<br/>command history<br/>[Undo.cpp]"]
  node_viewports["Viewport workspace<br/>editor views<br/>[ViewPorts.cpp]"]
  node_picking["3D picking<br/>viewport interaction<br/>[Pick3D.cpp]"]
end

subgraph group_render["Rendering &amp; Assets"]
  node_renderer["Renderer<br/>render subsystem<br/>[render.cpp]"]
  node_render_overlay["Render settings &amp; overlay<br/>render UI<br/>[UIOverlay.cpp]"]
  node_assets["2D assets &amp; skins<br/>asset runtime<br/>[Textura2D.cpp]"]
end

subgraph group_io["Project I/O &amp; Output"]
  node_project_io[("Native project I/O<br/>project persistence<br/>[import_w3d.cpp]")]
  node_interchange["OBJ / glTF / FBX interchange<br/>import/export<br/>[import_gltf.cpp]"]
  node_game_compile["Game compilation<br/>game output<br/>[CompilarJuego.cpp]"]
end

subgraph group_runtime["Game Runtime"]
  node_scripting["Lua scripting host<br/>embedded scripting<br/>[W3dScript.cpp]"]
  node_simulation["Game simulation &amp; bindings<br/>runtime simulation<br/>[SimJuego.cpp]"]
  node_lua["Vendored Lua<br/>third-party runtime"]
end

subgraph group_platform["Build &amp; Platforms"]
  node_cmake["CMake build graph<br/>build system<br/>[CMakeLists.txt]"]
  node_android["Android JNI package<br/>platform target<br/>[Android.mk]"]
  node_web["Web build target<br/>platform target<br/>[build_web.sh]"]
end

node_cmake -->|"builds"| node_app_entry
node_app_entry -->|"initializes"| node_app_init
node_app_init -->|"creates"| node_scene_context
node_app_init -->|"sets up"| node_docking
node_scene_context -->|"owns editor state"| node_scene_model
node_controls -->|"routes input"| node_picking
node_picking -->|"drives selection and edits"| node_edit_modes
node_edit_modes -->|"mutates"| node_scene_model
node_edit_modes -->|"records commands"| node_undo
node_viewports -->|"presents"| node_scene_model
node_viewports -->|"requests drawing"| node_renderer
node_renderer -->|"renders"| node_scene_model
node_renderer -->|"composes"| node_render_overlay
node_renderer -->|"uses"| node_assets
node_project_io -->|"loads and saves"| node_scene_model
node_interchange -->|"imports and exports"| node_scene_model
node_game_compile -->|"packages authored content"| node_scene_model
node_scripting -->|"embeds"| node_lua
node_simulation -->|"executes behavior through"| node_scripting
node_game_compile -->|"produces runtime output"| node_simulation
node_android -.->|"adapts native build"| node_cmake
node_web -.->|"builds for WebGL"| node_cmake

click node_cmake "https://github.com/dante-leoncini/whisk3d-editor/blob/main/CMakeLists.txt"
click node_app_entry "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/main.cpp"
click node_app_init "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/constructor.cpp"
click node_scene_context "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/W3dEscena.cpp"
click node_docking "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/W3dDock.cpp"
click node_controls "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/controles.cpp"
click node_scene_model "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/objects/Scene.cpp"
click node_edit_modes "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/edit/MeshEdit.cpp"
click node_undo "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/undo/Undo.cpp"
click node_viewports "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/ui/ViewPorts/ViewPorts.cpp"
click node_picking "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/ui/ViewPorts/Pick3D.cpp"
click node_renderer "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/render/render.cpp"
click node_render_overlay "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/render/UIOverlay.cpp"
click node_assets "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/io/Textura2D.cpp"
click node_project_io "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/importers/import_w3d.cpp"
click node_interchange "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/importers/import_gltf.cpp"
click node_game_compile "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/io/CompilarJuego.cpp"
click node_scripting "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/script/W3dScript.cpp"
click node_simulation "https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/script/SimJuego.cpp"
click node_android "https://github.com/dante-leoncini/whisk3d-editor/blob/main/platform/android/jni/Android.mk"
click node_web "https://github.com/dante-leoncini/whisk3d-editor/blob/main/platform/web/build_web.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_entry,node_app_init,node_scene_context,node_docking,node_controls toneBlue
class node_scene_model,node_edit_modes,node_undo,node_viewports,node_picking toneAmber
class node_renderer,node_render_overlay,node_assets toneMint
class node_project_io,node_interchange,node_game_compile toneRose
class node_scripting,node_simulation,node_lua toneIndigo
class node_cmake,node_android,node_web toneTeal
```

## Components

### Application Shell

- [Native app entry](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/main.cpp): C++ entry point · `main/app/main.cpp`
- [App construction & UI init](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/constructor.cpp): application bootstrap · `main/app/constructor.cpp`
- [Scene editor context](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/W3dEscena.cpp): editor state · Central scene and editor context. · `main/W3dEscena.cpp`
- [Dockable workspace](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/W3dDock.cpp): UI layout · `main/app/W3dDock.cpp`
- [Controls & input](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/app/controles.cpp): interaction layer · `main/app/controles.cpp`

### Editor & Scene

- [Scene & collections](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/objects/Scene.cpp): scene model · `main/objects/Scene.cpp`
- [Mesh editing](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/edit/MeshEdit.cpp): editing mode · Mode-specific editing also includes bones and weight painting. · `main/edit/MeshEdit.cpp`
- [Undo history](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/undo/Undo.cpp): command history · `main/undo/Undo.cpp`
- [Viewport workspace](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/ui/ViewPorts/ViewPorts.cpp): editor views · `main/ui/ViewPorts/ViewPorts.cpp`
- [3D picking](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/ui/ViewPorts/Pick3D.cpp): viewport interaction · `main/ui/ViewPorts/Pick3D.cpp`

### Rendering & Assets

- [Renderer](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/render/render.cpp): render subsystem · Draws the 3D workspace and editor overlays. · `main/render/render.cpp`
- [Render settings & overlay](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/render/UIOverlay.cpp): render UI · `main/render/UIOverlay.cpp`
- [2D assets & skins](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/io/Textura2D.cpp): asset runtime · Textures, fonts, atlases, and shipped UI skins. · `main/io/Textura2D.cpp`

### Project I/O & Output

- [Native project I/O](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/importers/import_w3d.cpp): project persistence · Loads and saves the native W3D container. · `main/importers/import_w3d.cpp`
- [OBJ / glTF / FBX interchange](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/importers/import_gltf.cpp): import/export · `main/importers/import_gltf.cpp`
- [Game compilation](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/io/CompilarJuego.cpp): game output · `main/io/CompilarJuego.cpp`

### Game Runtime

- [Lua scripting host](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/script/W3dScript.cpp): embedded scripting · `main/script/W3dScript.cpp`
- [Game simulation & bindings](https://github.com/dante-leoncini/whisk3d-editor/blob/main/main/script/SimJuego.cpp): runtime simulation · `main/script/SimJuego.cpp`
- **Vendored Lua**: third-party runtime

### Build & Platforms

- [CMake build graph](https://github.com/dante-leoncini/whisk3d-editor/blob/main/CMakeLists.txt): build system · `CMakeLists.txt`
- [Android JNI package](https://github.com/dante-leoncini/whisk3d-editor/blob/main/platform/android/jni/Android.mk): platform target · `platform/android/jni/Android.mk`
- [Web build target](https://github.com/dante-leoncini/whisk3d-editor/blob/main/platform/web/build_web.sh): platform target · `platform/web/build_web.sh`

## Connections

- CMake build graph → Native app entry: builds
- Native app entry → App construction & UI init: initializes
- App construction & UI init → Scene editor context: creates
- App construction & UI init → Dockable workspace: sets up
- Scene editor context → Scene & collections: owns editor state
- Controls & input → 3D picking: routes input
- 3D picking → Mesh editing: drives selection and edits
- Mesh editing → Scene & collections: mutates
- Mesh editing → Undo history: records commands
- Viewport workspace → Scene & collections: presents
- Viewport workspace → Renderer: requests drawing
- Renderer → Scene & collections: renders
- Renderer → Render settings & overlay: composes
- Renderer → 2D assets & skins: uses
- Native project I/O → Scene & collections: loads and saves
- OBJ / glTF / FBX interchange → Scene & collections: imports and exports
- Game compilation → Scene & collections: packages authored content
- Lua scripting host → Vendored Lua: embeds
- Game simulation & bindings → Lua scripting host: executes behavior through
- Game compilation → Game simulation & bindings: produces runtime output
- Android JNI package → CMake build graph: adapts native build
- Web build target → CMake build graph: builds for WebGL
