Shader¶
Shader interface.
Overview¶
Typical use cases:
Defining a common interface for shader management
Header¶
<RaeptorCogs/GAPI/Common/Ressources/Shader.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Classes¶
Class |
Description |
|---|---|
|
Shader interface. |
-
class Shader : public RaeptorCogs::GAPI::Common::ObjectData¶
Shader interface.
Provides a common interface for shader management.
Note
This is an abstract base class and should be inherited by specific shader implementations.
Subclassed by RaeptorCogs::GAPI::GL::Shader, RaeptorCogs::GAPI::Vulkan::Shader
Public Functions
-
Shader() = default¶
Default constructor.
-
virtual ~Shader() = default¶
Virtual destructor.
-
virtual void build(const char *vertexSource, const char *fragmentSource) = 0¶
Build the shader program from source code.
Note
Must be implemented by derived classes.
- Parameters:
vertexSource – Source code for the vertex shader.
fragmentSource – Source code for the fragment shader.
-
virtual void setBool(const std::string &name, bool value) const = 0¶
Set a boolean uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – Boolean value to set.
-
virtual void setInt(const std::string &name, int value) const = 0¶
Set an integer uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – Integer value to set.
-
virtual void setUInt(const std::string &name, unsigned int value) const = 0¶
Set an unsigned integer uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – Unsigned integer value to set.
-
virtual void setFloat(const std::string &name, float value) const = 0¶
Set a float uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – Float value to set.
-
virtual void setVec2(const std::string &name, const glm::vec2 &value) const = 0¶
Set a vec2 uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – vec2 value to set.
-
virtual void setVec3(const std::string &name, const glm::vec3 &value) const = 0¶
Set a vec3 uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – vec3 value to set.
-
virtual void setVec4(const std::string &name, const glm::vec4 &value) const = 0¶
Set a vec4 uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
value – vec4 value to set.
-
virtual void setMat2(const std::string &name, const glm::mat2 &mat) const = 0¶
Set a mat2 uniform variable.
Note
Must be implemented by derived classes.
- Parameters:
name – Name of the uniform variable.
mat – mat2 value to set.
-
Shader() = default¶