Skip to content

Commit

Permalink
fix(rtrace): restored tracing to sources with -oT option
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Apr 16, 2021
1 parent f8335c5 commit 6357954
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/rt/rtrace.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: rtrace.c,v 2.101 2021/02/16 22:06:00 greg Exp $";
static const char RCSid[] = "$Id: rtrace.c,v 2.102 2021/04/16 16:31:35 greg Exp $";
#endif
/*
* rtrace.c - program and variables for individual ray tracing.
Expand Down Expand Up @@ -52,6 +52,8 @@ int castonly = 0; /* only doing ray-casting? */
#endif
OBJECT traset[MAXTSET+1]={0}; /* trace include/exclude set */

static int Tflag = 0; /* source tracing enabled? */

static RAY thisray; /* for our convenience */

static FILE *inpfp = NULL; /* input stream pointer */
Expand Down Expand Up @@ -119,6 +121,16 @@ formstr( /* return format identifier */
}


static void
trace_sources(void) /* trace rays to light sources, also */
{
int sn;

for (sn = 0; sn < nsources; sn++)
source[sn].sflags |= SFOLLOW;
}


void
rtrace( /* trace rays from file */
char *fname,
Expand Down Expand Up @@ -148,6 +160,8 @@ rtrace( /* trace rays from file */
/* set up output */
if (castonly || every_out[0] != NULL)
nproc = 1; /* don't bother multiprocessing */
if (Tflag && every_out[0] != NULL)
trace_sources(); /* asking to trace light sources */
if ((nextflush > 0) & (nproc > nextflush)) {
error(WARNING, "reducing number of processes to match flush interval");
nproc = nextflush;
Expand Down Expand Up @@ -217,16 +231,6 @@ rtrace( /* trace rays from file */
}


static void
trace_sources(void) /* trace rays to light sources, also */
{
int sn;

for (sn = 0; sn < nsources; sn++)
source[sn].sflags |= SFOLLOW;
}


int
setrtoutput(void) /* set up output tables, return #comp */
{
Expand All @@ -241,8 +245,7 @@ setrtoutput(void) /* set up output tables, return #comp */
do
switch (*vs) {
case 'T': /* trace sources */
if (!vs[1]) break;
trace_sources();
Tflag++;
/* fall through */
case 't': /* trace */
if (!vs[1]) break;
Expand Down

0 comments on commit 6357954

Please sign in to comment.