diff options
Diffstat (limited to 'source/blender/render/intern/source/texture.c')
-rw-r--r-- | source/blender/render/intern/source/texture.c | 69 |
1 files changed, 46 insertions, 23 deletions
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index c706c6ccc11..2d2c01e0bf1 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -30,7 +30,7 @@ #include <string.h> #include <math.h> -#include "MTC_matrixops.h" + #include "BLI_blenlib.h" #include "BLI_arithb.h" @@ -832,7 +832,7 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float else { VECCOPY(nor, n); } - MTC_Mat4Mul3Vecfl(R.viewinv, nor); + Mat4Mul3Vecfl(R.viewinv, nor); x1= fabs(nor[0]); y1= fabs(nor[1]); @@ -925,7 +925,7 @@ static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *ad if(n==NULL) return 0; VECCOPY(nor, n); - if(ob) MTC_Mat4Mul3Vecfl(ob->imat, nor); + if(ob) Mat4Mul3Vecfl(ob->imat, nor); x1= fabs(nor[0]); y1= fabs(nor[1]); @@ -1455,12 +1455,22 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg VECCOPY(in, out); ramp_blend(MA_RAMP_COLOR, in, in+1, in+2, fact, tex); break; + case MTEX_SOFT_LIGHT: + fact*= facg; + VECCOPY(in, out); + ramp_blend(MA_RAMP_SOFT, in, in+1, in+2, fact, tex); + break; + case MTEX_LIN_LIGHT: + fact*= facg; + VECCOPY(in, out); + ramp_blend(MA_RAMP_LINEAR, in, in+1, in+2, fact, tex); + break; } } float texture_value_blend(float tex, float out, float fact, float facg, int blendtype, int flip) { - float in=0.0, facm, col; + float in=0.0, facm, col, scf; fact*= facg; facm= 1.0-fact; @@ -1505,6 +1515,19 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen col= fact*tex; if(col > out) in= col; else in= out; break; + + case MTEX_SOFT_LIGHT: + col= fact*tex; + scf=1.0 - (1.0 - tex) * (1.0 - out); + in= facm*out + fact * ((1.0 - out) * tex * out) + (out * scf); + break; + + case MTEX_LIN_LIGHT: + if (tex > 0.5) + in = out + fact*(2*(tex - 0.5)); + else + in = out + fact*(2*tex - 1); + break; } return in; @@ -1648,13 +1671,13 @@ void do_material_tex(ShadeInput *shi) VECCOPY(tempvec, shi->co); if(mtex->texflag & MTEX_OB_DUPLI_ORIG) if(shi->obi && shi->obi->duplitexmat) - MTC_Mat4MulVecfl(shi->obi->duplitexmat, tempvec); - MTC_Mat4MulVecfl(ob->imat, tempvec); + Mat4MulVecfl(shi->obi->duplitexmat, tempvec); + Mat4MulVecfl(ob->imat, tempvec); if(shi->osatex) { VECCOPY(dxt, shi->dxco); VECCOPY(dyt, shi->dyco); - MTC_Mat4Mul3Vecfl(ob->imat, dxt); - MTC_Mat4Mul3Vecfl(ob->imat, dyt); + Mat4Mul3Vecfl(ob->imat, dxt); + Mat4Mul3Vecfl(ob->imat, dyt); } } else { @@ -2291,9 +2314,9 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa VECCOPY(co, xyz); if(mtex->texflag & MTEX_OB_DUPLI_ORIG) { if(shi->obi && shi->obi->duplitexmat) - MTC_Mat4MulVecfl(shi->obi->duplitexmat, co); + Mat4MulVecfl(shi->obi->duplitexmat, co); } - MTC_Mat4MulVecfl(ob->imat, co); + Mat4MulVecfl(ob->imat, co); } } /* not really orco, but 'local' */ @@ -2305,12 +2328,12 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa else { Object *ob= shi->obi->ob; VECCOPY(co, xyz); - MTC_Mat4MulVecfl(ob->imat, co); + Mat4MulVecfl(ob->imat, co); } } else if(mtex->texco==TEXCO_GLOB) { VECCOPY(co, xyz); - MTC_Mat4MulVecfl(R.viewinv, co); + Mat4MulVecfl(R.viewinv, co); } else continue; // can happen when texco defines disappear and it renders old files @@ -2639,7 +2662,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f case TEXCO_OBJECT: if(mtex->object) { VECCOPY(tempvec, lo); - MTC_Mat4MulVecfl(mtex->object->imat, tempvec); + Mat4MulVecfl(mtex->object->imat, tempvec); co= tempvec; } break; @@ -2647,16 +2670,16 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f case TEXCO_GLOB: if(rco) { VECCOPY(tempvec, rco); - MTC_Mat4MulVecfl(R.viewinv, tempvec); + Mat4MulVecfl(R.viewinv, tempvec); co= tempvec; } else co= lo; // VECCOPY(shi->dxgl, shi->dxco); -// MTC_Mat3MulVecfl(R.imat, shi->dxco); +// Mat3MulVecfl(R.imat, shi->dxco); // VECCOPY(shi->dygl, shi->dyco); -// MTC_Mat3MulVecfl(R.imat, shi->dyco); +// Mat3MulVecfl(R.imat, shi->dyco); break; } @@ -2783,12 +2806,12 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef dx= dxt; dy= dyt; VECCOPY(tempvec, shi->co); - MTC_Mat4MulVecfl(ob->imat, tempvec); + Mat4MulVecfl(ob->imat, tempvec); if(shi->osatex) { VECCOPY(dxt, shi->dxco); VECCOPY(dyt, shi->dyco); - MTC_Mat4Mul3Vecfl(ob->imat, dxt); - MTC_Mat4Mul3Vecfl(ob->imat, dyt); + Mat4Mul3Vecfl(ob->imat, dxt); + Mat4Mul3Vecfl(ob->imat, dyt); } } else { @@ -2799,12 +2822,12 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef else if(mtex->texco==TEXCO_GLOB) { co= shi->gl; dx= shi->dxco; dy= shi->dyco; VECCOPY(shi->gl, shi->co); - MTC_Mat4MulVecfl(R.viewinv, shi->gl); + Mat4MulVecfl(R.viewinv, shi->gl); } else if(mtex->texco==TEXCO_VIEW) { VECCOPY(tempvec, lavec); - MTC_Mat3MulVecfl(la->imat, tempvec); + Mat3MulVecfl(la->imat, tempvec); if(la->type==LA_SPOT) { tempvec[0]*= la->spottexfac; @@ -2817,8 +2840,8 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef VECCOPY(dxt, shi->dxlv); VECCOPY(dyt, shi->dylv); /* need some matrix conversion here? la->imat is a [3][3] matrix!!! **/ - MTC_Mat3MulVecfl(la->imat, dxt); - MTC_Mat3MulVecfl(la->imat, dyt); + Mat3MulVecfl(la->imat, dxt); + Mat3MulVecfl(la->imat, dyt); VecMulf(dxt, la->spottexfac); VecMulf(dyt, la->spottexfac); |