8#include <QOpenGLContext>
68 #ifdef GL_GEOMETRY_SHADER
108 QFile file((
":Resources/Shaders/" + shader +
".glsl").getAs<QString>());
112 bool success = file.open(QIODevice::ReadOnly);
123 if (
m_device->context()->isOpenGLES())
124 code =
"#version 300 es\n";
126 code =
"#version 330\n";
130 code +=
"layout (location = 0) in highp ivec3 in_position;\n";
132 code +=
"layout (location = 0) in highp vec3 in_position;\n";
139 code +=
"#define POINT_SHADER 1\n";
142 code +=
"#define LINEWORK_SHADER 1\n";
145 code +=
"#define SOLID_SHADER 1\n";
171 template<
class t_type>
181 m_device->glUniform3iv(location, 1, &value[0]);
185 m_device->glUniform3fv(location, 1, &value[0]);
189 m_device->glUniform4iv(location, 1, &value[0]);
193 m_device->glUniform4fv(location, 1, &value[0]);
197 m_device->glUniformMatrix4fv(location, 1,
false, &value[0][0]);
201 m_device->glUniform1f(location, value);
205 m_device->glUniform1ui(location, value);
215 template<
size_t t_size>
218 m_device->glUniform1fv(location, t_size, &value[0]);
220 template<
size_t t_size>
223 m_device->glUniform1uiv(location, t_size, &value[0]);
225 template<
size_t t_size>
228 m_device->glUniform1uiv(location, t_size, &value[0]);
230 template<u
int01 t_size>
233 m_device->glUniform1fv(location, t_size, &value[0]);
235 template<u
int01 t_size>
248 GLchar infoLog[1024];
249 if (type !=
"PROGRAM")
251 m_device->glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
254 m_device->glGetShaderInfoLog(shader, 1024, NULL, infoLog);
255 throw Exception(
"Shader Compile Error ERROR::SHADER_COMPILATION_ERROR of type: " + type +
"\n" + infoLog);
260 m_device->glGetProgramiv(shader, GL_LINK_STATUS, &success);
263 m_device->glGetProgramInfoLog(shader, 1024, NULL, infoLog);
264 throw Exception(
"Shader Compile Error ERROR::PROGRAM_LINKING_ERROR of type: " + type +
"\n" + infoLog);
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:70
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
constexpr t_index_type size() const
Definition Buffer.hpp:1461
void setSize(t_index_type new_size)
Definition Buffer.hpp:1413
decltype(auto) begin()
Definition Buffer.hpp:504
Definition Dictionary.h:48
Definition Pointer.hpp:303
Definition Exception.hpp:56
Definition GLESShader.h:13
uint04 m_vertex
Definition GLESShader.h:270
void linkShader()
Definition GLESShader.h:83
void setUniformValue(int location, const uint04(&value)[t_size])
Definition GLESShader.h:221
void setUniformValue(int location, const Vector< 4, sint04 > &value)
Definition GLESShader.h:187
void compileShader(ShaderPart type, const String &shader)
Definition GLESShader.h:106
void setUniformValue(int location, const Vector< 4, fltp04 > &value)
Definition GLESShader.h:191
String versionedShaderCode(ShaderPart type, const char *src) const
Definition GLESShader.h:120
void setUniformValue(int location, const Vector< t_size, RGBColor > &value)
Definition GLESShader.h:236
void checkCompileErrors(GLuint shader, String type) const
Definition GLESShader.h:245
uint04 m_geometry
Definition GLESShader.h:271
void bind()
Definition GLESShader.h:240
void compile(ShaderPart type, const char *src)
Definition GLESShader.h:48
bool m_is_int
Definition GLESShader.h:275
ShaderType
Definition GLESShader.h:16
@ e_simple_points
Definition GLESShader.h:17
@ e_solid
Definition GLESShader.h:20
@ e_solid_grid
Definition GLESShader.h:21
@ e_linework
Definition GLESShader.h:19
@ e_solid_texture
Definition GLESShader.h:22
@ e_points
Definition GLESShader.h:18
@ e_all
Definition GLESShader.h:24
@ e_shader_type_size
Definition GLESShader.h:23
uint04 id() const
Definition GLESShader.h:167
ShaderPart
Definition GLESShader.h:27
@ Fragment
Definition GLESShader.h:29
@ Geometry
Definition GLESShader.h:30
@ Vertex
Definition GLESShader.h:28
void setUniformValue(const char *const location, const t_type &value)
Definition GLESShader.h:172
GLESShader(ShaderType type, bool is_integer, const DynamicPointer< GLESGraphicsDevice > &device)
Definition GLESShader.h:32
uint04 m_program_id
Definition GLESShader.h:268
void setUniformValue(int location, const Vector< 3, sint04 > &value)
Definition GLESShader.h:179
void setUniformValue(int location, const Buffer< fltp04 > &value)
Definition GLESShader.h:211
DynamicPointer< GLESGraphicsDevice > m_device
Definition GLESShader.h:273
void setUniformValue(int location, const Matrix< fltp04 > &value)
Definition GLESShader.h:195
void compileAndLink()
Definition GLESShader.h:42
void setUniformValue(int location, const fltp04(&value)[t_size])
Definition GLESShader.h:216
int uniformLocation(const char *const location) const
Definition GLESShader.h:152
void setUniformValue(int location, const fltp04 &value)
Definition GLESShader.h:199
void setUniformValue(int location, const RGBColor(&value)[t_size])
Definition GLESShader.h:226
ShaderType m_shader_type
Definition GLESShader.h:274
void setUniformValue(int location, const Vector< t_size, fltp04 > &value)
Definition GLESShader.h:231
void setUniformValue(int location, const Vector< 3, fltp04 > &value)
Definition GLESShader.h:183
void setUniformValue(int location, const uint04 &value)
Definition GLESShader.h:203
~GLESShader()
Definition GLESShader.h:101
void setUniformValue(int location, const RGBColor &value)
Definition GLESShader.h:207
uint04 m_fragment
Definition GLESShader.h:269
Dictionary< uint04, int > m_shader_variables
Definition GLESShader.h:272
Definition GLESShader.h:279
Dictionary< GLESShader::ShaderType, DynamicPointer< GLESShader > > m_flt_shaders
Definition GLESShader.h:323
const Dictionary< GLESShader::ShaderType, DynamicPointer< GLESShader > > & integerShaders() const
Definition GLESShader.h:286
GLESShaderManager(const DynamicPointer< GLESGraphicsDevice > &device)
Definition GLESShader.h:282
const Dictionary< GLESShader::ShaderType, DynamicPointer< GLESShader > > & floatShaders() const
Definition GLESShader.h:290
DynamicPointer< GLESGraphicsDevice > m_device
Definition GLESShader.h:324
DynamicPointer< GLESShader > shader(const GLESShader::ShaderType &id, bool is_int)
Definition GLESShader.h:294
Dictionary< GLESShader::ShaderType, DynamicPointer< GLESShader > > m_int_shaders
Definition GLESShader.h:322
DynamicPointer< GLESShader > createShader(const GLESShader::ShaderType &id, bool is_int)
Definition GLESShader.h:315
Definition Matrix.hpp:173
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
NDEVR_BASE_API uint04 convertToABGR32BitColor() const
Definition RGBColor.cpp:66
NDEVR_BASE_API String & append(const String &string)
Definition String.cpp:484
NDEVR_BASE_API uint08 hash() const
Definition String.cpp:494
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200
Definition BaseValues.hpp:272