2 #ifndef KJY_OBJECT_ORIENTED_OPENGL_MATERIAL_HPP_ 3 #define KJY_OBJECT_ORIENTED_OPENGL_MATERIAL_HPP_ 4 #include "../OOOGL_Core.hpp" 5 #include "../GLobjects/Texture.hpp" 8 #include "MaterialAttribute.hpp" 9 #include <unordered_map> 14 const char* what()
const noexcept
override{
15 return(
"Attempted to assign material attribute with mismatching type");
29 virtual void configureShader(GLuint program)
const = 0;
32 virtual void uploadUniforms(GLuint program)
const = 0;
35 virtual const GLSLBlockLayoutConstPtr getMaterialGLSLLayout()
const = 0;
37 virtual bool hasAttribute(
const std::string& attr_name)
const = 0;
38 virtual const MaterialAttribute& getAttribute(
const std::string& attr_name)
const = 0;
39 virtual void setAttribute(
const std::string& attr_name,
const MaterialAttribute& attr) = 0;
46 virtual void configureShader(GLuint program)
const override;
51 virtual void configureShader(GLuint program, GLuint textured_binding_offset)
const;
54 virtual void uploadUniforms(GLuint pid)
const override;
55 virtual const GLSLBlockLayoutConstPtr getMaterialGLSLLayout()
const override;
58 virtual bool hasAttribute(
const std::string& attr_name)
const override;
59 virtual const MaterialAttribute& getAttribute(
const std::string& attr_name)
const override;
60 virtual void setAttribute(
const std::string& attr_name,
const MaterialAttribute& attr)
override;
70 GLuint autoBindTextures(GLuint program, GLuint texture_binding_offset = 0)
const;
73 void bindTexturesExplicit(GLuint map_Ka_index, GLuint map_Kd_index, GLuint map_Ks_index, GLuint map_bump_index, GLuint map_d_index, GLuint map_disp_index)
const;
75 static const GLSLBlockLayoutConstPtr getMaterialGLSLLayout_static() {
return(&_glsl_layout_);}
79 std::unordered_map<std::string, MaterialAttribute> _attributes = {
96 void _bind_textures_(GLuint Ka, GLuint Kd, GLuint Ks, GLuint bump, GLuint d, GLuint disp)
const;
107 virtual void configureShader(GLuint program)
const override;
110 virtual void uploadUniforms(GLuint program)
const override;
113 virtual const GLSLBlockLayoutConstPtr getMaterialGLSLLayout()
const override;
115 virtual bool hasAttribute(
const std::string& attr_name)
const override;
116 virtual const MaterialAttribute& getAttribute(
const std::string& attr_name)
const override;
117 virtual void setAttribute(
const std::string& attr_name,
const MaterialAttribute& attr)
override;
119 virtual void printMaterial()
const;
122 static const GLSLBlockLayoutConstPtr getMaterialGLSLLayout_static() {
return(&_glsl_layout_);}
126 std::unordered_map<std::string, MaterialAttribute> _attributes = {
Definition: Material.hpp:43
Definition: Material.hpp:13
Definition: OOOGL_Core.hpp:133
Definition: Material.hpp:23
Definition: MaterialAttribute.hpp:67
Definition: Core_Utilities.cpp:3