* Little feature, blend texture can have extrapolation modes (like repeat).

This should probably go in trunk, but I'll stay away for now with all the 2.5 work on.
This commit is contained in:
2009-01-13 02:39:46 +00:00
parent 0572f1a5f6
commit 6cfbb0017a
4 changed files with 34 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ struct ListBase;
struct MemFile;
#define BLENDER_VERSION 248
#define BLENDER_SUBVERSION 1
#define BLENDER_SUBVERSION 3
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15

View File

@@ -7975,7 +7975,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
tex->vd->int_multiplier = 1.0;
}
}
}
/* set the curve radius interpolation to 2.47 default - easy */
@@ -8074,6 +8073,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
Tex *tex;
/* blend texture extrapolation */
for(tex=main->tex.first; tex; tex= tex->id.next) {
if (tex->type == TEX_BLEND)
tex->extend = TEX_EXTEND;
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

View File

@@ -197,6 +197,23 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
y= texvec[1];
}
if (tex->extend == TEX_REPEAT) {
if (x < -1.0 || x > 1.0) {
const float x2 = (x + 1.0)* 0.5; /* to 0.0, 1.0 */
x = (x2 - floor(x2) - 0.5) * 2.0; /* to -1.0, 1.0 */
}
if (y < -1.0 || y > 1.0) {
const float y2 = (y + 1.0)* 0.5; /* to 0.0, 1.0 */
y = (y2 - floor(y2) - 0.5) * 2.0; /* to -1.0, 1.0 */
}
} else if (tex->extend == TEX_CLIP) {
if (x < -1.0 || x > 1.0 || y < -1.0 || y > 1.0) {
texres->tin = 0.f;
BRICONT;
return TEX_INT;
}
}
if(tex->stype==TEX_LIN) { /* lin */
texres->tin= (1.0+x)/2.0;
}

View File

@@ -644,7 +644,13 @@ static void texture_panel_blend(Tex *tex)
uiDefButS(block, ROW, B_TEXPRV, "Sphere", 85, 160, 75, 19, &tex->stype, 2.0, (float)TEX_SPHERE, 0, 0, "Use progression with the shape of a sphere");
uiDefButS(block, ROW, B_TEXPRV, "Halo", 160, 160, 75, 19, &tex->stype, 2.0, (float)TEX_HALO, 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, (float)TEX_RAD, 0, 0, "Use a polar progression");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_TEXREDR_PRV, "Extend", 10,120,63,19, &tex->extend, 4.0, 1.0, 0, 0, "Extends the color of the edge pixels");
uiDefButS(block, ROW, B_TEXREDR_PRV, "Clip", 73,120,48,19, &tex->extend, 4.0, 2.0, 0, 0, "Sets alpha 0.0 outside Image edges");
uiDefButS(block, ROW, B_TEXREDR_PRV, "Repeat", 121,120,63,19, &tex->extend, 4.0, 3.0, 0, 0, "Causes Image to repeat horizontally and vertically");
uiBlockEndAlign(block);
}
/* newnoise: noisebasis menu string */