Refactor texture atlas
- Split into multiple modules - Rename some concepts - Change API details
This commit is contained in:
parent
82f0a49062
commit
59d45a5440
11 changed files with 647 additions and 667 deletions
25
wgpu/src/texture/atlas/entry.rs
Normal file
25
wgpu/src/texture/atlas/entry.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use crate::texture::atlas;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Entry {
|
||||
Contiguous(atlas::Allocation),
|
||||
Fragmented {
|
||||
size: (u32, u32),
|
||||
fragments: Vec<Fragment>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Entry {
|
||||
pub fn size(&self) -> (u32, u32) {
|
||||
match self {
|
||||
Entry::Contiguous(allocation) => allocation.size(),
|
||||
Entry::Fragmented { size, .. } => *size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Fragment {
|
||||
pub position: (u32, u32),
|
||||
pub allocation: atlas::Allocation,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue