diff --git a/port/dAssimp/assimp/animation.d b/port/dAssimp/assimp/animation.d index 2480c7352..fb716ee73 100644 --- a/port/dAssimp/assimp/animation.d +++ b/port/dAssimp/assimp/animation.d @@ -125,8 +125,8 @@ extern ( C ) { * * Note: All keys are returned in their correct, chronological order. * Duplicate keys don't pass the validation step. Most likely there will - * be no negative time values, but they are not forbidden (so you should - * be able to handle them). + * be no negative time values, but they are not forbidden (so + * implementations need to cope with them!). */ struct aiNodeAnim { /** diff --git a/port/dAssimp/assimp/config.d b/port/dAssimp/assimp/config.d index f20106ca7..9f8d222c7 100644 --- a/port/dAssimp/assimp/config.d +++ b/port/dAssimp/assimp/config.d @@ -49,6 +49,47 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. module assimp.config; extern ( C ) { + /* + * Library settings. + * + * General, global settings. + */ + + /** + * Enables time measurements. + * + * If enabled, measures the time needed for each part of the loading + * process (i.e. IO time, importing, postprocessing, ..) and dumps these + * timings to the DefaultLogger. See the performance page in the main + * Assimp docs information on this topic. + * + * Property type: bool. Default value: false. + */ + const char* AI_CONFIG_GLOB_MEASURE_TIME = "GLOB_MEASURE_TIME"; + + version( none ) { // not implemented yet + /** + * Set Assimp's multithreading policy. + * + * This setting is ignored if Assimp was built without boost.thread support + * (ASSIMP_BUILD_NO_THREADING, which is implied by + * ASSIMP_BUILD_BOOST_WORKAROUND). + * + * Possible values are: -1 to let Assimp decide what to do, 0 to disable + * multithreading entirely and any number larger than 0 to force a specific + * number of threads. Assimp is always free to ignore this settings, which + * is merely a hint. Usually, the default value (-1) will be fine. However, + * if Assimp is used concurrently from multiple user threads, it might be + * useful to limit each Importer instance to a specific number of cores. + * + * For more information, see the threading page in the main Assimp docs. + * + * Property type: int, default value: -1. + */ + const char* AI_CONFIG_GLOB_MULTITHREADING = "GLOB_MULTITHREADING"; + } + + /* * Post processing settings. * @@ -141,7 +182,7 @@ extern ( C ) { * * Default value: false. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_PP_PTV_KEEP_HIERARCHY = "PP_PTV_KEEP_HIERARCHY"; @@ -167,7 +208,7 @@ extern ( C ) { * * Default value: false. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_PP_FD_REMOVE = "PP_FD_REMOVE"; @@ -450,7 +491,7 @@ extern ( C ) { * * Default value: false. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_FAVOUR_SPEED = "FAVOUR_SPEED"; @@ -458,7 +499,7 @@ extern ( C ) { /* * Importer settings. * - * Various stuff to fine-tune the behaviour of a specific importer plugin. + * Various stuff to fine-tune the behaviour of specific importer plugins. */ /** @@ -493,7 +534,7 @@ extern ( C ) { * * Default value: true. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL = "IMPORT_AC_SEPARATE_BFCULL"; @@ -503,7 +544,7 @@ extern ( C ) { * * Default value: true. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS = "UNREAL_HANDLE_FLAGS"; @@ -518,7 +559,7 @@ extern ( C ) { * * Default value: false. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_IMPORT_TER_MAKE_UVS = "IMPORT_TER_MAKE_UVS"; @@ -530,12 +571,13 @@ extern ( C ) { * * Default value: true. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS = "IMPORT_ASE_RECONSTRUCT_NORMALS"; /** - * Configures the M3D loader to process multi-part player models. + * Configures the M3D loader to detect and process multi-part Quake player + * models. * * These models usually consist of three files, lower.md3, * upper.md3 and head.md3. If this property is set @@ -544,7 +586,7 @@ extern ( C ) { * * Default value: true. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART = "IMPORT_MD3_HANDLE_MULTIPART"; @@ -610,7 +652,7 @@ extern ( C ) { * * Default value: false. * - * Property type: integer (0: false; !0: true). + * Property type: bool. */ const char* AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD = "IMPORT_MD5_NO_ANIM_AUTOLOAD"; diff --git a/port/dAssimp/assimp/loader.d b/port/dAssimp/assimp/loader.d index b18610c2a..76fd44adf 100644 --- a/port/dAssimp/assimp/loader.d +++ b/port/dAssimp/assimp/loader.d @@ -51,8 +51,8 @@ import assimp.api; import tango.io.Stdout; import tango.sys.SharedLib; -const uint ASSIMP_BINDINGS_MAJOR = 1; -const uint ASSIMP_BINDINGS_MINOR = 1; +const uint ASSIMP_BINDINGS_MAJOR = 2; +const uint ASSIMP_BINDINGS_MINOR = 0; /** * Loader class for dynamically loading the Assimp library. @@ -74,7 +74,11 @@ public: static void load() { if ( m_sRefCount == 0 ) { version ( Posix ) { - m_sLibrary = SharedLib.load( "libassimp.so" ); + version ( OSX ) { + m_sLibrary = SharedLib.load( "libassimp.dylib" ); + } else { + m_sLibrary = SharedLib.load( "libassimp.so" ); + } } version ( Win32 ) { m_sLibrary = SharedLib.load( "Assimp32.dll" ); diff --git a/port/dAssimp/assimp/mesh.d b/port/dAssimp/assimp/mesh.d index d8db0e664..42a78128b 100644 --- a/port/dAssimp/assimp/mesh.d +++ b/port/dAssimp/assimp/mesh.d @@ -49,6 +49,43 @@ import assimp.math; import assimp.types; extern ( C ) { + /* + * These limits are required to match the settings Assimp was compiled + * against. Therfore, do not redefine them unless you build the library + * from source using the same definitions. + */ + + /** + * Maximum number of indices per face (polygon). + */ + const AI_MAX_FACE_INDICES = 0x7fff; + + /** + * Maximum number of indices per face (polygon). + */ + const AI_MAX_BONE_WEIGHTS = 0x7fffffff; + + /** + * Maximum number of vertices per mesh. + */ + const AI_MAX_VERTICES = 0x7fffffff; + + /** + * Maximum number of faces per mesh. + */ + const AI_MAX_FACES = 0x7fffffff; + + /** + * Supported number of vertex color sets per mesh. + */ + const AI_MAX_NUMBER_OF_COLOR_SETS = 0x4; + + /** + * Supported number of texture coord sets (UV(W) channels) per mesh. + */ + const AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x4; + + /** * A single face in a mesh, referring to multiple vertices. * @@ -71,8 +108,9 @@ extern ( C ) { */ struct aiFace { /** - * Number of indices defining this face (3 for a triangle, >3 for a - * polygon). + * Number of indices defining this face. + * + * The maximum value for this member is AI_MAX_FACE_INDICES. */ uint mNumIndices; @@ -116,6 +154,8 @@ extern ( C ) { /** * The number of vertices affected by this bone. + * + * The maximum value for this member is AI_MAX_BONE_WEIGHTS. */ uint mNumWeights; @@ -133,30 +173,6 @@ extern ( C ) { aiMatrix4x4 mOffsetMatrix; } - /** - * Maximum number of vertex color sets per mesh. - * - * Normally: Diffuse, specular, ambient and emissive. However, one could use - * the vertex color sets for any other purpose, too. - * - * Note: Some internal structures expect (and assert) this value to be at - * least 4. For the moment it is absolutely safe to assume that this will - * not change. - */ - const uint AI_MAX_NUMBER_OF_COLOR_SETS = 0x4; - - /** - * Maximum number of texture coord sets (UV(W) channels) per mesh - * - * The material system uses the AI_MATKEY_UVWSRC_XXX keys to - * specify which UVW channel serves as data source for a texture. - * - * Note: Some internal structures expect (and assert) this value to be at - * least 4. For the moment it is absolutely safe to assume that this will - * not change. - */ - const uint AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x4; - /** * Enumerates the types of geometric primitives supported by Assimp. * @@ -198,6 +214,58 @@ extern ( C ) { // Note: The AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) macro from the C headers is // missing since there is probably not much use for it when just reading // scene files. + + /** + * NOT CURRENTLY IN USE. An AnimMesh is an attachment to an #aiMesh stores + * per-vertex animations for a particular frame. + * + * You may think of an aiAnimMesh as a `patch` for the host + * mesh, which replaces only certain vertex data streams at a particular + * time. + * + * Each mesh stores n attached attached meshes (aiMesh.mAnimMeshes). + * The actual relationship between the time line and anim meshes is + * established by #aiMeshAnim, which references singular mesh attachments + * by their ID and binds them to a time offset. + */ + struct aiAnimMesh { + /** + * Replacement for aiMesh.mVertices. + * + * If this array is non-null, it *must* contain mNumVertices entries. + * The corresponding array in the host mesh must be non-null as well - + * animation meshes may neither add or nor remove vertex components (if + * a replacement array is NULL and the corresponding source array is + * not, the source data is taken instead). + */ + aiVector3D* mVertices; + + /// Replacement for aiMesh.mNormals. + aiVector3D* mNormals; + + /// Replacement for aiMesh.mTangents. + aiVector3D* mTangents; + + /// Replacement for aiMesh.mBitangents. + aiVector3D* mBitangents; + + /// Replacement for aiMesh.mColors. + aiColor4D* mColors[ AI_MAX_NUMBER_OF_COLOR_SETS ]; + + /// Replacement for aiMesh.mTextureCoords. + aiVector3D* mTextureCoords[ AI_MAX_NUMBER_OF_TEXTURECOORDS ]; + + /** + * The number of vertices in the aiAnimMesh, and thus the length of all + * the member arrays. + * + * This has always the same value as the mNumVertices property in the + * corresponding aiMesh. It is duplicated here merely to make the length + * of the member arrays accessible even if the aiMesh is not known, e.g. + * from language bindings. + */ + uint mNumVertices; + } /** * A mesh represents a geometry or model with a single material. @@ -230,13 +298,16 @@ extern ( C ) { /** * The number of vertices in this mesh. * - * This is also the size of all of the per-vertex data arrays. + * This is also the size of all of the per-vertex data arrays. The + * maximum value for this member is AI_MAX_VERTICES. */ uint mNumVertices; /** - * The number of primitives (triangles, polygons, lines) in this mesh. - * This is also the size of the mFaces array. + * 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 AI_MAX_FACES. */ uint mNumFaces; @@ -363,5 +434,32 @@ extern ( C ) { * index into the scene's material list. */ uint mMaterialIndex; + + /** + * 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. + */ + aiString mName; + + /// NOT CURRENTLY IN USE. The number of attachment meshes. + uint mNumAnimMeshes; + + /** + * NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex- + * based animation. + * + * Attachment meshes carry replacement data for some of the mesh's + * vertex components (usually positions, normals). + */ + aiAnimMesh** mAnimMeshes; } }