Skip to content

tex_util

Source: base/tealdef/scripts/tex_util.d.tl

Notes

Types of /scripts/tex_util.tl (TexUtil), helpers that build texture descriptions with common filter and wrap settings.

TexUtil

record global base/tealdef/scripts/tex_util.d.tl:3

global record TexUtil

Load: local tu = require "::/scripts/tex_util.tl"

Notes

Texture description helpers returned by ug_require "/scripts/tex_util.tl".

Functions

makeMaterialIndexTexture(fileName : string, wrapS : WrapMode, wrapT : WrapMode) : TextureDesc base/tealdef/scripts/tex_util.d.tl:72

Call as tu.makeMaterialIndexTexture

Create a material index texture description.

Parameter Type Description
fileName string path to the texture file
wrapS WrapMode horizontal wrap mode
wrapT WrapMode vertical wrap mode

Returns TextureDesc: texture description

Used in the base game: 792 times in 792 files

base/content/climates/climates/shared/gtex/water_ground.gtex.lua:5

texture = tu.makeMaterialIndexTexture("tex/mat255.tga", "CLAMP_TO_EDGE", "CLAMP_TO_EDGE"),
base/content/warehouses/warehouses/entrance/entrance.gtex.lua:5
texture = tu.makeMaterialIndexTexture("entrance.tga", "CLAMP_TO_EDGE", "CLAMP_TO_EDGE"),
base/content/warehouses/warehouses/wh_goods/wh_goods.gtex.lua:5
texture = tu.makeMaterialIndexTexture("wh_goods.tga", "CLAMP_TO_EDGE", "CLAMP_TO_EDGE"),
base/content/warehouses/warehouses/wh_bulk/wh_bulk.gtex.lua:5
texture = tu.makeMaterialIndexTexture("wh_bulk.tga", "CLAMP_TO_EDGE", "CLAMP_TO_EDGE"),
base/content/warehouses/warehouses/wh_liquid/wh_liquid.gtex.lua:5
texture = tu.makeMaterialIndexTexture("wh_liquid.tga", "CLAMP_TO_EDGE", "CLAMP_TO_EDGE"),
base/content/warehouses/warehouses/wh_universal/wh_universal.gtex.lua:5
texture = tu.makeMaterialIndexTexture("wh_universal.tga", "CLAMP_TO_EDGE", "CLAMP_TO_EDGE"),
… and 786 more files.

makeTextureLinearClamp(fileName : string, compressionAllowed : boolean, scaleDownAllowed? : boolean, redGreen? : boolean, texType? : TexType) : TextureDesc base/tealdef/scripts/tex_util.d.tl:80

Call as tu.makeTextureLinearClamp

Create a linear-filtered, clamped texture description.

Parameter Type Description
fileName string path to the texture file
compressionAllowed boolean whether compression is allowed
scaleDownAllowed? boolean whether the texture may be scaled down
redGreen? boolean whether to use only red and green channels
texType? TexType texture dimensionality type

Returns TextureDesc: texture description

makeTextureMipmapRepeat(fileName : string, compressionAllowed : boolean, scaleDownAllowed? : boolean, redGreen? : boolean, texType? : TexType) : TextureDesc base/tealdef/scripts/tex_util.d.tl:88

Call as tu.makeTextureMipmapRepeat

Create a mipmapped, repeating texture description.

Parameter Type Description
fileName string path to the texture file
compressionAllowed boolean whether compression is allowed
scaleDownAllowed? boolean whether the texture may be scaled down
redGreen? boolean whether to use only red and green channels
texType? TexType texture dimensionality type

Returns TextureDesc: texture description

makeTextureMipmapClamp(fileName : string, compressionAllowed : boolean, scaleDownAllowed? : boolean, redGreen? : boolean, texType? : TexType) : TextureDesc base/tealdef/scripts/tex_util.d.tl:96

Call as tu.makeTextureMipmapClamp

Create a mipmapped, clamped texture description.

Parameter Type Description
fileName string path to the texture file
compressionAllowed boolean whether compression is allowed
scaleDownAllowed? boolean whether the texture may be scaled down
redGreen? boolean whether to use only red and green channels
texType? TexType texture dimensionality type

Returns TextureDesc: texture description

makeTextureMipmapClampVertical(fileName : string, compressionAllowed : boolean, scaleDownAllowed? : boolean, redGreen? : boolean, texType? : TexType) : TextureDesc base/tealdef/scripts/tex_util.d.tl:104

Call as tu.makeTextureMipmapClampVertical

Create a mipmapped, vertically-clamped texture description.

Parameter Type Description
fileName string path to the texture file
compressionAllowed boolean whether compression is allowed
scaleDownAllowed? boolean whether the texture may be scaled down
redGreen? boolean whether to use only red and green channels
texType? TexType texture dimensionality type

Returns TextureDesc: texture description

TexUtil.TexType

enum base/tealdef/scripts/tex_util.d.tl:4

enum TexType

Notes

Texture dimensionality.

Used in the base game: 5 times in 1 file

base/content/scripts/scripts/tex_util.tl:13

texType? : TexUtil.TexType)

Value Description
"TWOD" 2D texture
"CUBE_MAP" Cube map texture
"TWOD_ARRAY" 2D array texture
"THREED" 3D texture

TexUtil.MagFilterMode

enum base/tealdef/scripts/tex_util.d.tl:15

enum MagFilterMode

Notes

Magnification filter.

Used in the base game: 1 time in 1 file

base/content/scripts/scripts/tex_util.tl:5

magFilter : TexUtil.MagFilterMode,

Value Description
"NEAREST" Nearest-neighbor magnification
"LINEAR" Linear magnification

TexUtil.MinFilterMode

enum base/tealdef/scripts/tex_util.d.tl:22

enum MinFilterMode

Notes

Minification filter, optionally with mipmaps.

Used in the base game: 1 time in 1 file

base/content/scripts/scripts/tex_util.tl:6

minFilter : TexUtil.MinFilterMode,

Value Description
"NEAREST" Nearest-neighbor minification
"LINEAR" Linear minification
"LINEAR_MIPMAP_LINEAR" Linear minification with linear mipmap interpolation
"LINEAR_MIPMAP_NEAREST" Linear minification with nearest mipmap selection
"NEAREST_MIPMAP_NEAREST" Nearest-neighbor minification with nearest mipmap selection

TexUtil.WrapMode

enum base/tealdef/scripts/tex_util.d.tl:35

enum WrapMode

Notes

Texture coordinate wrapping.

Used in the base game: 4 times in 1 file

base/content/scripts/scripts/tex_util.tl:7

wrapS : TexUtil.WrapMode,

Value Description
"REPEAT" Repeat the texture
"CLAMP_TO_EDGE" Clamp to the edge of the texture
"MIRROR_REPEAT" Mirror and repeat the texture

TexUtil.TextureDesc

record base/tealdef/scripts/tex_util.d.tl:44

record TextureDesc

Notes

Description of one texture: file, filtering, wrapping and compression options.

Used in the base game: 6 times in 1 file

base/content/scripts/scripts/tex_util.tl:14

: TexUtil.TextureDesc

Fields

Name Type Description
type TexType Texture dimensionality type
fileName string Path to the texture file
magFilter MagFilterMode Magnification filter mode
minFilter MinFilterMode Minification filter mode
wrapS WrapMode Horizontal (S) wrap mode
wrapT WrapMode Vertical (T) wrap mode
mipmapAlphaScale number Alpha scale factor applied during mipmap generation
compressionAllowed boolean Whether compression is allowed for this texture
redGreen boolean Whether to use only the red and green channels
scaleDownAllowed boolean Whether the texture may be scaled down