pub struct ProjectionRegistry { /* private fields */ }Expand description
Engine-wide CPU→GPU mesh + material upload service.
Registered into ServiceRegistry during bootstrap.
sync_all() is called once per frame in EngineCore::tick_with_services()
before the scheduler runs agents.
Implementations§
Source§impl ProjectionRegistry
impl ProjectionRegistry
Sourcepub fn new(store: AssetStore) -> Self
pub fn new(store: AssetStore) -> Self
Creates a new ProjectionRegistry backed by the shared AssetStore.
Sourcepub fn sync_all(&self, world: &mut World, device: &dyn GraphicsDevice)
pub fn sync_all(&self, world: &mut World, device: &dyn GraphicsDevice)
Uploads any newly loaded CPU meshes to the GPU and tags their ECS entities.
For each entity that has HandleComponent<Mesh> but not yet
HandleComponent<GpuMesh>:
- Checks whether the UUID is already in
GpuCache(shared across agents). - If not, uploads vertex + index buffers via
device. - Inserts the result into
GpuCache. - Adds
HandleComponent<GpuMesh>to the entity so subsequent frames skip it.
This method is idempotent and safe to call every frame.
Sourcepub fn sync_materials(
&self,
world: &mut World,
device: &dyn GraphicsDevice,
pipeline_system: &dyn PipelineSystem,
)
pub fn sync_materials( &self, world: &mut World, device: &dyn GraphicsDevice, pipeline_system: &dyn PipelineSystem, )
Uploads any newly-needed materials to the GPU and tags their ECS
entities with a HandleComponent<GpuMaterial>.
Runs once per frame in TickPhase::PreExtract, after sync_all
(so every rendered entity already has a HandleComponent<GpuMesh>)
and before RenderFlow projects the world. Idempotent: entities
already carrying a HandleComponent<GpuMaterial> are skipped.
Only entities with a resolved HandleComponent<Box<dyn Material>> are
projected. Each material’s [ShaderVariantKey] is exactly the maps it
declares; the group-2 bind group is built against the matching
pipeline_system.layout(device, LayoutKey::Material, &variant) — the
SAME layout the lit pipeline binds for that variant. There is no
fallback: a mesh entity without any material reference is logged and
skipped, and a material referencing a texture absent from
Assets<CpuTexture> is deferred (a missing decode is logged once it
has clearly stalled — see [MaterialProjector::resolve_texture]).
This call performs no asset loading — the Assets<CpuTexture> sub-store
is populated by the SDK layer that owns the AssetService.
Trait Implementations§
Source§impl Clone for ProjectionRegistry
impl Clone for ProjectionRegistry
Source§fn clone(&self) -> ProjectionRegistry
fn clone(&self) -> ProjectionRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more