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

Function g3_DrawBox

renderer/HardwareDraw.cpp:416–431  ·  view source on GitHub ↗

Draw a wireframe box aligned with the screen. Used for the editor. Parameters: color - the color to draw the lines pnt - the center point rad - specifies the width/2 & height/2 of the box

Source from the content-addressed store, hash-verified

414// pnt - the center point
415// rad - specifies the width/2 & height/2 of the box
416void g3_DrawBox(ddgr_color color, g3Point *pnt, float rad) {
417 if (!(pnt->p3_codes & CC_BEHIND)) {
418 if (!(pnt->p3_flags & PF_PROJECTED))
419 g3_ProjectPoint(pnt);
420
421 float w, h;
422
423 w = rad * Matrix_scale.x * Window_w2 / pnt->p3_z;
424 h = rad * Matrix_scale.y * Window_h2 / pnt->p3_z;
425
426 rend_DrawLine(round(pnt->p3_sx - w), round(pnt->p3_sy - h), round(pnt->p3_sx + w), round(pnt->p3_sy - h));
427 rend_DrawLine(round(pnt->p3_sx + w), round(pnt->p3_sy - h), round(pnt->p3_sx + w), round(pnt->p3_sy + h));
428 rend_DrawLine(round(pnt->p3_sx + w), round(pnt->p3_sy + h), round(pnt->p3_sx - w), round(pnt->p3_sy + h));
429 rend_DrawLine(round(pnt->p3_sx - w), round(pnt->p3_sy + h), round(pnt->p3_sx - w), round(pnt->p3_sy - h));
430 }
431}
432
433// Sets the triangulation test to on or off
434void g3_SetTriangulationTest(int state) { Triangulate_test = state; }

Callers 1

RenderObjectFunction · 0.85

Calls 2

g3_ProjectPointFunction · 0.85
rend_DrawLineFunction · 0.70

Tested by

no test coverage detected