Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes

Shader Class

Interface for shader manipulation.

To use this class, include the UnigineShader.h file.

Shader Class

Members


void setParameterBool (const char * name, int value)

Set shader boolean parameter.

Arguments

  • const char * name - Parameter identifier.
  • int value - Parameter value.

int loadFragment (const char * name, const char * defines)

Load fragment shader.

Arguments

  • const char * name - Fragment shader name or source.
  • const char * defines - Shader defines.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void * getD3D11ControlShader ()

Return Direct3D11 control shader.

Return value

void unbind ()

Unbind shader.

int compile ()

Compile shader.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void setParameterDouble (const char * name, double[] value)

Set shader double parameter.

Arguments

  • const char * name
  • double[] value

void setParameter (const char * name, const void * src, int size)

Set shader parameter.

Arguments

  • const char * name - Parameter identifier.
  • const void * src - Parameter pointer.
  • int size - Parameter size in bytes.

int loadCompute (const char * name, const char * defines)

Load compute shader.

Arguments

  • const char * name - Compute shader name or source.
  • const char * defines - Shader defines.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void setParameterFloatArray (const char * name, float[] value, int num)

Set shader float array parameter.

Arguments

  • const char * name
  • float[] value
  • int num

void setParameterUInt (const char * name, uint[] value)

Set shader unsigned integer parameter.

Arguments

  • const char * name
  • uint[] value

void * getD3D11EvaluateShader ()

Return Direct3D11 evaluate shader.

Return value

void setParameter (int id, const void * src, int size)

Set shader parameter.

Arguments

  • int id - Parameter identifier.
  • const void * src - Parameter pointer.
  • int size - Parameter size in bytes.

Ptr<Shader> create ()

Shader constructor.

Return value

Pointer to the created shader.

void flushParameters ()

Flush shader parameters.

void setParameterInt (int id, int[] value)

Set shader integer parameter.

Arguments

  • int id
  • int[] value

void setParameterDoubleArray (const char * name, double[] value, int num)

Set shader double array parameter.

Arguments

  • const char * name
  • double[] value
  • int num

Ptr<Shader> create (const char * vertex, const char * fragment, const char * defines)

Shader constructor.

Arguments

  • const char * vertex - Vertex shader name or source.
  • const char * fragment - Vertex shader name or source.
  • const char * defines - Shader defines.

Return value

Pointer to the created shader.

int getGLProgramID ()

Return OpenGL program identifier.

Return value

void bind ()

Bind shader.

void setParameterUInt (int id, uint[] value)

Set shader unsigned integer parameter.

Arguments

  • int id
  • uint[] value

void setParameterBool (int id, int value)

Set shader boolean parameter.

Arguments

  • int id - Parameter identifier.
  • int value - Parameter value.

void * getD3D11ComputeShader ()

Return Direct3D11 compute shader.

Return value

int findParameter (const char * name, int fast_id)

Find shader parameter.

Arguments

  • const char * name - Parameter name.
  • int fast_id - Fast identifier (hash of name).

Return value

Parameter identifier, if found; otherwise, -1.

void clear ()

Clear shader.

void setParameterFloat (int id, float[] value)

Set shader float parameter.

Arguments

  • int id
  • float[] value

int findParameter (const char * name)

Find shader parameter.

Arguments

  • const char * name - Fast identifier.

Return value

Parameter identifier, if found; otherwise, -1.

void setParameterFloatArray (int id, float[] value, int num)

Set shader float array parameter.

Arguments

  • int id
  • float[] value
  • int num

void setParameterInt (const char * name, int[] value)

Set shader integer parameter.

Arguments

  • const char * name
  • int[] value

void * getD3D11FragmentShader ()

Return Direct3D11 fragment shader.

Return value

int loadControl (const char * name, const char * defines)

Load control shader.

Arguments

  • const char * name - Control shader name or source.
  • const char * defines - Shader defines.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void * getD3D11VertexShader ()

Return Direct3D11 vertex shader.

Return value

int findParameter (int fast_id)

Find shader parameter.

Arguments

  • int fast_id - Fast identifier.

Return value

Parameter identifier, if found; otherwise, -1.

void setParameterDoubleArray (int id, double[] value, int num)

Set shader double array parameter.

Arguments

  • int id
  • double[] value
  • int num

void destroy ()

Destroy shader.

int loadVertex (const char * name, const char * defines)

Load vertex shader.

Arguments

  • const char * name - Vertex shader name or source.
  • const char * defines - Shader defines.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void setParameterFloat (const char * name, float[] value)

Set shader float parameter.

Arguments

  • const char * name
  • float[] value

int loadGeometry (const char * name, const char * defines)

Load geometry shader.

Arguments

  • const char * name - Geometry shader name or source.
  • const char * defines - Shader defines.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

int loadEvaluate (const char * name, const char * defines)

Load evaluate shader.

Arguments

  • const char * name - Evaluate shader name or source.
  • const char * defines - Shader defines.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void setParameterDouble (int id, double[] value)

Set shader double parameter.

Arguments

  • int id
  • double[] value

void * getD3D11GeometryShader ()

Return Direct3D11 geometry shader.

Return value

Ptr<Shader> create (const char * name, const char * defines = 0)

Shader constructor.

Arguments

  • const char * name - Shader name.
  • const char * defines - Shader defines.

Return value

Pointer to the created shader.
Last update: 2017-07-03