scene

 

Tag: scene
Parent tag: scenes
Attributes:

  • name (string) – scene’s name
  • filename (string) – a shortcut to specify a single filename
  • param (string) – params to be sent to the loader. Multiple params can be specified, separated by space or comma. Available values are UNITIZE (scale the scene so the it fits a cube with coordinates in [-1,1], SWAP_YZ (only for 3DS models), and USE_ADJACENCY (builds an adjacency index list)

Child tags:

  • TRANSFORM_ORDER (enum) – {T_R_S (default), T_S_R, R_T_S, R_S_T, S_T_R, S_R_T} defines the order of the geometric transformations
  • SCALE (vec3) – x, y, z
  • TRANSLATE (vec3) – x, y, z
  • ROTATE (vec4) – x, y, z, w, where (x,y,z) stand for the rotation axis and w stands for the angle in degrees
  • file+
  • folder+
  • geometry+
  • buffers+
  • terrain+

The scene tag can be used to:

  • import 3D models from specific files or entire folders;
  • define a model using a set of buffers for their attributes;
  • use some pre-defined geometric shapes.
  • build a terrain using a texture as a height map

The filename can be defined using the absolute path of the file, or the relative path considering the location of the project file.

The allowed file formats are: 3ds, obj, ply, dae, ogre xml mesh, lwo, stl, and nbo.

All but the last are popular file formats and Assimp is used to assist loading them. The last format, nbo (nau binary object), is a binary format that has been developed in particular for Nau. A nbo can be built using Composer, Nau’s GUI.

If a scene uses only a 3D model from a single file then the filename attribute can be used as a shortcut.

The geometric transformation child tags (TRANSLATION, ROTATION, and SCALE) can be used to transform the object. The different transformations are applied in the order specified in tag TRANSFORM_ORDER.

Example:

<scene name="MainScene"  
	param="SWAP_YZ, USE_ADJACENCY"
	filename="../../models/teapot.3ds"/>

In the above example a 3DS model will be imported. Since this model was built with the Z axis as the up axis, we also ask the loader to swap the Y and Z axes. We are also asking for an index list containg adjacency information that can later be used in a geometry shader.

The following examples are more generic where several scenes are defined using child tags:

<scene name="AScene" >
	<TRANSLATE x=1.5 y=0 z=0 />
	<ROTATE x=0 y=1 z=0 w=45 />
	<SCALE x=2 y=3 z=1 />
	<file .../>
	<file .../>
	<folder .../>
</scene>
<scene name="AnotherScene" param="UNITIZE" >
	<TRANSLATE x=1.5 y=0 z=0 />
	<ROTATE x=0 y=1 z=0 w=45 />
	<geometry ...>
		...
	</geometry>
</scene>
<scene name="YetAnotherScene" >
	<buffers ...">
		...				
	</buffers>	
</scene>

San Miguel scene loaded in Nau3D