Package org.lwjgl.assimp
Class AIMesh
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.assimp.AIMesh
-
- All Implemented Interfaces:
- java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer
public class AIMesh extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResource
A mesh represents a geometry or model with a single material.It usually consists of a number of vertices and a series of primitives/faces referencing the vertices. In addition there might be a series of bones, each of them addressing a number of vertices with a certain weight. Vertex data is presented in channels with each channel containing a single per-vertex information such as a set of texture coords or a normal vector. If a data pointer is non-null, the corresponding data stream is present.
A Mesh uses only a single material which is referenced by a material ID.
Member documentation
mPrimitiveTypes
– Bitwise combination of the members of theaiPrimitiveType
enum. This specifies which types of primitives are present in the mesh. The "SortByPrimitiveType"-Step can be used to make sure the output meshes consist of one primitive type each. One or more of:PrimitiveType_POINT
PrimitiveType_LINE
PrimitiveType_TRIANGLE
PrimitiveType_POLYGON
mNumVertices
– The number of vertices in this mesh. This is also the size of all of the per-vertex data arrays. The maximum value for this member isAssimp.AI_MAX_VERTICES
.mNumFaces
– The number of primitives (triangles, polygons, lines) in this mesh. This is also the size of the mFaces array. The maximum value for this member isAssimp.AI_MAX_FACES
.mVertices
– Vertex positions. This array is always present in a mesh. The array ismNumVertices
in size.mNormals
– Vertex normals. The array contains normalized vectors,NULL
if not present. The array ismNumVertices
in size. Normals are undefined for point and line primitives. A mesh consisting of points and lines only may not have normal vectors. Meshes with mixed primitive types (i.e. lines and triangles) may have normals, but the normals for vertices that are only referenced by point or line primitives are undefined and set toqNaN
.mTangents
– Vertex tangents. The tangent of a vertex points in the direction of the positive X texture axis. The array contains normalized vectors,NULL
if not present. The array ismNumVertices
in size. A mesh consisting of points and lines only may not have normal vectors. Meshes with mixed primitive types (i.e. lines and triangles) may have normals, but the normals for vertices that are only referenced by point or line primitives are undefined and set toqNaN
.mBitangents
– Vertex bitangents. The bitangent of a vertex points in the direction of the positive Y texture axis. The array contains normalized vectors,NULL
if not present. The array ismNumVertices
in size.mColors
– Vertex color sets. A mesh may contain 0 toAssimp.AI_MAX_NUMBER_OF_COLOR_SETS
vertex colors per vertex.NULL
if not present. Each array ismNumVertices
in size if present.mTextureCoords
– Vertex texture coords, also known as UV channels. A mesh may contain 0 toAssimp.AI_MAX_NUMBER_OF_TEXTURECOORDS
per vertex.NULL
if not present. The array ismNumVertices
in size.mNumUVComponents
– Specifies the number of components for a given UV channel. Up to three channels are supported (UVW, for accessing volume or cube maps). If the value is 2 for a given channel n, the componentp.z
ofmTextureCoords[n][p]
is set to 0.0f. If the value is 1 for a given channel,p.y
is set to 0.0f, too.mFaces
– The faces the mesh is constructed from. Each face refers to a number of vertices by their indices. This array is always present in a mesh, its size is given inmNumFaces
. If theAssimp.AI_SCENE_FLAGS_NON_VERBOSE_FORMAT
is NOT set each face references an unique set of vertices.mNumBones
– The number of bones this mesh contains. Can be 0, in which case themBones
array isNULL
.mBones
– The bones of this mesh. A bone consists of a name by which it can be found in the frame hierarchy and a set of vertex weights.mMaterialIndex
– The material used by this mesh. A mesh uses only a single material. If an imported model uses multiple materials, the import splits up the mesh. Use this value as index into the scene's material list.mName
– Name of the mesh. Meshes can be named, but this is not a requirement and leaving this field empty is totally fine. There are mainly three uses for mesh names: - some formats name nodes and meshes independently. - importers tend to split meshes up to meet the one-material-per-mesh requirement. Assigning the same (dummy) name to each of the result meshes aids the caller at recovering the original mesh partitioning. - Vertex animations refer to meshes by their names.mNumAnimMeshes
– NOT CURRENTLY IN USE. The number of attachment meshesmAnimMeshes
– NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation. Attachment meshes carry replacement data for some of the mesh'es vertex components (usually positions, normals).
Layout
struct aiMesh { unsigned int mPrimitiveTypes; unsigned int mNumVertices; unsigned int mNumFaces;
struct aiVector3D
* mVertices;struct aiVector3D
* mNormals;struct aiVector3D
* mTangents;struct aiVector3D
* mBitangents;struct aiColor4D
* mColors[Assimp.AI_MAX_NUMBER_OF_COLOR_SETS];struct aiVector3D
* mTextureCoords[Assimp.AI_MAX_NUMBER_OF_TEXTURECOORDS]; unsigned int mNumUVComponents[Assimp.AI_MAX_NUMBER_OF_TEXTURECOORDS];struct aiFace
* mFaces; unsigned int mNumBones;struct aiBone
** mBones; unsigned int mMaterialIndex;struct aiString
mName; unsigned int mNumAnimMeshes;struct aiAnimMesh
** mAnimMeshes; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
AIMesh.Buffer
An array ofAIMesh
structs.
-
Field Summary
Fields Modifier and Type Field and Description static int
SIZEOF
The struct size in bytes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static AIMesh
calloc()
Returns a newAIMesh
instance allocated withmemCalloc
.static AIMesh.Buffer
calloc(int capacity)
Returns a newAIMesh.Buffer
instance allocated withmemCalloc
.static AIMesh
callocStack()
Returns a newAIMesh
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static AIMesh.Buffer
callocStack(int capacity)
Returns a newAIMesh.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static AIMesh.Buffer
callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static AIMesh
callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static AIMesh
create()
Returns a newAIMesh
instance allocated withBufferUtils
.static AIMesh.Buffer
create(int capacity)
Returns a newAIMesh.Buffer
instance allocated withBufferUtils
.static AIMesh
create(long address)
Returns a newAIMesh
instance for the specified memory address.static AIMesh.Buffer
create(long address, int capacity)
Create aAIMesh.Buffer
instance at the specified memory.static AIMesh
createSafe(long address)
static AIMesh.Buffer
createSafe(long address, int capacity)
static AIMesh
malloc()
Returns a newAIMesh
instance allocated withmemAlloc
.static AIMesh.Buffer
malloc(int capacity)
Returns a newAIMesh.Buffer
instance allocated withmemAlloc
.static AIMesh
mallocStack()
Returns a newAIMesh
instance allocated on the thread-localMemoryStack
.static AIMesh.Buffer
mallocStack(int capacity)
Returns a newAIMesh.Buffer
instance allocated on the thread-localMemoryStack
.static AIMesh.Buffer
mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh.Buffer
instance allocated on the specifiedMemoryStack
.static AIMesh
mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh
instance allocated on the specifiedMemoryStack
.org.lwjgl.PointerBuffer
mAnimMeshes()
Returns aPointerBuffer
view of the data pointed to by themAnimMeshes
field.AIMesh
mAnimMeshes(org.lwjgl.PointerBuffer value)
Sets the address of the specifiedPointerBuffer
to themAnimMeshes
field.AIVector3D.Buffer
mBitangents()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themBitangents
field.AIMesh
mBitangents(AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themBitangents
field.org.lwjgl.PointerBuffer
mBones()
Returns aPointerBuffer
view of the data pointed to by themBones
field.AIMesh
mBones(org.lwjgl.PointerBuffer value)
Sets the address of the specifiedPointerBuffer
to themBones
field.org.lwjgl.PointerBuffer
mColors()
Returns aPointerBuffer
view of themColors
field.AIColor4D.Buffer
mColors(int index)
Returns aAIColor4D
view of the pointer at the specified index of themColors
field.AIMesh
mColors(int index, AIColor4D.Buffer value)
Copies the address of the specifiedAIColor4D
at the specified index of themColors
field.AIMesh
mColors(org.lwjgl.PointerBuffer value)
Copies the specifiedPointerBuffer
to themColors
field.AIFace.Buffer
mFaces()
Returns aAIFace.Buffer
view of the struct array pointed to by themFaces
field.AIMesh
mFaces(AIFace.Buffer value)
Sets the address of the specifiedAIFace.Buffer
to themFaces
field.int
mMaterialIndex()
Returns the value of themMaterialIndex
field.AIMesh
mMaterialIndex(int value)
Sets the specified value to themMaterialIndex
field.AIString
mName()
Returns aAIString
view of themName
field.AIMesh
mName(AIString value)
Copies the specifiedAIString
to themName
field.AIVector3D.Buffer
mNormals()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themNormals
field.AIMesh
mNormals(AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themNormals
field.int
mNumAnimMeshes()
Returns the value of themNumAnimMeshes
field.int
mNumBones()
Returns the value of themNumBones
field.int
mNumFaces()
Returns the value of themNumFaces
field.java.nio.IntBuffer
mNumUVComponents()
Returns aIntBuffer
view of themNumUVComponents
field.int
mNumUVComponents(int index)
Returns the value at the specified index of themNumUVComponents
field.AIMesh
mNumUVComponents(java.nio.IntBuffer value)
Copies the specifiedIntBuffer
to themNumUVComponents
field.AIMesh
mNumUVComponents(int index, int value)
Sets the specified value at the specified index of themNumUVComponents
field.int
mNumVertices()
Returns the value of themNumVertices
field.AIMesh
mNumVertices(int value)
Sets the specified value to themNumVertices
field.int
mPrimitiveTypes()
Returns the value of themPrimitiveTypes
field.AIMesh
mPrimitiveTypes(int value)
Sets the specified value to themPrimitiveTypes
field.AIVector3D.Buffer
mTangents()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themTangents
field.AIMesh
mTangents(AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themTangents
field.org.lwjgl.PointerBuffer
mTextureCoords()
Returns aPointerBuffer
view of themTextureCoords
field.AIVector3D.Buffer
mTextureCoords(int index)
Returns aAIVector3D
view of the pointer at the specified index of themTextureCoords
field.AIMesh
mTextureCoords(int index, AIVector3D.Buffer value)
Copies the address of the specifiedAIVector3D
at the specified index of themTextureCoords
field.AIMesh
mTextureCoords(org.lwjgl.PointerBuffer value)
Copies the specifiedPointerBuffer
to themTextureCoords
field.AIVector3D.Buffer
mVertices()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themVertices
field.AIMesh
mVertices(AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themVertices
field.AIMesh
set(AIMesh src)
Copies the specified struct data to this struct.AIMesh
set(int mPrimitiveTypes, int mNumVertices, AIVector3D.Buffer mVertices, AIVector3D.Buffer mNormals, AIVector3D.Buffer mTangents, AIVector3D.Buffer mBitangents, org.lwjgl.PointerBuffer mColors, org.lwjgl.PointerBuffer mTextureCoords, java.nio.IntBuffer mNumUVComponents, AIFace.Buffer mFaces, org.lwjgl.PointerBuffer mBones, int mMaterialIndex, AIString mName, org.lwjgl.PointerBuffer mAnimMeshes)
Initializes this struct with the specified values.int
sizeof()
static void
validate(long struct)
Validates pointer members that should not beNULL
.static void
validate(long array, int count)
CallsAIMesh.validate(long)
for each struct contained in the specified struct array.
-
-
-
Constructor Detail
-
AIMesh
public AIMesh(java.nio.ByteBuffer container)
Creates aAIMesh
instance at the current position of the specifiedByteBuffer
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.
-
-
Method Detail
-
sizeof
public int sizeof()
- Specified by:
sizeof
in classorg.lwjgl.system.Struct
-
mPrimitiveTypes
public int mPrimitiveTypes()
Returns the value of themPrimitiveTypes
field.
-
mNumVertices
public int mNumVertices()
Returns the value of themNumVertices
field.
-
mNumFaces
public int mNumFaces()
Returns the value of themNumFaces
field.
-
mVertices
public AIVector3D.Buffer mVertices()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themVertices
field.
-
mNormals
@Nullable public AIVector3D.Buffer mNormals()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themNormals
field.
-
mTangents
@Nullable public AIVector3D.Buffer mTangents()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themTangents
field.
-
mBitangents
@Nullable public AIVector3D.Buffer mBitangents()
Returns aAIVector3D.Buffer
view of the struct array pointed to by themBitangents
field.
-
mColors
public org.lwjgl.PointerBuffer mColors()
Returns aPointerBuffer
view of themColors
field.
-
mColors
@Nullable public AIColor4D.Buffer mColors(int index)
Returns aAIColor4D
view of the pointer at the specified index of themColors
field.
-
mTextureCoords
public org.lwjgl.PointerBuffer mTextureCoords()
Returns aPointerBuffer
view of themTextureCoords
field.
-
mTextureCoords
@Nullable public AIVector3D.Buffer mTextureCoords(int index)
Returns aAIVector3D
view of the pointer at the specified index of themTextureCoords
field.
-
mNumUVComponents
public java.nio.IntBuffer mNumUVComponents()
Returns aIntBuffer
view of themNumUVComponents
field.
-
mNumUVComponents
public int mNumUVComponents(int index)
Returns the value at the specified index of themNumUVComponents
field.
-
mFaces
public AIFace.Buffer mFaces()
Returns aAIFace.Buffer
view of the struct array pointed to by themFaces
field.
-
mNumBones
public int mNumBones()
Returns the value of themNumBones
field.
-
mBones
@Nullable public org.lwjgl.PointerBuffer mBones()
Returns aPointerBuffer
view of the data pointed to by themBones
field.
-
mMaterialIndex
public int mMaterialIndex()
Returns the value of themMaterialIndex
field.
-
mNumAnimMeshes
public int mNumAnimMeshes()
Returns the value of themNumAnimMeshes
field.
-
mAnimMeshes
@Nullable public org.lwjgl.PointerBuffer mAnimMeshes()
Returns aPointerBuffer
view of the data pointed to by themAnimMeshes
field.
-
mPrimitiveTypes
public AIMesh mPrimitiveTypes(int value)
Sets the specified value to themPrimitiveTypes
field.
-
mNumVertices
public AIMesh mNumVertices(int value)
Sets the specified value to themNumVertices
field.
-
mVertices
public AIMesh mVertices(AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themVertices
field.
-
mNormals
public AIMesh mNormals(@Nullable AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themNormals
field.
-
mTangents
public AIMesh mTangents(@Nullable AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themTangents
field.
-
mBitangents
public AIMesh mBitangents(@Nullable AIVector3D.Buffer value)
Sets the address of the specifiedAIVector3D.Buffer
to themBitangents
field.
-
mColors
public AIMesh mColors(org.lwjgl.PointerBuffer value)
Copies the specifiedPointerBuffer
to themColors
field.
-
mColors
public AIMesh mColors(int index, @Nullable AIColor4D.Buffer value)
Copies the address of the specifiedAIColor4D
at the specified index of themColors
field.
-
mTextureCoords
public AIMesh mTextureCoords(org.lwjgl.PointerBuffer value)
Copies the specifiedPointerBuffer
to themTextureCoords
field.
-
mTextureCoords
public AIMesh mTextureCoords(int index, @Nullable AIVector3D.Buffer value)
Copies the address of the specifiedAIVector3D
at the specified index of themTextureCoords
field.
-
mNumUVComponents
public AIMesh mNumUVComponents(java.nio.IntBuffer value)
Copies the specifiedIntBuffer
to themNumUVComponents
field.
-
mNumUVComponents
public AIMesh mNumUVComponents(int index, int value)
Sets the specified value at the specified index of themNumUVComponents
field.
-
mFaces
public AIMesh mFaces(AIFace.Buffer value)
Sets the address of the specifiedAIFace.Buffer
to themFaces
field.
-
mBones
public AIMesh mBones(@Nullable org.lwjgl.PointerBuffer value)
Sets the address of the specifiedPointerBuffer
to themBones
field.
-
mMaterialIndex
public AIMesh mMaterialIndex(int value)
Sets the specified value to themMaterialIndex
field.
-
mAnimMeshes
public AIMesh mAnimMeshes(@Nullable org.lwjgl.PointerBuffer value)
Sets the address of the specifiedPointerBuffer
to themAnimMeshes
field.
-
set
public AIMesh set(int mPrimitiveTypes, int mNumVertices, AIVector3D.Buffer mVertices, AIVector3D.Buffer mNormals, AIVector3D.Buffer mTangents, AIVector3D.Buffer mBitangents, org.lwjgl.PointerBuffer mColors, org.lwjgl.PointerBuffer mTextureCoords, java.nio.IntBuffer mNumUVComponents, AIFace.Buffer mFaces, org.lwjgl.PointerBuffer mBones, int mMaterialIndex, AIString mName, org.lwjgl.PointerBuffer mAnimMeshes)
Initializes this struct with the specified values.
-
set
public AIMesh set(AIMesh src)
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
public static AIMesh malloc()
Returns a newAIMesh
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static AIMesh calloc()
Returns a newAIMesh
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static AIMesh create(long address)
Returns a newAIMesh
instance for the specified memory address.
-
createSafe
@Nullable public static AIMesh createSafe(long address)
-
malloc
public static AIMesh.Buffer malloc(int capacity)
Returns a newAIMesh.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static AIMesh.Buffer calloc(int capacity)
Returns a newAIMesh.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static AIMesh.Buffer create(int capacity)
Returns a newAIMesh.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static AIMesh.Buffer create(long address, int capacity)
Create aAIMesh.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
@Nullable public static AIMesh.Buffer createSafe(long address, int capacity)
-
mallocStack
public static AIMesh mallocStack()
Returns a newAIMesh
instance allocated on the thread-localMemoryStack
.
-
callocStack
public static AIMesh callocStack()
Returns a newAIMesh
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.
-
mallocStack
public static AIMesh mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
callocStack
public static AIMesh callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
mallocStack
public static AIMesh.Buffer mallocStack(int capacity)
Returns a newAIMesh.Buffer
instance allocated on the thread-localMemoryStack
.- Parameters:
capacity
- the buffer capacity
-
callocStack
public static AIMesh.Buffer callocStack(int capacity)
Returns a newAIMesh.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.- Parameters:
capacity
- the buffer capacity
-
mallocStack
public static AIMesh.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
callocStack
public static AIMesh.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newAIMesh.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
validate
public static void validate(long struct)
Validates pointer members that should not beNULL
.- Parameters:
struct
- the struct to validate
-
validate
public static void validate(long array, int count)
CallsAIMesh.validate(long)
for each struct contained in the specified struct array.- Parameters:
array
- the struct array to validatecount
- the number of structs inarray
-
-