The .csv object file defines a single object using textual information. The object can be used in routes or in trains.
An object file defines multiple individual polygons (called faces). You can group multiple polygons together using the CreateMeshBuilder
command.
Some attributes such as SetColor
can be shared among multiple polygons in a group.
The file is a plain text file encoded in any arbitrary encoding, however UTF-8 with a byte order mark is preferred. The parsing model for numbers is Loose, however, Strict output is preferred. The file name is arbitrary, but must have the extension .csv. The file is interpreted on a per-line basis, from top to bottom.
Each command resides on a new line. A command contains of a command name, followed by arguments, seperated by commas. Arguments may be omitted by leaving the argument space empty.
CommandName, Argument1, Argument2, Argument3, ..., ArgumentN
Command names are case-insensitive. White space around the name, arguments, and beginning and end of each line is ignored.
Comments can be used anywhere, and must be preceded by a semicolon.
;This is a comment on its on its own line.
AddVertex, 1, 1, 1 ;This is a comment at the end of a line.
All comments are stripped prior to processing.
The following is a list of available commands.
CreateMeshBuilder
This command marks the beginning of a new group of faces. All further commands relate to the CreateMeshBuilder command that was last opened above.
AddVertex, vX, vY, vZ, nX, nY, nZ
Defines a new vertex which can later be used as points of a face/polygon. The order AddVertex commands are important: the first vertex created has the index 0, followed by 1, and so on.
A normal is the direction perpendicular to a face at a point. Changing the normals (combined with the use of a few other faces) can be used to create an illusion of a smooth curved surface. Leaving the normal arguments blank/zero will allow normals to be calculated automatically.
AddFace, v1, v2, ..., vMAX
Creates a face around the vertices provided. Specify the vertices in clockwise order when looking at the face. Only convex polygons can be formed.
AddFace2, v1, v2, ..., vMAX
Same as AddFace, except the created face is visible on both sides. The lighting on the backface will be that of the front face.
Cube, HalfWidth, HalfHeight, HalfDepth
Creates a cuboid centered around (0,0,0). The cube has 8 vertices and 6 faces.
Tip: move the cube using the Translate and Rotate commands below. This command is equivalent to a series of AddVertex and AddFace commands.
Cylinder, n, UpperRadius, LowerRadius, Height
Creates a frustrum centered around (0,0,0).
Tip: move the frustrum using the Translate and Rotate commands below. This command is equivalent to a series of AddVertex and AddFace commands.
Translate, X, Y, Z
, TranslateAll, X, Y, Z
Translate moves all vertices (including within Cube and Cylinder commands) above itself in the CreateMeshBuilder group accordingly. TranslateAll moves all vertices above itself in the entire file accordingly.
This command may be called multiple times.
Scale, X, Y, Z
, ScaleAll, X, Y, Z
Scale scales all vertices (including within Cube and Cylinder commands) above itself in the CreateMeshBuilder group accordingly. ScaleAll scales all vertices above itself in the entire file accordingly.
This command may be called multiple times.
Rotate, X, Y, Z
, RotateAll, X, Y, Z
Rotate rotates all vertices (including within Cube and Cylinder commands) above itself in the CreateMeshBuilder group accordingly. The rotation is done around the origin (0,0,0). RotateAll rotates all vertices above itself in the entire file accordingly.
Example: To rotate an object around the y-axis (rotate around a vertical axis), use x=0, y=1 and z=0.
This command may be called multiple times. Try using in conjunction with Translate(All) functions if needed.
Shear, dX, dY, dZ, sX, sY, sZ, r
, ShearAll, dX, dY, dZ, sX, sY, sZ, r
Shear performs a shear mapping. Essentially, the object is sliced into planes along the direction D and then displaced along the direction S. r indicates how much to displace vectors - it is calculated by the formula r = y/x.
This command is useful for creating bridges passing over a railway at an angle. This command may be called multiple times.
SetColor, R, G, B, A
SetColor applies the colour specified on faces above the command in the current section. If a texture is already used, the texture's colours will be multiplied by the specified colour.
This colour is affected by ambient lighting.
SetEmissiveColor, R, G, B, A
SetEmissiveColor applies the colour specified on faces above the command in the current section. Use this command for faces which appear as if it is emitting light.
This colour is affected by ambient lighting - the colour shown on the face is the sum of the specified colour and the ambient lighting.
SetBlendMode, BlendMode, GlowHalfDistance, GlowAttenuationMode
This command sets the blend mode of face(s) in the current section.
Normal blend mode replaces screen pixels with the texture, while additive will add the colour of the pixels onto the screen, where black will be transparent, while white and bright colours will be seen brighter.
GlowAttenuationMode sets the way the pixels fade off at distance. DivideExponent2 gives a smooth transition which gradually reaches its peak, while DivideExponent4 gives a sharper transition that quickly reaches its peak.
LoadTexture, DayTexture, NightTexture
Loads a texture that will be applied to all faces in the current section.
If only a day texture is defined, the object will be shaded depending on lighting conditions on the scene. If a night texture is specified, the day texture will always be at full brightness, and will fade into the night texture based on brightness.
You will almost always need to use SetTextureCoordinates to make the texture fill a face.
SetDecalTransparentColor, Red, Green, Blue
All the pixels in the texture that are of the exact specified colour will be made transparent.
SetTextureCoordinates, VertexIndex, X, Y
This command takes a vertex, and pins the specified point on the texture to the vertex. Textures will repeat infinitely.
Imagine the texture is a flexible, stretchable piece of cloth. Each time this command is used, a thumbtack is pushed through the (X, Y) position of the texture, then the thumbtack is moved to the location of the vertex of the face. You are pinning a point of the picture to each vertex.