Class KtxTexture
Loads a KTX texture from the StreamingAssets folder, a URL, or a buffer.
Inherited Members
Namespace: KtxUnity
Syntax
public class KtxTexture : TextureBase
Properties
baseDepth
Depth of largest mipmap level in pixels
Declaration
public uint baseDepth { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
baseHeight
Height of largest mipmap level in pixels
Declaration
public uint baseHeight { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
baseWidth
Width of largest mipmap level in pixels
Declaration
public uint baseWidth { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
hasAlpha
True if the texture has an alpha channel.
Declaration
public bool hasAlpha { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isArray
True if texture is of type array
Declaration
public bool isArray { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isCompressed
True if texture is compressed
Declaration
public bool isCompressed { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isCubemap
True if texture is of type cube map
Declaration
public bool isCubemap { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isMultipleOfFour
True if both pixel width and height are a multiple of four.
Declaration
public bool isMultipleOfFour { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isPowerOfTwo
True if both pixel width and height are a power of two.
Declaration
public bool isPowerOfTwo { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isSquare
True if texture is square (width equals height)
Declaration
public bool isSquare { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
needsTranscoding
Query if the texture is in a transcodable format.
Declaration
public bool needsTranscoding { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
numDimensions
Number of dimensions
Declaration
public uint numDimensions { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
numFaces
Number of faces (e.g. six for cube maps)
Declaration
public uint numFaces { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
numLayers
Number of layers
Declaration
public uint numLayers { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
numLevels
Number of levels
Declaration
public uint numLevels { get; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
orientation
Texture's orientation
Declaration
public TextureOrientation orientation { get; }
Property Value
| Type | Description |
|---|---|
| TextureOrientation |
Methods
Dispose()
Releases all resources. Part of the low-level API that provides finer control over the loading process.
Declaration
public override void Dispose()
Overrides
See Also
LoadTexture2D(Boolean, UInt32, UInt32, UInt32, Boolean)
Creates a UnityEngine.Texture2D from the previously opened texture. Transcodes or decodes the texture into a GPU compatible format (if required) and uploads it to GPU memory. Part of the low-level API that provides finer control over the loading process.
Declaration
public override async Task<TextureResult> LoadTexture2D(bool linear = false, uint layer = 0U, uint faceSlice = 0U, uint mipLevel = 0U, bool mipChain = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | linear | Depicts if texture is sampled in linear or sRGB gamma color space. |
| UInt32 | layer | Texture array layer to import |
| UInt32 | faceSlice | Cubemap face or 3D/volume texture slice to import. |
| UInt32 | mipLevel | Lowest mipmap level to import (where 0 is the highest resolution). Lower mipmap levels (of higher resolution) are being discarded. Useful to limit texture resolution. |
| Boolean | mipChain | If true, a mipmap chain (if present) is imported. |
Returns
| Type | Description |
|---|---|
| Task<TextureResult> | A TextureResult that contains an ErrorCode, the resulting texture and its orientation. |
Overrides
See Also
LoadTexture2D(GraphicsFormat, UInt32, UInt32, UInt32, Boolean)
Creates a UnityEngine.Texture2D from the previously opened texture. Transcodes or decodes the texture into a desired GPU compatible format (if required) and uploads it to GPU memory. Part of the low-level API that provides finer control over the loading process.
Declaration
public override async Task<TextureResult> LoadTexture2D(GraphicsFormat targetFormat, uint layer = 0U, uint faceSlice = 0U, uint mipLevel = 0U, bool mipChain = true)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Experimental.Rendering.GraphicsFormat | targetFormat | Desired texture format |
| UInt32 | layer | Texture array layer to import |
| UInt32 | faceSlice | Cubemap face or 3D/volume texture slice to import. |
| UInt32 | mipLevel | Lowest mipmap level to import (where 0 is the highest resolution). Lower mipmap levels (of higher resolution) are being discarded. Useful to limit texture resolution. |
| Boolean | mipChain | If true, a mipmap chain (if present) is imported. |
Returns
| Type | Description |
|---|---|
| Task<TextureResult> | A TextureResult that contains an ErrorCode, the resulting texture and its orientation. |
Overrides
See Also
Open(NativeSlice<Byte>)
Loads a texture from memory. Part of the low-level API that provides finer control over the loading process.
Declaration
public override ErrorCode Open(NativeSlice<byte> data)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Collections.NativeSlice<Byte> | data | Input texture data |
Returns
| Type | Description |
|---|---|
| ErrorCode | Success if loading was successful or an error specific code otherwise. |