History

Merge branch 'master' of https://github.com/highfidelity/hifi into deference

Andrzej Kapolka committed 12 years ago

Commit 08fda3b2 parents e356b06 76f78e723 files · +184 −97Browse files

Unified · Split

23 files
  1. domain-server/resources/web/settings/describe.json +1 −1
  2. examples/ControlledAC.js +10 −2
  3. examples/Recorder.js +10 −3
  4. examples/editVoxels.js +1 −1
  5. examples/headMove.js +44 −21
  6. interface/src/Application.cpp +4 −5
  7. interface/src/avatar/Avatar.cpp +6 −0
  8. interface/src/avatar/Avatar.h +2 −0
  9. interface/src/avatar/Head.cpp +16 −6
  10. interface/src/avatar/Head.h +1 −0
  11. interface/src/ui/DataWebDialog.cpp +8 −0
  12. interface/src/ui/OAuthWebViewHandler.cpp +1 −1
  13. libraries/audio/src/AudioFilter.h +2 −0
  14. libraries/audio/src/AudioSourceTone.cpp +2 −2
  15. libraries/avatars/src/AvatarData.cpp +24 −0
  16. libraries/avatars/src/AvatarData.h +4 −0
  17. libraries/avatars/src/Player.cpp +11 −12
  18. libraries/avatars/src/Player.h +2 −2
  19. libraries/avatars/src/Recorder.cpp +1 −1
  20. libraries/avatars/src/Recorder.h +1 −1
  21. libraries/avatars/src/Recording.cpp +17 −25
  22. libraries/avatars/src/Recording.h +15 −13
  23. libraries/fbx/src/FBXReader.cpp +1 −1
domain-server/resources/web/settings/describe.json+1−1
@@ -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": true70 "default": false
71 }71 }
72 }72 }
73 }73 }
examples/ControlledAC.js+10−2
@@ -12,6 +12,10 @@ · 11 unmodified lines
12// Set the following variables to the values needed12// Set the following variables to the values needed
13var filename = "http://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/bartender.rec";13var filename = "http://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/bartender.rec";
14var playFromCurrentLocation = true;14var playFromCurrentLocation = true;
15var useDisplayName = true;
16var useAttachments = true;
17var useHeadModel = true;
18var 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.
17var id = 0;21var id = 0;
@@ -44,11 +48,15 @@ COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 }; · 26 unmodified lines
44COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };48COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
45 49
46controlVoxelPosition.x += id * controlVoxelSize;50controlVoxelPosition.x += id * controlVoxelSize;
47
48Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
49 51
50Avatar.loadRecording(filename);52Avatar.loadRecording(filename);
51 53
54Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
55Avatar.setPlayerUseDisplayName(useDisplayName);
56Avatar.setPlayerUseAttachments(useAttachments);
57Avatar.setPlayerUseHeadModel(useHeadModel);
58Avatar.setPlayerUseSkeletonModel(useSkeletonModel);
59
52function setupVoxelViewer() {60function 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));
examples/Recorder.js+10−3
@@ -12,7 +12,14 @@ · 11 unmodified lines
12Script.include("toolBars.js");12Script.include("toolBars.js");
13 13
14var recordingFile = "recording.rec";14var recordingFile = "recording.rec";
15var playFromCurrentLocation = true;15
16function setPlayerOptions() {
17 MyAvatar.setPlayFromCurrentLocation(true);
18 MyAvatar.setPlayerUseDisplayName(false);
19 MyAvatar.setPlayerUseAttachments(false);
20 MyAvatar.setPlayerUseHeadModel(false);
21 MyAvatar.setPlayerUseSkeletonModel(false);
22}
16 23
17var windowDimensions = Controller.getViewportDimensions();24var windowDimensions = Controller.getViewportDimensions();
18var TOOL_ICON_URL = "http://s3-us-west-1.amazonaws.com/highfidelity-public/images/tools/";25var 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);
examples/editVoxels.js+1−1
@@ -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 avatar1114 // 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 = {
examples/headMove.js+44−21
@@ -16,24 +16,21 @@ var debug = false; · 15 unmodified lines
16var movingWithHead = false; 16var movingWithHead = false;
17var headStartPosition, headStartDeltaPitch, headStartFinalPitch, headStartRoll, headStartYaw;17var headStartPosition, headStartDeltaPitch, headStartFinalPitch, headStartRoll, headStartYaw;
18 18
19var HEAD_MOVE_DEAD_ZONE = 0.10;19var HEAD_MOVE_DEAD_ZONE = 0.05;
20var HEAD_STRAFE_DEAD_ZONE = 0.0;20var HEAD_STRAFE_DEAD_ZONE = 0.03;
21var HEAD_ROTATE_DEAD_ZONE = 0.0; 21var HEAD_ROTATE_DEAD_ZONE = 10.0;
22//var HEAD_THRUST_FWD_SCALE = 12000.0;22var HEAD_YAW_RATE = 1.5;
23//var HEAD_THRUST_STRAFE_SCALE = 0.0;
24var HEAD_YAW_RATE = 1.0;
25var HEAD_PITCH_RATE = 1.0;23var HEAD_PITCH_RATE = 1.0;
26//var HEAD_ROLL_THRUST_SCALE = 75.0;24var WALL_BOUNCE = 10000.0;
27//var HEAD_PITCH_LIFT_THRUST = 3.0;25var FIXED_WALK_VELOCITY = 1.5;
28var 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.
33var HEAD_VELOCITY_FWD_FACTOR = 20.0;30var HEAD_VELOCITY_FWD_FACTOR = 10.0;
34var HEAD_VELOCITY_LEFT_FACTOR = 20.0;31var HEAD_VELOCITY_LEFT_FACTOR = 0.0;
35var HEAD_VELOCITY_UP_FACTOR = 20.0;32var HEAD_VELOCITY_UP_FACTOR = 20.0;
36var SHORT_TIMESCALE = 0.125;33var SHORT_TIMESCALE = 0.01;
37var VERY_LARGE_TIMESCALE = 1000000.0;34var VERY_LARGE_TIMESCALE = 1000000.0;
38 35
39var xAxis = {x:1.0, y:0.0, z:0.0 };36var 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
44var maxVelocity = 1.25;41var maxVelocity = 1.25;
45var noFly = true; 42var noFly = true;
43var 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 };
48var roomLimits = { xMin: -1, xMax: 0, zMin: 0, zMax: 0 };46var roomLimits = { xMin: 193.0, xMax: 206.5, zMin: 251.4, zMax: 269.5 };
49 47
50function isInRoom(position) {48function 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 motion77 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-side90 // 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 pitch115 // 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 code144 // 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
130Controller.keyPressEvent.connect(function(event) {152Controller.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();
interface/src/Application.cpp+4−5
@@ -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 running227 // 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_RTMIDI427#ifdef HAVE_RTMIDI
interface/src/avatar/Avatar.cpp+6−0
@@ -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
100glm::vec3 Avatar::getNeckPosition() const {
101 glm::vec3 neckPosition;
102 return _skeletonModel.getNeckPosition(neckPosition) ? neckPosition : _position;
103}
104
105
100glm::quat Avatar::getWorldAlignedOrientation () const {106glm::quat Avatar::getWorldAlignedOrientation () const {
101 return computeRotationFromBodyToWorldUp() * getOrientation();107 return computeRotationFromBodyToWorldUp() * getOrientation();
102}108}
interface/src/avatar/Avatar.h+2−0
@@ -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; }
interface/src/avatar/Head.cpp+16−6
@@ -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
64void Head::simulate(float deltaTime, bool isMine, bool billboard) {65void Head::simulate(float deltaTime, bool isMine, bool billboard) {
65 // Update audio trailing average for rendering facial animations66
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 saccades96 // 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 delay109 // 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) {
interface/src/avatar/Head.h+1−0
@@ -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;
interface/src/ui/DataWebDialog.cpp+8−0
@@ -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
20DataWebDialog::DataWebDialog() {22DataWebDialog::DataWebDialog() {
@@ -23,6 +25,12 @@ DataWebDialog::DataWebDialog() { · 2 unmodified lines
23 25
24 // use an OAuthNetworkAccessManager instead of regular QNetworkAccessManager so our requests are authed26 // 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
28DataWebDialog* DataWebDialog::dialogForPath(const QString& path) {36DataWebDialog* DataWebDialog::dialogForPath(const QString& path) {
interface/src/ui/OAuthWebViewHandler.cpp+1−1
@@ -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
33const char HIGH_FIDELITY_CA[] = "-----BEGIN CERTIFICATE-----\n"33const char HIGH_FIDELITY_CA[] = "-----BEGIN CERTIFICATE-----\n"
libraries/audio/src/AudioFilter.h+2−0
@@ -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 line80 // update delay line
79 _xm2 = _xm1;81 _xm2 = _xm1;
80 _xm1 = x;82 _xm1 = x;
libraries/audio/src/AudioSourceTone.cpp+2−2
@@ -40,8 +40,8 @@ void AudioSourceTone::updateCoefficients() { · 39 unmodified lines
40 40
41void AudioSourceTone::initialize() {41void 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
47void AudioSourceTone::setParameters(const float32_t sampleRate, const float32_t frequency, const float32_t amplitude) {47void AudioSourceTone::setParameters(const float32_t sampleRate, const float32_t frequency, const float32_t amplitude) {
libraries/avatars/src/AvatarData.cpp+24−0
@@ -661,6 +661,30 @@ void AvatarData::setPlayerLoop(bool loop) { · 660 unmodified lines
661 }661 }
662}662}
663 663
664void AvatarData::setPlayerUseDisplayName(bool useDisplayName) {
665 if(_player) {
666 _player->useDisplayName(useDisplayName);
667 }
668}
669
670void AvatarData::setPlayerUseAttachments(bool useAttachments) {
671 if(_player) {
672 _player->useAttachements(useAttachments);
673 }
674}
675
676void AvatarData::setPlayerUseHeadModel(bool useHeadModel) {
677 if(_player) {
678 _player->useHeadModel(useHeadModel);
679 }
680}
681
682void AvatarData::setPlayerUseSkeletonModel(bool useSkeletonModel) {
683 if(_player) {
684 _player->useSkeletonModel(useSkeletonModel);
685 }
686}
687
664void AvatarData::play() {688void AvatarData::play() {
665 if (isPlaying()) {689 if (isPlaying()) {
666 if (QThread::currentThread() != thread()) {690 if (QThread::currentThread() != thread()) {
libraries/avatars/src/AvatarData.h+4−0
@@ -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
libraries/avatars/src/Player.cpp+11−12
@@ -17,15 +17,15 @@ · 16 unmodified lines
17#include "Player.h"17#include "Player.h"
18 18
19Player::Player(AvatarData* avatar) :19Player::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
163void Player::loadFromFile(QString file) {162void 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 }
libraries/avatars/src/Player.h+2−2
@@ -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:37public 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
libraries/avatars/src/Recorder.cpp+1−1
@@ -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
89void Recorder::saveToFile(QString file) {89void 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 }
libraries/avatars/src/Recorder.h+1−1
@@ -38,7 +38,7 @@ public: · 37 unmodified lines
38public slots:38public 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
libraries/avatars/src/Recording.cpp+17−25
@@ -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
77void Recording::addAudioPacket(QByteArray byteArray) {76void 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
92void writeVec3(QDataStream& stream, glm::vec3 value) {91void 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
105void writeQuat(QDataStream& stream, glm::quat value) {104void 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
139void writeRecordingToFile(RecordingPointer recording, QString filename) {138void 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-16332 // 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 checksum334 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
380RecordingPointer readRecordingFromFile(RecordingPointer recording, QString filename) {379RecordingPointer 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
644RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString filename, QByteArray byteArray) {639RecordingPointer 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 filename783 // 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 format794 // 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}
libraries/avatars/src/Recording.h+15−13
@@ -62,7 +62,7 @@ public: · 61 unmodified lines
62 62
63protected:63protected:
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
68private:68private:
@@ -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 frame83/// Stores the different values associated to one recording frame
@@ -95,13 +96,13 @@ public: · 12 unmodified lines
95protected:96protected:
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
106private:107private:
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
123void writeRecordingToFile(RecordingPointer recording, QString filename);125void writeRecordingToFile(RecordingPointer recording, const QString& filename);
124RecordingPointer readRecordingFromFile(RecordingPointer recording, QString filename);126RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString& filename);
125RecordingPointer readRecordingFromRecFile(RecordingPointer recording, QString filename, QByteArray byteArray);127RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QString& filename, const QByteArray& byteArray);
126 128
127#endif // hifi_Recording_h129#endif // hifi_Recording_h
libraries/fbx/src/FBXReader.cpp+1−1
@@ -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 lowest1773 // 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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t