Unified · Split
| @@ -67,7 +67,7 @@ · 66 unmodified lines | ||
| 67 | 67 | "type": "checkbox", |
| 68 | 68 | "label": "Enable Positional Filter", |
| 69 | 69 | "help": "If enabled, positional audio stream uses lowpass filter", |
| 70 | − "default": true | |
| 70 | + "default": false | |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
| @@ -12,6 +12,10 @@ · 11 unmodified lines | ||
| 12 | 12 | // Set the following variables to the values needed |
| 13 | 13 | var filename = "http://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/bartender.rec"; |
| 14 | 14 | var playFromCurrentLocation = true; |
| 15 | +var useDisplayName = true; | |
| 16 | +var useAttachments = true; | |
| 17 | +var useHeadModel = true; | |
| 18 | +var useSkeletonModel = true; | |
| 15 | 19 | |
| 16 | 20 | // ID of the agent. Two agents can't have the same ID. |
| 17 | 21 | var id = 0; |
| @@ -44,11 +48,15 @@ COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 }; · 26 unmodified lines | ||
| 44 | 48 | COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 }; |
| 45 | 49 | |
| 46 | 50 | controlVoxelPosition.x += id * controlVoxelSize; |
| 47 | − | |
| 48 | −Avatar.setPlayFromCurrentLocation(playFromCurrentLocation); | |
| 49 | 51 | |
| 50 | 52 | Avatar.loadRecording(filename); |
| 51 | 53 | |
| 54 | +Avatar.setPlayFromCurrentLocation(playFromCurrentLocation); | |
| 55 | +Avatar.setPlayerUseDisplayName(useDisplayName); | |
| 56 | +Avatar.setPlayerUseAttachments(useAttachments); | |
| 57 | +Avatar.setPlayerUseHeadModel(useHeadModel); | |
| 58 | +Avatar.setPlayerUseSkeletonModel(useSkeletonModel); | |
| 59 | + | |
| 52 | 60 | function setupVoxelViewer() { |
| 53 | 61 | var voxelViewerOffset = 10; |
| 54 | 62 | var voxelViewerPosition = JSON.parse(JSON.stringify(controlVoxelPosition)); |
| @@ -12,7 +12,14 @@ · 11 unmodified lines | ||
| 12 | 12 | Script.include("toolBars.js"); |
| 13 | 13 | |
| 14 | 14 | var recordingFile = "recording.rec"; |
| 15 | −var playFromCurrentLocation = true; | |
| 15 | + | |
| 16 | +function setPlayerOptions() { | |
| 17 | + MyAvatar.setPlayFromCurrentLocation(true); | |
| 18 | + MyAvatar.setPlayerUseDisplayName(false); | |
| 19 | + MyAvatar.setPlayerUseAttachments(false); | |
| 20 | + MyAvatar.setPlayerUseHeadModel(false); | |
| 21 | + MyAvatar.setPlayerUseSkeletonModel(false); | |
| 22 | +} | |
| 16 | 23 | |
| 17 | 24 | var windowDimensions = Controller.getViewportDimensions(); |
| 18 | 25 | var TOOL_ICON_URL = "http://s3-us-west-1.amazonaws.com/highfidelity-public/images/tools/"; |
| @@ -186,7 +193,7 @@ function mousePressEvent(event) { · 167 unmodified lines | ||
| 186 | 193 | toolBar.setAlpha(ALPHA_ON, saveIcon); |
| 187 | 194 | toolBar.setAlpha(ALPHA_ON, loadIcon); |
| 188 | 195 | } else if (MyAvatar.playerLength() > 0) { |
| 189 | − MyAvatar.setPlayFromCurrentLocation(playFromCurrentLocation); | |
| 196 | + setPlayerOptions(); | |
| 190 | 197 | MyAvatar.setPlayerLoop(false); |
| 191 | 198 | MyAvatar.startPlaying(); |
| 192 | 199 | toolBar.setAlpha(ALPHA_OFF, recordIcon); |
| @@ -201,7 +208,7 @@ function mousePressEvent(event) { · 8 unmodified lines | ||
| 201 | 208 | toolBar.setAlpha(ALPHA_ON, saveIcon); |
| 202 | 209 | toolBar.setAlpha(ALPHA_ON, loadIcon); |
| 203 | 210 | } else if (MyAvatar.playerLength() > 0) { |
| 204 | − MyAvatar.setPlayFromCurrentLocation(playFromCurrentLocation); | |
| 211 | + setPlayerOptions(); | |
| 205 | 212 | MyAvatar.setPlayerLoop(true); |
| 206 | 213 | MyAvatar.startPlaying(); |
| 207 | 214 | toolBar.setAlpha(ALPHA_OFF, recordIcon); |
| @@ -1110,7 +1110,7 @@ function keyPressEvent(event) { · 1109 unmodified lines | ||
| 1110 | 1110 | print("Color = " + (whichColor + 1)); |
| 1111 | 1111 | swatchesSound.play(whichColor); |
| 1112 | 1112 | moveTools(); |
| 1113 | − } else if (event.text == "0") { | |
| 1113 | + } else if (event.text == "0" && voxelToolSelected) { | |
| 1114 | 1114 | // Create a brand new 1 meter voxel in front of your avatar |
| 1115 | 1115 | var newPosition = getNewVoxelPosition(); |
| 1116 | 1116 | var newVoxel = { |
| @@ -16,24 +16,21 @@ var debug = false; · 15 unmodified lines | ||
| 16 | 16 | var movingWithHead = false; |
| 17 | 17 | var headStartPosition, headStartDeltaPitch, headStartFinalPitch, headStartRoll, headStartYaw; |
| 18 | 18 | |
| 19 | −var HEAD_MOVE_DEAD_ZONE = 0.10; | |
| 20 | −var HEAD_STRAFE_DEAD_ZONE = 0.0; | |
| 21 | −var HEAD_ROTATE_DEAD_ZONE = 0.0; | |
| 22 | −//var HEAD_THRUST_FWD_SCALE = 12000.0; | |
| 23 | −//var HEAD_THRUST_STRAFE_SCALE = 0.0; | |
| 24 | −var HEAD_YAW_RATE = 1.0; | |
| 19 | +var HEAD_MOVE_DEAD_ZONE = 0.05; | |
| 20 | +var HEAD_STRAFE_DEAD_ZONE = 0.03; | |
| 21 | +var HEAD_ROTATE_DEAD_ZONE = 10.0; | |
| 22 | +var HEAD_YAW_RATE = 1.5; | |
| 25 | 23 | var HEAD_PITCH_RATE = 1.0; |
| 26 | −//var HEAD_ROLL_THRUST_SCALE = 75.0; | |
| 27 | −//var HEAD_PITCH_LIFT_THRUST = 3.0; | |
| 28 | −var WALL_BOUNCE = 4000.0; | |
| 24 | +var WALL_BOUNCE = 10000.0; | |
| 25 | +var FIXED_WALK_VELOCITY = 1.5; | |
| 29 | 26 | |
| 30 | 27 | // Modify these values to tweak the strength of the motion. |
| 31 | 28 | // A larger *FACTOR increases the speed. |
| 32 | 29 | // A lower SHORT_TIMESCALE makes the motor achieve full speed faster. |
| 33 | −var HEAD_VELOCITY_FWD_FACTOR = 20.0; | |
| 34 | −var HEAD_VELOCITY_LEFT_FACTOR = 20.0; | |
| 30 | +var HEAD_VELOCITY_FWD_FACTOR = 10.0; | |
| 31 | +var HEAD_VELOCITY_LEFT_FACTOR = 0.0; | |
| 35 | 32 | var HEAD_VELOCITY_UP_FACTOR = 20.0; |
| 36 | −var SHORT_TIMESCALE = 0.125; | |
| 33 | +var SHORT_TIMESCALE = 0.01; | |
| 37 | 34 | var VERY_LARGE_TIMESCALE = 1000000.0; |
| 38 | 35 | |
| 39 | 36 | var xAxis = {x:1.0, y:0.0, z:0.0 }; |
| @@ -43,9 +40,10 @@ var zAxis = {x:0.0, y:0.0, z:1.0 }; · 3 unmodified lines | ||
| 43 | 40 | // If these values are set to something |
| 44 | 41 | var maxVelocity = 1.25; |
| 45 | 42 | var noFly = true; |
| 43 | +var fixedWalkVelocity = true; | |
| 46 | 44 | |
| 47 | 45 | //var roomLimits = { xMin: 618, xMax: 635.5, zMin: 528, zMax: 552.5 }; |
| 48 | −var roomLimits = { xMin: -1, xMax: 0, zMin: 0, zMax: 0 }; | |
| 46 | +var roomLimits = { xMin: 193.0, xMax: 206.5, zMin: 251.4, zMax: 269.5 }; | |
| 49 | 47 | |
| 50 | 48 | function isInRoom(position) { |
| 51 | 49 | var BUFFER = 2.0; |
| @@ -71,25 +69,49 @@ function moveWithHead(deltaTime) { · 19 unmodified lines | ||
| 71 | 69 | var deltaPitch = MyAvatar.getHeadDeltaPitch() - headStartDeltaPitch; |
| 72 | 70 | var deltaRoll = MyAvatar.getHeadFinalRoll() - headStartRoll; |
| 73 | 71 | var velocity = MyAvatar.getVelocity(); |
| 74 | − var bodyLocalCurrentHeadVector = Vec3.subtract(MyAvatar.getHeadPosition(), MyAvatar.position); | |
| 75 | − bodyLocalCurrentHeadVector = Vec3.multiplyQbyV(Quat.angleAxis(-deltaYaw, {x:0, y: 1, z:0}), bodyLocalCurrentHeadVector); | |
| 72 | + var position = MyAvatar.position; | |
| 73 | + var neckPosition = MyAvatar.getNeckPosition(); | |
| 74 | + var bodyLocalCurrentHeadVector = Vec3.subtract(neckPosition, position); | |
| 75 | + bodyLocalCurrentHeadVector = Vec3.multiplyQbyV(Quat.inverse(MyAvatar.orientation), bodyLocalCurrentHeadVector); | |
| 76 | 76 | var headDelta = Vec3.subtract(bodyLocalCurrentHeadVector, headStartPosition); |
| 77 | − headDelta = Vec3.multiplyQbyV(Quat.inverse(Camera.getOrientation()), headDelta); | |
| 78 | 77 | headDelta.y = 0.0; // Don't respond to any of the vertical component of head motion |
| 79 | − | |
| 78 | + headDelta = Vec3.multiplyQbyV(MyAvatar.orientation, headDelta); | |
| 79 | + headDelta = Vec3.multiplyQbyV(Quat.inverse(Camera.getOrientation()), headDelta); | |
| 80 | + | |
| 81 | + var length = Vec3.length(headDelta); | |
| 82 | + | |
| 83 | + if (length > 1.0) { | |
| 84 | + // Needs fixed! Right now sometimes reported neck position jumps to a bad value | |
| 85 | + headDelta.x = headDelta.y = headDelta.z = 0.0; | |
| 86 | + length = 0.0; | |
| 87 | + return; | |
| 88 | + } | |
| 89 | + | |
| 80 | 90 | // Thrust based on leaning forward and side-to-side |
| 81 | 91 | var targetVelocity = {x:0.0, y:0.0, z:0.0}; |
| 92 | + if (length > HEAD_MOVE_DEAD_ZONE) { | |
| 93 | + //headDelta = Vec3.normalize(headDelta); | |
| 94 | + //targetVelocity = Vec3.multiply(headDelta, FIXED_WALK_VELOCITY); | |
| 95 | + targetVelocity = Vec3.multiply(headDelta, HEAD_VELOCITY_FWD_FACTOR); | |
| 96 | + } | |
| 97 | + /* | |
| 82 | 98 | if (Math.abs(headDelta.z) > HEAD_MOVE_DEAD_ZONE) { |
| 83 | − targetVelocity = Vec3.multiply(zAxis, -headDelta.z * HEAD_VELOCITY_FWD_FACTOR); | |
| 99 | + if (fixedWalkVelocity) { | |
| 100 | + targetVelocity = Vec3.multiply(zAxis, headDelta.z > 0 ? FIXED_WALK_VELOCITY : -FIXED_WALK_VELOCITY); | |
| 101 | + } else { | |
| 102 | + targetVelocity = Vec3.multiply(zAxis, headDelta.z * HEAD_VELOCITY_FWD_FACTOR); | |
| 103 | + } | |
| 84 | 104 | } |
| 85 | 105 | if (Math.abs(headDelta.x) > HEAD_STRAFE_DEAD_ZONE) { |
| 86 | − var deltaVelocity = Vec3.multiply(xAxis, -headDelta.x * HEAD_VELOCITY_LEFT_FACTOR); | |
| 106 | + var deltaVelocity = Vec3.multiply(xAxis, headDelta.x * HEAD_VELOCITY_LEFT_FACTOR); | |
| 87 | 107 | targetVelocity = Vec3.sum(targetVelocity, deltaVelocity); |
| 88 | 108 | } |
| 109 | + */ | |
| 89 | 110 | if (Math.abs(deltaYaw) > HEAD_ROTATE_DEAD_ZONE) { |
| 90 | 111 | var orientation = Quat.multiply(Quat.angleAxis((deltaYaw + deltaRoll) * HEAD_YAW_RATE * deltaTime, yAxis), MyAvatar.orientation); |
| 91 | 112 | MyAvatar.orientation = orientation; |
| 92 | 113 | } |
| 114 | + | |
| 93 | 115 | // Thrust Up/Down based on head pitch |
| 94 | 116 | if (!noFly) { |
| 95 | 117 | var deltaVelocity = Vec3.multiply(yAxis, headDelta.y * HEAD_VELOCITY_UP_FACTOR); |
| @@ -121,7 +143,7 @@ function moveWithHead(deltaTime) { · 25 unmodified lines | ||
| 121 | 143 | if (movingWithHead && Vec3.length(thrust) > 0.0) { |
| 122 | 144 | // reduce the timescale of the motor so that it won't defeat the thrust code |
| 123 | 145 | Vec3.print("adebug room containment thrust = ", thrust); |
| 124 | − motorTimescale = 4.0 * SHORT_TIMESCALE; | |
| 146 | + motorTimescale = 1000000.0; | |
| 125 | 147 | } |
| 126 | 148 | } |
| 127 | 149 | MyAvatar.motorTimescale = motorTimescale; |
| @@ -130,7 +152,8 @@ function moveWithHead(deltaTime) { · 2 unmodified lines | ||
| 130 | 152 | Controller.keyPressEvent.connect(function(event) { |
| 131 | 153 | if (event.text == "SPACE" && !movingWithHead) { |
| 132 | 154 | movingWithHead = true; |
| 133 | − headStartPosition = Vec3.subtract(MyAvatar.getHeadPosition(), MyAvatar.position); | |
| 155 | + headStartPosition = Vec3.subtract(MyAvatar.getNeckPosition(), MyAvatar.position); | |
| 156 | + headStartPosition = Vec3.multiplyQbyV(Quat.inverse(MyAvatar.orientation), headStartPosition); | |
| 134 | 157 | headStartDeltaPitch = MyAvatar.getHeadDeltaPitch(); |
| 135 | 158 | headStartFinalPitch = MyAvatar.getHeadFinalPitch(); |
| 136 | 159 | headStartRoll = MyAvatar.getHeadFinalRoll(); |
| @@ -219,6 +219,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 218 unmodified lines | ||
| 219 | 219 | if (portStr) { |
| 220 | 220 | listenPort = atoi(portStr); |
| 221 | 221 | } |
| 222 | + | |
| 223 | + // call the OAuthWebviewHandler static getter so that its instance lives in our thread | |
| 224 | + // make sure it is ready before the NodeList might need it | |
| 225 | + OAuthWebViewHandler::getInstance(); | |
| 222 | 226 | |
| 223 | 227 | // start the nodeThread so its event loop is running |
| 224 | 228 | _nodeThread->start(); |
| @@ -418,11 +422,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 193 unmodified lines | ||
| 418 | 422 | connect(_window, &MainWindow::windowGeometryChanged, |
| 419 | 423 | _runningScriptsWidget, &RunningScriptsWidget::setBoundary); |
| 420 | 424 | |
| 421 | − // call the OAuthWebviewHandler static getter so that its instance lives in our thread | |
| 422 | − OAuthWebViewHandler::getInstance(); | |
| 423 | − // make sure the High Fidelity root CA is in our list of trusted certs | |
| 424 | − OAuthWebViewHandler::addHighFidelityRootCAToSSLConfig(); | |
| 425 | − | |
| 426 | 425 | _trayIcon->show(); |
| 427 | 426 | |
| 428 | 427 | #ifdef HAVE_RTMIDI |
| @@ -97,6 +97,12 @@ glm::vec3 Avatar::getChestPosition() const { · 96 unmodified lines | ||
| 97 | 97 | return _skeletonModel.getNeckPosition(neckPosition) ? (_position + neckPosition) * 0.5f : _position; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | +glm::vec3 Avatar::getNeckPosition() const { | |
| 101 | + glm::vec3 neckPosition; | |
| 102 | + return _skeletonModel.getNeckPosition(neckPosition) ? neckPosition : _position; | |
| 103 | +} | |
| 104 | + | |
| 105 | + | |
| 100 | 106 | glm::quat Avatar::getWorldAlignedOrientation () const { |
| 101 | 107 | return computeRotationFromBodyToWorldUp() * getOrientation(); |
| 102 | 108 | } |
| @@ -154,6 +154,8 @@ public: · 153 unmodified lines | ||
| 154 | 154 | Q_INVOKABLE void setJointModelPositionAndOrientation(int index, const glm::vec3 position, const glm::quat& rotation); |
| 155 | 155 | Q_INVOKABLE void setJointModelPositionAndOrientation(const QString& name, const glm::vec3 position, |
| 156 | 156 | const glm::quat& rotation); |
| 157 | + | |
| 158 | + Q_INVOKABLE glm::vec3 getNeckPosition() const; | |
| 157 | 159 | |
| 158 | 160 | Q_INVOKABLE glm::vec3 getVelocity() const { return _velocity; } |
| 159 | 161 | Q_INVOKABLE glm::vec3 getAcceleration() const { return _acceleration; } |
| @@ -32,6 +32,7 @@ Head::Head(Avatar* owningAvatar) : · 31 unmodified lines | ||
| 32 | 32 | _eyePosition(0.0f, 0.0f, 0.0f), |
| 33 | 33 | _scale(1.0f), |
| 34 | 34 | _lastLoudness(0.0f), |
| 35 | + _longTermAverageLoudness(-1.0f), | |
| 35 | 36 | _audioAttack(0.0f), |
| 36 | 37 | _angularVelocity(0,0,0), |
| 37 | 38 | _renderLookatVectors(false), |
| @@ -62,7 +63,7 @@ void Head::reset() { · 24 unmodified lines | ||
| 62 | 63 | } |
| 63 | 64 | |
| 64 | 65 | void Head::simulate(float deltaTime, bool isMine, bool billboard) { |
| 65 | − // Update audio trailing average for rendering facial animations | |
| 66 | + | |
| 66 | 67 | if (isMine) { |
| 67 | 68 | MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar); |
| 68 | 69 | |
| @@ -78,6 +79,18 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { · 9 unmodified lines | ||
| 78 | 79 | } |
| 79 | 80 | } |
| 80 | 81 | } |
| 82 | + // Update audio trailing average for rendering facial animations | |
| 83 | + const float AUDIO_AVERAGING_SECS = 0.05f; | |
| 84 | + const float AUDIO_LONG_TERM_AVERAGING_SECS = 30.f; | |
| 85 | + _averageLoudness = glm::mix(_averageLoudness, _audioLoudness, glm::min(deltaTime / AUDIO_AVERAGING_SECS, 1.0f)); | |
| 86 | + | |
| 87 | + if (_longTermAverageLoudness == -1.0) { | |
| 88 | + _longTermAverageLoudness = _averageLoudness; | |
| 89 | + } else { | |
| 90 | + _longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f)); | |
| 91 | + } | |
| 92 | + float deltaLoudness = glm::max(0.0f, _averageLoudness - _longTermAverageLoudness); | |
| 93 | + //qDebug() << "deltaLoudness: " << deltaLoudness; | |
| 81 | 94 | |
| 82 | 95 | if (!(_isFaceshiftConnected || billboard)) { |
| 83 | 96 | // Update eye saccades |
| @@ -92,9 +105,6 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { · 8 unmodified lines | ||
| 92 | 105 | _saccadeTarget = SACCADE_MAGNITUDE * randVector(); |
| 93 | 106 | } |
| 94 | 107 | _saccade += (_saccadeTarget - _saccade) * 0.50f; |
| 95 | − | |
| 96 | − const float AUDIO_AVERAGING_SECS = 0.05f; | |
| 97 | − _averageLoudness = glm::mix(_averageLoudness, _audioLoudness, glm::min(deltaTime / AUDIO_AVERAGING_SECS, 1.0f)); | |
| 98 | 108 | |
| 99 | 109 | // Detect transition from talking to not; force blink after that and a delay |
| 100 | 110 | bool forceBlink = false; |
| @@ -108,8 +118,8 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { · 7 unmodified lines | ||
| 108 | 118 | } |
| 109 | 119 | |
| 110 | 120 | // Update audio attack data for facial animation (eyebrows and mouth) |
| 111 | − _audioAttack = 0.9f * _audioAttack + 0.1f * fabs(_audioLoudness - _lastLoudness); | |
| 112 | − _lastLoudness = _audioLoudness; | |
| 121 | + _audioAttack = 0.9f * _audioAttack + 0.1f * fabs((_audioLoudness - _longTermAverageLoudness) - _lastLoudness); | |
| 122 | + _lastLoudness = (_audioLoudness - _longTermAverageLoudness); | |
| 113 | 123 | |
| 114 | 124 | const float BROW_LIFT_THRESHOLD = 100.0f; |
| 115 | 125 | if (_audioAttack > BROW_LIFT_THRESHOLD) { |
| @@ -123,6 +123,7 @@ private: · 122 unmodified lines | ||
| 123 | 123 | |
| 124 | 124 | float _scale; |
| 125 | 125 | float _lastLoudness; |
| 126 | + float _longTermAverageLoudness; | |
| 126 | 127 | float _audioAttack; |
| 127 | 128 | glm::vec3 _angularVelocity; |
| 128 | 129 | bool _renderLookatVectors; |
| @@ -15,6 +15,8 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <LimitedNodeList.h> |
| 16 | 16 | #include <OAuthNetworkAccessManager.h> |
| 17 | 17 | |
| 18 | +#include "Application.h" | |
| 19 | + | |
| 18 | 20 | #include "DataWebDialog.h" |
| 19 | 21 | |
| 20 | 22 | DataWebDialog::DataWebDialog() { |
| @@ -23,6 +25,12 @@ DataWebDialog::DataWebDialog() { · 2 unmodified lines | ||
| 23 | 25 | |
| 24 | 26 | // use an OAuthNetworkAccessManager instead of regular QNetworkAccessManager so our requests are authed |
| 25 | 27 | page()->setNetworkAccessManager(OAuthNetworkAccessManager::getInstance()); |
| 28 | + | |
| 29 | + // have the page delegate external links so they can be captured by the Application in case they are a hifi link | |
| 30 | + page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks); | |
| 31 | + | |
| 32 | + // have the Application handle external links | |
| 33 | + connect(this, &QWebView::linkClicked, Application::getInstance(), &Application::openUrl); | |
| 26 | 34 | } |
| 27 | 35 | |
| 28 | 36 | DataWebDialog* DataWebDialog::dialogForPath(const QString& path) { |
| @@ -27,7 +27,7 @@ OAuthWebViewHandler::OAuthWebViewHandler() : · 26 unmodified lines | ||
| 27 | 27 | _webViewRedisplayTimer(), |
| 28 | 28 | _lastAuthorizationURL() |
| 29 | 29 | { |
| 30 | − | |
| 30 | + addHighFidelityRootCAToSSLConfig(); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | const char HIGH_FIDELITY_CA[] = "-----BEGIN CERTIFICATE-----\n" |
| @@ -75,6 +75,8 @@ public: · 74 unmodified lines | ||
| 75 | 75 | - (_b1 * _ym1) |
| 76 | 76 | - (_b2 * _ym2); |
| 77 | 77 | |
| 78 | + y = (y >= -EPSILON && y < EPSILON) ? 0.0f : y; // clamp to 0 | |
| 79 | + | |
| 78 | 80 | // update delay line |
| 79 | 81 | _xm2 = _xm1; |
| 80 | 82 | _xm1 = x; |
| @@ -40,8 +40,8 @@ void AudioSourceTone::updateCoefficients() { · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | void AudioSourceTone::initialize() { |
| 42 | 42 | const float32_t FREQUENCY_220_HZ = 220.0f; |
| 43 | − const float32_t GAIN_MINUS_3DB = 0.708f; | |
| 44 | − setParameters(SAMPLE_RATE, FREQUENCY_220_HZ, GAIN_MINUS_3DB); | |
| 43 | + const float32_t GAIN_MINUS_6DB = 0.501f; | |
| 44 | + setParameters(SAMPLE_RATE, FREQUENCY_220_HZ, GAIN_MINUS_6DB); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | void AudioSourceTone::setParameters(const float32_t sampleRate, const float32_t frequency, const float32_t amplitude) { |
| @@ -661,6 +661,30 @@ void AvatarData::setPlayerLoop(bool loop) { · 660 unmodified lines | ||
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | +void AvatarData::setPlayerUseDisplayName(bool useDisplayName) { | |
| 665 | + if(_player) { | |
| 666 | + _player->useDisplayName(useDisplayName); | |
| 667 | + } | |
| 668 | +} | |
| 669 | + | |
| 670 | +void AvatarData::setPlayerUseAttachments(bool useAttachments) { | |
| 671 | + if(_player) { | |
| 672 | + _player->useAttachements(useAttachments); | |
| 673 | + } | |
| 674 | +} | |
| 675 | + | |
| 676 | +void AvatarData::setPlayerUseHeadModel(bool useHeadModel) { | |
| 677 | + if(_player) { | |
| 678 | + _player->useHeadModel(useHeadModel); | |
| 679 | + } | |
| 680 | +} | |
| 681 | + | |
| 682 | +void AvatarData::setPlayerUseSkeletonModel(bool useSkeletonModel) { | |
| 683 | + if(_player) { | |
| 684 | + _player->useSkeletonModel(useSkeletonModel); | |
| 685 | + } | |
| 686 | +} | |
| 687 | + | |
| 664 | 688 | void AvatarData::play() { |
| 665 | 689 | if (isPlaying()) { |
| 666 | 690 | if (QThread::currentThread() != thread()) { |
| @@ -302,6 +302,10 @@ public slots: · 301 unmodified lines | ||
| 302 | 302 | void startPlaying(); |
| 303 | 303 | void setPlayFromCurrentLocation(bool playFromCurrentLocation); |
| 304 | 304 | void setPlayerLoop(bool loop); |
| 305 | + void setPlayerUseDisplayName(bool useDisplayName); | |
| 306 | + void setPlayerUseAttachments(bool useAttachments); | |
| 307 | + void setPlayerUseHeadModel(bool useHeadModel); | |
| 308 | + void setPlayerUseSkeletonModel(bool useSkeletonModel); | |
| 305 | 309 | void play(); |
| 306 | 310 | void stopPlaying(); |
| 307 | 311 | |
| @@ -17,15 +17,15 @@ · 16 unmodified lines | ||
| 17 | 17 | #include "Player.h" |
| 18 | 18 | |
| 19 | 19 | Player::Player(AvatarData* avatar) : |
| 20 | −_recording(new Recording()), | |
| 21 | −_avatar(avatar), | |
| 22 | −_audioThread(NULL), | |
| 23 | −_playFromCurrentPosition(true), | |
| 24 | −_loop(false), | |
| 25 | −_useAttachments(true), | |
| 26 | −_useDisplayName(true), | |
| 27 | −_useHeadURL(true), | |
| 28 | −_useSkeletonURL(true) | |
| 20 | + _recording(new Recording()), | |
| 21 | + _avatar(avatar), | |
| 22 | + _audioThread(NULL), | |
| 23 | + _playFromCurrentPosition(true), | |
| 24 | + _loop(false), | |
| 25 | + _useAttachments(true), | |
| 26 | + _useDisplayName(true), | |
| 27 | + _useHeadURL(true), | |
| 28 | + _useSkeletonURL(true) | |
| 29 | 29 | { |
| 30 | 30 | _timer.invalidate(); |
| 31 | 31 | _options.setLoop(false); |
| @@ -157,10 +157,9 @@ void Player::loopRecording() { · 125 unmodified lines | ||
| 157 | 157 | setupAudioThread(); |
| 158 | 158 | _currentFrame = 0; |
| 159 | 159 | _timer.restart(); |
| 160 | − | |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | −void Player::loadFromFile(QString file) { | |
| 162 | +void Player::loadFromFile(const QString& file) { | |
| 164 | 163 | if (_recording) { |
| 165 | 164 | _recording->clear(); |
| 166 | 165 | } else { |
| @@ -204,7 +203,7 @@ void Player::play() { · 37 unmodified lines | ||
| 204 | 203 | head->setFinalPitch(eulers.x); |
| 205 | 204 | head->setFinalYaw(eulers.y); |
| 206 | 205 | head->setFinalRoll(eulers.z); |
| 207 | − head->setLookAtPosition(currentFrame.getLookAtPosition()); | |
| 206 | + head->setLookAtPosition(context->position + context->orientation * currentFrame.getLookAtPosition()); | |
| 208 | 207 | } else { |
| 209 | 208 | qDebug() << "WARNING: Player couldn't find head data."; |
| 210 | 209 | } |
| @@ -34,10 +34,10 @@ public: · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | RecordingPointer getRecording() const { return _recording; } |
| 36 | 36 | |
| 37 | − public slots: | |
| 37 | +public slots: | |
| 38 | 38 | void startPlaying(); |
| 39 | 39 | void stopPlaying(); |
| 40 | − void loadFromFile(QString file); | |
| 40 | + void loadFromFile(const QString& file); | |
| 41 | 41 | void loadRecording(RecordingPointer recording); |
| 42 | 42 | void play(); |
| 43 | 43 | |
| @@ -86,7 +86,7 @@ void Recorder::stopRecording() { · 85 unmodified lines | ||
| 86 | 86 | qDebug().nospace() << "Recorded " << _recording->getFrameNumber() << " during " << _recording->getLength() << " msec (" << _recording->getFrameNumber() / (_recording->getLength() / 1000.0f) << " fps)"; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | −void Recorder::saveToFile(QString file) { | |
| 89 | +void Recorder::saveToFile(const QString& file) { | |
| 90 | 90 | if (_recording->isEmpty()) { |
| 91 | 91 | qDebug() << "Cannot save recording to file, recording is empty."; |
| 92 | 92 | } |
| @@ -38,7 +38,7 @@ public: · 37 unmodified lines | ||
| 38 | 38 | public slots: |
| 39 | 39 | void startRecording(); |
| 40 | 40 | void stopRecording(); |
| 41 | − void saveToFile(QString file); | |
| 41 | + void saveToFile(const QString& file); | |
| 42 | 42 | void record(); |
| 43 | 43 | void record(char* samples, int size); |
| 44 | 44 | |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <QEventLoop> |
| 21 | 21 | #include <QFile> |
| 22 | 22 | #include <QFileInfo> |
| 23 | −#include <QMessageBox> | |
| 24 | 23 | #include <QPair> |
| 25 | 24 | |
| 26 | 25 | #include "AvatarData.h" |
| @@ -74,7 +73,7 @@ void Recording::addFrame(int timestamp, RecordingFrame &frame) { · 47 unmodified lines | ||
| 74 | 73 | _frames << frame; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | −void Recording::addAudioPacket(QByteArray byteArray) { | |
| 76 | +void Recording::addAudioPacket(const QByteArray& byteArray) { | |
| 78 | 77 | if (!_audio) { |
| 79 | 78 | _audio = new Sound(byteArray); |
| 80 | 79 | return; |
| @@ -89,7 +88,7 @@ void Recording::clear() { · 8 unmodified lines | ||
| 89 | 88 | _audio = NULL; |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | −void writeVec3(QDataStream& stream, glm::vec3 value) { | |
| 91 | +void writeVec3(QDataStream& stream, const glm::vec3& value) { | |
| 93 | 92 | unsigned char buffer[sizeof(value)]; |
| 94 | 93 | memcpy(buffer, &value, sizeof(value)); |
| 95 | 94 | stream.writeRawData(reinterpret_cast<char*>(buffer), sizeof(value)); |
| @@ -102,7 +101,7 @@ bool readVec3(QDataStream& stream, glm::vec3& value) { · 6 unmodified lines | ||
| 102 | 101 | return true; |
| 103 | 102 | } |
| 104 | 103 | |
| 105 | −void writeQuat(QDataStream& stream, glm::quat value) { | |
| 104 | +void writeQuat(QDataStream& stream, const glm::quat& value) { | |
| 106 | 105 | unsigned char buffer[256]; |
| 107 | 106 | int writtenToBuffer = packOrientationQuatToBytes(buffer, value); |
| 108 | 107 | stream.writeRawData(reinterpret_cast<char*>(buffer), writtenToBuffer); |
| @@ -136,7 +135,7 @@ bool readFloat(QDataStream& stream, float& value, int radix) { · 27 unmodified lines | ||
| 136 | 135 | return true; |
| 137 | 136 | } |
| 138 | 137 | |
| 139 | −void writeRecordingToFile(RecordingPointer recording, QString filename) { | |
| 138 | +void writeRecordingToFile(RecordingPointer recording, const QString& filename) { | |
| 140 | 139 | if (!recording || recording->getFrameNumber() < 1) { |
| 141 | 140 | qDebug() << "Can't save empty recording"; |
| 142 | 141 | return; |
| @@ -329,7 +328,7 @@ void writeRecordingToFile(RecordingPointer recording, QString filename) { · 186 unmodified lines | ||
| 329 | 328 | |
| 330 | 329 | fileStream << recording->_audio->getByteArray(); |
| 331 | 330 | |
| 332 | − qint64 writtingTime = timer.restart(); | |
| 331 | + qint64 writingTime = timer.restart(); | |
| 333 | 332 | // Write data length and CRC-16 |
| 334 | 333 | quint32 dataLength = file.pos() - dataOffset; |
| 335 | 334 | file.seek(dataOffset); // Go to beginning of data for checksum |
| @@ -374,10 +373,10 @@ void writeRecordingToFile(RecordingPointer recording, QString filename) { · 38 unmodified lines | ||
| 374 | 373 | } |
| 375 | 374 | |
| 376 | 375 | qint64 checksumTime = timer.elapsed(); |
| 377 | − qDebug() << "Wrote" << file.size() << "bytes in" << writtingTime + checksumTime << "ms. (" << checksumTime << "ms for checksum)"; | |
| 376 | + qDebug() << "Wrote" << file.size() << "bytes in" << writingTime + checksumTime << "ms. (" << checksumTime << "ms for checksum)"; | |
| 378 | 377 | } |
| 379 | 378 | |
| 380 | −RecordingPointer readRecordingFromFile(RecordingPointer recording, QString filename) { | |
| 379 | +RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString& filename) { | |
| 381 | 380 | QByteArray byteArray; |
| 382 | 381 | QUrl url(filename); |
| 383 | 382 | QElapsedTimer timer; |
| @@ -416,10 +415,6 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, QString filen · 32 unmodified lines | ||
| 416 | 415 | |
| 417 | 416 | if (filename.endsWith(".rec") || filename.endsWith(".REC")) { |
| 418 | 417 | qDebug() << "Old .rec format"; |
| 419 | − QMessageBox::warning(NULL, | |
| 420 | − QString("Old recording format"), | |
| 421 | − QString("Converting your file to the new format."), | |
| 422 | − QMessageBox::Ok); | |
| 423 | 418 | readRecordingFromRecFile(recording, filename, byteArray); |
| 424 | 419 | return recording; |
| 425 | 420 | } else if (!filename.endsWith(".hfr") && !filename.endsWith(".HFR")) { |
| @@ -641,7 +636,7 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, QString filen · 215 unmodified lines | ||
| 641 | 636 | } |
| 642 | 637 | |
| 643 | 638 | |
| 644 | −RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString filename, QByteArray byteArray) { | |
| 639 | +RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QString& filename, const QByteArray& byteArray) { | |
| 645 | 640 | QElapsedTimer timer; |
| 646 | 641 | timer.start(); |
| 647 | 642 | |
| @@ -786,21 +781,18 @@ RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString fi · 138 unmodified lines | ||
| 786 | 781 | qDebug() << "Read " << byteArray.size() << " bytes in " << timer.elapsed() << " ms."; |
| 787 | 782 | |
| 788 | 783 | // Set new filename |
| 789 | − if (filename.startsWith("http") || filename.startsWith("https") || filename.startsWith("ftp")) { | |
| 790 | − filename = QUrl(filename).fileName(); | |
| 784 | + QString newFilename = filename; | |
| 785 | + if (newFilename.startsWith("http") || newFilename.startsWith("https") || newFilename.startsWith("ftp")) { | |
| 786 | + newFilename = QUrl(newFilename).fileName(); | |
| 791 | 787 | } |
| 792 | − if (filename.endsWith(".rec") || filename.endsWith(".REC")) { | |
| 793 | − filename.chop(qstrlen(".rec")); | |
| 788 | + if (newFilename.endsWith(".rec") || newFilename.endsWith(".REC")) { | |
| 789 | + newFilename.chop(qstrlen(".rec")); | |
| 794 | 790 | } |
| 795 | − filename.append(".hfr"); | |
| 796 | − filename = QFileInfo(filename).absoluteFilePath(); | |
| 791 | + newFilename.append(".hfr"); | |
| 792 | + newFilename = QFileInfo(newFilename).absoluteFilePath(); | |
| 797 | 793 | |
| 798 | 794 | // Set recording to new format |
| 799 | − writeRecordingToFile(recording, filename); | |
| 800 | − QMessageBox::warning(NULL, | |
| 801 | − QString("New recording location"), | |
| 802 | − QString("The new recording was saved at:\n" + filename), | |
| 803 | − QMessageBox::Ok); | |
| 804 | − qDebug() << "Recording has been successfully converted at" << filename; | |
| 795 | + writeRecordingToFile(recording, newFilename); | |
| 796 | + qDebug() << "Recording has been successfully converted at" << newFilename; | |
| 805 | 797 | return recording; |
| 806 | 798 | } |
| @@ -62,7 +62,7 @@ public: · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | protected: |
| 64 | 64 | void addFrame(int timestamp, RecordingFrame& frame); |
| 65 | − void addAudioPacket(QByteArray byteArray); | |
| 65 | + void addAudioPacket(const QByteArray& byteArray); | |
| 66 | 66 | void clear(); |
| 67 | 67 | |
| 68 | 68 | private: |
| @@ -74,9 +74,10 @@ private: · 5 unmodified lines | ||
| 74 | 74 | |
| 75 | 75 | friend class Recorder; |
| 76 | 76 | friend class Player; |
| 77 | − friend void writeRecordingToFile(RecordingPointer recording, QString file); | |
| 78 | − friend RecordingPointer readRecordingFromFile(RecordingPointer recording, QString file); | |
| 79 | − friend RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString filename, QByteArray byteArray); | |
| 77 | + friend void writeRecordingToFile(RecordingPointer recording, const QString& file); | |
| 78 | + friend RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString& file); | |
| 79 | + friend RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QString& filename, | |
| 80 | + const QByteArray& byteArray); | |
| 80 | 81 | }; |
| 81 | 82 | |
| 82 | 83 | /// Stores the different values associated to one recording frame |
| @@ -95,13 +96,13 @@ public: · 12 unmodified lines | ||
| 95 | 96 | protected: |
| 96 | 97 | void setBlendshapeCoefficients(QVector<float> blendshapeCoefficients); |
| 97 | 98 | void setJointRotations(QVector<glm::quat> jointRotations) { _jointRotations = jointRotations; } |
| 98 | − void setTranslation(glm::vec3 translation) { _translation = translation; } | |
| 99 | − void setRotation(glm::quat rotation) { _rotation = rotation; } | |
| 99 | + void setTranslation(const glm::vec3& translation) { _translation = translation; } | |
| 100 | + void setRotation(const glm::quat& rotation) { _rotation = rotation; } | |
| 100 | 101 | void setScale(float scale) { _scale = scale; } |
| 101 | 102 | void setHeadRotation(glm::quat headRotation) { _headRotation = headRotation; } |
| 102 | 103 | void setLeanSideways(float leanSideways) { _leanSideways = leanSideways; } |
| 103 | 104 | void setLeanForward(float leanForward) { _leanForward = leanForward; } |
| 104 | − void setLookAtPosition(glm::vec3 lookAtPosition) { _lookAtPosition = lookAtPosition; } | |
| 105 | + void setLookAtPosition(const glm::vec3& lookAtPosition) { _lookAtPosition = lookAtPosition; } | |
| 105 | 106 | |
| 106 | 107 | private: |
| 107 | 108 | QVector<float> _blendshapeCoefficients; |
| @@ -115,13 +116,14 @@ private: · 7 unmodified lines | ||
| 115 | 116 | glm::vec3 _lookAtPosition; |
| 116 | 117 | |
| 117 | 118 | friend class Recorder; |
| 118 | − friend void writeRecordingToFile(RecordingPointer recording, QString file); | |
| 119 | − friend RecordingPointer readRecordingFromFile(RecordingPointer recording, QString file); | |
| 120 | − friend RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString filename, QByteArray byteArray); | |
| 119 | + friend void writeRecordingToFile(RecordingPointer recording, const QString& file); | |
| 120 | + friend RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString& file); | |
| 121 | + friend RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QString& filename, | |
| 122 | + const QByteArray& byteArray); | |
| 121 | 123 | }; |
| 122 | 124 | |
| 123 | −void writeRecordingToFile(RecordingPointer recording, QString filename); | |
| 124 | −RecordingPointer readRecordingFromFile(RecordingPointer recording, QString filename); | |
| 125 | −RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString filename, QByteArray byteArray); | |
| 125 | +void writeRecordingToFile(RecordingPointer recording, const QString& filename); | |
| 126 | +RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString& filename); | |
| 127 | +RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QString& filename, const QByteArray& byteArray); | |
| 126 | 128 | |
| 127 | 129 | #endif // hifi_Recording_h |
| @@ -1769,7 +1769,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping) · 1768 unmodified lines | ||
| 1769 | 1769 | lowestWeight = weights[k]; |
| 1770 | 1770 | } |
| 1771 | 1771 | } |
| 1772 | − if (k == 4) { | |
| 1772 | + if (k == 4 && weight > lowestWeight) { | |
| 1773 | 1773 | // no space for an additional weight; we must replace the lowest |
| 1774 | 1774 | weights[lowestIndex] = weight; |
| 1775 | 1775 | extracted.mesh.clusterIndices[it.value()][lowestIndex] = i; |