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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user