diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 10:04:52 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:26:27 +0300 |
commit | 891949cbb47143420f4324cb60efc05ef5d70b39 (patch) | |
tree | fe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source/blender/freestyle/intern/view_map | |
parent | c9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff) |
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
8 files changed, 31 insertions, 32 deletions
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index c8a6f0a0a3e..eac6765da99 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -127,7 +127,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, ++f) { if ((*f)->isInImage()) { Vec3r point = transform((*f)->center3d()); - unsigned int i, j; + uint i, j; getCellCoordinates(point, i, j); if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell @@ -149,8 +149,8 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, void BoxGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; @@ -194,7 +194,7 @@ void BoxGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) BoxGrid::Cell *BoxGrid::findCell(const Vec3r &point) { - unsigned int x, y; + uint x, y; getCellCoordinates(point, x, y); return _cells[x * _cellsY + y]; } diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 8ae6bec2fb2..e2886370800 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -56,7 +56,7 @@ bool CulledOccluderSource::next() void CulledOccluderSource::getOccluderProscenium(real proscenium[4]) { - for (unsigned int i = 0; i < 4; ++i) { + for (uint i = 0; i < 4; ++i) { proscenium[i] = gridSpaceOccluderProscenium[i]; } } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index cd36e4b0fe9..ffbb13e5df7 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -420,8 +420,8 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace) WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false); iFace->AddSmoothLayer(flayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); flayer->PushDotP(wxv->curvatures()->K1); @@ -570,8 +570,8 @@ void FEdgeXDetector::ProcessSuggestiveContourFace(WXFace *iFace) WXFaceLayer *faceLayer = new WXFaceLayer(iFace, Nature::SUGGESTIVE_CONTOUR, true); iFace->AddSmoothLayer(faceLayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); faceLayer->PushDotP(wxv->curvatures()->Kr); @@ -626,7 +626,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) GeomUtils::intersection_test res; real kr(0), kr1(0), kr2(0), t; - for (unsigned int i = 0; i < vertices_nb; ++i) { + for (uint i = 0; i < vertices_nb; ++i) { v = (WXVertex *)(iFace->GetVertex(i)); // v is a singular vertex, skip it. diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index 24625d39781..b77ccebe1f6 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -319,7 +319,7 @@ int QuantitativeInvisibilityF0D::operator()(Interface0DIterator &iter) { ViewEdge *ve1, *ve2; getViewEdges(iter, ve1, ve2); - unsigned int qi1, qi2; + uint qi1, qi2; qi1 = ve1->qi(); if (ve2 != nullptr) { qi2 = ve2->qi(); diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index dfe6bfdd0cf..7d9d871f586 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -66,7 +66,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const int iViewport[4], real iFocal) { - unsigned int i, j; + uint i, j; _translation[0] = iModelViewMatrix[3][0]; _translation[1] = iModelViewMatrix[3][1]; _translation[2] = iModelViewMatrix[3][2]; @@ -88,7 +88,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { _transform[i][j] = 0; - for (unsigned int k = 0; k < 4; k++) { + for (uint k = 0; k < 4; k++) { _transform[i][j] += _projectionMatrix[i][k] * _modelViewMatrix[k][j]; } } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 2a7637eb350..70f10058411 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -146,8 +146,8 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, void SphericalGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 1211b55e8e1..88f94e152a1 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -26,11 +26,11 @@ namespace Freestyle { using namespace Geometry; -SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) +SteerableViewMap::SteerableViewMap(uint nbOrientations) { _nbOrientations = nbOrientations; _bound = cos(M_PI / (float)_nbOrientations); - for (unsigned int i = 0; i < _nbOrientations; ++i) { + for (uint i = 0; i < _nbOrientations; ++i) { _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations), sin((float)i * M_PI / (float)_nbOrientations)); } @@ -47,7 +47,7 @@ void SteerableViewMap::Build() SteerableViewMap::SteerableViewMap(const SteerableViewMap &iBrother) { _nbOrientations = iBrother._nbOrientations; - unsigned int i; + uint i; _bound = iBrother._bound; _directions = iBrother._directions; _mapping = iBrother._mapping; @@ -66,7 +66,7 @@ SteerableViewMap::~SteerableViewMap() void SteerableViewMap::Clear() { - unsigned int i; + uint i; if (_imagesPyramids) { for (i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i]) { @@ -77,8 +77,7 @@ void SteerableViewMap::Clear() _imagesPyramids = nullptr; } if (!_mapping.empty()) { - for (map<unsigned int, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); - m != mend; + for (map<uint, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); m != mend; ++m) { delete[](*m).second; } @@ -109,7 +108,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) { unsigned i; unsigned id = iFEdge->getId().getFirst(); - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { return (*o).second; } @@ -142,7 +141,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) dir /= norm; double maxw = 0.0f; unsigned winner = _nbOrientations + 1; - for (unsigned int i = 0; i < _nbOrientations; ++i) { + for (uint i = 0; i < _nbOrientations; ++i) { double w = ComputeWeight(dir, i); if (w > maxw) { maxw = w; @@ -154,7 +153,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) unsigned SteerableViewMap::getSVMNumber(unsigned id) { - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; double maxw = 0.0; @@ -176,7 +175,7 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, unsigned iNbLevels, float iSigma) { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { ImagePyramid *svm = (_imagesPyramids)[i]; delete svm; if (copy) { @@ -215,7 +214,7 @@ float SteerableViewMap::readCompleteViewMapPixel(int iLevel, int x, int y) return readSteerableViewMapPixel(_nbOrientations, iLevel, x, y); } -unsigned int SteerableViewMap::getNumberOfPyramidLevels() const +uint SteerableViewMap::getNumberOfPyramidLevels() const { if (_imagesPyramids[0]) { return _imagesPyramids[0]->getNumberOfLevels(); @@ -225,7 +224,7 @@ unsigned int SteerableViewMap::getNumberOfPyramidLevels() const void SteerableViewMap::saveSteerableViewMap() const { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i] == nullptr) { cerr << "SteerableViewMap warning: orientation " << i << " of steerable View Map whas not been computed yet" << endl; diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 17447ced5e4..bbf9962b0e6 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -1003,11 +1003,11 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) } } -void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, unsigned int sceneNumFaces) +void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, uint sceneNumFaces) { _Grid->clear(); Vec3r size; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]); // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells // intersections. @@ -1032,7 +1032,7 @@ ViewMap *ViewMapBuilder::BuildViewMap(WingedEdge &we, visibility_algo iAlgo, real epsilon, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces) + uint sceneNumFaces) { _ViewMap = new ViewMap; _currentId = 1; @@ -1435,7 +1435,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces, + uint sceneNumFaces, visibility_algo iAlgo, real epsilon) { @@ -2270,7 +2270,7 @@ struct less_SVertex2D { { Vec3r A = x->point2D(); Vec3r B = y->point2D(); - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { if (fabs(A[i] - B[i]) < epsilon) { continue; } |