[Qb2c-cvs] goengine/src/editor mapedit.cpp,1.18,1.19
Brought to you by:
b_lindeijer,
syn9
|
From: Daniel K. <sy...@us...> - 2004-11-08 23:33:05
|
Update of /cvsroot/qb2c/goengine/src/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30702/src/editor Modified Files: mapedit.cpp Log Message: updated generate radiosity function Index: mapedit.cpp =================================================================== RCS file: /cvsroot/qb2c/goengine/src/editor/mapedit.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mapedit.cpp 8 Nov 2004 16:47:38 -0000 1.18 --- mapedit.cpp 8 Nov 2004 23:32:54 -0000 1.19 *************** *** 2919,2926 **** { ! short x, y, i, an, j, pl, po, plane, poly, nx, ny, p, or, og, ob, nr, ng, nb, lightr, lightg, lightb, p1, p2, p3; short ambientr, ambientg, ambientb, spanr, spang, spanb, focusstep, l, a, b; float dist, intense, strength, xx, yy, zz; ! float v, sx, sy, sz, aa, bb, cc, dd, ee, ff, c, c1, c2, c3; float ax, ay, az, bx, by, bz, ii, jj, kk, d, d1, d2, normalx, normaly, normalz; --- 2919,2928 ---- { ! short x, y, i, an, j, pl, po, plane, poly, nx, ny, p, nr, ng, nb, lightr, lightg, lightb, p1, p2, p3; short ambientr, ambientg, ambientb, spanr, spang, spanb, focusstep, l, a, b; + short c; + int c0; float dist, intense, strength, xx, yy, zz; ! float v, sx, sy, sz, aa, bb, cc, dd, ee, ff, c1, c2, c3; float ax, ay, az, bx, by, bz, ii, jj, kk, d, d1, d2, normalx, normaly, normalz; *************** *** 3110,3117 **** ! c = getpixel(textures[planeinfo[plane].polyinfo[poly][3]], (short)nx, (short)ny); ! nr = getr(c); ! ng = getg(c); ! nb = getb(c); //c1 = sin(1.57 * float(nr + ng + nb) / 768) * 256; c1 = float(nr + ng + nb) / 768; --- 3112,3119 ---- ! c0 = getpixel(textures[planeinfo[plane].polyinfo[poly][3]], (short)nx, (short)ny); ! nr = getr(c0); ! ng = getg(c0); ! nb = getb(c0); //c1 = sin(1.57 * float(nr + ng + nb) / 768) * 256; c1 = float(nr + ng + nb) / 768; *************** *** 3128,3135 **** ! c = getpixel(textures[planeinfo[plane].polyinfo[poly][3]], (short)sx, (short)sy); ! nr = getr(c); ! ng = getg(c); ! nb = getb(c); c2 = float(nr + ng + nb) / 768 - c1; --- 3130,3137 ---- ! c0 = getpixel(textures[planeinfo[plane].polyinfo[poly][3]], (short)sx, (short)sy); ! nr = getr(c0); ! ng = getg(c0); ! nb = getb(c0); c2 = float(nr + ng + nb) / 768 - c1; *************** *** 3147,3154 **** ! c = getpixel(textures[planeinfo[plane].polyinfo[poly][3]], (short)sx, (short)sy); ! nr = getr(c); ! ng = getg(c); ! nb = getb(c); c3 = float(nr + ng + nb) / 768 - c1; --- 3149,3156 ---- ! c0 = getpixel(textures[planeinfo[plane].polyinfo[poly][3]], (short)sx, (short)sy); ! nr = getr(c0); ! ng = getg(c0); ! nb = getb(c0); c3 = float(nr + ng + nb) / 768 - c1; *************** *** 3223,3234 **** if (intense < 0) intense = 0; ! c = getpixel(planeinfo[plane].radiosity[poly], nx, ny); nr = lightr * intense; ng = lightg * intense; nb = lightb * intense; ! nr = nr + getr(c); ! ng = ng + getg(c); ! nb = nb + getb(c); --- 3225,3236 ---- if (intense < 0) intense = 0; ! c0 = getpixel(planeinfo[plane].radiosity[poly], nx, ny); nr = lightr * intense; ng = lightg * intense; nb = lightb * intense; ! nr = nr + getr(c0); ! ng = ng + getg(c0); ! nb = nb + getb(c0); *************** *** 3278,3289 **** for (y = 0; y < 16; y++) { nr = 0; ng = 0; nb = 0; ! c = getpixel(planeinfo[i].radiosity[j], x, y); ! or = getr(c); ! og = getg(c); ! ob = getb(c); p = 0; --- 3280,3294 ---- for (y = 0; y < 16; y++) { + short old_r, old_g, old_b; + int color; + nr = 0; ng = 0; nb = 0; ! color = getpixel(planeinfo[i].radiosity[j], x, y); ! old_r = getr(color); ! old_g = getg(color); ! old_b = getb(color); p = 0; *************** *** 3298,3305 **** { p++; ! c = getpixel(planeinfo[i].radiosity[j], sx, sy); ! nr += getr(c); ! ng += getg(c); ! nb += getb(c); } } --- 3303,3310 ---- { p++; ! color = getpixel(planeinfo[i].radiosity[j], int(sx), int(sy)); ! nr += getr(color); ! ng += getg(color); ! nb += getb(color); } } *************** *** 3316,3322 **** if (nb > 255) nb = 255; ! if (nr < or) nr = or; ! if (ng < og) ng = og; ! if (nb < ob) nb = ob; putpixel(planeinfo[i].radiosity[j], x, y, makecol(nr, ng, nb)); --- 3321,3327 ---- if (nb > 255) nb = 255; ! if (nr < old_r) nr = old_r; ! if (ng < old_g) ng = old_g; ! if (nb < old_b) nb = old_b; putpixel(planeinfo[i].radiosity[j], x, y, makecol(nr, ng, nb)); *************** *** 3324,3327 **** --- 3329,3333 ---- } + } } *************** *** 3345,3352 **** for (y = 0; y < 16; y++) { ! c = getpixel(planeinfo[i].radiosity[j], x, y); ! nr = getr(c); ! ng = getg(c); ! nb = getb(c); spanr = 255 - ambientr; --- 3351,3358 ---- for (y = 0; y < 16; y++) { ! c0 = getpixel(planeinfo[i].radiosity[j], x, y); ! nr = getr(c0); ! ng = getg(c0); ! nb = getb(c0); spanr = 255 - ambientr; *************** *** 3358,3367 **** nb = ambientb + spanb * (float)nb / 255; ! c = getpixel(textures[planeinfo[i].polyinfo[j][3]], x, y); ! nr = getr(c) * (float)nr / 255; ! ng = getg(c) * (float)ng / 255; ! nb = getb(c) * (float)nb / 255; ! if (getr(c) == 255 && getg(c) == 0 && getb(c) == 255) { nr = 255; --- 3364,3373 ---- nb = ambientb + spanb * (float)nb / 255; ! c0 = getpixel(textures[planeinfo[i].polyinfo[j][3]], x, y); ! nr = getr(c0) * (float)nr / 255; ! ng = getg(c0) * (float)ng / 255; ! nb = getb(c0) * (float)nb / 255; ! if (getr(c0) == 255 && getg(c0) == 0 && getb(c0) == 255) { nr = 255; |