From 038b44539a5216897763d2cda68e65f6462c2cb9 Mon Sep 17 00:00:00 2001 From: "Gregory J. Ward" Date: Mon, 4 Jan 2021 19:07:15 +0000 Subject: [PATCH] refactor: added default initialization of RAY ron, rod members --- src/rt/raytrace.c | 4 +++- src/rt/source.c | 10 ++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/rt/raytrace.c b/src/rt/raytrace.c index ccc255481..49482c393 100644 --- a/src/rt/raytrace.c +++ b/src/rt/raytrace.c @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: raytrace.c,v 2.81 2020/03/29 18:21:57 greg Exp $"; +static const char RCSid[] = "$Id: raytrace.c,v 2.82 2021/01/04 19:07:15 greg Exp $"; #endif /* * raytrace.c - routines for tracing and shading rays. @@ -147,6 +147,8 @@ rayclear( /* clear a ray for (re)evaluation */ r->rox = NULL; r->rxt = r->rmt = r->rot = FHUGE; VCOPY(r->rop, r->rorg); + r->ron[0] = -r->rdir[0]; r->ron[1] = -r->rdir[1]; r->ron[2] = -r->rdir[2]; + r->rod = 1.0; r->pert[0] = r->pert[1] = r->pert[2] = 0.0; r->rflips = 0; r->uv[0] = r->uv[1] = 0.0; diff --git a/src/rt/source.c b/src/rt/source.c index c12575c25..5d9f4a972 100644 --- a/src/rt/source.c +++ b/src/rt/source.c @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.74 2020/12/17 03:30:37 greg Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.75 2021/01/04 19:07:15 greg Exp $"; #endif /* * source.c - routines dealing with illumination sources. @@ -364,15 +364,9 @@ sourcehit( /* check to see if ray hit distant source */ return(0); /* nothing usable */ } /* - * Make assignments. + * Assign object index */ r->robj = objndx(r->ro); - for (i = 0; i < 3; i++) - r->ron[i] = -r->rdir[i]; - r->rod = 1.0; - r->pert[0] = r->pert[1] = r->pert[2] = 0.0; - r->uv[0] = r->uv[1] = 0.0; - r->rox = NULL; return(1); }