gdk-graphics 0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
material.h
1// © Joseph Cameron - MIT License
2
3#ifndef GDK_GRAPHICS_MATERIAL_H
4#define GDK_GRAPHICS_MATERIAL_H
5
6#include <gdk/graphics/types.h>
7
8#include <memory>
9#include <string>
10#include <string_view>
11#include <vector>
12
13namespace gdk::graphics {
14 class texture;
15
21 class material {
22 public:
30
37
39 using texture_ptr_type = std::shared_ptr<gdk::graphics::texture>;
40
42 virtual void set_texture(const std::string_view aName, texture_ptr_type aTexturePointer) = 0;
43
45 virtual void set_float(const std::string_view aName, float aValue) = 0;
46
48 virtual void set_vector2(const std::string_view aName, vector2_type aValue) = 0;
49
51 virtual void set_vector3(const std::string_view aName, vector3_type aValue) = 0;
52
54 virtual void set_vector4(const std::string_view aName, vector4_type aValue) = 0;
55
57 virtual void set_vector4(const std::string_view aName, const color &aValue) = 0;
58
60 virtual void set_integer(const std::string_view aName, int aValue) = 0;
61
63 virtual void set_integer2(const std::string_view aName, int aValue1, int aValue2) = 0;
64
66 virtual void set_integer3(const std::string_view aName, int aValue1, int aValue2, int aValue3) = 0;
67
69 virtual void set_integer4(const std::string_view aName, int aValue1, int aValue2, int aValue3, int aValue4) = 0;
70
72 virtual void set_int_vector2_array(const std::string_view aName, const std::vector<intvector2_type> &aValue) = 0;
73
74 virtual ~material() = default;
75 };
76}
77
78#endif
79
decides how models using the material should be drawn.
Definition material.h:21
virtual void set_vector4(const std::string_view aName, vector4_type aValue)=0
assigns a 4 component vector
virtual void set_vector3(const std::string_view aName, vector3_type aValue)=0
assigns a 3 component vector
std::shared_ptr< gdk::graphics::texture > texture_ptr_type
textures can be shared among many materials.
Definition material.h:39
virtual void set_integer(const std::string_view aName, int aValue)=0
assigns an integer to the material.
virtual void set_vector2(const std::string_view aName, vector2_type aValue)=0
assigns a 2 component vector
virtual void set_integer4(const std::string_view aName, int aValue1, int aValue2, int aValue3, int aValue4)=0
assigns a 4 integer array to the material.
render_mode
render mode decides transparency etc
Definition material.h:32
@ additive
added to what is behind it, scaled by its alpha: light, a glow, a beam
Definition material.h:35
@ transparent
transparency
Definition material.h:34
@ opaque
no transparency
Definition material.h:33
virtual void set_integer3(const std::string_view aName, int aValue1, int aValue2, int aValue3)=0
assigns a 3 integer array to the material.
virtual void set_int_vector2_array(const std::string_view aName, const std::vector< intvector2_type > &aValue)=0
assigns an array of integer vector2s to the material
face_culling_mode
specify whether front- or back-facing polygons can be culled
Definition material.h:24
@ none
do not cull any polygons
Definition material.h:28
@ back
cull back facing polygons
Definition material.h:26
@ front_and_back
cull front and back facing polygons
Definition material.h:27
@ front
cull front facing polygons
Definition material.h:25
virtual void set_float(const std::string_view aName, float aValue)=0
assigns a float to the material.
virtual void set_texture(const std::string_view aName, texture_ptr_type aTexturePointer)=0
assigns a texture to the material, which shares it; a null texture unsets the name
virtual void set_integer2(const std::string_view aName, int aValue1, int aValue2)=0
assigns a 2 integer array to the material.
virtual void set_vector4(const std::string_view aName, const color &aValue)=0
assign an RGBA colour to a vec4 uniform
uniform color data, usually used to color the surface of a 3d model, but also used for height maps,...
Definition texture.h:14
Represents a 4 channel color: {Red, Green, Blue, Alpha}.
Definition color.h:10