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:
authorTon Roosendaal <ton@blender.org>2005-12-02 01:16:07 +0300
committerTon Roosendaal <ton@blender.org>2005-12-02 01:16:07 +0300
commitd1c59501214a4616fb65f2010072397f08e0e021 (patch)
tree36ef1533d3dfa88cb2a001d36a64e231373c159b /source/blender/render/intern
parentb99e1f6b3ce1823bfe2eca6cf64d72f5f6ab71d2 (diff)
Extra texture channel input for Mist effect; "Global". This feeds the
global coordinate (from faces) to the sky texture color calculus, this to make textured mist a bit less transparent (was only view coordinate).
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/include/pixelshading.h7
-rw-r--r--source/blender/render/intern/include/rendercore.h2
-rw-r--r--source/blender/render/intern/include/texture.h2
-rw-r--r--source/blender/render/intern/source/pixelshading.c22
-rw-r--r--source/blender/render/intern/source/ray.c4
-rw-r--r--source/blender/render/intern/source/rendercore.c15
-rw-r--r--source/blender/render/intern/source/texture.c18
-rw-r--r--source/blender/render/intern/source/vanillaRenderPipe.c7
-rw-r--r--source/blender/render/intern/source/zbuf.c7
9 files changed, 52 insertions, 32 deletions
diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h
index 6b9e13c069f..9f4600209b5 100644
--- a/source/blender/render/intern/include/pixelshading.h
+++ b/source/blender/render/intern/include/pixelshading.h
@@ -68,12 +68,11 @@ enum RE_SkyAlphaBlendingType getSkyBlendingMode(void);
/**
* Render the sky at pixel (x, y).
*/
-void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y);
+void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y, float *rco);
+void shadeSkyPixel(RE_COLBUFTYPE *collector, float fx, float fy, float *rco);
+void shadeSkyPixelFloat(float *colf, float *rco, float *view, float *dxyview);
-/* used by shadeSkyPixel: */
-void shadeSkyPixelFloat(float *colf, float *view, float *dxyview);
void renderSpotHaloPixel(float x, float y, float *target);
-void shadeSkyPixel(RE_COLBUFTYPE *collector, float fx, float fy);
void fillBackgroundImage(RE_COLBUFTYPE *collector, float x, float y);
void fillBackgroundImageChar(char *col, float x, float y);
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 5163b85d8c0..0859620982c 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -103,7 +103,7 @@ void zbufshadeDA(void); /* Delta Accum Pixel Struct */
/**
* Also called in: zbuf.c
*/
-void *shadepixel(float x, float y, int z, int facenr, int mask, float *col);
+void *shadepixel(float x, float y, int z, int facenr, int mask, float *col, float *rco);
/**
* A cryptic but very efficient way of counting the number of bits that
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index 525f8455aa2..4b7ac102d80 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -55,7 +55,7 @@ struct Image;
/* texture.h */
void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
-void do_sky_tex(float *lo, float *dxyview, float *hor, float *zen, float *blend);
+void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend);
void render_realtime_texture(struct ShadeInput *shi);
/* imagetexture.h */
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index d0c23f6daf3..9d6e7b421d5 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -127,10 +127,11 @@ static void *renderHaloPixel(RE_COLBUFTYPE *collector, float x, float y, int hal
void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *obdata, int mask)
{
- void* data = NULL;
+ void *data = NULL;
+ float rco[3]; /* not used (yet?) */
if (obdata[3] & RE_POLY) {
- data = shadepixel(x, y, obdata[0], obdata[1], mask, collector);
+ data = shadepixel(x, y, obdata[0], obdata[1], mask, collector, rco);
}
else if (obdata[3] & RE_HALO) {
data = renderHaloPixel(collector, x, y, obdata[1]);
@@ -138,7 +139,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[0], obdata[1], mask, collector);
+ data = shadepixel(x, y, obdata[0], obdata[1], mask, collector, rco);
}
return data;
@@ -148,7 +149,8 @@ void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *obdata, int m
void renderSpotHaloPixel(float x, float y, float* fcol)
{
- shadepixel(x, y, 0, 0, 0, fcol);
+ float rco[3]; /* unused */
+ shadepixel(x, y, 0, 0, 0, fcol, rco);
}
@@ -551,7 +553,7 @@ enum RE_SkyAlphaBlendingType getSkyBlendingMode() {
}
/* This one renders into collector, as always. */
-void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y)
+void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y, float *rco)
{
switch (keyingType) {
@@ -566,7 +568,7 @@ void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y)
break;
case RE_ALPHA_SKY:
/* Fill in the sky as if it were a normal face. */
- shadeSkyPixel(collector, x, y);
+ shadeSkyPixel(collector, x, y, rco);
collector[3]= 0.0;
break;
default:
@@ -579,7 +581,7 @@ void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y)
/*
Stuff the sky colour into the collector.
*/
-void shadeSkyPixel(RE_COLBUFTYPE *collector, float fx, float fy)
+void shadeSkyPixel(RE_COLBUFTYPE *collector, float fx, float fy, float *rco)
{
float view[3], dxyview[2];
@@ -655,13 +657,13 @@ void shadeSkyPixel(RE_COLBUFTYPE *collector, float fx, float fy)
}
/* get sky colour in the collector */
- shadeSkyPixelFloat(collector, view, dxyview);
+ shadeSkyPixelFloat(collector, rco, view, dxyview);
collector[3] = 1.0f;
}
}
/* Only view vector is important here. Result goes to colf[3] */
-void shadeSkyPixelFloat(float *colf, float *view, float *dxyview)
+void shadeSkyPixelFloat(float *colf, float *rco, float *view, float *dxyview)
{
float lo[3], zen[3], hor[3], blend, blendm;
@@ -698,7 +700,7 @@ void shadeSkyPixelFloat(float *colf, float *view, float *dxyview)
SWAP(float, lo[1], lo[2]);
}
- do_sky_tex(lo, dxyview, hor, zen, &blend);
+ do_sky_tex(rco, lo, dxyview, hor, zen, &blend);
}
if(blend>1.0) blend= 1.0;
diff --git a/source/blender/render/intern/source/ray.c b/source/blender/render/intern/source/ray.c
index d9f94c0be60..df914f96283 100644
--- a/source/blender/render/intern/source/ray.c
+++ b/source/blender/render/intern/source/ray.c
@@ -1623,7 +1623,7 @@ static void traceray(short depth, float *start, float *vec, float *col, VlakRen
VECCOPY(shi.view, vec);
Normalise(shi.view);
- shadeSkyPixelFloat(col, shi.view, NULL);
+ shadeSkyPixelFloat(col, shi.view, NULL, isec.start);
}
}
@@ -2118,7 +2118,7 @@ void ray_ao(ShadeInput *shi, World *wrld, float *shadfac)
shadfac[2]+= (1.0-fac)*R.wrld.horb + fac*R.wrld.zenb;
}
else {
- shadeSkyPixelFloat(skycol, view, NULL);
+ shadeSkyPixelFloat(skycol, view, NULL, isec.start);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
shadfac[2]+= skycol[2];
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 98c82019fa4..911a1c8fb14 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -158,7 +158,7 @@ void RE_sky_char(float *view, char *col)
dither_value = ( (BLI_frand()-0.5)*R.r.dither_intensity)/256.0;
- shadeSkyPixelFloat(colf, view, NULL);
+ shadeSkyPixelFloat(colf, view, view, NULL);
f= 255.0*(colf[0]+dither_value);
if(f<=0.0) col[0]= 0; else if(f>255.0) col[0]= 255;
@@ -2096,7 +2096,7 @@ static float isec_view_line(float *view, float *v3, float *v4)
/* 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)
+void *shadepixel(float x, float y, int z, int facenr, int mask, float *col, float *rco)
{
ShadeResult shr;
ShadeInput shi;
@@ -2115,6 +2115,7 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col)
if(facenr==0) { /* sky */
col[0]= 0.0; col[1]= 0.0; col[2]= 0.0; col[3]= 0.0;
+ VECCOPY(rco, col);
}
else if( (facenr & 0x7FFFFF) <= R.totvlak) {
VertRen *v1, *v2, *v3;
@@ -2210,6 +2211,8 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col)
}
}
}
+ /* rco might be used for sky texture */
+ VECCOPY(rco, shi.co);
/* cannot normalise earlier, code above needs it at pixel level */
fac= Normalise(shi.view);
@@ -2382,15 +2385,15 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col)
static void shadepixel_sky(float x, float y, int z, int facenr, int mask, float *colf)
{
VlakRen *vlr;
- float collector[4];
+ float collector[4], rco[3];
- vlr= shadepixel(x, y, z, facenr, mask, colf);
+ vlr= shadepixel(x, y, z, facenr, mask, colf, rco);
if(colf[3] != 1.0) {
/* bail out when raytrace transparency (sky included already) */
if(vlr && (R.r.mode & R_RAYTRACE))
if(vlr->mat->mode & MA_RAYTRANSP) return;
-
- renderSkyPixelFloat(collector, x, y);
+
+ renderSkyPixelFloat(collector, x, y, vlr?rco:NULL);
addAlphaOverFloat(collector, colf);
QUATCOPY(colf, collector);
}
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index 55e546a89f9..3653b82f581 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -1965,7 +1965,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
/* ------------------------------------------------------------------------- */
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
-void do_sky_tex(float *lo, float *dxyview, float *hor, float *zen, float *blend)
+void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend)
{
MTex *mtex;
TexResult texres;
@@ -2033,6 +2033,22 @@ void do_sky_tex(float *lo, float *dxyview, float *hor, float *zen, float *blend)
MTC_Mat4MulVecfl(mtex->object->imat, tempvec);
co= tempvec;
}
+ break;
+
+ case TEXCO_GLOB:
+ if(rco) {
+ VECCOPY(tempvec, rco);
+ MTC_Mat4MulVecfl(R.viewinv, tempvec);
+ co= tempvec;
+ }
+ else
+ co= lo;
+
+// VECCOPY(shi->dxgl, shi->dxco);
+// MTC_Mat3MulVecfl(R.imat, shi->dxco);
+// VECCOPY(shi->dygl, shi->dyco);
+// MTC_Mat3MulVecfl(R.imat, shi->dyco);
+ break;
}
/* placement */
diff --git a/source/blender/render/intern/source/vanillaRenderPipe.c b/source/blender/render/intern/source/vanillaRenderPipe.c
index b5b70aa0e0d..5ab38b589e8 100644
--- a/source/blender/render/intern/source/vanillaRenderPipe.c
+++ b/source/blender/render/intern/source/vanillaRenderPipe.c
@@ -594,7 +594,6 @@ static int composeStack(int zrow[][RE_PIXELFIELDSIZE], RE_COLBUFTYPE *collector,
VlakRen *vlr= NULL;
float xs = 0.0;
float ys = 0.0; /* coordinates for the render-spot */
-
float alphathreshold[RE_MAX_OSA_COUNT];
float colbuf[4];
int inconflict = 0;
@@ -714,7 +713,7 @@ static int composeStack(int zrow[][RE_PIXELFIELDSIZE], RE_COLBUFTYPE *collector,
ys= (float)y;
/* code identical for rendering empty sky pixel */
- renderSkyPixelFloat(collector, xs, ys);
+ renderSkyPixelFloat(collector, xs, ys, NULL);
cpFloatColV(collector, colbuf);
if(R.flag & R_LAMPHALO) {
@@ -1011,7 +1010,7 @@ static zbufline zb1, zb2;
static void renderZBufLine(int y, RE_COLBUFTYPE *colbuf1, RE_COLBUFTYPE *colbuf2, RE_COLBUFTYPE *colbuf3)
{
- RE_APixstrExt *ap; /* iterator for the face-lists */
+ RE_APixstrExt *ap; /* iterator for the face-lists */
RE_COLBUFTYPE collector[4];
RE_COLBUFTYPE sampcol[RE_MAX_OSA_COUNT * 4];
RE_COLBUFTYPE *j = NULL; /* generic pixel pointer */
@@ -1057,7 +1056,7 @@ static void renderZBufLine(int y, RE_COLBUFTYPE *colbuf1, RE_COLBUFTYPE *colbuf2
/* This is a bit dirty. Depending on sky-mode, the pixel is */
/* blended in differently. */
- renderSkyPixelFloat(collector, x, y);
+ renderSkyPixelFloat(collector, x, y, NULL);
j = sampcol;
for(i = 0; i < osaNr; i++, j+=4) {
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index b99f4d8e768..f7480c4cb2f 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -2695,6 +2695,7 @@ int vergzvlak(const void *a1, const void *a2)
*/
static void shadetrapixel(float x, float y, int z, int facenr, int mask, float *fcol)
{
+ float rco[3];
if( (facenr & 0x7FFFFF) > R.totvlak) {
printf("error in shadetrapixel nr: %d\n", (facenr & 0x7FFFFF));
@@ -2708,7 +2709,7 @@ static void shadetrapixel(float x, float y, int z, int facenr, int mask, float *
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], z, facenr, 1<<a, fcol);
+ shadepixel(x+jit[a][0], y+jit[a][1], z, facenr, 1<<a, fcol, rco);
accumcol[0]+= fcol[0];
accumcol[1]+= fcol[1];
accumcol[2]+= fcol[2];
@@ -2729,11 +2730,11 @@ static void shadetrapixel(float x, float y, int z, int facenr, int mask, float *
int b= centmask[mask];
x= x+centLut[b & 15];
y= y+centLut[b>>4];
- shadepixel(x, y, z, facenr, mask, fcol);
+ shadepixel(x, y, z, facenr, mask, fcol, rco);
}
}
- else shadepixel(x, y, z, facenr, mask, fcol);
+ else shadepixel(x, y, z, facenr, mask, fcol, rco);
}
static int addtosampcol(float *sampcol, float *fcol, int mask)