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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-01-11 19:01:09 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-01-11 19:01:09 +0300
commit16f8444d9d64967331e1a386ecc676b464869428 (patch)
tree89054a17e8add6073363bc26abdc4ecf607d091e /source
parent8d9ffa1a6f8ce0c5729dd2f89abb3fa8d0872698 (diff)
Fix T47147: small particles incorrectly rendered as large particles (particle size influenced by texture).
In fact, code would behave strangely here with any negative value, applying a 'wrapped positive clamping' (comes from original 2.5 commit feature, rBfafbd9d71b95776d1c7583476de74fccefab7f10)... This commit is conservative - it keeps same behavior for all particle properties affected by textures, except for size and length, where we apply a real [0, 1] clamping. Easy to change in future in case new odd cases popup.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index e8fcb5c50b1..5a6f1dae53e 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3427,6 +3427,11 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
if (event & type) { \
+ CLAMP(pvalue, 0.0f, 1.0f); \
+ } (void)0
+
+#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue) \
+ if (event & type) { \
if (pvalue < 0.0f) \
pvalue = 1.0f + pvalue; \
CLAMP(pvalue, 0.0f, 1.0f); \
@@ -3498,11 +3503,11 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
}
CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_CLUMP, ptex->clump);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_KINK_AMP, ptex->kink_amp);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_KINK_FREQ, ptex->kink_freq);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_ROUGH, ptex->rough1);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_CLUMP, ptex->clump);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_KINK_AMP, ptex->kink_amp);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_KINK_FREQ, ptex->kink_freq);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_ROUGH, ptex->rough1);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist);
}
void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTexture *ptex, int event, float cfra)
{
@@ -3592,14 +3597,14 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
}
}
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist);
CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size);
CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel);
CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field);
CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity);
- CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp);
+ CLAMP_WARP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp);
CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length);
}
/************************************************/