Simplygon C++ API  8.3.35800.0
SimplygonSDK::IShaderGenerator Class Referenceabstract

#include <SimplygonSDK.h>

Inheritance diagram for SimplygonSDK::IShaderGenerator:
SimplygonSDK::IObject

Public Member Functions

virtual bool GenerateShaderData ()=0
 
virtual const char * GetClass ()
 
virtual bool GetGenerateFullShader ()=0
 
virtual bool GetGenerateTextureSamplerData ()=0
 
virtual rstring GetGLSLFragmentCode ()=0
 
virtual rstring GetGLSLVertexCode ()=0
 
virtual rstring GetHLSLCode ()=0
 
virtual rstring GetIdentifersPrefix ()=0
 
virtual CountedPointer< IMaterialGetMaterial ()=0
 
virtual rstring GetShaderInputTexturePath (rid index)=0
 
virtual SGDEPRECATED CountedPointer< IStringArrayGetShaderInputTexturePaths ()=0
 
virtual unsigned int GetShaderInputTexturePathsCount ()=0
 
virtual rid GetShaderInputUVIndex (const char *uvset)=0
 
virtual rstring GetShaderInputUVSet (rid index)=0
 
virtual SGDEPRECATED CountedPointer< IStringArrayGetShaderInputUVSets ()=0
 
virtual unsigned int GetShaderInputUVSetsCount ()=0
 
virtual rstring GetShaderInputVertexColor (rid index)=0
 
virtual SGDEPRECATED CountedPointer< IStringArrayGetShaderInputVertexColors ()=0
 
virtual unsigned int GetShaderInputVertexColorsCount ()=0
 
virtual rid GetShaderInputVertexColorsIndex (const char *colorset)=0
 
virtual bool IsA (const char *type) const
 
virtual void SetGenerateFullShader (bool value)=0
 
virtual void SetGenerateTextureSamplerData (bool value)=0
 
virtual void SetIdentifersPrefix (const char *value)=0
 
virtual void SetMaterial (IMaterial *value)=0
 
virtual void UnloadData ()=0
 
- Public Member Functions inherited from SimplygonSDK::IObject
virtual rid AddObserver (robserver *Observer, rid EventId)=0
 
virtual void AddRef ()=0
 
virtual rstring GetName ()=0
 
virtual void * GetUserComponentArea (rid userid)=0
 
virtual void PrintInfo ()=0
 
virtual void Release ()=0
 
virtual void RemoveObserver (rid ObserverId)=0
 
virtual void SetName (const char *Name)=0
 

Static Public Member Functions

static bool IsClassA (const char *type)
 
static IShaderGeneratorSafeCast (IObject *ptr)
 
- Static Public Member Functions inherited from SimplygonSDK::IObject
static bool IsClassA (const char *type)
 
static IObjectSafeCast (IObject *ptr)
 

Detailed Description

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.

Member Function Documentation

◆ 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()

virtual CountedPointer<IMaterial> SimplygonSDK::IShaderGenerator::GetMaterial ( )
pure virtual

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
indexthe index of the path to retrieve.
Returns
the texture path

◆ GetShaderInputTexturePaths()

virtual SGDEPRECATED CountedPointer<IStringArray> SimplygonSDK::IShaderGenerator::GetShaderInputTexturePaths ( )
pure virtual
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
uvsetis the uv set name
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
indexthe index of the set to retrieve.
Returns
the set name

◆ GetShaderInputUVSets()

virtual SGDEPRECATED CountedPointer<IStringArray> SimplygonSDK::IShaderGenerator::GetShaderInputUVSets ( )
pure virtual
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
indexthe index of the set to retrieve.
Returns
the set name

◆ GetShaderInputVertexColors()

virtual SGDEPRECATED CountedPointer<IStringArray> SimplygonSDK::IShaderGenerator::GetShaderInputVertexColors ( )
pure virtual
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
colorsetis 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
typeis 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
typeis 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()

static IShaderGenerator* SimplygonSDK::IShaderGenerator::SafeCast ( IObject ptr)
inlinestatic

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
ptris the pointer to be cast into a IShaderGenerator pointer
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
valuethe 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
valuethe desired flag value

◆ SetIdentifersPrefix()

virtual void SimplygonSDK::IShaderGenerator::SetIdentifersPrefix ( const char *  value)
pure virtual

Sets the prefix for all global identifiers.

Parameters
valueis the prefix string

◆ SetMaterial()

virtual void SimplygonSDK::IShaderGenerator::SetMaterial ( IMaterial value)
pure virtual

Sets the material, for which to create a shader

Parameters
valueis 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: