Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-08-07 19:24:59 +0300
committerJacques Lucke <jacques@blender.org>2020-08-07 19:42:21 +0300
commitc50e5fcc344d00b03eb4a3141b5b45944c3570fd (patch)
treef683ae1a1f38551d160a5be2ee86561d51faca26 /source/blender/simulation
parent28b10224346a9a2e55267f98357991a841eeda5b (diff)
Cleanup: use C++ style casts in various places
Diffstat (limited to 'source/blender/simulation')
-rw-r--r--source/blender/simulation/intern/particle_allocator.cc4
-rw-r--r--source/blender/simulation/intern/particle_mesh_emitter.cc4
-rw-r--r--source/blender/simulation/intern/simulation_solver_influences.hh2
-rw-r--r--source/blender/simulation/intern/simulation_update.cc11
4 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/simulation/intern/particle_allocator.cc b/source/blender/simulation/intern/particle_allocator.cc
index e47a6354d81..91ca667a239 100644
--- a/source/blender/simulation/intern/particle_allocator.cc
+++ b/source/blender/simulation/intern/particle_allocator.cc
@@ -71,9 +71,9 @@ fn::MutableAttributesRef ParticleAllocator::allocate(int size)
}
else if (name == "Hash") {
MutableSpan<int> hashes = attributes.get<int>("Hash");
- RandomNumberGenerator rng(hash_seed_ ^ (uint32_t)next_id_);
+ RandomNumberGenerator rng(hash_seed_ ^ static_cast<uint32_t>(next_id_));
for (int pindex : IndexRange(size)) {
- hashes[pindex] = (int)rng.get_uint32();
+ hashes[pindex] = static_cast<int>(rng.get_uint32());
}
}
else {
diff --git a/source/blender/simulation/intern/particle_mesh_emitter.cc b/source/blender/simulation/intern/particle_mesh_emitter.cc
index 26541d550eb..3d43d4d8001 100644
--- a/source/blender/simulation/intern/particle_mesh_emitter.cc
+++ b/source/blender/simulation/intern/particle_mesh_emitter.cc
@@ -233,14 +233,14 @@ static BLI_NOINLINE bool compute_new_particle_attributes(ParticleEmitterContext
if (settings.object->type != OB_MESH) {
return false;
}
- Mesh &mesh = *(Mesh *)settings.object->data;
+ Mesh &mesh = *static_cast<Mesh *>(settings.object->data);
if (mesh.totvert == 0) {
return false;
}
const float start_time = context.emit_interval.start();
const uint32_t seed = DefaultHash<StringRef>{}(state.head.name);
- RandomNumberGenerator rng{(*(uint32_t *)&start_time) ^ seed};
+ RandomNumberGenerator rng{*reinterpret_cast<const uint32_t *>(&start_time) ^ seed};
compute_birth_times(settings.rate, context.emit_interval, state, r_birth_times);
const int particle_amount = r_birth_times.size();
diff --git a/source/blender/simulation/intern/simulation_solver_influences.hh b/source/blender/simulation/intern/simulation_solver_influences.hh
index d7914819d36..7dc0b3b8c8d 100644
--- a/source/blender/simulation/intern/simulation_solver_influences.hh
+++ b/source/blender/simulation/intern/simulation_solver_influences.hh
@@ -96,7 +96,7 @@ class SimulationStateMap {
template<typename StateType> StateType *lookup(StringRef name) const
{
const char *type = BKE_simulation_get_state_type_name<StateType>();
- return (StateType *)this->lookup_name_type(name, type);
+ return reinterpret_cast<StateType *>(this->lookup_name_type(name, type));
}
template<typename StateType> Span<StateType *> lookup() const
diff --git a/source/blender/simulation/intern/simulation_update.cc b/source/blender/simulation/intern/simulation_update.cc
index 32b582977d0..452b222bb08 100644
--- a/source/blender/simulation/intern/simulation_update.cc
+++ b/source/blender/simulation/intern/simulation_update.cc
@@ -143,7 +143,7 @@ class SampledDependencyAnimations : public DependencyAnimations {
const float factor = simulation_time_interval_.factor_at_time(simulation_time);
BLI_assert(factor > 0.0f && factor < 1.0f);
const float scaled_factor = factor * (cached_transforms.size() - 1);
- const int lower_sample = (int)scaled_factor;
+ const int lower_sample = static_cast<int>(scaled_factor);
const int upper_sample = lower_sample + 1;
const float mix_factor = scaled_factor - lower_sample;
r_transforms[i] = float4x4::interpolate(
@@ -205,7 +205,7 @@ static void prepare_dependency_animations(Depsgraph &depsgraph,
if (GS(id_cow->name) != ID_OB) {
continue;
}
- Object &object_cow = *(Object *)id_cow;
+ Object &object_cow = *reinterpret_cast<Object *>(id_cow);
constexpr int sample_count = 10;
Array<float4x4, sample_count> transforms(sample_count);
sample_object_transforms(object_cow, depsgraph, scene, scene_frame_interval, transforms);
@@ -233,7 +233,8 @@ void update_simulation_in_depsgraph(Depsgraph *depsgraph,
return;
}
- Simulation *simulation_orig = (Simulation *)DEG_get_original_id(&simulation_cow->id);
+ Simulation *simulation_orig = reinterpret_cast<Simulation *>(
+ DEG_get_original_id(&simulation_cow->id));
ResourceCollector resources;
SimulationInfluences influences;
@@ -317,8 +318,8 @@ bool update_simulation_dependencies(Simulation *simulation)
}
used_handles.add_new(next_handle);
- SimulationDependency *dependency = (SimulationDependency *)MEM_callocN(sizeof(*dependency),
- AT);
+ SimulationDependency *dependency = static_cast<SimulationDependency *>(
+ MEM_callocN(sizeof(*dependency), AT));
id_us_plus(id);
dependency->id = id;
dependency->handle = next_handle;