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 <mail@jlucke.com>2019-07-18 17:39:28 +0300
committerJacques Lucke <mail@jlucke.com>2019-07-18 17:39:28 +0300
commit182cc120159cbe25a486dd3d42aeeb5cc7089902 (patch)
treea5d70b934beeb7ca0344326368c1f7ce5f3239d4 /source/blender
parent83e75345a2ee131c915ac8b721390b12fe6992c4 (diff)
fix trail creation for partial time steps
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/simulations/bparticles/core.hpp2
-rw-r--r--source/blender/simulations/bparticles/forces.cpp5
-rw-r--r--source/blender/simulations/bparticles/simulate.cpp2
3 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index d1cf9939262..808dce63a5e 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -937,7 +937,7 @@ inline ArrayRef<float> OffsetHandlerInterface::durations()
inline TimeSpan OffsetHandlerInterface::time_span(uint pindex)
{
- float duration = m_step_data.remaining_durations[pindex];
+ float duration = m_step_data.remaining_durations[pindex] * m_time_factors[pindex];
return TimeSpan(m_step_data.step_end_time - duration, duration);
}
diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp
index e9e83744be4..1d859a3adc4 100644
--- a/source/blender/simulations/bparticles/forces.cpp
+++ b/source/blender/simulations/bparticles/forces.cpp
@@ -59,11 +59,14 @@ void CreateTrailHandler::execute(OffsetHandlerInterface &interface)
SmallVector<float3> new_positions;
SmallVector<float> new_birth_times;
for (uint pindex : particles.pindices()) {
+ float time_factor = interface.time_factors()[pindex];
TimeSpan time_span = interface.time_span(pindex);
float current_time = frequency * (std::floor(time_span.start() / frequency) + 1.0f);
+
+ float3 total_offset = position_offsets[pindex] * time_factor;
while (current_time < time_span.end()) {
float factor = time_span.get_factor_safe(current_time);
- new_positions.append(positions[pindex] + position_offsets[pindex] * factor);
+ new_positions.append(positions[pindex] + total_offset * factor);
new_birth_times.append(current_time);
current_time += frequency;
}
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 90f7116cd4e..5845e7c9518 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -539,7 +539,7 @@ BLI_NOINLINE static void ensure_required_containers_exist(ParticlesState &state,
for (std::string type_name : description.particle_types().keys()) {
if (!containers.contains(type_name)) {
- ParticlesContainer *container = new ParticlesContainer({}, 100);
+ ParticlesContainer *container = new ParticlesContainer({}, 1000);
containers.add_new(type_name, container);
}
}