use correct size of pixel instead of 4 (#2977)
# Objective - Fixes #2919 - Initial pixel was hard coded and not dependent on texture format - Replace #2920 as I noticed this needed to be done also on pipeline rendering branch ## Solution - Replace the hard coded pixel with one using the texture pixel size
This commit is contained in:
parent
dacc9d03a7
commit
a2ea9279b2
@ -168,10 +168,11 @@ impl TextureAtlasBuilder {
|
|||||||
&contains_smallest_box,
|
&contains_smallest_box,
|
||||||
) {
|
) {
|
||||||
Ok(rect_placements) => {
|
Ok(rect_placements) => {
|
||||||
atlas_texture = Texture::new_fill(
|
let size = Extent3d::new(current_width, current_height, 1);
|
||||||
Extent3d::new(current_width, current_height, 1),
|
atlas_texture = Texture::new(
|
||||||
|
size,
|
||||||
TextureDimension::D2,
|
TextureDimension::D2,
|
||||||
&[0, 0, 0, 0],
|
vec![0; self.format.pixel_size() * size.volume()],
|
||||||
self.format,
|
self.format,
|
||||||
);
|
);
|
||||||
Some(rect_placements)
|
Some(rect_placements)
|
||||||
|
@ -176,14 +176,17 @@ impl TextureAtlasBuilder {
|
|||||||
&contains_smallest_box,
|
&contains_smallest_box,
|
||||||
) {
|
) {
|
||||||
Ok(rect_placements) => {
|
Ok(rect_placements) => {
|
||||||
atlas_texture = Image::new_fill(
|
atlas_texture = Image::new(
|
||||||
Extent3d {
|
Extent3d {
|
||||||
width: current_width,
|
width: current_width,
|
||||||
height: current_height,
|
height: current_height,
|
||||||
depth_or_array_layers: 1,
|
depth_or_array_layers: 1,
|
||||||
},
|
},
|
||||||
TextureDimension::D2,
|
TextureDimension::D2,
|
||||||
&[0, 0, 0, 0],
|
vec![
|
||||||
|
0;
|
||||||
|
self.format.pixel_size() * (current_width * current_height) as usize
|
||||||
|
],
|
||||||
self.format,
|
self.format,
|
||||||
);
|
);
|
||||||
Some(rect_placements)
|
Some(rect_placements)
|
||||||
|
Loading…
Reference in New Issue
Block a user