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. ULON (Unigine Language Object Notation) - это универсальный формат, используемый в UNIGINE для описания сложных структур, подобных классам в объектно-ориентированном программировании. Кисти Landscape Terrain, а также некоторые из встроенных материалов UNIGINE описываются с помощью 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, но не поддерживает сохранение структур на основе ULON в файл, поскольку такие объявления обрабатываются больше как исходный код.
ULON Description Example Пример описания ULON
See AlsoСмотрите также#
NodesУзлы#
The basic element (building brick) of ULON is called a node. Each node has a type, a name, and a value.Базовый элемент ("кирпичик") ULON называется узлом (node). У каждого узла есть тип (type), имя (name) и значение (value).
The following construct is used to declare a node: Для объявления узла используется следующая конструкция:
Both node name and type are written as strings:
Here is an example:
"Node Type" "node name" = node_value
NodeType node_name1 = node_value
- either a quoted string with standard escape characters, либо строка в кавычках со стандартными escape-символами,
- 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
}
}
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
Boolean
Node my_node = true
Node my_node = 1234
Integer number
Node my_node = 1234
Node my_node = 3.1459
Floating-point number
Node my_node = 3.1459
Quoted string with standard escape characters:
Node node = "word word"Quoted string with standard escape characters:
Node node = "word word"
Node node = word1_word2 Bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_":
Node node = word1_word2
Node my_node = #{C++ C# USC HLSL GLSL USSL#}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#}
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#}String
Node node = "word word"Quoted string with standard escape characters:
Node node = "word word"
Node node = word1_word2 Bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_":
Node node = word1_word2
Node my_node = #{C++ C# USC HLSL GLSL USSL#}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#}
Node my_node = [100, 0.2, str str "str str str", #{vec4 asd = vec4_zero;#}]
This array has the following 6 elements:
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:
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"Quoted string with standard escape characters:
Node node = "word word"
Node node = word1_word2 Bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_":
Node node = word1_word2
Node my_node = #{C++ C# USC HLSL GLSL USSL#}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#}
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#}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:
Значения узлов ULON могут быть следующих типов:
- Boolean
Node my_node = true Boolean
Node my_node = true - Integer number
Node my_node = 1234 Целое число
Node my_node = 1234 - Floating-point number
Node my_node = 3.1459 Число с плавающей запятой
Node my_node = 3.1459 - String
- Quoted string with standard escape characters:
Node node = "word word"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 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#}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#}
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#} String
- Quoted string with standard escape characters:
Node node = "word word" Строка в кавычках со стандартными escape-символами:
Node node = "word word" - Bare word, beginning with a lower case letter, containing only letters, digits, and underscores "_":
Node node = word1_word2 Простое слово, начинающееся со строчной буквы, содержащее только буквы, цифры и символы подчеркивания "_":
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#} Строка Heredoc, заключенная в #{ ... #}. Этот тип можно использовать для фрагментов кода (например, кода шейдера, встроенного в описание материала):
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;
Node my_node = [100, 0.2, str str "str str str", #{vec4 asd = vec4_zero;#}]
Этот массив имеет следующие 6 элементов:- 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. Аргумент ULON - это пара имя - значение ( name = value ). Аргументы - это дополнительные параметры, которые могут быть связаны с узлами ULON и использоваться для различных целей (например, для определения всплывающей подсказки или заголовка для объявления параметра материала). Аргументы заключаются в угловые скобки < > и могут быть разделены с помощью "\ t", "\ n", "\ r", а также запятых и пробелов.
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) К условию дочернего узла добавляется условие родительского узла: (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]
}
}
Пример:
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]
ode 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 однострочные комментарии, начинающиеся с "//":
// This is a single-line comment - multi-line comments enclosed within "/*" and "*/":
/* This is
a multi-line
comment */ многострочные комментарии, заключенные в "/*" и "*/":
/ * Это
многострочный
комментарий * /