Nebula
|
The Nebula Intermediate Definition Language (NIDL) can be used to generate C++ code for Properties.
NIDL uses JSON but also supports comments using //
.
When generating code from NIDL files, the files are placed in the fips-build/{PROJECT}/{FIPS-CONFIG}/nidl
directory. In C++ code, you can include them as if they were placed in the same directory as the .nidl file.
Example:
NIDL file: nebula-demo/code/properties/movement.nidl
C++ include:
Denotes the namespace for this NIDL file.
Generated types will use this namespace.
Includes any header specified within the generated files.
Declares enumerated types. These can be used as types within properties.
Type
can either be:
Type
s, denoting a struct type.Properties are compiled into C++ structs that can be serialized and deserialized easily. Properties can be added to categories and used to store entities states.
Built in scalar-types are:
byte
, bool
short
, ushort
int
, uint
, float
int64
, uint64
, double
Built in non-scalar types are:
vec2
- 2D vector of 32-bit floats.vec3
- 3D vector of 32-bit floats*.vec4
- 4D vector of 32-bit floats.vector
- 4D vector of 32-bit floats*.point
- 4D vector of 32-bit floats.mat4
- 4x4 matrix of 32-bit floats.quat
- A quaternion with 32-bit floats.resource
- A path to a resource.Additional types are:
_flag_
- Create a flag type property that will not allocate memory per instance and cannot have a value. This is useful for categorizing entities, for example Static vs Dynamic entities.Enumerated type
- Any enumerated type defined in a NIDL file can be used as type.C++ type
fips-build/{PROJECT}/{FIPS-CONFIG}/nidl
).The _default_
value can be specified as:
type | value |
---|---|
Integers | 10 |
Floats | 3.0 |
vec2 | [1.0, 0.2] |
vec4 | [1.3, 20.0, 3.12, 4.0] |
vector | [1.0, 2.0, 3.0] |
point | [1.0, 2.0, 3.0] |
quat | [0.0, 0.0, 0.0, 1.0] |
mat4 | [1,0,0,0,0,1,...] (16 floats) |
resource | "mdl:system/placeholder.n3" |
Enum Type | Integer or String |
The default values for different types (usually zero or identity) can be found in {NEBULA-ROOT}/fips-files/generators/IDLC/idltypes.py
.