mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Replace M_PI with C++ numbers
C++20 added π (pi) to the standard, replace the C macro globally. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <numbers>
|
||||
|
||||
/* Note: this implementation uses CVertexBufferManager directly rather than access it through the nicer VertexArray interface,
|
||||
* because it allows you to work with variable amounts of vertices and indices more easily. New code should prefer
|
||||
@@ -410,7 +411,7 @@ void CTexturedLineRData::CreateLineCap(const SOverlayTexturedLine& line, const C
|
||||
// To please OpenGL's winding order, this angle needs to be negated depending on whether we start rotating from
|
||||
// the (center -> corner1) or (center -> corner2) vector. For the (center -> corner2) vector, we apparently need to use
|
||||
// the negated angle.
|
||||
float stepAngle = -(float)(M_PI/(roundCapPoints-1));
|
||||
float stepAngle = -std::numbers::pi_v<float> / (roundCapPoints-1);
|
||||
|
||||
// Push the vertices in triangle fan order (easy to generate GL_TRIANGLES indices for afterwards)
|
||||
// Note that we're manually adding the corner vertices instead of having them be generated by the rotating vector.
|
||||
|
||||
Reference in New Issue
Block a user