This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

UUSL数据结构

UUSL has Data structure which offers you a handy access to values. UUSL具有Data结构,可让您方便地访问值。

Data Fields资料栏位#

Data has the following fields (values in world space has _w postfix): Data具有以下字段(世界空间中的值具有_w后缀):

UUSL
struct Data {
	
	float 	depth;
	float3	position;
	float3	view;
	
	float3	normal;
	float3	reflection;
	
	// world space values
	float3	view_w;
	float3	normal_w;
	float3	reflection_w;
	
	float3	sky_reflect;
	
	float2	screen_coord;
	
	float	dotNV;
	
	float dielectric;
	float gloss;
};

Data FunctionsData功能#

Data dataDefault ( ) #

Default constructor for Data structure. It creates an instance with default (not null) values. Data结构的默认构造函数。它使用默认值(非null)创建一个实例。

返回值

Data structure with default (not null) values. Data结构,具有默认值(非null)。

void dataSetPosition ( inout Data Data, float3 pos ) #

Calculates position, depth and view values for given Data struct.为给定的Data结构计算位置,深度和视图值。

参数

  • inout Data Data - Data structure to fill.要填充的Data结构。
  • float3 pos - Position vector.位置向量。

void dataCalculateWorldSpace ( Data Data ) #

Calculates world view, normal, reflection in world space by using corresponding values of given Data struct.通过使用给定的Data结构的相应值来计算世界空间中的世界观,法线和反射。

参数

  • Data Data - Data structure to fill.要填充的Data结构。

void dataSetGbuffer ( inout Data Data, GBuffer gbuffer ) #

Sets Data's structure normal, dielectric and gloss values by using corresponding values of given GBuffer instance.通过使用给定GBuffer实例的相应值来设置数据的结构正常,介电和光泽度值。

参数

  • inout Data Data - Data structure. Data结构。
  • GBuffer gbuffer - GBuffer instance with necessary values to be set. GBuffer实例,需要设置必要的值。

void dataCalculateAll ( inout Data data, GBuffer gbuffer, float3 pos, float2 screen_coord ) #

Calculates all values for Data struct.计算数据结构的所有值。

参数

  • inout Data data - Data structure to be filled with calculated values. Data结构要填充计算所得的值。
  • GBuffer gbuffer - GBuffer struct. GBuffer结构。
  • float3 pos - Position vector.位置向量。
  • float2 screen_coord - Screen coordinates.屏幕坐标。

Usage Example使用范例#

To use Data structure in your shader's code, you should define and initialize the Data structure and fill it.要在着色器代码中使用Data结构,应定义并初始化Data结构并填充它。

The following example shows the way of creating Data structure and calculating its values.以下示例显示了创建数据结构和计算其值的方法。

UUSL
/* ... */
// input structure for fragment shader
STRUCT(FRAGMENT_IN)
	INIT_POSITION
	INIT_IN(float4,0)
	INIT_IN(float3,1)
	INIT_IN(float3x3,2)
	
	#ifdef USE_ALPHA_FADE && ALPHA_FADE
		INIT_IN(float,9)
	#endif
END

/* ... */
// in the main function of fragment shader
	// GBuffer 
	GBuffer gbuffer;

	/* fill the GBuffer struct */

	Data data;
	dataCalculateAll(data,gbuffer,IN_DATA(1),IN_POSITION.xy);
/* ... */
最新更新: 2021-12-13
Build: ()