"season-selector" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Added an usage example)
("Season-selector" Example)
Line 81: Line 81:
 
  }
 
  }
  
If you apply it to a groundtexture, add a texture-variants table:
+
If you apply it to a groundtexture, add a texture-variants container:
  
 
  texture-variants
 
  texture-variants

Revision as of 00:48, 27 March 2013

The "Season-selector" container is a top-level container is some assets' config.txt file which allows the simulator to display an appropriate visual for each asset instance based on certain environmental parameters. The container does not specify anything about the visuals directly, but rather provides logic which maps the varied environmental parameters down to a single "season index" which is then used in other parts of the asset's config.txt file.

The "Season-selector" container is a recursive structure- meaning that the container may contain one or more of itself as sub-containers.

Contents

Supported Tags

The "Season-selector" container supports the following tags. Each tag is show here with its default value.

output-season
season-range 0.0, 1.0
above-snow-line 0
branch-true
branch-false

output-season

Type: Integer
Desc: The season index used for this asset if the decision logic reaches this [sub-]container. If specified, this should be the only tag in this "Season-selector" [sub-]container.

season-range

Type: vector2
Desc: A conditional tag which tests whether the global time-of-year value falls within the specified range. If the first number is less than the second, the condition is evaluated by (first-value <= time-of-year <= second-value.) If the second number is less than the first, the condition is evaluated by (time-of-year <= second-value || time-of-year >= first-value.) The global time-of-year value varies from 0.0 to 1.0 throughout the year, where 0.0 is new year.

above-snow-line

Type: boolean
Desc: A conditional tag which tests whether the asset instance is above the snow-line. If set to a true value (eg. 1) then asset instances will evaluate this condition as (asset-height >= snow-line-height.) If set to a false value (eg. 0) then no test is performed.

branch-true

Type: "Season-selector" container
Desc: If all of the conditional tags in this [sub-]container evaluate to true, this child branch is evaluated to determine the output-season for a specified asset instance.

branch-false

Type: "Season-selector" container
Desc: If one or more of the conditional tags in this [sub-]container evaluate to false, this child branch is evaluated to determine the output-season for a specified asset instance.


"Season-selector" Example

The season-selector for selecting winter would look like this in the top-level of your config file (1 means winter, 0 the other three):

season-selector
{
  season-range                          0.25,0.75
  
  branch-true
  {
    season-range                        0.25,0.5
    
    branch-true
    {
      output-season                     0
    }
    
    branch-false
    {
      output-season                     1
    }
  }
  
  branch-false
  {
    output-season                       0
  }
}

If you apply it to a mesh (scenery), the mesh table would be:

mesh-table
{
 default
 {
   mesh                                "default/mesh.im"
   auto-create                         1
   mesh-season                         0
 }
 
 winter
 {
   mesh                                "winter/mesh.im"
   auto-create                         1
   mesh-season                         1
 }
}

If you apply it to a groundtexture, add a texture-variants container:

texture-variants
{
 0
 {
   diffuse-texture                     "default.texture"
 }
 
 1
 {
   diffuse-texture                     "winter.texture"
 }
}

See Also

Personal tools