[][src]Struct truck_platform::SceneDescriptor

pub struct SceneDescriptor {
    pub background: Color,
    pub camera: Camera,
    pub lights: Vec<Light>,
    pub sample_count: u32,
}

Configures of Scene.

Fields

background: Color

background color. Default is Color::BLACK.

camera: Camera

camera of the scene. Default is Camera::default().

lights: Vec<Light>

All lights in the scene. Default is vec![Light::default()].

sample_count: u32

sample count for anti-aliasing by MSAA. 1, 2, 4, 8, or 16.

Implementations

impl SceneDescriptor[src]

pub fn camera_buffer(&self, handler: &DeviceHandler) -> BufferHandler[src]

Creates a UNIFORM buffer of camera.

The bind group provides Scene holds this uniform buffer.

Shader Example

layout(set = 0, binding = 0) uniform Camera {
    mat4 camera_matrix;     // the camera matrix
    mat4 camera_projection; // the projection into the normalized view volume
};

pub fn lights_buffer(&self, device: &Device) -> BufferHandler[src]

Creates a STORAGE buffer of all lights.

The bind group provides Scene holds this uniform buffer.

Shader Example

struct Light {
    vec4 position;      // the position of light, position.w == 1.0
    vec4 color;         // the color of light, color.w == 1.0
    uvec4 light_type;   // Point => uvec4(0, 0, 0, 0), Uniform => uvec4(1, 0, 0, 0)
};

layout(set = 0, binding = 1) buffer Lights {
    Light lights[];
};

Trait Implementations

impl Clone for SceneDescriptor[src]

impl Debug for SceneDescriptor[src]

impl Default for SceneDescriptor[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.