# class
ShaderGenerator
Given a material, the shader data class keeps the relevant shader data and is able to generate a GLSL/HLSL shader.
# Properties
Property | Description |
---|---|
GenerateFullShader | 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. |
GenerateTextureSamplerData | 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. |
IdentifersPrefix | The prefix for all global identifiers. |
Material | The material, for which to create a shader. |
# Methods
Method | Description |
---|---|
GenerateShaderData | Generates a shader, given a material that uses shading node networks. To generate the actual shader code, use GetHLSLCode, GetGLSLVertexCode and GetGLSLFragmentCode. |
GetClass | Get the name of the ShaderGenerator class. |
GetGLSLFragmentCode | Returns a string containing the GLSL fragment shader GenerateShader must have been called prior to this call. |
GetGLSLVertexCode | 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 | Returns a string containing the HLSL shader code. GenerateShader must have been called prior to this call. |
GetShaderInputTexturePath | Get a specific path from the list of unique paths. See notes of GetShaderInputTexturePathsCountfor more documentation on usage. |
GetShaderInputTexturePathsCount | 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. |
GetShaderInputUVIndex | 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. |
GetShaderInputUVSet | Get a specific set from the list of unique sets. See notes of GetShaderInputUVSetsCountfor more documentation on usage. |
GetShaderInputUVSetsCount | 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. |
GetShaderInputVertexColor | Get a specific set from the list of unique sets. See notes of GetShaderInputVertexColorsCountfor more documentation on usage. |
GetShaderInputVertexColorsCount | 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. |
GetShaderInputVertexColorsIndex | 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. |
IsA | Returns true if ShaderGenerator is a or is a descendant of the class named as the type parameter. |
IsNull | Returns true if the ShaderGenerator object is invalid. |
UnloadData | Unloads all shader data and resets it. |
# Static methods
Method | Description |
---|---|
IsClassA | Returns true if the class is a or is a descendant of the class named as the type parameter. |
SafeCast | SafeCast makes sure the input object is of a class that can be cast into spShaderGenerator, and if this is the case, returns the object cast into spShaderGenerator. |
# Properties details
# GenerateFullShader
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.
# GenerateTextureSamplerData
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.
# IdentifersPrefix
The prefix for all global identifiers.
# Material
The material, for which to create a shader.
# Methods details
# GenerateShaderData
Generates a shader, given a material that uses shading node networks. To generate the actual shader code, use GetHLSLCode, GetGLSLVertexCode and GetGLSLFragmentCode.
# GetClass
Get the name of the ShaderGenerator class.
# GetGLSLFragmentCode
Returns a string containing the GLSL fragment shader GenerateShader must have been called prior to this call.
# GetGLSLVertexCode
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
Returns a string containing the HLSL shader code. GenerateShader must have been called prior to this call.
# GetShaderInputTexturePath
Get a specific path from the list of unique paths. See notes of GetShaderInputTexturePathsCountfor more documentation on usage.
# GetShaderInputTexturePathsCount
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.
# GetShaderInputUVIndex
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.
# GetShaderInputUVSet
Get a specific set from the list of unique sets. See notes of GetShaderInputUVSetsCountfor more documentation on usage.
# GetShaderInputUVSetsCount
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.
# GetShaderInputVertexColor
Get a specific set from the list of unique sets. See notes of GetShaderInputVertexColorsCountfor more documentation on usage.
# GetShaderInputVertexColorsCount
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.
# GetShaderInputVertexColorsIndex
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.
# IsA
Returns true if ShaderGenerator is a or is a descendant of the class named as the type parameter.
# IsNull
Returns true if the ShaderGenerator object is invalid.
# UnloadData
Unloads all shader data and resets it.
# Static methods details
# IsClassA
Returns true if the class is a or is a descendant of the class named as the type parameter.
# SafeCast
SafeCast makes sure the input object is of a class that can be cast into spShaderGenerator, and if this is the case, returns the object cast into spShaderGenerator.