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

Function FaceIntersectsPortal

Descent3/render.cpp:387–416  ·  view source on GitHub ↗

Returns true if a face intersects the passed in portal in any way

Source from the content-addressed store, hash-verified

385}
386// Returns true if a face intersects the passed in portal in any way
387static inline bool FaceIntersectsPortal(room *rp, face *fp, clip_wnd *wnd) {
388 g3Codes cc;
389 int i;
390
391 cc.cc_or = 0;
392 cc.cc_and = 0xff;
393 for (i = 0; i < fp->num_verts; i++) {
394 cc.cc_or |= Room_clips[fp->face_verts[i]];
395 cc.cc_and &= Room_clips[fp->face_verts[i]];
396 }
397 if (cc.cc_and)
398 return false; // completely outside
399 if (!cc.cc_or)
400 return true; // completely inside
401
402 // Now we must do a check
403 for (i = 0; i < fp->num_verts; i++) {
404 g3Point *p1 = &World_point_buffer[rp->wpb_index + fp->face_verts[i]];
405 g3Point *p2 = &World_point_buffer[rp->wpb_index + fp->face_verts[(i + 1) % fp->num_verts]];
406 if (LineIntersectsLine(p1, p2, wnd->left, wnd->top, wnd->right, wnd->top))
407 return true;
408 if (LineIntersectsLine(p1, p2, wnd->right, wnd->top, wnd->right, wnd->bot))
409 return true;
410 if (LineIntersectsLine(p1, p2, wnd->right, wnd->bot, wnd->left, wnd->bot))
411 return true;
412 if (LineIntersectsLine(p1, p2, wnd->left, wnd->bot, wnd->left, wnd->top))
413 return true;
414 }
415 return false;
416}
417// Sets the status of a glow light
418void SetGlowStatus(int roomnum, int facenum, vector *center, float size, int fast) {
419 int i;

Callers 1

MarkFacesForRenderingFunction · 0.85

Calls 1

LineIntersectsLineFunction · 0.85

Tested by

no test coverage detected