Fix compilation errors on Ubuntu 16.04

This commit is contained in:
Kevin Caccamo 2018-11-04 05:19:16 -05:00
parent 0ac4781d5e
commit 8d930df8fd
4 changed files with 11 additions and 7 deletions

View file

@ -8,6 +8,8 @@ include( CheckCXXCompilerFlag )
project( ZDRay ) project( ZDRay )
SET( CMAKE_CXX_STANDARD 14 )
IF( NOT CMAKE_BUILD_TYPE ) IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Debug CACHE STRING SET( CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
@ -84,7 +86,7 @@ if( MSVC )
endif( MSVC ) endif( MSVC )
if( CMAKE_COMPILER_IS_GNUCXX ) 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 ) if( GPROF )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" ) set( ALL_C_FLAGS "${ALL_C_FLAGS} -pg -g" )
else( GPROF ) else( GPROF )

View file

@ -34,6 +34,7 @@
#include "level/level.h" #include "level/level.h"
#include "lightmap/lightsurface.h" #include "lightmap/lightsurface.h"
#include <algorithm> #include <algorithm>
#include <memory>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable: 4267) // warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data #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")) 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")) 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);
} }
} }

View file

@ -250,11 +250,11 @@ kexVec3 kexLightmapBuilder::LightTexelSample(const kexVec3 &origin, surface_t *s
if (tl->outerAngleCos > -1.0f) if (tl->outerAngleCos > -1.0f)
{ {
float negPitch = -radians(tl->mapThing->pitch); float negPitch = -radians(tl->mapThing->pitch);
float xyLen = std::cosf(negPitch); float xyLen = std::cos(negPitch);
kexVec3 spotDir; kexVec3 spotDir;
spotDir.x = std::sinf(radians(tl->mapThing->angle)) * xyLen; spotDir.x = std::sin(radians(tl->mapThing->angle)) * xyLen;
spotDir.y = std::cosf(radians(tl->mapThing->angle)) * xyLen; spotDir.y = std::cos(radians(tl->mapThing->angle)) * xyLen;
spotDir.z = -std::sinf(negPitch); spotDir.z = -std::sin(negPitch);
float cosDir = kexVec3::Dot(dir, spotDir); float cosDir = kexVec3::Dot(dir, spotDir);
spotAttenuation = smoothstep(tl->outerAngleCos, tl->innerAngleCos, cosDir); spotAttenuation = smoothstep(tl->outerAngleCos, tl->innerAngleCos, cosDir);
if (spotAttenuation <= 0.0f) if (spotAttenuation <= 0.0f)

View file

@ -29,6 +29,7 @@
#include <math.h> #include <math.h>
#include <cstdint> #include <cstdint>
#include <cstddef>
#ifdef M_PI #ifdef M_PI
#undef M_PI #undef M_PI