Checks to see what faces intersect the passed in portal
| 573 | |
| 574 | // Checks to see what faces intersect the passed in portal |
| 575 | void MarkFacesForRendering(int roomnum, clip_wnd *wnd) { |
| 576 | room *rp = &Rooms[roomnum]; |
| 577 | int i; |
| 578 | MarkFacingFaces(roomnum, rp->verts); |
| 579 | |
| 580 | // Rotate all the points in this room |
| 581 | if (rp->wpb_index == -1) { |
| 582 | rp->wpb_index = Global_buffer_index; |
| 583 | |
| 584 | // Katmai enhanced rotate only in a release build, because not |
| 585 | // everyone has the intel compiler! |
| 586 | #if (defined(RELEASE) && defined(KATMAI)) |
| 587 | if (Katmai) |
| 588 | RotateRoomPoints(rp, rp->verts4); |
| 589 | else |
| 590 | #endif |
| 591 | RotateRoomPoints(rp, rp->verts); |
| 592 | |
| 593 | Global_buffer_index += rp->num_verts; |
| 594 | } |
| 595 | if (rp->flags & RF_DOOR) { |
| 596 | for (i = 0; i < rp->num_faces; i++) |
| 597 | rp->faces[i].flags |= FF_VISIBLE; |
| 598 | } else { |
| 599 | // If this room contains a mirror, just mark all faces as visible |
| 600 | // Else go through and figure out which ones are visible from the current portal |
| 601 | if (rp->mirror_face == -1 || !Detail_settings.Mirrored_surfaces) { |
| 602 | // Do pointer dereferencing instead of array lookup for speed reasons |
| 603 | g3Point *pnt = &World_point_buffer[rp->wpb_index]; |
| 604 | for (i = 0; i < rp->num_verts; i++, pnt++) { |
| 605 | Room_clips[i] = clip2d(pnt, wnd); |
| 606 | } |
| 607 | face *fp = &rp->faces[0]; |
| 608 | for (i = 0; i < rp->num_faces; i++, fp++) { |
| 609 | if (fp->flags & (FF_NOT_FACING | FF_VISIBLE)) |
| 610 | continue; // this face is a backface |
| 611 | |
| 612 | if (FaceIntersectsPortal(rp, fp, wnd)) |
| 613 | fp->flags |= FF_VISIBLE; |
| 614 | } |
| 615 | } else { |
| 616 | if (rp->flags & RF_MIRROR_VISIBLE) // If this room is already mirror, just return |
| 617 | return; |
| 618 | g3Point *pnt = &World_point_buffer[rp->wpb_index]; |
| 619 | for (i = 0; i < rp->num_verts; i++, pnt++) { |
| 620 | Room_clips[i] = clip2d(pnt, wnd); |
| 621 | } |
| 622 | int done = 0; |
| 623 | face *fp; |
| 624 | for (i = 0; i < rp->num_mirror_faces && !done; i++) { |
| 625 | fp = &rp->faces[rp->mirror_faces_list[i]]; |
| 626 | if (FaceIntersectsPortal(rp, fp, wnd)) { |
| 627 | rp->flags |= RF_MIRROR_VISIBLE; |
| 628 | Mirror_rooms[Num_mirror_rooms++] = roomnum; |
| 629 | done = 1; |
| 630 | } |
| 631 | } |
| 632 |
no test coverage detected