Apply some more modernize-use-emplace

pull/4703/head
Aaron Gokaslan 2022-09-02 11:20:02 -04:00
parent e3b01e10db
commit 411171fa45
17 changed files with 56 additions and 69 deletions

View File

@ -671,7 +671,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
int bone = v.bones[k]; int bone = v.bones[k];
float weight = v.weights[k]; float weight = v.weights[k];
vweights[bone].push_back(aiVertexWeight(vertIdx + faceIndex, weight)); vweights[bone].emplace_back(vertIdx + faceIndex, weight);
} }
} }
++face; ++face;

View File

@ -518,7 +518,7 @@ void COBImporter::ReadMat1_Ascii(Scene &out, LineSplitter &splitter, const Chunk
return; return;
} }
out.materials.push_back(Material()); out.materials.emplace_back();
Material &mat = out.materials.back(); Material &mat = out.materials.back();
mat = nfo; mat = nfo;
@ -1004,7 +1004,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
const chunk_guard cn(nfo, reader); const chunk_guard cn(nfo, reader);
out.materials.push_back(Material()); out.materials.emplace_back();
Material &mat = out.materials.back(); Material &mat = out.materials.back();
mat = nfo; mat = nfo;

View File

@ -3319,7 +3319,7 @@ FBXConverter::KeyFrameListList FBXConverter::GetKeyframeList(const std::vector<c
} }
} }
inputs.push_back(std::make_tuple(Keys, Values, mapto)); inputs.emplace_back(Keys, Values, mapto);
} }
} }
return inputs; // pray for NRVO :-) return inputs; // pray for NRVO :-)
@ -3396,7 +3396,7 @@ FBXConverter::KeyFrameListList FBXConverter::GetRotationKeyframeList(const std::
} }
} }
} }
inputs.push_back(std::make_tuple(Keys, Values, mapto)); inputs.emplace_back(Keys, Values, mapto);
} }
} }
return inputs; return inputs;

View File

@ -399,7 +399,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
ClipperLib::Polygon clip; ClipperLib::Polygon clip;
for(const IfcVector2& pip : a) { for(const IfcVector2& pip : a) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if (ClipperLib::Orientation(clip)) { if (ClipperLib::Orientation(clip)) {
@ -410,7 +410,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
clip.clear(); clip.clear();
for(const IfcVector2& pip : b) { for(const IfcVector2& pip : b) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if (ClipperLib::Orientation(clip)) { if (ClipperLib::Orientation(clip)) {
@ -433,7 +433,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
ClipperLib::Polygon clip; ClipperLib::Polygon clip;
for(const IfcVector2& pip : a) { for(const IfcVector2& pip : a) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if (ClipperLib::Orientation(clip)) { if (ClipperLib::Orientation(clip)) {
@ -444,7 +444,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
clip.clear(); clip.clear();
for(const IfcVector2& pip : b) { for(const IfcVector2& pip : b) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if (ClipperLib::Orientation(clip)) { if (ClipperLib::Orientation(clip)) {
@ -466,7 +466,7 @@ void CleanupWindowContour(ProjectedWindowContour& window)
ClipperLib::ExPolygons clipped; ClipperLib::ExPolygons clipped;
for(const IfcVector2& pip : contour) { for(const IfcVector2& pip : contour) {
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); subject.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
clipper.AddPolygon(subject,ClipperLib::ptSubject); clipper.AddPolygon(subject,ClipperLib::ptSubject);
@ -524,7 +524,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
ClipperLib::Polygon clip; ClipperLib::Polygon clip;
clip.reserve(contour_flat.size()); clip.reserve(contour_flat.size());
for(const IfcVector2& pip : contour_flat) { for(const IfcVector2& pip : contour_flat) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if (!ClipperLib::Orientation(clip)) { if (!ClipperLib::Orientation(clip)) {
@ -544,7 +544,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
continue; continue;
} }
} }
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); subject.emplace_back(to_int64(pip.x), to_int64(pip.y));
if (--countdown == 0) { if (--countdown == 0) {
if (!ClipperLib::Orientation(subject)) { if (!ClipperLib::Orientation(subject)) {
std::reverse(subject.begin(), subject.end()); std::reverse(subject.begin(), subject.end());
@ -1378,12 +1378,12 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
if(!temp_contour.empty()) { if(!temp_contour.empty()) {
if (generate_connection_geometry) { if (generate_connection_geometry) {
contours_to_openings.push_back(std::vector<TempOpening*>( contours_to_openings.emplace_back(
joined_openings.begin(), joined_openings.begin(),
joined_openings.end())); joined_openings.end());
} }
contours.push_back(ProjectedWindowContour(temp_contour, bb, is_rectangle)); contours.emplace_back(temp_contour, bb, is_rectangle);
} }
} }
@ -1791,7 +1791,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,
pip.x = (pip.x - vmin.x) / vmax.x; pip.x = (pip.x - vmin.x) / vmax.x;
pip.y = (pip.y - vmin.y) / vmax.y; pip.y = (pip.y - vmin.y) / vmax.y;
hole.push_back(ClipperLib::IntPoint(to_int64(pip.x),to_int64(pip.y))); hole.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if(!ClipperLib::Orientation(hole)) { if(!ClipperLib::Orientation(hole)) {
@ -1833,7 +1833,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,
pip.x = (pip.x - vmin.x) / vmax.x; pip.x = (pip.x - vmin.x) / vmax.x;
pip.y = (pip.y - vmin.y) / vmax.y; pip.y = (pip.y - vmin.y) / vmax.y;
poly.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); poly.emplace_back(to_int64(pip.x), to_int64(pip.y));
} }
if (ClipperLib::Orientation(poly)) { if (ClipperLib::Orientation(poly)) {

View File

@ -58,7 +58,7 @@ public:
IQMImporter(); IQMImporter();
~IQMImporter() override = default; ~IQMImporter() override = default;
/// \brief Returns whether the class can handle the format of the given file. /// \brief Returns whether the class can handle the format of the given file.
/// \remark See BaseImporter::CanRead() for details. /// \remark See BaseImporter::CanRead() for details.
bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override; bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;

View File

@ -218,7 +218,7 @@ void LWOImporter::CopyFaceIndicesLWOB(FaceList::iterator& it,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LWO::Texture* LWOImporter::SetupNewTextureLWOB(LWO::TextureList& list,unsigned int size) LWO::Texture* LWOImporter::SetupNewTextureLWOB(LWO::TextureList& list,unsigned int size)
{ {
list.push_back(LWO::Texture()); list.emplace_back();
LWO::Texture* tex = &list.back(); LWO::Texture* tex = &list.back();
std::string type; std::string type;

View File

@ -1095,7 +1095,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) {
void LWOImporter::LoadLWO2Clip(unsigned int length) { void LWOImporter::LoadLWO2Clip(unsigned int length) {
AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 10); AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 10);
mClips.push_back(LWO::Clip()); mClips.emplace_back();
LWO::Clip &clip = mClips.back(); LWO::Clip &clip = mClips.back();
// first - get the index of the clip // first - get the index of the clip
@ -1165,7 +1165,7 @@ void LWOImporter::LoadLWO2Clip(unsigned int length) {
void LWOImporter::LoadLWO3Clip(unsigned int length) { void LWOImporter::LoadLWO3Clip(unsigned int length) {
AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 12); AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 12);
mClips.push_back(LWO::Clip()); mClips.emplace_back();
LWO::Clip &clip = mClips.back(); LWO::Clip &clip = mClips.back();
// first - get the index of the clip // first - get the index of the clip
@ -1238,7 +1238,7 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length) {
LE_NCONST uint8_t *const end = mFileBuffer + length; LE_NCONST uint8_t *const end = mFileBuffer + length;
AI_LWO_VALIDATE_CHUNK_LENGTH(length, ENVL, 4); AI_LWO_VALIDATE_CHUNK_LENGTH(length, ENVL, 4);
mEnvelopes.push_back(LWO::Envelope()); mEnvelopes.emplace_back();
LWO::Envelope &envelope = mEnvelopes.back(); LWO::Envelope &envelope = mEnvelopes.back();
// Get the index of the envelope // Get the index of the envelope
@ -1346,7 +1346,7 @@ void LWOImporter::LoadLWO3Envelope(unsigned int length) {
LE_NCONST uint8_t *const end = mFileBuffer + length; LE_NCONST uint8_t *const end = mFileBuffer + length;
AI_LWO_VALIDATE_CHUNK_LENGTH(length, ENVL, 4); AI_LWO_VALIDATE_CHUNK_LENGTH(length, ENVL, 4);
mEnvelopes.push_back(LWO::Envelope()); mEnvelopes.emplace_back();
LWO::Envelope &envelope = mEnvelopes.back(); LWO::Envelope &envelope = mEnvelopes.back();
// Get the index of the envelope // Get the index of the envelope

View File

@ -76,7 +76,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) {
// and read all sections until we're finished // and read all sections until we're finished
bool running = true; bool running = true;
while (running) { while (running) {
mSections.push_back(Section()); mSections.emplace_back();
Section &sec = mSections.back(); Section &sec = mSections.back();
if (!ParseSection(sec)) { if (!ParseSection(sec)) {
break; break;
@ -158,7 +158,7 @@ bool MD5Parser::ParseSection(Section &out) {
break; break;
} }
out.mElements.push_back(Element()); out.mElements.emplace_back();
Element &elem = out.mElements.back(); Element &elem = out.mElements.back();
elem.iLineNumber = lineNumber; elem.iLineNumber = lineNumber;
@ -253,7 +253,7 @@ MD5MeshParser::MD5MeshParser(SectionList &mSections) {
} else if ((*iter).mName == "joints") { } else if ((*iter).mName == "joints") {
// "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 ) // "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 )
for (const auto &elem : (*iter).mElements) { for (const auto &elem : (*iter).mElements) {
mJoints.push_back(BoneDesc()); mJoints.emplace_back();
BoneDesc &desc = mJoints.back(); BoneDesc &desc = mJoints.back();
const char *sz = elem.szStart; const char *sz = elem.szStart;
@ -267,7 +267,7 @@ MD5MeshParser::MD5MeshParser(SectionList &mSections) {
AI_MD5_READ_TRIPLE(desc.mRotationQuat); // normalized quaternion, so w is not there AI_MD5_READ_TRIPLE(desc.mRotationQuat); // normalized quaternion, so w is not there
} }
} else if ((*iter).mName == "mesh") { } else if ((*iter).mName == "mesh") {
mMeshes.push_back(MeshDesc()); mMeshes.emplace_back();
MeshDesc &desc = mMeshes.back(); MeshDesc &desc = mMeshes.back();
for (const auto &elem : (*iter).mElements) { for (const auto &elem : (*iter).mElements) {
@ -364,7 +364,7 @@ MD5AnimParser::MD5AnimParser(SectionList &mSections) {
if ((*iter).mName == "hierarchy") { if ((*iter).mName == "hierarchy") {
// "sheath" 0 63 6 // "sheath" 0 63 6
for (const auto &elem : (*iter).mElements) { for (const auto &elem : (*iter).mElements) {
mAnimatedBones.push_back(AnimBoneDesc()); mAnimatedBones.emplace_back();
AnimBoneDesc &desc = mAnimatedBones.back(); AnimBoneDesc &desc = mAnimatedBones.back();
const char *sz = elem.szStart; const char *sz = elem.szStart;
@ -389,7 +389,7 @@ MD5AnimParser::MD5AnimParser(SectionList &mSections) {
for (const auto &elem : (*iter).mElements) { for (const auto &elem : (*iter).mElements) {
const char *sz = elem.szStart; const char *sz = elem.szStart;
mBaseFrames.push_back(BaseFrameDesc()); mBaseFrames.emplace_back();
BaseFrameDesc &desc = mBaseFrames.back(); BaseFrameDesc &desc = mBaseFrames.back();
AI_MD5_READ_TRIPLE(desc.vPositionXYZ); AI_MD5_READ_TRIPLE(desc.vPositionXYZ);
@ -401,7 +401,7 @@ MD5AnimParser::MD5AnimParser(SectionList &mSections) {
continue; continue;
} }
mFrames.push_back(FrameDesc()); mFrames.emplace_back();
FrameDesc &desc = mFrames.back(); FrameDesc &desc = mFrames.back();
desc.iIndex = strtoul10((*iter).mGlobalValue.c_str()); desc.iIndex = strtoul10((*iter).mGlobalValue.c_str());
@ -459,7 +459,7 @@ MD5CameraParser::MD5CameraParser(SectionList &mSections) {
for (const auto &elem : (*iter).mElements) { for (const auto &elem : (*iter).mElements) {
const char *sz = elem.szStart; const char *sz = elem.szStart;
frames.push_back(CameraAnimFrameDesc()); frames.emplace_back();
CameraAnimFrameDesc &cur = frames.back(); CameraAnimFrameDesc &cur = frames.back();
AI_MD5_READ_TRIPLE(cur.vPositionXYZ); AI_MD5_READ_TRIPLE(cur.vPositionXYZ);
AI_MD5_READ_TRIPLE(cur.vRotationQuat); AI_MD5_READ_TRIPLE(cur.vRotationQuat);

View File

@ -269,43 +269,30 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel,
dynamic_cast<pmx::PmxVertexSkinningSDEF *>(v->skinning.get()); dynamic_cast<pmx::PmxVertexSkinningSDEF *>(v->skinning.get());
switch (v->skinning_type) { switch (v->skinning_type) {
case pmx::PmxVertexSkinningType::BDEF1: case pmx::PmxVertexSkinningType::BDEF1:
bone_vertex_map[vsBDEF1_ptr->bone_index].push_back( bone_vertex_map[vsBDEF1_ptr->bone_index].emplace_back(index, 1.0);
aiVertexWeight(index, 1.0));
break; break;
case pmx::PmxVertexSkinningType::BDEF2: case pmx::PmxVertexSkinningType::BDEF2:
bone_vertex_map[vsBDEF2_ptr->bone_index1].push_back( bone_vertex_map[vsBDEF2_ptr->bone_index1].emplace_back(index, vsBDEF2_ptr->bone_weight);
aiVertexWeight(index, vsBDEF2_ptr->bone_weight)); bone_vertex_map[vsBDEF2_ptr->bone_index2].emplace_back(index, 1.0f - vsBDEF2_ptr->bone_weight);
bone_vertex_map[vsBDEF2_ptr->bone_index2].push_back(
aiVertexWeight(index, 1.0f - vsBDEF2_ptr->bone_weight));
break; break;
case pmx::PmxVertexSkinningType::BDEF4: case pmx::PmxVertexSkinningType::BDEF4:
bone_vertex_map[vsBDEF4_ptr->bone_index1].push_back( bone_vertex_map[vsBDEF4_ptr->bone_index1].emplace_back(index, vsBDEF4_ptr->bone_weight1);
aiVertexWeight(index, vsBDEF4_ptr->bone_weight1)); bone_vertex_map[vsBDEF4_ptr->bone_index2].emplace_back(index, vsBDEF4_ptr->bone_weight2);
bone_vertex_map[vsBDEF4_ptr->bone_index2].push_back( bone_vertex_map[vsBDEF4_ptr->bone_index3].emplace_back(index, vsBDEF4_ptr->bone_weight3);
aiVertexWeight(index, vsBDEF4_ptr->bone_weight2)); bone_vertex_map[vsBDEF4_ptr->bone_index4].emplace_back(index, vsBDEF4_ptr->bone_weight4);
bone_vertex_map[vsBDEF4_ptr->bone_index3].push_back(
aiVertexWeight(index, vsBDEF4_ptr->bone_weight3));
bone_vertex_map[vsBDEF4_ptr->bone_index4].push_back(
aiVertexWeight(index, vsBDEF4_ptr->bone_weight4));
break; break;
case pmx::PmxVertexSkinningType::SDEF: // TODO: how to use sdef_c, sdef_r0, case pmx::PmxVertexSkinningType::SDEF: // TODO: how to use sdef_c, sdef_r0,
// sdef_r1? // sdef_r1?
bone_vertex_map[vsSDEF_ptr->bone_index1].push_back( bone_vertex_map[vsSDEF_ptr->bone_index1].emplace_back(index, vsSDEF_ptr->bone_weight);
aiVertexWeight(index, vsSDEF_ptr->bone_weight)); bone_vertex_map[vsSDEF_ptr->bone_index2].emplace_back(index, 1.0f - vsSDEF_ptr->bone_weight);
bone_vertex_map[vsSDEF_ptr->bone_index2].push_back(
aiVertexWeight(index, 1.0f - vsSDEF_ptr->bone_weight));
break; break;
case pmx::PmxVertexSkinningType::QDEF: case pmx::PmxVertexSkinningType::QDEF:
const auto vsQDEF_ptr = const auto vsQDEF_ptr =
dynamic_cast<pmx::PmxVertexSkinningQDEF *>(v->skinning.get()); dynamic_cast<pmx::PmxVertexSkinningQDEF *>(v->skinning.get());
bone_vertex_map[vsQDEF_ptr->bone_index1].push_back( bone_vertex_map[vsQDEF_ptr->bone_index1].emplace_back(index, vsQDEF_ptr->bone_weight1);
aiVertexWeight(index, vsQDEF_ptr->bone_weight1)); bone_vertex_map[vsQDEF_ptr->bone_index2].emplace_back(index, vsQDEF_ptr->bone_weight2);
bone_vertex_map[vsQDEF_ptr->bone_index2].push_back( bone_vertex_map[vsQDEF_ptr->bone_index3].emplace_back(index, vsQDEF_ptr->bone_weight3);
aiVertexWeight(index, vsQDEF_ptr->bone_weight2)); bone_vertex_map[vsQDEF_ptr->bone_index4].emplace_back(index, vsQDEF_ptr->bone_weight4);
bone_vertex_map[vsQDEF_ptr->bone_index3].push_back(
aiVertexWeight(index, vsQDEF_ptr->bone_weight3));
bone_vertex_map[vsQDEF_ptr->bone_index4].push_back(
aiVertexWeight(index, vsQDEF_ptr->bone_weight4));
break; break;
} }
} }

View File

@ -418,7 +418,7 @@ outer:
(*fit).mat = 0; (*fit).mat = 0;
} }
if (fidx[(*fit).mat].empty()) ++pScene->mNumMeshes; if (fidx[(*fit).mat].empty()) ++pScene->mNumMeshes;
fidx[(*fit).mat].push_back(FaceIdx(p, q)); fidx[(*fit).mat].emplace_back(p, q);
} }
} }
pScene->mNumMaterials = pScene->mNumMeshes; pScene->mNumMaterials = pScene->mNumMeshes;

View File

@ -153,7 +153,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

@ -208,7 +208,7 @@ VertexWeightTable *ComputeVertexBoneWeightTable(const aiMesh *pMesh) {
aiBone *bone = pMesh->mBones[i]; aiBone *bone = pMesh->mBones[i];
for (unsigned int a = 0; a < bone->mNumWeights; ++a) { for (unsigned int a = 0; a < bone->mNumWeights; ++a) {
const aiVertexWeight &weight = bone->mWeights[a]; const aiVertexWeight &weight = bone->mWeights[a];
avPerVertexWeights[weight.mVertexId].push_back(std::pair<unsigned int, float>(i, weight.mWeight)); avPerVertexWeights[weight.mVertexId].emplace_back(i, weight.mWeight);
} }
} }
return avPerVertexWeights; return avPerVertexWeights;

View File

@ -309,7 +309,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(outIdx, (*it).second);
} }
} }

View File

@ -173,7 +173,7 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
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].push_back( BoneWeight( 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!");

View File

@ -434,7 +434,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n) { for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n) {
if (ref[n]) if (ref[n])
continue; continue;
trafo.push_back(STransformVecInfo()); trafo.emplace_back();
trafo.back().uvIndex = n; trafo.back().uvIndex = n;
} }

View File

@ -114,7 +114,7 @@ TEST_F(LimitBoneWeightsTest, testProcess) {
aiBone &pcBone = **(mMesh->mBones + i); aiBone &pcBone = **(mMesh->mBones + i);
for (unsigned int q = 0; q < pcBone.mNumWeights; ++q) { for (unsigned int q = 0; q < pcBone.mNumWeights; ++q) {
aiVertexWeight weight = pcBone.mWeights[q]; aiVertexWeight weight = pcBone.mWeights[q];
asWeights[weight.mVertexId].push_back(LimitBoneWeightsProcess::Weight(i, weight.mWeight)); asWeights[weight.mVertexId].emplace_back(i, weight.mWeight);
} }
} }

View File

@ -125,10 +125,10 @@ public:
ai_assert(expect); ai_assert(expect);
fseek(actual,0,SEEK_END); fseek(actual,0,SEEK_END);
lengths.push(std::make_pair(static_cast<uint32_t>(ftell(actual)),0)); lengths.emplace(static_cast<uint32_t>(ftell(actual)),0);
fseek(actual,0,SEEK_SET); fseek(actual,0,SEEK_SET);
history.push_back(HistoryEntry("---",PerChunkCounter())); history.emplace_back("---",PerChunkCounter());
} }
public: public:
@ -144,7 +144,7 @@ public:
} }
else history.back().second[s] = 0; else history.back().second[s] = 0;
history.push_back(HistoryEntry(s,PerChunkCounter())); history.emplace_back(s,PerChunkCounter());
debug_trace.push_back("PUSH " + s); debug_trace.push_back("PUSH " + s);
} }
@ -158,7 +158,7 @@ public:
/* push current chunk length and start offset on top of stack */ /* push current chunk length and start offset on top of stack */
void push_length(uint32_t nl, uint32_t start) { void push_length(uint32_t nl, uint32_t start) {
lengths.push(std::make_pair(nl,start)); lengths.emplace(nl,start);
++cnt_chunks; ++cnt_chunks;
} }