diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index ccf1e29fff7..21ae86ea68a 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -259,6 +259,15 @@ typedef struct Tex { #define TEX_SHARP 1 #define TEX_SHARPER 2 +/* tex->stype in texture.c - blend types */ +#define TEX_LIN 0 +#define TEX_QUAD 1 +#define TEX_EASE 2 +#define TEX_DIAG 3 +#define TEX_SPHERE 4 +#define TEX_HALO 5 +#define TEX_RAD 6 + /* wrap */ #define MTEX_FLAT 0 #define MTEX_CUBE 1 diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 191661d8ed7..183ce9fcd03 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -283,15 +283,15 @@ static int blend(Tex *tex, float *texvec, TexResult *texres) y= texvec[1]; } - if(tex->stype==0) { /* lin */ + if(tex->stype==TEX_LIN) { /* lin */ texres->tin= (1.0+x)/2.0; } - else if(tex->stype==1) { /* quad */ + else if(tex->stype==TEX_QUAD) { /* quad */ texres->tin= (1.0+x)/2.0; if(texres->tin<0.0) texres->tin= 0.0; else texres->tin*= texres->tin; } - else if(tex->stype==2) { /* ease */ + else if(tex->stype==TEX_EASE) { /* ease */ texres->tin= (1.0+x)/2.0; if(texres->tin<=.0) texres->tin= 0.0; else if(texres->tin>=1.0) texres->tin= 1.0; @@ -300,10 +300,13 @@ static int blend(Tex *tex, float *texvec, TexResult *texres) texres->tin= (3.0*t-2.0*t*texres->tin); } } - else if(tex->stype==3) { /* diag */ + else if(tex->stype==TEX_DIAG) { /* diag */ texres->tin= (2.0+x+y)/4.0; } - else { /* sphere */ + else if(tex->stype==TEX_RAD) { /* radial */ + texres->tin= (atan2(y,x) / (2*M_PI) + 0.5); + } + else { /* sphere TEX_SPHERE */ texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]); if(texres->tin<0.0) texres->tin= 0.0; if(tex->stype==5) texres->tin*= texres->tin; /* halo */ diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index e1fe46ed3c4..962f862b8b1 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -860,9 +860,10 @@ static void texture_panel_blend(Tex *tex) uiDefButS(block, ROW, B_TEXPRV, "Ease", 160, 180, 75, 19, &tex->stype, 2.0, 2.0, 0, 0, "Creates a progression easing from one step to the next"); uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_TEXPRV, "Flip XY", 235, 180, 75, 19, &tex->flag, 0, 0, 0, 0, "Flips the direction of the progression 90 degrees"); - uiDefButS(block, ROW, B_TEXPRV, "Diag", 10, 160, 100, 19, &tex->stype, 2.0, 3.0, 0, 0, "Use a diagonal progression"); - uiDefButS(block, ROW, B_TEXPRV, "Sphere", 110, 160, 100, 19, &tex->stype, 2.0, 4.0, 0, 0, "Use progression with the shape of a sphere"); - uiDefButS(block, ROW, B_TEXPRV, "Halo", 210, 160, 100, 19, &tex->stype, 2.0, 5.0, 0, 0, "Use a quadratic progression with the shape of a sphere"); + uiDefButS(block, ROW, B_TEXPRV, "Diag", 10, 160, 75, 19, &tex->stype, 2.0, 3.0, 0, 0, "Use a diagonal progression"); + uiDefButS(block, ROW, B_TEXPRV, "Sphere", 85, 160, 75, 19, &tex->stype, 2.0, 4.0, 0, 0, "Use progression with the shape of a sphere"); + uiDefButS(block, ROW, B_TEXPRV, "Halo", 160, 160, 75, 19, &tex->stype, 2.0, 5.0, 0, 0, "Use a quadratic progression with the shape of a sphere"); + uiDefButS(block, ROW, B_TEXPRV, "Radial", 235, 160, 75, 19, &tex->stype, 2.0, 6.0, 0, 0, "Use a polar progression"); }