Mesh: fix many linter warnings

This commit is contained in:
wmayer
2024-03-11 19:46:02 +01:00
committed by wwmayer
parent 230c7aa14e
commit a7ae00237d
32 changed files with 232 additions and 138 deletions

View File

@@ -224,8 +224,8 @@ QIcon ViewProviderExport::getIcon() const
// ------------------------------------------------------
App::PropertyFloatConstraint::Constraints ViewProviderMesh::floatRange = {1.0f, 64.0f, 1.0f};
App::PropertyFloatConstraint::Constraints ViewProviderMesh::angleRange = {0.0f, 180.0f, 1.0f};
App::PropertyFloatConstraint::Constraints ViewProviderMesh::floatRange = {1.0F, 64.0F, 1.0F};
App::PropertyFloatConstraint::Constraints ViewProviderMesh::angleRange = {0.0F, 180.0F, 1.0F};
App::PropertyIntegerConstraint::Constraints ViewProviderMesh::intPercent = {0, 100, 5};
const char* ViewProviderMesh::LightingEnums[] = {"One side", "Two side", nullptr};
@@ -357,7 +357,7 @@ void ViewProviderMesh::onChanged(const App::Property* prop)
pcMatBinding->value = SoMaterialBinding::OVERALL;
}
if (prop == &LineTransparency) {
float trans = LineTransparency.getValue() / 100.0f;
float trans = LineTransparency.getValue() / 100.0F;
pLineColor->transparency = trans;
}
else if (prop == &LineWidth) {
@@ -406,12 +406,12 @@ void ViewProviderMesh::onChanged(const App::Property* prop)
void ViewProviderMesh::setOpenEdgeColorFrom(const App::Color& c)
{
float r = 1.0f - c.r;
r = r < 0.5f ? 0.0f : 1.0f;
float g = 1.0f - c.g;
g = g < 0.5f ? 0.0f : 1.0f;
float b = 1.0f - c.b;
b = b < 0.5f ? 0.0f : 1.0f;
float r = 1.0F - c.r;
r = r < 0.5F ? 0.0F : 1.0F;
float g = 1.0F - c.g;
g = g < 0.5F ? 0.0F : 1.0F;
float b = 1.0F - c.b;
b = b < 0.5F ? 0.0F : 1.0F;
pOpenColor->rgb.setValue(r, g, b);
}
@@ -478,8 +478,8 @@ void ViewProviderMesh::attach(App::DocumentObject* pcFeat)
// appear on top of the faces
SoPolygonOffset* offset = new SoPolygonOffset();
offset->styles = SoPolygonOffset::FILLED;
offset->factor = 1.0f;
offset->units = 1.0f;
offset->factor = 1.0F;
offset->units = 1.0F;
SoSeparator* pcWireSep = new SoSeparator();
pcWireSep->addChild(pcLineStyle);
@@ -1297,17 +1297,17 @@ void ViewProviderMesh::selectGLCallback(void* ud, SoEventCallback* n)
pos.getValue(pX, pY);
const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getViewportSizePixels();
float fRatio = view->getSoRenderManager()->getViewportRegion().getViewportAspectRatio();
if (fRatio > 1.0f) {
pX = (pX - 0.5f) / fRatio + 0.5f;
if (fRatio > 1.0F) {
pX = (pX - 0.5F) / fRatio + 0.5F;
pos.setValue(pX, pY);
}
else if (fRatio < 1.0f) {
pY = (pY - 0.5f) * fRatio + 0.5f;
else if (fRatio < 1.0F) {
pY = (pY - 0.5F) * fRatio + 0.5F;
pos.setValue(pX, pY);
}
short x1 = (short)(pX * sz[0] + 0.5f);
short y1 = (short)(pY * sz[1] + 0.5f);
short x1 = (short)(pX * sz[0] + 0.5F);
short y1 = (short)(pY * sz[1] + 0.5F);
SbVec2s loc = ev->getPosition();
short x2 = loc[0];
short y2 = loc[1];
@@ -1436,7 +1436,10 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion& vp, S
}
// Get the new center in normalized pixel coordinates
short xmin {}, xmax {}, ymin {}, ymax {};
short xmin {};
short xmax {};
short ymin {};
short ymax {};
box.getBounds(xmin, ymin, xmax, ymax);
const SbVec2f center((float)((xmin + xmax) / 2) / (float)std::max((int)(size[0] - 1), 1),
(float)(size[1] - (ymin + ymax) / 2)
@@ -1454,8 +1457,8 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion& vp, S
static_cast<SoOrthographicCamera*>(cam)->height = height;
}
else if (cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) {
float height = static_cast<SoPerspectiveCamera*>(cam)->heightAngle.getValue() / 2.0f;
height = 2.0f * atan(tan(height) * scale);
float height = static_cast<SoPerspectiveCamera*>(cam)->heightAngle.getValue() / 2.0F;
height = 2.0F * atan(tan(height) * scale);
static_cast<SoPerspectiveCamera*>(cam)->heightAngle = height;
}
}
@@ -1544,7 +1547,7 @@ std::vector<Mesh::FacetIndex> ViewProviderMesh::getVisibleFacets(const SbViewpor
// Coin3d's off-screen renderer doesn't work out-of-the-box any more on most recent Linux
// systems. So, use FreeCAD's offscreen renderer now.
Gui::SoQtOffscreenRenderer renderer(vp);
renderer.setBackgroundColor(SbColor4f(0.0f, 0.0f, 0.0f));
renderer.setBackgroundColor(SbColor4f(0.0F, 0.0F, 0.0F));
QImage img;
renderer.render(root);
@@ -2091,7 +2094,7 @@ void ViewProviderMesh::selectFacet(Mesh::FacetIndex facet)
highlightSelection();
}
else {
pcShapeMaterial->diffuseColor.set1Value(facet, 1.0f, 0.0f, 0.0f);
pcShapeMaterial->diffuseColor.set1Value(facet, 1.0F, 0.0F, 0.0F);
}
}
@@ -2291,7 +2294,7 @@ void ViewProviderMesh::highlightSelection()
cols[i].setValue(c.r, c.g, c.b);
}
for (Mesh::FacetIndex it : selection) {
cols[it].setValue(1.0f, 0.0f, 0.0f);
cols[it].setValue(1.0F, 0.0F, 0.0F);
}
pcShapeMaterial->diffuseColor.finishEditing();
}
@@ -2494,7 +2497,7 @@ void ViewProviderIndexedFaceSet::attach(App::DocumentObject* pcFeat)
int size = hGrp->GetInt("RenderTriangleLimit", -1);
if (size > 0) {
static_cast<SoFCIndexedFaceSet*>(pcMeshFaces)->renderTriangleLimit =
(unsigned int)(pow(10.0f, size));
(unsigned int)(pow(10.0F, size));
}
}
@@ -2585,7 +2588,7 @@ void ViewProviderMeshObject::attach(App::DocumentObject* pcFeat)
Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh");
int size = hGrp->GetInt("RenderTriangleLimit", -1);
if (size > 0) {
pcMeshShape->renderTriangleLimit = (unsigned int)(pow(10.0f, size));
pcMeshShape->renderTriangleLimit = (unsigned int)(pow(10.0F, size));
}
}