struct Example {Show 17 fields
water_vertex_buf: Buffer,
water_vertex_count: usize,
water_bind_group_layout: BindGroupLayout,
water_bind_group: BindGroup,
water_uniform_buf: Buffer,
water_pipeline: RenderPipeline,
terrain_vertex_buf: Buffer,
terrain_vertex_count: usize,
terrain_normal_bind_group: BindGroup,
terrain_normal_uniform_buf: Buffer,
terrain_flipped_uniform_buf: Buffer,
terrain_pipeline: RenderPipeline,
terrain_bundle: RenderBundle,
reflect_view: TextureView,
depth_buffer: TextureView,
current_frame: usize,
active: Option<usize>,
}
Fields§
§water_vertex_buf: Buffer
§water_vertex_count: usize
§water_bind_group_layout: BindGroupLayout
§water_bind_group: BindGroup
§water_uniform_buf: Buffer
§water_pipeline: RenderPipeline
§terrain_vertex_buf: Buffer
§terrain_vertex_count: usize
§terrain_normal_bind_group: BindGroup
§terrain_normal_uniform_buf: Buffer
§terrain_flipped_uniform_buf: Buffer
Contains uniform variables where the camera has been placed underwater.
terrain_pipeline: RenderPipeline
§terrain_bundle: RenderBundle
A render bundle for drawing the terrain.
This isn’t really necessary, but it does make sure we have at
least one use of RenderBundleEncoder::set_bind_group
among
the examples.
reflect_view: TextureView
§depth_buffer: TextureView
§current_frame: usize
§active: Option<usize>
Used to prevent issues when rendering after minimizing the window.
Implementations§
Source§impl Example
impl Example
Sourcefn generate_matrices(aspect_ratio: f32) -> Matrices
fn generate_matrices(aspect_ratio: f32) -> Matrices
Creates the view matrices, and the corrected projection matrix.
fn generate_uniforms(width: u32, height: u32) -> Uniforms
Sourcefn initialize_resources(
config: &SurfaceConfiguration,
device: &Device,
queue: &Queue,
water_uniforms: &Buffer,
terrain_normal_uniforms: &Buffer,
terrain_flipped_uniforms: &Buffer,
water_bind_group_layout: &BindGroupLayout,
) -> (TextureView, TextureView, BindGroup)
fn initialize_resources( config: &SurfaceConfiguration, device: &Device, queue: &Queue, water_uniforms: &Buffer, terrain_normal_uniforms: &Buffer, terrain_flipped_uniforms: &Buffer, water_bind_group_layout: &BindGroupLayout, ) -> (TextureView, TextureView, BindGroup)
Initializes Uniforms and textures.
Trait Implementations§
Source§impl Example for Example
impl Example for Example
fn init( config: &SurfaceConfiguration, _adapter: &Adapter, device: &Device, queue: &Queue, ) -> Self
fn update(&mut self, _event: WindowEvent)
fn resize( &mut self, config: &SurfaceConfiguration, device: &Device, queue: &Queue, )
fn render(&mut self, view: &TextureView, device: &Device, queue: &Queue)
const SRGB: bool = true
fn optional_features() -> Features
fn required_features() -> Features
fn required_downlevel_capabilities() -> DownlevelCapabilities
fn required_limits() -> Limits
Auto Trait Implementations§
impl Freeze for Example
impl !RefUnwindSafe for Example
impl Send for Example
impl Sync for Example
impl Unpin for Example
impl !UnwindSafe for Example
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.