Use Math_TAU and deg2rad/rad2deg in more places and optimize code

This commit is contained in:
Aaron Franke 2020-04-03 05:50:40 -04:00
parent 98ccaa1bad
commit 1d5042c9e2
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
34 changed files with 149 additions and 130 deletions

View file

@ -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;