Renamed variables in Shadow

This commit is contained in:
korenkonder
2025-04-29 21:00:08 +03:00
parent d5d3595cc5
commit 29a4a0e682
5 changed files with 59 additions and 58 deletions
+41 -41
View File
@@ -98,7 +98,7 @@ void Shadow::reset() {
view_point[i] = 1.0f;
field_1C0[i] = 0.0f;
field_1C8[i] = 0.0f;
field_200[i] = i;
index[i] = i;
}
for (RenderTexture*& i : curr_render_textures)
@@ -125,7 +125,7 @@ void Shadow::reset() {
show_texture = false;
self_shadow = true;
separate = false;
field_208 = (z_far - z_near) * 0.5f;
z_half_range = (z_far - z_near) * 0.5f;
}
Shadow* shadow_ptr_get() {
@@ -147,33 +147,33 @@ void shadow_patch() {
static void sub_1405E60E0(Shadow* shad) {
for (int32_t i = 0; i < 2; i++) {
shad->field_1A8[i] = 0.0f;
shad->position[i] = 0.0f;
shad->field_1C8[i] = 0.0f;
if (!shad->shadow_enable[i] || !shad->field_1D0[i].size())
if (!shad->shadow_enable[i] || !shad->positions[i].size())
continue;
vec3 v7 = 0.0f;
for (vec3& j : shad->field_1D0[i])
v7 += j;
vec3 position = 0.0f;
for (vec3& j : shad->positions[i])
position += j;
float_t v14 = (float_t)(int64_t)shad->field_1D0[i].size();
float_t v14 = (float_t)(int64_t)shad->positions[i].size();
if (v14 < 0.0f)
v14 += (float_t)UINT64_MAX;
v7 *= 1.0f / v14;
position *= 1.0f / v14;
float_t v15 = 0.0f;
for (vec3& j : shad->field_1D0[i]) {
vec3 v22 = v7 - j;
for (vec3& j : shad->positions[i]) {
vec3 v22 = position - j;
vec3 v23 = vec3::dot(v22, shad->direction);
float_t v24 = vec3::distance(shad->direction * v23, v22);
v15 = max_def(v15, max_def(v24 - 0.25f, 0.0f));
}
shad->field_1A8[i] = v7;
shad->position[i] = position;
shad->field_1C8[i] = v15;
}
for (prj::vector<vec3>& i : shad->field_1D0)
for (prj::vector<vec3>& i : shad->positions)
i.clear();
}
@@ -187,12 +187,12 @@ static void sub_1405E63D0(Shadow* shad) {
if (!shad->shadow_enable[i])
continue;
const vec3 v11 = shad->field_1A8[i] - shad->direction * shad->field_208;
const vec3 v11 = shad->position[i] - shad->direction * shad->z_half_range;
const float_t v9 = vec3::distance(shad->view_point[i], v11);
const float_t v12 = vec3::distance(shad->interest[i], shad->field_1A8[i]);
const float_t v12 = vec3::distance(shad->interest[i], shad->position[i]);
if (v9 > 0.1f || v12 > 0.1f) {
shad->view_point[i] = v11;
shad->interest[i] = shad->field_1A8[i];
shad->interest[i] = shad->position[i];
}
view_point += shad->view_point[i];
@@ -207,9 +207,9 @@ static void sub_1405E6840(Shadow* shad) {
int32_t count = 0;
shad->num_shadow = 0;
for (int32_t i = 0; i < 2; i++) {
if (shad->shadow_enable[i] && shad->field_1D0[i].size()) {
if (shad->shadow_enable[i] && shad->positions[i].size()) {
++shad->num_shadow;
count += (int32_t)shad->field_1D0->size();
count += (int32_t)shad->positions->size();
}
else
shad->shadow_enable[i] = false;
@@ -228,14 +228,14 @@ static void sub_1405E6910(Shadow* shad) {
const float_t v2 = max_def(shad->field_1C8[0], shad->field_1C8[1]);
shad->separate = false;
shad->shadow_range = v2 + MIN_SHADOW_RANGE;
shad->field_200[0] = 0;
shad->field_200[1] = 1;
shad->index[0] = 0;
shad->index[1] = 1;
if (shad->num_shadow < 2)
return;
const vec3 v12 = shad->field_1A8[0] - shad->interest_shared;
const vec3 v14 = shad->field_1A8[1] - shad->interest_shared;
const vec3 v12 = shad->position[0] - shad->interest_shared;
const vec3 v14 = shad->position[1] - shad->interest_shared;
float_t v16 = vec3::distance((shad->direction * vec3::dot(v12, shad->direction)), v12);
v16 = max_def(v16 - 0.25f, 0.0f);
@@ -247,8 +247,8 @@ static void sub_1405E6910(Shadow* shad) {
shad->shadow_range = v2 + MIN_SHADOW_RANGE + v16;
if (vec3::dot(v12, shad->direction) < vec3::dot(v14, shad->direction)) {
shad->field_200[0] = 1;
shad->field_200[1] = 0;
shad->index[0] = 1;
shad->index[1] = 0;
}
}
@@ -267,29 +267,29 @@ static void sub_1405E6B70(Shadow* shad) {
}
for (int32_t i = 0; i < 2; i++) {
shad->field_1A8[i] = 0.0f;
shad->position[i] = 0.0f;
shad->field_1C8[i] = 0.0f;
if (!shad->shadow_enable[i] || !shad->field_1D0[i].size())
if (!shad->shadow_enable[i] || !shad->positions[i].size())
continue;
vec3 v22 = 0.0f;
for (vec3& j : shad->field_1D0[i])
for (vec3& j : shad->positions[i])
v22 += j;
float_t v29 = (float_t)(int64_t)shad->field_1D0[i].size();
float_t v29 = (float_t)(int64_t)shad->positions[i].size();
if (v29 < 0.0f)
v29 += (float_t)UINT64_MAX;
v22 *= 1.0f / v29;
float_t v30 = 0.0f;
for (vec3& j : shad->field_1D0[i]) {
for (vec3& j : shad->positions[i]) {
const vec3 v35 = v22 - j;
const float_t v39 = fabsf(vec3::dot(v35, v86));
const float_t v38 = fabsf(vec3::dot(v35, v3));
v30 = max_def(v30, max_def(v38, v39));
}
shad->field_1A8[i] = v22;
shad->position[i] = v22;
shad->field_1C8[i] = v30;
}
@@ -300,12 +300,12 @@ static void sub_1405E6B70(Shadow* shad) {
if (!shad->shadow_enable[i])
continue;
const vec3 v41 = shad->field_1A8[0] - shad->direction * shad->field_208;
const vec3 v41 = shad->position[0] - shad->direction * shad->z_half_range;
const float_t v42 = vec3::distance(shad->view_point[0], v41);
const float_t v45 = vec3::distance(shad->interest[0], shad->field_1A8[0]);
const float_t v45 = vec3::distance(shad->interest[0], shad->position[0]);
if (v42 > 0.1f || v45 > 0.1f) {
shad->view_point[0] = v41;
shad->interest[0] = shad->field_1A8[0];
shad->interest[0] = shad->position[0];
}
view_point += shad->view_point[i];
@@ -319,8 +319,8 @@ static void sub_1405E6B70(Shadow* shad) {
const float_t v67 = max_def(shad->field_1C8[0], shad->field_1C8[1]);
shad->separate = 0;
shad->shadow_range = v67 + MIN_SHADOW_RANGE;
shad->field_200[0] = 0;
shad->field_200[1] = 1;
shad->index[0] = 0;
shad->index[1] = 1;
if (shad->num_shadow >= 2) {
float_t v2 = 0.0f;
@@ -331,7 +331,7 @@ static void sub_1405E6B70(Shadow* shad) {
if (!shad->shadow_enable[i])
continue;
for (vec3& j : shad->field_1D0[i]) {
for (vec3& j : shad->positions[i]) {
const vec3 v74 = j - shad->interest_shared;
const float_t v77 = vec3::dot(v86, v74);
@@ -357,13 +357,13 @@ static void sub_1405E6B70(Shadow* shad) {
else
shad->shadow_range = v79 + MIN_SHADOW_RANGE;
if (vec3::dot(shad->field_1A8[0] - shad->interest_shared, shad->direction)
< vec3::dot(shad->field_1A8[1] - shad->interest_shared, shad->direction)) {
shad->field_200[1] = 0;
shad->field_200[0] = 1;
if (vec3::dot(shad->position[0] - shad->interest_shared, shad->direction)
< vec3::dot(shad->position[1] - shad->interest_shared, shad->direction)) {
shad->index[1] = 0;
shad->index[0] = 1;
}
}
for (prj::vector<vec3>& i : shad->field_1D0)
for (prj::vector<vec3>& i : shad->positions)
i.clear();
}