Troubleshooting hidden cubes

main
Elijah C. Voigt 1 year ago
parent df02314be2
commit 2e32534a27

@ -50,6 +50,7 @@ fn init_dice_cuboid(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
[1.0, e], [0.0, e], [0.0, f], [1.0, f], [1.0, e], [0.0, e], [0.0, f], [1.0, f],
], ],
); );
info!("Adding cuboid {:?}", cuboid);
commands.insert_resource(DiceCuboid { mesh: meshes.add(cuboid) }); commands.insert_resource(DiceCuboid { mesh: meshes.add(cuboid) });
} }
@ -97,9 +98,7 @@ fn init_dice_ui(mut commands: Commands) {
}); });
} }
fn init_dice( fn init_dice(mut commands: Commands) {
mut commands: Commands,
) {
[ [
["a", "b", "c", "d", "e", "f"], ["a", "b", "c", "d", "e", "f"],
["g", "h", "i", "j", "k", "l"], ["g", "h", "i", "j", "k", "l"],
@ -107,7 +106,7 @@ fn init_dice(
] ]
.into_iter() .into_iter()
.enumerate() .enumerate()
.for_each(|(idx, set)| { .for_each(|(_idx, set)| {
commands commands
.spawn(( .spawn((
GameChoice::Dice, GameChoice::Dice,
@ -182,7 +181,6 @@ struct DiceCuboid {
impl EntityCommand for Die { impl EntityCommand for Die {
fn apply(self, id: Entity, world: &mut World) { fn apply(self, id: Entity, world: &mut World) {
info!("Applying entity command for die"); info!("Applying entity command for die");
// Image we will render our texture to // Image we will render our texture to
@ -227,7 +225,8 @@ impl EntityCommand for Die {
.id(); .id();
// Scene being rendered to a texture // Scene being rendered to a texture
world.spawn(( world
.spawn((
NodeBundle { NodeBundle {
style: Style { style: Style {
width: Val::Percent(100.0), width: Val::Percent(100.0),
@ -274,18 +273,21 @@ impl EntityCommand for Die {
}); });
// Material used for this object // Material used for this object
let this_material = world.resource_mut::<Assets<StandardMaterial>>().add(StandardMaterial { let this_material =
base_color_texture: Some(image_handle), world
..default() .resource_mut::<Assets<StandardMaterial>>()
}); .add(StandardMaterial {
base_color_texture: Some(image_handle),
..default()
});
let pbr_bundle = PbrBundle { let pbr_bundle = PbrBundle {
mesh: world.resource::<DiceCuboid>().mesh.clone(), mesh: world.resource::<DiceCuboid>().mesh.clone(),
material: this_material, material: this_material.clone(),
..default() ..default()
}; };
world.entity_mut(id).insert((self, pbr_bundle)); world.entity_mut(id).insert((self, pbr_bundle.clone()));
} }
} }

@ -33,7 +33,7 @@ pub(crate) enum GameChoice {
fn init_camera(mut commands: Commands) { fn init_camera(mut commands: Commands) {
commands.spawn(Camera3dBundle { commands.spawn(Camera3dBundle {
camera: Camera { camera: Camera {
clear_color: ClearColorConfig::Custom(Color::WHITE), clear_color: ClearColorConfig::Custom(Color::ALICE_BLUE),
..default() ..default()
}, },
transform: Transform::from_xyz(10.0, 10.0, 10.0), transform: Transform::from_xyz(10.0, 10.0, 10.0),

@ -9,7 +9,6 @@ pub(crate) use bevy::render::camera::RenderTarget;
pub(crate) use bevy::render::render_resource::{ pub(crate) use bevy::render::render_resource::{
Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
}; };
pub(crate) use bevy::sprite::MaterialMesh2dBundle;
/// Bevy Plugins /// Bevy Plugins
pub(crate) use bevy_mod_picking::prelude::*; pub(crate) use bevy_mod_picking::prelude::*;

Loading…
Cancel
Save