60 const short imaprepeat,
61 const short imapextend);
68 int ofs =
y * ibuf->
x +
x;
86 const char *rect = (
char *)(ibuf->
rect + ofs);
88 col[0] = ((
float)rect[0]) * (1.0f / 255.0f);
89 col[1] = ((
float)rect[1]) * (1.0f / 255.0f);
90 col[2] = ((
float)rect[2]) * (1.0f / 255.0f);
91 col[3] = ((
float)rect[3]) * (1.0f / 255.0f);
102 const float texvec[3],
105 const bool skip_load_image)
107 float fx, fy, val1, val2, val3;
111 texres->
tin = texres->
ta = texres->
tr = texres->
tg = texres->
tb = 0.0f;
131 iuser = &local_iuser;
195 if (
x < 0 || y < 0 || x >= ibuf->
x ||
y >= ibuf->
y || texvec[2] < -1.0f || texvec[2] > 1.0f) {
203 if (
x < 0 || y < 0 || x >= ibuf->
x ||
y >= ibuf->
y) {
252 float filterx, filtery;
260 fy -= (
float)(yi -
y) / (
float)ibuf->
y;
284 texres->
nor[0] = -2.0f * (texres->
tr - 0.5f);
285 texres->
nor[1] = 2.0f * (texres->
tg - 0.5f);
286 texres->
nor[2] = 2.0f * (texres->
tb - 0.5f);
290 val1 = texres->
tr + texres->
tg + texres->
tb;
292 if (x < ibuf->
x - 1) {
301 if (y < ibuf->
y - 1) {
311 texres->
nor[0] = (val1 - val2);
312 texres->
nor[1] = (val1 - val3);
317 texres->
tin = texres->
ta;
323 texres->
ta = texres->
tin = 1.0;
327 texres->
ta = 1.0f - texres->
ta;
333 fx = 1.0f / texres->
ta;
365 newrct = stack + *
count;
389 newrct = stack + *
count;
425 newrct = stack + *
count;
440 else if (rf->
ymax > y2) {
449 newrct = stack + *
count;
527 float muly, mulx, div,
col[4];
528 int x,
y, startx, endx, starty, endy;
541 if (endx >= ibuf->
x) {
544 if (endy >= ibuf->
y) {
548 if (starty == endy && startx == endx) {
552 div = texres->
tr = texres->
tg = texres->
tb = texres->
ta = 0.0;
553 for (
y = starty;
y <= endy;
y++) {
557 if (starty == endy) {
562 muly = 1.0f - (rf->
ymin -
y);
565 muly = (rf->
ymax -
y);
569 if (startx == endx) {
574 texres->
ta += mulx *
col[3];
575 texres->
tr += mulx *
col[0];
576 texres->
tg += mulx *
col[1];
577 texres->
tb += mulx *
col[2];
581 for (
x = startx;
x <= endx;
x++) {
584 mulx *= 1.0f - (rf->
xmin -
x);
587 mulx *= (rf->
xmax -
x);
593 texres->
ta +=
col[3];
594 texres->
tr +=
col[0];
595 texres->
tg +=
col[1];
596 texres->
tb +=
col[2];
600 texres->
ta += mulx *
col[3];
601 texres->
tr += mulx *
col[0];
602 texres->
tg += mulx *
col[1];
603 texres->
tb += mulx *
col[2];
618 texres->
tr = texres->
tg = texres->
tb = texres->
ta = 0.0f;
629 const short imaprepeat,
630 const short imapextend)
644 float opp, tot, alphaclip = 1.0;
648 rf->
xmin = minx * (ibuf->
x);
649 rf->
xmax = maxx * (ibuf->
x);
650 rf->
ymin = miny * (ibuf->
y);
651 rf->
ymax = maxy * (ibuf->
y);
659 else if (imaprepeat) {
665 if (alphaclip <= 0.0f) {
666 texres->
tr = texres->
tb = texres->
tg = texres->
ta = 0.0;
675 else if (imaprepeat) {
679 alphaclip *=
clipy_rctf(rf, 0.0, (
float)(ibuf->
y));
681 if (alphaclip <= 0.0f) {
682 texres->
tr = texres->
tb = texres->
tg = texres->
ta = 0.0;
688 tot = texres->
tr = texres->
tb = texres->
tg = texres->
ta = 0.0;
695 texres->
tr += opp * texr.
tr;
696 texres->
tg += opp * texr.
tg;
697 texres->
tb += opp * texr.
tb;
699 texres->
ta += opp * texr.
ta;
716 if (texres->
talpha == 0) {
720 if (alphaclip != 1.0f) {
722 texres->
tr *= alphaclip;
723 texres->
tg *= alphaclip;
724 texres->
tb *= alphaclip;
725 texres->
ta *= alphaclip;
755 x +=
x < 0 ? 2 * ibuf->
x : 0;
756 x =
x >= ibuf->
x ? 2 * ibuf->
x -
x - 1 :
x;
758 y +=
y < 0 ? ibuf->
y : 0;
762 x +=
x < 0 ? ibuf->
x : 0;
764 y +=
y < 0 ? 2 * ibuf->
y : 0;
765 y =
y >= ibuf->
y ? 2 * ibuf->
y -
y - 1 :
y;
768 x = (
x < 0) ? 0 : ((
x >= ibuf->
x) ? (ibuf->
x - 1) :
x);
769 y = (
y < 0) ? 0 : ((
y >= ibuf->
y) ? (ibuf->
y - 1) :
y);
773 x += (
x < 0) ? ibuf->
x : 0;
775 y += (
y < 0) ? ibuf->
y : 0;
802 col[3] = clip ? 0.0f : (ibuf->
channels == 4 ? fp[3] : 1.0f);
806 const char *rect = (
char *)(ibuf->
rect +
x +
y * ibuf->
x);
807 float inv_alpha_fac = (1.0f / 255.0f) * rect[3] * (1.0f / 255.0f);
808 col[0] = rect[0] * inv_alpha_fac;
809 col[1] = rect[1] * inv_alpha_fac;
810 col[2] = rect[2] * inv_alpha_fac;
811 col[3] = clip ? 0.0f : rect[3] * (1.0f / 255.0f);
818 float col[4],
ImBuf *ibuf,
float u,
float v,
int intpol,
int extflag)
821 float c00[4], c01[4], c10[4], c11[4];
822 const float ufl =
floorf(u -= 0.5f), vfl =
floorf(
v -= 0.5f);
823 const float uf = u - ufl, vf =
v - vfl;
824 const float w00 = (1.0f - uf) * (1.0f - vf), w10 = uf * (1.0f - vf), w01 = (1.0f - uf) * vf,
826 const int x1 = (int)ufl,
y1 = (
int)vfl,
x2 = x1 + 1, y2 =
y1 + 1;
831 col[0] = w00 * c00[0] + w10 * c10[0] + w01 * c01[0] + w11 * c11[0];
832 col[1] = w00 * c00[1] + w10 * c10[1] + w01 * c01[1] + w11 * c11[1];
833 col[2] = w00 * c00[2] + w10 * c10[2] + w01 * c01[2] + w11 * c11[2];
834 col[3] = clip ? 0.0f : w00 * c00[3] + w10 * c10[3] + w01 * c01[3] + w11 * c11[3];
842 int xs, ys, clip = 0;
843 float tc[4], xsd, ysd, cw = 0.0f;
844 const float ux = ibuf->
x * AFD->
dxt[0], uy = ibuf->
y * AFD->
dxt[1];
845 const float vx = ibuf->
x * AFD->
dyt[0], vy = ibuf->
y * AFD->
dyt[1];
846 int xsam = (int)(0.5f *
sqrtf(ux * ux + uy * uy) + 0.5f);
847 int ysam = (int)(0.5f *
sqrtf(vx * vx + vy * vy) + 0.5f);
848 const int minsam = AFD->
intpol ? 2 : 4;
849 xsam =
CLAMPIS(xsam, minsam, ibuf->
x * 2);
850 ysam =
CLAMPIS(ysam, minsam, ibuf->
y * 2);
853 texr->
tr = texr->
tg = texr->
tb = texr->
ta = 0.0f;
854 for (ys = 0; ys < ysam; ys++) {
855 for (xs = 0; xs < xsam; xs++) {
856 const float su = (xs + ((ys & 1) + 0.5f) * 0.5f) * xsd - 0.5f;
857 const float sv = (ys + ((xs & 1) + 0.5f) * 0.5f) * ysd - 0.5f;
858 const float pu = fx + su * AFD->
dxt[0] + sv * AFD->
dyt[0];
859 const float pv = fy + su * AFD->
dxt[1] + sv * AFD->
dyt[1];
863 cw += out ? 0.0f : 1.0f;
867 texr->
ta += texr->
talpha ? tc[3] : 0.0f;
875 texr->
ta = texr->
talpha ? texr->
ta * xsd : (clip ? cw * xsd : 1.0f);
892 const float uv[2] = {fx, fy};
909 const int maxn = AFD->
iProbes - 1;
912 (maxn ? (
float)maxn : 1.0f);
913 float du = maxn ?
cosf(AFD->
theta) * ll : 0.0f;
914 float dv = maxn ?
sinf(AFD->
theta) * ll : 0.0f;
922 d = texr->
tr = texr->
tb = texr->
tg = texr->
ta = 0.0f;
923 for (n = -maxn; n <= maxn; n += 2) {
925 const float hn = n * 0.5f;
926 const float u = fx + hn * du,
v = fy + hn * dv;
929 const float wt =
expf(n * n *
D);
931 const float wt =
EWA_WTS[(int)(n * n *
D)];
937 texr->
tr += tc[0] * wt;
938 texr->
tg += tc[1] * wt;
939 texr->
tb += tc[2] * wt;
940 texr->
ta += texr->
talpha ? tc[3] * wt : 0.0f;
949 texr->
ta = texr->
talpha ? texr->
ta * d : 1.0f;
954 ImBuf *ibuf,
float minx,
float miny,
float maxx,
float maxy,
int extflag,
TexResult *texres)
963 rf.
xmin = minx * (ibuf->
x);
964 rf.
xmax = maxx * (ibuf->
x);
965 rf.
ymin = miny * (ibuf->
y);
966 rf.
ymax = maxy * (ibuf->
y);
968 alphaclip =
clipx_rctf(&rf, 0.0, (
float)(ibuf->
x));
969 alphaclip *=
clipy_rctf(&rf, 0.0, (
float)(ibuf->
y));
970 alphaclip =
max_ff(alphaclip, 0.0f);
972 if (alphaclip != 1.0f) {
974 texres->
tr *= alphaclip;
975 texres->
tg *= alphaclip;
976 texres->
tb *= alphaclip;
977 texres->
ta *= alphaclip;
1010 const float texvec[3],
1015 const bool skip_load_image)
1018 float fx, fy, minx, maxx, miny, maxy;
1019 float maxd, val1, val2, val3;
1020 int curmap, retval, intpol, extflag = 0;
1036 texres->
tin = texres->
ta = texres->
tr = texres->
tg = texres->
tb = 0.0f;
1086 minx =
min_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
1087 maxx =
max_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
1088 miny =
min_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
1089 maxy =
max_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
1092 minx = (maxx - minx) * 0.5f;
1093 miny = (maxy - miny) * 0.5f;
1099 if (addval > minx) {
1102 if (addval > miny) {
1117 SWAP(
float, minx, miny);
1131 minx = (minx > 0.25f) ? 0.25f : ((minx < 1e-5f) ? 1e-5f : minx);
1132 miny = (miny > 0.25f) ? 0.25f : ((miny < 1e-5f) ? 1e-5f : miny);
1168 int xs1 = (int)
floorf(fx - minx);
1169 int ys1 = (int)
floorf(fy - miny);
1170 int xs2 = (int)
floorf(fx + minx);
1171 int ys2 = (int)
floorf(fy + miny);
1172 if ((xs1 != xs2) || (ys1 != ys2)) {
1174 fx -= ((xs1 + ys) & 1) ? xs2 : xs1;
1175 fy -= ((ys1 + xs) & 1) ? ys2 : ys1;
1178 fx -= ((xs1 + ys) & 1) ? xs1 : xs2;
1179 fy -= ((ys1 + xs) & 1) ? ys1 : ys2;
1202 fx = (fx - 0.5f) * omcd + 0.5f;
1203 fy = (fy - 0.5f) * omcd + 0.5f;
1210 if ((fx + minx) < 0.0f || (fy + miny) < 0.0f || (fx - minx) > 1.0f || (fy - miny) > 1.0f ||
1211 texvec[2] < -1.0f || texvec[2] > 1.0f) {
1219 if ((fx + minx) < 0.0f || (fy + miny) < 0.0f || (fx - minx) > 1.0f || (fy - miny) > 1.0f) {
1228 fx = (fx > 1.0f) ? 1.0f : ((fx < 0.0f) ? 0.0f : fx);
1229 fy = (fy > 1.0f) ? 1.0f : ((fy < 0.0f) ? 0.0f : fy);
1248 if (AFD.
dxt[0] * AFD.
dxt[0] + AFD.
dxt[1] * AFD.
dxt[1] > 2.0f * 2.0f) {
1251 if (AFD.
dyt[0] * AFD.
dyt[0] + AFD.
dyt[1] * AFD.
dyt[1] > 2.0f * 2.0f) {
1257 ImBuf *previbuf, *curibuf;
1265 const float ff =
sqrtf(ibuf->
x), q = ibuf->
y / ff;
1266 const float Ux = dxt[0] * ff, Vx = dxt[1] * q, Uy = dyt[0] * ff, Vy = dyt[1] * q;
1267 const float A = Vx * Vx + Vy * Vy;
1268 const float B = -2.0f * (Ux * Vx + Uy * Vy);
1269 const float C = Ux * Ux + Uy * Uy;
1270 const float F =
A *
C -
B *
B * 0.25f;
1271 float a, b, th, ecc;
1279 fProbes = 2.0f * (
a / b) - 1.0f;
1288 AFD.
dusc = 1.0f / ff;
1304 mipmaps[curmap + 1] = ibuf->
mipmap[curmap];
1305 if (ibuf->
mipmap[curmap]) {
1313 previbuf = curibuf = mipmaps[0];
1316 else if (levf >= maxlev - 1) {
1317 previbuf = curibuf = mipmaps[maxlev - 1];
1324 const int lev =
isnan(levf) ? 0 : (int)levf;
1325 curibuf = mipmaps[lev];
1326 previbuf = mipmaps[lev + 1];
1334 filterfunc(texres, curibuf, fx, fy, &AFD);
1335 val1 = texres->
tr + texres->
tg + texres->
tb;
1336 filterfunc(&texr, curibuf, fx + dxt[0], fy + dxt[1], &AFD);
1337 val2 = texr.
tr + texr.
tg + texr.
tb;
1338 filterfunc(&texr, curibuf, fx + dyt[0], fy + dyt[1], &AFD);
1339 val3 = texr.
tr + texr.
tg + texr.
tb;
1341 texres->
nor[0] = val1 - val2;
1342 texres->
nor[1] = val1 - val3;
1343 if (previbuf != curibuf) {
1344 filterfunc(&texr, previbuf, fx, fy, &AFD);
1346 texres->
tr += levf * (texr.
tr - texres->
tr);
1347 texres->
tg += levf * (texr.
tg - texres->
tg);
1348 texres->
tb += levf * (texr.
tb - texres->
tb);
1349 texres->
ta += levf * (texr.
ta - texres->
ta);
1351 val1 += levf * ((texr.
tr + texr.
tg + texr.
tb) - val1);
1352 filterfunc(&texr, previbuf, fx + dxt[0], fy + dxt[1], &AFD);
1353 val2 += levf * ((texr.
tr + texr.
tg + texr.
tb) - val2);
1354 filterfunc(&texr, previbuf, fx + dyt[0], fy + dyt[1], &AFD);
1355 val3 += levf * ((texr.
tr + texr.
tg + texr.
tb) - val3);
1356 texres->
nor[0] = val1 - val2;
1357 texres->
nor[1] = val1 - val3;
1361 filterfunc(texres, curibuf, fx, fy, &AFD);
1362 if (previbuf != curibuf) {
1363 filterfunc(&texr, previbuf, fx, fy, &AFD);
1364 texres->
tr += levf * (texr.
tr - texres->
tr);
1365 texres->
tg += levf * (texr.
tg - texres->
tg);
1366 texres->
tb += levf * (texr.
tb - texres->
tb);
1367 texres->
ta += levf * (texr.
ta - texres->
ta);
1371 alpha_clip_aniso(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, extflag, texres);
1378 const float ff =
sqrtf(ibuf->
x), q = ibuf->
y / ff;
1379 const float Ux = dxt[0] * ff, Vx = dxt[1] * q, Uy = dyt[0] * ff, Vy = dyt[1] * q;
1380 const float A = Vx * Vx + Vy * Vy;
1381 const float B = -2.0f * (Ux * Vx + Uy * Vy);
1382 const float C = Ux * Ux + Uy * Uy;
1383 const float F =
A *
C -
B *
B * 0.25f;
1384 float a, b, th, ecc, fProbes;
1390 fProbes = 2.0f * (
a / b) - 1.0f;
1399 AFD.
dusc = 1.0f / ff;
1404 filterfunc(texres, ibuf, fx, fy, &AFD);
1405 val1 = texres->
tr + texres->
tg + texres->
tb;
1406 filterfunc(&texr, ibuf, fx + dxt[0], fy + dxt[1], &AFD);
1407 val2 = texr.
tr + texr.
tg + texr.
tb;
1408 filterfunc(&texr, ibuf, fx + dyt[0], fy + dyt[1], &AFD);
1409 val3 = texr.
tr + texr.
tg + texr.
tb;
1411 texres->
nor[0] = val1 - val2;
1412 texres->
nor[1] = val1 - val3;
1415 filterfunc(texres, ibuf, fx, fy, &AFD);
1417 alpha_clip_aniso(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, extflag, texres);
1426 texres->
tin = texres->
ta;
1429 texres->
ta = 1.0f - texres->
ta;
1439 texres->
nor[0] = -2.0f * (texres->
tr - 0.5f);
1440 texres->
nor[1] = 2.0f * (texres->
tg - 0.5f);
1441 texres->
nor[2] = 2.0f * (texres->
tb - 0.5f);
1453 fx = 1.0f / texres->
ta;
1471 const float texvec[3],
1476 const bool skip_load_image)
1479 float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[2], dyt[2];
1480 float maxd, pixsize, val1, val2, val3;
1481 int curmap, retval, imaprepeat, imapextend;
1493 texres->
tin = texres->
ta = texres->
tr = texres->
tg = texres->
tb = 0.0f;
1544 minx =
min_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
1545 maxx =
max_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
1546 miny =
min_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
1547 maxy =
max_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
1550 minx = (maxx - minx) / 2.0f;
1551 miny = (maxy - miny) / 2.0f;
1558 if (addval > minx) {
1561 if (addval > miny) {
1576 SWAP(
float, minx, miny);
1582 else if (minx < 0.00001f) {
1588 else if (miny < 0.00001f) {
1604 int xs, ys, xs1, ys1, xs2, ys2, boundary;
1606 xs = (int)
floor(fx);
1607 ys = (int)
floor(fy);
1622 xs1 = (int)
floor(fx - minx);
1623 ys1 = (int)
floor(fy - miny);
1624 xs2 = (int)
floor(fx + minx);
1625 ys2 = (int)
floor(fy + miny);
1626 boundary = (xs1 != xs2) || (ys1 != ys2);
1628 if (boundary == 0) {
1630 if ((xs + ys) & 1) {
1641 if ((xs + ys) & 1) {
1653 if ((xs1 + ys) & 1) {
1660 if ((ys1 + xs) & 1) {
1668 if ((xs1 + ys) & 1) {
1675 if ((ys1 + xs) & 1) {
1695 if (fx + minx < 0.0f || fy + miny < 0.0f || fx - minx > 1.0f || fy - miny > 1.0f ||
1696 texvec[2] < -1.0f || texvec[2] > 1.0f) {
1704 if (fx + minx < 0.0f || fy + miny < 0.0f || fx - minx > 1.0f || fy - miny > 1.0f) {
1716 else if (fx < 0.0f) {
1724 else if (fx < 0.0f) {
1725 fx += 1 - (int)(fx);
1733 else if (fy < 0.0f) {
1741 else if (fy < 0.0f) {
1742 fy += 1 - (int)(fy);
1749 ImBuf *previbuf, *curibuf;
1761 bumpscale = pixsize / maxd;
1762 if (bumpscale > 1.0f) {
1766 bumpscale *= bumpscale;
1770 previbuf = curibuf = ibuf;
1771 while (curmap < IMB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) {
1772 if (maxd < pixsize) {
1776 curibuf = ibuf->
mipmap[curmap];
1777 pixsize = 1.0f / (
float)
MIN2(curibuf->
x, curibuf->
y);
1783 if (minx < 0.5f / ibuf->
x) {
1784 minx = 0.5f / ibuf->
x;
1786 if (miny < 0.5f / ibuf->
y) {
1787 miny = 0.5f / ibuf->
y;
1797 curibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);
1798 val1 = texres->
tr + texres->
tg + texres->
tb;
1807 val2 = texr.
tr + texr.
tg + texr.
tb;
1816 val3 = texr.
tr + texr.
tg + texr.
tb;
1819 texres->
nor[0] = (val1 - val2);
1820 texres->
nor[1] = (val1 - val3);
1822 if (previbuf != curibuf) {
1825 previbuf, fx - minx, fy - miny, fx + minx, fy + miny, &texr, imaprepeat, imapextend);
1828 dx = 2.0f * (pixsize - maxd) / pixsize;
1830 texres->
ta = texr.
ta;
1831 texres->
tb = texr.
tb;
1832 texres->
tg = texr.
tg;
1833 texres->
tr = texr.
tr;
1837 texres->
tb = dy * texres->
tb + dx * texr.
tb;
1838 texres->
tg = dy * texres->
tg + dx * texr.
tg;
1839 texres->
tr = dy * texres->
tr + dx * texr.
tr;
1840 texres->
ta = dy * texres->
ta + dx * texr.
ta;
1843 val1 = dy * val1 + dx * (texr.
tr + texr.
tg + texr.
tb);
1852 val2 = dy * val2 + dx * (texr.
tr + texr.
tg + texr.
tb);
1861 val3 = dy * val3 + dx * (texr.
tr + texr.
tg + texr.
tb);
1863 texres->
nor[0] = (val1 - val2);
1864 texres->
nor[1] = (val1 - val3);
1868 texres->
tb = dy * texres->
tb + dx * texr.
tb;
1869 texres->
tg = dy * texres->
tg + dx * texr.
tg;
1870 texres->
tr = dy * texres->
tr + dx * texr.
tr;
1871 texres->
ta = dy * texres->
ta + dx * texr.
ta;
1874 texres->
nor[0] *= bumpscale;
1875 texres->
nor[1] *= bumpscale;
1883 boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend);
1885 if (previbuf != curibuf) {
1886 boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend);
1888 fx = 2.0f * (pixsize - maxd) / pixsize;
1891 texres->
ta = texr.
ta;
1892 texres->
tb = texr.
tb;
1893 texres->
tg = texr.
tg;
1894 texres->
tr = texr.
tr;
1898 texres->
tb = fy * texres->
tb + fx * texr.
tb;
1899 texres->
tg = fy * texres->
tg + fx * texr.
tg;
1900 texres->
tr = fy * texres->
tr + fx * texr.
tr;
1901 texres->
ta = fy * texres->
ta + fx * texr.
ta;
1910 if (minx < 0.5f / ibuf->
x) {
1911 minx = 0.5f / ibuf->
x;
1913 if (miny < 0.5f / ibuf->
y) {
1914 miny = 0.5f / ibuf->
y;
1919 boxsample(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);
1920 val1 = texres->
tr + texres->
tg + texres->
tb;
1929 val2 = texr.
tr + texr.
tg + texr.
tb;
1938 val3 = texr.
tr + texr.
tg + texr.
tb;
1941 texres->
nor[0] = (val1 - val2);
1942 texres->
nor[1] = (val1 - val3);
1945 boxsample(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);
1953 texres->
tin = texres->
ta;
1957 texres->
ta = 1.0f - texres->
ta;
1968 texres->
nor[0] = -2.0f * (texres->
tr - 0.5f);
1969 texres->
nor[1] = 2.0f * (texres->
tg - 0.5f);
1970 texres->
nor[2] = 2.0f * (texres->
tb - 0.5f);
2000 boxsample(ibuf, fx, fy, fx + dx, fy + dy, &texres, 0, 1);
2023 ewa_eval(&texres, ibuf, fx, fy, &AFD);
typedef float(TangentPoint)[2]
void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool)
struct ImBuf * BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool)
bool BKE_image_has_loaded_ibuf(struct Image *image)
int BKE_image_get_tile_from_pos(struct Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
MINLINE float max_fff(float a, float b, float c)
MINLINE int round_fl_to_int(float a)
MINLINE float max_ff(float a, float b)
MINLINE float min_fff(float a, float b, float c)
const float EWA_WTS[EWA_MAXIDX+1]
void BLI_ewa_filter(const int width, const int height, const bool intpol, const bool use_alpha, const float uv[2], const float du[2], const float dv[2], ewa_filter_read_pixel_cb read_pixel_cb, void *userdata, float result[4])
void BLI_ewa_imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v4(float r[4])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter)
void IMB_makemipmap(struct ImBuf *ibuf, int use_filter)
Contains defines and structs used throughout the imbuf module.
#define IMB_MIPMAP_LEVELS
Group RGB to Bright Vector Camera CLAMP
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
struct ImBuf * mipmap[IMB_MIPMAP_LEVELS]
static float square_rctf(rctf *rf)
void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float result[4])
int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[2], const float DYT[2], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
static float clipy_rctf(rctf *rf, float y1, float y2)
static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[2], float dyt[2], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
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, const short imaprepeat, const short imapextend)
int imagewrap(Tex *tex, Image *ima, const float texvec[3], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
static int ibuf_get_color_clip_bilerp(float col[4], ImBuf *ibuf, float u, float v, int intpol, int extflag)
static float clipx_rctf(rctf *rf, float x1, float x2)
static void ewa_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
void image_sample(Image *ima, float fx, float fy, float dx, float dy, float result[4], struct ImagePool *pool)
struct ReadEWAData ReadEWAData
static void ewa_read_pixel_cb(void *userdata, int x, int y, float result[4])
static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extflag)
static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, int extflag, TexResult *texres)
ccl_device_inline float2 floor(const float2 &a)
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)