From 9c972f037e7a9395f81bf4b85c38db8ef1c4ba6c Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Mon, 8 Jan 2024 17:44:24 -0700 Subject: [PATCH] Fix missed explicit conversions in examples (#11261) # Objective A few of these were missed in #10878 ## Solution Fix em --- examples/2d/2d_shapes.rs | 6 +++--- examples/2d/bloom_2d.rs | 4 ++-- examples/2d/mesh2d.rs | 2 +- examples/2d/mesh2d_vertex_color_texture.rs | 2 +- examples/2d/pixel_grid_snap.rs | 4 ++-- examples/3d/transmission.rs | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/2d/2d_shapes.rs b/examples/2d/2d_shapes.rs index 382b02fa7a..9a16f96ce5 100644 --- a/examples/2d/2d_shapes.rs +++ b/examples/2d/2d_shapes.rs @@ -19,7 +19,7 @@ fn setup( // Circle commands.spawn(MaterialMesh2dBundle { mesh: meshes.add(shape::Circle::new(50.)).into(), - material: materials.add(ColorMaterial::from(Color::PURPLE)), + material: materials.add(Color::PURPLE), transform: Transform::from_translation(Vec3::new(-150., 0., 0.)), ..default() }); @@ -38,7 +38,7 @@ fn setup( // Quad commands.spawn(MaterialMesh2dBundle { mesh: meshes.add(shape::Quad::new(Vec2::new(50., 100.))).into(), - material: materials.add(ColorMaterial::from(Color::LIME_GREEN)), + material: materials.add(Color::LIME_GREEN), transform: Transform::from_translation(Vec3::new(50., 0., 0.)), ..default() }); @@ -46,7 +46,7 @@ fn setup( // Hexagon commands.spawn(MaterialMesh2dBundle { mesh: meshes.add(shape::RegularPolygon::new(50., 6)).into(), - material: materials.add(ColorMaterial::from(Color::TURQUOISE)), + material: materials.add(Color::TURQUOISE), transform: Transform::from_translation(Vec3::new(150., 0., 0.)), ..default() }); diff --git a/examples/2d/bloom_2d.rs b/examples/2d/bloom_2d.rs index 04f8bc752b..de1292efdd 100644 --- a/examples/2d/bloom_2d.rs +++ b/examples/2d/bloom_2d.rs @@ -50,7 +50,7 @@ fn setup( commands.spawn(MaterialMesh2dBundle { mesh: meshes.add(shape::Circle::new(100.)).into(), // 4. Put something bright in a dark environment to see the effect - material: materials.add(ColorMaterial::from(Color::rgb(7.5, 0.0, 7.5))), + material: materials.add(Color::rgb(7.5, 0.0, 7.5)), transform: Transform::from_translation(Vec3::new(-200., 0., 0.)), ..default() }); @@ -59,7 +59,7 @@ fn setup( commands.spawn(MaterialMesh2dBundle { mesh: meshes.add(shape::RegularPolygon::new(100., 6)).into(), // 4. Put something bright in a dark environment to see the effect - material: materials.add(ColorMaterial::from(Color::rgb(6.25, 9.4, 9.1))), + material: materials.add(Color::rgb(6.25, 9.4, 9.1)), transform: Transform::from_translation(Vec3::new(200., 0., 0.)), ..default() }); diff --git a/examples/2d/mesh2d.rs b/examples/2d/mesh2d.rs index 324276a3c7..015bbdde2c 100644 --- a/examples/2d/mesh2d.rs +++ b/examples/2d/mesh2d.rs @@ -20,7 +20,7 @@ fn setup( commands.spawn(MaterialMesh2dBundle { mesh: meshes.add(shape::Quad::default()).into(), transform: Transform::default().with_scale(Vec3::splat(128.)), - material: materials.add(ColorMaterial::from(Color::PURPLE)), + material: materials.add(Color::PURPLE), ..default() }); } diff --git a/examples/2d/mesh2d_vertex_color_texture.rs b/examples/2d/mesh2d_vertex_color_texture.rs index 1e439e28c9..9c622eaced 100644 --- a/examples/2d/mesh2d_vertex_color_texture.rs +++ b/examples/2d/mesh2d_vertex_color_texture.rs @@ -54,7 +54,7 @@ fn setup( mesh: mesh_handle, transform: Transform::from_translation(Vec3::new(96., 0., 0.)) .with_scale(Vec3::splat(128.)), - material: materials.add(ColorMaterial::from(texture_handle)), + material: materials.add(texture_handle), ..default() }); } diff --git a/examples/2d/pixel_grid_snap.rs b/examples/2d/pixel_grid_snap.rs index 15e5732993..7bc67dcb4c 100644 --- a/examples/2d/pixel_grid_snap.rs +++ b/examples/2d/pixel_grid_snap.rs @@ -83,9 +83,9 @@ fn setup_mesh( ) { commands.spawn(( MaterialMesh2dBundle { - mesh: meshes.add(Mesh::from(shape::Capsule::default())).into(), + mesh: meshes.add(shape::Capsule::default()).into(), transform: Transform::from_xyz(40., 0., 2.).with_scale(Vec3::splat(32.)), - material: materials.add(ColorMaterial::from(Color::BLACK)), + material: materials.add(Color::BLACK), ..default() }, Rotate, diff --git a/examples/3d/transmission.rs b/examples/3d/transmission.rs index 8c780fbbab..3c92814026 100644 --- a/examples/3d/transmission.rs +++ b/examples/3d/transmission.rs @@ -80,12 +80,12 @@ fn setup( let plane_mesh = meshes.add(shape::Plane::from_size(2.0)); - let cylinder_mesh = meshes.add(Mesh::from(shape::Cylinder { + let cylinder_mesh = meshes.add(shape::Cylinder { radius: 0.5, height: 2.0, resolution: 50, segments: 1, - })); + }); // Cube #1 commands.spawn((