MCPcopy Create free account
hub / github.com/HailToDodongo/pyrite64 / drawSphere

Method drawSphere

n64/engine/src/debug/debugDraw.cpp:112–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void P64::Debug::drawSphere(const fm_vec3_t &center, float radius, color_t color) {
113
114 int steps = 12;
115 float step = 2.0f * (float)M_PI / steps;
116 fm_vec3_t last = center + fm_vec3_t{radius, 0, 0};
117 for(int i=1; i<=steps; ++i) {
118 float angle = i * step;
119 fm_vec3_t next = center + fm_vec3_t{radius * fm_cosf(angle), 0, radius * fm_sinf(angle)};
120 drawLine(last, next, color);
121 last = next;
122 }
123 last = center + fm_vec3_t{0, radius, 0};
124 for(int i=1; i<=steps; ++i) {
125 float angle = i * step;
126 fm_vec3_t next = center + fm_vec3_t{0, radius * fm_cosf(angle), radius * fm_sinf(angle)};
127 drawLine(last, next, color);
128 last = next;
129 }
130 last = center + fm_vec3_t{0, 0, radius};
131 for(int i=1; i<=steps; ++i) {
132 float angle = i * step;
133 fm_vec3_t next = center + fm_vec3_t{radius * fm_cosf(angle), radius * fm_sinf(angle), 0};
134 drawLine(last, next, color);
135 last = next;
136 }
137}
138
139void P64::Debug::draw(surface_t *fb) {
140 if(lines.empty())return;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected