Docs / Getting Started

Prerequisites

Sibling Repositories

These two repos must exist next to mesh-craft/:

Compiler

MeshCraft requires a C++23-capable compiler:

CompilerMinimum Version
GCC13+
Clang16+
MSVC2022 (17.6+)

Build Tools

System Libraries (Linux)

sudo apt install libgles2-mesa-dev libgl-dev libsdl3-dev
ℹ️

The exact packages depend on how CNA resolves SDL3 and OpenGL. SDL3 may also be fetched and built by CNA's own CMakeLists.txt.

Cloning the Repositories

MeshCraft depends on two sibling repositories that must exist next to the mesh-craft directory:

mkdir openeggbert && cd openeggbert

git clone https://github.com/openeggbert/cna
git clone https://github.com/openeggbert/sharp-runtime
git clone https://github.com/openeggbert/mesh-craft

ls
# cna  sharp-runtime  mesh-craft
⚠️
Directory layout is strict

CMakeLists.txt uses add_subdirectory(../cna CNA_dep). If the sibling repos are not at the expected relative paths, the build will fail immediately with a CMake error.

Configuring and Building

cd mesh-craft

# Configure
cmake -S . -B cmake-build-debug

# Build everything: editor + mc3togltf + mc3tomcb (all CPU cores)
ninja -C cmake-build-debug

The first build downloads ImGui, Manifold, and tinyobjloader via CMake's FetchContent. This requires internet access. Subsequent builds use the cached downloads.

ℹ️

If you add new .cpp files after the initial configure, run cmake -S . -B cmake-build-debug -DFETCHCONTENT_UPDATES_DISCONNECTED=ON to re-scan the source tree.

Running the Editor

# Open an empty new scene
./cmake-build-debug/MeshCraft

# Open an existing test scene
./cmake-build-debug/MeshCraft test/house.mc3.xml

# Auto-screenshot mode (exits after ~2 s — useful for CI)
./cmake-build-debug/MeshCraft test/house.mc3.xml --screenshot /tmp/editor.ppm

Keyboard Shortcuts

File Operations

ShortcutAction
Ctrl+NNew scene
Ctrl+OOpen file (in-editor dialog)
Ctrl+SSave
Ctrl+Shift+SSave As
Ctrl+EExport to GLB (via mc3togltf)
F11Save screenshot to screenshot.ppm

Edit Operations

ShortcutAction
Ctrl+ZUndo (up to 20 steps)
Ctrl+YRedo
Ctrl+DDuplicate selection
Ctrl+ASelect all objects (or all children in group)
Ctrl+GGroup selected objects
Ctrl+Shift+GUngroup selected group
Ctrl+X / C / VCut / Copy / Paste
DeleteDelete selected objects
Ctrl+Up / DownReorder selected object among its siblings in hierarchy
Ctrl+Shift+PCopy properties from active object to all selected
PSelect parent of currently selected object

Transform Tools

ShortcutAction
QSelect tool (no gizmo)
GMove (Translate) gizmo
RRotate gizmo
SScale gizmo
Shift (hold while dragging)Vertex snap — snap position to nearest vertex of another object
Ctrl (hold during rotate)Angle snap — lock rotation to 15°/45°/90° increments
Arrow keysNudge selected object ±0.1 units on X/Y axis
Page Up / Page DownNudge selected object ±0.1 units on Z axis

Viewport

ShortcutAction
FFocus camera on selection (reset view if nothing selected)
Alt+WToggle full-scene wireframe overlay
BToggle bounding box display around selected objects
Viewport overlay buttonsClick Front / Top / Right / Perspective icons to snap to preset camera views
Ortho/Persp button (toolbar)Toggle orthographic ↔ perspective projection
World/Local button (toolbar)Toggle gizmo between world-space and local-space axes

Add Primitives

ShortcutAction
F1Add Box
F2Add Sphere
F3Add Cylinder
F4Add Cone
F5Add Plane
Menu: Add → PrimitiveTorus, Capsule, Disk, Grid, Ico-sphere, Extrude, CSG Union/Difference/Intersection

Animation & Tools

ShortcutAction
Ctrl+TToggle timeline panel
SpacePlay / pause animation
KInsert keyframe for selected object at current time
Ctrl+POpen Command Palette (search objects and commands)
MActivate Measurement Tool (click two points to show distance)
F5Enter / exit first-person Walk Mode

Walk Mode Controls (while active)

InputAction
W / A / S / D or Arrow keysMove forward / left / back / right
Mouse moveLook around (yaw + pitch)
CtrlJump
Esc or "Exit Walk Mode" HUD buttonReturn to editor

Camera Controls

InputAction
Middle-mouse dragOrbit
Right-mouse dragPan
Scroll wheelZoom in/out
FFocus on selection (reset view if nothing selected)
Numpad 1Front view (yaw=0°, pitch=0°)
Numpad 3Right view (yaw=90°, pitch=0°)
Numpad 5Back view (yaw=180°, pitch=0°)
Numpad 7Top view (yaw=0°, pitch≈84°)
Numpad 9Bottom view (yaw=0°, pitch≈−84°)

CLI Tools

Both converter tools are built as part of the top-level build (ninja -C cmake-build-debug) and land in cmake-build-debug/:

mc3togltf — Export to glTF/GLB

# Export scene to GLB
./cmake-build-debug/mc3togltf/mc3togltf test/house.mc3.xml /tmp/house.glb

# Export with approximate CSG (children exported as separate meshes)
./cmake-build-debug/mc3togltf/mc3togltf --allow-approximate-csg scene.mc3.xml out.glb
⚠️

By default, any scene containing CSG nodes (<union>, <difference>, <intersection>) causes mc3togltf to exit with an error. Pass --allow-approximate-csg to export children as separate meshes instead (geometrically incorrect but useful for review).

mc3tomcb — Convert to/from MCB Binary

MCB is a compact binary format (.mcb) for fast runtime loading. The converter works in both directions:

# XML → MCB (for runtime use)
./cmake-build-debug/mc3tomcb/mc3tomcb scene.mc3.xml scene.mcb

# MCB → XML (to inspect or edit a binary scene)
./cmake-build-debug/mc3tomcb/mc3tomcb scene.mcb scene.mc3.xml

Running the Tests

ctest --test-dir cmake-build-debug -V

This runs two test suites:

  1. smoke_test — launches the editor with test/house.mc3.xml, takes a screenshot, and verifies the file is ≥ 1 MB.
  2. mc3_roundtrip — 114 XML round-trip checks covering all MC3 field types and animation data.
💡

If the smoke test fails with a display error, set DISPLAY=:0 or use a virtual framebuffer (Xvfb) for headless CI environments.

Next Steps