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],
],
);
info!("Adding cuboid {:?}", cuboid);
commands.insert_resource(DiceCuboid { mesh: meshes.add(cuboid) });
}
@ -97,9 +98,7 @@ fn init_dice_ui(mut commands: Commands) {
});
}
fn init_dice(
mut commands: Commands,
) {
fn init_dice(mut commands: Commands) {
[
["a", "b", "c", "d", "e", "f"],
["g", "h", "i", "j", "k", "l"],
@ -107,7 +106,7 @@ fn init_dice(
]
.into_iter()
.enumerate()
.for_each(|(idx, set)| {
.for_each(|(_idx, set)| {
commands
.spawn((
GameChoice::Dice,
@ -182,7 +181,6 @@ struct DiceCuboid {
impl EntityCommand for Die {
fn apply(self, id: Entity, world: &mut World) {
info!("Applying entity command for die");
// Image we will render our texture to
@ -227,7 +225,8 @@ impl EntityCommand for Die {
.id();
// Scene being rendered to a texture
world.spawn((
world
.spawn((
NodeBundle {
style: Style {
width: Val::Percent(100.0),
@ -274,18 +273,21 @@ impl EntityCommand for Die {
});
// Material used for this object
let this_material = world.resource_mut::<Assets<StandardMaterial>>().add(StandardMaterial {
base_color_texture: Some(image_handle),
..default()
});
let this_material =
world
.resource_mut::<Assets<StandardMaterial>>()
.add(StandardMaterial {
base_color_texture: Some(image_handle),
..default()
});
let pbr_bundle = PbrBundle {
mesh: world.resource::<DiceCuboid>().mesh.clone(),
material: this_material,
material: this_material.clone(),
..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) {
commands.spawn(Camera3dBundle {
camera: Camera {
clear_color: ClearColorConfig::Custom(Color::WHITE),
clear_color: ClearColorConfig::Custom(Color::ALICE_BLUE),
..default()
},
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::{
Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
};
pub(crate) use bevy::sprite::MaterialMesh2dBundle;
/// Bevy Plugins
pub(crate) use bevy_mod_picking::prelude::*;

Loading…
Cancel
Save