Class CompositeTexture
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
Holds data about a texture. Also allows textures to be overlayed on top of one another.
public class CompositeTexture
- Inheritance
-
CompositeTexture
- Inherited Members
- Extension Methods
Examples
"textures": {
"charcoal": { "base": "block/coal/charcoal" },
"coke": { "base": "block/coal/coke" },
"ore-anthracite": { "base": "block/coal/anthracite" },
"ore-lignite": { "base": "block/coal/lignite" },
"ore-bituminouscoal": { "base": "block/coal/bituminous" },
"ember": { "base": "block/coal/ember" }
},
"textures": {
"ore": {
"base": "block/stone/rock/{rock}1",
"overlays": [ "block/stone/ore/{ore}1" ]
}
},
Connected textures example (See https://discord.com/channels/302152934249070593/479736466453561345/1134187385501007962)
"textures": {
"all": {
"base": "block/stone/cobblestone/tiling/1",
"tiles": [
{ "base": "block/stone/cobblestone/tiling/*" }
],
"tilesWidth": 4
}
}
Constructors
CompositeTexture()
Creates a new empty composite texture
public CompositeTexture()
CompositeTexture(AssetLocation)
Creates a new empty composite texture with given base texture
public CompositeTexture(AssetLocation Base)
Parameters
Base
AssetLocation
Fields
Alpha
Can be used to modify the opacity of the texture. 255 is fully opaque, 0 is fully transparent.
public int Alpha
Field Value
AlphaSeparator
public const char AlphaSeparator = 'å'
Field Value
AlphaSeparatorRegexSearch
public const string AlphaSeparatorRegexSearch = "å\\d+"
Field Value
Alternates
The texture may consists of any amount of alternatives, one of which will be randomly chosen when the block is placed in the world.
public CompositeTexture[] Alternates
Field Value
Baked
BakedCompositeTexture is an expanded, atlas friendly version of CompositeTexture. Required during texture atlas generation.
public BakedCompositeTexture Baked
Field Value
Base
The basic texture for this composite texture
public AssetLocation Base
Field Value
BlendedOverlays
A set of textures to overlay above this texture. The base texture may be overlayed with any quantity of textures. These are baked together during texture atlas creation.
public BlendedOverlayTexture[] BlendedOverlays
Field Value
BlendmodeSeparator
public const char BlendmodeSeparator = '~'
Field Value
OverlaysSeparator
public const string OverlaysSeparator = "++"
Field Value
Rotation
Rotation of the texture may only be a multiple of 90
public int Rotation
Field Value
Tiles
A way of basic support for connected textures. Textures should be named numerically from 1 to TilesWidth squared.
E.g., if TilesWidth is 3, the order follows the pattern of:
1 2 3
4 5 6
7 8 9
public CompositeTexture[] Tiles
Field Value
TilesWidth
The number of tiles in one direction that make up the full connected textures defined in Tiles.
public int TilesWidth
Field Value
WildCardNoFiles
public AssetLocation WildCardNoFiles
Field Value
basicTexturesCache
[ThreadStatic]
public static Dictionary<AssetLocation, CompositeTexture> basicTexturesCache
Field Value
wildcardsCache
[ThreadStatic]
public static Dictionary<AssetLocation, List<IAsset>> wildcardsCache
Field Value
Properties
AnyWildCardNoFiles
public AssetLocation AnyWildCardNoFiles { get; }
Property Value
Overlays
Obsolete. Use BlendedOverlays instead.
public AssetLocation[] Overlays { set; }
Property Value
Methods
Bake(IAssetManager)
Expands the Composite Texture to a texture atlas friendly version and populates the Baked field. This method is called by the texture atlas managers. Won't have any effect if called after the texture atlasses have been created.
public void Bake(IAssetManager assetManager)
Parameters
assetManager
IAssetManager
Clone()
Creates a deep copy of the texture
public CompositeTexture Clone()
Returns
FillPlaceholder(string, string)
public void FillPlaceholder(string search, string replace)
Parameters
IsBasic()
Tests whether this is a basic CompositeTexture with an asset location only, no rotation, alpha, alternates or overlays
public bool IsBasic()
Returns
RuntimeBake(ICoreClientAPI, ITextureAtlasAPI)
Expands the Composite Texture to a texture atlas friendly version and populates the Baked field. This method can be called after the game world has loaded.
public void RuntimeBake(ICoreClientAPI capi, ITextureAtlasAPI intoAtlas)
Parameters
capi
ICoreClientAPIThe Client API
intoAtlas
ITextureAtlasAPIThe atlas to insert the baked texture.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.