$ show g3n/g3nd
g3nd is the official demo/showcase application for the g3n Go 3D game engine. It is a single Go binary that presents a windowed GUI (built on the engine's own immediate-mode GUI system) with a categorized demo tree. Users select demos that exercise the engine's capabilities: glTF/glb loading, PBR materials, animations (skinning, morph targets), audio (OpenAL), particle systems, post-processing shaders, and GUI widgets (tables, trees, sliders, form boxes, dock layouts). The application registers demos via Go's `init()` side-effect pattern: each demo package imports itself and calls `app.DemoMap["category.name"] = &struct{}{}`. The core `App` struct manages the scene graph, camera, orbit controls, and per-frame `Update` dispatch. The repository also vendors a large set of test assets (glTF sample models, Blender files, audio, textures) under `data/`. The architecture is a classic Go application: `main.go` imports all demo packages for their registration side effects, then delegates to `app.Create().Run()`. The `app` package owns the window, GUI, and demo lifecycle. Each demo implements a minimal `IDemo` interface (`Start`, `Update`, `Cleanup`). The `util` package provides reusable GUI helpers (file selectors, light meshes). The demos are grouped by category: animation, audio, experimental physics, geometry, GUI, light, loader, material, other, shader, texture. The code is idiomatic Go with clean separation, but some demos are marked experimental and the engine dependency is a pseudo-version that may drift.
The LLM identified 5 files worth highlighting for reuse:
Core App struct that owns the window, scene, camera, GUI, and demo registry. Implements the main loop (Update per frame), handles input, and dispatches to the active demo. The DemoMap registration pattern (via init() side effects) is a clean, idiomatic Go plugin pattern that allows demos to be added without modifying core code.
A reusable file selection dialog widget built on the engine's GUI. Demonstrates how to build a modal file browser with directory navigation and file filtering. Self-contained and could be extracted for any Go application needing a file picker.
Loads GUI layout definitions from YAML files (data/gui/*.yaml) and constructs the widget tree programmatically. This is a data-driven UI pattern where the demo scene is described declaratively, making it easy to add new GUI demos without recompiling.
Loads glTF 2.0 assets (including GLB binary format) and displays them. Handles embedded textures, PBR materials, and scene graph construction. Demonstrates the engine's glTF import pipeline and serves as a reference for engine users.
Performance stress test that renders many instances of a mesh to measure draw call overhead and frame rate. Uses the engine's instancing capabilities. Reusable as a benchmark pattern for any 3D engine.