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

Function MarkFacingFaces

Descent3/render.cpp:525–553  ·  view source on GitHub ↗

Marks all the faces facing us as drawable

Source from the content-addressed store, hash-verified

523
524// Marks all the faces facing us as drawable
525void MarkFacingFaces(int roomnum, vector *world_verts) {
526 room *rp = &Rooms[roomnum];
527 face *fp;
528 vector tvec;
529 if (Facing_visited[roomnum] == FrameCount)
530 return;
531 Facing_visited[roomnum] = FrameCount;
532
533 fp = &rp->faces[0];
534 // Go through and mark all non facing faces
535 if (Render_mirror_for_room) {
536 room *mirror_rp = &Rooms[Mirror_room];
537 face *mirror_fp = &mirror_rp->faces[mirror_rp->mirror_face];
538 for (int t = 0; t < rp->num_faces; t++, fp++) {
539 vector incident_norm;
540 ReflectRay(&incident_norm, &fp->normal, &mirror_fp->normal);
541
542 tvec = Viewer_eye - world_verts[fp->face_verts[0]];
543 if ((tvec * incident_norm) <= 0)
544 fp->flags |= FF_NOT_FACING;
545 }
546 } else {
547 for (int i = 0; i < rp->num_faces; i++, fp++) {
548 tvec = Viewer_eye - world_verts[fp->face_verts[0]];
549 if ((tvec * fp->normal) <= 0)
550 fp->flags |= FF_NOT_FACING;
551 }
552 }
553}
554
555// Returns true if the external room is visible from the passed in portal
556int ExternalRoomVisibleFromPortal(int index, clip_wnd *wnd) {

Callers 3

MarkFacesForRenderingFunction · 0.85
BuildRoomListFunction · 0.85
RenderMirroredRoomFunction · 0.85

Calls 1

ReflectRayFunction · 0.85

Tested by

no test coverage detected