diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-13 21:18:46 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:10 +0300 |
commit | 76c7d693d98f3b1e69fc42e7c3124761bf9b06a0 (patch) | |
tree | 9e888f8948422b7a41eed1b07487cf4067ae17f1 /intern/cycles/blender/blender_curves.cpp | |
parent | 6edeb43c16670c2d5ee6896b33880e6597192b74 (diff) |
Support in Cycles for the extra spiral keys in hair paths.
Diffstat (limited to 'intern/cycles/blender/blender_curves.cpp')
-rw-r--r-- | intern/cycles/blender/blender_curves.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index 332f1633a30..67358ec0417 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -141,7 +141,6 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par int mi = clamp(b_part.material()-1, 0, mesh->used_shaders.size()-1); int shader = mesh->used_shaders[mi]; int draw_step = background ? b_part.render_step() : b_part.draw_step(); - int ren_step = (int)powf(2.0f, (float)draw_step); int totparts = b_psys.particles.length(); int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f); int totcurves = totchild; @@ -152,6 +151,10 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par if(totcurves == 0) continue; + int ren_step = (1 << draw_step) + 1; + if (b_part.kink() == BL::ParticleSettings::kink_SPIRAL) + ren_step += b_part.kink_extra_steps(); + PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles"); CData->psys_firstcurve.push_back(curvenum); @@ -173,8 +176,8 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par CData->curve_firstkey.reserve(CData->curve_firstkey.size() + num_add); CData->curve_keynum.reserve(CData->curve_keynum.size() + num_add); CData->curve_length.reserve(CData->curve_length.size() + num_add); - CData->curvekey_co.reserve(CData->curvekey_co.size() + num_add*(ren_step+1)); - CData->curvekey_time.reserve(CData->curvekey_time.size() + num_add*(ren_step+1)); + CData->curvekey_co.reserve(CData->curvekey_co.size() + num_add*ren_step); + CData->curvekey_time.reserve(CData->curvekey_time.size() + num_add*ren_step); for(; pa_no < totparts+totchild; pa_no++) { int keynum = 0; @@ -182,7 +185,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par float curve_length = 0.0f; float3 pcKey; - for(int step_no = 0; step_no <= ren_step; step_no++) { + 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]); |