|
@@ -157,7 +157,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
# include "LWSLoader.h"
|
|
# include "LWSLoader.h"
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
|
|
// =======================================================================================
|
|
// =======================================================================================
|
|
// PostProcess-Steps
|
|
// PostProcess-Steps
|
|
// =======================================================================================
|
|
// =======================================================================================
|
|
@@ -221,6 +220,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#ifndef AI_BUILD_NO_FINDINSTANCES_PROCESS
|
|
#ifndef AI_BUILD_NO_FINDINSTANCES_PROCESS
|
|
# include "FindInstancesProcess.h"
|
|
# include "FindInstancesProcess.h"
|
|
#endif
|
|
#endif
|
|
|
|
+#ifndef AI_BUILD_NO_OPTIMIZEMESHES_PROCESS
|
|
|
|
+# include "OptimizeMeshes.h"
|
|
|
|
+#endif
|
|
|
|
+#ifndef AI_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
|
|
|
+# include "OptimizeGraph.h"
|
|
|
|
+#endif
|
|
|
|
|
|
using namespace Assimp;
|
|
using namespace Assimp;
|
|
using namespace Assimp::Intern;
|
|
using namespace Assimp::Intern;
|
|
@@ -230,273 +235,264 @@ using namespace Assimp::Intern;
|
|
// new and delete (and their array counterparts) of public API classes (e.g. Logger) to
|
|
// new and delete (and their array counterparts) of public API classes (e.g. Logger) to
|
|
// utilize our DLL heap
|
|
// utilize our DLL heap
|
|
// =======================================================================================
|
|
// =======================================================================================
|
|
-void* AllocateFromAssimpHeap::operator new ( size_t num_bytes)
|
|
|
|
-{
|
|
|
|
|
|
+void* AllocateFromAssimpHeap::operator new ( size_t num_bytes) {
|
|
return ::operator new(num_bytes);
|
|
return ::operator new(num_bytes);
|
|
}
|
|
}
|
|
|
|
|
|
-void AllocateFromAssimpHeap::operator delete ( void* data)
|
|
|
|
-{
|
|
|
|
|
|
+void AllocateFromAssimpHeap::operator delete ( void* data) {
|
|
return ::operator delete(data);
|
|
return ::operator delete(data);
|
|
}
|
|
}
|
|
|
|
|
|
-void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes)
|
|
|
|
-{
|
|
|
|
|
|
+void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes) {
|
|
return ::operator new[](num_bytes);
|
|
return ::operator new[](num_bytes);
|
|
}
|
|
}
|
|
|
|
|
|
-void AllocateFromAssimpHeap::operator delete[] ( void* data)
|
|
|
|
-{
|
|
|
|
|
|
+void AllocateFromAssimpHeap::operator delete[] ( void* data) {
|
|
return ::operator delete[](data);
|
|
return ::operator delete[](data);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
-// Importer Constructor.
|
|
|
|
|
|
+// Importer constructor.
|
|
Importer::Importer()
|
|
Importer::Importer()
|
|
- : mIOHandler (NULL)
|
|
|
|
- , mScene (NULL)
|
|
|
|
- , mErrorString ("")
|
|
|
|
{
|
|
{
|
|
|
|
+ // allocate the pimpl first
|
|
|
|
+ pimpl = new ImporterPimpl();
|
|
|
|
+
|
|
|
|
+ pimpl->mScene = NULL;
|
|
|
|
+ pimpl->mErrorString = "";
|
|
|
|
+
|
|
// Allocate a default IO handler
|
|
// Allocate a default IO handler
|
|
- mIOHandler = new DefaultIOSystem;
|
|
|
|
- mIsDefaultHandler = true;
|
|
|
|
- bExtraVerbose = false; // disable extra verbose mode by default
|
|
|
|
|
|
+ pimpl->mIOHandler = new DefaultIOSystem;
|
|
|
|
+ pimpl->mIsDefaultHandler = true;
|
|
|
|
+ pimpl->bExtraVerbose = false; // disable extra verbose mode by default
|
|
|
|
|
|
- // ======================================================================
|
|
|
|
|
|
+ // ----------------------------------------------------------------------------
|
|
// Add an instance of each worker class here
|
|
// Add an instance of each worker class here
|
|
- // The order doesn't really care, however file formats that are
|
|
|
|
|
|
+ // The order doesn't really care. File formats that are
|
|
// used more frequently than others should be at the beginning.
|
|
// used more frequently than others should be at the beginning.
|
|
- // ======================================================================
|
|
|
|
- mImporter.reserve(25);
|
|
|
|
|
|
+ // ----------------------------------------------------------------------------
|
|
|
|
+ pimpl->mImporter.reserve(25);
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_X_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_X_IMPORTER)
|
|
- mImporter.push_back( new XFileImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new XFileImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_OBJ_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_OBJ_IMPORTER)
|
|
- mImporter.push_back( new ObjFileImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new ObjFileImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_3DS_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_3DS_IMPORTER)
|
|
- mImporter.push_back( new Discreet3DSImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new Discreet3DSImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_MD3_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_MD3_IMPORTER)
|
|
- mImporter.push_back( new MD3Importer());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new MD3Importer());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_MD2_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_MD2_IMPORTER)
|
|
- mImporter.push_back( new MD2Importer());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new MD2Importer());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_PLY_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_PLY_IMPORTER)
|
|
- mImporter.push_back( new PLYImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new PLYImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_MDL_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_MDL_IMPORTER)
|
|
- mImporter.push_back( new MDLImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new MDLImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_ASE_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_ASE_IMPORTER)
|
|
- mImporter.push_back( new ASEImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new ASEImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_HMP_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_HMP_IMPORTER)
|
|
- mImporter.push_back( new HMPImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new HMPImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_SMD_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_SMD_IMPORTER)
|
|
- mImporter.push_back( new SMDImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new SMDImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_MDC_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_MDC_IMPORTER)
|
|
- mImporter.push_back( new MDCImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new MDCImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_MD5_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_MD5_IMPORTER)
|
|
- mImporter.push_back( new MD5Importer());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new MD5Importer());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_STL_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_STL_IMPORTER)
|
|
- mImporter.push_back( new STLImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new STLImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_LWO_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_LWO_IMPORTER)
|
|
- mImporter.push_back( new LWOImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new LWOImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_DXF_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_DXF_IMPORTER)
|
|
- mImporter.push_back( new DXFImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new DXFImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_NFF_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_NFF_IMPORTER)
|
|
- mImporter.push_back( new NFFImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new NFFImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_RAW_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_RAW_IMPORTER)
|
|
- mImporter.push_back( new RAWImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new RAWImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_OFF_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_OFF_IMPORTER)
|
|
- mImporter.push_back( new OFFImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new OFFImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_AC_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_AC_IMPORTER)
|
|
- mImporter.push_back( new AC3DImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new AC3DImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_BVH_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_BVH_IMPORTER)
|
|
- mImporter.push_back( new BVHLoader());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new BVHLoader());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_IRRMESH_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_IRRMESH_IMPORTER)
|
|
- mImporter.push_back( new IRRMeshImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new IRRMeshImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_IRR_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_IRR_IMPORTER)
|
|
- mImporter.push_back( new IRRImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new IRRImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_Q3D_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_Q3D_IMPORTER)
|
|
- mImporter.push_back( new Q3DImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new Q3DImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_B3D_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_B3D_IMPORTER)
|
|
- mImporter.push_back( new B3DImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new B3DImporter());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_COLLADA_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_COLLADA_IMPORTER)
|
|
- mImporter.push_back( new ColladaLoader());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new ColladaLoader());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_TERRAGEN_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_TERRAGEN_IMPORTER)
|
|
- mImporter.push_back( new TerragenImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new TerragenImporter());
|
|
#endif
|
|
#endif
|
|
//#if (!defined AI_BUILD_NO_CSM_IMPORTER)
|
|
//#if (!defined AI_BUILD_NO_CSM_IMPORTER)
|
|
// mImporter.push_back( new CSMImporter());
|
|
// mImporter.push_back( new CSMImporter());
|
|
//#endif
|
|
//#endif
|
|
#if (!defined AI_BUILD_NO_3D_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_3D_IMPORTER)
|
|
- mImporter.push_back( new UnrealImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new UnrealImporter());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_LWS_IMPORTER)
|
|
#if (!defined AI_BUILD_NO_LWS_IMPORTER)
|
|
- mImporter.push_back( new LWSImporter());
|
|
|
|
|
|
+ pimpl->mImporter.push_back( new LWSImporter());
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- // ======================================================================
|
|
|
|
|
|
+ // ----------------------------------------------------------------------------
|
|
// Add an instance of each post processing step here in the order
|
|
// Add an instance of each post processing step here in the order
|
|
// of sequence it is executed. Steps that are added here are not
|
|
// of sequence it is executed. Steps that are added here are not
|
|
- // validated - as RegisterPPStep() does - all dependencies must be there.
|
|
|
|
- // ======================================================================
|
|
|
|
- mPostProcessingSteps.reserve(25);
|
|
|
|
|
|
+ // validated - as RegisterPPStep() does - all dependencies must be given.
|
|
|
|
+ // ----------------------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+ pimpl->mPostProcessingSteps.reserve(25);
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_REMOVEVC_PROCESS)
|
|
#if (!defined AI_BUILD_NO_REMOVEVC_PROCESS)
|
|
- mPostProcessingSteps.push_back( new RemoveVCProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new RemoveVCProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new RemoveRedundantMatsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new RemoveRedundantMatsProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_FINDINSTANCES_PROCESS)
|
|
#if (!defined AI_BUILD_NO_FINDINSTANCES_PROCESS)
|
|
- mPostProcessingSteps.push_back( new FindInstancesProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new FindInstancesProcess());
|
|
|
|
+#endif
|
|
|
|
+#if (!defined AI_BUILD_NO_OPTIMIZEGRAPH_PROCESS)
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new OptimizeGraphProcess());
|
|
|
|
+#endif
|
|
|
|
+#if (!defined AI_BUILD_NO_OPTIMIZEMESHES_PROCESS)
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new OptimizeMeshesProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_FINDDEGENERATES_PROCESS)
|
|
#if (!defined AI_BUILD_NO_FINDDEGENERATES_PROCESS)
|
|
- mPostProcessingSteps.push_back( new FindDegeneratesProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new FindDegeneratesProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
#ifndef AI_BUILD_NO_GENUVCOORDS_PROCESS
|
|
#ifndef AI_BUILD_NO_GENUVCOORDS_PROCESS
|
|
- mPostProcessingSteps.push_back( new ComputeUVMappingProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new ComputeUVMappingProcess());
|
|
#endif
|
|
#endif
|
|
#ifndef AI_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
|
#ifndef AI_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
|
- mPostProcessingSteps.push_back( new TextureTransformStep());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new TextureTransformStep());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
|
|
#if (!defined AI_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
|
|
- mPostProcessingSteps.push_back( new PretransformVertices());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new PretransformVertices());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_TRIANGULATE_PROCESS)
|
|
#if (!defined AI_BUILD_NO_TRIANGULATE_PROCESS)
|
|
- mPostProcessingSteps.push_back( new TriangulateProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new TriangulateProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_SORTBYPTYPE_PROCESS)
|
|
#if (!defined AI_BUILD_NO_SORTBYPTYPE_PROCESS)
|
|
- mPostProcessingSteps.push_back( new SortByPTypeProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new SortByPTypeProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_FINDINVALIDDATA_PROCESS)
|
|
#if (!defined AI_BUILD_NO_FINDINVALIDDATA_PROCESS)
|
|
- mPostProcessingSteps.push_back( new FindInvalidDataProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new FindInvalidDataProcess());
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
#if (!defined AI_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new FixInfacingNormalsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new FixInfacingNormalsProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
|
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
|
- mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Triangle());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Triangle());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_GENFACENORMALS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_GENFACENORMALS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new GenFaceNormalsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new GenFaceNormalsProcess());
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
|
|
// DON'T change the order of these five!
|
|
// DON'T change the order of these five!
|
|
- mPostProcessingSteps.push_back( new ComputeSpatialSortProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new ComputeSpatialSortProcess());
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_GENVERTEXNORMALS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_GENVERTEXNORMALS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new GenVertexNormalsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new GenVertexNormalsProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_CALCTANGENTS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_CALCTANGENTS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new CalcTangentsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new CalcTangentsProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_JOINVERTICES_PROCESS)
|
|
#if (!defined AI_BUILD_NO_JOINVERTICES_PROCESS)
|
|
- mPostProcessingSteps.push_back( new JoinVerticesProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new JoinVerticesProcess());
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- mPostProcessingSteps.push_back( new DestroySpatialSortProcess());
|
|
|
|
-
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new DestroySpatialSortProcess());
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
|
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
|
- mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Vertex());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Vertex());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_MAKELEFTHANDED_PROCESS)
|
|
#if (!defined AI_BUILD_NO_MAKELEFTHANDED_PROCESS)
|
|
- mPostProcessingSteps.push_back( new MakeLeftHandedProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new MakeLeftHandedProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_FLIPUVS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_FLIPUVS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new FlipUVsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new FlipUVsProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
|
#if (!defined AI_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
|
- mPostProcessingSteps.push_back( new FlipWindingOrderProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new FlipWindingOrderProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
|
|
#if (!defined AI_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
|
|
- mPostProcessingSteps.push_back( new LimitBoneWeightsProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new LimitBoneWeightsProcess());
|
|
#endif
|
|
#endif
|
|
#if (!defined AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
|
|
#if (!defined AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
|
|
- mPostProcessingSteps.push_back( new ImproveCacheLocalityProcess());
|
|
|
|
|
|
+ pimpl->mPostProcessingSteps.push_back( new ImproveCacheLocalityProcess());
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-
|
|
|
|
// Allocate a SharedPostProcessInfo object and store pointers to it
|
|
// Allocate a SharedPostProcessInfo object and store pointers to it
|
|
// in all post-process steps in the list.
|
|
// in all post-process steps in the list.
|
|
- mPPShared = new SharedPostProcessInfo();
|
|
|
|
- for (std::vector<BaseProcess*>::iterator it = mPostProcessingSteps.begin(),
|
|
|
|
- end = mPostProcessingSteps.end(); it != end; ++it)
|
|
|
|
|
|
+ pimpl->mPPShared = new SharedPostProcessInfo();
|
|
|
|
+ for (std::vector<BaseProcess*>::iterator it = pimpl->mPostProcessingSteps.begin(),
|
|
|
|
+ end = pimpl->mPostProcessingSteps.end(); it != end; ++it)
|
|
{
|
|
{
|
|
- (*it)->SetSharedData(mPPShared);
|
|
|
|
|
|
+ (*it)->SetSharedData(pimpl->mPPShared);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
-// Destructor.
|
|
|
|
|
|
+// Destructor of Importer
|
|
Importer::~Importer()
|
|
Importer::~Importer()
|
|
{
|
|
{
|
|
// Delete all import plugins
|
|
// Delete all import plugins
|
|
- for( unsigned int a = 0; a < mImporter.size(); a++)
|
|
|
|
- delete mImporter[a];
|
|
|
|
|
|
+ for( unsigned int a = 0; a < pimpl->mImporter.size(); a++)
|
|
|
|
+ delete pimpl->mImporter[a];
|
|
|
|
|
|
// Delete all post-processing plug-ins
|
|
// Delete all post-processing plug-ins
|
|
- for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++)
|
|
|
|
- delete mPostProcessingSteps[a];
|
|
|
|
|
|
+ for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
|
|
|
|
+ delete pimpl->mPostProcessingSteps[a];
|
|
|
|
|
|
// Delete the assigned IO handler
|
|
// Delete the assigned IO handler
|
|
- delete mIOHandler;
|
|
|
|
|
|
+ delete pimpl->mIOHandler;
|
|
|
|
|
|
// Kill imported scene. Destructors should do that recursivly
|
|
// Kill imported scene. Destructors should do that recursivly
|
|
- delete mScene;
|
|
|
|
|
|
+ delete pimpl->mScene;
|
|
|
|
|
|
// Delete shared post-processing data
|
|
// Delete shared post-processing data
|
|
- delete mPPShared;
|
|
|
|
|
|
+ delete pimpl->mPPShared;
|
|
|
|
+
|
|
|
|
+ // and finally the pimpl itself
|
|
|
|
+ delete pimpl;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
-// Copy constructor - copies the config of another Importer, not the scene
|
|
|
|
|
|
+// Copy constructor - copies the config of another Importer, not the scene
|
|
Importer::Importer(const Importer &other)
|
|
Importer::Importer(const Importer &other)
|
|
{
|
|
{
|
|
- // Call the default constructor
|
|
|
|
new(this) Importer();
|
|
new(this) Importer();
|
|
|
|
|
|
- // Copy the property table
|
|
|
|
- mIntProperties = other.mIntProperties;
|
|
|
|
- mFloatProperties = other.mFloatProperties;
|
|
|
|
- mStringProperties = other.mStringProperties;
|
|
|
|
|
|
+ pimpl->mIntProperties = other.pimpl->mIntProperties;
|
|
|
|
+ pimpl->mFloatProperties = other.pimpl->mFloatProperties;
|
|
|
|
+ pimpl->mStringProperties = other.pimpl->mStringProperties;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -504,11 +500,12 @@ Importer::Importer(const Importer &other)
|
|
aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|
aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|
{
|
|
{
|
|
ai_assert(NULL != pImp);
|
|
ai_assert(NULL != pImp);
|
|
- // ======================================================================
|
|
|
|
|
|
+
|
|
|
|
+ // --------------------------------------------------------------------
|
|
// Check whether we would have two loaders for the same file extension
|
|
// Check whether we would have two loaders for the same file extension
|
|
- // This is absolutely OK, but we should warn the developer of the new
|
|
|
|
- // loader that his code will propably never be called.
|
|
|
|
- // ======================================================================
|
|
|
|
|
|
+ // This is absolutely OK but we should warn the developer of the new
|
|
|
|
+ // loader that his code will probably never be called.
|
|
|
|
+ // --------------------------------------------------------------------
|
|
std::string st;
|
|
std::string st;
|
|
pImp->GetExtensionList(st);
|
|
pImp->GetExtensionList(st);
|
|
|
|
|
|
@@ -524,31 +521,26 @@ aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// add the loader
|
|
// add the loader
|
|
- mImporter.push_back(pImp);
|
|
|
|
|
|
+ pimpl->mImporter.push_back(pImp);
|
|
DefaultLogger::get()->info("Registering custom importer: " + st);
|
|
DefaultLogger::get()->info("Registering custom importer: " + st);
|
|
return AI_SUCCESS;
|
|
return AI_SUCCESS;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
-// Unregister a custom loader
|
|
|
|
|
|
+// Unregister a custom loader plugin
|
|
aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
|
|
aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
|
|
{
|
|
{
|
|
ai_assert(NULL != pImp);
|
|
ai_assert(NULL != pImp);
|
|
- for (std::vector<BaseImporter*>::iterator
|
|
|
|
- it = mImporter.begin(),end = mImporter.end();
|
|
|
|
- it != end;++it)
|
|
|
|
- {
|
|
|
|
- if (pImp == (*it))
|
|
|
|
- {
|
|
|
|
- mImporter.erase(it);
|
|
|
|
-
|
|
|
|
- std::string st;
|
|
|
|
- pImp->GetExtensionList(st);
|
|
|
|
- DefaultLogger::get()->info("Unregistering custom importer: " + st);
|
|
|
|
- return AI_SUCCESS;
|
|
|
|
- }
|
|
|
|
|
|
+ std::vector<BaseImporter*>::iterator it = std::find(pimpl->mImporter.begin(),pimpl->mImporter.end(),pImp);
|
|
|
|
+ if (it != pimpl->mImporter.end()) {
|
|
|
|
+ pimpl->mImporter.erase(it);
|
|
|
|
+
|
|
|
|
+ std::string st;
|
|
|
|
+ pImp->GetExtensionList(st);
|
|
|
|
+ DefaultLogger::get()->info("Unregistering custom importer: " + st);
|
|
|
|
+ return AI_SUCCESS;
|
|
}
|
|
}
|
|
- DefaultLogger::get()->warn("Unable to remove importer: importer not found");
|
|
|
|
|
|
+ DefaultLogger::get()->warn("Unable to remove importer: importer object not found in table");
|
|
return AI_FAILURE;
|
|
return AI_FAILURE;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -560,30 +552,30 @@ void Importer::SetIOHandler( IOSystem* pIOHandler)
|
|
if (!pIOHandler)
|
|
if (!pIOHandler)
|
|
{
|
|
{
|
|
// Release pointer in the possession of the caller
|
|
// Release pointer in the possession of the caller
|
|
- // delete mIOHandler;
|
|
|
|
- mIOHandler = new DefaultIOSystem();
|
|
|
|
- mIsDefaultHandler = true;
|
|
|
|
|
|
+ pimpl->mIOHandler = new DefaultIOSystem();
|
|
|
|
+ pimpl->mIsDefaultHandler = true;
|
|
}
|
|
}
|
|
// Otherwise register the custom handler
|
|
// Otherwise register the custom handler
|
|
- else if (mIOHandler != pIOHandler)
|
|
|
|
|
|
+ else if (pimpl->mIOHandler != pIOHandler)
|
|
{
|
|
{
|
|
- delete mIOHandler;
|
|
|
|
- mIOHandler = pIOHandler;
|
|
|
|
- mIsDefaultHandler = false;
|
|
|
|
|
|
+ delete pimpl->mIOHandler;
|
|
|
|
+ pimpl->mIOHandler = pIOHandler;
|
|
|
|
+ pimpl->mIsDefaultHandler = false;
|
|
}
|
|
}
|
|
- return;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
+// Get the currently set IO handler
|
|
IOSystem* Importer::GetIOHandler()
|
|
IOSystem* Importer::GetIOHandler()
|
|
{
|
|
{
|
|
- return mIOHandler;
|
|
|
|
|
|
+ return pimpl->mIOHandler;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
+// Check whether a custom IO handler is currently set
|
|
bool Importer::IsDefaultIOHandler()
|
|
bool Importer::IsDefaultIOHandler()
|
|
{
|
|
{
|
|
- return mIsDefaultHandler;
|
|
|
|
|
|
+ return pimpl->mIsDefaultHandler;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -604,37 +596,42 @@ bool _ValidateFlags(unsigned int pFlags)
|
|
// Free the current scene
|
|
// Free the current scene
|
|
void Importer::FreeScene( )
|
|
void Importer::FreeScene( )
|
|
{
|
|
{
|
|
- delete mScene;
|
|
|
|
- mScene = NULL;
|
|
|
|
|
|
+ delete pimpl->mScene;
|
|
|
|
+ pimpl->mScene = NULL;
|
|
|
|
+
|
|
|
|
+ pimpl->mErrorString = "";
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
// Get the current error string, if any
|
|
// Get the current error string, if any
|
|
-const std::string& Importer::GetErrorString() const
|
|
|
|
|
|
+const char* Importer::GetErrorString() const
|
|
{
|
|
{
|
|
- return mErrorString;
|
|
|
|
|
|
+ /* Must remain valid as long as ReadFile() or FreeFile() are not called */
|
|
|
|
+ return pimpl->mErrorString.c_str();
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
// Enable extra-verbose mode
|
|
// Enable extra-verbose mode
|
|
void Importer::SetExtraVerbose(bool bDo)
|
|
void Importer::SetExtraVerbose(bool bDo)
|
|
{
|
|
{
|
|
- bExtraVerbose = bDo;
|
|
|
|
|
|
+ pimpl->bExtraVerbose = bDo;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
// Get the current scene
|
|
// Get the current scene
|
|
const aiScene* Importer::GetScene() const
|
|
const aiScene* Importer::GetScene() const
|
|
{
|
|
{
|
|
- return mScene;
|
|
|
|
|
|
+ return pimpl->mScene;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
-// Orphan the current scene
|
|
|
|
|
|
+// Orphan the current scene and return it.
|
|
aiScene* Importer::GetOrphanedScene()
|
|
aiScene* Importer::GetOrphanedScene()
|
|
{
|
|
{
|
|
- aiScene* s = mScene;
|
|
|
|
- mScene = NULL;
|
|
|
|
|
|
+ aiScene* s = pimpl->mScene;
|
|
|
|
+ pimpl->mScene = NULL;
|
|
|
|
+
|
|
|
|
+ pimpl->mErrorString = ""; /* reset error string */
|
|
return s;
|
|
return s;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -646,24 +643,22 @@ bool Importer::ValidateFlags(unsigned int pFlags)
|
|
if(!_ValidateFlags(pFlags))
|
|
if(!_ValidateFlags(pFlags))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- // ValidateDS does not anymore occur in the pp list, it plays
|
|
|
|
- // an awesome extra role ...
|
|
|
|
|
|
+ // ValidateDS does not anymore occur in the pp list, it plays an awesome extra role ...
|
|
#ifdef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
#ifdef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
if (pFlags & aiProcess_ValidateDataStructure)
|
|
if (pFlags & aiProcess_ValidateDataStructure)
|
|
return false;
|
|
return false;
|
|
#endif
|
|
#endif
|
|
pFlags &= ~aiProcess_ValidateDataStructure;
|
|
pFlags &= ~aiProcess_ValidateDataStructure;
|
|
|
|
|
|
- // Now iterate through all bits which are set in
|
|
|
|
- // the flags and check whether we find at least
|
|
|
|
|
|
+ // Now iterate through all bits which are set in the flags and check whether we find at least
|
|
// one pp plugin which handles it.
|
|
// one pp plugin which handles it.
|
|
for (unsigned int mask = 1; mask < (1 << (sizeof(unsigned int)*8-1));mask <<= 1) {
|
|
for (unsigned int mask = 1; mask < (1 << (sizeof(unsigned int)*8-1));mask <<= 1) {
|
|
|
|
|
|
if (pFlags & mask) {
|
|
if (pFlags & mask) {
|
|
|
|
|
|
bool have = false;
|
|
bool have = false;
|
|
- for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++) {
|
|
|
|
- if (mPostProcessingSteps[a]-> IsActive(mask) ) {
|
|
|
|
|
|
+ for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
|
|
|
+ if (pimpl->mPostProcessingSteps[a]-> IsActive(mask) ) {
|
|
|
|
|
|
have = true;
|
|
have = true;
|
|
break;
|
|
break;
|
|
@@ -680,42 +675,41 @@ bool Importer::ValidateFlags(unsigned int pFlags)
|
|
// Reads the given file and returns its contents if successful.
|
|
// Reads the given file and returns its contents if successful.
|
|
const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
{
|
|
{
|
|
- // In debug builds, run a basic flag validation
|
|
|
|
|
|
+ // In debug builds: run a basic flag validation
|
|
ai_assert(_ValidateFlags(pFlags));
|
|
ai_assert(_ValidateFlags(pFlags));
|
|
-
|
|
|
|
const std::string pFile(_pFile);
|
|
const std::string pFile(_pFile);
|
|
|
|
|
|
- // ======================================================================
|
|
|
|
|
|
+ // ----------------------------------------------------------------------
|
|
// Put a large try block around everything to catch all std::exception's
|
|
// Put a large try block around everything to catch all std::exception's
|
|
// that might be thrown by STL containers or by new().
|
|
// that might be thrown by STL containers or by new().
|
|
// ImportErrorException's are throw by ourselves and caught elsewhere.
|
|
// ImportErrorException's are throw by ourselves and caught elsewhere.
|
|
- // ======================================================================
|
|
|
|
|
|
+ //-----------------------------------------------------------------------
|
|
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
try
|
|
try
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
{
|
|
{
|
|
// Check whether this Importer instance has already loaded
|
|
// Check whether this Importer instance has already loaded
|
|
// a scene. In this case we need to delete the old one
|
|
// a scene. In this case we need to delete the old one
|
|
- if (mScene)
|
|
|
|
|
|
+ if (pimpl->mScene)
|
|
{
|
|
{
|
|
DefaultLogger::get()->debug("Deleting previous scene");
|
|
DefaultLogger::get()->debug("Deleting previous scene");
|
|
FreeScene();
|
|
FreeScene();
|
|
}
|
|
}
|
|
|
|
|
|
// First check if the file is accessable at all
|
|
// First check if the file is accessable at all
|
|
- if( !mIOHandler->Exists( pFile))
|
|
|
|
|
|
+ if( !pimpl->mIOHandler->Exists( pFile))
|
|
{
|
|
{
|
|
- mErrorString = "Unable to open file \"" + pFile + "\".";
|
|
|
|
- DefaultLogger::get()->error(mErrorString);
|
|
|
|
|
|
+ pimpl->mErrorString = "Unable to open file \"" + pFile + "\".";
|
|
|
|
+ DefaultLogger::get()->error(pimpl->mErrorString);
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
// Find an worker class which can handle the file
|
|
// Find an worker class which can handle the file
|
|
BaseImporter* imp = NULL;
|
|
BaseImporter* imp = NULL;
|
|
- for( unsigned int a = 0; a < mImporter.size(); a++) {
|
|
|
|
|
|
+ for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {
|
|
|
|
|
|
- if( mImporter[a]->CanRead( pFile, mIOHandler, false)) {
|
|
|
|
- imp = mImporter[a];
|
|
|
|
|
|
+ if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, false)) {
|
|
|
|
+ imp = pimpl->mImporter[a];
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -726,10 +720,10 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
std::string::size_type s = pFile.find_last_of('.');
|
|
std::string::size_type s = pFile.find_last_of('.');
|
|
if (s != std::string::npos) {
|
|
if (s != std::string::npos) {
|
|
DefaultLogger::get()->info("File extension now known, trying signature-based detection");
|
|
DefaultLogger::get()->info("File extension now known, trying signature-based detection");
|
|
- for( unsigned int a = 0; a < mImporter.size(); a++) {
|
|
|
|
|
|
+ for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {
|
|
|
|
|
|
- if( mImporter[a]->CanRead( pFile, mIOHandler, true)) {
|
|
|
|
- imp = mImporter[a];
|
|
|
|
|
|
+ if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {
|
|
|
|
+ imp = pimpl->mImporter[a];
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -737,8 +731,8 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
// Put a proper error message if no suitable importer was found
|
|
// Put a proper error message if no suitable importer was found
|
|
if( !imp)
|
|
if( !imp)
|
|
{
|
|
{
|
|
- mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\".";
|
|
|
|
- DefaultLogger::get()->error(mErrorString);
|
|
|
|
|
|
+ pimpl->mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\".";
|
|
|
|
+ DefaultLogger::get()->error(pimpl->mErrorString);
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -746,10 +740,10 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
// Dispatch the reading to the worker class for this format
|
|
// Dispatch the reading to the worker class for this format
|
|
DefaultLogger::get()->info("Found a matching importer for this file format");
|
|
DefaultLogger::get()->info("Found a matching importer for this file format");
|
|
imp->SetupProperties( this );
|
|
imp->SetupProperties( this );
|
|
- mScene = imp->ReadFile( pFile, mIOHandler);
|
|
|
|
|
|
+ pimpl->mScene = imp->ReadFile( pFile, pimpl->mIOHandler);
|
|
|
|
|
|
// If successful, apply all active post processing steps to the imported data
|
|
// If successful, apply all active post processing steps to the imported data
|
|
- if( mScene)
|
|
|
|
|
|
+ if( pimpl->mScene)
|
|
{
|
|
{
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
// The ValidateDS process is an exception. It is executed first,
|
|
// The ValidateDS process is an exception. It is executed first,
|
|
@@ -758,18 +752,18 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
{
|
|
{
|
|
ValidateDSProcess ds;
|
|
ValidateDSProcess ds;
|
|
ds.ExecuteOnScene (this);
|
|
ds.ExecuteOnScene (this);
|
|
- if (!mScene)
|
|
|
|
|
|
+ if (!pimpl->mScene)
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
#endif // no validation
|
|
#endif // no validation
|
|
|
|
|
|
// Preprocess the scene
|
|
// Preprocess the scene
|
|
- ScenePreprocessor pre(mScene);
|
|
|
|
|
|
+ ScenePreprocessor pre(pimpl->mScene);
|
|
pre.ProcessScene();
|
|
pre.ProcessScene();
|
|
|
|
|
|
DefaultLogger::get()->info("Import successful, entering postprocessing-steps");
|
|
DefaultLogger::get()->info("Import successful, entering postprocessing-steps");
|
|
#ifdef _DEBUG
|
|
#ifdef _DEBUG
|
|
- if (bExtraVerbose)
|
|
|
|
|
|
+ if (pimpl->bExtraVerbose)
|
|
{
|
|
{
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
|
|
|
@@ -781,17 +775,19 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
pFlags |= aiProcess_ValidateDataStructure;
|
|
pFlags |= aiProcess_ValidateDataStructure;
|
|
}
|
|
}
|
|
#else
|
|
#else
|
|
- if (bExtraVerbose)DefaultLogger::get()->warn("Not a debug build, ignoring extra verbose setting");
|
|
|
|
|
|
+ if (pimpl->bExtraVerbose)
|
|
|
|
+ DefaultLogger::get()->warn("Not a debug build, ignoring extra verbose setting");
|
|
#endif // ! DEBUG
|
|
#endif // ! DEBUG
|
|
- for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++)
|
|
|
|
|
|
+ for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
|
|
{
|
|
{
|
|
- BaseProcess* process = mPostProcessingSteps[a];
|
|
|
|
|
|
+ BaseProcess* process = pimpl->mPostProcessingSteps[a];
|
|
if( process->IsActive( pFlags))
|
|
if( process->IsActive( pFlags))
|
|
{
|
|
{
|
|
process->SetupProperties( this );
|
|
process->SetupProperties( this );
|
|
process->ExecuteOnScene ( this );
|
|
process->ExecuteOnScene ( this );
|
|
}
|
|
}
|
|
- if( !mScene)break;
|
|
|
|
|
|
+ if( !pimpl->mScene)
|
|
|
|
+ break;
|
|
#ifdef _DEBUG
|
|
#ifdef _DEBUG
|
|
|
|
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
@@ -800,13 +796,13 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
|
|
|
|
// If the extra verbose mode is active execute the
|
|
// If the extra verbose mode is active execute the
|
|
// VaidateDataStructureStep again after each step
|
|
// VaidateDataStructureStep again after each step
|
|
- if (bExtraVerbose)
|
|
|
|
|
|
+ if (pimpl->bExtraVerbose)
|
|
{
|
|
{
|
|
DefaultLogger::get()->debug("Extra verbose: revalidating data structures");
|
|
DefaultLogger::get()->debug("Extra verbose: revalidating data structures");
|
|
|
|
|
|
ValidateDSProcess ds;
|
|
ValidateDSProcess ds;
|
|
ds.ExecuteOnScene (this);
|
|
ds.ExecuteOnScene (this);
|
|
- if( !mScene)
|
|
|
|
|
|
+ if( !pimpl->mScene)
|
|
{
|
|
{
|
|
DefaultLogger::get()->error("Extra verbose: failed to revalidate data structures");
|
|
DefaultLogger::get()->error("Extra verbose: failed to revalidate data structures");
|
|
break;
|
|
break;
|
|
@@ -816,29 +812,29 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// if failed, extract the error string
|
|
// if failed, extract the error string
|
|
- else if( !mScene)
|
|
|
|
- mErrorString = imp->GetErrorText();
|
|
|
|
|
|
+ else if( !pimpl->mScene)
|
|
|
|
+ pimpl->mErrorString = imp->GetErrorText();
|
|
|
|
|
|
// clear any data allocated by post-process steps
|
|
// clear any data allocated by post-process steps
|
|
- mPPShared->Clean();
|
|
|
|
|
|
+ pimpl->mPPShared->Clean();
|
|
}
|
|
}
|
|
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
catch (std::exception &e)
|
|
catch (std::exception &e)
|
|
{
|
|
{
|
|
#if (defined _MSC_VER) && (defined _CPPRTTI)
|
|
#if (defined _MSC_VER) && (defined _CPPRTTI)
|
|
// if we have RTTI get the full name of the exception that occured
|
|
// if we have RTTI get the full name of the exception that occured
|
|
- mErrorString = std::string(typeid( e ).name()) + ": " + e.what();
|
|
|
|
|
|
+ pimpl->mErrorString = std::string(typeid( e ).name()) + ": " + e.what();
|
|
#else
|
|
#else
|
|
- mErrorString = std::string("std::exception: ") + e.what();
|
|
|
|
|
|
+ pimpl->mErrorString = std::string("std::exception: ") + e.what();
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- DefaultLogger::get()->error(mErrorString);
|
|
|
|
- delete mScene;mScene = NULL;
|
|
|
|
|
|
+ DefaultLogger::get()->error(pimpl->mErrorString);
|
|
|
|
+ delete pimpl->mScene; pimpl->mScene = NULL;
|
|
}
|
|
}
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
|
|
|
|
// either successful or failure - the pointer expresses it anyways
|
|
// either successful or failure - the pointer expresses it anyways
|
|
- return mScene;
|
|
|
|
|
|
+ return pimpl->mScene;
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -852,12 +848,11 @@ bool Importer::IsExtensionSupported(const char* szExtension)
|
|
BaseImporter* Importer::FindLoader (const char* _szExtension)
|
|
BaseImporter* Importer::FindLoader (const char* _szExtension)
|
|
{
|
|
{
|
|
const std::string szExtension(_szExtension);
|
|
const std::string szExtension(_szExtension);
|
|
- for (std::vector<BaseImporter*>::const_iterator
|
|
|
|
- i = mImporter.begin();
|
|
|
|
- i != mImporter.end();++i)
|
|
|
|
|
|
+ for (std::vector<BaseImporter*>::const_iterator i = pimpl->mImporter.begin();i != pimpl->mImporter.end();++i)
|
|
{
|
|
{
|
|
// pass the file extension to the CanRead(..,NULL)-method
|
|
// pass the file extension to the CanRead(..,NULL)-method
|
|
- if ((*i)->CanRead(szExtension,NULL,false))return *i;
|
|
|
|
|
|
+ if ((*i)->CanRead(szExtension,NULL,false))
|
|
|
|
+ return *i;
|
|
}
|
|
}
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -867,10 +862,8 @@ BaseImporter* Importer::FindLoader (const char* _szExtension)
|
|
void Importer::GetExtensionList(aiString& szOut)
|
|
void Importer::GetExtensionList(aiString& szOut)
|
|
{
|
|
{
|
|
unsigned int iNum = 0;
|
|
unsigned int iNum = 0;
|
|
- std::string tmp; // todo: Rewrite baseImporter::GetExtensionList to use aiString, too
|
|
|
|
- for (std::vector<BaseImporter*>::const_iterator
|
|
|
|
- i = mImporter.begin();
|
|
|
|
- i != mImporter.end();++i,++iNum)
|
|
|
|
|
|
+ std::string tmp;
|
|
|
|
+ for (std::vector<BaseImporter*>::const_iterator i = pimpl->mImporter.begin();i != pimpl->mImporter.end();++i,++iNum)
|
|
{
|
|
{
|
|
// Insert a comma as delimiter character
|
|
// Insert a comma as delimiter character
|
|
// FIX: to take lazy loader implementations into account, we are
|
|
// FIX: to take lazy loader implementations into account, we are
|
|
@@ -889,7 +882,7 @@ void Importer::GetExtensionList(aiString& szOut)
|
|
void Importer::SetPropertyInteger(const char* szName, int iValue,
|
|
void Importer::SetPropertyInteger(const char* szName, int iValue,
|
|
bool* bWasExisting /*= NULL*/)
|
|
bool* bWasExisting /*= NULL*/)
|
|
{
|
|
{
|
|
- SetGenericProperty<int>(mIntProperties, szName,iValue,bWasExisting);
|
|
|
|
|
|
+ SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue,bWasExisting);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -897,7 +890,7 @@ void Importer::SetPropertyInteger(const char* szName, int iValue,
|
|
void Importer::SetPropertyFloat(const char* szName, float iValue,
|
|
void Importer::SetPropertyFloat(const char* szName, float iValue,
|
|
bool* bWasExisting /*= NULL*/)
|
|
bool* bWasExisting /*= NULL*/)
|
|
{
|
|
{
|
|
- SetGenericProperty<float>(mFloatProperties, szName,iValue,bWasExisting);
|
|
|
|
|
|
+ SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue,bWasExisting);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -905,7 +898,7 @@ void Importer::SetPropertyFloat(const char* szName, float iValue,
|
|
void Importer::SetPropertyString(const char* szName, const std::string& value,
|
|
void Importer::SetPropertyString(const char* szName, const std::string& value,
|
|
bool* bWasExisting /*= NULL*/)
|
|
bool* bWasExisting /*= NULL*/)
|
|
{
|
|
{
|
|
- SetGenericProperty<std::string>(mStringProperties, szName,value,bWasExisting);
|
|
|
|
|
|
+ SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value,bWasExisting);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -913,7 +906,7 @@ void Importer::SetPropertyString(const char* szName, const std::string& value,
|
|
int Importer::GetPropertyInteger(const char* szName,
|
|
int Importer::GetPropertyInteger(const char* szName,
|
|
int iErrorReturn /*= 0xffffffff*/) const
|
|
int iErrorReturn /*= 0xffffffff*/) const
|
|
{
|
|
{
|
|
- return GetGenericProperty<int>(mIntProperties,szName,iErrorReturn);
|
|
|
|
|
|
+ return GetGenericProperty<int>(pimpl->mIntProperties,szName,iErrorReturn);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -921,7 +914,7 @@ int Importer::GetPropertyInteger(const char* szName,
|
|
float Importer::GetPropertyFloat(const char* szName,
|
|
float Importer::GetPropertyFloat(const char* szName,
|
|
float iErrorReturn /*= 10e10*/) const
|
|
float iErrorReturn /*= 10e10*/) const
|
|
{
|
|
{
|
|
- return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn);
|
|
|
|
|
|
+ return GetGenericProperty<float>(pimpl->mFloatProperties,szName,iErrorReturn);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -929,7 +922,7 @@ float Importer::GetPropertyFloat(const char* szName,
|
|
const std::string& Importer::GetPropertyString(const char* szName,
|
|
const std::string& Importer::GetPropertyString(const char* szName,
|
|
const std::string& iErrorReturn /*= ""*/) const
|
|
const std::string& iErrorReturn /*= ""*/) const
|
|
{
|
|
{
|
|
- return GetGenericProperty<std::string>(mStringProperties,szName,iErrorReturn);
|
|
|
|
|
|
+ return GetGenericProperty<std::string>(pimpl->mStringProperties,szName,iErrorReturn);
|
|
}
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
@@ -948,9 +941,13 @@ inline void AddNodeWeight(unsigned int& iScene,const aiNode* pcNode)
|
|
void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
|
|
void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
|
|
{
|
|
{
|
|
in = aiMemoryInfo();
|
|
in = aiMemoryInfo();
|
|
|
|
+ aiScene* mScene = pimpl->mScene;
|
|
|
|
|
|
// return if we have no scene loaded
|
|
// return if we have no scene loaded
|
|
- if (!this->mScene)return;
|
|
|
|
|
|
+ if (!pimpl->mScene)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+
|
|
in.total = sizeof(aiScene);
|
|
in.total = sizeof(aiScene);
|
|
|
|
|
|
// add all meshes
|
|
// add all meshes
|