mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 22:27:13 +02:00
move number constants out of SharedUtil to NumericalConstants
This commit is contained in:
parent
744d026e81
commit
94739cf8d3
56 changed files with 157 additions and 97 deletions
|
@ -173,8 +173,12 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
|
||||
// keep a counter of the number of considered avatars
|
||||
int numOtherAvatars = 0;
|
||||
|
||||
float dataRateLastSecond = node->getOutboundBandwidth();
|
||||
|
||||
// keep track of outbound data rate specifically for avatar data
|
||||
int numAvatarDataBytes = 0;
|
||||
|
||||
// use the data rate specifically for avatar data for FRD adjustment checks
|
||||
float avatarDataRateLastSecond = node->getOutboundBandwidth();
|
||||
|
||||
// Check if it is time to adjust what we send this client based on the observed
|
||||
// bandwidth to this node. We do this once a second, which is also the window for
|
||||
|
@ -183,12 +187,12 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
|
||||
const float FRD_ADJUSTMENT_ACCEPTABLE_RATIO = 0.8f;
|
||||
|
||||
qDebug() << "current node outbound bandwidth is" << dataRateLastSecond;
|
||||
qDebug() << "current node outbound bandwidth is" << avatarDataRateLastSecond;
|
||||
|
||||
if(dataRateLastSecond > _maxKbpsPerNode) {
|
||||
if (avatarDataRateLastSecond > _maxKbpsPerNode) {
|
||||
|
||||
qDebug() << "Adjustment down required for avatar" << node->getUUID() << "whose current send rate is"
|
||||
<< dataRateLastSecond;
|
||||
<< avatarDataRateLastSecond;
|
||||
|
||||
// is the FRD greater than the MAX FRD? if so, before we calculate anything, set it to the MAX FRD
|
||||
float newFullRateDistance = nodeData->getFullRateDistance();
|
||||
|
@ -208,7 +212,7 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
|
||||
nodeData->resetNumFramesSinceFRDAdjustment();
|
||||
} else if (nodeData->getFullRateDistance() < nodeData->getMaxFullRateDistance()
|
||||
&& dataRateLastSecond < _maxKbpsPerNode * FRD_ADJUSTMENT_ACCEPTABLE_RATIO) {
|
||||
&& avatarDataRateLastSecond < _maxKbpsPerNode * FRD_ADJUSTMENT_ACCEPTABLE_RATIO) {
|
||||
// we are constrained AND we've recovered to below the acceptable ratio, adjust the FRD upwards
|
||||
// by covering half the distance to the max FRD
|
||||
|
||||
|
@ -276,6 +280,8 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
|
||||
if (avatarByteArray.size() + mixedAvatarByteArray.size() > MAX_PACKET_SIZE) {
|
||||
nodeList->writeDatagram(mixedAvatarByteArray, node);
|
||||
|
||||
numAvatarDataBytes += mixedAvatarByteArray.size();
|
||||
|
||||
// reset the packet
|
||||
mixedAvatarByteArray.resize(numPacketHeaderBytes);
|
||||
|
@ -323,7 +329,12 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
++_sumIdentityPackets;
|
||||
}
|
||||
});
|
||||
|
||||
// send the last packet
|
||||
nodeList->writeDatagram(mixedAvatarByteArray, node);
|
||||
|
||||
// record the bytes sent for other avatar data in the AvatarMixerClientData
|
||||
nodeData->recordSentAvatarData(numAvatarDataBytes + mixedAvatarByteArray.size());
|
||||
|
||||
if (numOtherAvatars == 0) {
|
||||
// update the full rate distance to FLOAT_MAX since we didn't have any other avatars to send
|
||||
|
|
|
@ -30,4 +30,6 @@ void AvatarMixerClientData::loadJSONStats(QJsonObject& jsonObject) const {
|
|||
jsonObject["full_rate_distance"] = _fullRateDistance;
|
||||
jsonObject["max_full_rate_distance"] = _maxFullRateDistance;
|
||||
jsonObject["num_avatars_sent_last_frame"] = _numAvatarsSentLastFrame;
|
||||
|
||||
jsonObject["other_avatar_data_kbps"] = getSentAvatarDataKbps();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <AvatarData.h>
|
||||
#include <NodeData.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <SimpleMovingAverage.h>
|
||||
|
||||
class AvatarMixerClientData : public NodeData {
|
||||
Q_OBJECT
|
||||
|
@ -49,6 +51,11 @@ public:
|
|||
void incrementNumFramesSinceFRDAdjustment() { ++_numFramesSinceAdjustment; }
|
||||
void resetNumFramesSinceFRDAdjustment() { _numFramesSinceAdjustment = 0; }
|
||||
|
||||
void recordSentAvatarData(int numBytes) { _avgOtherAvatarDataRate.updateAverage((float) numBytes); }
|
||||
|
||||
float getSentAvatarDataKbps() const
|
||||
{ return _avgOtherAvatarDataRate.getAverageSampleValuePerSecond() / (float) BYTES_PER_KILOBIT; }
|
||||
|
||||
void loadJSONStats(QJsonObject& jsonObject) const;
|
||||
private:
|
||||
AvatarData _avatar;
|
||||
|
@ -59,6 +66,7 @@ private:
|
|||
float _maxFullRateDistance = FLT_MAX;
|
||||
int _numAvatarsSentLastFrame = 0;
|
||||
int _numFramesSinceAdjustment = 0;
|
||||
SimpleMovingAverage _avgOtherAvatarDataRate;
|
||||
};
|
||||
|
||||
#endif // hifi_AvatarMixerClientData_h
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
//
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
//
|
||||
|
||||
#include <NodeList.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PerfStat.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "OctreeSendThread.h"
|
||||
#include "OctreeServer.h"
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <HTTPConnection.h>
|
||||
#include <LogHandler.h>
|
||||
#include <NetworkingConstants.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include "../AssignmentClient.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// LODManager.cpp
|
||||
//
|
||||
// interface/src/LODManager.h
|
||||
//
|
||||
// Created by Clement on 1/16/15.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// LODManager.h
|
||||
//
|
||||
// interface/src/LODManager.h
|
||||
//
|
||||
// Created by Clement on 1/16/15.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
|
@ -13,8 +13,8 @@
|
|||
#define hifi_LODManager_h
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <OctreeConstants.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <SimpleMovingAverage.h>
|
||||
|
||||
const float DEFAULT_DESKTOP_LOD_DOWN_FPS = 30.0;
|
||||
|
@ -115,4 +115,4 @@ private:
|
|||
QMap<float, float> _shouldRenderTable;
|
||||
};
|
||||
|
||||
#endif // hifi_LODManager_h
|
||||
#endif // hifi_LODManager_h
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include "Stars.h"
|
||||
#include "Stars.h"
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include "starfield/Controller.h"
|
||||
|
||||
Stars::Stars() :
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
void addLeanDeltas(float sideways, float forward);
|
||||
|
||||
private:
|
||||
glm::vec3 calculateAverageEyePosition() const { return _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * ONE_HALF; }
|
||||
glm::vec3 calculateAverageEyePosition() const { return _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * 0.5f; }
|
||||
|
||||
// disallow copies of the Head, copy of owning Avatar is disallowed too
|
||||
Head(const Head&);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <QTimer>
|
||||
|
||||
#include <GLMHelpers.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "DdeFaceTracker.h"
|
||||
#include "FaceshiftConstants.h"
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <QTimer>
|
||||
|
||||
#include <GLMHelpers.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <PerfStat.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Faceshift.h"
|
||||
#include "Menu.h"
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
// include this before QGLWidget, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Overlay.h"
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
Overlay::Overlay() :
|
||||
_isLoaded(true),
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
#ifndef hifi_AudioFilter_h
|
||||
#define hifi_AudioFilter_h
|
||||
|
||||
//
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
// Implements a standard biquad filter in "Direct Form 1"
|
||||
// Reference http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
|
||||
//
|
||||
|
@ -183,10 +184,10 @@ public:
|
|||
a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha
|
||||
*/
|
||||
const float32_t b0 = +1.0f * (aAdd1 - aSub1TimesCosOmega + zeta) * a;
|
||||
const float32_t b1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + ZERO) * a;
|
||||
const float32_t b1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + 0.0f) * a;
|
||||
const float32_t b2 = +1.0f * (aAdd1 - aSub1TimesCosOmega - zeta) * a;
|
||||
const float32_t a0 = +1.0f * (aAdd1 + aSub1TimesCosOmega + zeta);
|
||||
const float32_t a1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + ZERO);
|
||||
const float32_t a1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + 0.0f);
|
||||
const float32_t a2 = +1.0f * (aAdd1 + aSub1TimesCosOmega - zeta);
|
||||
|
||||
const float32_t normA0 = 1.0f / a0;
|
||||
|
@ -224,10 +225,10 @@ public:
|
|||
a2 = (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha
|
||||
*/
|
||||
const float32_t b0 = +1.0f * (aAdd1 + aSub1TimesCosOmega + zeta) * a;
|
||||
const float32_t b1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + ZERO) * a;
|
||||
const float32_t b1 = -2.0f * (aSub1 + aAdd1TimesCosOmega + 0.0f) * a;
|
||||
const float32_t b2 = +1.0f * (aAdd1 + aSub1TimesCosOmega - zeta) * a;
|
||||
const float32_t a0 = +1.0f * (aAdd1 - aSub1TimesCosOmega + zeta);
|
||||
const float32_t a1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + ZERO);
|
||||
const float32_t a1 = +2.0f * (aSub1 - aAdd1TimesCosOmega + 0.0f);
|
||||
const float32_t a2 = +1.0f * (aAdd1 - aSub1TimesCosOmega - zeta);
|
||||
|
||||
const float32_t normA0 = 1.0f / a0;
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <SharedUtil.h>
|
||||
#include "AudioFormat.h"
|
||||
#include "AudioBuffer.h"
|
||||
#include "AudioFilter.h"
|
||||
#include "AudioFilterBank.h"
|
||||
|
||||
template<>
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
#ifndef hifi_AudioFilterBank_h
|
||||
#define hifi_AudioFilterBank_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "AudioBuffer.h"
|
||||
#include "AudioFilter.h"
|
||||
#include "AudioFormat.h"
|
||||
|
||||
//
|
||||
// Helper/convenience class that implements a bank of Filter objects
|
||||
//
|
||||
|
|
|
@ -22,6 +22,7 @@ typedef float float32_t;
|
|||
typedef double float64_t;
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "AudioConstants.h"
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
#ifndef hifi_AudioPan_h
|
||||
#define hifi_AudioPan_h
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "AudioFormat.h"
|
||||
|
||||
class AudioPan
|
||||
{
|
||||
float32_t _pan;
|
||||
|
|
|
@ -9,12 +9,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <SharedUtil.h>
|
||||
#include "AudioRingBuffer.h"
|
||||
#include "AudioFormat.h"
|
||||
#include "AudioBuffer.h"
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "AudioSourceTone.h"
|
||||
|
||||
AudioSourceTone::AudioSourceTone() {
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
#ifndef hifi_AudioSourceTone_h
|
||||
#define hifi_AudioSourceTone_h
|
||||
|
||||
#include "AudioBuffer.h"
|
||||
#include "AudioFormat.h"
|
||||
|
||||
// Implements a two-pole Gordon-Smith oscillator
|
||||
class AudioSourceTone
|
||||
{
|
||||
class AudioSourceTone {
|
||||
float32_t _frequency;
|
||||
float32_t _amplitude;
|
||||
float32_t _sampleRate;
|
||||
|
|
|
@ -12,13 +12,15 @@
|
|||
#ifndef hifi_InboundAudioStream_h
|
||||
#define hifi_InboundAudioStream_h
|
||||
|
||||
#include "NodeData.h"
|
||||
#include <NodeData.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <StDev.h>
|
||||
|
||||
#include "AudioRingBuffer.h"
|
||||
#include "MovingMinMaxAvg.h"
|
||||
#include "SequenceNumberStats.h"
|
||||
#include "AudioStreamStats.h"
|
||||
#include "PacketHeaders.h"
|
||||
#include "StDev.h"
|
||||
#include "TimeWeightedAvg.h"
|
||||
|
||||
// This adds some number of frames to the desired jitter buffer frames target we use when we're dropping frames.
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
class AvatarData;
|
||||
class PalmData;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <AACube.h>
|
||||
#include <FBXReader.h> // for SittingPoint
|
||||
#include <NumericalConstants.h>
|
||||
#include <PropertyFlags.h>
|
||||
#include <OctreeConstants.h>
|
||||
#include <ShapeInfo.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <FaceshiftConstants.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <GLMHelpers.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <OctalCode.h>
|
||||
#include <Shape.h>
|
||||
|
||||
|
|
|
@ -19,16 +19,17 @@
|
|||
#include <QtCore/QUrl>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
|
||||
#include <LogHandler.h>
|
||||
|
||||
#include <tbb/parallel_for.h>
|
||||
|
||||
#include <LogHandler.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "AccountManager.h"
|
||||
#include "Assignment.h"
|
||||
#include "HifiSockAddr.h"
|
||||
#include "LimitedNodeList.h"
|
||||
#include "PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "UUID.h"
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
#include <PerfStat.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "OctreeLogging.h"
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include <QStringList>
|
||||
|
||||
#include <LogHandler.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "OctreePacketData.h"
|
||||
#include "OctreeElement.h"
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
#define hifi_OctreeSceneStats_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <NodeList.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "JurisdictionMap.h"
|
||||
#include "OctreePacketData.h"
|
||||
#include "SequenceNumberStats.h"
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "GeometryUtil.h"
|
||||
#include "GLMHelpers.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "ViewFrustum.h"
|
||||
#include "OctreeLogging.h"
|
||||
#include "OctreeConstants.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <QVector>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "ProgramObject.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <gpu/GLBackend.h>
|
||||
|
||||
#include <FSTReader.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "TextureCache.h"
|
||||
#include "RenderUtilsLogging.h"
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
#include <glm/gtx/quaternion.hpp>
|
||||
#include <glm/gtx/transform.hpp>
|
||||
|
||||
#include <GLMHelpers.h>
|
||||
#include <FBXReader.h>
|
||||
#include <GLMHelpers.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
const float DEFAULT_PRIORITY = 3.0f;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <QTouchEvent>
|
||||
|
||||
#include <RegisteredMetaTypes.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "TouchEvent.h"
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
//
|
||||
|
||||
#include "AABox.h"
|
||||
|
||||
#include "AACube.h"
|
||||
#include "Extents.h"
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
AABox::AABox(const AACube& other) :
|
||||
_corner(other.getCorner()), _scale(other.getScale(), other.getScale(), other.getScale()) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "AACube.h"
|
||||
#include "Extents.h"
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
AACube::AACube(const AABox& other) :
|
||||
_corner(other.getCorner()), _scale(other.getLargestDimension()) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <glm/gtx/norm.hpp>
|
||||
|
||||
#include "AACubeShape.h"
|
||||
#include "SharedUtil.h" // for SQUARE_ROOT_OF_3
|
||||
#include "NumericalConstants.h" // for SQUARE_ROOT_OF_3
|
||||
|
||||
glm::vec3 faceNormals[3] = { glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f) };
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "AngularConstraint.h"
|
||||
#include "GLMHelpers.h"
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
// helper function
|
||||
/// \param angle radian angle to be clamped within angleMin and angleMax
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QBitArray>
|
||||
#include <QByteArray>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
template<typename T> class ByteCountCoded {
|
||||
public:
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "CapsuleShape.h"
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
CapsuleShape::CapsuleShape() : Shape(CAPSULE_SHAPE), _radius(0.0f), _halfHeight(0.0f) {}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#ifndef hifi_CapsuleShape_h
|
||||
#define hifi_CapsuleShape_h
|
||||
|
||||
#include "NumericalConstants.h"
|
||||
#include "Shape.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
// default axis of CapsuleShape is Y-axis
|
||||
const glm::vec3 DEFAULT_CAPSULE_AXIS(0.0f, 1.0f, 0.0f);
|
||||
|
|
|
@ -9,11 +9,9 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include "CollisionInfo.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include "Shape.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
CollisionInfo::CollisionInfo() :
|
||||
_data(NULL),
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "GLMHelpers.h"
|
||||
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
// Safe version of glm::mix; based on the code in Nick Bobick's article,
|
||||
// http://www.gamasutra.com/features/19980703/quaternions_01.htm (via Clyde,
|
||||
// https://github.com/threerings/clyde/blob/master/src/main/java/com/threerings/math/Quaternion.java)
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include <cmath>
|
||||
|
||||
#include "GeometryUtil.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include "PlaneShape.h"
|
||||
#include "RayIntersectionInfo.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
glm::vec3 computeVectorFromPointToSegment(const glm::vec3& point, const glm::vec3& start, const glm::vec3& end) {
|
||||
// compute the projection of the point vector onto the segment vector
|
||||
|
|
42
libraries/shared/src/NumericalConstants.h
Normal file
42
libraries/shared/src/NumericalConstants.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// NumericalConstants.h
|
||||
// libraries/shared/src
|
||||
//
|
||||
// Created by Stephen Birarda on 05/01/15.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_NumericalConstants_h
|
||||
#define hifi_NumericalConstants_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
const float PI = 3.14159265358979f;
|
||||
const float TWO_PI = 2.0f * PI;
|
||||
const float PI_OVER_TWO = 0.5f * PI;
|
||||
const float RADIANS_PER_DEGREE = PI / 180.0f;
|
||||
const float DEGREES_PER_RADIAN = 180.0f / PI;
|
||||
|
||||
const float EPSILON = 0.000001f; //smallish positive number - used as margin of error for some computations
|
||||
const float SQUARE_ROOT_OF_2 = (float)sqrt(2.0f);
|
||||
const float SQUARE_ROOT_OF_3 = (float)sqrt(3.0f);
|
||||
const float METERS_PER_DECIMETER = 0.1f;
|
||||
const float METERS_PER_CENTIMETER = 0.01f;
|
||||
const float METERS_PER_MILLIMETER = 0.001f;
|
||||
const float MILLIMETERS_PER_METER = 1000.0f;
|
||||
const quint64 USECS_PER_MSEC = 1000;
|
||||
const quint64 MSECS_PER_SECOND = 1000;
|
||||
const quint64 USECS_PER_SECOND = USECS_PER_MSEC * MSECS_PER_SECOND;
|
||||
|
||||
const int BITS_IN_BYTE = 8;
|
||||
const int BYTES_PER_KILOBYTE = 1000;
|
||||
const int BYTES_PER_KILOBIT = BYTES_PER_KILOBYTE / BITS_IN_BYTE;
|
||||
|
||||
#endif // hifi_NumericalConstants_h
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include "OctalCode.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
int numberOfThreeBitSectionsInCode(const unsigned char* octalCode, int maxBytes) {
|
||||
if (maxBytes == OVERFLOWED_OCTCODE_BUFFER) {
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "PerfStat.h"
|
||||
|
||||
#include "NumericalConstants.h"
|
||||
#include "SharedLogging.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PerformanceWarning
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
|
||||
#include "PhysicsHelpers.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
// This chunk of code was copied from Bullet-2.82, so we include the Bullet license here:
|
||||
/*
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
//
|
||||
|
||||
#include "GLMHelpers.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include "PlaneShape.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
const glm::vec3 UNROTATED_NORMAL(0.0f, 1.0f, 0.0f);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "CapsuleShape.h"
|
||||
#include "GeometryUtil.h"
|
||||
#include "ListShape.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include "PlaneShape.h"
|
||||
#include "ShapeCollider.h"
|
||||
#include "SphereShape.h"
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "ShapeInfo.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "SharedUtil.h" // for MILLIMETERS_PER_METER
|
||||
|
||||
#include "ShapeInfo.h"
|
||||
#include "NumericalConstants.h" // for MILLIMETERS_PER_METER
|
||||
|
||||
void ShapeInfo::clear() {
|
||||
_type = SHAPE_TYPE_NONE;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <QElapsedTimer>
|
||||
#include <QThread>
|
||||
|
||||
#include "NumericalConstants.h"
|
||||
#include "OctalCode.h"
|
||||
#include "SharedLogging.h"
|
||||
#include "SharedUtil.h"
|
||||
|
|
|
@ -43,30 +43,6 @@ inline QDebug& operator<<(QDebug& dbg, const xColor& c) {
|
|||
return dbg;
|
||||
}
|
||||
|
||||
static const float ZERO = 0.0f;
|
||||
static const float ONE = 1.0f;
|
||||
static const float ONE_HALF = 0.5f;
|
||||
static const float ONE_THIRD = 0.333333f;
|
||||
|
||||
static const float PI = 3.14159265358979f;
|
||||
static const float TWO_PI = 2.0f * PI;
|
||||
static const float PI_OVER_TWO = ONE_HALF * PI;
|
||||
static const float RADIANS_PER_DEGREE = PI / 180.0f;
|
||||
static const float DEGREES_PER_RADIAN = 180.0f / PI;
|
||||
|
||||
static const float EPSILON = 0.000001f; //smallish positive number - used as margin of error for some computations
|
||||
static const float SQUARE_ROOT_OF_2 = (float)sqrt(2.0f);
|
||||
static const float SQUARE_ROOT_OF_3 = (float)sqrt(3.0f);
|
||||
static const float METERS_PER_DECIMETER = 0.1f;
|
||||
static const float METERS_PER_CENTIMETER = 0.01f;
|
||||
static const float METERS_PER_MILLIMETER = 0.001f;
|
||||
static const float MILLIMETERS_PER_METER = 1000.0f;
|
||||
static const quint64 USECS_PER_MSEC = 1000;
|
||||
static const quint64 MSECS_PER_SECOND = 1000;
|
||||
static const quint64 USECS_PER_SECOND = USECS_PER_MSEC * MSECS_PER_SECOND;
|
||||
|
||||
const int BITS_IN_BYTE = 8;
|
||||
|
||||
// Use a custom User-Agent to avoid ModSecurity filtering, e.g. by hosting providers.
|
||||
const QByteArray HIGH_FIDELITY_USER_AGENT = "Mozilla/5.0 (HighFidelityInterface)";
|
||||
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
#ifndef hifi_SphereShape_h
|
||||
#define hifi_SphereShape_h
|
||||
|
||||
#include "NumericalConstants.h"
|
||||
#include "Shape.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
|
||||
class SphereShape : public Shape {
|
||||
public:
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <cerrno>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
#include <MovingMinMaxAvg.h>
|
||||
#include <SequenceNumberStats.h>
|
||||
#include <SharedUtil.h> // for usecTimestampNow
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <BulletUtil.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
||||
#include "BulletUtilTests.h"
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <AngularConstraint.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NumericalConstants.h>
|
||||
#include <StreamUtils.h>
|
||||
|
||||
#include "AngularConstraintTests.h"
|
||||
|
|
Loading…
Reference in a new issue