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/eevee_sampling.cc | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/draw/engines/eevee_next/eevee_sampling.cc')
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_sampling.cc | 10 |
1 files changed, 5 insertions, 5 deletions
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; } } |