Fix fighter material not removing the original material. (#92)
Reviewed-on: #92 Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #92.
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
use bevy::{gltf::GltfMaterialName, pbr::{ExtendedMaterial, MaterialExtension}, prelude::*, render::render_resource::AsBindGroup, shader::ShaderRef, world_serialization::WorldInstanceReady};
|
||||
use bevy::{
|
||||
gltf::GltfMaterialName,
|
||||
pbr::{ExtendedMaterial, MaterialExtension},
|
||||
prelude::*,
|
||||
render::render_resource::AsBindGroup,
|
||||
shader::ShaderRef,
|
||||
world_serialization::WorldInstanceReady,
|
||||
};
|
||||
|
||||
pub type FighterMaterial = ExtendedMaterial<StandardMaterial, FighterMaterialExtension>;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct FighterMesh {
|
||||
pub fighter: Entity
|
||||
pub fighter: Entity,
|
||||
}
|
||||
|
||||
#[derive(Asset, AsBindGroup, Reflect, Debug, Clone, Default)]
|
||||
@@ -64,12 +71,22 @@ pub fn bind_fighter_material(
|
||||
continue;
|
||||
};
|
||||
|
||||
commands.entity(entity).insert((MeshMaterial3d(asset_materials.add(ExtendedMaterial {
|
||||
base: StandardMaterial {
|
||||
// can be used in forward or deferred mode
|
||||
..original_material.clone()
|
||||
},
|
||||
extension: FighterMaterialExtension::new(bevy::color::palettes::css::BLUE.into())
|
||||
})), FighterMesh { fighter: scene_ready.entity }));
|
||||
commands
|
||||
.entity(entity)
|
||||
.remove::<MeshMaterial3d<StandardMaterial>>()
|
||||
.insert((
|
||||
MeshMaterial3d(asset_materials.add(ExtendedMaterial {
|
||||
base: StandardMaterial {
|
||||
// can be used in forward or deferred mode
|
||||
..original_material.clone()
|
||||
},
|
||||
extension: FighterMaterialExtension::new(
|
||||
bevy::color::palettes::css::BLUE.into(),
|
||||
),
|
||||
})),
|
||||
FighterMesh {
|
||||
fighter: scene_ready.entity,
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user