-
Notifications
You must be signed in to change notification settings - Fork 0
Projects
A behave
project can (and should) consist of many files:
- The main file (required)
- Several secondary files (highly recommended)
The file extension for behave
files is .beh
. You must follow this otherwise no secondary files will be detected or imported.
Secondary files can be placed in nested folders or alongside the main file.
Every file can contain use
s. They are used to bring items (struct
s, enum
s, template
s, and functions) from secondary files into scope so they can be referred to by Item
instead of This.Very.Long.Path.To.My.Item
.
Uses are handled at a scope level, so you can put them anywhere.
A use statement is written:
use Path.To.File.Or.Folder;
The path is relative to the main file, so use This.That
would look for a file or a folder named This
in the same folder as the main file.
It will then bring That
into scope. If That
is a file, all the items inside it will be brought into scope as That.{item}
. If That
is a folder, all files and subfolders inside it will be brought into scope as That.{sub}
.
The main file of a behave
project can contain two elements: lods
and behavior
. The behavior
element is optional.
The lods
element allows you to define the .gltf
files to use as LODs in your model.
It is written:
lods {
<min_size> -> <lod_file>,
// Which would look something like:
50 -> "LOD1.gltf",
0 -> "LOD2.gltf"
}
Note that trailing commas are not allowed.
min_size
: The minimum size of the bounding sphere of your object as a percentage of the size it takes on the screen. This is followed then the graphics setting Object Level of Detail
is set to 100
. Other values will scale these values down as appropriate.
lod_file
: The path to the .gltf
file to use, relative to the directory where the output .xml
is placed. This is checked at compile-time, and if the file does not exist, an error is raised.
The behavior
element defines how the model will behave
(haha get it). It is optional as not all models require behaviors.
It is written:
behavior {
<behavior_expressions_or_declarations>
}
The behavior
element contains a list of behavior expressions or variable declarations.
All the secondary files can contain a list of items:
Functions are declared much like in here,
but since they are items you need to add an <ident>
between the fn
and argument list:
fn <ident>(<args>) -> <ret> {
<code>
}