Removed _USE_MATH_DEFINES.

This commit is contained in:
Branimir Karadzic
2014-10-23 21:10:24 -07:00
parent 818e51cb88
commit b1cee49176
3 changed files with 9 additions and 10 deletions

View File

@@ -8,20 +8,22 @@
#ifndef BX_FPU_MATH_H_HEADER_GUARD
#define BX_FPU_MATH_H_HEADER_GUARD
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
namespace bx
{
const float pi = 3.14159265358979323846f;
const float piHalf = 1.57079632679489661923f;
inline float toRad(float _deg)
{
return _deg * float(M_PI / 180.0);
return _deg * pi / 180.0f;;
}
inline float toDeg(float _rad)
{
return _rad * float(180.0 / M_PI);
return _rad * 180.0f / pi;
}
inline float fmin(float _a, float _b)
@@ -231,7 +233,7 @@ namespace bx
inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
{
const float height = 1.0f/tanf(_fovy*( (float)M_PI/180.0f)*0.5f);
const float height = 1.0f/tanf(toRad(_fovy)*0.5f);
const float width = height * 1.0f/_aspect;
const float diff = _far-_near;
const float aa = _oglNdc ? (_far+_near)/diff : _far/diff;

View File

@@ -7,9 +7,7 @@
#define BX_RNG_H_HEADER_GUARD
#include "bx.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include "fpumath.h"
namespace bx
{
@@ -115,7 +113,7 @@ namespace bx
static inline void randUnitSphere(float _result[3], Ty* _rng)
{
float rand0 = frnd(_rng) * 2.0f - 1.0f;
float rand1 = frnd(_rng) * float(M_PI) * 2.0f;
float rand1 = frnd(_rng) * pi * 2.0f;
float sqrtf1 = sqrtf(1.0f - rand0*rand0);
_result[0] = sqrtf1 * cosf(rand1);
@@ -167,7 +165,7 @@ namespace bx
tt = 2.0f * tt - 1.0f;
const float phi = (ii + 0.5f) / _num;
const float phirad = phi * 2.0f * float(M_PI);
const float phirad = phi * 2.0f * pi;
const float st = sqrtf(1.0f-tt*tt) * _scale;
float* xyz = (float*)data;