[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16182] trunk/blender/source/blender/ blenkernel: Little tweaks so 0 wind results in 0 noise, also removed double-mass dependancy in cloth
Daniel Genrich
daniel.genrich at gmx.net
Mon Aug 18 21:32:21 CEST 2008
Revision: 16182
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16182
Author: genscher
Date: 2008-08-18 21:32:21 +0200 (Mon, 18 Aug 2008)
Log Message:
-----------
Little tweaks so 0 wind results in 0 noise, also removed double-mass dependancy in cloth
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_effect.h
trunk/blender/source/blender/blenkernel/intern/effect.c
trunk/blender/source/blender/blenkernel/intern/implicit.c
Modified: trunk/blender/source/blender/blenkernel/BKE_effect.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_effect.h 2008-08-18 19:31:40 UTC (rev 16181)
+++ trunk/blender/source/blender/blenkernel/BKE_effect.h 2008-08-18 19:32:21 UTC (rev 16182)
@@ -66,7 +66,7 @@
void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags);
/* required for particle_system.c */
-void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise);
+void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor);
float effector_falloff(struct PartDeflect *pd, float *eff_velocity, float *vec_to_part);
Modified: trunk/blender/source/blender/blenkernel/intern/effect.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/effect.c 2008-08-18 19:31:40 UTC (rev 16181)
+++ trunk/blender/source/blender/blenkernel/intern/effect.c 2008-08-18 19:32:21 UTC (rev 16182)
@@ -315,12 +315,12 @@
return falloff;
}
-void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise)
+void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor)
{
float mag_vec[3]={0,0,0};
float temp[3], temp2[3];
float eff_vel[3];
- float wind = 0;
+ float noise = 0;
VecCopyf(eff_vel,eff_velocity);
Normalize(eff_vel);
@@ -329,11 +329,11 @@
case PFIELD_WIND:
VECCOPY(mag_vec,eff_vel);
- // add wind noise here
- if(noise> 0.0f)
- wind = wind_func(rng, noise);
-
- VecMulf(mag_vec,(force_val+wind)*falloff);
+ // add wind noise here, only if we have wind
+ if((noise_factor> 0.0f) && (force_val > FLT_EPSILON))
+ noise = wind_func(rng, noise_factor);
+
+ VecMulf(mag_vec,(force_val+noise)*falloff);
VecAddf(field,field,mag_vec);
break;
Modified: trunk/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/implicit.c 2008-08-18 19:31:40 UTC (rev 16181)
+++ trunk/blender/source/blender/blenkernel/intern/implicit.c 2008-08-18 19:32:21 UTC (rev 16182)
@@ -1452,6 +1452,7 @@
float triunnormal[3]={0,0,0}; // not-normalized-triangle normal
float tmp[3]={0,0,0};
float factor = (mfaces[i].v4) ? 0.25 : 1.0 / 3.0;
+ factor *= 0.02;
// calculate face normal
if(mfaces[i].v4)
@@ -1465,24 +1466,24 @@
// add wind from v1
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v1], triunnormal));
- VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], tmp, factor*verts[mfaces[i].v1].mass);
+ VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], tmp, factor);
// add wind from v2
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v2], triunnormal));
- VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], tmp, factor*verts[mfaces[i].v2].mass);
+ VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], tmp, factor);
// add wind from v3
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v3], triunnormal));
- VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor*verts[mfaces[i].v3].mass);
+ VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
// add wind from v4
if(mfaces[i].v4)
{
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
- VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor*verts[mfaces[i].v4].mass);
+ VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor);
}
}
del_lfvector(winvec);
More information about the Bf-blender-cvs
mailing list