This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.Shader Class

Interface for shader manipulation. Shader is an interface for loading shaders, setting parameter values, binding graphic context.

To get loaded shader programs, use special methods for corresponding Direct3D11 shaders or use getGLProgramID() to get the OpenGL shaders.

Shader class provides a lot of methods to set parameters (or arrays of parameters) to shader programs.

Shader Class

Members


IntPtr getD3D11ComputeShader()

Returns Direct3D11 compute shader.

IntPtr getD3D11ControlShader()

Returns Direct3D11 control shader.

IntPtr getD3D11EvaluateShader()

Returns Direct3D11 evaluate shader.

IntPtr getD3D11FragmentShader()

Returns Direct3D11 fragment shader.

IntPtr getD3D11GeometryShader()

Returns Direct3D11 geometry shader.

IntPtr getD3D11VertexShader()

Returns Direct3D11 vertex shader.

int getGLProgramID()

Returns OpenGL program identifier.

void setParameter(int id, IntPtr src, int size)

Sets shader parameter value by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • IntPtr src - Parameter pointer.
  • int size - Parameter size in bytes.

void setParameter(string name, IntPtr src, int size)

Sets shader parameter value by using given parameter name.

Arguments

  • string name - Parameter name.
  • IntPtr src - Parameter pointer.
  • int size - Parameter size in bytes.

void setParameterBool(int id, int value)

Sets shader boolean parameter value by using given parameter id.

Arguments

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

void setParameterBool(string name, int value)

Sets shader boolean parameter value by using given parameter name.

Arguments

  • string name - Parameter identifier.
  • int value - Parameter value.

void setParameterDouble(int id, double[] value)

Sets shader double parameter value by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • double[] value - Parameter value to be set.

void setParameterDouble(string name, double[] value)

Sets shader double parameter value by using given parameter name.

Arguments

  • string name - Parameter name.
  • double[] value - Parameter value to be set.

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

Sets shader double array parameter values by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • double[] value - Parameter value to be set.
  • int num - The size of float vector.

void setParameterDoubleArray(string name, double[] value, int num)

Sets shader double array parameter values by using given parameter name.

Arguments

  • string name - Parameter name.
  • double[] value - Parameter value to be set.
  • int num - The size of float vector.

void setParameterFloat(int id, float[] value)

Sets shader float parameter value by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • float[] value - Parameter value to be set.

void setParameterFloat(string name, float[] value)

Sets shader float parameter value by using given parameter name.

Arguments

  • string name - Parameter name.
  • float[] value - Parameter value to be set.

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

Sets shader float array parameter values by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • float[] value - Parameter value to be set.
  • int num - The size of float vector.

void setParameterFloatArray(string name, float[] value, int num)

Sets shader float array parameter values by using given parameter name.

Arguments

  • string name - Parameter name.
  • float[] value - Parameter value to be set.
  • int num - The size of float vector.

void setParameterInt(int id, int[] value)

Sets shader integer parameter value by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • int[] value - Parameter value to be set.

void setParameterInt(string name, int[] value)

Sets shader integer parameter value by using given parameter name.

Arguments

  • string name - Parameter name.
  • int[] value - Parameter value to be set.

void setParameterUInt(int id, uint[] value)

Sets shader unsigned integer parameter value by using given parameter id.

Arguments

  • int id - Parameter identifier.
  • uint[] value - Parameter value to be set.

void setParameterUInt(string name, uint[] value)

Sets shader unsigned integer parameter value by using given parameter name.

Arguments

  • string name - Parameter name.
  • uint[] value - Parameter value to be set.

void bind()

Binds shader.

void clear()

Clears shader.

int compile()

Compiles shader.

Return value

1 if the shader compiled successfully; otherwise, 0.

Shader create()

Default shader constructor.

Return value

Pointer to the created shader.

Shader create(string name, string defines = 0)

Shader constructor. Loads all existing shaders with given name.

Arguments

  • string name - Shader name.
  • string defines - Shader defines.

Return value

Pointer to the created shader.

Shader create(string vertex, string fragment, string defines)

Shader constructor. Loads only vertex and fragment shaders with given names.

Arguments

  • string vertex - Vertex shader name or source.
  • string fragment - Fragment shader name or source.
  • string defines - Shader defines.

Return value

Pointer to the created shader.

void destroy()

Destroys shader.

int findParameter(int fast_id)

Finds shader parameter.

Arguments

  • int fast_id - Fast identifier.

Return value

Parameter identifier, if found; otherwise, -1.

int findParameter(string name)

Finds shader parameter.

Arguments

  • string name - Fast identifier.

Return value

Parameter identifier, if found; otherwise, -1.

int findParameter(string name, int fast_id)

Finds shader parameter.

Arguments

  • string name - Parameter name.
  • int fast_id - Fast identifier (hash of name).

Return value

Parameter identifier, if found; otherwise, -1.

void flushParameters()

Flushes shader parameters.

int loadCompute(string name, string defines)

Loads compute shader.

Arguments

  • string name - Compute shader name or source.
  • string defines - Shader defines.

Return value

1 if the compute shader was loaded successfully; otherwise, 0.

int loadControl(string name, string defines)

Loads control shader.

Arguments

  • string name - Control shader name or source.
  • string defines - Shader defines.

Return value

1 if the control shader was loaded successfully; otherwise, 0.

int loadEvaluate(string name, string defines)

Loads evaluate shader.

Arguments

  • string name - Evaluate shader name or source.
  • string defines - Shader defines.

Return value

1 if the evaluate shader was loaded successfully; otherwise, 0.

int loadFragment(string name, string defines)

Loads fragment shader.

Arguments

  • string name - Fragment shader name or source.
  • string defines - Shader defines.

Return value

1 if the fragment shader was loaded successfully; otherwise, 0.

int loadGeometry(string name, string defines)

Loads geometry shader.

Arguments

  • string name - Geometry shader name or source.
  • string defines - Shader defines.

Return value

1 if the geometry shader was loaded successfully; otherwise, 0.

int loadVertex(string name, string defines)

Loads vertex shader.

Arguments

  • string name - Vertex shader name or source.
  • string defines - Shader defines.

Return value

1 if the vertex shader was loaded successfully; otherwise, 0.

void unbind()

Unbinds shader.
Last update: 2018-08-10
Build: ()