Class TextureReader
Helper to load Daggerfall TEXTURE.xxx files as Texture2D.
Namespace: DaggerfallWorkshop.Utility
Assembly: Assembly-CSharp.dll
Syntax
public class TextureReader
Constructors
| Improve this Doc View SourceTextureReader(String)
Constructor to set Arena2Path.
Declaration
public TextureReader(string arena2Path)
Parameters
Type | Name | Description |
---|---|---|
String | arena2Path | Path to Arena2 folder. |
Fields
| Improve this Doc View SourceAnimalsTextureArchive
Declaration
public const int AnimalsTextureArchive = 201
Field Value
Type | Description |
---|---|
Int32 |
EditorFlatsTextureArchive
Declaration
public const int EditorFlatsTextureArchive = 199
Field Value
Type | Description |
---|---|
Int32 |
FireWallsArchive
Declaration
public const int FireWallsArchive = 356
Field Value
Type | Description |
---|---|
Int32 |
FixedTreasureFlatsArchive
Declaration
public const int FixedTreasureFlatsArchive = 216
Field Value
Type | Description |
---|---|
Int32 |
LightsTextureArchive
Declaration
public const int LightsTextureArchive = 210
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceArena2Path
Gets or sets Arena2 path. Path must be set before attempting to load textures.
Declaration
public string Arena2Path { get; set; }
Property Value
Type | Description |
---|---|
String |
MipMaps
Gets or sets flag to generate mipmaps for textures.
Declaration
public bool MipMaps { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceCreateFromAPIImage(BaseImageFile, Int32, Int32, Int32, Boolean, Boolean)
Creates a simple texture from any base API image.
Declaration
public static Texture2D CreateFromAPIImage(BaseImageFile image, int record = 0, int frame = 0, int alphaIndex = -1, bool createMipMaps = false, bool makeNoLongerReadable = true)
Parameters
Type | Name | Description |
---|---|---|
BaseImageFile | image | |
Int32 | record | |
Int32 | frame | |
Int32 | alphaIndex | |
Boolean | createMipMaps | |
Boolean | makeNoLongerReadable |
Returns
Type | Description |
---|---|
Texture2D |
CreateFromSolidColor(Int32, Int32, Color, Boolean, Boolean)
Creates a simple solid-colour texture.
Declaration
public static Texture2D CreateFromSolidColor(int width, int height, Color color, bool createMipMaps = false, bool makeNoLongerReadable = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | |
Int32 | height | |
Color | color | |
Boolean | createMipMaps | |
Boolean | makeNoLongerReadable |
Returns
Type | Description |
---|---|
Texture2D |
CreateTextureSettings(Int32, Int32, Int32, Int32, Int32, Boolean, Int32)
Creates common texture settings.
Declaration
public static GetTextureSettings CreateTextureSettings(int archive = 0, int record = 0, int frame = 0, int alphaIndex = 0, int borderSize = 0, bool dilate = false, int maxAtlasSize = 2048)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | |
Int32 | record | |
Int32 | frame | |
Int32 | alphaIndex | |
Int32 | borderSize | |
Boolean | dilate | |
Int32 | maxAtlasSize |
Returns
Type | Description |
---|---|
GetTextureSettings | GetTextureSettings. |
GetTerrainTextureArray(Int32, TextureMap)
Gets terrain texture array containing each terrain tile texture in a seperate array slice.
Declaration
public Texture2DArray GetTerrainTextureArray(int archive, TextureMap textureMap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Archive index. |
TextureMap | textureMap | The texture type. |
Returns
Type | Description |
---|---|
Texture2DArray | Texture2DArray or null. |
GetTerrainTilesetTexture(Int32, Boolean)
Gets specially packed tileset atlas for terrains. This needs to be improved to create each mip level manually to further reduce artifacts.
Declaration
public GetTextureResults GetTerrainTilesetTexture(int archive, bool stayReadable = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Archive index. |
Boolean | stayReadable | Texture should stay readable. |
Returns
Type | Description |
---|---|
GetTextureResults |
GetTexture2D(GetTextureSettings, SupportedAlphaTextureFormats, TextureImport)
Gets Unity textures from Daggerfall texture with all options. Returns all supported texture maps for Standard shader in one call.
Declaration
public GetTextureResults GetTexture2D(GetTextureSettings settings, SupportedAlphaTextureFormats alphaTextureFormat = SupportedAlphaTextureFormats.ARGB32, TextureImport textureImport = TextureImport.None)
Parameters
Type | Name | Description |
---|---|---|
GetTextureSettings | settings | Get texture settings. |
SupportedAlphaTextureFormats | alphaTextureFormat | Alpha TextureFormat. |
TextureImport | textureImport | Options for import of custom textures. |
Returns
Type | Description |
---|---|
GetTextureResults | GetTextureResults. |
GetTexture2D(Int32, Int32, Int32, Int32)
Gets Unity albedo texture from Daggerfall texture with minimum options.
Declaration
public Texture2D GetTexture2D(int archive, int record, int frame = 0, int alphaIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Archive index. |
Int32 | record | Record index. |
Int32 | frame | Frame index. |
Int32 | alphaIndex | Index to receive transparent alpha. |
Returns
Type | Description |
---|---|
Texture2D | Texture2D or null. |
GetTexture2DAtlas(GetTextureSettings, SupportedAlphaTextureFormats)
Gets Texture2D atlas from Daggerfall texture archive. Every record and frame in the archive will be added to atlas. An array of rects will be returned with sub-texture rect for each record index and frame. Currently supports one archive per atlas. Super-atlas packing (multiple archives) is in the works.
Declaration
public GetTextureResults GetTexture2DAtlas(GetTextureSettings settings, SupportedAlphaTextureFormats alphaTextureFormat = SupportedAlphaTextureFormats.ARGB32)
Parameters
Type | Name | Description |
---|---|---|
GetTextureSettings | settings | Get texture settings. |
SupportedAlphaTextureFormats | alphaTextureFormat | Alpha TextureFormat. |
Returns
Type | Description |
---|---|
GetTextureResults | GetTextureResults. |
IsChildNPCTexture(Int32, Int32)
Checks if sprite is a child NPC sprite texture.
Declaration
public static bool IsChildNPCTexture(int archive, int record)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | Texture archive. |
Int32 | record | Texture record. |
Returns
Type | Description |
---|---|
Boolean | True if a child NPC sprite texture. |
IsEmissive(Int32, Int32)
Declaration
public bool IsEmissive(int archive, int record)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive | |
Int32 | record |
Returns
Type | Description |
---|---|
Boolean |
IsEmissiveArchive(Int32)
Declaration
public bool IsEmissiveArchive(int archive)
Parameters
Type | Name | Description |
---|---|---|
Int32 | archive |
Returns
Type | Description |
---|---|
Boolean |
SetSpectral(ref DFBitmap)
Updates spectral color indices to set eyes red and accentuate other features
Declaration
public void SetSpectral(ref DFBitmap srcBitmap)
Parameters
Type | Name | Description |
---|---|---|
DFBitmap | srcBitmap |