Permalink
Browse files

Adding ASSIMP bindings

  • Loading branch information...
1 parent 31e1579 commit aba818267b687e562468e8a9324592c914995f8b @svenstaro svenstaro committed Apr 17, 2012
Showing with 729 additions and 0 deletions.
  1. +3 −0 build/derelict.d
  2. +113 −0 import/derelict/assimp/assimp.d
  3. +105 −0 import/derelict/assimp/functions.d
  4. +508 −0 import/derelict/assimp/types.d
View
@@ -68,6 +68,7 @@ enum packALURE = "DerelictALURE";
enum packFT = "DerelictFT";
enum packSDL2 = "DerelictSDL2";
enum packODE = "DerelictODE";
+enum packASSIMP = "DerelictASSIMP";
// Source paths
enum srcDerelict = "../import/derelict/";
@@ -80,6 +81,7 @@ enum srcALURE = srcDerelict ~ "alure/";
enum srcFT = srcDerelict ~ "freetype/";
enum srcSDL2 = srcDerelict ~ "sdl2/";
enum srcODE = srcDerelict ~ "ode/";
+enum srcASSIMP = srcDerelict ~ "assimp/";
// Map package names to source paths.
string[string] pathMap;
@@ -98,6 +100,7 @@ static this()
packFT : srcFT,
packSDL2 : srcSDL2,
packODE : srcODE,
+ packASSIMP : srcASSIMP,
];
}
@@ -0,0 +1,113 @@
+/*
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+module derelict.assimp.assimp;
+
+public
+{
+ import derelict.assimp.types;
+ import derelict.assimp.functions;
+}
+
+private
+{
+ import derelict.util.loader;
+ import derelict.util.system;
+
+ static if(Derelict_OS_Windows)
+ enum libNames = "assimp.dll";
+ else static if(Derelict_OS_Mac)
+ enum libNames = "libassimp.dylib";
+ else static if(Derelict_OS_Posix)
+ enum libNames = "libassimp.so, libassimp.so.2, libassimp.so.2.0.0";
+ else
+ static assert(0, "Need to implement ASSIMP libNames for this operating system.");
+}
+
+class DerelictASSIMPLoader : SharedLibLoader
+{
+
+ protected
+ {
+ override void loadSymbols()
+ {
+ bindFunc(cast(void**)&aiImportFile, "aiImportFile");
+ bindFunc(cast(void**)&aiImportFileEx, "aiImportFileEx");
+ bindFunc(cast(void**)&aiImportFileFromMemory, "aiImportFileFromMemory");
+ bindFunc(cast(void**)&aiApplyPostProcessing, "aiApplyPostProcessing");
+ bindFunc(cast(void**)&aiGetPredefinedLogStream, "aiGetPredefinedLogStream");
+ bindFunc(cast(void**)&aiAttachLogStream, "aiAttachLogStream");
+ bindFunc(cast(void**)&aiEnableVerboseLogging, "aiEnableVerboseLogging");
+ bindFunc(cast(void**)&aiDetachLogStream, "aiDetachLogStream");
+ bindFunc(cast(void**)&aiDetachAllLogStreams, "aiDetachAllLogStreams");
+ bindFunc(cast(void**)&aiReleaseImport, "aiReleaseImport");
+ bindFunc(cast(void**)&aiGetErrorString, "aiGetErrorString");
+ bindFunc(cast(void**)&aiIsExtensionSupported, "aiIsExtensionSupported");
+ bindFunc(cast(void**)&aiGetExtensionList, "aiGetExtensionList");
+ bindFunc(cast(void**)&aiGetMemoryRequirements, "aiGetMemoryRequirements");
+ bindFunc(cast(void**)&aiSetImportPropertyInteger, "aiSetImportPropertyInteger");
+ bindFunc(cast(void**)&aiSetImportPropertyFloat, "aiSetImportPropertyFloat");
+ bindFunc(cast(void**)&aiSetImportPropertyString, "aiSetImportPropertyString");
+ bindFunc(cast(void**)&aiCreateQuaternionFromMatrix, "aiCreateQuaternionFromMatrix");
+ bindFunc(cast(void**)&aiDecomposeMatrix, "aiDecomposeMatrix");
+ bindFunc(cast(void**)&aiTransposeMatrix4, "aiTransposeMatrix4");
+ bindFunc(cast(void**)&aiTransposeMatrix3, "aiTransposeMatrix3");
+ bindFunc(cast(void**)&aiTransformVecByMatrix3, "aiTransformVecByMatrix3");
+ bindFunc(cast(void**)&aiTransformVecByMatrix4, "aiTransformVecByMatrix4");
+ bindFunc(cast(void**)&aiMultiplyMatrix4, "aiMultiplyMatrix4");
+ bindFunc(cast(void**)&aiMultiplyMatrix3, "aiMultiplyMatrix3");
+ bindFunc(cast(void**)&aiIdentityMatrix3, "aiIdentityMatrix3");
+ bindFunc(cast(void**)&aiIdentityMatrix4, "aiIdentityMatrix4");
+ bindFunc(cast(void**)&aiGetLegalString, "aiGetLegalString");
+ bindFunc(cast(void**)&aiGetVersionMinor, "aiGetVersionMinor");
+ bindFunc(cast(void**)&aiGetVersionMajor, "aiGetVersionMajor");
+ bindFunc(cast(void**)&aiGetVersionRevision, "aiGetVersionRevision");
+ bindFunc(cast(void**)&aiGetCompileFlags, "aiGetCompileFlags");
+ }
+ }
+
+ public
+ {
+ this()
+ {
+ super(libNames);
+ }
+ }
+}
+
+__gshared DerelictASSIMPLoader DerelictASSIMP;
+
+shared static this()
+{
+ DerelictASSIMP = new DerelictASSIMPLoader();
+}
+
+shared static ~this()
+{
+ if(SharedLibLoader.isAutoUnloadEnabled())
+ DerelictASSIMP.unload();
+}
@@ -0,0 +1,105 @@
+/*
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+module derelict.assimp.functions;
+
+private
+{
+ import derelict.assimp.types;
+}
+
+extern(C)
+{
+ alias nothrow const aiScene* function(const char*, uint) da_aiImportFile;
+ alias nothrow const aiScene* function(const char*, uint, aiFileIO*) da_aiImportFileEx;
+ alias nothrow const aiScene* function(const char*, uint, uint, const char*) da_aiImportFileFromMemory;
+ alias nothrow const aiScene* function(const aiScene*, uint) da_aiApplyPostProcessing;
+ alias nothrow aiLogStream function(aiDefaultLogStream, const char*) da_aiGetPredefinedLogStream;
+ alias nothrow void function(const aiLogStream*) da_aiAttachLogStream;
+ alias nothrow void function(aiBool) da_aiEnableVerboseLogging;
+ alias nothrow aiReturn function(const aiLogStream*) da_aiDetachLogStream;
+ alias nothrow void function() da_aiDetachAllLogStreams;
+ alias nothrow void function(const aiScene*) da_aiReleaseImport;
+ alias nothrow const char* function() da_aiGetErrorString;
+ alias nothrow aiBool function(const char*) da_aiIsExtensionSupported;
+ alias nothrow void function(aiString*) da_aiGetExtensionList;
+ alias nothrow void function(const aiScene*, aiMemoryInfo*) da_aiGetMemoryRequirements;
+ alias nothrow void function(const char*, int) da_aiSetImportPropertyInteger;
+ alias nothrow void function(const char*, float) da_aiSetImportPropertyFloat;
+ alias nothrow void function(const char*, const aiString*) da_aiSetImportPropertyString;
+ alias nothrow void function(aiQuaternion*, const aiMatrix3x3*) da_aiCreateQuaternionFromMatrix;
+ alias nothrow void function(const aiMatrix4x4*, aiVector3D*, aiQuaternion*, aiVector3D*) da_aiDecomposeMatrix;
+ alias nothrow void function(aiMatrix4x4*) da_aiTransposeMatrix4;
+ alias nothrow void function(aiMatrix3x3*) da_aiTransposeMatrix3;
+ alias nothrow void function(aiVector3D*, const aiMatrix3x3*) da_aiTransformVecByMatrix3;
+ alias nothrow void function(aiVector3D*, const aiMatrix4x4*) da_aiTransformVecByMatrix4;
+ alias nothrow void function(aiMatrix4x4*) da_aiMultiplyMatrix4;
+ alias nothrow void function(aiMatrix3x3*) da_aiMultiplyMatrix3;
+ alias nothrow void function(aiMatrix3x3*) da_aiIdentityMatrix3;
+ alias nothrow void function(aiMatrix4x4*) da_aiIdentityMatrix4;
+ alias nothrow const char* function() da_aiGetLegalString;
+ alias nothrow uint function() da_aiGetVersionMinor;
+ alias nothrow uint function() da_aiGetVersionMajor;
+ alias nothrow uint function() da_aiGetVersionRevision;
+ alias nothrow uint function() da_aiGetCompileFlags;
+}
+
+__gshared
+{
+ da_aiImportFile aiImportFile;
+ da_aiImportFileEx aiImportFileEx;
+ da_aiImportFileFromMemory aiImportFileFromMemory;
+ da_aiApplyPostProcessing aiApplyPostProcessing;
+ da_aiGetPredefinedLogStream aiGetPredefinedLogStream;
+ da_aiAttachLogStream aiAttachLogStream;
+ da_aiEnableVerboseLogging aiEnableVerboseLogging;
+ da_aiDetachLogStream aiDetachLogStream;
+ da_aiDetachAllLogStreams aiDetachAllLogStreams;
+ da_aiReleaseImport aiReleaseImport;
+ da_aiGetErrorString aiGetErrorString;
+ da_aiIsExtensionSupported aiIsExtensionSupported;
+ da_aiGetExtensionList aiGetExtensionList;
+ da_aiGetMemoryRequirements aiGetMemoryRequirements;
+ da_aiSetImportPropertyInteger aiSetImportPropertyInteger;
+ da_aiSetImportPropertyFloat aiSetImportPropertyFloat;
+ da_aiSetImportPropertyString aiSetImportPropertyString;
+ da_aiCreateQuaternionFromMatrix aiCreateQuaternionFromMatrix;
+ da_aiDecomposeMatrix aiDecomposeMatrix;
+ da_aiTransposeMatrix4 aiTransposeMatrix4;
+ da_aiTransposeMatrix3 aiTransposeMatrix3;
+ da_aiTransformVecByMatrix3 aiTransformVecByMatrix3;
+ da_aiTransformVecByMatrix4 aiTransformVecByMatrix4;
+ da_aiMultiplyMatrix4 aiMultiplyMatrix4;
+ da_aiMultiplyMatrix3 aiMultiplyMatrix3;
+ da_aiIdentityMatrix3 aiIdentityMatrix3;
+ da_aiIdentityMatrix4 aiIdentityMatrix4;
+ da_aiGetLegalString aiGetLegalString;
+ da_aiGetVersionMinor aiGetVersionMinor;
+ da_aiGetVersionMajor aiGetVersionMajor;
+ da_aiGetVersionRevision aiGetVersionRevision;
+ da_aiGetCompileFlags aiGetCompileFlags;
+}
Oops, something went wrong.

0 comments on commit aba8182

Please sign in to comment.