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

Function DrawRoom

editor/drawworld.cpp:606–647  ·  view source on GitHub ↗

Draw a room

Source from the content-addressed store, hash-verified

604
605// Draw a room
606void DrawRoom(room *rp, int room_color) {
607 int fn, vn;
608 face *fp;
609 int edge_type;
610
611 ResetEdgeList(MAX_EDGES);
612
613 // Rotate all the points
614 for (vn = 0; vn < rp->num_verts; vn++)
615 g3_RotatePoint((g3Point *)&World_point_buffer[vn], &rp->verts[vn]);
616
617 for (fn = 0, fp = rp->faces; fn < rp->num_faces; fn++, fp++) {
618 if (fp->flags & FF_FLOATING_TRIG) {
619 for (vn = 0; vn < fp->num_verts; vn++)
620 DrawLine(FLOAT_TRIG_COLOR, fp->face_verts[vn], fp->face_verts[(vn + 1) % fp->num_verts]);
621 DrawLine(FLOAT_TRIG_COLOR, fp->face_verts[0], fp->face_verts[2]);
622 DrawLine(FLOAT_TRIG_COLOR, fp->face_verts[1], fp->face_verts[3]);
623 } else if (fp->portal_num == -1) {
624 bool facing = g3_CheckNormalFacing(&rp->verts[fp->face_verts[0]], &fp->normal);
625 for (vn = 0; vn < fp->num_verts; vn++) {
626 if (facing)
627 edge_type = ET_NOTFACING;
628 else
629 edge_type = ET_FACING;
630
631 AddEdge(fp->face_verts[vn], fp->face_verts[(vn + 1) % fp->num_verts], edge_type);
632 }
633 }
634 }
635
636 DrawEdges(room_color);
637
638 // Now draw the terrain portals
639 for (int p = 0; p < rp->num_portals; p++) {
640 portal *pp = &rp->portals[p];
641 if (pp->croom == -1) { // terrain portal
642 fp = &rp->faces[pp->portal_face];
643 for (vn = 0; vn < fp->num_verts; vn++)
644 DrawLine(TERR_PORTAL_COLOR, fp->face_verts[vn], fp->face_verts[(vn + 1) % fp->num_verts]);
645 }
646 }
647}
648
649// Draw a room rotated and placed in space
650void DrawRoomRotated(room *rp, vector *rotpoint, matrix *rotmat, vector *placepoint, int room_color) {

Callers 2

DrawAllRoomsFunction · 0.85
DrawWorldFunction · 0.85

Calls 6

ResetEdgeListFunction · 0.85
g3_RotatePointFunction · 0.85
DrawLineFunction · 0.85
g3_CheckNormalFacingFunction · 0.85
AddEdgeFunction · 0.85
DrawEdgesFunction · 0.85

Tested by

no test coverage detected