From 8a68f4f80814a28d68055a0ae0b22a7efe1c2619 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2022 10:04:44 +1000 Subject: Cleanup: replace unsigned with uint, use function style casts for C++ --- intern/sky/source/sky_model.cpp | 10 +- source/blender/blenlib/intern/math_solvers.c | 4 +- .../freestyle/intern/application/Controller.cpp | 26 ++--- .../intern/blender_interface/BlenderFileLoader.cpp | 22 ++-- .../blender_interface/BlenderStrokeRenderer.cpp | 2 +- .../blender/freestyle/intern/geometry/FastGrid.cpp | 2 +- .../blender/freestyle/intern/geometry/FitCurve.cpp | 4 +- .../freestyle/intern/geometry/GeomCleaner.cpp | 66 ++++++------ .../freestyle/intern/geometry/GeomUtils.cpp | 4 +- source/blender/freestyle/intern/geometry/Grid.cpp | 33 +++--- .../blender/freestyle/intern/geometry/HashGrid.cpp | 2 +- source/blender/freestyle/intern/geometry/Noise.cpp | 6 +- .../freestyle/intern/image/ImagePyramid.cpp | 12 +-- .../intern/python/BPy_ContextFunctions.cpp | 8 +- .../freestyle/intern/python/BPy_FrsNoise.cpp | 2 +- .../blender/freestyle/intern/python/Director.cpp | 4 +- .../BPy_EqualToChainingTimeStampUP1D.cpp | 2 +- .../UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp | 2 +- .../python/UnaryPredicate1D/BPy_ShapeUP1D.cpp | 2 +- .../intern/scene_graph/IndexedFaceSet.cpp | 70 ++++++------- .../freestyle/intern/scene_graph/SceneHash.cpp | 4 +- .../intern/scene_graph/ScenePrettyPrinter.cpp | 2 +- .../intern/stroke/AdvancedFunctions1D.cpp | 4 +- .../intern/stroke/AdvancedStrokeShaders.cpp | 2 +- .../freestyle/intern/stroke/BasicStrokeShaders.cpp | 2 +- source/blender/freestyle/intern/stroke/Canvas.cpp | 18 ++-- .../freestyle/intern/stroke/ContextFunctions.cpp | 14 +-- .../blender/freestyle/intern/stroke/Operators.cpp | 10 +- .../freestyle/intern/stroke/StrokeRenderer.cpp | 4 +- .../freestyle/intern/system/PseudoNoise.cpp | 4 +- source/blender/freestyle/intern/system/RandGen.cpp | 12 +-- .../freestyle/intern/system/StringUtils.cpp | 4 +- .../view_map/ArbitraryGridDensityProvider.cpp | 9 +- .../view_map/AverageAreaGridDensityProvider.cpp | 4 +- .../blender/freestyle/intern/view_map/BoxGrid.cpp | 6 +- .../freestyle/intern/view_map/FEdgeXDetector.cpp | 2 +- .../freestyle/intern/view_map/Functions0D.cpp | 2 +- .../HeuristicGridDensityProviderFactory.cpp | 2 +- .../freestyle/intern/view_map/OccluderSource.cpp | 2 +- .../intern/view_map/Pow23GridDensityProvider.cpp | 8 +- .../freestyle/intern/view_map/SphericalGrid.cpp | 10 +- .../freestyle/intern/view_map/SteerableViewMap.cpp | 20 ++-- .../freestyle/intern/view_map/ViewEdgeXBuilder.cpp | 6 +- .../blender/freestyle/intern/view_map/ViewMap.cpp | 2 +- .../freestyle/intern/view_map/ViewMapBuilder.cpp | 114 ++++++++++----------- .../blender/freestyle/intern/winged_edge/WEdge.cpp | 8 +- .../freestyle/intern/winged_edge/WXEdge.cpp | 10 +- .../freestyle/intern/winged_edge/WXEdgeBuilder.cpp | 2 +- .../intern/winged_edge/WingedEdgeBuilder.cpp | 44 ++++---- 49 files changed, 305 insertions(+), 309 deletions(-) diff --git a/intern/sky/source/sky_model.cpp b/intern/sky/source/sky_model.cpp index 4181605b9e4..9fb80202c98 100644 --- a/intern/sky/source/sky_model.cpp +++ b/intern/sky/source/sky_model.cpp @@ -129,7 +129,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset, elev_matrix = dataset + (9 * 6 * (int_turbidity - 1)); - for (unsigned int i = 0; i < 9; ++i) { + for (uint i = 0; i < 9; ++i) { //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4; config[i] = (1.0 - albedo) * (1.0 - turbidity_rem) * @@ -143,7 +143,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset, // alb 1 low turb elev_matrix = dataset + (9 * 6 * 10 + 9 * 6 * (int_turbidity - 1)); - for (unsigned int i = 0; i < 9; ++i) { + for (uint i = 0; i < 9; ++i) { //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4; config[i] += (albedo) * (1.0 - turbidity_rem) * @@ -161,7 +161,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset, // alb 0 high turb elev_matrix = dataset + (9 * 6 * (int_turbidity)); - for (unsigned int i = 0; i < 9; ++i) { + for (uint i = 0; i < 9; ++i) { //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4; config[i] += (1.0 - albedo) * (turbidity_rem) * @@ -175,7 +175,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset, // alb 1 high turb elev_matrix = dataset + (9 * 6 * 10 + 9 * 6 * (int_turbidity)); - for (unsigned int i = 0; i < 9; ++i) { + for (uint i = 0; i < 9; ++i) { //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4; config[i] += (albedo) * (turbidity_rem) * @@ -313,7 +313,7 @@ SKY_ArHosekSkyModelState *SKY_arhosek_xyz_skymodelstate_alloc_init(const double state->albedo = albedo; state->elevation = elevation; - for (unsigned int channel = 0; channel < 3; ++channel) { + for (uint channel = 0; channel < 3; ++channel) { ArHosekSkyModel_CookConfiguration( datasetsXYZ[channel], state->configs[channel], turbidity, albedo, elevation); diff --git a/source/blender/blenlib/intern/math_solvers.c b/source/blender/blenlib/intern/math_solvers.c index b5650410a70..1196c0bed7f 100644 --- a/source/blender/blenlib/intern/math_solvers.c +++ b/source/blender/blenlib/intern/math_solvers.c @@ -45,7 +45,7 @@ bool BLI_tridiagonal_solve( return false; } - size_t bytes = sizeof(double) * (unsigned)count; + size_t bytes = sizeof(double) * (uint)count; double *c1 = (double *)MEM_mallocN(bytes * 2, "tridiagonal_c1d1"); double *d1 = c1 + count; @@ -112,7 +112,7 @@ bool BLI_tridiagonal_solve_cyclic( return BLI_tridiagonal_solve(a, b, c, d, r_x, count); } - size_t bytes = sizeof(float) * (unsigned)count; + size_t bytes = sizeof(float) * (uint)count; float *tmp = (float *)MEM_mallocN(bytes * 2, "tridiagonal_ex"); float *b2 = tmp + count; diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 08480533937..80e58820b37 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -919,7 +919,7 @@ Render *Controller::RenderStrokes(Render *re, bool render) return freestyle_render; } -void Controller::InsertStyleModule(unsigned index, const char *iFileName) +void Controller::InsertStyleModule(uint index, const char *iFileName) { if (!BLI_path_extension_check(iFileName, ".py")) { cerr << "Error: Cannot load \"" << string(iFileName) << "\", unknown extension" << endl; @@ -930,13 +930,13 @@ void Controller::InsertStyleModule(unsigned index, const char *iFileName) _Canvas->InsertStyleModule(index, sm); } -void Controller::InsertStyleModule(unsigned index, const char *iName, const char *iBuffer) +void Controller::InsertStyleModule(uint index, const char *iName, const char *iBuffer) { StyleModule *sm = new BufferedStyleModule(iBuffer, iName, _inter); _Canvas->InsertStyleModule(index, sm); } -void Controller::InsertStyleModule(unsigned index, const char *iName, struct Text *iText) +void Controller::InsertStyleModule(uint index, const char *iName, struct Text *iText) { StyleModule *sm = new BlenderStyleModule(iText, iName, _inter); _Canvas->InsertStyleModule(index, sm); @@ -947,7 +947,7 @@ void Controller::AddStyleModule(const char * /*iFileName*/) //_pStyleWindow->Add(iFileName); } -void Controller::RemoveStyleModule(unsigned index) +void Controller::RemoveStyleModule(uint index) { _Canvas->RemoveStyleModule(index); } @@ -957,34 +957,34 @@ void Controller::Clear() _Canvas->Clear(); } -void Controller::ReloadStyleModule(unsigned index, const char *iFileName) +void Controller::ReloadStyleModule(uint index, const char *iFileName) { StyleModule *sm = new StyleModule(iFileName, _inter); _Canvas->ReplaceStyleModule(index, sm); } -void Controller::SwapStyleModules(unsigned i1, unsigned i2) +void Controller::SwapStyleModules(uint i1, uint i2) { _Canvas->SwapStyleModules(i1, i2); } -void Controller::toggleLayer(unsigned index, bool iDisplay) +void Controller::toggleLayer(uint index, bool iDisplay) { _Canvas->setVisible(index, iDisplay); } -void Controller::setModified(unsigned index, bool iMod) +void Controller::setModified(uint index, bool iMod) { //_pStyleWindow->setModified(index, iMod); _Canvas->setModified(index, iMod); updateCausalStyleModules(index + 1); } -void Controller::updateCausalStyleModules(unsigned index) +void Controller::updateCausalStyleModules(uint index) { - vector vec; + vector vec; _Canvas->causalStyleModules(vec, index); - for (vector::const_iterator it = vec.begin(); it != vec.end(); it++) { + for (vector::const_iterator it = vec.begin(); it != vec.end(); it++) { //_pStyleWindow->setModified(*it, true); _Canvas->setModified(*it, true); } @@ -1057,8 +1057,8 @@ void Controller::displayDensityCurves(int x, int y) vector curvesDirection(svm->getNumberOfPyramidLevels()); // collect the curves values - unsigned nbCurves = svm->getNumberOfOrientations() + 1; - unsigned nbPoints = svm->getNumberOfPyramidLevels(); + uint nbCurves = svm->getNumberOfOrientations() + 1; + uint nbPoints = svm->getNumberOfPyramidLevels(); if (!nbPoints) { return; } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index dec443064de..19589491bc4 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -436,7 +436,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // We count the number of triangles after the clipping by the near and far view // planes is applied (NOTE: mesh vertices are in the camera coordinate system). - unsigned numFaces = 0; + uint numFaces = 0; float v1[3], v2[3], v3[3]; float n1[3], n2[3], n3[3], facenormal[3]; int clip[3]; @@ -471,16 +471,16 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) NodeGroup *currentMesh = new NodeGroup; NodeShape *shape = new NodeShape; - unsigned vSize = 3 * 3 * numFaces; + uint vSize = 3 * 3 * numFaces; float *vertices = new float[vSize]; - unsigned nSize = vSize; + uint nSize = vSize; float *normals = new float[nSize]; - unsigned *numVertexPerFaces = new unsigned[numFaces]; + uint *numVertexPerFaces = new uint[numFaces]; vector meshMaterials; vector meshFrsMaterials; IndexedFaceSet::TRIANGLES_STYLE *faceStyle = new IndexedFaceSet::TRIANGLES_STYLE[numFaces]; - unsigned i; + uint i; for (i = 0; i < numFaces; i++) { faceStyle[i] = IndexedFaceSet::TRIANGLES; numVertexPerFaces[i] = 3; @@ -488,11 +488,11 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) IndexedFaceSet::FaceEdgeMark *faceEdgeMarks = new IndexedFaceSet::FaceEdgeMark[numFaces]; - unsigned viSize = 3 * numFaces; - unsigned *VIndices = new unsigned[viSize]; - unsigned niSize = viSize; - unsigned *NIndices = new unsigned[niSize]; - unsigned *MIndices = new unsigned[viSize]; // Material Indices + uint viSize = 3 * numFaces; + uint *VIndices = new uint[viSize]; + uint niSize = viSize; + uint *NIndices = new uint[niSize]; + uint *MIndices = new uint[viSize]; // Material Indices struct LoaderState ls; ls.pv = vertices; @@ -662,7 +662,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // addressed later in WShape::MakeFace(). vector detriList; Vec3r zero(0.0, 0.0, 0.0); - unsigned vi0, vi1, vi2; + uint vi0, vi1, vi2; for (i = 0; i < viSize; i += 3) { detri_t detri; vi0 = cleanVIndices[i]; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index ba583ecb2e1..64e7be5169c 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -189,7 +189,7 @@ float BlenderStrokeRenderer::get_stroke_vertex_z() const uint BlenderStrokeRenderer::get_stroke_mesh_id() const { - unsigned mesh_id = _mesh_id; + uint mesh_id = _mesh_id; BlenderStrokeRenderer *self = const_cast(this); self->_mesh_id--; return mesh_id; diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp index f87b25ebc71..24ecacbad2a 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.cpp +++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp @@ -32,7 +32,7 @@ void FastGrid::clear() Grid::clear(); } -void FastGrid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) +void FastGrid::configure(const Vec3r &orig, const Vec3r &size, uint nb) { Grid::configure(orig, size, nb); _cells_size = _cells_nb[0] * _cells_nb[1] * _cells_nb[2]; diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index eb53fd1257c..3ea83576e8f 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -273,7 +273,7 @@ static Vector2 BezierII(int degree, Vector2 *V, double t) Vector2 *Vtemp; /* Local copy of control points */ /* Copy array */ - Vtemp = (Vector2 *)malloc((unsigned)((degree + 1) * sizeof(Vector2))); + Vtemp = (Vector2 *)malloc(uint((degree + 1) * sizeof(Vector2))); for (i = 0; i <= degree; i++) { Vtemp[i] = V[i]; } @@ -376,7 +376,7 @@ static double *ChordLengthParameterize(Vector2 *d, int first, int last) int i; double *u; /* Parameterization */ - u = (double *)malloc((unsigned)(last - first + 1) * sizeof(double)); + u = (double *)malloc(uint(last - first + 1) * sizeof(double)); u[0] = 0.0; for (i = first + 1; i <= last; i++) { diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 1bbea79d793..c17fb92a58c 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -30,15 +30,15 @@ using namespace std; namespace Freestyle { void GeomCleaner::SortIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned **oIndices) + uint **oIndices) { // First, we build a list of IndexVertex: list indexedVertices; - unsigned i; + uint i; for (i = 0; i < iVSize; i += 3) { indexedVertices.emplace_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3); } @@ -47,11 +47,11 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, indexedVertices.sort(); // build the indices mapping array: - unsigned *mapIndices = new unsigned[iVSize / 3]; + uint *mapIndices = new uint[iVSize / 3]; *oVertices = new float[iVSize]; list::iterator iv; - unsigned newIndex = 0; - unsigned vIndex = 0; + uint newIndex = 0; + uint vIndex = 0; for (iv = indexedVertices.begin(); iv != indexedVertices.end(); iv++) { // Build the final results: (*oVertices)[vIndex] = iv->x(); @@ -64,7 +64,7 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, } // Build the final index array: - *oIndices = new unsigned[iISize]; + *oIndices = new uint[iISize]; for (i = 0; i < iISize; i++) { (*oIndices)[i] = 3 * mapIndices[iIndices[i] / 3]; } @@ -73,21 +73,21 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, } void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned *oVSize, - unsigned **oIndices) + uint *oVSize, + uint **oIndices) { // First, we build a list of IndexVertex: vector vertices; - unsigned i; + uint i; for (i = 0; i < iVSize; i += 3) { vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]); } - unsigned *mapVertex = new unsigned[iVSize]; + uint *mapVertex = new uint[iVSize]; vector::iterator v = vertices.begin(); vector compressedVertices; @@ -123,7 +123,7 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, } // Map the index array: - *oIndices = new unsigned[iISize]; + *oIndices = new uint[iISize]; for (i = 0; i < iISize; i++) { (*oIndices)[i] = 3 * mapVertex[iIndices[i] / 3]; } @@ -132,16 +132,16 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, } void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned *oVSize, - unsigned **oIndices) + uint *oVSize, + uint **oIndices) { // tmp arrays used to store the sorted data: float *tmpVertices; - unsigned *tmpIndices; + uint *tmpIndices; Chronometer chrono; // Sort data @@ -181,26 +181,26 @@ struct GeomCleanerHasher { }; void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned *oVSize, - unsigned **oIndices) + uint *oVSize, + uint **oIndices) { - using cleanHashTable = map; + using cleanHashTable = map; vector vertices; - unsigned i; + uint i; for (i = 0; i < iVSize; i += 3) { vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]); } cleanHashTable ht; - vector newIndices; + vector newIndices; vector newVertices; // elimination of needless points - unsigned currentIndex = 0; + uint currentIndex = 0; vector::const_iterator v = vertices.begin(); vector::const_iterator end = vertices.end(); cleanHashTable::const_iterator found; @@ -230,7 +230,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, } // map new indices: - *oIndices = new unsigned[iISize]; + *oIndices = new uint[iISize]; for (i = 0; i < iISize; i++) { (*oIndices)[i] = 3 * newIndices[iIndices[i] / 3]; } diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp index 742d5f2fd02..f1e4297ab5e 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp +++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp @@ -10,7 +10,7 @@ namespace Freestyle::GeomUtils { // This internal procedure is defined below. -bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n); +bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, uint n); bool intersect2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B) { @@ -739,7 +739,7 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] #define PERP(u, v) ((u)[0] * (v)[1] - (u)[1] * (v)[0]) // 2D perp product -inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n) +inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, uint n) { if (seg[0] == seg[1]) { return false; diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index ad45ab4eb42..e0e3af0fe47 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -93,7 +93,7 @@ void Grid::clear() //_ray_occluders.clear(); } -void Grid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) +void Grid::configure(const Vec3r &orig, const Vec3r &size, uint nb) { _orig = orig; Vec3r tmpSize = size; @@ -125,9 +125,9 @@ void Grid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) real edge = pow(cell_vol, 1.0 / 3.0); // We compute the number of cells par edge such as we cover at least the whole box. - unsigned i; + uint i; for (i = 0; i < 3; i++) { - _cells_nb[i] = (unsigned)floor(tmpSize[i] / edge) + 1; + _cells_nb[i] = uint(floor(tmpSize[i] / edge)) + 1; } _size = tmpSize; @@ -161,7 +161,7 @@ void Grid::insertOccluder(Polygon3r *occluder) // overlapping with the triangle in order to only fill in the ones really overlapping the // triangle. - unsigned i, x, y, z; + uint i, x, y, z; vector::const_iterator it; Vec3u coord; @@ -225,10 +225,10 @@ bool Grid::nextRayCell(Vec3u ¤t_cell, Vec3u &next_cell) { next_cell = current_cell; real t_min, t; - unsigned i; + uint i; - t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0. - unsigned coord = 0; // predominant coord(0=x, 1=y, 2=z) + t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0. + uint coord = 0; // predominant coord(0=x, 1=y, 2=z) // using a parametric equation of a line : B = A + t u, we find the tx, ty and tz respectively // corresponding to the intersections with the plans: @@ -280,10 +280,7 @@ bool Grid::nextRayCell(Vec3u ¤t_cell, Vec3u &next_cell) return true; } -void Grid::castRay(const Vec3r &orig, - const Vec3r &end, - OccludersSet &occluders, - unsigned timestamp) +void Grid::castRay(const Vec3r &orig, const Vec3r &end, OccludersSet &occluders, uint timestamp) { initRay(orig, end, timestamp); allOccludersGridVisitor visitor(occluders); @@ -293,7 +290,7 @@ void Grid::castRay(const Vec3r &orig, void Grid::castInfiniteRay(const Vec3r &orig, const Vec3r &dir, OccludersSet &occluders, - unsigned timestamp) + uint timestamp) { Vec3r end = Vec3r(orig + FLT_MAX * dir / dir.norm()); bool inter = initInfiniteRay(orig, dir, timestamp); @@ -305,7 +302,7 @@ void Grid::castInfiniteRay(const Vec3r &orig, } Polygon3r *Grid::castRayToFindFirstIntersection( - const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, unsigned timestamp) + const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, uint timestamp) { Polygon3r *occluder = nullptr; Vec3r end = Vec3r(orig + FLT_MAX * dir / dir.norm()); @@ -325,7 +322,7 @@ Polygon3r *Grid::castRayToFindFirstIntersection( return occluder; } -void Grid::initRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp) +void Grid::initRay(const Vec3r &orig, const Vec3r &end, uint timestamp) { _ray_dir = end - orig; _t_end = _ray_dir.norm(); @@ -333,15 +330,15 @@ void Grid::initRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp) _ray_dir.normalize(); _timestamp = timestamp; - for (unsigned i = 0; i < 3; i++) { - _current_cell[i] = (unsigned)floor((orig[i] - _orig[i]) / _cell_size[i]); + for (uint i = 0; i < 3; i++) { + _current_cell[i] = uint(floor((orig[i] - _orig[i]) / _cell_size[i])); // soc unused - unsigned u = _current_cell[i]; _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i]; } //_ray_occluders.clear(); } -bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timestamp) +bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, uint timestamp) { _ray_dir = dir; _t_end = FLT_MAX; @@ -367,7 +364,7 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta BLI_assert(tmin != -1.0); Vec3r newOrig = orig + tmin * _ray_dir; for (uint i = 0; i < 3; i++) { - _current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]); + _current_cell[i] = uint(floor((newOrig[i] - _orig[i]) / _cell_size[i])); if (_current_cell[i] == _cells_nb[i]) { _current_cell[i] = _cells_nb[i] - 1; } diff --git a/source/blender/freestyle/intern/geometry/HashGrid.cpp b/source/blender/freestyle/intern/geometry/HashGrid.cpp index c86aa4fd22c..51c87757645 100644 --- a/source/blender/freestyle/intern/geometry/HashGrid.cpp +++ b/source/blender/freestyle/intern/geometry/HashGrid.cpp @@ -22,7 +22,7 @@ void HashGrid::clear() Grid::clear(); } -void HashGrid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) +void HashGrid::configure(const Vec3r &orig, const Vec3r &size, uint nb) { Grid::configure(orig, size, nb); } diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp index 95a742e9d0d..306913e6297 100644 --- a/source/blender/freestyle/intern/geometry/Noise.cpp +++ b/source/blender/freestyle/intern/geometry/Noise.cpp @@ -69,7 +69,7 @@ static void normalize3(float v[3]) v[2] = v[2] / s; } -float Noise::turbulence1(float arg, float freq, float amp, unsigned oct) +float Noise::turbulence1(float arg, float freq, float amp, uint oct) { float t; float vec; @@ -81,7 +81,7 @@ float Noise::turbulence1(float arg, float freq, float amp, unsigned oct) return t; } -float Noise::turbulence2(Vec2f &v, float freq, float amp, unsigned oct) +float Noise::turbulence2(Vec2f &v, float freq, float amp, uint oct) { float t; Vec2f vec; @@ -94,7 +94,7 @@ float Noise::turbulence2(Vec2f &v, float freq, float amp, unsigned oct) return t; } -float Noise::turbulence3(Vec3f &v, float freq, float amp, unsigned oct) +float Noise::turbulence3(Vec3f &v, float freq, float amp, uint oct) { float t; Vec3f vec; diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp index d1a41fc82db..95afa4dda48 100644 --- a/source/blender/freestyle/intern/image/ImagePyramid.cpp +++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp @@ -109,13 +109,13 @@ int ImagePyramid::height(int level) return _levels[level]->height(); } -GaussianPyramid::GaussianPyramid(const GrayImage &level0, unsigned nbLevels, float iSigma) +GaussianPyramid::GaussianPyramid(const GrayImage &level0, uint nbLevels, float iSigma) { _sigma = iSigma; BuildPyramid(level0, nbLevels); } -GaussianPyramid::GaussianPyramid(GrayImage *level0, unsigned nbLevels, float iSigma) +GaussianPyramid::GaussianPyramid(GrayImage *level0, uint nbLevels, float iSigma) { _sigma = iSigma; BuildPyramid(level0, nbLevels); @@ -126,20 +126,20 @@ GaussianPyramid::GaussianPyramid(const GaussianPyramid &iBrother) : ImagePyramid _sigma = iBrother._sigma; } -void GaussianPyramid::BuildPyramid(const GrayImage &level0, unsigned nbLevels) +void GaussianPyramid::BuildPyramid(const GrayImage &level0, uint nbLevels) { GrayImage *pLevel = new GrayImage(level0); BuildPyramid(pLevel, nbLevels); } -void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) +void GaussianPyramid::BuildPyramid(GrayImage *level0, uint nbLevels) { GrayImage *pLevel = level0; _levels.push_back(pLevel); GaussianFilter gf(_sigma); // build the nbLevels: - unsigned w = pLevel->width(); - unsigned h = pLevel->height(); + uint w = pLevel->width(); + uint h = pLevel->height(); if (nbLevels != 0) { for (uint i = 0; i < nbLevels; ++i) { // soc w = pLevel->width() >> 1; diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index 16b08722fb2..114fafea55b 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -98,7 +98,7 @@ static PyObject *ContextFunctions_load_map(PyObject * /*self*/, PyObject *args, { static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", nullptr}; char *fileName, *mapName; - unsigned nbLevels = 4; + uint nbLevels = 4; float sigma = 1.0; if (!PyArg_ParseTupleAndKeywords( @@ -135,7 +135,7 @@ static PyObject *ContextFunctions_read_map_pixel(PyObject * /*self*/, static const char *kwlist[] = {"map_name", "level", "x", "y", nullptr}; char *mapName; int level; - unsigned x, y; + uint x, y; if (!PyArg_ParseTupleAndKeywords( args, kwds, "siII", (char **)kwlist, &mapName, &level, &x, &y)) { @@ -167,7 +167,7 @@ static PyObject *ContextFunctions_read_complete_view_map_pixel(PyObject * /*self { static const char *kwlist[] = {"level", "x", "y", nullptr}; int level; - unsigned x, y; + uint x, y; if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y)) { return nullptr; @@ -201,7 +201,7 @@ static PyObject *ContextFunctions_read_directional_view_map_pixel(PyObject * /*s { static const char *kwlist[] = {"orientation", "level", "x", "y", nullptr}; int orientation, level; - unsigned x, y; + uint x, y; if (!PyArg_ParseTupleAndKeywords( args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y)) { diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 218749b2672..097fdb6a16b 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -109,7 +109,7 @@ static PyObject *FrsNoise_turbulence_smooth(BPy_FrsNoise *self, PyObject *args, static const char *kwlist[] = {"v", "oct", nullptr}; double x; // NOTE: this has to be a double (not float) - unsigned nbOctaves = 8; + uint nbOctaves = 8; if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|I", (char **)kwlist, &x, &nbOctaves)) { return nullptr; diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index 752b498a302..ad54787ad05 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -254,7 +254,7 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0D ((UnaryFunction0D *)uf0D)->result = *(((BPy_FrsMaterial *)result)->m); } else if (BPy_UnaryFunction0DUnsigned_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = PyLong_AsLong(result); + ((UnaryFunction0D *)uf0D)->result = PyLong_AsLong(result); } else if (BPy_UnaryFunction0DVec2f_Check(obj)) { Vec2f vec; @@ -312,7 +312,7 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D ((UnaryFunction1D *)uf1D)->result = PyFloat_AsDouble(result); } else if (BPy_UnaryFunction1DUnsigned_Check(obj)) { - ((UnaryFunction1D *)uf1D)->result = PyLong_AsLong(result); + ((UnaryFunction1D *)uf1D)->result = PyLong_AsLong(result); } else if (BPy_UnaryFunction1DVec2f_Check(obj)) { Vec2f vec; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index 2f22e435017..ecf95e189d8 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -42,7 +42,7 @@ static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1 PyObject *kwds) { static const char *kwlist[] = {"ts", nullptr}; - unsigned u; + uint u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) { return -1; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index dd7a3f3baa3..b75e45cb132 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -41,7 +41,7 @@ static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, PyObject *kwds) { static const char *kwlist[] = {"ts", nullptr}; - unsigned u; + uint u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) { return -1; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index 773e6c8dfb2..ad8aba9eb29 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -42,7 +42,7 @@ static char ShapeUP1D___doc__[] = static int ShapeUP1D___init__(BPy_ShapeUP1D *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"first", "second", nullptr}; - unsigned u1, u2 = 0; + uint u1, u2 = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2)) { return -1; diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index c3559fe6e15..3962ac0aa35 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -34,26 +34,26 @@ IndexedFaceSet::IndexedFaceSet() } IndexedFaceSet::IndexedFaceSet(float *iVertices, - unsigned iVSize, + uint iVSize, float *iNormals, - unsigned iNSize, + uint iNSize, FrsMaterial **iMaterials, - unsigned iMSize, + uint iMSize, float *iTexCoords, - unsigned iTSize, - unsigned iNumFaces, - unsigned *iNumVertexPerFace, + uint iTSize, + uint iNumFaces, + uint *iNumVertexPerFace, TRIANGLES_STYLE *iFaceStyle, FaceEdgeMark *iFaceEdgeMarks, - unsigned *iVIndices, - unsigned iVISize, - unsigned *iNIndices, - unsigned iNISize, - unsigned *iMIndices, - unsigned iMISize, - unsigned *iTIndices, - unsigned iTISize, - unsigned iCopy) + uint *iVIndices, + uint iVISize, + uint *iNIndices, + uint iNISize, + uint *iMIndices, + uint iMISize, + uint *iTIndices, + uint iTISize, + uint iCopy) { if (1 == iCopy) { _VSize = iVSize; @@ -80,8 +80,8 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, } _NumFaces = iNumFaces; - _NumVertexPerFace = new unsigned[_NumFaces]; - memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(unsigned)); + _NumVertexPerFace = new uint[_NumFaces]; + memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(uint)); _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iFaceStyle, _NumFaces * sizeof(TRIANGLES_STYLE)); @@ -90,24 +90,24 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, memcpy(_FaceEdgeMarks, iFaceEdgeMarks, _NumFaces * sizeof(FaceEdgeMark)); _VISize = iVISize; - _VIndices = new unsigned[_VISize]; - memcpy(_VIndices, iVIndices, _VISize * sizeof(unsigned)); + _VIndices = new uint[_VISize]; + memcpy(_VIndices, iVIndices, _VISize * sizeof(uint)); _NISize = iNISize; - _NIndices = new unsigned[_NISize]; - memcpy(_NIndices, iNIndices, _NISize * sizeof(unsigned)); + _NIndices = new uint[_NISize]; + memcpy(_NIndices, iNIndices, _NISize * sizeof(uint)); _MISize = iMISize; _MIndices = nullptr; if (iMIndices) { - _MIndices = new unsigned[_MISize]; - memcpy(_MIndices, iMIndices, _MISize * sizeof(unsigned)); + _MIndices = new uint[_MISize]; + memcpy(_MIndices, iMIndices, _MISize * sizeof(uint)); } _TISize = iTISize; _TIndices = nullptr; if (_TISize) { - _TIndices = new unsigned[_TISize]; - memcpy(_TIndices, iTIndices, _TISize * sizeof(unsigned)); + _TIndices = new uint[_TISize]; + memcpy(_TIndices, iTIndices, _TISize * sizeof(uint)); } } else { @@ -177,8 +177,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) } _NumFaces = iBrother.numFaces(); - _NumVertexPerFace = new unsigned[_NumFaces]; - memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(unsigned)); + _NumVertexPerFace = new uint[_NumFaces]; + memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(uint)); _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iBrother.trianglesStyle(), _NumFaces * sizeof(TRIANGLES_STYLE)); @@ -187,17 +187,17 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) memcpy(_FaceEdgeMarks, iBrother.faceEdgeMarks(), _NumFaces * sizeof(FaceEdgeMark)); _VISize = iBrother.visize(); - _VIndices = new unsigned[_VISize]; - memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(unsigned)); + _VIndices = new uint[_VISize]; + memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(uint)); _NISize = iBrother.nisize(); - _NIndices = new unsigned[_NISize]; - memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(unsigned)); + _NIndices = new uint[_NISize]; + memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(uint)); _MISize = iBrother.misize(); if (_MISize) { - _MIndices = new unsigned[_MISize]; - memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(unsigned)); + _MIndices = new uint[_MISize]; + memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(uint)); } else { _MIndices = nullptr; @@ -206,8 +206,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _TISize = iBrother.tisize(); _TIndices = nullptr; if (_TISize) { - _TIndices = new unsigned[_TISize]; - memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned)); + _TIndices = new uint[_TISize]; + memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(uint)); } } diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index 3e6c8f924a1..a4ef70722d0 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -42,9 +42,9 @@ void SceneHash::visitNodeCamera(NodeCamera &cam) void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs) { const float *v = ifs.vertices(); - const unsigned n = ifs.vsize(); + const uint n = ifs.vsize(); - for (unsigned i = 0; i < n; i++) { + for (uint i = 0; i < n; i++) { adler32((uchar *)&v[i], sizeof(v[i])); } } diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp index 5ac41b6f234..6c5ea5ffd8a 100644 --- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp +++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp @@ -73,7 +73,7 @@ VISIT(VertexRep) void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs) { const float *vertices = ifs.vertices(); - unsigned vsize = ifs.vsize(); + uint vsize = ifs.vsize(); _ofs << _space << "IndexedFaceSet" << endl; const float *p = vertices; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index d12aab45215..79825b626d5 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -19,7 +19,7 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) Interface0DIterator itnext = it; ++itnext; FEdge *fe; - unsigned nSVM; + uint nSVM; vector values; while (!itnext.isEnd()) { @@ -45,7 +45,7 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) float res, res_tmp; vector::iterator v = values.begin(), vend = values.end(); - unsigned size = 1; + uint size = 1; switch (_integration) { case MIN: res = *v; diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index 5530026b7ec..4ff00dd0a08 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -71,7 +71,7 @@ int CalligraphicShader::shade(Stroke &ioStroke) const // ///////////////////////////////////////// -static const unsigned NB_VALUE_NOISE = 512; +static const uint NB_VALUE_NOISE = 512; SpatialNoiseShader::SpatialNoiseShader( float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom) diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index dd0239322ab..3a6946d1668 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -152,7 +152,7 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const return 0; } -static const unsigned NB_VALUE_NOISE = 512; +static const uint NB_VALUE_NOISE = 512; ThicknessNoiseShader::ThicknessNoiseShader() { diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 46620bbcac2..82772ebb3a7 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -169,9 +169,9 @@ void Canvas::PushBackStyleModule(StyleModule *iStyleModule) _Layers.push_back(layer); } -void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) +void Canvas::InsertStyleModule(uint index, StyleModule *iStyleModule) { - unsigned size = _StyleModules.size(); + uint size = _StyleModules.size(); StrokeLayer *layer = new StrokeLayer(); if ((_StyleModules.empty()) || (index == size)) { _StyleModules.push_back(iStyleModule); @@ -182,7 +182,7 @@ void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) _Layers.insert(_Layers.begin() + index, layer); } -void Canvas::RemoveStyleModule(unsigned index) +void Canvas::RemoveStyleModule(uint index) { uint i = 0; if (!_StyleModules.empty()) { @@ -216,7 +216,7 @@ void Canvas::RemoveStyleModule(unsigned index) } } -void Canvas::SwapStyleModules(unsigned i1, unsigned i2) +void Canvas::SwapStyleModules(uint i1, uint i2) { StyleModule *tmp; tmp = _StyleModules[i1]; @@ -229,9 +229,9 @@ void Canvas::SwapStyleModules(unsigned i1, unsigned i2) _Layers[i2] = tmp2; } -void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule) +void Canvas::ReplaceStyleModule(uint index, StyleModule *iStyleModule) { - unsigned i = 0; + uint i = 0; for (deque::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; ++s, ++i) { @@ -245,12 +245,12 @@ void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule) } } -void Canvas::setVisible(unsigned index, bool iVisible) +void Canvas::setVisible(uint index, bool iVisible) { _StyleModules[index]->setDisplayed(iVisible); } -void Canvas::setModified(unsigned index, bool iMod) +void Canvas::setModified(uint index, bool iMod) { _StyleModules[index]->setModified(iMod); } @@ -263,7 +263,7 @@ void Canvas::resetModified(bool iMod /* = false */) } } -void Canvas::causalStyleModules(vector &vec, unsigned index) +void Canvas::causalStyleModules(vector &vec, uint index) { uint size = _StyleModules.size(); diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp index e50b5f0b242..879ea49b43a 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp @@ -14,17 +14,17 @@ namespace Freestyle::ContextFunctions { -unsigned GetTimeStampCF() +uint GetTimeStampCF() { return TimeStamp::instance()->getTimeStamp(); } -unsigned GetCanvasWidthCF() +uint GetCanvasWidthCF() { return Canvas::getInstance()->width(); } -unsigned GetCanvasHeightCF() +uint GetCanvasHeightCF() { return Canvas::getInstance()->height(); } @@ -34,24 +34,24 @@ BBox GetBorderCF() return Canvas::getInstance()->border(); } -void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma) +void LoadMapCF(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels, iSigma); } -float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y) +float ReadMapPixelCF(const char *iMapName, int level, uint x, uint y) { Canvas *canvas = Canvas::getInstance(); return canvas->readMapPixel(iMapName, level, x, y); } -float ReadCompleteViewMapPixelCF(int level, unsigned x, unsigned y) +float ReadCompleteViewMapPixelCF(int level, uint x, uint y) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); return svm->readCompleteViewMapPixel(level, x, y); } -float ReadDirectionalViewMapPixelCF(int iOrientation, int level, unsigned x, unsigned y) +float ReadDirectionalViewMapPixelCF(int iOrientation, int level, uint x, uint y) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); return svm->readSteerableViewMapPixel(iOrientation, level, x, y); diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index ee9fa33285f..b45e3218a13 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -73,7 +73,7 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, return 0; } - unsigned id = 0; + uint id = 0; ViewEdge *edge; I1DContainer new_chains_set; @@ -137,7 +137,7 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &p return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -318,7 +318,7 @@ int Operators::bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred) return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -421,7 +421,7 @@ int Operators::bidirectionalChain(ChainingIterator &it) return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -873,7 +873,7 @@ static int __recursiveSplit(Chain *_curve, ++it; // real mean = 0.0f; // soc unused - real variance = 0.0f; - unsigned count = 0; + uint count = 0; CurveInternal::CurvePointIterator next = it; ++next; diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp index 35ee41adbaf..30dacb7f7df 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp @@ -69,12 +69,12 @@ void TextureManager::load() _hasLoadedTextures = true; } -unsigned TextureManager::getBrushTextureIndex(string name, Stroke::MediumType iType) +uint TextureManager::getBrushTextureIndex(string name, Stroke::MediumType iType) { BrushTexture bt(name, iType); brushesMap::iterator b = _brushesMap.find(bt); if (b == _brushesMap.end()) { - unsigned texId = loadBrush(name, iType); + uint texId = loadBrush(name, iType); _brushesMap[bt] = texId; return texId; // XXX! diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index 9bb597a8a67..98115691f52 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -79,7 +79,7 @@ real PseudoNoise::smoothNoise(real x) return (x0 * y0 + x1 * y1 + x2 * y2 + x3 * y3) / (y0 + y1 + y2 + y3); } -real PseudoNoise::turbulenceSmooth(real x, unsigned nbOctave) +real PseudoNoise::turbulenceSmooth(real x, uint nbOctave) { real y = 0; real k = 1.0; @@ -90,7 +90,7 @@ real PseudoNoise::turbulenceSmooth(real x, unsigned nbOctave) return y; } -real PseudoNoise::turbulenceLinear(real x, unsigned nbOctave) +real PseudoNoise::turbulenceLinear(real x, uint nbOctave) { real y = 0; real k = 1.0; diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp index bb6970bc27a..21ae863723a 100644 --- a/source/blender/freestyle/intern/system/RandGen.cpp +++ b/source/blender/freestyle/intern/system/RandGen.cpp @@ -15,7 +15,7 @@ namespace Freestyle { /////////////////////////////////////////////////////////////////////////////// #define N 16 -#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1) +#define MASK (uint(1 << (N - 1)) + (1 << (N - 1)) - 1) #define X0 0x330E #define X1 0xABCD #define X2 0x1234 @@ -27,7 +27,7 @@ namespace Freestyle { # define HI_BIT (1L << (2 * N - 1)) #endif -#define LOW(x) ((unsigned)(x)&MASK) +#define LOW(x) (uint(x) & MASK) #define HIGH(x) LOW((x) >> N) #define MUL(x, y, z) \ @@ -70,17 +70,17 @@ namespace Freestyle { } #endif -static unsigned x[3] = { +static uint x[3] = { X0, X1, X2, }; -static unsigned a[3] = { +static uint a[3] = { A0, A1, A2, }; -static unsigned c = C; +static uint c = C; // // Methods implementation @@ -101,7 +101,7 @@ void RandGen::srand48(long seedval) void RandGen::next() { - unsigned p[2], q[2], r[2], carry0, carry1; + uint p[2], q[2], r[2], carry0, carry1; MUL(a[0], x[0], p); ADDEQU(p[0], c, carry0); diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index c4a96ce3305..79b2cea0446 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -17,13 +17,13 @@ void getPathName(const string &path, const string &base, vector &pathnam string dir; string res; char cleaned[FILE_MAX]; - unsigned size = path.size(); + uint size = path.size(); pathnames.push_back(base); for (uint pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) { - if (sep == (unsigned)string::npos) { + if (sep == uint(string::npos)) { sep = size; } diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp index ad2ebb737a5..7fa4f52506d 100644 --- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp @@ -13,7 +13,7 @@ namespace Freestyle { ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, const real proscenium[4], - unsigned numCells) + uint numCells) : GridDensityProvider(source), numCells(numCells) { initialize(proscenium); @@ -22,7 +22,7 @@ ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &sourc ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, const BBox &bbox, const GridHelpers::Transform &transform, - unsigned numCells) + uint numCells) : GridDensityProvider(source), numCells(numCells) { real proscenium[4]; @@ -31,8 +31,7 @@ ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &sourc initialize(proscenium); } -ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, - unsigned numCells) +ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, uint numCells) : GridDensityProvider(source), numCells(numCells) { real proscenium[4]; @@ -76,7 +75,7 @@ void ArbitraryGridDensityProvider::initialize(const real proscenium[4]) _cellOrigin[1] = ((proscenium[2] + proscenium[3]) / 2.0) - (_cellsY / 2.0) * _cellSize; } -ArbitraryGridDensityProviderFactory::ArbitraryGridDensityProviderFactory(unsigned numCells) +ArbitraryGridDensityProviderFactory::ArbitraryGridDensityProviderFactory(uint numCells) : numCells(numCells) { } diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp index 6b66ce17373..11ba5933ce0 100644 --- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp @@ -48,7 +48,7 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s float prosceniumHeight = (proscenium[3] - proscenium[2]); real cellArea = 0.0; - unsigned numFaces = 0; + uint numFaces = 0; for (source.begin(); source.isValid(); source.next()) { Polygon3r &poly(source.getGridSpacePolygon()); Vec3r min, max; @@ -66,7 +66,7 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s } _cellSize = sqrt(cellArea); - unsigned maxCells = 931; // * 1.1 = 1024 + uint maxCells = 931; // * 1.1 = 1024 if (std::max(prosceniumWidth, prosceniumHeight) / _cellSize > maxCells) { if (G.debug & G_DEBUG_FREESTYLE) { cout << "Scene-dependent cell size (" << _cellSize << " square) is too small." << endl; diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index 4c79d6c2fa1..36afb0119a2 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -186,10 +186,10 @@ void BoxGrid::reorganizeCells() } } -void BoxGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) +void BoxGrid::getCellCoordinates(const Vec3r &point, uint &x, uint &y) { - x = min(_cellsX - 1, (unsigned)floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize)); - y = min(_cellsY - 1, (unsigned)floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize)); + x = min(_cellsX - 1, uint(floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize))); + y = min(_cellsY - 1, uint(floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize))); } BoxGrid::Cell *BoxGrid::findCell(const Vec3r &point) diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index ffbb13e5df7..b94904d5efb 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -618,7 +618,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) // Compute the derivative value at each vertex of the face, and add it in a vector. vector kr_derivatives; - unsigned vertices_nb = iFace->numberOfVertices(); + uint vertices_nb = iFace->numberOfVertices(); WXVertex *v, *opposite_vertex_a, *opposite_vertex_b; WXFace *wxf; WOEdge *opposite_edge; diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index b77ccebe1f6..d05107dc264 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -202,7 +202,7 @@ int Curvature2DAngleF0D::operator()(Interface0DIterator &iter) { Interface0DIterator tmp1 = iter, tmp2 = iter; ++tmp2; - unsigned count = 1; + uint count = 1; while ((!tmp1.isBegin()) && (count < 3)) { --tmp1; ++count; diff --git a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp index f5a6a5ed5a9..7e4f673e2fb 100644 --- a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp +++ b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp @@ -10,7 +10,7 @@ namespace Freestyle { HeuristicGridDensityProviderFactory::HeuristicGridDensityProviderFactory(real sizeFactor, - unsigned numFaces) + uint numFaces) : sizeFactor(sizeFactor), numFaces(numFaces) { } diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp index 378b017b504..54c30661de9 100644 --- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp @@ -114,7 +114,7 @@ void OccluderSource::getOccluderProscenium(real proscenium[4]) real OccluderSource::averageOccluderArea() { real area = 0.0; - unsigned numFaces = 0; + uint numFaces = 0; for (begin(); isValid(); next()) { Vec3r min, max; cachedPolygon.getBBox(min, max); diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp index 0fde521d315..43809f83dc4 100644 --- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp @@ -13,7 +13,7 @@ namespace Freestyle { Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, const real proscenium[4], - unsigned numFaces) + uint numFaces) : GridDensityProvider(source), numFaces(numFaces) { initialize(proscenium); @@ -22,7 +22,7 @@ Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, const BBox &bbox, const GridHelpers::Transform &transform, - unsigned numFaces) + uint numFaces) : GridDensityProvider(source), numFaces(numFaces) { real proscenium[4]; @@ -31,7 +31,7 @@ Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, initialize(proscenium); } -Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, unsigned numFaces) +Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, uint numFaces) : GridDensityProvider(source), numFaces(numFaces) { real proscenium[4]; @@ -75,7 +75,7 @@ void Pow23GridDensityProvider::initialize(const real proscenium[4]) _cellOrigin[1] = ((proscenium[2] + proscenium[3]) / 2.0) - (_cellsY / 2.0) * _cellSize; } -Pow23GridDensityProviderFactory::Pow23GridDensityProviderFactory(unsigned numFaces) +Pow23GridDensityProviderFactory::Pow23GridDensityProviderFactory(uint numFaces) : numFaces(numFaces) { } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 5e27e344c28..6d800d13b3b 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -124,7 +124,7 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, ++f) { if ((*f)->isInImage()) { Vec3r point = SphericalGrid::Transform::sphericalProjection((*f)->center3d()); - unsigned i, j; + uint i, j; getCellCoordinates(point, i, j); if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell @@ -182,15 +182,15 @@ void SphericalGrid::reorganizeCells() } } -void SphericalGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) +void SphericalGrid::getCellCoordinates(const Vec3r &point, uint &x, uint &y) { - x = min(_cellsX - 1, (unsigned)floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize)); - y = min(_cellsY - 1, (unsigned)floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize)); + x = min(_cellsX - 1, uint(floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize))); + y = min(_cellsY - 1, uint(floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize))); } SphericalGrid::Cell *SphericalGrid::findCell(const Vec3r &point) { - unsigned x, y; + uint x, y; getCellCoordinates(point, x, y); return _cells[x * _cellsY + y]; } diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 0a05d469585..ba37dc434f4 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -91,7 +91,7 @@ void SteerableViewMap::Reset() Build(); } -double SteerableViewMap::ComputeWeight(const Vec2d &dir, unsigned i) +double SteerableViewMap::ComputeWeight(const Vec2d &dir, uint i) { double dotp = fabs(dir * _directions[i]); if (dotp < _bound) { @@ -106,8 +106,8 @@ double SteerableViewMap::ComputeWeight(const Vec2d &dir, unsigned i) double *SteerableViewMap::AddFEdge(FEdge *iFEdge) { - unsigned i; - unsigned id = iFEdge->getId().getFirst(); + uint i; + uint id = iFEdge->getId().getFirst(); map::iterator o = _mapping.find(id); if (o != _mapping.end()) { return (*o).second; @@ -131,7 +131,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) return res; } -unsigned SteerableViewMap::getSVMNumber(Vec2f dir) +uint SteerableViewMap::getSVMNumber(Vec2f dir) { // soc unsigned res = 0; real norm = dir.norm(); @@ -140,7 +140,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) } dir /= norm; double maxw = 0.0f; - unsigned winner = _nbOrientations + 1; + uint winner = _nbOrientations + 1; for (uint i = 0; i < _nbOrientations; ++i) { double w = ComputeWeight(dir, i); if (w > maxw) { @@ -151,14 +151,14 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) return winner; } -unsigned SteerableViewMap::getSVMNumber(unsigned id) +uint SteerableViewMap::getSVMNumber(uint id) { map::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; double maxw = 0.0; - unsigned winner = _nbOrientations + 1; - for (unsigned i = 0; i < _nbOrientations; ++i) { + uint winner = _nbOrientations + 1; + for (uint i = 0; i < _nbOrientations; ++i) { double w = wvalues[i]; if (w > maxw) { maxw = w; @@ -172,7 +172,7 @@ unsigned SteerableViewMap::getSVMNumber(unsigned id) void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, bool copy, - unsigned iNbLevels, + uint iNbLevels, float iSigma) { for (uint i = 0; i <= _nbOrientations; ++i) { @@ -188,7 +188,7 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, } } -float SteerableViewMap::readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y) +float SteerableViewMap::readSteerableViewMapPixel(uint iOrientation, int iLevel, int x, int y) { ImagePyramid *pyramid = _imagesPyramids[iOrientation]; if (!pyramid) { diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 798f01a9aa5..dfc5cd0af61 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -128,7 +128,7 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer) // bidirectional chaining. // first direction list facesChain; - unsigned size = 0; + uint size = 0; while (!stopSmoothViewEdge(currentFace.fl)) { facesChain.push_back(currentFace); ++size; @@ -210,7 +210,7 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge &iWEdge) ViewEdge *newVEdge = new ViewEdge; newVEdge->setId(_currentViewId); ++_currentViewId; - unsigned size = 0; + uint size = 0; _pCurrentVShape->AddEdge(newVEdge); @@ -685,7 +685,7 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe) // get the faces normals and the material indices Vec3r normalA, normalB; - unsigned matA(0), matB(0); + uint matA(0), matB(0); bool faceMarkA = false, faceMarkB = false; if (iwe.order) { normalB = (iwe.e->GetbFace()->GetNormal()); diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index d918cfec2ae..34eae2ab47e 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -73,7 +73,7 @@ void ViewMap::Clean() } } -ViewShape *ViewMap::viewShape(unsigned id) +ViewShape *ViewMap::viewShape(uint id) { int index = _shapeIdToIndex[id]; return _VShapes[index]; diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index d73d457713c..024a6a82b72 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -430,12 +430,12 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, int nSamples = 0; vector wFaces; WFace *wFace = nullptr; - unsigned count = 0; - unsigned count_step = (unsigned)ceil(0.01f * vedges.size()); - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; + uint count = 0; + uint count_step = uint(ceil(0.01f * vedges.size())); + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (iRenderMonitor) { if (iRenderMonitor->testBreak()) { @@ -582,7 +582,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, // ViewEdge // qi -- // Find the minimum value that is >= the majority of the QI - for (unsigned count = 0, i = 0; i < 256; ++i) { + for (uint count = 0, i = 0; i < 256; ++i) { count += qiClasses[i]; if (count >= qiMajority) { (*ve)->setQI(i); @@ -639,10 +639,10 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, int nSamples = 0; vector wFaces; WFace *wFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (iRenderMonitor && iRenderMonitor->testBreak()) { break; @@ -816,13 +816,13 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) vector &vedges = ioViewMap->ViewEdges(); FEdge *fe, *festart; - unsigned nSamples = 0; + uint nSamples = 0; vector wFaces; WFace *wFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; bool even_test; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { // Find an edge to test @@ -950,7 +950,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) vector &vedges = ioViewMap->ViewEdges(); FEdge *fe; - unsigned qi = 0; + uint qi = 0; WFace *wFace = nullptr; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { @@ -1531,19 +1531,19 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, } } -static const unsigned gProgressBarMaxSteps = 10; -static const unsigned gProgressBarMinSize = 2000; +static const uint gProgressBarMaxSteps = 10; +static const uint gProgressBarMinSize = 2000; void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilon) { vector &vedges = ioViewMap->ViewEdges(); bool progressBarDisplay = false; - unsigned progressBarStep = 0; - unsigned vEdgesSize = vedges.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint progressBarStep = 0; + uint vEdgesSize = vedges.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Ray casting Visibility"); @@ -1552,16 +1552,16 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; FEdge *fe, *festart; int nSamples = 0; vector aFaces; Polygon3r *aFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; - static unsigned timestamp = 1; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; + static uint timestamp = 1; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; @@ -1695,12 +1695,12 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep { vector &vedges = ioViewMap->ViewEdges(); bool progressBarDisplay = false; - unsigned progressBarStep = 0; - unsigned vEdgesSize = vedges.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint progressBarStep = 0; + uint vEdgesSize = vedges.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Ray casting Visibility"); @@ -1709,16 +1709,16 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; FEdge *fe, *festart; - unsigned nSamples = 0; + uint nSamples = 0; vector aFaces; Polygon3r *aFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; - static unsigned timestamp = 1; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; + static uint timestamp = 1; bool even_test; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { @@ -1828,12 +1828,12 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea { vector &vedges = ioViewMap->ViewEdges(); bool progressBarDisplay = false; - unsigned progressBarStep = 0; - unsigned vEdgesSize = vedges.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint progressBarStep = 0; + uint vEdgesSize = vedges.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Ray casting Visibility"); @@ -1842,11 +1842,11 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; FEdge *fe; - unsigned qi = 0; + uint qi = 0; Polygon3r *aFace = nullptr; - static unsigned timestamp = 1; + static uint timestamp = 1; for (vector::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; @@ -1882,7 +1882,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, - unsigned timestamp, + uint timestamp, Vec3r &u, Vec3r &A, Vec3r &origin, @@ -1986,7 +1986,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, } void ViewMapBuilder::FindOccludee( - FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, unsigned timestamp) + FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, uint timestamp) { OccludersSet occluders; @@ -2030,7 +2030,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, real epsilon, set &oOccluders, Polygon3r **oaPolygon, - unsigned timestamp) + uint timestamp) { OccludersSet occluders; int qi = 0; @@ -2326,8 +2326,8 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi { vector &svertices = ioViewMap->SVertices(); bool progressBarDisplay = false; - unsigned sVerticesSize = svertices.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint sVerticesSize = svertices.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); #if 0 if (_global.debug & G_DEBUG_FREESTYLE) { ViewMap::fedges_container &fedges = ioViewMap->FEdges(); @@ -2338,10 +2338,10 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi } } #endif - unsigned progressBarStep = 0; + uint progressBarStep = 0; if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, sVerticesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, sVerticesSize); progressBarStep = sVerticesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Sweep Line Intersections"); @@ -2350,7 +2350,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; sort(svertices.begin(), svertices.end(), less_SVertex2D(epsilon)); @@ -2500,8 +2500,8 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi progressBarStep = 0; if (progressBarDisplay) { - unsigned iEdgesSize = iedges.size(); - unsigned progressBarSteps = min(gProgressBarMaxSteps, iEdgesSize); + uint iEdgesSize = iedges.size(); + uint progressBarSteps = min(gProgressBarMaxSteps, iEdgesSize); progressBarStep = iEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Splitting intersected edges"); diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index 8af34d5e0ac..33f72cc0c9f 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -451,7 +451,7 @@ WShape *WFace::getShape() * * **********************************/ -unsigned WShape::_SceneCurrentId = 0; +uint WShape::_SceneCurrentId = 0; WShape *WShape::duplicate() { @@ -585,7 +585,7 @@ WShape::WShape(WShape &iBrother) WFace *WShape::MakeFace(vector &iVertexList, vector &iFaceEdgeMarksList, - unsigned iMaterial) + uint iMaterial) { // allocate the new face WFace *face = instanciateFace(); @@ -601,7 +601,7 @@ WFace *WShape::MakeFace(vector &iVertexList, vector &iNormalsList, vector &iTexCoordsList, vector &iFaceEdgeMarksList, - unsigned iMaterial) + uint iMaterial) { // allocate the new face WFace *face = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial); @@ -620,7 +620,7 @@ WFace *WShape::MakeFace(vector &iVertexList, WFace *WShape::MakeFace(vector &iVertexList, vector &iFaceEdgeMarksList, - unsigned iMaterial, + uint iMaterial, WFace *face) { int id = _FaceList.size(); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index f04c6e3f2be..2c107a01d13 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -64,7 +64,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() bool ok = false; vector cuspEdgesIndices; int indexStart, indexEnd; - unsigned nedges = _pWXFace->numberOfEdges(); + uint nedges = _pWXFace->numberOfEdges(); if (_nNullDotP == nedges) { _pSmoothEdge = nullptr; return _pSmoothEdge; @@ -118,8 +118,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() _pSmoothEdge = nullptr; return nullptr; } - unsigned index0 = Get0VertexIndex(); // retrieve the 0 vertex index - unsigned nedges = _pWXFace->numberOfEdges(); + uint index0 = Get0VertexIndex(); // retrieve the 0 vertex index + uint nedges = _pWXFace->numberOfEdges(); if (_DotP[cuspEdgesIndices[0]] > 0.0f) { woea = _pWXFace->GetOEdge(cuspEdgesIndices[0]); woeb = _pWXFace->GetOEdge(index0); @@ -257,7 +257,7 @@ void WXFace::ComputeCenter() WFace *WXShape::MakeFace(vector &iVertexList, vector &iFaceEdgeMarksList, - unsigned iMaterialIndex) + uint iMaterialIndex) { WFace *face = WShape::MakeFace(iVertexList, iFaceEdgeMarksList, iMaterialIndex); if (!face) { @@ -280,7 +280,7 @@ WFace *WXShape::MakeFace(vector &iVertexList, vector &iNormalsList, vector &iTexCoordsList, vector &iFaceEdgeMarksList, - unsigned iMaterialIndex) + uint iMaterialIndex) { WFace *face = WShape::MakeFace( iVertexList, iNormalsList, iTexCoordsList, iFaceEdgeMarksList, iMaterialIndex); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp index b1daedb0cd0..929e9b7e4dd 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp @@ -27,7 +27,7 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) // ifs.setId(shape->GetId()); } -void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) +void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, uint vsize) { WXVertex *vertex; for (uint i = 0; i < vsize; i += 3) { diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index d1389ac17c1..bb6ff066d03 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -94,7 +94,7 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) vector frs_materials; if (ifs.msize()) { const FrsMaterial *const *mats = ifs.frs_materials(); - for (unsigned i = 0; i < ifs.msize(); ++i) { + for (uint i = 0; i < ifs.msize(); ++i) { frs_materials.push_back(*(mats[i])); } shape.setFrsMaterials(frs_materials); @@ -228,7 +228,7 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) return true; } -void WingedEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) +void WingedEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, uint vsize) { WVertex *vertex; for (uint i = 0; i < vsize; i += 3) { @@ -243,15 +243,15 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/, vector & /*iMaterials*/, const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices) + const uint *vindices, + const uint *nindices, + const uint *mindices, + const uint *tindices, + const uint nvertices) { - unsigned nDoneVertices = 2; // number of vertices already treated - unsigned nTriangle = 0; // number of the triangle currently being treated - // int nVertex = 0; // vertex number + uint nDoneVertices = 2; /* Number of vertices already treated. */ + uint nTriangle = 0; /* Number of the triangle currently being treated. */ + // int nVertex = 0; /* Vertex number. */ WShape *currentShape = _current_wshape; // the current shape being built vector triangleVertices; @@ -340,11 +340,11 @@ void WingedEdgeBuilder::buildTriangleFan(const float * /*vertices*/, vector & /*iMaterials*/, const float * /*texCoords*/, const IndexedFaceSet::FaceEdgeMark * /*iFaceEdgeMarks*/, - const unsigned * /*vindices*/, - const unsigned * /*nindices*/, - const unsigned * /*mindices*/, - const unsigned * /*tindices*/, - const unsigned /*nvertices*/) + const uint * /*vindices*/, + const uint * /*nindices*/, + const uint * /*mindices*/, + const uint * /*tindices*/, + const uint /*nvertices*/) { // Nothing to be done } @@ -354,11 +354,11 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, vector & /*iMaterials*/, const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices) + const uint *vindices, + const uint *nindices, + const uint *mindices, + const uint *tindices, + const uint nvertices) { WShape *currentShape = _current_wshape; // the current shape begin built vector triangleVertices; @@ -405,7 +405,7 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, } void WingedEdgeBuilder::transformVertices(const float *vertices, - unsigned vsize, + uint vsize, const Matrix44r &transform, float *res) { @@ -424,7 +424,7 @@ void WingedEdgeBuilder::transformVertices(const float *vertices, } void WingedEdgeBuilder::transformNormals(const float *normals, - unsigned nsize, + uint nsize, const Matrix44r &transform, float *res) { -- cgit v1.2.3