Loading...
Searching...
No Matches
Shader.hpp
Go to the documentation of this file.
7// In no event will the authors be held liable for any damages arising from the use of this software.
168 Shader(const std::filesystem::path& vertexShaderFilename, const std::filesystem::path& fragmentShaderFilename);
255 Shader(std::string_view vertexShader, std::string_view geometryShader, std::string_view fragmentShader);
318 Shader(InputStream& vertexShaderStream, InputStream& geometryShaderStream, InputStream& fragmentShaderStream);
426 [[nodiscard]] bool loadFromMemory(std::string_view vertexShader, std::string_view fragmentShader);
491 [[nodiscard]] bool loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream);
739 void setUniformArray(const std::string& name, const Glsl::Vec2* vectorArray, std::size_t length);
749 void setUniformArray(const std::string& name, const Glsl::Vec3* vectorArray, std::size_t length);
759 void setUniformArray(const std::string& name, const Glsl::Vec4* vectorArray, std::size_t length);
769 void setUniformArray(const std::string& name, const Glsl::Mat3* matrixArray, std::size_t length);
779 void setUniformArray(const std::string& name, const Glsl::Mat4* matrixArray, std::size_t length);
void setUniformArray(const std::string &name, const Glsl::Mat4 *matrixArray, std::size_t length)
Specify values for mat4[] array uniform.
Shader(const std::filesystem::path &vertexShaderFilename, const std::filesystem::path &geometryShaderFilename, const std::filesystem::path &fragmentShaderFilename)
Construct from vertex, geometry and fragment shader files.
bool loadFromStream(InputStream &stream, Type type)
Load the vertex, geometry or fragment shader from a custom stream.
bool loadFromFile(const std::filesystem::path &vertexShaderFilename, const std::filesystem::path &geometryShaderFilename, const std::filesystem::path &fragmentShaderFilename)
Load the vertex, geometry and fragment shaders from files.
void setUniform(const std::string &name, const Glsl::Ivec4 &vector)
Specify value for ivec4 uniform.
bool loadFromStream(InputStream &vertexShaderStream, InputStream &fragmentShaderStream)
Load both the vertex and fragment shaders from custom streams.
static bool isGeometryAvailable()
Tell whether or not the system supports geometry shaders.
Shader(const std::filesystem::path &filename, Type type)
Construct from a shader file.
bool loadFromFile(const std::filesystem::path &filename, Type type)
Load the vertex, geometry or fragment shader from a file.
void setUniformArray(const std::string &name, const Glsl::Mat3 *matrixArray, std::size_t length)
Specify values for mat3[] array uniform.
void setUniform(const std::string &name, Glsl::Vec2 vector)
Specify value for vec2 uniform.
void setUniformArray(const std::string &name, const float *scalarArray, std::size_t length)
Specify values for float[] array uniform.
void setUniform(const std::string &name, const Texture &texture)
Specify a texture as sampler2D uniform.
bool loadFromFile(const std::filesystem::path &vertexShaderFilename, const std::filesystem::path &fragmentShaderFilename)
Load both the vertex and fragment shaders from files.
void setUniform(const std::string &name, Glsl::Bvec2 vector)
Specify value for bvec2 uniform.
bool loadFromMemory(std::string_view vertexShader, std::string_view fragmentShader)
Load both the vertex and fragment shaders from source codes in memory.
Shader(InputStream &vertexShaderStream, InputStream &fragmentShaderStream)
Construct from vertex and fragment shader streams.
void setUniform(const std::string &name, const Glsl::Ivec3 &vector)
Specify value for ivec3 uniform.
void setUniform(const std::string &name, Glsl::Ivec2 vector)
Specify value for ivec2 uniform.
bool loadFromStream(InputStream &vertexShaderStream, InputStream &geometryShaderStream, InputStream &fragmentShaderStream)
Load the vertex, geometry and fragment shaders from custom streams.
void setUniformArray(const std::string &name, const Glsl::Vec4 *vectorArray, std::size_t length)
Specify values for vec4[] array uniform.
void setUniform(const std::string &name, const Glsl::Vec3 &vector)
Specify value for vec3 uniform.
void setUniform(const std::string &name, const Glsl::Bvec3 &vector)
Specify value for bvec3 uniform.
void setUniform(const std::string &name, CurrentTextureType)
Specify current texture as sampler2D uniform.
void setUniformArray(const std::string &name, const Glsl::Vec2 *vectorArray, std::size_t length)
Specify values for vec2[] array uniform.
void setUniform(const std::string &name, const Glsl::Vec4 &vector)
Specify value for vec4 uniform.
void setUniform(const std::string &name, float x)
Specify value for float uniform.
void setUniform(const std::string &name, const Glsl::Mat3 &matrix)
Specify value for mat3 matrix.
unsigned int getNativeHandle() const
Get the underlying OpenGL handle of the shader.
Shader(std::string_view vertexShader, std::string_view fragmentShader)
Construct from vertex and fragment shaders in memory.
static CurrentTextureType CurrentTexture
Represents the texture of the object being drawn.
Definition Shader.hpp:85
void setUniform(const std::string &name, const Glsl::Bvec4 &vector)
Specify value for bvec4 uniform.
void setUniform(const std::string &name, const Glsl::Mat4 &matrix)
Specify value for mat4 matrix.
void setUniform(const std::string &name, const Texture &&texture)=delete
Disallow setting from a temporary texture.
bool loadFromMemory(std::string_view shader, Type type)
Load the vertex, geometry or fragment shader from a source code in memory.
void setUniformArray(const std::string &name, const Glsl::Vec3 *vectorArray, std::size_t length)
Specify values for vec3[] array uniform.
Shader(std::string_view vertexShader, std::string_view geometryShader, std::string_view fragmentShader)
Construct from vertex, geometry and fragment shaders in memory.
Shader(InputStream &vertexShaderStream, InputStream &geometryShaderStream, InputStream &fragmentShaderStream)
Construct from vertex, geometry and fragment shader streams.
void setUniform(const std::string &name, bool x)
Specify value for bool uniform.
Shader(const std::filesystem::path &vertexShaderFilename, const std::filesystem::path &fragmentShaderFilename)
Construct from vertex and fragment shader files.
bool loadFromMemory(std::string_view vertexShader, std::string_view geometryShader, std::string_view fragmentShader)
Load the vertex, geometry and fragment shaders from source codes in memory.
Definition AudioResource.hpp:36
Special type that can be passed to setUniform(), and that represents the texture of the object being ...
Definition Shader.hpp:75