From 7bd93cce37ed1e4f3a39547340f4c7d6894c32d2 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 11 May 2016 16:22:30 -0600 Subject: [PATCH] light: move private BSP tracing stuff from light.h to trace.c --- include/light/light.h | 49 ------------------------------------------- light/trace.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/include/light/light.h b/include/light/light.h index 197c9f5f..f833cb43 100644 --- a/include/light/light.h +++ b/include/light/light.h @@ -46,55 +46,6 @@ typedef struct { vec_t dist; } plane_t; -typedef struct traceinfo_s { - vec3_t point; - const bsp2_dface_t *face; - plane_t hitplane; - /* returns true if sky was hit. */ - bool hitsky; - bool hitback; - - // internal - vec3_t dir; -} traceinfo_t; - -/* Stopped by solid and sky */ -bool TraceFaces (traceinfo_t *ti, int node, const vec3_t start, const vec3_t end); - - -typedef struct { - const dplane_t *dplane; - int side; - vec3_t point; -} tracepoint_t; - -/* - * --------- - * TraceLine - * --------- - * Generic BSP model ray tracing function. Traces a ray from start towards - * stop. If the trace line hits one of the flagged contents along the way, the - * corresponding TRACE flag will be returned. Furthermore, if hitpoint is - * non-null, information about the point the ray hit will be filled in. - * - * model - The bsp model to trace against - * flags - contents which will stop the trace (must be > 0) - * start - coordinates to start trace - * stop - coordinates to end the trace - * hitpoint - filled in if result > 0 and hitpoint is non-NULL - * - * TraceLine will return a negative traceflag if the point 'start' resides - * inside a leaf with one of the contents types which stop the trace. - * - * ericw -- note, this should only be used for testing occlusion. - * the hitpoint is not accurate, imagine a solid cube floating in a room, - * only one of the 6 sides will be a node with a solid leaf child. - * Yet, which side is the node with the solid leaf child determines - * what the hit point will be. - */ -int TraceLine(const dmodel_t *model, const int traceflags, - const vec3_t start, const vec3_t end, tracepoint_t *hitpoint); - /* * Convenience functions TestLight and TestSky will test against all shadow * casting bmodels and self-shadow the model 'self' if self != NULL. Returns diff --git a/light/trace.c b/light/trace.c index 3134e263..9f9f560c 100644 --- a/light/trace.c +++ b/light/trace.c @@ -19,6 +19,54 @@ #include +typedef struct traceinfo_s { + vec3_t point; + const bsp2_dface_t *face; + plane_t hitplane; + /* returns true if sky was hit. */ + bool hitsky; + bool hitback; + + // internal + vec3_t dir; +} traceinfo_t; + +/* Stopped by solid and sky */ +bool TraceFaces (traceinfo_t *ti, int node, const vec3_t start, const vec3_t end); + +typedef struct { + const dplane_t *dplane; + int side; + vec3_t point; +} tracepoint_t; + +/* + * --------- + * TraceLine + * --------- + * Generic BSP model ray tracing function. Traces a ray from start towards + * stop. If the trace line hits one of the flagged contents along the way, the + * corresponding TRACE flag will be returned. Furthermore, if hitpoint is + * non-null, information about the point the ray hit will be filled in. + * + * model - The bsp model to trace against + * flags - contents which will stop the trace (must be > 0) + * start - coordinates to start trace + * stop - coordinates to end the trace + * hitpoint - filled in if result > 0 and hitpoint is non-NULL + * + * TraceLine will return a negative traceflag if the point 'start' resides + * inside a leaf with one of the contents types which stop the trace. + * + * ericw -- note, this should only be used for testing occlusion. + * the hitpoint is not accurate, imagine a solid cube floating in a room, + * only one of the 6 sides will be a node with a solid leaf child. + * Yet, which side is the node with the solid leaf child determines + * what the hit point will be. + */ +int TraceLine(const dmodel_t *model, const int traceflags, + const vec3_t start, const vec3_t end, tracepoint_t *hitpoint); + typedef struct tnode_s { vec3_t normal; vec_t dist;