From 91a06ea3c4f516853764640fff622b1cf57d6053 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 5 May 2015 10:50:19 -0700 Subject: [PATCH 01/11] Add "Calibrate Camera" menu item for DDE face tracking --- interface/src/Application.cpp | 1 + interface/src/Menu.cpp | 3 +++ interface/src/Menu.h | 1 + interface/src/devices/DdeFaceTracker.cpp | 3 +++ interface/src/devices/DdeFaceTracker.h | 1 + 5 files changed, 9 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e20ee73877..5e557dd772 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1853,6 +1853,7 @@ void Application::setActiveFaceTracker() { bool isUsingDDE = Menu::getInstance()->isOptionChecked(MenuOption::UseCamera); Menu::getInstance()->getActionForOption(MenuOption::UseAudioForMouth)->setVisible(isUsingDDE); Menu::getInstance()->getActionForOption(MenuOption::VelocityFilter)->setVisible(isUsingDDE); + Menu::getInstance()->getActionForOption(MenuOption::CalibrateCamera)->setVisible(isUsingDDE); DependencyManager::get()->setEnabled(isUsingDDE); #endif } diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 8070bd5555..55fec541f8 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -393,6 +393,9 @@ Menu::Menu() { useAudioForMouth->setVisible(false); QAction* ddeFiltering = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::VelocityFilter, 0, true); ddeFiltering->setVisible(false); + QAction* ddeCalibrate = addActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::CalibrateCamera, 0, + DependencyManager::get().data(), SLOT(calibrate())); + ddeCalibrate->setVisible(false); #endif auto avatarManager = DependencyManager::get(); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 7d105687ab..f57e050831 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -154,6 +154,7 @@ namespace MenuOption { const QString Bookmarks = "Bookmarks"; const QString CascadedShadows = "Cascaded"; const QString CachesSize = "RAM Caches Size"; + const QString CalibrateCamera = "Calibrate Camera"; const QString Chat = "Chat..."; const QString Collisions = "Collisions"; const QString Console = "Console..."; diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index 98f1636a32..37686d575b 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -503,3 +503,6 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) { } _lastReceiveTimestamp = usecTimestampNow(); } + +void DdeFaceTracker::calibrate() { +} diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 9fb0e943f2..7b006b6c7c 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -50,6 +50,7 @@ public: public slots: void setEnabled(bool enabled); + void calibrate(); private slots: void processFinished(int exitCode, QProcess::ExitStatus exitStatus); From ceeb1dd81fa0ee47303b63acddbda56a92f701fe Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 5 May 2015 11:03:36 -0700 Subject: [PATCH 02/11] Remove unused DDE member variables --- interface/src/devices/DdeFaceTracker.cpp | 4 +--- interface/src/devices/DdeFaceTracker.h | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index 37686d575b..73ab436e70 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -178,9 +178,7 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui _filteredBrowUp(0.0f), _lastEyeBlinks(), _filteredEyeBlinks(), - _lastEyeCoefficients(), - _isCalculatingFPS(false), - _frameCount(0) + _lastEyeCoefficients() { _coefficients.resize(NUM_FACESHIFT_BLENDSHAPES); diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 7b006b6c7c..8dcebabb95 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -121,9 +121,6 @@ private: float _lastEyeBlinks[2]; float _filteredEyeBlinks[2]; float _lastEyeCoefficients[2]; - - bool _isCalculatingFPS; - int _frameCount; }; #endif // hifi_DdeFaceTracker_h From e1b5e7caf65d5c5a396c8684fc302dbaa6abf5c1 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 6 May 2015 11:13:19 -0700 Subject: [PATCH 03/11] Add DDE calibration count-down --- interface/src/devices/DdeFaceTracker.cpp | 89 +++++++++++++++++++++++- interface/src/devices/DdeFaceTracker.h | 10 +++ 2 files changed, 97 insertions(+), 2 deletions(-) diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index 73ab436e70..5736717419 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -20,6 +20,7 @@ #include #include +#include "Application.h" #include "DdeFaceTracker.h" #include "FaceshiftConstants.h" #include "InterfaceLogging.h" @@ -135,7 +136,9 @@ struct Packet { char name[MAX_NAME_SIZE + 1]; }; -const float STARTING_DDE_MESSAGE_TIME = 0.033f; +static const float STARTING_DDE_MESSAGE_TIME = 0.033f; + +static const quint64 CALIBRATION_SAMPLES = 150; #ifdef WIN32 // warning C4351: new behavior: elements of array 'DdeFaceTracker::_lastEyeBlinks' will be default initialized @@ -178,7 +181,12 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui _filteredBrowUp(0.0f), _lastEyeBlinks(), _filteredEyeBlinks(), - _lastEyeCoefficients() + _lastEyeCoefficients(), + _isCalibrating(false), + _calibrationCount(0), + _calibrationBillboard(NULL), + _calibrationBillboardID(0), + _calibrationMessage(QString()) { _coefficients.resize(NUM_FACESHIFT_BLENDSHAPES); @@ -195,6 +203,10 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui DdeFaceTracker::~DdeFaceTracker() { setEnabled(false); + + if (_isCalibrating) { + cancelCalibration(); + } } #ifdef WIN32 @@ -203,6 +215,12 @@ DdeFaceTracker::~DdeFaceTracker() { void DdeFaceTracker::setEnabled(bool enabled) { #ifdef HAVE_DDE + + if (_isCalibrating) { + cancelCalibration(); + } + + // isOpen() does not work as one might expect on QUdpSocket; don't test isOpen() before closing socket. _udpSocket.close(); if (enabled) { @@ -371,6 +389,11 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) { _coefficients[DDE_TO_FACESHIFT_MAPPING[i]] = packet.expressions[i]; } + // Calibration + if (_isCalibrating) { + addCalibrationDatum(); + } + // Use BrowsU_C to control both brows' up and down float browUp = _coefficients[_browUpCenterIndex]; if (isFiltering) { @@ -500,7 +523,69 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) { qCWarning(interfaceapp) << "DDE Face Tracker: Decode error"; } _lastReceiveTimestamp = usecTimestampNow(); + + if (_isCalibrating && _calibrationCount > CALIBRATION_SAMPLES) { + finishCalibration(); + } } +static const int CALIBRATION_BILLBOARD_WIDTH = 240; +static const int CALIBRATION_BILLBOARD_HEIGHT = 180; +static const int CALIBRATION_BILLBOARD_TOP_MARGIN = 60; +static const int CALIBRATION_BILLBOARD_LEFT_MARGIN = 30; +static const int CALIBRATION_BILLBOARD_FONT_SIZE = 16; +static const float CALIBRATION_BILLBOARD_ALPHA = 0.5f; +static QString CALIBRATION_INSTRUCTION_MESSAGE = "Hold still to calibrate"; + void DdeFaceTracker::calibrate() { + if (!_isCalibrating) { + qCDebug(interfaceapp) << "DDE Face Tracker: Calibration started"; + + _isCalibrating = true; + _calibrationCount = 0; + _calibrationMessage = CALIBRATION_INSTRUCTION_MESSAGE + "\n\n"; + + _calibrationBillboard = new TextOverlay(); + _calibrationBillboard->setTopMargin(CALIBRATION_BILLBOARD_TOP_MARGIN); + _calibrationBillboard->setLeftMargin(CALIBRATION_BILLBOARD_LEFT_MARGIN); + _calibrationBillboard->setFontSize(CALIBRATION_BILLBOARD_FONT_SIZE); + _calibrationBillboard->setText(CALIBRATION_INSTRUCTION_MESSAGE); + _calibrationBillboard->setAlpha(CALIBRATION_BILLBOARD_ALPHA); + glm::vec2 viewport = qApp->getViewportDimensions(); + _calibrationBillboard->setX((viewport.x - CALIBRATION_BILLBOARD_WIDTH) / 2); + _calibrationBillboard->setY((viewport.y - CALIBRATION_BILLBOARD_HEIGHT) / 2); + _calibrationBillboard->setWidth(CALIBRATION_BILLBOARD_WIDTH); + _calibrationBillboard->setHeight(CALIBRATION_BILLBOARD_HEIGHT); + _calibrationBillboardID = qApp->getOverlays().addOverlay(_calibrationBillboard); + + } +} + +void DdeFaceTracker::addCalibrationDatum() { + const int LARGE_TICK_INTERVAL = 30; + const int SMALL_TICK_INTERVAL = 6; + int samplesLeft = CALIBRATION_SAMPLES - _calibrationCount; + if (samplesLeft % LARGE_TICK_INTERVAL == 0) { + _calibrationMessage += QString::number(samplesLeft / LARGE_TICK_INTERVAL); + _calibrationBillboard->setText(_calibrationMessage); + } else if (samplesLeft % SMALL_TICK_INTERVAL == 0) { + _calibrationMessage += "."; + _calibrationBillboard->setText(_calibrationMessage); + } + + _calibrationCount += 1; +} + +void DdeFaceTracker::cancelCalibration() { + qApp->getOverlays().deleteOverlay(_calibrationBillboardID); + _calibrationBillboard = NULL; + _isCalibrating = false; + qCDebug(interfaceapp) << "DDE Face Tracker: Calibration cancelled"; +} + +void DdeFaceTracker::finishCalibration() { + qApp->getOverlays().deleteOverlay(_calibrationBillboardID); + _calibrationBillboard = NULL; + _isCalibrating = false; + qCDebug(interfaceapp) << "DDE Face Tracker: Calibration finished"; } diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 8dcebabb95..0078cbcd61 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -20,6 +20,7 @@ #include #include +#include #include "FaceTracker.h" @@ -121,6 +122,15 @@ private: float _lastEyeBlinks[2]; float _filteredEyeBlinks[2]; float _lastEyeCoefficients[2]; + + bool _isCalibrating; + int _calibrationCount; + TextOverlay* _calibrationBillboard; + int _calibrationBillboardID; + QString _calibrationMessage; + void addCalibrationDatum(); + void cancelCalibration(); + void finishCalibration(); }; #endif // hifi_DdeFaceTracker_h From a6dd08fea89d4d06ac9b1b9ecd84c18bea64369c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 6 May 2015 11:38:14 -0700 Subject: [PATCH 04/11] Calculate average coefficient values --- interface/src/devices/DdeFaceTracker.cpp | 17 +++++++++++++++-- interface/src/devices/DdeFaceTracker.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index 5736717419..3bb6a3530a 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -138,7 +138,7 @@ struct Packet { static const float STARTING_DDE_MESSAGE_TIME = 0.033f; -static const quint64 CALIBRATION_SAMPLES = 150; +static const int CALIBRATION_SAMPLES = 150; #ifdef WIN32 // warning C4351: new behavior: elements of array 'DdeFaceTracker::_lastEyeBlinks' will be default initialized @@ -183,14 +183,15 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui _filteredEyeBlinks(), _lastEyeCoefficients(), _isCalibrating(false), + _calibrationValues(), _calibrationCount(0), _calibrationBillboard(NULL), _calibrationBillboardID(0), _calibrationMessage(QString()) { _coefficients.resize(NUM_FACESHIFT_BLENDSHAPES); - _blendshapeCoefficients.resize(NUM_FACESHIFT_BLENDSHAPES); + _calibrationValues.resize(NUM_FACESHIFT_BLENDSHAPES); _eyeStates[0] = EYE_OPEN; _eyeStates[1] = EYE_OPEN; @@ -558,6 +559,9 @@ void DdeFaceTracker::calibrate() { _calibrationBillboard->setHeight(CALIBRATION_BILLBOARD_HEIGHT); _calibrationBillboardID = qApp->getOverlays().addOverlay(_calibrationBillboard); + for (int i = 0; i < NUM_FACESHIFT_BLENDSHAPES; i++) { + _calibrationValues[i] += 0.0f; + } } } @@ -573,6 +577,10 @@ void DdeFaceTracker::addCalibrationDatum() { _calibrationBillboard->setText(_calibrationMessage); } + for (int i = 0; i < NUM_FACESHIFT_BLENDSHAPES; i++) { + _calibrationValues[i] += _coefficients[i]; + } + _calibrationCount += 1; } @@ -587,5 +595,10 @@ void DdeFaceTracker::finishCalibration() { qApp->getOverlays().deleteOverlay(_calibrationBillboardID); _calibrationBillboard = NULL; _isCalibrating = false; + + for (int i = 0; i < NUM_FACESHIFT_BLENDSHAPES; i++) { + _calibrationValues[i] = _calibrationValues[i] / (float)CALIBRATION_SAMPLES; + } + qCDebug(interfaceapp) << "DDE Face Tracker: Calibration finished"; } diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 0078cbcd61..342ef1c3ec 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -125,6 +125,7 @@ private: bool _isCalibrating; int _calibrationCount; + QVector _calibrationValues; TextOverlay* _calibrationBillboard; int _calibrationBillboardID; QString _calibrationMessage; From 4cd4dee84de3e9d71b906d93ad676082cbc3cfc3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 6 May 2015 12:26:44 -0700 Subject: [PATCH 05/11] Use average coefficient values to zero out bias Adjust control thresholds to suit. --- interface/src/devices/DdeFaceTracker.cpp | 28 ++++++++++++++---------- interface/src/devices/DdeFaceTracker.h | 1 + 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index 3bb6a3530a..5fb2c5baf6 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -87,16 +87,16 @@ static const float DDE_COEFFICIENT_SCALES[] = { 3.0f, // BrowsU_L 3.0f, // BrowsU_R 1.0f, // JawFwd - 1.5f, // JawLeft + 2.0f, // JawLeft 1.8f, // JawOpen 1.0f, // JawChew - 1.5f, // JawRight + 2.0f, // JawRight 1.5f, // MouthLeft 1.5f, // MouthRight 1.5f, // MouthFrown_L 1.5f, // MouthFrown_R - 1.5f, // MouthSmile_L - 1.5f, // MouthSmile_R + 2.5f, // MouthSmile_L + 2.5f, // MouthSmile_R 1.0f, // MouthDimple_L 1.0f, // MouthDimple_R 1.0f, // LipsStretch_L @@ -107,8 +107,8 @@ static const float DDE_COEFFICIENT_SCALES[] = { 1.0f, // LipsLowerDown 1.0f, // LipsUpperOpen 1.0f, // LipsLowerOpen - 2.5f, // LipsFunnel - 2.0f, // LipsPucker + 1.5f, // LipsFunnel + 2.5f, // LipsPucker 1.5f, // ChinLowerRaise 1.5f, // ChinUpperRaise 1.0f, // Sneer @@ -191,6 +191,7 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui { _coefficients.resize(NUM_FACESHIFT_BLENDSHAPES); _blendshapeCoefficients.resize(NUM_FACESHIFT_BLENDSHAPES); + _coefficientAverages.resize(NUM_FACESHIFT_BLENDSHAPES); _calibrationValues.resize(NUM_FACESHIFT_BLENDSHAPES); _eyeStates[0] = EYE_OPEN; @@ -394,11 +395,14 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) { if (_isCalibrating) { addCalibrationDatum(); } + for (int i = 0; i < NUM_FACESHIFT_BLENDSHAPES; i++) { + _coefficients[i] -= _coefficientAverages[i]; + } // Use BrowsU_C to control both brows' up and down float browUp = _coefficients[_browUpCenterIndex]; if (isFiltering) { - const float BROW_VELOCITY_FILTER_STRENGTH = 0.75f; + const float BROW_VELOCITY_FILTER_STRENGTH = 0.5f; float velocity = fabs(browUp - _lastBrowUp) / _averageMessageTime; float velocityFilter = glm::clamp(velocity * BROW_VELOCITY_FILTER_STRENGTH, 0.0f, 1.0f); _filteredBrowUp = velocityFilter * browUp + (1.0f - velocityFilter) * _filteredBrowUp; @@ -412,11 +416,11 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) { _coefficients[_browDownRightIndex] = -browUp; // Offset jaw open coefficient - static const float JAW_OPEN_THRESHOLD = 0.16f; + static const float JAW_OPEN_THRESHOLD = 0.1f; _coefficients[_jawOpenIndex] = _coefficients[_jawOpenIndex] - JAW_OPEN_THRESHOLD; // Offset smile coefficients - static const float SMILE_THRESHOLD = 0.18f; + static const float SMILE_THRESHOLD = 0.5f; _coefficients[_mouthSmileLeftIndex] = _coefficients[_mouthSmileLeftIndex] - SMILE_THRESHOLD; _coefficients[_mouthSmileRightIndex] = _coefficients[_mouthSmileRightIndex] - SMILE_THRESHOLD; @@ -443,7 +447,7 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) { // Change to closing or opening states const float EYE_CONTROL_HYSTERISIS = 0.25f; - const float EYE_CLOSING_THRESHOLD = 0.95f; + const float EYE_CLOSING_THRESHOLD = 0.8f; const float EYE_OPENING_THRESHOLD = EYE_CONTROL_THRESHOLD - EYE_CONTROL_HYSTERISIS; if ((_eyeStates[i] == EYE_OPEN || _eyeStates[i] == EYE_OPENING) && eyeCoefficients[i] > EYE_CLOSING_THRESHOLD) { _eyeStates[i] = EYE_CLOSING; @@ -560,7 +564,7 @@ void DdeFaceTracker::calibrate() { _calibrationBillboardID = qApp->getOverlays().addOverlay(_calibrationBillboard); for (int i = 0; i < NUM_FACESHIFT_BLENDSHAPES; i++) { - _calibrationValues[i] += 0.0f; + _calibrationValues[i] = 0.0f; } } } @@ -597,7 +601,7 @@ void DdeFaceTracker::finishCalibration() { _isCalibrating = false; for (int i = 0; i < NUM_FACESHIFT_BLENDSHAPES; i++) { - _calibrationValues[i] = _calibrationValues[i] / (float)CALIBRATION_SAMPLES; + _coefficientAverages[i] = _calibrationValues[i] / (float)CALIBRATION_SAMPLES; } qCDebug(interfaceapp) << "DDE Face Tracker: Calibration finished"; diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 342ef1c3ec..a0cdc1db9c 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -122,6 +122,7 @@ private: float _lastEyeBlinks[2]; float _filteredEyeBlinks[2]; float _lastEyeCoefficients[2]; + QVector _coefficientAverages; bool _isCalibrating; int _calibrationCount; From b1d5b2643f0a5a8655c51704ff19051850bf247f Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 8 May 2015 13:17:39 -0700 Subject: [PATCH 06/11] add has stars to edit.js --- examples/html/entityProperties.html | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index e525818e51..9c984ea373 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -26,6 +26,20 @@ ); }; } + function createEmitGroupCheckedPropertyUpdateFunction(group, propertyName) { + return function() { + var properties = {}; + properties[group] = {}; + properties[group][propertyName] = this.checked; + EventBridge.emitWebEvent( + JSON.stringify({ + type: "update", + properties: properties + }) + ); + }; + } + function createEmitNumberPropertyUpdateFunction(propertyName) { return function() { EventBridge.emitWebEvent( @@ -286,6 +300,8 @@ var elZoneAtmosphereScatteringWavelengthsX = document.getElementById("property-zone-atmosphere-scattering-wavelengths-x"); var elZoneAtmosphereScatteringWavelengthsY = document.getElementById("property-zone-atmosphere-scattering-wavelengths-y"); var elZoneAtmosphereScatteringWavelengthsZ = document.getElementById("property-zone-atmosphere-scattering-wavelengths-z"); + var elZoneAtmosphereHasStars = document.getElementById("property-zone-atmosphere-has-stars"); + if (window.EventBridge !== undefined) { EventBridge.scriptEventReceived.connect(function(data) { @@ -486,7 +502,7 @@ elZoneAtmosphereScatteringWavelengthsX.value = properties.atmosphere.scatteringWavelengths.x; elZoneAtmosphereScatteringWavelengthsY.value = properties.atmosphere.scatteringWavelengths.y; elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; - + elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars; } @@ -650,6 +666,8 @@ elZoneAtmosphereScatteringWavelengthsX.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); elZoneAtmosphereScatteringWavelengthsY.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); elZoneAtmosphereScatteringWavelengthsZ.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); + elZoneAtmosphereHasStars.addEventListener('change', createEmitGroupCheckedPropertyUpdateFunction('atmosphere','hasStars')); + elMoveSelectionToGrid.addEventListener("click", function() { EventBridge.emitWebEvent(JSON.stringify({ @@ -1153,6 +1171,12 @@
Z
+
+ Atmosphere Has Stars + + + +
From 1936f4c11489260e9fcaa43fd1097cf0e988b5ec Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 8 May 2015 14:03:58 -0700 Subject: [PATCH 07/11] fix zone:nothing bug --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index b268ba6031..e4c476c6f7 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -450,8 +450,8 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, } else { _viewState->endOverrideEnvironmentData(); + auto stage = scene->getSkyStage(); if (_bestZone->getBackgroundMode() == BACKGROUND_MODE_SKYBOX) { - auto stage = scene->getSkyStage(); stage->getSkybox()->setColor(_bestZone->getSkyboxProperties().getColorVec3()); if (_bestZone->getSkyboxProperties().getURL().isEmpty()) { stage->getSkybox()->clearCubemap(); @@ -461,6 +461,8 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, stage->getSkybox()->setCubemap(cubeMap->getGPUTexture()); } stage->setBackgroundMode(model::SunSkyStage::SKY_BOX); + } else { + stage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through } } @@ -478,7 +480,7 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, _hasPreviousZone = false; } _viewState->endOverrideEnvironmentData(); - scene->getSkyStage()->setBackgroundMode(model::SunSkyStage::SKY_DOME); + scene->getSkyStage()->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through } // we must call endScene while we still have the tree locked so that no one deletes a model From 603afefaab7833d3fc70de79874130df3b6a432e Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 8 May 2015 14:16:38 -0700 Subject: [PATCH 08/11] silence verbose no-very-helpful log message --- libraries/physics/src/PhysicalEntitySimulation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index ed7b986800..50e81b4788 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -167,7 +167,8 @@ VectorOfMotionStates& PhysicalEntitySimulation::getObjectsToAdd() { _tempVector.push_back(motionState); entityItr = _pendingAdds.erase(entityItr); } else { - qDebug() << "Warning! Failed to generate new shape for entity." << entity->getName(); + // TODO: Seth to look into why this case is hit. + //qDebug() << "Warning! Failed to generate new shape for entity." << entity->getName(); ++entityItr; } } else { From a2ffc1029b9d32ddc38ed875a9fdd9106277f892 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 8 May 2015 14:18:44 -0700 Subject: [PATCH 09/11] clear MotionState pointer in body on delete --- libraries/physics/src/PhysicsEngine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index ea74a87286..bfd0b6cb28 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -147,6 +147,7 @@ void PhysicsEngine::deleteObjects(VectorOfMotionStates& objects) { // NOTE: setRigidBody() modifies body->m_userPointer so we should clear the MotionState's body BEFORE deleting it. btRigidBody* body = object->getRigidBody(); object->setRigidBody(nullptr); + body->setMotionState(nullptr); delete body; object->releaseShape(); delete object; @@ -161,6 +162,7 @@ void PhysicsEngine::deleteObjects(SetOfMotionStates& objects) { // NOTE: setRigidBody() modifies body->m_userPointer so we should clear the MotionState's body BEFORE deleting it. object->setRigidBody(nullptr); + body->setMotionState(nullptr); delete body; object->releaseShape(); delete object; From 9f229dc3b37084d9185448fdf751c2b62dd4fe50 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 8 May 2015 15:03:04 -0700 Subject: [PATCH 10/11] remove spinners from scatter values --- examples/html/entityProperties.html | 10 +++++----- examples/html/style.css | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 9c984ea373..26bcc63f15 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -1154,21 +1154,21 @@
Atmosphere Mie Scattering
- +
Atmosphere Rayleigh Scattering
- +
Atmosphere Scattering Wavelenghts
-
X
-
Y
-
Z
+
X
+
Y
+
Z
diff --git a/examples/html/style.css b/examples/html/style.css index 8be9b92a51..c87201da4b 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -121,6 +121,14 @@ input.coord { display: block; } +input.no-spin::-webkit-outer-spin-button, +input.no-spin::-webkit-inner-spin-button { + display: none; + -webkit-appearance: none; + -moz-appearance: none; + margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ +} + table#entity-table { border-collapse: collapse; font-family: Sans-Serif; From abc99267afd317b3450dfd9941322d7606cec71f Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 8 May 2015 16:19:39 -0700 Subject: [PATCH 11/11] Typo was making edit.js fail and impossible to debug. --- examples/libraries/entitySelectionTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 80ba4c0f56..f3ea18aef3 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -203,7 +203,7 @@ SelectionManager = (function() { try { listeners[i](); } catch (e) { - print("EntitySelectionTool got exception: " = JSON.stringify(e)); + print("EntitySelectionTool got exception: " + JSON.stringify(e)); } } };