diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:33:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 13:17:08 +0300 |
commit | f68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch) | |
tree | 2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/draw/engines/eevee_next | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/draw/engines/eevee_next')
6 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc index bc0891ceb92..e4c4f6f3f6f 100644 --- a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc +++ b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc @@ -637,8 +637,8 @@ void DepthOfField::render(View &view, /* Do not step over any unvisited tile. */ int max_multiplier = dilation_radius + 1; - int ring_count = min_ii(DOF_DILATE_RING_COUNT, ceilf(remainder / (float)max_multiplier)); - int multiplier = min_ii(max_multiplier, floorf(remainder / (float)ring_count)); + int ring_count = min_ii(DOF_DILATE_RING_COUNT, ceilf(remainder / float(max_multiplier))); + int multiplier = min_ii(max_multiplier, floorf(remainder / float(ring_count))); dilation_radius += ring_count * multiplier; diff --git a/source/blender/draw/engines/eevee_next/eevee_film.cc b/source/blender/draw/engines/eevee_next/eevee_film.cc index 244eb1e54ef..82f948167dc 100644 --- a/source/blender/draw/engines/eevee_next/eevee_film.cc +++ b/source/blender/draw/engines/eevee_next/eevee_film.cc @@ -120,7 +120,7 @@ void Film::sync_mist() const ::World *world = inst_.scene->world; float mist_start = world ? world->miststa : cam.clip_near; float mist_distance = world ? world->mistdist : fabsf(cam.clip_far - cam.clip_near); - int mist_type = world ? world->mistype : (int)WO_MIST_LINEAR; + int mist_type = world ? world->mistype : int(WO_MIST_LINEAR); switch (mist_type) { case WO_MIST_QUADRATIC: diff --git a/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc b/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc index f5638cc5160..29a5484f438 100644 --- a/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc +++ b/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc @@ -43,10 +43,10 @@ void RenderBuffers::acquire(int2 extent) bool do_vector_render_pass = (enabled_passes & EEVEE_RENDER_PASS_VECTOR) || (inst_.motion_blur.postfx_enabled() && !inst_.is_viewport()); uint32_t max_light_color_layer = max_ii(enabled_passes & EEVEE_RENDER_PASS_DIFFUSE_LIGHT ? - (int)RENDER_PASS_LAYER_DIFFUSE_LIGHT : + int(RENDER_PASS_LAYER_DIFFUSE_LIGHT) : -1, enabled_passes & EEVEE_RENDER_PASS_SPECULAR_LIGHT ? - (int)RENDER_PASS_LAYER_SPECULAR_LIGHT : + int(RENDER_PASS_LAYER_SPECULAR_LIGHT) : -1) + 1; /* Only RG16F when only doing only reprojection or motion blur. */ diff --git a/source/blender/draw/engines/eevee_next/eevee_sampling.cc b/source/blender/draw/engines/eevee_next/eevee_sampling.cc index 76a0e98638b..521b6d603df 100644 --- a/source/blender/draw/engines/eevee_next/eevee_sampling.cc +++ b/source/blender/draw/engines/eevee_next/eevee_sampling.cc @@ -215,8 +215,8 @@ void Sampling::dof_disk_sample_get(float *r_radius, float *r_theta) const samples_passed += ring_sample_count; } - *r_radius = ring / (float)dof_ring_count_; - *r_theta = 2.0f * M_PI * ring_sample / (float)ring_sample_count; + *r_radius = ring / float(dof_ring_count_); + *r_theta = 2.0f * M_PI * ring_sample / float(ring_sample_count); } /** \} */ @@ -233,7 +233,7 @@ void Sampling::cdf_from_curvemapping(const CurveMapping &curve, Vector<float> &c cdf[0] = 0.0f; /* Actual CDF evaluation. */ for (int u : IndexRange(cdf.size() - 1)) { - float x = (float)(u + 1) / (float)(cdf.size() - 1); + float x = float(u + 1) / float(cdf.size() - 1); cdf[u + 1] = cdf[u] + BKE_curvemapping_evaluateF(&curve, 0, x); } /* Normalize the CDF. */ @@ -249,14 +249,14 @@ void Sampling::cdf_from_curvemapping(const CurveMapping &curve, Vector<float> &c void Sampling::cdf_invert(Vector<float> &cdf, Vector<float> &inverted_cdf) { for (int u : inverted_cdf.index_range()) { - float x = (float)u / (float)(inverted_cdf.size() - 1); + float x = float(u) / float(inverted_cdf.size() - 1); for (int i : cdf.index_range()) { if (i == cdf.size() - 1) { inverted_cdf[u] = 1.0f; } else if (cdf[i] >= x) { float t = (x - cdf[i]) / (cdf[i + 1] - cdf[i]); - inverted_cdf[u] = ((float)i + t) / (float)(cdf.size() - 1); + inverted_cdf[u] = (float(i) + t) / float(cdf.size() - 1); break; } } diff --git a/source/blender/draw/engines/eevee_next/eevee_velocity.cc b/source/blender/draw/engines/eevee_next/eevee_velocity.cc index 7af311a8ccc..e7e4984f7de 100644 --- a/source/blender/draw/engines/eevee_next/eevee_velocity.cc +++ b/source/blender/draw/engines/eevee_next/eevee_velocity.cc @@ -226,11 +226,11 @@ void VelocityModule::step_swap() for (VelocityObjectData &vel : velocity_map.values()) { vel.obj.ofs[step_a] = vel.obj.ofs[step_b]; - vel.obj.ofs[step_b] = (uint)-1; + vel.obj.ofs[step_b] = uint(-1); vel.geo.ofs[step_a] = vel.geo.ofs[step_b]; vel.geo.len[step_a] = vel.geo.len[step_b]; - vel.geo.ofs[step_b] = (uint)-1; - vel.geo.len[step_b] = (uint)-1; + vel.geo.ofs[step_b] = uint(-1); + vel.geo.len[step_b] = uint(-1); } }; @@ -262,7 +262,7 @@ void VelocityModule::end_sync() uint32_t max_resource_id_ = 0u; for (Map<ObjectKey, VelocityObjectData>::Item item : velocity_map.items()) { - if (item.value.obj.resource_id == (uint32_t)-1) { + if (item.value.obj.resource_id == uint32_t(-1)) { deleted_obj.append(item.key); } else { @@ -302,7 +302,7 @@ void VelocityModule::end_sync() } indirection_buf[vel.obj.resource_id] = vel; /* Reset for next sync. */ - vel.obj.resource_id = (uint)-1; + vel.obj.resource_id = uint(-1); } object_steps[STEP_PREVIOUS]->push_update(); diff --git a/source/blender/draw/engines/eevee_next/eevee_view.cc b/source/blender/draw/engines/eevee_next/eevee_view.cc index 48951c2bae7..3a4fb9d4c20 100644 --- a/source/blender/draw/engines/eevee_next/eevee_view.cc +++ b/source/blender/draw/engines/eevee_next/eevee_view.cc @@ -39,7 +39,7 @@ void ShadingView::sync() int2 render_extent = inst_.film.render_extent_get(); if (false /* inst_.camera.is_panoramic() */) { - int64_t render_pixel_count = render_extent.x * (int64_t)render_extent.y; + int64_t render_pixel_count = render_extent.x * int64_t(render_extent.y); /* Divide pixel count between the 6 views. Rendering to a square target. */ extent_[0] = extent_[1] = ceilf(sqrtf(1 + (render_pixel_count / 6))); /* TODO(@fclem): Clip unused views here. */ |