attribute
Tag: attribute
Parent tag: attributes
Attributes:
type
(enum) – The object type. See this for the full listname
(string)data
(enum) – Any of the data types supported by Nauvalue
|x
,y
,z
,w
– float, double, bool or int, depending on thedata
type. Note: this attribute is not allowed for matrix types.
Child tags: (none)
Nau’s objects have several predefined attributes, for instance a camera has a component named POSITION
. See this for further info. The attribute
tag allows adding user defined components to a type of object. These can then be set when defining an object using the same rules as any other component, manipulated with lua scripts, and accessed within shaders.
Example:
<attribute type="LIGHT" name="DIR" data="VEC4" x="-1.0" y="-1.0" z="-1.0" w = "0" /> <attribute type="CAMERA" name="DIST" data="FLOAT" value="10" /> <attribute type="STATE" name="FOG_MIN_DIST" data="FLOAT" value = 0.0 /> <attribute type="STATE" name="FOG_MAX_DIST" data="FLOAT" value = 100.0 />
For instance, considering the above defined attributes, a camera can now use the DIST
attribute as shown in the following example:
<camera name="MainCamera" > <viewport name="MainViewport" /> <TYPE value="PERSPECTIVE"/> <FOV value=60/> <POSITION x=-1.914014 y=1.992289 z=1.460414 /> <VIEW x=0.562365 y=-0.67465 z=-0.478115 /> <DIST value=5 /> </camera>
Note that all cameras will have the DIST
attribute. If DIST
is not present in the camera definition then it will assume its default value as specified in the attribute
definition.