Class AIMesh

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class AIMesh
    extends Struct
    implements 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 the aiPrimitiveType 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_POINTPrimitiveType_LINEPrimitiveType_TRIANGLEPrimitiveType_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 is Assimp.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 is Assimp.AI_MAX_FACES.
    • mVertices – Vertex positions. This array is always present in a mesh. The array is mNumVertices in size.
    • mNormals – Vertex normals. The array contains normalized vectors, NULL if not present. The array is mNumVertices 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 to qNaN.
    • 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 is mNumVertices 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 to qNaN.
    • 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 is mNumVertices in size.
    • mColors – Vertex color sets. A mesh may contain 0 to Assimp.AI_MAX_NUMBER_OF_COLOR_SETS vertex colors per vertex. NULL if not present. Each array is mNumVertices in size if present.
    • mTextureCoords – Vertex texture coords, also known as UV channels. A mesh may contain 0 to Assimp.AI_MAX_NUMBER_OF_TEXTURECOORDS per vertex. NULL if not present. The array is mNumVertices 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 component p.z of mTextureCoords[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 in mNumFaces. If the Assimp.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 the mBones array is NULL.
    • 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 meshes
    • mAnimMeshes – 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;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • MPRIMITIVETYPES, MNUMVERTICES, MNUMFACES, MVERTICES, MNORMALS, MTANGENTS, MBITANGENTS, MCOLORS, MTEXTURECOORDS, MNUMUVCOMPONENTS, MFACES, MNUMBONES, MBONES, MMATERIALINDEX, MNAME, MNUMANIMMESHES, MANIMMESHES

        The struct member offsets.
    • Constructor Detail

      • AIMesh

        public AIMesh​(java.nio.ByteBuffer container)
        Creates a AIMesh 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.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • mPrimitiveTypes

        public int mPrimitiveTypes()
        Returns the value of the mPrimitiveTypes field.
      • mNumVertices

        public int mNumVertices()
        Returns the value of the mNumVertices field.
      • mNumFaces

        public int mNumFaces()
        Returns the value of the mNumFaces field.
      • mColors

        @Nullable
        public AIColor4D.Buffer mColors​(int index)
        Returns a AIColor4D view of the pointer at the specified index of the mColors field.
      • mTextureCoords

        @Nullable
        public AIVector3D.Buffer mTextureCoords​(int index)
        Returns a AIVector3D view of the pointer at the specified index of the mTextureCoords field.
      • mNumUVComponents

        public java.nio.IntBuffer mNumUVComponents()
        Returns a IntBuffer view of the mNumUVComponents field.
      • mNumUVComponents

        public int mNumUVComponents​(int index)
        Returns the value at the specified index of the mNumUVComponents field.
      • mNumBones

        public int mNumBones()
        Returns the value of the mNumBones field.
      • mMaterialIndex

        public int mMaterialIndex()
        Returns the value of the mMaterialIndex field.
      • mName

        public AIMesh mName​(java.util.function.Consumer<AIString> consumer)
        Passes the mName field to the specified Consumer.
      • mNumAnimMeshes

        public int mNumAnimMeshes()
        Returns the value of the mNumAnimMeshes field.
      • mAnimMeshes

        @Nullable
        public PointerBuffer mAnimMeshes()
        Returns a PointerBuffer view of the data pointed to by the mAnimMeshes field.
      • mPrimitiveTypes

        public AIMesh mPrimitiveTypes​(int value)
        Sets the specified value to the mPrimitiveTypes field.
      • mNumVertices

        public AIMesh mNumVertices​(int value)
        Sets the specified value to the mNumVertices field.
      • mColors

        public AIMesh mColors​(int index,
                              @Nullable
                              AIColor4D.Buffer value)
        Copies the address of the specified AIColor4D at the specified index of the mColors field.
      • mTextureCoords

        public AIMesh mTextureCoords​(int index,
                                     @Nullable
                                     AIVector3D.Buffer value)
        Copies the address of the specified AIVector3D at the specified index of the mTextureCoords field.
      • mNumUVComponents

        public AIMesh mNumUVComponents​(java.nio.IntBuffer value)
        Copies the specified IntBuffer to the mNumUVComponents field.
      • mNumUVComponents

        public AIMesh mNumUVComponents​(int index,
                                       int value)
        Sets the specified value at the specified index of the mNumUVComponents field.
      • mMaterialIndex

        public AIMesh mMaterialIndex​(int value)
        Sets the specified value to the mMaterialIndex field.
      • 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 new AIMesh instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static AIMesh calloc()
        Returns a new AIMesh instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static AIMesh create​(long address)
        Returns a new AIMesh instance for the specified memory address.
      • createSafe

        @Nullable
        public static AIMesh createSafe​(long address)
        Like create, but returns null if address is NULL.
      • malloc

        public static AIMesh.Buffer malloc​(int capacity)
        Returns a new AIMesh.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • calloc

        public static AIMesh.Buffer calloc​(int capacity)
        Returns a new AIMesh.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • create

        public static AIMesh.Buffer create​(long address,
                                           int capacity)
        Create a AIMesh.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        @Nullable
        public static AIMesh.Buffer createSafe​(long address,
                                               int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static AIMesh mallocStack()
        Returns a new AIMesh instance allocated on the thread-local MemoryStack.
      • callocStack

        public static AIMesh callocStack()
        Returns a new AIMesh instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static AIMesh mallocStack​(MemoryStack stack)
        Returns a new AIMesh instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static AIMesh callocStack​(MemoryStack stack)
        Returns a new AIMesh instance allocated on the specified MemoryStack 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 new AIMesh.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static AIMesh.Buffer callocStack​(int capacity)
        Returns a new AIMesh.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

        public static AIMesh.Buffer mallocStack​(int capacity,
                                                MemoryStack stack)
        Returns a new AIMesh.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • callocStack

        public static AIMesh.Buffer callocStack​(int capacity,
                                                MemoryStack stack)
        Returns a new AIMesh.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • nmPrimitiveTypes

        public static int nmPrimitiveTypes​(long struct)
        Unsafe version of mPrimitiveTypes().
      • nmNumVertices

        public static int nmNumVertices​(long struct)
        Unsafe version of mNumVertices().
      • nmNumFaces

        public static int nmNumFaces​(long struct)
        Unsafe version of mNumFaces().
      • nmColors

        @Nullable
        public static AIColor4D.Buffer nmColors​(long struct,
                                                int index)
        Unsafe version of mColors.
      • nmNumUVComponents

        public static java.nio.IntBuffer nmNumUVComponents​(long struct)
        Unsafe version of mNumUVComponents().
      • nmNumUVComponents

        public static int nmNumUVComponents​(long struct,
                                            int index)
        Unsafe version of mNumUVComponents.
      • nmNumBones

        public static int nmNumBones​(long struct)
        Unsafe version of mNumBones().
      • nmBones

        @Nullable
        public static PointerBuffer nmBones​(long struct)
        Unsafe version of mBones.
      • nmMaterialIndex

        public static int nmMaterialIndex​(long struct)
        Unsafe version of mMaterialIndex().
      • nmName

        public static AIString nmName​(long struct)
        Unsafe version of mName().
      • nmNumAnimMeshes

        public static int nmNumAnimMeshes​(long struct)
        Unsafe version of mNumAnimMeshes().
      • nmPrimitiveTypes

        public static void nmPrimitiveTypes​(long struct,
                                            int value)
        Unsafe version of mPrimitiveTypes.
      • nmNumVertices

        public static void nmNumVertices​(long struct,
                                         int value)
        Sets the specified value to the mNumVertices field of the specified struct.
      • nmNumFaces

        public static void nmNumFaces​(long struct,
                                      int value)
        Sets the specified value to the mNumFaces field of the specified struct.
      • nmColors

        public static void nmColors​(long struct,
                                    PointerBuffer value)
        Unsafe version of mColors.
      • nmColors

        public static void nmColors​(long struct,
                                    int index,
                                    @Nullable
                                    AIColor4D.Buffer value)
        Unsafe version of mColors.
      • nmNumUVComponents

        public static void nmNumUVComponents​(long struct,
                                             java.nio.IntBuffer value)
        Unsafe version of mNumUVComponents.
      • nmNumUVComponents

        public static void nmNumUVComponents​(long struct,
                                             int index,
                                             int value)
        Unsafe version of mNumUVComponents.
      • nmFaces

        public static void nmFaces​(long struct,
                                   AIFace.Buffer value)
        Unsafe version of mFaces.
      • nmNumBones

        public static void nmNumBones​(long struct,
                                      int value)
        Sets the specified value to the mNumBones field of the specified struct.
      • nmBones

        public static void nmBones​(long struct,
                                   @Nullable
                                   PointerBuffer value)
        Unsafe version of mBones.
      • nmMaterialIndex

        public static void nmMaterialIndex​(long struct,
                                           int value)
        Unsafe version of mMaterialIndex.
      • nmName

        public static void nmName​(long struct,
                                  AIString value)
        Unsafe version of mName.
      • nmNumAnimMeshes

        public static void nmNumAnimMeshes​(long struct,
                                           int value)
        Sets the specified value to the mNumAnimMeshes field of the specified struct.
      • nmAnimMeshes

        public static void nmAnimMeshes​(long struct,
                                        @Nullable
                                        PointerBuffer value)
        Unsafe version of mAnimMeshes.
      • validate

        public static void validate​(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array