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