Show / Hide Table of Contents

Class MaterialReader

Imports Daggerfall images into Unity. Should only be attached to DaggerfallUnity singleton (for which it is a required component). Note: Texture loading methods have been moved to TextureReader class.

Inheritance
Object
Object
Component
Behaviour
MonoBehaviour
MaterialReader
Namespace: DaggerfallWorkshop
Assembly: Assembly-CSharp.dll
Syntax
[RequireComponent(typeof(DaggerfallUnity))]
public class MaterialReader : MonoBehaviour

Fields

| Improve this Doc View Source

_DaggerfallBillboardBatchNoShadowsShaderName

Declaration
public const string _DaggerfallBillboardBatchNoShadowsShaderName = "Daggerfall/BillboardBatchNoShadows"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallBillboardBatchShaderName

Declaration
public const string _DaggerfallBillboardBatchShaderName = "Daggerfall/BillboardBatch"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallBillboardShaderName

Declaration
public const string _DaggerfallBillboardShaderName = "Daggerfall/Billboard"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallDefaultShaderName

Declaration
public const string _DaggerfallDefaultShaderName = "Daggerfall/Default"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallGhostShaderName

Declaration
public const string _DaggerfallGhostShaderName = "Daggerfall/GhostShader"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallPixelFontShaderName

Declaration
public const string _DaggerfallPixelFontShaderName = "Daggerfall/PixelFont"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallRetroDepthShaderName

Declaration
public const string _DaggerfallRetroDepthShaderName = "Daggerfall/DepthProcessShader"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallRetroPalettizationShaderName

Declaration
public const string _DaggerfallRetroPalettizationShaderName = "Daggerfall/RetroPalettization"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallRetroPosterizationShaderName

Declaration
public const string _DaggerfallRetroPosterizationShaderName = "Daggerfall/RetroPosterization"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallSDFFontShaderName

Declaration
public const string _DaggerfallSDFFontShaderName = "Daggerfall/SDFFont"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallTilemapShaderName

Declaration
public const string _DaggerfallTilemapShaderName = "Daggerfall/Tilemap"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallTilemapTextureArrayShaderName

Declaration
public const string _DaggerfallTilemapTextureArrayShaderName = "Daggerfall/TilemapTextureArray"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallUIBlendShaderName

Declaration
public const string _DaggerfallUIBlendShaderName = "Daggerfall/UIBlend"
Field Value
Type Description
String
| Improve this Doc View Source

_DaggerfallUIBlitShaderName

Declaration
public const string _DaggerfallUIBlitShaderName = "Daggerfall/UIBlit"
Field Value
Type Description
String
| Improve this Doc View Source

_StandardShaderName

Declaration
public const string _StandardShaderName = "Standard"
Field Value
Type Description
String
| Improve this Doc View Source

AlphaTextureFormat

Declaration
public SupportedAlphaTextureFormats AlphaTextureFormat
Field Value
Type Description
SupportedAlphaTextureFormats
| Improve this Doc View Source

AtlasKeyGroup

Declaration
public const int AtlasKeyGroup = 512
Field Value
Type Description
Int32
| Improve this Doc View Source

AtlasTextures

Declaration
public bool AtlasTextures
Field Value
Type Description
Boolean
| Improve this Doc View Source

CompressModdedTextures

Declaration
public bool CompressModdedTextures
Field Value
Type Description
Boolean
| Improve this Doc View Source

CompressSkyTextures

Declaration
public bool CompressSkyTextures
Field Value
Type Description
Boolean
| Improve this Doc View Source

CustomBillboardKeyGroup

Declaration
public const int CustomBillboardKeyGroup = 1536
Field Value
Type Description
Int32
| Improve this Doc View Source

CustomWindowColor

Declaration
public Color CustomWindowColor
Field Value
Type Description
Color
| Improve this Doc View Source

CustomWindowIntensity

Declaration
public float CustomWindowIntensity
Field Value
Type Description
Single
| Improve this Doc View Source

DayWindowColor

Declaration
public Color DayWindowColor
Field Value
Type Description
Color
| Improve this Doc View Source

DayWindowIntensity

Declaration
public float DayWindowIntensity
Field Value
Type Description
Single
| Improve this Doc View Source

FireWallsArchive

Declaration
public const int FireWallsArchive = 356
Field Value
Type Description
Int32
| Improve this Doc View Source

FogWindowColor

Declaration
public Color FogWindowColor
Field Value
Type Description
Color
| Improve this Doc View Source

FogWindowIntensity

Declaration
public float FogWindowIntensity
Field Value
Type Description
Single
| Improve this Doc View Source

GenerateNormals

Declaration
public bool GenerateNormals
Field Value
Type Description
Boolean
| Improve this Doc View Source

MainFilterMode

Declaration
public FilterMode MainFilterMode
Field Value
Type Description
FilterMode
| Improve this Doc View Source

MainKeyGroup

Declaration
public const int MainKeyGroup = 0
Field Value
Type Description
Int32
| Improve this Doc View Source

MipMaps

Declaration
public bool MipMaps
Field Value
Type Description
Boolean
| Improve this Doc View Source

NightWindowColor

Declaration
public Color NightWindowColor
Field Value
Type Description
Color
| Improve this Doc View Source

NightWindowIntensity

Declaration
public float NightWindowIntensity
Field Value
Type Description
Single
| Improve this Doc View Source

NormalTextureStrength

Declaration
public float NormalTextureStrength
Field Value
Type Description
Single
| Improve this Doc View Source

ReadableTextures

Declaration
public bool ReadableTextures
Field Value
Type Description
Boolean
| Improve this Doc View Source

Sharpen

Declaration
public bool Sharpen
Field Value
Type Description
Boolean
| Improve this Doc View Source

SkyFilterMode

Declaration
public FilterMode SkyFilterMode
Field Value
Type Description
FilterMode
| Improve this Doc View Source

TileMapKeyGroup

Declaration
public const int TileMapKeyGroup = 1024
Field Value
Type Description
Int32

Properties

| Improve this Doc View Source

IsReady

Gets true if file reading is ready.

Declaration
public bool IsReady { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

TextureReader

Gets managed texture reader.

Declaration
public TextureReader TextureReader { get; }
Property Value
Type Description
TextureReader

Methods

| Improve this Doc View Source

ChangeClimate(Int32, ClimateBases, ClimateSeason, WindowStyle)

Get a new Material based on climate.

Declaration
public Material ChangeClimate(int key, ClimateBases climate, ClimateSeason season, WindowStyle windowStyle)
Parameters
Type Name Description
Int32 key

Material key.

ClimateBases climate

New climate base.

ClimateSeason season

New season.

WindowStyle windowStyle

New window style.

Returns
Type Description
Material

New material.

| Improve this Doc View Source

ChangeWindowEmissionColor(Material, WindowStyle)

Change emission colour of window materials.

Declaration
public void ChangeWindowEmissionColor(Material material, WindowStyle windowStyle)
Parameters
Type Name Description
Material material

Source material to change.

WindowStyle windowStyle

New window style.

| Improve this Doc View Source

ClearCache()

Clears material cache dictionary, forcing material to reload.

Declaration
public void ClearCache()
| Improve this Doc View Source

CreateBillboardMaterial()

Creates a new transparent cutout billboard material for mobiles, misc. objects, etc.

Declaration
public static Material CreateBillboardMaterial()
Returns
Type Description
Material

Material using Daggerfall/Billboard shader.

| Improve this Doc View Source

CreateDefaultMaterial()

Creates a new default material for world geometry.

Declaration
public static Material CreateDefaultMaterial()
Returns
Type Description
Material

Material using Daggerfall/Default shader.

| Improve this Doc View Source

CreateStandardMaterial(MaterialReader.CustomBlendMode, MaterialReader.CustomSmoothnessMapChannel, Single, Single)

Creates new Standard material with default properties suitable for most Daggerfall textures.

Declaration
public static Material CreateStandardMaterial(MaterialReader.CustomBlendMode blendMode = MaterialReader.CustomBlendMode.Opaque, MaterialReader.CustomSmoothnessMapChannel smoothnessChannel = MaterialReader.CustomSmoothnessMapChannel.AlbedoAlpha, float metallic = 0F, float glossiness = 0F)
Parameters
Type Name Description
MaterialReader.CustomBlendMode blendMode
MaterialReader.CustomSmoothnessMapChannel smoothnessChannel
Single metallic
Single glossiness
Returns
Type Description
Material

Material using Standard shader.

| Improve this Doc View Source

GetCachedMaterial(Int32, Int32, Int32, out CachedMaterial, Int32)

Gets CachedMaterial properties. Material will be loaded into cache if not present already.

Declaration
public bool GetCachedMaterial(int archive, int record, int frame, out CachedMaterial cachedMaterialOut, int alphaIndex = -1)
Parameters
Type Name Description
Int32 archive

Archive index.

Int32 record

Record index.

Int32 frame

Frame index.

CachedMaterial cachedMaterialOut

CachedMaterial out.

Int32 alphaIndex

Alpha index used if material needs to be loaded.

Returns
Type Description
Boolean

True if CachedMaterial found or loaded successfully.

| Improve this Doc View Source

GetCachedMaterialAtlas(Int32, out CachedMaterial)

Gets CachedMaterial properties for an atlased material. Atlas material will not be loaded automatically if not found in cache.

Declaration
public bool GetCachedMaterialAtlas(int archive, out CachedMaterial cachedMaterialOut)
Parameters
Type Name Description
Int32 archive

Atlas archive index.

CachedMaterial cachedMaterialOut

CachedMaterial out

Returns
Type Description
Boolean

True if CachedMaterial found.

| Improve this Doc View Source

GetCachedMaterialCustomBillboard(Int32, Int32, Int32, out CachedMaterial)

Gets CachedMaterial properties for a billboard with custom material.

Declaration
public bool GetCachedMaterialCustomBillboard(int archive, int record, int frame, out CachedMaterial cachedMaterialOut)
Parameters
Type Name Description
Int32 archive

Archive index.

Int32 record

Record index.

Int32 frame
CachedMaterial cachedMaterialOut

CachedMaterial out

Returns
Type Description
Boolean

True if CachedMaterial found.

| Improve this Doc View Source

GetEditorFlatType(Int32)

Declaration
public static EditorFlatTypes GetEditorFlatType(int record)
Parameters
Type Name Description
Int32 record
Returns
Type Description
EditorFlatTypes
| Improve this Doc View Source

GetFlatType(Int32)

Declaration
public static FlatTypes GetFlatType(int archive)
Parameters
Type Name Description
Int32 archive
Returns
Type Description
FlatTypes
| Improve this Doc View Source

GetMaterial(Int32, Int32, Int32, Int32)

Gets Unity Material from Daggerfall texture.

Declaration
public Material GetMaterial(int archive, int record, int frame = 0, int alphaIndex = -1)
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
Material

Material or null.

| Improve this Doc View Source

GetMaterial(Int32, Int32, Int32, Int32, out Rect, Int32, Boolean, Boolean)

Gets Unity Material from Daggerfall texture with more options.

Declaration
public Material GetMaterial(int archive, int record, int frame, int alphaIndex, out Rect rectOut, int borderSize = 0, bool dilate = false, bool isBillboard = false)
Parameters
Type Name Description
Int32 archive

Archive index.

Int32 record

Record index.

Int32 frame

Frame index.

Int32 alphaIndex
Rect rectOut

Receives UV rect for texture inside border.

Int32 borderSize

Number of pixels internal border around each texture.

Boolean dilate

Blend texture into surrounding empty pixels.

Boolean isBillboard

Set true when creating atlas material for simple billboards.

Returns
Type Description
Material

Material or null.

| Improve this Doc View Source

GetMaterialAtlas(Int32, Int32, Int32, Int32, out Rect[], out RecordIndex[], Int32, Boolean, Int32, Boolean, Boolean)

Gets Unity Material atlas from Daggerfall texture archive.

Declaration
public Material GetMaterialAtlas(int archive, int alphaIndex, int padding, int maxAtlasSize, out Rect[] rectsOut, out RecordIndex[] indicesOut, int border = 0, bool dilate = false, int shrinkUVs = 0, bool copyToOppositeBorder = false, bool isBillboard = false)
Parameters
Type Name Description
Int32 archive

Archive index to create atlas from.

Int32 alphaIndex

Index to receive transparent alpha.

Int32 padding

Number of pixels each sub-texture.

Int32 maxAtlasSize

Max size of atlas.

Rect[] rectsOut

Array of rects, one for each record sub-texture and frame.

RecordIndex[] indicesOut

Array of record indices into rect array, accounting for animation frames.

Int32 border

Number of pixels internal border around each texture.

Boolean dilate

Blend texture into surrounding empty pixels.

Int32 shrinkUVs

Number of pixels to shrink UV rect.

Boolean copyToOppositeBorder

Copy texture edges to opposite border. Requires border, will overwrite dilate.

Boolean isBillboard

Set true when creating atlas material for simple billboards.

Returns
Type Description
Material

Material or null.

| Improve this Doc View Source

GetTerrainTextureArrayMaterial(Int32)

Gets Unity Material from Daggerfall terrain using texture arrays.

Declaration
public Material GetTerrainTextureArrayMaterial(int archive)
Parameters
Type Name Description
Int32 archive

Archive index.

Returns
Type Description
Material

Material or null.

| Improve this Doc View Source

GetTerrainTilesetMaterial(Int32)

Gets Unity Material from Daggerfall terrain tilemap texture.

Declaration
public Material GetTerrainTilesetMaterial(int archive)
Parameters
Type Name Description
Int32 archive

Archive index.

Returns
Type Description
Material

Material or null.

| Improve this Doc View Source

MakeTextureKey(Int16, Byte, Byte, Int32)

Declaration
public static int MakeTextureKey(short archive, byte record, byte frame = 0, int group = 0)
Parameters
Type Name Description
Int16 archive
Byte record
Byte frame
Int32 group
Returns
Type Description
Int32
| Improve this Doc View Source

ReverseTextureKey(Int32, out Int32, out Int32, out Int32, Int32)

Declaration
public static void ReverseTextureKey(int key, out int archiveOut, out int recordOut, out int frameOut, int group = 0)
Parameters
Type Name Description
Int32 key
Int32 archiveOut
Int32 recordOut
Int32 frameOut
Int32 group
| Improve this Doc View Source

SetBlendMode(Material, MaterialReader.CustomBlendMode, MaterialReader.CustomSmoothnessMapChannel, Single, Single)

Change the blend mode of a Standard material at runtime.

Declaration
public static void SetBlendMode(Material material, MaterialReader.CustomBlendMode blendMode, MaterialReader.CustomSmoothnessMapChannel smoothnessChannel, float metallic, float glossiness)
Parameters
Type Name Description
Material material
MaterialReader.CustomBlendMode blendMode
MaterialReader.CustomSmoothnessMapChannel smoothnessChannel
Single metallic
Single glossiness
| Improve this Doc View Source

SetCachedMaterial(Int32, Int32, Int32, CachedMaterial)

Sets CachedMaterial properties. existing Material will be updated in cache with cachedMaterialIn.

Declaration
public bool SetCachedMaterial(int archive, int record, int frame, CachedMaterial cachedMaterialIn)
Parameters
Type Name Description
Int32 archive

Archive index.

Int32 record

Record index.

Int32 frame

Frame index.

CachedMaterial cachedMaterialIn

the CachedMaterial used to update the cache.

Returns
Type Description
Boolean

True if CachedMaterial was found and updated successfully.

| Improve this Doc View Source

SetCachedMaterialCustomBillboard(Int32, Int32, Int32, CachedMaterial)

Sets CachedMaterial properties for a billboard with custom material.

Declaration
public void SetCachedMaterialCustomBillboard(int archive, int record, int frame, CachedMaterial cachedMaterialIn)
Parameters
Type Name Description
Int32 archive

Archive index.

Int32 record

Record index.

Int32 frame
CachedMaterial cachedMaterialIn

Extension Methods

MBExtensions.Invoke(MonoBehaviour, Action, Single)
MBExtensions.Invoke<T>(MonoBehaviour, Action<T>, T, Single)
MBExtensions.Invoke<T1, T2>(MonoBehaviour, Action<T1, T2>, T1, T2, Single)
MBExtensions.Invoke<T1, T2, T3>(MonoBehaviour, Action<T1, T2, T3>, T1, T2, T3, Single)
MBExtensions.Invoke<T1, T2, T3, T4>(MonoBehaviour, Action<T1, T2, T3, T4>, T1, T2, T3, T4, Single)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX