Build renderer and material component foundations
Add dedicated skinned rendering, pose restoration, shared Material and Material Instance slots, registry-driven components, Surface/Solari integration, transactional schema upgrades, navigation authoring, documentation, and evaluation evidence.
This commit is contained in:
1 parent
0553a85220
commit
0798aa5d57
169 files changed
+27098
-3469
No files matched your search
@@ -7,6 +7,7 @@ mod models;
|
||||
mod physics;
|
||||
mod prefabs;
|
||||
mod primitives;
|
||||
mod skinned_meshes;
|
||||
mod static_meshes;
|
||||
pub mod strip;
|
||||
mod visibility;
|
||||
@@ -27,6 +28,11 @@ use physics::hydrate_physics;
|
||||
use prefabs::{hydrate_prefabs, tag_hydrated_prefab_members};
|
||||
pub use prefabs::{HydratedPrefabMember, HydratedPrefabReady, PrefabHydrationBlocked};
|
||||
use primitives::{hydrate_primitives, primitive_mesh};
|
||||
pub use skinned_meshes::HydratedSkinnedMeshRoot;
|
||||
use skinned_meshes::{
|
||||
apply_skinned_renderer_material_changes, cleanup_removed_skinned_mesh_renderers,
|
||||
hydrate_skinned_mesh_renderers, mark_skinned_materials_ready,
|
||||
};
|
||||
use static_meshes::{
|
||||
hydrate_static_mesh_renderers, spawn_static_mesh_parts, HydratedStaticMeshPart,
|
||||
StaticMeshArtifactCache,
|
||||
@@ -37,10 +43,10 @@ use visibility::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
inspector_component_active, BrushDesc, ColliderDesc, EditorVisibility, InspectorOrder,
|
||||
LevelObject, MaterialDesc, MaterialOverride, Primitive, StaticMeshRenderer,
|
||||
COMPONENT_BRUSH_DESC, COMPONENT_COLLIDER_DESC, COMPONENT_LIGHT_DESC, COMPONENT_MATERIAL_DESC,
|
||||
COMPONENT_PRIMITIVE, COMPONENT_STATIC_MESH_RENDERER,
|
||||
authoring_component_active, AuthoringComponentStates, BrushDesc, ColliderDesc,
|
||||
EditorVisibility, InspectorOrder, LevelObject, MaterialDesc, MaterialOverride, Primitive,
|
||||
StaticMeshRenderer, COMPONENT_BRUSH_DESC, COMPONENT_COLLIDER_DESC, COMPONENT_LIGHT_DESC,
|
||||
COMPONENT_MATERIAL_DESC, COMPONENT_PRIMITIVE, COMPONENT_STATIC_MESH_RENDERER,
|
||||
};
|
||||
|
||||
/// Registers hydration systems in deterministic order.
|
||||
@@ -50,6 +56,7 @@ impl Plugin for HydrationPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<StaticMeshArtifactCache>()
|
||||
.add_observer(tag_hydrated_prefab_members)
|
||||
.add_observer(mark_skinned_materials_ready)
|
||||
.add_observer(crate::prefab_overrides::apply_prefab_overrides_on_ready)
|
||||
.add_systems(
|
||||
Update,
|
||||
@@ -60,6 +67,9 @@ impl Plugin for HydrationPlugin {
|
||||
hydrate_lights,
|
||||
reconcile_missing_runtime_lights,
|
||||
hydrate_static_mesh_renderers,
|
||||
hydrate_skinned_mesh_renderers,
|
||||
apply_skinned_renderer_material_changes,
|
||||
cleanup_removed_skinned_mesh_renderers,
|
||||
hydrate_models,
|
||||
hydrate_prefabs,
|
||||
hydrate_physics,
|
||||
@@ -89,17 +99,31 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
}
|
||||
|
||||
let primitives: Vec<(Entity, Primitive)> = world
|
||||
.query_filtered::<(Entity, &Primitive, Option<&InspectorOrder>), With<LevelObject>>()
|
||||
.query_filtered::<(
|
||||
Entity,
|
||||
&Primitive,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.filter(|(_, _, order)| inspector_component_active(*order, COMPONENT_PRIMITIVE))
|
||||
.map(|(entity, primitive, _)| (entity, primitive.clone()))
|
||||
.filter(|(_, _, states, order)| {
|
||||
authoring_component_active(*states, *order, COMPONENT_PRIMITIVE)
|
||||
})
|
||||
.map(|(entity, primitive, _, _)| (entity, primitive.clone()))
|
||||
.collect();
|
||||
|
||||
let material_targets: Vec<(Entity, MaterialDesc)> = world
|
||||
.query_filtered::<(Entity, &MaterialDesc, Option<&InspectorOrder>), With<LevelObject>>()
|
||||
.query_filtered::<(
|
||||
Entity,
|
||||
&MaterialDesc,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.filter(|(_, _, order)| inspector_component_active(*order, COMPONENT_MATERIAL_DESC))
|
||||
.map(|(entity, desc, _)| (entity, desc.clone()))
|
||||
.filter(|(_, _, states, order)| {
|
||||
authoring_component_active(*states, *order, COMPONENT_MATERIAL_DESC)
|
||||
})
|
||||
.map(|(entity, desc, _, _)| (entity, desc.clone()))
|
||||
.collect();
|
||||
|
||||
let brush_entities_for_cleanup: Vec<Entity> = world
|
||||
@@ -113,31 +137,33 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
BrushDesc,
|
||||
Option<MaterialDesc>,
|
||||
Option<ColliderDesc>,
|
||||
Option<InspectorOrder>,
|
||||
)> = world
|
||||
.query_filtered::<(
|
||||
Entity,
|
||||
&BrushDesc,
|
||||
Option<&MaterialDesc>,
|
||||
Option<&ColliderDesc>,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.map(|(entity, brush, material, collider, order)| {
|
||||
(
|
||||
entity,
|
||||
brush.clone(),
|
||||
material
|
||||
.filter(|_| inspector_component_active(order, COMPONENT_MATERIAL_DESC))
|
||||
.cloned(),
|
||||
collider
|
||||
.filter(|_| inspector_component_active(order, COMPONENT_COLLIDER_DESC))
|
||||
.cloned(),
|
||||
order.cloned(),
|
||||
)
|
||||
})
|
||||
.filter(|(_, _, _, _, order)| {
|
||||
inspector_component_active(order.as_ref(), COMPONENT_BRUSH_DESC)
|
||||
.filter_map(|(entity, brush, material, collider, states, order)| {
|
||||
authoring_component_active(states, order, COMPONENT_BRUSH_DESC).then(|| {
|
||||
(
|
||||
entity,
|
||||
brush.clone(),
|
||||
material
|
||||
.filter(|_| {
|
||||
authoring_component_active(states, order, COMPONENT_MATERIAL_DESC)
|
||||
})
|
||||
.cloned(),
|
||||
collider
|
||||
.filter(|_| {
|
||||
authoring_component_active(states, order, COMPONENT_COLLIDER_DESC)
|
||||
})
|
||||
.cloned(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -153,7 +179,6 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
Option<MaterialDesc>,
|
||||
Option<MaterialOverride>,
|
||||
Option<ColliderDesc>,
|
||||
Option<InspectorOrder>,
|
||||
)> = world
|
||||
.query_filtered::<(
|
||||
Entity,
|
||||
@@ -161,28 +186,41 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
Option<&MaterialDesc>,
|
||||
Option<&MaterialOverride>,
|
||||
Option<&ColliderDesc>,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.map(
|
||||
|(entity, renderer, material, material_override, collider, order)| {
|
||||
(
|
||||
entity,
|
||||
renderer.clone(),
|
||||
material
|
||||
.filter(|_| inspector_component_active(order, COMPONENT_MATERIAL_DESC))
|
||||
.cloned(),
|
||||
material_override.cloned(),
|
||||
collider
|
||||
.filter(|_| inspector_component_active(order, COMPONENT_COLLIDER_DESC))
|
||||
.cloned(),
|
||||
order.cloned(),
|
||||
.filter_map(
|
||||
|(entity, renderer, material, material_override, collider, states, order)| {
|
||||
authoring_component_active(states, order, COMPONENT_STATIC_MESH_RENDERER).then(
|
||||
|| {
|
||||
(
|
||||
entity,
|
||||
renderer.clone(),
|
||||
material
|
||||
.filter(|_| {
|
||||
authoring_component_active(
|
||||
states,
|
||||
order,
|
||||
COMPONENT_MATERIAL_DESC,
|
||||
)
|
||||
})
|
||||
.cloned(),
|
||||
material_override.cloned(),
|
||||
collider
|
||||
.filter(|_| {
|
||||
authoring_component_active(
|
||||
states,
|
||||
order,
|
||||
COMPONENT_COLLIDER_DESC,
|
||||
)
|
||||
})
|
||||
.cloned(),
|
||||
)
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
.filter(|(_, _, _, _, _, order)| {
|
||||
inspector_component_active(order.as_ref(), COMPONENT_STATIC_MESH_RENDERER)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut generated_static_mesh_parts = Vec::new();
|
||||
@@ -225,13 +263,18 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
.cloned();
|
||||
|
||||
let lights: Vec<(Entity, crate::LightDesc)> = world
|
||||
.query_filtered::<(Entity, &crate::LightDesc, Option<&InspectorOrder>), With<LevelObject>>()
|
||||
.query_filtered::<(
|
||||
Entity,
|
||||
&crate::LightDesc,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
), With<LevelObject>>()
|
||||
.iter(world)
|
||||
.filter(|(_, light, order)| {
|
||||
inspector_component_active(*order, COMPONENT_LIGHT_DESC)
|
||||
.filter(|(_, light, states, order)| {
|
||||
authoring_component_active(*states, *order, COMPONENT_LIGHT_DESC)
|
||||
&& !lights::local_light_disabled_in_solari(light, profile.as_ref(), caps.as_ref())
|
||||
})
|
||||
.map(|(entity, light, _)| (entity, light.clone()))
|
||||
.map(|(entity, light, _, _)| (entity, light.clone()))
|
||||
.collect();
|
||||
|
||||
let mut state: SystemState<(
|
||||
@@ -261,7 +304,7 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
commands.entity(child).despawn();
|
||||
}
|
||||
|
||||
for (entity, brush, material, collider, _) in &brush_targets {
|
||||
for (entity, brush, material, collider) in &brush_targets {
|
||||
spawn_brush_mesh(
|
||||
&mut commands,
|
||||
&asset_server,
|
||||
@@ -278,7 +321,7 @@ pub fn flush_level_object_hydration(world: &mut World) {
|
||||
commands.entity(child).despawn();
|
||||
}
|
||||
|
||||
for (entity, renderer, material, material_override, collider, _) in &static_mesh_renderers {
|
||||
for (entity, renderer, material, material_override, collider) in &static_mesh_renderers {
|
||||
spawn_static_mesh_parts(
|
||||
&mut commands,
|
||||
&asset_server,
|
||||
|
||||
Reference in new issue
Block a user