Skip to content

Commit

Permalink
Codestyle fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Relintai committed Jul 31, 2022
1 parent f5b3262 commit 9771f1a
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions modules/props/prop_instance_prop_job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ void PropInstancePropJob::clear_lights() {
}

void PropInstancePropJob::_physics_process(float delta) {
if (_phase == 0)
if (_phase == 0) {
phase_physics_process();
}
}

void PropInstancePropJob::_execute_phase() {
Expand Down Expand Up @@ -418,8 +419,9 @@ void PropInstancePropJob::phase_steps() {
for (int i = 0; i < count; ++i) {
RID mesh_rid = _prop_instace->mesh_get(i);

if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0)
if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
VS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
}
}
}
}
Expand Down Expand Up @@ -603,8 +605,9 @@ Array PropInstancePropJob::merge_mesh_array(Array arr) const {
for (int j = i + 1; j < verts.size(); ++j) {
Vector3 vc = verts[j];

if (Math::is_equal_approx(v.x, vc.x) && Math::is_equal_approx(v.y, vc.y) && Math::is_equal_approx(v.z, vc.z))
if (Math::is_equal_approx(v.x, vc.x) && Math::is_equal_approx(v.y, vc.y) && Math::is_equal_approx(v.z, vc.z)) {
equals.push_back(j);
}
}

for (int k = 0; k < equals.size(); ++k) {
Expand All @@ -613,20 +616,24 @@ Array PropInstancePropJob::merge_mesh_array(Array arr) const {

verts.remove(remk);

if (has_normals)
if (has_normals) {
normals.remove(remk);
if (has_uvs)
}
if (has_uvs) {
uvs.remove(remk);
if (has_colors)
}
if (has_colors) {
colors.remove(remk);
}

for (int j = 0; j < indices.size(); ++j) {
int indx = indices[j];

if (indx == remk)
if (indx == remk) {
indices.set(j, i);
else if (indx > remk)
} else if (indx > remk) {
indices.set(j, indx - 1);
}
}
}

Expand All @@ -635,12 +642,15 @@ Array PropInstancePropJob::merge_mesh_array(Array arr) const {

arr[VisualServer::ARRAY_VERTEX] = verts;

if (has_normals)
if (has_normals) {
arr[VisualServer::ARRAY_NORMAL] = normals;
if (has_uvs)
}
if (has_uvs) {
arr[VisualServer::ARRAY_TEX_UV] = uvs;
if (has_colors)
}
if (has_colors) {
arr[VisualServer::ARRAY_COLOR] = colors;
}

arr[VisualServer::ARRAY_INDEX] = indices;

Expand All @@ -659,8 +669,9 @@ Array PropInstancePropJob::bake_mesh_array_uv(Array arr, Ref<Texture> tex, const
PoolVector2Array uvs = arr[VisualServer::ARRAY_TEX_UV];
PoolColorArray colors = arr[VisualServer::ARRAY_COLOR];

if (colors.size() < uvs.size())
if (colors.size() < uvs.size()) {
colors.resize(uvs.size());
}

img->lock();

Expand Down Expand Up @@ -695,8 +706,9 @@ void PropInstancePropJob::reset_meshes() {
for (int i = 0; i < count; ++i) {
RID mesh_rid = _prop_instace->mesh_get(i);

if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0)
if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
VS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
}
}
}
}
Expand Down

0 comments on commit 9771f1a

Please sign in to comment.