gdk-graphics 0b051eb9b5c1eaa0658babaa4463dd7a80aa9d2c
Loading...
Searching...
No Matches
material.h
1// © Joseph Cameron - All Rights Reserved
2
3#ifndef GDK_GFX_MATERIAL_H
4#define GDK_GFX_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 {
14 class texture;
15
21 //TODO: instead of explicitly naming set_TYPE, do overloads: set_uniform(name, TYPE)
22 class material {
23 public:
31
37
39 using texture_ptr_type = std::shared_ptr<gdk::texture>;
40
43 virtual void set_texture(const std::string_view aName, texture_ptr_type aTexturePointer) = 0;
44
46 virtual void set_float(const std::string_view aName, float aValue) = 0;
47
49 virtual void set_vector2(const std::string_view aName, graphics_vector2_type aValue) = 0;
50
52 virtual void set_vector3(const std::string_view aName, graphics_vector3_type aValue) = 0;
53
55 virtual void set_vector4(const std::string_view aName, graphics_vector4_type aValue) = 0;
56
58 virtual void set_integer(const std::string_view aName, int aValue) = 0;
59
61 virtual void set_integer2(const std::string_view aName, int aValue1, int aValue2) = 0;
62
64 virtual void set_integer3(const std::string_view aName, int aValue1, int aValue2, int aValue3) = 0;
65
67 virtual void set_integer4(const std::string_view aName, int aValue1, int aValue2, int aValue3, int aValue4) = 0;
68
70 virtual void set_int_vector2_array(const std::string_view aName, const std::vector<graphics_intvector2_type> &aValue) = 0;
71
72 virtual ~material() = default;
73 };
74}
75
76#endif
77
decides how models using the material should be drawn.
Definition material.h:22
virtual void set_vector2(const std::string_view aName, graphics_vector2_type aValue)=0
assigns a 2 component vector
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_integer(const std::string_view aName, int aValue)=0
assigns an integer to the material.
std::shared_ptr< gdk::texture > texture_ptr_type
textures can be shared among many webgl1es2_materials.
Definition material.h:39
virtual void set_texture(const std::string_view aName, texture_ptr_type aTexturePointer)=0
assigns a texture to the material.
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.
virtual void set_integer3(const std::string_view aName, int aValue1, int aValue2, int aValue3)=0
assigns a 3 integer array to the material.
face_culling_mode
specify whether front- or back-facing polygons can be culled
Definition material.h:25
@ none
do not cull any polygons
Definition material.h:29
@ back
cull back facing polygons
Definition material.h:27
@ front_and_back
cull front and back facing polygons
Definition material.h:28
@ front
cull front facing polygons
Definition material.h:26
virtual void set_float(const std::string_view aName, float aValue)=0
assigns a float to the material.
virtual void set_int_vector2_array(const std::string_view aName, const std::vector< graphics_intvector2_type > &aValue)=0
assigns an array of integer vector2s to the material
virtual void set_vector4(const std::string_view aName, graphics_vector4_type aValue)=0
assigns a 4 component vector
virtual void set_vector3(const std::string_view aName, graphics_vector3_type aValue)=0
assigns a 3 component vector
render_mode
render mode decides transparency etc
Definition material.h:33
@ transparent
transparency
Definition material.h:35
@ opaque
no transparency
Definition material.h:34
uniform color data, usually used to color the surface of a 3d model, but also used for height maps,...
Definition texture.h:17