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>2007-01-24 19:10:37 +0300
committerTon Roosendaal <ton@blender.org>2007-01-24 19:10:37 +0300
commit18fc6ca7621c74ee5950315c98fc7c725887eede (patch)
treee7f73cf4d92bf2e6fd2f5dcd1ab9b02f6eca7566
parent06826d27d4ce4b74b5d7a9af856a4c8616d29ce2 (diff)
Small tweak in clipping code for irregular shadow buffers
-rw-r--r--source/blender/render/intern/source/shadbuf.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 3c6975c2a67..4e08369a89f 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -1530,22 +1530,18 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, VlakRen *vlr, float x, float y, fl
/* clip We can test for -1.0/1.0 because of the properties of the
* coordinate transformations. */
- if(hoco[0]<-hoco[3] || hoco[0]>hoco[3])
+ fac= fabs(hoco[3]);
+ if(hoco[0]<-fac || hoco[0]>fac)
return 0;
- if(hoco[1]<-hoco[3] || hoco[1]>hoco[3])
+ if(hoco[1]<-fac || hoco[1]>fac)
+ return 0;
+ if(hoco[2]<-fac || hoco[2]>fac)
return 0;
siz= 0.5f*(float)shb->size;
co[0]= siz*(1.0f+hoco[0]/hoco[3]) -0.5f;
co[1]= siz*(1.0f+hoco[1]/hoco[3]) -0.5f;
-
- /* Clip for z: clipsta and clipend clip values of the shadow buffer */
- fac= (hoco[2]/hoco[3]);
-
- if(fac >= 1.0f || fac <= -1.0f)
- return 0;
- else
- co[2]= ((float)0x7FFFFFFF)*fac;
+ co[2]= ((float)0x7FFFFFFF)*(hoco[2]/hoco[3]);
/* XXXX bias, much less than normal shadbuf, or do we need a constant? */
co[2] -= 0.05f*shb->bias;