Struct truck_rendimpl::PolygonState
source · [−]pub struct PolygonState {
pub matrix: Matrix4,
pub material: Material,
pub texture: Option<Arc<Texture>>,
pub backface_culling: bool,
}Expand description
Configures of instances.
Fields
matrix: Matrix4instance matrix
material: Materialmaterial of instance
texture: Option<Arc<Texture>>texture of instance
backface_culling: boolIf this parameter is true, the backface culling will be activated.
Implementations
sourceimpl PolygonState
impl PolygonState
sourcepub fn matrix_buffer(&self, device: &Device) -> BufferHandler
pub fn matrix_buffer(&self, device: &Device) -> BufferHandler
Creates a UNIFORM buffer of instance matrix.
The bind group provided by the instances holds this uniform buffer.
Shader Examples
layout(set = 1, binding = 0) uniform ModelMatrix {
mat4 uniform_matrix;
};sourcepub fn material_buffer(&self, device: &Device) -> BufferHandler
pub fn material_buffer(&self, device: &Device) -> BufferHandler
Creates a UNIFORM buffer of material.
The bind group provided by the instances holds this uniform buffer.
Shader Examples
layout(set = 1, binding = 1) uniform Material {
vec4 albedo;
float roughness;
float reflectance;
float ambient_ratio;
};sourcepub fn textureview_and_sampler(&self, device: &Device) -> (TextureView, Sampler)
pub fn textureview_and_sampler(&self, device: &Device) -> (TextureView, Sampler)
Creates texture view and sampler of the instance’s texture image.
The bind group provided by the instances holds this uniform buffer.
Shader Examples
layout(set = 1, binding = 2) uniform texture2D texture_view;
layout(set = 1, binding = 3) uniform sampler texture_sampler;Trait Implementations
sourceimpl Clone for PolygonState
impl Clone for PolygonState
sourcefn clone(&self) -> PolygonState
fn clone(&self) -> PolygonState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for PolygonState
impl Debug for PolygonState
sourceimpl Default for PolygonState
impl Default for PolygonState
sourcefn default() -> PolygonState
fn default() -> PolygonState
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for PolygonState
impl Send for PolygonState
impl Sync for PolygonState
impl Unpin for PolygonState
impl !UnwindSafe for PolygonState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more