* Make EWA new default, rename Default to Box.
* Fix windows compile issue in texture filter code.
This commit is contained in:
2009-07-22 17:20:04 +00:00
parent 8b5fbbec80
commit 94518b6308
5 changed files with 12 additions and 12 deletions

View File

@@ -442,7 +442,7 @@ void default_tex(Tex *tex)
tex->extend= TEX_REPEAT;
tex->cropxmin= tex->cropymin= 0.0;
tex->cropxmax= tex->cropymax= 1.0;
tex->texfilter = TXF_DEFAULT;
tex->texfilter = TXF_EWA;
tex->afmax = 8;
tex->xrepeat= tex->yrepeat= 1;
tex->fie_ima= 2;

View File

@@ -256,8 +256,8 @@ typedef struct TexMapping {
#define TEX_FILTER_MIN 8192
/* texfilter */
// TXF_DEFAULT -> blender's old texture filtering method
#define TXF_DEFAULT 0
// TXF_BOX -> blender's old texture filtering method
#define TXF_BOX 0
#define TXF_EWA 1
#define TXF_FELINE 2
#define TXF_AREA 3

View File

@@ -40,7 +40,7 @@
#include "WM_types.h"
static EnumPropertyItem texture_filter_items[] = {
{TXF_DEFAULT, "DEFAULT", 0, "Default", ""},
{TXF_BOX, "BOX", 0, "Box", ""},
{TXF_EWA, "EWA", 0, "EWA", ""},
{TXF_FELINE, "FELINE", 0, "FELINE", ""},
{TXF_AREA, "AREA", 0, "Area", ""},
@@ -126,7 +126,7 @@ static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value)
else tex->imaflag &= ~TEX_MIPMAP;
if((tex->imaflag & TEX_MIPMAP) && tex->texfilter == TXF_SAT)
tex->texfilter = TXF_DEFAULT;
tex->texfilter = TXF_EWA;
}
static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA *ptr, int *free)
@@ -135,7 +135,7 @@ static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA *
EnumPropertyItem *item= NULL;
int totitem= 0;
RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_DEFAULT);
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);

View File

@@ -1342,7 +1342,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
b *= ff;
}
maxd = MAX2(b, 1e-8f);
levf = logf(maxd)*(float)M_LOG2E;
levf = ((float)M_LOG2E)*logf(maxd);
curmap = 0;
maxlev = 1;
@@ -1503,7 +1503,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
VECCOPY(dyt, DYT);
// anisotropic filtering
if (!SAT && (tex->texfilter != TXF_DEFAULT))
if (!SAT && (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;

View File

@@ -1107,7 +1107,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
float origf= fx *= tex->xrepeat;
// TXF: omit mirror here, see comments in do_material_tex() after do_2d_mapping() call
if (tex->texfilter == TXF_DEFAULT) {
if (tex->texfilter == TXF_BOX) {
if(fx>1.0f) fx -= (int)(fx);
else if(fx<0.0f) fx+= 1-(int)(fx);
@@ -1127,7 +1127,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
float origf= fy *= tex->yrepeat;
// TXF: omit mirror here, see comments in do_material_tex() after do_2d_mapping() call
if (tex->texfilter == TXF_DEFAULT) {
if (tex->texfilter == TXF_BOX) {
if(fy>1.0f) fy -= (int)(fy);
else if(fy<0.0f) fy+= 1-(int)(fy);
@@ -1545,7 +1545,7 @@ static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, floa
// textures are scaled (sizeXYZ) as well as repeated. See also modification in do_2d_mapping().
// (since currently only done in osa mode, results will look incorrect without osa TODO)
if (tex->extend == TEX_REPEAT && (tex->flag & TEX_REPEAT_XMIR)) {
if (tex->texfilter == TXF_DEFAULT)
if (tex->texfilter == TXF_BOX)
texvec[0] -= floorf(texvec[0]); // this line equivalent to old code, same below
else if (texvec[0] < 0.f || texvec[0] > 1.f) {
const float tx = 0.5f*texvec[0];
@@ -1554,7 +1554,7 @@ static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, floa
}
}
if (tex->extend == TEX_REPEAT && (tex->flag & TEX_REPEAT_YMIR)) {
if (tex->texfilter == TXF_DEFAULT)
if (tex->texfilter == TXF_BOX)
texvec[1] -= floorf(texvec[1]);
else if (texvec[1] < 0.f || texvec[1] > 1.f) {
const float ty = 0.5f*texvec[1];