int ofs, x, y;
char *rect;
+ Tin= Ta= Tr= Tg= Tb= 0.0;
ima= tex->ima;
-
if(ima==0 || ima->ok== 0) {
- Tin= Ta= Tr= Tg= Tb= 0.0;
return 0;
}
if(ima->ibuf==0) ima_ibuf_is_nul(tex);
if (ima->ok) {
-
ibuf = ima->ibuf;
if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
fy= texvec[1];
}
+ if(tex->extend == TEX_CHECKER) {
+ int xs, ys;
+
+ xs= (int)floor(fx);
+ ys= (int)floor(fy);
+ fx-= xs;
+ fy-= ys;
+
+ if( (tex->flag & TEX_CHECKER_ODD)==0) {
+ if((xs+ys) & 1);else return 0;
+ }
+ if( (tex->flag & TEX_CHECKER_EVEN)==0) {
+ if((xs+ys) & 1) return 0;
+ }
+ /* scale around center, (0.5, 0.5) */
+ if(tex->checkerdist<1.0) {
+ fx= (fx-0.5)/(1.0-tex->checkerdist) +0.5;
+ fy= (fy-0.5)/(1.0-tex->checkerdist) +0.5;
+ }
+ }
+
x = (int)(fx*ibuf->x);
y = (int)(fy*ibuf->y);
if(tex->extend == TEX_CLIPCUBE) {
if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0 || texvec[2]>1.0) {
- Tin= 0;
return 0;
}
}
- else if(tex->extend == TEX_CLIP) {
+ else if( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
- Tin= 0;
return 0;
}
}
imaprepeat= (tex->extend==TEX_REPEAT);
imapextend= (tex->extend==TEX_EXTEND);
+ if(tex->extend == TEX_CHECKER) {
+ int xs, ys, xs1, ys1, xs2, ys2, boundary;
+
+ xs= (int)floor(fx);
+ ys= (int)floor(fy);
+
+ // both checkers available, no boundary exceptions, checkerdist will eat aliasing
+ if( (tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN) ) {
+ fx-= xs;
+ fy-= ys;
+ }
+ else {
+
+ xs1= (int)floor(fx-minx);
+ ys1= (int)floor(fy-miny);
+ xs2= (int)floor(fx+minx);
+ ys2= (int)floor(fy+miny);
+ boundary= (xs1!=xs2) || (ys1!=ys2);
+
+ if(boundary==0) {
+ if( (tex->flag & TEX_CHECKER_ODD)==0) {
+ if((xs+ys) & 1);
+ else return 0;
+ }
+ if( (tex->flag & TEX_CHECKER_EVEN)==0) {
+ if((xs+ys) & 1) return 0;
+ }
+ fx-= xs;
+ fy-= ys;
+ }
+ else {
+ if(tex->flag & TEX_CHECKER_ODD) {
+ if((xs1+ys) & 1) fx-= xs2;
+ else fx-= xs1;
+
+ if((ys1+xs) & 1) fy-= ys2;
+ else fy-= ys1;
+ }
+ if(tex->flag & TEX_CHECKER_EVEN) {
+ if((xs1+ys) & 1) fx-= xs1;
+ else fx-= xs2;
+
+ if((ys1+xs) & 1) fy-= ys1;
+ else fy-= ys2;
+ }
+ }
+ }
+
+ /* scale around center, (0.5, 0.5) */
+ if(tex->checkerdist<1.0) {
+ fx= (fx-0.5)/(1.0-tex->checkerdist) +0.5;
+ fy= (fy-0.5)/(1.0-tex->checkerdist) +0.5;
+ minx/= (1.0-tex->checkerdist);
+ miny/= (1.0-tex->checkerdist);
+ }
+ }
if(tex->extend == TEX_CLIPCUBE) {
if(fx+minx<0.0 || fy+miny<0.0 || fx-minx>1.0 || fy-miny>1.0 || texvec[2]<-1.0 || texvec[2]>1.0) {
- Tin= 0;
return 0;
}
}
- else if(tex->extend == TEX_CLIP) {
+ else if(tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
if(fx+minx<0.0 || fy+miny<0.0 || fx-minx>1.0 || fy-miny>1.0) {
- Tin= 0.0;
return 0;
}
}
BRICONRGB;
if(tex->imaflag & TEX_CALCALPHA) {
- Ta= Tin= MAX3(Tr, Tg, Tb);
+ Ta= Tin= Ta*MAX3(Tr, Tg, Tb);
}
else Tin= Ta;
if(tex->flag & TEX_NEGALPHA) Ta= 1.0f-Ta;
uiDefButF(block, NUM, B_TEXPRV, "Filter :", 10,92,150,19, &tex->filtersize, 0.1, 25.0, 0, 0, "Sets the filter size used by mipmap and interpol");
uiBlockBeginAlign(block);
- uiDefButS(block, ROW, 0, "Extend", 10,70,75,19, &tex->extend, 4.0, 1.0, 0, 0, "Extends the colour of the edge pixels");
- uiDefButS(block, ROW, 0, "Clip", 85,70,75,19, &tex->extend, 4.0, 2.0, 0, 0, "Sets alpha 0.0 outside Image edges");
- uiDefButS(block, ROW, 0, "ClipCube", 160,70,75,19, &tex->extend, 4.0, 4.0, 0, 0, "Sets alpha to 0.0 outside cubeshaped area around Image");
- uiDefButS(block, ROW, 0, "Repeat", 235,70,75,19, &tex->extend, 4.0, 3.0, 0, 0, "Causes Image to repeat horizontally and vertically");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_TEXPRV, "Xrepeat:", 10,50,150,19, &tex->xrepeat, 1.0, 512.0, 0, 0, "Sets a repetition multiplier in the X direction");
- uiDefButS(block, NUM, B_TEXPRV, "Yrepeat:", 160,50,150,19, &tex->yrepeat, 1.0, 512.0, 0, 0, "Sets a repetition multiplier in the Y direction");
+ uiDefButS(block, ROW, B_TEXREDR_PRV, "Extend", 10,70,63,19, &tex->extend, 4.0, 1.0, 0, 0, "Extends the colour of the edge pixels");
+ uiDefButS(block, ROW, B_TEXREDR_PRV, "Clip", 73,70,48,19, &tex->extend, 4.0, 2.0, 0, 0, "Sets alpha 0.0 outside Image edges");
+ uiDefButS(block, ROW, B_TEXREDR_PRV, "ClipCube", 121,70,63,19, &tex->extend, 4.0, 4.0, 0, 0, "Sets alpha to 0.0 outside cubeshaped area around Image");
+ uiDefButS(block, ROW, B_TEXREDR_PRV, "Repeat", 184,70,63,19, &tex->extend, 4.0, 3.0, 0, 0, "Causes Image to repeat horizontally and vertically");
+ uiDefButS(block, ROW, B_TEXREDR_PRV, "Checker", 247,70,63,19, &tex->extend, 4.0, 5.0, 0, 0, "Causes Image to repeat in checker pattern");
+
+ if(tex->extend==TEX_REPEAT) {
+ uiBlockBeginAlign(block);
+ uiDefButS(block, NUM, B_TEXPRV, "Xrepeat:", 10,50,150,19, &tex->xrepeat, 1.0, 512.0, 0, 0, "Sets a repetition multiplier in the X direction");
+ uiDefButS(block, NUM, B_TEXPRV, "Yrepeat:", 160,50,150,19, &tex->yrepeat, 1.0, 512.0, 0, 0, "Sets a repetition multiplier in the Y direction");
+ }
+ else if(tex->extend==TEX_CHECKER) {
+ uiBlockBeginAlign(block);
+ uiDefButS(block, TOG|BIT|3, B_TEXPRV, "Odd", 10,50,100,19, &tex->flag, 0.0, 0.0, 0, 0, "Sets odd checker tiles");
+ uiDefButS(block, TOG|BIT|4, B_TEXPRV, "Even", 110,50,100,19, &tex->flag, 0.0, 0.0, 0, 0, "Sets even checker tiles");
+ uiDefButF(block, NUM, B_TEXPRV, "Mortar:", 210,50,100,19, &tex->checkerdist, 0.0, 0.99, 0, 0, "Set checkers distance (like mortar)");
+ }
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_REDR, "MinX ", 10,28,150,19, &tex->cropxmin, -10.0, 10.0, 10, 0, "Sets minimum X value to crop Image");
uiDefButF(block, NUM, B_REDR, "MinY ", 10,8,150,19, &tex->cropymin, -10.0, 10.0, 10, 0, "Sets minimum Y value to crop Image");
+
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_REDR, "MaxX ", 160,28,150,19, &tex->cropxmax, -10.0, 10.0, 10, 0, "Sets maximum X value to crop Image");
uiDefButF(block, NUM, B_REDR, "MaxY ", 160,8,150,19, &tex->cropymax, -10.0, 10.0, 10, 0, "Sets maximum Y value to crop Image");
uiBlockBeginAlign(block);
if ELEM(la->type, LA_LOCAL, LA_SPOT) {
uiDefButF(block, NUMSLI,B_MATPRV,"Quad1 ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the linear distance attenuatation for a quad lamp");
- uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the qudratic distance attenuatation for a quad lamp");
+ uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the quadratic distance attenuatation for a quad lamp");
}
else if(la->type==LA_AREA) {
if(la->k==0.0) la->k= 1.0;