"mesh-table" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(mesh-asset)
m (orientation)
Line 80: Line 80:
 
Allows a submesh to be rotated relative to its insertion point.  To reverse a mesh by 180 degrees about the Z axis, add the tag:
 
Allows a submesh to be rotated relative to its insertion point.  To reverse a mesh by 180 degrees about the Z axis, add the tag:
  
position 0,0,3.14159
+
orientation 0,0,3.14159
  
 
A coconut is awarded to the programmer who decided that the parameters to this tag should be in radians.
 
A coconut is awarded to the programmer who decided that the parameters to this tag should be in radians.

Revision as of 15:17, 1 April 2011

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
mesh-season 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

Allows assets to be used as 'mesh libraries', the following container specifies that the mesh required (and its optional animation) is located in the root folder of <kuid:1234:5678>. CMP does not check for the existence of these files so you must ensure that they are present before using this tag.

mesh-table {
  submesh {
   mesh-asset <kuid:1234:5678>
   mesh "meshname.im"
   anim "meshname.kin"
   att "a.point"
   att-parent "default"
  }
}

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 (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. 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.

mesh-season

The season index for which this mesh is displayed. The default value (255) indicates that this mesh is visible in all seasons. See also "Season-selector" container.

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

opacity x (float 0.0 - 1.0 default 1.0)

Specifies the overall transparency of a mesh. Values other than 0.0 or 1.0 employ alpha blending and a value of 0.0 has the same effect as hiding the mesh.

Note that this tag is buggy in TS2009 prior to SP4.

position

position X,Y,Z (in metres, default 0,0,0)

Specifies the location of a mesh relative to its insertion point.

orientation

orientation X,Y,Z (radians default 0,0,0)

Allows a submesh to be rotated relative to its insertion point. To reverse a mesh by 180 degrees about the Z axis, add the tag:

orientation 0,0,3.14159

A coconut is awarded to the programmer who decided that the parameters to this tag should be in radians.

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.

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