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

Function g3_DrawLine

renderer/HardwareDraw.cpp:26–64  ·  view source on GitHub ↗

draws a line. takes two points. returns true if drew

Source from the content-addressed store, hash-verified

24
25// draws a line. takes two points. returns true if drew
26void g3_DrawLine(ddgr_color color, g3Point *p0, g3Point *p1) {
27 uint8_t codes_or;
28 bool was_clipped = 0;
29
30 if (p0->p3_codes & p1->p3_codes)
31 return;
32
33 codes_or = p0->p3_codes | p1->p3_codes;
34
35 if (codes_or) {
36 ClipLine(&p0, &p1, codes_or);
37 was_clipped = 1;
38 }
39
40 if (!(p0->p3_flags & PF_PROJECTED)) {
41 g3_ProjectPoint(p0);
42 }
43
44 if (!(p1->p3_flags & PF_PROJECTED)) {
45 g3_ProjectPoint(p1);
46 }
47
48 rend_SetFlatColor(color);
49 rend_DrawLine(round(p0->p3_sx), round(p0->p3_sy), round(p1->p3_sx), round(p1->p3_sy));
50
51 // If was clipped, free temp points
52 if (was_clipped) {
53 if (p0->p3_flags & PF_TEMP_POINT) {
54 FreeTempPoint(p0);
55 }
56
57 if (p1->p3_flags & PF_TEMP_POINT) {
58 FreeTempPoint(p1);
59 }
60
61 // Make sure all temp points have been freed
62 CheckTempPoints();
63 }
64}
65
66// draws a line based on the current setting of render states. takes two points. returns true if drew
67void g3_DrawSpecialLine(g3Point *p0, g3Point *p1) {

Callers 15

model_draw_outlineFunction · 0.85
DrawSubmodelFaceOutlineFunction · 0.85
DrawLineFunction · 0.85
DrawAllPathsFunction · 0.85
DrawNumberFunction · 0.85
EBNode_DrawRoomFunction · 0.85
DrawNumberFunction · 0.85
DrawDebugInfoFunction · 0.85
RenderObjectFunction · 0.85
DrawWireframeSkyFunction · 0.85
DrawTerrainOutlineFunction · 0.85

Calls 6

ClipLineFunction · 0.85
g3_ProjectPointFunction · 0.85
FreeTempPointFunction · 0.85
CheckTempPointsFunction · 0.85
rend_SetFlatColorFunction · 0.70
rend_DrawLineFunction · 0.70

Tested by

no test coverage detected