I'm attempting draw some custom shapes, and although I'm getting the desired shape to draw, I just can't seem to get the color I want.
here's my "test" system:
fn polygon_test(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
let vertices: std::vec::Vec<Vec3> = [
Vec3::new(-40., 40., 0.),
Vec3::new(-20., 40., 0.),
Vec3::new(-40., 20., 0.),
Vec3::new(40., -20., 0.),
Vec3::new(20., -40., 0.),
Vec3::new(40., -40., 0.),
]
.to_vec();
let test_mesh = meshes.add(
Mesh::new(
bevy::render::mesh::PrimitiveTopology::TriangleStrip,
RenderAssetUsages::default(),
)
.with_inserted_attribute(Mesh::ATTRIBUTE_POSITION, vertices),
);
commands.spawn(ColorMesh2dBundle {
mesh: test_mesh.into(),
// SHOULD be neon red
material: materials.add(Color::linear_rgb(253.0, 28.0, 3.0)),
..default()
});
}
I can use Color::WHITE and Color::BLACK and get the specified color, but when I run the above code, I still only get a white shape.
what do?