pub struct ViewUniform {Show 16 fields
pub clip_from_world: Mat4,
pub unjittered_clip_from_world: Mat4,
pub world_from_clip: Mat4,
pub world_from_view: Mat4,
pub view_from_world: Mat4,
pub clip_from_view: Mat4,
pub view_from_clip: Mat4,
pub world_position: Vec3,
pub exposure: f32,
pub viewport: Vec4,
pub main_pass_viewport: Vec4,
pub frustum: [Vec4; 6],
pub lod_view_world_position: Vec3,
pub color_grading: ColorGradingUniform,
pub mip_bias: f32,
pub frame_count: u32,
}Fields§
§clip_from_world: Mat4§unjittered_clip_from_world: Mat4§world_from_clip: Mat4§world_from_view: Mat4§view_from_world: Mat4§clip_from_view: Mat4Typically a column-major right-handed projection matrix, one of either:
Perspective (infinite reverse z)
f = 1 / tan(fov_y_radians / 2)
⎡ f / aspect 0 0 0 ⎤
⎢ 0 f 0 0 ⎥
⎢ 0 0 0 near ⎥
⎣ 0 0 -1 0 ⎦Orthographic
w = right - left
h = top - bottom
d = far - near
cw = -right - left
ch = -top - bottom
⎡ 2 / w 0 0 cw / w ⎤
⎢ 0 2 / h 0 ch / h ⎥
⎢ 0 0 1 / d far / d ⎥
⎣ 0 0 0 1 ⎦clip_from_view[3][3] == 1.0 is the standard way to check if a projection is orthographic
Glam matrices are column major, so for example getting the near plane of a perspective projection is clip_from_view[3][2]
Custom projections are also possible however.
view_from_clip: Mat4§world_position: Vec3§exposure: f32§viewport: Vec4§main_pass_viewport: Vec4§frustum: [Vec4; 6]6 world-space half spaces (normal: vec3, distance: f32) ordered left, right, top, bottom, near, far.
The normal vectors point towards the interior of the frustum.
A half space contains p if normal.dot(p) + distance > 0.
lod_view_world_position: Vec3The world-space position of the camera used to resolve visibility ranges.
This is the position of the camera itself, unless this view isn’t associated with a camera, in which case it’s the position of the primary camera.
color_grading: ColorGradingUniform§mip_bias: f32§frame_count: u32Trait Implementations§
Source§impl Clone for ViewUniform
impl Clone for ViewUniform
Source§fn clone(&self) -> ViewUniform
fn clone(&self) -> ViewUniform
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CreateFrom for ViewUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<16usize>>,
for<'__, '__, '__, '__, '__, '__, '__> Mat4: CreateFrom,
for<'__, '__> Vec3: CreateFrom,
for<'__, '__> f32: CreateFrom,
for<'__, '__> Vec4: CreateFrom,
for<'__> [Vec4; 6]: CreateFrom,
for<'__> ColorGradingUniform: CreateFrom,
for<'__> u32: CreateFrom,
impl CreateFrom for ViewUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<16usize>>,
for<'__, '__, '__, '__, '__, '__, '__> Mat4: CreateFrom,
for<'__, '__> Vec3: CreateFrom,
for<'__, '__> f32: CreateFrom,
for<'__, '__> Vec4: CreateFrom,
for<'__> [Vec4; 6]: CreateFrom,
for<'__> ColorGradingUniform: CreateFrom,
for<'__> u32: CreateFrom,
fn create_from<B: BufferRef>(reader: &mut Reader<B>) -> Self
Source§impl ReadFrom for ViewUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<16usize>>,
for<'__, '__, '__, '__, '__, '__, '__> Mat4: ReadFrom,
for<'__, '__> Vec3: ReadFrom,
for<'__, '__> f32: ReadFrom,
for<'__, '__> Vec4: ReadFrom,
for<'__> [Vec4; 6]: ReadFrom,
for<'__> ColorGradingUniform: ReadFrom,
for<'__> u32: ReadFrom,
impl ReadFrom for ViewUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<16usize>>,
for<'__, '__, '__, '__, '__, '__, '__> Mat4: ReadFrom,
for<'__, '__> Vec3: ReadFrom,
for<'__, '__> f32: ReadFrom,
for<'__, '__> Vec4: ReadFrom,
for<'__> [Vec4; 6]: ReadFrom,
for<'__> ColorGradingUniform: ReadFrom,
for<'__> u32: ReadFrom,
Source§impl ShaderSize for ViewUniformwhere
Mat4: ShaderSize,
Vec3: ShaderSize,
f32: ShaderSize,
Vec4: ShaderSize,
[Vec4; 6]: ShaderSize,
ColorGradingUniform: ShaderSize,
u32: ShaderSize,
impl ShaderSize for ViewUniformwhere
Mat4: ShaderSize,
Vec3: ShaderSize,
f32: ShaderSize,
Vec4: ShaderSize,
[Vec4; 6]: ShaderSize,
ColorGradingUniform: ShaderSize,
u32: ShaderSize,
Source§const SHADER_SIZE: NonZero<u64> = _
const SHADER_SIZE: NonZero<u64> = _
ShaderType::min_size)Source§impl ShaderType for ViewUniformwhere
Mat4: ShaderType + ShaderSize,
Vec3: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
Vec4: ShaderType + ShaderSize,
[Vec4; 6]: ShaderType + ShaderSize,
ColorGradingUniform: ShaderType + ShaderSize,
u32: ShaderType,
impl ShaderType for ViewUniformwhere
Mat4: ShaderType + ShaderSize,
Vec3: ShaderType + ShaderSize,
f32: ShaderType + ShaderSize,
Vec4: ShaderType + ShaderSize,
[Vec4; 6]: ShaderType + ShaderSize,
ColorGradingUniform: ShaderType + ShaderSize,
u32: ShaderType,
Source§fn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Self at runtime Read moreSource§fn assert_uniform_compat()
fn assert_uniform_compat()
Self meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints Read moreSource§impl WriteInto for ViewUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<16usize>>,
for<'__, '__, '__, '__, '__, '__, '__> Mat4: WriteInto,
for<'__, '__> Vec3: WriteInto,
for<'__, '__> f32: WriteInto,
for<'__, '__> Vec4: WriteInto,
for<'__> [Vec4; 6]: WriteInto,
for<'__> ColorGradingUniform: WriteInto,
for<'__> u32: WriteInto,
impl WriteInto for ViewUniformwhere
Self: ShaderType<ExtraMetadata = StructMetadata<16usize>>,
for<'__, '__, '__, '__, '__, '__, '__> Mat4: WriteInto,
for<'__, '__> Vec3: WriteInto,
for<'__, '__> f32: WriteInto,
for<'__, '__> Vec4: WriteInto,
for<'__> [Vec4; 6]: WriteInto,
for<'__> ColorGradingUniform: WriteInto,
for<'__> u32: WriteInto,
fn write_into<B: BufferMut>(&self, writer: &mut Writer<B>)
Auto Trait Implementations§
impl Freeze for ViewUniform
impl RefUnwindSafe for ViewUniform
impl Send for ViewUniform
impl Sync for ViewUniform
impl Unpin for ViewUniform
impl UnsafeUnpin for ViewUniform
impl UnwindSafe for ViewUniform
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more