Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-14 21:22:04 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-14 21:22:04 +0300
commit7ecba90f652ae2b1f9ea5256ab3a418845c20213 (patch)
treeb77505cb626d3b837f48e086d92c71094286ef38
parentd8d92b5d93e3553150fe9f28f1efbc4c3534c395 (diff)
Remove SAT texture filter. It's not working, thought it was but that's
because the mipmap was not being refreshed. Also this will be problematic to support when I add tile/mipmap cache, so would not rather not try to. Can be added back afterwards if someone wants to make it work.
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/imbuf/IMB_imbuf.h2
-rw-r--r--source/blender/imbuf/intern/filter.c109
-rw-r--r--source/blender/imbuf/intern/tiff.c28
-rw-r--r--source/blender/makesdna/DNA_texture_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_texture.c22
-rw-r--r--source/blender/render/intern/source/imagetexture.c179
7 files changed, 54 insertions, 290 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c5e0f096c04..ac66dfa621c 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1362,7 +1362,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
int mip= 0;
if(ibuf->mipmap[0]==NULL)
- IMB_makemipmap(ibuf, 0, 0);
+ IMB_makemipmap(ibuf, 0);
while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {
tzoom*= 2.0f;
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index a77ef54b0b6..14c58496352 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -317,7 +317,7 @@ void IMB_antialias(struct ImBuf * ibuf);
void IMB_filter(struct ImBuf *ibuf);
void IMB_filterN(struct ImBuf *out, struct ImBuf *in);
void IMB_filter_extend(struct ImBuf *ibuf, char *mask);
-void IMB_makemipmap(struct ImBuf *ibuf, int use_filter, int SAT);
+void IMB_makemipmap(struct ImBuf *ibuf, int use_filter);
/**
*
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 76ed0e2c61f..5692686a9bc 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -371,114 +371,21 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask)
}
}
-#if 0
void IMB_makemipmap(ImBuf *ibuf, int use_filter)
{
- ImBuf *hbuf= ibuf;
- int minsize, curmap=0;
-
- minsize= ibuf->x<ibuf->y?ibuf->x:ibuf->y;
-
- while(minsize>10 && curmap<IB_MIPMAP_LEVELS) {
- if(use_filter) {
+ ImBuf *hbuf = ibuf;
+ int curmap = 0;
+ while (curmap < IB_MIPMAP_LEVELS) {
+ if (use_filter) {
ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0);
IMB_filterN(nbuf, hbuf);
- ibuf->mipmap[curmap]= IMB_onehalf(nbuf);
+ ibuf->mipmap[curmap] = IMB_onehalf(nbuf);
IMB_freeImBuf(nbuf);
}
- else {
- ibuf->mipmap[curmap]= IMB_onehalf(hbuf);
- }
- hbuf= ibuf->mipmap[curmap];
-
+ else ibuf->mipmap[curmap] = IMB_onehalf(hbuf);
+ hbuf = ibuf->mipmap[curmap];
+ if (hbuf->x == 1 && hbuf->y == 1) break;
curmap++;
- minsize= hbuf->x<hbuf->y?hbuf->x:hbuf->y;
}
}
-#endif
-void IMB_makemipmap(ImBuf *ibuf, int use_filter, int SAT)
-{
- if (SAT) {
- // to maximize precision subtract image average, use intermediate double SAT,
- // only convert to float at the end
- const double dv = 1.0/255.0;
- double avg[4] = {0, 0, 0, 0};
- const int x4 = ibuf->x << 2;
- int x, y, i;
- ImBuf* sbuf = IMB_allocImBuf(ibuf->x, ibuf->y, 32, IB_rectfloat, 0);
- double *satp, *satbuf = MEM_callocN(sizeof(double)*ibuf->x*ibuf->y*4, "tmp SAT buf");
- const double mf = ibuf->x*ibuf->y;
- float* fp;
- ibuf->mipmap[0] = sbuf;
- if (ibuf->rect_float) {
- fp = ibuf->rect_float;
- for (y=0; y<ibuf->y; ++y)
- for (x=0; x<ibuf->x; ++x) {
- avg[0] += *fp++;
- avg[1] += *fp++;
- avg[2] += *fp++;
- avg[3] += *fp++;
- }
- }
- else {
- char* cp = (char*)ibuf->rect;
- for (y=0; y<ibuf->y; ++y)
- for (x=0; x<ibuf->x; ++x) {
- avg[0] += *cp++ * dv;
- avg[1] += *cp++ * dv;
- avg[2] += *cp++ * dv;
- avg[3] += *cp++ * dv;
- }
- }
- avg[0] /= mf;
- avg[1] /= mf;
- avg[2] /= mf;
- avg[3] /= mf;
- for (y=0; y<ibuf->y; ++y)
- for (x=0; x<ibuf->x; ++x) {
- const unsigned int p = (x + y*ibuf->x) << 2;
- char* cp = (char*)ibuf->rect + p;
- fp = ibuf->rect_float + p;
- satp = satbuf + p;
- for (i=0; i<4; ++i, ++cp, ++fp, ++satp) {
- double sv = (ibuf->rect_float ? (double)*fp : (double)(*cp)*dv) - avg[i];
- if (x > 0) sv += satp[-4];
- if (y > 0) sv += satp[-x4];
- if (x > 0 && y > 0) sv -= satp[-x4 - 4];
- *satp = sv;
- }
- }
- fp = sbuf->rect_float;
- satp = satbuf;
- for (y=0; y<ibuf->y; ++y)
- for (x=0; x<ibuf->x; ++x) {
- *fp++ = (float)*satp++;
- *fp++ = (float)*satp++;
- *fp++ = (float)*satp++;
- *fp++ = (float)*satp++;
- }
- MEM_freeN(satbuf);
- fp = &sbuf->rect_float[(sbuf->x - 1 + (sbuf->y - 1)*sbuf->x) << 2];
- fp[0] = avg[0];
- fp[1] = avg[1];
- fp[2] = avg[2];
- fp[3] = avg[3];
- }
- else {
- ImBuf *hbuf = ibuf;
- int curmap = 0;
- while (curmap < IB_MIPMAP_LEVELS) {
- if (use_filter) {
- ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0);
- IMB_filterN(nbuf, hbuf);
- ibuf->mipmap[curmap] = IMB_onehalf(nbuf);
- IMB_freeImBuf(nbuf);
- }
- else ibuf->mipmap[curmap] = IMB_onehalf(hbuf);
- hbuf = ibuf->mipmap[curmap];
- if (hbuf->x == 1 && hbuf->y == 1) break;
- curmap++;
- }
- }
-}
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 7ee31ff7d9a..5a31a705591 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -62,13 +62,13 @@
* Local declarations. *
***********************/
/* Reading and writing of an in-memory TIFF file. */
-tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n);
-tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n);
-toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence);
-int imb_tiff_CloseProc(thandle_t handle);
-toff_t imb_tiff_SizeProc(thandle_t handle);
-int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize);
-void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size);
+static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n);
+static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n);
+static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence);
+static int imb_tiff_CloseProc(thandle_t handle);
+static toff_t imb_tiff_SizeProc(thandle_t handle);
+static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize);
+static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size);
/* Structure for in-memory TIFF file. */
@@ -86,11 +86,11 @@ struct ImbTIFFMemFile {
*****************************/
-void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
{
}
-int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
{
return (0);
}
@@ -105,7 +105,7 @@ int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
* @return: Number of bytes actually read.
* 0 = EOF.
*/
-tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
+static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
{
tsize_t nRemaining, nCopy;
struct ImbTIFFMemFile* mfile;
@@ -147,7 +147,7 @@ tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
* NOTE: The current Blender implementation should not need this function. It
* is simply a stub.
*/
-tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n)
+static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n)
{
printf("imb_tiff_WriteProc: this function should not be called.\n");
return (-1);
@@ -169,7 +169,7 @@ tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n)
* @return: Resulting offset location within the file, measured in bytes from
* the beginning of the file. (-1) indicates an error.
*/
-toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
+static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
{
struct ImbTIFFMemFile *mfile;
toff_t new_offset;
@@ -216,7 +216,7 @@ toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
*
* @return: 0
*/
-int imb_tiff_CloseProc(thandle_t handle)
+static int imb_tiff_CloseProc(thandle_t handle)
{
struct ImbTIFFMemFile *mfile;
@@ -242,7 +242,7 @@ int imb_tiff_CloseProc(thandle_t handle)
*
* @return: Size of file (in bytes).
*/
-toff_t imb_tiff_SizeProc(thandle_t handle)
+static toff_t imb_tiff_SizeProc(thandle_t handle)
{
struct ImbTIFFMemFile* mfile;
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 3212ff7b534..5d80936d2cc 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -335,8 +335,6 @@ typedef struct TexMapping {
#define TXF_EWA 1
#define TXF_FELINE 2
#define TXF_AREA 3
-// TXF_SAT only available when mipmaps disabled
-#define TXF_SAT 4
/* imaflag unused, only for version check */
#define TEX_FIELDS_ 8
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index b5a4ac5db8c..8a432002d2b 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -48,7 +48,6 @@ static EnumPropertyItem texture_filter_items[] = {
{TXF_EWA, "EWA", 0, "EWA", ""},
{TXF_FELINE, "FELINE", 0, "FELINE", ""},
{TXF_AREA, "AREA", 0, "Area", ""},
- {TXF_SAT, "SAT", 0, "SAT (4x mem)", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem texture_type_items[] = {
@@ -327,26 +326,8 @@ static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value)
if(value) tex->imaflag |= TEX_MIPMAP;
else tex->imaflag &= ~TEX_MIPMAP;
- if((tex->imaflag & TEX_MIPMAP) && tex->texfilter == TXF_SAT)
- tex->texfilter = TXF_EWA;
-}
-
-static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA *ptr, int *free)
-{
- Tex *tex= (Tex*)ptr->data;
- EnumPropertyItem *item= NULL;
- int totitem= 0;
-
- RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_BOX);
- RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_EWA);
- RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_FELINE);
- RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_AREA);
if(tex->imaflag & TEX_MIPMAP)
- RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_SAT);
-
- *free= 1;
-
- return item;
+ tex->texfilter = TXF_EWA;
}
static void rna_Envmap_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -695,7 +676,6 @@ static void rna_def_filter_common(StructRNA *srna)
prop= RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "texfilter");
RNA_def_property_enum_items(prop, texture_filter_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageTexture_filter_itemf");
RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
RNA_def_property_update(prop, 0, "rna_Texture_update");
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index cf0a01576d8..8abde533028 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -417,107 +417,6 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
}
-// used in SAT_get_color_bilerp() below
-static void SAT_getcol(float* col, ImBuf* ibuf, int x, int y)
-{
- if ((x == (ibuf->x - 1)) && (y == (ibuf->y - 1))) { // avg val pos
- col[0] = col[1] = col[2] = col[3] = 0.f;
- return;
- }
- ibuf_get_color(col, ibuf, x, y);
-}
-
-// used in boxsampleclip_SAT() below
-static void SAT_get_color_bilerp(float *col, ImBuf *ibuf, float u, float v)
-{
- float c00[4], c01[4], c10[4], c11[4];
- const float ufl = floorf(u -= 0.5f), vfl = floorf(v -= 0.5f);
- const float uf = u - ufl, vf = v - vfl;
- const float w00=(1.f-uf)*(1.f-vf), w10=uf*(1.f-vf), w01=(1.f-uf)*vf, w11=uf*vf;
- int x1 = (int)ufl, y1 = (int)vfl, x2 = x1 + 1, y2 = y1 + 1;
- x1 = (x1 < 0) ? 0 : (x1 >= ibuf->x ? ibuf->x - 1 : x1);
- x2 = (x2 < 0) ? 0 : (x2 >= ibuf->x ? ibuf->x - 1 : x2);
- y1 = (y1 < 0) ? 0 : (y1 >= ibuf->y ? ibuf->y - 1 : y1);
- y2 = (y2 < 0) ? 0 : (y2 >= ibuf->y ? ibuf->y - 1 : y2);
- SAT_getcol(c00, ibuf, x1, y1);
- SAT_getcol(c10, ibuf, x2, y1);
- SAT_getcol(c01, ibuf, x1, y2);
- SAT_getcol(c11, ibuf, x2, y2);
- col[0] = w00*c00[0] + w10*c10[0] + w01*c01[0] + w11*c11[0];
- col[1] = w00*c00[1] + w10*c10[1] + w01*c01[1] + w11*c11[1];
- col[2] = w00*c00[2] + w10*c10[2] + w01*c01[2] + w11*c11[2];
- col[3] = w00*c00[3] + w10*c10[3] + w01*c01[3] + w11*c11[3];
-}
-
-static void boxsampleclip_SAT(ImBuf *ibuf, rctf *rf, TexResult *texres, int intpol)
-{
- float div, col[4];
- if (intpol) {
- div = 1.f/((rf->xmax - rf->xmin + 1.f)*(rf->ymax - rf->ymin + 1.f));
- SAT_get_color_bilerp(&texres->tr, ibuf, rf->xmax, rf->ymax);
- if (rf->ymin >= 1.f) {
- SAT_get_color_bilerp(col, ibuf, rf->xmax, rf->ymin - 1.f);
- texres->tr -= col[0];
- texres->tg -= col[1];
- texres->tb -= col[2];
- texres->ta -= col[3];
- }
- if (rf->xmin >= 1.f) {
- SAT_get_color_bilerp(col, ibuf, rf->xmin - 1.f, rf->ymax);
- texres->tr -= col[0];
- texres->tg -= col[1];
- texres->tb -= col[2];
- texres->ta -= col[3];
- }
- if (rf->xmin >= 1.f && rf->ymin >= 1.f) {
- SAT_get_color_bilerp(col, ibuf, rf->xmin - 1.f, rf->ymin - 1.f);
- texres->tr += col[0];
- texres->tg += col[1];
- texres->tb += col[2];
- texres->ta += col[3];
- }
- }
- else {
- int startx = (int)floorf(rf->xmin);
- int endx = (int)floorf(rf->xmax);
- int starty = (int)floorf(rf->ymin);
- int endy = (int)floorf(rf->ymax);
- if (startx < 0) startx = 0;
- if (starty < 0) starty = 0;
- if (endx >= ibuf->x) endx = ibuf->x - 1;
- if (endy >= ibuf->y) endy = ibuf->y - 1;
- div = 1.f/((endx - startx + 1)*(endy - starty + 1));
- SAT_getcol(&texres->tr, ibuf, endx, endy);
- if (starty >= 1) {
- SAT_getcol(col, ibuf, endx, starty - 1);
- texres->tr -= col[0];
- texres->tg -= col[1];
- texres->tb -= col[2];
- texres->ta -= col[3];
- }
- if (startx >= 1) {
- SAT_getcol(col, ibuf, startx - 1, endy);
- texres->tr -= col[0];
- texres->tg -= col[1];
- texres->tb -= col[2];
- texres->ta -= col[3];
- }
- if (startx >=1 && starty >= 1) {
- SAT_getcol(col, ibuf, startx - 1, starty - 1);
- texres->tr += col[0];
- texres->tg += col[1];
- texres->tb += col[2];
- texres->ta += col[3];
- }
- }
- // avg
- ibuf_get_color(col, ibuf, ibuf->x - 1, ibuf->y - 1);
- texres->tr = texres->tr*div + col[0];
- texres->tg = texres->tg*div + col[1];
- texres->tb = texres->tb*div + col[2];
- texres->ta = texres->ta*div + col[3];
-}
-
static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
{
/* sample box, is clipped already, and minx etc. have been set at ibuf size.
@@ -601,7 +500,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
}
}
-static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int SAT, int intpol)
+static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int intpol)
{
/* Sample box, performs clip. minx etc are in range 0.0 - 1.0 .
* Enlarge with antialiased edges of pixels.
@@ -655,10 +554,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
if(count>1) {
tot= texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
while(count--) {
- if (SAT)
- boxsampleclip_SAT(ibuf, rf, &texr, intpol);
- else
- boxsampleclip(ibuf, rf, &texr);
+ boxsampleclip(ibuf, rf, &texr);
opp= square_rctf(rf);
tot+= opp;
@@ -676,12 +572,8 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
if(texres->talpha) texres->ta/= tot;
}
}
- else {
- if (SAT)
- boxsampleclip_SAT(ibuf, rf, texres, intpol);
- else
- boxsampleclip(ibuf, rf, texres);
- }
+ else
+ boxsampleclip(ibuf, rf, texres);
if(texres->talpha==0) texres->ta= 1.0;
@@ -707,7 +599,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect+= (ibuf->x*ibuf->y);
- boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0, 0);
+ boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0);
result[0]= texres.tr;
result[1]= texres.tg;
result[2]= texres.tb;
@@ -726,7 +618,7 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res
}
memset(&texres, 0, sizeof(texres));
- boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0, 0);
+ boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0);
result[0]= texres.tr;
result[1]= texres.tg;
result[2]= texres.tb;
@@ -1148,7 +1040,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
if (tex->imaflag & TEX_MIPMAP) {
if (((ibuf->flags & IB_fields) == 0) && (ibuf->mipmap[0] == NULL)) {
BLI_lock_thread(LOCK_IMAGE);
- if (ibuf->mipmap[0] == NULL) IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP, 0);
+ if (ibuf->mipmap[0] == NULL) IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
BLI_unlock_thread(LOCK_IMAGE);
}
}
@@ -1505,7 +1397,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
TexResult texr;
float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[3], dyt[3];
float maxd, pixsize, val1, val2, val3;
- int curmap, retval, imaprepeat, imapextend, SAT = (tex->texfilter == TXF_SAT);
+ int curmap, retval, imaprepeat, imapextend;
// TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call,
// make a local copy here so that original vecs remain untouched
@@ -1513,7 +1405,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
VECCOPY(dyt, DYT);
// anisotropic filtering
- if (!SAT && (tex->texfilter != TXF_BOX))
+ if (tex->texfilter != TXF_BOX)
return imagewraposa_aniso(tex, ima, ibuf, texvec, dxt, dyt, texres);
texres->tin= texres->ta= texres->tr= texres->tg= texres->tb= 0.0f;
@@ -1536,13 +1428,13 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
return retval;
/* mipmap test */
- if (SAT || tex->imaflag & TEX_MIPMAP) {
+ if (tex->imaflag & TEX_MIPMAP) {
if(ibuf->flags & IB_fields);
else if(ibuf->mipmap[0]==NULL) {
BLI_lock_thread(LOCK_IMAGE);
if(ibuf->mipmap[0]==NULL)
- IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP, SAT);
+ IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
BLI_unlock_thread(LOCK_IMAGE);
}
@@ -1754,11 +1646,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
//minx*= 1.35f;
//miny*= 1.35f;
- boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0, 0);
+ boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
val1= texres->tr+texres->tg+texres->tb;
- boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0, 0);
+ boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0);
val2= texr.tr + texr.tg + texr.tb;
- boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0, 0);
+ boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0);
val3= texr.tr + texr.tg + texr.tb;
/* don't switch x or y! */
@@ -1767,7 +1659,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
if(previbuf!=curibuf) { /* interpolate */
- boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0, 0);
+ boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0);
/* calc rgb */
dx= 2.0f*(pixsize-maxd)/pixsize;
@@ -1784,9 +1676,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
}
val1= dy*val1+ dx*(texr.tr + texr.tg + texr.tb);
- boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0, 0);
+ boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0);
val2= dy*val2+ dx*(texr.tr + texr.tg + texr.tb);
- boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0, 0);
+ boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0);
val3= dy*val3+ dx*(texr.tr + texr.tg + texr.tb);
texres->nor[0]= (val1-val2); /* vals have been interpolated above! */
@@ -1809,10 +1701,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
maxy= fy+miny;
miny= fy-miny;
- boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0, 0);
+ boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0);
if(previbuf!=curibuf) { /* interpolate */
- boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0, 0);
+ boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0);
fx= 2.0f*(pixsize-maxd)/pixsize;
@@ -1831,39 +1723,26 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
}
else {
const int intpol = tex->imaflag & TEX_INTERPOL;
- if (intpol && !SAT) {
+ if (intpol) {
/* sample 1 pixel minimum */
if (minx < 0.5f / ibuf->x) minx = 0.5f / ibuf->x;
if (miny < 0.5f / ibuf->y) miny = 0.5f / ibuf->y;
}
if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
- if (SAT) {
- boxsample(ibuf->mipmap[0], fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 1, intpol);
- val1 = texres->tr + texres->tg + texres->tb;
- boxsample(ibuf->mipmap[0], fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 1, intpol);
- val2 = texr.tr + texr.tg + texr.tb;
- boxsample(ibuf->mipmap[0], fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 1, intpol);
- val3 = texr.tr + texr.tg + texr.tb;
- }
- else {
- boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0, 0);
- val1= texres->tr+texres->tg+texres->tb;
- boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0, 0);
- val2= texr.tr + texr.tg + texr.tb;
- boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0, 0);
- val3= texr.tr + texr.tg + texr.tb;
- }
+ boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
+ val1= texres->tr+texres->tg+texres->tb;
+ boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0);
+ val2= texr.tr + texr.tg + texr.tb;
+ boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0);
+ val3= texr.tr + texr.tg + texr.tb;
+
/* don't switch x or y! */
texres->nor[0]= (val1-val2);
texres->nor[1]= (val1-val3);
}
- else {
- if (SAT)
- boxsample(ibuf->mipmap[0], fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 1, intpol);
- else
- boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0, 0);
- }
+ else
+ boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
}
BRICONTRGB;