Class TextureAtlasBuilder
Builds an atlas from any combination of texture archives. Does not yet integrate with main material system. Currently some limitations around caching and serialization. At this time used only for static misc billboards in cities. Will be enhanced in future.
Namespace: DaggerfallWorkshop.Utility
Assembly: Assembly-CSharp.dll
Syntax
public class TextureAtlasBuilder
Properties
| Improve this Doc View SourceAtlasMaterial
Gets the atlas material generated from texture.
Declaration
public Material AtlasMaterial { get; }
Property Value
Type | Description |
---|---|
Material |
AtlasTexture
Gets the atlas Texture2D created after packing.
Declaration
public Texture2D AtlasTexture { get; }
Property Value
Type | Description |
---|---|
Texture2D |
MaxAtlasDim
Gets or sets max dimensions of texture atlas.
Declaration
public int MaxAtlasDim { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
MipMaps
Gets or sets flag to create mipmaps for atlas texture.
Declaration
public bool MipMaps { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Padding
Gets or sets padding around each texture in atlas.
Declaration
public int Padding { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAddTextureItem(Texture2D, Int32, Int32, Int32, Int32, Vector2, Vector2)
Add a new texture item to source list. These items are used to build atlas.
Declaration
public void AddTextureItem(Texture2D texture, int archive, int record, int frame, int frameCount, Vector2 size, Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Individual Texture2D. Must be readable. |
Int32 | archive | Archive index of this texture. |
Int32 | record | Record index of this texture. |
Int32 | frame | Frame index of this texture. |
Int32 | frameCount | Number of frames in this set. |
Vector2 | size | |
Vector2 | scale |
Clear()
Clear all texture items and reset atlas.
Declaration
public void Clear()
GetAtlasItem(Int32)
Gets details of a particular atlas item. If texture does not exist in atlas an empty item is returned.
Declaration
public TextureAtlasBuilder.AtlasItem GetAtlasItem(int key)
Parameters
Type | Name | Description |
---|---|---|
Int32 | key | Key of item. |
Returns
Type | Description |
---|---|
TextureAtlasBuilder.AtlasItem | AtlasItem. Key member contains -1 if item not present. |
GetAtlasItem(Int32, Int32, Int32)
Gets atlas details of a particular item. If texture does not exist in atlas an empty item is returned.
Declaration
public TextureAtlasBuilder.AtlasItem GetAtlasItem(int archive, int record, int frame = 0)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Archive index of texture. |
Int32 | record | Record index of texture. |
Int32 | frame | Frame index of texture. |
Returns
Type | Description |
---|---|
TextureAtlasBuilder.AtlasItem | AtlasItem. Key member contains -1 if item not present. |
GetFrameCount(Int32, Int32)
Gets frame count of any item.
Declaration
public int GetFrameCount(int archive, int record)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | |
Int32 | record |
Returns
Type | Description |
---|---|
Int32 | Number of frame in this set. |
GetMaterial(MaterialReader.CustomBlendMode)
Gets a Daggerfall/Default or Daggerfall/Billboard material from current atlas texture based on blendMode. Does not return normal or emission map.
Declaration
public Material GetMaterial(MaterialReader.CustomBlendMode blendMode = MaterialReader.CustomBlendMode.Cutout)
Parameters
Type | Name | Description |
---|---|---|
MaterialReader.CustomBlendMode | blendMode | Blend mode of material used to determine material returned. |
Returns
Type | Description |
---|---|
Material | Material. |
MakeTextureKey(Int16, Byte, Byte)
Create a texture key from indices.
Declaration
public static int MakeTextureKey(short archive, byte record, byte frame)
Parameters
Type | Name | Description |
---|---|---|
Int16 | archive | |
Byte | record | |
Byte | frame |
Returns
Type | Description |
---|---|
Int32 |
Rebuild(Int32)
Rebuilds source textures into new atlas.
Declaration
public void Rebuild(int borderSize)
Parameters
Type | Name | Description |
---|---|---|
Int32 | borderSize |
ReverseTextureKey(Int32, out Int32, out Int32, out Int32)
Reverse a texture key back into indices.
Declaration
public static void ReverseTextureKey(int key, out int archiveOut, out int recordOut, out int frameOut)
Parameters
Type | Name | Description |
---|---|---|
Int32 | key | |
Int32 | archiveOut | |
Int32 | recordOut | |
Int32 | frameOut |