Compare commits

...

45 Commits

Author SHA1 Message Date
Kim Kulling 1607c8e6e0
Fix merge issue 2020-07-27 11:18:46 +02:00
Kim Kulling 08f945b7ec
Update SkeletonMeshBuilder.cpp
Fix merge issue.
2020-07-24 12:03:49 +02:00
Kim Kulling 608e3102a0
fix init of aiString 2020-07-24 11:58:51 +02:00
Kim Kulling 0be78e0ca3
Merge branch 'master' into iamAdrianIusca-master 2020-07-24 11:35:02 +02:00
kimkulling 81c15b38ae fix merge 2020-07-07 17:16:53 +02:00
Adrian Iusca 85114117d1
Merge branch 'master' into master 2020-04-24 13:09:38 +03:00
iamAdrianIusca d527939881 fixed the windows build 2020-04-24 00:16:38 +03:00
iamAdrianIusca 5b7e9ccb5f small fix 2020-04-23 23:48:35 +03:00
Adrian Iusca 40b611b478
Merge branch 'master' into master 2020-04-23 22:42:16 +03:00
iamAdrianIusca f1817598b0 fix the whitespaces 2020-04-23 22:42:03 +03:00
iamAdrianIusca d777070eb1 fix the whitespaces 2020-04-23 22:41:22 +03:00
iamAdrianIusca d02be05862 fix the whitespaces 2020-04-23 22:40:14 +03:00
iamAdrianIusca a77a18693d fix the whitespaces 2020-04-23 22:37:41 +03:00
iamAdrianIusca 1450b5b29c fix the whitespaces 2020-04-23 22:35:55 +03:00
iamAdrianIusca f8024188f0 fix the whitespaces 2020-04-23 22:33:13 +03:00
iamAdrianIusca 798f6cf083 fix the whitespaces 2020-04-23 22:30:58 +03:00
iamAdrianIusca efa6ead1a5 fix the whitespaces 2020-04-23 22:27:55 +03:00
iamAdrianIusca 74931fe6d9 fix the whitespaces 2020-04-23 22:25:38 +03:00
iamAdrianIusca bcd86ccc76 fix 2020-04-23 22:23:55 +03:00
iamAdrianIusca e5f69d55bb fix 2020-04-23 22:20:28 +03:00
iamAdrianIusca 871f3fd337 fix 2020-04-23 22:18:59 +03:00
iamAdrianIusca 287030e720 fix 2020-04-23 22:17:48 +03:00
Adrian Iusca 5ec896af49
Merge branch 'master' into master 2020-04-21 20:33:29 +03:00
Kim Kulling 5eeea82793
Merge branch 'master' into master 2020-04-16 11:54:57 +02:00
Adrian Iusca 951ec9e0d9
Merge branch 'master' into master 2020-03-21 21:06:50 +02:00
Adrian Iusca c45a168839
Merge branch 'master' into master 2020-03-18 18:14:38 +02:00
Adrian Iusca 3bf62cf6e4
Merge branch 'master' into master 2020-03-16 17:44:00 +02:00
Adrian Iusca df8511e1b0
Merge branch 'master' into master 2020-03-12 11:19:39 +02:00
Adrian Iusca b4c97f3903
Merge branch 'master' into master 2020-03-11 20:50:55 +02:00
Adrian Iusca 47e05470ff
Merge branch 'master' into master 2020-03-11 20:45:07 +02:00
Adrian Iusca 6e13baf89c
Merge branch 'master' into master 2020-03-09 22:23:36 +02:00
iamAdrianIusca 691dfe7012 fixing the conflicts 2020-03-09 22:23:18 +02:00
iamAdrianIusca 18cb5745bc fixing the conflicts 2020-03-09 22:21:36 +02:00
iamAdrianIusca 8f41516637 Merge remote-tracking branch 'origin/master' 2020-03-09 22:19:22 +02:00
iamAdrianIusca 051d01e339 fixing the conflicts 2020-03-09 22:19:12 +02:00
Adrian Iusca 067677595c
Merge branch 'master' into master 2020-03-05 10:29:21 +02:00
iamAdrianIusca 66288df49b small change 2020-03-01 12:24:34 +02:00
iamAdrianIusca ffaa3629d8 back with the emplace_back 2020-03-01 11:24:58 +02:00
Adrian Iusca ec61318443
Merge branch 'master' into master 2020-03-01 11:24:12 +02:00
iamAdrianIusca 0d8434ed34 fix 2020-03-01 11:23:55 +02:00
iamAdrianIusca 2917ab04b7 fix 2020-03-01 11:22:44 +02:00
iamAdrianIusca 89ca66f300 fix 2020-03-01 11:21:53 +02:00
iamAdrianIusca 1f4b99479d fix 2020-03-01 11:20:55 +02:00
iamAdrianIusca 3bef9382bb Merge remote-tracking branch 'origin/master' 2020-03-01 11:12:46 +02:00
iamAdrianIusca aca6aaf35d small changes
- removed static definition
- use emplace_back instead of push_back
- changed the c++ deprecated headers
- removed some redundant std containers initialization in the destructor
- removed redundant .clear call for the std containers in the destructor
- added some const reference for some std container parameters
- other small changes in different places
2020-03-01 11:12:37 +02:00
20 changed files with 50 additions and 64 deletions

View File

@ -74,15 +74,13 @@ struct Face {
Material *m_pMaterial;
//! \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) {
// empty
}
//! \brief Destructor
~Face() {
// empty
}
~Face() = default;
};
// ------------------------------------------------------------------------------------------------
@ -296,19 +294,16 @@ struct Model {
it != m_Objects.end(); ++it) {
delete *it;
}
m_Objects.clear();
// Clear all stored mesh instances
for (std::vector<Mesh *>::iterator it = m_Meshes.begin();
it != m_Meshes.end(); ++it) {
delete *it;
}
m_Meshes.clear();
for (GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) {
delete it->second;
}
m_Groups.clear();
for (std::map<std::string, Material *>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it) {
delete it->second;

View File

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

View File

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

View File

@ -66,10 +66,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
// clang-format off
#if (__GNUC__ >= 8 && __GNUC_MINOR__ >= 0)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
// clang-format on
// ------------------------------------------------------------------------------------------------
// Add a prefix to a string
@ -495,7 +497,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
OffsetNodeMeshIndices(node, offset[n]);
}
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?
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)
#pragma GCC diagnostic pop
# pragma GCC diagnostic pop
#endif
// clang-format on
} // Namespace Assimp

View File

@ -57,7 +57,7 @@ SkeletonMeshBuilder::SkeletonMeshBuilder(aiScene *pScene, aiNode *root, bool bKn
return;
}
if (!root) {
if (nullptr != root) {
root = pScene->mRootNode;
}
@ -251,8 +251,8 @@ aiMaterial *SkeletonMeshBuilder::CreateMaterial() {
aiMaterial *matHelper = new aiMaterial;
// Name
aiString matName(std::string("SkeletonMaterial"));
matHelper->AddProperty(&matName, AI_MATKEY_NAME);
aiString matName("SkeletonMaterial");
matHelper->AddProperty( &matName, AI_MATKEY_NAME);
// Prevent backface culling
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
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) {
@ -121,7 +121,7 @@ void SpatialSort::FindPositions(const aiVector3D &pPosition,
poResults.clear();
// quick check for positions outside the range
if (mPositions.size() == 0)
if( mPositions.empty())
return;
if (maxDist < mPositions.front().mDistance)
return;

View File

@ -423,17 +423,18 @@ void StandardShapes::MakeCone(ai_real height, ai_real radius1,
if (!bOpen) {
// generate the end 'cap'
positions.push_back(aiVector3D(s * radius2, halfHeight, t * radius2));
positions.push_back(aiVector3D(s2 * radius2, halfHeight, t2 * radius2));
positions.push_back(aiVector3D(0.0, halfHeight, 0.0));
positions.emplace_back(s * radius2, halfHeight, t * radius2 );
positions.emplace_back(s2 * radius2, halfHeight, t2 * radius2 );
positions.emplace_back(ai_real(0.0), halfHeight, ai_real(0.0));
if (radius1) {
// generate the other end 'cap'
positions.push_back(aiVector3D(s * radius1, -halfHeight, t * radius1));
positions.push_back(aiVector3D(s2 * radius1, -halfHeight, t2 * radius1));
positions.push_back(aiVector3D(0.0, -halfHeight, 0.0));
positions.emplace_back(s * radius1, -halfHeight, t * radius1 );
positions.emplace_back(s2 * radius1, -halfHeight, t2 * radius1 );
positions.emplace_back(ai_real(0.0), -halfHeight, ai_real(0.0));
}
}
s = s2;
t = t2;
angle = next;
@ -467,13 +468,13 @@ void StandardShapes::MakeCircle(ai_real radius, unsigned int tess,
ai_real t = 0.0; // std::sin(angle == 0);
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;
s = std::cos(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
}
if (real.size()) {
if (!real.empty()) {
*distanceTrack = real;
}
}

View File

@ -51,10 +51,10 @@ using namespace Assimp;
namespace {
const static aiVector3D base_axis_y(0.0,1.0,0.0);
const static aiVector3D base_axis_x(1.0,0.0,0.0);
const static aiVector3D base_axis_z(0.0,0.0,1.0);
const static ai_real angle_epsilon = ai_real( 0.95 );
const aiVector3D base_axis_y(0.0,1.0,0.0);
const aiVector3D base_axis_x(1.0,0.0,0.0);
const aiVector3D base_axis_z(0.0,0.0,1.0);
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
#include "ProcessHelper.h"
#include "DeboneProcess.h"
#include <stdio.h>
#include <cstdio>
using namespace Assimp;
@ -83,7 +83,7 @@ bool DeboneProcess::IsActive( unsigned int pFlags) const
void DeboneProcess::SetupProperties(const Importer* pImp)
{
// 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);
}
@ -104,7 +104,7 @@ void DeboneProcess::Execute( aiScene* pScene)
int numSplits = 0;
if(!!mNumBonesCanDoWithout && (!mAllOrNone||mNumBonesCanDoWithout==mNumBones)) {
if(mNumBonesCanDoWithout != 0 && (!mAllOrNone || mNumBonesCanDoWithout == mNumBones)) {
for(unsigned int a = 0; a < pScene->mNumMeshes; a++) {
if(splitList[a]) {
numSplits++;
@ -156,7 +156,7 @@ void DeboneProcess::Execute( aiScene* pScene)
}
else {
// 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);
}
}

View File

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

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
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." );
}
if (newWeights.size() > 0) {
if (!newWeights.empty()) {
// kill the old and replace them with the translated weights
delete [] bone->mWeights;
bone->mNumWeights = (unsigned int)newWeights.size();

View File

@ -55,22 +55,19 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
LimitBoneWeightsProcess::LimitBoneWeightsProcess()
{
LimitBoneWeightsProcess::LimitBoneWeightsProcess() {
mMaxWeights = AI_LMW_MAX_WEIGHTS;
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
LimitBoneWeightsProcess::~LimitBoneWeightsProcess()
{
LimitBoneWeightsProcess::~LimitBoneWeightsProcess() {
// nothing to do here
}
// ------------------------------------------------------------------------------------------------
// 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;
}
@ -89,10 +86,9 @@ void LimitBoneWeightsProcess::Execute( aiScene* pScene)
// ------------------------------------------------------------------------------------------------
// 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
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
ProcessNode(pScene->mRootNode);
if (!output.size()) {
if (output.empty()) {
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
All rights reserved.
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;
}
}
out.push_back(std::string(base, (size_t)(s - base)));
out.emplace_back(base,(size_t)(s-base));
++s;
} else {
out.push_back(GetNextToken(s));

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -269,7 +267,7 @@ void SortByPTypeProcess::Execute(aiScene *pScene) {
VertexWeightTable &tbl = avw[idx];
for (VertexWeightTable::const_iterator it = tbl.begin(), end = tbl.end();
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
avList.push_back(std::pair<aiMesh*, unsigned int>(pcMesh,a));
avList.emplace_back(pcMesh,a);
}
// now delete the old mesh data
delete pMesh;
} 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];
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?
#ifdef AI_BUILD_TRIANGULATE_COLOR_FACE_WINDING
@ -476,7 +476,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
for(aiFace* f = last_face; f != curOut; ++f) {
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");

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,