mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Modernize various files (src/m*) (#6267)
* Modernize various files (src/m*) * range-based for loops * code style * C++ headers instead of C headers * Default operators * empty function Thanks to clang-tidy
This commit is contained in:
parent
fb196be8cf
commit
c427533389
34 changed files with 254 additions and 355 deletions
37
src/mesh.cpp
37
src/mesh.cpp
|
@ -453,11 +453,7 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
|
|||
|
||||
video::SColor c(255,255,255,255);
|
||||
|
||||
for (std::vector<aabb3f>::const_iterator
|
||||
i = boxes.begin();
|
||||
i != boxes.end(); ++i)
|
||||
{
|
||||
aabb3f box = *i;
|
||||
for (aabb3f box : boxes) {
|
||||
box.repair();
|
||||
|
||||
box.MinEdge.X -= expand;
|
||||
|
@ -614,9 +610,8 @@ class f_lru
|
|||
public:
|
||||
f_lru(vcache *v, tcache *t): vc(v), tc(t)
|
||||
{
|
||||
for (u16 i = 0; i < cachesize; i++)
|
||||
{
|
||||
cache[i] = -1;
|
||||
for (int &i : cache) {
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,15 +666,14 @@ public:
|
|||
}
|
||||
|
||||
// Update triangle scores
|
||||
for (u16 i = 0; i < cachesize; i++)
|
||||
{
|
||||
if (cache[i] == -1)
|
||||
for (int i : cache) {
|
||||
if (i == -1)
|
||||
break;
|
||||
|
||||
const u16 trisize = vc[cache[i]].tris.size();
|
||||
const u16 trisize = vc[i].tris.size();
|
||||
for (u16 t = 0; t < trisize; t++)
|
||||
{
|
||||
tcache *tri = &tc[vc[cache[i]].tris[t]];
|
||||
tcache *tri = &tc[vc[i].tris[t]];
|
||||
|
||||
tri->score =
|
||||
vc[tri->ind[0]].score +
|
||||
|
@ -689,7 +683,7 @@ public:
|
|||
if (tri->score > hiscore)
|
||||
{
|
||||
hiscore = tri->score;
|
||||
highest = vc[cache[i]].tris[t];
|
||||
highest = vc[i].tris[t];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -876,9 +870,8 @@ scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh)
|
|||
|
||||
tc[highest].drawn = true;
|
||||
|
||||
for (u16 j = 0; j < 3; j++)
|
||||
{
|
||||
vcache *vert = &vc[tc[highest].ind[j]];
|
||||
for (u16 j : tc[highest].ind) {
|
||||
vcache *vert = &vc[j];
|
||||
for (u16 t = 0; t < vert->tris.size(); t++)
|
||||
{
|
||||
if (highest == vert->tris[t])
|
||||
|
@ -988,9 +981,8 @@ scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh)
|
|||
|
||||
tc[highest].drawn = true;
|
||||
|
||||
for (u16 j = 0; j < 3; j++)
|
||||
{
|
||||
vcache *vert = &vc[tc[highest].ind[j]];
|
||||
for (u16 j : tc[highest].ind) {
|
||||
vcache *vert = &vc[j];
|
||||
for (u16 t = 0; t < vert->tris.size(); t++)
|
||||
{
|
||||
if (highest == vert->tris[t])
|
||||
|
@ -1101,9 +1093,8 @@ scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh)
|
|||
|
||||
tc[highest].drawn = true;
|
||||
|
||||
for (u16 j = 0; j < 3; j++)
|
||||
{
|
||||
vcache *vert = &vc[tc[highest].ind[j]];
|
||||
for (u16 j : tc[highest].ind) {
|
||||
vcache *vert = &vc[j];
|
||||
for (u16 t = 0; t < vert->tris.size(); t++)
|
||||
{
|
||||
if (highest == vert->tris[t])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue