first commit with hours and hours of comment translation for render code...

This commit is contained in:
2003-04-27 14:05:41 +00:00
parent 0b2b5dbfb9
commit 1ab53ee998
8 changed files with 322 additions and 394 deletions

View File

@@ -81,7 +81,7 @@ RE_BasicShadowBuffer::~RE_BasicShadowBuffer(void)
void RE_BasicShadowBuffer::lrectreadRectz(int x1, int y1,
int x2, int y2,
char *r1) /* leest deel uit rectz in r1 */
char *r1) /* reads part from rectz in r1 */
{
unsigned int len4, *rz;
@@ -149,14 +149,14 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
panophi = getPanoPhi();
/* viewvars onthouden */
/* store view vars */
temprx= R.rectx; tempry= R.recty;
R.rectx= R.recty= shb->size;
shb->jit= give_jitter_tab(shb->samp);
/* matrices en window: in R.winmat komt transformatie
van obsview naar lampview, inclusief lampwinmat */
/* matrices and window: in R.winmat the transformation is being put,
transforming from observer view to lamp view, including lamp window matrix */
wsize= shb->pixsize*(shb->size/2.0);
@@ -167,12 +167,12 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
/* temp, will be restored */
MTC_Mat4SwapMat4(shb->persmat, R.winmat);
/* zbufferen */
/* zbuffering */
if(R.rectz) MEM_freeN(R.rectz);
R.rectz= (unsigned int *)MEM_mallocN(sizeof(int)*shb->size*shb->size,"makeshadbuf");
rcline= (char*) MEM_mallocN(256*4+sizeof(int),"makeshadbuf2");
/* onthouden: panorama rot */
/* store: panorama rot */
temp= panophi;
panophi= 0.0;
pushTempPanoPhi(0.0);
@@ -185,23 +185,9 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
zbuffershad(lar);
/* alle pixels 1 x ingevuld verwijderen (oneven) */
/* probleem hierbij kan geven dat er abrupte overgangen van zacht gebied
* naar geen zacht gebied is: bijv als eronder een klein vlakje zit
* DAAROM ER WEER UIT
* ook vanwege shadowhalo!
*
a= shb->size*shb->size;
rz= R.rectz;
while(a--) {
if(*rz & 1) *rz= 0x7FFFFFFF;
rz++;
}
*/
square= lar->mode & LA_SQUARE;
/* Z tiles aanmaken: dit systeem is 24 bits!!! */
/* create Z tiles (for compression): this system is 24 bits!!! */
ztile= shb->zbuf;
ctile= shb->cbuf;
@@ -211,7 +197,7 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
for(x=0; x<shb->size; x+=16) {
/* ligt rechthoek binnen spotbundel? */
/* is tile within spotbundle? */
a= shb->size/2;
if(x< a) minx= x+15-a;
else minx= x-a;
@@ -232,13 +218,13 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
if( (*rz1 & 0xFFFFFF00) != verg) break;
}
}
if(a==256) { /* compleet leeg vakje */
if(a==256) { /* complete empty tile */
*ctile= 0;
*ztile= *(rz1-1);
}
else {
/* ACOMP enz. zijn defined L/B endian */
/* ACOMP etc. are defined to work L/B endian */
rc= rcline;
rz1= (int *)rcline;
@@ -252,7 +238,7 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
if(byt1==0) break;
}
if(byt1 && byt2) { /* alleen byte opslaan */
if(byt1 && byt2) { /* only store byte */
*ctile= 1;
*ztile= (unsigned long)MEM_mallocN(256+4, "tile1");
rz= (int *)*ztile;
@@ -262,7 +248,7 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
rc= rcline;
for(a=0; a<256; a++, zt++, rc+=4) *zt= rc[GCOMP];
}
else if(byt1) { /* short opslaan */
else if(byt1) { /* store short */
*ctile= 2;
*ztile= (unsigned long)MEM_mallocN(2*256+4,"Tile2");
rz= (int *)*ztile;
@@ -275,7 +261,7 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
zt[1]= rc[GCOMP];
}
}
else { /* triple opslaan */
else { /* store triple */
*ctile= 3;
*ztile= (unsigned long)MEM_mallocN(3*256,"Tile3");
@@ -304,7 +290,7 @@ void RE_BasicShadowBuffer::importScene(LampRen *lar)
int RE_BasicShadowBuffer::firstreadshadbuf(struct ShadBuf *shb, int xs, int ys, int nr)
{
/* return 1 als volledig gecomprimeerde shadbuftile && z==const */
/* return a 1 if fully compressed shadbuf-tile && z==const */
static int *rz;
int ofs;
char *ct;
@@ -313,7 +299,7 @@ int RE_BasicShadowBuffer::firstreadshadbuf(struct ShadBuf *shb, int xs, int ys,
if(xs<0) xs= 0; else if(xs>=shb->size) xs= shb->size-1;
if(ys<0) ys= 0; else if(ys>=shb->size) ys= shb->size-1;
/* z berekenen */
/* z calc */
ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
ct= shb->cbuf+ofs;
if(*ct==0) {
@@ -330,14 +316,14 @@ int RE_BasicShadowBuffer::firstreadshadbuf(struct ShadBuf *shb, int xs, int ys,
}
float RE_BasicShadowBuffer::readshadowbuf(struct ShadBuf *shb,
int xs, int ys, int zs) /* return 1.0 : volledig licht */
int xs, int ys, int zs) /* return 1.0 : fully in light */
{
float temp;
int *rz, ofs;
int zsamp;
char *ct, *cz;
/* simpleclip */
/* simple clip */
/* if(xs<0 || ys<0) return 1.0; */
/* if(xs>=shb->size || ys>=shb->size) return 1.0; */
@@ -345,7 +331,7 @@ float RE_BasicShadowBuffer::readshadowbuf(struct ShadBuf *shb,
if(xs<0) xs= 0; else if(xs>=shb->size) xs= shb->size-1;
if(ys<0) ys= 0; else if(ys>=shb->size) ys= shb->size-1;
/* z berekenen */
/* z calc */
ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
ct= shb->cbuf+ofs;
rz= *( (int **)(shb->zbuf+ofs) );
@@ -376,16 +362,14 @@ float RE_BasicShadowBuffer::readshadowbuf(struct ShadBuf *shb,
}
else {
/* got warning on this from alpha .... */
/* got warning on this from DEC alpha (64 bits).... */
/* but it's working code! (ton) */
zsamp= (int) rz;
}
/* if(zsamp >= 0x7FFFFE00) return 1.0; */ /* geen schaduw als op oneindig wordt gesampeld*/
if(zsamp > zs) return 1.0; /* absoluut geen schaduw */
else if( zsamp < zs-bias) return 0.0 ; /* absoluut wel schaduw */
else { /* zacht gebied */
if(zsamp > zs) return 1.0; /* absolute no shadow */
else if( zsamp < zs-bias) return 0.0 ; /* absolute in shadow */
else { /* soft area */
temp= ( (float)(zs- zsamp) )/(float)bias;
return 1.0 - temp*temp;
@@ -396,7 +380,7 @@ float RE_BasicShadowBuffer::readshadowbuf(struct ShadBuf *shb,
void RE_BasicShadowBuffer::readShadowValue(struct ShadBuf *shb,
float inp,
float * shadres) /* return 1.0: geen schaduw */
float * shadres) /* return 1.0: no shadow */
{
float fac, co[4], dx[3], dy[3], aantal=0;
float xs1,ys1, siz, *j, xres, yres;
@@ -411,14 +395,12 @@ void RE_BasicShadowBuffer::readShadowValue(struct ShadBuf *shb,
return;
#endif
/* if(inp <= 0.0) return 1.0; */
/* renderco en osaco roteren */
/* rotate renderco en osaco */
siz= 0.5*(float)shb->size;
VECCOPY(co, R.co);
co[3]= 1.0;
MTC_Mat4MulVec4fl(shb->persmat, co); /* rationele hom co */
MTC_Mat4MulVec4fl(shb->persmat, co); /* rational homogenic co */
xs1= siz*(1.0+co[0]/co[3]);
ys1= siz*(1.0+co[1]/co[3]);
@@ -442,7 +424,7 @@ void RE_BasicShadowBuffer::readShadowValue(struct ShadBuf *shb,
zs = (int) (((float)0x7FFFFFFF)*fac);
/* num*num samples nemen, gebied met fac vergroten */
/* take num*num samples, increase area with fac */
num= shb->samp*shb->samp;
fac= shb->soft;
@@ -461,7 +443,7 @@ void RE_BasicShadowBuffer::readShadowValue(struct ShadBuf *shb,
co[1]= R.co[1]+O.dxco[1];
co[2]= R.co[2]+O.dxco[2];
co[3]= 1.0;
MTC_Mat4MulVec4fl(shb->persmat,co); /* rationele hom co */
MTC_Mat4MulVec4fl(shb->persmat,co); /* rational hom co */
dx[0]= xs1- siz*(1.0+co[0]/co[3]);
dx[1]= ys1- siz*(1.0+co[1]/co[3]);
@@ -469,7 +451,7 @@ void RE_BasicShadowBuffer::readShadowValue(struct ShadBuf *shb,
co[1]= R.co[1]+O.dyco[1];
co[2]= R.co[2]+O.dyco[2];
co[3]= 1.0;
MTC_Mat4MulVec4fl(shb->persmat,co); /* rationele hom co */
MTC_Mat4MulVec4fl(shb->persmat,co); /* rational hom co */
dy[0]= xs1- siz*(1.0+co[0]/co[3]);
dy[1]= ys1- siz*(1.0+co[1]/co[3]);
@@ -502,7 +484,7 @@ void RE_BasicShadowBuffer::readShadowValue(struct ShadBuf *shb,
}
for(a=num;a>0;a--) {
/* i.p.v. jit ook met random geprobeerd: lelijk! */
/* instead of jit i tried random: ugly! */
xs= (int) (xs1 + xres*j[0]);
ys= (int) (ys1 + yres*j[1]);
j+=2;
@@ -531,7 +513,7 @@ float RE_BasicShadowBuffer::readshadowbuf_halo(struct ShadBuf *shb, int xs, int
if(xs<0 || ys<0) return 0.0;
if(xs>=shb->size || ys>=shb->size) return 0.0;
/* z berekenen */
/* z calc */
ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
ct= shb->cbuf+ofs;
rz= *( (int **)(shb->zbuf+ofs) );
@@ -568,21 +550,21 @@ float RE_BasicShadowBuffer::readshadowbuf_halo(struct ShadBuf *shb, int xs, int
zsamp= (int) rz;
}
/* geen schaduw als op oneindig wordt gesampeld*/
/* NO schadow when sampled at 'eternal' distance */
if(zsamp >= 0x7FFFFE00) return 1.0;
if(zsamp > zs) return 1.0; /* absoluut geen schaduw */
if(zsamp > zs) return 1.0; /* absolute no shadww */
else {
/* bias is negative, so the (zs-bias) can be beyond 0x7fffffff */
zbias= 0x7fffffff - zs;
if(zbias > -bias) {
if( zsamp < zs-bias) return 0.0 ; /* absoluut wel schaduw */
if( zsamp < zs-bias) return 0.0 ; /* absolute in shadow */
}
else return 0.0 ; /* absoluut wel schaduw */
else return 0.0 ; /* absolute shadow */
}
/* zacht gebied */
/* soft area */
temp= ( (float)(zs- zsamp) )/(float)bias;
return 1.0 - temp*temp;
@@ -608,7 +590,7 @@ float RE_BasicShadowBuffer::shadow_halo(LampRen *lar, float *p1, float *p2)
co[1]= p1[1];
co[2]= p1[2]/lar->sh_zfac;
co[3]= 1.0;
MTC_Mat4MulVec4fl(shb->winmat, co); /* rationele hom co */
MTC_Mat4MulVec4fl(shb->winmat, co); /* rational hom co */
xf1= siz*(1.0+co[0]/co[3]);
yf1= siz*(1.0+co[1]/co[3]);
zf1= (co[2]/co[3]);
@@ -618,12 +600,12 @@ float RE_BasicShadowBuffer::shadow_halo(LampRen *lar, float *p1, float *p2)
co[1]= p2[1];
co[2]= p2[2]/lar->sh_zfac;
co[3]= 1.0;
MTC_Mat4MulVec4fl(shb->winmat, co); /* rationele hom co */
MTC_Mat4MulVec4fl(shb->winmat, co); /* rational hom co */
xf2= siz*(1.0+co[0]/co[3]);
yf2= siz*(1.0+co[1]/co[3]);
zf2= (co[2]/co[3]);
/* de 2dda */
/* the 2dda (a pixel line formula) */
xs1= (int)xf1;
ys1= (int)yf1;
@@ -710,28 +692,3 @@ float RE_BasicShadowBuffer::shadow_halo(LampRen *lar, float *p1, float *p2)
}
/* sampelen met filter
xstart= xs-1;
ystart= ys-1;
if(xstart<0) xstart= 0;
if(ystart<0) ystart= 0;
xend= xstart+2;
yend= ystart+2;
if(xend>=shb->size) { xstart= shb->size-3; xend= shb->size-1;}
if(yend>=shb->size) { ystart= shb->size-3; yend= shb->size-1;}
fid= filt3;
for(ys=ystart;ys<=yend;ys++) {
rz= shb->buf+ ys*shb->size+ xstart;
for(xs= xstart;xs<=xend;xs++,rz++) {
if( *rz+0x100000<zs) aantal+= *fid;
fid++;
}
}
return 1.0-((float)aantal)/16.0;
*/

View File

@@ -367,7 +367,7 @@ void renderEdges(char *colourRect)
}
}
/* alle getallen in zbuffer 3 naar rechts shiften */
/* shift values in zbuffer 3 to the right */
rz = edgeBuffer;
if(rz==0) return;
@@ -498,13 +498,13 @@ void renderEdges(char *colourRect)
/* ------------------------------------------------------------------------- */
void addEdgeOver(char *doel, char *bron) /* telt bron bij doel */
void addEdgeOver(char *doel, char *bron) /* adds bron (source) to doel (goal) */
{
float c;
int mul;
if( bron[3] == 0) return;
if( bron[3] == 255) { /* is getest, scheelt */
if( bron[3] == 255) { /* has been tested, saves a lot */
*((unsigned int *)doel)= *((unsigned int *)bron);
return;
}
@@ -659,7 +659,7 @@ void fillEdgeRenderFace(float *v1, float *v2, float *v3)
else { minv=v3; midv=v2; maxv=v1;}
}
if(minv[1] == maxv[1]) return; /* beveiliging 'nul' grote vlakken */
if(minv[1] == maxv[1]) return; /* security, for 'zero' size faces */
my0 = ceil(minv[1]);
my2 = floor(maxv[1]);
@@ -670,7 +670,7 @@ void fillEdgeRenderFace(float *v1, float *v2, float *v3)
if(my0<Aminy) my0= Aminy;
/* EDGES : DE LANGSTE */
/* EDGES : THE LONGEST */
xx1= maxv[1]-minv[1];
if(xx1>2.0/65536.0) {
z0= (maxv[0]-minv[0])/xx1;
@@ -685,7 +685,7 @@ void fillEdgeRenderFace(float *v1, float *v2, float *v3)
dx0= 0;
xs0= 65536.0*(MIN2(minv[0],maxv[0]));
}
/* EDGES : DE BOVENSTE */
/* EDGES : THE TOP ONE */
xx1= maxv[1]-midv[1];
if(xx1>2.0/65536.0) {
z0= (maxv[0]-midv[0])/xx1;
@@ -700,7 +700,7 @@ void fillEdgeRenderFace(float *v1, float *v2, float *v3)
dx1= 0;
xs1= 65536.0*(MIN2(midv[0],maxv[0]));
}
/* EDGES : DE ONDERSTE */
/* EDGES : THE BOTTOM ONE */
xx1= midv[1]-minv[1];
if(xx1>2.0/65536.0) {
z0= (midv[0]-minv[0])/xx1;
@@ -725,9 +725,9 @@ void fillEdgeRenderFace(float *v1, float *v2, float *v3)
if(vec0[2]==0.0) return;
if(midv[1] == maxv[1]) omsl= my2;
if(omsl < Aminy) omsl= Aminy-1; /* dan neemt ie de eerste lus helemaal */
if(omsl < Aminy) omsl= Aminy-1; /* that way it does the first loop entirely */
while (my2 > Amaxy) { /* my2 kan groter zijn */
while (my2 > Amaxy) { /* my2 can really be larger */
xs0+=dx0;
if (my2<=omsl) {
xs2+= dx2;
@@ -852,7 +852,7 @@ void fillEdgeRenderEdge(float *vec1, float *vec2)
if(fabs(dx) > fabs(dy)) {
/* alle lijnen van links naar rechts */
/* alle lines from left to right */
if(vec1[0]<vec2[0]) {
VECCOPY(v1, vec1);
VECCOPY(v2, vec2);
@@ -900,7 +900,7 @@ void fillEdgeRenderEdge(float *vec1, float *vec2)
}
else {
/* alle lijnen van onder naar boven */
/* all lines from top to bottom */
if(vec1[1]<vec2[1]) {
VECCOPY(v1, vec1);
VECCOPY(v2, vec2);

View File

@@ -301,7 +301,7 @@ void env_rotate_scene(float mat[][4], int mode)
xn= ver->n[0];
yn= ver->n[1];
zn= ver->n[2];
/* geen transpose ! */
/* no transpose ! */
ver->n[0]= imat[0][0]*xn+imat[1][0]*yn+imat[2][0]*zn;
ver->n[1]= imat[0][1]*xn+imat[1][1]*yn+imat[2][1]*zn;
ver->n[2]= imat[0][2]*xn+imat[1][2]*yn+imat[2][2]*zn;
@@ -322,7 +322,7 @@ void env_rotate_scene(float mat[][4], int mode)
xn= vlr->n[0];
yn= vlr->n[1];
zn= vlr->n[2];
/* geen transpose ! */
/* no transpose ! */
vlr->n[0]= imat[0][0]*xn+imat[1][0]*yn+imat[2][0]*zn;
vlr->n[1]= imat[0][1]*xn+imat[1][1]*yn+imat[2][1]*zn;
vlr->n[2]= imat[0][2]*xn+imat[1][2]*yn+imat[2][2]*zn;
@@ -424,7 +424,7 @@ void render_envmap(EnvMap *env)
RE_local_clear_render_display(R.win);
fillrect(R.rectot, R.rectx, R.recty, 0);
RE_setwindowclip(1,-1); /* geen jit:(-1) */
RE_setwindowclip(1,-1); /* no jit:(-1) */
MTC_Mat4CpyMat4(tmat, G.scene->camera->obmat);
MTC_Mat4Ortho(tmat);

View File

@@ -100,13 +100,13 @@
#define ELEM3(a, b, c, d) ( ELEM(a, b, c) || (a)==(d) )
/* uit render.c */
/* from render.c */
extern float fmask[256], centLut[16];
extern unsigned short *mask1[9], *mask2[9], /* *igamtab1, */ *igamtab2/*, *gamtab */;
extern char cmask[256], *centmask;
Material defmaterial;
short pa; /* pa is globaal part ivm print */
short pa; /* pa is global part, for print */
short allparts[65][4];
int qscount;
@@ -159,7 +159,7 @@ void RE_free_render_data()
end_render_material(&defmaterial);
}
/* ****************** GAMMA, MASKERS en LUTS **************** */
/* ****************** GAMMA, MASKS and LUTS **************** */
float calc_weight(float *weight, int i, int j)
{
@@ -225,7 +225,7 @@ void RE_init_filt_mask(void)
}
if(R.r.alphamode==R_ALPHAKEY) gamma= 1.0; /* ??? */
if(R.r.alphamode==R_ALPHAKEY) gamma= 1.0; /* gamma correction of alpha is nasty */
if(R.r.mode & R_GAMMA) gamma= 2.0;
else gamma= 1.0;
@@ -234,7 +234,7 @@ void RE_init_filt_mask(void)
if(gamma!= lastgamma) {
lastgamma= gamma;
/* gamtab: in short, uit short */
/* gamtab: in short, out short */
for(a=0; a<65536; a++) {
val= a;
val/= 65535.0;
@@ -244,7 +244,7 @@ void RE_init_filt_mask(void)
gamtab[a]= (65535.99*val);
}
/* inv gamtab1 : in byte, uit short */
/* inverse gamtab1 : in byte, out short */
for(a=1; a<=256; a++) {
if(gamma==2.0) igamtab1[a-1]= a*a-1;
else if(gamma==1.0) igamtab1[a-1]= 256*a-1;
@@ -254,7 +254,7 @@ void RE_init_filt_mask(void)
}
}
/* inv gamtab2 : in short, uit short */
/* inverse gamtab2 : in short, out short */
for(a=0; a<65536; a++) {
val= a;
val/= 65535.0;
@@ -280,7 +280,7 @@ void RE_init_filt_mask(void)
memset(mask2[a], 0, 256*2);
}
/* bereken totw */
/* calculate totw */
totw= 0.0;
for(j= -1; j<2; j++) {
for(i= -1; i<2; i++) {
@@ -290,7 +290,7 @@ void RE_init_filt_mask(void)
for(j= -1; j<2; j++) {
for(i= -1; i<2; i++) {
/* bereken ahv jit met ofset de gewichten */
/* calculate using jit, with offset the weights */
memset(weight, 0, 32*2);
calc_weight(weight, i, j);
@@ -337,7 +337,7 @@ void RE_init_filt_mask(void)
}
}
/* centmask: de juiste subpixel ofset per masker */
/* centmask: the correct subpixel offset per mask */
fpx1= MEM_mallocN(256*sizeof(float), "initgauss4");
fpx2= MEM_mallocN(256*sizeof(float), "initgauss4");
@@ -457,7 +457,7 @@ void RE_make_existing_file(char *name)
strcpy(di, name);
BLI_splitdirstring(di, fi);
/* exist testen */
/* test exist */
if (BLI_exists(di) == 0) {
BLI_recurdir_fileops(di);
}
@@ -466,11 +466,11 @@ void RE_make_existing_file(char *name)
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* code for holographic hack, used in the neogeo days. SHould be removed (ton) */
extern float holoofs; /* render.c */
void RE_setwindowclip(int mode, int jmode)
{
/* jmode>=0: alleen jitter doen, anders berekenen */
/* mode==1 zet persmat en grvec */
Camera *cam=0;
float lens, fac, minx, miny, maxx, maxy;
float xd, yd, afmx, afmy;
@@ -509,7 +509,7 @@ void RE_setwindowclip(int mode, int jmode)
R.viewfac= R.ycor*(afmy*lens)/16.0;
}
if(R.r.mode & R_ORTHO) {
R.near*= 100.0; /* R.far niet doen */
R.near*= 100.0;
R.viewfac*= 100.0;
}
@@ -572,8 +572,6 @@ void RE_setwindowclip(int mode, int jmode)
maxy= R.pixsize*(maxy+yd);
if(R.r.mode & R_ORTHO) {
/* hier de near & far vermenigvuldigen is voldoende! */
i_window(minx, maxx, miny, maxy, R.near, 100.0*R.far, R.winmat);
}
else i_window(minx, maxx, miny, maxy, R.near, R.far, R.winmat);
@@ -605,20 +603,20 @@ void initparts()
ymaxb= R.recty;
}
xparts= R.r.xparts; /* voor border */
xparts= R.r.xparts; /* for border */
yparts= R.r.yparts;
for(nr=0;nr<xparts*yparts;nr++)
allparts[nr][0]= -1; /* array leegmaken */
allparts[nr][0]= -1; /* clear array */
xpart= R.rectx/xparts;
ypart= R.recty/yparts;
/* als border: testen of aantal parts minder kan */
/* if border: test if amount of parts can be fewer */
if(R.r.mode & R_BORDER) {
a= (xmaxb-xminb-1)/xpart+1; /* zoveel parts in border */
a= (xmaxb-xminb-1)/xpart+1; /* amount of parts in border */
if(a<xparts) xparts= a;
a= (ymaxb-yminb-1)/ypart+1; /* zoveel parts in border */
a= (ymaxb-yminb-1)/ypart+1; /* amount of parts in border */
if(a<yparts) yparts= a;
xpart= (xmaxb-xminb)/xparts;
@@ -651,7 +649,7 @@ void initparts()
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
short setpart(short nr) /* return 0 als geen goede part */
short setpart(short nr) /* return 0 if incorrect part */
{
if(allparts[nr][0]== -1) return 0;
@@ -672,7 +670,7 @@ void addparttorect(short nr, Part *part)
unsigned int *rt, *rp;
short y, heigth, len;
/* de juiste offset in rectot */
/* the right offset in rectot */
rt= R.rectot+ (allparts[nr][1]*R.rectx+ allparts[nr][0]);
rp= part->rect;
@@ -726,12 +724,12 @@ void add_to_blurbuf(int blur)
}
}
else if(blur==R.osa-1) {
/* eerste keer */
/* first time */
blurrect= MEM_mallocN(R.rectx*R.recty*sizeof(int), "rectblur");
if(R.rectot) memcpy(blurrect, R.rectot, R.rectx*R.recty*4);
}
else if(blurrect) {
/* accumuleren */
/* accumulate */
facr= 256/(R.osa-blur);
facb= 256-facr;
@@ -765,7 +763,7 @@ void add_to_blurbuf(int blur)
}
}
if(blur==0) {
/* laatste keer */
/* last time */
if(R.rectot) MEM_freeN(R.rectot);
R.rectot= blurrect;
blurrect= 0;
@@ -785,12 +783,12 @@ void render() {
}
void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
void oldRenderLoop(void) /* here the PART and FIELD loops */
{
Part *part;
unsigned int *rt, *rt1, *rt2;
int len, y;
short blur, a,fields,fi,parts; /* pa is globaal ivm print */
short blur, a,fields,fi,parts; /* pa is a global because of print */
unsigned int *border_buf= NULL;
unsigned int border_x= 0;
unsigned int border_y= 0;
@@ -806,13 +804,13 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if (R.rectz) MEM_freeN(R.rectz);
R.rectz = 0;
/* FIELDLUS */
/* FIELD LOOP */
fields= 1;
parts= R.r.xparts*R.r.yparts;
if(R.r.mode & R_FIELDS) {
fields= 2;
R.rectf1= R.rectf2= 0; /* fieldrecten */
R.rectf1= R.rectf2= 0; /* field rects */
R.r.ysch/= 2;
R.afmy/= 2;
R.r.yasp*= 2;
@@ -832,7 +830,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(fi==1) R.flag |= R_SEC_FIELD;
/* MOTIONBLUR lus */
/* MOTIONBLUR loop */
if(R.r.mode & R_MBLUR) blur= R.osa;
else blur= 1;
@@ -850,7 +848,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(R.r.mode & R_MBLUR) set_mblur_offs(R.osa-blur);
initparts(); /* altijd doen ivm border */
initparts(); /* always do, because of border */
setpart(0);
RE_local_init_render_display();
@@ -865,7 +863,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
if(pa) { /* want pa==0 is al gedaan */
if(pa) { /* because case pa==0 has been done */
if(setpart(pa)==0) break;
}
@@ -874,7 +872,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(R.r.mode & R_PANORAMA) setPanoRot(pa);
/* HOMOGENE COORDINATEN EN ZBUF EN CLIP OPT (per part) */
/* HOMOGENIC COORDINATES AND ZBUF AND CLIP OPTIMISATION (per part) */
/* There may be some interference with z-coordinate */
/* calculation here? */
@@ -882,7 +880,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
/* ZBUFFER & SHADE: zbuffer stores int distances, int face indices */
/* ZBUFFER & SHADE: zbuffer stores integer distances, and integer face indices */
R.rectot= (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
R.rectz = (unsigned int *)MEM_mallocN(sizeof(int)*R.rectx*R.recty, "rectz");
@@ -896,10 +894,10 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
/* uitzondering */
/* exception */
if( (R.r.mode & R_BORDER) && (R.r.mode & R_MOVIECROP));
else {
/* PART OF BORDER AFHANDELEN */
/* HANDLE PART OR BORDER */
if(parts>1 || (R.r.mode & R_BORDER)) {
part= MEM_callocN(sizeof(Part), "part");
@@ -915,9 +913,9 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
}
}
/* PARTS SAMENVOEGEN OF BORDER INVOEGEN */
/* JOIN PARTS OR INSERT BORDER */
/* uitzondering: crop */
/* exception: crop */
if( (R.r.mode & R_BORDER) && (R.r.mode & R_MOVIECROP)) ;
else {
R.rectx= R.r.xsch;
@@ -968,16 +966,16 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
add_to_blurbuf(blur);
}
/* EINDE (blurlus) */
/* END (blur loop) */
finalizeScene();
if(RE_local_test_break()) break;
}
/* definitief vrijgeven */
/* definite free */
add_to_blurbuf(-1);
/* FIELD AFHANDELEN */
/* HANDLE FIELD */
if(R.r.mode & R_FIELDS) {
if(R.flag & R_SEC_FIELD) R.rectf2= R.rectot;
else R.rectf1= R.rectot;
@@ -987,14 +985,14 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
}
/* FIELDS SAMENVOEGEN */
/* JOIN FIELDS */
if(R.r.mode & R_FIELDS) {
R.r.ysch*= 2;
R.afmy*= 2;
R.recty*= 2;
R.r.yasp/=2;
if(R.rectot) MEM_freeN(R.rectot); /* komt voor bij afbreek */
if(R.rectot) MEM_freeN(R.rectot); /* happens when a render has been stopped */
R.rectot=(unsigned int *)MEM_mallocN(sizeof(int)*R.rectx*R.recty, "rectot");
if(RE_local_test_break()==0) {
@@ -1026,7 +1024,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
/* if(R.r.mode & R_PANORAMA) R.rectx*= R.r.xparts; */
/* R.recty= R.r.ysch; */
/* als border: wel de skybuf doen */
/* if border: still do skybuf */
if(R.r.mode & R_BORDER) {
if( (R.r.mode & R_MOVIECROP)==0) {
if(R.r.bufflag & 1) {
@@ -1040,7 +1038,7 @@ void oldRenderLoop(void) /* hierbinnen de PART en FIELD lussen */
set_mblur_offs(0);
/* VRIJGEVEN */
/* FREE */
/* zbuf test */
@@ -1068,17 +1066,17 @@ void RE_initrender(struct View3D *ogl_render_view3d)
Image *bima;
char name[256];
/* scenedata naar R */
/* scene data to R */
R.r= G.scene->r;
R.r.postigamma= 1.0/R.r.postgamma;
/* voor zekerheid: bij voortijdige return */
/* to be sure: when a premature return */
R.rectx= R.r.xsch;
R.recty= R.r.ysch;
/* MAG ER WEL WORDEN GERENDERD */
/* IS RENDERING ALLOWED? */
/* verboden combinatie */
/* forbidden combination */
if((R.r.mode & R_BORDER) && (R.r.mode & R_PANORAMA)) {
error("No border allowed for Panorama");
G.afbreek= 1;
@@ -1099,7 +1097,7 @@ void RE_initrender(struct View3D *ogl_render_view3d)
}
/* BACKBUF TESTEN */
/* TEST BACKBUF */
/* If an image is specified for use as backdrop, that image is loaded */
/* here. */
if((R.r.bufflag & 1) && (G.scene->r.scemode & R_OGL)==0) {
@@ -1127,7 +1125,7 @@ void RE_initrender(struct View3D *ogl_render_view3d)
}
usegamtab= 0; /* zie hieronder */
usegamtab= 0; /* see also further */
if(R.r.mode & (R_OSA|R_MBLUR)) {
R.osa= R.r.osa;
@@ -1136,7 +1134,7 @@ void RE_initrender(struct View3D *ogl_render_view3d)
init_render_jit(R.osa);
RE_init_filt_mask();
/* wordt af en toe tijdelijk op nul gezet, o.a. in transp zbuf */
/* this value sometimes is reset temporally, for example in transp zbuf */
if(R.r.mode & R_GAMMA) {
if((R.r.mode & R_OSA)) usegamtab= 1;
}
@@ -1175,7 +1173,7 @@ void RE_initrender(struct View3D *ogl_render_view3d)
if(RE_local_test_break()==0) do_render_seq();
/* displayen */
/* display */
if(R.rectot) RE_local_render_display(0, R.recty-1,
R.rectx, R.recty,
R.rectot);
@@ -1207,11 +1205,11 @@ void RE_initrender(struct View3D *ogl_render_view3d)
if(cam->type==CAM_ORTHO) R.r.mode |= R_ORTHO;
}
render(); /* keert terug met complete rect xsch-ysch */
render(); /* returns with complete rect xsch-ysch */
}
}
/* nog eens displayen: fields/seq/parts/pano etc */
/* display again: fields/seq/parts/pano etc */
if(R.rectot) {
RE_local_init_render_display();
RE_local_render_display(0, R.recty-1,
@@ -1222,9 +1220,9 @@ void RE_initrender(struct View3D *ogl_render_view3d)
RE_local_printrenderinfo((PIL_check_seconds_timer() - start_time), -1);
/* variabelen weer goed */
/* restore variables */
R.osatex= 0;
R.vlr= 0; /* bij cubemap */
R.vlr= 0; /* at cubemap */
R.flag= 0;
}
@@ -1235,10 +1233,10 @@ void RE_animrender(struct View3D *ogl_render_view3d)
if(G.scene==0) return;
/* scenedata naar R: (voor backbuf, R.rectx enz) */
/* scenedata to R: (for backbuf, R.rectx etc) */
R.r= G.scene->r;
/* START ANIMLUS overal wordt NIET de cfra uit R.r gebruikt: ivm rest blender */
/* START ANIMLOOP, everywhere NOT the cfra from R.r is gebruikt: because of rest blender */
cfrao= (G.scene->r.cfra);
if(G.scene->r.scemode & R_OGL) R.r.mode &= ~R_PANORAMA;
@@ -1275,7 +1273,7 @@ void RE_animrender(struct View3D *ogl_render_view3d)
RE_initrender(ogl_render_view3d);
/* SCHRIJF PLAATJE */
/* WRITE IMAGE */
if(RE_local_test_break()==0) {
if (0) {
@@ -1297,7 +1295,7 @@ void RE_animrender(struct View3D *ogl_render_view3d)
timestr(PIL_check_seconds_timer()-starttime, name);
printf(" Time: %s\n", name);
fflush(stdout); /* nodig voor renderd !! */
fflush(stdout); /* needed for renderd !! */
}
if(G.afbreek==1) break;
@@ -1306,7 +1304,7 @@ void RE_animrender(struct View3D *ogl_render_view3d)
(G.scene->r.cfra)= cfrao;
/* restoren tijd */
/* restore time */
if(R.r.mode & (R_FIELDS|R_MBLUR)) {
do_all_ipos();
do_all_keys();

View File

@@ -83,12 +83,12 @@ void addToBlurBuffer(int blur)
}
}
else if(blur==R.osa-1) {
/* eerste keer */
/* first time */
blurrect= MEM_mallocN(R.rectx*R.recty*sizeof(int), "rectblur");
if(R.rectot) memcpy(blurrect, R.rectot, R.rectx*R.recty*4);
}
else if(blurrect) {
/* accumuleren */
/* accumulate */
facr= 256/(R.osa-blur);
facb= 256-facr;
@@ -122,7 +122,7 @@ void addToBlurBuffer(int blur)
}
}
if(blur==0) {
/* laatste keer */
/* last time */
if(R.rectot) MEM_freeN(R.rectot);
R.rectot= blurrect;
blurrect= 0;
@@ -138,7 +138,7 @@ void addPartToRect(short nr, Part *part)
unsigned int *rt, *rp;
short y, heigth, len;
/* de juiste offset in rectot */
/* the correct offset in rectot */
rt= R.rectot+ (partsCoordinates[nr][1]*R.rectx+ partsCoordinates[nr][0]);
rp= part->rect;
@@ -177,20 +177,20 @@ void initParts()
ymaxb= R.recty;
}
xparts= R.r.xparts; /* voor border */
xparts= R.r.xparts; /* for border */
yparts= R.r.yparts;
for(nr=0;nr<xparts*yparts;nr++)
partsCoordinates[nr][0]= -1; /* array leegmaken */
partsCoordinates[nr][0]= -1; /* clear array */
xpart= R.rectx/xparts;
ypart= R.recty/yparts;
/* als border: testen of aantal parts minder kan */
/* if border: test if amount of parts can be reduced */
if(R.r.mode & R_BORDER) {
a= (xmaxb-xminb-1)/xpart+1; /* zoveel parts in border */
a= (xmaxb-xminb-1)/xpart+1; /* amount of parts in border */
if(a<xparts) xparts= a;
a= (ymaxb-yminb-1)/ypart+1; /* zoveel parts in border */
a= (ymaxb-yminb-1)/ypart+1; /* amount of parts in border */
if(a<yparts) yparts= a;
xpart= (xmaxb-xminb)/xparts;
@@ -222,7 +222,7 @@ void initParts()
}
}
short setPart(short nr) /* return 0 als geen goede part */
short setPart(short nr) /* return 0 if incorrect part */
{
if(partsCoordinates[nr][0]== -1) return 0;
@@ -239,12 +239,12 @@ short setPart(short nr) /* return 0 als geen goede part */
/* ------------------------------------------------------------------------- */
void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
void unifiedRenderingLoop(void) /* here the PART en FIELD loops */
{
Part *part;
unsigned int *rt, *rt1, *rt2;
int len;
short blur, a,fields,fi,parts; /* pa is globaal ivm print */
short blur, a,fields,fi,parts; /* pa is global because of print */
unsigned int *border_buf= NULL;
unsigned int border_x= 0;
unsigned int border_y= 0;
@@ -260,13 +260,13 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if (R.rectz) MEM_freeN(R.rectz);
R.rectz = 0;
/* FIELDLUS */
/* FIELD LOOP */
fields= 1;
parts= R.r.xparts*R.r.yparts;
if(R.r.mode & R_FIELDS) {
fields= 2;
R.rectf1= R.rectf2= 0; /* fieldrecten */
R.rectf1= R.rectf2= 0; /* field rects */
R.r.ysch/= 2;
R.afmy/= 2;
R.r.yasp*= 2;
@@ -286,7 +286,7 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if(fi==1) R.flag |= R_SEC_FIELD;
/* MOTIONBLUR lus */
/* MOTIONBLUR loop */
if(R.r.mode & R_MBLUR) blur= R.osa;
else blur= 1;
@@ -304,7 +304,7 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if(R.r.mode & R_MBLUR) set_mblur_offs(R.osa-blur);
initParts(); /* altijd doen ivm border */
initParts(); /* always do because of border */
setPart(0);
RE_local_init_render_display();
@@ -319,7 +319,7 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
if(pa) { /* want pa==0 is al gedaan */
if(pa) { /* because pa==0 has been done */
if(setPart(pa)==0) break;
}
@@ -328,7 +328,7 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if(R.r.mode & R_PANORAMA) setPanoRot(pa);
/* HOMOGENE COORDINATEN EN ZBUF EN CLIP OPT (per part) */
/* HOMOGENIC COORDINATES AND ZBUF AND CLIP OPTIMISATION (per part) */
/* There may be some interference with z-coordinate */
/* calculation here? */
@@ -347,10 +347,10 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
/* uitzondering */
/* exception */
if( (R.r.mode & R_BORDER) && (R.r.mode & R_MOVIECROP));
else {
/* PART OF BORDER AFHANDELEN */
/* HANDLE PARTS OR BORDER */
if(parts>1 || (R.r.mode & R_BORDER)) {
part= MEM_callocN(sizeof(Part), "part");
@@ -366,9 +366,9 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
}
}
/* PARTS SAMENVOEGEN OF BORDER INVOEGEN */
/* JOIN PARTS OR INSERT BORDER */
/* uitzondering: crop */
/* exception: crop */
if( (R.r.mode & R_BORDER) && (R.r.mode & R_MOVIECROP)) ;
else {
R.rectx= R.r.xsch;
@@ -420,16 +420,16 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
addToBlurBuffer(blur);
}
/* EINDE (blurlus) */
/* END (blur loop) */
finalizeScene();
if(RE_local_test_break()) break;
}
/* definitief vrijgeven */
/* definite free */
addToBlurBuffer(-1);
/* FIELD AFHANDELEN */
/* HANDLE FIELD */
if(R.r.mode & R_FIELDS) {
if(R.flag & R_SEC_FIELD) R.rectf2= R.rectot;
else R.rectf1= R.rectot;
@@ -439,14 +439,14 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
if(RE_local_test_break()) break;
}
/* FIELDS SAMENVOEGEN */
/* JOIN FIELDS */
if(R.r.mode & R_FIELDS) {
R.r.ysch*= 2;
R.afmy*= 2;
R.recty*= 2;
R.r.yasp/=2;
if(R.rectot) MEM_freeN(R.rectot); /* komt voor bij afbreek */
if(R.rectot) MEM_freeN(R.rectot); /* happens when break */
R.rectot=(unsigned int *)MEM_mallocN(sizeof(int)*R.rectx*R.recty, "rectot");
if(RE_local_test_break()==0) {
@@ -478,7 +478,6 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
/* if(R.r.mode & R_PANORAMA) R.rectx*= R.r.xparts; */
/* R.recty= R.r.ysch; */
/* als border: wel de skybuf doen */
/*
This may be tricky
*/
@@ -495,7 +494,7 @@ void unifiedRenderingLoop(void) /* hierbinnen de PART en FIELD lussen */
set_mblur_offs(0);
/* VRIJGEVEN */
/* FREE */
/* zbuf test */

View File

@@ -174,12 +174,13 @@ int addtosampcol(unsigned short *sampcol, unsigned short *shortcol, int mask)
/* ------------------------------------------------------------------------- */
void addAlphaOverShort(unsigned short *doel, unsigned short *bron) /* vult bron over doel in met alpha van bron */
void addAlphaOverShort(unsigned short *doel, unsigned short *bron)
/* fills in bron (source) over doel (target) with alpha from bron */
{
unsigned int c;
unsigned int mul;
if( doel[3]==0 || bron[3]>=0xFFF0) { /* is getest, scheelt veel */
if( doel[3]==0 || bron[3]>=0xFFF0) { /* has been tested */
*((unsigned int *)doel)= *((unsigned int *)bron);
*((unsigned int *)(doel+2))= *((unsigned int *)(bron+2));
return;
@@ -204,13 +205,14 @@ void addAlphaOverShort(unsigned short *doel, unsigned short *bron) /* vult bro
/* ------------------------------------------------------------------------- */
void addAlphaUnderShort(unsigned short *doel, unsigned short *bron) /* vult bron onder doel in met alpha van doel */
void addAlphaUnderShort(unsigned short *doel, unsigned short *bron)
/* fills in bron (source) under doel (target) using alpha from doel */
{
unsigned int c;
unsigned int mul;
if(doel[3]>=0xFFF0) return;
if( doel[3]==0 ) { /* is getest, scheelt veel */
if( doel[3]==0 ) { /* was tested */
*((unsigned int *)doel)= *((unsigned int *)bron);
*((unsigned int *)(doel+2))= *((unsigned int *)(bron+2));
return;
@@ -243,8 +245,7 @@ void addAlphaOverFloat(float *dest, float *source)
/* I may want to disable this clipping */
#ifdef RE_FLOAT_COLOUR_CLIPPING
if( /* (-RE_FULL_COLOUR_FLOAT < source[3]) */
/* && */ (source[3] > RE_FULL_COLOUR_FLOAT) ) { /* is getest, scheelt veel */
if( (source[3] > RE_FULL_COLOUR_FLOAT) ) {
dest[0] = source[0];
dest[1] = source[1];
dest[2] = source[2];
@@ -299,7 +300,7 @@ void addAlphaUnderFloat(float *dest, float *source)
if( dest[3] >= RE_FULL_COLOUR_FLOAT) return;
#endif
if( (-RE_EMPTY_COLOUR_FLOAT < dest[3])
&& (dest[3] < RE_EMPTY_COLOUR_FLOAT) ) { /* is getest, scheelt veel */
&& (dest[3] < RE_EMPTY_COLOUR_FLOAT) ) {
dest[0] = source[0];
dest[1] = source[1];
dest[2] = source[2];
@@ -372,8 +373,7 @@ void cpIntColV2CharColV(unsigned int *source, char *dest)
void cpCharColV2FloatColV(char *source, float *dest)
{
/* What about endianness? Might be caught at this level :) */
dest[0] = source[0]/255.0;
dest[0] = source[0]/255.0;
dest[1] = source[1]/255.0;
dest[2] = source[2]/255.0;
dest[3] = source[3]/255.0;
@@ -442,7 +442,6 @@ void cpCharColV(char *source, char *dest)
/* ------------------------------------------------------------------------- */
void addalphaAddfacFloat(float *dest, float *source, char addfac)
/* doel= bron over doel */
{
float m; /* weiging factor of destination */
float c; /* intermediate colour */
@@ -655,7 +654,7 @@ void sampleFloatColV2FloatColV(float *sample, float *dest, int osaNr)
/* The following functions are 'old' blending functions: */
/* ------------------------------------------------------------------------- */
void keyalpha(char *doel) /* maakt premul 255 */
void keyalpha(char *doel) /* makes premul 255 */
{
int c;
short div;
@@ -680,14 +679,14 @@ void keyalpha(char *doel) /* maakt premul 255 */
}
/* ------------------------------------------------------------------------- */
/* vult bron onder doel in met alpha van doel*/
/* fills in bron (source) under doel (target) with alpha of doel*/
void addalphaUnder(char *doel, char *bron)
{
int c;
int mul;
if(doel[3]==255) return;
if( doel[3]==0) { /* is getest, scheelt */
if( doel[3]==0) { /* tested */
*((unsigned int *)doel)= *((unsigned int *)bron);
return;
}
@@ -712,14 +711,14 @@ void addalphaUnder(char *doel, char *bron)
}
/* ------------------------------------------------------------------------- */
/* gamma-gecorr: vult bron onder doel in met alpha van doel */
/* gamma-corrected */
void addalphaUnderGamma(char *doel, char *bron)
{
unsigned int tot;
int c, doe, bro;
int mul;
/* hier doel[3]==0 of doel==255 afvangen gebeurt al in skylus */
/* if doel[3]==0 or doel==255 has been handled in sky loop */
mul= 256-doel[3];
doe= igamtab1[(int)doel[0]];
@@ -754,7 +753,7 @@ void addalphaOver(char *doel, char *bron)
int mul;
if(bron[3]==0) return;
if( bron[3]==255) { /* is getest, scheelt */
if( bron[3]==255) { /* tested */
*((unsigned int *)doel)= *((unsigned int *)bron);
return;
}
@@ -776,11 +775,11 @@ void addalphaOver(char *doel, char *bron)
}
/* ------------------------------------------------------------------------- */
void addalphaAdd(char *doel, char *bron) /* telt bron bij doel */
void addalphaAdd(char *doel, char *bron) /* adds bron (source) to doel (target) */
{
int c;
if( doel[3]==0 || bron[3]==255) { /* is getest, scheelt veel */
if( doel[3]==0 || bron[3]==255) { /* tested */
*((unsigned int *)doel)= *((unsigned int *)bron);
return;
}
@@ -798,7 +797,7 @@ void addalphaAdd(char *doel, char *bron) /* telt bron bij doel */
else doel[3]= c;
}
/* ------------------------------------------------------------------------- */
void addalphaAddshort(unsigned short *doel, unsigned short *bron) /* telt bron bij doel */
void addalphaAddshort(unsigned short *doel, unsigned short *bron) /* adds bron (source) to doel (target) */
{
int c;
@@ -847,7 +846,6 @@ void addalphaAddFloat(float *dest, float *source)
* Z= X alphaover Y:
* Zrgb= (1-Xa)*Yrgb + Xrgb
*
* Om ook de add te doen moet (1-Xa) moduleren met 1 via fac
* (1-fac)*(1-Xa) + fac <=>
* 1-Xa-fac+fac*Xa+fac <=>
* Xa*(fac-1)+1

View File

@@ -204,7 +204,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
return vlr;
#endif
if(R.vlaknr== -1) { /* doet initrender */
if(R.vlaknr== -1) { /* set by initrender */
/* also set in the pixelrender loop */
vlr= R.vlr= 0;
}
@@ -225,7 +225,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
R.mat= vlr->mat;
R.matren= R.mat->ren;
if(R.matren==0) { /* tijdelijk voor debug */
if(R.matren==0) { /* purple color, for debug */
collector[3] = RE_UNITY_COLOUR_FLOAT;
collector[2] = 0.0;
collector[1] = RE_UNITY_COLOUR_FLOAT;
@@ -242,7 +242,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
v1= vlr->v1;
dvlak= MTC_dot3Float(v1->co, vlr->n);
if( (vlr->flag & R_SMOOTH) || (R.matren->texco & NEED_UV)) { /* uv nodig */
if( (vlr->flag & R_SMOOTH) || (R.matren->texco & NEED_UV)) { /* uv needed */
if(vlaknr & 0x800000) {
v2= vlr->v3;
v3= vlr->v4;
@@ -269,7 +269,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
t00/= detsh; t01/=detsh;
t10/=detsh; t11/=detsh;
if(vlr->flag & R_SMOOTH) { /* puno's goedzetten */
if(vlr->flag & R_SMOOTH) { /* set vertex normals ("punos") */
if(vlr->puno & ME_FLIPV1) MTC_cp3FloatInv(v1->n, n1);
else MTC_cp3Float(v1->n, n1);
@@ -303,7 +303,6 @@ void *renderFacePixel(float x, float y, int vlaknr)
/* This trafo might be migrated to a separate function. It is used */
/* quite often. */
/* COXYZ nieuwe methode */
if( (G.special1 & G_HOLO)
&& (((Camera *)G.scene->camera->data)->flag & CAM_HOLO2) ) {
R.view[0]= (x+(R.xstart)+1.0+holoofs);
@@ -353,7 +352,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
}
fac= Normalise(R.view);
R.zcor*= fac; /* voor mist */
R.zcor*= fac; /* for mist */
if(R.osatex) {
if( (R.matren->texco & TEXCO_REFL) ) {
@@ -535,11 +534,11 @@ void *renderFacePixel(float x, float y, int vlaknr)
if(vlr->tface) render_realtime_texture();
}
/* hierna klopt de u en v EN O.dxuv en O.dyuv niet meer */
/* after this, the u en v AND O.dxuv and O.dyuv are incorrect */
if(R.matren->texco & TEXCO_STICKY) {
if(v2->sticky) {
/* opnieuw u en v berekenen */
/* recalc u en v */
hox= x/Zmulx -1.0;
hoy= y/Zmuly -1.0;
u= (hox - v3->ho[0]/v3->ho[3])*s11
@@ -590,7 +589,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
}
else alpha= 1.0;
/* RAYTRACE (tijdelijk?) UITGESCHAKELD */
/* RAYTRACE WAS HERE! */
if(R.matren->alpha!=1.0 || alpha!=1.0) {
fac= alpha*(R.matren->alpha);
@@ -616,7 +615,7 @@ void *renderFacePixel(float x, float y, int vlaknr)
/* here makes it difficult to do proper overlaying later on. */
/* It starts off with a coordinate transform again. */
if(R.flag & R_LAMPHALO) {
if(vlaknr<=0) { /* bereken viewvec en zet R.co op far */
if(vlaknr<=0) { /* calculate view vector and set R.co at far */
/* this view vector stuff should get its own function */
if( (G.special1 & G_HOLO) &&
@@ -696,15 +695,15 @@ void shadeSpotHaloPixelFloat(float *col)
if(factor > RE_FULL_COLOUR_FLOAT) rescol[3]= 1.0;
else rescol[3]= factor;
/* erg vervelend: gammagecorrigeerd renderen EN addalphaADD */
/* gaat niet goed samen */
/* eigenlijk moet er een aparte 'optel' gamma komen */
/* nasty issue: gamma corrected rendering AND 'addalphaADD' */
/* do not work well togethe */
/* actually, we should invent a new 'add' gamma type... (ton) */
/*
There is a strange thing here: the spothalo seems to be
calculated in the space you would get when you go from
value space through inverse gamma! So we gamma-transform
to value-space, then integrate, blend, and gamma correct
_again_.
_again_. -nzc-
*/
rescol[0] = factor * lar->r; /* Lampren rgb's are floats */
@@ -762,14 +761,14 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
*intens= 0.0;
haint= lar->haint;
VECCOPY(npos, lar->sh_invcampos); /* in initlamp berekend */
VECCOPY(npos, lar->sh_invcampos); /* calculated in initlamp */
/* view roteren */
/* rotate view */
VECCOPY(nray, view);
MTC_Mat3MulVecd(lar->imat, nray);
if(R.wrld.mode & WO_MIST) {
/* een beetje patch... */
/* a bit patchy... */
R.zcor= -lar->co[2];
haint *= mistfactor(lar->co);
if(haint==0.0) {
@@ -778,8 +777,8 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
}
/* maxz roteren */
if(R.co[2]==0) doclip= 0; /* is als halo op sky */
/* rotate maxz */
if(R.co[2]==0) doclip= 0; /* for when halo over a sky */
else {
p1[0]= R.co[0]-lar->co[0];
p1[1]= R.co[1]-lar->co[1];
@@ -792,13 +791,13 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
if( fabs(nray[2]) <0.000001 ) use_yco= 1;
}
/* z scalen zodat het volume genormaliseerd is */
/* scale z to make sure we've got a normalized volume */
nray[2]*= lar->sh_zfac;
/* nray hoeft niet genormaliseerd */
/* nray does not need normalize */
ladist= lar->sh_zfac*lar->dist;
/* oplossen */
/* solve */
a = nray[0] * nray[0] + nray[1] * nray[1] - nray[2]*nray[2];
b = nray[0] * npos[0] + nray[1] * npos[1] - nray[2]*npos[2];
c = npos[0] * npos[0] + npos[1] * npos[1] - npos[2]*npos[2];
@@ -825,27 +824,27 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
}
}
if(snijp==2) {
/* sorteren */
/* sort */
if(t1>t2) {
a= t1; t1= t2; t2= a;
}
/* z van snijpunten met diabolo */
/* the z of intersection points with 'diabolo' shape */
p1[2]= npos[2] + t1*nray[2];
p2[2]= npos[2] + t2*nray[2];
/* beide punten evalueren */
/* evaluate both points */
if(p1[2]<=0.0) ok1= 1;
if(p2[2]<=0.0 && t1!=t2) ok2= 1;
/* minstens 1 punt met negatieve z */
/* at least 1 point with negative z */
if(ok1==0 && ok2==0) return;
/* snijpunt met -ladist, de bodem van de kegel */
/* intersction point with -ladist, the bottom of the cone */
if(use_yco==0) {
t3= (-ladist-npos[2])/nray[2];
/* moet 1 van de snijpunten worden vervangen? */
/* does one intersection point has to be replaced? */
if(ok1) {
if(p1[2]<-ladist) t1= t3;
}
@@ -863,7 +862,7 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
}
else if(ok1==0 || ok2==0) return;
/* minstens 1 zichtbaar snijpunt */
/* at least 1 visible intersection point */
if(t1<0.0 && t2<0.0) return;
if(t1<0.0) t1= 0.0;
@@ -871,13 +870,12 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
if(t1==t2) return;
/* voor zekerheid nog eens sorteren */
/* to be sure, sort again */
if(t1>t2) {
a= t1; t1= t2; t2= a;
}
/* t0 berekenen: is de maximale zichtbare z (als halo door vlak */
/* doorsneden wordt) */
/* calculate t0: is de maximal visible z (for when halo was intersected with face */
if(doclip) {
if(use_yco==0) t0= (maxz-npos[2])/nray[2];
else t0= (maxy-npos[1])/nray[1];
@@ -886,7 +884,7 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
if(t0<t2) t2= t0;
}
/* bereken punten */
/* calculate points */
p1[0]= npos[0] + t1*nray[0];
p1[1]= npos[1] + t1*nray[1];
p1[2]= npos[2] + t1*nray[2];
@@ -895,7 +893,7 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
p2[2]= npos[2] + t2*nray[2];
/* nu hebben we twee punten, hiermee maken we drie lengtes */
/* now we've got two points, we make three lengths with that */
a= sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]);
b= sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]);
@@ -909,12 +907,12 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
*intens= c*( (1.0-a)+(1.0-b) );
/* LET OP: a,b en c NIET op 1.0 clippen, dit geeft kleine
overflowtjes op de rand (vooral bij smalle halo's) */
/* WATCH IT: do not clip a,b en c at 1.0, this gives nasty little overflows
at the edges (especially with narrow halos) */
if(*intens<=0.0) return;
/* zachte gebied */
/* vervalt omdat t0 nu ook voor p1/p2 wordt gebruikt */
/* soft area */
/* not needed because t0 has been used for p1/p2 as well */
/* if(doclip && t0<t2) { */
/* *intens *= (t0-t1)/(t2-t1); */
/* } */
@@ -925,6 +923,7 @@ void spotHaloFloat(struct LampRen *lar, float *view, float *intens)
/* from shadbuf.c, returns float */
*intens *= shadow_halo(lar, p1, p2);
}
/* this was a test, for textured halos! unfortunately i could not get transformations right... (ton) */
/* if(lar->mode & LA_TEXTURE) do_lamphalo_tex(lar, p1, p2, intens); */
}
@@ -947,7 +946,7 @@ void shadeLampLusFloat()
view= R.view;
ma= R.matren;
/* aparte lus */
/* separate loop */
if(ma->mode & MA_ONLYSHADOW) {
shadfac= ir= 0.0;
for(a=0; a<R.totlamp; a++) {
@@ -956,7 +955,7 @@ void shadeLampLusFloat()
if(lar->mode & LA_LAYER) if((lar->lay & R.vlr->lay)==0) continue;
if(lar->shb) {
/* alleen testen binnen spotbundel */
/* only test within spotbundle */
lv[0]= R.co[0]-lar->co[0];
lv[1]= R.co[1]-lar->co[1];
lv[2]= R.co[2]-lar->co[2];
@@ -1049,10 +1048,10 @@ void shadeLampLusFloat()
for(a=0; a<R.totlamp; a++) {
lar= R.la[a];
/* test op lamplayer */
/* test for lamplayer */
if(lar->mode & LA_LAYER) if((lar->lay & R.vlr->lay)==0) continue;
/* lampdist berekening */
/* lampdist calculation */
if(lar->type==LA_SUN || lar->type==LA_HEMI) {
VECCOPY(lv, lar->vec);
lampdist= 1.0;
@@ -1066,7 +1065,7 @@ void shadeLampLusFloat()
lv[1]/= ld;
lv[2]/= ld;
/* ld wordt verderop nog gebruikt (texco's) */
/* ld is used further on too (texco's) */
if(lar->mode & LA_QUAD) {
t= 1.0;
@@ -1095,7 +1094,7 @@ void shadeLampLusFloat()
if(lar->type==LA_SPOT) {
/* hier de fie Inp() vertaagt! */
/* using here a function call Inp() slows down! */
if(lar->mode & LA_SQUARE) {
if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0) {
@@ -1123,7 +1122,7 @@ void shadeLampLusFloat()
i= 1.0;
soft= 1.0;
if(t<lar->spotbl && lar->spotbl!=0.0) {
/* zachte gebied */
/* soft area */
i= t/lar->spotbl;
t= i*i;
soft= (3.0*t-2.0*t*i);
@@ -1131,13 +1130,12 @@ void shadeLampLusFloat()
}
if(lar->mode & LA_ONLYSHADOW && lar->shb) {
if(ma->mode & MA_SHADOW) {
/* inprodukt positief: voorzijde vlak! */
/* dot product positive: front side face! */
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
if(inp>0.0) {
/* testshadowbuf==0.0 : 100% schaduw */
/* testshadowbuf==0.0 : 100% shadow */
RE_testshadowbuf(lar->shadowBufOb, lar->shb, inp, shadfacvec);
/* testshadowbuf(lar->shb, inp, shadfacvec); */
shadfac = 1.0 - shadfacvec[0];
if(shadfac>0.0) {
@@ -1156,7 +1154,7 @@ void shadeLampLusFloat()
if(lar->mode & LA_ONLYSHADOW) continue;
if(lar->mode & LA_OSATEX) {
R.osatex= 1; /* signaal voor multitex() */
R.osatex= 1; /* signal for multitex() */
O.dxlv[0]= lv[0] - (R.co[0]-lar->co[0]+O.dxco[0])/ld;
O.dxlv[1]= lv[1] - (R.co[1]-lar->co[1]+O.dxco[1])/ld;
@@ -1169,7 +1167,7 @@ void shadeLampLusFloat()
}
/* inprodukt en reflectivity*/
/* dot product and reflectivity*/
inp=i= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
if(lar->type==LA_HEMI) {
i= 0.5*i+0.5;
@@ -1178,14 +1176,13 @@ void shadeLampLusFloat()
i*= lampdist*ma->ref;
}
/* schaduw en spec */
if(i> -0.41) { /* beetje willekeurig, beetje getest */
/* shadow and spec */
if(i> -0.41) { /* heuristic value... :) */
shadfac= 1.0;
if(lar->shb) {
if(ma->mode & MA_SHADOW) {
float shadfacvec[3] = {1.0, 1.0, 1.0};
RE_testshadowbuf(lar->shadowBufOb, lar->shb, inp, shadfacvec);
/* testshadowbuf(lar->shb, inp, shadfacvec); */
shadfac = shadfacvec[0];
/* shadfac = 1.0; : no shadow */
@@ -1214,10 +1211,8 @@ void shadeLampLusFloat()
if(lar->type==LA_HEMI) {
t= 0.5*t+0.5;
}
/* let op: shadfac en lampdist uit onderstaande */
/* watch it: shadfac and lampdist used below */
/* no more speclim */
t= ma->spec*RE_Spec(t, ma->har);
isr+= t*(lar->r * ma->specr);
isg+= t*(lar->g * ma->specg);
@@ -1345,18 +1340,18 @@ void shadeHaloFloat(HaloRen *har,
float dist, float xn,
float yn, short flarec)
{
/* in col invullen */
/* fill in col */
/* migrate: fill collector */
float t, zn, radist, ringf=0.0, linef=0.0, alpha, si, co, colf[4];
int a;
if(R.wrld.mode & WO_MIST) {
if(har->type & HA_ONLYSKY) {
/* sterren geen mist */
/* stars but no mist */
alpha= har->alfa;
}
else {
/* een beetje patch... */
/* a but patchy... */
R.zcor= -har->co[2];
alpha= mistfactor(har->co)*har->alfa;
}
@@ -1373,14 +1368,14 @@ void shadeHaloFloat(HaloRen *har,
radist= sqrt(dist);
/* let op: hiermee wordt gesjoemeld: flarec wordt op nul gezet in de pixstruct */
/* watch it: not used nicely: flarec is set at zero in pixstruct */
if(flarec) har->pixels+= (int)(har->rad-radist);
if(har->ringc) {
float *rc, fac;
int ofs;
/* per ring een alicirc */
/* per ring an antialised circle */
ofs= har->seed;
for(a= har->ringc; a>0; a--, ofs+=2) {
@@ -1429,7 +1424,7 @@ void shadeHaloFloat(HaloRen *har,
float *rc, fac;
int ofs;
/* per starpoint een aliline */
/* per starpoint an antialiased line */
ofs= har->seed;
for(a= har->linec; a>0; a--, ofs+=3) {
@@ -1449,7 +1444,7 @@ void shadeHaloFloat(HaloRen *har,
if(har->starpoints) {
float ster, hoek;
/* rotatie */
/* rotation */
hoek= atan2(yn, xn);
hoek*= (1.0+0.25*har->starpoints);
@@ -1466,7 +1461,7 @@ void shadeHaloFloat(HaloRen *har,
}
}
/* halo wordt doorsneden? */
/* halo being intersected? */
if(har->zs> zz-har->zd) {
t= ((float)(zz-har->zs))/(float)har->zd;
alpha*= sqrt(sqrt(t));
@@ -1835,7 +1830,7 @@ void shadeSkyPixelFloat(float y)
}
/* Why are this R. members? */
/* Why are this R. members? because textures need it (ton) */
if(R.inprz>1.0) R.inprz= 1.0;
R.inprh= 1.0-R.inprz;
@@ -1852,9 +1847,6 @@ void shadeSkyPixelFloat(float y)
}
collector[3]= RE_UNITY_COLOUR_FLOAT;
/* om verkeerde optimalisatie alphaover van flares te voorkomen */
/* ??? seems strange to me... This used to be a 1 when the colours */
/* were chars. might need a separate flag for this... */
}

View File

@@ -124,11 +124,11 @@ void gamtabdit(unsigned short *in, char *out)
}
float mistfactor(float *co) /* dist en hoogte, return alpha */
float mistfactor(float *co) /* dist en height, return alpha */
{
float fac, hi;
fac= R.zcor - R.wrld.miststa; /* R.zcor wordt per pixel berekend */
fac= R.zcor - R.wrld.miststa; /* R.zcor is calculated per pixel */
/* fac= -co[2]-R.wrld.miststa; */
@@ -145,9 +145,9 @@ float mistfactor(float *co) /* dist en hoogte, return alpha */
}
else fac= 0.0;
/* de hoogte schakelt de mist af */
/* height switched off mist */
if(R.wrld.misthi!=0.0 && fac!=0.0) {
/* op hoogte misthi is mist volledig weg */
/* at height misthi the mist is completely gone */
hi= R.viewinv[0][2]*co[0]+R.viewinv[1][2]*co[1]+R.viewinv[2][2]*co[2]+R.viewinv[3][2];
@@ -222,7 +222,7 @@ void RE_sky(char *col)
col[1]= 255.0*R.wrld.horg;
col[2]= 255.0*R.wrld.horb;
}
col[3]= 1; /* om verkeerde optimalisatie alphaover van flares te voorkomen */
col[3]= 1; /* to prevent wrong optimalisation alphaover of flares */
}
/* ------------------------------------------------------------------------- */
@@ -255,7 +255,7 @@ void scanlinesky(char *rect, int y)
*( ( unsigned int *)rect)= col;
}
else {
/* voorkomen dat 'col' in afbeelding voorkomt */
/* prevent 'col' to be in the image */
cp1= (char *)rect;
if( cp[0]==cp1[0] && cp[1]==cp1[1] && cp[2]==cp1[2] ) {
@@ -284,7 +284,7 @@ void scanlinesky(char *rect, int y)
return;
}
}
/* welke scanline/ */
/* which scanline/ */
y= ((y+R.afmy+R.ystart)*R.backbuf->ibuf->y)/(2*R.afmy);
if(R.flag & R_SEC_FIELD) {
@@ -298,7 +298,7 @@ void scanlinesky(char *rect, int y)
rt= (R.backbuf->ibuf->rect + y*R.backbuf->ibuf->x);
/* op welke plek */
/* at which location */
fac= ((float)R.backbuf->ibuf->x)/(float)(2*R.afmx);
ofs= (R.afmx+R.xstart)*fac;
rt+= ofs;
@@ -423,7 +423,6 @@ void do_lamphalo_tex(LampRen *lar, float *p1, float *p2, float *intens)
totin/= (float)steps;
*intens *= totin;
/* why isn't there a return value here? */
}
@@ -439,14 +438,14 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
*intens= 0.0;
haint= lar->haint;
VECCOPY(npos, lar->sh_invcampos); /* in initlamp berekend */
VECCOPY(npos, lar->sh_invcampos); /* in initlamp calculated */
/* view roteren */
/* rotate view */
VECCOPY(nray, view);
MTC_Mat3MulVecd(lar->imat, nray);
if(R.wrld.mode & WO_MIST) {
/* een beetje patch... */
/* patchy... */
R.zcor= -lar->co[2];
haint *= mistfactor(lar->co);
if(haint==0.0) {
@@ -455,8 +454,8 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
}
/* maxz roteren */
if(R.co[2]==0) doclip= 0; /* is als halo op sky */
/* rotate maxz */
if(R.co[2]==0) doclip= 0; /* for when halo at sky */
else {
p1[0]= R.co[0]-lar->co[0];
p1[1]= R.co[1]-lar->co[1];
@@ -469,13 +468,13 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
if( fabs(nray[2]) <0.000001 ) use_yco= 1;
}
/* z scalen zodat het volume genormaliseerd is */
/* scale z to make sure volume is normalized */
nray[2]*= lar->sh_zfac;
/* nray hoeft niet genormaliseerd */
/* nray does not need normalization */
ladist= lar->sh_zfac*lar->dist;
/* oplossen */
/* solve */
a = nray[0] * nray[0] + nray[1] * nray[1] - nray[2]*nray[2];
b = nray[0] * npos[0] + nray[1] * npos[1] - nray[2]*npos[2];
c = npos[0] * npos[0] + npos[1] * npos[1] - npos[2]*npos[2];
@@ -502,27 +501,27 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
}
}
if(snijp==2) {
/* sorteren */
/* sort */
if(t1>t2) {
a= t1; t1= t2; t2= a;
}
/* z van snijpunten met diabolo */
/* z of intersection points with diabolo */
p1[2]= npos[2] + t1*nray[2];
p2[2]= npos[2] + t2*nray[2];
/* beide punten evalueren */
/* evaluate both points */
if(p1[2]<=0.0) ok1= 1;
if(p2[2]<=0.0 && t1!=t2) ok2= 1;
/* minstens 1 punt met negatieve z */
/* at least 1 point with negative z */
if(ok1==0 && ok2==0) return;
/* snijpunt met -ladist, de bodem van de kegel */
/* intersction point with -ladist, the bottom of the cone */
if(use_yco==0) {
t3= (-ladist-npos[2])/nray[2];
/* moet 1 van de snijpunten worden vervangen? */
/* de we have to replace one of the intersection points? */
if(ok1) {
if(p1[2]<-ladist) t1= t3;
}
@@ -540,7 +539,7 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
}
else if(ok1==0 || ok2==0) return;
/* minstens 1 zichtbaar snijpunt */
/* at least 1 visible interesction point */
if(t1<0.0 && t2<0.0) return;
if(t1<0.0) t1= 0.0;
@@ -548,12 +547,12 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
if(t1==t2) return;
/* voor zekerheid nog eens sorteren */
/* sort again to be sure */
if(t1>t2) {
a= t1; t1= t2; t2= a;
}
/* t0 berekenen: is de maximale zichtbare z (als halo door vlak doorsneden wordt) */
/* calculate t0: is the maximum visible z (when halo is intersected by face) */
if(doclip) {
if(use_yco==0) t0= (maxz-npos[2])/nray[2];
else t0= (maxy-npos[1])/nray[1];
@@ -562,7 +561,7 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
if(t0<t2) t2= t0;
}
/* bereken punten */
/* calc points */
p1[0]= npos[0] + t1*nray[0];
p1[1]= npos[1] + t1*nray[1];
p1[2]= npos[2] + t1*nray[2];
@@ -571,7 +570,7 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
p2[2]= npos[2] + t2*nray[2];
/* nu hebben we twee punten, hiermee maken we drie lengtes */
/* now we have 2 points, make three lengths with it */
a= sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]);
b= sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]);
@@ -584,13 +583,13 @@ void spothalo(struct LampRen *lar, float *view, float *intens)
c/= ladist;
*intens= c*( (1.0-a)+(1.0-b) );
/* LET OP: a,b en c NIET op 1.0 clippen, dit geeft kleine
overflowtjes op de rand (vooral bij smalle halo's) */
/* WATCH IT: do not clip a,b en c at 1.0, this gives nasty little overflows
at the edges (especially with narrow halos) */
if(*intens<=0.0) return;
/* zachte gebied */
/* vervalt omdat t0 nu ook voor p1/p2 wordt gebruikt */
/* soft area */
/* not needed because t0 has been used for p1/p2 as well */
/* if(doclip && t0<t2) { */
/* *intens *= (t0-t1)/(t2-t1); */
/* } */
@@ -632,8 +631,8 @@ void renderspothalo(unsigned short *col)
colt= i;
if(colt>65535) scol[3]= 65535; else scol[3]= colt;
/* erg vervelend: gammagecorrigeerd renderen EN addalphaADD gaat niet goed samen */
/* eigenlijk moet er een aparte 'optel' gamma komen */
/* really bad: gamma corrected rendering AND addalphaADD doesnt work together */
/* actually we should invent a special add-gamma type */
colt= i*lar->r;
if(colt>65535) scol[0]= 65535; else scol[0]= colt;
@@ -673,10 +672,10 @@ void render_lighting_halo(HaloRen *har, float *colf)
for(a=0; a<R.totlamp; a++) {
lar= R.la[a];
/* test op lamplayer */
/* test for lamplayer */
if(lar->mode & LA_LAYER) if((lar->lay & har->lay)==0) continue;
/* lampdist berekening */
/* lampdist cacluation */
if(lar->type==LA_SUN || lar->type==LA_HEMI) {
VECCOPY(lv, lar->vec);
lampdist= 1.0;
@@ -690,7 +689,7 @@ void render_lighting_halo(HaloRen *har, float *colf)
lv[1]/= ld;
lv[2]/= ld;
/* ld wordt verderop nog gebruikt (texco's) */
/* ld is re-used further on (texco's) */
if(lar->mode & LA_QUAD) {
t= 1.0;
@@ -719,8 +718,6 @@ void render_lighting_halo(HaloRen *har, float *colf)
if(lar->type==LA_SPOT) {
/* hier de fie Inp() vertaagt! */
if(lar->mode & LA_SQUARE) {
if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0) {
float x, lvrot[3];
@@ -747,7 +744,7 @@ void render_lighting_halo(HaloRen *har, float *colf)
i= 1.0;
soft= 1.0;
if(t<lar->spotbl && lar->spotbl!=0.0) {
/* zachte gebied */
/* soft area */
i= t/lar->spotbl;
t= i*i;
soft= (3.0*t-2.0*t*i);
@@ -755,10 +752,10 @@ void render_lighting_halo(HaloRen *har, float *colf)
}
if(lar->mode & LA_ONLYSHADOW) {
/* if(ma->mode & MA_SHADOW) { */
/* inprodukt positief: voorzijde vlak! */
/* dot product positive: front side face! */
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
if(inp>0.0) {
/* testshadowbuf==0.0 : 100% schaduw */
/* testshadowbuf==0.0 : 100% shadow */
shadfac = testshadowbuf(lar->shb, inp);
if( shadfac>0.0 ) {
shadfac*= inp*soft*lar->energy;
@@ -777,7 +774,7 @@ void render_lighting_halo(HaloRen *har, float *colf)
}
/* inprodukt en reflectivity*/
/* dot product and reflectivity*/
inp= 1.0-fabs(vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2]);
@@ -793,8 +790,8 @@ void render_lighting_halo(HaloRen *har, float *colf)
/* i*= lampdist*ma->ref; */
}
/* schaduw */
if(i> -0.41) { /* beetje willekeurig, beetje getest */
/* shadow */
if(i> -0.41) { /* heuristic valua! */
shadfac= 1.0;
if(lar->shb) {
/* if(ma->mode & MA_SHADOW) { */
@@ -826,17 +823,17 @@ void render_lighting_halo(HaloRen *har, float *colf)
extern float hashvectf[];
void RE_shadehalo(HaloRen *har, char *col, unsigned int zz, float dist, float xn, float yn, short flarec)
{
/* in col invullen */
/* fill in in col */
float t, zn, radist, ringf=0.0, linef=0.0, alpha, si, co, colf[4];
int colt, a;
if(R.wrld.mode & WO_MIST) {
if(har->type & HA_ONLYSKY) {
/* sterren geen mist */
/* stars have no mist */
alpha= har->alfa;
}
else {
/* een beetje patch... */
/* patchy... */
R.zcor= -har->co[2];
alpha= mistfactor(har->co)*har->alfa;
}
@@ -856,14 +853,14 @@ void RE_shadehalo(HaloRen *har, char *col, unsigned int zz, float dist, float xn
radist= sqrt(dist);
/* let op: hiermee wordt gesjoemeld: flarec wordt op nul gezet in de pixstruct */
/* watch it: abused value: flarec was set to zero in pixstruct */
if(flarec) har->pixels+= (int)(har->rad-radist);
if(har->ringc) {
float *rc, fac;
int ofs;
/* per ring een alicirc */
/* per ring an antialised circle */
ofs= har->seed;
for(a= har->ringc; a>0; a--, ofs+=2) {
@@ -912,7 +909,7 @@ void RE_shadehalo(HaloRen *har, char *col, unsigned int zz, float dist, float xn
float *rc, fac;
int ofs;
/* per starpoint een aliline */
/* per starpoint an antialaised line */
ofs= har->seed;
for(a= har->linec; a>0; a--, ofs+=3) {
@@ -932,7 +929,7 @@ void RE_shadehalo(HaloRen *har, char *col, unsigned int zz, float dist, float xn
if(har->starpoints) {
float ster, hoek;
/* rotatie */
/* rotation */
hoek= atan2(yn, xn);
hoek*= (1.0+0.25*har->starpoints);
@@ -949,7 +946,7 @@ void RE_shadehalo(HaloRen *har, char *col, unsigned int zz, float dist, float xn
}
}
/* halo wordt doorsneden? */
/* halo intersected? */
if(har->zs> zz-har->zd) {
t= ((float)(zz-har->zs))/(float)har->zd;
alpha*= sqrt(sqrt(t));
@@ -1055,7 +1052,7 @@ void scanlinehaloPS(unsigned int *rectz, long *rectdelta, unsigned int *rectt, s
if((a & 255)==0) har= R.bloha[a>>8];
else har++;
if(!(a%256)&&RE_local_test_break()) break; /* Hos, RPW - fix slow render bug, */
if( !(a % 256) && RE_local_test_break() ) break; /* Hos, RPW - fix slow render bug, */
/* !(loopvar%256) keeps checking for */
/* ESC too often and bogging down render */
/* (Based on discovery by Rob Haarsma) */
@@ -1079,7 +1076,7 @@ void scanlinehaloPS(unsigned int *rectz, long *rectdelta, unsigned int *rectt, s
ysq= yn*yn;
for(x=minx; x<=maxx; x++) {
flarec= har->flarec; /* har->pixels mag maar 1 x geteld worden */
flarec= har->flarec; /* har->pixels is inly allowd to count once */
if( IS_A_POINTER_CODE(*rd)) {
xn= x-har->xs;
@@ -1164,7 +1161,7 @@ void scanlinehalo(unsigned int *rectz, unsigned int *rectt, short ys)
if((a & 255)==0) har= R.bloha[a>>8];
else har++;
if(!(a%256)&&RE_local_test_break()) break;/*Hos, RPW, fixes Slow Render Bug*/
if( !(a % 256) && RE_local_test_break() ) break; /* Hos, RPW, fixes Slow Render Bug */
if(ys>har->maxy);
else if(ys<har->miny);
@@ -1218,7 +1215,7 @@ void halovert()
if((a & 255)==0) har= R.bloha[a>>8];
else har++;
if(!(a%256)&&RE_local_test_break()) break;/*Hos, RPW, fixes slow render bug */
if( !(a % 256) && RE_local_test_break() ) break; /* Hos, RPW, fixes slow render bug */
if(har->maxy<0);
else if(R.recty<har->miny);
@@ -1272,7 +1269,7 @@ void halovert()
rectt+= R.rectx;
rectz+= R.rectx;
if(!(y%256)&&RE_local_test_break()) break;/*Hos,RPW, Fixes slow render bug */
if( !(y % 256) && RE_local_test_break() ) break; /* Hos,RPW, Fixes slow render bug */
}
}
@@ -1395,7 +1392,7 @@ void shadelamplus()
view= R.view;
ma= R.matren;
/* aparte lus */
/* separate loop */
if(ma->mode & MA_ONLYSHADOW) {
shadfac= ir= 0.0;
for(a=0; a<R.totlamp; a++) {
@@ -1404,7 +1401,7 @@ void shadelamplus()
if(lar->mode & LA_LAYER) if((lar->lay & R.vlr->lay)==0) continue;
if(lar->shb) {
/* alleen testen binnen spotbundel */
/* only test within spotbundel */
lv[0]= R.co[0]-lar->co[0];
lv[1]= R.co[1]-lar->co[1];
lv[2]= R.co[2]-lar->co[2];
@@ -1508,10 +1505,10 @@ void shadelamplus()
for(a=0; a<R.totlamp; a++) {
lar= R.la[a];
/* test op lamplayer */
/* test for lamp layer */
if(lar->mode & LA_LAYER) if((lar->lay & R.vlr->lay)==0) continue;
/* lampdist berekening */
/* lampdist calculation */
if(lar->type==LA_SUN || lar->type==LA_HEMI) {
VECCOPY(lv, lar->vec);
lampdist= 1.0;
@@ -1525,7 +1522,7 @@ void shadelamplus()
lv[1]/= ld;
lv[2]/= ld;
/* ld wordt verderop nog gebruikt (texco's) */
/* ld is re-used further on (texco's) */
if(lar->mode & LA_QUAD) {
t= 1.0;
@@ -1553,8 +1550,6 @@ void shadelamplus()
if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv);
if(lar->type==LA_SPOT) {
/* hier de fie Inp() vertaagt! */
if(lar->mode & LA_SQUARE) {
if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0) {
@@ -1582,7 +1577,7 @@ void shadelamplus()
i= 1.0;
soft= 1.0;
if(t<lar->spotbl && lar->spotbl!=0.0) {
/* zachte gebied */
/* soft area */
i= t/lar->spotbl;
t= i*i;
soft= (3.0*t-2.0*t*i);
@@ -1590,10 +1585,10 @@ void shadelamplus()
}
if(lar->mode & LA_ONLYSHADOW && lar->shb) {
if(ma->mode & MA_SHADOW) {
/* inprodukt positief: voorzijde vlak! */
/* dot product positive: front side face! */
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
if(inp>0.0) {
/* testshadowbuf==0.0 : 100% schaduw */
/* testshadowbuf==0.0 : 100% shadow */
shadfac = 1.0 - testshadowbuf(lar->shb, inp);
if(shadfac>0.0) {
shadfac*= inp*soft*lar->energy;
@@ -1611,7 +1606,7 @@ void shadelamplus()
if(lar->mode & LA_ONLYSHADOW) continue;
if(lar->mode & LA_OSATEX) {
R.osatex= 1; /* signaal voor multitex() */
R.osatex= 1; /* signal for multitex() */
O.dxlv[0]= lv[0] - (R.co[0]-lar->co[0]+O.dxco[0])/ld;
O.dxlv[1]= lv[1] - (R.co[1]-lar->co[1]+O.dxco[1])/ld;
@@ -1624,7 +1619,7 @@ void shadelamplus()
}
/* inprodukt en reflectivity*/
/* dot product and reflectivity*/
inp=i= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
if(lar->type==LA_HEMI) {
i= 0.5*i+0.5;
@@ -1633,8 +1628,8 @@ void shadelamplus()
i*= lampdist*ma->ref;
}
/* schaduw en spec */
if(i> -0.41) { /* beetje willekeurig, beetje getest */
/* shadow and spec */
if(i> -0.41) { /* heuristic value */
shadfac= 1.0;
if(lar->shb) {
if(ma->mode & MA_SHADOW) {
@@ -1664,8 +1659,6 @@ void shadelamplus()
if(lar->type==LA_HEMI) {
t= 0.5*t+0.5;
}
/* let op: shadfac en lampdist uit onderstaande */
/* no more speclim */
t= ma->spec*RE_Spec(t, ma->har);
@@ -1738,7 +1731,7 @@ void shadelamplus()
void shadepixel(float x, float y, int vlaknr)
/* x,y: windowcoordinaat van 0 tot rectx,y */
/* x,y: window coordinate from 0 to rectx,y */
{
static VlakRen *vlr;
static VertRen *v1, *v2, *v3;
@@ -1748,7 +1741,7 @@ void shadepixel(float x, float y, int vlaknr)
float u, v, l, dl, hox, hoy, detsh, fac, deler, alpha;
char *cp1, *cp2, *cp3;
if(R.vlaknr== -1) { /* doet initrender */
if(R.vlaknr== -1) { /* does initrender */
vlr= R.vlr= 0;
}
@@ -1764,7 +1757,7 @@ void shadepixel(float x, float y, int vlaknr)
R.mat= vlr->mat;
R.matren= R.mat->ren;
if(R.matren==0) { /* tijdelijk voor debug */
if(R.matren==0) { /* for debug */
shortcol[3]= 65535;
shortcol[2]= 0;
shortcol[1]= 65535;
@@ -1781,7 +1774,7 @@ void shadepixel(float x, float y, int vlaknr)
v1= vlr->v1;
dvlak= v1->co[0]*vlr->n[0]+v1->co[1]*vlr->n[1]+v1->co[2]*vlr->n[2];
if( (vlr->flag & R_SMOOTH) || (R.matren->texco & NEED_UV)) { /* uv nodig */
if( (vlr->flag & R_SMOOTH) || (R.matren->texco & NEED_UV)) { /* uv needed */
if(vlaknr & 0x800000) {
v2= vlr->v3;
v3= vlr->v4;
@@ -1808,7 +1801,7 @@ void shadepixel(float x, float y, int vlaknr)
t00/= detsh; t01/=detsh;
t10/=detsh; t11/=detsh;
if(vlr->flag & R_SMOOTH) { /* puno's goedzetten */
if(vlr->flag & R_SMOOTH) { /* adjust punos (vertexnormals) */
if(vlr->puno & ME_FLIPV1) {
n1[0]= -v1->n[0]; n1[1]= -v1->n[1]; n1[2]= -v1->n[2];
} else {
@@ -1855,7 +1848,7 @@ void shadepixel(float x, float y, int vlaknr)
}
}
/* COXYZ nieuwe methode */
/* COXYZ */
if( (G.special1 & G_HOLO) && ((Camera *)G.scene->camera->data)->flag & CAM_HOLO2) {
R.view[0]= (x+(R.xstart)+1.0+holoofs);
}
@@ -1904,7 +1897,7 @@ void shadepixel(float x, float y, int vlaknr)
}
fac= Normalise(R.view);
R.zcor*= fac; /* voor mist */
R.zcor*= fac; /* for mist */
if(R.osatex) {
if( (R.matren->texco & TEXCO_REFL) ) {
@@ -1913,7 +1906,7 @@ void shadepixel(float x, float y, int vlaknr)
}
}
/* UV en TEX*/
/* UV and TEX*/
if( (vlr->flag & R_SMOOTH) || (R.matren->texco & NEED_UV)) {
if(vlr->snproj==0) {
u= (R.co[0]-v3->co[0])*t11-(R.co[1]-v3->co[1])*t10;
@@ -2085,11 +2078,11 @@ void shadepixel(float x, float y, int vlaknr)
}
/* hierna klopt de u en v EN O.dxuv en O.dyuv niet meer */
/* after this the u and v AND O.dxuv and O.dyuv are incorrect */
if(R.matren->texco & TEXCO_STICKY) {
if(v2->sticky) {
/* opnieuw u en v berekenen */
/* recalc u and v again */
hox= x/Zmulx -1.0;
hoy= y/Zmuly -1.0;
u= (hox - v3->ho[0]/v3->ho[3])*s11 - (hoy - v3->ho[1]/v3->ho[3])*s10;
@@ -2136,7 +2129,7 @@ void shadepixel(float x, float y, int vlaknr)
}
else alpha= 1.0;
/* RAYTRACE (tijdelijk?) UITGESCHAKELD */
/* RAYTRACE WAS HERE! */
if(R.matren->alpha!=1.0 || alpha!=1.0) {
fac= alpha*(R.matren->alpha);
@@ -2161,7 +2154,7 @@ void shadepixel(float x, float y, int vlaknr)
}
if(R.flag & R_LAMPHALO) {
if(vlaknr<=0) { /* bereken viewvec en zet R.co op far */
if(vlaknr<=0) { /* calc view vector and put R.co at far */
if( (G.special1 & G_HOLO) && ((Camera *)G.scene->camera->data)->flag & CAM_HOLO2) {
R.view[0]= (x+(R.xstart)+1.0+holoofs);
@@ -2270,7 +2263,7 @@ void addps(long *rd, int vlak, unsigned int z, short ronde)
return;
}
/* eerste PS maken */
/* make first PS (pixel struct) */
if((psmteller & 4095)==0) prev= addpsmain();
else prev++;
psmteller++;
@@ -2298,7 +2291,7 @@ float count_maskf(unsigned short mask)
void add_filt_mask(unsigned int mask, unsigned short *col, unsigned int *rb1, unsigned int *rb2, unsigned int *rb3)
{
/* bereken de waarde van mask */
/* calc the value of mask */
unsigned int a, maskand, maskshift;
int j;
unsigned short val, r, g, b, al;
@@ -2353,7 +2346,7 @@ void edge_enhance(void)
int val, y, x, col, *rz, *rz1, *rz2, *rz3;
char *cp;
/* alle getallen in zbuffer 3 naar rechts shiften */
/* shift values in zbuffer 3 to the right */
rz= (int *)R.rectz;
if(rz==0) return;
@@ -2363,13 +2356,6 @@ void edge_enhance(void)
}
}
/* eerste order, werkt toch niet goed!:
val= abs(rz1[0]-rz2[1])+ 2*abs(rz1[1]-rz2[1])+ abs(rz1[2]-rz2[1]);
val+= 2*abs(rz2[0]-rz2[1])+ 2*abs(rz1[2]-rz2[1]);
val+= abs(rz3[0]-rz2[1])+ 2*abs(rz3[1]-rz2[1])+ abs(rz3[2]-rz2[1]);
*rz= val;
*/
rz1= (int *)R.rectz;
rz2= rz1+R.rectx;
rz3= rz2+R.rectx;
@@ -2427,7 +2413,7 @@ void edge_enhance(void)
}
/* ********************* HOOFDLUSSEN ******************** */
/* ********************* MAINLOOPS ******************** */
extern unsigned short *Acolrow;
/* short zbuffermetdehand(); */
@@ -2488,12 +2474,12 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
rz+= R.rectx;
}
}
/* 1 is voor osa */
/* 1 is for osa */
if(R.r.mode & R_EDGE) edge_enhance();
if(!(v%256)&&RE_local_test_break()) break; /*Hos,RPW, fixes slow render bug*/
if( !(v % 256) && RE_local_test_break()) break; /*Hos,RPW, fixes slow render bug*/
}
if(R.flag & (R_ZTRA+R_HALO) ) { /* om de juiste zbuffer Z voor transp en halo's terug te halen */
if(R.flag & (R_ZTRA+R_HALO) ) { /* to get back correct values of zbuffer Z for transp and halos */
xd= jit[0][0];
yd= jit[0][1];
Zjitx= -xd;
@@ -2510,7 +2496,7 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
fullmask= (1<<R.osa)-1;
/* de rowbuf is 4 pixels breder dan het plaatje! */
/* the rowbuf is 4 pixels larger than an image! */
rowbuf1= MEM_callocN(3*(R.rectx+4)*4*sizeof(float), "ZbufshadeDA3");
rowbuf2= MEM_callocN(3*(R.rectx+4)*4*sizeof(float), "ZbufshadeDA3");
rowbuf3= MEM_callocN(3*(R.rectx+4)*4*sizeof(float), "ZbufshadeDA3");
@@ -2571,7 +2557,7 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
colrb= (unsigned short *)(rowbuf3+4);
/* LET OP: ENDIAN */
/* WATCH IT: ENDIAN */
for(x=0; x<R.rectx; x++,colrt+=4) {
colrt[0]= ( (char *) (gamtab+colrb[0+MOST_SIG_BYTE]) )[MOST_SIG_BYTE];
@@ -2597,13 +2583,13 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
}
if(R.flag & R_HALO) {
/* van deze pixels zijn de pixstr al 1 scanline oud */
/* from these pixels the pixstr is 1 scanline old */
scanlinehaloPS(rz-R.rectx, rd-2*R.rectx, ((unsigned int *)colrt)-R.rectx, y-1);
}
scanlinesky(colrt-4*R.rectx, y-1);
/* scanline begint netjes: halo's gebruiken ook textures! */
/* scanline starts nicely: halos use textures as well! */
R.vlaknr= -1;
}
@@ -2623,7 +2609,7 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
}
rz+= R.rectx;
}
if(!(y%256)&&RE_local_test_break()) break; /*Hos,RPW, fixes slow render bug */
if(!(y % 256) && RE_local_test_break()) break; /* Hos,RPW, fixes slow render bug */
}
if( (R.r.mode & R_EDGE) && RE_local_test_break()==0) {
@@ -2633,8 +2619,6 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
addalphaOver((char *)rt, (char *)rp);
}
}
/* hier stond dof */
MEM_freeN(R.rectdaps);
freeps();
@@ -2669,7 +2653,7 @@ void zbufshade(void)
#ifdef BBIG_ENDIAN
#else
charcol++; /* short anders uitlezen */
charcol++; /* short is read different then */
#endif
if(R.flag & R_ZTRA) bgnaccumbuf();
@@ -2724,7 +2708,7 @@ void zbufshade(void)
R.rectot);
}
if(!(y%256)&&RE_local_test_break()) break; /*Hos,RPW, Fixes Slow render bug */
if(!(y % 256) && RE_local_test_break()) break; /*Hos,RPW, Fixes Slow render bug */
}
if(R.flag & R_ZTRA) endaccumbuf();
@@ -2737,7 +2721,7 @@ void zbufshade(void)
/* ------------------------------------------------------------------------ */
void renderhalo(HaloRen *har) /* postprocess versie */
void renderhalo(HaloRen *har) /* postprocess version */
{
float dist, xsq, ysq, xn, yn;
@@ -2787,12 +2771,12 @@ void renderhalo(HaloRen *har) /* postprocess versie */
rectt+= R.rectx;
if(!(y%256)&&RE_local_test_break()) break; /* Hos,RPW, fixes slow render bug */
if( !(y % 256) && RE_local_test_break()) break; /* Hos,RPW, fixes slow render bug */
}
}
}
} /* end of void renderhalo(HaloRen *har), postprocess versie */
} /* end of void renderhalo(HaloRen *har), postprocess version */
/* ------------------------------------------------------------------------ */
@@ -2811,13 +2795,13 @@ void RE_renderflare(HaloRen *har)
alfa= har->alfa;
visifac= R.ycor*(har->pixels);
/* alle stralen opgeteld / r^3 == 1.0! */
/* all radials added / r^3 == 1.0! */
visifac /= (har->rad*har->rad*har->rad);
visifac*= visifac;
ma= har->mat;
/* eerste halo: gewoon doen */
/* first halo: just do */
har->rad= rad*ma->flaresize*visifac;
har->radsq= har->rad*har->rad;
@@ -2827,7 +2811,7 @@ void RE_renderflare(HaloRen *har)
renderhalo(har);
/* volgende halo's: de flares */
/* next halo's: the flares */
rc= hashvectf + ma->seed2;
for(b=1; b<har->flarec; b++) {
@@ -2876,7 +2860,7 @@ void RE_renderflare(HaloRen *har)
void add_halo_flare(void)
{
/* extern void RE_projectverto(); */ /* uit zbuf.c */
/* extern void RE_projectverto(); */ /* zbuf.c */
HaloRen *har = NULL;
int a, mode;
@@ -2887,7 +2871,7 @@ void add_halo_flare(void)
R.xend= R.xstart+R.rectx-1;
R.yend= R.ystart+R.recty-1;
RE_setwindowclip(1,-1); /* geen jit:(-1) */
RE_setwindowclip(1,-1); /* no jit:(-1) */
setzbufvlaggen(RE_projectverto);
for(a=0; a<R.tothalo; a++) {