t
Loading...
Searching...
No Matches
Material.hpp
1#include "lights/Light.hpp"
2#include "primitives/Attributes.hpp"
3#include "primitives/Color.hpp"
4#include "primitives/Uniforms.hpp"
5#include "primitives/Varyings.hpp"
6
7#ifndef MATERIAL_HPP
8#define MATERIAL_HPP
9
10namespace t {
11
24class Material {
25public:
28 bool depthTest = true;
31 bool depthWrite = true;
34 virtual ~Material() = default;
35
45 virtual Vector4 vertexShader(const Uniforms &uniforms,
46 const Attributes &attributes) = 0;
47
59 virtual Color
60 fragmentShader(const Uniforms &uniforms, const Varyings &varyings,
61 const std::vector<std::reference_wrapper<Light>> &lights) = 0;
62};
63
64} // namespace t
65
66#endif // MATERIAL_HPP
The color class.
Definition Color.hpp:18
The base material class.
Definition Material.hpp:24
bool depthTest
Whether or not to perform the depth test.
Definition Material.hpp:28
CullMode cullMode
The face to cull (not draw) in the render.
Definition Material.hpp:26
bool depthWrite
Whether or not to write the depth of the object to the depth texture.
Definition Material.hpp:31
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 th...
The 4D vector class.
Definition Vector4.hpp:20
The t software 3D graphics library namespace.
Definition algorithms.hpp:12
CullMode
Which faces to cull in the render.
Definition constants.hpp:41
@ Back
Culls back faces.
The attributes of a vertex, available to vertex shaders.
Definition Attributes.hpp:14
The uniforms available to vertex shaders and fragment shaders.
Definition Uniforms.hpp:19
The varyings available to fragment shaders.
Definition Varyings.hpp:19