pub struct RenderState {Show 18 fields
pub shaders: Assets<ShaderModule>,
pub pipelines: Assets<PipelineSet>,
pub pipeline_bind_group_cache: Assets<BindGroup>,
pub buffers: Buffers,
pub meshes: Assets<MeshBufferRange>,
pub textures: Assets<TextureSet>,
pub default_sampler: Sampler,
pub materials: Assets<Box<dyn AsBindGroup>>,
pub material_bind_group_cache: Assets<BindGroup>,
pub surface: Surface<'static>,
pub surface_config: SurfaceConfiguration,
pub surface_format: TextureFormat,
pub background_color: Color,
pub viewport: ViewportState,
pub capture_target: Option<PathBuf>,
pub device: Device,
pub queue: Queue,
pub window: Arc<Window>,
}Expand description
Struct to store graphics-related states (e.g. buffers, wgpu states).
Fields§
§shaders: Assets<ShaderModule>Shaders
pipelines: Assets<PipelineSet>Render pipelines
pipeline_bind_group_cache: Assets<BindGroup>Bind group cache for pipelines.
buffers: BuffersBuffers (e.g. vertices, instances)
meshes: Assets<MeshBufferRange>Meshes
textures: Assets<TextureSet>Textures
default_sampler: SamplerDefault sampler
materials: Assets<Box<dyn AsBindGroup>>Materials
material_bind_group_cache: Assets<BindGroup>Bind group cache for materials
surface: Surface<'static>Screen surface
surface_config: SurfaceConfiguration§surface_format: TextureFormat§background_color: Color§viewport: ViewportStateViewport state
capture_target: Option<PathBuf>§device: Device§queue: Queue§window: Arc<Window>Implementations§
Source§impl RenderState
impl RenderState
pub async fn new(window: Window) -> Self
Sourcepub fn init_buffer<V: BufferItem>(&mut self, usage: BufferUsages)
pub fn init_buffer<V: BufferItem>(&mut self, usage: BufferUsages)
Initialize buffer with given usage.
pub fn register_shader( &mut self, shader_id: u32, shader_module_descriptor: ShaderModuleDescriptor<'_>, )
pub fn register_mesh<V: BufferItem>(&mut self, mesh_id: u32, mesh: Mesh<V>)
pub fn register_mesh_temporary<V: BufferItem>( &mut self, mesh: Mesh<V>, ) -> Handle
pub fn register_texture(&mut self, texture_id: u32, image: DynamicImage)
pub fn resolution(&self) -> Vec2
Auto Trait Implementations§
impl !Freeze for RenderState
impl !RefUnwindSafe for RenderState
impl !Send for RenderState
impl !Sync for RenderState
impl Unpin for RenderState
impl !UnwindSafe for RenderState
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> 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>
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.Source§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.Source§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.Source§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.