Class AIMaterialProperty

  • All Implemented Interfaces:
    Pointer

    public class AIMaterialProperty
    extends Struct
    Data structure for a single material property.

    As a user, you'll probably never need to deal with this data structure. Just use the provided aiGetMaterialXXX() family of functions to query material properties easily. Processing them manually is faster, but it is not the recommended way. It isn't worth the effort.

    Material property names follow a simple scheme:

    
     $<name>
     ?<name>
         A public property, there must be corresponding AI_MATKEY_XXX define
         2nd: Public, but ignored by the aiProcess_RemoveRedundantMaterials
         post-processing step.
     ~<name>
         A temporary property for internal use.

    Member documentation

    • mKey – Specifies the name of the property (key). Keys are generally case insensitive.
    • mSemantic – Textures: Specifies their exact usage semantic. For non-texture properties, this member is always 0 (or, better-said, TextureType_NONE).
    • mIndex – Textures: Specifies the index of the texture. For non-texture properties, this member is always 0.
    • mDataLength – Size of the buffer mData is pointing to, in bytes. This value may not be 0.
    • mType – Type information for the property. Defines the data layout inside the data buffer. This is used by the library internally to perform debug checks and to utilize proper type conversions. (It's probably a hacky solution, but it works.)
    • mData – Binary buffer to hold the property's value. The size of the buffer is always mDataLength.

    Layout

    
     struct aiMaterialProperty {
         struct aiString mKey;
         unsigned int mSemantic;
         unsigned int mIndex;
         unsigned int mDataLength;
         aiPropertyTypeInfo mType;
         char * mData;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • MKEY, MSEMANTIC, MINDEX, MDATALENGTH, MTYPE, MDATA

        The struct member offsets.
    • Constructor Detail

      • AIMaterialProperty

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

        public AIMaterialProperty mKey​(java.util.function.Consumer<AIString> consumer)
        Passes the mKey field to the specified Consumer.
      • mSemantic

        public int mSemantic()
        Returns the value of the mSemantic field.
      • mIndex

        public int mIndex()
        Returns the value of the mIndex field.
      • mDataLength

        public int mDataLength()
        Returns the value of the mDataLength field.
      • mType

        public int mType()
        Returns the value of the mType field.
      • mData

        public java.nio.ByteBuffer mData()
        Returns a ByteBuffer view of the data pointed to by the mData field.
      • createSafe

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

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

        public static AIString nmKey​(long struct)
        Unsafe version of mKey().
      • nmSemantic

        public static int nmSemantic​(long struct)
        Unsafe version of mSemantic().
      • nmIndex

        public static int nmIndex​(long struct)
        Unsafe version of mIndex().
      • nmDataLength

        public static int nmDataLength​(long struct)
        Unsafe version of mDataLength().
      • nmType

        public static int nmType​(long struct)
        Unsafe version of mType().
      • nmData

        public static java.nio.ByteBuffer nmData​(long struct)
        Unsafe version of mData.