mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Use Image::default for 1 pixel white texture directly (#7884)
for place holder image, it should use `default` directly.
This commit is contained in:
parent
6beca13553
commit
0b794c8f1e
4 changed files with 4 additions and 18 deletions
|
@ -484,12 +484,7 @@ impl FromWorld for MeshPipeline {
|
|||
|
||||
// A 1x1x1 'all 1.0' texture to use as a dummy texture to use in place of optional StandardMaterial textures
|
||||
let dummy_white_gpu_image = {
|
||||
let image = Image::new_fill(
|
||||
Extent3d::default(),
|
||||
TextureDimension::D2,
|
||||
&[255u8; 4],
|
||||
TextureFormat::bevy_default(),
|
||||
);
|
||||
let image = Image::default();
|
||||
let texture = render_device.create_texture(&image.texture_descriptor);
|
||||
let sampler = match image.sampler_descriptor {
|
||||
ImageSampler::Default => (**default_sampler).clone(),
|
||||
|
|
|
@ -172,6 +172,7 @@ impl ImageSampler {
|
|||
pub struct DefaultImageSampler(pub(crate) Sampler);
|
||||
|
||||
impl Default for Image {
|
||||
/// default is a 1x1x1 all '1.0' texture
|
||||
fn default() -> Self {
|
||||
let format = wgpu::TextureFormat::bevy_default();
|
||||
let data = vec![255; format.pixel_size()];
|
||||
|
|
|
@ -208,12 +208,7 @@ impl FromWorld for Mesh2dPipeline {
|
|||
});
|
||||
// A 1x1x1 'all 1.0' texture to use as a dummy texture to use in place of optional StandardMaterial textures
|
||||
let dummy_white_gpu_image = {
|
||||
let image = Image::new_fill(
|
||||
Extent3d::default(),
|
||||
TextureDimension::D2,
|
||||
&[255u8; 4],
|
||||
TextureFormat::bevy_default(),
|
||||
);
|
||||
let image = Image::default();
|
||||
let texture = render_device.create_texture(&image.texture_descriptor);
|
||||
let sampler = match image.sampler_descriptor {
|
||||
ImageSampler::Default => (**default_sampler).clone(),
|
||||
|
|
|
@ -91,12 +91,7 @@ impl FromWorld for SpritePipeline {
|
|||
label: Some("sprite_material_layout"),
|
||||
});
|
||||
let dummy_white_gpu_image = {
|
||||
let image = Image::new_fill(
|
||||
Extent3d::default(),
|
||||
TextureDimension::D2,
|
||||
&[255u8; 4],
|
||||
TextureFormat::bevy_default(),
|
||||
);
|
||||
let image = Image::default();
|
||||
let texture = render_device.create_texture(&image.texture_descriptor);
|
||||
let sampler = match image.sampler_descriptor {
|
||||
ImageSampler::Default => (**default_sampler).clone(),
|
||||
|
|
Loading…
Reference in a new issue