This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

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

This class is used to implement Scriptable Material expressions in UnigineScript. You should only use it to write materials-related logic.

See Also#

EngineExpression Class

Members


float noise ( float pos, float size, int frequency ) #

Returns a noise value calculated using a Perlin noise function.

Arguments

  • float pos - Float position.
  • float size - Size of the noise.
  • int frequency - Noise frequency.

Return value

Noise value.

float random ( float from, float to ) #

Returns a pseudo-random float number.

Arguments

  • float from - The initial point of the range.
  • float to - The end point of the range.

Return value

Random float number.

Node getNode ( ) #

Returns the current node.

Return value

The current node.

Node getParent ( ) #

Returns the parent node of the current node.

Return value

The parent node of the current node, if it exists; otherwise, NULL.

int getNumChildren ( ) #

Returns the number of node’s children.

Return value

The number of children for the node, if it exists; otherwise, 0.

Node getChild ( int num ) #

Returns the child node by its index.

Arguments

  • int num - Index of the child node to return.

Return value

The child node of the current node, if it exists; otherwise, 0.

Material getMaterial ( ) #

Returns the current material.

Return value

The pointer to the current material.

int getState ( string name ) #

Returns the value of the state.

Arguments

  • string name - Name of the state.

Return value

The value of the state for the material, if it exists; otherwise, 0.

void setState ( string name, int value ) #

Sets the value to the state by its name.

Arguments

  • string name - Name of the state.
  • int value - Value of the state.

Variable getParameter ( string param ) #

Returns the parameter of the material by its name.

Arguments

  • string param - Name of the parameter.

Return value

The value of the parameter for the material, if it exists; otherwise, 0.

void setParameter ( string param, Variable value ) #

Sets the value to the parameter by its name.

Arguments

  • string param - Name of the parameter.
  • Variable value - Value to set.

void getParameterArray ( Variable param, int value_id ) #

Returns a value of the array parameter (type: PARAMETER_ARRAY_FLOAT4) with the specified number and puts it to the specified buffer array.

Arguments

  • Variable param - Material parameter identifier. Can be of the following:
  • int value_id - ID of the buffer array to store parameter values.

void setParameterArray ( Variable param, int value_id ) #

Sets a value of the array parameter (type: PARAMETER_ARRAY_FLOAT4) with the specified number using the specified array.

Arguments

  • Variable param - Material parameter identifier. Can be of the following:
  • int value_id - ID of the array of values to be set.

Texture getTexture ( string name ) #

Returns the texture by its name.

Arguments

  • string name - Name of the texture.

void setTexture ( string name, Texture texture ) #

Sets the new texture to the specified texture slot of the material.

Arguments

  • string name - Name of the texture slot.
  • Texture texture - Pointer to the new texture.

void renderPassCompute ( string pass, int w, int h ) #

Calls the specified compute shader dispatch.

Arguments

  • string pass - Name of the pass.
  • int w - The number of thread groups dispatched in the X direction.
  • int h - The number of thread groups dispatched in the Y direction.

void renderPassCompute ( string pass, int w, int h, int d ) #

Calls the specified compute shader dispatch.

Arguments

  • string pass - Name of the pass.
  • int w - The number of thread groups dispatched in the X direction.
  • int h - The number of thread groups dispatched in the Y direction.
  • int d - The number of thread groups dispatched in the Z direction.

void renderPass ( string pass ) #

Renders the pass to the manually set render target.

Arguments

  • string pass - Name of the pass.

void renderPassToTexture ( string pass, Texture texture ) #

Renders the pass to the texture (render target initialization and realease is done automatically).

Arguments

  • string pass - Name of the pass.
  • Texture texture - Target texture for the pass rendering.
Last update: 2024-08-16
Build: ()