The Textures Section


The Textures section loads textures into the simulation and assigns names to them, for use in the rest of the sections. The section starts with this header:
<Textures>

and ends with this footer:
<EndTextures>

1. Load - loads a texture
Syntax: Load filename, name, tile_x, tile_y[, force]
Example: Load data\brick1.jpg, Brick, 1, 1

This example will load the file brick.jpg and name it Brick. The values tile_x and tile_y are per-texture multipliers. For example, if you set tile_x to 2, and you specify a texture width (tw) of 2 during an AddFloor command later, the tiling value will be 4 (2 times 2), and the texture will be repeated 4 times horizontally. The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

2. LoadRange - loads a numeric range of textures, and the current number is available in the number variable (%number%)
Syntax: LoadRange startnumber, endnumber, filename, name, tile_x, tile_y[, force]
Example: LoadRange 2, 138, data\floorindicators\%number%.jpg, Button%number%, 1, 1

This example will load the file 2.jpg and name it Button2, 3.jpg as Button3, and so on. The values tile_x and tile_y are per-texture multipliers. For example, if you set tile_x to 2, and you specify a texture width (tw) of 2 during an AddFloor command later, the tiling value will be 4 (2 times 2), and the texture will be repeated 4 times horizontally. The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

3. LoadAnimated - loads a set of textures to use as a single animated texture
Syntax: LoadAnimated filename1, filename2, ..., name, duration, tile_x, tile_y[, force]
Example: LoadAnimated data/pic1.jpg, data/pic2.jpg, data/pic3.jpg, myanimation, 2, 1, 1

This example will load the files pic1.jpg, pic2.jpg and pic3.jpg and associate them with the texture material "myanimation". When "myanimation" is used, those three images will automatically be displayed in order, in a loop. Duration refers to the length of the animation in seconds. The values tile_x and tile_y are per-texture multipliers. For example, if you set tile_x to 2, and you specify a texture width (tw) of 2 during an AddFloor command later, the tiling value will be 4 (2 times 2), and the texture will be repeated 4 times horizontally. The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

4. LoadAlphaBlend - loads a texture with a specular mask texture and blending texture, used to make things like reflection effects
Syntax: LoadAlphaBlend filename, specular_filename, blend_filename, name, spherical, tile_x, tile_y[, force]
Example: LoadAlphaBlend data/windows.jpg, data/windows_spec.png, data/sky.jpg, mywindows, true, 1, 1
This example will load the texture windows.jpg normally, and will load windows_spec.png as a specular mask (which needs to be a file that contains an alpha blended image that is used to determine how the blending texture applies to the original texture), and loads a texture to blend as sky.jpg (see Skyscraper's data folder for examples of this). The spherical parameter determines if the texture is spherically mapped (true) or planar mapped (false). The values tile_x and tile_y are per-texture multipliers. For example, if you set tile_x to 2, and you specify a texture width (tw) of 2 during an AddFloor command later, the tiling value will be 4 (2 times 2), and the texture will be repeated 4 times horizontally. The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

5. LoadMaterial - loads a custom OGRE material, used for advanced/specific texture definitions
Syntax: LoadMaterial material_name, name, tile_x, tile_y[, force]
Example: LoadMaterial testmat, mycustommaterial, 1, 1
Material definitions (and their associated textures) are stored in Skyscraper's data/materials folder, and are all automatically loaded on startup. The material definitions (the example being testmat.material) contain a material name along with the texture processing parameters. The material name specified in this command needs to match the one in the material definition you want to use; the example file is named "testmat". Name is the standard texture name you want to map it to, to use with other commands. The other commands are the same as in previous commands. For more information on how to make material definition scripts, see the OGRE manual's "Material Scripts" section.

6. AddText - draws text onto a texture - this only creates a new texture during runtime (in memory), and all changes are lost when the application shuts down
Syntax: AddText texture_name, name, font_filename, font_size, text, x1, y1, x2, y2, h_align, v_align, ColorR, ColorG, ColorB[, force]
Example: AddText Black, Button100, nimbus_sans.ttf, 47, 100, -1, -1, -1, -1, center, center, 255, 255, 255

With this command, texture_name is the name of the previously loaded texture to draw text onto (loaded with either Load or LoadRange). Name is the name to call this new texture. Font_filename is the filename of the font to use - fonts are in Skyscraper's data/fonts directory. X1, y1, x2, and y2 are coordinate values mainly used to position the text in a boxed area, with the position of 0, 0 (x 0, y 0) being on the top left.. If any value is -1, the dimension of the texture will be used (so in this example, the loaded texture has a size of 128x128 pixels, and so the values are 0, 0, 128, 128). This will place the text in the center of the texture image, but to position it elsewhere, specify the pixel box to place it in. H_align and v_align determine the alignment of the text - for h_align, it can either be "left", "right" or "center", and for v_align either "top", "bottom" or "center". ColorR, ColorG and ColorB determine the color of the text, and the values range from 0 to 255. If all values are 255, the text is white, and if all values are 0, then it's black. The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

7. AddTextRange - similar to LoadRange, but draws text onto a texture
Syntax: AddText startnumber, endnumber, texture_name, name, font_filename, font_size, text, x1, y1, x2, y2, h_align, v_align, ColorR, ColorG, ColorB[, force]
Example: AddText 1, 100, Black, Button%number%, nimbus_sans.ttf, 47, %number%, -1, -1, -1, -1, center, center, 255, 255, 255

8. LoadCropped - loads a cropped image.
Syntax: LoadCropped filename, name, x, y, width, height, tile_x, tile_y[, force]
Example: LoadCropped data\brick1.jpg, Brick2, 10, 10, 20, 20, 1, 1

This command is similar to the Load command, but loads only a portion of an image. In the above example, the command loads the file data\brick1.jpg as "Brick2", but only loads the portion of the image starting at pixel 10, 10, with a width of 20 pixels and a heigth of 20 pixels. Pixel 0, 0 is on the top left of the image. The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

9. AddOverlay - draws an image on top of another image
Syntax: AddOverlay texture_name, overlay_texture_name, name, x, y, width, height, tile_x, tile_y[, force]
Example: AddOverlay Brick1, Brick2, NewBrick, 25, 25, 50, 50, 1, 1

This command allows multiple textures to be combined into a single texture, by drawing one on top of the other. Texture_name specifies the original source texture name to use (all textures must be loaded beforehand), overlay_texture_name specifies the texture to draw on top of the source texture, and name specifies the name of the new texture. X and Y determine the position to place the top-left of the new image at (since position 0, 0 is the top left of the image), and width and height determine the size in pixels of the overlay texture. In the above example, the "Brick2" texture is drawn on top of the "Brick1" texture, starting at pixel position 25, 25, with a width of 50 and a height of 50. The resulting texture is called "NewBrick". The force value is optional, and if set to false, autosizing will always be disabled for this texture; if set to true, autosizing will always be enabled.

10. Rotate - sets a texture's rotation to a set amount. This can be used with other texture modifiers.
Syntax: Rotate name, angle
Example: Rotate Brick1, 30

This command sets the texture's rotation value. In the example, the Brick1 texture's rotation is set to 30 degrees (clockwise).

11. RotateAnim - applies rotation animation to a texture. This can be used with other texture modifiers.
Syntax: RotateAnim name, speed
Example: RotateAnim Brick1, 0.2

This command sets the texture's animated rotation value. Speed is in rotations per second. In the example, the Brick1 texture's rotation animation is set to 0.2 rotations per second.

12. Scroll - set's a texture's fixed scrolling value. This can be used with other texture modifiers.
Syntax: Scroll name, x_offset, y_offset
Example: Scroll Brick1, 0.5, 0.5

This command sets the texture's scrolling value. In the example, the Brick1 texture is shifted to the right halfway, and shifted up halfway.

13. ScrollAnim - applies scrolling animation to a texture. This can be used with other texture modifiers.
Syntax: ScrollAnim name, x_speed, y_speed
Example: ScrollAnim Brick1, 1, 1

The speed values are the number of full scrolls per second. In the example, the Brick1 texture will scroll to the right once per second, and up once per second.

14. Scale - sets a texture's scaling factor. This can be used with other texture modifiers.
Syntax: Scale name, x_scale, y_scale
Example: Scale Brick1, 30

In the example, the Brick1 texture is scaled to half the size, in both width and height.

15. Transform - sets an advanced transformation method on the texture. This can be used with other texture modifiers, and also can be used multiple times to create multiple transformations.
Syntax: Transform name, type, wave_type, base, frequency, phase, amplitude
Example: Transform Brick1, rotate, sine, 0.2, 0.2, 0.1, 1.0

This command applies an advanced transformation method on the texture. Type is the animation type modified, and can either be scroll_x, scroll_y, rotate, scale_x, or scale_y. Wave_type defines the type of waveform applied to the transformation, which creates a variable speed of the animation. The values are sine (a typical sine wave which smoothly loops between min and max values), triangle (an angled wave which increases & decreases at constant speed, changing instantly at the extremes), square (max for half the wavelength, min for the rest with instant transition between), sawtooth (gradual steady increase from min to max over the period with an instant return to min at the end), inverse_sawtooth (gradual steady decrease from max to min over the period, with an instant return to max at the end), or pwm (Pulse Width Modulation; like square, except the high to low transition is controlled by duty cycle). Base is the base value of the wave (base value, the minimum if amplitude > 0, the maximum if amplitude < 0), frequency is the number of wave iterations per second (speed), phase is the offset of the wave start, and amplitude is the size of the wave.

16. SetCulling - sets the culling value for a specified texture.  This determines which sides of the object the texture should be displayed.
Syntax: SetCulling name, value
Example: SetCulling Brick1, 0

Values are 0 for no culling (show both sides), 1 to cull anticlockwise (SBS default), or 2 to cull clockwise (Ogre default, used for models).
In the example, the Brick1 texture is now showing both sides of the texture.