public class AITexture
extends org.lwjgl.system.Struct
Normally textures are contained in external files but some file formats embed them directly in the model file. There are two types of embedded textures:
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.
Embedded textures are referenced from materials using strings like "*0", "*1", etc. as the texture paths (a single asterisk character followed by the
zero-based index of the texture in the AIScene::mTextures array).
mWidth –
Width of the texture, in pixels. If mHeight is zero the texture is compressed in a format like JPEG. In this case mWidth specifies the
size of the memory area pcData is pointing to, in bytes.mHeight – Height of the texture, in pixels. If this value is zero, pcData points to an compressed texture in any format (e.g. JPEG).achFormatHint[9] –
A hint from the loader to make it easier for applications to determine the type of embedded textures.
If mHeight != 0 this member is show how data is packed. Hint will consist of two parts: channel order and channel bitness (count of the bits
for every color channel). For simple parsing by the viewer it's better to not omit absent color channel and just use 0 for bitness. For example:
achFormatHint == "rgba8888";achFormatHint == "argb8888";achFormatHint == "rgba5650";achFormatHint == "rgba0010";If mHeight == 0 then achFormatHint is set set to '\0\0\0\0' if the loader has no additional information about the texture file format
used OR the file extension of the format without a trailing dot. If there are multiple file extensions for a format, the shortest extension is chosen
(JPEG maps to 'jpg', not to 'jpeg'). E.g. 'dds\0', 'pcx\0', 'jpg\0'. All characters are lower-case. The fourth character will always be '\0'.
pcData –
Data of the texture.
Points to an array of mWidth * mHeight AITexel's. The format of the texture data is always ARGB8888 to make the implementation for user of
the library as easy as possible. If mHeight = 0 this is a pointer to a memory buffer of size mWidth containing the compressed texture
data. Good luck, have fun!
mFilename – texture original filename. Used to get the texture reference.
struct aiTexture {
unsigned int mWidth;
unsigned int mHeight;
char achFormatHint[9];
struct aiTexel * pcData;
struct aiString mFilename;
}| Modifier and Type | Class and Description |
|---|---|
static class |
AITexture.Buffer
An array of
AITexture structs. |
| Modifier and Type | Field and Description |
|---|---|
static int |
ACHFORMATHINT
The struct member offsets.
|
static int |
ALIGNOF
The struct alignment in bytes.
|
static int |
MFILENAME
The struct member offsets.
|
static int |
MHEIGHT
The struct member offsets.
|
static int |
MWIDTH
The struct member offsets.
|
static int |
PCDATA
The struct member offsets.
|
static int |
SIZEOF
The struct size in bytes.
|
| Constructor and Description |
|---|
AITexture(java.nio.ByteBuffer container)
Creates a
AITexture instance at the current position of the specified ByteBuffer container. |
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
achFormatHint()
Returns a
ByteBuffer view of the achFormatHint field. |
java.lang.String |
achFormatHintString()
Decodes the null-terminated string stored in the
achFormatHint field. |
static AITexture |
create(long address)
Returns a new
AITexture instance for the specified memory address. |
static AITexture.Buffer |
create(long address,
int capacity)
Create a
AITexture.Buffer instance at the specified memory. |
static AITexture |
createSafe(long address)
|
static AITexture.Buffer |
createSafe(long address,
int capacity)
|
AIString |
mFilename()
Returns a
AIString view of the mFilename field. |
int |
mHeight()
Returns the value of the
mHeight field. |
int |
mWidth()
Returns the value of the
mWidth field. |
static java.nio.ByteBuffer |
nachFormatHint(long struct)
Unsafe version of
achFormatHint(). |
static java.lang.String |
nachFormatHintString(long struct)
Unsafe version of
achFormatHintString(). |
static AIString |
nmFilename(long struct)
Unsafe version of
mFilename(). |
static int |
nmHeight(long struct)
Unsafe version of
mHeight(). |
static int |
nmWidth(long struct)
Unsafe version of
mWidth(). |
static AITexel.Buffer |
npcData(long struct,
int capacity)
Unsafe version of
pcData(int). |
AITexel.Buffer |
pcData(int capacity)
Returns a
AITexel.Buffer view of the struct array pointed to by the pcData field. |
int |
sizeof() |
public static final int SIZEOF
public static final int ALIGNOF
public static final int MWIDTH
public static final int MHEIGHT
public static final int ACHFORMATHINT
public static final int PCDATA
public static final int MFILENAME
public AITexture(java.nio.ByteBuffer container)
AITexture instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be
visible to the struct instance and vice versa.
The created instance holds a strong reference to the container object.
public int sizeof()
sizeof in class org.lwjgl.system.Structpublic int mWidth()
mWidth field.public int mHeight()
mHeight field.public java.nio.ByteBuffer achFormatHint()
ByteBuffer view of the achFormatHint field.public java.lang.String achFormatHintString()
achFormatHint field.public AITexel.Buffer pcData(int capacity)
AITexel.Buffer view of the struct array pointed to by the pcData field.capacity - the number of elements in the returned bufferpublic static AITexture create(long address)
AITexture instance for the specified memory address.@Nullable public static AITexture createSafe(long address)
public static AITexture.Buffer create(long address, int capacity)
AITexture.Buffer instance at the specified memory.address - the memory addresscapacity - the buffer capacity@Nullable public static AITexture.Buffer createSafe(long address, int capacity)
public static int nmWidth(long struct)
mWidth().public static int nmHeight(long struct)
mHeight().public static java.nio.ByteBuffer nachFormatHint(long struct)
achFormatHint().public static java.lang.String nachFormatHintString(long struct)
achFormatHintString().public static AITexel.Buffer npcData(long struct, int capacity)
pcData(int).public static AIString nmFilename(long struct)
mFilename().Copyright LWJGL. All Rights Reserved. License terms.