[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12795] trunk/blender/source/blender:
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed Dec 5 16:48:49 CET 2007
Revision: 12795
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12795
Author: blendix
Date: 2007-12-05 16:48:49 +0100 (Wed, 05 Dec 2007)
Log Message:
-----------
Particles
=========
- Added texture control for child particle roughness.
- Fix some use of uninitialized variables in particle texture code.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_particle.h
trunk/blender/source/blender/blenkernel/intern/particle.c
trunk/blender/source/blender/makesdna/DNA_material_types.h
trunk/blender/source/blender/src/buttons_shading.c
Modified: trunk/blender/source/blender/blenkernel/BKE_particle.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_particle.h 2007-12-05 12:40:54 UTC (rev 12794)
+++ trunk/blender/source/blender/blenkernel/BKE_particle.h 2007-12-05 15:48:49 UTC (rev 12795)
@@ -87,10 +87,10 @@
}ParticleReactEvent;
typedef struct ParticleTexture{
- float ivel; /* used in reset */
- float time, life, exist, size; /* used in init */
- float pvel[3]; /* used in physics */
- float length, clump, kink; /* used in path caching */
+ float ivel; /* used in reset */
+ float time, life, exist, size; /* used in init */
+ float pvel[3]; /* used in physics */
+ float length, clump, kink, rough; /* used in path caching */
} ParticleTexture;
typedef struct BoidVecFunc{
Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c 2007-12-05 12:40:54 UTC (rev 12794)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c 2007-12-05 15:48:49 UTC (rev 12795)
@@ -1480,7 +1480,8 @@
float *cpa_fuv=0;
float co[3], orco[3], ornor[3], t, rough_t, cpa_1st[3], dvec[3];
float branch_begin, branch_end, branch_prob, branchfac, rough_rand;
- float pa_rough1, pa_rough2, pa_roughe, length, pa_length, pa_clump, pa_kink;
+ float pa_rough1, pa_rough2, pa_roughe;
+ float length, pa_length, pa_clump, pa_kink;
float max_length = 1.0f, cur_length = 0.0f;
int k, cpa_num, guided=0;
short cpa_from;
@@ -1583,15 +1584,17 @@
ptex.length=part->length*(1.0f - part->randlength*cpa->rand[0]);
ptex.clump=1.0;
ptex.kink=1.0;
+ ptex.rough= 1.0;
- get_cpa_texture(ctx->dm,ctx->ma,cpa_num,cpa_fuv,orco,&ptex,MAP_PA_CACHE);
+ get_cpa_texture(ctx->dm,ctx->ma,cpa_num,cpa_fuv,orco,&ptex,
+ MAP_PA_LENGTH|MAP_PA_CLUMP|MAP_PA_KINK|MAP_PA_ROUGH);
pa_length=ptex.length;
pa_clump=ptex.clump;
pa_kink=ptex.kink;
- pa_rough1=1.0;
- pa_rough2=1.0;
- pa_roughe=1.0;
+ pa_rough1=ptex.rough;
+ pa_rough2=ptex.rough;
+ pa_roughe=ptex.rough;
if(ctx->vg_length)
pa_length*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_length);
@@ -2606,13 +2609,16 @@
if((event & mtex->pmapto) & MAP_PA_CLUMP)
ptex->clump= texture_value_blend(value,ptex->clump,value,var,blend,neg & MAP_PA_CLUMP);
if((event & mtex->pmapto) & MAP_PA_KINK)
- ptex->kink= texture_value_blend(value,ptex->kink,value,var,blend,neg & MAP_PA_CLUMP);
+ ptex->kink= texture_value_blend(value,ptex->kink,value,var,blend,neg & MAP_PA_KINK);
+ if((event & mtex->pmapto) & MAP_PA_ROUGH)
+ ptex->rough= texture_value_blend(value,ptex->rough,value,var,blend,neg & MAP_PA_ROUGH);
}
}
- CLAMP(ptex->time,0.0,1.0);
- CLAMP(ptex->length,0.0,1.0);
- CLAMP(ptex->clump,0.0,1.0);
- CLAMP(ptex->kink,0.0,1.0);
+ if(event & MAP_PA_TIME) { CLAMP(ptex->time,0.0,1.0); }
+ if(event & MAP_PA_LENGTH) { CLAMP(ptex->length,0.0,1.0); }
+ if(event & MAP_PA_CLUMP) { CLAMP(ptex->clump,0.0,1.0); }
+ if(event & MAP_PA_KINK) { CLAMP(ptex->kink,0.0,1.0); }
+ if(event & MAP_PA_ROUGH) { CLAMP(ptex->rough,0.0,1.0); }
}
void psys_get_texture(Object *ob, Material *ma, ParticleSystemModifierData *psmd, ParticleSystem *psys, ParticleData *pa, ParticleTexture *ptex, int event)
{
@@ -2682,14 +2688,14 @@
ptex->kink= texture_value_blend(mtex->def_var,ptex->kink,value,var,blend,neg & MAP_PA_CLUMP);
}
}
- CLAMP(ptex->time,0.0,1.0);
- CLAMP(ptex->life,0.0,1.0);
- CLAMP(ptex->exist,0.0,1.0);
- CLAMP(ptex->size,0.0,1.0);
- CLAMP(ptex->ivel,0.0,1.0);
- CLAMP(ptex->length,0.0,1.0);
- CLAMP(ptex->clump,0.0,1.0);
- CLAMP(ptex->kink,0.0,1.0);
+ if(event & MAP_PA_TIME) { CLAMP(ptex->time,0.0,1.0); }
+ if(event & MAP_PA_LIFE) { CLAMP(ptex->life,0.0,1.0); }
+ if(event & MAP_PA_DENS) { CLAMP(ptex->exist,0.0,1.0); }
+ if(event & MAP_PA_SIZE) { CLAMP(ptex->size,0.0,1.0); }
+ if(event & MAP_PA_IVEL) { CLAMP(ptex->ivel,0.0,1.0); }
+ if(event & MAP_PA_LENGTH) { CLAMP(ptex->length,0.0,1.0); }
+ if(event & MAP_PA_CLUMP) { CLAMP(ptex->clump,0.0,1.0); }
+ if(event & MAP_PA_KINK) { CLAMP(ptex->kink,0.0,1.0); }
}
/************************************************/
/* Particle State */
@@ -2966,7 +2972,7 @@
ptex.clump=1.0;
ptex.kink=1.0;
- get_cpa_texture(psmd->dm,ma,cpa_num,cpa_fuv,orco,&ptex,MAP_PA_CACHE-MAP_PA_LENGTH);
+ get_cpa_texture(psmd->dm,ma,cpa_num,cpa_fuv,orco,&ptex,MAP_PA_CLUMP|MAP_PA_KINK);
pa_clump=ptex.clump;
pa_kink=ptex.kink;
Modified: trunk/blender/source/blender/makesdna/DNA_material_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_material_types.h 2007-12-05 12:40:54 UTC (rev 12794)
+++ trunk/blender/source/blender/makesdna/DNA_material_types.h 2007-12-05 15:48:49 UTC (rev 12795)
@@ -298,9 +298,10 @@
/* physics */
#define MAP_PA_PVEL 64
/* path cache */
-#define MAP_PA_CACHE 384
+#define MAP_PA_CACHE 912
#define MAP_PA_CLUMP 128
#define MAP_PA_KINK 256
+#define MAP_PA_ROUGH 512
/* pr_type */
#define MA_FLAT 0
Modified: trunk/blender/source/blender/src/buttons_shading.c
===================================================================
--- trunk/blender/source/blender/src/buttons_shading.c 2007-12-05 12:40:54 UTC (rev 12794)
+++ trunk/blender/source/blender/src/buttons_shading.c 2007-12-05 15:48:49 UTC (rev 12795)
@@ -3164,7 +3164,7 @@
but=uiDefButBitS(block, TOG3, MAP_PA_DENS, B_MAT_PARTICLE, "Dens", 130,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the density of particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
uiDefButBitS(block, TOG3, MAP_PA_IVEL, B_MAT_PARTICLE, "IVel", 190,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the initial velocity of particles");
- uiDefButBitS(block, TOG3, MAP_PA_PVEL, B_MAT_PARTICLE, "PVel", 250,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the velocity of particles");
+ uiDefButBitS(block, TOG3, MAP_PA_ROUGH, B_MAT_PARTICLE, "Rough", 250,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the roughness of child particles");
but=uiDefButBitS(block, TOG3, MAP_PA_SIZE, B_MAT_PARTICLE, "Size", 10,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the size of particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
More information about the Bf-blender-cvs
mailing list