3 #ifndef GDK_GFX_WEBGL1ES2_MATERIAL_H 4 #define GDK_GFX_WEBGL1ES2_MATERIAL_H 6 #include <gdk/material.h> 7 #include <gdk/webgl1es2_shader_program.h> 9 #include <unordered_map> 25 virtual void setFloat(
const std::string& aName,
float aValue)
override;
26 virtual void setVector2(
const std::string& aName, graphics_vector2_type aValue)
override;
27 virtual void setVector3(
const std::string &aName, graphics_vector3_type aValue)
override;
28 virtual void setVector4(
const std::string &aName, graphics_vector4_type aValue)
override;
30 virtual void setInteger(
const std::string& aName,
int aValue)
override;
31 virtual void setInteger2(
const std::string& aName,
int aValue1,
int aValue2)
override;
32 virtual void setInteger3(
const std::string& aName,
int aValue1,
int aValue2,
33 int aValue3)
override;
34 virtual void setInteger4(
const std::string& aName,
int aValue1,
int aValue2,
35 int aValue3,
int aValue4)
override;
76 using texture_ptr_impl_type = std::shared_ptr<webgl1es2_texture>;
79 using texture_uniform_collection_type =
80 std::unordered_map<std::string, texture_ptr_impl_type>;
92 texture_uniform_collection_type m_Textures;
95 std::unordered_map<std::string, float> m_Floats;
98 std::unordered_map<std::string, graphics_vector2_type> m_Vector2s;
101 std::unordered_map<std::string, graphics_vector3_type> m_Vector3s;
104 std::unordered_map<std::string, graphics_vector4_type> m_Vector4s;
107 std::unordered_map<std::string, int> m_Integers;
110 std::unordered_map<std::string, std::array<int, 2>> m_Integer2s;
113 std::unordered_map<std::string, std::array<int, 3>> m_Integer3s;
116 std::unordered_map<std::string, std::array<int, 4>> m_Integer4s;
virtual void setInteger4(const std::string &aName, int aValue1, int aValue2, int aValue3, int aValue4) override
assigns a 4 integer array to the material.
void activate()
modifies the opengl state, assigning the program, assigning values to the program's uniforms etc...
Definition: webgl1es2_material.h:17
webgl1es2_material(webgl1es2_material &&)=default
support move semantics
virtual void setTexture(const std::string &aName, texture_ptr_type aTexture) override
assigns a texture to the material.
virtual void setVector4(const std::string &aName, graphics_vector4_type aValue) override
assigns a 4 component vector
virtual void setFloat(const std::string &aName, float aValue) override
assigns a float to the material.
webgl1es2_material & operator=(webgl1es2_material &&)=default
support move semantics
std::shared_ptr< gdk::texture > texture_ptr_type
textures can be shared among many webgl1es2_materials.
Definition: material.h:40
std::shared_ptr< gdk::webgl1es2_shader_program > shader_ptr_type
shaders can be shared among many webgl1es2_materials
Definition: webgl1es2_material.h:39
virtual void setVector2(const std::string &aName, graphics_vector2_type aValue) override
assigns a 2 component vector
decides how models using the material should be drawn.
Definition: material.h:20
virtual void setInteger(const std::string &aName, int aValue) override
assigns an integer to the material.
render_mode
render mode decides transparency etc
Definition: material.h:33
virtual void setInteger3(const std::string &aName, int aValue1, int aValue2, int aValue3) override
assigns a 3 integer array to the material.
FaceCullingMode
specify whether front- or back-facing polygons can be culled
Definition: material.h:24
virtual void setVector3(const std::string &aName, graphics_vector3_type aValue) override
assigns a 3 component vector
~webgl1es2_material()=default
trivial destructor
virtual void setInteger2(const std::string &aName, int aValue1, int aValue2) override
assigns a 2 integer array to the material.