Module material

Module material 

Source
Expand description

Contains the Material and MaterialBuilder struct which are needed for anything to be rendered

// Simple code to draw a 100x100 red rectangle to the screen
let defualt_material: Material<()> = MaterialBuilder::new().build();

impl Game for Struct {
    fn render<'pass, 'others>(&mut Self, mut renderer: RenderInformation<'pass, 'others>) where 'others: 'pass {
        self.defualt_material.add_rectangle(Vec2{x: 0.0, y: 0.0}, Vec2{x: 100.0, y: 100.0}, Colour::RED, &renderer);
        self.default_material.draw(&mut renderer);
    }
}

Structs§

LineMaterial
A diffrent type of material used to draw WebGPU debug lines. These lines will allways be 1px wide and only one instance of this material should ever be made per programm.
Material
A material represents a unique combination of a Texture and Shader, while also containing all nessicary buffers. If you don’t have any uniform data attached to the shader utilized by the material use the unit () type.
MaterialBuilder
A builder struct used to create Materials