How pargame/metal-cube works
Metal Cube is a C++/metal-cpp macOS app that animates and presents a rotating 3D cube. Its main workflow is native window/view setup, per-frame world-state advancement, camera projection, GPU rendering, and presentation. The graph follows the README’s rendering stages and the sampled Renderer code; app-to-renderer wiring is documented, but the app source and several subsystems were not excerpted, so those links cite the README. The vendored metal-cpp bindings are represented as an API layer, not as separately mapped application features.
Main entry points: Renderer.hpp Cube renderer · metal_rotating_cube.cpp Frame loop delegate · World.hpp World simulation · MTKView.hpp Window and view
Components 13
App lifecycle
- Native app setup
metal_rotating_cube.cpp - Window and view
metal-cpp-extensions/MetalKit/MTKView.hpp - Frame loop delegate
metal_rotating_cube.cpp
Scene and projection
- Cube geometry
include/World.hpp - World simulation
include/World.hpp - Matrix operations
include/Math3D.hpp - Camera projection
include/Observer.hpp
Rendering pipeline
- Vertex and fragment shaders
include/Shaders.hpp - Cube renderer
include/Renderer.hpp
Apple API bindings
- Metal API bindings
metal-cpp/Metal/MTLRenderCommandEncoder.hpp
Other components
- User
- Apple graphics platform
- Rendered window
Connections 17
- User → Native app setup: launches
README.md - Native app setup → Window and view: initializes
README.md - Native app setup → Frame loop delegate: sets up
README.md - Frame loop delegate → World simulation: advances
README.md - World simulation → Cube geometry: transforms
README.md - World simulation → Matrix operations: uses matrices
include/World.hpp - Frame loop delegate → Cube renderer: renders frame
README.md - Frame loop delegate → Camera projection: supplies camera
README.md - Cube renderer → World simulation: reads state
README.md - Cube renderer → Camera projection: projects through
README.md - Cube renderer → Cube geometry: draws geometry
README.md - Cube renderer → Vertex and fragment shaders: configures pipeline
README.md - Cube renderer → Metal API bindings: encodes commands
- Metal API bindings → Apple graphics platform: calls
- Window and view → Cube renderer: requests frames
- Cube renderer → Rendered window: presents frame
README.md - User → Rendered window: views output
README.md