fix merge

iamAdrianIusca-master
kimkulling 2020-07-07 17:16:53 +02:00
commit 81c15b38ae
20 changed files with 50 additions and 61 deletions

View File

@ -74,15 +74,13 @@ struct Face {
Material *m_pMaterial; Material *m_pMaterial;
//! \brief Default constructor //! \brief Default constructor
Face(aiPrimitiveType pt = aiPrimitiveType_POLYGON) : explicit Face(aiPrimitiveType pt = aiPrimitiveType_POLYGON) :
m_PrimitiveType(pt), m_vertices(), m_normals(), m_texturCoords(), m_pMaterial(0L) { m_PrimitiveType(pt), m_vertices(), m_normals(), m_texturCoords(), m_pMaterial(0L) {
// empty // empty
} }
//! \brief Destructor //! \brief Destructor
~Face() { ~Face() = default;
// empty
}
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -296,19 +294,16 @@ struct Model {
it != m_Objects.end(); ++it) { it != m_Objects.end(); ++it) {
delete *it; delete *it;
} }
m_Objects.clear();
// Clear all stored mesh instances // Clear all stored mesh instances
for (std::vector<Mesh *>::iterator it = m_Meshes.begin(); for (std::vector<Mesh *>::iterator it = m_Meshes.begin();
it != m_Meshes.end(); ++it) { it != m_Meshes.end(); ++it) {
delete *it; delete *it;
} }
m_Meshes.clear();
for (GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) { for (GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) {
delete it->second; delete it->second;
} }
m_Groups.clear();
for (std::map<std::string, Material *>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it) { for (std::map<std::string, Material *>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it) {
delete it->second; delete it->second;

View File

@ -60,6 +60,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <list> #include <list>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <cctype>
#include <utility>
using namespace Assimp; using namespace Assimp;

View File

@ -129,14 +129,8 @@ ImporterPimpl::ImporterPimpl() AI_NO_EXCEPT
, mIsDefaultHandler( false ) , mIsDefaultHandler( false )
, mProgressHandler( nullptr ) , mProgressHandler( nullptr )
, mIsDefaultProgressHandler( false ) , mIsDefaultProgressHandler( false )
, mImporter()
, mPostProcessingSteps() , mPostProcessingSteps()
, mScene( nullptr ) , mScene( nullptr )
, mErrorString()
, mIntProperties()
, mFloatProperties()
, mStringProperties()
, mMatrixProperties()
, bExtraVerbose( false ) , bExtraVerbose( false )
, mPPShared( nullptr ) { , mPPShared( nullptr ) {
// empty // empty

View File

@ -66,10 +66,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
// clang-format off
#if (__GNUC__ >= 8 && __GNUC_MINOR__ >= 0) #if (__GNUC__ >= 8 && __GNUC_MINOR__ >= 0)
#pragma GCC diagnostic push # pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess" # pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif #endif
// clang-format on
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Add a prefix to a string // Add a prefix to a string
@ -495,7 +497,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
OffsetNodeMeshIndices(node, offset[n]); OffsetNodeMeshIndices(node, offset[n]);
} }
if (n) // src[0] is the master node if (n) // src[0] is the master node
nodes.push_back(NodeAttachmentInfo(node, srcList[n - 1].attachToNode, n)); nodes.emplace_back( node,srcList[n-1].attachToNode,n );
// add name prefixes? // add name prefixes?
if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES) { if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES) {
@ -1331,8 +1333,10 @@ void SceneCombiner::Copy(aiMetadata **_dest, const aiMetadata *src) {
} }
} }
// clang-format off
#if (__GNUC__ >= 8 && __GNUC_MINOR__ >= 0) #if (__GNUC__ >= 8 && __GNUC_MINOR__ >= 0)
#pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
// clang-format on
} // Namespace Assimp } // Namespace Assimp

View File

@ -253,6 +253,8 @@ aiMaterial *SkeletonMeshBuilder::CreateMaterial() {
// Name // Name
aiString matName(std::string("SkeletonMaterial")); aiString matName(std::string("SkeletonMaterial"));
matHelper->AddProperty(&matName, AI_MATKEY_NAME); matHelper->AddProperty(&matName, AI_MATKEY_NAME);
aiString matName("SkeletonMaterial");
matHelper->AddProperty( &matName, AI_MATKEY_NAME);
// Prevent backface culling // Prevent backface culling
const int no_cull = 1; const int no_cull = 1;

View File

@ -101,7 +101,7 @@ void SpatialSort::Append(const aiVector3D *pPositions, unsigned int pNumPosition
// store position by index and distance // store position by index and distance
ai_real distance = *vec * mPlaneNormal; ai_real distance = *vec * mPlaneNormal;
mPositions.push_back(Entry(static_cast<unsigned int>(a + initial), *vec, distance)); mPositions.emplace_back(Entry(static_cast<unsigned int>(a + initial), *vec, distance));
} }
if (pFinalize) { if (pFinalize) {
@ -121,7 +121,7 @@ void SpatialSort::FindPositions(const aiVector3D &pPosition,
poResults.clear(); poResults.clear();
// quick check for positions outside the range // quick check for positions outside the range
if (mPositions.size() == 0) if( mPositions.empty())
return; return;
if (maxDist < mPositions.front().mDistance) if (maxDist < mPositions.front().mDistance)
return; return;

View File

@ -423,17 +423,18 @@ void StandardShapes::MakeCone(ai_real height, ai_real radius1,
if (!bOpen) { if (!bOpen) {
// generate the end 'cap' // generate the end 'cap'
positions.push_back(aiVector3D(s * radius2, halfHeight, t * radius2)); positions.emplace_back(s * radius2, halfHeight, t * radius2 );
positions.push_back(aiVector3D(s2 * radius2, halfHeight, t2 * radius2)); positions.emplace_back(s2 * radius2, halfHeight, t2 * radius2 );
positions.push_back(aiVector3D(0.0, halfHeight, 0.0)); positions.emplace_back(ai_real(0.0), halfHeight, ai_real(0.0));
if (radius1) { if (radius1) {
// generate the other end 'cap' // generate the other end 'cap'
positions.push_back(aiVector3D(s * radius1, -halfHeight, t * radius1)); positions.emplace_back(s * radius1, -halfHeight, t * radius1 );
positions.push_back(aiVector3D(s2 * radius1, -halfHeight, t2 * radius1)); positions.emplace_back(s2 * radius1, -halfHeight, t2 * radius1 );
positions.push_back(aiVector3D(0.0, -halfHeight, 0.0)); positions.emplace_back(ai_real(0.0), -halfHeight, ai_real(0.0));
} }
} }
s = s2; s = s2;
t = t2; t = t2;
angle = next; angle = next;
@ -466,14 +467,15 @@ void StandardShapes::MakeCircle(ai_real radius, unsigned int tess,
ai_real s = 1.0; // std::cos(angle == 0); ai_real s = 1.0; // std::cos(angle == 0);
ai_real t = 0.0; // std::sin(angle == 0); ai_real t = 0.0; // std::sin(angle == 0);
<<<<<<< HEAD
for (ai_real angle = 0.0; angle < angle_max;) { for (ai_real angle = 0.0; angle < angle_max;) {
positions.push_back(aiVector3D(s * radius, 0.0, t * radius)); positions.emplace_back(aiVector3D(s * radius, 0.0, t * radius));
angle += angle_delta; angle += angle_delta;
s = std::cos(angle); s = std::cos(angle);
t = std::sin(angle); t = std::sin(angle);
positions.push_back(aiVector3D(s * radius, 0.0, t * radius)); positions.emplace_back(aiVector3D(s * radius, 0.0, t * radius));
positions.push_back(aiVector3D(0.0, 0.0, 0.0)); positions.emplace_back(aiVector3D(0.0, 0.0, 0.0));
} }
} }

View File

@ -220,7 +220,7 @@ void TargetAnimationHelper::Process(std::vector<aiVectorKey> *distanceTrack) {
// diff is now the vector in which our camera is pointing // diff is now the vector in which our camera is pointing
} }
if (real.size()) { if (!real.empty()) {
*distanceTrack = real; *distanceTrack = real;
} }
} }

View File

@ -51,10 +51,10 @@ using namespace Assimp;
namespace { namespace {
const static aiVector3D base_axis_y(0.0,1.0,0.0); const aiVector3D base_axis_y(0.0,1.0,0.0);
const static aiVector3D base_axis_x(1.0,0.0,0.0); const aiVector3D base_axis_x(1.0,0.0,0.0);
const static aiVector3D base_axis_z(0.0,0.0,1.0); const aiVector3D base_axis_z(0.0,0.0,1.0);
const static ai_real angle_epsilon = ai_real( 0.95 ); const ai_real angle_epsilon = ai_real( 0.95 );
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 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 <cstdio>
using namespace Assimp; using namespace Assimp;
@ -83,7 +83,7 @@ bool DeboneProcess::IsActive( unsigned int pFlags) const
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) != 0;
mThreshold = pImp->GetPropertyFloat(AI_CONFIG_PP_DB_THRESHOLD,AI_DEBONE_THRESHOLD); mThreshold = pImp->GetPropertyFloat(AI_CONFIG_PP_DB_THRESHOLD,AI_DEBONE_THRESHOLD);
} }
@ -104,7 +104,7 @@ void DeboneProcess::Execute( aiScene* pScene)
int numSplits = 0; int numSplits = 0;
if(!!mNumBonesCanDoWithout && (!mAllOrNone||mNumBonesCanDoWithout==mNumBones)) { if(mNumBonesCanDoWithout != 0 && (!mAllOrNone || mNumBonesCanDoWithout == mNumBones)) {
for(unsigned int a = 0; a < pScene->mNumMeshes; a++) { for(unsigned int a = 0; a < pScene->mNumMeshes; a++) {
if(splitList[a]) { if(splitList[a]) {
numSplits++; numSplits++;
@ -156,7 +156,7 @@ void DeboneProcess::Execute( aiScene* pScene)
} }
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(std::pair<unsigned int,aiNode*>(static_cast<unsigned int>(meshes.size()),(aiNode*)0)); mSubMeshIndices[a].emplace_back(static_cast<unsigned int>(meshes.size()),(aiNode*)0);
meshes.push_back(srcMesh); meshes.push_back(srcMesh);
} }
} }

View File

@ -174,7 +174,7 @@ inline const char *ValidateArrayContents<aiVector3D>(const aiVector3D *arr, unsi
unsigned int cnt = 0; unsigned int cnt = 0;
for (unsigned int i = 0; i < size; ++i) { for (unsigned int i = 0; i < size; ++i) {
if (dirtyMask.size() && dirtyMask[i]) { if (!dirtyMask.empty() && dirtyMask[i]) {
continue; continue;
} }
++cnt; ++cnt;

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, 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,

View File

@ -423,7 +423,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
ASSIMP_LOG_ERROR( "X-Export: aiBone shall contain weights, but pointer to them is nullptr." ); ASSIMP_LOG_ERROR( "X-Export: aiBone shall contain weights, but pointer to them is nullptr." );
} }
if (newWeights.size() > 0) { if (!newWeights.empty()) {
// kill the old and replace them with the translated weights // kill the old and replace them with the translated weights
delete [] bone->mWeights; delete [] bone->mWeights;
bone->mNumWeights = (unsigned int)newWeights.size(); bone->mNumWeights = (unsigned int)newWeights.size();

View File

@ -55,22 +55,19 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
LimitBoneWeightsProcess::LimitBoneWeightsProcess() LimitBoneWeightsProcess::LimitBoneWeightsProcess() {
{
mMaxWeights = AI_LMW_MAX_WEIGHTS; mMaxWeights = AI_LMW_MAX_WEIGHTS;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
LimitBoneWeightsProcess::~LimitBoneWeightsProcess() LimitBoneWeightsProcess::~LimitBoneWeightsProcess() {
{
// nothing to do here // nothing to do here
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// 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 LimitBoneWeightsProcess::IsActive( unsigned int pFlags) const bool LimitBoneWeightsProcess::IsActive(unsigned int pFlags) const {
{
return (pFlags & aiProcess_LimitBoneWeights) != 0; return (pFlags & aiProcess_LimitBoneWeights) != 0;
} }
@ -89,10 +86,9 @@ void LimitBoneWeightsProcess::Execute( aiScene* pScene)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) void LimitBoneWeightsProcess::SetupProperties(const Importer *pImp) {
{
// get the current value of the property // get the current value of the property
this->mMaxWeights = pImp->GetPropertyInteger(AI_CONFIG_PP_LBW_MAX_WEIGHTS,AI_LMW_MAX_WEIGHTS); this->mMaxWeights = pImp->GetPropertyInteger(AI_CONFIG_PP_LBW_MAX_WEIGHTS, AI_LMW_MAX_WEIGHTS);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -140,7 +140,7 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene)
// and process all nodes in the scenegraph recursively // and process all nodes in the scenegraph recursively
ProcessNode(pScene->mRootNode); ProcessNode(pScene->mRootNode);
if (!output.size()) { if (output.empty()) {
throw DeadlyImportError("OptimizeMeshes: No meshes remaining; there's definitely something wrong"); throw DeadlyImportError("OptimizeMeshes: No meshes remaining; there's definitely something wrong");
} }

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, 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,
@ -63,7 +62,7 @@ void ConvertListToStrings(const std::string &in, std::list<std::string> &out) {
return; return;
} }
} }
out.push_back(std::string(base, (size_t)(s - base))); out.emplace_back(base,(size_t)(s-base));
++s; ++s;
} else { } else {
out.push_back(GetNextToken(s)); out.push_back(GetNextToken(s));

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, 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,
@ -269,7 +267,7 @@ void SortByPTypeProcess::Execute(aiScene *pScene) {
VertexWeightTable &tbl = avw[idx]; VertexWeightTable &tbl = avw[idx];
for (VertexWeightTable::const_iterator it = tbl.begin(), end = tbl.end(); for (VertexWeightTable::const_iterator it = tbl.begin(), end = tbl.end();
it != end; ++it) { it != end; ++it) {
tempBones[(*it).first].push_back(aiVertexWeight(outIdx, (*it).second)); tempBones[(*it).first].emplace_back(aiVertexWeight(outIdx, (*it).second));
} }
} }

View File

@ -316,13 +316,13 @@ void SplitLargeMeshesProcess_Triangle::SplitMesh(
} }
// add the newly created mesh to the list // add the newly created mesh to the list
avList.push_back(std::pair<aiMesh*, unsigned int>(pcMesh,a)); avList.emplace_back(pcMesh,a);
} }
// now delete the old mesh data // now delete the old mesh data
delete pMesh; delete pMesh;
} else { } else {
avList.push_back(std::pair<aiMesh*, unsigned int>(pMesh,a)); avList.emplace_back(pMesh,a);
} }
} }

View File

@ -200,7 +200,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
aiFace& face = pMesh->mFaces[a]; aiFace& face = pMesh->mFaces[a];
unsigned int* idx = face.mIndices; unsigned int* idx = face.mIndices;
int num = (int)face.mNumIndices, ear = 0, tmp, prev = num-1, next = 0, max = num; int num = (int)face.mNumIndices, ear, tmp, prev = num - 1, next = 0, max = num;
// Apply vertex colors to represent the face winding? // Apply vertex colors to represent the face winding?
#ifdef AI_BUILD_TRIANGULATE_COLOR_FACE_WINDING #ifdef AI_BUILD_TRIANGULATE_COLOR_FACE_WINDING
@ -476,7 +476,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
for(aiFace* f = last_face; f != curOut; ++f) { for(aiFace* f = last_face; f != curOut; ++f) {
unsigned int* i = f->mIndices; unsigned int* i = f->mIndices;
fprintf(fout," (%i %i %i)",i[0],i[1],i[2]); fprintf(fout," (%u %u %u)",i[0],i[1],i[2]);
} }
fprintf(fout,"\n*********************************************************************\n"); fprintf(fout,"\n*********************************************************************\n");

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, 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,