merge with upstream/master

This commit is contained in:
Philip Rosedale 2014-03-14 14:35:48 -07:00
commit 85cc04f172
18 changed files with 72 additions and 62 deletions

View file

@ -74,7 +74,7 @@ function checkCamera(deltaTime) {
if (yaw < -360) {
yaw += 360;
}
var orientation = Quat.fromPitchYawRoll(pitch, yaw, roll);
var orientation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll);
Camera.setOrientation(orientation);
}
}

View file

@ -14,10 +14,10 @@ var cumulativeTime = 0.0;
Script.update.connect(function(deltaTime) {
cumulativeTime += deltaTime;
MyAvatar.setJointData("joint_R_hip", Quat.fromPitchYawRoll(0.0, 0.0, AMPLITUDE * Math.sin(cumulativeTime * FREQUENCY)));
MyAvatar.setJointData("joint_L_hip", Quat.fromPitchYawRoll(0.0, 0.0, -AMPLITUDE * Math.sin(cumulativeTime * FREQUENCY)));
MyAvatar.setJointData("joint_R_knee", Quat.fromPitchYawRoll(0.0, 0.0,
MyAvatar.setJointData("joint_R_hip", Quat.fromPitchYawRollDegrees(0.0, 0.0, AMPLITUDE * Math.sin(cumulativeTime * FREQUENCY)));
MyAvatar.setJointData("joint_L_hip", Quat.fromPitchYawRollDegrees(0.0, 0.0, -AMPLITUDE * Math.sin(cumulativeTime * FREQUENCY)));
MyAvatar.setJointData("joint_R_knee", Quat.fromPitchYawRollDegrees(0.0, 0.0,
AMPLITUDE * (1.0 + Math.sin(cumulativeTime * FREQUENCY))));
MyAvatar.setJointData("joint_L_knee", Quat.fromPitchYawRoll(0.0, 0.0,
MyAvatar.setJointData("joint_L_knee", Quat.fromPitchYawRollDegrees(0.0, 0.0,
AMPLITUDE * (1.0 - Math.sin(cumulativeTime * FREQUENCY))));
});

View file

@ -152,7 +152,7 @@ function update(deltaTime) {
// Check for mouseLook movement, update rotation
// rotate body yaw for yaw received from mouse
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3( { x: 0, y: yawFromMouse, z: 0 } ));
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3Radians( { x: 0, y: yawFromMouse, z: 0 } ));
MyAvatar.orientation = newOrientation;
yawFromMouse = 0;

View file

@ -184,7 +184,7 @@ function flyWithHydra(deltaTime) {
// change the body yaw based on our x controller
var orientation = MyAvatar.orientation;
var deltaOrientation = Quat.fromPitchYawRoll(0, (-1 * viewJoystickPosition.x * JOYSTICK_YAW_MAG * deltaTime), 0);
var deltaOrientation = Quat.fromPitchYawRollDegrees(0, (-1 * viewJoystickPosition.x * JOYSTICK_YAW_MAG * deltaTime), 0);
MyAvatar.orientation = Quat.multiply(orientation, deltaOrientation);
// change the headPitch based on our x controller

View file

@ -54,7 +54,7 @@ function update(deltaTime) {
print("update()...");
}
// rotate body yaw for yaw received from mouse
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3( { x: 0, y: yawFromMouse, z: 0 } ));
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3Radians( { x: 0, y: yawFromMouse, z: 0 } ));
if (wantDebugging) {
print("changing orientation"
+ " [old]MyAvatar.orientation="+MyAvatar.orientation.x + "," + MyAvatar.orientation.y + ","

View file

@ -45,7 +45,7 @@ function touchUpdateEvent(event) {
function update(deltaTime) {
// rotate body yaw for yaw received from mouse
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3( { x: 0, y: yawFromMouse, z: 0 } ));
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollRadians(0, yawFromMouse, 0));
if (wantDebugging) {
print("changing orientation"
+ " [old]MyAvatar.orientation="+MyAvatar.orientation.x + "," + MyAvatar.orientation.y + ","

View file

@ -92,7 +92,7 @@ Controller.touchEndEvent.connect(touchEndEvent);
function update(deltaTime) {
// rotate body yaw for yaw received from multitouch rotate
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3( { x: 0, y: yawFromMultiTouch, z: 0 } ));
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromVec3Radians( { x: 0, y: yawFromMultiTouch, z: 0 } ));
if (wantDebugging) {
print("changing orientation"
+ " [old]MyAvatar.orientation="+MyAvatar.orientation.x + "," + MyAvatar.orientation.y + ","

View file

@ -17,7 +17,7 @@ var yawMin = 20;
var isLocal = false;
// set up our VoxelViewer with a position and orientation
var orientation = Quat.fromPitchYawRoll(0, yaw, 0);
var orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0);
function init() {
if (isLocal) {
@ -40,7 +40,7 @@ function keepLooking(deltaTime) {
count++;
if (count % 10 == 0) {
yaw += yawDirection;
orientation = Quat.fromPitchYawRoll(0, yaw, 0);
orientation = Quat.fromPitchYawRollDegrees(0, yaw, 0);
if (yaw > yawMax || yaw < yawMin) {
yawDirection = yawDirection * -1;
}

View file

@ -4,22 +4,22 @@
<context>
<name>Application</name>
<message>
<location filename="src/Application.cpp" line="1362"/>
<location filename="src/Application.cpp" line="1354"/>
<source>Export Voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="1363"/>
<location filename="src/Application.cpp" line="1355"/>
<source>Sparse Voxel Octree Files (*.svo)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="3573"/>
<location filename="src/Application.cpp" line="3565"/>
<source>Open Script</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="3574"/>
<location filename="src/Application.cpp" line="3566"/>
<source>JavaScript Files (*.js)</source>
<translation type="unfinished"></translation>
</message>
@ -45,7 +45,7 @@
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/>
<location filename="src/ui/ChatWindow.cpp" line="128"/>
<source>day</source>
<translation>
<numerusform>%n day</numerusform>
@ -53,7 +53,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/>
<location filename="src/ui/ChatWindow.cpp" line="128"/>
<source>hour</source>
<translation>
<numerusform>%n hour</numerusform>
@ -61,7 +61,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/>
<location filename="src/ui/ChatWindow.cpp" line="128"/>
<source>minute</source>
<translation>
<numerusform>%n minute</numerusform>
@ -76,7 +76,7 @@
</translation>
</message>
<message>
<location filename="src/ui/ChatWindow.cpp" line="179"/>
<location filename="src/ui/ChatWindow.cpp" line="183"/>
<source>%1 online now:</source>
<translation type="unfinished"></translation>
</message>

View file

@ -27,7 +27,6 @@
#include <QColorDialog>
#include <QDesktopWidget>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QImage>
#include <QKeyEvent>
#include <QMainWindow>
@ -292,14 +291,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
ResourceCache::setNetworkAccessManager(_networkAccessManager);
ResourceCache::setRequestLimit(3);
QWidget* centralWidget = new QWidget();
QHBoxLayout* mainLayout = new QHBoxLayout();
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0, 0, 0, 0);
centralWidget->setLayout(mainLayout);
_glWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
centralWidget->layout()->addWidget(_glWidget);
_window->setCentralWidget(centralWidget);
_window->setCentralWidget(_glWidget);
restoreSizeAndPosition();

View file

@ -1044,13 +1044,11 @@ void Menu::showMetavoxelEditor() {
void Menu::showChat() {
if (!_chatWindow) {
_chatWindow = new ChatWindow();
QMainWindow* mainWindow = Application::getInstance()->getWindow();
QBoxLayout* boxLayout = static_cast<QBoxLayout*>(mainWindow->centralWidget()->layout());
boxLayout->addWidget(_chatWindow, 0, Qt::AlignRight);
Application::getInstance()->getWindow()->addDockWidget(Qt::RightDockWidgetArea, _chatWindow = new ChatWindow());
} else {
if (!_chatWindow->isVisible()) {
_chatWindow->show();
if (!_chatWindow->toggleViewAction()->isChecked()) {
_chatWindow->toggleViewAction()->trigger();
}
}
}
@ -1058,8 +1056,8 @@ void Menu::showChat() {
void Menu::toggleChat() {
#ifdef HAVE_QXMPP
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
if (!_chatAction->isEnabled() && _chatWindow) {
_chatWindow->hide();
if (!_chatAction->isEnabled() && _chatWindow && _chatWindow->toggleViewAction()->isChecked()) {
_chatWindow->toggleViewAction()->trigger();
}
#endif
}

View file

@ -36,9 +36,9 @@ Head::Head(Avatar* owningAvatar) :
_leftEyeBlinkVelocity(0.0f),
_rightEyeBlinkVelocity(0.0f),
_timeWithoutTalking(0.0f),
_tweakedPitch(0.f),
_tweakedYaw(0.f),
_tweakedRoll(0.f),
_pitchTweak(0.f),
_yawTweak(0.f),
_rollTweak(0.f),
_isCameraMoving(false),
_faceModel(this)
{
@ -202,15 +202,15 @@ glm::vec3 Head::getScalePivot() const {
}
float Head::getTweakedYaw() const {
return glm::clamp(_yaw + _tweakedYaw, MIN_HEAD_YAW, MAX_HEAD_YAW);
return glm::clamp(_yaw + _yawTweak, MIN_HEAD_YAW, MAX_HEAD_YAW);
}
float Head::getTweakedPitch() const {
return glm::clamp(_pitch + _tweakedPitch, MIN_HEAD_PITCH, MAX_HEAD_PITCH);
return glm::clamp(_pitch + _pitchTweak, MIN_HEAD_PITCH, MAX_HEAD_PITCH);
}
float Head::getTweakedRoll() const {
return glm::clamp(_roll + _tweakedRoll, MIN_HEAD_ROLL, MAX_HEAD_ROLL);
return glm::clamp(_roll + _rollTweak, MIN_HEAD_ROLL, MAX_HEAD_ROLL);
}
void Head::applyCollision(CollisionInfo& collision) {

View file

@ -70,10 +70,15 @@ public:
/// Returns the point about which scaling occurs.
glm::vec3 getScalePivot() const;
void tweakPitch(float pitch) { _tweakedPitch = pitch; }
void tweakYaw(float yaw) { _tweakedYaw = yaw; }
void tweakRoll(float roll) { _tweakedRoll = roll; }
void setPitchTweak(float pitch) { _pitchTweak = pitch; }
float getPitchTweak() const { return _pitchTweak; }
void setYawTweak(float yaw) { _yawTweak = yaw; }
float getYawTweak() const { return _yawTweak; }
void setRollTweak(float roll) { _rollTweak = roll; }
float getRollTweak() const { return _rollTweak; }
virtual float getTweakedPitch() const;
virtual float getTweakedYaw() const;
virtual float getTweakedRoll() const;
@ -104,9 +109,9 @@ private:
float _timeWithoutTalking;
// tweaked angles affect the rendered head, but not the camera
float _tweakedPitch;
float _tweakedYaw;
float _tweakedRoll;
float _pitchTweak;
float _yawTweak;
float _rollTweak;
bool _isCameraMoving;
FaceModel _faceModel;

View file

@ -363,8 +363,9 @@ void MyAvatar::updateFromGyros(float deltaTime) {
// restore rotation, lean to neutral positions
const float RESTORE_PERIOD = 1.f; // seconds
float restorePercentage = glm::clamp(deltaTime/RESTORE_PERIOD, 0.f, 1.f);
head->setYaw(glm::mix(head->getYaw(), 0.0f, restorePercentage));
head->setRoll(glm::mix(head->getRoll(), 0.0f, restorePercentage));
head->setPitchTweak(glm::mix(head->getPitchTweak(), 0.0f, restorePercentage));
head->setYawTweak(glm::mix(head->getYawTweak(), 0.0f, restorePercentage));
head->setRollTweak(glm::mix(head->getRollTweak(), 0.0f, restorePercentage));
head->setLeanSideways(glm::mix(head->getLeanSideways(), 0.0f, restorePercentage));
head->setLeanForward(glm::mix(head->getLeanForward(), 0.0f, restorePercentage));
return;
@ -375,9 +376,9 @@ void MyAvatar::updateFromGyros(float deltaTime) {
const float AVATAR_HEAD_PITCH_MAGNIFY = 1.0f;
const float AVATAR_HEAD_YAW_MAGNIFY = 1.0f;
const float AVATAR_HEAD_ROLL_MAGNIFY = 1.0f;
head->tweakPitch(estimatedRotation.x * AVATAR_HEAD_PITCH_MAGNIFY);
head->tweakYaw(estimatedRotation.y * AVATAR_HEAD_YAW_MAGNIFY);
head->tweakRoll(estimatedRotation.z * AVATAR_HEAD_ROLL_MAGNIFY);
head->setPitchTweak(estimatedRotation.x * AVATAR_HEAD_PITCH_MAGNIFY);
head->setYawTweak(estimatedRotation.y * AVATAR_HEAD_YAW_MAGNIFY);
head->setRollTweak(estimatedRotation.z * AVATAR_HEAD_ROLL_MAGNIFY);
// Update torso lean distance based on accelerometer data
const float TORSO_LENGTH = 0.5f;

View file

@ -28,17 +28,21 @@ const int NUM_MESSAGES_TO_TIME_STAMP = 20;
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)");
ChatWindow::ChatWindow() :
QWidget(),
ui(new Ui::ChatWindow),
numMessagesAfterLastTimeStamp(0)
{
ui->setupUi(this);
QWidget* widget = new QWidget();
setWidget(widget);
ui->setupUi(widget);
FlowLayout* flowLayout = new FlowLayout(0, 4, 4);
ui->usersWidget->setLayout(flowLayout);
ui->messagePlainTextEdit->installEventFilter(this);
ui->closeButton->hide();
#ifdef HAVE_QXMPP
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
if (xmppClient.isConnected()) {

View file

@ -10,8 +10,8 @@
#define __interface__ChatWindow__
#include <QDateTime>
#include <QDockWidget>
#include <QTimer>
#include <QWidget>
#include <Application.h>
@ -26,7 +26,7 @@ namespace Ui {
class ChatWindow;
}
class ChatWindow : public QWidget {
class ChatWindow : public QDockWidget {
Q_OBJECT
public:

View file

@ -22,14 +22,22 @@ glm::quat Quat::multiply(const glm::quat& q1, const glm::quat& q2) {
return q1 * q2;
}
glm::quat Quat::fromVec3(const glm::vec3& eulerAngles) {
glm::quat Quat::fromVec3Degrees(const glm::vec3& eulerAngles) {
return glm::quat(glm::radians(eulerAngles));
}
glm::quat Quat::fromPitchYawRoll(float pitch, float yaw, float roll) {
glm::quat Quat::fromVec3Radians(const glm::vec3& eulerAngles) {
return glm::quat(eulerAngles);
}
glm::quat Quat::fromPitchYawRollDegrees(float pitch, float yaw, float roll) {
return glm::quat(glm::radians(glm::vec3(pitch, yaw, roll)));
}
glm::quat Quat::fromPitchYawRollRadians(float pitch, float yaw, float roll) {
return glm::quat(glm::vec3(pitch, yaw, roll));
}
glm::quat Quat::inverse(const glm::quat& q) {
return glm::inverse(q);
}

View file

@ -23,8 +23,10 @@ class Quat : public QObject {
public slots:
glm::quat multiply(const glm::quat& q1, const glm::quat& q2);
glm::quat fromVec3(const glm::vec3& vec3);
glm::quat fromPitchYawRoll(float pitch, float yaw, float roll); // degrees
glm::quat fromVec3Degrees(const glm::vec3& vec3); // degrees
glm::quat fromVec3Radians(const glm::vec3& vec3); // radians
glm::quat fromPitchYawRollDegrees(float pitch, float yaw, float roll); // degrees
glm::quat fromPitchYawRollRadians(float pitch, float yaw, float roll); // radians
glm::quat inverse(const glm::quat& q);
glm::vec3 getFront(const glm::quat& orientation);
glm::vec3 getRight(const glm::quat& orientation);