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

Function OutlineCurrentFace

Descent3/render.cpp:289–327  ·  view source on GitHub ↗

Draw outline for current edge & vertex

Source from the content-addressed store, hash-verified

287#define PLACED_COLOR GR_RGB(255, 0, 255)
288// Draw outline for current edge & vertex
289void OutlineCurrentFace(room *rp, int facenum, int edgenum, int vertnum, ddgr_color face_color, ddgr_color edge_color) {
290 face *fp = &rp->faces[facenum];
291 g3Point p0, p1;
292 uint8_t c0, c1;
293 int v;
294 for (v = 0; v < fp->num_verts; v++) {
295 c0 = g3_RotatePoint(&p0, &rp->verts[fp->face_verts[v]]);
296 c1 = g3_RotatePoint(&p1, &rp->verts[fp->face_verts[(v + 1) % fp->num_verts]]);
297 if (!(c0 & c1)) { // both not off screen?
298 // Draw current edge in green
299 g3_DrawLine((v == edgenum) ? edge_color : face_color, &p0, &p1);
300 }
301 if ((v == vertnum) && (c0 == 0)) {
302 // Draw a little cross at the current vert
303 g3_ProjectPoint(&p0); // make sure projected
304 rend_SetFlatColor(edge_color);
305 rend_DrawLine(p0.p3_sx - CROSS_WIDTH, p0.p3_sy, p0.p3_sx, p0.p3_sy - CROSS_HEIGHT);
306 rend_DrawLine(p0.p3_sx, p0.p3_sy - CROSS_HEIGHT, p0.p3_sx + CROSS_WIDTH, p0.p3_sy);
307 rend_DrawLine(p0.p3_sx + CROSS_WIDTH, p0.p3_sy, p0.p3_sx, p0.p3_sy + CROSS_HEIGHT);
308 rend_DrawLine(p0.p3_sx, p0.p3_sy + CROSS_HEIGHT, p0.p3_sx - CROSS_WIDTH, p0.p3_sy);
309 }
310 }
311 // Draw upper left cross
312 if (Outline_lightmaps && (rp->faces[facenum].flags & FF_LIGHTMAP)) {
313 ASSERT(rp->faces[facenum].lmi_handle != BAD_LMI_INDEX);
314
315 p0.p3_flags = 0;
316 c0 = g3_RotatePoint(&p0, &LightmapInfo[rp->faces[facenum].lmi_handle].upper_left);
317 if (!c0) {
318 // Draw a little cross at the current vert
319 g3_ProjectPoint(&p0); // make sure projected
320 rend_SetFlatColor(GR_RGB(255, 0, 0));
321 rend_DrawLine(p0.p3_sx - CROSS_WIDTH, p0.p3_sy, p0.p3_sx, p0.p3_sy - CROSS_HEIGHT);
322 rend_DrawLine(p0.p3_sx, p0.p3_sy - CROSS_HEIGHT, p0.p3_sx + CROSS_WIDTH, p0.p3_sy);
323 rend_DrawLine(p0.p3_sx + CROSS_WIDTH, p0.p3_sy, p0.p3_sx, p0.p3_sy + CROSS_HEIGHT);
324 rend_DrawLine(p0.p3_sx, p0.p3_sy + CROSS_HEIGHT, p0.p3_sx - CROSS_WIDTH, p0.p3_sy);
325 }
326 }
327}
328
329// Draw a room rotated and placed in space
330static void DrawPlacedRoomFace(room *rp, vector *rotpoint, matrix *rotmat, vector *placepoint, int facenum, int color) {

Callers 1

RenderMineFunction · 0.85

Calls 6

g3_RotatePointFunction · 0.85
g3_DrawLineFunction · 0.85
g3_ProjectPointFunction · 0.85
rend_SetFlatColorFunction · 0.50
rend_DrawLineFunction · 0.50
GR_RGBFunction · 0.50

Tested by

no test coverage detected