Cleanup: Clang-Tidy, modernize-use-emplace
This commit is contained in:
parent
cee5a41518
commit
8d5073345d
|
@ -40,7 +40,6 @@ Checks: >
|
|||
-modernize-use-equals-default,
|
||||
-modernize-use-nullptr,
|
||||
-modernize-concat-nested-namespaces,
|
||||
-modernize-use-emplace,
|
||||
-modernize-use-nodiscard,
|
||||
-modernize-use-using,
|
||||
-modernize-use-bool-literals,
|
||||
|
|
|
@ -350,7 +350,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph
|
|||
string basename = string(cleaned);
|
||||
#endif
|
||||
|
||||
_ListOfModels.push_back("Blender_models");
|
||||
_ListOfModels.emplace_back("Blender_models");
|
||||
|
||||
_Scene3dBBox = _RootNode->bbox();
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ void BezierCurveSegment::Build()
|
|||
float increment = 1.0 / (float)nvertices;
|
||||
float t = 0.0f;
|
||||
for (int i = 0; i <= nvertices; ++i) {
|
||||
_Vertices.push_back(Vec2d((x[3] + t * (x[2] + t * (x[1] + t * x[0]))),
|
||||
(y[3] + t * (y[2] + t * (y[1] + t * y[0])))));
|
||||
_Vertices.emplace_back((x[3] + t * (x[2] + t * (x[1] + t * x[0]))),
|
||||
(y[3] + t * (y[2] + t * (y[1] + t * y[0]))));
|
||||
t += increment;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -493,7 +493,7 @@ void FitCurveWrapper::FitCurve(vector<Vec2d> &data, vector<Vec2d> &oCurve, doubl
|
|||
|
||||
// copy results
|
||||
for (vector<Vector2>::iterator v = _vertices.begin(), vend = _vertices.end(); v != vend; ++v) {
|
||||
oCurve.push_back(Vec2d(v->x(), v->y()));
|
||||
oCurve.emplace_back(v->x(), v->y());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices,
|
|||
list<IndexedVertex> indexedVertices;
|
||||
unsigned i;
|
||||
for (i = 0; i < iVSize; i += 3) {
|
||||
indexedVertices.push_back(
|
||||
IndexedVertex(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3));
|
||||
indexedVertices.emplace_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3);
|
||||
}
|
||||
|
||||
// q-sort
|
||||
|
@ -99,7 +98,7 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices,
|
|||
vector<Vec3f> vertices;
|
||||
unsigned i;
|
||||
for (i = 0; i < iVSize; i += 3) {
|
||||
vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
|
||||
vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]);
|
||||
}
|
||||
|
||||
unsigned *mapVertex = new unsigned[iVSize];
|
||||
|
@ -207,7 +206,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices,
|
|||
vector<Vec3f> vertices;
|
||||
unsigned i;
|
||||
for (i = 0; i < iVSize; i += 3) {
|
||||
vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
|
||||
vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]);
|
||||
}
|
||||
|
||||
cleanHashTable ht;
|
||||
|
|
|
@ -384,13 +384,13 @@ int BezierCurveShader::shade(Stroke &stroke) const
|
|||
// Build the Bezier curve from this set of data points:
|
||||
vector<Vec2d> data;
|
||||
StrokeInternal::StrokeVertexIterator v = stroke.strokeVerticesBegin(), vend;
|
||||
data.push_back(Vec2d(v->x(), v->y())); // first one
|
||||
data.emplace_back(v->x(), v->y()); // first one
|
||||
StrokeInternal::StrokeVertexIterator previous = v;
|
||||
++v;
|
||||
for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
|
||||
if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) &&
|
||||
((fabs(v->y() - (previous)->y()) < M_EPSILON)))) {
|
||||
data.push_back(Vec2d(v->x(), v->y()));
|
||||
data.emplace_back(v->x(), v->y());
|
||||
}
|
||||
previous = v;
|
||||
}
|
||||
|
|
|
@ -562,7 +562,7 @@ int Stroke::Resample(int iNPoints)
|
|||
real norm_var = vec_tmp.norm();
|
||||
int numberOfPointsToAdd = (int)floor(NPointsToAdd * norm_var / _Length);
|
||||
float csampling = norm_var / (float)(numberOfPointsToAdd + 1);
|
||||
strokeSegments.push_back(StrokeSegment(it, next, norm_var, numberOfPointsToAdd, csampling));
|
||||
strokeSegments.emplace_back(it, next, norm_var, numberOfPointsToAdd, csampling);
|
||||
N += numberOfPointsToAdd;
|
||||
meanlength += norm_var;
|
||||
++nsegments;
|
||||
|
|
|
@ -45,8 +45,8 @@ SteerableViewMap::SteerableViewMap(unsigned int nbOrientations)
|
|||
_nbOrientations = nbOrientations;
|
||||
_bound = cos(M_PI / (float)_nbOrientations);
|
||||
for (unsigned int i = 0; i < _nbOrientations; ++i) {
|
||||
_directions.push_back(Vec2d(cos((float)i * M_PI / (float)_nbOrientations),
|
||||
sin((float)i * M_PI / (float)_nbOrientations)));
|
||||
_directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations),
|
||||
sin((float)i * M_PI / (float)_nbOrientations));
|
||||
}
|
||||
Build();
|
||||
}
|
||||
|
|
|
@ -566,7 +566,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
|
|||
if (wFace) {
|
||||
vector<Vec3r> vertices;
|
||||
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
|
||||
vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
|
||||
vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
|
||||
}
|
||||
Polygon3r poly(vertices, wFace->GetNormal());
|
||||
poly.userdata = (void *)wFace;
|
||||
|
@ -764,7 +764,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
|
|||
if (wFace) {
|
||||
vector<Vec3r> vertices;
|
||||
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
|
||||
vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
|
||||
vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
|
||||
}
|
||||
Polygon3r poly(vertices, wFace->GetNormal());
|
||||
poly.userdata = (void *)wFace;
|
||||
|
@ -918,7 +918,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
|
|||
if (wFace) {
|
||||
vector<Vec3r> vertices;
|
||||
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
|
||||
vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
|
||||
vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
|
||||
}
|
||||
Polygon3r poly(vertices, wFace->GetNormal());
|
||||
poly.userdata = (void *)wFace;
|
||||
|
@ -1002,7 +1002,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
|
|||
if (wFace) {
|
||||
vector<Vec3r> vertices;
|
||||
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
|
||||
vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
|
||||
vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
|
||||
}
|
||||
Polygon3r poly(vertices, wFace->GetNormal());
|
||||
poly.userdata = (void *)wFace;
|
||||
|
|
|
@ -42,7 +42,7 @@ void WFillGrid::fillGrid()
|
|||
(*f)->RetrieveVertexList(fvertices);
|
||||
|
||||
for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) {
|
||||
vectors.push_back(Vec3r((*wv)->GetVertex()));
|
||||
vectors.emplace_back((*wv)->GetVertex());
|
||||
}
|
||||
|
||||
// occluder will be deleted by the grid
|
||||
|
|
|
@ -42,7 +42,7 @@ void WSFillGrid::fillGrid()
|
|||
(*f)->RetrieveVertexList(fvertices);
|
||||
|
||||
for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) {
|
||||
vectors.push_back(Vec3r((*wv)->GetVertex()));
|
||||
vectors.emplace_back((*wv)->GetVertex());
|
||||
}
|
||||
|
||||
// occluder will be deleted by the grid
|
||||
|
|
|
@ -282,23 +282,23 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/,
|
|||
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]);
|
||||
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 2] / 3]);
|
||||
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[nTriangle]],
|
||||
normals[nindices[nTriangle] + 1],
|
||||
normals[nindices[nTriangle] + 2]));
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 1]],
|
||||
normals[nindices[nTriangle + 1] + 1],
|
||||
normals[nindices[nTriangle + 1] + 2]));
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 2]],
|
||||
normals[nindices[nTriangle + 2] + 1],
|
||||
normals[nindices[nTriangle + 2] + 2]));
|
||||
triangleNormals.emplace_back(normals[nindices[nTriangle]],
|
||||
normals[nindices[nTriangle] + 1],
|
||||
normals[nindices[nTriangle] + 2]);
|
||||
triangleNormals.emplace_back(normals[nindices[nTriangle + 1]],
|
||||
normals[nindices[nTriangle + 1] + 1],
|
||||
normals[nindices[nTriangle + 1] + 2]);
|
||||
triangleNormals.emplace_back(normals[nindices[nTriangle + 2]],
|
||||
normals[nindices[nTriangle + 2] + 1],
|
||||
normals[nindices[nTriangle + 2] + 2]);
|
||||
|
||||
if (texCoords) {
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1]));
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[nTriangle + 1]], texCoords[tindices[nTriangle + 1] + 1]));
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[nTriangle + 2]], texCoords[tindices[nTriangle + 2] + 1]));
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[nTriangle]],
|
||||
texCoords[tindices[nTriangle] + 1]);
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 1]],
|
||||
texCoords[tindices[nTriangle + 1] + 1]);
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 2]],
|
||||
texCoords[tindices[nTriangle + 2] + 1]);
|
||||
}
|
||||
}
|
||||
else { // if nTriangle is odd
|
||||
|
@ -306,23 +306,23 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/,
|
|||
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 2] / 3]);
|
||||
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]);
|
||||
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[nTriangle]],
|
||||
normals[nindices[nTriangle] + 1],
|
||||
normals[nindices[nTriangle] + 2]));
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 2]],
|
||||
normals[nindices[nTriangle + 2] + 1],
|
||||
normals[nindices[nTriangle + 2] + 2]));
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 1]],
|
||||
normals[nindices[nTriangle + 1] + 1],
|
||||
normals[nindices[nTriangle + 1] + 2]));
|
||||
triangleNormals.emplace_back(normals[nindices[nTriangle]],
|
||||
normals[nindices[nTriangle] + 1],
|
||||
normals[nindices[nTriangle] + 2]);
|
||||
triangleNormals.emplace_back(normals[nindices[nTriangle + 2]],
|
||||
normals[nindices[nTriangle + 2] + 1],
|
||||
normals[nindices[nTriangle + 2] + 2]);
|
||||
triangleNormals.emplace_back(normals[nindices[nTriangle + 1]],
|
||||
normals[nindices[nTriangle + 1] + 1],
|
||||
normals[nindices[nTriangle + 1] + 2]);
|
||||
|
||||
if (texCoords) {
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1]));
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[nTriangle + 2]], texCoords[tindices[nTriangle + 2] + 1]));
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[nTriangle + 1]], texCoords[tindices[nTriangle + 1] + 1]));
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[nTriangle]],
|
||||
texCoords[tindices[nTriangle] + 1]);
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 2]],
|
||||
texCoords[tindices[nTriangle + 2] + 1]);
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 1]],
|
||||
texCoords[tindices[nTriangle + 1] + 1]);
|
||||
}
|
||||
}
|
||||
triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle / 3] & IndexedFaceSet::FACE_MARK) !=
|
||||
|
@ -386,22 +386,21 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/,
|
|||
triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 1] / 3]);
|
||||
triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 2] / 3]);
|
||||
|
||||
triangleNormals.push_back(Vec3f(
|
||||
normals[nindices[3 * i]], normals[nindices[3 * i] + 1], normals[nindices[3 * i] + 2]));
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[3 * i + 1]],
|
||||
normals[nindices[3 * i + 1] + 1],
|
||||
normals[nindices[3 * i + 1] + 2]));
|
||||
triangleNormals.push_back(Vec3f(normals[nindices[3 * i + 2]],
|
||||
normals[nindices[3 * i + 2] + 1],
|
||||
normals[nindices[3 * i + 2] + 2]));
|
||||
triangleNormals.emplace_back(
|
||||
normals[nindices[3 * i]], normals[nindices[3 * i] + 1], normals[nindices[3 * i] + 2]);
|
||||
triangleNormals.emplace_back(normals[nindices[3 * i + 1]],
|
||||
normals[nindices[3 * i + 1] + 1],
|
||||
normals[nindices[3 * i + 1] + 2]);
|
||||
triangleNormals.emplace_back(normals[nindices[3 * i + 2]],
|
||||
normals[nindices[3 * i + 2] + 1],
|
||||
normals[nindices[3 * i + 2] + 2]);
|
||||
|
||||
if (texCoords) {
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[3 * i]], texCoords[tindices[3 * i] + 1]));
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[3 * i + 1]], texCoords[tindices[3 * i + 1] + 1]));
|
||||
triangleTexCoords.push_back(
|
||||
Vec2f(texCoords[tindices[3 * i + 2]], texCoords[tindices[3 * i + 2] + 1]));
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[3 * i]], texCoords[tindices[3 * i] + 1]);
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[3 * i + 1]],
|
||||
texCoords[tindices[3 * i + 1] + 1]);
|
||||
triangleTexCoords.emplace_back(texCoords[tindices[3 * i + 2]],
|
||||
texCoords[tindices[3 * i + 2] + 1]);
|
||||
}
|
||||
|
||||
triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::FACE_MARK) != 0);
|
||||
|
|
|
@ -170,7 +170,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
|
|||
float r_uv[2], mapfw[4], vec[3];
|
||||
|
||||
psys_interpolate_uvs(tface, face->v4, pa->fuv, r_uv);
|
||||
uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1]));
|
||||
uv_values.emplace_back(r_uv[0], r_uv[1]);
|
||||
|
||||
psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, normal, NULL, NULL, NULL);
|
||||
|
||||
|
@ -203,7 +203,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
|
|||
}
|
||||
|
||||
if (vtx[o] == num) {
|
||||
uv_values.push_back(Imath::V2f(tface->uv[o][0], tface->uv[o][1]));
|
||||
uv_values.emplace_back(tface->uv[o][0], tface->uv[o][1]);
|
||||
|
||||
MVert *mv = mverts + vtx[o];
|
||||
|
||||
|
@ -230,7 +230,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
|
|||
mul_m4_v3(inv_mat, vert);
|
||||
|
||||
/* Convert Z-up to Y-up. */
|
||||
verts.push_back(Imath::V3f(vert[0], vert[2], -vert[1]));
|
||||
verts.emplace_back(vert[0], vert[2], -vert[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,12 +277,12 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context,
|
|||
float r_uv[2], tmpnor[3], mapfw[4], vec[3];
|
||||
|
||||
psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv);
|
||||
uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1]));
|
||||
uv_values.emplace_back(r_uv[0], r_uv[1]);
|
||||
|
||||
psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, tmpnor, NULL, NULL, NULL);
|
||||
|
||||
/* Convert Z-up to Y-up. */
|
||||
norm_values.push_back(Imath::V3f(tmpnor[0], tmpnor[2], -tmpnor[1]));
|
||||
norm_values.emplace_back(tmpnor[0], tmpnor[2], -tmpnor[1]);
|
||||
}
|
||||
else {
|
||||
if (!uv_values.empty()) {
|
||||
|
@ -302,7 +302,7 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context,
|
|||
mul_m4_v3(inv_mat, vert);
|
||||
|
||||
/* Convert Z-up to Y-up. */
|
||||
verts.push_back(Imath::V3f(vert[0], vert[2], -vert[1]));
|
||||
verts.emplace_back(vert[0], vert[2], -vert[1]);
|
||||
|
||||
path++;
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ void ABCPointsWriter::do_write(HierarchyContext &context)
|
|||
sub_v3_v3v3(vel, state.co, psys->particles[p].prev_state.co);
|
||||
|
||||
/* Convert Z-up to Y-up. */
|
||||
points.push_back(Imath::V3f(pos[0], pos[2], -pos[1]));
|
||||
velocities.push_back(Imath::V3f(vel[0], vel[2], -vel[1]));
|
||||
points.emplace_back(pos[0], pos[2], -pos[1]);
|
||||
velocities.emplace_back(vel[0], vel[2], -vel[1]);
|
||||
widths.push_back(psys->particles[p].size);
|
||||
ids.push_back(index++);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ void AbcNurbsReader::getNurbsPatches(const IObject &obj)
|
|||
if (num_children == 0) {
|
||||
INuPatch abc_nurb(obj, kWrapExisting);
|
||||
INuPatchSchema schem = abc_nurb.getSchema();
|
||||
m_schemas.push_back(std::pair<INuPatchSchema, IObject>(schem, obj));
|
||||
m_schemas.emplace_back(schem, obj);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ void AbcNurbsReader::getNurbsPatches(const IObject &obj)
|
|||
if (INuPatch::matches(md) && ok) {
|
||||
INuPatch abc_nurb(child, kWrapExisting);
|
||||
INuPatchSchema schem = abc_nurb.getSchema();
|
||||
m_schemas.push_back(std::pair<INuPatchSchema, IObject>(schem, child));
|
||||
m_schemas.emplace_back(schem, child);
|
||||
}
|
||||
|
||||
getNurbsPatches(child);
|
||||
|
|
Loading…
Reference in New Issue