forked from bartvdbraak/blender
Little cleanup of eerie unified code for halos. Still got no clue what
was original idea of this implementation... At least it's protected from crashing a bit more.
This commit is contained in:
parent
0b0f82bbb2
commit
35f4c77d96
@ -53,8 +53,6 @@
|
||||
*/
|
||||
void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *t, int mask);
|
||||
|
||||
void *renderHaloPixel(RE_COLBUFTYPE *collector, float x, float y, int haloNr) ;
|
||||
|
||||
|
||||
void setSkyBlendingMode(enum RE_SkyAlphaBlendingType mode);
|
||||
|
||||
|
@ -75,6 +75,53 @@
|
||||
- unified render now uses face render routines from rendercore.c
|
||||
- todo still: shalo render and sky routines */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static int calcHaloZ(HaloRen *har, int zz)
|
||||
{
|
||||
|
||||
if(har->type & HA_ONLYSKY) {
|
||||
if(zz!=0x7FFFFFFF) zz= - 0x7FFFFF;
|
||||
}
|
||||
else {
|
||||
zz= (zz>>8);
|
||||
}
|
||||
return zz;
|
||||
}
|
||||
|
||||
void *renderHaloPixel(RE_COLBUFTYPE *collector, float x, float y, int haloNr)
|
||||
{
|
||||
HaloRen *har = NULL;
|
||||
float dist = 0.0;
|
||||
int zz = 0;
|
||||
|
||||
/* Find har to go with haloNr */
|
||||
har = RE_findOrAddHalo(haloNr);
|
||||
|
||||
/* zz is a strange number... This call should effect that halo's are */
|
||||
/* never cut? Seems a bit strange to me now... (nzc) */
|
||||
/* it checks for sky... which is info not available in unified (ton) */
|
||||
zz = calcHaloZ(har, 0x7FFFFFFF);
|
||||
if(zz> har->zs) {
|
||||
|
||||
/* distance of this point wrt. the halo center. Maybe xcor is also needed? */
|
||||
dist = ((x - har->xs) * (x - har->xs))
|
||||
+ ((y - har->ys) * (y - har->ys) * R.ycor * R.ycor) ;
|
||||
|
||||
collector[0] = 0.0f; collector[1] = 0.0f;
|
||||
collector[2] = 0.0f; collector[3] = 0.0f;
|
||||
|
||||
if (dist < har->radsq) {
|
||||
shadeHaloFloat(har, collector, zz, dist,
|
||||
(x - har->xs), (y - har->ys) * R.ycor, har->flarec);
|
||||
}; /* else: this pixel is not rendered for this halo: no colour */
|
||||
}
|
||||
return (void*) har;
|
||||
|
||||
} /* end of void* renderHaloPixel(float x, float y, int haloNr) */
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *obdata, int mask)
|
||||
@ -104,49 +151,6 @@ void renderSpotHaloPixel(float x, float y, float* target)
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static int calcHaloZ(HaloRen *har, int zz)
|
||||
{
|
||||
|
||||
if(har->type & HA_ONLYSKY) {
|
||||
if(zz!=0x7FFFFFFF) zz= 0;
|
||||
}
|
||||
else {
|
||||
zz= (zz>>8);
|
||||
}
|
||||
return zz;
|
||||
}
|
||||
|
||||
void *renderHaloPixel(RE_COLBUFTYPE *collector, float x, float y, int haloNr)
|
||||
{
|
||||
HaloRen *har = NULL;
|
||||
float dist = 0.0;
|
||||
int zz = 0;
|
||||
|
||||
/* Find har to go with haloNr */
|
||||
har = RE_findOrAddHalo(haloNr);
|
||||
|
||||
/* zz is a strange number... This call should effect that halo's are */
|
||||
/* never cut? Seems a bit strange to me now... */
|
||||
/* This might be the zbuffer depth */
|
||||
zz = calcHaloZ(har, 0x7FFFFFFF);
|
||||
|
||||
/* distance of this point wrt. the halo center. Maybe xcor is also needed? */
|
||||
dist = ((x - har->xs) * (x - har->xs))
|
||||
+ ((y - har->ys) * (y - har->ys) * R.ycor * R.ycor) ;
|
||||
|
||||
collector[0] = 0.0f; collector[1] = 0.0f;
|
||||
collector[2] = 0.0f; collector[3] = 0.0f;
|
||||
|
||||
if (dist < har->radsq) {
|
||||
shadeHaloFloat(har, collector, zz, dist,
|
||||
(x - har->xs), (y - har->ys) * R.ycor, har->flarec);
|
||||
}; /* else: this pixel is not rendered for this halo: no colour */
|
||||
|
||||
return (void*) har;
|
||||
|
||||
} /* end of void* renderHaloPixel(float x, float y, int haloNr) */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
extern float hashvectf[];
|
||||
@ -486,7 +490,8 @@ void shadeHaloFloat(HaloRen *har, float *col, int zz,
|
||||
else col[3]= dist;
|
||||
}
|
||||
|
||||
if(har->mat && har->mat->mode & MA_HALO_SHADE) {
|
||||
if(har->mat) {
|
||||
if(har->mat->mode & MA_HALO_SHADE) {
|
||||
/* we test for lights because of preview... */
|
||||
if(R.totlamp) render_lighting_halo(har, col);
|
||||
}
|
||||
@ -513,6 +518,7 @@ void shadeHaloFloat(HaloRen *har, float *col, int zz,
|
||||
else col[3]+= ringf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user