t
Loading...
Searching...
No Matches
t::Material Class Referenceabstract

The base material class. More...

#include <Material.hpp>

Inheritance diagram for t::Material:
t::BlinnPhong t::NormalColor t::SolidColor

Public Member Functions

virtual Vector4 vertexShader (const Uniforms &uniforms, const Attributes &attributes)=0
 The vertex shader of this material, which will be run for every vertex of the mesh's geometry.
 
virtual Color fragmentShader (const Uniforms &uniforms, const Varyings &varyings, const std::vector< std::reference_wrapper< Light > > &lights)=0
 The fragment shader of this material, which will be run for every fragment that the mesh covers on the screen to determine its color.
 

Public Attributes

CullMode cullMode
 The face to cull (not draw) in the render.
 
bool depthTest = true
 Whether or not to perform the depth test.
 
bool depthWrite = true
 Whether or not to write the depth of the object to the depth texture.
 

Detailed Description

The base material class.

A material defines the look of a 3D object. It is one of the 2 components of a 3D mesh.

This class must not be instantiated directly. Instead, you can create your own material by deriving from this class and implement your own vertexShader and fragmentShader.

Member Function Documentation

◆ fragmentShader()

virtual Color t::Material::fragmentShader ( const Uniforms & uniforms,
const Varyings & varyings,
const std::vector< std::reference_wrapper< Light > > & lights )
pure virtual

The fragment shader of this material, which will be run for every fragment that the mesh covers on the screen to determine its color.

Parameters
uniformsThe uniforms.
varyingsThe varyings.
lightsThe list of lights in the scene.
Returns
The color of the fragment this shader is invoked on.
See also
Fragment

Implemented in t::BlinnPhong, t::NormalColor, and t::SolidColor.

◆ vertexShader()

virtual Vector4 t::Material::vertexShader ( const Uniforms & uniforms,
const Attributes & attributes )
pure virtual

The vertex shader of this material, which will be run for every vertex of the mesh's geometry.

Parameters
uniformsThe uniforms.
attributesThe attributes of the vertex.
Returns
The transformed vertex's position in homogeneous coordinates, usually in normalized device coordinates (NDC).

Implemented in t::BlinnPhong, t::NormalColor, and t::SolidColor.

Member Data Documentation

◆ cullMode

CullMode t::Material::cullMode
Initial value:
=
@ Back
Culls back faces.

The face to cull (not draw) in the render.

◆ depthTest

bool t::Material::depthTest = true

Whether or not to perform the depth test.

The depth test tests if a part of an object is behind another object, and thus avoid drawing that part.


The documentation for this class was generated from the following file: