mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-26 00:48:44 -06:00
fix some atlas bugs
This commit is contained in:
parent
7a70b0ccb2
commit
cd6d421909
|
@ -95,10 +95,9 @@ impl BufferPair {
|
||||||
self.vertex_count = vtx.len();
|
self.vertex_count = vtx.len();
|
||||||
self.index_count = idx.len();
|
self.index_count = idx.len();
|
||||||
|
|
||||||
// self.vertex_buffer.invalidate();
|
|
||||||
// self.index_buffer.invalidate();
|
|
||||||
|
|
||||||
if self.vertex_count == 0 || self.index_count == 0 {
|
if self.vertex_count == 0 || self.index_count == 0 {
|
||||||
|
self.vertex_buffer.invalidate();
|
||||||
|
self.index_buffer.invalidate();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,8 @@ impl TextureAtlasManager {
|
||||||
self.packer.resize(new_size.x as i32, new_size.y as i32);
|
self.packer.resize(new_size.x as i32, new_size.y as i32);
|
||||||
//Resize the data array in-place
|
//Resize the data array in-place
|
||||||
self.data.resize((new_size.x * new_size.y * RGBA_CHANNEL_COUNT) as usize, 0);
|
self.data.resize((new_size.x * new_size.y * RGBA_CHANNEL_COUNT) as usize, 0);
|
||||||
for y in (1..self.size.y).rev() {
|
for y in (0..self.size.y).rev() {
|
||||||
for x in (0..self.size.x).rev() {
|
for x in (1..self.size.x).rev() {
|
||||||
let idx = ((y * self.size.x + x) * RGBA_CHANNEL_COUNT) as usize;
|
let idx = ((y * self.size.x + x) * RGBA_CHANNEL_COUNT) as usize;
|
||||||
let new_idx = ((y * new_size.x + x) * RGBA_CHANNEL_COUNT) as usize;
|
let new_idx = ((y * new_size.x + x) * RGBA_CHANNEL_COUNT) as usize;
|
||||||
for c in 0..(RGBA_CHANNEL_COUNT as usize) {
|
for c in 0..(RGBA_CHANNEL_COUNT as usize) {
|
||||||
|
@ -111,7 +111,7 @@ impl TextureAtlasManager {
|
||||||
// TODO: implement these
|
// TODO: implement these
|
||||||
// Plan C: resize the atlas
|
// Plan C: resize the atlas
|
||||||
let mut new_size = self.size;
|
let mut new_size = self.size;
|
||||||
while !self.packer.can_pack(size.x as i32, size.y as i32, true) {
|
while !self.packer.can_pack(size.x as i32, size.y as i32, ALLOW_ROTATION) {
|
||||||
new_size *= 2;
|
new_size *= 2;
|
||||||
self.packer.resize(new_size.x as i32, new_size.y as i32);
|
self.packer.resize(new_size.x as i32, new_size.y as i32);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue