MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ShootRayToVolumePoint

Function ShootRayToVolumePoint

editor/rad_cast.cpp:223–251  ·  view source on GitHub ↗

Returns 1 if a src vector can hit dest vector for a volume point

Source from the content-addressed store, hash-verified

221
222// Returns 1 if a src vector can hit dest vector for a volume point
223int ShootRayToVolumePoint(vector *src, vector *dest, int start_room) {
224 fvi_info hit_info;
225 fvi_query fq;
226
227 if (UseBSP) {
228 int fate = BSPRayOccluded(src, dest, MineBSP.root);
229 if (!fate)
230 return 1;
231 return 0;
232 }
233
234 // shoot a ray from the light position to the current vertex
235 fq.p0 = src;
236 fq.p1 = dest;
237
238 fq.startroom = start_room;
239
240 fq.rad = 0.0f;
241 fq.flags = FQ_CHECK_OBJS | FQ_IGNORE_NON_LIGHTMAP_OBJECTS | FQ_NO_RELINK | FQ_IGNORE_RENDER_THROUGH_PORTALS;
242 fq.thisobjnum = -1;
243 fq.ignore_obj_list = NULL;
244
245 int fate = fvi_FindIntersection(&fq, &hit_info);
246
247 float dist = vm_VectorDistance(&hit_info.hit_pnt, dest);
248 if (dist > .1)
249 return 0;
250 return 1;
251}
252
253void ClipSatelliteToTerrain(vector *answer, vector *src_vec, vector *dest_vec) {
254 vector cur_vec = *src_vec;

Callers 1

Calls 3

BSPRayOccludedFunction · 0.85
fvi_FindIntersectionFunction · 0.85
vm_VectorDistanceFunction · 0.50

Tested by

no test coverage detected