Trait three_d::renderer::material::Material [−][src]
pub trait Material {
fn fragment_shader_source(
&self,
use_vertex_colors: bool,
lights: &Lights
) -> String;
fn use_uniforms(
&self,
program: &Program,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>;
fn render_states(&self) -> RenderStates;
fn is_transparent(&self) -> bool;
}
Expand description
Represents a material that can be applied to a Shadable object.
The material can use the attributes position (in world space) by adding in vec3 pos;
,
normal by in vec3 nor;
, uv coordinates by in vec2 uvs;
and color by in vec4 col;
to the fragment shader source code.
Required methods
fn fragment_shader_source(
&self,
use_vertex_colors: bool,
lights: &Lights
) -> String
fn fragment_shader_source(
&self,
use_vertex_colors: bool,
lights: &Lights
) -> String
Returns the fragment shader source for this material. Should output the final fragment color.
fn use_uniforms(
&self,
program: &Program,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
fn use_uniforms(
&self,
program: &Program,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
Sends the uniform data needed for this material to the fragment shader.
fn render_states(&self) -> RenderStates
fn render_states(&self) -> RenderStates
Returns the render states needed to render with this material.
fn is_transparent(&self) -> bool
fn is_transparent(&self) -> bool
Returns whether or not this material is transparent.