-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Texture coordinates are now integers
There is a lot of random cleanup in this commit, but the only real change in functionality is switching from inputting precomputed f32 fractional coordinates to unsigned pixels for the texture coordinates. This has a couple of major benefits: resizing textures no longer breaks texture coordinates, and fractionally extracting from a texture is no longer possible. Subpixel rendering may be desired, however. I'm currently debating whether to always pixel align or offer some sort of integer-based subpixel subdivisions. With the modern movement being to move to higher DPI screens, in general, the importance of subpixel rendering dimenishes and the sharpness of pixel aligned graphics shines. Ultimately, I'm sure this will be tweaked once text rendering is supported, as that's the situation where subpixel rendering seems like it should be important.
- Loading branch information
Showing
8 changed files
with
82 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::sync::atomic::{self, AtomicUsize}; | ||
use std::sync::{Arc, OnceLock}; | ||
|
||
use crate::Graphics; | ||
|
||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] | ||
pub struct TextureId(usize); | ||
|
||
impl TextureId { | ||
pub fn new_unique_id() -> Self { | ||
static COUNTER: OnceLock<AtomicUsize> = OnceLock::new(); | ||
Self( | ||
COUNTER | ||
.get_or_init(AtomicUsize::default) | ||
.fetch_add(1, atomic::Ordering::Relaxed), | ||
) | ||
} | ||
} | ||
|
||
pub trait ShaderScalableSealed { | ||
fn flags() -> u32; | ||
} | ||
pub trait TextureSource { | ||
fn id(&self) -> TextureId; | ||
fn bind_group(&self, graphics: &Graphics<'_>) -> Arc<wgpu::BindGroup>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.