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
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
Rendering-Related Classes
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.

UUSL Data Structure

UUSL has Data structure which offers you a handy access to values.

Data Fields#

Data has the following fields (values in world space has _w postfix):

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 Functions#

Data dataDefault ( ) #

Default constructor for Data structure. It creates an instance with default (not null) values.

Return value

Data structure with default (not null) values.

void dataSetPosition ( inout Data Data, float3 pos ) #

Calculates position, depth and view values for given Data struct.

Arguments

  • inout Data Data - Data structure to fill.
  • float3 pos - Position vector.

void dataCalculateWorldSpace ( Data Data ) #

Calculates world view, normal, reflection in world space by using corresponding values of given Data struct.

Arguments

  • Data Data - Data structure to fill.

void dataSetGbuffer ( inout Data Data, GBuffer gbuffer ) #

Sets Data's structure normal, dielectric and gloss values by using corresponding values of given GBuffer instance.

Arguments

  • inout Data Data - Data structure.
  • GBuffer gbuffer - GBuffer instance with necessary values to be set.

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

Calculates all values for Data struct.

Arguments

  • inout Data data - Data structure to be filled with calculated values.
  • GBuffer gbuffer - GBuffer struct.
  • 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.

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);
/* ... */
Last update: 2021-12-13
Build: ()