Expand description
The demo’s render bridge: an asset server over entities in the render sub-world.
unlit3dx leaves the render bridge to its callers; this module is the
demo’s own, built on the runtime’s core and on unlit3d’s generic
MeshSource registry. It is a template for a caller’s bridge: register a
pipeline family and allocate through the mesh source, and the world is the
same registry either way.
The server helpers follow one rule: the world is the registry. A mesh or
a material is allocated inside the render world and left there as the
GpuMesh or GpuMaterial component of its own asset entity — the
GPU handles inside carry Rc, so they cannot cross a thread, but the
entity can. A simulation world builds through a job that names the assets
by entity, or asks for an entity it does not have yet with a
Pending: the answer comes back under the
key the request was asked under, and the next job names it.
Re-exports§
use glam::Affine3A;🔒use glam::Vec3;🔒use unlit_ecs::Bundle;🔒use unlit_ecs::DynamicBundle;🔒use unlit_ecs::Entity;🔒use unlit_ecs::Scope;🔒use unlit_ecs::World;🔒use unlit_wgpu::pipeline::LitOptions;🔒use unlit3d::bounds::FrustumPlanes;🔒use unlit3d::components::Camera;🔒use unlit3d::components::GpuMaterial;🔒use unlit3d::components::GpuMesh;🔒use unlit3d::components::GpuRenderPipeline;🔒use unlit3d::components::InstanceVisibility;🔒use unlit3d::components::Transform;🔒use unlit3d::culling::is_culled;🔒use unlit3d::lit::LitMeshDesc;🔒use unlit3d::lit::LitPipelineKey;🔒use unlit3d::mesh_source::MeshSource;🔒use unlit3d::source::Source;🔒use unlit_ecs::bundle;🔒use unlit3dx::job::Job;🔒
Structs§
- Ball
Instance - One ball and the render instance that stands for it.
- Owned
LitMesh Desc - A mesh description that owns its vertex data, so it can cross a thread
inside a job;
LitMeshDescis what the render world finally sees. - Render
Entity - An entity of the render sub-world.
- Rendered 🔒
- One thing the render world draws: a mesh, the material bound to it, the pipeline that draws it and where it stands.
Constants§
- FACES 🔒
- The unit right and up axes for each cuboid face, with the face’s outward normal, so the six faces share one loop.
- WHITE_
COLOR - The opaque white every generated mesh vertex carries; materials tint via textures, so the geometry itself stays colorless.
Functions§
- allocate_
material 🔒 - Allocate one material in the render world from a texture built on its device, and answer its asset entity.
- allocate_
mesh 🔒 - Allocate a mesh in the render world, answering its asset entity.
- allocate_
rgba_ 🔒material - Allocate a material over the RGBA image
pixels, answering its asset entity. - camera_
looking_ at - A camera at
eyelooking attarget, with a reverse-z infinite perspective offov_y_radiansfitted tosize. - cuboid_
mesh - An axis-aligned cuboid from its half extents: 24 vertices (four per face, so each face has clean uvs) and 36 indices, wound CCW as seen from outside.
- despawn_
instances_ 🔒job - A job that despawns the instances it names.
- hidden_
instance_ 🔒of - Spawn one rendered instance that starts hidden, until its body is ready.
- instance_
of 🔒 - Spawn one rendered instance from asset entities, answering the new entity.
- linear_
sampler - The sampler most textured materials want: linear filtering keeps flat colors clean under minification.
- mesh_
source 🔒 - The render world’s mesh source and the pipeline key its server jobs use.
- rgba_
texture - A texture of
size.0bysize.1RGBA pixels. - show 🔒
- Show one instance: point it at a mesh and material, place it, and make it visible.
- sweep 🔒
- Retire the instances the camera cannot see: despawn each one and answer with the ones that went, each naming the ball it stood for.
- uv_
sphere - A lat-long sphere: positions, uvs, opaque white colors and indices.