Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/render/extern/include/render.h2
-rw-r--r--source/blender/render/extern/include/render_types.h12
-rw-r--r--source/blender/render/intern/include/pixelshading.h2
-rw-r--r--source/blender/render/intern/include/rendercore.h16
-rw-r--r--source/blender/render/intern/include/zbuf.h2
-rw-r--r--source/blender/render/intern/source/initrender.c2
-rw-r--r--source/blender/render/intern/source/pixelblending.c2
-rw-r--r--source/blender/render/intern/source/pixelshading.c14
-rw-r--r--source/blender/render/intern/source/renderHelp.c10
-rw-r--r--source/blender/render/intern/source/rendercore.c356
-rw-r--r--source/blender/render/intern/source/renderdatabase.c10
-rw-r--r--source/blender/render/intern/source/vanillaRenderPipe.c6
-rw-r--r--source/blender/render/intern/source/zbuf.c80
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c8
14 files changed, 271 insertions, 251 deletions
diff --git a/source/blender/render/extern/include/render.h b/source/blender/render/extern/include/render.h
index 417702c6860..646d1838479 100644
--- a/source/blender/render/extern/include/render.h
+++ b/source/blender/render/extern/include/render.h
@@ -259,7 +259,7 @@ void RE_renderflare(struct HaloRen *har);
*/
void RE_shadehalo(struct HaloRen *har,
char *col, float *colf,
- unsigned int zz,
+ int zz,
float dist,
float x,
float y,
diff --git a/source/blender/render/extern/include/render_types.h b/source/blender/render/extern/include/render_types.h
index 05a5380847c..7c7499740cc 100644
--- a/source/blender/render/extern/include/render_types.h
+++ b/source/blender/render/extern/include/render_types.h
@@ -140,8 +140,8 @@ typedef struct RE_Render
struct VertRen **blove;
struct HaloRen **bloha;
- unsigned int *rectaccu;
- unsigned int *rectz; /* z buffer: distance buffer */
+ int *rectaccu;
+ int *rectz; /* z buffer: distance buffer */
unsigned int *rectf1, *rectf2;
unsigned int *rectot; /* z buffer: face index buffer, recycled as colour buffer! */
unsigned int *rectspare; /* */
@@ -170,7 +170,7 @@ typedef struct ShadBuf {
float d,far,pixsize,soft;
int co[3];
int size,bias;
- unsigned long *zbuf;
+ long *zbuf;
char *cbuf;
} ShadBuf;
@@ -194,7 +194,7 @@ typedef struct VertRen
struct halosort {
struct HaloRen *har;
- unsigned int z;
+ int z;
};
/* ------------------------------------------------------------------------- */
@@ -229,8 +229,8 @@ typedef struct HaloRen
short miny, maxy;
float alfa, xs, ys, rad, radsq, sin, cos, co[3], no[3];
float hard, b, g, r;
- unsigned int zs, zd;
- unsigned int zBufDist; /* depth in the z-buffer coordinate system */
+ int zs, zd;
+ int zBufDist; /* depth in the z-buffer coordinate system */
char starpoints, type, add, tex;
char linec, ringc, seed;
short flarec; /* used to be a char. why ?*/
diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h
index 2f888cf05cf..8a1b6b7007c 100644
--- a/source/blender/render/intern/include/pixelshading.h
+++ b/source/blender/render/intern/include/pixelshading.h
@@ -59,7 +59,7 @@ void *renderHaloPixel(RE_COLBUFTYPE *collector, float x, float y, int haloNr) ;
void setSkyBlendingMode(enum RE_SkyAlphaBlendingType mode);
void shadeHaloFloat(HaloRen *har,
- float *col, unsigned int zz,
+ float *col, int zz,
float dist, float xn,
float yn, short flarec);
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 44aedf5392a..158977cef5a 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -57,10 +57,8 @@ typedef struct ShadeResult
typedef struct PixStr
{
struct PixStr *next;
- int vlak0, vlak;
- unsigned int z;
- unsigned int mask;
- short aantal, ronde;
+ int facenr, z;
+ unsigned short mask, amount;
} PixStr;
/* ------------------------------------------------------------------------- */
@@ -104,7 +102,7 @@ void zbufshadeDA(void); /* Delta Accum Pixel Struct */
/**
* Also called in: zbuf.c
*/
-void *shadepixel(float x, float y, int vlaknr, int mask, float *col);
+void *shadepixel(float x, float y, int z, int facenr, int mask, float *col);
/**
* A cryptic but very efficient way of counting the number of bits that
@@ -112,13 +110,5 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col);
*/
int count_mask(unsigned short mask);
-/* These defines are only used internally :) */
-/* dirty hack: pointers are negative, indices positive */
-/* pointers should be converted to positive numbers */
-
-#define IS_A_POINTER_CODE(a) ((a)<0)
-#define POINTER_FROM_CODE(a) ((void *)(-(a)))
-#define POINTER_TO_CODE(a) (-(long)(a))
-
#endif /* RENDER_EXT_H */
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index 73f6644650f..003342ee9f1 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -67,7 +67,7 @@ struct VlakRen;
* @param y The height of the rectangle
* @param val The value used to fill the rectangle.
*/
-void fillrect(unsigned int *rect, int x, int y, unsigned int val);
+void fillrect(int *rect, int x, int y, int val);
/**
* Converts a world coordinate into a homogenous coordinate in view
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 4459a92dd25..c4d7c0c0d62 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -1345,6 +1345,8 @@ void RE_initrender(struct View3D *ogl_render_view3d)
if ((G.scene->r.scemode & R_OGL)==0) /* header gets scrabled if renderwindow holds OGL context */
RE_local_printrenderinfo((PIL_check_seconds_timer() - start_time), -1);
+ /* grms... this is a nasty global */
+ do_gamma= 0;
/* these flags remain on, until reset in caller to render (renderwin.c) */
R.flag &= (R_RENDERING|R_ANIMRENDER|R_REDRAW_PRV);
diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c
index d2a3b0678d9..f774a624ba9 100644
--- a/source/blender/render/intern/source/pixelblending.c
+++ b/source/blender/render/intern/source/pixelblending.c
@@ -461,7 +461,7 @@ void sampleFloatColV2FloatColVFilter(float *sample, float *dest1, float *dest2,
}
}
-} /* end void sampleFloatColVToFloatColV(unsigned short *, unsigned short *) */
+}
/* ------------------------------------------------------------------------- */
/* The following functions are 'old' blending functions: */
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index eac8e2ee149..cd187ee6d2a 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -82,7 +82,7 @@ void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *obdata, int m
void* data = NULL;
if (obdata[3] & RE_POLY) {
- data = shadepixel(x, y, obdata[1], mask, collector);
+ data = shadepixel(x, y, obdata[0], obdata[1], mask, collector);
}
else if (obdata[3] & RE_HALO) {
data = renderHaloPixel(collector, x, y, obdata[1]);
@@ -90,7 +90,7 @@ void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *obdata, int m
else if( obdata[1] == 0 ) {
/* for lamphalo, but doesn't seem to be called? Actually it is, and */
/* it returns NULL pointers. */
- data = shadepixel(x, y, obdata[1], mask, collector);
+ data = shadepixel(x, y, obdata[0], obdata[1], mask, collector);
}
return data;
@@ -100,12 +100,12 @@ void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *obdata, int m
void renderSpotHaloPixel(float x, float y, float* target)
{
- shadepixel(x, y, 0, 0, target);
+ shadepixel(x, y, 0, 0, 0, target);
}
/* ------------------------------------------------------------------------- */
-static unsigned int calcHaloZ(HaloRen *har, unsigned int zz)
+static int calcHaloZ(HaloRen *har, int zz)
{
if(har->type & HA_ONLYSKY) {
@@ -113,8 +113,6 @@ static unsigned int calcHaloZ(HaloRen *har, unsigned int zz)
}
else {
zz= (zz>>8);
- if(zz<0x800000) zz= (zz+0x7FFFFF);
- else zz= (zz-0x800000);
}
return zz;
}
@@ -123,7 +121,7 @@ void *renderHaloPixel(RE_COLBUFTYPE *collector, float x, float y, int haloNr)
{
HaloRen *har = NULL;
float dist = 0.0;
- unsigned int zz = 0;
+ int zz = 0;
/* Find har to go with haloNr */
har = RE_findOrAddHalo(haloNr);
@@ -325,7 +323,7 @@ static void render_lighting_halo(HaloRen *har, float *colf)
-void shadeHaloFloat(HaloRen *har, float *col, unsigned int zz,
+void shadeHaloFloat(HaloRen *har, float *col, int zz,
float dist, float xn, float yn, short flarec)
{
/* fill in col */
diff --git a/source/blender/render/intern/source/renderHelp.c b/source/blender/render/intern/source/renderHelp.c
index ef885eccbc3..5b0ae9147aa 100644
--- a/source/blender/render/intern/source/renderHelp.c
+++ b/source/blender/render/intern/source/renderHelp.c
@@ -203,9 +203,10 @@ void setzbufvlaggen( void (*projectfunc)(float *, float *) )
har->ys= 0.5*R.recty*(1.0+hoco[1]/zn);
/* this should be the zbuffer coordinate */
- har->zs= 0x7FFFFF*(1.0+hoco[2]/zn);
+ har->zs= 0x7FFFFF*(hoco[2]/zn);
/* taking this from the face clip functions? seems ok... */
har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn);
+
vec[0]+= har->hasize;
projectfunc(vec, hoco);
vec[0]-= har->hasize;
@@ -227,14 +228,9 @@ void setzbufvlaggen( void (*projectfunc)(float *, float *) )
vec[2]-= har->hasize; /* z negative, otherwise it's clipped */
projectfunc(vec, hoco);
zn= hoco[3];
- zn= fabs(har->zs - 0x7FFFFF*(1.0+hoco[2]/zn));
+ zn= fabs( (float)har->zs - 0x7FFFFF*(hoco[2]/zn));
har->zd= CLAMPIS(zn, 0, INT_MAX);
- /* if( har->zs < 2*har->zd) { */
- /* PRINT2(d, d, har->zs, har->zd); */
- /* har->alfa= har->mat->alpha * ((float)(har->zs))/(float)(2*har->zd); */
- /* } */
-
}
}
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index a8a5136263a..d3b87980939 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -346,7 +346,7 @@ static void renderspothalo(ShadeInput *shi, float *col)
}
-static unsigned int calchalo_z(HaloRen *har, unsigned int zz)
+static int calchalo_z(HaloRen *har, int zz)
{
if(har->type & HA_ONLYSKY) {
@@ -354,22 +354,20 @@ static unsigned int calchalo_z(HaloRen *har, unsigned int zz)
}
else {
zz= (zz>>8);
- if(zz<0x800000) zz= (zz+0x7FFFFF);
- else zz= (zz-0x800000);
}
return zz;
}
-static void scanlinehaloPS(unsigned int *rectz, long *rectdelta, float *rowbuf, short ys)
+static void scanlinehaloPS(int *rectz, long *rectdelta, float *rowbuf, short ys)
{
HaloRen *har = NULL;
PixStr *ps;
float dist, xsq, ysq, xn, yn;
float *rb;
float col[4], accol[4];
- unsigned int a, *rz, zz;
+ int a, *rz, zz, didgamma=0;
long *rd;
- short minx, maxx, x, aantal, aantalm, flarec;
+ short minx, maxx, x, amount, amountm, flarec;
for(a=0; a<R.tothalo; a++) {
if((a & 255)==0) {
@@ -398,28 +396,44 @@ static void scanlinehaloPS(unsigned int *rectz, long *rectdelta, float *rowbuf,
ysq= yn*yn;
for(x=minx; x<=maxx; x++) {
- flarec= har->flarec; /* har->pixels is inly allowd to count once */
-
- if( IS_A_POINTER_CODE(*rd)) {
- xn= x-har->xs;
- xsq= xn*xn;
- dist= xsq+ysq;
- if(dist<har->radsq) {
+ xn= x-har->xs;
+ xsq= xn*xn;
+ dist= xsq+ysq;
+
+ if(dist<har->radsq) {
+
+ /* well yah, halo adding shouldnt be done gamma corrected, have to bypass it this way */
+ /* alternative is moving it outside of thread renderlineDA */
+ /* on positive side; the invert correct cancels out correcting halo color */
+ if(do_gamma && didgamma==0) {
+ float *buf= rowbuf;
+ int xt;
+ for(xt=0; xt<R.rectx; xt++, buf+=4) {
+ buf[0]= invGammaCorrect(buf[0]);
+ buf[1]= invGammaCorrect(buf[1]);
+ buf[2]= invGammaCorrect(buf[2]);
+ }
+ didgamma= 1;
+ }
+
+ flarec= har->flarec; /* har->pixels is only allowed to count once */
+
+ if(*rd) { /* theres a pixel struct */
- ps= (PixStr *) POINTER_FROM_CODE(*rd);
- aantal= 0;
+ ps= (PixStr *)(*rd);
+ amount= 0;
accol[0]=accol[1]=accol[2]=accol[3]= 0.0;
while(ps) {
- aantalm= count_mask(ps->mask);
- aantal+= aantalm;
+ amountm= count_mask(ps->mask);
+ amount+= amountm;
zz= calchalo_z(har, ps->z);
if(zz> har->zs) {
float fac;
shadeHaloFloat(har, col, zz, dist, xn, yn, flarec);
- fac= ((float)aantalm)/(float)R.osa;
+ fac= ((float)amountm)/(float)R.osa;
accol[0]+= fac*col[0];
accol[1]+= fac*col[1];
accol[2]+= fac*col[2];
@@ -429,48 +443,30 @@ static void scanlinehaloPS(unsigned int *rectz, long *rectdelta, float *rowbuf,
ps= ps->next;
}
- ps= (PixStr *) POINTER_FROM_CODE(*rd);
- aantal= R.osa-aantal;
-
- zz= calchalo_z(har, *rz);
- if(zz> har->zs) {
+ /* now do the sky sub-pixels */
+ amount= R.osa-amount;
+ if(amount) {
float fac;
- shadeHaloFloat(har, col, zz, dist, xn, yn, flarec);
- fac= ((float)aantal)/(float)R.osa;
+ shadeHaloFloat(har, col, 0x7FFFFF, dist, xn, yn, flarec);
+ fac= ((float)amount)/(float)R.osa;
accol[0]+= fac*col[0];
accol[1]+= fac*col[1];
accol[2]+= fac*col[2];
accol[3]+= fac*col[3];
}
-
col[0]= accol[0];
col[1]= accol[1];
col[2]= accol[2];
col[3]= accol[3];
- /* if(behind > (R.osa>>1)) addalphaUnder(rt,col); */
- if(do_gamma) {
- col[0]= gammaCorrect(col[0]);
- col[1]= gammaCorrect(col[1]);
- col[2]= gammaCorrect(col[2]);
- }
addalphaAddfacFloat(rb, col, har->add);
}
- }
- else {
- zz= calchalo_z(har, *rz);
- if(zz> har->zs) {
- xn= x- har->xs;
- xsq= xn*xn;
- dist= xsq+ysq;
- if(dist<har->radsq) {
+ else {
+ zz= calchalo_z(har, *rz);
+ if(zz> har->zs) {
+
shadeHaloFloat(har, col, zz, dist, xn, yn, flarec);
- if(do_gamma) {
- col[0]= gammaCorrect(col[0]);
- col[1]= gammaCorrect(col[1]);
- col[2]= gammaCorrect(col[2]);
- }
addalphaAddfacFloat(rb, col, har->add);
}
}
@@ -482,14 +478,26 @@ static void scanlinehaloPS(unsigned int *rectz, long *rectdelta, float *rowbuf,
}
}
}
+
+ /* the entire scanline has to be put back in gammaspace */
+ if(didgamma) {
+ float *buf= rowbuf;
+ int xt;
+ for(xt=0; xt<R.rectx; xt++, buf+=4) {
+ buf[0]= gammaCorrect(buf[0]);
+ buf[1]= gammaCorrect(buf[1]);
+ buf[2]= gammaCorrect(buf[2]);
+ }
+ }
+
}
-static void scanlinehalo(unsigned int *rectz, float *rowbuf, short ys)
+static void scanlinehalo(int *rectz, float *rowbuf, short ys)
{
HaloRen *har = NULL;
float dist, xsq, ysq, xn, yn, *rb;
float col[4];
- unsigned int a, *rz, zz;
+ int a, *rz, zz;
short minx, maxx, x;
for(a=0; a<R.tothalo; a++) {
@@ -1918,21 +1926,49 @@ void shade_input_set_coords(ShadeInput *shi, float u, float v, int i1, int i2, i
}
}
- /* x,y: window coordinate from 0 to rectx,y */
- /* return pointer to rendered face */
+#if 0
+/* return labda for view vector being closest to line v3-v4 */
+/* was used for wire render */
+static float isec_view_line(float *view, float *v3, float *v4)
+{
+ float vec[3];
+ float dot0, dot1, dot2, veclen, viewlen;
+ float fac, div;
+
+ vec[0]= v4[0] - v3[0];
+ vec[1]= v4[1] - v3[1];
+ vec[2]= v4[2] - v3[2];
+
+ dot0 = v3[0]*vec[0] + v3[1]*vec[1] + v3[2]*vec[2];
+ dot1 = vec[0]*view[0] + vec[1]*view[1] + vec[2]*view[2];
+ dot2 = v3[0]*view[0] + v3[1]*view[1] + v3[2]*view[2];
+
+ veclen = vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2];
+ viewlen = view[0]*view[0] + view[1]*view[1] + view[2]*view[2];
+
+ div = viewlen*veclen - dot1*dot1;
+ if (div==0.0) return 0.0;
+
+ fac = dot2*veclen - dot0*dot1;
+ return fac/div;
+}
+#endif
+
-float bluroffsx, bluroffsy; // set in initrender.c (ton)
+float bluroffsx=0.0, bluroffsy=0.0; // set in initrender.c (bad, ton)
-void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
+/* x,y: window coordinate from 0 to rectx,y */
+/* return pointer to rendered face */
+void *shadepixel(float x, float y, int z, int facenr, int mask, float *col)
{
ShadeResult shr;
ShadeInput shi;
VlakRen *vlr=NULL;
- if(vlaknr< 0) { /* error */
+ if(facenr< 0) { /* error */
return NULL;
}
- /* currently in use for dithering soft shadow */
+ /* currently in use for dithering (soft shadow) and detecting thread */
shi.xs= x;
shi.ys= y;
@@ -1940,14 +1976,14 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
shi.mask= mask;
shi.depth= 0; // means first hit, not raytracing
- if(vlaknr==0) { /* sky */
+ if(facenr==0) { /* sky */
col[0]= 0.0; col[1]= 0.0; col[2]= 0.0; col[3]= 0.0;
}
- else if( (vlaknr & 0x7FFFFF) <= R.totvlak) {
+ else if( (facenr & 0x7FFFFF) <= R.totvlak) {
VertRen *v1, *v2, *v3;
- float alpha, fac, dvlak, deler, zcor;
+ float alpha, fac, zcor;
- vlr= RE_findOrAddVlak( (vlaknr-1) & 0x7FFFFF);
+ vlr= RE_findOrAddVlak( (facenr-1) & 0x7FFFFF);
shi.vlr= vlr;
shi.mat= vlr->mat;
@@ -1964,7 +2000,6 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
shi.puno= vlr->puno;
v1= vlr->v1;
- dvlak= v1->co[0]*shi.facenor[0]+v1->co[1]*shi.facenor[1]+v1->co[2]*shi.facenor[2];
/* COXYZ AND VIEW VECTOR */
shi.view[0]= (x+(R.xstart)+bluroffsx +0.5);
@@ -1986,32 +2021,8 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
shi.view[0]= panoco*u + panosi*v;
shi.view[2]= -panosi*u + panoco*v;
}
-
- deler= shi.facenor[0]*shi.view[0] + shi.facenor[1]*shi.view[1] + shi.facenor[2]*shi.view[2];
- if (deler!=0.0) fac= zcor= dvlak/deler;
- else fac= zcor= 0.0;
-
- shi.co[0]= fac*shi.view[0];
- shi.co[1]= fac*shi.view[1];
- shi.co[2]= fac*shi.view[2];
- /* pixel dx/dy for render coord */
- if(shi.osatex || (R.r.mode & R_SHADOW) ) {
- float u= dvlak/(deler-shi.facenor[0]);
- float v= dvlak/(deler- R.ycor*shi.facenor[1]);
-
- shi.dxco[0]= shi.co[0]- (shi.view[0]-1.0)*u;
- shi.dxco[1]= shi.co[1]- (shi.view[1])*u;
- shi.dxco[2]= shi.co[2]- (shi.view[2])*u;
-
- shi.dyco[0]= shi.co[0]- (shi.view[0])*v;
- shi.dyco[1]= shi.co[1]- (shi.view[1]-1.0*R.ycor)*v;
- shi.dyco[2]= shi.co[2]- (shi.view[2])*v;
-
- }
-
fac= Normalise(shi.view);
- zcor*= fac; /* for mist */
if(shi.osatex) {
if( (shi.mat->texco & TEXCO_REFL) ) {
@@ -2020,8 +2031,49 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
}
}
+ /* wire cannot use normal for calculating shi.co */
+ if(shi.mat->mode & MA_WIRE) {
+ float zco;
+ /* inverse of zbuf calc: zbuf = MAXZ*hoco_z/hoco_w */
+
+ zco= ((float)z)/(float)0x7FFFFFFF;
+ shi.co[2]= R.winmat[3][2]/( R.winmat[2][3]*zco - R.winmat[2][2] );
+
+ fac= zcor= shi.co[2]/shi.view[2];
+
+ shi.co[0]= fac*shi.view[0];
+ shi.co[1]= fac*shi.view[1];
+ }
+ else {
+ float div, dface;
+
+ dface= v1->co[0]*shi.facenor[0]+v1->co[1]*shi.facenor[1]+v1->co[2]*shi.facenor[2];
+ div= shi.facenor[0]*shi.view[0] + shi.facenor[1]*shi.view[1] + shi.facenor[2]*shi.view[2];
+ if (div!=0.0) fac= zcor= dface/div;
+ else fac= zcor= 0.0;
+
+ shi.co[0]= fac*shi.view[0];
+ shi.co[1]= fac*shi.view[1];
+ shi.co[2]= fac*shi.view[2];
+
+ /* pixel dx/dy for render coord */
+ if(shi.osatex || (R.r.mode & R_SHADOW) ) {
+ float u= dface/(div-shi.facenor[0]);
+ float v= dface/(div- R.ycor*shi.facenor[1]);
+
+ shi.dxco[0]= shi.co[0]- (shi.view[0]-1.0)*u;
+ shi.dxco[1]= shi.co[1]- (shi.view[1])*u;
+ shi.dxco[2]= shi.co[2]- (shi.view[2])*u;
+
+ shi.dyco[0]= shi.co[0]- (shi.view[0])*v;
+ shi.dyco[1]= shi.co[1]- (shi.view[1]-1.0*R.ycor)*v;
+ shi.dyco[2]= shi.co[2]- (shi.view[2])*v;
+
+ }
+ }
+
/* calcuate normals, texture coords, vertex colors, etc */
- if(vlaknr & 0x800000)
+ if(facenr & 0x800000)
shade_input_set_coords(&shi, 1.0, 1.0, 0, 2, 3);
else
shade_input_set_coords(&shi, 1.0, 1.0, 0, 1, 2);
@@ -2045,7 +2097,7 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
float *o1, *o2, *o3, hox, hoy, l, dl, u, v;
float s00, s01, s10, s11, detsh;
- if(vlaknr & 0x800000) {
+ if(facenr & 0x800000) {
v2= vlr->v3; v3= vlr->v4;
} else {
v2= vlr->v2; v3= vlr->v3;
@@ -2146,7 +2198,7 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
}
if(R.flag & R_LAMPHALO) {
- if(vlaknr<=0) { /* calc view vector and put shi.co at far */
+ if(facenr<=0) { /* calc view vector and put shi.co at far */
shi.view[0]= (x+(R.xstart)+0.5);
@@ -2177,11 +2229,11 @@ void *shadepixel(float x, float y, int vlaknr, int mask, float *col)
return vlr;
}
-static void shadepixel_sky(float x, float y, int vlaknr, int mask, float *colf)
+static void shadepixel_sky(float x, float y, int z, int facenr, int mask, float *colf)
{
float collector[4];
- shadepixel(x, y, vlaknr, mask, colf);
+ shadepixel(x, y, z, facenr, mask, colf);
if(colf[3] != 1.0) {
renderSkyPixelFloat(collector, x, y);
addAlphaOverFloat(collector, colf);
@@ -2191,8 +2243,8 @@ static void shadepixel_sky(float x, float y, int vlaknr, int mask, float *colf)
/* ************* pixel struct ******** */
-PixStrMain psmfirst;
-int psmteller;
+static PixStrMain psmfirst;
+static int psmteller;
static PixStr *addpsmain(void)
{
@@ -2234,51 +2286,36 @@ static void freeps(void)
psmfirst.ps= 0;
}
-static void addps(long *rd, int vlak, unsigned int z, short ronde)
+static void addps(long *rd, int facenr, int z, unsigned short mask)
{
- static PixStr *prev;
+ static PixStr *cur;
PixStr *ps, *last = NULL;
- if( IS_A_POINTER_CODE(*rd)) {
- ps= (PixStr *) POINTER_FROM_CODE(*rd);
-
- if(ps->vlak0==vlak) return;
+ if(*rd) {
+ ps= (PixStr *)(*rd);
while(ps) {
- if( ps->vlak == vlak ) {
- ps->mask |= (1<<ronde);
+ if( ps->facenr == facenr ) {
+ ps->mask |= mask;
return;
}
last= ps;
ps= ps->next;
}
-
- if((psmteller & 4095)==0) prev= addpsmain();
- else prev++;
- psmteller++;
-
- last->next= prev;
- prev->next= 0;
- prev->vlak= vlak;
- prev->z= z;
- prev->mask = (1<<ronde);
- prev->ronde= ronde;
-
- return;
}
- /* make first PS (pixel struct) */
- if((psmteller & 4095)==0) prev= addpsmain();
- else prev++;
+ /* make new PS (pixel struct) */
+ if((psmteller & 4095)==0) cur= addpsmain();
+ else cur++;
psmteller++;
- prev->next= 0;
- prev->vlak0= (int) *rd;
- prev->vlak= vlak;
- prev->z= z;
- prev->mask = (1<<ronde);
- prev->ronde= ronde;
- *rd= POINTER_TO_CODE(prev);
+ if(last) last->next= cur;
+ else *rd= (long)cur;
+
+ cur->next= NULL;
+ cur->facenr= facenr;
+ cur->z= z;
+ cur->mask = mask;
}
@@ -2361,7 +2398,7 @@ static void edge_enhance(void)
/* ********************* MAINLOOPS ******************** */
struct renderlineDA {
long *rd;
- unsigned int *rz;
+ int *rz;
float *rb1, *rb2, *rb3;
float *acol;
int y;
@@ -2374,8 +2411,8 @@ static int do_renderlineDA(void *poin)
float xs, ys;
float fcol[4], *acol=NULL;
long *rd= rl->rd;
- int samp, curmask, face, mask, fullmask;
- int b, x, full_osa, face0;
+ int zbuf, samp, curmask, face, mask, fullmask;
+ int b, x, full_osa;
fullmask= (1<<R.osa)-1;
@@ -2386,24 +2423,21 @@ static int do_renderlineDA(void *poin)
for(x=0; x<R.rectx; x++, rd++) {
- if( IS_A_POINTER_CODE(*rd))
- ps= (PixStr *) POINTER_FROM_CODE(*rd);
- else ps= NULL;
-
- if(ps) face0= ps->vlak0;
- else face0= (int)*rd;
+ ps= (PixStr *)(*rd);
mask= 0;
- /* complex loop, because first pixelstruct has a vlak0, without mask */
+ /* complex loop, because empty spots are sky, without mask */
while(TRUE) {
if(ps==NULL) {
- face= face0;
+ face= 0;
curmask= (~mask) & fullmask;
+ zbuf= *(rl->rz+x);
}
else {
- face= ps->vlak;
+ face= ps->facenr;
curmask= ps->mask;
+ zbuf= ps->z;
}
/* check osa level */
@@ -2418,7 +2452,7 @@ static int do_renderlineDA(void *poin)
if(curmask & (1<<samp)) {
xs= (float)x + jit[samp][0];
ys= (float)rl->y + jit[samp][1];
- shadepixel_sky(xs, ys, face, (1<<samp), fcol);
+ shadepixel_sky(xs, ys, zbuf, face, (1<<samp), fcol);
if(acol && acol[3]!=0.0) addAlphaOverFloat(fcol, acol);
if(do_gamma) {
@@ -2437,7 +2471,7 @@ static int do_renderlineDA(void *poin)
b= centmask[curmask];
xs= (float)x+centLut[b & 15];
ys= (float)rl->y+centLut[b>>4];
- shadepixel_sky(xs, ys, face, curmask, fcol);
+ shadepixel_sky(xs, ys, zbuf, face, curmask, fcol);
if(acol && acol[3]!=0.0) addAlphaOverFloat(fcol, acol);
@@ -2462,7 +2496,6 @@ static int do_renderlineDA(void *poin)
}
if(R.flag & R_HALO) {
- /* from these pixels the pixstr is 1 scanline old */
scanlinehaloPS(rl->rz, rl->rd, rl->rb2-4*R.rectx + 4, rl->y);
}
@@ -2475,7 +2508,7 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
struct renderlineDA rl1, rl2;
float xd, yd, *rf;
long *rd;
- unsigned int *rz, *rp, *rt;
+ int *rz, *rp, *rt;
float *rowbuf1, *rowbuf2, *rowbuf3, *rowbuf0, *rowbuf1a, *rowbuf2a, *rb3;
int a;
short v, x, y;
@@ -2491,7 +2524,7 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
psmteller= 0;
if(R.r.mode & R_EDGE) {
- R.rectaccu= (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty,"zbufshadeDA");
+ R.rectaccu= (int *)MEM_callocN(sizeof(int)*R.rectx*R.recty,"zbufshadeDA");
}
for(v=0; v<R.osa; v++) {
@@ -2508,29 +2541,18 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
zbufferall();
- if(v==0) {
- a= R.rectx*R.recty;
- rt= R.rectot;
- rd= R.rectdaps;
- while(a--) {
- *rd= (long)*rt;
- rd++; rt++;
- }
- }
- else {
- rd= R.rectdaps;
- rp= R.rectot;
- rz= R.rectz;
- for(y=0; y<R.recty; y++) {
- for(x=0; x<R.rectx; x++, rp++, rd++) {
- if(*rd!= (long) *rp) {
- addps(rd, *rp, *(rz+x), v);
- }
+ rd= R.rectdaps;
+ rp= R.rectot;
+ rz= R.rectz;
+ for(y=0; y<R.recty; y++) {
+ for(x=0; x<R.rectx; x++, rp++, rd++) {
+ if(*rp) {
+ addps(rd, *rp, *(rz+x), 1<<v);
}
- rz+= R.rectx;
}
+ rz+= R.rectx;
}
- /* 1 is for osa */
+
if(R.r.mode & R_EDGE) edge_enhance();
if(RE_local_test_break()) break;
@@ -2608,7 +2630,7 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
else do_renderlineDA(&rl1);
}
- /* convert 4x32 bits buffer to 4x8, add halos. this can't be threaded due to gauss */
+ /* convert 4x32 bits buffer to 4x8, this can't be threaded due to gauss */
if(y>0) {
transferColourBufferToOutput(rowbuf3+4, y-1);
if(R.rectftot) {
@@ -2677,7 +2699,8 @@ void zbufshadeDA(void) /* Delta Accum Pixel Struct */
struct renderline {
float *rowbuf, *acol;
- unsigned int *rp, *rz;
+ int *rp;
+ int *rz;
short ys;
float y;
};
@@ -2687,16 +2710,15 @@ static int do_renderline(void *poin)
struct renderline *rl= poin;
float *fcol= rl->rowbuf;
float *acol=NULL;
- int x;
+ int x, *rz, *rp;
if(R.flag & R_ZTRA) { /* zbuf tra */
abufsetrow(rl->acol, rl->ys);
acol= rl->acol;
}
-
- for(x=0; x<R.rectx; x++, (rl->rp)++, fcol+=4) {
-
- shadepixel_sky((float)x, rl->y, *(rl->rp), 0, fcol);
+
+ for(x=0, rz= rl->rz, rp= rl->rp; x<R.rectx; x++, rz++, rp++, fcol+=4) {
+ shadepixel_sky((float)x, rl->y, *rz, *rp, 0, fcol);
if(acol) {
if(acol[3]!=0.0) addAlphaOverFloat(fcol, acol);
acol+= 4;
@@ -2721,7 +2743,7 @@ void zbufshade(void)
{
struct renderline rl1, rl2;
extern float Zjitx,Zjity;
- unsigned int *rz,*rp;
+ int *rz, *rp;
float fy;
int y;
@@ -2802,7 +2824,7 @@ void zbufshade(void)
/* ------------------------------------------------------------------------ */
-void RE_shadehalo(HaloRen *har, char *col, float *colf, unsigned int zz, float dist, float xn, float yn, short flarec)
+void RE_shadehalo(HaloRen *har, char *col, float *colf, int zz, float dist, float xn, float yn, short flarec)
{
shadeHaloFloat(har, colf, zz, dist, xn, yn, flarec);
@@ -2818,7 +2840,7 @@ static void renderhalo(HaloRen *har) /* postprocess version */
{
float dist, xsq, ysq, xn, yn, colf[4], *rectft, *rtf;
- unsigned int *rectt, *rt;
+ int *rectt, *rt;
int minx, maxx, miny, maxy, x, y;
char col[4];
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 00fff240fb9..2e519591afc 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -183,20 +183,20 @@ HaloRen *RE_inithalo(Material *ma, float *vec, float *vec1,
float tin, tr, tg, tb, ta;
float xn, yn, zn, texvec[3], hoco[4], hoco1[4];
- if(hasize==0) return 0;
+ if(hasize==0.0) return NULL;
RE_projectverto(vec, hoco);
- if(hoco[3]==0.0) return 0;
+ if(hoco[3]==0.0) return NULL;
if(vec1) {
RE_projectverto(vec1, hoco1);
- if(hoco1[3]==0.0) return 0;
+ if(hoco1[3]==0.0) return NULL;
}
har= RE_findOrAddHalo(R.tothalo++);
VECCOPY(har->co, vec);
har->hasize= hasize;
- /* projectvert is done function 'zbufvlaggen' because of parts/border/pano */
+ /* projectvert is done in function 'zbufvlaggen' because of parts/border/pano */
/* halovect */
if(vec1) {
@@ -206,7 +206,7 @@ HaloRen *RE_inithalo(Material *ma, float *vec, float *vec1,
zn= hoco[3];
har->xs= 0.5*R.rectx*(hoco[0]/zn);
har->ys= 0.5*R.recty*(hoco[1]/zn);
- har->zs= 0x7FFFFF*(1.0+hoco[2]/zn);
+ har->zs= 0x7FFFFF*(hoco[2]/zn);
har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn);
diff --git a/source/blender/render/intern/source/vanillaRenderPipe.c b/source/blender/render/intern/source/vanillaRenderPipe.c
index f76a7e479e2..e06abb0ef37 100644
--- a/source/blender/render/intern/source/vanillaRenderPipe.c
+++ b/source/blender/render/intern/source/vanillaRenderPipe.c
@@ -408,7 +408,7 @@ static void zBufferFillEdge(unsigned int zvlnr, float *vec1, float *vec2)
{
int apteller;
int start, end, x, y, oldx, oldy, ofs;
- int dz, vergz, mask;
+ int dz, vergz, mask, maxtest=0;
float dx, dy;
float v1[3], v2[3];
@@ -438,6 +438,7 @@ static void zBufferFillEdge(unsigned int zvlnr, float *vec1, float *vec2)
vergz= v1[2];
vergz-= Azvoordeel;
dz= (v2[2]-v1[2])/dx;
+ if(vergz>0x70000000 && dz>0) maxtest= 1; // prevent overflow
apteller = zBufferWidth*(oldy-Aminy) +start;
mask = 1<<Zsample;
@@ -459,6 +460,7 @@ static void zBufferFillEdge(unsigned int zvlnr, float *vec1, float *vec2)
v1[1]+= dy;
vergz+= dz;
+ if(maxtest && vergz<0) vergz= 0x7FFFFFF0;
}
}
else {
@@ -487,6 +489,7 @@ static void zBufferFillEdge(unsigned int zvlnr, float *vec1, float *vec2)
vergz= v1[2];
vergz-= Azvoordeel;
dz= (v2[2]-v1[2])/dy;
+ if(vergz>0x70000000 && dz>0) maxtest= 1; // prevent overflow
apteller = zBufferWidth*(start-Aminy) +oldx;
@@ -509,6 +512,7 @@ static void zBufferFillEdge(unsigned int zvlnr, float *vec1, float *vec2)
v1[0]+= dx;
vergz+= dz;
+ if(maxtest && vergz<0) vergz= 0x7FFFFFF0;
}
}
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 608ce13b411..f0619990870 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -79,25 +79,25 @@ float Zjitx; /* Jitter offset in x. When jitter is disabled, this */
float Zjity; /* Jitter offset in y. When jitter is disabled, this */
/* should be 0.5. (used in render.c, zbuf.c) */
-unsigned int Zsample;
+int Zsample;
void (*zbuffunc)(int, float *, float *, float *);
void (*zbuflinefunc)(int, float *, float *);
-APixstr *APixbuf; /* Zbuffer: linked list of face indices */
-int *Arectz; /* Zbuffer: distance buffer, almost obsolete */
-int Aminy; /* y value of first line in the accu buffer */
-int Amaxy; /* y value of last line in the accu buffer */
-int Azvoordeel = 0;
-APixstrMain apsmfirst;
-short apsmteller = 0;
+static APixstr *APixbuf; /* Zbuffer: linked list of face indices */
+static int *Arectz; /* Zbuffer: distance buffer, almost obsolete */
+static int Aminy; /* y value of first line in the accu buffer */
+static int Amaxy; /* y value of last line in the accu buffer */
+static int Azvoordeel = 0;
+static APixstrMain apsmfirst;
+static short apsmteller = 0;
/*-----------------------------------------------------------*/
/* Functions */
/*-----------------------------------------------------------*/
-void fillrect(unsigned int *rect, int x, int y, unsigned int val)
+void fillrect(int *rect, int x, int y, int val)
{
- unsigned int len,*drect;
+ int len, *drect;
len= x*y;
drect= rect;
@@ -481,9 +481,9 @@ void zbufinvulAc(int zvlnr, float *v1, float *v2, float *v3)
void zbuflineAc(int zvlnr, float *vec1, float *vec2)
{
APixstr *ap, *apn;
- unsigned int *rectz;
+ int *rectz;
int start, end, x, y, oldx, oldy, ofs;
- int dz, vergz, mask;
+ int dz, vergz, mask, maxtest=0;
float dx, dy;
float v1[3], v2[3];
@@ -513,8 +513,9 @@ void zbuflineAc(int zvlnr, float *vec1, float *vec2)
vergz= v1[2];
vergz-= Azvoordeel;
dz= (v2[2]-v1[2])/dx;
+ if(vergz>0x70000000 && dz>0) maxtest= 1; // prevent overflow
- rectz= (unsigned int *)(Arectz+R.rectx*(oldy-Aminy) +start);
+ rectz= (int *)(Arectz+R.rectx*(oldy-Aminy) +start);
ap= (APixbuf+ R.rectx*(oldy-Aminy) +start);
mask= 1<<Zsample;
@@ -552,6 +553,7 @@ void zbuflineAc(int zvlnr, float *vec1, float *vec2)
v1[1]+= dy;
vergz+= dz;
+ if(maxtest && vergz<0) vergz= 0x7FFFFFF0;
}
}
else {
@@ -580,8 +582,9 @@ void zbuflineAc(int zvlnr, float *vec1, float *vec2)
vergz= v1[2];
vergz-= Azvoordeel;
dz= (v2[2]-v1[2])/dy;
+ if(vergz>0x70000000 && dz>0) maxtest= 1; // prevent overflow
- rectz= (unsigned int *)( Arectz+ (start-Aminy)*R.rectx+ oldx );
+ rectz= (int *)( Arectz+ (start-Aminy)*R.rectx+ oldx );
ap= (APixbuf+ R.rectx*(start-Aminy) +oldx);
mask= 1<<Zsample;
@@ -619,6 +622,7 @@ void zbuflineAc(int zvlnr, float *vec1, float *vec2)
v1[0]+= dx;
vergz+= dz;
+ if(maxtest && vergz<0) vergz= 0x7FFFFFF0;
}
}
}
@@ -648,9 +652,9 @@ static void hoco_to_zco(float *zco, float *hoco)
void zbufline(int zvlnr, float *vec1, float *vec2)
{
- unsigned int *rectz, *rectp;
+ int *rectz, *rectp;
int start, end, x, y, oldx, oldy, ofs;
- int dz, vergz;
+ int dz, vergz, maxtest= 0;
float dx, dy;
float v1[3], v2[3];
@@ -677,8 +681,9 @@ void zbufline(int zvlnr, float *vec1, float *vec2)
oldy= floor(v1[1]);
dy/= dx;
- vergz= v1[2];
- dz= (v2[2]-v1[2])/dx;
+ vergz= floor(v1[2]);
+ dz= floor((v2[2]-v1[2])/dx);
+ if(vergz>0x70000000 && dz>0) maxtest= 1; // prevent overflow
rectz= R.rectz+ oldy*R.rectx+ start;
rectp= R.rectot+ oldy*R.rectx+ start;
@@ -704,6 +709,7 @@ void zbufline(int zvlnr, float *vec1, float *vec2)
v1[1]+= dy;
vergz+= dz;
+ if(maxtest && vergz<0) vergz= 0x7FFFFFF0;
}
}
else {
@@ -726,9 +732,10 @@ void zbufline(int zvlnr, float *vec1, float *vec2)
oldx= floor(v1[0]);
dx/= dy;
- vergz= v1[2];
- dz= (v2[2]-v1[2])/dy;
-
+ vergz= floor(v1[2]);
+ dz= floor((v2[2]-v1[2])/dy);
+ if(vergz>0x70000000 && dz>0) maxtest= 1; // prevent overflow
+
rectz= R.rectz+ start*R.rectx+ oldx;
rectp= R.rectot+ start*R.rectx+ oldx;
@@ -753,6 +760,7 @@ void zbufline(int zvlnr, float *vec1, float *vec2)
v1[0]+= dx;
vergz+= dz;
+ if(maxtest && vergz<0) vergz= 0x7FFFFFF0;
}
}
}
@@ -945,7 +953,7 @@ static void zbufinvulGLinv(int zvlnr, float *v1, float *v2, float *v3)
double x0,y0,z0,x1,y1,z1,x2,y2,z2,xx1;
double zxd,zyd,zy0,tmp;
float *minv,*maxv,*midv;
- unsigned int *rectpofs,*rp;
+ int *rectpofs,*rp;
int *rz,zverg,zvlak,x;
int my0,my2,sn1,sn2,rectx,zd,*rectzofs;
int y,omsl,xs0,xs1,xs2,xs3, dx0,dx1,dx2;
@@ -1176,7 +1184,7 @@ static void zbufinvulGL(int zvlnr, float *v1, float *v2, float *v3)
double x1,y1,z1,x2,y2,z2,xx1;
double zxd,zyd,zy0,tmp, zverg, zd;
float *minv,*maxv,*midv;
- unsigned int *rectpofs,*rp;
+ int *rectpofs,*rp;
int *rz,zvlak,x;
int my0,my2,sn1,sn2,rectx,*rectzofs;
int y,omsl,xs0,xs1,xs2,xs3, dx0,dx1,dx2;
@@ -1947,7 +1955,7 @@ void RE_zbufferall_radio(struct RadView *vw, RNode **rg_elem, int rg_totelem)
float hoco[4][4];
int a, zvlnr;
int c1, c2, c3, c4= 0;
- unsigned int *rectoto, *rectzo;
+ int *rectoto, *rectzo;
int rectxo, rectyo;
if(rg_totelem==0) return;
@@ -2131,8 +2139,8 @@ static void copyto_abufz(int sample)
for(y=Aminy; y<=Amaxy; y++) {
for(x=0; x<R.rectx; x++) {
- if( IS_A_POINTER_CODE(*rd)) {
- ps= (PixStr *) POINTER_FROM_CODE(*rd);
+ if(*rd) {
+ ps= (PixStr *)(*rd);
while(ps) {
if(sample & ps->mask) {
@@ -2242,22 +2250,22 @@ int vergzvlak(const void *a1, const void *a2)
/**
* Shade this face at this location in SCS.
*/
-static void shadetrapixel(float x, float y, int face, int mask, float *fcol)
+static void shadetrapixel(float x, float y, int z, int facenr, int mask, float *fcol)
{
- if( (face & 0x7FFFFF) > R.totvlak) {
- printf("error in shadetrapixel nr: %d\n", (face & 0x7FFFFF));
+ if( (facenr & 0x7FFFFF) > R.totvlak) {
+ printf("error in shadetrapixel nr: %d\n", (facenr & 0x7FFFFF));
return;
}
if(R.r.mode & R_OSA) {
- VlakRen *vlr= RE_findOrAddVlak( (face-1) & 0x7FFFFF);
+ VlakRen *vlr= RE_findOrAddVlak( (facenr-1) & 0x7FFFFF);
float accumcol[4]={0,0,0,0}, tot=0.0;
int a;
if(vlr->flag & R_FULL_OSA) {
for(a=0; a<R.osa; a++) {
if(mask & (1<<a)) {
- shadepixel(x+jit[a][0], y+jit[a][1], face, 1<<a, fcol);
+ shadepixel(x+jit[a][0], y+jit[a][1], z, facenr, 1<<a, fcol);
accumcol[0]+= fcol[0];
accumcol[1]+= fcol[1];
accumcol[2]+= fcol[2];
@@ -2278,11 +2286,11 @@ static void shadetrapixel(float x, float y, int face, int mask, float *fcol)
int b= centmask[mask];
x= x+centLut[b & 15];
y= y+centLut[b>>4];
- shadepixel(x, y, face, mask, fcol);
+ shadepixel(x, y, z, facenr, mask, fcol);
}
}
- else shadepixel(x, y, face, mask, fcol);
+ else shadepixel(x, y, z, facenr, mask, fcol);
}
static int addtosampcol(float *sampcol, float *fcol, int mask)
@@ -2371,7 +2379,7 @@ void abufsetrow(float *acolrow, int y)
}
if(totvlak==1) {
- shadetrapixel((float)x, (float)y, ap->p[0], ap->mask[0], fcol);
+ shadetrapixel((float)x, (float)y, ap->z[0], ap->p[0], ap->mask[0], fcol);
nr= count_mask(ap->mask[0]);
if( (R.r.mode & R_OSA) && nr<R.osa) {
@@ -2407,7 +2415,7 @@ void abufsetrow(float *acolrow, int y)
while(totvlak>0) {
totvlak--;
- shadetrapixel((float)x, (float)y, zrow[totvlak][1], zrow[totvlak][2], fcol);
+ shadetrapixel((float)x, (float)y, zrow[totvlak][0], zrow[totvlak][1], zrow[totvlak][2], fcol);
a= count_mask(zrow[totvlak][2]);
if( (R.r.mode & R_OSA ) && a<R.osa) {
@@ -2421,7 +2429,7 @@ void abufsetrow(float *acolrow, int y)
if(a==R.osa) break;
totvlak--;
- shadetrapixel((float)x, (float)y, zrow[totvlak][1], zrow[totvlak][2], fcol);
+ shadetrapixel((float)x, (float)y, zrow[totvlak][0], zrow[totvlak][1], zrow[totvlak][2], fcol);
sval= addtosampcol(sampcol, fcol, zrow[totvlak][2]);
}
scol= sampcol;
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index 0108603e103..5d4498b348a 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -847,8 +847,8 @@ static void make_render_halos(Object *ob, Mesh *me, int totvert, MVert *mvert, M
else hasize*= zn*zn*zn*zn;
}
- if(orco) har= RE_inithalo(ma, vec, 0, orco, hasize, 0, seed);
- else har= RE_inithalo(ma, vec, 0, mvert->co, hasize, 0, seed);
+ if(orco) har= RE_inithalo(ma, vec, NULL, orco, hasize, 0.0, seed);
+ else har= RE_inithalo(ma, vec, NULL, mvert->co, hasize, 0.0, seed);
if(har) har->lay= ob->lay;
}
if(orco) orco+= 3;
@@ -941,7 +941,7 @@ static void render_particle_system(Object *ob, PartEff *paf)
if(paf->stype==PAF_VECT) har= RE_inithalo(ma, vec, vec1, pa->co, hasize, paf->vectsize, seed);
else {
- har= RE_inithalo(ma, vec, 0, pa->co, hasize, 0, seed);
+ har= RE_inithalo(ma, vec, NULL, pa->co, hasize, 0.0, seed);
if(har && ma->mode & MA_HALO_SHADE) {
VecSubf(har->no, vec, vec1);
Normalise(har->no);
@@ -1081,7 +1081,7 @@ static void render_static_particle_system(Object *ob, PartEff *paf)
if(paf->stype==PAF_VECT) har= RE_inithalo(ma, vec, vec1, pa->co, hasize, paf->vectsize, seed);
else {
- har= RE_inithalo(ma, vec, 0, pa->co, hasize, 0, seed);
+ har= RE_inithalo(ma, vec, NULL, pa->co, hasize, 0.0, seed);
if(har && (ma->mode & MA_HALO_SHADE)) {
VecSubf(har->no, vec, vec1);
Normalise(har->no);