@@ -54,11 +54,7 @@ impl Plugin for ModelNodePlugin {
|
||||
app.init_resource::<MaterialRegistry>();
|
||||
app.add_systems(
|
||||
Update,
|
||||
(
|
||||
load_models,
|
||||
gen_model_parts,
|
||||
apply_materials,
|
||||
)
|
||||
(load_models, gen_model_parts, apply_materials)
|
||||
.chain()
|
||||
.in_set(ModelNodeSystemSet),
|
||||
);
|
||||
@@ -71,9 +67,9 @@ impl Plugin for ModelNodePlugin {
|
||||
#[bindless(index_table(range(50..51), binding(100)))]
|
||||
pub struct HoldoutExtension {}
|
||||
impl From<&HoldoutExtension> for u32 {
|
||||
fn from(_: &HoldoutExtension) -> Self {
|
||||
0
|
||||
}
|
||||
fn from(_: &HoldoutExtension) -> Self {
|
||||
0
|
||||
}
|
||||
}
|
||||
impl MaterialExtension for HoldoutExtension {
|
||||
fn fragment_shader() -> ShaderRef {
|
||||
|
||||
@@ -31,7 +31,6 @@ impl Plugin for SpatialNodePlugin {
|
||||
PostUpdate,
|
||||
(
|
||||
spawn_spatial_nodes,
|
||||
// update_spatial_node_parenting,
|
||||
despawn_unneeded_spatial_nodes,
|
||||
update_spatial_nodes,
|
||||
)
|
||||
@@ -54,32 +53,6 @@ fn spawn_spatial_nodes(mut cmds: Commands) {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_spatial_node_parenting(
|
||||
query: Query<(Entity, Option<&ChildOf>, &SpatialNode)>,
|
||||
mut cmds: Commands,
|
||||
) {
|
||||
for (entity, parent, spatial) in &query {
|
||||
let Some(spatial) = spatial.0.upgrade() else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let Some(parent_entity) = spatial
|
||||
.get_parent()
|
||||
.map(|v| v.entity.read().as_ref().map(|v| v.0))
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
// no changes needed, early exit
|
||||
if parent.map(|v| v.0) == parent_entity {
|
||||
continue;
|
||||
}
|
||||
match parent_entity {
|
||||
Some(e) => cmds.entity(entity).insert(ChildOf(e)),
|
||||
None => cmds.entity(entity).remove::<ChildOf>(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn despawn_unneeded_spatial_nodes(query: Query<(Entity, &SpatialNode)>, cmds: ParallelCommands) {
|
||||
query.par_iter().for_each(|(entity, spatial_node)| {
|
||||
if spatial_node.0.upgrade().is_none() {
|
||||
|
||||
@@ -34,7 +34,10 @@ impl Plugin for HandPlugin {
|
||||
app.add_systems(PreFrameWait, update_hands.run_if(resource_exists::<Hands>));
|
||||
app.add_systems(XrSessionCreated, create_trackers);
|
||||
app.add_systems(XrPreDestroySession, destroy_trackers);
|
||||
app.add_systems(PostUpdate, update_hand_material.run_if(resource_exists::<Hands>));
|
||||
app.add_systems(
|
||||
PostUpdate,
|
||||
update_hand_material.run_if(resource_exists::<Hands>),
|
||||
);
|
||||
app.add_systems(Startup, setup.run_if(session_available));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user