[Bf-blender-cvs] [4d6b6ab7e3e] functions: fix wrong index access
Jacques Lucke
noreply at git.blender.org
Wed Jul 10 17:18:22 CEST 2019
Commit: 4d6b6ab7e3e2ec5d588028e9400f524368185e82
Author: Jacques Lucke
Date: Wed Jul 10 16:34:07 2019 +0200
Branches: functions
https://developer.blender.org/rB4d6b6ab7e3e2ec5d588028e9400f524368185e82
fix wrong index access
===================================================================
M source/blender/simulations/bparticles/core.hpp
M source/blender/simulations/bparticles/events.cpp
===================================================================
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 467ce20c49a..8745a2d58f5 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -436,7 +436,7 @@ class EventFilterInterface {
/**
* Get the time span that should be checked for a specific particle.
*/
- TimeSpan time_span(uint index);
+ TimeSpan time_span(uint pindex);
/**
* Get the end time of the current time step.
@@ -759,9 +759,9 @@ inline ArrayRef<float> EventFilterInterface::durations()
return m_durations;
}
-inline TimeSpan EventFilterInterface::time_span(uint index)
+inline TimeSpan EventFilterInterface::time_span(uint pindex)
{
- float duration = m_durations[index];
+ float duration = m_durations[pindex];
return TimeSpan(m_end_time - duration, duration);
}
diff --git a/source/blender/simulations/bparticles/events.cpp b/source/blender/simulations/bparticles/events.cpp
index 00b8633b902..ca7c2d220c4 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -62,7 +62,7 @@ class AgeReachedEvent : public Event {
float age_at_end = end_time - birth_time;
if (age_at_end >= trigger_age) {
- TimeSpan time_span = interface.time_span(i);
+ TimeSpan time_span = interface.time_span(pindex);
float age_at_start = age_at_end - time_span.duration();
if (trigger_age < age_at_start) {
@@ -170,13 +170,13 @@ class MeshCollisionEventFilter : public Event {
uint pindex = particles.get_particle_index(i);
float3 ray_start = m_world_to_local.transform_position(positions[pindex]);
- float3 ray_direction = m_world_to_local.transform_direction(position_offsets[i]);
+ float3 ray_direction = m_world_to_local.transform_direction(position_offsets[pindex]);
float length = ray_direction.normalize_and_get_length();
auto result = this->ray_cast(ray_start, ray_direction, length);
if (result.success) {
float time_factor = result.distance / length;
- float time = interface.time_span(i).interpolate(time_factor);
+ float time = interface.time_span(pindex).interpolate(time_factor);
if (std::abs(last_collision_times[pindex] - time) < 0.0001f) {
continue;
}
More information about the Bf-blender-cvs
mailing list