How wisdom-km/mira_new works
Purpose and Entry Points
DirectorDesk is a native C++17 desktop application for creating controllable AI-video storyboards from Markdown scripts, 3D assets, camera presets, and shot links. The executable starts in src/App/main.cpp, constructs the application loop in src/App/Application.cpp, and optionally opens a .ddproj project such as examples/cafe.ddproj.
Application Composition
Application coordinates platform startup, window/render loop, project loading, document state, panels, and asynchronous work. Project-level persistence and cross-document binding are centered in src/App/ProjectFile.cpp and src/App/ProjectBinding.cpp; public application contracts live under include/DirectorDesk/App/.
Script-to-Shot Domain Flow
Markdown is parsed into a structured script document by src/Script/Parser.cpp and maintained by src/Script/Document.cpp. Stable script IDs from src/Script/Ids.cpp provide the boundary for linking visual shots back to source text. This script domain feeds shot association rather than directly driving rendering.
Asset Acquisition and Scene Construction
The asset subsystem imports local OBJ/GLB models through registered loaders (src/Asset/LoaderRegistry.cpp, src/Asset/ObjLoader.cpp, src/Asset/GlbLoader.cpp) into the asset library (src/Asset/Library.cpp). It also manages an official catalog and downloads through the HTTP abstraction: src/Asset/OfficialCatalog.cpp, include/DirectorDesk/Platform/IHttpClient.h, and the curl implementation backends/curl/CurlHttpClient.cpp. Scene state is represented separately by src/Scene/Document.cpp and transforms in src/Scene/Transform.cpp.
Camera, Links, and Storyboard Assembly
Camera authoring is managed through orbit controls and reusable presets in src/Camera/CameraManager.cpp, src/Camera/OrbitCamera.cpp, and src/Camera/Presets.cpp. src/Link/ShotLink.cpp binds script-shot IDs to scene/camera information. The storyboard domain then composes linked shots into board documents and layouts via src/Storyboard/Document.cpp, src/Storyboard/BoardComposer.cpp, and src/Storyboard/Layout.cpp.
UI and Rendering Boundary
ImGui panels expose the workflow: library, script, workspace, and storyboard panels in src/UI/LibraryPanel.cpp, src/UI/ScriptPanel.cpp, and src/UI/WorkspacePanel.cpp. UI and domain code depend on renderer interfaces (include/DirectorDesk/Renderer/IRenderer.h), while concrete graphics/window backends are isolated in backends/bgfx/BgfxRenderer.cpp, backends/glfw/GlfwWindow.cpp, and backends/imgui/ImGuiGlfwBackend.cpp. Mesh and ImGui shaders originate in shaders/mesh/ and shaders/imgui/, compiled by CMake.
Export and Service Extension Points
Storyboard/shot output is exported as PNG through src/Export/ShotExport.cpp and src/Renderer/PngWriter.cpp. AI image/video generation is intentionally interface-driven rather than coupled to a provider: include/DirectorDesk/AI/IImageGenService.h, include/DirectorDesk/AI/IVideoGenService.h, with current mock/null implementations in src/AI/. Background work and UI-safe result handoff use platform workers plus core command/result queues (src/Platform/Worker.cpp, include/DirectorDesk/Core/CommandQueue.h).
Runtime and Delivery
Supported desktop targets are Windows 10/11 and macOS. The build is CMake/vcpkg based (CMakeLists.txt, CMakePresets.json, vcpkg.json), using GLFW, bgfx, ImGui, curl, and shaderc-related shader compilation. Windows packaging is an Inno Setup installer under packaging/windows/DirectorDesk.iss.
Main entry points: Application.cpp Application loop · WorkspacePanel.cpp ImGui workflow panels · ProjectFile.cpp Project persistence · Document.cpp Script document
Components 21
Application
- Desktop entry point
src/App/main.cpp - Application loop · Coordinates projects, panels, rendering, and async work.
src/App/Application.cpp - Project persistence · Loads .ddproj state and binds documents.
src/App/ProjectFile.cpp - ImGui workflow panels · Library, script, workspace, and storyboard editing surfaces.
src/UI/WorkspacePanel.cpp
Authoring Domains
- Script document · Parses Markdown and maintains stable source IDs.
src/Script/Document.cpp - Markdown parser
src/Script/Parser.cpp - Shot links · Associates script IDs with scene and camera state.
src/Link/ShotLink.cpp - Storyboard composer · Composes linked shots into board documents and layouts.
src/Storyboard/BoardComposer.cpp - Camera authoring
src/Camera/CameraManager.cpp
Assets and Scene
- Asset library
src/Asset/Library.cpp - Model importers
src/Asset/LoaderRegistry.cpp - Official asset catalog
src/Asset/OfficialCatalog.cpp - Scene document · Maintains scene objects and transforms.
src/Scene/Document.cpp
Platform and Rendering
- Renderer interface
include/DirectorDesk/Renderer/IRenderer.h - bgfx renderer
backends/bgfx/BgfxRenderer.cpp - GLFW window backend
backends/glfw/GlfwWindow.cpp - Background work queues · Runs work off-thread and returns UI-safe results.
src/Platform/Worker.cpp - HTTP client contract
include/DirectorDesk/Platform/IHttpClient.h - curl HTTP backend
backends/curl/CurlHttpClient.cpp
Export and Services
- PNG shot export
src/Export/ShotExport.cpp - AI generation services · Provider-independent image and video generation extension points.
include/DirectorDesk/AI/IImageGenService.h
Connections 25
- Desktop entry point → Application loop: starts
- Application loop → Project persistence: loads
- Project persistence → Script document: persists
- Project persistence → Scene document: persists
- Project persistence → Storyboard composer: persists
- Markdown parser → Script document: parses into
- Script document → Shot links: stable IDs
- Scene document → Shot links: scene binding
- Camera authoring → Shot links: camera binding
- Shot links → Storyboard composer: linked shots
- Model importers → Asset library: imports models
- Asset library → Scene document: supplies assets
- Official asset catalog → Asset library: acquires assets
- Official asset catalog → HTTP client contract: downloads via
- curl HTTP backend → HTTP client contract: implements
- Application loop → ImGui workflow panels: hosts
- ImGui workflow panels → Script document: edits
- ImGui workflow panels → Scene document: edits
- ImGui workflow panels → Storyboard composer: edits
- ImGui workflow panels → Renderer interface: renders through
- bgfx renderer → Renderer interface: implements
- Application loop → GLFW window backend: creates window
- Application loop → Background work queues: dispatches
- Storyboard composer → PNG shot export: exports shots
- Application loop → AI generation services: invokes