mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 15:58:35 +02:00
use glm::isnan() everywhere for portable code
This commit is contained in:
parent
17d878bc94
commit
c0177e80a7
2 changed files with 5 additions and 15 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/noise.hpp>
|
#include <glm/gtc/noise.hpp>
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
#include <glm/detail/func_common.hpp>
|
||||||
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
|
@ -24,12 +25,6 @@
|
||||||
|
|
||||||
#include "Util.h"
|
#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;
|
using namespace std;
|
||||||
|
|
||||||
// no clue which versions are affected...
|
// 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
|
// Helper function return the rotation from the first vector onto the second
|
||||||
glm::quat rotationBetween(const glm::vec3& v1, const glm::vec3& v2) {
|
glm::quat rotationBetween(const glm::vec3& v1, const glm::vec3& v2) {
|
||||||
float angle = angleBetween(v1, v2);
|
float angle = angleBetween(v1, v2);
|
||||||
if (isnan(angle) || angle < EPSILON) {
|
if (glm::isnan(angle) || angle < EPSILON) {
|
||||||
return glm::quat();
|
return glm::quat();
|
||||||
}
|
}
|
||||||
glm::vec3 axis;
|
glm::vec3 axis;
|
||||||
|
@ -586,7 +581,7 @@ void runTimingTests() {
|
||||||
|
|
||||||
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
|
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
|
||||||
float value = settings->value(name, defaultValue).toFloat();
|
float value = settings->value(name, defaultValue).toFloat();
|
||||||
if (isnan(value)) {
|
if (glm::isnan(value)) {
|
||||||
value = defaultValue;
|
value = defaultValue;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <glm/detail/func_common.hpp>
|
||||||
#include <QtCore/QDataStream>
|
#include <QtCore/QDataStream>
|
||||||
|
|
||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
|
@ -16,12 +17,6 @@
|
||||||
|
|
||||||
#include "PositionalAudioRingBuffer.h"
|
#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) :
|
PositionalAudioRingBuffer::PositionalAudioRingBuffer(PositionalAudioRingBuffer::Type type) :
|
||||||
AudioRingBuffer(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL),
|
AudioRingBuffer(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL),
|
||||||
_type(type),
|
_type(type),
|
||||||
|
@ -69,7 +64,7 @@ int PositionalAudioRingBuffer::parsePositionalData(const QByteArray& positionalB
|
||||||
packetStream.readRawData(reinterpret_cast<char*>(&_orientation), sizeof(_orientation));
|
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 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();
|
reset();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue