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
材质和着色器
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
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

表达式

The expressions are used to specify UnigineScript code to be called on some event or on user demand. They can be used to generate various elements used in the material (e.g., textures, texture arrays, unstructured buffers, etc.) or contain other logic.表达式用于指定UnigineScript在某些事件或用户需求时调用的代码。它们可用于生成材质中使用的各种元素(例如,纹理、纹理数组、非结构化缓冲区等)或包含其他逻辑。

As a node value you must specify a UnigineScript-based code enclosed in "#{" and "#}". You can also specify a path to an external script file (in usc or h format) or the name of a Script node inside this material.作为节点值,您必须指定包含在 "#{""#}" 中的基于 UnigineScript 的代码。您还可以指定外部脚本文件的路径(以 usch 格式)或此材质内的 Script 节点的名称。

The syntax is the following:语法如下:

ULON
Expression name = 
#{
    // UnigineScript code
#}

Or要么

ULON
Script script_name = 
#{
     // UnigineScript code
#}

Expression name = script_name

Or要么

ULON
Expression name = "some/path/to/your/script.h"		// script.h consists of some UnigineScript code

When the name of an expression specified as RENDER_* (where * is a name of a render callback) and the current material is set globally or assigned to the main camera, the expression code will be executed automatically at the corresponding stage of the rendering sequence. Materials containing such expressions are called scriptable.当表达式的名称指定为 RENDER_*(其中 * 是渲染回调)且当前素材是全局设置或分配给主摄像机,表情代码会在对应阶段自动执行渲染顺序.包含此类表达式的材质称为可编写脚本.

It is possible to call an expression via the runExpression() function of the Material class. The expression’s name must be unique.可以通过 Material 类的 runExpression() 函数调用表达式。表达式的名称必须是唯一的。

Usage Examples
使用示例#

ULON
Expression RENDER_CALLBACK_BEGIN_SSAO =
#{
        // typical most frequently used parameters passed to the expression when it is called.
        int in_width;
        int in_height;
        int in_depth;
        Material in_material;

        // get a temporary texture
        Texture texture = engine.render.getTemporaryTexture(in_width, in_height);


        // set the modified texture as albedo texture of the material
        in_material->setTexture("albedo", texture);
#}
最新更新: 2024-08-16
Build: ()