#include <SimplygonSDK.h>
Given a material, the shader data class keeps the relevant shader data and is able to generate a GLSL/HLSL shader.
Definition at line 17846 of file SimplygonSDK.h.
◆ GenerateShaderData()
virtual bool SimplygonSDK::IShaderGenerator::GenerateShaderData |
( |
| ) |
|
|
pure virtual |
Generates a shader, given a material that uses shading node networks. To generate the actual shader code, use GetHLSLCode, GetGLSLVertexCode and GetGLSLFragmentCode
- Returns
- will return true if the shader could be generated from the material
◆ GetClass()
virtual const char* SimplygonSDK::IShaderGenerator::GetClass |
( |
| ) |
|
|
virtual |
GetClass returns the name of the class of the object.
- Returns
- the name of the actual class of the object, as a const char string
Reimplemented from SimplygonSDK::IObject.
◆ GetGenerateFullShader()
virtual bool SimplygonSDK::IShaderGenerator::GetGenerateFullShader |
( |
| ) |
|
|
pure virtual |
Gets the GenerateFullShader flag value. If set, the shader generator will generate a full shader, and not just the material shader tree. If false, the generator will define the basic samplers, the per-fragment information and all the sampling tree functions, but not the vertex and fragment shaders, that the user will have to generate manually. This is useful for custom shader integration. The default value is true (create full shader).
◆ GetGenerateTextureSamplerData()
virtual bool SimplygonSDK::IShaderGenerator::GetGenerateTextureSamplerData |
( |
| ) |
|
|
pure virtual |
Gets the GenerateTextureSamplerData flag value. If set, the shader generator will generate sampler registers and uniforms (HLSL: map_[x] values, state_[x]). If not set, the user will need to define them manually. As a help, the code is still generated, but commented out. This flag only applies to when the shader only generates the shading sampling tree, and is ignored if the GenerateFullShader is set.
◆ GetGLSLFragmentCode()
virtual rstring SimplygonSDK::IShaderGenerator::GetGLSLFragmentCode |
( |
| ) |
|
|
pure virtual |
Returns a string containing the GLSL fragment shader GenerateShader must have been called prior to this call
◆ GetGLSLVertexCode()
virtual rstring SimplygonSDK::IShaderGenerator::GetGLSLVertexCode |
( |
| ) |
|
|
pure virtual |
Returns a string containing the GLSL vertex shader GenerateShader must have been called prior to this call. Note: If GenerateFullShader is set to false, this code will be empty, as the code generated is only used by the fragment shader.
◆ GetHLSLCode()
virtual rstring SimplygonSDK::IShaderGenerator::GetHLSLCode |
( |
| ) |
|
|
pure virtual |
Returns a string containing the HLSL shader code. GenerateShader must have been called prior to this call
◆ GetIdentifersPrefix()
virtual rstring SimplygonSDK::IShaderGenerator::GetIdentifersPrefix |
( |
| ) |
|
|
pure virtual |
Gets the currently assigned prefix for all global identifiers.
- Returns
- the currently assigned prefix (default="sg_")
◆ GetMaterial()
Gets the material, for which to create a shader
◆ GetShaderInputTexturePath()
virtual rstring SimplygonSDK::IShaderGenerator::GetShaderInputTexturePath |
( |
rid |
index | ) |
|
|
pure virtual |
Get a specific path from the list of unique paths. See notes of GetShaderInputTexturePathsCount for more documentation on usage.
- Parameters
-
index | the index of the path to retrieve. |
- Returns
- the texture path
◆ GetShaderInputTexturePaths()
- Deprecated:
- Method is marked as deprecated and will be removed in future version. Use GetShaderInputTexturePathsCount() instead. Get an array of the unique texture paths used in the material. For the shader to use these textures, they are required to be uploaded to the texture channel corresponding to their position in the array. The shader will generate these sampler variables with the naming convention "map_i" (i : the array index of the texture). GenerateShader must have been called prior to this call
- Returns
- the array of unique texture paths
◆ GetShaderInputTexturePathsCount()
virtual unsigned int SimplygonSDK::IShaderGenerator::GetShaderInputTexturePathsCount |
( |
| ) |
|
|
pure virtual |
The number of unique texture paths used in the material. For the shader to use these textures, they are required to be uploaded to the texture channel corresponding to their position in the array. The shader will generate these sampler variables with the naming convention "map_i" (i : the array index of the texture). GenerateShader must have been called prior to this call. Enumerate 0 to Count, and use GetShaderInputTexturePath to retrieve a specific path.
- Returns
- the number of unique texture paths
◆ GetShaderInputUVIndex()
virtual rid SimplygonSDK::IShaderGenerator::GetShaderInputUVIndex |
( |
const char * |
uvset | ) |
|
|
pure virtual |
Returns the index that is set for the specific input UV set. If the UV set is not used by the generated shader, the returned value is -1. Note that the UV set name must match exactly, including case.
- Parameters
-
- Returns
- the index of the uv set, if used, or -1 if not used.
◆ GetShaderInputUVSet()
virtual rstring SimplygonSDK::IShaderGenerator::GetShaderInputUVSet |
( |
rid |
index | ) |
|
|
pure virtual |
Get a specific set from the list of unique sets. See notes of GetShaderInputUVSetsCount for more documentation on usage.
- Parameters
-
index | the index of the set to retrieve. |
- Returns
- the set name
◆ GetShaderInputUVSets()
- Deprecated:
- Method is marked as deprecated and will be removed in future version. Use GetShaderInputUVSetsCount() instead. Get an array of the unique UV sets used in the material. For the shader to use these UV sets, they are required to be uploaded as texture coordinates corresponding to their position in the array. The shader will generate the texcoords variables with the naming convention "tex_i" (i : the array index of the UV set). GenerateShader must have been called prior to this call
- Returns
- the array of UV sets (texcoords)
◆ GetShaderInputUVSetsCount()
virtual unsigned int SimplygonSDK::IShaderGenerator::GetShaderInputUVSetsCount |
( |
| ) |
|
|
pure virtual |
The number of unique UV sets used in the material. For the shader to use these UV sets, they are required to be uploaded as texture coordinates corresponding to their position in the array. The shader will generate the texcoords variables with the naming convention "tex_i" (i : the array index of the UV set). GenerateShader must have been called prior to this call
- Returns
- the number of unique UV sets
◆ GetShaderInputVertexColor()
virtual rstring SimplygonSDK::IShaderGenerator::GetShaderInputVertexColor |
( |
rid |
index | ) |
|
|
pure virtual |
Get a specific set from the list of unique sets. See notes of GetShaderInputVertexColorsCount for more documentation on usage.
- Parameters
-
index | the index of the set to retrieve. |
- Returns
- the set name
◆ GetShaderInputVertexColors()
- Deprecated:
- Method is marked as deprecated and will be removed in future version. Use GetShaderInputVertexColorsCount() instead. Get an array of the unique vertex colors used in the material. For the shader to use these vertex colors, they are required to be uploaded as vertex color corresponding to their position in the array. The shader will generate the vertex color variables with the naming convention "vertexcolor_i" (i : the array index of the vertex color). GenerateShader must have been called prior to this call
- Returns
- the array of vertex colors
◆ GetShaderInputVertexColorsCount()
virtual unsigned int SimplygonSDK::IShaderGenerator::GetShaderInputVertexColorsCount |
( |
| ) |
|
|
pure virtual |
The number of unique vertex colors used in the material. For the shader to use these vertex colors, they are required to be uploaded as vertex color corresponding to their position in the array. The shader will generate the vertex color variables with the naming convention "vertexcolor_i" (i : the array index of the vertex color). GenerateShader must have been called prior to this call
- Returns
- the number of unique color sets
◆ GetShaderInputVertexColorsIndex()
virtual rid SimplygonSDK::IShaderGenerator::GetShaderInputVertexColorsIndex |
( |
const char * |
colorset | ) |
|
|
pure virtual |
Returns the index that is set for the specific input vertex color set. If the vertex color set is not used by the generated shader, the returned value is -1. Note that the vertex color set name must match exactly, including case.
- Parameters
-
colorset | is the name of the color set |
- Returns
- the index of the vertex color set, if used, or -1 if not used.
◆ IsA()
virtual bool SimplygonSDK::IShaderGenerator::IsA |
( |
const char * |
type | ) |
const |
|
virtual |
The IsA function returns true if the object is a or is a descendant of the class named as the type parameter
- Parameters
-
type | is the name of the class to check if the object is, or is a descendant of |
- Returns
- true if the object is of the specified class, false if not
Reimplemented from SimplygonSDK::IObject.
◆ IsClassA()
static bool SimplygonSDK::IShaderGenerator::IsClassA |
( |
const char * |
type | ) |
|
|
inlinestatic |
The IsClassA function returns true if IShaderGenerator is a or is a descendant of the class named as the type parameter
- Parameters
-
type | is the name of the class to check if the class is, or is a descendant of |
- Returns
- true if the class is of the specified class, false if not
Definition at line 17867 of file SimplygonSDK.h.
◆ SafeCast()
SafeCast makes sure the pointer is of a class that can be cast into a IShaderGenerator pointer, and if this is possible, returns the cast pointer.
- Parameters
-
- Returns
- a pointer to the IShaderGenerator object, if the cast can be made, and a NULL pointer otherwise
Definition at line 17880 of file SimplygonSDK.h.
◆ SetGenerateFullShader()
virtual void SimplygonSDK::IShaderGenerator::SetGenerateFullShader |
( |
bool |
value | ) |
|
|
pure virtual |
Sets the GenerateFullShader flag value. If set, the shader generator will generate a full shader, and not just the material shader tree. If false, the generator will define the basic samplers, the per-fragment information and all the sampling tree functions, but not the vertex and fragment shaders, that the user will have to generate manually. This is useful for custom shader integration. The default value is true (create full shader).
- Parameters
-
value | the desired flag value |
◆ SetGenerateTextureSamplerData()
virtual void SimplygonSDK::IShaderGenerator::SetGenerateTextureSamplerData |
( |
bool |
value | ) |
|
|
pure virtual |
Sets the GenerateTextureSamplerData flag value. If set, the shader generator will generate sampler registers and uniforms (HLSL: map_[x] values, state_[x]). If not set, the user will need to define them manually. As a help, the code is still generated, but commented out. This flag only applies to when the shader only generates the shading sampling tree, and is ignored if the GenerateFullShader is set.
- Parameters
-
value | the desired flag value |
◆ SetIdentifersPrefix()
virtual void SimplygonSDK::IShaderGenerator::SetIdentifersPrefix |
( |
const char * |
value | ) |
|
|
pure virtual |
Sets the prefix for all global identifiers.
- Parameters
-
value | is the prefix string |
◆ SetMaterial()
virtual void SimplygonSDK::IShaderGenerator::SetMaterial |
( |
IMaterial * |
value | ) |
|
|
pure virtual |
Sets the material, for which to create a shader
- Parameters
-
value | is the material object |
◆ UnloadData()
virtual void SimplygonSDK::IShaderGenerator::UnloadData |
( |
| ) |
|
|
pure virtual |
Unloads all shader data and resets it.
The documentation for this class was generated from the following file: