|
|
|
@ -239,7 +239,7 @@ fn initialize(mut commands: Commands, board: Res<game::Board>, assets: Res<Asset
|
|
|
|
SceneBundle { ..default() },
|
|
|
|
SceneBundle { ..default() },
|
|
|
|
TitleText,
|
|
|
|
TitleText,
|
|
|
|
Dissolvable {
|
|
|
|
Dissolvable {
|
|
|
|
start: 0.0,
|
|
|
|
start: 1.0,
|
|
|
|
duration: 3.0,
|
|
|
|
duration: 3.0,
|
|
|
|
}, // Marks title text as dissolving
|
|
|
|
}, // Marks title text as dissolving
|
|
|
|
));
|
|
|
|
));
|
|
|
|
@ -1189,7 +1189,7 @@ impl MaterialExtension for DissolveExtension {
|
|
|
|
/// Sets up all pieces to have an associated "dissolve" material ready for capture
|
|
|
|
/// Sets up all pieces to have an associated "dissolve" material ready for capture
|
|
|
|
fn setup_dissolve_materials(
|
|
|
|
fn setup_dissolve_materials(
|
|
|
|
// All entities with materials are candidates for this procedure
|
|
|
|
// All entities with materials are candidates for this procedure
|
|
|
|
events: Query<(Entity, &Handle<StandardMaterial>), Added<Handle<StandardMaterial>>>,
|
|
|
|
events: Query<(Entity, &Handle<StandardMaterial>, Option<&Name>), Added<Handle<StandardMaterial>>>,
|
|
|
|
// Only process newly created pieces (we do not delete pieces at runtime)
|
|
|
|
// Only process newly created pieces (we do not delete pieces at runtime)
|
|
|
|
query: Query<Entity, (With<Dissolvable>, Added<Children>)>,
|
|
|
|
query: Query<Entity, (With<Dissolvable>, Added<Children>)>,
|
|
|
|
// Children of pieces are the actual meshes that need materials
|
|
|
|
// Children of pieces are the actual meshes that need materials
|
|
|
|
@ -1204,10 +1204,10 @@ fn setup_dissolve_materials(
|
|
|
|
events
|
|
|
|
events
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
// Only process if this is a child of a piece
|
|
|
|
// Only process if this is a child of a piece
|
|
|
|
.filter(|(child, _)| query.iter_many(parents.iter_ancestors(*child)).count() > 0)
|
|
|
|
.filter(|(child, _, _)| query.iter_many(parents.iter_ancestors(*child)).count() > 0)
|
|
|
|
// Handle this entity (mesh)
|
|
|
|
// Handle this entity (mesh)
|
|
|
|
.for_each(|(child, std_handle)| {
|
|
|
|
.for_each(|(child, std_handle, name)| {
|
|
|
|
info!("Setting up dissolve material for {:?}", child);
|
|
|
|
info!("Setting up dissolve material for {:?} {:?}", name, child);
|
|
|
|
|
|
|
|
|
|
|
|
// Extension we will add to existing gltf-sourced materials
|
|
|
|
// Extension we will add to existing gltf-sourced materials
|
|
|
|
let extension = DissolveExtension { percentage: 1.0 };
|
|
|
|
let extension = DissolveExtension { percentage: 1.0 };
|
|
|
|
@ -1217,9 +1217,9 @@ fn setup_dissolve_materials(
|
|
|
|
.expect("Resolve material data")
|
|
|
|
.expect("Resolve material data")
|
|
|
|
.clone();
|
|
|
|
.clone();
|
|
|
|
|
|
|
|
|
|
|
|
base.alpha_mode = AlphaMode::Mask(0.5);
|
|
|
|
base.alpha_mode = AlphaMode::Mask(0.1);
|
|
|
|
base.base_color = Color::NONE.with_a(0.0);
|
|
|
|
base.base_color = Color::NONE.with_a(0.0);
|
|
|
|
info!("Base material {:#?}", base);
|
|
|
|
debug!("Base material {:#?}", base);
|
|
|
|
|
|
|
|
|
|
|
|
let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension });
|
|
|
|
let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension });
|
|
|
|
|
|
|
|
|
|
|
|
|