Class AITexture
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.assimp.AITexture
-
- All Implemented Interfaces:
org.lwjgl.system.Pointer
public class AITexture extends org.lwjgl.system.StructHelper structure to describe an embedded texture.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:
- Uncompressed textures. The color data is given in an uncompressed format.
- Compressed textures stored in a file format like png or jpg.
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::mTexturesarray).Member documentation
mWidth– Width of the texture, in pixels. IfmHeightis zero the texture is compressed in a format like JPEG. In this casemWidthspecifies the size of the memory areapcDatais pointing to, in bytes.mHeight– Height of the texture, in pixels. If this value is zero,pcDatapoints 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 != 0this 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:- Image contain RGBA and 8 bit per channel,
achFormatHint == "rgba8888"; - Image contain ARGB and 8 bit per channel,
achFormatHint == "argb8888"; - Image contain RGB and 5 bit for R and B channels and 6 bit for G channel,
achFormatHint == "rgba5650"; - One color image with B channel and 1 bit for it,
achFormatHint == "rgba0010";
If
mHeight == 0thenachFormatHintis 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'.- Image contain RGBA and 8 bit per channel,
pcData– Data of the texture.Points to an array of
mWidth * mHeightAITexel's. The format of the texture data is always ARGB8888 to make the implementation for user of the library as easy as possible. IfmHeight = 0this is a pointer to a memory buffer of sizemWidthcontaining the compressed texture data. Good luck, have fun!mFilename– texture original filename. Used to get the texture reference.
Layout
struct aiTexture { unsigned int mWidth; unsigned int mHeight; char achFormatHint[9];struct aiTexel* pcData;struct aiStringmFilename; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAITexture.BufferAn array ofAITexturestructs.
-
Constructor Summary
Constructors Constructor Description AITexture(java.nio.ByteBuffer container)Creates aAITextureinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBufferachFormatHint()Returns aByteBufferview of theachFormatHintfield.java.lang.StringachFormatHintString()Decodes the null-terminated string stored in theachFormatHintfield.static AITexturecreate(long address)Returns a newAITextureinstance for the specified memory address.static AITexture.Buffercreate(long address, int capacity)Create aAITexture.Bufferinstance at the specified memory.static AITexturecreateSafe(long address)static AITexture.BuffercreateSafe(long address, int capacity)AIStringmFilename()Returns aAIStringview of themFilenamefield.intmHeight()Returns the value of themHeightfield.intmWidth()Returns the value of themWidthfield.static java.nio.ByteBuffernachFormatHint(long struct)Unsafe version ofachFormatHint().static java.lang.StringnachFormatHintString(long struct)Unsafe version ofachFormatHintString().static AIStringnmFilename(long struct)Unsafe version ofmFilename().static intnmHeight(long struct)Unsafe version ofmHeight().static intnmWidth(long struct)Unsafe version ofmWidth().static AITexel.BuffernpcData(long struct, int capacity)Unsafe version ofpcData(int).AITexel.BufferpcData(int capacity)Returns aAITexel.Bufferview of the struct array pointed to by thepcDatafield.intsizeof()
-
-
-
Constructor Detail
-
AITexture
public AITexture(java.nio.ByteBuffer container)
Creates aAITextureinstance at the current position of the specifiedByteBuffercontainer. 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.
-
-
Method Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
mWidth
public int mWidth()
Returns the value of themWidthfield.
-
mHeight
public int mHeight()
Returns the value of themHeightfield.
-
achFormatHint
public java.nio.ByteBuffer achFormatHint()
Returns aByteBufferview of theachFormatHintfield.
-
achFormatHintString
public java.lang.String achFormatHintString()
Decodes the null-terminated string stored in theachFormatHintfield.
-
pcData
public AITexel.Buffer pcData(int capacity)
Returns aAITexel.Bufferview of the struct array pointed to by thepcDatafield.- Parameters:
capacity- the number of elements in the returned buffer
-
create
public static AITexture create(long address)
Returns a newAITextureinstance for the specified memory address.
-
createSafe
@Nullable public static AITexture createSafe(long address)
-
create
public static AITexture.Buffer create(long address, int capacity)
Create aAITexture.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
@Nullable public static AITexture.Buffer createSafe(long address, int capacity)
-
nmWidth
public static int nmWidth(long struct)
Unsafe version ofmWidth().
-
nmHeight
public static int nmHeight(long struct)
Unsafe version ofmHeight().
-
nachFormatHint
public static java.nio.ByteBuffer nachFormatHint(long struct)
Unsafe version ofachFormatHint().
-
nachFormatHintString
public static java.lang.String nachFormatHintString(long struct)
Unsafe version ofachFormatHintString().
-
npcData
public static AITexel.Buffer npcData(long struct, int capacity)
Unsafe version ofpcData(int).
-
nmFilename
public static AIString nmFilename(long struct)
Unsafe version ofmFilename().
-
-