And a first threading fix; mist render still used a R global for storage.
caused very bad stripes in render.
This commit is contained in:
@@ -123,7 +123,7 @@ typedef struct RE_Render
|
|||||||
* near and far, but VC in cpp mode chokes on it :( */
|
* near and far, but VC in cpp mode chokes on it :( */
|
||||||
float near; /* near clip distance */
|
float near; /* near clip distance */
|
||||||
float far; /* far clip distance */
|
float far; /* far clip distance */
|
||||||
float ycor, zcor, pixsize, viewfac;
|
float ycor, pixsize, viewfac;
|
||||||
|
|
||||||
|
|
||||||
/* These three need to be 'handlerized'. Not an easy task... */
|
/* These three need to be 'handlerized'. Not an easy task... */
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ typedef struct PixStrMain
|
|||||||
} PixStrMain;
|
} PixStrMain;
|
||||||
|
|
||||||
|
|
||||||
float mistfactor(float *co); /* dist and height, return alpha */
|
float mistfactor(float zcor, float *co); /* dist and height, return alpha */
|
||||||
|
|
||||||
void add_halo_flare(void);
|
void add_halo_flare(void);
|
||||||
|
|
||||||
|
|||||||
@@ -338,9 +338,8 @@ void shadeHaloFloat(HaloRen *har, float *col, unsigned int zz,
|
|||||||
alpha= har->alfa;
|
alpha= har->alfa;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* a but patchy... */
|
/* a bit patchy... */
|
||||||
R.zcor= -har->co[2];
|
alpha= mistfactor(-har->co[2], har->co)*har->alfa;
|
||||||
alpha= mistfactor(har->co)*har->alfa;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else alpha= har->alfa;
|
else alpha= har->alfa;
|
||||||
|
|||||||
@@ -86,11 +86,11 @@
|
|||||||
/* global for this file. struct render will be more dynamic later, to allow multiple renderers */
|
/* global for this file. struct render will be more dynamic later, to allow multiple renderers */
|
||||||
RE_Render R;
|
RE_Render R;
|
||||||
|
|
||||||
float mistfactor(float *co) /* dist en height, return alpha */
|
float mistfactor(float zcor, float *co) /* dist en height, return alpha */
|
||||||
{
|
{
|
||||||
float fac, hi;
|
float fac, hi;
|
||||||
|
|
||||||
fac= R.zcor - R.wrld.miststa; /* R.zcor is calculated per pixel */
|
fac= zcor - R.wrld.miststa; /* zcor is calculated per pixel */
|
||||||
|
|
||||||
/* fac= -co[2]-R.wrld.miststa; */
|
/* fac= -co[2]-R.wrld.miststa; */
|
||||||
|
|
||||||
@@ -168,8 +168,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
|
|||||||
|
|
||||||
if(R.wrld.mode & WO_MIST) {
|
if(R.wrld.mode & WO_MIST) {
|
||||||
/* patchy... */
|
/* patchy... */
|
||||||
R.zcor= -lar->co[2];
|
haint *= mistfactor(-lar->co[2], lar->co);
|
||||||
haint *= mistfactor(lar->co);
|
|
||||||
if(haint==0.0) {
|
if(haint==0.0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1948,7 +1947,7 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
|
|||||||
}
|
}
|
||||||
else if( (vlaknr & 0x7FFFFF) <= R.totvlak) {
|
else if( (vlaknr & 0x7FFFFF) <= R.totvlak) {
|
||||||
VertRen *v1, *v2, *v3;
|
VertRen *v1, *v2, *v3;
|
||||||
float alpha, fac, dvlak, deler;
|
float alpha, fac, dvlak, deler, zcor;
|
||||||
|
|
||||||
vlr= RE_findOrAddVlak( (vlaknr-1) & 0x7FFFFF);
|
vlr= RE_findOrAddVlak( (vlaknr-1) & 0x7FFFFF);
|
||||||
|
|
||||||
@@ -1987,8 +1986,8 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
deler= vlr->n[0]*shi.view[0] + vlr->n[1]*shi.view[1] + vlr->n[2]*shi.view[2];
|
deler= vlr->n[0]*shi.view[0] + vlr->n[1]*shi.view[1] + vlr->n[2]*shi.view[2];
|
||||||
if (deler!=0.0) fac= R.zcor= dvlak/deler;
|
if (deler!=0.0) fac= zcor= dvlak/deler;
|
||||||
else fac= R.zcor= 0.0;
|
else fac= zcor= 0.0;
|
||||||
|
|
||||||
shi.co[0]= fac*shi.view[0];
|
shi.co[0]= fac*shi.view[0];
|
||||||
shi.co[1]= fac*shi.view[1];
|
shi.co[1]= fac*shi.view[1];
|
||||||
@@ -2010,7 +2009,7 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fac= Normalise(shi.view);
|
fac= Normalise(shi.view);
|
||||||
R.zcor*= fac; /* for mist */
|
zcor*= fac; /* for mist */
|
||||||
|
|
||||||
if(shi.osatex) {
|
if(shi.osatex) {
|
||||||
if( (shi.mat->texco & TEXCO_REFL) ) {
|
if( (shi.mat->texco & TEXCO_REFL) ) {
|
||||||
@@ -2129,7 +2128,7 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
|
|||||||
|
|
||||||
/* MIST */
|
/* MIST */
|
||||||
if( (R.wrld.mode & WO_MIST) && (shi.mat->mode & MA_NOMIST)==0 ){
|
if( (R.wrld.mode & WO_MIST) && (shi.mat->mode & MA_NOMIST)==0 ){
|
||||||
alpha= mistfactor(shi.co);
|
alpha= mistfactor(zcor, shi.co);
|
||||||
}
|
}
|
||||||
else alpha= 1.0;
|
else alpha= 1.0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user