You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Use Math_TAU and deg2rad/rad2deg in more places and optimize code
This commit is contained in:
@@ -721,8 +721,10 @@ void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos,
|
||||
static const int circle_points = 64;
|
||||
|
||||
points.resize(circle_points);
|
||||
const real_t circle_point_step = Math_TAU / circle_points;
|
||||
|
||||
for (int i = 0; i < circle_points; i++) {
|
||||
float angle = (i / float(circle_points)) * 2 * Math_PI;
|
||||
float angle = i * circle_point_step;
|
||||
points.write[i].x = Math::cos(angle) * p_radius;
|
||||
points.write[i].y = Math::sin(angle) * p_radius;
|
||||
points.write[i] += p_pos;
|
||||
|
||||
Reference in New Issue
Block a user