aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-02-13 00:27:21 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-02-13 00:27:21 +0800
commitb859c1accbb2bf7b19f634346528458ccf11b6f1 (patch)
tree9edc158e77cda0000d020f27c7f17fb3d1c9014c
parent7621516c1ca0ecf9f80d094763a1705c32d7458f (diff)
downloadSMELT-b859c1accbb2bf7b19f634346528458ccf11b6f1.tar.xz
Fixed building on Microsoft(R) Windows(TM), a.k.a. the most advanced
operating system ever.
-rw-r--r--include/smmath.hpp6
-rw-r--r--smelt/glfw/gfx_glfw.cpp2
-rw-r--r--smelt/glfw/smelt_internal.hpp10
-rw-r--r--smelt/glfw/smmath_priv.hpp2
4 files changed, 13 insertions, 7 deletions
diff --git a/include/smmath.hpp b/include/smmath.hpp
index d5ed80e..6be239a 100644
--- a/include/smmath.hpp
+++ b/include/smmath.hpp
@@ -15,7 +15,11 @@
#define sqr(x) ((x)*(x))
#define EPS 1e-8
#ifndef PI
-#define PI 3.14159265358979323846f
+#define PI 3.14159265358979323846264338327950288f
+#endif
+#ifdef min //for windows sdk, the stupidest sdk ever
+#undef min
+#undef max
#endif
template<class T>const T& min(const T& a,const T& b){return a<b?a:b;}
template<class T>const T& max(const T& a,const T& b){return a>b?a:b;}
diff --git a/smelt/glfw/gfx_glfw.cpp b/smelt/glfw/gfx_glfw.cpp
index d8135e8..c545073 100644
--- a/smelt/glfw/gfx_glfw.cpp
+++ b/smelt/glfw/gfx_glfw.cpp
@@ -730,7 +730,7 @@ void SMELT_IMPL::configProjectionMatrix2D(int w,int h)
void SMELT_IMPL::configProjectionMatrix3D(int w,int h,float fov)
{
memset(mproj,0,sizeof(mproj));
- float f=1./tanf(M_PI*fov/360.);
+ float f=1./tanf(PI*fov/360.);
float ar=(float)w/(float)h;
float Near=0.1,Far=1000.;
mproj[0]=f/ar;mproj[5]=f;
diff --git a/smelt/glfw/smelt_internal.hpp b/smelt/glfw/smelt_internal.hpp
index 5b82bf6..d7ec3c9 100644
--- a/smelt/glfw/smelt_internal.hpp
+++ b/smelt/glfw/smelt_internal.hpp
@@ -18,8 +18,14 @@
#include <cstdlib>
#include <ctime>
#include <cstdarg>
+#ifdef WIN32
+#include <windows.h>
+#include <intrin.h>
+#define strcasecmp _stricmp
+#else
#include <dirent.h>
#include <unistd.h>
+#endif
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
@@ -32,10 +38,6 @@
#include <vorbis/vorbisfile.h>
#endif
#endif
-#ifdef WIN32
-#include <windows.h>
-#include <intrin.h>
-#endif
#define xstr(s) str(s)
#define str(s) #s
diff --git a/smelt/glfw/smmath_priv.hpp b/smelt/glfw/smmath_priv.hpp
index ac62335..d906b89 100644
--- a/smelt/glfw/smmath_priv.hpp
+++ b/smelt/glfw/smmath_priv.hpp
@@ -15,7 +15,7 @@
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#ifndef PI
-#define PI 3.14159265358979323846f
+#define PI 3.14159265358979323846264338327950288f
#endif
class _smMath