mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-03 17:19:46 +02:00
Replace uses of cmath constants by glm
This commit is contained in:
parent
772876afdb
commit
bdfa30729f
@ -140,10 +140,6 @@ add_library(rwengine
|
||||
${RWENGINE_SOURCES}
|
||||
)
|
||||
|
||||
if(MINGW)
|
||||
add_definitions(-D _USE_MATH_DEFINES)
|
||||
endif()
|
||||
|
||||
target_link_libraries(rwengine
|
||||
rwlib
|
||||
${MAD_LIBRARY}
|
||||
|
@ -1,6 +1,3 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
#include <render/GameRenderer.hpp>
|
||||
#include <engine/GameWorld.hpp>
|
||||
#include <engine/Animator.hpp>
|
||||
@ -26,7 +23,7 @@
|
||||
#include <core/Logger.hpp>
|
||||
|
||||
#include <deque>
|
||||
#include <cmath>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/gtx/string_cast.hpp>
|
||||
|
||||
@ -163,9 +160,9 @@ GameRenderer::GameRenderer(Logger* log, GameData* _data)
|
||||
for( size_t r = 0, i = 0; r < rows; ++r) {
|
||||
for( size_t s = 0; s < segments; ++s) {
|
||||
skydomeVerts[i++].position = glm::vec3(
|
||||
cos(2.f * M_PI * s * S) * cos(M_PI_2 * r * R),
|
||||
sin(2.f * M_PI * s * S) * cos(M_PI_2 * r * R),
|
||||
sin(M_PI_2 * r * R)
|
||||
cos(2.f * glm::pi<float>() * s * S) * cos(glm::half_pi<float>() * r * R),
|
||||
sin(2.f * glm::pi<float>() * s * S) * cos(glm::half_pi<float>() * r * R),
|
||||
sin(glm::half_pi<float>() * r * R)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ target_link_libraries(rwgame
|
||||
${SDL2_LIBRARY}
|
||||
)
|
||||
if(MINGW)
|
||||
add_definitions(-D _USE_MATH_DEFINES)
|
||||
target_link_libraries(rwgame
|
||||
mman)
|
||||
endif()
|
||||
|
@ -1,6 +1,3 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
#include "DrawUI.hpp"
|
||||
#include <render/GameRenderer.hpp>
|
||||
#include <ai/PlayerController.hpp>
|
||||
@ -8,6 +5,7 @@
|
||||
#include <engine/GameState.hpp>
|
||||
#include <items/WeaponItem.hpp>
|
||||
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <iomanip>
|
||||
|
||||
constexpr size_t ui_textSize = 25;
|
||||
@ -34,7 +32,7 @@ void drawMap(ViewCamera& currentView, PlayerController* player, GameWorld* worl
|
||||
|
||||
glm::quat camRot = currentView.rotation;
|
||||
|
||||
map.rotation = glm::roll(camRot) - M_PI/2.f;
|
||||
map.rotation = glm::roll(camRot) - glm::half_pi<float>();
|
||||
map.worldSize = ui_worldSizeMin;
|
||||
map.worldSize = ui_worldSizeMax;
|
||||
if( player )
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <script/ScriptMachine.hpp>
|
||||
#include <dynamics/RaycastCallbacks.hpp>
|
||||
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
constexpr float kAutoLookTime = 2.f;
|
||||
@ -343,7 +344,7 @@ void IngameState::tick(float dt)
|
||||
}
|
||||
|
||||
float length = glm::length(movement);
|
||||
float movementAngle = angleYaw - M_PI/2.f;
|
||||
float movementAngle = angleYaw - glm::half_pi<float>();
|
||||
if (length > 0.1f)
|
||||
{
|
||||
glm::vec3 direction = glm::normalize(movement);
|
||||
|
Loading…
Reference in New Issue
Block a user