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>
11#include <unordered_map>
23 virtual void set_float(
const std::string_view aName,
float aValue)
override;
24 virtual void set_vector2(
const std::string_view aName, graphics_vector2_type aValue)
override;
25 virtual void set_vector3(
const std::string_view aName, graphics_vector3_type aValue)
override;
26 virtual void set_vector4(
const std::string_view aName, graphics_vector4_type aValue)
override;
28 virtual void set_integer(
const std::string_view aName,
int aValue)
override;
29 virtual void set_integer2(
const std::string_view aName,
int aValue1,
int aValue2)
override;
30 virtual void set_integer3(
const std::string_view aName,
int aValue1,
int aValue2,
int aValue3)
override;
31 virtual void set_integer4(
const std::string_view aName,
int aValue1,
int aValue2,
int aValue3,
int aValue4)
override;
33 virtual void set_int_vector2_array(
const std::string_view aName,
const std::vector<graphics_intvector2_type> &aValue)
override;
74 using texture_ptr_impl_type = std::shared_ptr<webgl1es2_texture>;
77 using texture_uniform_collection_type =
78 std::unordered_map<std::string, texture_ptr_impl_type>;
90 texture_uniform_collection_type m_Textures;
93 std::unordered_map<std::string, float> m_Floats;
96 std::unordered_map<std::string, graphics_vector2_type> m_Vector2s;
99 std::unordered_map<std::string, graphics_vector3_type> m_vector3s;
102 std::unordered_map<std::string, graphics_vector4_type> m_vector4s;
105 std::unordered_map<std::string, int> m_Integers;
108 std::unordered_map<std::string, graphics_intvector2_type> m_Integer2s;
111 std::unordered_map<std::string, graphics_intvector3_type> m_Integer3s;
114 std::unordered_map<std::string, graphics_intvector4_type> m_Integer4s;
116 std::unordered_map<std::string, std::vector<graphics_intvector2_type>> m_IntVector2Arrays;
decides how models using the material should be drawn.
Definition material.h:22
std::shared_ptr< gdk::texture > texture_ptr_type
textures can be shared among many webgl1es2_materials.
Definition material.h:39
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
render_mode
render mode decides transparency etc
Definition material.h:33
@ opaque
no transparency
Definition material.h:34
virtual void set_texture(const std::string_view aName, const texture_ptr_type aTexture) override
assigns a texture to the material.
virtual void set_float(const std::string_view aName, float aValue) override
assigns a float to the material.
virtual void set_integer(const std::string_view aName, int aValue) override
assigns an integer to the material.
virtual void set_vector4(const std::string_view aName, graphics_vector4_type aValue) override
assigns a 4 component vector
~webgl1es2_material()=default
trivial destructor
std::shared_ptr< gdk::webgl1es2_shader_program > shader_ptr_type
shaders can be shared among many webgl1es2_materials
Definition webgl1es2_material.h:37
webgl1es2_material(webgl1es2_material &&)=default
support move semantics
webgl1es2_material(const webgl1es2_material &)=default
support copy semantics
webgl1es2_material(shader_ptr_type pShader, material::face_culling_mode aface_culling_mode, material::render_mode aRenderMode)
virtual void set_integer2(const std::string_view aName, int aValue1, int aValue2) override
assigns a 2 integer array to the material.
virtual void set_vector3(const std::string_view aName, graphics_vector3_type aValue) override
assigns a 3 component vector
webgl1es2_material & operator=(const webgl1es2_material &)=default
support copy semantics
void activate()
modifies the opengl state, assigning the program, assigning values to the program's uniforms etc.
virtual void set_integer4(const std::string_view aName, int aValue1, int aValue2, int aValue3, int aValue4) override
assigns a 4 integer array to the material.
virtual void set_int_vector2_array(const std::string_view aName, const std::vector< graphics_intvector2_type > &aValue) override
assigns an array of integer vector2s to the material
virtual void set_integer3(const std::string_view aName, int aValue1, int aValue2, int aValue3) override
assigns a 3 integer array to the material.
webgl1es2_material & operator=(webgl1es2_material &&)=default
support move semantics
virtual void set_vector2(const std::string_view aName, graphics_vector2_type aValue) override
assigns a 2 component vector