Skip to content
Permalink
Browse files

Rework texture generating code, add texture grouping via ( ... )

  • Loading branch information
sfan5 committed Jul 24, 2014
1 parent 5357a17 commit 5884236046c4405eec7cfc12cdde0be9f48058b6
Showing with 233 additions and 229 deletions.
  1. +1 −0 builtin/game/features.lua
  2. +72 −0 doc/lua_api.txt
  3. +160 −227 src/tile.cpp
  4. +0 −2 src/tile.h
@@ -7,6 +7,7 @@ core.features = {
get_all_craft_recipes_works = true,
use_texture_alpha = true,
no_legacy_abms = true,
texture_names_parens = true,
}

function core.has_feature(arg)
@@ -186,6 +186,78 @@ stripping out the file extension:
e.g. foomod_foothing.png
e.g. foomod_foothing

Texture modifiers
-----------------
There are various texture modifiers that can be used
to generate textures on-the-fly.

Texture overlaying:
Textures can be overlaid by putting a ^ between them.
Example: default_dirt.png^default_grass_side.png
default_grass_side.png is overlayed over default_dirt.png

Texture grouping:
Textures can be grouped together by enclosing them in ( and ).
Example: cobble.png^(thing1.png^thing2.png)
A texture for 'thing1.png^thing2.png' is created and the resulting
texture is overlaid over cobble.png.

Advanced texture modifiers:
[crack:<n>:<p>
n = animation frame count, p = current animation frame
Draw a step of the crack animation on the texture.
Example: default_cobble.png^[crack:10:1

[combine:<w>x<h>:<x1>,<y1>=<file1>:<x2>,<y2>=<file2>
w = width, h = height, x1/x2 = x position, y1/y1 = y position,
file1/file2 = texture to combine
Create a textue of size <w> x <h> and blit <file1> to (<x1>,<y1>)
and blit <file2> to (<x2>,<y2>).
Example: [combine:16x32:0,0=default_cobble.png:0,16=default_wood.png

[brighten
Brightens the texture.
Example: tnt_tnt_side.png^[brighten

[noalpha
Makes the texture completly opaque.
Example: default_leaves.png^[noalpha

[makealpha:<r>,<g>,<b>
Convert one color to transparency.
Example: default_cobble.png^[makealpha:128,128,128

[transform<t>
t = transformation(s) to apply
Rotates and/or flips the image.
<t> can be a number (between 0 and 7) or a transform name.
Rotations are counter-clockwise.
0 I identity
1 R90 rotate by 90 degrees
2 R180 rotate by 180 degrees
3 R270 rotate by 270 degrees
4 FX flip X
5 FXR90 flip X then rotate by 90 degrees
6 FY flip Y
7 FYR90 flip Y then rotate by 90 degrees
Example: default_stone.png^[transformFXR90

[inventorycube{<top>{<left>{<right>
'^' is replaced by '&' in texture names
Create an inventory cube texture using the side textures.
Example: [inventorycube{grass.png{dirt.png&grass_side.png{dirt.png&grass_side.png
Creates an inventorycube with 'grass.png', 'dirt.png^grass_side.png' and
'dirt.png^grass_side.png' textures

[lowpart:<percent>:<file>
Blit the lower <percent>% part of <file> on the texture:
Example: base.png^[lowpart:25:overlay.png

[verticalframe:<t>:<n>
t = animation frame count, n = current animation frame
Crops the texture to a frame of a vertical animation.
Example: default_torch_animated.png^[verticalframe:16:8

Sounds
-------
Only OGG Vorbis files are supported.

0 comments on commit 5884236

Please sign in to comment.
You can’t perform that action at this time.