Class EmbeddedTexture
Represents an embedded texture. Some file formats directly embed texture assets. Embedded textures may be uncompressed, where the data is given in an uncompressed format. Or it may be compressed in a format like png or jpg. In the latter case, the raw file bytes are given so the application must utilize an image decoder (e.g. DevIL) to get access to the actual color data. This object represents both types, so some properties may or may not be valid depending if it is compressed or not.
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public sealed class EmbeddedTexture : IMarshalable<EmbeddedTexture, AiTexture>
Constructors
| Edit this page View SourceEmbeddedTexture()
Constructs a new instance of the EmbeddedTexture class. Should use only if reading from a native value.
Declaration
public EmbeddedTexture()
EmbeddedTexture(int, int, Texel[], string)
Constructs a new instance of the EmbeddedTexture class. This creates an uncompressed embedded texture.
Declaration
public EmbeddedTexture(int width, int height, Texel[] uncompressedData, string originalFileName = "")
Parameters
Type | Name | Description |
---|---|---|
int | width | Width of the texture |
int | height | Height of the texture |
Texel[] | uncompressedData | Color data |
string | originalFileName | Optional file name for the texture. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the data size does not match width * height. |
EmbeddedTexture(string, byte[], string)
Constructs a new instance of the EmbeddedTexture class. This creates a compressed embedded texture.
Declaration
public EmbeddedTexture(string compressedFormatHint, byte[] compressedData, string originalFileName = "")
Parameters
Type | Name | Description |
---|---|---|
string | compressedFormatHint | The 3 character format hint. |
byte[] | compressedData | The compressed data. |
string | originalFileName | Optional file name for the texture. |
Properties
| Edit this page View SourceCompressedData
Gets the raw byte data representing the compressed texture. Only valid for compressed textures.
Declaration
public byte[]? CompressedData { get; }
Property Value
Type | Description |
---|---|
byte[] |
CompressedDataSize
Gets the size of the compressed data. Only valid for compressed textures.
Declaration
public int CompressedDataSize { get; }
Property Value
Type | Description |
---|---|
int |
CompressedFormatHint
Gets the format hint to determine the type of compressed data. This hint is a three-character lower-case hint like "dds", "jpg", "png".
Declaration
public string? CompressedFormatHint { get; }
Property Value
Type | Description |
---|---|
string |
Filename
Gets or sets the texture's original filename.
Declaration
public string Filename { get; set; }
Property Value
Type | Description |
---|---|
string |
HasCompressedData
Gets if the embedded texture has compressed data. Only valid for compressed textures.
Declaration
public bool HasCompressedData { get; }
Property Value
Type | Description |
---|---|
bool |
HasNonCompressedData
Gets if the texture has non-compressed texel data. Only valid for non-compressed textures.
Declaration
public bool HasNonCompressedData { get; }
Property Value
Type | Description |
---|---|
bool |
Height
Gets the height of the texture in pixels. Only valid for non-compressed textures.
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
int |
IsCompressed
Gets if the texture is compressed or not.
Declaration
public bool IsCompressed { get; }
Property Value
Type | Description |
---|---|
bool |
NonCompressedData
Gets the non-compressed texel data, the array is of size Width * Height. Only valid for non-compressed textures.
Declaration
public Texel[]? NonCompressedData { get; }
Property Value
Type | Description |
---|---|
Texel[] |
NonCompressedDataSize
Gets the size of the non-compressed texel data. Only valid for non-compressed textures.
Declaration
public int NonCompressedDataSize { get; }
Property Value
Type | Description |
---|---|
int |
Width
Gets the width of the texture in pixels. Only valid for non-compressed textures.
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceFreeNative(nint, bool)
Frees unmanaged memory created by ToNative(nint, out Native).
Declaration
public static void FreeNative(nint nativeValue, bool freeNative)
Parameters
Type | Name | Description |
---|---|---|
nint | nativeValue | Native value to free |
bool | freeNative | True if the unmanaged memory should be freed, false otherwise. |