Merge remote-tracking branch 'upstream/master' into infoview

This commit is contained in:
Bradley Austin Davis 2015-04-29 00:15:32 -07:00
commit c4349e797f
16 changed files with 51 additions and 29 deletions

View file

@ -13,6 +13,7 @@
var createdRenderMenu = false;
var createdGeneratedAudioMenu = false;
var createdStereoInputMenuItem = false;
var DEVELOPER_MENU = "Developer";
@ -28,6 +29,7 @@ var AUDIO_SOURCE_INJECT = "Generated Audio";
var AUDIO_SOURCE_MENU = AUDIO_MENU + " > Generated Audio Source";
var AUDIO_SOURCE_PINK_NOISE = "Pink Noise";
var AUDIO_SOURCE_SINE_440 = "Sine 440hz";
var AUDIO_STEREO_INPUT = "Stereo Input";
function setupMenus() {
@ -78,6 +80,10 @@ function setupMenus() {
Audio.selectPinkNoise();
createdGeneratedAudioMenu = true;
}
if (!Menu.menuItemExists(AUDIO_MENU, AUDIO_STEREO_INPUT)) {
Menu.addMenuItem({ menuName: AUDIO_MENU, menuItemName: AUDIO_STEREO_INPUT, isCheckable: true, isChecked: false });
createdStereoInputMenuItem = true;
}
}
Menu.menuItemEvent.connect(function (menuItem) {
@ -99,6 +105,8 @@ Menu.menuItemEvent.connect(function (menuItem) {
} else if (menuItem == AUDIO_SOURCE_SINE_440 && !createdGeneratedAudioMenu) {
Audio.selectSine440();
Menu.setIsOptionChecked(AUDIO_SOURCE_PINK_NOISE, false);
} else if (menuItem == AUDIO_STEREO_INPUT) {
Audio.setStereoInput(Menu.isOptionChecked(AUDIO_STEREO_INPUT))
}
});
@ -125,6 +133,10 @@ function scriptEnding() {
Menu.removeMenuItem(AUDIO_MENU, AUDIO_SOURCE_INJECT);
Menu.removeMenu(AUDIO_SOURCE_MENU);
}
if (createdStereoInputMenuItem) {
Menu.removeMenuItem(AUDIO_MENU, AUDIO_STEREO_INPUT);
}
}
setupMenus();

View file

@ -462,6 +462,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
addressManager->setOrientationGetter(getOrientationForPath);
connect(addressManager.data(), &AddressManager::rootPlaceNameChanged, this, &Application::updateWindowTitle);
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
#ifdef _WIN32
WSADATA WsaData;

View file

@ -55,7 +55,6 @@ Camera::Camera() :
_farClip(DEFAULT_FAR_CLIP), // default
_hmdPosition(),
_hmdRotation(),
_scale(1.0f),
_isKeepLookingAt(false),
_lookingAt(0.0f, 0.0f, 0.0f)
{
@ -94,8 +93,8 @@ void Camera::setHmdRotation(const glm::quat& hmdRotation) {
}
float Camera::getFarClip() const {
return (_scale * _farClip < std::numeric_limits<int16_t>::max())
? _scale * _farClip
return (_farClip < std::numeric_limits<int16_t>::max())
? _farClip
: std::numeric_limits<int16_t>::max() - 1;
}

View file

@ -54,7 +54,6 @@ public:
void setFarClip(float f);
void setEyeOffsetPosition(const glm::vec3& p) { _eyeOffsetPosition = p; }
void setEyeOffsetOrientation(const glm::quat& o) { _eyeOffsetOrientation = o; }
void setScale(const float s) { _scale = s; }
glm::quat getRotation() const { return _rotation * _hmdRotation; }
const glm::vec3& getHmdPosition() const { return _hmdPosition; }
@ -63,11 +62,10 @@ public:
CameraMode getMode() const { return _mode; }
float getFieldOfView() const { return _fieldOfView; }
float getAspectRatio() const { return _aspectRatio; }
float getNearClip() const { return _scale * _nearClip; }
float getNearClip() const { return _nearClip; }
float getFarClip() const;
const glm::vec3& getEyeOffsetPosition() const { return _eyeOffsetPosition; }
const glm::quat& getEyeOffsetOrientation() const { return _eyeOffsetOrientation; }
float getScale() const { return _scale; }
public slots:
QString getModeString() const;
void setModeString(const QString& mode);
@ -107,7 +105,6 @@ private:
glm::quat _rotation;
glm::vec3 _hmdPosition;
glm::quat _hmdRotation;
float _scale;
bool _isKeepLookingAt;
glm::vec3 _lookingAt;
};

View file

@ -484,8 +484,6 @@ Menu::Menu() {
audioIO.data(), SLOT(toggleServerEcho()));
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::EchoLocalAudio, 0, false,
audioIO.data(), SLOT(toggleLocalEcho()));
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::StereoAudio, 0, false,
audioIO.data(), SLOT(toggleStereoInput()));
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::MuteAudio,
Qt::CTRL | Qt::Key_M,
false,

View file

@ -267,7 +267,6 @@ namespace MenuOption {
const QString ShiftHipsForIdleAnimations = "Shift hips for idle animations";
const QString Stars = "Stars";
const QString Stats = "Stats";
const QString StereoAudio = "Stereo Audio (disables spatial sound)";
const QString StopAllScripts = "Stop All Scripts";
const QString SuppressShortTimings = "Suppress Timings Less than 10ms";
const QString TestPing = "Test Ping";

View file

@ -166,7 +166,6 @@ void MyAvatar::simulate(float deltaTime) {
if (_scale != _targetScale) {
float scale = (1.0f - SMOOTHING_RATIO) * _scale + SMOOTHING_RATIO * _targetScale;
setScale(scale);
Application::getInstance()->getCamera()->setScale(scale);
}
{
@ -673,8 +672,6 @@ void MyAvatar::loadData() {
_leanScale = loadSetting(settings, "leanScale", 0.05f);
_targetScale = loadSetting(settings, "scale", 1.0f);
setScale(_scale);
Application::getInstance()->getCamera()->setScale(_scale);
// The old preferences only stored the face and skeleton URLs, we didn't track if the user wanted to use 1 or 2 urls
// for their avatar, So we need to attempt to detect this old case and set our new preferences accordingly. If

View file

@ -108,8 +108,6 @@ public:
bool isMuted() { return _muted; }
void setIsStereoInput(bool isStereoInput);
const AudioIOStats& getStats() const { return _stats; }
float getInputRingBufferMsecsAvailable() const;
@ -146,14 +144,14 @@ public slots:
virtual void enableAudioSourceInject(bool enable);
virtual void selectAudioSourcePinkNoise();
virtual void selectAudioSourceSine440();
virtual void setIsStereoInput(bool stereo);
void toggleAudioNoiseReduction() { _isNoiseGateEnabled = !_isNoiseGateEnabled; }
void toggleLocalEcho() { _shouldEchoLocally = !_shouldEchoLocally; }
void toggleServerEcho() { _shouldEchoToServer = !_shouldEchoToServer; }
void toggleStereoInput() { setIsStereoInput(!_isStereoInput); }
void processReceivedSamples(const QByteArray& inputBuffer, QByteArray& outputBuffer);
void sendMuteEnvironmentPacket();

View file

@ -31,6 +31,8 @@ public slots:
virtual void enableAudioSourceInject(bool enable) = 0;
virtual void selectAudioSourcePinkNoise() = 0;
virtual void selectAudioSourceSine440() = 0;
virtual void setIsStereoInput(bool stereo) = 0;
};
Q_DECLARE_METATYPE(AbstractAudioInterface*)

View file

@ -55,6 +55,17 @@ bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
return !avatarWithDisplayName(displayName).isNull();
}
bool AvatarHashMap::isAvatarInRange(const glm::vec3& position, const float range) {
foreach(const AvatarSharedPointer& sharedAvatar, _avatarHash) {
glm::vec3 avatarPosition = sharedAvatar->getPosition();
float distance = glm::distance(avatarPosition, position);
if (distance < range) {
return true;
}
}
return false;
}
AvatarWeakPointer AvatarHashMap::avatarWithDisplayName(const QString& displayName) {
foreach(const AvatarSharedPointer& sharedAvatar, _avatarHash) {
if (sharedAvatar->getDisplayName() == displayName) {

View file

@ -20,6 +20,7 @@
#include <Node.h>
#include "AvatarData.h"
#include <glm/glm.hpp>
typedef QSharedPointer<AvatarData> AvatarSharedPointer;
typedef QWeakPointer<AvatarData> AvatarWeakPointer;
@ -36,6 +37,7 @@ public:
public slots:
void processAvatarMixerDatagram(const QByteArray& datagram, const QWeakPointer<Node>& mixerWeakPointer);
bool containsAvatarWithDisplayName(const QString& displayName);
bool isAvatarInRange(const glm::vec3 & position, const float range);
AvatarWeakPointer avatarWithDisplayName(const QString& displayname);
private slots:

View file

@ -35,7 +35,6 @@ AddressManager::AddressManager() :
_positionGetter(NULL),
_orientationGetter(NULL)
{
connect(qApp, &QCoreApplication::aboutToQuit, this, &AddressManager::storeCurrentAddress);
}
bool AddressManager::isConnected() {

View file

@ -41,8 +41,8 @@ protected:
DynamicCharacterController::DynamicCharacterController(AvatarData* avatarData) {
_halfHeight = 1.0f;
_shape = NULL;
_rigidBody = NULL;
_shape = nullptr;
_rigidBody = nullptr;
assert(avatarData);
_avatarData = avatarData;
@ -262,7 +262,7 @@ void DynamicCharacterController::setDynamicsWorld(btDynamicsWorld* world) {
_dynamicsWorld->removeRigidBody(_rigidBody);
_dynamicsWorld->removeAction(this);
}
_dynamicsWorld = NULL;
_dynamicsWorld = nullptr;
}
if (world && _rigidBody) {
_dynamicsWorld = world;
@ -292,9 +292,9 @@ void DynamicCharacterController::updateShapeIfNecessary() {
_pendingFlags &= ~ PENDING_FLAG_UPDATE_SHAPE;
// delete shape and RigidBody
delete _rigidBody;
_rigidBody = NULL;
_rigidBody = nullptr;
delete _shape;
_shape = NULL;
_shape = nullptr;
// compute new dimensions from avatar's bounding box
float x = _boxScale.x;
@ -314,7 +314,7 @@ void DynamicCharacterController::updateShapeIfNecessary() {
// create new body
float mass = 1.0f;
btVector3 inertia(1.0f, 1.0f, 1.0f);
_rigidBody = new btRigidBody(mass, NULL, _shape, inertia);
_rigidBody = new btRigidBody(mass, nullptr, _shape, inertia);
_rigidBody->setSleepingThresholds(0.0f, 0.0f);
_rigidBody->setAngularFactor(0.0f);
_rigidBody->setWorldTransform(btTransform(glmToBullet(_avatarData->getOrientation()),

View file

@ -30,7 +30,7 @@ protected:
glm::vec3 _shapeLocalOffset;
glm::vec3 _boxScale; // used to compute capsule shape
AvatarData* _avatarData = NULL;
AvatarData* _avatarData = nullptr;
bool _enabled;
bool _isOnGround;
@ -41,7 +41,7 @@ protected:
quint64 _jumpToHoverStart;
uint32_t _pendingFlags;
btDynamicsWorld* _dynamicsWorld = NULL;
btDynamicsWorld* _dynamicsWorld = nullptr;
btScalar _jumpSpeed;
@ -78,7 +78,8 @@ public:
bool needsRemoval() const;
bool needsAddition() const;
void setEnabled(bool enabled);
bool isEnabled() const { return _enabled; }
bool isEnabled() const { return _enabled && _dynamicsWorld; }
void setDynamicsWorld(btDynamicsWorld* world);
void setLocalBoundingBox(const glm::vec3& corner, const glm::vec3& scale);

View file

@ -89,4 +89,8 @@ void AudioScriptingInterface::selectSine440() {
}
}
void AudioScriptingInterface::setStereoInput(bool stereo) {
if (_localAudioInterface) {
_localAudioInterface->setIsStereoInput(stereo);
}
}

View file

@ -32,6 +32,8 @@ protected:
Q_INVOKABLE void injectGeneratedNoise(bool inject);
Q_INVOKABLE void selectPinkNoise();
Q_INVOKABLE void selectSine440();
Q_INVOKABLE void setStereoInput(bool stereo);
signals:
void mutedByMixer();