This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::Shader Class

Interface for shader manipulation.

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

Unigine::Shader Class

Members


virtual ~Shader ()

Virtual destructor.

static Ptr< Shader > create ()

Shader constructor.

Return value

Pointer to the created shader.

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

Shader constructor.

Arguments

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

Return value

Pointer to the created shader.

static 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.

virtual int loadVertex (const char * name, const char * defines) const =0

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.

virtual int loadControl (const char * name, const char * defines) const =0

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.

virtual int loadEvaluate (const char * name, const char * defines) const =0

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.

virtual int loadGeometry (const char * name, const char * defines) const =0

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.

virtual int loadFragment (const char * name, const char * defines) const =0

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.

virtual int loadCompute (const char * name, const char * defines) const =0

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.

virtual int compile () const =0

Compile shader.

Return value

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

virtual void clear () const =0

Clear shader.

virtual void destroy () const =0

Destroy shader.

virtual int findParameter (int fast_id) const =0

Find shader parameter.

Arguments

  • int fast_id - Fast identifier.

Return value

Parameter identifier, if found; otherwise, -1.

virtual int findParameter (const char * name) const =0

Find shader parameter.

Arguments

  • const char * name - Parameter name.

Return value

Parameter identifier, if found; otherwise, -1.

virtual int findParameter (const char * name, int fast_id) const =0

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.

virtual void setParameterBool (int id, int value) const =0

Set shader boolean parameter.

Arguments

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

virtual void setParameterInt (int id, const int * value, int size) const =0

Set shader integer parameter.

Arguments

  • int id - Parameter identifier.
  • const int * value - Parameter value pointer.
  • int size - Parameter size.

virtual void setParameterFloat (int id, const float * value, int size) const =0

Set shader float parameter.

Arguments

  • int id - Parameter identifier.
  • const float * value - Parameter value pointer.
  • int size - Parameter size.

virtual void setParameterFloatArray (int id, const float * value, int size, int num) const =0

Set shader float array parameter.

Arguments

  • int id - Parameter identifier.
  • const float * value - Parameter value pointer.
  • int size - Parameter size.
  • int num - Number of parameters.

virtual void setParameterDouble (int id, const double * value, int size) const =0

Set shader double parameter.

Arguments

  • int id - Parameter identifier.
  • const double * value - Parameter value pointer.
  • int size - Parameter size.

virtual void setParameterDoubleArray (int id, const double * value, int size, int num) const =0

Set shader double array parameter.

Arguments

  • int id - Parameter identifier.
  • const double * value - Parameter value pointer.
  • int size - Parameter size.
  • int num - Number of parameters.

virtual void setParameter (int id, const void * src, int size) const =0

Set shader parameter.

Arguments

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

virtual void setParameterBool (const char * name, int value) const =0

Set shader boolean parameter.

Arguments

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

virtual void setParameterInt (const char * name, const int * value, int size) const =0

Set shader integer parameter.

Arguments

  • const char * name - Parameter name.
  • const int * value - Parameter value pointer.
  • int size - Parameter size.

virtual void setParameterFloat (const char * name, const float * value, int size) const =0

Set shader float parameter.

Arguments

  • const char * name - Parameter name.
  • const float * value - Parameter value pointer.
  • int size - Parameter size.

virtual void setParameterFloatArray (const char * name, const float * value, int size, int num) const =0

Set shader float array parameter.

Arguments

  • const char * name - Parameter name.
  • const float * value - Parameter value pointer.
  • int size - Parameter size.
  • int num - Number of parameters.

virtual void setParameterDouble (const char * name, const double * value, int size) const =0

Set shader double parameter.

Arguments

  • const char * name - Parameter name.
  • const double * value - Parameter value pointer.
  • int size - Parameter size.

virtual void setParameterDoubleArray (const char * name, const double * value, int size, int num) const =0

Set shader double array parameter.

Arguments

  • const char * name - Parameter name.
  • const double * value - Parameter value pointer.
  • int size - Parameter size.
  • int num - Number of parameters.

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

Set shader parameter.

Arguments

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

UNIGINE_INLINE void setParameterInt1 (int id, int x)

Set shader integer parameter.

Arguments

  • int id - Parameter identifier.
  • int x - X component.

UNIGINE_INLINE void setParameterInt2 (int id, int x, int y)

Set shader integer parameter.

Arguments

  • int id - Parameter identifier.
  • int x - X component.
  • int y - Y component.

UNIGINE_INLINE void setParameterInt3 (int id, int x, int y, int z)

Set shader integer parameter.

Arguments

  • int id - Parameter identifier.
  • int x - X component.
  • int y - Y component.
  • int z - Z component

UNIGINE_INLINE void setParameterInt4 (int id, int x, int y, int z, int w)

Set shader integer parameter.

Arguments

  • int id - Parameter identifier.
  • int x - X component.
  • int y - Y component.
  • int z - Z component.
  • int w - W component.

UNIGINE_INLINE void setParameterFloat1 (int id, float x)

Set shader float parameter.

Arguments

  • int id - Parameter identifier.
  • float x - X component.

UNIGINE_INLINE void setParameterFloat2 (int id, float x, float y)

Set shader float parameter.

Arguments

  • int id - Parameter identifier.
  • float x - X component.
  • float y - Y component.

UNIGINE_INLINE void setParameterFloat3 (int id, float x, float y, float z)

Set shader float parameter.

Arguments

  • int id - Parameter identifier.
  • float x - X component.
  • float y - Y component.
  • float z - Z component.

UNIGINE_INLINE void setParameterFloat4 (int id, float x, float y, float z, float w)

Set shader float parameter.

Arguments

  • int id - Parameter identifier.
  • float x - X component.
  • float y - Y component.
  • float z - Z component.
  • float w - W component.

UNIGINE_INLINE void setParameterDouble1 (int id, double x)

Set shader double parameter.

Arguments

  • int id - Parameter identifier.
  • double x - X component.

UNIGINE_INLINE void setParameterDouble2 (int id, double x, double y)

Set shader double parameter.

Arguments

  • int id - Parameter identifier.
  • double x - X component.
  • double y - Y component.

UNIGINE_INLINE void setParameterDouble3 (int id, double x, double y, double z)

Set shader double parameter.

Arguments

  • int id - Parameter identifier.
  • double x - X component.
  • double y - Y component.
  • double z - Z component.

UNIGINE_INLINE void setParameterDouble4 (int id, double x, double y, double z, double w)

Set shader double parameter.

Arguments

  • int id - Parameter identifier.
  • double x - X component.
  • double y - Y component.
  • double z - Z component.
  • double w - W component.

UNIGINE_INLINE void setParameterInt1 (const char * name, int x)

Set shader integer parameter.

Arguments

  • const char * name - Parameter name.
  • int x - X component.

UNIGINE_INLINE void setParameterInt2 (const char * name, int x, int y)

Set shader integer parameter.

Arguments

  • const char * name - Parameter name.
  • int x - X component.
  • int y - Y component.

UNIGINE_INLINE void setParameterInt3 (const char * name, int x, int y, int z)

Set shader integer parameter.

Arguments

  • const char * name - Parameter name.
  • int x - X component.
  • int y - Y component.
  • int z - Z component.

UNIGINE_INLINE void setParameterInt4 (const char * name, int x, int y, int z, int w)

Set shader integer parameter.

Arguments

  • const char * name - Parameter name.
  • int x - X component.
  • int y - Y component.
  • int z - Z component.
  • int w - W component.

UNIGINE_INLINE void setParameterFloat1 (const char * name, float x)

Set shader float parameter.

Arguments

  • const char * name - Parameter name.
  • float x - X component.

UNIGINE_INLINE void setParameterFloat2 (const char * name, float x, float y)

Set shader float parameter.

Arguments

  • const char * name - Parameter name.
  • float x - X component.
  • float y - Y component.

UNIGINE_INLINE void setParameterFloat3 (const char * name, float x, float y, float z)

Set shader float parameter.

Arguments

  • const char * name - Parameter name.
  • float x - X component.
  • float y - Y component.
  • float z - Z component.

UNIGINE_INLINE void setParameterFloat4 (const char * name, float x, float y, float z, float w)

Set shader float parameter.

Arguments

  • const char * name - Parameter name.
  • float x - X component.
  • float y - Y component.
  • float z - Z component.
  • float w - W component.

UNIGINE_INLINE void setParameterDouble1 (const char * name, double x)

Set shader double parameter.

Arguments

  • const char * name - Parameter name.
  • double x - X component.

UNIGINE_INLINE void setParameterDouble2 (const char * name, double x, double y)

Set shader double parameter.

Arguments

  • const char * name - Parameter name.
  • double x - X component.
  • double y - Y component.

UNIGINE_INLINE void setParameterDouble3 (const char * name, double x, double y, double z)

Set shader double parameter.

Arguments

  • const char * name - Parameter name.
  • double x - X component.
  • double y - Y component.
  • double z - Z component.

UNIGINE_INLINE void setParameterDouble4 (const char * name, double x, double y, double z, double w)

Set shader double parameter.

Arguments

  • const char * name - Parameter name.
  • double x - X component.
  • double y - Y component.
  • double z - Z component.
  • double w - W component.

virtual void flushParameters () const =0

Flush shader parameters.

virtual void bind () const =0

Bind shader.

virtual void unbind () const =0

Unbind shader.

virtual int getGLProgramID () const =0

Return OpenGL program identifier.

virtual void * getD3D9VertexShader () const =0

Return Direct3D9 vertex shader.

virtual void * getD3D9FragmentShader () const =0

Return Direct3D9 fragment shader.

virtual void * getD3D9VertexConstants () const =0

Return Direct3D9 vertex constants.

virtual void * getD3D9FragmentConstants () const =0

Return Direct3D9 fragment constants.

virtual void * getD3D11VertexShader () const =0

Return Direct3D11 vertex shader.

virtual void * getD3D11ControlShader () const =0

Return Direct3D11 control shader.

virtual void * getD3D11EvaluateShader () const =0

Return Direct3D11 evaluate shader.

virtual void * getD3D11GeometryShader () const =0

Return Direct3D11 geometry shader.

virtual void * getD3D11FragmentShader () const =0

Return Direct3D11 fragment shader.

virtual void * getD3D11ComputeShader () const =0

Return Direct3D11 compute shader.
Last update: 03.07.2017
Build: ()