Browse Source

add some #ifdefs for SWIG
fixed a compile error in DefaultIOSystem
add swig-script


git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@546 67173fc5-114c-0410-ac8e-9d2fd5bffc1f

rave3d 15 years ago
parent
commit
52228add3a

+ 1 - 1
code/DefaultIOSystem.cpp

@@ -130,7 +130,7 @@ bool IOSystem::ComparePaths (const char* one, const char* second) const
 // Convert a relative path into an absolute path
 inline void MakeAbsolutePath (const char* in, char* _out)
 {
-	ai_assert(in & _out);
+	ai_assert(in && _out);
 	char* ret;
 #ifdef _WIN32
 	ret = ::_fullpath(_out, in,PATHLIMIT);

+ 2 - 0
include/aiAnim.h

@@ -166,7 +166,9 @@ enum aiAnimBehaviour
 
 	/** This value is not used, it is just here to force the
 	 *  the compiler to map this enum to a 32 Bit integer  */
+#ifndef SWIG
 	_aiAnimBehaviour_Force32Bit = 0x8fffffff
+#endif
 };
 
 // ---------------------------------------------------------------------------

+ 10 - 0
include/aiConfig.h

@@ -259,10 +259,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 enum aiComponent
 {
 	/** Normal vectors */
+#ifdef SWIG
+	aiComponent_NORMALS = 0x2,
+#else
 	aiComponent_NORMALS = 0x2u,
+#endif
 
 	/** Tangents and bitangents go always together ... */
+#ifdef SWIG
+	aiComponent_TANGENTS_AND_BITANGENTS = 0x4,
+#else
 	aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,
+#endif
 
 	/** ALL color sets
 	 * Use aiComponent_COLORn(N) to specify the N'th set */
@@ -305,7 +313,9 @@ enum aiComponent
 
 	/** This value is not used. It is just there to force the
 	 *  compiler to map this enum to a 32 Bit integer. */
+#ifndef SWIG
 	_aiComponent_Force32Bit = 0x9fffffff
+#endif
 };
 
 // Remove a specific color channel 'n'

+ 2 - 0
include/aiLight.h

@@ -79,7 +79,9 @@ enum aiLightSourceType
 	/** This value is not used. It is just there to force the
 	 *  compiler to map this enum to a 32 Bit integer.
 	 */
+#ifndef SWIG
 	_aiLightSource_Force32Bit = 0x9fffffff
+#endif
 };
 
 // ---------------------------------------------------------------------------

+ 18 - 2
include/aiMaterial.h

@@ -100,7 +100,9 @@ enum aiTextureOp
 	 *  This value is not used. It forces the compiler to use at least
 	 *  32 Bit integers to represent this enum.
 	 */
+#ifndef SWIG
 	_aiTextureOp_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -134,7 +136,9 @@ enum aiTextureMapMode
 	  *  This value is not used. It forces the compiler to use at least
 	  *  32 Bit integers to represent this enum.
 	  */
+#ifndef SWIG
 	_aiTextureMapMode_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -177,7 +181,9 @@ enum aiTextureMapping
 	  *  This value is not used. It forces the compiler to use at least
 	  *  32 Bit integers to represent this enum.
 	  */
+#ifndef SWIG
 	_aiTextureMapping_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -295,7 +301,9 @@ enum aiTextureType
 	  *  This value is not used. It forces the compiler to use at least
 	  *  32 Bit integers to represent this enum.
 	  */
+#ifndef SWIG
 	_aiTextureType_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -371,7 +379,9 @@ enum aiShadingMode
 	  *  This value is not used. It forces the compiler to use at least
 	  *  32 Bit integers to represent this enum.
 	  */
+#ifndef SWIG
 	_aiShadingMode_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -415,7 +425,9 @@ enum aiTextureFlags
 	  *  This value is not used. It forces the compiler to use at least
 	  *  32 Bit integers to represent this enum.
 	  */
-	_aiTextureFlags_Force32Bit = 0x9fffffff
+#ifndef SWIG
+	  _aiTextureFlags_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -462,7 +474,9 @@ enum aiBlendMode
 	  *  This value is not used. It forces the compiler to use at least
 	  *  32 Bit integers to represent this enum.
 	  */
+#ifndef SWIG
 	_aiBlendMode_Force32Bit = 0x9fffffff
+#endif
 	//! @endcond
 };
 
@@ -554,7 +568,9 @@ enum aiPropertyTypeInfo
 	 /** This value is not used. It is just there to force the
 	 *  compiler to map this enum to a 32 Bit integer.
 	 */
-	_aiPTI_Force32Bit = 0x9fffffff
+#ifndef SWIG
+	 _aiPTI_Force32Bit = 0x9fffffff
+#endif
 };
 
 // ---------------------------------------------------------------------------

+ 2 - 0
include/aiMesh.h

@@ -293,7 +293,9 @@ enum aiPrimitiveType
 	/** This value is not used. It is just here to force the
 	 *  compiler to map this enum to a 32 Bit integer.
 	 */
+#ifndef SWIG
 	_aiPrimitiveType_Force32Bit = 0x9fffffff
+#endif
 }; //! enum aiPrimitiveType
 
 // Get the #aiPrimitiveType flag for a specific number of face indices

+ 27 - 0
port/Assimp.NET/Assimp.NET.sln

@@ -5,6 +5,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Assimp.NET", "Assimp.NET\As
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssimpNetDemo", "AssimpNetDemo\AssimpNetDemo.csproj", "{76085EBB-B11E-4C2B-82C7-47A781D2B4BE}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Assimp.NET_SWIG", "Assimp.NET_SWIG\Assimp.NET_SWIG.vcproj", "{521DD721-C184-412B-AA80-0E741F2FDD4F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assimp.NET_SWIG_CS", "Assimp.NET_SWIG_CS\Assimp.NET_SWIG_CS.csproj", "{D88CA6D2-F511-4BAA-99FF-38E12380E58D}"
+	ProjectSection(ProjectDependencies) = postProject
+		{521DD721-C184-412B-AA80-0E741F2FDD4F} = {521DD721-C184-412B-AA80-0E741F2FDD4F}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -35,6 +42,26 @@ Global
 		{76085EBB-B11E-4C2B-82C7-47A781D2B4BE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
 		{76085EBB-B11E-4C2B-82C7-47A781D2B4BE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{76085EBB-B11E-4C2B-82C7-47A781D2B4BE}.Release|Win32.ActiveCfg = Release|Any CPU
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Debug|Any CPU.ActiveCfg = Debug|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Debug|Win32.Build.0 = Debug|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Release|Any CPU.ActiveCfg = Release|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Release|Mixed Platforms.Build.0 = Release|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Release|Win32.ActiveCfg = Release|Win32
+		{521DD721-C184-412B-AA80-0E741F2FDD4F}.Release|Win32.Build.0 = Release|Win32
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{D88CA6D2-F511-4BAA-99FF-38E12380E58D}.Release|Win32.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 5 - 0
port/Assimp.NET/Assimp.NET/Animation.h

@@ -49,6 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 using namespace System;
 
+#pragma managed
+
 namespace AssimpNET
 {
 	public ref class Animation
@@ -121,3 +123,6 @@ namespace AssimpNET
 	};
 }//namespace
 
+
+
+

+ 81 - 0
scripts/SWIG_WIP/AssimpSwigPort.i

@@ -0,0 +1,81 @@
+/* File : example.i */
+%module(directors="1") AssimpNET_SWIG
+%{
+//#include "..\..\..\include\aiAssert.h"
+#include "..\..\..\include\aiDefines.h"
+#include "..\..\..\include\aiConfig.h"
+#include "..\..\..\include\aiTypes.h"
+#include "..\..\..\include\aiVersion.h"
+#include "..\..\..\include\aiPostProcess.h"
+#include "..\..\..\include\aiVector2D.h"
+#include "..\..\..\include\aiVector3D.h"
+#include "..\..\..\include\aiMatrix3x3.h"
+#include "..\..\..\include\aiMatrix4x4.h"
+#include "..\..\..\include\aiCamera.h"
+#include "..\..\..\include\aiLight.h"
+#include "..\..\..\include\aiAnim.h"
+#include "..\..\..\include\aiMesh.h"
+#include "..\..\..\include\aiFileIO.h"
+//#include "..\..\..\include\aiMaterial.h"
+#include "..\..\..\include\aiQuaternion.h"
+#include "..\..\..\include\aiScene.h"
+#include "..\..\..\include\aiTexture.h"
+#include "..\..\..\include\assimp.hpp"
+#include "..\..\..\include\IOSystem.h"
+#include "..\..\..\include\IOStream.h"
+#include "..\..\..\include\Logger.h"
+#include "..\..\..\include\LogStream.h"
+#include "..\..\..\include\NullLogger.h"
+%}
+
+#define C_STRUCT
+#define C_ENUM
+#define ASSIMP_API
+#define PACK_STRUCT
+
+%rename(__add__) operator+;
+%rename(__addnset__) operator+=;
+%rename(__sub__) operator-;
+%rename(__subnset__) operator-=;
+%rename(__mul__) operator*;
+%rename(__mulnset__) operator*=;
+%rename(__div__) operator/;
+%rename(__divnset__) operator/=;
+%rename(__equal__) operator==;
+%rename(__nequal__) operator!=;
+%rename(__idx__) operator[];
+%rename(__set__) operator=;
+%rename(__greater__) operator>;
+%rename(__smaller__) operator<;
+
+%include "std_string.i"
+
+//%include "..\..\..\include\aiAssert.h"
+%include "..\..\..\include\aiDefines.h"
+%include "..\..\..\include\aiConfig.h"
+%include "..\..\..\include\aiTypes.h"
+%include "..\..\..\include\aiVersion.h"
+%include "..\..\..\include\aiPostProcess.h"
+%include "..\..\..\include\aiVector2D.h"
+%include "..\..\..\include\aiVector3D.h"
+%include "..\..\..\include\aiMatrix3x3.h"
+%include "..\..\..\include\aiMatrix4x4.h"
+%include "..\..\..\include\aiCamera.h"
+%include "..\..\..\include\aiLight.h"
+%include "..\..\..\include\aiAnim.h"
+%include "..\..\..\include\aiMesh.h"
+%include "..\..\..\include\aiFileIO.h"
+//%include "..\..\..\include\aiMaterial.h"
+%include "..\..\..\include\aiQuaternion.h"
+%include "..\..\..\include\aiScene.h"
+%include "..\..\..\include\aiTexture.h"
+%include "..\..\..\include\assimp.hpp"
+%include "..\..\..\include\IOSystem.h"
+%include "..\..\..\include\IOStream.h"
+%include "..\..\..\include\Logger.h"
+%include "..\..\..\include\LogStream.h"
+%include "..\..\..\include\NullLogger.h"
+
+
+
+