This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine 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
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
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.

RenderState Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.

A low-level graphics state abstraction.

RenderState Class

Members


void setAnisotropy ( int anisotropy ) #

Sets the texture anisotropy level (degree of anisotropic filtering).

Arguments

  • int anisotropy - Texture anisotropy level to be set:
    • 0 - anisotropy level 1.
    • 1 - anisotropy level 2.
    • 2 - anisotropy level 4.
    • 3 - anisotropy level 8.
    • 4 - anisotropy level 16.

int getAnisotropy ( ) #

Returns the current texture anisotropy level (degree of anisotropic filtering).

Return value

Current texture anisotropy level:
  • 0 - anisotropy level 1.
  • 1 - anisotropy level 2.
  • 2 - anisotropy level 4.
  • 3 - anisotropy level 8.
  • 4 - anisotropy level 16.

void setBlendDestFunc ( int func ) #

Sets a new destination blending function.

Arguments

  • int func - New destination blending function to be set. One of the BLEND_* variables.

int getBlendDestFunc ( ) #

Returns the destination blending function.

Return value

Destination blending function. One of the BLEND_* variables.

int getBlendDestFuncBuffer ( int num ) #

Returns the destination blending function for the specified buffer.

Arguments

  • int num - Buffer number.

Return value

Destination blending function. One of the BLEND_* variables.

void setBlendFunc ( int src, int dest, int blend_op = 0 ) #

Sets blending function.

Arguments

  • int src - Source blending function. One of the BLEND_* variables.
  • int dest - Destination blending function. One of the BLEND_* variables.
  • int blend_op - Blending operation to be used. One of the BLEND_OP_* variables. BLEND_OP_ADD is used by default.

void setBlendFuncBuffer ( int num, int src, int dest, int blend_op = 0 ) #

Sets blending function for the specified buffer.

Arguments

  • int num - Buffer number.
  • int src - Source blending function. One of the BLEND_* variables.
  • int dest - Destination blending function. One of the BLEND_* variables.
  • int blend_op - Blending operation to be used. One of the BLEND_OP_* variables. BLEND_OP_ADD is used by default.

void setBlendSrcFunc ( int func ) #

Sets a new source blending function.

Arguments

  • int func - New source blending function to be set. One of the BLEND_* variables.

int getBlendSrcFunc ( ) #

Returns the source blending function.

Return value

Source blending function. One of the BLEND_* variables.

int getBlendSrcFuncBuffer ( int num ) #

Returns the source blending function for the specified buffer.

Arguments

  • int num - Buffer number.

Return value

Source blending function. One of the BLEND_* variables.

void setBlendOperation ( int operation ) #

Sets a new blending operation.

Arguments

  • int operation - New blending operation to be set. One of the BLEND_OP_* variables.

int getBlendOperation ( ) #

Returns the current blending operation.

Return value

Current blending operation. One of the BLEND_OP_* variables.

int getBlendOperationBuffer ( int num ) #

Returns the current blending operation for the given buffer.

Arguments

  • int num - Buffer number.

Return value

Current blending operation for the given buffer. One of the BLEND_OP_* variables.

void setBufferMask ( int num, int mask ) #

Sets the buffer mask.

Arguments

  • int num - Buffer number.
  • int mask - Buffer mask.

int getBufferMask ( int num ) #

Returns buffer mask.

Arguments

  • int num - Buffer number.

Return value

Buffer mask.

void setDepthFunc ( int func ) #

Sets the depth function.

Arguments

  • int func - Depth function

int getDepthFunc ( ) #

Returns the current depth function.

Return value

The depth function (one of the DEPTH_* variables).

void setMaterial ( Material material ) #

Sets the specified material to be used.

Arguments

void setMaterial ( int pass, Material material ) #

Sets the specified material to be used for the specified rendering pass.

Arguments

  • int pass - Rendering pass for which the material is to be set.
  • Material material - Material to be used.

Material getMaterial ( ) #

Returns the current material.

Return value

Material.

void setPolygonBias ( float bias ) #

Sets a new polygon bias offset.

Arguments

  • float bias - New polygon bias offset to be set.

float getPolygonBias ( ) #

Returns the polygon bias offset.

Return value

Polygon bias offset.

void setPolygonCull ( int cull ) #

Sets the polygon cull mode.

Arguments

  • int cull - The polygon cull mode (one of the CULL_* variables).

int getPolygonCull ( ) #

Returns the polygon cull mode.

Return value

Polygon cull mode (one of the CULL_* variables).

void setPolygonFill ( int fill ) #

Sets the polygon fill mode.

Arguments

  • int fill - Polygon fill mode (one of the FILL_* variables).

int getPolygonFill ( ) #

Returns the polygon fill mode.

Return value

Polygon fill mode.

void setPolygonFront ( int front ) #

Set the polygon mode to front.

Arguments

  • int front - 1 - enable the front mode; 0 - disable it.

int getPolygonFront ( ) #

Returns value indicating if the polygon front mode is set.

Return value

1 if the polygon front mode is set; otherwise - 0.

void setPolygonOffset ( float bias, float offset ) #

Sets the polygon offset value.

Arguments

  • float bias - Polygon bias offset.
  • float offset - Polygon slope offset.

void setPolygonSlope ( float slope ) #

Sets a new polygon slope offset.

Arguments

  • float slope - New polygon slope offset.

float getPolygonSlope ( ) #

Returns the polygon slope offset.

Return value

Polygon slope offset.

void setScissorTest ( float x, float y, float width, float height ) #

Sets scissor test.

Arguments

  • float x - The X coordinate.
  • float y - The Y coordinate.
  • float width - Viewport width.
  • float height - Viewport height.

void setScissorTest ( ) #

Sets scissor test by using rectangle coordinates.

Arguments

    void setScissorTest ( vec4 rectangle ) #

    Sets scissor test by using rectangle coordinates.

    Arguments

    • vec4 rectangle - Rectangle coordinates.

    int getScissorTest ( ) #

    Returns the scissors test status.

    Return value

    Scissors test status.

    Texture getScreenColorTexture ( ) #

    Returns the screen color texture.

    Return value

    Texture.

    Texture getScreenDepthTexture ( ) #

    Returns the screen depth texture.

    Return value

    Texture.

    void setShader ( Shader shader ) #

    Sets the specified shader.

    Arguments

    Shader getShader ( ) #

    Returns the shader.

    Return value

    Shader.Shader smart pointer.

    void setStencilFunc ( int func ) #

    Sets the stencil function.

    Arguments

    • int func - Stencil function.

    int getStencilFunc ( ) #

    Returns the stencil function.

    Return value

    Stencil function.

    void setStencilPass ( int pass ) #

    Sets a new stencil mode.

    Arguments

    • int pass - New stencil mode to be set (one of the STENCIL_* variables.)

    int getStencilPass ( ) #

    Returns the stencil mode.

    Return value

    The stencil mode (one of the STENCIL_* variables.)

    void setStencilRef ( int ref ) #

    Sets a new stencil reference value.

    Arguments

    • int ref - New stencil reference value to be set.

    int getStencilRef ( ) #

    Returns the stencil reference value.

    Return value

    Stencil reference value.

    void setStructuredBuffer ( int num, StructuredBuffer buffer ) #

    Sets given StructuredBuffer to the render state.

    Arguments

    • int num - StructuredBuffer unit number.
    • StructuredBuffer buffer - A pointer to the StructuredBuffer.

    void setTexture ( int binding, int num, Texture texture ) #

    Sets the texture.

    Arguments

    • int binding - Binding.
    • int num - Texture unit number (texture slot).
    • Texture texture - Texture.

    void setTexture ( int binding, int num, Texture texture, int sampler_flags ) #

    Arguments

    • int binding
    • int num - Texture unit number (texture slot).
    • Texture texture
    • int sampler_flags

    Texture getTexture ( int num ) #

    Returns the current texture.

    Arguments

    • int num - Texture unit number (texture slot).

    Return value

    Texture.

    void setViewport ( int x, int y, int width, int height ) #

    Sets the viewport size and position.

    Arguments

    • int x - The X coordinate.
    • int y - The Y coordinate.
    • int width - The width.
    • int height - The height.

    int getCoordX ( ) #

    Returns the X-coordinate of the viewport.

    Return value

    X-coordinate of the viewport.

    int getCoordY ( ) #

    Returns the Y-coordinate of the viewport.

    Return value

    Y-coordinate of the viewport.

    int getHeight ( ) #

    Returns the viewport height.

    Return value

    Viewport height.

    int getWidth ( ) #

    Returns the viewport width.

    Return value

    Viewport width.

    void clearBuffer ( int buffer, vec4 color, float depth = 0.0f, int stencil = 0 ) #

    Clears the specified buffer.

    Arguments

    • int buffer - Buffer mask determines which buffers are to be cleared. One or combination of BUFFER_* variables.
      Source code
      clearBuffer(BUFFER_COLOR); // clears color buffer
      clearBuffer(BUFFER_DEPTH); // clears depth buffer
      clearBuffer(BUFFER_STENCIL); // clears stencil buffer
      
      //masks can be combined:
      clearBuffer(BUFFER_COLOR | BUFFER_STENCIL); // clears color and stencil buffer
      
      //there is a separate BUFFER_DEPTH_STENCIL mask for convenience
      clearBuffer(BUFFER_DEPTH_STENCIL);
    • vec4 color - Color value to be used.
    • float depth - Depth value to be used.
    • int stencil - Stencil value to be used.

    void clearStates ( int clear_all = true ) #

    Clears all current render states. This method is used to prevent certain rendering code segment from being affected by other segments. See the usage example, that illustrates the typical use case.

    Arguments

    • int clear_all - Clear flag: 1 - to clear current shader, material, textures, and structured buffers as well, or 0 to clear render states only.

    void clearStructuredBuffer ( StructuredBuffer buffer ) #

    Clears the specified structured buffer.

    Arguments

    void clearStructuredBuffers ( ) #

    Clears all current structured buffers.

    void clearTexture ( Texture texture ) #

    Clears the specified texture.

    Arguments

    • Texture texture - Texture to be cleared.

    void clearTextures ( ) #

    Clears all textures.

    void flushRender ( ) #

    Flushes the render.

    void flushStates ( ) #

    Flushes the current render state to GPU. See the usage example, that illustrates the typical use case.

    void saveState ( ) #

    Saves the current render state. This method is to be used together with the restoreState() method to enclose a segment of code, that changes the render state. See the usage example, that illustrates the typical use case.

    void restoreState ( ) #

    Restores the current render state, that was saved by calling the saveState() method. These two methods are used together to enclose a segment of code, that changes the render state. See the usage example, that illustrates the typical use case.

    void dispatch ( int group_threads_x, int group_threads_y, int group_threads_z ) #

    Executes commands in a compute shader (similar to ID3D11DeviceContext::Dispatch() method). A compute shader can be run on many threads in parallel, within a thread group. Index a particular thread, within a thread group using a 3D vector given by (x,y,z).

    Arguments

    • int group_threads_x - Local X work-group size of the compute shader.
    • int group_threads_y - Local Y work-group size of the compute shader.
    • int group_threads_z - Local Z work-group size of the compute shader.
    Last update: 2021-12-13
    Build: ()