Skip to content

Commit

Permalink
perf(rpict,rtrace,rcontrib): changed shadow test to always check firs…
Browse files Browse the repository at this point in the history
…t 2 sources
  • Loading branch information
Gregungory committed Dec 17, 2020
1 parent 8cf7a49 commit c59354f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/rt/source.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: source.c,v 2.73 2020/07/03 00:42:20 greg Exp $";
static const char RCSid[] = "$Id: source.c,v 2.74 2020/12/17 03:30:37 greg Exp $";
#endif
/*
* source.c - routines dealing with illumination sources.
Expand Down Expand Up @@ -477,19 +477,17 @@ direct( /* add direct component */
/* compute number to check */
nshadcheck = pow((double)ncnts, shadcert) + .5;
/* modify threshold */
if (ncnts > MINSHADCNT)
ourthresh = shadthresh / r->rweight;
else
ourthresh = 0;
ourthresh = shadthresh / r->rweight;
/* test for shadows */
for (nhits = 0, hwt = 0.0, sn = 0; sn < ncnts;
hwt += (double)source[scp->sno].nhits /
(double)source[scp->sno].ntests,
sn++) {
/* check threshold */
if ((sn+nshadcheck>=ncnts ? cntord[sn].brt :
if (sn >= MINSHADCNT &&
(sn+nshadcheck>=ncnts ? cntord[sn].brt :
cntord[sn].brt-cntord[sn+nshadcheck].brt)
< ourthresh*bright(r->rcol))
< ourthresh*bright(r->rcol))
break;
scp = srccnt + cntord[sn].sndx;
/* test for hit */
Expand Down
4 changes: 2 additions & 2 deletions src/rt/source.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* RCSid $Id: source.h,v 2.21 2020/04/06 21:09:07 greg Exp $ */
/* RCSid $Id: source.h,v 2.22 2020/12/17 03:30:37 greg Exp $ */
/*
* source.h - header file for ray tracing sources.
*
Expand All @@ -20,7 +20,7 @@ extern "C" {
#define SHADCACHE 20 /* shadow cache resolution */
#endif
#ifndef MINSHADCNT
#define MINSHADCNT 4 /* test all sources if this few */
#define MINSHADCNT 2 /* test at least this many shadows */
#endif

#define SDISTANT 01 /* source distant flag */
Expand Down

0 comments on commit c59354f

Please sign in to comment.