Merge pull request #5009 from assimp/kimkulling/refactoring_geoutils
Kimkulling/refactoring geoutilskimkulling/remove-deprecated-badge
commit
da1ec4de91
|
@ -218,6 +218,12 @@ SET( CApi_SRCS
|
||||||
)
|
)
|
||||||
SOURCE_GROUP(CApi FILES ${CApi_SRCS})
|
SOURCE_GROUP(CApi FILES ${CApi_SRCS})
|
||||||
|
|
||||||
|
SET(Geometry_SRCS
|
||||||
|
Geometry/GeometryUtils.h
|
||||||
|
Geometry/GeometryUtils.cpp
|
||||||
|
)
|
||||||
|
SOURCE_GROUP(Geometry FILES ${Geometry_SRCS})
|
||||||
|
|
||||||
SET( STEPParser_SRCS
|
SET( STEPParser_SRCS
|
||||||
AssetLib/STEPParser/STEPFileReader.h
|
AssetLib/STEPParser/STEPFileReader.h
|
||||||
AssetLib/STEPParser/STEPFileReader.cpp
|
AssetLib/STEPParser/STEPFileReader.cpp
|
||||||
|
@ -1129,6 +1135,7 @@ SET( assimp_src
|
||||||
${Core_SRCS}
|
${Core_SRCS}
|
||||||
${CApi_SRCS}
|
${CApi_SRCS}
|
||||||
${Common_SRCS}
|
${Common_SRCS}
|
||||||
|
${Geometry_SRCS}
|
||||||
${Logging_SRCS}
|
${Logging_SRCS}
|
||||||
${Exporter_SRCS}
|
${Exporter_SRCS}
|
||||||
${PostProcessing_SRCS}
|
${PostProcessing_SRCS}
|
||||||
|
|
|
@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
void mydummy() {}
|
void mydummy() {}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2022, assimp 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 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.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "GeometryUtils.h"
|
||||||
|
|
||||||
|
#include <assimp/vector3.h>
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
|
||||||
|
ai_real GeometryUtils::heron( ai_real a, ai_real b, ai_real c ) {
|
||||||
|
ai_real s = (a + b + c) / 2;
|
||||||
|
ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), (ai_real)0.5 );
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
ai_real GeometryUtils::distance3D( const aiVector3D &vA, aiVector3D &vB ) {
|
||||||
|
const ai_real lx = ( vB.x - vA.x );
|
||||||
|
const ai_real ly = ( vB.y - vA.y );
|
||||||
|
const ai_real lz = ( vB.z - vA.z );
|
||||||
|
ai_real a = lx*lx + ly*ly + lz*lz;
|
||||||
|
ai_real d = pow( a, (ai_real)0.5 );
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
ai_real GeometryUtils::calculateAreaOfTriangle( const aiFace& face, aiMesh* mesh ) {
|
||||||
|
ai_real area = 0;
|
||||||
|
|
||||||
|
aiVector3D vA( mesh->mVertices[ face.mIndices[ 0 ] ] );
|
||||||
|
aiVector3D vB( mesh->mVertices[ face.mIndices[ 1 ] ] );
|
||||||
|
aiVector3D vC( mesh->mVertices[ face.mIndices[ 2 ] ] );
|
||||||
|
|
||||||
|
ai_real a( distance3D( vA, vB ) );
|
||||||
|
ai_real b( distance3D( vB, vC ) );
|
||||||
|
ai_real c( distance3D( vC, vA ) );
|
||||||
|
area = heron( a, b, c );
|
||||||
|
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Assimp
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2022, assimp 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 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.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assimp/types.h>
|
||||||
|
#include <assimp/mesh.h>
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
/// @brief This helper class supports some basic geometry algorithms.
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
class GeometryUtils {
|
||||||
|
public:
|
||||||
|
static ai_real heron( ai_real a, ai_real b, ai_real c );
|
||||||
|
|
||||||
|
/// @brief Will compute the distance between 2 3D-vectors
|
||||||
|
/// @param vA Vector a.
|
||||||
|
/// @param vB Vector b.
|
||||||
|
/// @return The distance.
|
||||||
|
static ai_real distance3D( const aiVector3D &vA, aiVector3D &vB );
|
||||||
|
|
||||||
|
/// @brief Will calculate the area of a triangle described by a aiFace.
|
||||||
|
/// @param face The face
|
||||||
|
/// @param mesh The mesh containing the face
|
||||||
|
/// @return The area.
|
||||||
|
static ai_real calculateAreaOfTriangle( const aiFace& face, aiMesh* mesh );
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Assimp
|
|
@ -60,10 +60,6 @@ CalcTangentsProcess::CalcTangentsProcess() :
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
CalcTangentsProcess::~CalcTangentsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool CalcTangentsProcess::IsActive(unsigned int pFlags) const {
|
bool CalcTangentsProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -59,14 +59,11 @@ namespace Assimp
|
||||||
* because the joining of vertices also considers tangents and bitangents for
|
* because the joining of vertices also considers tangents and bitangents for
|
||||||
* uniqueness.
|
* uniqueness.
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API_WINONLY CalcTangentsProcess : public BaseProcess
|
class ASSIMP_API_WINONLY CalcTangentsProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CalcTangentsProcess();
|
CalcTangentsProcess();
|
||||||
~CalcTangentsProcess();
|
~CalcTangentsProcess() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag.
|
/** Returns whether the processing step is present in the given flag.
|
||||||
* @param pFlags The processing flags the importer was called with.
|
* @param pFlags The processing flags the importer was called with.
|
||||||
|
@ -74,24 +71,21 @@ public:
|
||||||
* @return true if the process is present in this flag fields,
|
* @return true if the process is present in this flag fields,
|
||||||
* false if not.
|
* false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
|
||||||
// setter for configMaxAngle
|
// setter for configMaxAngle
|
||||||
inline void SetMaxSmoothAngle(float f)
|
void SetMaxSmoothAngle(float f) {
|
||||||
{
|
|
||||||
configMaxAngle =f;
|
configMaxAngle =f;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Calculates tangents and bitangents for a specific mesh.
|
/** Calculates tangents and bitangents for a specific mesh.
|
||||||
* @param pMesh The mesh to process.
|
* @param pMesh The mesh to process.
|
||||||
|
@ -103,10 +97,9 @@ protected:
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Configuration option: maximum smoothing angle, in radians*/
|
/** Configuration option: maximum smoothing angle, in radians*/
|
||||||
float configMaxAngle;
|
float configMaxAngle;
|
||||||
unsigned int configSourceUV;
|
unsigned int configSourceUV;
|
||||||
|
|
|
@ -57,14 +57,6 @@ namespace {
|
||||||
const static ai_real angle_epsilon = ai_real( 0.95 );
|
const static ai_real angle_epsilon = ai_real( 0.95 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
ComputeUVMappingProcess::ComputeUVMappingProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
ComputeUVMappingProcess::~ComputeUVMappingProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool ComputeUVMappingProcess::IsActive( unsigned int pFlags) const
|
bool ComputeUVMappingProcess::IsActive( unsigned int pFlags) const
|
||||||
|
|
|
@ -59,13 +59,10 @@ namespace Assimp {
|
||||||
/** ComputeUVMappingProcess - converts special mappings, such as spherical,
|
/** ComputeUVMappingProcess - converts special mappings, such as spherical,
|
||||||
* cylindrical or boxed to proper UV coordinates for rendering.
|
* cylindrical or boxed to proper UV coordinates for rendering.
|
||||||
*/
|
*/
|
||||||
class ComputeUVMappingProcess : public BaseProcess
|
class ComputeUVMappingProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
|
||||||
ComputeUVMappingProcess();
|
|
||||||
~ComputeUVMappingProcess();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ComputeUVMappingProcess() = default;
|
||||||
|
~ComputeUVMappingProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
|
@ -73,14 +70,14 @@ public:
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -125,8 +122,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// temporary structure to describe a mapping
|
// temporary structure to describe a mapping
|
||||||
struct MappingInfo
|
struct MappingInfo {
|
||||||
{
|
|
||||||
explicit MappingInfo(aiTextureMapping _type)
|
explicit MappingInfo(aiTextureMapping _type)
|
||||||
: type (_type)
|
: type (_type)
|
||||||
, axis (0.f,1.f,0.f)
|
, axis (0.f,1.f,0.f)
|
||||||
|
@ -137,8 +133,7 @@ private:
|
||||||
aiVector3D axis;
|
aiVector3D axis;
|
||||||
unsigned int uv;
|
unsigned int uv;
|
||||||
|
|
||||||
bool operator== (const MappingInfo& other)
|
bool operator== (const MappingInfo& other) {
|
||||||
{
|
|
||||||
return type == other.type && axis == other.axis;
|
return type == other.type && axis == other.axis;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,14 +79,6 @@ void flipUVs(aiMeshType *pMesh) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
MakeLeftHandedProcess::MakeLeftHandedProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
MakeLeftHandedProcess::~MakeLeftHandedProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool MakeLeftHandedProcess::IsActive(unsigned int pFlags) const {
|
bool MakeLeftHandedProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
@ -305,14 +297,6 @@ void FlipUVsProcess::ProcessMesh(aiMesh *pMesh) {
|
||||||
#ifndef ASSIMP_BUILD_NO_FLIPWINDING_PROCESS
|
#ifndef ASSIMP_BUILD_NO_FLIPWINDING_PROCESS
|
||||||
// # FlipWindingOrderProcess
|
// # FlipWindingOrderProcess
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
FlipWindingOrderProcess::FlipWindingOrderProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
FlipWindingOrderProcess::~FlipWindingOrderProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool FlipWindingOrderProcess::IsActive(unsigned int pFlags) const {
|
bool FlipWindingOrderProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2022, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -72,22 +71,18 @@ namespace Assimp {
|
||||||
*
|
*
|
||||||
* @note RH-LH and LH-RH is the same, so this class can be used for both
|
* @note RH-LH and LH-RH is the same, so this class can be used for both
|
||||||
*/
|
*/
|
||||||
class MakeLeftHandedProcess : public BaseProcess
|
class MakeLeftHandedProcess : public BaseProcess {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MakeLeftHandedProcess();
|
MakeLeftHandedProcess() = default;
|
||||||
~MakeLeftHandedProcess();
|
~MakeLeftHandedProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Recursively converts a node and all of its children
|
/** Recursively converts a node and all of its children
|
||||||
*/
|
*/
|
||||||
|
@ -120,24 +115,22 @@ protected:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Postprocessing step to flip the face order of the imported data
|
/** Postprocessing step to flip the face order of the imported data
|
||||||
*/
|
*/
|
||||||
class FlipWindingOrderProcess : public BaseProcess
|
class FlipWindingOrderProcess : public BaseProcess {
|
||||||
{
|
|
||||||
friend class Importer;
|
friend class Importer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Constructor to be privately used by Importer */
|
/** Constructor to be privately used by Importer */
|
||||||
FlipWindingOrderProcess();
|
FlipWindingOrderProcess() = default;
|
||||||
|
|
||||||
/** Destructor, private as well */
|
/** Destructor, private as well */
|
||||||
~FlipWindingOrderProcess();
|
~FlipWindingOrderProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
public:
|
|
||||||
/** Some other types of post-processing require winding order flips */
|
/** Some other types of post-processing require winding order flips */
|
||||||
static void ProcessMesh( aiMesh* pMesh);
|
static void ProcessMesh( aiMesh* pMesh);
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,42 +43,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/// @file DeboneProcess.cpp
|
/// @file DeboneProcess.cpp
|
||||||
/** Implementation of the DeboneProcess post processing step */
|
/** Implementation of the DeboneProcess post processing step */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// internal headers of the post-processing framework
|
// internal headers of the post-processing framework
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "DeboneProcess.h"
|
#include "DeboneProcess.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
DeboneProcess::DeboneProcess()
|
DeboneProcess::DeboneProcess() : mNumBones(0), mNumBonesCanDoWithout(0), mThreshold(AI_DEBONE_THRESHOLD), mAllOrNone(false) {}
|
||||||
{
|
|
||||||
mNumBones = 0;
|
|
||||||
mNumBonesCanDoWithout = 0;
|
|
||||||
|
|
||||||
mThreshold = AI_DEBONE_THRESHOLD;
|
|
||||||
mAllOrNone = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
DeboneProcess::~DeboneProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool DeboneProcess::IsActive( unsigned int pFlags) const
|
bool DeboneProcess::IsActive( unsigned int pFlags) const {
|
||||||
{
|
|
||||||
return (pFlags & aiProcess_Debone) != 0;
|
return (pFlags & aiProcess_Debone) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
void DeboneProcess::SetupProperties(const Importer* pImp)
|
void DeboneProcess::SetupProperties(const Importer* pImp) {
|
||||||
{
|
|
||||||
// get the current value of the property
|
// get the current value of the property
|
||||||
mAllOrNone = pImp->GetPropertyInteger(AI_CONFIG_PP_DB_ALL_OR_NONE,0)?true:false;
|
mAllOrNone = pImp->GetPropertyInteger(AI_CONFIG_PP_DB_ALL_OR_NONE,0)?true:false;
|
||||||
mThreshold = pImp->GetPropertyFloat(AI_CONFIG_PP_DB_THRESHOLD,AI_DEBONE_THRESHOLD);
|
mThreshold = pImp->GetPropertyFloat(AI_CONFIG_PP_DB_THRESHOLD,AI_DEBONE_THRESHOLD);
|
||||||
|
@ -86,8 +70,7 @@ void DeboneProcess::SetupProperties(const Importer* pImp)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
void DeboneProcess::Execute( aiScene* pScene)
|
void DeboneProcess::Execute( aiScene* pScene) {
|
||||||
{
|
|
||||||
ASSIMP_LOG_DEBUG("DeboneProcess begin");
|
ASSIMP_LOG_DEBUG("DeboneProcess begin");
|
||||||
|
|
||||||
if(!pScene->mNumMeshes) {
|
if(!pScene->mNumMeshes) {
|
||||||
|
@ -117,10 +100,8 @@ void DeboneProcess::Execute( aiScene* pScene)
|
||||||
// build a new array of meshes for the scene
|
// build a new array of meshes for the scene
|
||||||
std::vector<aiMesh*> meshes;
|
std::vector<aiMesh*> meshes;
|
||||||
|
|
||||||
for(unsigned int a=0;a<pScene->mNumMeshes;a++)
|
for (unsigned int a=0;a<pScene->mNumMeshes; ++a) {
|
||||||
{
|
|
||||||
aiMesh* srcMesh = pScene->mMeshes[a];
|
aiMesh* srcMesh = pScene->mMeshes[a];
|
||||||
|
|
||||||
std::vector<std::pair<aiMesh*,const aiBone*> > newMeshes;
|
std::vector<std::pair<aiMesh*,const aiBone*> > newMeshes;
|
||||||
|
|
||||||
if(splitList[a]) {
|
if(splitList[a]) {
|
||||||
|
@ -150,8 +131,7 @@ void DeboneProcess::Execute( aiScene* pScene)
|
||||||
|
|
||||||
// and destroy the source mesh. It should be completely contained inside the new submeshes
|
// and destroy the source mesh. It should be completely contained inside the new submeshes
|
||||||
delete srcMesh;
|
delete srcMesh;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Mesh is kept unchanged - store it's new place in the mesh array
|
// Mesh is kept unchanged - store it's new place in the mesh array
|
||||||
mSubMeshIndices[a].emplace_back(static_cast<unsigned int>(meshes.size()), (aiNode *)nullptr);
|
mSubMeshIndices[a].emplace_back(static_cast<unsigned int>(meshes.size()), (aiNode *)nullptr);
|
||||||
meshes.push_back(srcMesh);
|
meshes.push_back(srcMesh);
|
||||||
|
@ -173,8 +153,7 @@ void DeboneProcess::Execute( aiScene* pScene)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Counts bones total/removable in a given mesh.
|
// Counts bones total/removable in a given mesh.
|
||||||
bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
|
bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh) {
|
||||||
{
|
|
||||||
if(!pMesh->HasBones()) {
|
if(!pMesh->HasBones()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -193,25 +172,23 @@ bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
|
||||||
for(unsigned int i=0;i<pMesh->mNumBones;i++) {
|
for(unsigned int i=0;i<pMesh->mNumBones;i++) {
|
||||||
for(unsigned int j=0;j<pMesh->mBones[i]->mNumWeights;j++) {
|
for(unsigned int j=0;j<pMesh->mBones[i]->mNumWeights;j++) {
|
||||||
float w = pMesh->mBones[i]->mWeights[j].mWeight;
|
float w = pMesh->mBones[i]->mWeights[j].mWeight;
|
||||||
|
if (w == 0.0f) {
|
||||||
if(w==0.0f) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int vid = pMesh->mBones[i]->mWeights[j].mVertexId;
|
unsigned int vid = pMesh->mBones[i]->mWeights[j].mVertexId;
|
||||||
if(w>=mThreshold) {
|
if (w >= mThreshold) {
|
||||||
|
if (vertexBones[vid] != cUnowned) {
|
||||||
if(vertexBones[vid]!=cUnowned) {
|
//double entry
|
||||||
if(vertexBones[vid]==i) //double entry
|
if(vertexBones[vid]==i) {
|
||||||
{
|
|
||||||
ASSIMP_LOG_WARN("Encountered double entry in bone weights");
|
ASSIMP_LOG_WARN("Encountered double entry in bone weights");
|
||||||
}
|
} else {
|
||||||
else //TODO: track attraction in order to break tie
|
//TODO: track attraction in order to break tie
|
||||||
{
|
|
||||||
vertexBones[vid] = cCoowned;
|
vertexBones[vid] = cCoowned;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
vertexBones[vid] = i;
|
||||||
}
|
}
|
||||||
else vertexBones[vid] = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isBoneNecessary[i]) {
|
if(!isBoneNecessary[i]) {
|
||||||
|
@ -227,13 +204,16 @@ bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
|
||||||
if(isInterstitialRequired) {
|
if(isInterstitialRequired) {
|
||||||
for(unsigned int i=0;i<pMesh->mNumFaces;i++) {
|
for(unsigned int i=0;i<pMesh->mNumFaces;i++) {
|
||||||
unsigned int v = vertexBones[pMesh->mFaces[i].mIndices[0]];
|
unsigned int v = vertexBones[pMesh->mFaces[i].mIndices[0]];
|
||||||
|
for (unsigned int j=1;j<pMesh->mFaces[i].mNumIndices;j++) {
|
||||||
for(unsigned int j=1;j<pMesh->mFaces[i].mNumIndices;j++) {
|
|
||||||
unsigned int w = vertexBones[pMesh->mFaces[i].mIndices[j]];
|
unsigned int w = vertexBones[pMesh->mFaces[i].mIndices[j]];
|
||||||
|
|
||||||
if(v!=w) {
|
if (v != w) {
|
||||||
if(v<pMesh->mNumBones) isBoneNecessary[v] = true;
|
if(v<pMesh->mNumBones) {
|
||||||
if(w<pMesh->mNumBones) isBoneNecessary[w] = true;
|
isBoneNecessary[v] = true;
|
||||||
|
}
|
||||||
|
if (w<pMesh->mNumBones) {
|
||||||
|
isBoneNecessary[w] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,8 +232,7 @@ bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Splits the given mesh by bone count.
|
// Splits the given mesh by bone count.
|
||||||
void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMesh*,const aiBone* > >& poNewMeshes) const
|
void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMesh*,const aiBone* > >& poNewMeshes) const {
|
||||||
{
|
|
||||||
// same deal here as ConsiderMesh basically
|
// same deal here as ConsiderMesh basically
|
||||||
|
|
||||||
std::vector<bool> isBoneNecessary(pMesh->mNumBones,false);
|
std::vector<bool> isBoneNecessary(pMesh->mNumBones,false);
|
||||||
|
@ -371,8 +350,7 @@ void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMe
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Recursively updates the node's mesh list to account for the changed mesh list
|
// Recursively updates the node's mesh list to account for the changed mesh list
|
||||||
void DeboneProcess::UpdateNode(aiNode* pNode) const
|
void DeboneProcess::UpdateNode(aiNode* pNode) const {
|
||||||
{
|
|
||||||
// rebuild the node's mesh index list
|
// rebuild the node's mesh index list
|
||||||
|
|
||||||
std::vector<unsigned int> newMeshList;
|
std::vector<unsigned int> newMeshList;
|
||||||
|
@ -430,8 +408,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Apply the node transformation to a mesh
|
// Apply the node transformation to a mesh
|
||||||
void DeboneProcess::ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat)const
|
void DeboneProcess::ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat)const {
|
||||||
{
|
|
||||||
// Check whether we need to transform the coordinates at all
|
// Check whether we need to transform the coordinates at all
|
||||||
if (!mat.IsIdentity()) {
|
if (!mat.IsIdentity()) {
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace Assimp {
|
||||||
class DeboneProcess : public BaseProcess {
|
class DeboneProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
DeboneProcess();
|
DeboneProcess();
|
||||||
~DeboneProcess();
|
~DeboneProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag.
|
/** Returns whether the processing step is present in the given flag.
|
||||||
|
@ -79,14 +79,14 @@ public:
|
||||||
* @return true if the process is present in this flag fields,
|
* @return true if the process is present in this flag fields,
|
||||||
* false if not.
|
* false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -94,7 +94,7 @@ protected:
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Counts bones total/removable in a given mesh.
|
/** Counts bones total/removable in a given mesh.
|
||||||
|
|
|
@ -54,14 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
DropFaceNormalsProcess::DropFaceNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
DropFaceNormalsProcess::~DropFaceNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool DropFaceNormalsProcess::IsActive( unsigned int pFlags) const {
|
bool DropFaceNormalsProcess::IsActive( unsigned int pFlags) const {
|
||||||
|
|
|
@ -55,8 +55,8 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API_WINONLY DropFaceNormalsProcess : public BaseProcess {
|
class ASSIMP_API_WINONLY DropFaceNormalsProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
DropFaceNormalsProcess();
|
DropFaceNormalsProcess() = default;
|
||||||
~DropFaceNormalsProcess();
|
~DropFaceNormalsProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
|
@ -64,15 +64,14 @@ public:
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool DropMeshFaceNormals(aiMesh* pcMesh);
|
bool DropMeshFaceNormals(aiMesh* pcMesh);
|
||||||
|
|
|
@ -49,10 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
EmbedTexturesProcess::EmbedTexturesProcess() = default;
|
|
||||||
|
|
||||||
EmbedTexturesProcess::~EmbedTexturesProcess() = default;
|
|
||||||
|
|
||||||
bool EmbedTexturesProcess::IsActive(unsigned int pFlags) const {
|
bool EmbedTexturesProcess::IsActive(unsigned int pFlags) const {
|
||||||
return (pFlags & aiProcess_EmbedTextures) != 0;
|
return (pFlags & aiProcess_EmbedTextures) != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,19 +62,19 @@ namespace Assimp {
|
||||||
class ASSIMP_API EmbedTexturesProcess : public BaseProcess {
|
class ASSIMP_API EmbedTexturesProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
/// The default class constructor.
|
/// The default class constructor.
|
||||||
EmbedTexturesProcess();
|
EmbedTexturesProcess() = default;
|
||||||
|
|
||||||
/// The class destructor.
|
/// The class destructor.
|
||||||
virtual ~EmbedTexturesProcess();
|
~EmbedTexturesProcess() override = default;
|
||||||
|
|
||||||
/// Overwritten, @see BaseProcess
|
/// Overwritten, @see BaseProcess
|
||||||
virtual bool IsActive(unsigned int pFlags) const;
|
bool IsActive(unsigned int pFlags) const override;
|
||||||
|
|
||||||
/// Overwritten, @see BaseProcess
|
/// Overwritten, @see BaseProcess
|
||||||
virtual void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
/// Overwritten, @see BaseProcess
|
/// Overwritten, @see BaseProcess
|
||||||
virtual void Execute(aiScene* pScene);
|
virtual void Execute(aiScene* pScene) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Resolve the path and add the file content to the scene as a texture.
|
// Resolve the path and add the file content to the scene as a texture.
|
||||||
|
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "FindDegenerates.h"
|
#include "FindDegenerates.h"
|
||||||
|
#include "Geometry/GeometryUtils.h"
|
||||||
|
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
|
@ -63,10 +64,6 @@ FindDegeneratesProcess::FindDegeneratesProcess() :
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
FindDegeneratesProcess::~FindDegeneratesProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool FindDegeneratesProcess::IsActive( unsigned int pFlags) const {
|
bool FindDegeneratesProcess::IsActive( unsigned int pFlags) const {
|
||||||
|
@ -132,37 +129,6 @@ static void updateSceneGraph(aiNode* pNode, const std::unordered_map<unsigned in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ai_real heron( ai_real a, ai_real b, ai_real c ) {
|
|
||||||
ai_real s = (a + b + c) / 2;
|
|
||||||
ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), (ai_real)0.5 );
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ai_real distance3D( const aiVector3D &vA, aiVector3D &vB ) {
|
|
||||||
const ai_real lx = ( vB.x - vA.x );
|
|
||||||
const ai_real ly = ( vB.y - vA.y );
|
|
||||||
const ai_real lz = ( vB.z - vA.z );
|
|
||||||
ai_real a = lx*lx + ly*ly + lz*lz;
|
|
||||||
ai_real d = pow( a, (ai_real)0.5 );
|
|
||||||
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ai_real calculateAreaOfTriangle( const aiFace& face, aiMesh* mesh ) {
|
|
||||||
ai_real area = 0;
|
|
||||||
|
|
||||||
aiVector3D vA( mesh->mVertices[ face.mIndices[ 0 ] ] );
|
|
||||||
aiVector3D vB( mesh->mVertices[ face.mIndices[ 1 ] ] );
|
|
||||||
aiVector3D vC( mesh->mVertices[ face.mIndices[ 2 ] ] );
|
|
||||||
|
|
||||||
ai_real a( distance3D( vA, vB ) );
|
|
||||||
ai_real b( distance3D( vB, vC ) );
|
|
||||||
ai_real c( distance3D( vC, vA ) );
|
|
||||||
area = heron( a, b, c );
|
|
||||||
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported mesh
|
// Executes the post processing step on the given imported mesh
|
||||||
bool FindDegeneratesProcess::ExecuteOnMesh( aiMesh* mesh) {
|
bool FindDegeneratesProcess::ExecuteOnMesh( aiMesh* mesh) {
|
||||||
|
@ -218,7 +184,7 @@ bool FindDegeneratesProcess::ExecuteOnMesh( aiMesh* mesh) {
|
||||||
|
|
||||||
if ( mConfigCheckAreaOfTriangle ) {
|
if ( mConfigCheckAreaOfTriangle ) {
|
||||||
if ( face.mNumIndices == 3 ) {
|
if ( face.mNumIndices == 3 ) {
|
||||||
ai_real area = calculateAreaOfTriangle( face, mesh );
|
ai_real area = GeometryUtils::calculateAreaOfTriangle( face, mesh );
|
||||||
if (area < ai_epsilon) {
|
if (area < ai_epsilon) {
|
||||||
if ( mConfigRemoveDegenerates ) {
|
if ( mConfigRemoveDegenerates ) {
|
||||||
remove_me[ a ] = true;
|
remove_me[ a ] = true;
|
||||||
|
|
|
@ -59,19 +59,19 @@ namespace Assimp {
|
||||||
class ASSIMP_API FindDegeneratesProcess : public BaseProcess {
|
class ASSIMP_API FindDegeneratesProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
FindDegeneratesProcess();
|
FindDegeneratesProcess();
|
||||||
~FindDegeneratesProcess();
|
~FindDegeneratesProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Check whether step is active
|
// Check whether step is active
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Execute step on a given scene
|
// Execute step on a given scene
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Setup import settings
|
// Setup import settings
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Execute step on a given mesh
|
// Execute step on a given mesh
|
||||||
|
@ -105,23 +105,19 @@ private:
|
||||||
bool mConfigCheckAreaOfTriangle;
|
bool mConfigCheckAreaOfTriangle;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline void FindDegeneratesProcess::EnableInstantRemoval(bool enabled) {
|
||||||
void FindDegeneratesProcess::EnableInstantRemoval(bool enabled) {
|
|
||||||
mConfigRemoveDegenerates = enabled;
|
mConfigRemoveDegenerates = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline bool FindDegeneratesProcess::IsInstantRemoval() const {
|
||||||
bool FindDegeneratesProcess::IsInstantRemoval() const {
|
|
||||||
return mConfigRemoveDegenerates;
|
return mConfigRemoveDegenerates;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline void FindDegeneratesProcess::EnableAreaCheck( bool enabled ) {
|
||||||
void FindDegeneratesProcess::EnableAreaCheck( bool enabled ) {
|
|
||||||
mConfigCheckAreaOfTriangle = enabled;
|
mConfigCheckAreaOfTriangle = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline bool FindDegeneratesProcess::isAreaCheckEnabled() const {
|
||||||
bool FindDegeneratesProcess::isAreaCheckEnabled() const {
|
|
||||||
return mConfigCheckAreaOfTriangle;
|
return mConfigCheckAreaOfTriangle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,6 @@ FindInstancesProcess::FindInstancesProcess()
|
||||||
: configSpeedFlag (false)
|
: configSpeedFlag (false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
FindInstancesProcess::~FindInstancesProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool FindInstancesProcess::IsActive( unsigned int pFlags) const
|
bool FindInstancesProcess::IsActive( unsigned int pFlags) const
|
||||||
|
|
|
@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "PostProcessing/ProcessHelper.h"
|
#include "PostProcessing/ProcessHelper.h"
|
||||||
|
|
||||||
class FindInstancesProcessTest;
|
class FindInstancesProcessTest;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
@ -60,8 +61,7 @@ namespace Assimp {
|
||||||
* @param in Input mesh
|
* @param in Input mesh
|
||||||
* @return Hash.
|
* @return Hash.
|
||||||
*/
|
*/
|
||||||
inline
|
inline uint64_t GetMeshHash(aiMesh* in) {
|
||||||
uint64_t GetMeshHash(aiMesh* in) {
|
|
||||||
ai_assert(nullptr != in);
|
ai_assert(nullptr != in);
|
||||||
|
|
||||||
// ... get an unique value representing the vertex format of the mesh
|
// ... get an unique value representing the vertex format of the mesh
|
||||||
|
@ -83,8 +83,7 @@ uint64_t GetMeshHash(aiMesh* in) {
|
||||||
* @param e Epsilon
|
* @param e Epsilon
|
||||||
* @return true if the arrays are identical
|
* @return true if the arrays are identical
|
||||||
*/
|
*/
|
||||||
inline
|
inline bool CompareArrays(const aiVector3D* first, const aiVector3D* second,
|
||||||
bool CompareArrays(const aiVector3D* first, const aiVector3D* second,
|
|
||||||
unsigned int size, float e) {
|
unsigned int size, float e) {
|
||||||
for (const aiVector3D* end = first+size; first != end; ++first,++second) {
|
for (const aiVector3D* end = first+size; first != end; ++first,++second) {
|
||||||
if ( (*first - *second).SquareLength() >= e)
|
if ( (*first - *second).SquareLength() >= e)
|
||||||
|
@ -107,31 +106,27 @@ inline bool CompareArrays(const aiColor4D* first, const aiColor4D* second,
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief A post-processing steps to search for instanced meshes
|
/** @brief A post-processing steps to search for instanced meshes
|
||||||
*/
|
*/
|
||||||
class FindInstancesProcess : public BaseProcess
|
class FindInstancesProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FindInstancesProcess();
|
FindInstancesProcess();
|
||||||
~FindInstancesProcess();
|
~FindInstancesProcess() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Check whether step is active in given flags combination
|
// Check whether step is active in given flags combination
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Execute step on a given scene
|
// Execute step on a given scene
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Setup properties prior to executing the process
|
// Setup properties prior to executing the process
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool configSpeedFlag;
|
bool configSpeedFlag;
|
||||||
|
|
||||||
}; // ! end class FindInstancesProcess
|
}; // ! end class FindInstancesProcess
|
||||||
|
|
||||||
} // ! end namespace Assimp
|
} // ! end namespace Assimp
|
||||||
|
|
||||||
#endif // !! AI_FINDINSTANCES_H_INC
|
#endif // !! AI_FINDINSTANCES_H_INC
|
||||||
|
|
|
@ -60,10 +60,6 @@ FindInvalidDataProcess::FindInvalidDataProcess() :
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
FindInvalidDataProcess::~FindInvalidDataProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool FindInvalidDataProcess::IsActive(unsigned int pFlags) const {
|
bool FindInvalidDataProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -64,35 +64,37 @@ namespace Assimp {
|
||||||
* which have zero normal vectors. */
|
* which have zero normal vectors. */
|
||||||
class ASSIMP_API FindInvalidDataProcess : public BaseProcess {
|
class ASSIMP_API FindInvalidDataProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
FindInvalidDataProcess();
|
FindInvalidDataProcess();
|
||||||
~FindInvalidDataProcess();
|
~FindInvalidDataProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
//
|
/// Returns active state.
|
||||||
bool IsActive(unsigned int pFlags) const;
|
bool IsActive(unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Setup import settings
|
/// Setup import settings
|
||||||
void SetupProperties(const Importer *pImp);
|
void SetupProperties(const Importer *pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Run the step
|
/// Run the step
|
||||||
void Execute(aiScene *pScene);
|
void Execute(aiScene *pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post-processing step on the given mesh
|
/// Executes the post-processing step on the given mesh
|
||||||
* @param pMesh The mesh to process.
|
/// @param pMesh The mesh to process.
|
||||||
* @return 0 - nothing, 1 - removed sth, 2 - please delete me */
|
/// @return 0 - nothing, 1 - removed sth, 2 - please delete me */
|
||||||
int ProcessMesh(aiMesh *pMesh);
|
int ProcessMesh(aiMesh *pMesh);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post-processing step on the given animation
|
/// Executes the post-processing step on the given animation
|
||||||
* @param anim The animation to process. */
|
/// @param anim The animation to process. */
|
||||||
void ProcessAnimation(aiAnimation *anim);
|
void ProcessAnimation(aiAnimation *anim);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post-processing step on the given anim channel
|
/// Executes the post-processing step on the given anim channel
|
||||||
* @param anim The animation channel to process.*/
|
/// @param anim The animation channel to process.*/
|
||||||
void ProcessAnimationChannel(aiNodeAnim *anim);
|
void ProcessAnimationChannel(aiNodeAnim *anim);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -56,26 +56,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
FixInfacingNormalsProcess::FixInfacingNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
FixInfacingNormalsProcess::~FixInfacingNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool FixInfacingNormalsProcess::IsActive( unsigned int pFlags) const
|
bool FixInfacingNormalsProcess::IsActive( unsigned int pFlags) const {
|
||||||
{
|
|
||||||
return (pFlags & aiProcess_FixInfacingNormals) != 0;
|
return (pFlags & aiProcess_FixInfacingNormals) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
void FixInfacingNormalsProcess::Execute( aiScene* pScene)
|
void FixInfacingNormalsProcess::Execute( aiScene* pScene) {
|
||||||
{
|
|
||||||
ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess begin");
|
ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess begin");
|
||||||
|
|
||||||
bool bHas( false );
|
bool bHas( false );
|
||||||
|
|
|
@ -49,8 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** The FixInfacingNormalsProcess tries to determine whether the normal
|
/** The FixInfacingNormalsProcess tries to determine whether the normal
|
||||||
|
@ -59,8 +58,10 @@ namespace Assimp
|
||||||
*/
|
*/
|
||||||
class FixInfacingNormalsProcess : public BaseProcess {
|
class FixInfacingNormalsProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
FixInfacingNormalsProcess();
|
// -------------------------------------------------------------------
|
||||||
~FixInfacingNormalsProcess();
|
/// The default class constructor / destructor.
|
||||||
|
FixInfacingNormalsProcess() = default;
|
||||||
|
~FixInfacingNormalsProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
|
@ -68,14 +69,14 @@ public:
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
GenBoundingBoxesProcess::GenBoundingBoxesProcess() = default;
|
|
||||||
|
|
||||||
GenBoundingBoxesProcess::~GenBoundingBoxesProcess() = default;
|
|
||||||
|
|
||||||
bool GenBoundingBoxesProcess::IsActive(unsigned int pFlags) const {
|
bool GenBoundingBoxesProcess::IsActive(unsigned int pFlags) const {
|
||||||
return 0 != ( pFlags & aiProcess_GenBoundingBoxes );
|
return 0 != ( pFlags & aiProcess_GenBoundingBoxes );
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ conditions are met:
|
||||||
copyright notice, this list of conditions and the
|
copyright notice, this list of conditions and the
|
||||||
following disclaimer in the documentation and/or other
|
following disclaimer in the documentation and/or other
|
||||||
materials provided with the distribution.
|
materials provided with the distribution.
|
||||||
|
s
|
||||||
* Neither the name of the assimp team, nor the names of its
|
* Neither the name of the assimp team, nor the names of its
|
||||||
contributors may be used to endorse or promote products
|
contributors may be used to endorse or promote products
|
||||||
derived from this software without specific prior
|
derived from this software without specific prior
|
||||||
|
@ -54,18 +54,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
/** Post-processing process to find axis-aligned bounding volumes for amm meshes
|
/**
|
||||||
* used in a scene
|
* @brief Post-processing process to find axis-aligned bounding volumes for amm meshes
|
||||||
|
* used in a scene.
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API GenBoundingBoxesProcess : public BaseProcess {
|
class ASSIMP_API GenBoundingBoxesProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
/// The class constructor.
|
// -------------------------------------------------------------------
|
||||||
GenBoundingBoxesProcess();
|
/// The default class constructor / destructor.
|
||||||
/// The class destructor.
|
GenBoundingBoxesProcess() = default;
|
||||||
~GenBoundingBoxesProcess();
|
~GenBoundingBoxesProcess() override = default;
|
||||||
/// Will return true, if aiProcess_GenBoundingBoxes is defined.
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// @brief Will return true, if aiProcess_GenBoundingBoxes is defined.
|
||||||
bool IsActive(unsigned int pFlags) const override;
|
bool IsActive(unsigned int pFlags) const override;
|
||||||
/// The execution callback.
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// @brief The execution callback.
|
||||||
void Execute(aiScene* pScene) override;
|
void Execute(aiScene* pScene) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
GenFaceNormalsProcess::GenFaceNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
GenFaceNormalsProcess::~GenFaceNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool GenFaceNormalsProcess::IsActive(unsigned int pFlags) const {
|
bool GenFaceNormalsProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -47,35 +47,33 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "Common/BaseProcess.h"
|
#include "Common/BaseProcess.h"
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** The GenFaceNormalsProcess computes face normals for all faces of all meshes
|
/**
|
||||||
*/
|
* @brief The GenFaceNormalsProcess computes face normals for all faces of all meshes
|
||||||
class ASSIMP_API_WINONLY GenFaceNormalsProcess : public BaseProcess
|
*/
|
||||||
{
|
class ASSIMP_API_WINONLY GenFaceNormalsProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
|
GenFaceNormalsProcess() = default;
|
||||||
|
~GenFaceNormalsProcess() override = default;
|
||||||
|
|
||||||
GenFaceNormalsProcess();
|
|
||||||
~GenFaceNormalsProcess();
|
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
* @param pFlags The processing flags the importer was called with. A bitwise
|
* @param pFlags The processing flags the importer was called with. A bitwise
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool GenMeshFaceNormals(aiMesh* pcMesh);
|
bool GenMeshFaceNormals(aiMesh* pcMesh);
|
||||||
|
|
|
@ -60,10 +60,6 @@ GenVertexNormalsProcess::GenVertexNormalsProcess() :
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
GenVertexNormalsProcess::~GenVertexNormalsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool GenVertexNormalsProcess::IsActive(unsigned int pFlags) const {
|
bool GenVertexNormalsProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
@ -109,11 +105,11 @@ void GenVertexNormalsProcess::Execute(aiScene *pScene) {
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
bool GenVertexNormalsProcess::GenMeshVertexNormals(aiMesh *pMesh, unsigned int meshIndex) {
|
bool GenVertexNormalsProcess::GenMeshVertexNormals(aiMesh *pMesh, unsigned int meshIndex) {
|
||||||
if (nullptr != pMesh->mNormals) {
|
if (nullptr != pMesh->mNormals) {
|
||||||
if (force_)
|
if (!force_) {
|
||||||
delete[] pMesh->mNormals;
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
delete[] pMesh->mNormals;
|
||||||
|
}
|
||||||
|
|
||||||
// If the mesh consists of lines and/or points but not of
|
// If the mesh consists of lines and/or points but not of
|
||||||
// triangles or higher-order polygons the normal vectors
|
// triangles or higher-order polygons the normal vectors
|
||||||
|
@ -144,8 +140,9 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals(aiMesh *pMesh, unsigned int m
|
||||||
const aiVector3D *pV3 = &pMesh->mVertices[face.mIndices[face.mNumIndices - 1]];
|
const aiVector3D *pV3 = &pMesh->mVertices[face.mIndices[face.mNumIndices - 1]];
|
||||||
// Boolean XOR - if either but not both of these flags is set, then the winding order has
|
// Boolean XOR - if either but not both of these flags is set, then the winding order has
|
||||||
// changed and the cross product to calculate the normal needs to be reversed
|
// changed and the cross product to calculate the normal needs to be reversed
|
||||||
if (flippedWindingOrder_ != leftHanded_)
|
if (flippedWindingOrder_ != leftHanded_) {
|
||||||
std::swap(pV2, pV3);
|
std::swap(pV2, pV3);
|
||||||
|
}
|
||||||
const aiVector3D vNor = ((*pV2 - *pV1) ^ (*pV3 - *pV1)).NormalizeSafe();
|
const aiVector3D vNor = ((*pV2 - *pV1) ^ (*pV3 - *pV1)).NormalizeSafe();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < face.mNumIndices; ++i) {
|
for (unsigned int i = 0; i < face.mNumIndices; ++i) {
|
||||||
|
|
|
@ -60,8 +60,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API GenVertexNormalsProcess : public BaseProcess {
|
class ASSIMP_API GenVertexNormalsProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
GenVertexNormalsProcess();
|
GenVertexNormalsProcess();
|
||||||
~GenVertexNormalsProcess();
|
~GenVertexNormalsProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag.
|
/** Returns whether the processing step is present in the given flag.
|
||||||
|
@ -70,22 +72,21 @@ public:
|
||||||
* @return true if the process is present in this flag fields,
|
* @return true if the process is present in this flag fields,
|
||||||
* false if not.
|
* false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
|
|
||||||
// setter for configMaxAngle
|
// setter for configMaxAngle
|
||||||
inline void SetMaxSmoothAngle(ai_real f) {
|
inline void SetMaxSmoothAngle(ai_real f) {
|
||||||
|
|
|
@ -68,10 +68,6 @@ ImproveCacheLocalityProcess::ImproveCacheLocalityProcess()
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
ImproveCacheLocalityProcess::~ImproveCacheLocalityProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool ImproveCacheLocalityProcess::IsActive( unsigned int pFlags) const {
|
bool ImproveCacheLocalityProcess::IsActive( unsigned int pFlags) const {
|
||||||
|
|
|
@ -51,8 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** The ImproveCacheLocalityProcess reorders all faces for improved vertex
|
/** The ImproveCacheLocalityProcess reorders all faces for improved vertex
|
||||||
|
@ -61,26 +60,24 @@ namespace Assimp
|
||||||
*
|
*
|
||||||
* @note This step expects triagulated input data.
|
* @note This step expects triagulated input data.
|
||||||
*/
|
*/
|
||||||
class ImproveCacheLocalityProcess : public BaseProcess
|
class ImproveCacheLocalityProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
ImproveCacheLocalityProcess();
|
ImproveCacheLocalityProcess();
|
||||||
~ImproveCacheLocalityProcess();
|
~ImproveCacheLocalityProcess() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Check whether the pp step is active
|
// Check whether the pp step is active
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Executes the pp step on a given scene
|
// Executes the pp step on a given scene
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Configures the pp step
|
// Configures the pp step
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
|
@ -51,8 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
struct aiMesh;
|
struct aiMesh;
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** The JoinVerticesProcess unites identical vertices in all imported meshes.
|
/** The JoinVerticesProcess unites identical vertices in all imported meshes.
|
||||||
|
@ -65,12 +64,9 @@ namespace Assimp
|
||||||
class ASSIMP_API JoinVerticesProcess : public BaseProcess {
|
class ASSIMP_API JoinVerticesProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/// @brief The default class constructor.
|
/// The default class constructor / destructor.
|
||||||
JoinVerticesProcess() = default;
|
JoinVerticesProcess() = default;
|
||||||
|
~JoinVerticesProcess() override = default;
|
||||||
// -------------------------------------------------------------------
|
|
||||||
/// @brief The default class destructor.
|
|
||||||
~JoinVerticesProcess() = default;
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
|
@ -78,14 +74,14 @@ public:
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Unites identical vertices in the given mesh.
|
/** Unites identical vertices in the given mesh.
|
||||||
|
|
|
@ -53,11 +53,9 @@ namespace Assimp {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {}
|
LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {
|
||||||
|
// empty
|
||||||
// ------------------------------------------------------------------------------------------------
|
}
|
||||||
// Destructor, private as well
|
|
||||||
LimitBoneWeightsProcess::~LimitBoneWeightsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
|
|
|
@ -74,8 +74,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API LimitBoneWeightsProcess : public BaseProcess {
|
class ASSIMP_API LimitBoneWeightsProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
LimitBoneWeightsProcess();
|
LimitBoneWeightsProcess();
|
||||||
~LimitBoneWeightsProcess();
|
~LimitBoneWeightsProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag.
|
/** Returns whether the processing step is present in the given flag.
|
||||||
|
@ -84,27 +86,27 @@ public:
|
||||||
* @return true if the process is present in this flag fields,
|
* @return true if the process is present in this flag fields,
|
||||||
* false if not.
|
* false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
/** 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.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/** Limits the bone weight count for all vertices in the given mesh.
|
||||||
|
* @param pMesh The mesh to process.
|
||||||
|
*/
|
||||||
|
void ProcessMesh( aiMesh* pMesh);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Describes a bone weight on a vertex */
|
/** Describes a bone weight on a vertex */
|
||||||
|
|
|
@ -49,10 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
MakeVerboseFormatProcess::MakeVerboseFormatProcess() = default;
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
MakeVerboseFormatProcess::~MakeVerboseFormatProcess() = default;
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
void MakeVerboseFormatProcess::Execute(aiScene *pScene) {
|
void MakeVerboseFormatProcess::Execute(aiScene *pScene) {
|
||||||
|
|
|
@ -66,22 +66,19 @@ namespace Assimp {
|
||||||
* The step has been added because it was required by the viewer, however
|
* The step has been added because it was required by the viewer, however
|
||||||
* it has been moved to the main library since others might find it
|
* it has been moved to the main library since others might find it
|
||||||
* useful, too. */
|
* useful, too. */
|
||||||
class ASSIMP_API_WINONLY MakeVerboseFormatProcess : public BaseProcess
|
class ASSIMP_API_WINONLY MakeVerboseFormatProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
MakeVerboseFormatProcess();
|
|
||||||
~MakeVerboseFormatProcess();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
|
MakeVerboseFormatProcess() = default;
|
||||||
|
~MakeVerboseFormatProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
* @param pFlags The processing flags the importer was called with. A bitwise
|
* @param pFlags The processing flags the importer was called with. A bitwise
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not */
|
* @return true if the process is present in this flag fields, false if not */
|
||||||
bool IsActive( unsigned int /*pFlags*/ ) const
|
bool IsActive( unsigned int /*pFlags*/ ) const override
|
||||||
{
|
{
|
||||||
// NOTE: There is no direct flag that corresponds to
|
// NOTE: There is no direct flag that corresponds to
|
||||||
// this postprocess step.
|
// this postprocess step.
|
||||||
|
@ -92,7 +89,7 @@ public:
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at. */
|
* @param pScene The imported data to work at. */
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,6 @@ OptimizeGraphProcess::OptimizeGraphProcess() :
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
OptimizeGraphProcess::~OptimizeGraphProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool OptimizeGraphProcess::IsActive(unsigned int pFlags) const {
|
bool OptimizeGraphProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -71,8 +71,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class OptimizeGraphProcess : public BaseProcess {
|
class OptimizeGraphProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
OptimizeGraphProcess();
|
OptimizeGraphProcess();
|
||||||
~OptimizeGraphProcess();
|
~OptimizeGraphProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool IsActive( unsigned int pFlags) const override;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
|
@ -69,10 +69,6 @@ OptimizeMeshesProcess::OptimizeMeshesProcess()
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
OptimizeMeshesProcess::~OptimizeMeshesProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool OptimizeMeshesProcess::IsActive( unsigned int pFlags) const
|
bool OptimizeMeshesProcess::IsActive( unsigned int pFlags) const
|
||||||
|
|
|
@ -68,11 +68,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class OptimizeMeshesProcess : public BaseProcess {
|
class OptimizeMeshesProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
/// @brief The class constructor.
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
OptimizeMeshesProcess();
|
OptimizeMeshesProcess();
|
||||||
|
~OptimizeMeshesProcess() override = default;
|
||||||
/// @brief The class destructor.
|
|
||||||
~OptimizeMeshesProcess();
|
|
||||||
|
|
||||||
/** @brief Internal utility to store additional mesh info
|
/** @brief Internal utility to store additional mesh info
|
||||||
*/
|
*/
|
||||||
|
@ -94,16 +93,14 @@ public:
|
||||||
unsigned int output_id;
|
unsigned int output_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Specify whether you want meshes with different
|
/** @brief Specify whether you want meshes with different
|
||||||
|
|
|
@ -68,10 +68,6 @@ PretransformVertices::PretransformVertices() :
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
PretransformVertices::~PretransformVertices() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool PretransformVertices::IsActive(unsigned int pFlags) const {
|
bool PretransformVertices::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -68,8 +68,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API PretransformVertices : public BaseProcess {
|
class ASSIMP_API PretransformVertices : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
PretransformVertices();
|
PretransformVertices();
|
||||||
~PretransformVertices();
|
~PretransformVertices() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Check whether step is active
|
// Check whether step is active
|
||||||
|
|
|
@ -62,10 +62,6 @@ RemoveRedundantMatsProcess::RemoveRedundantMatsProcess()
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
RemoveRedundantMatsProcess::~RemoveRedundantMatsProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool RemoveRedundantMatsProcess::IsActive( unsigned int pFlags) const
|
bool RemoveRedundantMatsProcess::IsActive( unsigned int pFlags) const
|
||||||
|
|
|
@ -59,23 +59,22 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API RemoveRedundantMatsProcess : public BaseProcess {
|
class ASSIMP_API RemoveRedundantMatsProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
/// The default class constructor.
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
RemoveRedundantMatsProcess();
|
RemoveRedundantMatsProcess();
|
||||||
|
~RemoveRedundantMatsProcess() override = default;
|
||||||
/// The class destructor.
|
|
||||||
~RemoveRedundantMatsProcess();
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Check whether step is active
|
// Check whether step is active
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Execute step on a given scene
|
// Execute step on a given scene
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Setup import settings
|
// Setup import settings
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Set list of fixed (inmutable) materials
|
/** @brief Set list of fixed (inmutable) materials
|
||||||
|
|
|
@ -56,10 +56,6 @@ using namespace Assimp;
|
||||||
RemoveVCProcess::RemoveVCProcess() :
|
RemoveVCProcess::RemoveVCProcess() :
|
||||||
configDeleteFlags(), mScene() {}
|
configDeleteFlags(), mScene() {}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
RemoveVCProcess::~RemoveVCProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool RemoveVCProcess::IsActive(unsigned int pFlags) const {
|
bool RemoveVCProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -58,11 +58,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API RemoveVCProcess : public BaseProcess {
|
class ASSIMP_API RemoveVCProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
/// The default class constructor.
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
RemoveVCProcess();
|
RemoveVCProcess();
|
||||||
|
~RemoveVCProcess() override = default;
|
||||||
/// The class destructor.
|
|
||||||
~RemoveVCProcess();
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
|
@ -70,37 +69,35 @@ public:
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
virtual void SetupProperties(const Importer* pImp);
|
virtual void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Manually setup the configuration flags for the step
|
/** Manually setup the configuration flags for the step
|
||||||
*
|
*
|
||||||
* @param Bitwise combination of the #aiComponent enumerated values.
|
* @param Bitwise combination of the #aiComponent enumerated values.
|
||||||
*/
|
*/
|
||||||
void SetDeleteFlags(unsigned int f)
|
void SetDeleteFlags(unsigned int f) {
|
||||||
{
|
|
||||||
configDeleteFlags = f;
|
configDeleteFlags = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Query the current configuration.
|
/** Query the current configuration.
|
||||||
*/
|
*/
|
||||||
unsigned int GetDeleteFlags() const
|
unsigned int GetDeleteFlags() const {
|
||||||
{
|
|
||||||
return configDeleteFlags;
|
return configDeleteFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,25 +47,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
ScaleProcess::ScaleProcess()
|
// ------------------------------------------------------------------------------------------------
|
||||||
: BaseProcess()
|
ScaleProcess::ScaleProcess() : BaseProcess(), mScale( AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT ) {
|
||||||
, mScale( AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT ) {
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
ScaleProcess::~ScaleProcess() = default;
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void ScaleProcess::setScale( ai_real scale ) {
|
void ScaleProcess::setScale( ai_real scale ) {
|
||||||
mScale = scale;
|
mScale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
ai_real ScaleProcess::getScale() const {
|
ai_real ScaleProcess::getScale() const {
|
||||||
return mScale;
|
return mScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool ScaleProcess::IsActive( unsigned int pFlags ) const {
|
bool ScaleProcess::IsActive( unsigned int pFlags ) const {
|
||||||
return ( pFlags & aiProcess_GlobalScale ) != 0;
|
return ( pFlags & aiProcess_GlobalScale ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ScaleProcess::SetupProperties( const Importer* pImp ) {
|
void ScaleProcess::SetupProperties( const Importer* pImp ) {
|
||||||
// User scaling
|
// User scaling
|
||||||
mScale = pImp->GetPropertyFloat( AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY, 1.0f );
|
mScale = pImp->GetPropertyFloat( AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY, 1.0f );
|
||||||
|
@ -78,6 +80,7 @@ void ScaleProcess::SetupProperties( const Importer* pImp ) {
|
||||||
mScale *= importerScale;
|
mScale *= importerScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ScaleProcess::Execute( aiScene* pScene ) {
|
void ScaleProcess::Execute( aiScene* pScene ) {
|
||||||
if(mScale == 1.0f) {
|
if(mScale == 1.0f) {
|
||||||
return; // nothing to scale
|
return; // nothing to scale
|
||||||
|
@ -96,37 +99,30 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process animations and update position transform to new unit system
|
// Process animations and update position transform to new unit system
|
||||||
for( unsigned int animationID = 0; animationID < pScene->mNumAnimations; animationID++ )
|
for( unsigned int animationID = 0; animationID < pScene->mNumAnimations; animationID++ ) {
|
||||||
{
|
|
||||||
aiAnimation* animation = pScene->mAnimations[animationID];
|
aiAnimation* animation = pScene->mAnimations[animationID];
|
||||||
|
|
||||||
for( unsigned int animationChannel = 0; animationChannel < animation->mNumChannels; animationChannel++)
|
for( unsigned int animationChannel = 0; animationChannel < animation->mNumChannels; animationChannel++) {
|
||||||
{
|
|
||||||
aiNodeAnim* anim = animation->mChannels[animationChannel];
|
aiNodeAnim* anim = animation->mChannels[animationChannel];
|
||||||
|
|
||||||
for( unsigned int posKey = 0; posKey < anim->mNumPositionKeys; posKey++)
|
for( unsigned int posKey = 0; posKey < anim->mNumPositionKeys; posKey++) {
|
||||||
{
|
|
||||||
aiVectorKey& vectorKey = anim->mPositionKeys[posKey];
|
aiVectorKey& vectorKey = anim->mPositionKeys[posKey];
|
||||||
vectorKey.mValue *= mScale;
|
vectorKey.mValue *= mScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned int meshID = 0; meshID < pScene->mNumMeshes; meshID++)
|
for( unsigned int meshID = 0; meshID < pScene->mNumMeshes; meshID++) {
|
||||||
{
|
|
||||||
aiMesh *mesh = pScene->mMeshes[meshID];
|
aiMesh *mesh = pScene->mMeshes[meshID];
|
||||||
|
|
||||||
// Reconstruct mesh vertices to the new unit system
|
// Reconstruct mesh vertices to the new unit system
|
||||||
for( unsigned int vertexID = 0; vertexID < mesh->mNumVertices; vertexID++)
|
for( unsigned int vertexID = 0; vertexID < mesh->mNumVertices; vertexID++) {
|
||||||
{
|
|
||||||
aiVector3D& vertex = mesh->mVertices[vertexID];
|
aiVector3D& vertex = mesh->mVertices[vertexID];
|
||||||
vertex *= mScale;
|
vertex *= mScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// bone placement / scaling
|
// bone placement / scaling
|
||||||
for( unsigned int boneID = 0; boneID < mesh->mNumBones; boneID++)
|
for( unsigned int boneID = 0; boneID < mesh->mNumBones; boneID++) {
|
||||||
{
|
|
||||||
// Reconstruct matrix by transform rather than by scale
|
// Reconstruct matrix by transform rather than by scale
|
||||||
// This prevent scale values being changed which can
|
// This prevent scale values being changed which can
|
||||||
// be meaningful in some cases
|
// be meaningful in some cases
|
||||||
|
@ -152,12 +148,10 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||||
|
|
||||||
// animation mesh processing
|
// animation mesh processing
|
||||||
// convert by position rather than scale.
|
// convert by position rather than scale.
|
||||||
for( unsigned int animMeshID = 0; animMeshID < mesh->mNumAnimMeshes; animMeshID++)
|
for( unsigned int animMeshID = 0; animMeshID < mesh->mNumAnimMeshes; animMeshID++) {
|
||||||
{
|
|
||||||
aiAnimMesh * animMesh = mesh->mAnimMeshes[animMeshID];
|
aiAnimMesh * animMesh = mesh->mAnimMeshes[animMeshID];
|
||||||
|
|
||||||
for( unsigned int vertexID = 0; vertexID < animMesh->mNumVertices; vertexID++)
|
for( unsigned int vertexID = 0; vertexID < animMesh->mNumVertices; vertexID++) {
|
||||||
{
|
|
||||||
aiVector3D& vertex = animMesh->mVertices[vertexID];
|
aiVector3D& vertex = animMesh->mVertices[vertexID];
|
||||||
vertex *= mScale;
|
vertex *= mScale;
|
||||||
}
|
}
|
||||||
|
@ -167,16 +161,17 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||||
traverseNodes( pScene->mRootNode );
|
traverseNodes( pScene->mRootNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ScaleProcess::traverseNodes( aiNode *node, unsigned int nested_node_id ) {
|
void ScaleProcess::traverseNodes( aiNode *node, unsigned int nested_node_id ) {
|
||||||
applyScaling( node );
|
applyScaling( node );
|
||||||
|
|
||||||
for( size_t i = 0; i < node->mNumChildren; i++)
|
for( size_t i = 0; i < node->mNumChildren; i++) {
|
||||||
{
|
|
||||||
// recurse into the tree until we are done!
|
// recurse into the tree until we are done!
|
||||||
traverseNodes( node->mChildren[i], nested_node_id+1 );
|
traverseNodes( node->mChildren[i], nested_node_id+1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ScaleProcess::applyScaling( aiNode *currentNode ) {
|
void ScaleProcess::applyScaling( aiNode *currentNode ) {
|
||||||
if ( nullptr != currentNode ) {
|
if ( nullptr != currentNode ) {
|
||||||
// Reconstruct matrix by transform rather than by scale
|
// Reconstruct matrix by transform rather than by scale
|
||||||
|
|
|
@ -62,11 +62,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API ScaleProcess : public BaseProcess {
|
class ASSIMP_API ScaleProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
/// The default class constructor.
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
ScaleProcess();
|
ScaleProcess();
|
||||||
|
~ScaleProcess() override = default;
|
||||||
/// The class destructor.
|
|
||||||
virtual ~ScaleProcess();
|
|
||||||
|
|
||||||
/// Will set the scale manually.
|
/// Will set the scale manually.
|
||||||
void setScale( ai_real scale );
|
void setScale( ai_real scale );
|
||||||
|
@ -75,13 +74,13 @@ public:
|
||||||
ai_real getScale() const;
|
ai_real getScale() const;
|
||||||
|
|
||||||
/// Overwritten, @see BaseProcess
|
/// Overwritten, @see BaseProcess
|
||||||
virtual bool IsActive( unsigned int pFlags ) const;
|
virtual bool IsActive( unsigned int pFlags ) const override;
|
||||||
|
|
||||||
/// Overwritten, @see BaseProcess
|
/// Overwritten, @see BaseProcess
|
||||||
virtual void SetupProperties( const Importer* pImp );
|
virtual void SetupProperties( const Importer* pImp ) override;
|
||||||
|
|
||||||
/// Overwritten, @see BaseProcess
|
/// Overwritten, @see BaseProcess
|
||||||
virtual void Execute( aiScene* pScene );
|
virtual void Execute( aiScene* pScene ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void traverseNodes( aiNode *currentNode, unsigned int nested_node_id = 0 );
|
void traverseNodes( aiNode *currentNode, unsigned int nested_node_id = 0 );
|
||||||
|
|
|
@ -59,10 +59,6 @@ SortByPTypeProcess::SortByPTypeProcess() :
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
SortByPTypeProcess::~SortByPTypeProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool SortByPTypeProcess::IsActive(unsigned int pFlags) const {
|
bool SortByPTypeProcess::IsActive(unsigned int pFlags) const {
|
||||||
|
|
|
@ -60,17 +60,19 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API SortByPTypeProcess : public BaseProcess {
|
class ASSIMP_API SortByPTypeProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
SortByPTypeProcess();
|
SortByPTypeProcess();
|
||||||
~SortByPTypeProcess();
|
~SortByPTypeProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mConfigRemoveMeshes;
|
int mConfigRemoveMeshes;
|
||||||
|
|
|
@ -40,7 +40,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/// @file SplitByBoneCountProcess.cpp
|
/// @file SplitByBoneCountProcess.cpp
|
||||||
/// Implementation of the SplitByBoneCount postprocessing step
|
/// Implementation of the SplitByBoneCount postprocessing step
|
||||||
|
|
||||||
|
@ -59,47 +58,36 @@ using namespace Assimp::Formatter;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
SplitByBoneCountProcess::SplitByBoneCountProcess()
|
SplitByBoneCountProcess::SplitByBoneCountProcess() : mMaxBoneCount(AI_SBBC_DEFAULT_MAX_BONES) {
|
||||||
{
|
// empty
|
||||||
// set default, might be overridden by importer config
|
|
||||||
mMaxBoneCount = AI_SBBC_DEFAULT_MAX_BONES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor
|
|
||||||
SplitByBoneCountProcess::~SplitByBoneCountProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag.
|
// Returns whether the processing step is present in the given flag.
|
||||||
bool SplitByBoneCountProcess::IsActive( unsigned int pFlags) const
|
bool SplitByBoneCountProcess::IsActive( unsigned int pFlags) const {
|
||||||
{
|
|
||||||
return !!(pFlags & aiProcess_SplitByBoneCount);
|
return !!(pFlags & aiProcess_SplitByBoneCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Updates internal properties
|
// Updates internal properties
|
||||||
void SplitByBoneCountProcess::SetupProperties(const Importer* pImp)
|
void SplitByBoneCountProcess::SetupProperties(const Importer* pImp) {
|
||||||
{
|
|
||||||
mMaxBoneCount = pImp->GetPropertyInteger(AI_CONFIG_PP_SBBC_MAX_BONES,AI_SBBC_DEFAULT_MAX_BONES);
|
mMaxBoneCount = pImp->GetPropertyInteger(AI_CONFIG_PP_SBBC_MAX_BONES,AI_SBBC_DEFAULT_MAX_BONES);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
void SplitByBoneCountProcess::Execute( aiScene* pScene) {
|
||||||
{
|
|
||||||
ASSIMP_LOG_DEBUG("SplitByBoneCountProcess begin");
|
ASSIMP_LOG_DEBUG("SplitByBoneCountProcess begin");
|
||||||
|
|
||||||
// early out
|
// early out
|
||||||
bool isNecessary = false;
|
bool isNecessary = false;
|
||||||
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a)
|
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a)
|
||||||
if( pScene->mMeshes[a]->mNumBones > mMaxBoneCount )
|
if( pScene->mMeshes[a]->mNumBones > mMaxBoneCount ) {
|
||||||
{
|
|
||||||
isNecessary = true;
|
isNecessary = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isNecessary )
|
if( !isNecessary ) {
|
||||||
{
|
|
||||||
ASSIMP_LOG_DEBUG("SplitByBoneCountProcess early-out: no meshes with more than ", mMaxBoneCount, " bones." );
|
ASSIMP_LOG_DEBUG("SplitByBoneCountProcess early-out: no meshes with more than ", mMaxBoneCount, " bones." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -111,28 +99,23 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
||||||
// build a new array of meshes for the scene
|
// build a new array of meshes for the scene
|
||||||
std::vector<aiMesh*> meshes;
|
std::vector<aiMesh*> meshes;
|
||||||
|
|
||||||
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a)
|
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
|
||||||
{
|
|
||||||
aiMesh* srcMesh = pScene->mMeshes[a];
|
aiMesh* srcMesh = pScene->mMeshes[a];
|
||||||
|
|
||||||
std::vector<aiMesh*> newMeshes;
|
std::vector<aiMesh*> newMeshes;
|
||||||
SplitMesh( pScene->mMeshes[a], newMeshes);
|
SplitMesh( pScene->mMeshes[a], newMeshes);
|
||||||
|
|
||||||
// mesh was split
|
// mesh was split
|
||||||
if( !newMeshes.empty() )
|
if( !newMeshes.empty() ) {
|
||||||
{
|
|
||||||
// store new meshes and indices of the new meshes
|
// store new meshes and indices of the new meshes
|
||||||
for( unsigned int b = 0; b < newMeshes.size(); ++b)
|
for( unsigned int b = 0; b < newMeshes.size(); ++b) {
|
||||||
{
|
|
||||||
mSubMeshIndices[a].push_back( static_cast<unsigned int>(meshes.size()));
|
mSubMeshIndices[a].push_back( static_cast<unsigned int>(meshes.size()));
|
||||||
meshes.push_back( newMeshes[b]);
|
meshes.push_back( newMeshes[b]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// and destroy the source mesh. It should be completely contained inside the new submeshes
|
// and destroy the source mesh. It should be completely contained inside the new submeshes
|
||||||
delete srcMesh;
|
delete srcMesh;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Mesh is kept unchanged - store it's new place in the mesh array
|
// Mesh is kept unchanged - store it's new place in the mesh array
|
||||||
mSubMeshIndices[a].push_back( static_cast<unsigned int>(meshes.size()));
|
mSubMeshIndices[a].push_back( static_cast<unsigned int>(meshes.size()));
|
||||||
meshes.push_back( srcMesh);
|
meshes.push_back( srcMesh);
|
||||||
|
@ -153,11 +136,9 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Splits the given mesh by bone count.
|
// Splits the given mesh by bone count.
|
||||||
void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh*>& poNewMeshes) const
|
void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh*>& poNewMeshes) const {
|
||||||
{
|
|
||||||
// skip if not necessary
|
// skip if not necessary
|
||||||
if( pMesh->mNumBones <= mMaxBoneCount )
|
if( pMesh->mNumBones <= mMaxBoneCount ) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,17 +146,13 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
// TODO: (thom) maybe add a custom allocator here to avoid allocating tens of thousands of small arrays
|
// TODO: (thom) maybe add a custom allocator here to avoid allocating tens of thousands of small arrays
|
||||||
typedef std::pair<unsigned int, float> BoneWeight;
|
typedef std::pair<unsigned int, float> BoneWeight;
|
||||||
std::vector< std::vector<BoneWeight> > vertexBones( pMesh->mNumVertices);
|
std::vector< std::vector<BoneWeight> > vertexBones( pMesh->mNumVertices);
|
||||||
for( unsigned int a = 0; a < pMesh->mNumBones; ++a)
|
for( unsigned int a = 0; a < pMesh->mNumBones; ++a) {
|
||||||
{
|
|
||||||
const aiBone* bone = pMesh->mBones[a];
|
const aiBone* bone = pMesh->mBones[a];
|
||||||
for( unsigned int b = 0; b < bone->mNumWeights; ++b)
|
for( unsigned int b = 0; b < bone->mNumWeights; ++b) {
|
||||||
{
|
if (bone->mWeights[b].mWeight > 0.0f) {
|
||||||
if (bone->mWeights[b].mWeight > 0.0f)
|
|
||||||
{
|
|
||||||
int vertexId = bone->mWeights[b].mVertexId;
|
int vertexId = bone->mWeights[b].mVertexId;
|
||||||
vertexBones[vertexId].emplace_back(a, bone->mWeights[b].mWeight);
|
vertexBones[vertexId].emplace_back(a, bone->mWeights[b].mWeight);
|
||||||
if (vertexBones[vertexId].size() > mMaxBoneCount)
|
if (vertexBones[vertexId].size() > mMaxBoneCount) {
|
||||||
{
|
|
||||||
throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!");
|
throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,8 +161,7 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
|
|
||||||
unsigned int numFacesHandled = 0;
|
unsigned int numFacesHandled = 0;
|
||||||
std::vector<bool> isFaceHandled( pMesh->mNumFaces, false);
|
std::vector<bool> isFaceHandled( pMesh->mNumFaces, false);
|
||||||
while( numFacesHandled < pMesh->mNumFaces )
|
while( numFacesHandled < pMesh->mNumFaces ) {
|
||||||
{
|
|
||||||
// which bones are used in the current submesh
|
// which bones are used in the current submesh
|
||||||
unsigned int numBones = 0;
|
unsigned int numBones = 0;
|
||||||
std::vector<bool> isBoneUsed( pMesh->mNumBones, false);
|
std::vector<bool> isBoneUsed( pMesh->mNumBones, false);
|
||||||
|
@ -196,11 +172,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
unsigned int numSubMeshVertices = 0;
|
unsigned int numSubMeshVertices = 0;
|
||||||
|
|
||||||
// add faces to the new submesh as long as all bones affecting the faces' vertices fit in the limit
|
// add faces to the new submesh as long as all bones affecting the faces' vertices fit in the limit
|
||||||
for( unsigned int a = 0; a < pMesh->mNumFaces; ++a)
|
for( unsigned int a = 0; a < pMesh->mNumFaces; ++a) {
|
||||||
{
|
|
||||||
// skip if the face is already stored in a submesh
|
// skip if the face is already stored in a submesh
|
||||||
if( isFaceHandled[a] )
|
if( isFaceHandled[a] ) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// a small local set of new bones for the current face. State of all used bones for that face
|
// a small local set of new bones for the current face. State of all used bones for that face
|
||||||
|
@ -209,30 +183,24 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
|
|
||||||
const aiFace& face = pMesh->mFaces[a];
|
const aiFace& face = pMesh->mFaces[a];
|
||||||
// check every vertex if its bones would still fit into the current submesh
|
// check every vertex if its bones would still fit into the current submesh
|
||||||
for( unsigned int b = 0; b < face.mNumIndices; ++b )
|
for( unsigned int b = 0; b < face.mNumIndices; ++b ) {
|
||||||
{
|
|
||||||
const std::vector<BoneWeight>& vb = vertexBones[face.mIndices[b]];
|
const std::vector<BoneWeight>& vb = vertexBones[face.mIndices[b]];
|
||||||
for( unsigned int c = 0; c < vb.size(); ++c)
|
for( unsigned int c = 0; c < vb.size(); ++c) {
|
||||||
{
|
|
||||||
unsigned int boneIndex = vb[c].first;
|
unsigned int boneIndex = vb[c].first;
|
||||||
if( !isBoneUsed[boneIndex] )
|
if( !isBoneUsed[boneIndex] ) {
|
||||||
{
|
|
||||||
newBonesAtCurrentFace.insert(boneIndex);
|
newBonesAtCurrentFace.insert(boneIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
|
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
|
||||||
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount )
|
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount ) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark all new bones as necessary
|
// mark all new bones as necessary
|
||||||
for (std::set<unsigned int>::iterator it = newBonesAtCurrentFace.begin(); it != newBonesAtCurrentFace.end(); ++it)
|
for (std::set<unsigned int>::iterator it = newBonesAtCurrentFace.begin(); it != newBonesAtCurrentFace.end(); ++it) {
|
||||||
{
|
if (!isBoneUsed[*it]) {
|
||||||
if (!isBoneUsed[*it])
|
|
||||||
{
|
|
||||||
isBoneUsed[*it] = true;
|
isBoneUsed[*it] = true;
|
||||||
numBones++;
|
numBones++;
|
||||||
}
|
}
|
||||||
|
@ -261,27 +229,21 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
newMesh->mNumVertices = numSubMeshVertices;
|
newMesh->mNumVertices = numSubMeshVertices;
|
||||||
newMesh->mNumFaces = static_cast<unsigned int>(subMeshFaces.size());
|
newMesh->mNumFaces = static_cast<unsigned int>(subMeshFaces.size());
|
||||||
newMesh->mVertices = new aiVector3D[newMesh->mNumVertices];
|
newMesh->mVertices = new aiVector3D[newMesh->mNumVertices];
|
||||||
if( pMesh->HasNormals() )
|
if( pMesh->HasNormals() ) {
|
||||||
{
|
|
||||||
newMesh->mNormals = new aiVector3D[newMesh->mNumVertices];
|
newMesh->mNormals = new aiVector3D[newMesh->mNumVertices];
|
||||||
}
|
}
|
||||||
if( pMesh->HasTangentsAndBitangents() )
|
if( pMesh->HasTangentsAndBitangents() ) {
|
||||||
{
|
|
||||||
newMesh->mTangents = new aiVector3D[newMesh->mNumVertices];
|
newMesh->mTangents = new aiVector3D[newMesh->mNumVertices];
|
||||||
newMesh->mBitangents = new aiVector3D[newMesh->mNumVertices];
|
newMesh->mBitangents = new aiVector3D[newMesh->mNumVertices];
|
||||||
}
|
}
|
||||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) {
|
||||||
{
|
if( pMesh->HasTextureCoords( a) ) {
|
||||||
if( pMesh->HasTextureCoords( a) )
|
|
||||||
{
|
|
||||||
newMesh->mTextureCoords[a] = new aiVector3D[newMesh->mNumVertices];
|
newMesh->mTextureCoords[a] = new aiVector3D[newMesh->mNumVertices];
|
||||||
}
|
}
|
||||||
newMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a];
|
newMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a];
|
||||||
}
|
}
|
||||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a ) {
|
||||||
{
|
if( pMesh->HasVertexColors( a) ) {
|
||||||
if( pMesh->HasVertexColors( a) )
|
|
||||||
{
|
|
||||||
newMesh->mColors[a] = new aiColor4D[newMesh->mNumVertices];
|
newMesh->mColors[a] = new aiColor4D[newMesh->mNumVertices];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,41 +252,33 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
newMesh->mFaces = new aiFace[subMeshFaces.size()];
|
newMesh->mFaces = new aiFace[subMeshFaces.size()];
|
||||||
unsigned int nvi = 0; // next vertex index
|
unsigned int nvi = 0; // next vertex index
|
||||||
std::vector<unsigned int> previousVertexIndices( numSubMeshVertices, std::numeric_limits<unsigned int>::max()); // per new vertex: its index in the source mesh
|
std::vector<unsigned int> previousVertexIndices( numSubMeshVertices, std::numeric_limits<unsigned int>::max()); // per new vertex: its index in the source mesh
|
||||||
for( unsigned int a = 0; a < subMeshFaces.size(); ++a )
|
for( unsigned int a = 0; a < subMeshFaces.size(); ++a ) {
|
||||||
{
|
|
||||||
const aiFace& srcFace = pMesh->mFaces[subMeshFaces[a]];
|
const aiFace& srcFace = pMesh->mFaces[subMeshFaces[a]];
|
||||||
aiFace& dstFace = newMesh->mFaces[a];
|
aiFace& dstFace = newMesh->mFaces[a];
|
||||||
dstFace.mNumIndices = srcFace.mNumIndices;
|
dstFace.mNumIndices = srcFace.mNumIndices;
|
||||||
dstFace.mIndices = new unsigned int[dstFace.mNumIndices];
|
dstFace.mIndices = new unsigned int[dstFace.mNumIndices];
|
||||||
|
|
||||||
// accumulate linearly all the vertices of the source face
|
// accumulate linearly all the vertices of the source face
|
||||||
for( unsigned int b = 0; b < dstFace.mNumIndices; ++b )
|
for( unsigned int b = 0; b < dstFace.mNumIndices; ++b ) {
|
||||||
{
|
|
||||||
unsigned int srcIndex = srcFace.mIndices[b];
|
unsigned int srcIndex = srcFace.mIndices[b];
|
||||||
dstFace.mIndices[b] = nvi;
|
dstFace.mIndices[b] = nvi;
|
||||||
previousVertexIndices[nvi] = srcIndex;
|
previousVertexIndices[nvi] = srcIndex;
|
||||||
|
|
||||||
newMesh->mVertices[nvi] = pMesh->mVertices[srcIndex];
|
newMesh->mVertices[nvi] = pMesh->mVertices[srcIndex];
|
||||||
if( pMesh->HasNormals() )
|
if( pMesh->HasNormals() ) {
|
||||||
{
|
|
||||||
newMesh->mNormals[nvi] = pMesh->mNormals[srcIndex];
|
newMesh->mNormals[nvi] = pMesh->mNormals[srcIndex];
|
||||||
}
|
}
|
||||||
if( pMesh->HasTangentsAndBitangents() )
|
if( pMesh->HasTangentsAndBitangents() ) {
|
||||||
{
|
|
||||||
newMesh->mTangents[nvi] = pMesh->mTangents[srcIndex];
|
newMesh->mTangents[nvi] = pMesh->mTangents[srcIndex];
|
||||||
newMesh->mBitangents[nvi] = pMesh->mBitangents[srcIndex];
|
newMesh->mBitangents[nvi] = pMesh->mBitangents[srcIndex];
|
||||||
}
|
}
|
||||||
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c )
|
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c ) {
|
||||||
{
|
if( pMesh->HasTextureCoords( c) ) {
|
||||||
if( pMesh->HasTextureCoords( c) )
|
|
||||||
{
|
|
||||||
newMesh->mTextureCoords[c][nvi] = pMesh->mTextureCoords[c][srcIndex];
|
newMesh->mTextureCoords[c][nvi] = pMesh->mTextureCoords[c][srcIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c )
|
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c ) {
|
||||||
{
|
if( pMesh->HasVertexColors( c) ) {
|
||||||
if( pMesh->HasVertexColors( c) )
|
|
||||||
{
|
|
||||||
newMesh->mColors[c][nvi] = pMesh->mColors[c][srcIndex];
|
newMesh->mColors[c][nvi] = pMesh->mColors[c][srcIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,10 +294,8 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
newMesh->mBones = new aiBone*[numBones];
|
newMesh->mBones = new aiBone*[numBones];
|
||||||
|
|
||||||
std::vector<unsigned int> mappedBoneIndex( pMesh->mNumBones, std::numeric_limits<unsigned int>::max());
|
std::vector<unsigned int> mappedBoneIndex( pMesh->mNumBones, std::numeric_limits<unsigned int>::max());
|
||||||
for( unsigned int a = 0; a < pMesh->mNumBones; ++a )
|
for( unsigned int a = 0; a < pMesh->mNumBones; ++a ) {
|
||||||
{
|
if( !isBoneUsed[a] ) {
|
||||||
if( !isBoneUsed[a] )
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,24 +312,20 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
ai_assert( newMesh->mNumBones == numBones );
|
ai_assert( newMesh->mNumBones == numBones );
|
||||||
|
|
||||||
// iterate over all new vertices and count which bones affected its old vertex in the source mesh
|
// iterate over all new vertices and count which bones affected its old vertex in the source mesh
|
||||||
for( unsigned int a = 0; a < numSubMeshVertices; ++a )
|
for( unsigned int a = 0; a < numSubMeshVertices; ++a ) {
|
||||||
{
|
|
||||||
unsigned int oldIndex = previousVertexIndices[a];
|
unsigned int oldIndex = previousVertexIndices[a];
|
||||||
const std::vector<BoneWeight>& bonesOnThisVertex = vertexBones[oldIndex];
|
const std::vector<BoneWeight>& bonesOnThisVertex = vertexBones[oldIndex];
|
||||||
|
|
||||||
for( unsigned int b = 0; b < bonesOnThisVertex.size(); ++b )
|
for( unsigned int b = 0; b < bonesOnThisVertex.size(); ++b ) {
|
||||||
{
|
|
||||||
unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ];
|
unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ];
|
||||||
if( newBoneIndex != std::numeric_limits<unsigned int>::max() )
|
if( newBoneIndex != std::numeric_limits<unsigned int>::max() ) {
|
||||||
{
|
|
||||||
newMesh->mBones[newBoneIndex]->mNumWeights++;
|
newMesh->mBones[newBoneIndex]->mNumWeights++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate all bone weight arrays accordingly
|
// allocate all bone weight arrays accordingly
|
||||||
for( unsigned int a = 0; a < newMesh->mNumBones; ++a )
|
for( unsigned int a = 0; a < newMesh->mNumBones; ++a ) {
|
||||||
{
|
|
||||||
aiBone* bone = newMesh->mBones[a];
|
aiBone* bone = newMesh->mBones[a];
|
||||||
ai_assert( bone->mNumWeights > 0 );
|
ai_assert( bone->mNumWeights > 0 );
|
||||||
bone->mWeights = new aiVertexWeight[bone->mNumWeights];
|
bone->mWeights = new aiVertexWeight[bone->mNumWeights];
|
||||||
|
@ -385,16 +333,14 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
}
|
}
|
||||||
|
|
||||||
// now copy all the bone vertex weights for all the vertices which made it into the new submesh
|
// now copy all the bone vertex weights for all the vertices which made it into the new submesh
|
||||||
for( unsigned int a = 0; a < numSubMeshVertices; ++a)
|
for( unsigned int a = 0; a < numSubMeshVertices; ++a) {
|
||||||
{
|
|
||||||
// find the source vertex for it in the source mesh
|
// find the source vertex for it in the source mesh
|
||||||
unsigned int previousIndex = previousVertexIndices[a];
|
unsigned int previousIndex = previousVertexIndices[a];
|
||||||
// these bones were affecting it
|
// these bones were affecting it
|
||||||
const std::vector<BoneWeight>& bonesOnThisVertex = vertexBones[previousIndex];
|
const std::vector<BoneWeight>& bonesOnThisVertex = vertexBones[previousIndex];
|
||||||
// all of the bones affecting it should be present in the new submesh, or else
|
// all of the bones affecting it should be present in the new submesh, or else
|
||||||
// the face it comprises shouldn't be present
|
// the face it comprises shouldn't be present
|
||||||
for( unsigned int b = 0; b < bonesOnThisVertex.size(); ++b)
|
for( unsigned int b = 0; b < bonesOnThisVertex.size(); ++b) {
|
||||||
{
|
|
||||||
unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ];
|
unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ];
|
||||||
ai_assert( newBoneIndex != std::numeric_limits<unsigned int>::max() );
|
ai_assert( newBoneIndex != std::numeric_limits<unsigned int>::max() );
|
||||||
aiVertexWeight* dstWeight = newMesh->mBones[newBoneIndex]->mWeights + newMesh->mBones[newBoneIndex]->mNumWeights;
|
aiVertexWeight* dstWeight = newMesh->mBones[newBoneIndex]->mWeights + newMesh->mBones[newBoneIndex]->mNumWeights;
|
||||||
|
@ -450,14 +396,11 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Recursively updates the node's mesh list to account for the changed mesh list
|
// Recursively updates the node's mesh list to account for the changed mesh list
|
||||||
void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const
|
void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const {
|
||||||
{
|
|
||||||
// rebuild the node's mesh index list
|
// rebuild the node's mesh index list
|
||||||
if( pNode->mNumMeshes > 0 )
|
if( pNode->mNumMeshes == 0 ) {
|
||||||
{
|
|
||||||
std::vector<unsigned int> newMeshList;
|
std::vector<unsigned int> newMeshList;
|
||||||
for( unsigned int a = 0; a < pNode->mNumMeshes; ++a)
|
for( unsigned int a = 0; a < pNode->mNumMeshes; ++a) {
|
||||||
{
|
|
||||||
unsigned int srcIndex = pNode->mMeshes[a];
|
unsigned int srcIndex = pNode->mMeshes[a];
|
||||||
const std::vector<unsigned int>& replaceMeshes = mSubMeshIndices[srcIndex];
|
const std::vector<unsigned int>& replaceMeshes = mSubMeshIndices[srcIndex];
|
||||||
newMeshList.insert( newMeshList.end(), replaceMeshes.begin(), replaceMeshes.end());
|
newMeshList.insert( newMeshList.end(), replaceMeshes.begin(), replaceMeshes.end());
|
||||||
|
@ -470,8 +413,7 @@ void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// do that also recursively for all children
|
// do that also recursively for all children
|
||||||
for( unsigned int a = 0; a < pNode->mNumChildren; ++a )
|
for( unsigned int a = 0; a < pNode->mNumChildren; ++a ) {
|
||||||
{
|
|
||||||
UpdateNode( pNode->mChildren[a]);
|
UpdateNode( pNode->mChildren[a]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2022, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -51,9 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/** Postprocessing filter to split meshes with many bones into submeshes
|
/** Postprocessing filter to split meshes with many bones into submeshes
|
||||||
* so that each submesh has a certain max bone count.
|
* so that each submesh has a certain max bone count.
|
||||||
|
@ -61,34 +58,29 @@ namespace Assimp
|
||||||
* Applied BEFORE the JoinVertices-Step occurs.
|
* Applied BEFORE the JoinVertices-Step occurs.
|
||||||
* Returns NON-UNIQUE vertices, splits by bone count.
|
* Returns NON-UNIQUE vertices, splits by bone count.
|
||||||
*/
|
*/
|
||||||
class SplitByBoneCountProcess : public BaseProcess
|
class SplitByBoneCountProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
SplitByBoneCountProcess();
|
SplitByBoneCountProcess();
|
||||||
~SplitByBoneCountProcess();
|
~SplitByBoneCountProcess() override = default;
|
||||||
|
|
||||||
public:
|
/// @brief Returns whether the processing step is present in the given flag.
|
||||||
/** Returns whether the processing step is present in the given flag.
|
/// @param pFlags The processing flags the importer was called with. A
|
||||||
* @param pFlags The processing flags the importer was called with. A
|
/// bitwise combination of #aiPostProcessSteps.
|
||||||
* bitwise combination of #aiPostProcessSteps.
|
/// @return true if the process is present in this flag fields, false if not.
|
||||||
* @return true if the process is present in this flag fields,
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
* false if not.
|
|
||||||
*/
|
|
||||||
bool IsActive( unsigned int pFlags) const;
|
|
||||||
|
|
||||||
/** Called prior to ExecuteOnScene().
|
/// @brief Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
/// The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
/// basing on the Importer's configuration property list.
|
||||||
*/
|
virtual void SetupProperties(const Importer* pImp) override;
|
||||||
virtual void SetupProperties(const Importer* pImp);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Executes the post processing step on the given imported data.
|
/// Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
/// At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
/// @param pScene The imported data to work at.
|
||||||
*/
|
void Execute( aiScene* pScene) override;
|
||||||
void Execute( aiScene* pScene);
|
|
||||||
|
|
||||||
/// Splits the given mesh by bone count.
|
/// Splits the given mesh by bone count.
|
||||||
/// @param pMesh the Mesh to split. Is not changed at all, but might be superfluous in case it was split.
|
/// @param pMesh the Mesh to split. Is not changed at all, but might be superfluous in case it was split.
|
||||||
|
|
|
@ -55,9 +55,6 @@ SplitLargeMeshesProcess_Triangle::SplitLargeMeshesProcess_Triangle() {
|
||||||
LIMIT = AI_SLM_DEFAULT_MAX_TRIANGLES;
|
LIMIT = AI_SLM_DEFAULT_MAX_TRIANGLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SplitLargeMeshesProcess_Triangle::~SplitLargeMeshesProcess_Triangle() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool SplitLargeMeshesProcess_Triangle::IsActive( unsigned int pFlags) const {
|
bool SplitLargeMeshesProcess_Triangle::IsActive( unsigned int pFlags) const {
|
||||||
|
@ -329,9 +326,6 @@ SplitLargeMeshesProcess_Vertex::SplitLargeMeshesProcess_Vertex() {
|
||||||
LIMIT = AI_SLM_DEFAULT_MAX_VERTICES;
|
LIMIT = AI_SLM_DEFAULT_MAX_VERTICES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SplitLargeMeshesProcess_Vertex::~SplitLargeMeshesProcess_Vertex() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool SplitLargeMeshesProcess_Vertex::IsActive( unsigned int pFlags) const {
|
bool SplitLargeMeshesProcess_Vertex::IsActive( unsigned int pFlags) const {
|
||||||
|
|
|
@ -83,16 +83,15 @@ class SplitLargeMeshesProcess_Vertex;
|
||||||
* Applied BEFORE the JoinVertices-Step occurs.
|
* Applied BEFORE the JoinVertices-Step occurs.
|
||||||
* Returns NON-UNIQUE vertices, splits by triangle number.
|
* Returns NON-UNIQUE vertices, splits by triangle number.
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API SplitLargeMeshesProcess_Triangle : public BaseProcess
|
class ASSIMP_API SplitLargeMeshesProcess_Triangle : public BaseProcess {
|
||||||
{
|
|
||||||
friend class SplitLargeMeshesProcess_Vertex;
|
friend class SplitLargeMeshesProcess_Vertex;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
SplitLargeMeshesProcess_Triangle();
|
SplitLargeMeshesProcess_Triangle();
|
||||||
~SplitLargeMeshesProcess_Triangle();
|
~SplitLargeMeshesProcess_Triangle() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag.
|
/** Returns whether the processing step is present in the given flag.
|
||||||
* @param pFlags The processing flags the importer was called with. A
|
* @param pFlags The processing flags the importer was called with. A
|
||||||
|
@ -100,16 +99,14 @@ public:
|
||||||
* @return true if the process is present in this flag fields,
|
* @return true if the process is present in this flag fields,
|
||||||
* false if not.
|
* false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
virtual void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
|
||||||
//! Set the split limit - needed for unit testing
|
//! Set the split limit - needed for unit testing
|
||||||
inline void SetLimit(unsigned int l)
|
inline void SetLimit(unsigned int l)
|
||||||
|
@ -119,14 +116,12 @@ public:
|
||||||
inline unsigned int GetLimit() const
|
inline unsigned int GetLimit() const
|
||||||
{return LIMIT;}
|
{return LIMIT;}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
//! Apply the algorithm to a given mesh
|
//! Apply the algorithm to a given mesh
|
||||||
|
@ -144,36 +139,31 @@ public:
|
||||||
unsigned int LIMIT;
|
unsigned int LIMIT;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Post-processing filter to split large meshes into sub-meshes
|
/** Post-processing filter to split large meshes into sub-meshes
|
||||||
*
|
*
|
||||||
* Applied AFTER the JoinVertices-Step occurs.
|
* Applied AFTER the JoinVertices-Step occurs.
|
||||||
* Returns UNIQUE vertices, splits by vertex number.
|
* Returns UNIQUE vertices, splits by vertex number.
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API SplitLargeMeshesProcess_Vertex : public BaseProcess
|
class ASSIMP_API SplitLargeMeshesProcess_Vertex : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SplitLargeMeshesProcess_Vertex();
|
SplitLargeMeshesProcess_Vertex();
|
||||||
~SplitLargeMeshesProcess_Vertex();
|
~SplitLargeMeshesProcess_Vertex() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
* @param pFlags The processing flags the importer was called with. A bitwise
|
* @param pFlags The processing flags the importer was called with. A bitwise
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Called prior to ExecuteOnScene().
|
/** Called prior to ExecuteOnScene().
|
||||||
* The function is a request to the process to update its configuration
|
* The function is a request to the process to update its configuration
|
||||||
* basing on the Importer's configuration property list.
|
* basing on the Importer's configuration property list.
|
||||||
*/
|
*/
|
||||||
virtual void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
|
||||||
//! Set the split limit - needed for unit testing
|
//! Set the split limit - needed for unit testing
|
||||||
inline void SetLimit(unsigned int l)
|
inline void SetLimit(unsigned int l)
|
||||||
|
@ -183,14 +173,12 @@ public:
|
||||||
inline unsigned int GetLimit() const
|
inline unsigned int GetLimit() const
|
||||||
{return LIMIT;}
|
{return LIMIT;}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
//! Apply the algorithm to a given mesh
|
//! Apply the algorithm to a given mesh
|
||||||
|
|
|
@ -56,33 +56,24 @@ using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
TextureTransformStep::TextureTransformStep() :
|
TextureTransformStep::TextureTransformStep() : configFlags() {
|
||||||
configFlags()
|
|
||||||
{
|
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
TextureTransformStep::~TextureTransformStep() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool TextureTransformStep::IsActive( unsigned int pFlags) const
|
bool TextureTransformStep::IsActive( unsigned int pFlags) const {
|
||||||
{
|
|
||||||
return (pFlags & aiProcess_TransformUVCoords) != 0;
|
return (pFlags & aiProcess_TransformUVCoords) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Setup properties
|
// Setup properties
|
||||||
void TextureTransformStep::SetupProperties(const Importer* pImp)
|
void TextureTransformStep::SetupProperties(const Importer* pImp) {
|
||||||
{
|
|
||||||
configFlags = pImp->GetPropertyInteger(AI_CONFIG_PP_TUV_EVALUATE,AI_UVTRAFO_ALL);
|
configFlags = pImp->GetPropertyInteger(AI_CONFIG_PP_TUV_EVALUATE,AI_UVTRAFO_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info) {
|
||||||
{
|
|
||||||
/* This function tries to simplify the input UV transformation.
|
/* This function tries to simplify the input UV transformation.
|
||||||
* That's very important as it allows us to reduce the number
|
* That's very important as it allows us to reduce the number
|
||||||
* of output UV channels. The order in which the transformations
|
* of output UV channels. The order in which the transformations
|
||||||
|
@ -90,7 +81,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rounded;
|
int rounded;
|
||||||
char szTemp[512];
|
char szTemp[512] = {};
|
||||||
|
|
||||||
/* Optimize the rotation angle. That's slightly difficult as
|
/* Optimize the rotation angle. That's slightly difficult as
|
||||||
* we have an inprecise floating-point number (when comparing
|
* we have an inprecise floating-point number (when comparing
|
||||||
|
@ -98,12 +89,10 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
||||||
* an epsilon of 5 degrees). If there is a rotation value, we can't
|
* an epsilon of 5 degrees). If there is a rotation value, we can't
|
||||||
* perform any further optimizations.
|
* perform any further optimizations.
|
||||||
*/
|
*/
|
||||||
if (info.mRotation)
|
if (info.mRotation) {
|
||||||
{
|
|
||||||
float out = info.mRotation;
|
float out = info.mRotation;
|
||||||
rounded = static_cast<int>((info.mRotation / static_cast<float>(AI_MATH_TWO_PI)));
|
rounded = static_cast<int>((info.mRotation / static_cast<float>(AI_MATH_TWO_PI)));
|
||||||
if (rounded)
|
if (rounded) {
|
||||||
{
|
|
||||||
out -= rounded * static_cast<float>(AI_MATH_PI);
|
out -= rounded * static_cast<float>(AI_MATH_PI);
|
||||||
ASSIMP_LOG_INFO("Texture coordinate rotation ", info.mRotation, " can be simplified to ", out);
|
ASSIMP_LOG_INFO("Texture coordinate rotation ", info.mRotation, " can be simplified to ", out);
|
||||||
}
|
}
|
||||||
|
@ -187,8 +176,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void UpdateUVIndex(const std::list<TTUpdateInfo>& l, unsigned int n)
|
void UpdateUVIndex(const std::list<TTUpdateInfo>& l, unsigned int n) {
|
||||||
{
|
|
||||||
// Don't set if == 0 && wasn't set before
|
// Don't set if == 0 && wasn't set before
|
||||||
for (std::list<TTUpdateInfo>::const_iterator it = l.begin();it != l.end(); ++it) {
|
for (std::list<TTUpdateInfo>::const_iterator it = l.begin();it != l.end(); ++it) {
|
||||||
const TTUpdateInfo& info = *it;
|
const TTUpdateInfo& info = *it;
|
||||||
|
@ -203,8 +191,7 @@ void UpdateUVIndex(const std::list<TTUpdateInfo>& l, unsigned int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
inline const char* MappingModeToChar(aiTextureMapMode map)
|
inline static const char* MappingModeToChar(aiTextureMapMode map) {
|
||||||
{
|
|
||||||
if (aiTextureMapMode_Wrap == map)
|
if (aiTextureMapMode_Wrap == map)
|
||||||
return "-w";
|
return "-w";
|
||||||
|
|
||||||
|
@ -215,8 +202,7 @@ inline const char* MappingModeToChar(aiTextureMapMode map)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void TextureTransformStep::Execute( aiScene* pScene)
|
void TextureTransformStep::Execute( aiScene* pScene) {
|
||||||
{
|
|
||||||
ASSIMP_LOG_DEBUG("TransformUVCoordsProcess begin");
|
ASSIMP_LOG_DEBUG("TransformUVCoordsProcess begin");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -193,28 +193,23 @@ struct STransformVecInfo : public aiUVTransform {
|
||||||
/** Helper step to compute final UV coordinate sets if there are scalings
|
/** Helper step to compute final UV coordinate sets if there are scalings
|
||||||
* or rotations in the original data read from the file.
|
* or rotations in the original data read from the file.
|
||||||
*/
|
*/
|
||||||
class TextureTransformStep : public BaseProcess
|
class TextureTransformStep : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
TextureTransformStep();
|
TextureTransformStep();
|
||||||
~TextureTransformStep();
|
~TextureTransformStep() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void SetupProperties(const Importer* pImp);
|
void SetupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Preprocess a specific UV transformation setup
|
/** Preprocess a specific UV transformation setup
|
||||||
*
|
*
|
||||||
|
@ -223,10 +218,9 @@ protected:
|
||||||
void PreProcessUVTransform(STransformVecInfo& info);
|
void PreProcessUVTransform(STransformVecInfo& info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
unsigned int configFlags;
|
unsigned int configFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace Assimp
|
||||||
|
|
||||||
#endif //! AI_TEXTURE_TRANSFORM_H_INCLUDED
|
#endif //! AI_TEXTURE_TRANSFORM_H_INCLUDED
|
||||||
|
|
|
@ -156,15 +156,6 @@ namespace {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Constructor to be privately used by Importer
|
|
||||||
TriangulateProcess::TriangulateProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
TriangulateProcess::~TriangulateProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool TriangulateProcess::IsActive( unsigned int pFlags) const
|
bool TriangulateProcess::IsActive( unsigned int pFlags) const
|
||||||
|
|
|
@ -61,8 +61,10 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
class ASSIMP_API TriangulateProcess : public BaseProcess {
|
class ASSIMP_API TriangulateProcess : public BaseProcess {
|
||||||
public:
|
public:
|
||||||
TriangulateProcess();
|
// -------------------------------------------------------------------
|
||||||
~TriangulateProcess();
|
/// The default class constructor / destructor.
|
||||||
|
TriangulateProcess() = default;
|
||||||
|
~TriangulateProcess() override = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the processing step is present in the given flag field.
|
/** Returns whether the processing step is present in the given flag field.
|
||||||
|
@ -70,14 +72,14 @@ public:
|
||||||
* combination of #aiPostProcessSteps.
|
* combination of #aiPostProcessSteps.
|
||||||
* @return true if the process is present in this flag fields, false if not.
|
* @return true if the process is present in this flag fields, false if not.
|
||||||
*/
|
*/
|
||||||
bool IsActive( unsigned int pFlags) const;
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Executes the post processing step on the given imported data.
|
/** Executes the post processing step on the given imported data.
|
||||||
* At the moment a process is not supposed to fail.
|
* At the moment a process is not supposed to fail.
|
||||||
* @param pScene The imported data to work at.
|
* @param pScene The imported data to work at.
|
||||||
*/
|
*/
|
||||||
void Execute( aiScene* pScene);
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Triangulates the given mesh.
|
/** Triangulates the given mesh.
|
||||||
|
|
|
@ -60,12 +60,7 @@ using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
ValidateDSProcess::ValidateDSProcess() :
|
ValidateDSProcess::ValidateDSProcess() : mScene(nullptr) {}
|
||||||
mScene() {}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
ValidateDSProcess::~ValidateDSProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
|
|
|
@ -69,22 +69,20 @@ namespace Assimp {
|
||||||
/** Validates the whole ASSIMP scene data structure for correctness.
|
/** Validates the whole ASSIMP scene data structure for correctness.
|
||||||
* ImportErrorException is thrown of the scene is corrupt.*/
|
* ImportErrorException is thrown of the scene is corrupt.*/
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
class ValidateDSProcess : public BaseProcess
|
class ValidateDSProcess : public BaseProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/// The default class constructor / destructor.
|
||||||
ValidateDSProcess();
|
ValidateDSProcess();
|
||||||
~ValidateDSProcess();
|
~ValidateDSProcess() override = default;
|
||||||
|
|
||||||
public:
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
bool IsActive( unsigned int pFlags) const;
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void Execute( aiScene* pScene);
|
bool IsActive( unsigned int pFlags) const override;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
void Execute( aiScene* pScene) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Report a validation error. This will throw an exception,
|
/** Report a validation error. This will throw an exception,
|
||||||
* control won't return.
|
* control won't return.
|
||||||
|
|
Loading…
Reference in New Issue