"season-selector" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (Corrected 0-1 sumer-winter period)
(season-range)
 
(7 intermediate revisions by 4 users not shown)
Line 18: Line 18:
 
====season-range====
 
====season-range====
 
:Type: vector2
 
: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 = mid-summer, 0.5 = mid-winter.
+
: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 the following applies:
 +
0 = start of summer
 +
0.25 = start of autumn/fall
 +
0.5 = start of winter
 +
0.75 = start of spring
 +
1.0 = end of spring
 +
 
 +
1 month = 0.083333
  
 
====above-snow-line====
 
====above-snow-line====
Line 34: Line 41:
  
 
=="Season-selector" Example==
 
=="Season-selector" Example==
 +
 +
Download a Full Seasonal Asset [http://download.trainzportal.com/tutorials/seasonal_asset_example_trainz-build_4.6.cdp HERE] for trainz-build 4.6 or above.
  
 
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):
 
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):
Line 39: Line 48:
 
  season-selector
 
  season-selector
 
  {
 
  {
   season-range                          0.25,0.75
+
   season-range                          0.503,0.741
 
    
 
    
 
   branch-true
 
   branch-true
 
   {
 
   {
     season-range                        0.25,0.5
+
     output-season                    1
   
+
    branch-true
+
    {
+
      output-season                    0
+
    }
+
   
+
    branch-false
+
    {
+
      output-season                    1
+
    }
+
 
   }
 
   }
 
    
 
    
 
   branch-false
 
   branch-false
 
   {
 
   {
     output-season                       0
+
     output-season                     0
 
   }
 
   }
 
  }
 
  }
Line 93: Line 92:
 
   {
 
   {
 
     diffuse-texture                    "winter.texture"
 
     diffuse-texture                    "winter.texture"
 +
  }
 +
}
 +
 +
This next example covers all seasonal options including Summer, Autumn, Winter, Spring, Snowline Summer, Snowline Autumn, Snowline Winter, Snowline Spring. Not all assets require these. Foliage is a good example of assets that might require a number of these seasonal options. If you wish to use "snow" on your asset use the Snowline options, not the Winter options.
 +
 +
summer = 0
 +
 +
winter = 1
 +
 +
autumn = 4
 +
 +
spring = 5
 +
 +
snow line summer = 2
 +
 +
snow line winter = 3
 +
 +
snow line autumn = 6
 +
 +
snow line spring = 7
 +
 +
season-selector
 +
{
 +
  above-snow-line                      1
 +
 
 +
  branch-true
 +
  {
 +
    season-range                        0.501,0.75
 +
   
 +
    branch-true
 +
    {
 +
      output-season                    3
 +
    }
 +
   
 +
    branch-false
 +
    {
 +
      season-range                      0.251,0.5
 +
     
 +
      branch-true
 +
      {
 +
        output-season                  6
 +
      }
 +
     
 +
      branch-false
 +
      {
 +
        season-range                    0.751,1
 +
       
 +
        branch-true
 +
        {
 +
          output-season                7
 +
        }
 +
       
 +
        branch-false
 +
        {
 +
          output-season                2
 +
        }
 +
      }
 +
    }
 +
  }
 +
 
 +
  branch-false
 +
  {
 +
    season-range                        0.501,0.75
 +
   
 +
    branch-true
 +
    {
 +
      output-season                    1
 +
    }
 +
   
 +
    branch-false
 +
    {
 +
      season-range                      0.251,0.5
 +
     
 +
      branch-true
 +
      {
 +
        output-season                  4
 +
      }
 +
     
 +
      branch-false
 +
      {
 +
        season-range                    0.751,1
 +
       
 +
        branch-true
 +
        {
 +
          output-season                5
 +
        }
 +
       
 +
        branch-false
 +
        {
 +
          output-season                0
 +
        }
 +
      }
 +
    }
 
   }
 
   }
 
  }
 
  }

Latest revision as of 10:43, 23 April 2024

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

[edit] 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

[edit] 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.

[edit] 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 the following applies:

0 = start of summer 0.25 = start of autumn/fall 0.5 = start of winter 0.75 = start of spring 1.0 = end of spring

1 month = 0.083333

[edit] 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.

[edit] 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.

[edit] 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.


[edit] "Season-selector" Example

Download a Full Seasonal Asset HERE for trainz-build 4.6 or above.

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.503,0.741
  
  branch-true
  {
    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"
 }
}

This next example covers all seasonal options including Summer, Autumn, Winter, Spring, Snowline Summer, Snowline Autumn, Snowline Winter, Snowline Spring. Not all assets require these. Foliage is a good example of assets that might require a number of these seasonal options. If you wish to use "snow" on your asset use the Snowline options, not the Winter options.

summer = 0

winter = 1

autumn = 4

spring = 5

snow line summer = 2

snow line winter = 3

snow line autumn = 6

snow line spring = 7

season-selector
{
 above-snow-line                       1
 
 branch-true
 {
   season-range                        0.501,0.75
   
   branch-true
   {
     output-season                     3
   }
   
   branch-false
   {
     season-range                      0.251,0.5
     
     branch-true
     {
       output-season                   6
     }
     
     branch-false
     {
       season-range                    0.751,1
       
       branch-true
       {
         output-season                 7
       }
       
       branch-false
       {
         output-season                 2
       }
     }
   }
 }
 
 branch-false
 {
   season-range                        0.501,0.75
   
   branch-true
   {
     output-season                     1
   }
   
   branch-false
   {
     season-range                      0.251,0.5
     
     branch-true
     {
       output-season                   4
     }
     
     branch-false
     {
       season-range                    0.751,1
       
       branch-true
       {
         output-season                 5
       }
       
       branch-false
       {
         output-season                 0
       }
     }
   }
 }
}

[edit] See Also

Personal tools