Expand description
The client’s render layer. The backend-agnostic render-prep helpers (record
builders, render graph, trait seam, CPU-side render math, plus the GPU-free
cursor / sprite / text / lights / streaming layout helpers) now live in
concinnity-render and are re-exported below under the historical
crate::gfx::<module> paths so the rest of the client and the device backends
keep resolving. What remains declared here are the game/runtime render systems
(the renderer driver, animation, camera controllers, draw list) and the
client-only settings/quality-preset resolution.
The GPU data layouts and render math (camera, frustum, post-process settings)
and the CPU kernels over them (mesh payloads, pose blending, IK, line
expansion, the animation cursor) both live in concinnity-core, re-exported
here so the crate::gfx::<module> paths keep resolving. pub so the editor
crate can reach them through concinnity_engine::gfx::* (e.g. shader-layout
reflection); chunk_coord is named only by the chunk-streaming drive, so it
stays crate-private.
Modules§
- anim_
graph - The animation state machine: what an
AnimationGraphasset compiles into, the blendspace members a state can play, and the cursor that walks it. - animation
- Skeletal animation playback. Internal system, constructed by
World::startwhen the world declares anyAnimation; produces per-frame skinning matrices.pubso the editor crate can drive the clip hot-reload through theAnimationSystemsetter API. - auto_
exposure - Auto-exposure: the tunables the post-process config resolves into, the luminance histogram the backends measure a frame with, and the running EMA that turns that measurement into the next frame’s exposure.
- backend
- RenderBackend trait: the union of methods every graphics backend implements, dispatched dynamically by GraphicsSystem so the per-frame step + setup logic lives in one cfg-free copy instead of three.
- backend_
init - Grouped construction inputs for the render backends, plus the requirements
derivation that trims scene-scoped features when a world has no 3D content.
GraphicsSystem init assembles a
BackendInitfrom the drained world assets, callsresolve_requirements(), and hands it to the backend constructor selected at compile time (Metal / DirectX / Vulkan). Every backend receives the same struct; each reads the fields its feature set consumes. - camera
- Pure math for a right-handed first-person camera. All functions are stateless – callers own position, yaw, and pitch directly (e.g. on Camera3D) and pass them in as needed.
- camera_
controller - First-person / fly-through camera controller. Internal system, constructed by
World::startfrom aCamera3D’s controller settings.pubso the editor crate can zero the controller’s velocity behind an externally driven pose. - decal
- Backend-agnostic decal helpers. Owns the per-decal model / inverse-model
matrix math the projected-decal pass needs at runtime, plus the
DecalRecordthe backends consume. Decals are stamped onto the scene depth buffer by drawing a unit-box volume per decal: the fragment shader reconstructs the world-space point of each rasterised pixel from depth and tests whether it lies inside the box. - draw_
preview - Live reassignment of a running world’s draw slots (their material and cull distance), for an editor previewing a Prop edit without a rebuild.
- draw_
slot - Free-list allocator for backend draw-object slots. A backend appends draw
objects into a single
Vecand stores raw indices into it on each entity’s RenderHandle, so a despawned object’s slot cannot be compacted away without invalidating every later index. Instead the allocator hands out a vacated slot before growing the vec:retirepushes a freed index, the next runtime spawn pops it. Streamed chunks were the first consumer (one freed chunk’s slot reused by the next); runtime entity spawn/despawn is the second. All three backends (Metal, DirectX, Vulkan) route their draw-slot allocation through this. - error
- The typed error vocabulary of the
RenderBackendboundary. Backends map their native failure codes (VkResult, HRESULT, MTLCommandBuffer status) into these classes at the detection sites; the frame loop dispatches recovery policy on the class, never on prose.Othercarries legacy string errors so interior call sites can migrate incrementally. - feedback
- The render half’s per-frame report back to the simulation: the sampled
window input, the frame’s render stats, what the snapshot’s op replay
produced, and the consumed snapshot returned for buffer reuse. The
counterpart of
RenderSnapshoton the pipelined driver’s return channel. - font
- Per-glyph metrics of a compiled font atlas: where a glyph sits in the atlas texture and how the pen moves across it. Shared by the build-time rasteriser that writes the payload, the decoder that reads it back, and the text layout that turns it into quads, none of which owns the layout.
- frustum
- Backend-agnostic frustum culling.
- graphics_
system - The renderer driver. An internal system (not a declarable asset), constructed
by
World::startwhen the world declares aGraphicsConfig. - ik
- Analytic two-bone inverse kinematics: bend a root-mid-end joint chain (a
leg or an arm) so the end joint lands on a target, with a pole vector
picking the bend side. Operates on the sampled local pose matrices after
blending and before
skinning_matrices, so the solve composes with any animation. Pure math, no ECS or backend types. - input
- Backend-agnostic input snapshot returned by RenderBackend::take_input. Each backend was previously carrying its own structurally-identical InputState; this single type replaces those duplicates.
- lighting_
preview - Live application of the world’s lighting assets to a running world, for an editor previewing sun / fog / shadow / post-process edits without a rebuild.
- lines
- The world-space line segment any system can submit for a frame: a trajectory arc, a tether or beam, a patrol path, the editor’s origin axes. Lines are scene geometry, not overlay, so the depth-tested pass occludes them behind whatever is in front of them.
- lod
- Level of detail: baking the alternate index lists a mesh is drawn from, and picking between them per draw.
- mesh_
payload - Canonical vertex type and the binary serialisation format shared between the build step (build_mesh.rs writes) and GraphicsSystem (reads).
- mesh_
seed - Shrinkable seed VRAM: planning + buffer compaction for streamed mesh geometry.
- morph_
weights - Composition of a pose’s static morph base layer with the weights a clip samples each frame.
- ops
- Recorded backend effects: simulation systems queue their GPU mutations as ops instead of calling the backend directly, and the submit path replays them in record order before the frame’s draw. Ordering across systems is preserved by the single queue, so the GPU-visible result matches the old direct calls exactly. Ops own their payloads, so a queue can cross a thread boundary with the snapshot that carries it.
- particles
- Backend-agnostic resolution of
ParticleEmittercomponents into theParticleEmitterRecords the backends consume. Each record carries the clamped emitter tunables, the resolved texture pool slot, and the per-frame uniform builder the GPU compute + render passes share. Pure CPU; the per-emitter GPU buffers themselves are allocated by the backend at init. - pose_
blend - Pose blending: combining several sampled poses into one set of local joint matrices. The blend runs in TRS space, the same interpolation a single clip uses between keyframes, so a blended pose is continuous with a clip’s own sampling.
- pose_
scratch - Reusable per-target scratch buffers for the pose sampling chain.
- profile
- Per-frame profiling data. Backend-agnostic:
World::steprecords each system’s CPU step time here, the active render backend writes its draw / GPU stats here, andStatHudreads it back to drive the on-screen HUD. The debug server’sprofilecommand also reports it for headless verification. - proportions
- Per-joint proportion changes applied to a posed skeleton: a uniform scale on a joint’s local matrix and a length offset pushing its children along the bone. The bind pose and inverse bind matrices stay as authored, so the change rides under every clip sampled on the skeleton.
- render_
types - Shared GPU data types used by all rendering backends. Defined here (no #cfg gate) so a future Vulkan backend can import them without pulling in Metal-specific code. metal.rs imports from this module rather than defining its own copies.
- root_
motion - Root-motion track: the character-displacement curve stripped out of a clip’s root joint at build time. The pose keeps the root anchored in place; the runtime samples this track’s frame-to-frame delta instead and feeds it to whatever moves the character (a physics capsule, or the mesh transform directly). Pure math, unit-tested here.
- rt_
reflections - Hardware ray-traced reflection configuration. Backend-agnostic resolve of the
authored
PostProcessConfigfields into clamped settings, plus the per-frame GPU uniform. The acceleration-structure build and the inline ray-trace itself live in the backend (Metal); this module owns only the parameter math so it can be unit-tested without a GPU. - scene_
flow - Platform-agnostic active-scene state and transition logic. Scenes are pure content groupings; changes are imperative jumps (UI actions, Behaviors), so this module tracks only which scene is active and drives fade transitions. The SceneControl trait decouples this module from any specific backend; callers supply a concrete backend that implements the two mutation methods.
- scene_
residency - Scene residency bookkeeping: which scenes are pinned (their streamed
content wanted on the GPU), which of each scene’s members are currently
resident, and the derived per-scene load state and progress. Pure
bookkeeping against
core+alloconly, like the streaming policy core: the driver applies pin changes to the stream planners as blocked flags and reports residency transitions back here. - shape_
preview - Live re-resolution of a
CharacterShapeagainst a running world’s poses, for an editor previewing slider edits without a rebuild. - skeleton
- The skeletal-animation vocabulary: a joint hierarchy with its bind pose, the keyframe tracks a clip animates it with, and the sampling that turns a clip time into one local matrix per joint.
- snapshot
- The owned per-frame snapshot the extraction phase fills from world state and the submission phase consumes. Self-contained by construction: no borrows into component storage, resources, or the backend, so a frame’s draw inputs can outlive the world borrow that produced them and later cross a thread boundary. Buffers keep their capacity across frames; a steady-state extraction allocates nothing.
- ssao
- Screen-space ambient occlusion (GTAO) configuration. Backend-agnostic
resolve of the authored
PostProcessConfigSSAO fields into clamped settings, plus the per-frame GPU uniform. The horizon-search arc integral itself lives in each backend’s shader; this module owns only the parameter math so it can be unit-tested without a GPU. - ssgi
- Screen-space global illumination (SSGI) configuration. Backend-agnostic
resolve of the authored
PostProcessConfigSSGI fields into clamped settings, plus the per-frame GPU uniform. SSGI is a refinement of SSR: it reuses the same depth + normal pre-pass G-buffer and screen-space ray-march, but integrates bounced radiance over a cosine-weighted hemisphere instead of along a single reflection vector, and adds the result on top of the IBL ambient term. The hemisphere gather itself lives in each backend’s shader; this module owns only the parameter math so it can be unit-tested without a GPU. - ssr
- Screen-space reflection (SSR) configuration. Backend-agnostic resolve of the
authored
PostProcessConfigSSR fields into clamped settings, plus the per-frame GPU uniform. The screen-space ray-march itself lives in each backend’s shader; this module owns only the parameter math so it can be unit-tested without a GPU. - streaming_
system - Asset-streaming drive (texture / mesh / voxel-world chunk pools) + the
camera-relative view publish. Internal system, constructed alongside
GraphicsSystem (same gate) and scheduled immediately before it.
pubso the editor’s debug server can nameStreamingStats(its state lives in the parkedStreamingStateresource, read viaWorld::streaming_stats). - transform
- The engine’s transform convention, in one place: the column-major 4x4 layout
every renderer uniform is written in, the multiply and the two inverses over
it, the
T * R(YXZ) * Scomposition joints and props both build their matrix through, and the quaternion conversions that let a rotation be interpolated along the shorter arc rather than component-wise through its Euler angles. - transform_
propagation - Resolving each entity’s world matrix from its Transform and its Parent chain, and writing the result back to its GlobalTransform. A host with a renderer runs this every frame before it builds a draw list.
- view_
modes - Viewport view-mode and show-flag state: backend-agnostic per-frame render selection. The mode picks what the final image shows (the lit scene, a flat shading, or one G-buffer channel); the flags switch individual feature passes off for the frame without touching their resources. Consumed by the render graph (masking pass gates) and each backend’s composite.
- volumetric_
fog - Backend-agnostic resolution of the authored
VolumetricFogasset into a clamped settings struct plus the per-frameFogParamsuniform the Metal fog fragment shader consumes. Pure CPU; unit-testable without a GPU.