use glm::isnan() everywhere for portable code

This commit is contained in:
Andrew Meadows 2014-03-25 09:56:15 -07:00
parent 17d878bc94
commit c0177e80a7
2 changed files with 5 additions and 15 deletions

View file

@ -14,6 +14,7 @@
#include <glm/glm.hpp>
#include <glm/gtc/noise.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/detail/func_common.hpp>
#include <SharedUtil.h>
@ -24,12 +25,6 @@
#include "Util.h"
#ifdef _WIN32
int isnan(double value) { return _isnan(value); }
#else
int isnan(double value) { return std::isnan(value); }
#endif
using namespace std;
// no clue which versions are affected...
@ -88,7 +83,7 @@ float angleBetween(const glm::vec3& v1, const glm::vec3& v2) {
// Helper function return the rotation from the first vector onto the second
glm::quat rotationBetween(const glm::vec3& v1, const glm::vec3& v2) {
float angle = angleBetween(v1, v2);
if (isnan(angle) || angle < EPSILON) {
if (glm::isnan(angle) || angle < EPSILON) {
return glm::quat();
}
glm::vec3 axis;
@ -586,7 +581,7 @@ void runTimingTests() {
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
float value = settings->value(name, defaultValue).toFloat();
if (isnan(value)) {
if (glm::isnan(value)) {
value = defaultValue;
}
return value;

View file

@ -8,6 +8,7 @@
#include <cstring>
#include <glm/detail/func_common.hpp>
#include <QtCore/QDataStream>
#include <Node.h>
@ -16,12 +17,6 @@
#include "PositionalAudioRingBuffer.h"
#ifdef _WIN32
int isnan(double value) { return _isnan(value); }
#else
int isnan(double value) { return std::isnan(value); }
#endif
PositionalAudioRingBuffer::PositionalAudioRingBuffer(PositionalAudioRingBuffer::Type type) :
AudioRingBuffer(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL),
_type(type),
@ -69,7 +64,7 @@ int PositionalAudioRingBuffer::parsePositionalData(const QByteArray& positionalB
packetStream.readRawData(reinterpret_cast<char*>(&_orientation), sizeof(_orientation));
// if this node sent us a NaN for first float in orientation then don't consider this good audio and bail
if (isnan(_orientation.x)) {
if (glm::isnan(_orientation.x)) {
reset();
return 0;
}