diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-03 19:40:03 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-03 20:35:29 +0300 |
commit | 3d6e7cd67c2dac8acbce585efed2fa34341f2676 (patch) | |
tree | b4b4dcfe9cebfd01b71816a4955756feb3ae8d32 /intern | |
parent | 26ba7573e61e80de5f87967ba2e517972f689de7 (diff) |
Fix Cycles particle hair rendering broken after recent changes
This code was already wrong, we were just lucky that the previous coordinate
was repeated due to using the same memory location.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_curves.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index 4dba8ffbe0e..78db1d5c832 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -173,19 +173,20 @@ static bool ObtainCacheParticleData( CData->curve_firstkey.push_back_slow(keyno); float curve_length = 0.0f; - float3 pcKey; + float3 prev_co_world = make_float3(0.0f, 0.0f, 0.0f); + float3 prev_co_object = make_float3(0.0f, 0.0f, 0.0f); for (int step_no = 0; step_no < ren_step; step_no++) { - float nco[3]; - b_psys.co_hair(*b_ob, pa_no, step_no, nco); - float3 cKey = make_float3(nco[0], nco[1], nco[2]); - cKey = transform_point(&itfm, cKey); + float3 co_world = prev_co_world; + b_psys.co_hair(*b_ob, pa_no, step_no, &co_world.x); + float3 co_object = transform_point(&itfm, co_world); if (step_no > 0) { - const float step_length = len(cKey - pcKey); + const float step_length = len(co_object - prev_co_object); curve_length += step_length; } - CData->curvekey_co.push_back_slow(cKey); + CData->curvekey_co.push_back_slow(co_object); CData->curvekey_time.push_back_slow(curve_length); - pcKey = cKey; + prev_co_object = co_object; + prev_co_world = co_world; keynum++; } keyno += keynum; |