* Fixed a strange problem with the way textures are interpreted - was causing weird things with point density turbulence on

* Reverted the spin field once more..
This commit is contained in:
Matt Ebb
2008-11-04 05:17:02 +00:00
parent 389588bb4f
commit f5f0c8fb37
3 changed files with 23 additions and 12 deletions

View File

@@ -422,20 +422,27 @@ void do_physical_effector(Object *ob, float *opco, short type, float force_val,
break;
case PFIELD_SPIN:
{
float inward[3];
Projf(temp, velocity, eff_vel);
Crossf(mag_vec,eff_vel,vec_to_part);
Crossf(inward, mag_vec, eff_vel);
Normalize(mag_vec);
Normalize(inward);
VecSubf(mag_vec, mag_vec, inward);
VecMulf(mag_vec,force_val*distance*falloff);
VecAddf(mag_vec, mag_vec, temp);
VecCopyf(velocity, mag_vec);
//VecSubf(mag_vec, mag_vec, velocity);
//VecAddf(field, field, mag_vec);
//VecCopyf(velocity, mag_vec);
VecSubf(mag_vec, mag_vec, velocity);
VecAddf(field, field, mag_vec);
break;
}
case PFIELD_MAGNET:
if(planar)
VecCopyf(temp,eff_vel);

View File

@@ -304,9 +304,9 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
PointDensityRangeData pdr;
float density=0.0f, time=0.0f;
float vec[3] = {0.0, 0.0, 0.0};
float tv[3];
float co[3];
float turb, noise_fac;
int num;
if ((!pd) || (!pd->point_tree)) {
texres->tin = 0.0f;
@@ -331,11 +331,13 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
if (ELEM(pd->noise_influence, TEX_PD_NOISE_VEL, TEX_PD_NOISE_TIME)) {
/* find the average speed vectors or particle time,
* for perturbing final density lookup with */
BLI_bvhtree_range_query(pd->point_tree, co, pd->radius, accum_density, &pdr);
num = BLI_bvhtree_range_query(pd->point_tree, co, pd->radius, accum_density, &pdr);
density = 0.0f;
if (pd->noise_influence == TEX_PD_NOISE_TIME)
vec[0] = vec[1] = vec[2] = time;
if (pd->noise_influence == TEX_PD_NOISE_TIME) {
vec[0] = vec[1] = vec[2] = time/num;
//if ((G.rt==1) && (time > 0.f)) printf("time: %f time/num: %f \n", time, time/num);
}
Normalize(vec);
}
@@ -357,7 +359,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
texres->tr = vec[0];
texres->tg = vec[1];
texres->tb = vec[2];
texres->ta = density;
//texres->ta = density;
BRICONTRGB;
return retval;

View File

@@ -1590,9 +1590,11 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa
float varfac= mtex->varfac*stencilTin;
/* convert RGB to intensity if intensity info isn't provided */
if((rgbnor & TEX_RGB) && !(rgbnor & TEX_INT)) {
if(texres.talpha) texres.tin= texres.ta;
else texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb);
if (rgbnor & TEX_INT) {
if (rgbnor & TEX_RGB) {
if(texres.talpha) texres.tin= texres.ta;
else texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb);
}
}
if((mapto_flag & MAP_EMIT) && (mtex->mapto & MAP_EMIT)) {