14 GLint ViewMatrix = HANDLE_NULL;
15 GLint ModelMatrix = HANDLE_NULL;
16 GLint ProjectionMatrix = HANDLE_NULL;
17 GLint ViewInvMatrix = HANDLE_NULL;
18 GLint ProjectionInvMatrix = HANDLE_NULL;
19 GLint CameraPosition = HANDLE_NULL;
21 GLint LightPosition = HANDLE_NULL;
22 GLint LightType = HANDLE_NULL;
23 GLint LightRadius = HANDLE_NULL;
24 GLint LightColor = HANDLE_NULL;
25 GLint LightShadowMap = HANDLE_NULL;
26 GLint LightMatrix = HANDLE_NULL;
27 GLint LightShadowMode = HANDLE_NULL;
28 GLint LightSize = HANDLE_NULL;
29 GLint LightIrradiance = HANDLE_NULL;
30 GLint LightPrefilter = HANDLE_NULL;
31 GLint LightBrdfLut = HANDLE_NULL;
33 GLint JointMatrix = HANDLE_NULL;
34 GLint SkinningMode = HANDLE_NULL;
36 GLint SourceBuffer = HANDLE_NULL;
37 GLint SourceBufferSize = HANDLE_NULL;
39 GLint SdfEnvSize = HANDLE_NULL;
40 GLint SdfCellSize = HANDLE_NULL;
41 GLint SdfNodeSize = HANDLE_NULL;
42 GLint SdfNodeSpace = HANDLE_NULL;
43 GLint SdfFrameCount = HANDLE_NULL;
44 GLint SdfMap = HANDLE_NULL;
48 GLint Position = HANDLE_NULL;
49 GLint Color = HANDLE_NULL;
50 GLint Normal = HANDLE_NULL;
52 GLint TextureCoord = HANDLE_NULL;
53 GLint Weight = HANDLE_NULL;
54 GLint JointId = HANDLE_NULL;
64 typedef std::map<std::string, GLProgramHandle::Element*> GLElementList;
70 void Exterminate()
override;
72 void SetProgram(GLuint program) {
76 Element* AttributeLocation(
const char* location)
const {
77 auto pair = AttributesList.find(location);
78 return pair == AttributesList.end() ? nullptr : pair->second;
81 Element* UniformLocation(
const char* location)
const {
82 auto pair = UniformsList.find(location);
83 return pair == UniformsList.end() ? nullptr : pair->second;
86 void SetAttribVec3(
const std::string& location, vec3& value);
88 void SetAttribVec4(
const std::string& location, vec4& value);
90 void SetUniformInt(
const std::string& location,
int value);
92 void SetUniformFloat(
const std::string& location,
float value);
94 void SetUniformMat4(
const std::string& location, mat4& value);
96 void SetUniformMat3(
const std::string& location, mat3& value);
98 void SetAttributesList(std::map<std::string, std::string>& vert, std::map<std::string, std::string>& frag);
100 void SetUniformsList(std::map<std::string, std::string>& vert, std::map<std::string, std::string>& frag);
102 GLElementList GetAttributesList()
const;
104 GLElementList GetUniformsList()
const;
106 void SaveShader(
const std::string& path);
108 void SetValue(std::string name_str, Arguments value)
override;
110 std::string PrintValue()
const override;
113 void Init(
const AssetMgr::AssetReference* asset)
override;
116 static std::string getImplementName(std::map<std::string, std::string>& list,
const std::string& name);
120 GLAttributeHandles Attributes;
121 GLUniformHandles Uniforms;
123 GLElementList AttributesList;
124 GLElementList UniformsList;
126 GLuint CullFace = GL_BACK;
128 std::string m_fragShaderName;
129 std::string m_vertShaderName;