Class AINode

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

    public class AINode
    extends Struct
    implements NativeResource
    A node in the imported hierarchy.

    Each node has name, a parent node (except for the root node), a transformation relative to its parent and possibly several child nodes. Simple file formats don't support hierarchical structures - for these formats the imported scene does consist of only a single root node without children.

    Member documentation

    • mName – The name of the node.

      The name might be empty (length of zero) but all nodes which need to be referenced by either bones or animations are named. Multiple nodes may have the same name, except for nodes which are referenced by bones (see AIBone and AIMesh::mBones). Their names must be unique.

      Cameras and lights reference a specific node by name - if there are multiple nodes with this name, they are assigned to each of them.

      There are no limitations with regard to the characters contained in the name string as it is usually taken directly from the source file.

      Implementations should be able to handle tokens such as whitespace, tabs, line feeds, quotation marks, ampersands etc.

      Sometimes assimp introduces new nodes not present in the source file into the hierarchy (usually out of necessity because sometimes the source hierarchy format is simply not compatible). Their names are surrounded by <> e.g. <DummyRootNode>.

    • mTransformation – The transformation relative to the node's parent.
    • mParent – Parent node. NULL if this node is the root node.
    • mNumChildren – The number of child nodes of this node.
    • mChildren – The child nodes of this node. NULL if mNumChildren is 0.
    • mNumMeshes – The number of meshes of this node.
    • mMeshes – The meshes of this node. Each entry is an index into the mesh list of the AIScene.
    • mMetadata – Metadata associated with this node or NULL if there is no metadata.

      Whether any metadata is generated depends on the source file format. See the importer notes page for more information on every source file format. Importers that don't document any metadata don't write any.

    Layout

    
     struct aiNode {
         struct aiString mName;
         struct aiMatrix4x4 mTransformation;
         struct aiNode * mParent;
         unsigned int mNumChildren;
         struct aiNode ** mChildren;
         unsigned int mNumMeshes;
         unsigned int * mMeshes;
         struct aiMetadata * mMetadata;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • MNAME, MTRANSFORMATION, MPARENT, MNUMCHILDREN, MCHILDREN, MNUMMESHES, MMESHES, MMETADATA

        The struct member offsets.
    • Constructor Detail

      • AINode

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

        public AIMatrix4x4 mTransformation()
        Returns a AIMatrix4x4 view of the mTransformation field.
      • mParent

        @Nullable
        public AINode mParent()
        Returns a AINode view of the struct pointed to by the mParent field.
      • mNumChildren

        public int mNumChildren()
        Returns the value of the mNumChildren field.
      • mChildren

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

        public int mNumMeshes()
        Returns the value of the mNumMeshes field.
      • mMeshes

        @Nullable
        public java.nio.IntBuffer mMeshes()
        Returns a IntBuffer view of the data pointed to by the mMeshes field.
      • mMetadata

        @Nullable
        public AIMetaData mMetadata()
        Returns a AIMetaData view of the struct pointed to by the mMetadata field.
      • mName

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

        public AINode mTransformation​(java.util.function.Consumer<AIMatrix4x4> consumer)
        Passes the mTransformation field to the specified Consumer.
      • mParent

        public AINode mParent​(@Nullable
                              AINode value)
        Sets the address of the specified AINode to the mParent field.
      • mMeshes

        public AINode mMeshes​(@Nullable
                              java.nio.IntBuffer value)
        Sets the address of the specified IntBuffer to the mMeshes field.
      • mMetadata

        public AINode mMetadata​(@Nullable
                                AIMetaData value)
        Sets the address of the specified AIMetaData to the mMetadata field.
      • set

        public AINode set​(AINode src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • malloc

        public static AINode malloc()
        Returns a new AINode instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

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

        public static AINode create()
        Returns a new AINode instance allocated with BufferUtils.
      • create

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

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

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

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

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

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

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

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

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

        public static AINode callocStack​(MemoryStack stack)
        Returns a new AINode instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • mallocStack

        public static AINode.Buffer mallocStack​(int capacity)
        Returns a new AINode.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

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

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

        public static AINode.Buffer callocStack​(int capacity,
                                                MemoryStack stack)
        Returns a new AINode.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
      • nmName

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

        @Nullable
        public static AINode nmParent​(long struct)
        Unsafe version of mParent().
      • nmNumChildren

        public static int nmNumChildren​(long struct)
        Unsafe version of mNumChildren().
      • nmNumMeshes

        public static int nmNumMeshes​(long struct)
        Unsafe version of mNumMeshes().
      • nmMeshes

        @Nullable
        public static java.nio.IntBuffer nmMeshes​(long struct)
        Unsafe version of mMeshes.
      • nmMetadata

        @Nullable
        public static AIMetaData nmMetadata​(long struct)
        Unsafe version of mMetadata().
      • nmName

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

        public static void nmParent​(long struct,
                                    @Nullable
                                    AINode value)
        Unsafe version of mParent.
      • nmNumChildren

        public static void nmNumChildren​(long struct,
                                         int value)
        Sets the specified value to the mNumChildren field of the specified struct.
      • nmChildren

        public static void nmChildren​(long struct,
                                      @Nullable
                                      PointerBuffer value)
        Unsafe version of mChildren.
      • nmNumMeshes

        public static void nmNumMeshes​(long struct,
                                       int value)
        Sets the specified value to the mNumMeshes field of the specified struct.
      • nmMeshes

        public static void nmMeshes​(long struct,
                                    @Nullable
                                    java.nio.IntBuffer value)
        Unsafe version of mMeshes.
      • nmMetadata

        public static void nmMetadata​(long struct,
                                      @Nullable
                                      AIMetaData value)
        Unsafe version of mMetadata.
      • 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