merge from upstream

This commit is contained in:
Seth Alves 2017-06-01 10:10:11 -07:00
commit eb94c48c5b
14 changed files with 34 additions and 23 deletions

View file

@ -410,6 +410,7 @@ void Agent::executeScript() {
bool openedInLastBlock = !_audioGateOpen && audioGateOpen; // the gate just opened bool openedInLastBlock = !_audioGateOpen && audioGateOpen; // the gate just opened
bool closedInLastBlock = _audioGateOpen && !audioGateOpen; // the gate just closed bool closedInLastBlock = _audioGateOpen && !audioGateOpen; // the gate just closed
_audioGateOpen = audioGateOpen; _audioGateOpen = audioGateOpen;
Q_UNUSED(openedInLastBlock);
// the codec must be flushed to silence before sending silent packets, // the codec must be flushed to silence before sending silent packets,
// so delay the transition to silent packets by one packet after becoming silent. // so delay the transition to silent packets by one packet after becoming silent.

View file

@ -3992,7 +3992,7 @@ void Application::updateMyAvatarLookAtPosition() {
// I am not looking at anyone else, so just look forward // I am not looking at anyone else, so just look forward
if (isHMD) { if (isHMD) {
glm::mat4 worldHMDMat = myAvatar->getSensorToWorldMatrix() * glm::mat4 worldHMDMat = myAvatar->getSensorToWorldMatrix() *
(glm::mat4)myAvatar->getHeadControllerPoseInSensorFrame() * Matrices::Y_180; myAvatar->getHeadControllerPoseInSensorFrame().getMatrix() * Matrices::Y_180;
lookAtSpot = transformPoint(worldHMDMat, glm::vec3(0.0f, 0.0f, -TREE_SCALE)); lookAtSpot = transformPoint(worldHMDMat, glm::vec3(0.0f, 0.0f, -TREE_SCALE));
} else { } else {
lookAtSpot = myAvatar->getHead()->getEyePosition() + lookAtSpot = myAvatar->getHead()->getEyePosition() +

View file

@ -1885,7 +1885,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
getHead()->setBasePitch(getHead()->getBasePitch() + getDriveKey(PITCH) * _pitchSpeed * deltaTime); getHead()->setBasePitch(getHead()->getBasePitch() + getDriveKey(PITCH) * _pitchSpeed * deltaTime);
if (qApp->isHeadControllerEnabled()) { if (qApp->isHeadControllerEnabled()) {
glm::quat localOrientation = getHeadControllerPoseInAvatarFrame(); glm::quat localOrientation = getHeadControllerPoseInAvatarFrame().rotation;
// these angles will be in radians // these angles will be in radians
// ... so they need to be converted to degrees before we do math... // ... so they need to be converted to degrees before we do math...
glm::vec3 euler = glm::eulerAngles(localOrientation) * DEGREES_PER_RADIAN; glm::vec3 euler = glm::eulerAngles(localOrientation) * DEGREES_PER_RADIAN;
@ -2328,8 +2328,8 @@ glm::quat MyAvatar::getWorldBodyOrientation() const {
glm::mat4 MyAvatar::deriveBodyFromHMDSensor() const { glm::mat4 MyAvatar::deriveBodyFromHMDSensor() const {
// HMD is in sensor space. // HMD is in sensor space.
const glm::vec3 headPosition = getHeadControllerPoseInSensorFrame(); const glm::vec3 headPosition = getHeadControllerPoseInSensorFrame().translation;
const glm::quat headOrientation = (glm::quat)getHeadControllerPoseInSensorFrame() * Quaternions::Y_180; const glm::quat headOrientation = getHeadControllerPoseInSensorFrame().rotation * Quaternions::Y_180;
const glm::quat headOrientationYawOnly = cancelOutRollAndPitch(headOrientation); const glm::quat headOrientationYawOnly = cancelOutRollAndPitch(headOrientation);
const Rig& rig = _skeletonModel->getRig(); const Rig& rig = _skeletonModel->getRig();
@ -2765,7 +2765,7 @@ glm::mat4 MyAvatar::getLeftFootCalibrationMat() const {
auto leftFootRot = getAbsoluteDefaultJointRotationInObjectFrame(leftFootIndex); auto leftFootRot = getAbsoluteDefaultJointRotationInObjectFrame(leftFootIndex);
return createMatFromQuatAndPos(leftFootRot, leftFootPos); return createMatFromQuatAndPos(leftFootRot, leftFootPos);
} else { } else {
return createMatFromQuatAndPos(DEFAULT_AVATAR_LEFTFOOT_POS, DEFAULT_AVATAR_LEFTFOOT_POS); return createMatFromQuatAndPos(DEFAULT_AVATAR_LEFTFOOT_ROT, DEFAULT_AVATAR_LEFTFOOT_POS);
} }
} }
@ -2777,7 +2777,7 @@ glm::mat4 MyAvatar::getRightFootCalibrationMat() const {
auto rightFootRot = getAbsoluteDefaultJointRotationInObjectFrame(rightFootIndex); auto rightFootRot = getAbsoluteDefaultJointRotationInObjectFrame(rightFootIndex);
return createMatFromQuatAndPos(rightFootRot, rightFootPos); return createMatFromQuatAndPos(rightFootRot, rightFootPos);
} else { } else {
return createMatFromQuatAndPos(DEFAULT_AVATAR_RIGHTFOOT_POS, DEFAULT_AVATAR_RIGHTFOOT_POS); return createMatFromQuatAndPos(DEFAULT_AVATAR_RIGHTFOOT_ROT, DEFAULT_AVATAR_RIGHTFOOT_POS);
} }
} }
@ -2800,7 +2800,7 @@ glm::mat4 MyAvatar::getLeftArmCalibrationMat() const {
auto leftArmRot = getAbsoluteDefaultJointRotationInObjectFrame(leftArmIndex); auto leftArmRot = getAbsoluteDefaultJointRotationInObjectFrame(leftArmIndex);
return createMatFromQuatAndPos(leftArmRot, leftArmPos); return createMatFromQuatAndPos(leftArmRot, leftArmPos);
} else { } else {
return createMatFromQuatAndPos(DEFAULT_AVATAR_LEFTARM_ROT, DEFAULT_AVATAR_RIGHTARM_POS); return createMatFromQuatAndPos(DEFAULT_AVATAR_LEFTARM_ROT, DEFAULT_AVATAR_LEFTARM_POS);
} }
} }

View file

@ -850,7 +850,10 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
glm::quat sensorToWorldQuat; glm::quat sensorToWorldQuat;
unpackOrientationQuatFromSixBytes(data->sensorToWorldQuat, sensorToWorldQuat); unpackOrientationQuatFromSixBytes(data->sensorToWorldQuat, sensorToWorldQuat);
float sensorToWorldScale; float sensorToWorldScale;
unpackFloatScalarFromSignedTwoByteFixed((int16_t*)&data->sensorToWorldScale, &sensorToWorldScale, SENSOR_TO_WORLD_SCALE_RADIX); // Grab a local copy of sensorToWorldScale to be able to use the unpack function with a pointer on it,
// a direct pointer on the struct attribute triggers warnings because of potential misalignement.
auto srcSensorToWorldScale = data->sensorToWorldScale;
unpackFloatScalarFromSignedTwoByteFixed((int16_t*)&srcSensorToWorldScale, &sensorToWorldScale, SENSOR_TO_WORLD_SCALE_RADIX);
glm::vec3 sensorToWorldTrans(data->sensorToWorldTrans[0], data->sensorToWorldTrans[1], data->sensorToWorldTrans[2]); glm::vec3 sensorToWorldTrans(data->sensorToWorldTrans[0], data->sensorToWorldTrans[1], data->sensorToWorldTrans[2]);
glm::mat4 sensorToWorldMatrix = createMatFromScaleQuatAndPos(glm::vec3(sensorToWorldScale), sensorToWorldQuat, sensorToWorldTrans); glm::mat4 sensorToWorldMatrix = createMatFromScaleQuatAndPos(glm::vec3(sensorToWorldScale), sensorToWorldQuat, sensorToWorldTrans);
if (_sensorToWorldMatrixCache.get() != sensorToWorldMatrix) { if (_sensorToWorldMatrixCache.get() != sensorToWorldMatrix) {

View file

@ -39,14 +39,11 @@ namespace controller {
quat getRotation() const { return rotation; } quat getRotation() const { return rotation; }
vec3 getVelocity() const { return velocity; } vec3 getVelocity() const { return velocity; }
vec3 getAngularVelocity() const { return angularVelocity; } vec3 getAngularVelocity() const { return angularVelocity; }
mat4 getMatrix() const { return createMatFromQuatAndPos(rotation, translation); }
Pose transform(const glm::mat4& mat) const; Pose transform(const glm::mat4& mat) const;
Pose postTransform(const glm::mat4& mat) const; Pose postTransform(const glm::mat4& mat) const;
operator glm::mat4() const { return createMatFromQuatAndPos(rotation, translation); }
operator glm::quat() const { return rotation; }
operator glm::vec3() const { return translation; }
static QScriptValue toScriptValue(QScriptEngine* engine, const Pose& event); static QScriptValue toScriptValue(QScriptEngine* engine, const Pose& event);
static void fromScriptValue(const QScriptValue& object, Pose& event); static void fromScriptValue(const QScriptValue& object, Pose& event);
}; };

View file

@ -21,9 +21,9 @@ namespace controller {
LowVelocityFilter(float rotationConstant, float translationConstant) : LowVelocityFilter(float rotationConstant, float translationConstant) :
_translationConstant(translationConstant), _rotationConstant(rotationConstant) {} _translationConstant(translationConstant), _rotationConstant(rotationConstant) {}
virtual float apply(float value) const override { return value; } float apply(float value) const override { return value; }
virtual Pose apply(Pose newPose) const override; Pose apply(Pose newPose) const override;
virtual bool parseParameters(const QJsonValue& parameters) override; bool parseParameters(const QJsonValue& parameters) override;
private: private:
float _translationConstant { 0.1f }; float _translationConstant { 0.1f };

View file

@ -192,7 +192,7 @@ void EntityTreeRenderer::update() {
tree->update(); tree->update();
// Handle enter/leave entity logic // Handle enter/leave entity logic
bool updated = checkEnterLeaveEntities(); checkEnterLeaveEntities();
// Even if we're not moving the mouse, if we started clicking on an entity and we have // Even if we're not moving the mouse, if we started clicking on an entity and we have
// not yet released the hold then this is still considered a holdingClickOnEntity event // not yet released the hold then this is still considered a holdingClickOnEntity event

View file

@ -367,7 +367,6 @@ void RenderableZoneEntityItem::sceneUpdateRenderItemFromEntity(render::Transacti
bool sunChanged = _keyLightPropertiesChanged; bool sunChanged = _keyLightPropertiesChanged;
bool backgroundChanged = _backgroundPropertiesChanged; bool backgroundChanged = _backgroundPropertiesChanged;
bool stageChanged = _stagePropertiesChanged;
bool skyboxChanged = _skyboxPropertiesChanged; bool skyboxChanged = _skyboxPropertiesChanged;
transaction.updateItem<RenderableZoneEntityItemMeta>(_myMetaItem, [=](RenderableZoneEntityItemMeta& data) { transaction.updateItem<RenderableZoneEntityItemMeta>(_myMetaItem, [=](RenderableZoneEntityItemMeta& data) {

View file

@ -211,6 +211,7 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
break; break;
case gpu::NUINT32: case gpu::NUINT32:
case gpu::NINT32: case gpu::NINT32:
case gpu::COMPRESSED:
case gpu::NUM_TYPES: // quiet compiler case gpu::NUM_TYPES: // quiet compiler
Q_UNREACHABLE(); Q_UNREACHABLE();
} }
@ -484,6 +485,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
texel.internalFormat = GL_R8_SNORM; texel.internalFormat = GL_R8_SNORM;
break; break;
} }
case gpu::COMPRESSED:
case gpu::NUM_TYPES: { // quiet compiler case gpu::NUM_TYPES: { // quiet compiler
Q_UNREACHABLE(); Q_UNREACHABLE();
} }
@ -527,6 +529,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
texel.internalFormat = GL_DEPTH_COMPONENT24; texel.internalFormat = GL_DEPTH_COMPONENT24;
break; break;
} }
case gpu::COMPRESSED:
case gpu::NUM_TYPES: { // quiet compiler case gpu::NUM_TYPES: { // quiet compiler
Q_UNREACHABLE(); Q_UNREACHABLE();
} }
@ -641,6 +644,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
break; break;
case gpu::NUINT32: case gpu::NUINT32:
case gpu::NINT32: case gpu::NINT32:
case gpu::COMPRESSED:
case gpu::NUM_TYPES: // quiet compiler case gpu::NUM_TYPES: // quiet compiler
Q_UNREACHABLE(); Q_UNREACHABLE();
} }

View file

@ -229,7 +229,7 @@ namespace ktx {
} else { } else {
Image::FaceBytes faceBytes(NUM_CUBEMAPFACES); Image::FaceBytes faceBytes(NUM_CUBEMAPFACES);
auto faceSize = srcImages[l]._faceSize; auto faceSize = srcImages[l]._faceSize;
for (int face = 0; face < NUM_CUBEMAPFACES; face++) { for (uint32_t face = 0; face < NUM_CUBEMAPFACES; face++) {
memcpy(currentPtr, srcImages[l]._faceBytes[face], faceSize); memcpy(currentPtr, srcImages[l]._faceBytes[face], faceSize);
faceBytes[face] = currentPtr; faceBytes[face] = currentPtr;
currentPtr += faceSize; currentPtr += faceSize;

View file

@ -112,7 +112,6 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
skybox->render(batch, args->getViewFrustum()); skybox->render(batch, args->getViewFrustum());
}); });
args->_batch = nullptr; args->_batch = nullptr;
gpu::Batch& batch = *args->_batch;
// break; // break;
} }

View file

@ -169,7 +169,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
batch.setUniformBuffer(ZONE_DEFERRED_TRANSFORM_BUFFER, deferredTransform->getFrameTransformBuffer()); batch.setUniformBuffer(ZONE_DEFERRED_TRANSFORM_BUFFER, deferredTransform->getFrameTransformBuffer());
batch.setPipeline(getKeyLightPipeline()); batch.setPipeline(getKeyLightPipeline());
auto numKeys = keyLightStack.size(); auto numKeys = (int) keyLightStack.size();
for (int i = numKeys - 1; i >= 0; i--) { for (int i = numKeys - 1; i >= 0; i--) {
model.setTranslation(glm::vec3(-4.0, -3.0 + (i * 1.0), -10.0 - (i * 3.0))); model.setTranslation(glm::vec3(-4.0, -3.0 + (i * 1.0), -10.0 - (i * 3.0)));
batch.setModelTransform(model); batch.setModelTransform(model);
@ -180,7 +180,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
} }
batch.setPipeline(getAmbientPipeline()); batch.setPipeline(getAmbientPipeline());
auto numAmbients = ambientLightStack.size(); auto numAmbients = (int) ambientLightStack.size();
for (int i = numAmbients - 1; i >= 0; i--) { for (int i = numAmbients - 1; i >= 0; i--) {
model.setTranslation(glm::vec3(0.0, -3.0 + (i * 1.0), -10.0 - (i * 3.0))); model.setTranslation(glm::vec3(0.0, -3.0 + (i * 1.0), -10.0 - (i * 3.0)));
batch.setModelTransform(model); batch.setModelTransform(model);
@ -194,7 +194,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
} }
batch.setPipeline(getBackgroundPipeline()); batch.setPipeline(getBackgroundPipeline());
auto numBackgrounds = skyboxStack.size(); auto numBackgrounds = (int) skyboxStack.size();
for (int i = numBackgrounds - 1; i >= 0; i--) { for (int i = numBackgrounds - 1; i >= 0; i--) {
model.setTranslation(glm::vec3(4.0, -3.0 + (i * 1.0), -10.0 - (i * 3.0))); model.setTranslation(glm::vec3(4.0, -3.0 + (i * 1.0), -10.0 - (i * 3.0)));
batch.setModelTransform(model); batch.setModelTransform(model);

View file

@ -24,7 +24,7 @@
#include <gl/QOpenGLContextWrapper.h> #include <gl/QOpenGLContextWrapper.h>
#include <PerfStat.h> #include <PerfStat.h>
#include <ViewFrustum.h> #include <ViewFrustum.h>
#include <gpu/gl/GLbackend.h> #include <gpu/gl/GLBackend.h>
#include <ui-plugins/PluginContainer.h> #include <ui-plugins/PluginContainer.h>

View file

@ -122,6 +122,10 @@ int main(int argc, char** argv) {
glm::mat4(), glm::mat4(),
glm::mat4(), glm::mat4(),
glm::mat4(), glm::mat4(),
glm::mat4(),
glm::mat4(),
glm::mat4(),
glm::mat4(),
glm::mat4() glm::mat4()
}; };
@ -144,6 +148,10 @@ int main(int argc, char** argv) {
glm::mat4(), glm::mat4(),
glm::mat4(), glm::mat4(),
glm::mat4(), glm::mat4(),
glm::mat4(),
glm::mat4(),
glm::mat4(),
glm::mat4(),
glm::mat4() glm::mat4()
}; };