diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:41:43 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 21:57:34 +0200 |
commit | 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch) | |
tree | 198d4ff7665d89307f6ca2469fa38620a9eb1672 /modules/gdnavigation/navigation_mesh_generator.cpp | |
parent | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff) | |
download | redot-engine-0ee0fa42e6639b6fa474b7cf6afc6b1a78142185.tar.gz |
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'modules/gdnavigation/navigation_mesh_generator.cpp')
-rw-r--r-- | modules/gdnavigation/navigation_mesh_generator.cpp | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp index 78818fd990..7dc08fbf29 100644 --- a/modules/gdnavigation/navigation_mesh_generator.cpp +++ b/modules/gdnavigation/navigation_mesh_generator.cpp @@ -74,8 +74,9 @@ void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform for (int i = 0; i < p_mesh->get_surface_count(); i++) { current_vertex_count = p_verticies.size() / 3; - if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) + if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) { continue; + } int index_count = 0; if (p_mesh->surface_get_format(i) & Mesh::ARRAY_FORMAT_INDEX) { @@ -314,8 +315,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( rcContext ctx; #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Setting up Configuration..."), 1); + } #endif const float *verts = vertices.ptr(); @@ -351,14 +353,16 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( cfg.bmax[2] = bmax[2]; #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Calculating grid size..."), 2); + } #endif rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height); #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Creating heightfield..."), 3); + } #endif hf = rcAllocHeightfield(); @@ -366,8 +370,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( ERR_FAIL_COND(!rcCreateHeightfield(&ctx, *hf, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch)); #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Marking walkable triangles..."), 4); + } #endif { Vector<unsigned char> tri_areas; @@ -381,16 +386,20 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( ERR_FAIL_COND(!rcRasterizeTriangles(&ctx, verts, nverts, tris, tri_areas.ptr(), ntris, *hf, cfg.walkableClimb)); } - if (p_nav_mesh->get_filter_low_hanging_obstacles()) + if (p_nav_mesh->get_filter_low_hanging_obstacles()) { rcFilterLowHangingWalkableObstacles(&ctx, cfg.walkableClimb, *hf); - if (p_nav_mesh->get_filter_ledge_spans()) + } + if (p_nav_mesh->get_filter_ledge_spans()) { rcFilterLedgeSpans(&ctx, cfg.walkableHeight, cfg.walkableClimb, *hf); - if (p_nav_mesh->get_filter_walkable_low_height_spans()) + } + if (p_nav_mesh->get_filter_walkable_low_height_spans()) { rcFilterWalkableLowHeightSpans(&ctx, cfg.walkableHeight, *hf); + } #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Constructing compact heightfield..."), 5); + } #endif chf = rcAllocCompactHeightfield(); @@ -402,15 +411,17 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( hf = nullptr; #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Eroding walkable area..."), 6); + } #endif ERR_FAIL_COND(!rcErodeWalkableArea(&ctx, cfg.walkableRadius, *chf)); #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Partitioning..."), 7); + } #endif if (p_nav_mesh->get_sample_partition_type() == NavigationMesh::SAMPLE_PARTITION_WATERSHED) { @@ -423,8 +434,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( } #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Creating contours..."), 8); + } #endif cset = rcAllocContourSet(); @@ -433,8 +445,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( ERR_FAIL_COND(!rcBuildContours(&ctx, *chf, cfg.maxSimplificationError, cfg.maxEdgeLen, *cset)); #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Creating polymesh..."), 9); + } #endif poly_mesh = rcAllocPolyMesh(); @@ -451,8 +464,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh( cset = nullptr; #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Converting to native navigation mesh..."), 10); + } #endif _convert_detail_mesh_to_native_navigation_mesh(detail_mesh, p_nav_mesh); @@ -483,8 +497,9 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node) ep = memnew(EditorProgress("bake", TTR("Navigation Mesh Generator Setup:"), 11)); } - if (ep) + if (ep) { ep->step(TTR("Parsing Geometry..."), 0); + } #endif Vector<float> vertices; @@ -543,11 +558,13 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node) } #ifdef TOOLS_ENABLED - if (ep) + if (ep) { ep->step(TTR("Done!"), 11); + } - if (ep) + if (ep) { memdelete(ep); + } #endif } |