|
Castor3D
..
|
Base shader program implementation, used to share functions through the supported shader languages. More...
Inheritance diagram for Castor3D::ShaderProgram:
Collaboration diagram for Castor3D::ShaderProgram:Classes | |
| class | BinaryParser |
| ShaderProgram loader. More... | |
| class | TextLoader |
| ShaderProgram loader. More... | |
Public Member Functions | |
| C3D_API | ShaderProgram (RenderSystem &p_renderSystem, eSHADER_LANGUAGE p_langage) |
| Constructor. More... | |
| virtual C3D_API | ~ShaderProgram () |
| Destructor. More... | |
| C3D_API ShaderObjectSPtr | CreateObject (eSHADER_TYPE p_type) |
| Creates the wanted shader object. More... | |
| virtual C3D_API void | SetFile (eSHADER_MODEL p_eModel, Castor::Path const &p_pathFile) |
| Sets all objects file. More... | |
| C3D_API void | AddFrameVariableBuffer (FrameVariableBufferSPtr p_pVariableBuffer, uint64_t p_shaderMask) |
| Adds a variable buffer to add. More... | |
| C3D_API void | ResetToCompile () |
| Resets compilation variables to be able to compile again. More... | |
| C3D_API void | SetInputType (eSHADER_TYPE p_target, eTOPOLOGY p_topology) |
| Sets the input primitives type. More... | |
| C3D_API void | SetOutputType (eSHADER_TYPE p_target, eTOPOLOGY p_topology) |
| Sets the output primitives type. More... | |
| C3D_API void | SetOutputVtxCount (eSHADER_TYPE p_target, uint8_t p_count) |
| Sets the output vertex count. More... | |
| C3D_API void | SetFile (eSHADER_TYPE p_target, eSHADER_MODEL p_eModel, Castor::Path const &p_pathFile) |
| Sets the shader file for given model. More... | |
| C3D_API Castor::Path | GetFile (eSHADER_TYPE p_target, eSHADER_MODEL p_eModel) const |
| Retrieves the shader file for given model. More... | |
| C3D_API bool | HasFile (eSHADER_TYPE p_target) const |
| Tells if the shader object has a source file, whatever model it is. More... | |
| C3D_API void | SetSource (eSHADER_TYPE p_target, eSHADER_MODEL p_eModel, Castor::String const &p_strSource) |
| Sets the shader source for given model. More... | |
| C3D_API Castor::String | GetSource (eSHADER_TYPE p_target, eSHADER_MODEL p_eModel) const |
| Retrieves the shader source for given model. More... | |
| C3D_API bool | HasSource (eSHADER_TYPE p_target) const |
| Tells if the shader object has a source code, whatever model it is. More... | |
| C3D_API bool | HasObject (eSHADER_TYPE p_target) const |
| Tests if the program has an object for given type. More... | |
| C3D_API eSHADER_STATUS | GetObjectStatus (eSHADER_TYPE p_target) const |
| Retrieves the given object type status. More... | |
| C3D_API OneIntFrameVariableSPtr | CreateFrameVariable (Castor::String const &p_name, eSHADER_TYPE p_type, int p_iNbOcc=1) |
| Creates a variable. More... | |
| C3D_API OneIntFrameVariableSPtr | FindFrameVariable (Castor::String const &p_name, eSHADER_TYPE p_type) const |
| Looks for a variable. More... | |
| C3D_API FrameVariableBufferSPtr | FindFrameVariableBuffer (Castor::String const &p_name) const |
| Finds a variable. More... | |
| C3D_API FrameVariablePtrList & | GetFrameVariables (eSHADER_TYPE p_type) |
| Retrieves the frame variables bound to one shader type. More... | |
| C3D_API FrameVariablePtrList const & | GetFrameVariables (eSHADER_TYPE p_type) const |
| Retrieves the frame variables bound to one shader type. More... | |
| virtual C3D_API void | Cleanup ()=0 |
| Cleans the program up. More... | |
| virtual C3D_API bool | Initialise ()=0 |
| Initialises the program. More... | |
| virtual C3D_API void | Bind (bool p_bindUbo=true)=0 |
| Activates the program. More... | |
| virtual C3D_API void | Unbind ()=0 |
| Deactivates the program. More... | |
| virtual C3D_API bool | Link ()=0 |
| Links all shader objects held by the program. More... | |
| virtual C3D_API ProgramInputLayout const & | GetLayout () const =0 |
| virtual C3D_API ProgramInputLayout & | GetLayout ()=0 |
| FrameVariableBufferPtrList & | GetFrameVariableBuffers (eSHADER_TYPE p_type) |
| Retrieves the frame variable buffers bound to one shader type. More... | |
| FrameVariableBufferPtrList const & | GetFrameVariableBuffers (eSHADER_TYPE p_type) const |
| Retrieves the frame variable buffers bound to one shader type. More... | |
| FrameVariableBufferPtrList & | GetFrameVariableBuffers () |
| Retrieves the frame variable buffers. More... | |
| FrameVariableBufferPtrList const & | GetFrameVariableBuffers () const |
| Retrieves the frame variable buffers. More... | |
| ePROGRAM_STATUS | GetStatus () const |
| Retrieves the program link status. More... | |
| eSHADER_LANGUAGE | GetLanguage () const |
| Retrieves the shader language. More... | |
Static Public Attributes | |
Attributes | |
| static C3D_API const Castor::String | Position |
| Name of the position attribute. More... | |
| static C3D_API const Castor::String | Normal |
| Name of the normal attribute. More... | |
| static C3D_API const Castor::String | Tangent |
| Name of the tangent attribute. More... | |
| static C3D_API const Castor::String | Bitangent |
| Name of the bitangent attribute. More... | |
| static C3D_API const Castor::String | Texture |
| Name of the texture attribute. More... | |
| static C3D_API const Castor::String | Colour |
| Name of the colour attribute. More... | |
| static C3D_API const Castor::String | Text |
| Name of the text overlay texture attribute. More... | |
| static C3D_API const Castor::String | BoneIds0 |
| Name of the first bones ID attribute. More... | |
| static C3D_API const Castor::String | BoneIds1 |
| Name of the second bones ID attribute. More... | |
| static C3D_API const Castor::String | Weights0 |
| Name of the first bones weight attribute. More... | |
| static C3D_API const Castor::String | Weights1 |
| Name of the second bones weight attribute. More... | |
| static C3D_API const Castor::String | Transform |
| Name of the instance transform attribute. More... | |
Scene | |
| static C3D_API const Castor::String | CameraPos |
| Name of the camera position frame variable. More... | |
| static C3D_API const Castor::String | AmbientLight |
| Name of the ambient light frame variable. More... | |
| static C3D_API const Castor::String | BackgroundColour |
| Name of the background colour frame variable. More... | |
| static C3D_API const Castor::String | LightsCount |
| Name of the lights count frame variable. More... | |
| static C3D_API const Castor::String | Lights |
| Name of the lights frame variable. More... | |
Pass | |
| static C3D_API const Castor::String | MatAmbient |
| Name of the ambient material colour frame variable. More... | |
| static C3D_API const Castor::String | MatDiffuse |
| Name of the diffuse material colour frame variable. More... | |
| static C3D_API const Castor::String | MatSpecular |
| Name of the specular material colour frame variable. More... | |
| static C3D_API const Castor::String | MatEmissive |
| Name of the emissive material colour frame variable. More... | |
| static C3D_API const Castor::String | MatShininess |
| Name of the material shininess frame variable. More... | |
| static C3D_API const Castor::String | MatOpacity |
| Name of the material opacity frame variable. More... | |
| static C3D_API const Castor::String | MapText |
| Name of the overlay text image frame variable. More... | |
Textures | |
| static C3D_API const Castor::String | MapColour |
| Name of the colour texture frame variable. More... | |
| static C3D_API const Castor::String | MapAmbient |
| Name of the ambient texture frame variable. More... | |
| static C3D_API const Castor::String | MapDiffuse |
| Name of the diffuse texture frame variable. More... | |
| static C3D_API const Castor::String | MapSpecular |
| Name of the specular texture frame variable. More... | |
| static C3D_API const Castor::String | MapEmissive |
| Name of the emissive texture frame variable. More... | |
| static C3D_API const Castor::String | MapNormal |
| Name of the emissive texture frame variable. More... | |
| static C3D_API const Castor::String | MapOpacity |
| Name of the opacity texture frame variable. More... | |
| static C3D_API const Castor::String | MapGloss |
| Name of the shininess texture frame variable. More... | |
| static C3D_API const Castor::String | MapHeight |
| Name of the height texture frame variable. More... | |
Frame Variable Buffers | |
| static C3D_API const Castor::String | BufferMatrix |
| Name of the matrix frame variable buffer. More... | |
| static C3D_API const Castor::String | BufferScene |
| Name of the scene frame variable buffer. More... | |
| static C3D_API const Castor::String | BufferPass |
| Name of the pass frame variable buffer. More... | |
Protected Member Functions | |
| C3D_API void | DoCleanup () |
| Cleans the program up. More... | |
| C3D_API bool | DoInitialise () |
| Initialises the program. More... | |
| C3D_API void | DoBind (bool p_bindUbo) |
| Activates the program. More... | |
| C3D_API void | DoUnbind () |
| Deactivates the program. More... | |
| C3D_API bool | DoLink () |
| Links all shader objects held by the program. More... | |
Protected Attributes | |
| ePROGRAM_STATUS | m_status |
| < The program status More... | |
| eSHADER_LANGUAGE | m_eLanguage |
| std::array< ShaderObjectSPtr, eSHADER_TYPE_COUNT > | m_pShaders |
| The shaders array. More... | |
| std::vector< ShaderObjectSPtr > | m_activeShaders |
| The active shaders array. More... | |
| std::array< Castor::Path, eSHADER_MODEL_COUNT > | m_arrayFiles |
| Array of files path, sorted by shader model. More... | |
| FrameVariableBufferPtrStrMap | m_frameVariableBuffersByName |
| The frame variable buffers map, ordered by name. More... | |
| std::array< FrameVariableBufferPtrList, eSHADER_TYPE_COUNT > | m_frameVariableBuffers |
| The frame variable buffers map, ordered by shader type. More... | |
| FrameVariableBufferPtrList | m_listFrameVariableBuffers |
| The frame variable buffers map. More... | |
Friends | |
| class | Castor::TextLoader< Castor3D::ShaderProgram > |
Base shader program implementation, used to share functions through the supported shader languages.
| C3D_API Castor3D::ShaderProgram::ShaderProgram | ( | RenderSystem & | p_renderSystem, |
| eSHADER_LANGUAGE | p_langage | ||
| ) |
Constructor.
| [in] | p_renderSystem | The RenderSystem instance |
| [in] | p_langage | The program language |
|
virtual |
Destructor.
| C3D_API void Castor3D::ShaderProgram::AddFrameVariableBuffer | ( | FrameVariableBufferSPtr | p_pVariableBuffer, |
| uint64_t | p_shaderMask | ||
| ) |
Adds a variable buffer to add.
| [in] | p_pVariableBuffer | The GPU variables buffer |
| [in] | p_shaderMask | MASK_SHADER_TYPE combination, to set at what shaders it is to be bound |
|
pure virtual |
Activates the program.
| [in] | p_bindUbo | Tells if the frame variable buffers muts be bound. |
|
pure virtual |
Cleans the program up.
| C3D_API OneIntFrameVariableSPtr Castor3D::ShaderProgram::CreateFrameVariable | ( | Castor::String const & | p_name, |
| eSHADER_TYPE | p_type, | ||
| int | p_iNbOcc = 1 |
||
| ) |
Creates a variable.
| [in] | p_name | The variable name |
| [in] | p_type | The shader type |
| [in] | p_iNbOcc | The array dimension |
| C3D_API ShaderObjectSPtr Castor3D::ShaderProgram::CreateObject | ( | eSHADER_TYPE | p_type | ) |
Creates the wanted shader object.
| [in] | p_type | The shader object concerned |
|
protected |
Activates the program.
| [in] | p_bindUbo | Tells if the frame variable buffers muts be bound. |
|
protected |
Cleans the program up.
|
protected |
Initialises the program.
|
protected |
Links all shader objects held by the program.
|
protected |
Deactivates the program.
| C3D_API OneIntFrameVariableSPtr Castor3D::ShaderProgram::FindFrameVariable | ( | Castor::String const & | p_name, |
| eSHADER_TYPE | p_type | ||
| ) | const |
Looks for a variable.
| [in] | p_name | The variable name |
| [in] | p_type | The shader type |
| C3D_API FrameVariableBufferSPtr Castor3D::ShaderProgram::FindFrameVariableBuffer | ( | Castor::String const & | p_name | ) | const |
Finds a variable.
| C3D_API Castor::Path Castor3D::ShaderProgram::GetFile | ( | eSHADER_TYPE | p_target, |
| eSHADER_MODEL | p_eModel | ||
| ) | const |
Retrieves the shader file for given model.
| [in] | p_target | The shader object concerned |
| [in] | p_eModel | The shader model |
|
inline |
Retrieves the frame variable buffers bound to one shader type.
| [in] | p_type | The shader type |
References m_frameVariableBuffers.
|
inline |
Retrieves the frame variable buffers bound to one shader type.
| [in] | p_type | The shader type |
References m_frameVariableBuffers.
|
inline |
|
inline |
| C3D_API FrameVariablePtrList& Castor3D::ShaderProgram::GetFrameVariables | ( | eSHADER_TYPE | p_type | ) |
Retrieves the frame variables bound to one shader type.
| [in] | p_type | The shader type |
| C3D_API FrameVariablePtrList const& Castor3D::ShaderProgram::GetFrameVariables | ( | eSHADER_TYPE | p_type | ) | const |
Retrieves the frame variables bound to one shader type.
| [in] | p_type | The shader type |
|
inline |
|
pure virtual |
|
pure virtual |
| C3D_API eSHADER_STATUS Castor3D::ShaderProgram::GetObjectStatus | ( | eSHADER_TYPE | p_target | ) | const |
Retrieves the given object type status.
| C3D_API Castor::String Castor3D::ShaderProgram::GetSource | ( | eSHADER_TYPE | p_target, |
| eSHADER_MODEL | p_eModel | ||
| ) | const |
Retrieves the shader source for given model.
| [in] | p_target | The shader object concerned |
| [in] | p_eModel | The shader model |
|
inline |
| C3D_API bool Castor3D::ShaderProgram::HasFile | ( | eSHADER_TYPE | p_target | ) | const |
Tells if the shader object has a source file, whatever model it is.
| [in] | p_target | The shader object concerned |
true if the shader object has a source file | C3D_API bool Castor3D::ShaderProgram::HasObject | ( | eSHADER_TYPE | p_target | ) | const |
Tests if the program has an object for given type.
| [in] | p_target | The shader object type |
true if the shader object exists | C3D_API bool Castor3D::ShaderProgram::HasSource | ( | eSHADER_TYPE | p_target | ) | const |
Tells if the shader object has a source code, whatever model it is.
| [in] | p_target | The shader object concerned |
true if the shader object has a source code
|
pure virtual |
Initialises the program.
|
pure virtual |
Links all shader objects held by the program.
| C3D_API void Castor3D::ShaderProgram::ResetToCompile | ( | ) |
Resets compilation variables to be able to compile again.
|
virtual |
Sets all objects file.
| [in] | p_eModel | The shader model |
| [in] | p_pathFile | The file name |
| C3D_API void Castor3D::ShaderProgram::SetFile | ( | eSHADER_TYPE | p_target, |
| eSHADER_MODEL | p_eModel, | ||
| Castor::Path const & | p_pathFile | ||
| ) |
Sets the shader file for given model.
| [in] | p_target | The shader object concerned |
| [in] | p_eModel | The shader model |
| [in] | p_pathFile | The file name |
| C3D_API void Castor3D::ShaderProgram::SetInputType | ( | eSHADER_TYPE | p_target, |
| eTOPOLOGY | p_topology | ||
| ) |
Sets the input primitives type.
| [in] | p_target | The shader object concerned |
| [in] | p_topology | The input primitives type |
| C3D_API void Castor3D::ShaderProgram::SetOutputType | ( | eSHADER_TYPE | p_target, |
| eTOPOLOGY | p_topology | ||
| ) |
Sets the output primitives type.
| [in] | p_target | The shader object concerned |
| [in] | p_topology | The output primitives type |
| C3D_API void Castor3D::ShaderProgram::SetOutputVtxCount | ( | eSHADER_TYPE | p_target, |
| uint8_t | p_count | ||
| ) |
Sets the output vertex count.
| [in] | p_target | The shader object concerned |
| [in] | p_count | The count |
| C3D_API void Castor3D::ShaderProgram::SetSource | ( | eSHADER_TYPE | p_target, |
| eSHADER_MODEL | p_eModel, | ||
| Castor::String const & | p_strSource | ||
| ) |
Sets the shader source for given model.
| [in] | p_target | The shader object concerned |
| [in] | p_eModel | The shader model |
| [in] | p_strSource | The source code |
|
pure virtual |
Deactivates the program.
|
friend |
|
static |
Name of the ambient light frame variable.
|
static |
Name of the background colour frame variable.
|
static |
Name of the bitangent attribute.
|
static |
Name of the first bones ID attribute.
|
static |
Name of the second bones ID attribute.
|
static |
Name of the matrix frame variable buffer.
|
static |
Name of the pass frame variable buffer.
|
static |
Name of the scene frame variable buffer.
|
static |
Name of the camera position frame variable.
|
static |
Name of the colour attribute.
|
static |
Name of the lights frame variable.
|
static |
Name of the lights count frame variable.
|
protected |
The active shaders array.
|
protected |
Array of files path, sorted by shader model.
|
protected |
Referenced by GetLanguage().
|
protected |
The frame variable buffers map, ordered by shader type.
Referenced by GetFrameVariableBuffers().
|
protected |
The frame variable buffers map, ordered by name.
|
protected |
The frame variable buffers map.
Referenced by GetFrameVariableBuffers().
|
protected |
The shaders array.
|
protected |
|
static |
Name of the ambient texture frame variable.
|
static |
Name of the colour texture frame variable.
|
static |
Name of the diffuse texture frame variable.
|
static |
Name of the emissive texture frame variable.
|
static |
Name of the shininess texture frame variable.
|
static |
Name of the height texture frame variable.
|
static |
Name of the emissive texture frame variable.
|
static |
Name of the opacity texture frame variable.
|
static |
Name of the specular texture frame variable.
|
static |
Name of the overlay text image frame variable.
|
static |
Name of the ambient material colour frame variable.
|
static |
Name of the diffuse material colour frame variable.
|
static |
Name of the emissive material colour frame variable.
|
static |
Name of the material opacity frame variable.
|
static |
Name of the material shininess frame variable.
|
static |
Name of the specular material colour frame variable.
|
static |
Name of the normal attribute.
|
static |
Name of the position attribute.
|
static |
Name of the tangent attribute.
|
static |
Name of the text overlay texture attribute.
|
static |
Name of the texture attribute.
|
static |
Name of the instance transform attribute.
|
static |
Name of the first bones weight attribute.
|
static |
Name of the second bones weight attribute.
1.8.15