MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / draw_circle

Method draw_circle

native/shared/src/renderer/mod.rs:11890–11910  ·  view source on GitHub ↗
(&mut self, cx: f64, cy: f64, radius: f64, r: f64, g: f64, b: f64, a: f64)

Source from the content-addressed store, hash-verified

11888 }
11889
11890 pub fn draw_circle(&mut self, cx: f64, cy: f64, radius: f64, r: f64, g: f64, b: f64, a: f64) {
11891 self.ensure_draw_state(0);
11892 let color = Self::color_to_f32(r, g, b, a);
11893 let segments = 36u32;
11894 let base = self.vertices_2d.len() as u32;
11895 let (cx, cy, radius) = (cx as f32, cy as f32, radius as f32);
11896
11897 self.vertices_2d.push(Vertex2D { position: [cx, cy], uv: [0.0, 0.0], color });
11898 for i in 0..segments {
11899 let angle = (i as f32) / (segments as f32) * std::f32::consts::TAU;
11900 self.vertices_2d.push(Vertex2D {
11901 position: [cx + radius * angle.cos(), cy + radius * angle.sin()],
11902 uv: [0.0, 0.0],
11903 color,
11904 });
11905 }
11906 for i in 0..segments {
11907 let next = if i + 1 < segments { i + 1 } else { 0 };
11908 self.indices_2d.extend_from_slice(&[base, base + 1 + i, base + 1 + next]);
11909 }
11910 }
11911
11912 pub fn draw_circle_lines(&mut self, cx: f64, cy: f64, radius: f64, r: f64, g: f64, b: f64, a: f64) {
11913 let segments = 36;

Callers 7

bloom_draw_circleFunction · 0.80
bloom_draw_circleFunction · 0.80
bloom_draw_circleFunction · 0.80
bloom_draw_circleFunction · 0.80
bloom_draw_circleFunction · 0.80
bloom_draw_circleFunction · 0.80
bloom_draw_circleFunction · 0.80

Calls 2

ensure_draw_stateMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected