From 8d930df8fd58af9f84e35fb19f6589c9af22f6ac Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Sun, 4 Nov 2018 05:19:16 -0500 Subject: [PATCH] Fix compilation errors on Ubuntu 16.04 --- CMakeLists.txt | 4 +++- src/level/level_light.cpp | 5 +++-- src/lightmap/lightmap.cpp | 8 ++++---- src/math/mathlib.h | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4db9c7..e8d13ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ include( CheckCXXCompilerFlag ) project( ZDRay ) +SET( CMAKE_CXX_STANDARD 14 ) + IF( NOT CMAKE_BUILD_TYPE ) SET( CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." @@ -84,7 +86,7 @@ if( MSVC ) endif( MSVC ) if( CMAKE_COMPILER_IS_GNUCXX ) - set( ALL_C_FLAGS "${ALL_C_FLAGS} -ffast-math -pipe" ) + set( ALL_C_FLAGS "${ALL_C_FLAGS} -ffast-math -pipe -pthread" ) if( GPROF ) set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" ) else( GPROF ) diff --git a/src/level/level_light.cpp b/src/level/level_light.cpp index ff41373..120e266 100644 --- a/src/level/level_light.cpp +++ b/src/level/level_light.cpp @@ -34,6 +34,7 @@ #include "level/level.h" #include "lightmap/lightsurface.h" #include +#include #ifdef _MSC_VER #pragma warning(disable: 4267) // warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data @@ -198,11 +199,11 @@ void FLevel::CreateLights() } else if (!stricmp(key.key, "lightinnerangle")) { - innerAngleCos = std::cosf(atof(key.value) * 3.14159265359f / 180.0f); + innerAngleCos = std::cos(atof(key.value) * 3.14159265359f / 180.0f); } else if (!stricmp(key.key, "lightouterangle")) { - outerAngleCos = std::cosf(atof(key.value) * 3.14159265359f / 180.0f); + outerAngleCos = std::cos(atof(key.value) * 3.14159265359f / 180.0f); } } diff --git a/src/lightmap/lightmap.cpp b/src/lightmap/lightmap.cpp index 41680c5..bf7407f 100644 --- a/src/lightmap/lightmap.cpp +++ b/src/lightmap/lightmap.cpp @@ -250,11 +250,11 @@ kexVec3 kexLightmapBuilder::LightTexelSample(const kexVec3 &origin, surface_t *s if (tl->outerAngleCos > -1.0f) { float negPitch = -radians(tl->mapThing->pitch); - float xyLen = std::cosf(negPitch); + float xyLen = std::cos(negPitch); kexVec3 spotDir; - spotDir.x = std::sinf(radians(tl->mapThing->angle)) * xyLen; - spotDir.y = std::cosf(radians(tl->mapThing->angle)) * xyLen; - spotDir.z = -std::sinf(negPitch); + spotDir.x = std::sin(radians(tl->mapThing->angle)) * xyLen; + spotDir.y = std::cos(radians(tl->mapThing->angle)) * xyLen; + spotDir.z = -std::sin(negPitch); float cosDir = kexVec3::Dot(dir, spotDir); spotAttenuation = smoothstep(tl->outerAngleCos, tl->innerAngleCos, cosDir); if (spotAttenuation <= 0.0f) diff --git a/src/math/mathlib.h b/src/math/mathlib.h index c405462..ccbd980 100644 --- a/src/math/mathlib.h +++ b/src/math/mathlib.h @@ -29,6 +29,7 @@ #include #include +#include #ifdef M_PI #undef M_PI