#[repr(C)]pub struct Uniforms {
pub mvp: [[f32; 4]; 4],
pub gamma: f32,
pub _padding: [f32; 3],
}Expand description
Uniform data structure
This corresponds to the Uniforms struct in the C++ implementation. Contains the MVP matrix and gamma correction value.
Fields§
§mvp: [[f32; 4]; 4]Model-View-Projection matrix (4x4 f32 matrix)
gamma: f32Gamma correction value
_padding: [f32; 3]Padding to ensure proper alignment
Implementations§
Source§impl Uniforms
impl Uniforms
Sourcepub fn create_orthographic_matrix(
display_pos: [f32; 2],
display_size: [f32; 2],
) -> [[f32; 4]; 4]
pub fn create_orthographic_matrix( display_pos: [f32; 2], display_size: [f32; 2], ) -> [[f32; 4]; 4]
Create orthographic projection matrix for Dear ImGui
This matches the matrix calculation in ImGui_ImplWGPU_SetupRenderState
Sourcepub fn gamma_for_format(format: TextureFormat) -> f32
pub fn gamma_for_format(format: TextureFormat) -> f32
Determine gamma value based on texture format
This matches the gamma detection logic in ImGui_ImplWGPU_SetupRenderState from the official C++ implementation, supporting all sRGB texture formats.
Trait Implementations§
impl Copy for Uniforms
impl Pod for Uniforms
Auto Trait Implementations§
impl Freeze for Uniforms
impl RefUnwindSafe for Uniforms
impl Send for Uniforms
impl Sync for Uniforms
impl Unpin for Uniforms
impl UnsafeUnpin for Uniforms
impl UnwindSafe for Uniforms
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.