"mesh-table" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
 
m (1 revision)

Revision as of 23:58, 3 February 2010

The "mesh-table" container is a top-level config.txt file entry used by various Content Types.


The mesh-table is a list of mesh subcontainers with no standalone tags. Each mesh subcontainer uses the following format. Tags are parsed in a standardised format, but not all Content Types support the full range of tags. Each mesh derives its name from the subcontainer's tag name. These names are used to refer to specific meshes from within the mesh-table and also from script.

Contents

Supported Tags

Each mesh subcontainer supports the following tags. Each tag is shown here with its default value.

mesh-asset <NULLKUID>
mesh ""
anim ""
lod-level 255
att ""
att-parent ""
opacity 1.0
position 0,0,0
orientation 0,0,0
auto-create 0
use-parent-bounds 0
animation-loop-speed 0
light 1
critical-animation 1
effects
{
}
night-mesh-base ""

mesh-asset

TBD

mesh

The ‘main’ mesh name. This may include a sub-path; ie: mesh nightwindows/nightwindows.im, where the file nightwindows.im has been placed in the subdirectory nightwindows.

Use .im files exported from 3dsmax or gmax (as opposed to .pm.) or reference an .lm file if you wish your asset to have ‘Level of Detail’ mesh reduction.

Level of detail is a process of using different model meshes, depending on how far the viewer is from the model. A finer mesh is used for close up viewing in Trainz.

anim

The animation file (.kin) exported from 3dsmax or gmax. This may include a sub-path.

lod-level

The object LOD level at which this mesh is displayed. The default value (255) indicates that this mesh is visible at all detail levels. See also KIND Mesh for the 'mesh-detail-level' tag.

att

The mesh (and animation if present) is inserted at a mesh attachment point rather than the origin (without this line the mesh is placed relative to the origin of the parent model).

att-parent

The tag tells Trainz in which mesh the attachment point is located. The insertion attachment point is located within the mesh ‘name’ , as listed in the config.txt.

opacity

TBD'

position

TBD'

orientation

TBD'

auto-create

The model is generated automatically when placed, or when you load a map which includes the model. In some instances you don’t want the mesh visible (as this may be controlled through script). If auto-create is 0 the mesh will not be visible when placed.

use-parent-bounds

When enabled, this tag indicates that render culling should occur using the whole object's bounding box rather than this mesh's bounding box. Bounding boxes on individual meshes may not update correctly when animation moves the object's geometry any significant distance from the bind position. This flag can help mitigate such effects, at a tiny performance penalty.

animation-loop-speed

This tag must be here if the asset is to animate when placed. If this tag is not here when placed the animation will not play by default, but may play if controlled by script. A different value (e.g. 0.5, 2.0) may be used in the tag to play the animation at a different speed from that created in 3dsmax or gmax.

light

TBD'

critical-animation

"critical-animation" indicates that this mesh's animation generates events which are critical to the script system's behavior. If your asset is not scripted, does not use scripted animation events, or only uses the events for display purposes and will not break if the occasional event is missed, this tag should be set to false. Leaving this flag set to true is a significant performance penalty.

night-mesh-base

This night mesh is linked to the specified mesh and is visible only at night. It is invisible if the specified mesh is invisible, (if the auto-create 0 line were used so the specified mesh can be controlled by script).


Effects Container

The effects container also contains a list of effect subcontainers. The effect subcontainers support the following generic tags.

kind ""
name ""

The effect subcontainers support additional tags depending on the effect kind. The following effect kinds are supported:


Mesh-Table Example

The following is an example of a simple mesh-table which implements two levels of detail.

mesh-table
{
  default-lod0
  {
    mesh "example-lod0.im"
    auto-create 1
    lod-level 0
  }
  default-lod1
  {
    mesh "example-lod1.im"
    auto-create 1
    lod-level 1
  }
}
Personal tools