2
0
Эх сурвалжийг харах

Updated D bindings to the latest C headers (aiGetMaterialTextureCount, comments about UTF-8 in aiString).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@472 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
klickverbot 16 жил өмнө
parent
commit
a5d0829b78

+ 23 - 7
port/dAssimp/assimp/api.d

@@ -579,17 +579,33 @@ extern ( C ) {
    ) aiGetMaterialString;
 
    /**
-    * Helper function for retrieving a texture from the material.
+    * Get the number of textures for a particular texture type.
+    *
+    * Params:
+    *    pMat = Pointer to the input material. May not be NULL
+    *    type = Texture type to check for
+    *
+    * Returns:
+    *    Number of textures for this type.
+    */
+   uint function( aiMaterial* pMat, aiTextureType type ) aiGetMaterialTextureCount;
+
+   /**
+    * Helper function to get all values pertaining to a particular texture slot
+    * from a material structure.
     *
     * This function is provided just for convenience. You could also read the
-    * texture by reading all of its properties manually. This function bundles
-    * all of them in a huge function-monster.
+    * texture by parsing all of its properties manually. This function bundles
+    * all of them in a huge function monster.
     *
     * Params:
     *    mat = Pointer to the input material. May not be null.
-    *    type = Specifies the <code>aiTextureType</code> of the texture to be
-    *       retrieved.
-    *    index = Index of the texture to be retrieved.
+    *    type = Specifies the texture stack (<code>aiTextureType</code>) to
+    *       read from.
+    *    index = Index of the texture. The function fails if the requested
+    *       index is not available for this texture type.
+    *       <code>aiGetMaterialTextureCount()</code> can be used to determine
+    *       the number of textures in a particular texture stack.
     *    path = Receives the output path. null is not a valid value.
     *    mapping = Recieves the texture mapping mode to be used.
     *       Pass null if you are not interested in this information.
@@ -606,7 +622,7 @@ extern ( C ) {
     *       UV order) or null if you are not interested in this information.
     *
     * Returns:
-    *    <code>aiReturn.SUCCESS</code> on success, something else otherwise.
+    *    <code>aiReturn.SUCCESS</code> on success, otherwise something else.
     */
    aiReturn function(
       aiMaterial* mat,

+ 1 - 0
port/dAssimp/assimp/loader.d

@@ -152,6 +152,7 @@ public:
          bind( aiGetMaterialIntegerArray )( "aiGetMaterialIntegerArray" );
          bind( aiGetMaterialColor )( "aiGetMaterialColor" );
          bind( aiGetMaterialString )( "aiGetMaterialString" );
+         bind( aiGetMaterialTextureCount )( "aiGetMaterialTextureCount" );
          bind( aiGetMaterialTexture )( "aiGetMaterialTexture" );
       }
       ++m_sRefCount;

+ 19 - 2
port/dAssimp/assimp/types.d

@@ -85,11 +85,24 @@ extern ( C ) {
    const size_t MAXLEN = 1024;
 
    /**
-    * Represents a string, zero byte terminated.
+    * Represents an UTF-8 string, zero byte terminated.
     *
-    * The length of such a string is limited to <code>MAXLEN</code> characters
+    * The length of such a string is limited to <code>MAXLEN</code> bytes
     * (excluding the terminal \0).
     *
+    * The character set of an aiString is explicitly defined to be UTF-8. This
+    * Unicode transformation was chosen in the belief that most strings in 3d
+    * model files are limited to ASCII characters, thus the character set
+    * needed to be ASCII compatible.
+    *
+    * Most text file loaders provide proper Unicode input file handling,
+    * special unicode characters are correctly transcoded to UTF-8 and are kept
+    * throughout the libraries' import pipeline.
+    *
+    * For most applications, it will be absolutely sufficient to interpret the
+    * aiString as ASCII data and work with it as one would work with a plain
+    * char[].
+    *
     * To access an aiString from D you might want to use something like the
     * following piece of code:
     * ---
@@ -101,6 +114,10 @@ extern ( C ) {
    struct aiString {
       /**
        * Length of the string (excluding the terminal \0).
+       *
+       * This is <em>not</em> the logical length of strings containing UTF-8
+       * multibyte sequences, but the number of bytes from the beginning of the
+       * string to its end.
        */
       size_t length;