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

Function SizeRoomVertices

editor/roomkeypaddialog.cpp:677–704  ·  view source on GitHub ↗

Goes through all the vertices in the room and scales them by scale_factor

Source from the content-addressed store, hash-verified

675
676// Goes through all the vertices in the room and scales them by scale_factor
677void SizeRoomVertices(room *rp, float scale_factor) {
678 vector room_center;
679 vector vec;
680 int portal_list[MAX_VERTS_PER_ROOM];
681 int i, t, ok_to_scale;
682 int num_portal_verts;
683
684 ASSERT(rp->used > 0);
685
686 num_portal_verts = BuildListOfPortalVerts(rp, portal_list);
687
688 ComputeRoomCenter(&room_center, rp);
689
690 for (i = 0; i < rp->num_verts; i++) {
691 for (ok_to_scale = 1, t = 0; t < num_portal_verts; t++) {
692 if (portal_list[t] == i) {
693 ok_to_scale = 0;
694 break;
695 }
696 }
697
698 if (ok_to_scale) {
699 vec = rp->verts[i] - room_center;
700 vec *= scale_factor;
701 rp->verts[i] = vec + room_center;
702 }
703 }
704}
705
706// Goes through all the vertices in a face and scales them by scale_factor
707void SizeFaceVertices(room *rp, int facenum, float scale_factor) {

Callers 2

OnRoompadExpandRoomMethod · 0.85
OnRoompadContractRoomMethod · 0.85

Calls 2

BuildListOfPortalVertsFunction · 0.85
ComputeRoomCenterFunction · 0.85

Tested by

no test coverage detected