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 placespull/3042/head
parent
4e414eb4ef
commit
aca6aaf35d
|
@ -60,6 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <utility>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -484,11 +485,11 @@ void BaseImporter::TextFileToBuffer(IOStream* stream,
|
|||
namespace Assimp {
|
||||
// Represents an import request
|
||||
struct LoadRequest {
|
||||
LoadRequest(const std::string& _file, unsigned int _flags,const BatchLoader::PropertyMap* _map, unsigned int _id)
|
||||
: file(_file)
|
||||
LoadRequest(std::string _file, unsigned int _flags,const BatchLoader::PropertyMap* _map, unsigned int _id)
|
||||
: file(std::move(_file))
|
||||
, flags(_flags)
|
||||
, refCnt(1)
|
||||
, scene(NULL)
|
||||
, scene(nullptr)
|
||||
, loaded(false)
|
||||
, id(_id) {
|
||||
if ( _map ) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -503,7 +503,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) {
|
||||
|
@ -662,7 +662,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, std::vector<At
|
|||
// Build a list of unique bones
|
||||
void SceneCombiner::BuildUniqueBoneList(std::list<BoneWithHash>& asBones,
|
||||
std::vector<aiMesh*>::const_iterator it,
|
||||
std::vector<aiMesh*>::const_iterator end)
|
||||
const std::vector<aiMesh*>::const_iterator& end)
|
||||
{
|
||||
unsigned int iOffset = 0;
|
||||
for (; it != end;++it) {
|
||||
|
@ -670,24 +670,24 @@ void SceneCombiner::BuildUniqueBoneList(std::list<BoneWithHash>& asBones,
|
|||
aiBone* p = (*it)->mBones[l];
|
||||
uint32_t itml = SuperFastHash(p->mName.data,(unsigned int)p->mName.length);
|
||||
|
||||
std::list<BoneWithHash>::iterator it2 = asBones.begin();
|
||||
std::list<BoneWithHash>::iterator end2 = asBones.end();
|
||||
auto it2 = asBones.begin();
|
||||
auto end2 = asBones.end();
|
||||
|
||||
for (;it2 != end2;++it2) {
|
||||
if ((*it2).first == itml) {
|
||||
(*it2).pSrcBones.push_back(BoneSrcIndex(p,iOffset));
|
||||
(*it2).pSrcBones.emplace_back(p,iOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (end2 == it2) {
|
||||
// need to begin a new bone entry
|
||||
asBones.push_back(BoneWithHash());
|
||||
asBones.emplace_back();
|
||||
BoneWithHash& btz = asBones.back();
|
||||
|
||||
// setup members
|
||||
btz.first = itml;
|
||||
btz.second = &p->mName;
|
||||
btz.pSrcBones.push_back(BoneSrcIndex(p,iOffset));
|
||||
btz.pSrcBones.emplace_back(p,iOffset);
|
||||
}
|
||||
}
|
||||
iOffset += (*it)->mNumVertices;
|
||||
|
@ -697,7 +697,7 @@ void SceneCombiner::BuildUniqueBoneList(std::list<BoneWithHash>& asBones,
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Merge a list of bones
|
||||
void SceneCombiner::MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator it,
|
||||
std::vector<aiMesh*>::const_iterator end)
|
||||
const std::vector<aiMesh*>::const_iterator& end)
|
||||
{
|
||||
if ( nullptr == out || out->mNumBones == 0 ) {
|
||||
return;
|
||||
|
|
|
@ -124,10 +124,10 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
|
|||
mVertices.push_back( childpos);
|
||||
mVertices.push_back( -front * distanceToChild * (ai_real)0.1);
|
||||
|
||||
mFaces.push_back( Face( localVertexStart + 0, localVertexStart + 1, localVertexStart + 2));
|
||||
mFaces.push_back( Face( localVertexStart + 3, localVertexStart + 4, localVertexStart + 5));
|
||||
mFaces.push_back( Face( localVertexStart + 6, localVertexStart + 7, localVertexStart + 8));
|
||||
mFaces.push_back( Face( localVertexStart + 9, localVertexStart + 10, localVertexStart + 11));
|
||||
mFaces.emplace_back( localVertexStart + 0, localVertexStart + 1, localVertexStart + 2);
|
||||
mFaces.emplace_back( localVertexStart + 3, localVertexStart + 4, localVertexStart + 5);
|
||||
mFaces.emplace_back( localVertexStart + 6, localVertexStart + 7, localVertexStart + 8);
|
||||
mFaces.emplace_back( localVertexStart + 9, localVertexStart + 10, localVertexStart + 11);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -136,40 +136,40 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode)
|
|||
aiVector3D ownpos( pNode->mTransformation.a4, pNode->mTransformation.b4, pNode->mTransformation.c4);
|
||||
ai_real sizeEstimate = ownpos.Length() * ai_real( 0.18 );
|
||||
|
||||
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, -sizeEstimate));
|
||||
mVertices.emplace_back( -sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( 0.0, sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, -sizeEstimate);
|
||||
mVertices.emplace_back( 0.0, sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, -sizeEstimate);
|
||||
mVertices.emplace_back( sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( 0.0, -sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, -sizeEstimate);
|
||||
mVertices.emplace_back( 0.0, -sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( -sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, -sizeEstimate);
|
||||
|
||||
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( sizeEstimate, 0.0, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, -sizeEstimate, 0.0));
|
||||
mVertices.push_back( aiVector3D( 0.0, 0.0, sizeEstimate));
|
||||
mVertices.push_back( aiVector3D( -sizeEstimate, 0.0, 0.0));
|
||||
mVertices.emplace_back( -sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, sizeEstimate);
|
||||
mVertices.emplace_back( 0.0, sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( 0.0, sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, sizeEstimate);
|
||||
mVertices.emplace_back( sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( sizeEstimate, 0.0, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, sizeEstimate);
|
||||
mVertices.emplace_back( 0.0, -sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( 0.0, -sizeEstimate, 0.0);
|
||||
mVertices.emplace_back( 0.0, 0.0, sizeEstimate);
|
||||
mVertices.emplace_back( -sizeEstimate, 0.0, 0.0);
|
||||
|
||||
mFaces.push_back( Face( vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2));
|
||||
mFaces.push_back( Face( vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5));
|
||||
mFaces.push_back( Face( vertexStartIndex + 6, vertexStartIndex + 7, vertexStartIndex + 8));
|
||||
mFaces.push_back( Face( vertexStartIndex + 9, vertexStartIndex + 10, vertexStartIndex + 11));
|
||||
mFaces.push_back( Face( vertexStartIndex + 12, vertexStartIndex + 13, vertexStartIndex + 14));
|
||||
mFaces.push_back( Face( vertexStartIndex + 15, vertexStartIndex + 16, vertexStartIndex + 17));
|
||||
mFaces.push_back( Face( vertexStartIndex + 18, vertexStartIndex + 19, vertexStartIndex + 20));
|
||||
mFaces.push_back( Face( vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23));
|
||||
mFaces.emplace_back( vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2);
|
||||
mFaces.emplace_back( vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5);
|
||||
mFaces.emplace_back( vertexStartIndex + 6, vertexStartIndex + 7, vertexStartIndex + 8);
|
||||
mFaces.emplace_back( vertexStartIndex + 9, vertexStartIndex + 10, vertexStartIndex + 11);
|
||||
mFaces.emplace_back( vertexStartIndex + 12, vertexStartIndex + 13, vertexStartIndex + 14);
|
||||
mFaces.emplace_back( vertexStartIndex + 15, vertexStartIndex + 16, vertexStartIndex + 17);
|
||||
mFaces.emplace_back( vertexStartIndex + 18, vertexStartIndex + 19, vertexStartIndex + 20);
|
||||
mFaces.emplace_back( vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23);
|
||||
}
|
||||
|
||||
unsigned int numVertices = static_cast<unsigned int>(mVertices.size() - vertexStartIndex);
|
||||
|
@ -259,7 +259,7 @@ aiMaterial* SkeletonMeshBuilder::CreateMaterial()
|
|||
aiMaterial* matHelper = new aiMaterial;
|
||||
|
||||
// Name
|
||||
aiString matName( std::string( "SkeletonMaterial"));
|
||||
aiString matName("SkeletonMaterial");
|
||||
matHelper->AddProperty( &matName, AI_MATKEY_NAME);
|
||||
|
||||
// Prevent backface culling
|
||||
|
|
|
@ -110,7 +110,7 @@ void SpatialSort::Append( const aiVector3D* pPositions, unsigned int pNumPositio
|
|||
|
||||
// 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( static_cast<unsigned int>(a+initial), *vec, distance);
|
||||
}
|
||||
|
||||
if (pFinalize) {
|
||||
|
@ -131,7 +131,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;
|
||||
|
|
|
@ -74,7 +74,7 @@ SplitByBoneCountProcess::~SplitByBoneCountProcess()
|
|||
// Returns whether the processing step is present in the given flag.
|
||||
bool SplitByBoneCountProcess::IsActive( unsigned int pFlags) const
|
||||
{
|
||||
return !!(pFlags & aiProcess_SplitByBoneCount);
|
||||
return (pFlags & aiProcess_SplitByBoneCount) != 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -165,7 +165,7 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
{
|
||||
const aiBone* bone = pMesh->mBones[a];
|
||||
for( unsigned int b = 0; b < bone->mNumWeights; ++b)
|
||||
vertexBones[ bone->mWeights[b].mVertexId ].push_back( BoneWeight( a, bone->mWeights[b].mWeight));
|
||||
vertexBones[ bone->mWeights[b].mVertexId ].emplace_back( a, bone->mWeights[b].mWeight);
|
||||
}
|
||||
|
||||
unsigned int numFacesHandled = 0;
|
||||
|
|
|
@ -445,20 +445,19 @@ 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(0.0, halfHeight, 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(0.0, -halfHeight, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
s = s2;
|
||||
t = t2;
|
||||
angle = next;
|
||||
|
@ -494,13 +493,14 @@ void StandardShapes::MakeCircle(ai_real radius, unsigned int tess,
|
|||
|
||||
for (ai_real angle = 0.0; angle < angle_max; )
|
||||
{
|
||||
positions.push_back(aiVector3D(s * radius,0.0,t * radius));
|
||||
positions.emplace_back(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.push_back(aiVector3D(0.0,0.0,0.0));
|
||||
positions.emplace_back(s * radius,0.0,t * radius);
|
||||
positions.emplace_back(0.0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,19 +75,14 @@ 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 ) {
|
||||
, m_pMaterial( nullptr ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
//! \brief Destructor
|
||||
~Face() {
|
||||
// empty
|
||||
}
|
||||
~Face() = default;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -285,14 +280,12 @@ struct Model {
|
|||
|
||||
//! \brief The default class constructor
|
||||
Model() :
|
||||
m_ModelName(""),
|
||||
m_pCurrent(NULL),
|
||||
m_pCurrentMaterial(NULL),
|
||||
m_pDefaultMaterial(NULL),
|
||||
m_pGroupFaceIDs(NULL),
|
||||
m_strActiveGroup(""),
|
||||
m_pCurrent(nullptr),
|
||||
m_pCurrentMaterial(nullptr),
|
||||
m_pDefaultMaterial(nullptr),
|
||||
m_pGroupFaceIDs(nullptr),
|
||||
m_TextureCoordDim(0),
|
||||
m_pCurrentMesh(NULL)
|
||||
m_pCurrentMesh(nullptr)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
@ -304,19 +297,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;
|
||||
|
|
|
@ -112,7 +112,7 @@ void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene,
|
|||
// Read file into memory
|
||||
static const std::string mode = "rb";
|
||||
std::unique_ptr<IOStream> fileStream( pIOHandler->Open( file, mode));
|
||||
if( !fileStream.get() ) {
|
||||
if(!fileStream) {
|
||||
throw DeadlyImportError( "Failed to open file " + file + "." );
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,7 @@ ObjFileParser::ObjFileParser()
|
|||
, m_pModel( nullptr )
|
||||
, m_uiLine( 0 )
|
||||
, m_pIO( nullptr )
|
||||
, m_progress( nullptr )
|
||||
, m_originalObjFileName() {
|
||||
, m_progress( nullptr ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
@ -567,7 +566,7 @@ void ObjFileParser::getMaterialDesc() {
|
|||
|
||||
if (!skip) {
|
||||
// Search for material
|
||||
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find(strName);
|
||||
auto it = m_pModel->m_MaterialMap.find(strName);
|
||||
if (it == m_pModel->m_MaterialMap.end()) {
|
||||
// Not found, so we don't know anything about the material except for its name.
|
||||
// This may be the case if the material library is missing. We don't want to lose all
|
||||
|
@ -674,7 +673,7 @@ void ObjFileParser::getNewMaterial() {
|
|||
while( m_DataIt != m_DataItEnd && IsSpaceOrNewLine( *m_DataIt ) ) {
|
||||
++m_DataIt;
|
||||
}
|
||||
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strMat );
|
||||
auto it = m_pModel->m_MaterialMap.find( strMat );
|
||||
if ( it == m_pModel->m_MaterialMap.end() ) {
|
||||
// Show a warning, if material was not found
|
||||
ASSIMP_LOG_WARN("OBJ: Unsupported material requested: " + strMat);
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ const char* ValidateArrayContents<aiVector3D>(const aiVector3D* arr, unsigned in
|
|||
unsigned int cnt = 0;
|
||||
for (unsigned int i = 0; i < size;++i) {
|
||||
|
||||
if (dirtyMask.size() && dirtyMask[i]) {
|
||||
if (!dirtyMask.empty() && dirtyMask[i]) {
|
||||
continue;
|
||||
}
|
||||
++cnt;
|
||||
|
|
|
@ -158,9 +158,9 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
|
|||
|
||||
// Set up a SpatialSort to quickly find all vertices close to a given position
|
||||
// check whether we can reuse the SpatialSort of a previous step.
|
||||
SpatialSort* vertexFinder = NULL;
|
||||
SpatialSort* vertexFinder = nullptr;
|
||||
SpatialSort _vertexFinder;
|
||||
ai_real posEpsilon = ai_real( 1e-5 );
|
||||
ai_real posEpsilon;
|
||||
if (shared) {
|
||||
std::vector<std::pair<SpatialSort,ai_real> >* avf;
|
||||
shared->GetProperty(AI_SPP_SPATIAL_SORT,avf);
|
||||
|
|
|
@ -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 NULL." );
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
@ -111,7 +111,7 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh)
|
|||
for( unsigned int b = 0; b < bone->mNumWeights; b++)
|
||||
{
|
||||
const aiVertexWeight& w = bone->mWeights[b];
|
||||
vertexWeights[w.mVertexId].push_back( Weight( a, w.mWeight));
|
||||
vertexWeights[w.mVertexId].emplace_back( a, w.mWeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh)
|
|||
{
|
||||
const std::vector<Weight>& vw = vertexWeights[a];
|
||||
for( std::vector<Weight>::const_iterator it = vw.begin(); it != vw.end(); ++it)
|
||||
boneWeights[it->mBone].push_back( aiVertexWeight( a, it->mWeight));
|
||||
boneWeights[it->mBone].emplace_back( a, it->mWeight);
|
||||
}
|
||||
|
||||
// and finally copy the vertex weight list over to the mesh's bones
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,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 {
|
||||
|
|
|
@ -293,7 +293,7 @@ void SortByPTypeProcess::Execute( aiScene* pScene) {
|
|||
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(outIdx, (*it).second );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -274,7 +274,7 @@ public:
|
|||
* @param end Points to the mesh after the last mesh to be processed
|
||||
*/
|
||||
static void MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator it,
|
||||
std::vector<aiMesh*>::const_iterator end);
|
||||
const std::vector<aiMesh*>::const_iterator& end);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Merges two or more materials
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
*/
|
||||
static void BuildUniqueBoneList(std::list<BoneWithHash>& asBones,
|
||||
std::vector<aiMesh*>::const_iterator it,
|
||||
std::vector<aiMesh*>::const_iterator end);
|
||||
const std::vector<aiMesh*>::const_iterator& end);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Add a name prefix to all nodes in a scene.
|
||||
|
|
Loading…
Reference in New Issue