Updated D bindings to the new API.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@858 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
klickverbot 2010-11-21 19:52:11 +00:00
parent a3e42915d8
commit 6744cb32bc
4 changed files with 189 additions and 45 deletions

View File

@ -125,8 +125,8 @@ extern ( C ) {
* *
* Note: All keys are returned in their correct, chronological order. * Note: All keys are returned in their correct, chronological order.
* Duplicate keys don't pass the validation step. Most likely there will * 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 no negative time values, but they are not forbidden (so
* be able to handle them). * implementations need to cope with them!).
*/ */
struct aiNodeAnim { struct aiNodeAnim {
/** /**

View File

@ -49,6 +49,47 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
module assimp.config; module assimp.config;
extern ( C ) { 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
* (<code>ASSIMP_BUILD_NO_THREADING</code>, which is implied by
* <code>ASSIMP_BUILD_BOOST_WORKAROUND</code>).
*
* 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. * Post processing settings.
* *
@ -141,7 +182,7 @@ extern ( C ) {
* *
* Default value: false. * 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"; const char* AI_CONFIG_PP_PTV_KEEP_HIERARCHY = "PP_PTV_KEEP_HIERARCHY";
@ -167,7 +208,7 @@ extern ( C ) {
* *
* Default value: false. * Default value: false.
* *
* Property type: integer (0: false; !0: true). * Property type: bool.
*/ */
const char* AI_CONFIG_PP_FD_REMOVE = "PP_FD_REMOVE"; const char* AI_CONFIG_PP_FD_REMOVE = "PP_FD_REMOVE";
@ -450,7 +491,7 @@ extern ( C ) {
* *
* Default value: false. * Default value: false.
* *
* Property type: integer (0: false; !0: true). * Property type: bool.
*/ */
const char* AI_CONFIG_FAVOUR_SPEED = "FAVOUR_SPEED"; const char* AI_CONFIG_FAVOUR_SPEED = "FAVOUR_SPEED";
@ -458,7 +499,7 @@ extern ( C ) {
/* /*
* Importer settings. * 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. * 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"; const char* AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL = "IMPORT_AC_SEPARATE_BFCULL";
@ -503,7 +544,7 @@ extern ( C ) {
* *
* Default value: true. * Default value: true.
* *
* Property type: integer (0: false; !0: true). * Property type: bool.
*/ */
const char* AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS = "UNREAL_HANDLE_FLAGS"; const char* AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS = "UNREAL_HANDLE_FLAGS";
@ -518,7 +559,7 @@ extern ( C ) {
* *
* Default value: false. * 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"; const char* AI_CONFIG_IMPORT_TER_MAKE_UVS = "IMPORT_TER_MAKE_UVS";
@ -530,12 +571,13 @@ extern ( C ) {
* *
* Default value: true. * 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"; 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, <code>lower.md3</code>, * These models usually consist of three files, <code>lower.md3</code>,
* <code>upper.md3</code> and <code>head.md3</code>. If this property is set * <code>upper.md3</code> and <code>head.md3</code>. If this property is set
@ -544,7 +586,7 @@ extern ( C ) {
* *
* Default value: true. * 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"; const char* AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART = "IMPORT_MD3_HANDLE_MULTIPART";
@ -610,7 +652,7 @@ extern ( C ) {
* *
* Default value: false. * 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"; const char* AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD = "IMPORT_MD5_NO_ANIM_AUTOLOAD";

View File

@ -51,8 +51,8 @@ import assimp.api;
import tango.io.Stdout; import tango.io.Stdout;
import tango.sys.SharedLib; import tango.sys.SharedLib;
const uint ASSIMP_BINDINGS_MAJOR = 1; const uint ASSIMP_BINDINGS_MAJOR = 2;
const uint ASSIMP_BINDINGS_MINOR = 1; const uint ASSIMP_BINDINGS_MINOR = 0;
/** /**
* Loader class for dynamically loading the Assimp library. * Loader class for dynamically loading the Assimp library.
@ -74,7 +74,11 @@ public:
static void load() { static void load() {
if ( m_sRefCount == 0 ) { if ( m_sRefCount == 0 ) {
version ( Posix ) { 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 ) { version ( Win32 ) {
m_sLibrary = SharedLib.load( "Assimp32.dll" ); m_sLibrary = SharedLib.load( "Assimp32.dll" );

View File

@ -49,6 +49,43 @@ import assimp.math;
import assimp.types; import assimp.types;
extern ( C ) { 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. * A single face in a mesh, referring to multiple vertices.
* *
@ -71,8 +108,9 @@ extern ( C ) {
*/ */
struct aiFace { struct aiFace {
/** /**
* Number of indices defining this face (3 for a triangle, >3 for a * Number of indices defining this face.
* polygon). *
* The maximum value for this member is <code>AI_MAX_FACE_INDICES</code>.
*/ */
uint mNumIndices; uint mNumIndices;
@ -116,6 +154,8 @@ extern ( C ) {
/** /**
* The number of vertices affected by this bone. * The number of vertices affected by this bone.
*
* The maximum value for this member is <code>AI_MAX_BONE_WEIGHTS</code>.
*/ */
uint mNumWeights; uint mNumWeights;
@ -133,30 +173,6 @@ extern ( C ) {
aiMatrix4x4 mOffsetMatrix; 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 <code>AI_MATKEY_UVWSRC_XXX</code> 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. * 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 // 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 // missing since there is probably not much use for it when just reading
// scene files. // 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 <code>aiAnimMesh</code> 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 (<code>aiMesh.mAnimMeshes</code>).
* 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 <code>aiMesh.mNormals</code>.
aiVector3D* mNormals;
/// Replacement for <code>aiMesh.mTangents</code>.
aiVector3D* mTangents;
/// Replacement for <code>aiMesh.mBitangents</code>.
aiVector3D* mBitangents;
/// Replacement for <code>aiMesh.mColors</code>.
aiColor4D* mColors[ AI_MAX_NUMBER_OF_COLOR_SETS ];
/// Replacement for <code>aiMesh.mTextureCoords</code>.
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. * A mesh represents a geometry or model with a single material.
@ -230,13 +298,16 @@ extern ( C ) {
/** /**
* The number of vertices in this mesh. * 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 <code>AI_MAX_VERTICES</code>.
*/ */
uint mNumVertices; uint mNumVertices;
/** /**
* The number of primitives (triangles, polygons, lines) in this mesh. * The number of primitives (triangles, polygons, lines) in this mesh.
* This is also the size of the <code>mFaces</code> array. *
* This is also the size of the <code>mFaces</code> array. The maximum
* value for this member is <code>AI_MAX_FACES</code>.
*/ */
uint mNumFaces; uint mNumFaces;
@ -363,5 +434,32 @@ extern ( C ) {
* index into the scene's material list. * index into the scene's material list.
*/ */
uint mMaterialIndex; 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;
} }
} }