Unigine Language Object Notation (ULON)
ULON (Unigine Language Object Notation) is a universal format used in UNIGINE to describe complex structures similar to classes in Object-Oriented Programming. Landscape Terrain brushes as well as some of UNIGINE built-in materials are described using ULON.
The Engine supports loading and parsing files containing ULON-declarations, but does not support saving ULON-based structures to a file as such declarations are treated more like source code.
ULON Description Example
See Also#
Nodes#
The basic element (building brick) of ULON is called a node. Each node has a type, a name, and a value.
The following construct is used to declare a node:
Both node name and type are written as strings:
- either a quoted string with standard escape characters,
- or a bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_".
"Node Type" "node name" = node_value
NodeType node_name1 = node_value
Node declarations can be nested, thus forming a hierarchy. So a node can have a parent and an unlimited number children.
Node parent
{
Node child_0
Node child_1
{
Node child_2
Node child_3
}
}
Values#
ULON node values can be of the following types:
- Boolean
Node my_node = true - Integer number
Node my_node = 1234 - Floating-point number
Node my_node = 3.1459 - String
- Quoted string with standard escape characters:
Node node = "word word" - Bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_":
Node node = word1_word2 - Heredoc string enclosed in #{ ... #}. This type can be used for code fragments (e.g., shader code embedded into material description):
Node my_node = #{C++ C# USC HLSL GLSL USSL#}
- Quoted string with standard escape characters:
- Array containing a finite number of integer, float, and string elements
Node my_node = [100, 0.2, str str "str str str", #{vec4 asd = vec4_zero;#}]
This array has the following 6 elements:- 100
- 0.2
- str
- str
- str str str
- vec4 asd = vec4_zero;
Arguments#
ULON argument is a name - value pair (name = value). Arguments are additional parameters that can be associated with ULON nodes and used for various purposes (e.g. to define a tooltip or a title for a material parameter declaration). Arguments are enclosed in angle brackets < > and can be separated using "\t","\n","\r", as well as commas and spaces.
Example:
Conditions#
For each node a logical condition can be specified, if the condition fails the ULON node with all its children is ignored. Thus you can dynamically build the hierarchy of ULON nodes with a great degree of flexibility. This can be useful when the contents of the node depends on certain parameters, e.g. a shader to be used is defined by the rendering pass.
Condition of the parent node is added to the condition of the child: (parent_conditon) && (child_conditon)
Example:
Node parent if[var1 == 10 || var1 == 5]
{
Node child_0 if[var2 == 3]
Node child_1 if[var2 == 4]
{
Node child_2 if[var3 != 11]
Node child_3 if[var3 != 25]
}
}
- parent condition: (var1 == 10 || var1 == 5)
- child_0 condition: (var1 == 10 || var1 == 5) && (var2 == 3)
- child_1 condition: (var1 == 10 || var1 == 5) && (var2 == 4)
- child_2 condition: (var1 == 10 || var1 == 5) && (var2 == 4) && (var3 != 11)
- child_3 condition: (var1 == 10 || var1 == 5) && (var2 == 4) && (var3 != 25)
Comments#
Adding comments make object declaration easier to understand, especially if the object is a complex one. The following type os comments are supported:
- single-line comments starting with "//":
// This is a single-line comment - multi-line comments enclosed within "/*" and "*/":
/* This is
a multi-line
comment */