فهرست منبع

Refactoring ... added documentation, simplified some parts of the code and migrated some class declarations in separate files.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@100 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 17 سال پیش
والد
کامیت
6fe8c867e8

+ 1 - 1
code/ASELoader.cpp

@@ -473,7 +473,7 @@ void ASEImporter::BuildNodes()
 			aiNode* pcNode = new aiNode();
 			pcNode->mParent = pcScene->mRootNode;
 			pcNode->mName.Set(szMyName[1]);
-			this->AddNodes(pcScene,pcNode,pcNode->mName.data);
+			this->AddNodes(pcNode,pcNode->mName.data);
 			apcNodes.push_back(pcNode);
 		}
 		pcScene->mRootNode->mChildren = new aiNode*[apcNodes.size()];

+ 2 - 2
code/Assimp.cpp

@@ -184,7 +184,7 @@ void aiGetExtensionList(aiString* szOut)
 }
 // ------------------------------------------------------------------------------------------------
 void aiGetMemoryRequirements(const C_STRUCT aiScene* pIn,
-	C_STRUCT aiMemoryInfo* in);
+	C_STRUCT aiMemoryInfo* in)
 {
 // lock the mutex
 #if (defined AI_C_THREADSAFE)
@@ -198,7 +198,7 @@ void aiGetMemoryRequirements(const C_STRUCT aiScene* pIn,
 	{
 		DefaultLogger::get()->error("Unable to find the Importer instance for this scene. "
 			"Are you sure it has been created by aiImportFile(ex)(...)?");
-		return 0;
+		return;
 	}
 	// get memory statistics
 	it->second->GetMemoryRequirements(*in);

+ 5 - 24
code/BaseImporter.cpp

@@ -39,9 +39,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ---------------------------------------------------------------------------
 */
 
-/** @file Implementation of the few default functions of the base importer class */
+/** @file Implementation of BaseImporter */
 #include "BaseImporter.h"
-#include "BaseProcess.h"
 
 #include "../include/DefaultLogger.h"
 #include "../include/aiScene.h"
@@ -68,7 +67,7 @@ BaseImporter::~BaseImporter()
 aiScene* BaseImporter::ReadFile( const std::string& pFile, IOSystem* pIOHandler)
 {
 	// create a scene object to hold the data
-	aiScene* scene = new aiScene;
+	aiScene* scene = new aiScene();
 
 	// dispatch importing
 	try
@@ -93,26 +92,8 @@ aiScene* BaseImporter::ReadFile( const std::string& pFile, IOSystem* pIOHandler)
 }
 
 // ------------------------------------------------------------------------------------------------
-void BaseProcess::ExecuteOnScene( Importer* pImp)
+void BaseImporter::SetupProperties(const Importer* pImp)
 {
-	ai_assert(NULL != pImp && NULL != pImp->mScene);
-
-	// catch exceptions thrown inside the PostProcess-Step
-	try
-	{
-		this->Execute(pImp->mScene);
-
-	} catch( ImportErrorException* exception)
-	{
-		// extract error description
-		pImp->mErrorString = exception->GetErrorText();
-
-		DefaultLogger::get()->error(pImp->mErrorString);
-
-		delete exception;
-
-		// and kill the partially imported data
-		delete pImp->mScene;
-		pImp->mScene = NULL;
-	}
+	// the default implementation does nothing
 }
+

+ 8 - 0
code/BaseImporter.h

@@ -137,6 +137,14 @@ public:
 	inline const std::string& GetErrorText() const 
 		{ return mErrorText; }
 
+
+	// -------------------------------------------------------------------
+	/** Called prior to ReadFile().
+	* The function is a request to the importer to update its configuration
+	* basing on the Importer's configuration property list.
+	*/
+	virtual void SetupProperties(const Importer* pImp);
+
 protected:
 
 	// -------------------------------------------------------------------

+ 94 - 0
code/BaseProcess.cpp

@@ -0,0 +1,94 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (ASSIMP)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2008, ASSIMP Development Team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, 
+with or without modification, are permitted provided that the following 
+conditions are met:
+
+* Redistributions of source code must retain the above
+  copyright notice, this list of conditions and the
+  following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the
+  following disclaimer in the documentation and/or other
+  materials provided with the distribution.
+
+* Neither the name of the ASSIMP team, nor the names of its
+  contributors may be used to endorse or promote products
+  derived from this software without specific prior
+  written permission of the ASSIMP Development Team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
+
+/** @file Implementation of BaseProcess */
+#include "BaseImporter.h"
+#include "BaseProcess.h"
+
+#include "../include/DefaultLogger.h"
+#include "../include/aiScene.h"
+#include "../include/aiAssert.h"
+#include "../include/assimp.hpp"
+using namespace Assimp;
+
+// ------------------------------------------------------------------------------------------------
+// Constructor to be privately used by Importer
+BaseProcess::BaseProcess()
+{
+	// nothing to do here
+}
+
+// ------------------------------------------------------------------------------------------------
+// Destructor, private as well
+BaseProcess::~BaseProcess()
+{
+	// nothing to do here
+}
+
+// ------------------------------------------------------------------------------------------------
+void BaseProcess::ExecuteOnScene( Importer* pImp)
+{
+	ai_assert(NULL != pImp && NULL != pImp->mScene);
+
+	// catch exceptions thrown inside the PostProcess-Step
+	try
+	{
+		this->Execute(pImp->mScene);
+
+	} catch( ImportErrorException* exception)
+	{
+		// extract error description
+		pImp->mErrorString = exception->GetErrorText();
+		DefaultLogger::get()->error(pImp->mErrorString);
+
+		delete exception;
+
+		// and kill the partially imported data
+		delete pImp->mScene;
+		pImp->mScene = NULL;
+	}
+}
+
+// ------------------------------------------------------------------------------------------------
+void BaseProcess::SetupProperties(const Importer* pImp)
+{
+	// the default implementation does nothing
+}

+ 21 - 19
code/BaseProcess.h

@@ -53,17 +53,19 @@ namespace Assimp
 // ---------------------------------------------------------------------------
 /** The BaseProcess defines a common interface for all post processing steps.
  * A post processing step is run after a successful import if the caller
- * specified the corresponding flag when calling ReadFile(). Enum #aiPostProcessSteps
- * defines which flags are available. 
- * After a successful import the Importer iterates over its internal array of processes
- * and calls IsActive() on each process to evaluate if the step should be executed.
- * If the function returns true, the class' Execute() function is called subsequently.
+ * specified the corresponding flag when calling ReadFile(). 
+ * Enum #aiPostProcessSteps defines which flags are available. 
+ * After a successful import the Importer iterates over its internal array 
+ * of processes and calls IsActive() on each process to evaluate if the step 
+ * should be executed. If the function returns true, the class' Execute() 
+ * function is called subsequently.
  */
-class ASSIMP_API BaseProcess
+class ASSIMP_API BaseProcess 
 {
 	friend class Importer;
 
 public:
+
 	/** Constructor to be privately used by Importer */
 	BaseProcess();
 
@@ -71,11 +73,13 @@ public:
 	virtual ~BaseProcess();
 
 public:
+
 	// -------------------------------------------------------------------
-	/** Returns whether the processing step is present in the given flag field.
-	 * @param pFlags The processing flags the importer was called with. A bitwise
-	 *   combination of #aiPostProcessSteps.
-	 * @return true if the process is present in this flag fields, false if not.
+	/** Returns whether the processing step is present in the given flag.
+	 * @param pFlags The processing flags the importer was called with. A
+	 *   bitwise combination of #aiPostProcessSteps.
+	 * @return true if the process is present in this flag fields, 
+	 *   false if not.
 	*/
 	virtual bool IsActive( unsigned int pFlags) const = 0;
 
@@ -87,6 +91,13 @@ public:
 	*/
 	void ExecuteOnScene( Importer* pImp);
 
+	// -------------------------------------------------------------------
+	/** Called prior to ExecuteOnScene().
+	* The function is a request to the process to update its configuration
+	* basing on the Importer's configuration property list.
+	*/
+	virtual void SetupProperties(const Importer* pImp);
+
 	// -------------------------------------------------------------------
 	/** Executes the post processing step on the given imported data.
 	* A process should throw an ImportErrorException* if it fails.
@@ -96,15 +107,6 @@ public:
 	virtual void Execute( aiScene* pScene) = 0;
 };
 
-/** Constructor, dummy implementation to keep the compiler from complaining */
-inline BaseProcess::BaseProcess()
-{
-}
-
-/** Destructor */
-inline BaseProcess::~BaseProcess()
-{
-}
 
 } // end of namespace Assimp
 

+ 15 - 27
code/Importer.cpp

@@ -100,9 +100,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #if (!defined AI_BUILD_NO_MD5_IMPORTER)
 #	include "MD5Loader.h"
 #endif
-#if (!defined AI_BUILD_NO_MD5_IMPORTER)
-#	include "MD5Loader.h"
-#endif
 #if (!defined AI_BUILD_NO_STL_IMPORTER)
 #	include "STLLoader.h"
 #endif
@@ -266,21 +263,6 @@ Importer::Importer() :
 #if (!defined AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
 	mPostProcessingSteps.push_back( new ImproveCacheLocalityProcess());
 #endif
-
-	//// store the *this* pointer in all BaseImporter instances
-	//for (std::vector<BaseImporter*>::iterator
-	//	i =  mImporter.begin();
-	//	i != mImporter.end();++i)
-	//{
-	//	(**i).mImporter = this;
-	//}
-	//// store the *this* pointer in all BaseProcess instances
-	//for (std::vector<BaseProcess*>::iterator
-	//	i =  mPostProcessingSteps.begin();
-	//	i != mPostProcessingSteps.end();++i)
-	//{
-	//	(**i).mImporter = this;
-	//}
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -327,6 +309,7 @@ bool Importer::IsDefaultIOHandler()
 {
 	return mIsDefaultHandler;
 }
+#ifdef _DEBUG
 // ------------------------------------------------------------------------------------------------
 // Validate post process step flags 
 bool ValidateFlags(unsigned int pFlags)
@@ -341,6 +324,7 @@ bool ValidateFlags(unsigned int pFlags)
 
 	return true;
 }
+#endif // ! DEBUG
 // ------------------------------------------------------------------------------------------------
 // Reads the given file and returns its contents if successful. 
 const aiScene* Importer::ReadFile( const std::string& pFile, unsigned int pFlags)
@@ -384,11 +368,13 @@ const aiScene* Importer::ReadFile( const std::string& pFile, unsigned int pFlags
 	}
 
 	// dispatch the reading to the worker class for this format
+	imp->SetupProperties( this );
 	mScene = imp->ReadFile( pFile, mIOHandler);
 	
 	// if successful, apply all active post processing steps to the imported data
 	if( mScene)
 	{
+#ifdef _DEBUG
 		if (bExtraVerbose)
 		{
 			pFlags |= aiProcess_ValidateDataStructure;
@@ -397,15 +383,17 @@ const aiScene* Importer::ReadFile( const std::string& pFile, unsigned int pFlags
 			// TODO: temporary solution, clean up later
 			mScene->mFlags |= 0x80000000; 
 		}
+#endif // ! DEBUG
 		for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++)
 		{
 			BaseProcess* process = mPostProcessingSteps[a];
 			if( process->IsActive( pFlags))
 			{
-				process->ExecuteOnScene( this );
+				process->SetupProperties( this );
+				process->ExecuteOnScene	( this );
 			}
-			if( !mScene)break; // error string has already been set ...
-
+			if( !mScene)break; 
+#ifdef _DEBUG
 			// if the extra verbose mode is active execute the
 			// VaidateDataStructureStep again after each step
 			if (bExtraVerbose && a)
@@ -415,18 +403,18 @@ const aiScene* Importer::ReadFile( const std::string& pFile, unsigned int pFlags
 				if( !mScene)
 				{
 					DefaultLogger::get()->error("Extra verbose: failed to revalidate data structures");
-					break; // error string has already been set ...
+					break; 
 				}
 			}
+#endif // ! DEBUG
 		}
+#ifdef _DEBUG
 		if (bExtraVerbose)mScene->mFlags &= ~0x80000000; 
+#endif // ! DEBUG
 	}
 
 	// if failed, extract the error string
-	else if( !mScene)
-	{
-		mErrorString = imp->GetErrorText();
-	}
+	else if( !mScene)mErrorString = imp->GetErrorText();
 
 	// either successful or failure - the pointer expresses it anyways
 	return mScene;
@@ -497,7 +485,7 @@ int Importer::SetProperty(const char* szName, int iValue)
 // ------------------------------------------------------------------------------------------------
 // Get a configuration property
 int Importer::GetProperty(const char* szName, 
-	int iErrorReturn /*= 0xffffffff*/)
+	int iErrorReturn /*= 0xffffffff*/) const
 {
 	ai_assert(NULL != szName);
 

+ 13 - 18
code/LimitBoneWeightsProcess.cpp

@@ -49,29 +49,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "../include/aiMesh.h"
 #include "../include/aiScene.h"
 #include "../include/aiAssert.h"
+#include "../include/assimp.hpp"
 #include "../include/DefaultLogger.h"
 
 using namespace Assimp;
 
 
-/*static*/ unsigned int LimitBoneWeightsProcess::mMaxWeights = AI_LMW_MAX_WEIGHTS;
-
-extern "C" {
-// ------------------------------------------------------------------------------------------------
-aiReturn aiSetBoneWeightLimit(unsigned int pLimit)
-{
-	if (0 == pLimit)
-	{
-		LimitBoneWeightsProcess::mMaxWeights = 0xFFFFFFFF;
-		return AI_FAILURE;
-	}
-
-	LimitBoneWeightsProcess::mMaxWeights = pLimit;
-	DefaultLogger::get()->debug("aiSetBoneWeightLimit() - bone weight limit was changed");
-	return AI_SUCCESS;
-}
-};
-
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 LimitBoneWeightsProcess::LimitBoneWeightsProcess()
@@ -100,6 +83,18 @@ void LimitBoneWeightsProcess::Execute( aiScene* pScene)
 		ProcessMesh( pScene->mMeshes[a]);
 }
 
+// ------------------------------------------------------------------------------------------------
+// Executes the post processing step on the given imported data.
+void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp)
+{
+	// get the current value of the property
+	if(0xffffffff == (this->mMaxWeights = pImp->GetProperty(
+		AI_CONFIG_PP_LBW_MAX_WEIGHTS,0xffffffff)))
+	{
+		this->mMaxWeights = AI_LMW_MAX_WEIGHTS;
+	}
+}
+
 // ------------------------------------------------------------------------------------------------
 // Unites identical vertices in the given mesh
 void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh)

+ 25 - 7
code/LimitBoneWeightsProcess.h

@@ -91,35 +91,53 @@ public:
 	bool IsActive( unsigned int pFlags) const;
 
 	// -------------------------------------------------------------------
-	/** Executes the post processing step on the given imported data.
-	* At the moment a process is not supposed to fail.
-	* @param pScene The imported data to work at.
+	/** Called prior to ExecuteOnScene().
+	* The function is a request to the process to update its configuration
+	* basing on the Importer's configuration property list.
 	*/
-	void Execute( aiScene* pScene);
+	virtual void SetupProperties(const Importer* pImp);
 
 protected:
+
 	// -------------------------------------------------------------------
 	/** Limits the bone weight count for all vertices in the given mesh.
 	* @param pMesh The mesh to process.
 	*/
 	void ProcessMesh( aiMesh* pMesh);
 
+	// -------------------------------------------------------------------
+	/** Executes the post processing step on the given imported data.
+	* At the moment a process is not supposed to fail.
+	* @param pScene The imported data to work at.
+	*/
+	void Execute( aiScene* pScene);
+
+
 protected:
+
+	// -------------------------------------------------------------------
 	/** Describes a bone weight on a vertex */
 	struct Weight
 	{
 		unsigned int mBone; ///< Index of the bone
 		float mWeight;      ///< Weight of that bone on this vertex
 		Weight() { }
-		Weight( unsigned int pBone, float pWeight) { mBone = pBone; mWeight = pWeight; }
+		Weight( unsigned int pBone, float pWeight) 
+		{
+			mBone = pBone; 
+			mWeight = pWeight; 
+		}
 
 		/** Comparision operator to sort bone weights by descending weight */
-		bool operator < (const Weight& pWeight) const { return mWeight > pWeight.mWeight; }
+		bool operator < (const Weight& pWeight) const
+		{ 
+			return mWeight > pWeight.mWeight;
+		}
 	};
 
 public:
 	/** Maximum number of bones influencing any single vertex. */
-	static unsigned int mMaxWeights;
+	unsigned int mMaxWeights;
 };
 
 } // end of namespace Assimp

+ 12 - 9
code/SMDLoader.cpp

@@ -105,6 +105,18 @@ bool SMDImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler) const
 	return true;
 }
 // ------------------------------------------------------------------------------------------------
+// Setup configuration properties
+void SMDImporter::SetupProperties(const Importer* pImp)
+{
+	// The AI_CONFIG_IMPORT_SMD_KEYFRAME option overrides the
+	// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
+	if(0xffffffff == (this->configFrameID = pImp->GetProperty(
+		AI_CONFIG_IMPORT_SMD_KEYFRAME,0xffffffff)))
+	{
+		this->configFrameID = pImp->GetProperty(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
+	}
+}
+// ------------------------------------------------------------------------------------------------
 // Imports the given file into the given scene structure. 
 void SMDImporter::InternReadFile( 
 	const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
@@ -139,15 +151,6 @@ void SMDImporter::InternReadFile(
 	// reserve enough space for ... hm ... 20 bones
 	this->asBones.reserve(20);
 
-	// The AI_CONFIG_IMPORT_SMD_KEYFRAME option overrides the
-	// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
-	if(0xffffffff == (this->configFrameID = this->mImporter->GetProperty(
-		AI_CONFIG_IMPORT_SMD_KEYFRAME,0xffffffff)))
-	{
-		this->configFrameID = this->mImporter->GetProperty(
-			AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
-	}
-
 	try
 	{
 		// parse the file ...

+ 7 - 0
code/SMDLoader.h

@@ -189,6 +189,13 @@ public:
 	* See BaseImporter::CanRead() for details.	*/
 	bool CanRead( const std::string& pFile, IOSystem* pIOHandler) const;
 
+	// -------------------------------------------------------------------
+	/** Called prior to ReadFile().
+	* The function is a request to the importer to update its configuration
+	* basing on the Importer's configuration property list.
+	*/
+	void SetupProperties(const Importer* pImp);
+
 protected:
 
 

+ 29 - 33
code/SplitLargeMeshes.cpp

@@ -46,41 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "../include/aiPostProcess.h"
 #include "../include/aiMesh.h"
 #include "../include/aiScene.h"
+#include "../include/assimp.hpp"
 
 using namespace Assimp;
 
-/*static*/ unsigned int SplitLargeMeshesProcess_Triangle::LIMIT = AI_SLM_DEFAULT_MAX_TRIANGLES;
-/*static*/ unsigned int SplitLargeMeshesProcess_Vertex::LIMIT = AI_SLM_DEFAULT_MAX_VERTICES;
 
-extern "C" {
-
-// ------------------------------------------------------------------------------------------------
-aiReturn aiSetVertexSplitLimit(unsigned int pLimit)
-{
-	if (0 == pLimit)
-	{
-		SplitLargeMeshesProcess_Vertex::LIMIT = 0xFFFFFFFF;
-		return AI_FAILURE;
-	}
-
-	SplitLargeMeshesProcess_Vertex::LIMIT = pLimit;
-	DefaultLogger::get()->debug("aiSetVertexSplitLimit() - vertex split limit was changed");
-	return AI_SUCCESS;
-}
-// ------------------------------------------------------------------------------------------------
-aiReturn aiSetTriangleSplitLimit(unsigned int pLimit)
-{
-	if (0 == pLimit)
-	{
-		SplitLargeMeshesProcess_Triangle::LIMIT = 0xFFFFFFFF;
-		return AI_FAILURE;
-	}
-
-	SplitLargeMeshesProcess_Triangle::LIMIT = pLimit;
-	DefaultLogger::get()->debug("aiSetTriangleSplitLimit() - triangle split limit was changed");
-	return AI_SUCCESS;
-}
-}; //! extern "C"
 
 // ------------------------------------------------------------------------------------------------
 SplitLargeMeshesProcess_Triangle::SplitLargeMeshesProcess_Triangle()
@@ -96,12 +66,14 @@ SplitLargeMeshesProcess_Triangle::~SplitLargeMeshesProcess_Triangle()
 // Returns whether the processing step is present in the given flag field.
 bool SplitLargeMeshesProcess_Triangle::IsActive( unsigned int pFlags) const
 {
-	return (pFlags & aiProcess_SplitLargeMeshes) != 0 && (0xFFFFFFFF != LIMIT);
+	return (pFlags & aiProcess_SplitLargeMeshes) != 0;
 }
 // ------------------------------------------------------------------------------------------------
 // Executes the post processing step on the given imported data.
 void SplitLargeMeshesProcess_Triangle::Execute( aiScene* pScene)
 {
+	if (0xffffffff == this->LIMIT)return;
+
 	DefaultLogger::get()->debug("SplitLargeMeshesProcess_Triangle begin");
 	std::vector<std::pair<aiMesh*, unsigned int> > avList;
 
@@ -126,6 +98,17 @@ void SplitLargeMeshesProcess_Triangle::Execute( aiScene* pScene)
 	return;
 }
 // ------------------------------------------------------------------------------------------------
+// Setup properties
+void SplitLargeMeshesProcess_Triangle::SetupProperties( const Importer* pImp)
+{
+        // get the current value of the split property
+	if(0xcdcdcdcd == (this->LIMIT = pImp->GetProperty(
+		AI_CONFIG_PP_SLM_TRIANGLE_LIMIT,0xcdcdcdcd)))
+	{
+		this->LIMIT = AI_SLM_DEFAULT_MAX_TRIANGLES;
+	}
+}
+// ------------------------------------------------------------------------------------------------
 // Update a node after some meshes have been split
 void SplitLargeMeshesProcess_Triangle::UpdateNode(aiNode* pcNode,
 	const std::vector<std::pair<aiMesh*, unsigned int> >& avList)
@@ -368,7 +351,7 @@ SplitLargeMeshesProcess_Vertex::~SplitLargeMeshesProcess_Vertex()
 // Returns whether the processing step is present in the given flag field.
 bool SplitLargeMeshesProcess_Vertex::IsActive( unsigned int pFlags) const
 {
-	return (pFlags & aiProcess_SplitLargeMeshes) != 0 && (0xFFFFFFFF != LIMIT);
+	return (pFlags & aiProcess_SplitLargeMeshes) != 0;
 }
 // ------------------------------------------------------------------------------------------------
 // Executes the post processing step on the given imported data.
@@ -376,6 +359,8 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
 {
 	std::vector<std::pair<aiMesh*, unsigned int> > avList;
 
+  	if (0xffffffff == this->LIMIT)return;
+
 	DefaultLogger::get()->debug("SplitLargeMeshesProcess_Vertex begin");
 	for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
 		this->SplitMesh(a, pScene->mMeshes[a],avList);
@@ -398,6 +383,17 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
 	return;
 }
 // ------------------------------------------------------------------------------------------------
+// Setup properties
+void SplitLargeMeshesProcess_Vertex::SetupProperties( const Importer* pImp)
+{
+        // get the current value of the split property
+	if(0xcdcdcdcd == (this->LIMIT = pImp->GetProperty(
+		AI_CONFIG_PP_SLM_VERTEX_LIMIT,0xcdcdcdcd)))
+	{
+		this->LIMIT = AI_SLM_DEFAULT_MAX_VERTICES;
+	}
+}
+// ------------------------------------------------------------------------------------------------
 // Executes the post processing step on the given imported data.
 void SplitLargeMeshesProcess_Vertex::SplitMesh(
 	unsigned int a,

+ 34 - 14
code/SplitLargeMeshes.h

@@ -96,13 +96,25 @@ protected:
 
 public:
 	// -------------------------------------------------------------------
-	/** Returns whether the processing step is present in the given flag field.
-	* @param pFlags The processing flags the importer was called with. A bitwise
-	*   combination of #aiPostProcessSteps.
-	* @return true if the process is present in this flag fields, false if not.
+	/** Returns whether the processing step is present in the given flag.
+	* @param pFlags The processing flags the importer was called with. A
+ 	*   bitwise combination of #aiPostProcessSteps.
+	* @return true if the process is present in this flag fields, 
+ 	*   false if not.
 	*/
 	bool IsActive( unsigned int pFlags) const;
 
+
+	// -------------------------------------------------------------------
+	/** Called prior to ExecuteOnScene().
+	* The function is a request to the process to update its configuration
+	* basing on the Importer's configuration property list.
+	*/
+	virtual void SetupProperties(const Importer* pImp);
+
+
+protected:
+
 	// -------------------------------------------------------------------
 	/** Executes the post processing step on the given imported data.
 	* At the moment a process is not supposed to fail.
@@ -110,20 +122,20 @@ public:
 	*/
 	void Execute( aiScene* pScene);
 
-
-private:
-
+	// -------------------------------------------------------------------
 	//! Apply the algorithm to a given mesh
 	void SplitMesh (unsigned int a, aiMesh* pcMesh,
 		std::vector<std::pair<aiMesh*, unsigned int> >& avList);
 
-	//! Update a node in the asset after a few of its meshes have been split
+	// -------------------------------------------------------------------
+	//! Update a node in the asset after a few of its meshes 
+	//! have been split
 	static void UpdateNode(aiNode* pcNode,
 		const std::vector<std::pair<aiMesh*, unsigned int> >& avList);
 
 public:
-	//! Triangle limit set via aiSetTriangleSplitLimit()
-	static unsigned int LIMIT;
+	//! Triangle limit 
+	unsigned int LIMIT;
 };
 
 
@@ -154,6 +166,15 @@ public:
 	*/
 	bool IsActive( unsigned int pFlags) const;
 
+	// -------------------------------------------------------------------
+	/** Called prior to ExecuteOnScene().
+	* The function is a request to the process to update its configuration
+	* basing on the Importer's configuration property list.
+	*/
+	virtual void SetupProperties(const Importer* pImp);
+
+protected:
+
 	// -------------------------------------------------------------------
 	/** Executes the post processing step on the given imported data.
 	* At the moment a process is not supposed to fail.
@@ -161,8 +182,7 @@ public:
 	*/
 	void Execute( aiScene* pScene);
 
-private:
-
+	// -------------------------------------------------------------------
 	//! Apply the algorithm to a given mesh
 	void SplitMesh (unsigned int a, aiMesh* pcMesh,
 		std::vector<std::pair<aiMesh*, unsigned int> >& avList);
@@ -170,8 +190,8 @@ private:
 	// NOTE: Reuse SplitLargeMeshesProcess_Triangle::UpdateNode()
 
 public:
-	//! Triangle limit set via aiSetTriangleSplitLimit()
-	static unsigned int LIMIT;
+	//! Triangle limit 
+	unsigned int LIMIT;
 };
 
 } // end of namespace Assimp

+ 1 - 1
include/assimp.hpp

@@ -154,7 +154,7 @@ public:
 	 *   for the requested property is returned!
 	 * @return Current value of the property
 	 */
-	int GetProperty(const char* szName, int iErrorReturn = 0xffffffff);
+	int GetProperty(const char* szName, int iErrorReturn = 0xffffffff) const;
 
 
 	// -------------------------------------------------------------------

+ 1 - 1
port/jAssimp/assimp.iml

@@ -7,7 +7,7 @@
         <attribute name="URI" value="/" />
       </containerElement>
     </containerInfo>
-    <setting name="jarPath" value="J:\Programmieren\ASSIMP\assimp\port\jAssimp\assimp.jar" />
+    <setting name="jarPath" value="J:\Programmieren\ASSIMP\assimp3\port\jAssimp\assimp.jar" />
     <setting name="buildJar" value="true" />
     <setting name="mainClass" value="" />
   </component>

+ 11 - 9
port/jAssimp/src/assimp/ShadingMode.java

@@ -52,16 +52,18 @@ package assimp;
  */
 public class ShadingMode {
 
+    private ShadingMode() {}
+
     /**
      * Flat shading. Shading is done on per-face base,
      * diffuse only.
      */
-    int Flat = 0x1;
+    public static final int Flat = 0x1;
 
     /**
      * Diffuse gouraud shading. Shading on per-vertex base
      */
-    int Gouraud = 0x2;
+    public static final int Gouraud = 0x2;
 
     /**
      * Diffuse/Specular Phong-Shading
@@ -69,7 +71,7 @@ public class ShadingMode {
      * Shading is applied on per-pixel base. This is the
      * slowest algorithm, but generates the best results.
      */
-    int Phong = 0x3;
+    public static final int Phong = 0x3;
 
     /**
      * Diffuse/Specular Phong-Blinn-Shading
@@ -78,7 +80,7 @@ public class ShadingMode {
      * bit faster than phong and in some cases even
      * more realistic
      */
-    int Blinn = 0x4;
+    public static final int Blinn = 0x4;
 
     /**
      * Toon-Shading per pixel
@@ -86,7 +88,7 @@ public class ShadingMode {
      * Shading is applied on per-pixel base. The output looks
      * like a comic. Often combined with edge detection.
      */
-    int Toon = 0x5;
+    public static final int Toon = 0x5;
 
     /**
      * OrenNayar-Shading per pixel
@@ -94,7 +96,7 @@ public class ShadingMode {
      * Extension to standard lambertian shading, taking the
      * roughness of the material into account
      */
-    int OrenNayar = 0x6;
+    public static final int OrenNayar = 0x6;
 
     /**
      * Minnaert-Shading per pixel
@@ -102,15 +104,15 @@ public class ShadingMode {
      * Extension to standard lambertian shading, taking the
      * "darkness" of the material into account
      */
-    int Minnaert = 0x7;
+    public static final int Minnaert = 0x7;
 
     /**
      * CookTorrance-Shading per pixel
      */
-    int CookTorrance = 0x8;
+    public static final int CookTorrance = 0x8;
 
     /**
      * No shading at all
      */
-    int NoShading = 0x8;
+    public static final int NoShading = 0x8;
 }

+ 2 - 2
workspaces/jidea5.1/jAssimp.ipr

@@ -49,7 +49,7 @@
     <option name="MAXIMUM_HEAP_SIZE" value="128" />
   </component>
   <component name="JavadocGenerationManager">
-    <option name="OUTPUT_DIRECTORY" value="J:/Programmieren/ASSIMP/assimp/doc/javadoc" />
+    <option name="OUTPUT_DIRECTORY" value="J:/Programmieren/ASSIMP3/assimp/doc/javadoc" />
     <option name="OPTION_SCOPE" value="package" />
     <option name="OPTION_HIERARCHY" value="true" />
     <option name="OPTION_NAVIGATOR" value="true" />
@@ -178,7 +178,7 @@
   </component>
   <component name="ProjectModuleManager">
     <modules>
-      <module fileurl="file://J:/Programmieren/ASSIMP/ASSIMP/port/jAssimp/assimp.iml" filepath="J:/Programmieren/ASSIMP/ASSIMP/port/jAssimp/assimp.iml" />
+      <module fileurl="file://J:/Programmieren/ASSIMP/ASSIMP3/port/jAssimp/assimp.iml" filepath="J:/Programmieren/ASSIMP/ASSIMP3/port/jAssimp/assimp.iml" />
     </modules>
   </component>
   <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" />

+ 4 - 0
workspaces/vc8/assimp.vcproj

@@ -1046,6 +1046,10 @@
 				RelativePath="..\..\code\BaseImporter.cpp"
 				>
 			</File>
+			<File
+				RelativePath="..\..\code\BaseProcess.cpp"
+				>
+			</File>
 			<File
 				RelativePath="..\..\code\CalcTangentsProcess.cpp"
 				>