Castor3D
..
|
Base shader class. More...
Classes | |
class | BinaryParser |
ShaderObject loader. More... | |
class | TextLoader |
ShaderObject loader. More... | |
Public Member Functions | |
C3D_API | ShaderObject (ShaderProgram *p_parent, eSHADER_TYPE p_type) |
Constructor. More... | |
virtual C3D_API | ~ShaderObject () |
Destructor. More... | |
virtual C3D_API bool | Create ()=0 |
Creates the program on GPU. More... | |
virtual C3D_API void | Destroy ()=0 |
Destroys the program on GPU. More... | |
virtual C3D_API void | Detach ()=0 |
Detaches this shader from it's program. More... | |
virtual C3D_API void | AttachTo (ShaderProgram &p_program)=0 |
Attaches this shader to the given program. More... | |
C3D_API void | SetFile (eSHADER_MODEL p_eModel, Castor::Path const &p_pathFile) |
Sets the shader file for given model. More... | |
C3D_API bool | HasFile () const |
Tells if the shader object has a source file, whatever model it is. More... | |
C3D_API void | SetSource (eSHADER_MODEL p_eModel, Castor::String const &p_strSource) |
Sets the shader source for given model. More... | |
C3D_API bool | HasSource () const |
Tells if the shader object has a source code, whatever model it is. More... | |
C3D_API void | Bind () |
Activates the shader. More... | |
C3D_API void | Unbind () |
Deactivates the shader. More... | |
virtual C3D_API bool | Compile () |
Compiles the shader. More... | |
virtual C3D_API void | AddFrameVariable (OneIntFrameVariableSPtr p_variable) |
Adds a uniform variable to pass to the shader objects. More... | |
C3D_API OneIntFrameVariableSPtr | FindFrameVariable (Castor::String const &p_name) const |
Finds a variable. More... | |
virtual C3D_API void | FlushFrameVariables () |
Removes all frame variables. More... | |
FrameVariablePtrList & | GetFrameVariables () |
Retrieves the frame variables bound to this shader. More... | |
FrameVariablePtrList const & | GetFrameVariables () const |
Retrieves the frame variables bound to this shader. More... | |
virtual bool | HasParameter (Castor::String const &p_name) |
Tells if the compiled shader has the given parameter. More... | |
Castor::String const & | GetSource (eSHADER_MODEL p_eModel) const |
Retrieves the shader source for given model. More... | |
Castor::String const & | GetLoadedSource () const |
Retrieves the compiled shader source. More... | |
Castor::Path const & | GetFile (eSHADER_MODEL p_eModel) const |
Retrieves the shader file for given model. More... | |
Castor::Path const & | GetCurrentFile () const |
Retrieves the shader file for current model. More... | |
Castor::String | GetStrType () const |
Retrieves the name of this object type. More... | |
eSHADER_TYPE | GetType () const |
Retrieves the this object type. More... | |
void | SetInputType (eTOPOLOGY p_topology) |
Sets the input primitives type. More... | |
eTOPOLOGY | GetInputType () const |
Retrieves the intput primitives type. More... | |
void | SetOutputType (eTOPOLOGY p_topology) |
Sets the output primitives type. More... | |
eTOPOLOGY | GetOutputType () const |
Retrieves the output primitives type. More... | |
void | SetOutputVtxCount (uint8_t p_count) |
Sets the output vertex count. More... | |
uint8_t | GetOutputVtxCount () const |
Retrieves the output vertex count. More... | |
eSHADER_STATUS | GetStatus () const |
Retrieves the object compile status. More... | |
ShaderProgram * | GetParent () const |
Retrieves the object parent. More... | |
virtual void | SetParameter (Castor::String const &p_name, Castor::Matrix4x4r const &p_value) |
Defines the given parameter value. More... | |
virtual void | SetParameter (Castor::String const &p_name, Castor::Matrix3x3r const &p_value) |
Defines the given parameter value. More... | |
Protected Member Functions | |
C3D_API bool | DoCheckErrors () |
Checks for compiler errors. More... | |
virtual Castor::String | DoRetrieveCompilerLog ()=0 |
Protected Attributes | |
ShaderProgram * | m_parent |
The parent shader program. More... | |
eSHADER_TYPE | m_type |
std::array< Castor::Path, eSHADER_MODEL_COUNT > | m_arrayFiles |
Array of files path, sorted by shader model. More... | |
std::array< Castor::String, eSHADER_MODEL_COUNT > | m_arraySources |
Array of source codes, sorted by shader model. More... | |
Castor::String | m_loadedSource |
Actually loaded file path. More... | |
Castor::Path | m_pathLoadedFile |
The shader compile status. More... | |
eSHADER_STATUS | m_status |
FrameVariablePtrStrMap | m_mapFrameVariables |
The frame variables map, ordered by name. More... | |
FrameVariablePtrList | m_listFrameVariables |
The frame variables map. More... | |
eTOPOLOGY | m_eInputType |
The input primitive type (for geometry shaders) More... | |
eTOPOLOGY | m_eOutputType |
The output primitive type (for geometry shaders) More... | |
uint8_t | m_uiOutputVtxCount |
The output vertex count (for geometry shaders) More... | |
eSHADER_MODEL | m_eShaderModel |
The current shader model. More... | |
Base shader class.
C3D_API Castor3D::ShaderObject::ShaderObject | ( | ShaderProgram * | p_parent, |
eSHADER_TYPE | p_type | ||
) |
Constructor.
[in] | p_parent | Parent program |
[in] | p_type | Shader type |
|
virtual |
Destructor.
|
virtual |
Adds a uniform variable to pass to the shader objects.
[in] | p_variable | The variable to pass |
|
pure virtual |
Attaches this shader to the given program.
[in] | p_program | The program |
C3D_API void Castor3D::ShaderObject::Bind | ( | ) |
Activates the shader.
|
virtual |
Compiles the shader.
true
on success
|
pure virtual |
Creates the program on GPU.
|
pure virtual |
Destroys the program on GPU.
|
pure virtual |
Detaches this shader from it's program.
|
protected |
Checks for compiler errors.
true
if no error.
|
protectedpure virtual |
C3D_API OneIntFrameVariableSPtr Castor3D::ShaderObject::FindFrameVariable | ( | Castor::String const & | p_name | ) | const |
Finds a variable.
|
virtual |
Removes all frame variables.
|
inline |
Retrieves the shader file for current model.
References m_arrayFiles, and m_eShaderModel.
|
inline |
Retrieves the shader file for given model.
[in] | p_eModel | The shader model |
References m_arrayFiles.
|
inline |
Retrieves the frame variables bound to this shader.
References m_listFrameVariables.
|
inline |
Retrieves the frame variables bound to this shader.
References m_listFrameVariables.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Retrieves the shader source for given model.
[in] | p_eModel | The shader model |
References m_arraySources.
|
inline |
|
inline |
|
inline |
C3D_API bool Castor3D::ShaderObject::HasFile | ( | ) | const |
Tells if the shader object has a source file, whatever model it is.
true
if the shader object has a source file
|
inlinevirtual |
Tells if the compiled shader has the given parameter.
[in] | p_name | The parameter name |
true
if the parameter was found C3D_API bool Castor3D::ShaderObject::HasSource | ( | ) | const |
Tells if the shader object has a source code, whatever model it is.
true
if the shader object has a source code C3D_API void Castor3D::ShaderObject::SetFile | ( | eSHADER_MODEL | p_eModel, |
Castor::Path const & | p_pathFile | ||
) |
Sets the shader file for given model.
[in] | p_eModel | The shader model |
[in] | p_pathFile | The file name |
|
inline |
Sets the input primitives type.
[in] | p_topology | The input primitives type |
References m_eInputType.
|
inline |
Sets the output primitives type.
[in] | p_topology | The primitives type |
References m_eOutputType.
|
inline |
|
inlinevirtual |
Defines the given parameter value.
[in] | p_name | The parameter name |
[in] | p_value | The parameter value |
|
inlinevirtual |
Defines the given parameter value.
[in] | p_name | The parameter name |
[in] | p_value | The parameter value |
C3D_API void Castor3D::ShaderObject::SetSource | ( | eSHADER_MODEL | p_eModel, |
Castor::String const & | p_strSource | ||
) |
Sets the shader source for given model.
[in] | p_eModel | The shader model |
[in] | p_strSource | The source code |
C3D_API void Castor3D::ShaderObject::Unbind | ( | ) |
Deactivates the shader.
|
protected |
Array of files path, sorted by shader model.
Referenced by GetCurrentFile(), and GetFile().
|
protected |
Array of source codes, sorted by shader model.
Actually loaded ASCII Source-Code
Referenced by GetSource().
|
protected |
The input primitive type (for geometry shaders)
Referenced by GetInputType(), and SetInputType().
|
protected |
The output primitive type (for geometry shaders)
Referenced by GetOutputType(), and SetOutputType().
|
protected |
The current shader model.
Referenced by GetCurrentFile().
|
protected |
The frame variables map.
Referenced by GetFrameVariables().
|
protected |
Actually loaded file path.
Referenced by GetLoadedSource().
|
protected |
The frame variables map, ordered by name.
|
protected |
|
protected |
The shader compile status.
|
protected |
Referenced by GetStatus().
|
protected |
Referenced by GetStrType(), and GetType().
|
protected |
The output vertex count (for geometry shaders)
Referenced by GetOutputVtxCount(), and SetOutputVtxCount().