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

Function AddPointToFace

editor/HRoom.cpp:1034–1064  ·  view source on GitHub ↗

Adds a point to a face Parameters: rp,facenum - the face we're adding the point to vertindex - the position in the face's vertex list at which to add the point vp - the point to add

Source from the content-addressed store, hash-verified

1032// vertindex - the position in the face's vertex list at which to add the point
1033// vp - the point to add
1034void AddPointToFace(room *rp, int facenum, int vertindex, vector *vp) {
1035 face *fp = &rp->faces[facenum];
1036 int old_verts[MAX_VERTS_PER_FACE];
1037 roomUVL old_uvls[MAX_VERTS_PER_FACE];
1038 int t;
1039
1040 // Add the new point to the room
1041 int newvertnum = RoomAddVertices(rp, 1);
1042 rp->verts[newvertnum] = *vp;
1043
1044 // Make copy of old verts
1045 for (t = 0; t < fp->num_verts; t++) {
1046 old_verts[t] = fp->face_verts[t];
1047 old_uvls[t] = fp->face_uvls[t];
1048 }
1049
1050 // Allocate for new verts
1051 ReInitRoomFace(fp, fp->num_verts + 1);
1052
1053 // Copy old verts
1054 for (t = 0; t < vertindex; t++) {
1055 fp->face_verts[t] = old_verts[t];
1056 fp->face_uvls[t] = old_uvls[t];
1057 }
1058 fp->face_verts[t++] = newvertnum;
1059 // fp0->face_uvls[t] = ??
1060 for (; t < fp->num_verts; t++) {
1061 fp->face_verts[t] = old_verts[t - 1];
1062 fp->face_uvls[t] = old_uvls[t - 1];
1063 }
1064}
1065
1066// Deletes a point from a face
1067// Parameters: rp,facenum - the face we're deleting the point from

Callers

nothing calls this directly

Calls 2

RoomAddVerticesFunction · 0.85
ReInitRoomFaceFunction · 0.85

Tested by

no test coverage detected