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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-01-02 17:20:15 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-01-02 17:20:15 +0300
commit1c6e1dd5f458b5e7ebc3df55b9eb5e556ed7e389 (patch)
tree956912b7406a7cc49deec382fb20a2b4b3cd6529 /source
parentfb3ed9e0a573d9296caddeba0f705b83949ee3ad (diff)
Bugfix for incorrect strand clipping in shadow maps, not sure yet it
actually fixes the problem.
Diffstat (limited to 'source')
-rw-r--r--source/blender/render/intern/include/strand.h1
-rw-r--r--source/blender/render/intern/source/strand.c14
2 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h
index 34a147c1933..f2f1c2763c0 100644
--- a/source/blender/render/intern/include/strand.h
+++ b/source/blender/render/intern/include/strand.h
@@ -64,6 +64,7 @@ typedef struct StrandPoint {
float co1[3], co2[3];
float hoco1[4], hoco2[4];
float zco1[3], zco2[3];
+ int clip1, clip2;
/* screen space */
float hoco[4];
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 4f0e9764a43..adaf2ae3259 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -388,9 +388,9 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
Crossf(cross, spoint->co, spoint->tan);
w= spoint->co[2]*strandbuf->winmat[2][3] + strandbuf->winmat[3][3];
- dx= strandbuf->winx*cross[0]*strandbuf->winmat[0][0];
- dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1];
- w= sqrt(dx*dx + dy*dy)/w;
+ dx= strandbuf->winx*cross[0]*strandbuf->winmat[0][0]/w;
+ dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1]/w;
+ w= sqrt(dx*dx + dy*dy);
if(w > 0.0f) {
if(strandbuf->flag & R_STRAND_B_UNITS) {
@@ -777,7 +777,7 @@ static void strand_render(Render *re, float winmat[][4], StrandPart *spart, ZSpa
projectvert(p2->co, winmat, hoco2);
/* render both strand and single pixel wire to counter aliasing */
- zbufclip4(zspan, 0, 0, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, 0, 0, 0, 0);
+ zbufclip4(zspan, 0, 0, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, p1->clip2, p1->clip1, p2->clip1, p2->clip2);
zbufsinglewire(zspan, 0, 0, hoco1, hoco2);
}
}
@@ -817,6 +817,8 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
else {
projectvert(p.co1, winmat, p.hoco1);
projectvert(p.co2, winmat, p.hoco2);
+ p.clip1= testclip(p.hoco1);
+ p.clip2= testclip(p.hoco2);
}
if(!strand_segment_recursive(re, winmat, spart, zspan, sseg, p1, &p, depth+1))
@@ -852,6 +854,10 @@ void render_strand_segment(Render *re, float winmat[][4], StrandPart *spart, ZSp
projectvert(p1->co2, winmat, p1->hoco2);
projectvert(p2->co1, winmat, p2->hoco1);
projectvert(p2->co2, winmat, p2->hoco2);
+ p1->clip1= testclip(p1->hoco1);
+ p1->clip2= testclip(p1->hoco2);
+ p2->clip1= testclip(p2->hoco1);
+ p2->clip2= testclip(p2->hoco2);
}
if(!strand_segment_recursive(re, winmat, spart, zspan, sseg, p1, p2, 0))