From 237022d3042438ec462452039a187bf72fcbeb51 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Wed, 12 Sep 2018 10:56:19 -0700 Subject: [PATCH 001/157] Refactor new pick parenting system for use with RayPick, ParabolaPick --- interface/src/Application.cpp | 12 +- interface/src/raypick/CollisionPick.cpp | 2 +- interface/src/raypick/CollisionPick.h | 1 - interface/src/raypick/JointParabolaPick.cpp | 43 ----- interface/src/raypick/JointParabolaPick.h | 32 ---- interface/src/raypick/JointRayPick.cpp | 45 ----- interface/src/raypick/JointRayPick.h | 33 ---- interface/src/raypick/MouseParabolaPick.cpp | 28 --- interface/src/raypick/MouseParabolaPick.h | 24 --- interface/src/raypick/MouseRayPick.cpp | 29 --- interface/src/raypick/MouseRayPick.h | 26 --- interface/src/raypick/ParabolaPick.cpp | 49 +++-- interface/src/raypick/ParabolaPick.h | 14 +- .../src/raypick/PickScriptingInterface.cpp | 177 ++++++++++-------- .../src/raypick/PickScriptingInterface.h | 1 + interface/src/raypick/RayPick.cpp | 11 ++ interface/src/raypick/RayPick.h | 7 +- .../src/raypick/RayPickScriptingInterface.cpp | 4 - interface/src/raypick/StaticParabolaPick.cpp | 19 -- interface/src/raypick/StaticParabolaPick.h | 26 --- interface/src/raypick/StaticRayPick.cpp | 18 -- interface/src/raypick/StaticRayPick.h | 25 --- interface/src/raypick/StylusPick.h | 1 + libraries/pointers/src/Pick.h | 20 +- libraries/shared/src/RegisteredMetaTypes.h | 2 + 25 files changed, 185 insertions(+), 464 deletions(-) delete mode 100644 interface/src/raypick/JointParabolaPick.cpp delete mode 100644 interface/src/raypick/JointParabolaPick.h delete mode 100644 interface/src/raypick/JointRayPick.cpp delete mode 100644 interface/src/raypick/JointRayPick.h delete mode 100644 interface/src/raypick/MouseParabolaPick.cpp delete mode 100644 interface/src/raypick/MouseParabolaPick.h delete mode 100644 interface/src/raypick/MouseRayPick.cpp delete mode 100644 interface/src/raypick/MouseRayPick.h delete mode 100644 interface/src/raypick/StaticParabolaPick.cpp delete mode 100644 interface/src/raypick/StaticParabolaPick.h delete mode 100644 interface/src/raypick/StaticRayPick.cpp delete mode 100644 interface/src/raypick/StaticRayPick.h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e290531471..7f43c3d773 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -214,7 +214,8 @@ #include #include #include -#include +#include +#include #include @@ -2235,8 +2236,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo }); // Setup the mouse ray pick and related operators - DependencyManager::get()->setMouseRayPickID(DependencyManager::get()->addPick(PickQuery::Ray, std::make_shared( - PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true))); + { + auto mouseRayPick = std::make_shared(glm::vec3(), Vectors::UP, + PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true); + mouseRayPick->parentTransform = std::make_shared(); + auto mouseRayPickID = DependencyManager::get()->addPick(PickQuery::Ray, mouseRayPick); + DependencyManager::get()->setMouseRayPickID(mouseRayPickID); + } DependencyManager::get()->setMouseRayPickResultOperator([](unsigned int rayPickID) { RayToEntityIntersectionResult entityResult; entityResult.intersects = false; diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp index 9aee76a3da..f79879bf93 100644 --- a/interface/src/raypick/CollisionPick.cpp +++ b/interface/src/raypick/CollisionPick.cpp @@ -347,8 +347,8 @@ void CollisionPick::computeShapeInfo(const CollisionRegion& pick, ShapeInfo& sha CollisionPick::CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine) : Pick(filter, maxDistance, enabled), - _mathPick(collisionRegion), _physicsEngine(physicsEngine) { + _mathPick = collisionRegion; if (collisionRegion.shouldComputeShapeInfo()) { _cachedResource = DependencyManager::get()->getCollisionGeometryResource(collisionRegion.modelURL); } diff --git a/interface/src/raypick/CollisionPick.h b/interface/src/raypick/CollisionPick.h index 0662ab6c19..79238b37fc 100644 --- a/interface/src/raypick/CollisionPick.h +++ b/interface/src/raypick/CollisionPick.h @@ -67,7 +67,6 @@ protected: void computeShapeInfoDimensionsOnly(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource); void filterIntersections(std::vector& intersections) const; - CollisionRegion _mathPick; PhysicsEnginePointer _physicsEngine; QSharedPointer _cachedResource; diff --git a/interface/src/raypick/JointParabolaPick.cpp b/interface/src/raypick/JointParabolaPick.cpp deleted file mode 100644 index 11a2e90819..0000000000 --- a/interface/src/raypick/JointParabolaPick.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -// Created by Sam Gondelman 7/2/2018 -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "JointParabolaPick.h" - -#include "avatar/AvatarManager.h" - -JointParabolaPick::JointParabolaPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, - float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, bool scaleWithAvatar, PickFilter& filter, float maxDistance, bool enabled) : - ParabolaPick(speed, accelerationAxis, rotateAccelerationWithAvatar, scaleWithAvatar, filter, maxDistance, enabled), - _jointName(jointName), - _posOffset(posOffset), - _dirOffset(dirOffset) -{ -} - -PickParabola JointParabolaPick::getMathematicalPick() const { - auto myAvatar = DependencyManager::get()->getMyAvatar(); - int jointIndex = myAvatar->getJointIndex(QString::fromStdString(_jointName)); - bool useAvatarHead = _jointName == "Avatar"; - const int INVALID_JOINT = -1; - if (jointIndex != INVALID_JOINT || useAvatarHead) { - glm::vec3 jointPos = useAvatarHead ? myAvatar->getHeadPosition() : myAvatar->getAbsoluteJointTranslationInObjectFrame(jointIndex); - glm::quat jointRot = useAvatarHead ? myAvatar->getHeadOrientation() : myAvatar->getAbsoluteJointRotationInObjectFrame(jointIndex); - glm::vec3 avatarPos = myAvatar->getWorldPosition(); - glm::quat avatarRot = myAvatar->getWorldOrientation(); - - glm::vec3 pos = useAvatarHead ? jointPos : avatarPos + (avatarRot * jointPos); - glm::quat rot = useAvatarHead ? jointRot * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT) : avatarRot * jointRot; - - // Apply offset - pos = pos + (rot * (myAvatar->getSensorToWorldScale() * _posOffset)); - glm::vec3 dir = glm::normalize(rot * glm::normalize(_dirOffset)); - - return PickParabola(pos, getSpeed() * dir, getAcceleration()); - } - - return PickParabola(); -} diff --git a/interface/src/raypick/JointParabolaPick.h b/interface/src/raypick/JointParabolaPick.h deleted file mode 100644 index aff6bd34d8..0000000000 --- a/interface/src/raypick/JointParabolaPick.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by Sam Gondelman 7/2/2018 -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#ifndef hifi_JointParabolaPick_h -#define hifi_JointParabolaPick_h - -#include "ParabolaPick.h" - -class JointParabolaPick : public ParabolaPick { - -public: - JointParabolaPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, - float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, bool scaleWithAvatar, - PickFilter& filter, float maxDistance = 0.0f, bool enabled = false); - - PickParabola getMathematicalPick() const override; - - bool isLeftHand() const override { return (_jointName == "_CONTROLLER_LEFTHAND") || (_jointName == "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND"); } - bool isRightHand() const override { return (_jointName == "_CONTROLLER_RIGHTHAND") || (_jointName == "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND"); } - -private: - std::string _jointName; - glm::vec3 _posOffset; - glm::vec3 _dirOffset; - -}; - -#endif // hifi_JointParabolaPick_h diff --git a/interface/src/raypick/JointRayPick.cpp b/interface/src/raypick/JointRayPick.cpp deleted file mode 100644 index 340014e7d2..0000000000 --- a/interface/src/raypick/JointRayPick.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// JointRayPick.cpp -// interface/src/raypick -// -// Created by Sam Gondelman 7/11/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "JointRayPick.h" - -#include "avatar/AvatarManager.h" - -JointRayPick::JointRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const PickFilter& filter, float maxDistance, bool enabled) : - RayPick(filter, maxDistance, enabled), - _jointName(jointName), - _posOffset(posOffset), - _dirOffset(dirOffset) -{ -} - -PickRay JointRayPick::getMathematicalPick() const { - auto myAvatar = DependencyManager::get()->getMyAvatar(); - int jointIndex = myAvatar->getJointIndex(QString::fromStdString(_jointName)); - bool useAvatarHead = _jointName == "Avatar"; - const int INVALID_JOINT = -1; - if (jointIndex != INVALID_JOINT || useAvatarHead) { - glm::vec3 jointPos = useAvatarHead ? myAvatar->getHeadPosition() : myAvatar->getAbsoluteJointTranslationInObjectFrame(jointIndex); - glm::quat jointRot = useAvatarHead ? myAvatar->getHeadOrientation() : myAvatar->getAbsoluteJointRotationInObjectFrame(jointIndex); - glm::vec3 avatarPos = myAvatar->getWorldPosition(); - glm::quat avatarRot = myAvatar->getWorldOrientation(); - - glm::vec3 pos = useAvatarHead ? jointPos : avatarPos + (avatarRot * jointPos); - glm::quat rot = useAvatarHead ? jointRot * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT) : avatarRot * jointRot; - - // Apply offset - pos = pos + (rot * (myAvatar->getSensorToWorldScale() * _posOffset)); - glm::vec3 dir = glm::normalize(rot * glm::normalize(_dirOffset)); - - return PickRay(pos, dir); - } - - return PickRay(); -} diff --git a/interface/src/raypick/JointRayPick.h b/interface/src/raypick/JointRayPick.h deleted file mode 100644 index c0031d87ff..0000000000 --- a/interface/src/raypick/JointRayPick.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// JointRayPick.h -// interface/src/raypick -// -// Created by Sam Gondelman 7/11/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#ifndef hifi_JointRayPick_h -#define hifi_JointRayPick_h - -#include "RayPick.h" - -class JointRayPick : public RayPick { - -public: - JointRayPick(const std::string& jointName, const glm::vec3& posOffset, const glm::vec3& dirOffset, const PickFilter& filter, float maxDistance = 0.0f, bool enabled = false); - - PickRay getMathematicalPick() const override; - - bool isLeftHand() const override { return (_jointName == "_CONTROLLER_LEFTHAND") || (_jointName == "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND"); } - bool isRightHand() const override { return (_jointName == "_CONTROLLER_RIGHTHAND") || (_jointName == "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND"); } - -private: - std::string _jointName; - glm::vec3 _posOffset; - glm::vec3 _dirOffset; - -}; - -#endif // hifi_JointRayPick_h diff --git a/interface/src/raypick/MouseParabolaPick.cpp b/interface/src/raypick/MouseParabolaPick.cpp deleted file mode 100644 index 66351f4520..0000000000 --- a/interface/src/raypick/MouseParabolaPick.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// Created by Sam Gondelman 7/2/2018 -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "MouseParabolaPick.h" - -#include "Application.h" -#include "display-plugins/CompositorHelper.h" - -MouseParabolaPick::MouseParabolaPick(float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, - bool scaleWithAvatar, const PickFilter& filter, float maxDistance, bool enabled) : - ParabolaPick(speed, accelerationAxis, rotateAccelerationWithAvatar, scaleWithAvatar, filter, maxDistance, enabled) -{ -} - -PickParabola MouseParabolaPick::getMathematicalPick() const { - QVariant position = qApp->getApplicationCompositor().getReticleInterface()->getPosition(); - if (position.isValid()) { - QVariantMap posMap = position.toMap(); - PickRay pickRay = qApp->getCamera().computePickRay(posMap["x"].toFloat(), posMap["y"].toFloat()); - return PickParabola(pickRay.origin, getSpeed() * pickRay.direction, getAcceleration()); - } - - return PickParabola(); -} diff --git a/interface/src/raypick/MouseParabolaPick.h b/interface/src/raypick/MouseParabolaPick.h deleted file mode 100644 index cb67c3b361..0000000000 --- a/interface/src/raypick/MouseParabolaPick.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// Created by Sam Gondelman 7/2/2018 -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#ifndef hifi_MouseParabolaPick_h -#define hifi_MouseParabolaPick_h - -#include "ParabolaPick.h" - -class MouseParabolaPick : public ParabolaPick { - -public: - MouseParabolaPick(float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, bool scaleWithAvatar, - const PickFilter& filter, float maxDistance = 0.0f, bool enabled = false); - - PickParabola getMathematicalPick() const override; - - bool isMouse() const override { return true; } -}; - -#endif // hifi_MouseParabolaPick_h diff --git a/interface/src/raypick/MouseRayPick.cpp b/interface/src/raypick/MouseRayPick.cpp deleted file mode 100644 index 2b55c44460..0000000000 --- a/interface/src/raypick/MouseRayPick.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// MouseRayPick.cpp -// interface/src/raypick -// -// Created by Sam Gondelman 7/19/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "MouseRayPick.h" - -#include "Application.h" -#include "display-plugins/CompositorHelper.h" - -MouseRayPick::MouseRayPick(const PickFilter& filter, float maxDistance, bool enabled) : - RayPick(filter, maxDistance, enabled) -{ -} - -PickRay MouseRayPick::getMathematicalPick() const { - QVariant position = qApp->getApplicationCompositor().getReticleInterface()->getPosition(); - if (position.isValid()) { - QVariantMap posMap = position.toMap(); - return qApp->getCamera().computePickRay(posMap["x"].toFloat(), posMap["y"].toFloat()); - } - - return PickRay(); -} diff --git a/interface/src/raypick/MouseRayPick.h b/interface/src/raypick/MouseRayPick.h deleted file mode 100644 index a9070e8b92..0000000000 --- a/interface/src/raypick/MouseRayPick.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// MouseRayPick.h -// interface/src/raypick -// -// Created by Sam Gondelman 7/19/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#ifndef hifi_MouseRayPick_h -#define hifi_MouseRayPick_h - -#include "RayPick.h" - -class MouseRayPick : public RayPick { - -public: - MouseRayPick(const PickFilter& filter, float maxDistance = 0.0f, bool enabled = false); - - PickRay getMathematicalPick() const override; - - bool isMouse() const override { return true; } -}; - -#endif // hifi_MouseRayPick_h diff --git a/interface/src/raypick/ParabolaPick.cpp b/interface/src/raypick/ParabolaPick.cpp index 1b37eee096..a2a9211b88 100644 --- a/interface/src/raypick/ParabolaPick.cpp +++ b/interface/src/raypick/ParabolaPick.cpp @@ -14,6 +14,43 @@ #include "scripting/HMDScriptingInterface.h" #include "DependencyManager.h" +ParabolaPick::ParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, bool rotateAccelerationWithParent, bool scaleWithParent, const PickFilter& filter, float maxDistance, bool enabled) : + Pick(filter, maxDistance, enabled), + _rotateAccelerationWithAvatar(rotateAccelerationWithAvatar), + _rotateAccelerationWithParent(rotateAccelerationWithParent), + _scaleWithParent(scaleWithParent) { + _mathPick = PickParabola(position, speed*direction, accelerationAxis); +} + +PickParabola ParabolaPick::getMathematicalPick() const { + if (!parentTransform) { + PickParabola mathPick = _mathPick; + if (_rotateAccelerationWithAvatar) { + mathPick.acceleration = DependencyManager::get()->getMyAvatar()->getWorldOrientation() * mathPick.acceleration; + } + return mathPick; + } + + Transform currentParentTransform = parentTransform->getTransform(); + + glm::vec3 position = currentParentTransform.transform(_mathPick.origin); + glm::vec3 velocity = _mathPick.velocity; + if (_scaleWithParent) { + velocity = currentParentTransform.transformDirection(velocity); + } + glm::vec3 acceleration = _mathPick.acceleration; + if (_rotateAccelerationWithAvatar) { + acceleration = DependencyManager::get()->getMyAvatar()->getWorldOrientation() * acceleration; + } else if (_rotateAccelerationWithParent) { + acceleration = currentParentTransform.getRotation() * acceleration; + } + if (_scaleWithParent) { + acceleration *= currentParentTransform.getScale(); + } + + return PickParabola(position, velocity, acceleration); +} + PickResultPointer ParabolaPick::getEntityIntersection(const PickParabola& pick) { if (glm::length2(pick.acceleration) > EPSILON && glm::length2(pick.velocity) > EPSILON) { ParabolaToEntityIntersectionResult entityRes = @@ -57,18 +94,6 @@ PickResultPointer ParabolaPick::getHUDIntersection(const PickParabola& pick) { return std::make_shared(pick.toVariantMap()); } -float ParabolaPick::getSpeed() const { - return (_scaleWithAvatar ? DependencyManager::get()->getMyAvatar()->getSensorToWorldScale() * _speed : _speed); -} - -glm::vec3 ParabolaPick::getAcceleration() const { - float scale = (_scaleWithAvatar ? DependencyManager::get()->getMyAvatar()->getSensorToWorldScale() : 1.0f); - if (_rotateAccelerationWithAvatar) { - return scale * (DependencyManager::get()->getMyAvatar()->getWorldOrientation() * _accelerationAxis); - } - return scale * _accelerationAxis; -} - Transform ParabolaPick::getResultTransform() const { PickResultPointer result = getPrevPickResult(); if (!result) { diff --git a/interface/src/raypick/ParabolaPick.h b/interface/src/raypick/ParabolaPick.h index 01454390f9..7089228d21 100644 --- a/interface/src/raypick/ParabolaPick.h +++ b/interface/src/raypick/ParabolaPick.h @@ -74,9 +74,9 @@ public: class ParabolaPick : public Pick { public: - ParabolaPick(float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, bool scaleWithAvatar, const PickFilter& filter, float maxDistance, bool enabled) : - Pick(filter, maxDistance, enabled), _speed(speed), _accelerationAxis(accelerationAxis), _rotateAccelerationWithAvatar(rotateAccelerationWithAvatar), - _scaleWithAvatar(scaleWithAvatar) {} + ParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& acceleration, bool rotateAccelerationWithAvatar, bool rotateAccelerationWithParent, bool scaleWithParent, const PickFilter& filter, float maxDistance, bool enabled); + + PickParabola getMathematicalPick() const override; PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared(pickVariant); } PickResultPointer getEntityIntersection(const PickParabola& pick) override; @@ -86,13 +86,9 @@ public: Transform getResultTransform() const override; protected: - float _speed; - glm::vec3 _accelerationAxis; bool _rotateAccelerationWithAvatar; - bool _scaleWithAvatar; - - float getSpeed() const; - glm::vec3 getAcceleration() const; + bool _rotateAccelerationWithParent; + bool _scaleWithParent; }; #endif // hifi_ParabolaPick_h diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index b9693f6782..600be743fe 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -14,13 +14,9 @@ #include "Application.h" #include -#include "StaticRayPick.h" -#include "JointRayPick.h" -#include "MouseRayPick.h" +#include "RayPick.h" #include "StylusPick.h" -#include "StaticParabolaPick.h" -#include "JointParabolaPick.h" -#include "MouseParabolaPick.h" +#include "ParabolaPick.h" #include "CollisionPick.h" #include "SpatialParentFinder.h" @@ -56,9 +52,9 @@ unsigned int PickScriptingInterface::createPick(const PickQuery::PickType type, * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results. * @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid. - * @property {string} [joint] Only for Joint or Mouse Ray Picks. If "Mouse", it will create a Ray Pick that follows the system mouse, in desktop or HMD. - * If "Avatar", it will create a Joint Ray Pick that follows your avatar's head. Otherwise, it will create a Joint Ray Pick that follows the given joint, if it - * exists on your current avatar. + * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. + * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) + * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Ray Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral * @property {Vec3} [dirOffset=Vec3.UP] Only for Joint Ray Picks. A local joint direction offset. x = upward, y = forward, z = lateral * @property {Vec3} [position] Only for Static Ray Picks. The world-space origin of the ray. @@ -82,38 +78,30 @@ unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) { maxDistance = propMap["maxDistance"].toFloat(); } - if (propMap["joint"].isValid()) { - std::string jointName = propMap["joint"].toString().toStdString(); - - if (jointName != "Mouse") { - // x = upward, y = forward, z = lateral - glm::vec3 posOffset = Vectors::ZERO; - if (propMap["posOffset"].isValid()) { - posOffset = vec3FromVariant(propMap["posOffset"]); - } - - glm::vec3 dirOffset = Vectors::UP; - if (propMap["dirOffset"].isValid()) { - dirOffset = vec3FromVariant(propMap["dirOffset"]); - } - - return DependencyManager::get()->addPick(PickQuery::Ray, std::make_shared(jointName, posOffset, dirOffset, filter, maxDistance, enabled)); - - } else { - return DependencyManager::get()->addPick(PickQuery::Ray, std::make_shared(filter, maxDistance, enabled)); - } - } else if (propMap["position"].isValid()) { - glm::vec3 position = vec3FromVariant(propMap["position"]); - - glm::vec3 direction = -Vectors::UP; - if (propMap["direction"].isValid()) { - direction = vec3FromVariant(propMap["direction"]); - } - - return DependencyManager::get()->addPick(PickQuery::Ray, std::make_shared(position, direction, filter, maxDistance, enabled)); + glm::vec3 position = Vectors::ZERO; + if (propMap["position"].isValid()) { + position = vec3FromVariant(propMap["position"]); + } else if (propMap["posOffset"].isValid()) { + position = vec3FromVariant(propMap["posOffset"]); } - return PickManager::INVALID_PICK_ID; + // direction has two defaults to ensure compatibility with older scripts + // Joint ray picks had default direction = Vec3.UP + // Static ray picks had default direction = -Vec3.UP + glm::vec3 direction = propMap["joint"].isValid() ? Vectors::UP : -Vectors::UP; + if (propMap["orientation"].isValid()) { + direction = quatFromVariant(propMap["orientation"]) * Vectors::UP; + } else if (propMap["direction"].isValid()) { + direction = vec3FromVariant(propMap["direction"]); + } else if (propMap["dirOffset"].isValid()) { + direction = vec3FromVariant(propMap["dirOffset"]); + } + + auto rayPick = std::make_shared(position, direction, filter, maxDistance, enabled); + rayPick->parentTransform = createTransformNode(propMap); + rayPick->setJointState(getPickJointState(propMap)); + + return DependencyManager::get()->addPick(PickQuery::Ray, rayPick); } /**jsdoc @@ -153,23 +141,26 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties return DependencyManager::get()->addPick(PickQuery::Stylus, std::make_shared(side, filter, maxDistance, enabled)); } +// NOTE: Laser pointer still uses scaleWithAvatar. Until scaleWithAvatar is also deprecated for pointers, scaleWithAvatar should not be removed from the pick API. /**jsdoc * A set of properties that can be passed to {@link Picks.createPick} to create a new Parabola Pick. * @typedef {object} Picks.ParabolaPickProperties * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results. * @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid. - * @property {string} [joint] Only for Joint or Mouse Parabola Picks. If "Mouse", it will create a Parabola Pick that follows the system mouse, in desktop or HMD. - * If "Avatar", it will create a Joint Parabola Pick that follows your avatar's head. Otherwise, it will create a Joint Parabola Pick that follows the given joint, if it - * exists on your current avatar. + * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. + * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) + * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Parabola Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral * @property {Vec3} [dirOffset=Vec3.UP] Only for Joint Parabola Picks. A local joint direction offset. x = upward, y = forward, z = lateral * @property {Vec3} [position] Only for Static Parabola Picks. The world-space origin of the parabola segment. * @property {Vec3} [direction=-Vec3.FRONT] Only for Static Parabola Picks. The world-space direction of the parabola segment. * @property {number} [speed=1] The initial speed of the parabola, i.e. the initial speed of the projectile whose trajectory defines the parabola. * @property {Vec3} [accelerationAxis=-Vec3.UP] The acceleration of the parabola, i.e. the acceleration of the projectile whose trajectory defines the parabola, both magnitude and direction. - * @property {boolean} [rotateAccelerationWithAvatar=true] Whether or not the acceleration axis should rotate with your avatar's local Y axis. - * @property {boolean} [scaleWithAvatar=false] If true, the velocity and acceleration of the Pick will scale linearly with your avatar. + * @property {boolean} [rotateAccelerationWithAvatar=true] Whether or not the acceleration axis should rotate with the avatar's local Y axis. + * @property {boolean} [rotateAccelerationWithParent=false] Whether or not the acceleration axis should rotate with the parent's local Y axis, if available. + * @property {boolean} [scaleWithParent=false] If true, the velocity and acceleration of the Pick will scale linearly with the parent, if available. + * @property {boolean} [scaleWithAvatar] Alias for scaleWithParent. Deprecated. */ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properties) { QVariantMap propMap = properties.toMap(); @@ -204,48 +195,38 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti rotateAccelerationWithAvatar = propMap["rotateAccelerationWithAvatar"].toBool(); } - bool scaleWithAvatar = false; - if (propMap["scaleWithAvatar"].isValid()) { - scaleWithAvatar = propMap["scaleWithAvatar"].toBool(); + bool rotateAccelerationWithParent = false; + if (propMap["rotateAccelerationWithParent"].isValid()) { + rotateAccelerationWithParent = propMap["rotateAccelerationWithParent"].toBool(); } - if (propMap["joint"].isValid()) { - std::string jointName = propMap["joint"].toString().toStdString(); - - if (jointName != "Mouse") { - // x = upward, y = forward, z = lateral - glm::vec3 posOffset = Vectors::ZERO; - if (propMap["posOffset"].isValid()) { - posOffset = vec3FromVariant(propMap["posOffset"]); - } - - glm::vec3 dirOffset = Vectors::UP; - if (propMap["dirOffset"].isValid()) { - dirOffset = vec3FromVariant(propMap["dirOffset"]); - } - - return DependencyManager::get()->addPick(PickQuery::Parabola, std::make_shared(jointName, posOffset, dirOffset, - speed, accelerationAxis, rotateAccelerationWithAvatar, - scaleWithAvatar, filter, maxDistance, enabled)); - - } else { - return DependencyManager::get()->addPick(PickQuery::Parabola, std::make_shared(speed, accelerationAxis, rotateAccelerationWithAvatar, - scaleWithAvatar, filter, maxDistance, enabled)); - } - } else if (propMap["position"].isValid()) { - glm::vec3 position = vec3FromVariant(propMap["position"]); - - glm::vec3 direction = -Vectors::FRONT; - if (propMap["direction"].isValid()) { - direction = vec3FromVariant(propMap["direction"]); - } - - return DependencyManager::get()->addPick(PickQuery::Parabola, std::make_shared(position, direction, speed, accelerationAxis, - rotateAccelerationWithAvatar, scaleWithAvatar, - filter, maxDistance, enabled)); + bool scaleWithParent = false; + if (propMap["scaleWithParent"].isValid()) { + scaleWithParent = propMap["scaleWithParent"].toBool(); + } else if (propMap["scaleWithAvatar"].isValid()) { + scaleWithParent = propMap["scaleWithAvatar"].toBool(); } - return PickManager::INVALID_PICK_ID; + glm::vec3 position = glm::vec3(); + glm::vec3 direction = -Vectors::FRONT; + if (propMap["position"].isValid()) { + position = vec3FromVariant(propMap["position"]); + } else if (propMap["posOffset"].isValid()) { + position = vec3FromVariant(propMap["posOffset"]); + } + if (propMap["orientation"].isValid()) { + direction = quatFromVariant(propMap["orientation"]) * Vectors::UP; + } else if (propMap["direction"].isValid()) { + direction = vec3FromVariant(propMap["direction"]); + } else if (propMap["dirOffset"].isValid()) { + direction = vec3FromVariant(propMap["dirOffset"]); + } + + auto parabolaPick = std::make_shared(position, direction, speed, accelerationAxis, + rotateAccelerationWithAvatar, rotateAccelerationWithParent, scaleWithParent, filter, maxDistance, enabled); + parabolaPick->parentTransform = createTransformNode(propMap); + parabolaPick->setJointState(getPickJointState(propMap)); + return DependencyManager::get()->addPick(PickQuery::Parabola, parabolaPick); } /**jsdoc @@ -297,6 +278,7 @@ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& propert CollisionRegion collisionRegion(propMap); auto collisionPick = std::make_shared(filter, maxDistance, enabled, collisionRegion, qApp->getPhysicsEngine()); collisionPick->parentTransform = createTransformNode(propMap); + collisionPick->setJointState(getPickJointState(propMap)); return DependencyManager::get()->addPick(PickQuery::Collision, collisionPick); } @@ -373,6 +355,37 @@ void PickScriptingInterface::setPerFrameTimeBudget(unsigned int numUsecs) { DependencyManager::get()->setPerFrameTimeBudget(numUsecs); } +PickQuery::JointState PickScriptingInterface::getPickJointState(const QVariantMap& propMap) { + if (propMap["parentID"].isValid()) { + QUuid parentUuid = propMap["parentID"].toUuid(); + if (propMap["parentJointIndex"].isValid() && parentUuid == DependencyManager::get()->getMyAvatar()->getSessionUUID()) { + int jointIndex = propMap["parentJointIndes"].toInt(); + if (jointIndex == CONTROLLER_LEFTHAND_INDEX || jointIndex == CAMERA_RELATIVE_CONTROLLER_LEFTHAND_INDEX) { + return PickQuery::JOINT_STATE_LEFT_HAND; + } else if (jointIndex == CONTROLLER_RIGHTHAND_INDEX || jointIndex == CAMERA_RELATIVE_CONTROLLER_RIGHTHAND_INDEX) { + return PickQuery::JOINT_STATE_RIGHT_HAND; + } else { + return PickQuery::JOINT_STATE_NONE; + } + } else { + return PickQuery::JOINT_STATE_NONE; + } + } else if (propMap["joint"].isValid()) { + QString joint = propMap["joint"].toString(); + if (joint == "Mouse") { + return PickQuery::JOINT_STATE_MOUSE; + } else if (joint == "_CONTROLLER_LEFTHAND" || joint == "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND") { + return PickQuery::JOINT_STATE_LEFT_HAND; + } else if (joint== "_CONTROLLER_RIGHTHAND" || joint == "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND") { + return PickQuery::JOINT_STATE_RIGHT_HAND; + } else { + return PickQuery::JOINT_STATE_NONE; + } + } else { + return PickQuery::JOINT_STATE_NONE; + } +} + std::shared_ptr PickScriptingInterface::createTransformNode(const QVariantMap& propMap) { if (propMap["parentID"].isValid()) { QUuid parentUuid = propMap["parentID"].toUuid(); diff --git a/interface/src/raypick/PickScriptingInterface.h b/interface/src/raypick/PickScriptingInterface.h index 36079cec2b..224f7a547e 100644 --- a/interface/src/raypick/PickScriptingInterface.h +++ b/interface/src/raypick/PickScriptingInterface.h @@ -320,6 +320,7 @@ public slots: static constexpr unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; } protected: + static PickQuery::JointState getPickJointState(const QVariantMap& propMap); static std::shared_ptr createTransformNode(const QVariantMap& propMap); }; diff --git a/interface/src/raypick/RayPick.cpp b/interface/src/raypick/RayPick.cpp index 736d3c1760..d16e10a3f4 100644 --- a/interface/src/raypick/RayPick.cpp +++ b/interface/src/raypick/RayPick.cpp @@ -14,6 +14,17 @@ #include "scripting/HMDScriptingInterface.h" #include "DependencyManager.h" +PickRay RayPick::getMathematicalPick() const { + if (!parentTransform) { + return _mathPick; + } + + Transform currentParentTransform = parentTransform->getTransform(); + Transform relativeTransform(rotationBetween(Vectors::UP, _mathPick.direction), glm::vec3(1.0f), _mathPick.origin); + Transform pickTransform = currentParentTransform.worldTransform(relativeTransform); + return PickRay(pickTransform.getTranslation(), pickTransform.getRotation() * Vectors::UP); +} + PickResultPointer RayPick::getEntityIntersection(const PickRay& pick) { RayToEntityIntersectionResult entityRes = DependencyManager::get()->findRayIntersectionVector(pick, !getFilter().doesPickCoarse(), diff --git a/interface/src/raypick/RayPick.h b/interface/src/raypick/RayPick.h index 11f985cec2..7c7ea5758a 100644 --- a/interface/src/raypick/RayPick.h +++ b/interface/src/raypick/RayPick.h @@ -70,7 +70,12 @@ public: class RayPick : public Pick { public: - RayPick(const PickFilter& filter, float maxDistance, bool enabled) : Pick(filter, maxDistance, enabled) {} + RayPick(glm::vec3 position, glm::vec3 direction, const PickFilter& filter, float maxDistance, bool enabled) : + Pick(filter, maxDistance, enabled) { + _mathPick = PickRay(position, direction); + } + + PickRay getMathematicalPick() const override; PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { return std::make_shared(pickVariant); } PickResultPointer getEntityIntersection(const PickRay& pick) override; diff --git a/interface/src/raypick/RayPickScriptingInterface.cpp b/interface/src/raypick/RayPickScriptingInterface.cpp index c90f5d6c6c..247368df51 100644 --- a/interface/src/raypick/RayPickScriptingInterface.cpp +++ b/interface/src/raypick/RayPickScriptingInterface.cpp @@ -16,10 +16,6 @@ #include -#include "StaticRayPick.h" -#include "JointRayPick.h" -#include "MouseRayPick.h" - unsigned int RayPickScriptingInterface::createRayPick(const QVariant& properties) { return DependencyManager::get()->createRayPick(properties); } diff --git a/interface/src/raypick/StaticParabolaPick.cpp b/interface/src/raypick/StaticParabolaPick.cpp deleted file mode 100644 index a4e3ccb97f..0000000000 --- a/interface/src/raypick/StaticParabolaPick.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -// Created by Sam Gondelman 7/2/2018 -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "StaticParabolaPick.h" - -StaticParabolaPick::StaticParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& accelerationAxis, - bool scaleWithAvatar, bool rotateAccelerationWithAvatar, const PickFilter& filter, float maxDistance, bool enabled) : - ParabolaPick(speed, accelerationAxis, rotateAccelerationWithAvatar, scaleWithAvatar, filter, maxDistance, enabled), - _position(position), _velocity(direction) -{ -} - -PickParabola StaticParabolaPick::getMathematicalPick() const { - return PickParabola(_position, getSpeed() * _velocity, getAcceleration()); -} \ No newline at end of file diff --git a/interface/src/raypick/StaticParabolaPick.h b/interface/src/raypick/StaticParabolaPick.h deleted file mode 100644 index df2057a6f0..0000000000 --- a/interface/src/raypick/StaticParabolaPick.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by Sam Gondelman 7/2/2018 -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#ifndef hifi_StaticParabolaPick_h -#define hifi_StaticParabolaPick_h - -#include "ParabolaPick.h" - -class StaticParabolaPick : public ParabolaPick { - -public: - StaticParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, - bool scaleWithAvatar, const PickFilter& filter, float maxDistance = 0.0f, bool enabled = false); - - PickParabola getMathematicalPick() const override; - -private: - glm::vec3 _position; - glm::vec3 _velocity; -}; - -#endif // hifi_StaticParabolaPick_h diff --git a/interface/src/raypick/StaticRayPick.cpp b/interface/src/raypick/StaticRayPick.cpp deleted file mode 100644 index b74afd6b5d..0000000000 --- a/interface/src/raypick/StaticRayPick.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// Created by Sam Gondelman 7/11/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "StaticRayPick.h" - -StaticRayPick::StaticRayPick(const glm::vec3& position, const glm::vec3& direction, const PickFilter& filter, float maxDistance, bool enabled) : - RayPick(filter, maxDistance, enabled), - _pickRay(position, direction) -{ -} - -PickRay StaticRayPick::getMathematicalPick() const { - return _pickRay; -} \ No newline at end of file diff --git a/interface/src/raypick/StaticRayPick.h b/interface/src/raypick/StaticRayPick.h deleted file mode 100644 index e4da2dbd55..0000000000 --- a/interface/src/raypick/StaticRayPick.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Created by Sam Gondelman 7/11/2017 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#ifndef hifi_StaticRayPick_h -#define hifi_StaticRayPick_h - -#include "RayPick.h" - -class StaticRayPick : public RayPick { - -public: - StaticRayPick(const glm::vec3& position, const glm::vec3& direction, const PickFilter& filter, float maxDistance = 0.0f, bool enabled = false); - - PickRay getMathematicalPick() const override; - -private: - PickRay _pickRay; - -}; - -#endif // hifi_StaticRayPick_h diff --git a/interface/src/raypick/StylusPick.h b/interface/src/raypick/StylusPick.h index ca80e9fbea..e6b1da9914 100644 --- a/interface/src/raypick/StylusPick.h +++ b/interface/src/raypick/StylusPick.h @@ -70,6 +70,7 @@ public: bool isLeftHand() const override { return _side == Side::Left; } bool isRightHand() const override { return _side == Side::Right; } + bool isMouse() const override { return false; } private: const Side _side; diff --git a/libraries/pointers/src/Pick.h b/libraries/pointers/src/Pick.h index 099a791407..42a9354122 100644 --- a/libraries/pointers/src/Pick.h +++ b/libraries/pointers/src/Pick.h @@ -170,6 +170,13 @@ public: }; Q_ENUM(PickType) + enum JointState { + JOINT_STATE_NONE = 0, + JOINT_STATE_LEFT_HAND, + JOINT_STATE_RIGHT_HAND, + JOINT_STATE_MOUSE + }; + void enable(bool enabled = true); void disable() { enable(false); } @@ -210,9 +217,11 @@ public: void setIgnoreItems(const QVector& items); void setIncludeItems(const QVector& items); - virtual bool isLeftHand() const { return false; } - virtual bool isRightHand() const { return false; } - virtual bool isMouse() const { return false; } + virtual bool isLeftHand() const { return _jointState == JOINT_STATE_LEFT_HAND; } + virtual bool isRightHand() const { return _jointState == JOINT_STATE_RIGHT_HAND; } + virtual bool isMouse() const { return _jointState == JOINT_STATE_MOUSE; } + + void setJointState(JointState jointState) { _jointState = jointState; } virtual Transform getResultTransform() const = 0; @@ -226,6 +235,8 @@ private: QVector _ignoreItems; QVector _includeItems; + + JointState _jointState = JOINT_STATE_NONE; }; Q_DECLARE_METATYPE(PickQuery::PickType) @@ -240,6 +251,9 @@ public: virtual PickResultPointer getOverlayIntersection(const T& pick) = 0; virtual PickResultPointer getAvatarIntersection(const T& pick) = 0; virtual PickResultPointer getHUDIntersection(const T& pick) = 0; + +protected: + T _mathPick; }; namespace std { diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index 6ecf9faca7..46f112f5c6 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -178,7 +178,9 @@ public: QVariantMap toVariantMap() const override { QVariantMap pickRay; pickRay["origin"] = vec3toVariant(origin); + pickRay["position"] = vec3toVariant(origin); pickRay["direction"] = vec3toVariant(direction); + pickRay["orientation"] = quatToVariant(rotationBetween(Vectors::UP, direction)); return pickRay; } }; From 986dece4ec20dec669e9e84550a95392d7a0f94e Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 14 Sep 2018 20:24:22 -0700 Subject: [PATCH 002/157] Add name of the batch during tracing and introduce detailed tracing if needed and one error message in the case the materialMap is detected in an fst file but not understood --- libraries/fbx/src/FBXReader_Material.cpp | 6 +- .../gpu-gl-common/src/gpu/gl/GLBackend.cpp | 95 +++++++++++++++++++ libraries/gpu/src/gpu/Batch.h | 1 + 3 files changed, 101 insertions(+), 1 deletion(-) diff --git a/libraries/fbx/src/FBXReader_Material.cpp b/libraries/fbx/src/FBXReader_Material.cpp index 4aa3044934..d5902962e5 100644 --- a/libraries/fbx/src/FBXReader_Material.cpp +++ b/libraries/fbx/src/FBXReader_Material.cpp @@ -128,7 +128,11 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) { QString materialMapString = mapping.value("materialMap").toString(); QJsonDocument materialMapDocument = QJsonDocument::fromJson(materialMapString.toUtf8()); QJsonObject materialMap = materialMapDocument.object(); - + if (!materialMapString.isEmpty()) { + if (materialMapDocument.isEmpty() || materialMap.isEmpty()) { + qCDebug(modelformat) << "fbx Material Map found but did not produce valid JSON:" << materialMapString; + } + } for (QHash::iterator it = _fbxMaterials.begin(); it != _fbxMaterials.end(); it++) { FBXMaterial& material = (*it); diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp index 4fea4f2dc5..68fe38fc72 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp @@ -20,6 +20,9 @@ #include "nvToolsExt.h" #endif +// Define the GPU_BATCH_DETAILED_TRACING to get detailed tracing of the commands during the batch executions +// #define GPU_BATCH_DETAILED_TRACING + #include #include "GLTexture.h" @@ -271,6 +274,8 @@ void GLBackend::renderPassDraw(const Batch& batch) { case Batch::COMMAND_drawIndexedInstanced: case Batch::COMMAND_multiDrawIndirect: case Batch::COMMAND_multiDrawIndexedIndirect: { + PROFILE_RANGE(render_gpu_gl_detail, "drawcall"); + // updates for draw calls ++_currentDraw; updateInput(); @@ -281,6 +286,94 @@ void GLBackend::renderPassDraw(const Batch& batch) { (this->*(call))(batch, *offset); break; } +#ifdef GPU_BATCH_DETAILED_TRACING + //case Batch::COMMAND_setModelTransform: + //case Batch::COMMAND_setViewTransform: + //case Batch::COMMAND_setProjectionTransform: + case Batch::COMMAND_setProjectionJitter: + case Batch::COMMAND_setViewportTransform: + case Batch::COMMAND_setDepthRangeTransform: + { + PROFILE_RANGE(render_gpu_gl_detail, "transform"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_clearFramebuffer: + { + PROFILE_RANGE(render_gpu_gl_detail, "clear"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_blit: + { + PROFILE_RANGE(render_gpu_gl_detail, "blit"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_setInputFormat: + case Batch::COMMAND_setInputBuffer: + case Batch::COMMAND_setIndexBuffer: + case Batch::COMMAND_setIndirectBuffer: { + PROFILE_RANGE(render_gpu_gl_detail, "input"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_setStateBlendFactor: + case Batch::COMMAND_setStateScissorRect: + case Batch::COMMAND_setPipeline: { + PROFILE_RANGE(render_gpu_gl_detail, "pipeline"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_setUniformBuffer: + { + PROFILE_RANGE(render_gpu_gl_detail, "ubo"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_setResourceBuffer: + case Batch::COMMAND_setResourceTexture: + case Batch::COMMAND_setResourceTextureTable: + { + PROFILE_RANGE(render_gpu_gl_detail, "resource"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + + case Batch::COMMAND_setResourceFramebufferSwapChainTexture: + case Batch::COMMAND_setFramebuffer: + case Batch::COMMAND_setFramebufferSwapChain: + { + PROFILE_RANGE(render_gpu_gl_detail, "framebuffer"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_generateTextureMips: + { + PROFILE_RANGE(render_gpu_gl_detail, "genMipMaps"); + + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } + case Batch::COMMAND_beginQuery: + case Batch::COMMAND_endQuery: + case Batch::COMMAND_getQuery: + { + PROFILE_RANGE(render_gpu_gl_detail, "query"); + CommandCall call = _commandCalls[(*command)]; + (this->*(call))(batch, *offset); + break; + } +#endif default: { CommandCall call = _commandCalls[(*command)]; (this->*(call))(batch, *offset); @@ -294,6 +387,8 @@ void GLBackend::renderPassDraw(const Batch& batch) { } void GLBackend::render(const Batch& batch) { + PROFILE_RANGE(render_gpu_gl, batch.getName()); + _transform._skybox = _stereo._skybox = batch.isSkyboxEnabled(); // Allow the batch to override the rendering stereo settings // for things like full framebuffer copy operations (deferred lighting passes) diff --git a/libraries/gpu/src/gpu/Batch.h b/libraries/gpu/src/gpu/Batch.h index 8e607a189e..c68a04fa62 100644 --- a/libraries/gpu/src/gpu/Batch.h +++ b/libraries/gpu/src/gpu/Batch.h @@ -95,6 +95,7 @@ public: ~Batch(); void setName(const char* name); + const char* getName() const { return _name; } void clear(); // Batches may need to override the context level stereo settings From ec6117e9bb7ba773dc8fd3dfa56ef68cd9d0b08f Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 18 Sep 2018 17:40:29 -0700 Subject: [PATCH 003/157] bringing the blendshape in skin shader only work in master --- libraries/fbx/src/FBX.h | 2 +- libraries/fbx/src/FBXReader_Mesh.cpp | 2 +- libraries/gpu/src/gpu/Transform.slh | 12 ++ .../render-utils/src/CauterizedModel.cpp | 6 +- .../render-utils/src/MeshPartPayload.cpp | 16 +-- libraries/render-utils/src/MeshPartPayload.h | 2 +- libraries/render-utils/src/Model.cpp | 125 ++++++------------ libraries/render-utils/src/Model.h | 17 ++- .../render-utils/src/SoftAttachmentModel.cpp | 2 +- libraries/render-utils/src/model.slv | 12 +- libraries/render-utils/src/model_fade.slv | 7 +- libraries/render-utils/src/model_lightmap.slv | 6 +- .../render-utils/src/model_normal_map.slv | 10 +- .../src/model_normal_map_fade.slv | 6 +- libraries/render-utils/src/model_shadow.slv | 8 +- .../render-utils/src/model_shadow_fade.slv | 8 +- .../src/render-utils/model_lightmap.slp | 1 + .../src/render-utils/model_lightmap_fade.slp | 1 + .../model_lightmap_normal_map.slp | 1 + .../model_lightmap_normal_map_fade.slp | 1 + .../src/render-utils/model_translucent.slp | 1 + .../model_translucent_normal_map.slp | 1 + .../model_translucent_normal_map_fade.slp | 2 +- libraries/render-utils/src/skin_model.slv | 8 +- libraries/render-utils/src/skin_model_dq.slv | 8 +- .../render-utils/src/skin_model_fade.slv | 7 +- .../render-utils/src/skin_model_fade_dq.slv | 6 +- .../src/skin_model_normal_map.slv | 8 +- .../src/skin_model_normal_map_dq.slv | 8 +- .../src/skin_model_normal_map_fade.slv | 7 +- .../src/skin_model_normal_map_fade_dq.slv | 8 +- .../render-utils/src/skin_model_shadow.slv | 8 +- .../render-utils/src/skin_model_shadow_dq.slv | 8 +- .../src/skin_model_shadow_fade.slv | 7 +- .../src/skin_model_shadow_fade_dq.slv | 7 +- 35 files changed, 141 insertions(+), 198 deletions(-) diff --git a/libraries/fbx/src/FBX.h b/libraries/fbx/src/FBX.h index fdebb16bc8..3eb963550e 100644 --- a/libraries/fbx/src/FBX.h +++ b/libraries/fbx/src/FBX.h @@ -31,7 +31,7 @@ #if defined(Q_OS_ANDROID) #define FBX_PACK_NORMALS 0 #else -#define FBX_PACK_NORMALS 1 +#define FBX_PACK_NORMALS 0 #endif #if FBX_PACK_NORMALS diff --git a/libraries/fbx/src/FBXReader_Mesh.cpp b/libraries/fbx/src/FBXReader_Mesh.cpp index e8b5abcc9c..692c55d297 100644 --- a/libraries/fbx/src/FBXReader_Mesh.cpp +++ b/libraries/fbx/src/FBXReader_Mesh.cpp @@ -765,7 +765,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { // This work is going into rc73 release which is meant to be used for the SPot500 event and we are picking the format // that works best for blendshaped and skinned meshes aka the avatars. // We will improve this technique in a hot fix to 73. - hasBlendShapes = true; + hasBlendShapes = false; // If has blend shapes allocate and assign buffers for pos and tangents now if (hasBlendShapes) { diff --git a/libraries/gpu/src/gpu/Transform.slh b/libraries/gpu/src/gpu/Transform.slh index d0b7587da6..c6780a64d2 100644 --- a/libraries/gpu/src/gpu/Transform.slh +++ b/libraries/gpu/src/gpu/Transform.slh @@ -214,6 +214,18 @@ TransformObject getTransformObject() { } <@endfunc@> +<@func transformModelToWorldAndEyeAndClipPos(cameraTransform, objectTransform, modelPos, worldPos, eyePos, clipPos)@> + { // transformModelToEyeAndClipPos + vec4 eyeWAPos; + <$transformModelToEyeWorldAlignedPos($cameraTransform$, $objectTransform$, $modelPos$, eyeWAPos)$> + <$worldPos$> = vec4(eyeWAPos.xyz - <$cameraTransform$>._view[3].xyz, 1.0); + <$clipPos$> = <$cameraTransform$>._projectionViewUntranslated * eyeWAPos; + <$eyePos$> = vec4((<$cameraTransform$>._view * vec4(eyeWAPos.xyz, 0.0)).xyz, 1.0); + + <$transformStereoClipsSpace($cameraTransform$, $clipPos$)$> + } +<@endfunc@> + <@func transformModelToEyePos(cameraTransform, objectTransform, modelPos, eyePos)@> { // transformModelToEyePos vec4 eyeWAPos; diff --git a/libraries/render-utils/src/CauterizedModel.cpp b/libraries/render-utils/src/CauterizedModel.cpp index ffb652f923..e4f0dd0ecd 100644 --- a/libraries/render-utils/src/CauterizedModel.cpp +++ b/libraries/render-utils/src/CauterizedModel.cpp @@ -86,7 +86,7 @@ void CauterizedModel::createRenderItemSet() { // Create the render payloads int numParts = (int)mesh->getNumParts(); for (int partIndex = 0; partIndex < numParts; partIndex++) { - if (!fbxGeometry.meshes[i].blendshapes.empty() && _blendedVertexBuffers.find(i) == _blendedVertexBuffers.end()) { + if (_blendshapeBuffers.find(i) == _blendshapeBuffers.end()) { initializeBlendshapes(fbxGeometry.meshes[i], i); } auto ptr = std::make_shared(shared_from_this(), i, partIndex, shapeID, transform, offset); @@ -97,7 +97,7 @@ void CauterizedModel::createRenderItemSet() { shapeID++; } } - _blendedVertexBuffersInitialized = true; + _blendshapeBuffersInitialized = true; } else { Model::createRenderItemSet(); } @@ -176,7 +176,7 @@ void CauterizedModel::updateClusterMatrices() { // post the blender if we're not currently waiting for one to finish auto modelBlender = DependencyManager::get(); - if (_blendedVertexBuffersInitialized && modelBlender->shouldComputeBlendshapes() && geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { + if (_blendshapeBuffersInitialized && modelBlender->shouldComputeBlendshapes() && geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { _blendedBlendshapeCoefficients = _blendshapeCoefficients; modelBlender->noteRequiresBlend(getThisPointer()); } diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 94a5026fb4..a08f5858d7 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -208,9 +208,11 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in bool useDualQuaternionSkinning = model->getUseDualQuaternionSkinning(); - if (!model->getFBXGeometry().meshes[meshIndex].blendshapes.isEmpty()) { - _blendedVertexBuffer = model->_blendedVertexBuffers[meshIndex]; + auto buffer = model->_blendshapeBuffers.find(meshIndex); + if (buffer != model->_blendshapeBuffers.end()) { + _blendshapeBuffer = buffer->second; } + auto& modelMesh = model->getGeometry()->getMeshes().at(_meshIndex); const Model::MeshState& state = model->getMeshState(_meshIndex); @@ -389,14 +391,10 @@ ShapeKey ModelMeshPartPayload::getShapeKey() const { void ModelMeshPartPayload::bindMesh(gpu::Batch& batch) { batch.setIndexBuffer(gpu::UINT32, (_drawMesh->getIndexBuffer()._buffer), 0); batch.setInputFormat((_drawMesh->getVertexFormat())); - if (_isBlendShaped && _blendedVertexBuffer) { - batch.setInputBuffer(0, _blendedVertexBuffer, 0, sizeof(glm::vec3)); - // Stride is 2*sizeof(glm::vec3) because normal and tangents are interleaved - batch.setInputBuffer(1, _blendedVertexBuffer, _drawMesh->getNumVertices() * sizeof(glm::vec3), 2 * sizeof(NormalType)); - batch.setInputStream(2, _drawMesh->getVertexStream().makeRangedStream(2)); - } else { - batch.setInputStream(0, _drawMesh->getVertexStream()); + if (_blendshapeBuffer) { + batch.setResourceBuffer(0, _blendshapeBuffer); } + batch.setInputStream(0, _drawMesh->getVertexStream()); } void ModelMeshPartPayload::bindTransform(gpu::Batch& batch, RenderArgs::RenderMode renderMode) const { diff --git a/libraries/render-utils/src/MeshPartPayload.h b/libraries/render-utils/src/MeshPartPayload.h index 5c7177e890..33ab091f09 100644 --- a/libraries/render-utils/src/MeshPartPayload.h +++ b/libraries/render-utils/src/MeshPartPayload.h @@ -135,7 +135,7 @@ public: private: void initCache(const ModelPointer& model); - gpu::BufferPointer _blendedVertexBuffer; + gpu::BufferPointer _blendshapeBuffer; render::ShapeKey _shapeKey { render::ShapeKey::Builder::invalid() }; }; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index b9ed43c339..3bc22f9e79 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -308,12 +308,12 @@ bool Model::updateGeometry() { state.clusterDualQuaternions.resize(mesh.clusters.size()); state.clusterMatrices.resize(mesh.clusters.size()); _meshStates.push_back(state); - if (!mesh.blendshapes.empty() && _blendedVertexBuffers.find(i) == _blendedVertexBuffers.end()) { + if (_blendshapeBuffers.find(i) == _blendshapeBuffers.end()) { initializeBlendshapes(mesh, i); } i++; } - _blendedVertexBuffersInitialized = true; + _blendshapeBuffersInitialized = true; needFullUpdate = true; emit rigReady(); } @@ -1034,9 +1034,9 @@ void Model::removeFromScene(const render::ScenePointer& scene, render::Transacti _modelMeshMaterialNames.clear(); _modelMeshRenderItemShapes.clear(); - _blendedVertexBuffers.clear(); - _normalsAndTangents.clear(); - _blendedVertexBuffersInitialized = false; + _blendshapeBuffers.clear(); + _blendshapeOffsets.clear(); + _blendshapeBuffersInitialized = false; _addedToScene = false; @@ -1304,26 +1304,21 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe } void Blender::run() { - QVector vertices; - QVector normalsAndTangents; + QVector blendshapeOffsets; if (_model && _model->isLoaded()) { DETAILED_PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } }); int offset = 0; - int normalsAndTangentsOffset = 0; auto meshes = _model->getFBXGeometry().meshes; int meshIndex = 0; foreach (const FBXMesh& mesh, meshes) { - auto modelMeshNormalsAndTangents = _model->_normalsAndTangents.find(meshIndex++); - if (mesh.blendshapes.isEmpty() || modelMeshNormalsAndTangents == _model->_normalsAndTangents.end()) { + auto modelMeshBlendshapeOffsets = _model->_blendshapeOffsets.find(meshIndex++); + if (mesh.blendshapes.isEmpty() || modelMeshBlendshapeOffsets == _model->_blendshapeOffsets.end()) { continue; } - vertices += mesh.vertices; - normalsAndTangents += modelMeshNormalsAndTangents->second; - glm::vec3* meshVertices = vertices.data() + offset; - NormalType* meshNormalsAndTangents = normalsAndTangents.data() + normalsAndTangentsOffset; - offset += mesh.vertices.size(); - normalsAndTangentsOffset += modelMeshNormalsAndTangents->second.size(); + blendshapeOffsets += modelMeshBlendshapeOffsets->second; + BlendshapeOffset* meshBlendshapeOffsets = blendshapeOffsets.data() + offset; + offset += modelMeshBlendshapeOffsets->second.size(); const float NORMAL_COEFFICIENT_SCALE = 0.01f; for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) { float vertexCoefficient = _blendshapeCoefficients.at(i); @@ -1336,26 +1331,15 @@ void Blender::run() { tbb::parallel_for(tbb::blocked_range(0, blendshape.indices.size()), [&](const tbb::blocked_range& range) { for (auto j = range.begin(); j < range.end(); j++) { int index = blendshape.indices.at(j); - meshVertices[index] += blendshape.vertices.at(j) * vertexCoefficient; + auto& currentBlendshapeOffset = meshBlendshapeOffsets[index]; + currentBlendshapeOffset.positionOffsetAndSpare += glm::vec4(blendshape.vertices.at(j) * vertexCoefficient, 0.0f); - glm::vec3 normal = mesh.normals.at(index) + blendshape.normals.at(j) * normalCoefficient; - glm::vec3 tangent; + currentBlendshapeOffset.normalOffsetAndSpare += glm::vec4(blendshape.normals.at(j) * normalCoefficient, 0.0f); if (index < mesh.tangents.size()) { - tangent = mesh.tangents.at(index); if ((int)j < blendshape.tangents.size()) { - tangent += blendshape.tangents.at(j) * normalCoefficient; + currentBlendshapeOffset.tangentOffsetAndSpare += glm::vec4(blendshape.tangents.at(j) * normalCoefficient, 0.0f); } } -#if FBX_PACK_NORMALS - glm::uint32 finalNormal; - glm::uint32 finalTangent; - buffer_helpers::packNormalAndTangent(normal, tangent, finalNormal, finalTangent); -#else - const auto& finalNormal = normal; - const auto& finalTangent = tangent; -#endif - meshNormalsAndTangents[2 * index] = finalNormal; - meshNormalsAndTangents[2 * index + 1] = finalTangent; } }); } @@ -1363,8 +1347,7 @@ void Blender::run() { } // post the result to the ModelBlender, which will dispatch to the model if still alive QMetaObject::invokeMethod(DependencyManager::get().data(), "setBlendedVertices", - Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber), Q_ARG(QVector, vertices), - Q_ARG(QVector, normalsAndTangents)); + Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber), Q_ARG(QVector, blendshapeOffsets)); } void Model::setScaleToFit(bool scaleToFit, const glm::vec3& dimensions, bool forceRescale) { @@ -1525,7 +1508,7 @@ void Model::updateClusterMatrices() { // post the blender if we're not currently waiting for one to finish auto modelBlender = DependencyManager::get(); - if (_blendedVertexBuffersInitialized && modelBlender->shouldComputeBlendshapes() && geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { + if (_blendshapeBuffersInitialized && modelBlender->shouldComputeBlendshapes() && geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { _blendedBlendshapeCoefficients = _blendshapeCoefficients; modelBlender->noteRequiresBlend(getThisPointer()); } @@ -1542,39 +1525,34 @@ bool Model::maybeStartBlender() { return false; } -void Model::setBlendedVertices(int blendNumber, const QVector& vertices, const QVector& normalsAndTangents) { - if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendedVertexBuffersInitialized) { +void Model::setBlendedVertices(int blendNumber, const QVector& blendshapeOffsets) { + if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendshapeBuffersInitialized) { return; } _appliedBlendNumber = blendNumber; const FBXGeometry& fbxGeometry = getFBXGeometry(); int index = 0; - int normalAndTangentIndex = 0; for (int i = 0; i < fbxGeometry.meshes.size(); i++) { const FBXMesh& mesh = fbxGeometry.meshes.at(i); - auto meshNormalsAndTangents = _normalsAndTangents.find(i); - if (mesh.blendshapes.isEmpty() || meshNormalsAndTangents == _normalsAndTangents.end()) { + auto meshBlendshapeOffsets = _blendshapeOffsets.find(i); + if (mesh.blendshapes.isEmpty() || meshBlendshapeOffsets == _blendshapeOffsets.end()) { continue; } - const auto vertexCount = mesh.vertices.size(); - const auto verticesSize = vertexCount * sizeof(glm::vec3); - const auto& buffer = _blendedVertexBuffers.find(i); - assert(buffer != _blendedVertexBuffers.end()); - buffer->second->resize(mesh.vertices.size() * sizeof(glm::vec3) + meshNormalsAndTangents->second.size() * sizeof(NormalType)); - buffer->second->setSubData(0, verticesSize, (gpu::Byte*) vertices.constData() + index * sizeof(glm::vec3)); - buffer->second->setSubData(verticesSize, meshNormalsAndTangents->second.size() * sizeof(NormalType), (const gpu::Byte*) normalsAndTangents.data() + normalAndTangentIndex * sizeof(NormalType)); + const auto& buffer = _blendshapeBuffers.find(i); + assert(buffer != _blendshapeBuffers.end()); + const auto blendshapeOffsetSize = meshBlendshapeOffsets->second.size() * sizeof(BlendshapeOffset); + buffer->second->setData(blendshapeOffsetSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset)); - index += vertexCount; - normalAndTangentIndex += meshNormalsAndTangents->second.size(); + index += meshBlendshapeOffsets->second.size(); } } void Model::deleteGeometry() { _deleteGeometryCounter++; - _blendedVertexBuffers.clear(); - _normalsAndTangents.clear(); - _blendedVertexBuffersInitialized = false; + _blendshapeBuffers.clear(); + _blendshapeOffsets.clear(); + _blendshapeBuffersInitialized = false; _meshStates.clear(); _rig.destroyAnimGraph(); _blendedBlendshapeCoefficients.clear(); @@ -1607,39 +1585,12 @@ const render::ItemIDs& Model::fetchRenderItemIDs() const { } void Model::initializeBlendshapes(const FBXMesh& mesh, int index) { - _blendedVertexBuffers[index] = std::make_shared(); - QVector normalsAndTangents; - normalsAndTangents.resize(2 * mesh.normals.size()); - - // Interleave normals and tangents - // Parallel version for performance - tbb::parallel_for(tbb::blocked_range(0, mesh.normals.size()), [&](const tbb::blocked_range& range) { - auto normalsRange = std::make_pair(mesh.normals.begin() + range.begin(), mesh.normals.begin() + range.end()); - auto tangentsRange = std::make_pair(mesh.tangents.begin() + range.begin(), mesh.tangents.begin() + range.end()); - auto normalsAndTangentsIt = normalsAndTangents.begin() + 2 * range.begin(); - - for (auto normalIt = normalsRange.first, tangentIt = tangentsRange.first; - normalIt != normalsRange.second; - ++normalIt, ++tangentIt) { -#if FBX_PACK_NORMALS - glm::uint32 finalNormal; - glm::uint32 finalTangent; - buffer_helpers::packNormalAndTangent(*normalIt, *tangentIt, finalNormal, finalTangent); -#else - const auto& finalNormal = *normalIt; - const auto& finalTangent = *tangentIt; -#endif - *normalsAndTangentsIt = finalNormal; - ++normalsAndTangentsIt; - *normalsAndTangentsIt = finalTangent; - ++normalsAndTangentsIt; - } - }); - const auto verticesSize = mesh.vertices.size() * sizeof(glm::vec3); - _blendedVertexBuffers[index]->resize(mesh.vertices.size() * sizeof(glm::vec3) + normalsAndTangents.size() * sizeof(NormalType)); - _blendedVertexBuffers[index]->setSubData(0, verticesSize, (const gpu::Byte*) mesh.vertices.constData()); - _blendedVertexBuffers[index]->setSubData(verticesSize, normalsAndTangents.size() * sizeof(NormalType), (const gpu::Byte*) normalsAndTangents.data()); - _normalsAndTangents[index] = normalsAndTangents; + _blendshapeBuffers[index] = std::make_shared(); + QVector blendshapeOffset; + blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size()); + const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset); + _blendshapeBuffers[index]->setData(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData()); + _blendshapeOffsets[index] = blendshapeOffset; } void Model::createRenderItemSet() { @@ -1680,7 +1631,7 @@ void Model::createRenderItemSet() { // Create the render payloads int numParts = (int)mesh->getNumParts(); for (int partIndex = 0; partIndex < numParts; partIndex++) { - if (!fbxGeometry.meshes[i].blendshapes.empty() && _blendedVertexBuffers.find(i) == _blendedVertexBuffers.end()) { + if (_blendshapeBuffers.find(i) == _blendshapeBuffers.end()) { initializeBlendshapes(fbxGeometry.meshes[i], i); } _modelMeshRenderItems << std::make_shared(shared_from_this(), i, partIndex, shapeID, transform, offset); @@ -1794,9 +1745,9 @@ void ModelBlender::noteRequiresBlend(ModelPointer model) { _modelsRequiringBlends.insert(model); } -void ModelBlender::setBlendedVertices(ModelPointer model, int blendNumber, QVector vertices, QVector normalsAndTangents) { +void ModelBlender::setBlendedVertices(ModelPointer model, int blendNumber, QVector blendshapeOffsets) { if (model) { - model->setBlendedVertices(blendNumber, vertices, normalsAndTangents); + model->setBlendedVertices(blendNumber, blendshapeOffsets); } { Lock lock(_mutex); diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 447f75dd9d..da141bf905 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -75,6 +75,12 @@ struct SortedTriangleSet { int subMeshIndex; }; +struct BlendshapeOffset { + glm::vec4 positionOffsetAndSpare; + glm::vec4 normalOffsetAndSpare; + glm::vec4 tangentOffsetAndSpare; +}; + /// A generic 3D model displaying geometry loaded from a URL. class Model : public QObject, public std::enable_shared_from_this, public scriptable::ModelProvider { Q_OBJECT @@ -144,7 +150,7 @@ public: bool maybeStartBlender(); /// Sets blended vertices computed in a separate thread. - void setBlendedVertices(int blendNumber, const QVector& vertices, const QVector& normalsAndTangents); + void setBlendedVertices(int blendNumber, const QVector& blendshapeOffsets); bool isLoaded() const { return (bool)_renderGeometry && _renderGeometry->isGeometryLoaded(); } bool isAddedToScene() const { return _addedToScene; } @@ -344,7 +350,7 @@ public: void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName); void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName); - std::unordered_map> _normalsAndTangents; + std::unordered_map> _blendshapeOffsets; public slots: void loadURLFinished(bool success); @@ -424,8 +430,8 @@ protected: QUrl _url; - std::unordered_map _blendedVertexBuffers; - bool _blendedVertexBuffersInitialized { false }; + std::unordered_map _blendshapeBuffers; + bool _blendshapeBuffersInitialized{ false }; QVector>> _dilatedTextures; @@ -506,6 +512,7 @@ private: Q_DECLARE_METATYPE(ModelPointer) Q_DECLARE_METATYPE(Geometry::WeakPointer) +Q_DECLARE_METATYPE(BlendshapeOffset) /// Handle management of pending models that need blending class ModelBlender : public QObject, public Dependency { @@ -520,7 +527,7 @@ public: bool shouldComputeBlendshapes() { return _computeBlendshapes; } public slots: - void setBlendedVertices(ModelPointer model, int blendNumber, QVector vertices, QVector normalsAndTangents); + void setBlendedVertices(ModelPointer model, int blendNumber, QVector blendshapeOffsets); void setComputeBlendshapes(bool computeBlendshapes) { _computeBlendshapes = computeBlendshapes; } private: diff --git a/libraries/render-utils/src/SoftAttachmentModel.cpp b/libraries/render-utils/src/SoftAttachmentModel.cpp index b9a6581f1d..114ccab712 100644 --- a/libraries/render-utils/src/SoftAttachmentModel.cpp +++ b/libraries/render-utils/src/SoftAttachmentModel.cpp @@ -78,7 +78,7 @@ void SoftAttachmentModel::updateClusterMatrices() { // post the blender if we're not currently waiting for one to finish auto modelBlender = DependencyManager::get(); - if (_blendedVertexBuffersInitialized && modelBlender->shouldComputeBlendshapes() && geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { + if (_blendshapeBuffersInitialized && modelBlender->shouldComputeBlendshapes() && geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { _blendedBlendshapeCoefficients = _blendshapeCoefficients; modelBlender->noteRequiresBlend(getThisPointer()); } diff --git a/libraries/render-utils/src/model.slv b/libraries/render-utils/src/model.slv index 3763b8d2de..bc5371df34 100644 --- a/libraries/render-utils/src/model.slv +++ b/libraries/render-utils/src/model.slv @@ -1,10 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// model.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// Created by Andrzej Kapolka on 10/14/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. @@ -21,6 +20,7 @@ <$declareMaterialTexMapArrayBuffer()$> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; @@ -32,11 +32,11 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, inPosition, _positionWS, _positionES, gl_Position)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> } diff --git a/libraries/render-utils/src/model_fade.slv b/libraries/render-utils/src/model_fade.slv index 84f4f08fed..97c861616c 100644 --- a/libraries/render-utils/src/model_fade.slv +++ b/libraries/render-utils/src/model_fade.slv @@ -1,8 +1,7 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// model_fade.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // // Created by Olivier Prat on 04/24/17. // Copyright 2017 High Fidelity, Inc. @@ -33,7 +32,7 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/model_lightmap.slv b/libraries/render-utils/src/model_lightmap.slv index 7306e2c831..fe508d0912 100644 --- a/libraries/render-utils/src/model_lightmap.slv +++ b/libraries/render-utils/src/model_lightmap.slv @@ -1,9 +1,7 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // // Created by Sam Gateau on 11/21/14. // Copyright 2013 High Fidelity, Inc. diff --git a/libraries/render-utils/src/model_normal_map.slv b/libraries/render-utils/src/model_normal_map.slv index 4a1a0c9264..90d28acc90 100644 --- a/libraries/render-utils/src/model_normal_map.slv +++ b/libraries/render-utils/src/model_normal_map.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// model_normal_map.vert -// vertex shader -// -// Created by Andrzej Kapolka on 10/14/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. @@ -36,7 +34,7 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/model_normal_map_fade.slv b/libraries/render-utils/src/model_normal_map_fade.slv index 090027ac79..e2bba7f811 100644 --- a/libraries/render-utils/src/model_normal_map_fade.slv +++ b/libraries/render-utils/src/model_normal_map_fade.slv @@ -1,9 +1,7 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_normal_map_fade.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // // Created by Olivier Prat on 04/24/17. // Copyright 2017 High Fidelity, Inc. diff --git a/libraries/render-utils/src/model_shadow.slv b/libraries/render-utils/src/model_shadow.slv index c81235b392..0e6f05f09f 100644 --- a/libraries/render-utils/src/model_shadow.slv +++ b/libraries/render-utils/src/model_shadow.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// model_shadow.vert -// vertex shader -// -// Created by Andrzej Kapolka on 3/24/14. +// Created by Hifi Engine Team. // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/model_shadow_fade.slv b/libraries/render-utils/src/model_shadow_fade.slv index cf180c2dc8..70ffe855fb 100644 --- a/libraries/render-utils/src/model_shadow_fade.slv +++ b/libraries/render-utils/src/model_shadow_fade.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// model_shadow_fade.vert -// vertex shader -// -// Created by Olivier Prat on 06/045/17. +// Created by Olivier Prat on 06/05/17. // Copyright 2017 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/render-utils/model_lightmap.slp b/libraries/render-utils/src/render-utils/model_lightmap.slp index e69de29bb2..ea0b2cf566 100644 --- a/libraries/render-utils/src/render-utils/model_lightmap.slp +++ b/libraries/render-utils/src/render-utils/model_lightmap.slp @@ -0,0 +1 @@ +VERTEX model \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_lightmap_fade.slp b/libraries/render-utils/src/render-utils/model_lightmap_fade.slp index e69de29bb2..9505946c8d 100644 --- a/libraries/render-utils/src/render-utils/model_lightmap_fade.slp +++ b/libraries/render-utils/src/render-utils/model_lightmap_fade.slp @@ -0,0 +1 @@ +VERTEX model_fade \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_lightmap_normal_map.slp b/libraries/render-utils/src/render-utils/model_lightmap_normal_map.slp index e69de29bb2..c50be6285b 100644 --- a/libraries/render-utils/src/render-utils/model_lightmap_normal_map.slp +++ b/libraries/render-utils/src/render-utils/model_lightmap_normal_map.slp @@ -0,0 +1 @@ +VERTEX model_normal_map diff --git a/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp b/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp index e69de29bb2..93df8e9a9a 100644 --- a/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp +++ b/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp @@ -0,0 +1 @@ +VERTEX model_normal_map_fade \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_translucent.slp b/libraries/render-utils/src/render-utils/model_translucent.slp index e69de29bb2..ea0b2cf566 100644 --- a/libraries/render-utils/src/render-utils/model_translucent.slp +++ b/libraries/render-utils/src/render-utils/model_translucent.slp @@ -0,0 +1 @@ +VERTEX model \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_translucent_normal_map.slp b/libraries/render-utils/src/render-utils/model_translucent_normal_map.slp index e69de29bb2..659899f9f8 100644 --- a/libraries/render-utils/src/render-utils/model_translucent_normal_map.slp +++ b/libraries/render-utils/src/render-utils/model_translucent_normal_map.slp @@ -0,0 +1 @@ +VERTEX model_normal_map \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp b/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp index 01953a9891..41fbdeafbe 100644 --- a/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp +++ b/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp @@ -1 +1 @@ -VERTEX model_translucent_normal_map +VERTEX model_normal_map_fade diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index d44ca0ae3f..b5d186ecf1 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model.vert -// vertex shader -// -// Created by Andrzej Kapolka on 10/14/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index ff73c7a398..38867ca1fe 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model_dq.vert -// vertex shader -// -// Created by Andrzej Kapolka on 10/14/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_fade.slv b/libraries/render-utils/src/skin_model_fade.slv index 1689476d38..24d7d6c4cc 100644 --- a/libraries/render-utils/src/skin_model_fade.slv +++ b/libraries/render-utils/src/skin_model_fade.slv @@ -1,10 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// skin_model_fade.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // +// Created by Hifi Engine Team. // Created by Olivier Prat on 06/045/17. // Copyright 2017 High Fidelity, Inc. // diff --git a/libraries/render-utils/src/skin_model_fade_dq.slv b/libraries/render-utils/src/skin_model_fade_dq.slv index 6e64305de7..3bc3f8226b 100644 --- a/libraries/render-utils/src/skin_model_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_fade_dq.slv @@ -1,9 +1,7 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// skin_model_fade_dq.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // // Created by Olivier Prat on 06/045/17. // Copyright 2017 High Fidelity, Inc. diff --git a/libraries/render-utils/src/skin_model_normal_map.slv b/libraries/render-utils/src/skin_model_normal_map.slv index f67220c6bd..7b302bc695 100644 --- a/libraries/render-utils/src/skin_model_normal_map.slv +++ b/libraries/render-utils/src/skin_model_normal_map.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model_normal_map.vert -// vertex shader -// -// Created by Andrzej Kapolka on 10/29/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_normal_map_dq.slv b/libraries/render-utils/src/skin_model_normal_map_dq.slv index b5ffbdc49d..7c251e9264 100644 --- a/libraries/render-utils/src/skin_model_normal_map_dq.slv +++ b/libraries/render-utils/src/skin_model_normal_map_dq.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model_normal_map_dq.vert -// vertex shader -// -// Created by Andrzej Kapolka on 10/29/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_normal_map_fade.slv b/libraries/render-utils/src/skin_model_normal_map_fade.slv index 5759416d44..e1a015be6d 100644 --- a/libraries/render-utils/src/skin_model_normal_map_fade.slv +++ b/libraries/render-utils/src/skin_model_normal_map_fade.slv @@ -1,10 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// skin_model_normal_map_fade.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // +// Created by Hifi Engine Team. // Created by Olivier Prat on 06/045/17. // Copyright 2017 High Fidelity, Inc. // diff --git a/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv b/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv index e48bf47758..970e5362b5 100644 --- a/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model_normal_map_fade_dq.vert -// vertex shader -// -// Created by Andrzej Kapolka on 10/29/13. +// Created by Hifi Engine Team. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_shadow.slv b/libraries/render-utils/src/skin_model_shadow.slv index 03da2e074e..8ddfd34fcd 100644 --- a/libraries/render-utils/src/skin_model_shadow.slv +++ b/libraries/render-utils/src/skin_model_shadow.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model_shadow.vert -// vertex shader -// -// Created by Andrzej Kapolka on 3/24/14. +// Created by Hifi Engine Team. // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_shadow_dq.slv b/libraries/render-utils/src/skin_model_shadow_dq.slv index a60eed62d3..d75af69acd 100644 --- a/libraries/render-utils/src/skin_model_shadow_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_dq.slv @@ -1,11 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // -// skin_model_shadow_dq.vert -// vertex shader -// -// Created by Andrzej Kapolka on 3/24/14. +// Created by Hifi Engine Team. // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slv b/libraries/render-utils/src/skin_model_shadow_fade.slv index 4881cb9f62..afad370abc 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade.slv @@ -1,10 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// skin_model_shadow_fade.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // +// Created by Hifi Engine Team. // Created by Olivier Prat on 06/045/17. // Copyright 2017 High Fidelity, Inc. // diff --git a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv index c45107b47c..c5737e6c21 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv @@ -1,10 +1,9 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// skin_model_shadow_fade_dq.vert -// vertex shader +// <$_SCRIBE_FILENAME$> +// Generated on <$_SCRIBE_DATE$> // +// Created by Hifi Engine Team. // Created by Olivier Prat on 06/045/17. // Copyright 2017 High Fidelity, Inc. // From 61644c48f0606bbcd5938be542ec5fef18f7f7ba Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 19 Sep 2018 09:18:09 -0700 Subject: [PATCH 004/157] Update the slp tp reflect the chanes in the vertex shaders --- libraries/render-utils/src/render-utils/model_fade.slp | 1 + libraries/render-utils/src/render-utils/model_lightmap_fade.slp | 2 +- .../src/render-utils/model_lightmap_normal_map_fade.slp | 2 +- .../render-utils/src/render-utils/model_normal_map_fade.slp | 1 + libraries/render-utils/src/render-utils/model_shadow_fade.slp | 1 + .../render-utils/src/render-utils/model_translucent_fade.slp | 2 +- .../src/render-utils/model_translucent_normal_map_fade.slp | 2 +- .../src/render-utils/model_translucent_unlit_fade.slp | 2 +- libraries/render-utils/src/render-utils/model_unlit_fade.slp | 2 +- libraries/render-utils/src/render-utils/skin_model_fade.slp | 1 + libraries/render-utils/src/render-utils/skin_model_fade_dq.slp | 1 + .../src/render-utils/skin_model_normal_map_fade.slp | 1 + .../src/render-utils/skin_model_normal_map_fade_dq.slp | 1 + .../src/render-utils/skin_model_normal_map_translucent.slp | 2 +- .../src/render-utils/skin_model_normal_map_translucent_dq.slp | 2 +- .../src/render-utils/skin_model_normal_map_translucent_fade.slp | 2 +- .../render-utils/skin_model_normal_map_translucent_fade_dq.slp | 2 +- .../render-utils/src/render-utils/skin_model_shadow_fade.slp | 1 + .../render-utils/src/render-utils/skin_model_shadow_fade_dq.slp | 1 + .../render-utils/src/render-utils/skin_model_translucent.slp | 2 +- .../render-utils/src/render-utils/skin_model_translucent_dq.slp | 2 +- .../src/render-utils/skin_model_translucent_fade.slp | 2 +- .../src/render-utils/skin_model_translucent_fade_dq.slp | 2 +- 23 files changed, 23 insertions(+), 14 deletions(-) diff --git a/libraries/render-utils/src/render-utils/model_fade.slp b/libraries/render-utils/src/render-utils/model_fade.slp index e69de29bb2..ea0b2cf566 100644 --- a/libraries/render-utils/src/render-utils/model_fade.slp +++ b/libraries/render-utils/src/render-utils/model_fade.slp @@ -0,0 +1 @@ +VERTEX model \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_lightmap_fade.slp b/libraries/render-utils/src/render-utils/model_lightmap_fade.slp index 9505946c8d..ea0b2cf566 100644 --- a/libraries/render-utils/src/render-utils/model_lightmap_fade.slp +++ b/libraries/render-utils/src/render-utils/model_lightmap_fade.slp @@ -1 +1 @@ -VERTEX model_fade \ No newline at end of file +VERTEX model \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp b/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp index 93df8e9a9a..659899f9f8 100644 --- a/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp +++ b/libraries/render-utils/src/render-utils/model_lightmap_normal_map_fade.slp @@ -1 +1 @@ -VERTEX model_normal_map_fade \ No newline at end of file +VERTEX model_normal_map \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_normal_map_fade.slp b/libraries/render-utils/src/render-utils/model_normal_map_fade.slp index e69de29bb2..659899f9f8 100644 --- a/libraries/render-utils/src/render-utils/model_normal_map_fade.slp +++ b/libraries/render-utils/src/render-utils/model_normal_map_fade.slp @@ -0,0 +1 @@ +VERTEX model_normal_map \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_shadow_fade.slp b/libraries/render-utils/src/render-utils/model_shadow_fade.slp index e69de29bb2..f43521cba6 100644 --- a/libraries/render-utils/src/render-utils/model_shadow_fade.slp +++ b/libraries/render-utils/src/render-utils/model_shadow_fade.slp @@ -0,0 +1 @@ +VERTEX model_shadow \ No newline at end of file diff --git a/libraries/render-utils/src/render-utils/model_translucent_fade.slp b/libraries/render-utils/src/render-utils/model_translucent_fade.slp index ba3a685b5b..81ac672062 100644 --- a/libraries/render-utils/src/render-utils/model_translucent_fade.slp +++ b/libraries/render-utils/src/render-utils/model_translucent_fade.slp @@ -1 +1 @@ -VERTEX model_fade +VERTEX model diff --git a/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp b/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp index 41fbdeafbe..c50be6285b 100644 --- a/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp +++ b/libraries/render-utils/src/render-utils/model_translucent_normal_map_fade.slp @@ -1 +1 @@ -VERTEX model_normal_map_fade +VERTEX model_normal_map diff --git a/libraries/render-utils/src/render-utils/model_translucent_unlit_fade.slp b/libraries/render-utils/src/render-utils/model_translucent_unlit_fade.slp index ba3a685b5b..81ac672062 100644 --- a/libraries/render-utils/src/render-utils/model_translucent_unlit_fade.slp +++ b/libraries/render-utils/src/render-utils/model_translucent_unlit_fade.slp @@ -1 +1 @@ -VERTEX model_fade +VERTEX model diff --git a/libraries/render-utils/src/render-utils/model_unlit_fade.slp b/libraries/render-utils/src/render-utils/model_unlit_fade.slp index ba3a685b5b..81ac672062 100644 --- a/libraries/render-utils/src/render-utils/model_unlit_fade.slp +++ b/libraries/render-utils/src/render-utils/model_unlit_fade.slp @@ -1 +1 @@ -VERTEX model_fade +VERTEX model diff --git a/libraries/render-utils/src/render-utils/skin_model_fade.slp b/libraries/render-utils/src/render-utils/skin_model_fade.slp index 2b354b0832..798a0a826d 100644 --- a/libraries/render-utils/src/render-utils/skin_model_fade.slp +++ b/libraries/render-utils/src/render-utils/skin_model_fade.slp @@ -1 +1,2 @@ +VERTEX skin_model FRAGMENT model_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp index 2b354b0832..2d4c6cd9cd 100644 --- a/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp @@ -1 +1,2 @@ +VERTEX skin_model_dq FRAGMENT model_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp index 36e92e03e8..1730c25aad 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp @@ -1 +1,2 @@ +VERTEX skin_model_normal_map FRAGMENT model_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp index 36e92e03e8..cac2c5d1b6 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp @@ -1 +1,2 @@ +VERTEX skin_model_normal_map_dq FRAGMENT model_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp index c1b0ee2841..3404358b00 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map_fade +VERTEX skin_model_normal_map FRAGMENT model_translucent_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp index 58947f1bae..6a8c3ada0c 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map_fade_dq +VERTEX skin_model_normal_map_dq FRAGMENT model_translucent_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp index 6698d1b7be..5286615a99 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map_fade +VERTEX skin_model_normal_map FRAGMENT model_translucent_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp index d2e938bd2a..d493c20aa9 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map_fade_dq +VERTEX skin_model_normal_map_dq FRAGMENT model_translucent_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp index f356a5638d..bb15fd1ef5 100644 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp +++ b/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp @@ -1 +1,2 @@ +VERTEX skin_model_shadow FRAGMENT model_shadow diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp index a7e3f3328b..57bf072969 100644 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp @@ -1 +1,2 @@ +VERTEX skin_model_shadow_dq FRAGMENT model_shadow_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent.slp b/libraries/render-utils/src/render-utils/skin_model_translucent.slp index 469224f9fd..030db7b091 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent.slp +++ b/libraries/render-utils/src/render-utils/skin_model_translucent.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_fade +VERTEX skin_model FRAGMENT model_translucent diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp b/libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp index fdac5044ce..e56a4cba7f 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_fade_dq +VERTEX skin_model_dq FRAGMENT model_translucent diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp b/libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp index c6ff435342..af2df840e9 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp +++ b/libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_fade +VERTEX skin_model FRAGMENT model_translucent_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp index 7361a0fd71..3cdfdabc62 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_fade_dq +VERTEX skin_model_dq FRAGMENT model_translucent_fade From c05cbf065b3098f89e675120564f10fb171551bd Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 19 Sep 2018 10:13:14 -0700 Subject: [PATCH 005/157] fixing the texcoord1 input in skined vertex shader --- libraries/render-utils/src/skin_model.slv | 2 +- libraries/render-utils/src/skin_model_dq.slv | 2 +- libraries/render-utils/src/skin_model_fade.slv | 3 +-- libraries/render-utils/src/skin_model_fade_dq.slv | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index b5d186ecf1..3795cf1844 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -40,7 +40,7 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index 38867ca1fe..52588282e3 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -40,7 +40,7 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/skin_model_fade.slv b/libraries/render-utils/src/skin_model_fade.slv index 24d7d6c4cc..f2db64d590 100644 --- a/libraries/render-utils/src/skin_model_fade.slv +++ b/libraries/render-utils/src/skin_model_fade.slv @@ -3,7 +3,6 @@ // <$_SCRIBE_FILENAME$> // Generated on <$_SCRIBE_DATE$> // -// Created by Hifi Engine Team. // Created by Olivier Prat on 06/045/17. // Copyright 2017 High Fidelity, Inc. // @@ -42,7 +41,7 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/skin_model_fade_dq.slv b/libraries/render-utils/src/skin_model_fade_dq.slv index 3bc3f8226b..8af463f240 100644 --- a/libraries/render-utils/src/skin_model_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_fade_dq.slv @@ -41,7 +41,7 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); From 4ce942b0f2ec13801d01a819609df0c35390ec63 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 19 Sep 2018 13:00:56 -0700 Subject: [PATCH 006/157] updating spawn location/floor in redirect --- interface/resources/serverless/redirect.json | 52 +++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/interface/resources/serverless/redirect.json b/interface/resources/serverless/redirect.json index 64cb4d8a3f..97cd75c8cd 100644 --- a/interface/resources/serverless/redirect.json +++ b/interface/resources/serverless/redirect.json @@ -2,7 +2,7 @@ "DataVersion": 0, "Paths": { - "/": "/4,1.4,4/0,0.49544,0,0.868645" + "/": "/5.77,1.4,4.96/0,0.49544,0,0.868645" }, "Entities": [ { @@ -96,6 +96,53 @@ "userData": "{\"grabbableKey\":{\"grabbable\":false}}", "visible": false }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-05T00:40:03Z", + "dimensions": { + "blue": 6.9401350021362305, + "green": 0.04553089290857315, + "red": 7.004304885864258, + "x": 7.004304885864258, + "y": 0.04553089290857315, + "z": 6.9401350021362305 + }, + "id": "{33440bf8-f9ce-4d52-9b29-1b321e226982}", + "lastEdited": 1536107948774796, + "lastEditedBy": "{4eecd88f-ef9b-4a83-bb9a-7f7496209c6b}", + "locked": true, + "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/floor.fbx", + "name": "floorModel", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 3.6175529956817627, + "green": 0, + "red": 4.102385997772217, + "x": 4.102385997772217, + "y": 0, + "z": 3.6175529956817627 + }, + "queryAACube": { + "scale": 9.860417366027832, + "x": -0.8278226852416992, + "y": -4.930208683013916, + "z": -1.3126556873321533 + }, + "rotation": { + "w": 0.8660253882408142, + "x": -1.5922749298624694e-05, + "y": 0.5, + "z": -4.572480611386709e-05 + }, + "shapeType": "simple-hull", + "type": "Model", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}" + }, { "clientOnly": false, "color": { @@ -140,7 +187,8 @@ }, "shape": "Cube", "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false }, { "clientOnly": false, From 4fc6466250520806ee46743a076b50001b0dd5b1 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 19 Sep 2018 17:27:58 -0700 Subject: [PATCH 007/157] update shaders --- libraries/render-utils/src/LightingModel.cpp | 32 ++++++++++ libraries/render-utils/src/LightingModel.h | 21 ++++++- libraries/render-utils/src/LightingModel.slh | 13 +++- libraries/render-utils/src/Model.cpp | 2 +- libraries/render-utils/src/model_fade.slv | 43 ------------- libraries/render-utils/src/model_lightmap.slv | 42 ------------- .../render-utils/src/model_lightmap_fade.slv | 48 -------------- .../src/model_lightmap_normal_map.slv | 47 -------------- .../src/model_lightmap_normal_map_fade.slv | 48 -------------- .../src/model_normal_map_fade.slv | 46 -------------- .../render-utils/src/model_translucent.slv | 44 ------------- .../src/model_translucent_normal_map.slv | 46 -------------- libraries/render-utils/src/skin_model.slv | 23 ++++--- libraries/render-utils/src/skin_model_dq.slv | 23 ++++--- .../render-utils/src/skin_model_fade.slv | 52 ---------------- .../render-utils/src/skin_model_fade_dq.slv | 52 ---------------- .../src/skin_model_normal_map.slv | 39 +++++++----- .../src/skin_model_normal_map_dq.slv | 41 +++++++----- .../src/skin_model_normal_map_fade.slv | 62 ------------------- .../src/skin_model_normal_map_fade_dq.slv | 61 ------------------ .../render-utils/src/skin_model_shadow.slv | 14 ++++- .../render-utils/src/skin_model_shadow_dq.slv | 14 ++++- .../src/skin_model_shadow_fade.slv | 16 +++-- .../src/skin_model_shadow_fade_dq.slv | 18 ++++-- 24 files changed, 185 insertions(+), 662 deletions(-) delete mode 100644 libraries/render-utils/src/model_fade.slv delete mode 100644 libraries/render-utils/src/model_lightmap.slv delete mode 100644 libraries/render-utils/src/model_lightmap_fade.slv delete mode 100644 libraries/render-utils/src/model_lightmap_normal_map.slv delete mode 100644 libraries/render-utils/src/model_lightmap_normal_map_fade.slv delete mode 100644 libraries/render-utils/src/model_normal_map_fade.slv delete mode 100644 libraries/render-utils/src/model_translucent.slv delete mode 100644 libraries/render-utils/src/model_translucent_normal_map.slv delete mode 100644 libraries/render-utils/src/skin_model_fade.slv delete mode 100644 libraries/render-utils/src/skin_model_fade_dq.slv delete mode 100644 libraries/render-utils/src/skin_model_normal_map_fade.slv delete mode 100644 libraries/render-utils/src/skin_model_normal_map_fade_dq.slv diff --git a/libraries/render-utils/src/LightingModel.cpp b/libraries/render-utils/src/LightingModel.cpp index 23d4c66fd5..70262a29a6 100644 --- a/libraries/render-utils/src/LightingModel.cpp +++ b/libraries/render-utils/src/LightingModel.cpp @@ -159,6 +159,34 @@ void LightingModel::setWireframe(bool enable) { bool LightingModel::isWireframeEnabled() const { return (bool)_parametersBuffer.get().enableWireframe; } + +void LightingModel::setBloom(bool enable) { + if (enable != isBloomEnabled()) { + _parametersBuffer.edit().enableBloom = (float)enable; + } +} +bool LightingModel::isBloomEnabled() const { + return (bool)_parametersBuffer.get().enableBloom; +} + +void LightingModel::setSkinning(bool enable) { + if (enable != isSkinningEnabled()) { + _parametersBuffer.edit().enableSkinning = (float)enable; + } +} +bool LightingModel::isSkinningEnabled() const { + return (bool)_parametersBuffer.get().enableSkinning; +} + +void LightingModel::setBlendshape(bool enable) { + if (enable != isBlendshapeEnabled()) { + _parametersBuffer.edit().enableBlendshape = (float)enable; + } +} +bool LightingModel::isBlendshapeEnabled() const { + return (bool)_parametersBuffer.get().enableBlendshape; +} + MakeLightingModel::MakeLightingModel() { _lightingModel = std::make_shared(); } @@ -169,6 +197,7 @@ void MakeLightingModel::configure(const Config& config) { _lightingModel->setLightmap(config.enableLightmap); _lightingModel->setBackground(config.enableBackground); _lightingModel->setHaze(config.enableHaze); + _lightingModel->setBloom(config.enableBloom); _lightingModel->setObscurance(config.enableObscurance); @@ -186,6 +215,9 @@ void MakeLightingModel::configure(const Config& config) { _lightingModel->setShowLightContour(config.showLightContour); _lightingModel->setWireframe(config.enableWireframe); + + _lightingModel->setSkinning(config.enableSkinning); + _lightingModel->setBlendshape(config.enableBlendshape); } void MakeLightingModel::run(const render::RenderContextPointer& renderContext, LightingModelPointer& lightingModel) { diff --git a/libraries/render-utils/src/LightingModel.h b/libraries/render-utils/src/LightingModel.h index c71917603c..c210358ed6 100644 --- a/libraries/render-utils/src/LightingModel.h +++ b/libraries/render-utils/src/LightingModel.h @@ -38,6 +38,8 @@ public: void setHaze(bool enable); bool isHazeEnabled() const; + void setBloom(bool enable); + bool isBloomEnabled() const; void setObscurance(bool enable); bool isObscuranceEnabled() const; @@ -69,6 +71,10 @@ public: void setWireframe(bool enable); bool isWireframeEnabled() const; + void setSkinning(bool enable); + bool isSkinningEnabled() const; + void setBlendshape(bool enable); + bool isBlendshapeEnabled() const; UniformBufferView getParametersBuffer() const { return _parametersBuffer; } @@ -102,9 +108,9 @@ protected: float enableWireframe { 0.0f }; // false by default float enableHaze{ 1.0f }; - float spare1; // Needed for having the LightingModel class aligned on a 4 scalar boundary for gpu - float spare2; - float spare3; + float enableBloom{ 1.0f }; + float enableSkinning{ 1.0f }; + float enableBlendshape{ 1.0f }; Parameters() {} }; @@ -142,6 +148,11 @@ class MakeLightingModelConfig : public render::Job::Config { Q_PROPERTY(bool enableWireframe MEMBER enableWireframe NOTIFY dirty) Q_PROPERTY(bool showLightContour MEMBER showLightContour NOTIFY dirty) + Q_PROPERTY(bool enableBloom MEMBER enableBloom NOTIFY dirty) + Q_PROPERTY(bool enableSkinning MEMBER enableSkinning NOTIFY dirty) + Q_PROPERTY(bool enableBlendshape MEMBER enableBlendshape NOTIFY dirty) + + public: MakeLightingModelConfig() : render::Job::Config() {} // Make Lighting Model is always on @@ -168,6 +179,10 @@ public: bool enableWireframe { false }; // false by default bool enableHaze{ true }; + bool enableBloom{ true }; + bool enableSkinning{ true }; + bool enableBlendshape{ true }; + signals: void dirty(); }; diff --git a/libraries/render-utils/src/LightingModel.slh b/libraries/render-utils/src/LightingModel.slh index 10a2afabef..d10a52be60 100644 --- a/libraries/render-utils/src/LightingModel.slh +++ b/libraries/render-utils/src/LightingModel.slh @@ -19,7 +19,7 @@ struct LightingModel { vec4 _ScatteringDiffuseSpecularAlbedo; vec4 _AmbientDirectionalPointSpot; vec4 _ShowContourObscuranceWireframe; - vec4 _Haze_spareyzw; + vec4 _HazeBloomSkinningBlendshape; }; // See DeferredShader_BufferSlot in DeferredLightingEffect.cpp @@ -78,7 +78,16 @@ float isWireframeEnabled() { } float isHazeEnabled() { - return lightingModel._Haze_spareyzw.x; + return lightingModel._HazeBloomSkinningBlendshape.x; +} +float isBloomEnabled() { + return lightingModel._HazeBloomSkinningBlendshape.y; +} +float isSkinningEnabled() { + return lightingModel._HazeBloomSkinningBlendshape.z; +} +float isBlendshapeEnabled() { + return lightingModel._HazeBloomSkinningBlendshape.w; } <@endfunc@> diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 3bc22f9e79..7611171557 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1641,7 +1641,7 @@ void Model::createRenderItemSet() { shapeID++; } } - _blendedVertexBuffersInitialized = true; + _blendshapeBuffersInitialized = true; } bool Model::isRenderable() const { diff --git a/libraries/render-utils/src/model_fade.slv b/libraries/render-utils/src/model_fade.slv deleted file mode 100644 index 97c861616c..0000000000 --- a/libraries/render-utils/src/model_fade.slv +++ /dev/null @@ -1,43 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Olivier Prat on 04/24/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; - -void main(void) { - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.w; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> -} diff --git a/libraries/render-utils/src/model_lightmap.slv b/libraries/render-utils/src/model_lightmap.slv deleted file mode 100644 index fe508d0912..0000000000 --- a/libraries/render-utils/src/model_lightmap.slv +++ /dev/null @@ -1,42 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Sam Gateau on 11/21/14. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<@include graphics/MaterialTextures.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> - -<$declareMaterialTexMapArrayBuffer()$> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; - -void main(void) { - // pass along the color in linear space - _color.rgb = color_sRGBToLinear(inColor.xyz); - - // and the texture coordinates - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> -} \ No newline at end of file diff --git a/libraries/render-utils/src/model_lightmap_fade.slv b/libraries/render-utils/src/model_lightmap_fade.slv deleted file mode 100644 index d174d3c1d3..0000000000 --- a/libraries/render-utils/src/model_lightmap_fade.slv +++ /dev/null @@ -1,48 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_fade.vert -// vertex shader -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - // pass along the color in linear space - _color.rgb = color_sRGBToLinear(inColor.xyz); - _color.a = 1.0; - - // and the texture coordinates - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> -} - diff --git a/libraries/render-utils/src/model_lightmap_normal_map.slv b/libraries/render-utils/src/model_lightmap_normal_map.slv deleted file mode 100644 index 17794bce5f..0000000000 --- a/libraries/render-utils/src/model_lightmap_normal_map.slv +++ /dev/null @@ -1,47 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_normal_map.vert -// vertex shader -// -// Created by Sam Gateau on 11/21/14. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<@include graphics/MaterialTextures.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> - -<$declareMaterialTexMapArrayBuffer()$> - - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; - -void main(void) { - // pass along the color in linear space - _color.rgb = color_sRGBToLinear(inColor.xyz); - _color.a = 1.0; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> - <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> -} diff --git a/libraries/render-utils/src/model_lightmap_normal_map_fade.slv b/libraries/render-utils/src/model_lightmap_normal_map_fade.slv deleted file mode 100644 index 50a2bc43c9..0000000000 --- a/libraries/render-utils/src/model_lightmap_normal_map_fade.slv +++ /dev/null @@ -1,48 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_normal_map_fade.vert -// vertex shader -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<@include graphics/MaterialTextures.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> -<$declareMaterialTexMapArrayBuffer()$> - - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - // pass along the color in linear space - _color.rgb = color_sRGBToLinear(inColor.xyz); - _color.a = 1.0; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> - <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> -} diff --git a/libraries/render-utils/src/model_normal_map_fade.slv b/libraries/render-utils/src/model_normal_map_fade.slv deleted file mode 100644 index e2bba7f811..0000000000 --- a/libraries/render-utils/src/model_normal_map_fade.slv +++ /dev/null @@ -1,46 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Olivier Prat on 04/24/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<@include graphics/MaterialTextures.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> -<$declareMaterialTexMapArrayBuffer()$> - - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; - -void main(void) { - // pass along the color - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> - <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> -} diff --git a/libraries/render-utils/src/model_translucent.slv b/libraries/render-utils/src/model_translucent.slv deleted file mode 100644 index 70e61cd788..0000000000 --- a/libraries/render-utils/src/model_translucent.slv +++ /dev/null @@ -1,44 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// model_translucent.vert -// vertex shader -// -// Created by Olivier Prat on 15/01/18. -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; - -void main(void) { - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> -} diff --git a/libraries/render-utils/src/model_translucent_normal_map.slv b/libraries/render-utils/src/model_translucent_normal_map.slv deleted file mode 100644 index 299e1f53e1..0000000000 --- a/libraries/render-utils/src/model_translucent_normal_map.slv +++ /dev/null @@ -1,46 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// model_translucent_normal_map.vert -// vertex shader -// -// Created by Olivier Prat on 23/01/18. -// Copyright 2018 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; - -void main(void) { - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> - <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> -} diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index 3795cf1844..9f173bf7dc 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -15,24 +15,31 @@ <@include gpu/Transform.slh@> <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> +<@include Skinning.slh@> +<$declareUseDualQuaternionSkinning()$> + +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets(1)$> + <@include render-utils/ShaderConstants.h@> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec3 interpolatedNormal = vec3(0.0, 0.0, 0.0); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 deformedNormal = vec3(0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal); - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal); + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); + skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, skinnedPosition, skinnedNormal); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -45,6 +52,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index 52588282e3..0b58021703 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -15,24 +15,31 @@ <@include gpu/Transform.slh@> <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> +<@include Skinning.slh@> +<$declareUseDualQuaternionSkinning(1)$> + +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets(1)$> + <@include render-utils/ShaderConstants.h@> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec3 interpolatedNormal = vec3(0.0, 0.0, 0.0); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 deformedNormal = vec3(0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal); - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal); + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); + skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, skinnedPosition, skinnedNormal); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -45,6 +52,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_fade.slv b/libraries/render-utils/src/skin_model_fade.slv deleted file mode 100644 index f2db64d590..0000000000 --- a/libraries/render-utils/src/skin_model_fade.slv +++ /dev/null @@ -1,52 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Olivier Prat on 06/045/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec3 interpolatedNormal = vec3(0.0, 0.0, 0.0); - - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal); - - // pass along the color - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, position, _positionWS)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$> -} diff --git a/libraries/render-utils/src/skin_model_fade_dq.slv b/libraries/render-utils/src/skin_model_fade_dq.slv deleted file mode 100644 index 8af463f240..0000000000 --- a/libraries/render-utils/src/skin_model_fade_dq.slv +++ /dev/null @@ -1,52 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Olivier Prat on 06/045/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec3 interpolatedNormal = vec3(0.0, 0.0, 0.0); - - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal); - - // pass along the color - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, position, _positionWS)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$> -} diff --git a/libraries/render-utils/src/skin_model_normal_map.slv b/libraries/render-utils/src/skin_model_normal_map.slv index 7b302bc695..56e221fbef 100644 --- a/libraries/render-utils/src/skin_model_normal_map.slv +++ b/libraries/render-utils/src/skin_model_normal_map.slv @@ -15,14 +15,18 @@ <@include gpu/Transform.slh@> <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> +<@include Skinning.slh@> +<$declareUseDualQuaternionSkinning()$> + +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets(1, 1)$> + <@include render-utils/ShaderConstants.h@> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; @@ -30,11 +34,18 @@ layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedTangent = vec4(0.0, 0.0, 0.0, 0.0); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 deformedNormal = vec3(0.0, 0.0, 0.0); + vec3 deformedTangent = vec3(0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent); - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, inTangent.xyz, position, interpolatedNormal.xyz, interpolatedTangent.xyz); + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); + vec3 skinnedTangent = vec3(0.0, 0.0, 0.0); + skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, deformedTangent, skinnedPosition, skinnedNormal, skinnedTangent); + +// skinnedNormal = normalize(skinnedNormal); +// skinnedTangent = normalize(skinnedTangent); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -42,18 +53,12 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - interpolatedNormal = vec4(normalize(interpolatedNormal.xyz), 0.0); - interpolatedTangent = vec4(normalize(interpolatedTangent.xyz), 0.0); + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, interpolatedNormal.xyz)$> - <$transformModelToWorldDir(cam, obj, interpolatedTangent.xyz, interpolatedTangent.xyz)$> - - _normalWS = interpolatedNormal.xyz; - _tangentWS = interpolatedTangent.xyz; + <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> + <$transformModelToWorldDir(cam, obj, skinnedTangent, _tangentWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_normal_map_dq.slv b/libraries/render-utils/src/skin_model_normal_map_dq.slv index 7c251e9264..89d94e5eeb 100644 --- a/libraries/render-utils/src/skin_model_normal_map_dq.slv +++ b/libraries/render-utils/src/skin_model_normal_map_dq.slv @@ -16,12 +16,18 @@ <@include render-utils/ShaderConstants.h@> <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> +<@include Skinning.slh@> +<$declareUseDualQuaternionSkinning(1)$> + +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets(1, 1)$> + +<@include render-utils/ShaderConstants.h@> + +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; @@ -29,11 +35,18 @@ layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedTangent = vec4(0.0, 0.0, 0.0, 0.0); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 deformedNormal = vec3(0.0, 0.0, 0.0); + vec3 deformedTangent = vec3(0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent); - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, inTangent.xyz, position, interpolatedNormal.xyz, interpolatedTangent.xyz); + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); + vec3 skinnedTangent = vec3(0.0, 0.0, 0.0); + skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, deformedTangent, skinnedPosition, skinnedNormal, skinnedTangent); + + skinnedNormal = normalize(skinnedNormal); + skinnedTangent = normalize(skinnedTangent); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -41,18 +54,12 @@ void main(void) { TexMapArray texMapArray = getTexMapArray(); <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - interpolatedNormal = vec4(normalize(interpolatedNormal.xyz), 0.0); - interpolatedTangent = vec4(normalize(interpolatedTangent.xyz), 0.0); + <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord1, _texCoord01.zw)$> // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, interpolatedNormal.xyz)$> - <$transformModelToWorldDir(cam, obj, interpolatedTangent.xyz, interpolatedTangent.xyz)$> - - _normalWS = interpolatedNormal.xyz; - _tangentWS = interpolatedTangent.xyz; + <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> + <$transformModelToWorldDir(cam, obj, skinnedTangent, _tangentWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_normal_map_fade.slv b/libraries/render-utils/src/skin_model_normal_map_fade.slv deleted file mode 100644 index e1a015be6d..0000000000 --- a/libraries/render-utils/src/skin_model_normal_map_fade.slv +++ /dev/null @@ -1,62 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Hifi Engine Team. -// Created by Olivier Prat on 06/045/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedTangent = vec4(0.0, 0.0, 0.0, 0.0); - - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, inTangent.xyz, position, interpolatedNormal.xyz, interpolatedTangent.xyz); - - // pass along the color - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - interpolatedNormal = vec4(normalize(interpolatedNormal.xyz), 0.0); - interpolatedTangent = vec4(normalize(interpolatedTangent.xyz), 0.0); - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, position, _positionWS)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, interpolatedNormal.xyz)$> - <$transformModelToWorldDir(cam, obj, interpolatedTangent.xyz, interpolatedTangent.xyz)$> - - _normalWS = interpolatedNormal.xyz; - _tangentWS = interpolatedTangent.xyz; -} diff --git a/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv b/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv deleted file mode 100644 index 970e5362b5..0000000000 --- a/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv +++ /dev/null @@ -1,61 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Hifi Engine Team. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - -<@include graphics/MaterialTextures.slh@> -<$declareMaterialTexMapArrayBuffer()$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; -layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; -layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; -layout(location=RENDER_UTILS_ATTR_TANGENT_WS) out vec3 _tangentWS; -layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0); - vec4 interpolatedTangent = vec4(0.0, 0.0, 0.0, 0.0); - - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, inTangent.xyz, position, interpolatedNormal.xyz, interpolatedTangent.xyz); - - // pass along the color - _color.rgb = color_sRGBToLinear(inColor.rgb); - _color.a = inColor.a; - - TexMapArray texMapArray = getTexMapArray(); - <$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord01.xy)$> - <$evalTexMapArrayTexcoord1(texMapArray, inTexCoord0, _texCoord01.zw)$> - - interpolatedNormal = vec4(normalize(interpolatedNormal.xyz), 0.0); - interpolatedTangent = vec4(normalize(interpolatedTangent.xyz), 0.0); - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> - <$transformModelToWorldPos(obj, position, _positionWS)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, interpolatedNormal.xyz)$> - <$transformModelToWorldDir(cam, obj, interpolatedTangent.xyz, interpolatedTangent.xyz)$> - - _normalWS = interpolatedNormal.xyz; - _tangentWS = interpolatedTangent.xyz; -} diff --git a/libraries/render-utils/src/skin_model_shadow.slv b/libraries/render-utils/src/skin_model_shadow.slv index 8ddfd34fcd..6abf509be8 100644 --- a/libraries/render-utils/src/skin_model_shadow.slv +++ b/libraries/render-utils/src/skin_model_shadow.slv @@ -17,12 +17,20 @@ <@include Skinning.slh@> <$declareUseDualQuaternionSkinning()$> +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets()$> + +<@include render-utils/ShaderConstants.h@> + void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, inPosition, position); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); + + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, position, gl_Position)$> + <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_dq.slv b/libraries/render-utils/src/skin_model_shadow_dq.slv index d75af69acd..3233278fe3 100644 --- a/libraries/render-utils/src/skin_model_shadow_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_dq.slv @@ -17,12 +17,20 @@ <@include Skinning.slh@> <$declareUseDualQuaternionSkinning(1)$> +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets()$> + +<@include render-utils/ShaderConstants.h@> + void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, inPosition, position); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); + + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, position, gl_Position)$> + <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slv b/libraries/render-utils/src/skin_model_shadow_fade.slv index afad370abc..aa05684ce5 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade.slv @@ -20,15 +20,23 @@ <@include Skinning.slh@> <$declareUseDualQuaternionSkinning()$> +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets()$> + +<@include render-utils/ShaderConstants.h@> + layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, inPosition, position); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); + + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, position, gl_Position)$> - <$transformModelToWorldPos(obj, position, _positionWS)$> + <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> + <$transformModelToWorldPos(obj, skinnedPosition, _positionWS)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv index c5737e6c21..a8cad12d76 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv @@ -14,21 +14,29 @@ <@include gpu/Inputs.slh@> <@include gpu/Transform.slh@> <@include render-utils/ShaderConstants.h@> -<@include Skinning.slh@> <$declareStandardTransform()$> +<@include Skinning.slh@> <$declareUseDualQuaternionSkinning(1)$> +<@include Blendshape.slh@> +<$declareApplyBlendshapeOffsets()$> + +<@include render-utils/ShaderConstants.h@> + layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; void main(void) { - vec4 position = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, inPosition, position); + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); + + vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); + skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, position, gl_Position)$> - <$transformModelToWorldPos(obj, position, _positionWS)$> + <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> + <$transformModelToWorldPos(obj, skinnedPosition, _positionWS)$> } From 6b6551c8bd7657f94f4adb1d93967e125dff63de Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 19 Sep 2018 17:29:10 -0700 Subject: [PATCH 008/157] the missing file --- libraries/render-utils/src/Blendshape.slh | 62 +++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 libraries/render-utils/src/Blendshape.slh diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh new file mode 100644 index 0000000000..51381241eb --- /dev/null +++ b/libraries/render-utils/src/Blendshape.slh @@ -0,0 +1,62 @@ +// +// Created by Sam Gondelman on 9/13/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +<@if not BLENDSHAPE_SLH@> +<@def BLENDSHAPE_SLH@> + +<@func declareApplyBlendshapeOffsets(USE_NORMAL, USE_TANGENT)@> + +struct BlendshapeOffset { + vec4 position; + vec4 normal; + vec4 tangent; +}; + +#if defined(GPU_GL410) +layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; +BlendshapeOffset getBlendshapeOffset(int i) { + int offset = 3 * i; + BlendshapeOffset blendshapeOffset; + blendshapeOffset.position = texelFetch(blendshapeOffsetsBuffer, offset); +<@if USE_NORMAL@> + blendshapeOffset.normal = texelFetch(blendshapeOffsetsBuffer, offset + 1); +<@endif@> +<@if USE_TANGENT@> + blendshapeOffset.tangent = texelFetch(blendshapeOffsetsBuffer, offset + 2); +<@endif@> + return blendshapeOffset; +} +#else +layout(std140, binding=0) buffer blendshapeOffsetsBuffer { + BlendshapeOffset _blendshapeOffsets[]; +}; +BlendshapeOffset getBlendshapeOffset(int i) { + return _blendshapeOffsets[i]; +} +#endif + +void applyBlendshapeOffset(int i, vec4 inPosition, out vec4 position +<@if USE_NORMAL@> + , vec3 inNormal, out vec3 normal +<@endif@> +<@if USE_TANGENT@> + , vec3 inTangent, out vec3 tangent +<@endif@> +) { + BlendshapeOffset blendshapeOffset = getBlendshapeOffset(i); + position = inPosition + blendshapeOffset.position; +<@if USE_NORMAL@> + normal = normalize(inNormal + blendshapeOffset.normal.xyz); +<@endif@> +<@if USE_TANGENT@> + tangent = normalize(inTangent + blendshapeOffset.tangent.xyz); +<@endif@> +} + +<@endfunc@> + +<@endif@> From b04cbbb0ac6aa7dd53dbd595a35c6c1c3eace106 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 20 Sep 2018 09:16:43 -0700 Subject: [PATCH 009/157] Apply fix to gl41 backend needed for proper Resource BUffer on gl41 --- libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp index 8a67ff9619..46f91fdc15 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp @@ -57,7 +57,7 @@ void GL41Backend::postLinkProgram(ShaderObject& programObject, const Shader& pro const auto resourceBufferUniforms = ::gl::Uniform::loadByName(glprogram, program.getResourceBuffers().getNames()); for (const auto& resourceBuffer : resourceBufferUniforms) { const auto& targetBinding = expectedResourceBuffers.at(resourceBuffer.name); - glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding); + glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding + GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT); } } From 5d80a890942b1b3c5472bb85124ab49e32d4c985 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 20 Sep 2018 16:09:08 -0700 Subject: [PATCH 010/157] Apply fix to gl41 backend needed for proper Resource BUffer on gl41 --- libraries/render-utils/src/Blendshape.slh | 2 +- libraries/render-utils/src/MeshDeformer.slh | 91 +++++++++++++++++++ .../render-utils/src/MeshPartPayload.cpp | 16 +++- libraries/render-utils/src/Model.cpp | 30 +++--- libraries/render-utils/src/skin_model.slv | 13 +-- libraries/render-utils/src/skin_model_dq.slv | 18 ++-- 6 files changed, 130 insertions(+), 40 deletions(-) create mode 100644 libraries/render-utils/src/MeshDeformer.slh diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 51381241eb..8f62626829 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -59,4 +59,4 @@ void applyBlendshapeOffset(int i, vec4 inPosition, out vec4 position <@endfunc@> -<@endif@> +<@endif@> // if not BLENDSHAPE_SLH diff --git a/libraries/render-utils/src/MeshDeformer.slh b/libraries/render-utils/src/MeshDeformer.slh new file mode 100644 index 0000000000..8bc66e6998 --- /dev/null +++ b/libraries/render-utils/src/MeshDeformer.slh @@ -0,0 +1,91 @@ + +<@if not MESH_DEFORMER_SLH@> +<@def MESH_DEFORMER_SLH@> +// MeshDeformer.slh + +<@include Skinning.slh@> +<@include Blendshape.slh@> + + +<@func declareMeshDeformer(USE_NORMAL, USE_TANGENT, USE_SKINNING, USE_DUAL_QUATERNION, USE_BLENDSHAPE)@> + + +<@if USE_SKINNING@> +<$declareUseDualQuaternionSkinning($USE_DUAL_QUATERNION$) $> + +<@endif@> + +<$declareApplyBlendshapeOffsets($USE_NORMAL$, $USE_TANGENT$)$> + + + +!> + +<@func evalMeshDeformer(inPosition, outPosition, inNormal, outNormal, inTangent, outTangent, inSkinClusterIndex, inSkinClusterWeight, vertexIndex)@> + +{ + <@if USE_BLENDSHAPE@> + + vec4 _deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + <@if USE_NORMAL@> + vec3 _deformedNormal = vec3(0.0, 0.0, 0.0); + <@endif@> + <@if USE_TANGENT@> + vec3 _deformedTangent = vec3(0.0, 0.0, 0.0); + <@endif@> + + <@if USE_TANGENT@> + applyBlendshapeOffset(<$vertexIndex$>, <$inPosition$>, _deformedPosition, <$inNormal$>, _deformedNormal, <$inTangent$>, _deformedTangent); + <@else@> + <@if USE_NORMAL@> + applyBlendshapeOffset(<$vertexIndex$>, <$inPosition$>, _deformedPosition, <$inNormal$>, _deformedNormal); + <@else@> + applyBlendshapeOffset(vertexIndex, <$inPosition$>, _deformedPosition); + <@endif@> + <@endif@> + + <@else@> + + vec4 _deformedPosition = <$inPosition$>; + <@if USE_NORMAL@> + vec3 _deformedNormal = <$inNormal$>; + <@endif@> + <@if USE_TANGENT@> + vec3 _deformedTangent = <$inTangent$>; + <@endif@> + + <@endif@> + + <@if USE_SKINNING@> + <@if USE_TANGENT@> + skinPositionNormalTangent(<$inSkinClusterIndex$>, <$inSkinClusterWeight$>, _deformedPosition, _deformedNormal, _deformedTangent, _deformedPosition, _deformedNormal, _deformedTangent); + <@else@> + <@if USE_NORMAL@> + skinPositionNormal(<$inSkinClusterIndex$>, <$inSkinClusterWeight$>, _deformedPosition, _deformedNormal, _deformedPosition, _deformedNormal); + <@else@> + skinPosition(<$inSkinClusterIndex$>, <$inSkinClusterWeight$>, _deformedPosition, _deformedPosition); + <@endif@> + <@endif@> + <@endif@> + + <$outPosition$> = _deformedPosition; + <@if USE_NORMAL@> + <$outNormal$> = _deformedNormal; + <@endif@> + <@if USE_TANGENT@> + <$outTangent$> = _deformedTangent; + <@endif@> +} + +<@endfunc@> + + +<@endif@> // if not MESH_DEFORMER_SLH diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index a08f5858d7..c202acf9be 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -208,11 +208,6 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in bool useDualQuaternionSkinning = model->getUseDualQuaternionSkinning(); - auto buffer = model->_blendshapeBuffers.find(meshIndex); - if (buffer != model->_blendshapeBuffers.end()) { - _blendshapeBuffer = buffer->second; - } - auto& modelMesh = model->getGeometry()->getMeshes().at(_meshIndex); const Model::MeshState& state = model->getMeshState(_meshIndex); @@ -242,6 +237,17 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in updateTransformForSkinnedMesh(renderTransform, transform); initCache(model); + + if (_isBlendShaped) { + auto buffer = model->_blendshapeBuffers.find(meshIndex); + if (buffer != model->_blendshapeBuffers.end()) { + _blendshapeBuffer = buffer->second; + } + + if (!_isSkinned) { + qWarning() << "MeshPArt Payload is blendshape but not skinned"; + } + } } void ModelMeshPartPayload::initCache(const ModelPointer& model) { diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 7611171557..49f95f0ac0 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -308,9 +308,7 @@ bool Model::updateGeometry() { state.clusterDualQuaternions.resize(mesh.clusters.size()); state.clusterMatrices.resize(mesh.clusters.size()); _meshStates.push_back(state); - if (_blendshapeBuffers.find(i) == _blendshapeBuffers.end()) { - initializeBlendshapes(mesh, i); - } + initializeBlendshapes(mesh, i); i++; } _blendshapeBuffersInitialized = true; @@ -1585,12 +1583,22 @@ const render::ItemIDs& Model::fetchRenderItemIDs() const { } void Model::initializeBlendshapes(const FBXMesh& mesh, int index) { - _blendshapeBuffers[index] = std::make_shared(); - QVector blendshapeOffset; - blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size()); - const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset); - _blendshapeBuffers[index]->setData(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData()); - _blendshapeOffsets[index] = blendshapeOffset; + if (mesh.blendshapes.empty()) { + // mesh doesn't have blendshape, did we allocate one though ? + if (_blendshapeBuffers.find(index) != _blendshapeBuffers.end()) { + qWarning() << "Mesh does not have Blendshape yet a blendshapeOffset buffer is allocated ?"; + } + return; + } + // Mesh has blendshape, let s allocate the local buffer if not done yet + if (_blendshapeBuffers.find(index) == _blendshapeBuffers.end()) { + _blendshapeBuffers[index] = std::make_shared(); + QVector blendshapeOffset; + blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size()); + const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset); + _blendshapeBuffers[index]->setData(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData()); + _blendshapeOffsets[index] = blendshapeOffset; + } } void Model::createRenderItemSet() { @@ -1631,9 +1639,7 @@ void Model::createRenderItemSet() { // Create the render payloads int numParts = (int)mesh->getNumParts(); for (int partIndex = 0; partIndex < numParts; partIndex++) { - if (_blendshapeBuffers.find(i) == _blendshapeBuffers.end()) { - initializeBlendshapes(fbxGeometry.meshes[i], i); - } + initializeBlendshapes(fbxGeometry.meshes[i], i); _modelMeshRenderItems << std::make_shared(shared_from_this(), i, partIndex, shapeID, transform, offset); auto material = getGeometry()->getShapeMaterial(shapeID); _modelMeshMaterialNames.push_back(material ? material->getName() : ""); diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index 9f173bf7dc..905325544f 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -18,11 +18,8 @@ <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets(1)$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(1, _SCRIBE_NULL, 1, 0, 1)$> <@include render-utils/ShaderConstants.h@> @@ -35,11 +32,7 @@ layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, skinnedPosition, skinnedNormal); + <$evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, _SCRIBE_NULL, _SCRIBE_NULL, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index 0b58021703..fb51e62abc 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -18,11 +18,8 @@ <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets(1)$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(1, _SCRIBE_NULL, 1, 1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -33,13 +30,10 @@ layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { + vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, skinnedPosition, skinnedNormal); + <$evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, _SCRIBE_NULL, _SCRIBE_NULL, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -52,6 +46,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, deformedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, deformedNormal, _normalWS.xyz)$> } From d3ff4b8630f6fa98e6a9d18891ecf98ed4d86859 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 20 Sep 2018 17:26:26 -0700 Subject: [PATCH 011/157] Factorizing the deformer code in a separate file, and now trying to control dynamically the blend shape on off --- libraries/render-utils/src/MeshDeformer.slh | 141 ++++++++++-------- libraries/render-utils/src/skin_model.slv | 6 +- libraries/render-utils/src/skin_model_dq.slv | 2 +- .../src/skin_model_normal_map.slv | 23 +-- .../src/skin_model_normal_map_dq.slv | 23 +-- .../render-utils/src/skin_model_shadow.slv | 15 +- .../render-utils/src/skin_model_shadow_dq.slv | 14 +- .../src/skin_model_shadow_fade.slv | 16 +- .../src/skin_model_shadow_fade_dq.slv | 16 +- .../utilities/render/deferredLighting.qml | 2 + 10 files changed, 117 insertions(+), 141 deletions(-) diff --git a/libraries/render-utils/src/MeshDeformer.slh b/libraries/render-utils/src/MeshDeformer.slh index 8bc66e6998..7416eda4b3 100644 --- a/libraries/render-utils/src/MeshDeformer.slh +++ b/libraries/render-utils/src/MeshDeformer.slh @@ -10,82 +10,101 @@ <@def MESH_DEFORMER_SLH@> // MeshDeformer.slh -<@include Skinning.slh@> -<@include Blendshape.slh@> - <@func declareMeshDeformer(USE_NORMAL, USE_TANGENT, USE_SKINNING, USE_DUAL_QUATERNION, USE_BLENDSHAPE)@> +<@include LightingModel.slh@> <@if USE_SKINNING@> +<@include Skinning.slh@> <$declareUseDualQuaternionSkinning($USE_DUAL_QUATERNION$) $> - <@endif@> - + +<@if USE_BLENDSHAPE@> +<@include Blendshape.slh@> <$declareApplyBlendshapeOffsets($USE_NORMAL$, $USE_TANGENT$)$> +<@endif@> - - -!> - -<@func evalMeshDeformer(inPosition, outPosition, inNormal, outNormal, inTangent, outTangent, inSkinClusterIndex, inSkinClusterWeight, vertexIndex)@> - -{ - <@if USE_BLENDSHAPE@> - - vec4 _deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - <@if USE_NORMAL@> - vec3 _deformedNormal = vec3(0.0, 0.0, 0.0); - <@endif@> - <@if USE_TANGENT@> - vec3 _deformedTangent = vec3(0.0, 0.0, 0.0); - <@endif@> - - <@if USE_TANGENT@> - applyBlendshapeOffset(<$vertexIndex$>, <$inPosition$>, _deformedPosition, <$inNormal$>, _deformedNormal, <$inTangent$>, _deformedTangent); - <@else@> - <@if USE_NORMAL@> - applyBlendshapeOffset(<$vertexIndex$>, <$inPosition$>, _deformedPosition, <$inNormal$>, _deformedNormal); - <@else@> - applyBlendshapeOffset(vertexIndex, <$inPosition$>, _deformedPosition); - <@endif@> - <@endif@> - - <@else@> - - vec4 _deformedPosition = <$inPosition$>; - <@if USE_NORMAL@> - vec3 _deformedNormal = <$inNormal$>; - <@endif@> - <@if USE_TANGENT@> - vec3 _deformedTangent = <$inTangent$>; - <@endif@> - - <@endif@> - - <@if USE_SKINNING@> - <@if USE_TANGENT@> - skinPositionNormalTangent(<$inSkinClusterIndex$>, <$inSkinClusterWeight$>, _deformedPosition, _deformedNormal, _deformedTangent, _deformedPosition, _deformedNormal, _deformedTangent); - <@else@> - <@if USE_NORMAL@> - skinPositionNormal(<$inSkinClusterIndex$>, <$inSkinClusterWeight$>, _deformedPosition, _deformedNormal, _deformedPosition, _deformedNormal); - <@else@> - skinPosition(<$inSkinClusterIndex$>, <$inSkinClusterWeight$>, _deformedPosition, _deformedPosition); - <@endif@> - <@endif@> - <@endif@> - - <$outPosition$> = _deformedPosition; +void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@if USE_NORMAL@> - <$outNormal$> = _deformedNormal; + , vec3 inNormal, out vec3 outNormal <@endif@> <@if USE_TANGENT@> - <$outTangent$> = _deformedTangent; + , vec3 inTangent, out vec3 outTangent <@endif@> + <@if USE_SKINNING@> + ,ivec4 skinClusterIndex, vec4 skinClusterWeight + <@endif@> + <@if USE_BLENDSHAPE@> + , int vertexIndex + <@endif@> +) { + + vec4 _deformedPosition = inPosition; + <@if USE_NORMAL@> + vec3 _deformedNormal = inNormal; + <@endif@> + <@if USE_TANGENT@> + vec3 _deformedTangent = inTangent; + <@endif@> + +<@if USE_BLENDSHAPE@> +/* + vec4 _deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); + <@if USE_NORMAL@> + vec3 _deformedNormal = vec3(0.0, 0.0, 0.0); + <@endif@> + <@if USE_TANGENT@> + vec3 _deformedTangent = vec3(0.0, 0.0, 0.0); + <@endif@> +*/ + if (isBlendshapeEnabled()) { + + <@if USE_TANGENT@> + applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal, inTangent, _deformedTangent); + <@else@> + <@if USE_NORMAL@> + applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal); + <@else@> + applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition); + <@endif@> + <@endif@> + }/* else { + vec4 _deformedPosition = inPosition; + <@if USE_NORMAL@> + vec3 _deformedNormal = inNormal; + <@endif@> + <@if USE_TANGENT@> + vec3 _deformedTangent = inTangent; + <@endif@> + + }*/ + +<@endif@> + +<@if USE_SKINNING@> + if (isSkinningEnabled()) { + <@if USE_TANGENT@> + skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedTangent, _deformedPosition, _deformedNormal, _deformedTangent); + <@else@> + <@if USE_NORMAL@> + skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedPosition, _deformedNormal); + <@else@> + skinPosition(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedPosition); + <@endif@> + <@endif@> + } +<@endif@> + + outPosition = _deformedPosition; +<@if USE_NORMAL@> + outNormal = _deformedNormal; +<@endif@> +<@if USE_TANGENT@> + outTangent = _deformedTangent; +<@endif@> } <@endfunc@> - <@endif@> // if not MESH_DEFORMER_SLH diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index 905325544f..9d6afb00aa 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -32,7 +32,7 @@ layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color; void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); - <$evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, _SCRIBE_NULL, _SCRIBE_NULL, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); + evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -45,6 +45,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, deformedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, deformedNormal, _normalWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index fb51e62abc..5da08255ec 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -33,7 +33,7 @@ void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); - <$evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, _SCRIBE_NULL, _SCRIBE_NULL, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); + evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); diff --git a/libraries/render-utils/src/skin_model_normal_map.slv b/libraries/render-utils/src/skin_model_normal_map.slv index 56e221fbef..6d7e822cc2 100644 --- a/libraries/render-utils/src/skin_model_normal_map.slv +++ b/libraries/render-utils/src/skin_model_normal_map.slv @@ -18,11 +18,8 @@ <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets(1, 1)$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(1, 1, 1, _SCRIBE_NULL, 1)$> <@include render-utils/ShaderConstants.h@> @@ -37,15 +34,7 @@ void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); vec3 deformedTangent = vec3(0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); - vec3 skinnedTangent = vec3(0.0, 0.0, 0.0); - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, deformedTangent, skinnedPosition, skinnedNormal, skinnedTangent); - -// skinnedNormal = normalize(skinnedNormal); -// skinnedTangent = normalize(skinnedTangent); + evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -58,7 +47,7 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> - <$transformModelToWorldDir(cam, obj, skinnedTangent, _tangentWS.xyz)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, deformedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, deformedNormal, _normalWS.xyz)$> + <$transformModelToWorldDir(cam, obj, deformedTangent, _tangentWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_normal_map_dq.slv b/libraries/render-utils/src/skin_model_normal_map_dq.slv index 89d94e5eeb..0ba7d78bef 100644 --- a/libraries/render-utils/src/skin_model_normal_map_dq.slv +++ b/libraries/render-utils/src/skin_model_normal_map_dq.slv @@ -19,11 +19,8 @@ <@include graphics/MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets(1, 1)$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(1, 1, 1, 1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -38,15 +35,7 @@ void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); vec3 deformedTangent = vec3(0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - vec3 skinnedNormal = vec3(0.0, 0.0, 0.0); - vec3 skinnedTangent = vec3(0.0, 0.0, 0.0); - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, deformedNormal, deformedTangent, skinnedPosition, skinnedNormal, skinnedTangent); - - skinnedNormal = normalize(skinnedNormal); - skinnedTangent = normalize(skinnedTangent); + evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); @@ -59,7 +48,7 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToWorldAndEyeAndClipPos(cam, obj, skinnedPosition, _positionWS, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, skinnedNormal, _normalWS.xyz)$> - <$transformModelToWorldDir(cam, obj, skinnedTangent, _tangentWS.xyz)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, deformedPosition, _positionWS, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, deformedNormal, _normalWS.xyz)$> + <$transformModelToWorldDir(cam, obj, deformedTangent, _tangentWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_shadow.slv b/libraries/render-utils/src/skin_model_shadow.slv index 6abf509be8..cb7c054ef4 100644 --- a/libraries/render-utils/src/skin_model_shadow.slv +++ b/libraries/render-utils/src/skin_model_shadow.slv @@ -14,23 +14,18 @@ <@include gpu/Transform.slh@> <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets()$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, _SCRIBE_NULL, 1)$> <@include render-utils/ShaderConstants.h@> void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); + evalMeshDeformer(inPosition, deformedPosition, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> + <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> } + diff --git a/libraries/render-utils/src/skin_model_shadow_dq.slv b/libraries/render-utils/src/skin_model_shadow_dq.slv index 3233278fe3..48d2ec217e 100644 --- a/libraries/render-utils/src/skin_model_shadow_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_dq.slv @@ -14,23 +14,17 @@ <@include gpu/Transform.slh@> <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets()$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, 1, 1)$> <@include render-utils/ShaderConstants.h@> void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); + evalMeshDeformer(inPosition, deformedPosition, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> + <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slv b/libraries/render-utils/src/skin_model_shadow_fade.slv index aa05684ce5..b0a1f89aa0 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade.slv @@ -17,11 +17,8 @@ <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning()$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets()$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, _SCRIBE_NULL, 1)$> <@include render-utils/ShaderConstants.h@> @@ -29,14 +26,11 @@ layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); + evalMeshDeformer(inPosition, deformedPosition, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> - <$transformModelToWorldPos(obj, skinnedPosition, _positionWS)$> + <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> + <$transformModelToWorldPos(obj, deformedPosition, _positionWS)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv index a8cad12d76..6d2440f76d 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv @@ -17,11 +17,8 @@ <$declareStandardTransform()$> -<@include Skinning.slh@> -<$declareUseDualQuaternionSkinning(1)$> - -<@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets()$> +<@include MeshDeformer.slh@> +<$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, 1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -29,14 +26,11 @@ layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - applyBlendshapeOffset(gl_VertexID, inPosition, deformedPosition); - - vec4 skinnedPosition = vec4(0.0, 0.0, 0.0, 0.0); - skinPosition(inSkinClusterIndex, inSkinClusterWeight, deformedPosition, skinnedPosition); + evalMeshDeformer(inPosition, deformedPosition, inSkinClusterIndex, inSkinClusterWeight, gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, skinnedPosition, gl_Position)$> - <$transformModelToWorldPos(obj, skinnedPosition, _positionWS)$> + <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> + <$transformModelToWorldPos(obj, deformedPosition, _positionWS)$> } diff --git a/scripts/developer/utilities/render/deferredLighting.qml b/scripts/developer/utilities/render/deferredLighting.qml index 8a4a8f0622..d6f3163ed8 100644 --- a/scripts/developer/utilities/render/deferredLighting.qml +++ b/scripts/developer/utilities/render/deferredLighting.qml @@ -71,6 +71,8 @@ Rectangle { "Specular:LightingModel:enableSpecular", "Albedo:LightingModel:enableAlbedo", "Wireframe:LightingModel:enableWireframe" + "Skinning:LightingModel:enableSkinnning" + "Blendshape:LightingModel:enableBlendshape" ] HifiControls.CheckBox { boxSize: 20 From cae2c60e7f03e7361b3fa367bb391965bebc4a0b Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 20 Sep 2018 17:29:31 -0700 Subject: [PATCH 012/157] Factorizing the deformer code in a separate file, and now trying to control dynamically the blend shape on off --- scripts/developer/utilities/render/deferredLighting.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/developer/utilities/render/deferredLighting.qml b/scripts/developer/utilities/render/deferredLighting.qml index d6f3163ed8..dae8488dcf 100644 --- a/scripts/developer/utilities/render/deferredLighting.qml +++ b/scripts/developer/utilities/render/deferredLighting.qml @@ -70,8 +70,8 @@ Rectangle { "Diffuse:LightingModel:enableDiffuse", "Specular:LightingModel:enableSpecular", "Albedo:LightingModel:enableAlbedo", - "Wireframe:LightingModel:enableWireframe" - "Skinning:LightingModel:enableSkinnning" + "Wireframe:LightingModel:enableWireframe", + "Skinning:LightingModel:enableSkinnning", "Blendshape:LightingModel:enableBlendshape" ] HifiControls.CheckBox { From d3368146ce1a34f11b2eb48d27820f5931979970 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 21 Sep 2018 11:42:26 -0700 Subject: [PATCH 013/157] saving work --- interface/src/Application.cpp | 106 ++++++------------ interface/src/Application.h | 8 +- interface/src/octree/SafeLanding.cpp | 4 + .../utilities/render/textureMonitor.qml | 2 +- scripts/system/interstitialPage.js | 46 +++++++- 5 files changed, 84 insertions(+), 82 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 46cebc1661..0947a85a17 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -5346,8 +5347,8 @@ void Application::resetPhysicsReadyInformation() { // collision information of nearby entities to make running bullet be safe. _fullSceneReceivedCounter = 0; _fullSceneCounterAtLastPhysicsCheck = 0; - _nearbyEntitiesCountAtLastPhysicsCheck = 0; - _nearbyEntitiesStabilityCount = 0; + _gpuTextureMemSizeStabilityCount = 0; + _gpuTextureMemSizeAtLastCheck = 0; _physicsEnabled = false; _octreeProcessor.startEntitySequence(); } @@ -5586,18 +5587,20 @@ void Application::update(float deltaTime) { // for nearby entities before starting bullet up. quint64 now = usecTimestampNow(); if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) { - // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway - _lastPhysicsCheckTime = now; - _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; - _lastQueriedViews.clear(); // Force new view. + if (gpuTextureMemSizeStable()) { + // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway + _lastPhysicsCheckTime = now; + _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; + _lastQueriedViews.clear(); // Force new view. - // process octree stats packets are sent in between full sends of a scene (this isn't currently true). - // We keep physics disabled until we've received a full scene and everything near the avatar in that - // scene is ready to compute its collision shape. - if (getMyAvatar()->isReadyForPhysics()) { - _physicsEnabled = true; - setIsInterstitialMode(false); - getMyAvatar()->updateMotionBehaviorFromMenu(); + // process octree stats packets are sent in between full sends of a scene (this isn't currently true). + // We keep physics disabled until we've received a full scene and everything near the avatar in that + // scene is ready to compute its collision shape. + if (getMyAvatar()->isReadyForPhysics()) { + _physicsEnabled = true; + setIsInterstitialMode(false); + getMyAvatar()->updateMotionBehaviorFromMenu(); + } } } } else if (domainLoadingInProgress) { @@ -6234,9 +6237,14 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { const bool isModifiedQuery = !_physicsEnabled; if (isModifiedQuery) { // Create modified view that is a simple sphere. + ConicalViewFrustum sphericalView; + ConicalViewFrustum farView; + + farView.set(_viewFrustum); + sphericalView.setSimpleRadius(INITIAL_QUERY_RADIUS); - _octreeQuery.setConicalViews({ sphericalView }); + _octreeQuery.setConicalViews({ sphericalView, farView }); _octreeQuery.setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE); static constexpr float MIN_LOD_ADJUST = -20.0f; _octreeQuery.setBoundaryLevelAdjust(MIN_LOD_ADJUST); @@ -6548,69 +6556,23 @@ void Application::trackIncomingOctreePacket(ReceivedMessage& message, SharedNode } } -bool Application::nearbyEntitiesAreReadyForPhysics() { - // this is used to avoid the following scenario: - // A table has some items sitting on top of it. The items are at rest, meaning they aren't active in bullet. - // Someone logs in close to the table. They receive information about the items on the table before they - // receive information about the table. The items are very close to the avatar's capsule, so they become - // activated in bullet. This causes them to fall to the floor, because the table's shape isn't yet in bullet. - EntityTreePointer entityTree = getEntities()->getTree(); - if (!entityTree) { - return false; - } +bool Application::gpuTextureMemSizeStable() { + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); + auto renderStats = renderConfig->getConfig("Stats"); - // We don't want to use EntityTree::findEntities(AABox, ...) method because that scan will snarf parented entities - // whose bounding boxes cannot be computed (it is too loose for our purposes here). Instead we manufacture - // custom filters and use the general-purpose EntityTree::findEntities(filter, ...) - QVector entities; - AABox avatarBox(getMyAvatar()->getWorldPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); - // create two functions that use avatarBox (entityScan and elementScan), the second calls the first - std::function entityScan = [=](EntityItemPointer& entity) { - if (entity->shouldBePhysical()) { - bool success = false; - AABox entityBox = entity->getAABox(success); - // important: bail for entities that cannot supply a valid AABox - return success && avatarBox.touches(entityBox); - } - return false; - }; - std::function elementScan = [&](const OctreeElementPointer& element, void* unused) { - if (element->getAACube().touches(avatarBox)) { - EntityTreeElementPointer entityTreeElement = std::static_pointer_cast(element); - entityTreeElement->getEntities(entityScan, entities); - return true; - } - return false; - }; + quint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; + quint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; - entityTree->withReadLock([&] { - // Pass the second function to the general-purpose EntityTree::findEntities() - // which will traverse the tree, apply the two filter functions (to element, then to entities) - // as it traverses. The end result will be a list of entities that match. - entityTree->findEntities(elementScan, entities); - }); - - uint32_t nearbyCount = entities.size(); - if (nearbyCount == _nearbyEntitiesCountAtLastPhysicsCheck) { - _nearbyEntitiesStabilityCount++; + if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { + _gpuTextureMemSizeStabilityCount++; } else { - _nearbyEntitiesStabilityCount = 0; + _gpuTextureMemSizeStabilityCount = 0; } - _nearbyEntitiesCountAtLastPhysicsCheck = nearbyCount; + _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; - const uint32_t MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT = 3; - if (_nearbyEntitiesStabilityCount >= MINIMUM_NEARBY_ENTITIES_STABILITY_COUNT) { - // We've seen the same number of nearby entities for several stats packets in a row. assume we've got all - // the local entities. - bool result = true; - foreach (EntityItemPointer entity, entities) { - if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) { - HIFI_FCDEBUG(interfaceapp(), "Physics disabled until entity loads: " << entity->getID() << entity->getName()); - // don't break here because we want all the relevant entities to start their downloads - result = false; - } - } - return result; + const uint32_t MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT = 10; + if (_gpuTextureMemSizeStabilityCount >= MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT) { + return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); } return false; } diff --git a/interface/src/Application.h b/interface/src/Application.h index 3bebc60480..4a15c4fa61 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -528,7 +528,7 @@ private: bool importFromZIP(const QString& filePath); bool importImage(const QString& urlString); - bool nearbyEntitiesAreReadyForPhysics(); + bool gpuTextureMemSizeStable(); int processOctreeStats(ReceivedMessage& message, SharedNodePointer sendingNode); void trackIncomingOctreePacket(ReceivedMessage& message, SharedNodePointer sendingNode, bool wasStatsPacket); @@ -725,8 +725,10 @@ private: std::atomic _fullSceneReceivedCounter { 0 }; // how many times have we received a full-scene octree stats packet uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 }; // _fullSceneReceivedCounter last time we checked physics ready - uint32_t _nearbyEntitiesCountAtLastPhysicsCheck { 0 }; // how many in-range entities last time we checked physics ready - uint32_t _nearbyEntitiesStabilityCount { 0 }; // how many times has _nearbyEntitiesCountAtLastPhysicsCheck been the same + + quint64 _gpuTextureMemSizeStabilityCount { 0 }; + quint64 _gpuTextureMemSizeAtLastCheck { 0 }; + quint64 _lastPhysicsCheckTime { usecTimestampNow() }; // when did we last check to see if physics was ready bool _keyboardDeviceHasFocus { true }; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 5d4ebe9853..7c6ea3b015 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -171,6 +171,9 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; + + qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID(); + Settings settings; bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); @@ -188,6 +191,7 @@ bool SafeLanding::isEntityLoadingComplete() { entityMapIter++; } } + qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; return _trackedEntities.empty(); } diff --git a/scripts/developer/utilities/render/textureMonitor.qml b/scripts/developer/utilities/render/textureMonitor.qml index 97cc577ff9..b01a390fa8 100644 --- a/scripts/developer/utilities/render/textureMonitor.qml +++ b/scripts/developer/utilities/render/textureMonitor.qml @@ -75,4 +75,4 @@ Item { } } -} \ No newline at end of file +} diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 57726f397b..6c2db91010 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -14,7 +14,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); - var DEBUG = false; + var DEBUG = true; var MIN_LOADING_PROGRESS = 3.6; var TOTAL_LOADING_PROGRESS = 3.8; var EPSILON = 0.01; @@ -186,6 +186,8 @@ var currentDomain = "no domain"; var timer = null; var target = 0; + var textureMemSizeStabilityCount = 0; + var textureMemSizeAtLastCheck = 0; var connectionToDomainFailed = false; @@ -228,6 +230,8 @@ updateOverlays(false); startAudio(); target = 0; + textureMemSizeStabilityCount = 0; + textureMemSizeAtLastCheck = 0; currentProgress = 0.1; connectionToDomainFailed = false; previousCameraMode = Camera.mode; @@ -348,10 +352,11 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); - if (!HMD.active) { - toolbar.writeProperty("visible", physicsEnabled); + if (!DEBUG) { + Menu.setIsOptionChecked("Show Overlays", physicsEnabled); + if (!HMD.active) { + toolbar.writeProperty("visible", physicsEnabled); + } } resetValues(); @@ -374,6 +379,7 @@ } function update() { + var renderStats = Render.getConfig("Stats"); var physicsEnabled = Window.isPhysicsEnabled(); var thisInterval = Date.now(); var deltaTime = (thisInterval - lastInterval); @@ -381,11 +387,39 @@ var domainLoadingProgressPercentage = Window.domainLoadingProgress(); - var progress = MIN_LOADING_PROGRESS * domainLoadingProgressPercentage; + var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage); if (progress >= target) { target = progress; } + if (currentProgress >= (TOTAL_LOADING_PROGRESS * 0.4)) { + var textureResourceGPUMemSize = renderStats.textureResourceGPUMemSize; + var texturePopulatedGPUMemSize = renderStats.textureResourcePopulatedGPUMemSize; + + if (textureMemSizeAtLastCheck === textureResourceGPUMemSize) { + textureMemSizeStabilityCount++; + } else { + textureMemSizeStabilityCount = 0; + } + + textureMemSizeAtLastCheck = textureResourceGPUMemSize; + + if (textureMemSizeStabilityCount >= 15) { + + if (textureResourceGPUMemSize > 0) { + print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); + var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); + print("---> gpu: " + gpuPercantage); + print("----> current: " + progress); + var totalProgress = progress + gpuPercantage; + print("------> totalProgress: " + totalProgress + "\n"); + if (totalProgress >= target) { + target = totalProgress; + } + } + } + } + if ((physicsEnabled && (currentProgress < TOTAL_LOADING_PROGRESS))) { target = TOTAL_LOADING_PROGRESS; } From d8984dafa0f31e2ab46b0a0e7a1c0505eeb8d53e Mon Sep 17 00:00:00 2001 From: sam gateau Date: Fri, 21 Sep 2018 16:45:21 -0700 Subject: [PATCH 014/157] ui allows to enable/disable the deformer componenets --- libraries/render-utils/src/LightingModel.h | 2 - libraries/render-utils/src/MeshDeformer.slh | 37 +++++-------------- .../utilities/render/deferredLighting.qml | 2 +- 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/libraries/render-utils/src/LightingModel.h b/libraries/render-utils/src/LightingModel.h index c210358ed6..de7ff63972 100644 --- a/libraries/render-utils/src/LightingModel.h +++ b/libraries/render-utils/src/LightingModel.h @@ -152,7 +152,6 @@ class MakeLightingModelConfig : public render::Job::Config { Q_PROPERTY(bool enableSkinning MEMBER enableSkinning NOTIFY dirty) Q_PROPERTY(bool enableBlendshape MEMBER enableBlendshape NOTIFY dirty) - public: MakeLightingModelConfig() : render::Job::Config() {} // Make Lighting Model is always on @@ -178,7 +177,6 @@ public: bool enableWireframe { false }; // false by default bool enableHaze{ true }; - bool enableBloom{ true }; bool enableSkinning{ true }; bool enableBlendshape{ true }; diff --git a/libraries/render-utils/src/MeshDeformer.slh b/libraries/render-utils/src/MeshDeformer.slh index 7416eda4b3..6ee35adcfa 100644 --- a/libraries/render-utils/src/MeshDeformer.slh +++ b/libraries/render-utils/src/MeshDeformer.slh @@ -49,37 +49,18 @@ void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@endif@> <@if USE_BLENDSHAPE@> -/* - vec4 _deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - <@if USE_NORMAL@> - vec3 _deformedNormal = vec3(0.0, 0.0, 0.0); - <@endif@> - <@if USE_TANGENT@> - vec3 _deformedTangent = vec3(0.0, 0.0, 0.0); - <@endif@> -*/ if (isBlendshapeEnabled()) { <@if USE_TANGENT@> applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal, inTangent, _deformedTangent); <@else@> - <@if USE_NORMAL@> - applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal); - <@else@> - applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition); - <@endif@> - <@endif@> - }/* else { - vec4 _deformedPosition = inPosition; <@if USE_NORMAL@> - vec3 _deformedNormal = inNormal; + applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal); + <@else@> + applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition); <@endif@> - <@if USE_TANGENT@> - vec3 _deformedTangent = inTangent; <@endif@> - - }*/ - + } <@endif@> <@if USE_SKINNING@> @@ -87,11 +68,11 @@ void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@if USE_TANGENT@> skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedTangent, _deformedPosition, _deformedNormal, _deformedTangent); <@else@> - <@if USE_NORMAL@> - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedPosition, _deformedNormal); - <@else@> - skinPosition(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedPosition); - <@endif@> + <@if USE_NORMAL@> + skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedPosition, _deformedNormal); + <@else@> + skinPosition(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedPosition); + <@endif@> <@endif@> } <@endif@> diff --git a/scripts/developer/utilities/render/deferredLighting.qml b/scripts/developer/utilities/render/deferredLighting.qml index dae8488dcf..a9479b2935 100644 --- a/scripts/developer/utilities/render/deferredLighting.qml +++ b/scripts/developer/utilities/render/deferredLighting.qml @@ -71,7 +71,7 @@ Rectangle { "Specular:LightingModel:enableSpecular", "Albedo:LightingModel:enableAlbedo", "Wireframe:LightingModel:enableWireframe", - "Skinning:LightingModel:enableSkinnning", + "Skinning:LightingModel:enableSkinning", "Blendshape:LightingModel:enableBlendshape" ] HifiControls.CheckBox { From 4210ce46aaa71548e5b27314c0bf2b558bb91fb9 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Sun, 23 Sep 2018 23:10:56 -0700 Subject: [PATCH 015/157] bringing the tex corrd transform in the Material struct and shaving one ubo --- libraries/graphics/src/graphics/Material.cpp | 28 +++++++-------- libraries/graphics/src/graphics/Material.h | 20 +++++------ libraries/graphics/src/graphics/Material.slh | 34 +++++++++++++++++++ .../src/graphics/MaterialTextures.slh | 6 ++-- libraries/render-utils/src/MeshDeformer.slh | 4 +-- .../render-utils/src/RenderPipelines.cpp | 2 +- 6 files changed, 63 insertions(+), 31 deletions(-) diff --git a/libraries/graphics/src/graphics/Material.cpp b/libraries/graphics/src/graphics/Material.cpp index 2300bc5098..5b5f597113 100755 --- a/libraries/graphics/src/graphics/Material.cpp +++ b/libraries/graphics/src/graphics/Material.cpp @@ -20,15 +20,15 @@ using namespace gpu; Material::Material() : _key(0), _schemaBuffer(), - _texMapArrayBuffer(), + // _texMapArrayBuffer(), _textureMaps() { // created from nothing: create the Buffer to store the properties Schema schema; _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); - TexMapArraySchema TexMapArraySchema; - _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &TexMapArraySchema)); +// TexMapArraySchema TexMapArraySchema; +// _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &TexMapArraySchema)); } Material::Material(const Material& material) : @@ -41,9 +41,9 @@ Material::Material(const Material& material) : _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); _schemaBuffer.edit() = material._schemaBuffer.get(); - TexMapArraySchema texMapArraySchema; - _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &texMapArraySchema)); - _texMapArrayBuffer.edit() = material._texMapArrayBuffer.get(); + // TexMapArraySchema texMapArraySchema; + // _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &texMapArraySchema)); + // _texMapArrayBuffer.edit() = material._texMapArrayBuffer.get(); } Material& Material::operator= (const Material& material) { @@ -60,9 +60,9 @@ Material& Material::operator= (const Material& material) { _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); _schemaBuffer.edit() = material._schemaBuffer.get(); - TexMapArraySchema texMapArraySchema; - _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &texMapArraySchema)); - _texMapArrayBuffer.edit() = material._texMapArrayBuffer.get(); +// TexMapArraySchema texMapArraySchema; + // _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &texMapArraySchema)); + // _texMapArrayBuffer.edit() = material._texMapArrayBuffer.get(); return (*this); } @@ -137,17 +137,17 @@ void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textur resetOpacityMap(); // update the texcoord0 with albedo - _texMapArrayBuffer.edit()._texcoordTransforms[0] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); + _schemaBuffer.edit()._texcoordTransforms[0] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); } if (channel == MaterialKey::OCCLUSION_MAP) { - _texMapArrayBuffer.edit()._texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); + _schemaBuffer.edit()._texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); } if (channel == MaterialKey::LIGHTMAP_MAP) { // update the texcoord1 with lightmap - _texMapArrayBuffer.edit()._texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); - _texMapArrayBuffer.edit()._lightmapParams = (textureMap ? glm::vec4(textureMap->getLightmapOffsetScale(), 0.0, 0.0) : glm::vec4(0.0, 1.0, 0.0, 0.0)); + _schemaBuffer.edit()._texcoordTransforms[1] = (textureMap ? textureMap->getTextureTransform().getMatrix() : glm::mat4()); + _schemaBuffer.edit()._lightmapParams = (textureMap ? glm::vec4(textureMap->getLightmapOffsetScale(), 0.0, 0.0) : glm::vec4(0.0, 1.0, 0.0, 0.0)); } _schemaBuffer.edit()._key = (uint32)_key._flags.to_ulong(); @@ -235,6 +235,6 @@ void Material::setTextureTransforms(const Transform& transform) { } } for (int i = 0; i < NUM_TEXCOORD_TRANSFORMS; i++) { - _texMapArrayBuffer.edit()._texcoordTransforms[i] = transform.getMatrix(); + _schemaBuffer.edit()._texcoordTransforms[i] = transform.getMatrix(); } } \ No newline at end of file diff --git a/libraries/graphics/src/graphics/Material.h b/libraries/graphics/src/graphics/Material.h index fd3f12e865..63481e0f5e 100755 --- a/libraries/graphics/src/graphics/Material.h +++ b/libraries/graphics/src/graphics/Material.h @@ -268,6 +268,9 @@ public: typedef glm::vec3 Color; + // Texture Map Array Schema + static const int NUM_TEXCOORD_TRANSFORMS{ 2 }; + typedef MaterialKey::MapChannel MapChannel; typedef std::map TextureMaps; typedef std::bitset MapFlags; @@ -323,6 +326,11 @@ public: // for alignment beauty, Material size == Mat4x4 + // Texture Coord Transform Array + glm::mat4 _texcoordTransforms[NUM_TEXCOORD_TRANSFORMS]; + + glm::vec4 _lightmapParams{ 0.0, 1.0, 0.0, 0.0 }; + Schema() {} }; @@ -340,17 +348,6 @@ public: // conversion from legacy material properties to PBR equivalent static float shininessToRoughness(float shininess) { return 1.0f - shininess / 100.0f; } - // Texture Map Array Schema - static const int NUM_TEXCOORD_TRANSFORMS{ 2 }; - class TexMapArraySchema { - public: - glm::mat4 _texcoordTransforms[NUM_TEXCOORD_TRANSFORMS]; - glm::vec4 _lightmapParams{ 0.0, 1.0, 0.0, 0.0 }; - TexMapArraySchema() {} - }; - - const UniformBufferView& getTexMapArrayBuffer() const { return _texMapArrayBuffer; } - int getTextureCount() const { calculateMaterialInfo(); return _textureCount; } size_t getTextureSize() const { calculateMaterialInfo(); return _textureSize; } bool hasTextureInfo() const { return _hasCalculatedTextureInfo; } @@ -370,7 +367,6 @@ protected: private: mutable MaterialKey _key; mutable UniformBufferView _schemaBuffer; - mutable UniformBufferView _texMapArrayBuffer; mutable gpu::TextureTablePointer _textureTable{ std::make_shared() }; TextureMaps _textureMaps; diff --git a/libraries/graphics/src/graphics/Material.slh b/libraries/graphics/src/graphics/Material.slh index fe273ed2a9..e147860730 100644 --- a/libraries/graphics/src/graphics/Material.slh +++ b/libraries/graphics/src/graphics/Material.slh @@ -13,6 +13,36 @@ <@include graphics/ShaderConstants.h@> + +const int MAX_TEXCOORDS = 2; + +struct TexMapArray { + mat4 _texcoordTransforms0; + mat4 _texcoordTransforms1; + vec4 _lightmapParams; +}; + +<@func declareMaterialTexMapArrayBuffer()@> + +//layout(binding=GRAPHICS_BUFFER_TEXMAPARRAY) uniform texMapArrayBuffer { +// TexMapArray _texMapArray; +//}; + + +<@func evalTexMapArrayTexcoord0(texMapArray, inTexcoord0, outTexcoord0)@> +{ + <$outTexcoord0$> = (<$texMapArray$>._texcoordTransforms0 * vec4(<$inTexcoord0$>.st, 0.0, 1.0)).st; +} +<@endfunc@> + +<@func evalTexMapArrayTexcoord1(texMapArray, inTexcoord1, outTexcoord1)@> +{ + <$outTexcoord1$> = (<$texMapArray$>._texcoordTransforms1 * vec4(<$inTexcoord1$>.st, 0.0, 1.0)).st; +} +<@endfunc@> + +<@endfunc@> + // The material values (at least the material key) must be precisely bitwise accurate // to what is provided by the uniform buffer, or the material key has the wrong bits @@ -25,11 +55,15 @@ struct Material { layout(binding=GRAPHICS_BUFFER_MATERIAL) uniform materialBuffer { Material _mat; + TexMapArray _texMapArray; }; Material getMaterial() { return _mat; } +TexMapArray getTexMapArray() { + return _texMapArray; +} vec3 getMaterialEmissive(Material m) { return m._emissiveOpacity.rgb; } float getMaterialOpacity(Material m) { return m._emissiveOpacity.a; } diff --git a/libraries/graphics/src/graphics/MaterialTextures.slh b/libraries/graphics/src/graphics/MaterialTextures.slh index f76d65da96..1c381e9d98 100644 --- a/libraries/graphics/src/graphics/MaterialTextures.slh +++ b/libraries/graphics/src/graphics/MaterialTextures.slh @@ -11,8 +11,10 @@ <@if not MODEL_MATERIAL_TEXTURES_SLH@> <@def MODEL_MATERIAL_TEXTURES_SLH@> -<@include graphics/ShaderConstants.h@> +!> +<@include graphics/Material.slh@> + const int MAX_TEXCOORDS = 2; @@ -45,7 +47,7 @@ TexMapArray getTexMapArray() { <@endfunc@> <@endfunc@> - +!> <@func declareMaterialTextures(withAlbedo, withRoughness, withNormal, withMetallic, withEmissive, withOcclusion, withScattering)@> diff --git a/libraries/render-utils/src/MeshDeformer.slh b/libraries/render-utils/src/MeshDeformer.slh index 6ee35adcfa..b207e81a06 100644 --- a/libraries/render-utils/src/MeshDeformer.slh +++ b/libraries/render-utils/src/MeshDeformer.slh @@ -49,7 +49,7 @@ void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@endif@> <@if USE_BLENDSHAPE@> - if (isBlendshapeEnabled()) { + if (bool(isBlendshapeEnabled())) { <@if USE_TANGENT@> applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal, inTangent, _deformedTangent); @@ -64,7 +64,7 @@ void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@endif@> <@if USE_SKINNING@> - if (isSkinningEnabled()) { + if (bool(isSkinningEnabled())) { <@if USE_TANGENT@> skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedTangent, _deformedPosition, _deformedNormal, _deformedTangent); <@else@> diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 704b1d7663..4804416c00 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -404,7 +404,7 @@ void RenderPipelines::bindMaterial(const graphics::MaterialPointer& material, gp auto textureCache = DependencyManager::get(); batch.setUniformBuffer(gr::Buffer::Material, material->getSchemaBuffer()); - batch.setUniformBuffer(gr::Buffer::TexMapArray, material->getTexMapArrayBuffer()); + // batch.setUniformBuffer(gr::Buffer::TexMapArray, material->getTexMapArrayBuffer()); const auto& materialKey = material->getKey(); const auto& textureMaps = material->getTextureMaps(); From a5950156cc42a78b077bee3f0d82db4373018b9b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Mon, 24 Sep 2018 11:13:13 -0700 Subject: [PATCH 016/157] Add markdeep for docs --- docs/LICENSE_highlight.js.txt | 24 +++++ docs/LICENSE_markdeep.txt | 23 +++++ docs/markdeep.min.js | 7 ++ docs/markdeep_apidoc.css | 170 ++++++++++++++++++++++++++++++++++ 4 files changed, 224 insertions(+) create mode 100644 docs/LICENSE_highlight.js.txt create mode 100644 docs/LICENSE_markdeep.txt create mode 100644 docs/markdeep.min.js create mode 100644 docs/markdeep_apidoc.css diff --git a/docs/LICENSE_highlight.js.txt b/docs/LICENSE_highlight.js.txt new file mode 100644 index 0000000000..20975b7d41 --- /dev/null +++ b/docs/LICENSE_highlight.js.txt @@ -0,0 +1,24 @@ +Copyright (c) 2006, Ivan Sagalaev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list +of conditions and the following disclaimer in the documentation and/or other materials +provided with the distribution. +* Neither the name of highlight.js nor the names of its contributors may be used to +endorse or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/docs/LICENSE_markdeep.txt b/docs/LICENSE_markdeep.txt new file mode 100644 index 0000000000..9394bd5193 --- /dev/null +++ b/docs/LICENSE_markdeep.txt @@ -0,0 +1,23 @@ +Copyright 2015-2017, Morgan McGuire +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this +list of conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/docs/markdeep.min.js b/docs/markdeep.min.js new file mode 100644 index 0000000000..d24225c984 --- /dev/null +++ b/docs/markdeep.min.js @@ -0,0 +1,7 @@ +/**See http://casual-effects.com/markdeep for @license and documentation. +markdeep.min.js 1.03 (C) 2018 Morgan McGuire +highlight.min.js 9.12.0 (C) 2017 Ivan Sagalaev https://highlightjs.org/*/ +!function(){"use strict";function e(e,t,r){return"<"+e+(r?" "+r:"")+">"+t+""}function t(e){try{var t=document.createElement("canvas"),r=t.getContext("2d");return r.font="10pt "+e,r.measureText("M").width}catch(e){return 10}}function r(e,t){if(window.markdeepOptions&&void 0!==window.markdeepOptions[e]){var r=window.markdeepOptions[e];return t?(r=r[t],void 0!==r?r:ne[e][t]):window.markdeepOptions[e]}return void 0!==ne[e]?t?ne[e][t]:ne[e]:void console.warn('Illegal option: "'+e+'"')}function n(t,n){if(r("showLabels")){var a=" {\xa0"+t+"\xa0}";return n?e(n,a):a}return""}function a(e){return r("lang").keyword[e.toLowerCase()]||e}function i(e){return(e+"").rp(/&/g,"&").rp(//g,">").rp(/"/g,""")}function s(e){return e.rp(/</g,"<").rp(/>/g,">").rp(/"/g,'"').rp(/'/g,"'").rp(/–/g,"\u2013").rp(/—/g,"---").rp(/&/g,"&")}function o(e){return e.rp(/<.*?>/g,"")}function c(e){return encodeURI(e.rp(/\s/g,"").toLowerCase())}function l(){for(var t="",r=1;r<=6;++r){t+=".md h"+r+"::before {\ncontent:";for(var n=1;n<=r;++n)t+="counter(h"+n+') "'+(n|<\/ftp:.*>|<\/[^ "\t\n>]+@[^ "\t\n>]+>/gi,""),r=r.rp(/<(https?|ftp): (.*?)>/gi,function(e,t,r){var n="<"+t+"://"+r.rp(/=""\s/g,"/");return'=""'===n.ss(n.length-3)&&(n=n.ss(0,n.length-3)),n=n.rp(/"/g,""),n+">"}),r=r.rp(/",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[r],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},r]}]}}),hljs.g("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}}),hljs.g("javascript",function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",r={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},n={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},a={cN:"subst",b:"\\$\\{",e:"\\}",k:r,c:[]},i={cN:"string",b:"`",e:"`",c:[e.BE,a]};a.c=[e.ASM,e.QSM,i,n,e.RM];var s=a.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:r,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,i,e.CLCM,e.CBCM,n,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),hljs.g("lisp",function(e){var t="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*",r="\\|[^]*?\\|",n="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|\\-)?\\d+)?",a={cN:"meta",b:"^#!",e:"$"},i={cN:"literal",b:"\\b(t{1}|nil)\\b"},s={cN:"number",v:[{b:n,r:0},{b:"#(b|B)[0-1]+(/[0-1]+)?"},{b:"#(o|O)[0-7]+(/[0-7]+)?"},{b:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{b:"#(c|C)\\("+n+" +"+n,e:"\\)"}]},o=e.inherit(e.QSM,{i:null}),c=e.C(";","$",{r:0}),l={b:"\\*",e:"\\*"},u={cN:"symbol",b:"[:&]"+t},d={b:t,r:0},p={b:r},m={b:"\\(",e:"\\)",c:["self",i,o,s,d]},g={c:[s,o,l,u,m,d],v:[{b:"['`]\\(",e:"\\)"},{b:"\\(quote ",e:"\\)",k:{name:"quote"}},{b:"'"+r}]},b={v:[{b:"'"+t},{b:"#'"+t+"(::"+t+")*"}]},f={b:"\\(\\s*",e:"\\)"},h={eW:!0,r:0};return f.c=[{cN:"name",v:[{b:t},{b:r}]},h],h.c=[g,b,f,i,s,o,c,l,u,p,d],{i:/\S/,c:[s,a,i,o,c,g,b,f,d]}}),hljs.g("r",function(e){var t="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[e.HCM,{b:t,l:t,k:{keyword:"function if in break next repeat else for return switch while try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",c:[e.BE],v:[{b:'"',e:'"'},{b:"'",e:"'"}]}]}}),hljs.g("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",literal:"true false iota nil",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"|<-"}]}}),hljs.g("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},n={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/\b-?[a-z\._]+\b/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,r,n,t]}}),hljs.g("java",function(e){var t="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",r=t+"(<"+t+"(\\s*,\\s*"+t+")*>)?",n="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",a="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",i={cN:"number",b:a,r:0};return{aliases:["jsp"],k:n,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:n,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:n,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},i,{cN:"meta",b:"@[A-Za-z]+"}]}}),hljs.g("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},n={b:"->{",e:"}"},a={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,a],s=[a,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),n,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=s,n.c=s,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:s}}),hljs.g("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",n={cN:"subst",b:/#\{/,e:/}/,k:t},a=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,n]},{b:/"/,e:/"/,c:[e.BE,n]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[n,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+r},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];n.c=a;var i=e.inherit(e.TM,{b:r}),s="(\\(.*\\))?\\s*\\B[-=]>",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(a)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:a.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),hljs.g("kotlin",function(e){var t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit initinterface annotation data sealed internal infix operator out by constructor super trait volatile transient native default",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={cN:"keyword",b:/\b(break|continue|return|this)\b/,starts:{c:[{cN:"symbol",b:/@\w+/}]}},n={cN:"symbol",b:e.UIR+"@"},a={cN:"subst",b:"\\${",e:"}",c:[e.ASM,e.CNM]},i={cN:"variable",b:"\\$"+e.UIR},s={cN:"string",v:[{b:'"""',e:'"""',c:[i,a]},{b:"'",e:"'",i:/\n/,c:[e.BE]},{b:'"',e:'"',i:/\n/,c:[e.BE,i,a]}]},o={cN:"meta",b:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UIR+")?"},c={cN:"meta",b:"@"+e.UIR,c:[{b:/\(/,e:/\)/,c:[e.inherit(s,{cN:"meta-string"})]}]};return{k:t,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,r,n,o,c,{cN:"function",bK:"fun",e:"[(]|$",rB:!0,eE:!0,k:t,i:/fun\s+(<.*>)?[^\s\(]+(\s+[^\s\(]+)\s*=/,r:5,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"type",b://,k:"reified",r:0},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,r:0,c:[{b:/:/,e:/[=,\/]/,eW:!0,c:[{cN:"type",b:e.UIR},e.CLCM,e.CBCM],r:0},e.CLCM,e.CBCM,o,c,s,e.CNM]},e.CBCM]},{cN:"class",bK:"class interface trait",e:/[:\{(]|$/,eE:!0,i:"extends implements",c:[{bK:"public protected internal private constructor"},e.UTM,{cN:"type",b://,eB:!0,eE:!0,r:0},{cN:"type",b:/[,:]\s*/,e:/[<\(,]|$/,eB:!0,rE:!0},o,c]},s,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.CNM]}}),hljs.g("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},n={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},i=[e.C("#","$",{c:[n]}),e.C("^\\=begin","^\\=end",{c:[n],r:10}),e.C("^__END__","\\n$")],s={cN:"subst",b:"#\\{",e:"}",k:r},o={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},c={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},l=[o,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(i)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:t}),c].concat(i)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[o,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",k:"unless",c:[a,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(i),r:0}].concat(i);s.c=l,c.c=l;var u="[>?]>",d="[\\w#]+\\(\\w+\\):\\d+:\\d+>",p="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",m=[{ +b:/^\s*=>/,starts:{e:"$",c:l}},{cN:"meta",b:"^("+u+"|"+d+"|"+p+")",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:i.concat(m).concat(l)}}),hljs.g("css",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",r={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:t,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,r]}]}}),hljs.g("cpp",function(e){var t={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[e.BE]},{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},n={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},a={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},e.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:/<[^\n>]*>/,e:/$/,i:"\\n"},e.CLCM,e.CBCM]},i=e.IR+"\\s*\\(",s={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return and or not",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},o=[t,e.CLCM,e.CBCM,n,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:s,i:"",k:s,c:["self",t]},{b:e.IR+"::",k:s},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:s,c:o.concat([{b:/\(/,e:/\)/,k:s,c:o.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+e.IR+"[\\*&\\s]+)+"+i,rB:!0,e:/[{;=]/,eE:!0,k:s,i:/[^\w\s\*&]/,c:[{b:i,rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:s,r:0,c:[e.CLCM,e.CBCM,r,n,t]},e.CLCM,e.CBCM,a]},{cN:"class",bK:"class struct",e:/[{;:]/,c:[{b://,c:["self"]},e.TM]}]),exports:{preprocessor:a,strings:r,k:s}}}),hljs.g("typescript",function(e){var t={keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private protected get set super static implements enum export import declare type namespace abstract as from extends async await",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void Promise"};return{aliases:["ts"],k:t,c:[{cN:"meta",b:/^\s*['"]use strict['"]/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+e.IR+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:e.IR},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:["self",e.CLCM,e.CBCM]}]}]}],r:0},{cN:"function",b:"function",e:/[\{;]/,eE:!0,k:t,c:["self",e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/%/,r:0},{bK:"constructor",e:/\{/,eE:!0,c:["self",{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:[e.CLCM,e.CBCM],i:/["'\(]/}]},{b:/module\./,k:{built_in:"module"},r:0},{bK:"module",e:/\{/,eE:!0},{bK:"interface",e:/\{/,eE:!0,k:"interface extends"},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{cN:"meta",b:"@[A-Za-z]+"}]}}),hljs.g("shell",function(e){return{aliases:["console"],c:[{cN:"meta",b:"^\\s{0,3}[\\w\\d\\[\\]()@-]*[>%$#]",starts:{e:"$",sL:"bash"}}]}}),hljs.g("rust",function(e){var t="([ui](8|16|32|64|128|size)|f(32|64))?",r="alignof as be box break const continue crate do else enum extern false fn for if impl in let loop match mod mut offsetof once priv proc pub pure ref return self Self sizeof static struct super trait true type typeof unsafe unsized use virtual while where yield move default",n="drop i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize f32 f64 str char bool Box Option Result String Vec Copy Send Sized Sync Drop Fn FnMut FnOnce ToOwned Clone Debug PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator Extend IntoIterator DoubleEndedIterator ExactSizeIterator SliceConcatExt ToString assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln! macro_rules! assert_ne! debug_assert_ne!";return{aliases:["rs"],k:{keyword:r,literal:"true false Some None Ok Err",built_in:n},l:e.IR+"!?",i:""}]}}),hljs.g("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:r,l:n,i:""}]}]},{cN:"class",b:"("+a.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:a,l:n,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}}),hljs.g("tex",function(e){var t={cN:"tag",b:/\\/,r:0,c:[{cN:"name",v:[{b:/[a-zA-Z\u0430-\u044f\u0410-\u044f]+[*]?/},{b:/[^a-zA-Z\u0430-\u044f\u0410-\u044f0-9]/}],starts:{eW:!0,r:0,c:[{cN:"string",v:[{b:/\[/,e:/\]/},{b:/\{/,e:/\}/}]},{b:/\s*=\s*/,eW:!0,r:0,c:[{cN:"number",b:/-?\d*\.?\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?/}]}]}}]};return{c:[t,{cN:"formula",c:[t],r:0,v:[{b:/\$\$/,e:/\$\$/},{b:/\$/,e:/\$/}]},e.C("%","$",{r:0})]}}),hljs.g("makefile",function(e){var t={cN:"variable",v:[{b:"\\$\\("+e.UIR+"\\)",c:[e.BE]},{b:/\$[@%>>|\.\.\.) /},n={cN:"subst",b:/\{/,e:/\}/,k:t,i:/#/},a={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[r],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[r],r:10},{b:/(fr|rf|f)'''/,e:/'''/,c:[r,n]},{b:/(fr|rf|f)"""/,e:/"""/,c:[r,n]},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},{b:/(fr|rf|f)'/,e:/'/,c:[n]},{b:/(fr|rf|f)"/,e:/"/,c:[n]},e.ASM,e.QSM]},i={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},s={cN:"params",b:/\(/,e:/\)/,c:["self",r,i,a]};return n.c=[a,i,r],{aliases:["py","gyp"],k:t,i:/(<\/|->|\?)|=>/,c:[r,i,a,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,s,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}}),hljs.g("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],n={e:",",eW:!0,eE:!0,c:r,k:t},a={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(n,{b:/:/})],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(n)],i:"\\S"};return r.splice(r.length,0,a,i),{c:r,k:t,i:"\\S"}}),hljs.g("armasm",function(e){return{cI:!0,aliases:["arm"],l:"\\.?"+e.IR,k:{meta:".2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 pc lr sp ip sl sb fp a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 {PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @"},c:[{cN:"keyword",b:"\\b(adc|(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|wfe|wfi|yield)(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?[sptrx]?",e:"\\s"},e.C("[;@]","$",{r:0}),e.CBCM,e.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"title",b:"\\|",e:"\\|",i:"\\n",r:0},{cN:"number",v:[{b:"[#$=]?0x[0-9a-f]+"},{b:"[#$=]?0b[01]+"},{b:"[#$=]\\d+"},{b:"\\b\\d+"}],r:0},{cN:"symbol",v:[{b:"^[a-z_\\.\\$][a-z0-9_\\.\\$]+"},{b:"^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:"},{b:"[=#]\\w+"}],r:0}]}}),hljs.g("cs",function(e){var t={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long nameof object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},n=e.inherit(r,{i:/\n/}),a={cN:"subst",b:"{",e:"}",k:t},i=e.inherit(a,{i:/\n/}),s={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,i]},o={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},a]},c=e.inherit(o,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},i]});a.c=[o,s,r,e.ASM,e.QSM,e.CNM,e.CBCM],i.c=[c,s,n,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[o,s,r,e.ASM,e.QSM]},u=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{cN:"meta",b:"^\\s*\\[",eB:!0,e:"\\]",eE:!0,c:[{cN:"meta-string",b:/"/,e:/"/}]},{bK:"new return throw await else",r:0},{cN:"function",b:"("+u+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.g("matlab",function(e){var t=[e.CNM,{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]}],r={r:0,c:[{b:/'['\.]*/}]};return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}]}]},{b:/[a-zA-Z_][a-zA-Z_0-9]*'['\.]*/,rB:!0,r:0,c:[{b:/[a-zA-Z_][a-zA-Z_0-9]*/,r:0},r.c[0]]},{b:"\\[",e:"\\]",c:t,r:0,starts:r},{b:"\\{",e:/}/,c:t,r:0,starts:r},{b:/\)/,r:0,starts:r},e.C("^\\s*\\%\\{\\s*$","^\\s*\\%\\}\\s*$"),e.C("\\%","$")].concat(t)}}),hljs.g("swift",function(e){var t={keyword:"__COLUMN__ __FILE__ __FUNCTION__ __LINE__ as as! as? associativity break case catch class continue convenience default defer deinit didSet do dynamic dynamicType else enum extension fallthrough false fileprivate final for func get guard if import in indirect infix init inout internal is lazy left let mutating nil none nonmutating open operator optional override postfix precedence prefix private protocol Protocol public repeat required rethrows return right self Self set static struct subscript super switch throw throws true try try! try? Type typealias unowned var weak where while willSet",literal:"true false nil",built_in:"abs advance alignof alignofValue anyGenerator assert assertionFailure bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal fatalError filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced isUniquelyReferencedNonObjC join lazy lexicographicalCompare map max maxElement min minElement numericCast overlaps partition posix precondition preconditionFailure print println quickSort readLine reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith stride strideof strideofValue swap toString transcode underestimateCount unsafeAddressOf unsafeBitCast unsafeDowncast unsafeUnwrap unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers withUnsafePointer withUnsafePointers withVaList zip"},r={cN:"type",b:"\\b[A-Z][\\w\xc0-\u02b8']*",r:0},n=e.C("/\\*","\\*/",{c:["self"]}),a={cN:"subst",b:/\\\(/,e:"\\)",k:t,c:[]},i={cN:"number",b:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",r:0},s=e.inherit(e.QSM,{c:[a,e.BE]});return a.c=[i],{k:t,c:[s,e.CLCM,n,r,i,{cN:"function",bK:"func",e:"{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{b://},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,c:["self",i,s,e.CBCM,{b:":"}],i:/["']/}],i:/\[|%/},{cN:"class",bK:"struct protocol class extension enum",k:t,e:"\\{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/})]},{cN:"meta",b:"(@warn_unused_result|@exported|@lazy|@noescape|@NSCopying|@NSManaged|@objc|@convention|@required|@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|@infix|@prefix|@postfix|@autoclosure|@testable|@available|@nonobjc|@NSApplicationMain|@UIApplicationMain)"},{bK:"import",e:/$/,c:[e.CLCM,n]}]}}),hljs.g("scheme",function(e){var t="[^\\(\\)\\[\\]\\{\\}\",'`;#|\\\\\\s]+",r="(\\-|\\+)?\\d+([./]\\d+)?",n=r+"[+\\-]"+r+"i",a={"builtin-name":"case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules ' * + , ,@ - ... / ; < <= = => > >= ` abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?" +},i={cN:"meta",b:"^#!",e:"$"},s={cN:"literal",b:"(#t|#f|#\\\\"+t+"|#\\\\.)"},o={cN:"number",v:[{b:r,r:0},{b:n,r:0},{b:"#b[0-1]+(/[0-1]+)?"},{b:"#o[0-7]+(/[0-7]+)?"},{b:"#x[0-9a-f]+(/[0-9a-f]+)?"}]},c=e.QSM,l=[e.C(";","$",{r:0}),e.C("#\\|","\\|#")],u={b:t,r:0},d={cN:"symbol",b:"'"+t},p={eW:!0,r:0},m={v:[{b:/'/},{b:"`"}],c:[{b:"\\(",e:"\\)",c:["self",s,c,o,u,d]}]},g={cN:"name",b:t,l:t,k:a},b={b:/lambda/,eW:!0,rB:!0,c:[g,{b:/\(/,e:/\)/,endsParent:!0,c:[u]}]},f={v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}],c:[b,g,p]};return p.c=[s,o,c,u,d,m,f].concat(l),{i:/\S/,c:[i,o,c,d,m,f].concat(l)}}),hljs.g("php",function(e){var t={b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"},r={cN:"meta",b:/<\?(php)?|\?>/},n={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},a={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[r]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},r,{cN:"keyword",b:/\$this\b/},t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,n,a]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},n,a]}}),hljs.g("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});var U="Menlo,Consolas,monospace",O=105.1316178/t(U)+"px",F=e("style",'body{max-width:680px;margin:auto;padding:20px;text-align:justify;line-height:140%; -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:antialiased;color:#222;font-family:Palatino,Georgia,"Times New Roman",serif}'),P=e("style","body{counter-reset: h1 h2 h3 h4 h5 h6 paragraph}@page{margin:0;size:auto}.md code,pre{font-family:"+U+";font-size:"+O+';line-height:140%}.md div.title{font-size:26px;font-weight:800;line-height:120%;text-align:center}.md div.afterTitles{height:10px}.md div.subtitle{text-align:center}.md .image{display:inline-block}.md div.imagecaption,.md div.tablecaption,.md div.listingcaption{margin:5px 5px 5px 5px;text-align: justify;font-style:italic}.md div.imagecaption{margin-bottom:0}.md img{max-width:100%;page-break-inside:avoid}.md li{text-align:left;text-indent:0}.md pre.listing {tab-size:4;-moz-tab-size:4;-o-tab-size:4;counter-reset:line}.md pre.listing .linenumbers span.line:before{width:30px;margin-left:-52px;font-size:80%;text-align:right;counter-increment:line;content:counter(line);display:inline-block;padding-right:13px;margin-right:8px;color:#ccc}.md div.tilde{margin:20px 0 -10px;text-align:center}.md blockquote.fancyquote{margin:25px 0 25px;text-align:left;line-height:160%}.md blockquote.fancyquote::before{content:"\u201c";color:#DDD;font-family:Times New Roman;font-size:45px;line-height:0;margin-right:6px;vertical-align:-0.3em}.md span.fancyquote{font-size:118%;color:#777;font-style:italic}.md span.fancyquote::after{content:"\u201d";font-style:normal;color:#DDD;font-family:Times New Roman;font-size:45px;line-height:0;margin-left:6px;vertical-align:-0.3em}.md blockquote.fancyquote .author{width:100%;margin-top:10px;display:inline-block;text-align:right}.md small{font-size:60%}.md div.title,contents,.md .tocHeader,h1,h2,h3,h4,h5,h6,.md .shortTOC,.md .mediumTOC,.nonumberh1,.nonumberh2,.nonumberh3,.nonumberh4,.nonumberh5,.nonumberh6{font-family:Verdana,Helvetica,Arial,sans-serif;margin:13.4px 0 13.4px;padding:15px 0 3px;border-top:none;clear:both}.md h1,.md h2,.md h3,.md h4,.md h5,.md h6,.md .nonumberh1,.md .nonumberh2,.md .nonumberh3,.md .nonumberh4,.md .nonumberh5,.md .nonumberh6{page-break-after:avoid;break-after:avoid}.md svg.diagram{display:block;font-family:'+U+";font-size:"+O+";text-align:center;stroke-linecap:round;stroke-width:"+z+'px;page-break-inside:avoid;stroke:#000;fill:#000}.md svg.diagram .opendot{fill:#FFF}.md svg.diagram text{stroke:none}@media print{.md .pagebreak{page-break-after:always;visibility:hidden}}.md a{font-family:Georgia,Palatino,\'Times New Roman\'}.md h1,.md .tocHeader,.md .nonumberh1{border-bottom:3px solid;font-size:20px;font-weight:bold;}.md h1,.md .nonumberh1{counter-reset: h2 h3 h4 h5 h6}.md h2,.md .nonumberh2{counter-reset: h3 h4 h5 h6;border-bottom:2px solid #999;color:#555;font-weight:bold;font-size:18px;}.md h3,.md h4,.md h5,.md h6,.md .nonumberh3,.md .nonumberh4,.md .nonumberh5,.md .nonumberh6{font-family:Helvetica,Arial,sans-serif;color:#555;font-size:16px;}.md h3{counter-reset:h4 h5 h6}.md h4{counter-reset:h5 h6}.md h5{counter-reset:h6}.md div.table{margin:16px 0 16px 0}.md table{border-collapse:collapse;line-height:140%;page-break-inside:avoid}.md table.table{margin:auto}.md table.calendar{width:100%;margin:auto;font-size:11px;font-family:Helvetica,Arial,sans-serif}.md table.calendar th{font-size:16px}.md .today{background:#ECF8FA}.md .calendar .parenthesized{color:#999;font-style:italic}.md div.tablecaption{text-align:center}.md table.table th{color:#FFF;background-color:#AAA;border:1px solid #888;padding:8px 15px 8px 15px}.md table.table td{padding:5px 15px 5px 15px;border:1px solid #888}.md table.table tr:nth-child(even){background:#EEE}.md pre.tilde{border-top: 1px solid #CCC;border-bottom: 1px solid #CCC;padding: 5px 0 5px 20px;margin:0 0 0 0;background:#FCFCFC;page-break-inside:avoid}.md a.target{width:0px;height:0px;visibility:hidden;font-size:0px;display:inline-block}.md a:link, .md a:visited{color:#38A;text-decoration:none}.md a:link:hover{text-decoration:underline}.md dt{font-weight:700}.md dl>dd{margin-top:-8px; margin-bottom:8px}.md dl>table{margin:35px 0 30px}.md code{white-space:pre-wrap;overflow-wrap:break-word;text-align:left;page-break-inside:avoid}.md .endnote{font-size:13px;line-height:15px;padding-left:10px;text-indent:-10px}.md .bib{padding-left:80px;text-indent:-80px;text-align:left}.markdeepFooter{font-size:9px;text-align:right;padding-top:80px;color:#999}.md .mediumTOC{float:right;font-size:12px;line-height:15px;border-left:1px solid #CCC;padding-left:15px;margin:15px 0px 15px 25px}.md .mediumTOC .level1{font-weight:600}.md .longTOC .level1{font-weight:600;display:block;padding-top:12px;margin:0 0 -20px}.md .shortTOC{text-align:center;font-weight:bold;margin-top:15px;font-size:14px}.md .admonition{position:relative;margin:1em 0;padding:.4rem 1rem;border-radius:.2rem;border-left:2.5rem solid rgba(68,138,255,.4);background-color:rgba(68,138,255,.15);}.md .admonition-title{font-weight:bold;border-bottom:solid 1px rgba(68,138,255,.4);padding-bottom:4px;margin-bottom:4px;margin-left: -1rem;padding-left:1rem;margin-right:-1rem;border-color:rgba(68,138,255,.4)}.md .admonition.tip{border-left:2.5rem solid rgba(50,255,90,.4);background-color:rgba(50,255,90,.15)}.md .admonition.tip::before{content:"\\24d8";font-weight:bold;font-size:150%;position:relative;top:3px;color:rgba(26,128,46,.8);left:-2.95rem;display:block;width:0;height:0}.md .admonition.tip>.admonition-title{border-color:rgba(50,255,90,.4)}.md .admonition.warn,.md .admonition.warning{border-left:2.5rem solid rgba(255,145,0,.4);background-color:rgba(255,145,0,.15)}.md .admonition.warn::before,.md .admonition.warning::before{content:"\\26A0";font-weight:bold;font-size:150%;position:relative;top:2px;color:rgba(128,73,0,.8);left:-2.95rem;display:block;width:0;height:0}.md .admonition.warn>.admonition-title,.md .admonition.warning>.admonition-title{border-color:rgba(255,145,0,.4)}.md .admonition.error{border-left: 2.5rem solid rgba(255,23,68,.4);background-color:rgba(255,23,68,.15)}.md .admonition.error>.admonition-title{border-color:rgba(255,23,68,.4)}.md .admonition.error::before{content: "\\2612";font-family:"Arial";font-size:200%;position:relative;color:rgba(128,12,34,.8);top:-2px;left:-3rem;display:block;width:0;height:0}.md .admonition p:last-child{margin-bottom:0}.md li.checked,.md li.unchecked{list-style:none;overflow:visible;text-indent:-1.2em}.md li.checked:before,.md li.unchecked:before{content:"\\2611";display:block;float:left;width:1em;font-size:120%}.md li.unchecked:before{content:"\\2610"}'),H='',W={keyword:{table:"tableau",figure:"figure",m:"liste",diagram:"diagramme",contents:"Table des mati\xe8res",sec:"sec",section:"section",subsection:"paragraphe",Monday:"lundi",Tuesday:"mardi",Wednesday:"mercredi",Thursday:"jeudi",Friday:"vendredi",Saturday:"samedi",Sunday:"dimanche",January:"Janvier",February:"F\xe9vrier",March:"Mars",April:"Avril",May:"Mai",June:"Juin",July:"Julliet",August:"Ao\xfbt",September:"Septembre",October:"Octobre",November:"Novembre",December:"D\xe9cembre",jan:"janv",feb:"f\xe9vr",mar:"mars",apr:"avril",may:"mai",jun:"juin",jul:"juil",aug:"ao\xfbt",sep:"sept",oct:"oct",nov:"nov",dec:"d\xe9c","“":"« ","&rtquo;":" »"}},V={keyword:{table:"lentel\u0117",figure:"paveiksl\u0117lis",m:"s\u0105ra\u0161as",diagram:"diagrama",contents:"Turinys",sec:"sk",section:"skyrius",subsection:"poskyris",Monday:"pirmadienis",Tuesday:"antradienis",Wednesday:"tre\u010diadienis",Thursday:"ketvirtadienis",Friday:"penktadienis",Saturday:"\u0161e\u0161tadienis",Sunday:"sekmadienis",January:"Sausis",February:"Vasaris",March:"Kovas",April:"Balandis",May:"Gegu\u017e\u0117",June:"Bir\u017eelis",July:"Liepa",August:"Rugpj\u016btis",September:"Rugs\u0117jis",October:"Spalis",November:"Lapkritis",December:"Gruodis",jan:"saus",feb:"vas",mar:"kov",apr:"bal",may:"geg",jun:"bir\u017e",jul:"liep",aug:"rugpj",sep:"rugs",oct:"spal",nov:"lapkr",dec:"gruod","“":"„","&rtquo;":"“"}},Z={keyword:{table:"\u0442\u0430\u0431\u043b\u0438\u0446\u0430",figure:"\u0444\u0438\u0433\u0443\u0440\u0430",m:"\u0441\u043f\u0438\u0441\u044a\u043a",diagram:"\u0434\u0438\u0430\u0433\u0440\u0430\u043c\u0430",contents:"c\u044a\u0434\u044a\u0440\u0436\u0430\u043d\u0438\u0435",sec:"\u0441\u0435\u043a",section:"\u0440\u0430\u0437\u0434\u0435\u043b",subsection:"\u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b",Monday:"\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a",Tuesday:"\u0432\u0442\u043e\u0440\u043d\u0438\u043a",Wednesday:"\u0441\u0440\u044f\u0434\u0430",Thursday:"\u0447\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a",Friday:"\u043f\u0435\u0442\u044a\u043a",Saturday:"\u0441\u044a\u0431\u043e\u0442\u0430",Sunday:"\u043d\u0435\u0434\u0435\u043b\u044f",January:"\u044f\u043d\u0443\u0430\u0440\u0438",February:"\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438",March:"\u043c\u0430\u0440\u0442",April:"\u0430\u043f\u0440\u0438\u043b",May:"\u043c\u0430\u0439",June:"\u044e\u043d\u0438",July:"\u044e\u043b\u0438",August:"\u0430\u0432\u0433\u0443\u0441\u0442",September:"\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438",October:"\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438",November:"\u043d\u043e\u0435\u043c\u0432\u0440\u0438",December:"\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438",jan:"\u044f\u043d",feb:"\u0444\u0435\u0432\u0440",mar:"\u043c\u0430\u0440\u0442",apr:"\u0430\u043f\u0440",may:"\u043c\u0430\u0439",jun:"\u044e\u043d\u0438",jul:"\u044e\u043b\u0438",aug:"\u0430\u0432\u0433",sep:"\u0441\u0435\u043f\u0442",oct:"\u043e\u043a\u0442",nov:"\u043d\u043e\u0435\u043c",dec:"\u0434\u0435\u043a","“":"„","”":"”"}},G={keyword:{table:"tabela",figure:"figura",m:"lista",diagram:"diagrama",contents:"conte\xfado",sec:"sec",section:"sec\xe7\xe3o",subsection:"subsec\xe7\xe3o",Monday:"Segunda-feira",Tuesday:"Ter\xe7a-feira",Wednesday:"Quarta-feira",Thursday:"Quinta-feira",Friday:"Sexta-feira",Saturday:"S\xe1bado",Sunday:"Domingo",January:"Janeiro",February:"Fevereiro",March:"Mar\xe7o",April:"Abril",May:"Maio",June:"Junho",July:"Julho",August:"Agosto",September:"Setembro",October:"Outubro",November:"Novembro",December:"Dezembro",jan:"jan",feb:"fev",mar:"mar",apr:"abr",may:"mai",jun:"jun",jul:"jul",aug:"ago",sep:"set",oct:"oct",nov:"nov",dec:"dez","“":"«","&rtquo;":"»"}},J={keyword:{table:"Tabulka",figure:"Obr\xe1zek",m:"Seznam",diagram:"Diagram",contents:"Obsah",sec:"kap.",section:"kapitola",subsection:"podkapitola",Monday:"pond\u011bl\xed",Tuesday:"\xfater\xfd",Wednesday:"st\u0159eda",Thursday:"\u010dtvrtek",Friday:"p\xe1tek",Saturday:"sobota",Sunday:"ned\u011ble",January:"leden",February:"\xfanor",March:"b\u0159ezen",April:"duben",May:"kv\u011bten",June:"\u010derven",July:"\u010dervenec",August:"srpen",September:"z\xe1\u0159\xed",October:"\u0159\xedjen",November:"listopad",December:"prosinec",jan:"led",feb:"\xfano",mar:"b\u0159e",apr:"dub",may:"kv\u011b",jun:"\u010dvn",jul:"\u010dvc",aug:"srp",sep:"z\xe1\u0159",oct:"\u0159\xedj",nov:"lis",dec:"pro","“":"„","”":"“"}},K={keyword:{table:"tabella",figure:"figura",m:"lista",diagram:"diagramma",contents:"indice",sec:"sez",section:"sezione",subsection:"paragrafo",Monday:"luned\xec",Tuesday:"marted\xec",Wednesday:"mercoled\xec",Thursday:"gioved\xec",Friday:"venerd\xec",Saturday:"sabato",Sunday:"domenica",January:"Gennaio",February:"Febbraio",March:"Marzo",April:"Aprile",May:"Maggio",June:"Giugno",July:"Luglio",August:"Agosto",September:"Settembre",October:"Ottobre",November:"Novembre",December:"Dicembre",jan:"gen",feb:"feb",mar:"mar",apr:"apr",may:"mag",jun:"giu",jul:"lug",aug:"ago",sep:"set",oct:"ott",nov:"nov",dec:"dic","“":"“","&rtquo;":"”"}},Q={keyword:{table:"\u0442\u0430\u0431\u043b\u0438\u0446\u0430",figure:"\u0440\u0438\u0441\u0443\u043d\u043e\u043a",m:"\u043b\u0438\u0441\u0442\u0438\u043d\u0433",diagram:"\u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430",contents:"\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435",sec:"\u0441\u0435\u043a",section:"\u0440\u0430\u0437\u0434\u0435\u043b",subsection:"\u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b",Monday:"\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a",Tuesday:"\u0432\u0442\u043e\u0440\u043d\u0438\u043a",Wednesday:"\u0441\u0440\u0435\u0434\u0430",Thursday:"\u0447\u0435\u0442\u0432\u0435\u0440\u0433",Friday:"\u043f\u044f\u0442\u043d\u0438\u0446\u0430",Saturday:"\u0441\u0443\u0431\u0431\u043e\u0442\u0430",Sunday:"\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435",January:"\u044f\u043d\u0432\u0430\u0440\u044cr",February:"\u0444\u0435\u0432\u0440\u0430\u043b\u044c",March:"\u043c\u0430\u0440\u0442",April:"\u0430\u043f\u0440\u0435\u043b\u044c",May:"\u043c\u0430\u0439",June:"\u0438\u044e\u043d\u044c",July:"\u0438\u044e\u043b\u044c",August:"\u0430\u0432\u0433\u0443\u0441\u0442",September:"\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c",October:"\u043e\u043a\u0442\u044f\u0431\u0440\u044c",November:"\u043d\u043e\u044f\u0431\u0440\u044c",December:"\u0434\u0435\u043a\u0430\u0431\u0440\u044c",jan:"\u044f\u043d\u0432",feb:"\u0444\u0435\u0432\u0440",mar:"\u043c\u0430\u0440\u0442",apr:"\u0430\u043f\u0440",may:"\u043c\u0430\u0439",jun:"\u0438\u044e\u043d\u044c",jul:"\u0438\u044e\u043b\u044c",aug:"\u0430\u0432\u0433",sep:"\u0441\u0435\u043d\u0442",oct:"\u043e\u043a\u0442",nov:"\u043d\u043e\u044f\u0431\u0440\u044c",dec:"\u0434\u0435\u043a","“":"\xab","”":"\xbb"}},X={keyword:{table:"tabela",figure:"ilustracja",m:"wykaz",diagram:"diagram",contents:"Spis tre\u015bci",sec:"rozdz.",section:"rozdzia\u0142",subsection:"podrozdzia\u0142",Monday:"Poniedzia\u0142ek",Tuesday:"Wtorek",Wednesday:"\u015aroda",Thursday:"Czwartek",Friday:"Pi\u0105tek",Saturday:"Sobota",Sunday:"Niedziela",January:"Stycze\u0144",February:"Luty",March:"Marzec",April:"Kwiecie\u0144",May:"Maj",June:"Czerwiec",July:"Lipiec",August:"Sierpie\u0144",September:"Wrzesie\u0144",October:"Pa\u017adziernik",November:"Listopad",December:"Grudzie\u0144",jan:"sty",feb:"lut",mar:"mar",apr:"kwi",may:"maj",jun:"cze",jul:"lip",aug:"sie",sep:"wrz",oct:"pa\u017a",nov:"lis",dec:"gru","“":"„","”":"”"}},Y={keyword:{table:"t\xe1bl\xe1zat",figure:"\xe1bra",m:"lista",diagram:"diagramm",contents:"Tartalomjegyz\xe9k",sec:"fej",section:"fejezet",subsection:"alfejezet",Monday:"h\xe9tf\u0151",Tuesday:"kedd",Wednesday:"szerda",Thursday:"cs\xfct\xf6rt\xf6k",Friday:"p\xe9ntek",Saturday:"szombat",Sunday:"vas\xe1rnap",January:"janu\xe1r",February:"febru\xe1r",March:"m\xe1rcius",April:"\xe1prilis",May:"m\xe1jus",June:"j\xfanius",July:"j\xfalius",August:"augusztus",September:"szeptember",October:"okt\xf3ber",November:"november",December:"december",jan:"jan",feb:"febr",mar:"m\xe1rc",apr:"\xe1pr",may:"m\xe1j",jun:"j\xfan",jul:"j\xfal",aug:"aug",sep:"szept",oct:"okt",nov:"nov",dec:"dec","“":"„","”":"”"}},ee={keyword:{table:"\u8868",figure:"\u56f3",m:"\u4e00\u89a7",diagram:"\u56f3",contents:"\u76ee\u6b21",sec:"\u7ae0",section:"\u7bc0",subsection:"\u9805",Monday:"\u6708",Tuesday:"\u706b",Wednesday:"\u6c34",Thursday:"\u6728",Friday:"\u91d1",Saturday:"\u571f",Sunday:"\u65e5",January:"1\u6708",February:"2\u6708",March:"3\u6708",April:"4\u6708",May:"5\u6708",June:"6\u6708",July:"7\u6708",August:"8\u6708",September:"9\u6708",October:"10\u6708",November:"11\u6708",December:"12\u6708",jan:"1\u6708",feb:"2\u6708",mar:"3\u6708",apr:"4\u6708",may:"5\u6708",jun:"6\u6708",jul:"7\u6708",aug:"8\u6708",sep:"9\u6708",oct:"10\u6708",nov:"11\u6708",dec:"12\u6708","“":"\u300c","”":"\u300d"}},te={keyword:{table:"Tabelle",figure:"Abbildung",m:"Auflistung",diagram:"Diagramm",contents:"Inhaltsverzeichnis",sec:"Kap",section:"Kapitel",subsection:"Unterabschnitt",Monday:"Montag",Tuesday:"Dienstag",Wednesday:"Mittwoch",Thursday:"Donnerstag",Friday:"Freitag",Saturday:"Samstag",Sunday:"Sonntag",January:"Januar",February:"Februar",March:"M\xe4rz",April:"April",May:"Mai",June:"Juni",July:"Juli",August:"August",September:"September",October:"Oktober",November:"November",December:"Dezember",jan:"Jan",feb:"Feb",mar:"M\xe4r",apr:"Apr",may:"Mai",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Okt",nov:"Nov",dec:"Dez","“":"„","”":"“"}},re={keyword:{table:"tabell",figure:"illustration",m:"lista",diagram:"diagram",contents:"inneh\xe5llsf\xf6rteckning",sec:"kap",section:"kapitel",subsection:"avsnitt",Monday:"m\xe5ndag",Tuesday:"tisdag",Wednesday:"onsdag",Thursday:"torsdag",Friday:"fredag",Saturday:"l\xf6rdag",Sunday:"s\xf6ndag",January:"januari",February:"februari",March:"mars",April:"april",May:"maj",June:"juni",July:"juli",August:"augusti",September:"september",October:"oktober",November:"november",December:"december",jan:"jan",feb:"feb",mar:"mar",apr:"apr",may:"maj",jun:"jun",jul:"jul",aug:"aug",sep:"sep",oct:"okt",nov:"nov",dec:"dec","“":"”","”":"”"}},ne={mode:"markdeep",detectMath:!0,lang:{keyword:{}},tocStyle:"auto",hideEmptyWeekends:!0,showLabels:!1,o:!0,captionAbove:{diagram:!1,image:!1,table:!1,m:!1}},ae={en:{keyword:{}},ru:Q,fr:W,pl:X,bg:Z,de:te,hu:Y,sv:re,pt:G,ja:ee,it:K,lt:V,cz:J};[].slice.call(document.getElementsByTagName("meta")).forEach(function(e){var t=e.getAttribute("lang");if(t){var r=ae[t];r&&(ne.lang=r)}});var ie=Math.max,se=Math.min,oe=Math.abs,ce=Math.sign||function(e){return+e===e?0===e?e:e>0?1:-1:NaN},le="";if(!window.alreadyProcessedMarkdeep){window.alreadyProcessedMarkdeep=!0;var ue=window.location.href.search(/\?.*noformat.*/i)!==-1;window.markdeep=Object.freeze({format:v,formatDiagram:M,stylesheet:function(){return P+l()+le}});var de=''+"$$NC{\\n}{\\hat{n}}NC{\\w}{\\hat{\\omega}}NC{\\wi}{\\w_\\mathrm{i}}NC{\\wo}{\\w_\\mathrm{o}}NC{\\wh}{\\w_\\mathrm{h}}NC{\\Li}{L_\\mathrm{i}}NC{\\Lo}{L_\\mathrm{o}}NC{\\Le}{L_\\mathrm{e}}NC{\\Lr}{L_\\mathrm{r}}NC{\\Lt}{L_\\mathrm{t}}NC{\\O}{\\mathrm{O}}NC{\\degrees}{{^{\\large\\circ}}}NC{\\T}{\\mathsf{T}}NC{\\mathset}[1]{\\mathbb{#1}}NC{\\Real}{\\mathset{R}}NC{\\Integer}{\\mathset{Z}}NC{\\Boolean}{\\mathset{B}}NC{\\Complex}{\\mathset{C}}NC{\\un}[1]{\\,\\mathrm{#1}}$$\n".rp(/NC/g,"\\newcommand")+"\n",pe="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML",me=r("mode");switch(me){case"script":return;case"html":case"doxygen":A(document.getElementsByClassName("diagram")).concat(A(document.getElementsByTagName("diagram"))).forEach(function(e){var t=s(e.innerHTML);t=t.rp(/(:?^[ \t]*\n)|(:?\n[ \t]*)$/g,""),"doxygen"===me&&(t=t.rp(RegExp("\u2013","g"),"--"),t=t.rp(RegExp("\u2014","g"),"---"),t=t.rp(/(.*)<\/a>/g,"$1")),e.outerHTML='
'+M(C(t),"")+"
"});var ge=!1;return A(document.getElementsByClassName("markdeep")).concat(A(document.getElementsByTagName("markdeep"))).forEach(function(e){var t=document.createElement("div"),r=v(C(s(e.innerHTML)),!0);ge=ge||S(r),t.innerHTML=r,e.parentNode.replaceChild(t,e)}),document.head.innerHTML=window.markdeep.stylesheet()+document.head.innerHTML+(ge?de:""),void E()}ue||(A(document.getElementsByTagName("script")).forEach(function(e){k(e.src)&&e.parentNode.removeChild(e)}),document.body.style.visibility="hidden");var be=u(document.body);if(ue){be=be.rp(/ */ <----+ * +* | | | / offset child * +* | | |/ ^ transform* +* v +---------+ / <---+ * +* . +-> dimensions * +* . . . . . . . . . . . . . . | relative * +* . . . v to parent * +************************************************************************ + +!!! WARNING + Skew is not supported for collision picks. Scaling a parent entity or + overlay non-uniformly can lead to inaccurate shapes for the child + collision pick. + +## Avatar parent + +A pick parented to an avatar behaves like a wearable. It will maintain +its position relative to some point on the avatar's body. If the pick +has scale (currently only collision picks), then the pick will rescale +when the avatar rescales. + +**************************************************************** +* Avatar .---. hand ^ -. * +* | | | joint / | * +* '-----> | | \ /orientation | * +* '-+-' +-> o | * +* | / ^ position |relative * +* +---------' +----- |avatar * +* | |scale * +* | if not a joint, |factor * +* | parent to the |(default: 1) * +* | avatar's origin | * +* |\ | |uniform scale * +* | \ | | ^ * +* | \ | | +-> * +* | o \ <-+ -' v * +**************************************************************** + +*************************************************************** +* orientation offset * +* <-----+ * +* ^ \ * +* \ * +* \ child * +* Avatar .---. hand .......... * <-- transform * +* | | | joint . ^ | * +* '-----> | | \ . / v * +* '-+-' +-> o ---------+ ^ * +* | / position +-> scale * +* +---------' offset v relative * +* | to avatar * +*************************************************************** + +## Pick parent + +Picks can also be parented to other picks. +When this is done, the child pick is actually parented to +the parent pick's result, not the pick itself. + +A pick parented to another pick will have its position changed, +but not its orientation or scale. + +### Ray pick parent + +********************************** +* position * +* o * +* \ \ orientation * +* \ \ * +* \ v . . . . * +* \ . * +* \ . result transform * +* * <-- no scale * +* . no orientation * +* . * +********************************** + +### Parabola pick parent + +************************************************************** +* .------. acceleration * +* + + | ^ * +* speed x ^ / \ . | | * +* orientation / / \ . v | * +* / / * y axis to rotate * +* | . ^ acceleration with * +* o . | * +* position result transform * +* no scale * +* no orientation * +************************************************************** + +### Stylus pick parent + +******************************************** +* * +* * +* . * +* . * +* . * +* .---. avatar * * +* | | hand / ^. * +* | | \ / \ . * +* '-+-' +-> o \ * +* | / result transform * +* +---------' no scale * +* | no orientation * +******************************************** + +### Collision pick parent + +******************************************** +* * +* .---. * +* | | <-- collision pick * +* | | * +* | *<-+--- result transform at * +* | | collision pick position * +* | | no scale * +* . . . '---' . . no orientation * +* * +******************************************** + +# Effect of scale on picks + +Scale affects the position and shape of picks, which in turn affects the pick result. +Scale currently does not affect the max distance of a pick. + +## Ray and stylus pick scaling + +Rescaling the parent of a ray pick or stylus pick can result in a translation of the pick. + +*************************************** +* before after * +* * +* pick * +* pick +--------------+ ^ * +* ^ | |/ * +* +-----+/ | o * +* | o | | * +* | | | | * +* +-----+ | | * +* parent | | * +* +--------------+ * +* parent * +* * +*************************************** + +## Parabola pick scaling + +*************************************************************************** +* before after after * +* (scaleWithParent (scaleWithParent * +* is false) is true) * +* * +* .----. * +* + + * +* .--. / \ * +* + + / \ * +* .--. / \ / \ * +* + + /pick \ /pick \ * +* / \ +-------o +-------o * +* /pick \ | | | | * +* +---o | | | | * +* | | | | | | * +* +---+ +-------+ +-------+ * +* parent parent parent * +*************************************************************************** + +## Collision pick scaling + +Collision picks use the full transform of their parent (position, orientation, and scale/dimensions). +When first created, a collision pick's transform is defined in world space. +As the parent rescales, the collision pick rescales proportionally. + +The collision pick's threshold also rescales. The change is proportional to the largest +dimension of the parent. So, if the largest dimension of the parent was 3.0 and is now 6.0, +the threshold doubles. + +************************************************************ +* * +* before after * +* * +* pick * +* +------------+ * +* | | * +* | ........ | * +* | . . | * +* | . . | * +* | . . | * +* pick | . . | * +* +-----+ | ........ +___ * +* |.....| | | theshold * +* |. .| theshold +------------+--- * +* |.....|___ | * +* +-----+--- <-+ * +* +----------+ * +* +---+ / \ * +* +-----+ +--------------+ * +* parent parent * +* * +************************************************************ + + + + + + \ No newline at end of file From 57ae8ff8a14fb7dc1538e57c93fe3314a3822fe5 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 24 Sep 2018 16:09:53 -0700 Subject: [PATCH 018/157] update interstitial page stability count and loading bar --- interface/src/Application.cpp | 3 +- interface/src/Application.h | 4 ++ interface/src/octree/SafeLanding.cpp | 40 ++++++++++++++----- interface/src/octree/SafeLanding.h | 3 ++ .../scripting/WindowScriptingInterface.cpp | 4 ++ .../src/scripting/WindowScriptingInterface.h | 2 + scripts/system/interstitialPage.js | 6 +-- 7 files changed, 45 insertions(+), 17 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0947a85a17..ac21af6d44 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6570,8 +6570,7 @@ bool Application::gpuTextureMemSizeStable() { } _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; - const uint32_t MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT = 10; - if (_gpuTextureMemSizeStabilityCount >= MINIMUM_GPU_TEXTURE_MEM_SIZE_STABILITY_COUNT) { + if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); } return false; diff --git a/interface/src/Application.h b/interface/src/Application.h index 4a15c4fa61..b4df36704a 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -233,6 +233,8 @@ public: float getSettingConstrainToolbarPosition() { return _constrainToolbarPosition.get(); } void setSettingConstrainToolbarPosition(bool setting); + Q_INVOKABLE void setMinimumGPUTextureMemStabilityCount(int stabilityCount) { _minimumGPUTextureMemSizeStabilityCount = stabilityCount; } + NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; } virtual controller::ScriptingInterface* getControllerScriptingInterface() { return _controllerScriptingInterface; } @@ -585,6 +587,8 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; + int _minimumGPUTextureMemSizeStabilityCount { 15 }; + ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; PhysicsEnginePointer _physicsEngine; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 7c6ea3b015..ba6e1dac8a 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -10,6 +10,9 @@ // #include "SafeLanding.h" + +#include + #include "EntityTreeRenderer.h" #include "ModelEntityItem.h" #include "InterfaceLogging.h" @@ -39,6 +42,7 @@ void SafeLanding::startEntitySequence(QSharedPointer entityT _entityTree = entityTree; _trackedEntities.clear(); _trackingEntities = true; + _maxTrackedEntityCount = 0; connect(std::const_pointer_cast(_entityTree).get(), &EntityTree::addingEntity, this, &SafeLanding::addTrackedEntity); connect(std::const_pointer_cast(_entityTree).get(), @@ -47,6 +51,7 @@ void SafeLanding::startEntitySequence(QSharedPointer entityT _sequenceNumbers.clear(); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; + _startTime = usecTimestampNow(); EntityTreeRenderer::setEntityLoadingPriorityFunction(&ElevatedPriority); } } @@ -55,6 +60,7 @@ void SafeLanding::stopEntitySequence() { Locker lock(_lock); _trackingEntities = false; _maxTrackedEntityCount = 0; + _trackedEntityStabilityCount = 0; _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; _trackedEntities.clear(); @@ -66,13 +72,14 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) { Locker lock(_lock); EntityItemPointer entity = _entityTree->findEntityByID(entityID); - if (entity) { + if (entity && entity->getCreated() < _startTime) { _trackedEntities.emplace(entityID, entity); int trackedEntityCount = (int)_trackedEntities.size(); if (trackedEntityCount > _maxTrackedEntityCount) { _maxTrackedEntityCount = trackedEntityCount; + _trackedEntityStabilityCount = 0; } qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); } @@ -116,11 +123,19 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); + + static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; + + float percentage = 0.0f; if (_maxTrackedEntityCount > 0) { - return ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); + percentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); } - return 0.0f; + if (_trackedEntityStabilityCount < MINIMUM_TRACKED_ENTITY_STABILITY_COUNT) { + percentage *= 0.20f; + } + + return percentage; } bool SafeLanding::isSequenceNumbersComplete() { @@ -166,19 +181,18 @@ bool SafeLanding::isEntityLoadingComplete() { auto entityTree = qApp->getEntities(); auto entityMapIter = _trackedEntities.begin(); + Settings settings; + bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); + while (entityMapIter != _trackedEntities.end()) { auto entity = entityMapIter->second; bool isVisuallyReady = true; - - qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID(); - - Settings settings; - bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); - if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); + + qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -191,7 +205,13 @@ bool SafeLanding::isEntityLoadingComplete() { entityMapIter++; } } - qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; + + if (enableInterstitial) { + _trackedEntityStabilityCount++; + qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; + } + + return _trackedEntities.empty(); } diff --git a/interface/src/octree/SafeLanding.h b/interface/src/octree/SafeLanding.h index 317e4587c7..51357b60ff 100644 --- a/interface/src/octree/SafeLanding.h +++ b/interface/src/octree/SafeLanding.h @@ -52,6 +52,9 @@ private: int _initialStart { INVALID_SEQUENCE }; int _initialEnd { INVALID_SEQUENCE }; int _maxTrackedEntityCount { 0 }; + int _trackedEntityStabilityCount { 0 }; + + quint64 _startTime { 0 }; struct SequenceLessThan { bool operator()(const int& a, const int& b) const; diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index e3ae65aee1..543dfe4933 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -389,6 +389,10 @@ void WindowScriptingInterface::showAssetServer(const QString& upload) { QMetaObject::invokeMethod(qApp, "showAssetServerWidget", Qt::QueuedConnection, Q_ARG(QString, upload)); } +void WindowScriptingInterface::setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount) { + QMetaObject::invokeMethod(qApp, " setMinimumGPUTextureMemStabilityCount", Qt::QueuedConnection, Q_ARG(int, stabilityCount)); +} + QString WindowScriptingInterface::checkVersion() { return QCoreApplication::applicationVersion(); } diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 3827406729..bf93e73ea9 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -570,6 +570,8 @@ public slots: float domainLoadingProgress(); + void setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount); + private slots: void onWindowGeometryChanged(const QRect& geometry); void onMessageBoxSelected(int button); diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index f5cd8293be..b8b9385a4d 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -14,7 +14,7 @@ (function() { Script.include("/~/system/libraries/Xform.js"); - var DEBUG = true; + var DEBUG = false; var MIN_LOADING_PROGRESS = 3.6; var TOTAL_LOADING_PROGRESS = 3.8; var EPSILON = 0.01; @@ -385,7 +385,6 @@ lastInterval = thisInterval; var domainLoadingProgressPercentage = Window.domainLoadingProgress(); - var progress = ((TOTAL_LOADING_PROGRESS * 0.4) * domainLoadingProgressPercentage); if (progress >= target) { target = progress; @@ -408,10 +407,7 @@ if (textureResourceGPUMemSize > 0) { print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); - print("---> gpu: " + gpuPercantage); - print("----> current: " + progress); var totalProgress = progress + gpuPercantage; - print("------> totalProgress: " + totalProgress + "\n"); if (totalProgress >= target) { target = totalProgress; } From 69734ce21bb96eeb0a8149c8b6fa50e3fd4b960a Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 24 Sep 2018 22:34:43 -0700 Subject: [PATCH 019/157] Getting better' --- libraries/render-utils/src/LightingModel.cpp | 2 ++ libraries/render-utils/src/MeshDeformer.slh | 14 +------------- libraries/render-utils/src/MeshPartPayload.cpp | 9 +++------ libraries/render-utils/src/MeshPartPayload.h | 5 ----- libraries/render-utils/src/skin_model.slv | 6 +++--- libraries/render-utils/src/skin_model_dq.slv | 6 +++--- .../render-utils/src/skin_model_normal_map.slv | 6 +++--- .../render-utils/src/skin_model_normal_map_dq.slv | 6 +++--- libraries/render-utils/src/skin_model_shadow.slv | 6 +++--- .../render-utils/src/skin_model_shadow_dq.slv | 6 +++--- .../render-utils/src/skin_model_shadow_fade.slv | 6 +++--- .../render-utils/src/skin_model_shadow_fade_dq.slv | 6 +++--- libraries/render/src/render/Args.h | 4 +++- 13 files changed, 33 insertions(+), 49 deletions(-) diff --git a/libraries/render-utils/src/LightingModel.cpp b/libraries/render-utils/src/LightingModel.cpp index 70262a29a6..3781d0e0b1 100644 --- a/libraries/render-utils/src/LightingModel.cpp +++ b/libraries/render-utils/src/LightingModel.cpp @@ -226,4 +226,6 @@ void MakeLightingModel::run(const render::RenderContextPointer& renderContext, L // make sure the enableTexturing flag of the render ARgs is in sync renderContext->args->_enableTexturing = _lightingModel->isMaterialTexturingEnabled(); + renderContext->args->_enableBlendshape = _lightingModel->isBlendshapeEnabled(); + renderContext->args->_enableSkinning = _lightingModel->isSkinningEnabled(); } \ No newline at end of file diff --git a/libraries/render-utils/src/MeshDeformer.slh b/libraries/render-utils/src/MeshDeformer.slh index 50dc655137..fb96b63a1b 100644 --- a/libraries/render-utils/src/MeshDeformer.slh +++ b/libraries/render-utils/src/MeshDeformer.slh @@ -85,32 +85,20 @@ void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@endfunc@> -<@func declareMeshDeformerActivation(USE_SKINNING, USE_BLENDSHAPE, USE_LIGHTING_MODEL)@> +<@func declareMeshDeformerActivation(USE_SKINNING, USE_BLENDSHAPE)@> const BITFIELD MESH_DEFORMER_BLENDSHAPE_BIT = 0x00000001; const BITFIELD MESH_DEFORMER_SKINNING_BIT = 0x00000002; -<@if USE_LIGHTING_MODEL@> -<@include LightingModel.slh@> -<@endif@> - <@if USE_BLENDSHAPE@> bool meshDeformer_doBlendshape(int meshKey) { - <@if USE_LIGHTING_MODEL@> - return ((meshKey & MESH_DEFORMER_BLENDSHAPE_BIT) != 0) & bool(isBlendshapeEnabled()); - <@else@> return ((meshKey & MESH_DEFORMER_BLENDSHAPE_BIT) != 0); - <@endif@> } <@endif@> <@if USE_SKINNING@> bool meshDeformer_doSkinning(int meshKey) { - <@if USE_LIGHTING_MODEL@> - return ((meshKey & MESH_DEFORMER_SKINNING_BIT) != 0) & bool(isSkinningEnabled()); - <@else@> return ((meshKey & MESH_DEFORMER_SKINNING_BIT) != 0); - <@endif@> } <@endif@> diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index cc17573bfd..8fb6c5c978 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -243,10 +243,6 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in if (buffer != model->_blendshapeBuffers.end()) { _blendshapeBuffer = buffer->second; } - - if (!_isSkinned) { - qWarning() << "MeshPArt Payload is blendshape but not skinned"; - } } } @@ -356,7 +352,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe bool hasLightmap = drawMaterialKey.isLightmapMap(); bool isUnlit = drawMaterialKey.isUnlit(); - bool isSkinned = _isSkinned; + bool isSkinned = _isBlendShaped || _isSkinned; if (isWireframe) { isTranslucent = hasTangents = hasLightmap = isSkinned = false; @@ -424,7 +420,8 @@ void ModelMeshPartPayload::render(RenderArgs* args) { //Bind the index buffer and vertex buffer and Blend shapes if needed bindMesh(batch); - auto drawcallInfo = (uint16_t) ((_isBlendShaped << 0) | (_isSkinned << 1)); + // IF deformed pass the mesh key + auto drawcallInfo = (uint16_t) (((_isBlendShaped && args->_enableBlendshape) << 0) | ((_isSkinned && args->_enableSkinning) << 1)); if (drawcallInfo) { batch.setDrawcallInfo(drawcallInfo); } diff --git a/libraries/render-utils/src/MeshPartPayload.h b/libraries/render-utils/src/MeshPartPayload.h index 2f31ffbf92..c1a73e8ea0 100644 --- a/libraries/render-utils/src/MeshPartPayload.h +++ b/libraries/render-utils/src/MeshPartPayload.h @@ -27,11 +27,6 @@ class Model; class MeshPartPayload { public: - struct DrawcallInfo { - uint32_t _geometryKey { 0 }; - uint32_t _spare[3]; - }; - MeshPartPayload() {} MeshPartPayload(const std::shared_ptr& mesh, int partIndex, graphics::MaterialPointer material); diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index c36df0be99..5853ca47fc 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -20,7 +20,7 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(1, _SCRIBE_NULL, 1, 0, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include LightingModel.slh@> @@ -37,8 +37,8 @@ void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index fbff970a38..c6540c90b1 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -20,7 +20,7 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(1, _SCRIBE_NULL, 1, 1, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -35,8 +35,8 @@ void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); vec3 deformedNormal = vec3(0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); diff --git a/libraries/render-utils/src/skin_model_normal_map.slv b/libraries/render-utils/src/skin_model_normal_map.slv index a8926cb89e..8627b5b856 100644 --- a/libraries/render-utils/src/skin_model_normal_map.slv +++ b/libraries/render-utils/src/skin_model_normal_map.slv @@ -20,7 +20,7 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(1, 1, 1, _SCRIBE_NULL, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -36,8 +36,8 @@ void main(void) { vec3 deformedNormal = vec3(0.0, 0.0, 0.0); vec3 deformedTangent = vec3(0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); diff --git a/libraries/render-utils/src/skin_model_normal_map_dq.slv b/libraries/render-utils/src/skin_model_normal_map_dq.slv index 7e192c0b86..b45d94938a 100644 --- a/libraries/render-utils/src/skin_model_normal_map_dq.slv +++ b/libraries/render-utils/src/skin_model_normal_map_dq.slv @@ -21,7 +21,7 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(1, 1, 1, 1, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -37,8 +37,8 @@ void main(void) { vec3 deformedNormal = vec3(0.0, 0.0, 0.0); vec3 deformedTangent = vec3(0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, inNormal.xyz, deformedNormal, inTangent.xyz, deformedTangent, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // pass along the color _color.rgb = color_sRGBToLinear(inColor.rgb); diff --git a/libraries/render-utils/src/skin_model_shadow.slv b/libraries/render-utils/src/skin_model_shadow.slv index c748b6e3ba..08f474a94d 100644 --- a/libraries/render-utils/src/skin_model_shadow.slv +++ b/libraries/render-utils/src/skin_model_shadow.slv @@ -16,15 +16,15 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, _SCRIBE_NULL, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/skin_model_shadow_dq.slv b/libraries/render-utils/src/skin_model_shadow_dq.slv index 579a758646..e19f412bdc 100644 --- a/libraries/render-utils/src/skin_model_shadow_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_dq.slv @@ -16,15 +16,15 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, 1, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slv b/libraries/render-utils/src/skin_model_shadow_fade.slv index 8c9cafd8ac..541b58ccb9 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade.slv @@ -19,7 +19,7 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, _SCRIBE_NULL, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -28,8 +28,8 @@ layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv index 80710464cf..c5dd46daae 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv @@ -19,7 +19,7 @@ <@include MeshDeformer.slh@> <$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, 1, 1)$> -<$declareMeshDeformerActivation(1, 1, 1)$> +<$declareMeshDeformerActivation(1, 1)$> <@include render-utils/ShaderConstants.h@> @@ -28,8 +28,8 @@ layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, - meshDeformer_doSkinning(_drawcallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawcallInfo.y), gl_VertexID); + meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, + meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); // standard transform TransformCamera cam = getTransformCamera(); diff --git a/libraries/render/src/render/Args.h b/libraries/render/src/render/Args.h index dd061c0092..b5c98e3428 100644 --- a/libraries/render/src/render/Args.h +++ b/libraries/render/src/render/Args.h @@ -121,7 +121,9 @@ namespace render { uint32_t _globalShapeKey{ 0 }; uint32_t _itemShapeKey{ 0 }; - bool _enableTexturing { true }; + bool _enableTexturing{ true }; + bool _enableBlendshape{ true }; + bool _enableSkinning{ true }; bool _enableFade{ false }; From e41b8f06e15562b8f07722ac8d43a2ee7abdf390 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 25 Sep 2018 13:57:50 -0700 Subject: [PATCH 020/157] Cleaning up the pipeline and checking that it is working for all cases --- interface/src/Application.cpp | 2 +- libraries/render-utils/src/model.slv | 3 +- .../render-utils/src/model_normal_map.slv | 1 - libraries/render-utils/src/model_shadow.slv | 5 +++ .../render-utils/src/model_shadow_fade.slv | 28 ------------- .../src/render-utils/skin_model.slp | 1 + .../src/render-utils/skin_model_dq.slp | 1 + .../render-utils/skin_model_normal_map.slp | 1 + .../render-utils/skin_model_normal_map_dq.slp | 1 + .../src/render-utils/skin_model_shadow.slp | 1 + .../src/render-utils/skin_model_shadow_dq.slp | 1 + libraries/render-utils/src/skin_model.slv | 2 +- .../render-utils/src/skin_model_shadow.slv | 3 ++ .../render-utils/src/skin_model_shadow_dq.slv | 3 ++ .../src/skin_model_shadow_fade.slv | 39 ------------------- .../src/skin_model_shadow_fade_dq.slv | 39 ------------------- libraries/render/src/render/DrawTask.cpp | 8 +++- 17 files changed, 28 insertions(+), 111 deletions(-) delete mode 100644 libraries/render-utils/src/model_shadow_fade.slv delete mode 100644 libraries/render-utils/src/skin_model_shadow_fade.slv delete mode 100644 libraries/render-utils/src/skin_model_shadow_fade_dq.slv diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 46cebc1661..a90be233d3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -315,7 +315,7 @@ static QTimer pingTimer; static bool DISABLE_WATCHDOG = true; #else static const QString DISABLE_WATCHDOG_FLAG{ "HIFI_DISABLE_WATCHDOG" }; -static bool DISABLE_WATCHDOG = nsightActive() || QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); +static bool DISABLE_WATCHDOG = true || nsightActive() || QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); #endif #if defined(USE_GLES) diff --git a/libraries/render-utils/src/model.slv b/libraries/render-utils/src/model.slv index bc5371df34..f3d315c7a4 100644 --- a/libraries/render-utils/src/model.slv +++ b/libraries/render-utils/src/model.slv @@ -14,12 +14,13 @@ <@include gpu/Color.slh@> <@include gpu/Transform.slh@> <@include graphics/MaterialTextures.slh@> -<@include render-utils/ShaderConstants.h@> <$declareStandardTransform()$> <$declareMaterialTexMapArrayBuffer()$> +<@include render-utils/ShaderConstants.h@> + layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; diff --git a/libraries/render-utils/src/model_normal_map.slv b/libraries/render-utils/src/model_normal_map.slv index 90d28acc90..e85b5521a9 100644 --- a/libraries/render-utils/src/model_normal_map.slv +++ b/libraries/render-utils/src/model_normal_map.slv @@ -20,7 +20,6 @@ <$declareMaterialTexMapArrayBuffer()$> - layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; diff --git a/libraries/render-utils/src/model_shadow.slv b/libraries/render-utils/src/model_shadow.slv index 0e6f05f09f..8de77d7b1d 100644 --- a/libraries/render-utils/src/model_shadow.slv +++ b/libraries/render-utils/src/model_shadow.slv @@ -16,9 +16,14 @@ <$declareStandardTransform()$> +<@include render-utils/ShaderConstants.h@> + +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; + void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> + <$transformModelToWorldPos(obj, inPosition, _positionWS)$> } diff --git a/libraries/render-utils/src/model_shadow_fade.slv b/libraries/render-utils/src/model_shadow_fade.slv deleted file mode 100644 index 70ffe855fb..0000000000 --- a/libraries/render-utils/src/model_shadow_fade.slv +++ /dev/null @@ -1,28 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Transform.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> - - -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _positionWS)$> -} diff --git a/libraries/render-utils/src/render-utils/skin_model.slp b/libraries/render-utils/src/render-utils/skin_model.slp index d6466a6aa4..0d9b419365 100644 --- a/libraries/render-utils/src/render-utils/skin_model.slp +++ b/libraries/render-utils/src/render-utils/skin_model.slp @@ -1 +1,2 @@ +VERTEX skin_model FRAGMENT model diff --git a/libraries/render-utils/src/render-utils/skin_model_dq.slp b/libraries/render-utils/src/render-utils/skin_model_dq.slp index d6466a6aa4..c90dc802c3 100644 --- a/libraries/render-utils/src/render-utils/skin_model_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_dq.slp @@ -1 +1,2 @@ +VERTEX skin_model_dq FRAGMENT model diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map.slp index c9d4016041..88c5986f06 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map.slp @@ -1 +1,2 @@ +VERTEX skin_model_normal_map FRAGMENT model_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp index c9d4016041..e443eaf431 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp @@ -1 +1,2 @@ +VERTEX skin_model_normal_map_dq FRAGMENT model_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow.slp b/libraries/render-utils/src/render-utils/skin_model_shadow.slp index f356a5638d..bb15fd1ef5 100644 --- a/libraries/render-utils/src/render-utils/skin_model_shadow.slp +++ b/libraries/render-utils/src/render-utils/skin_model_shadow.slp @@ -1 +1,2 @@ +VERTEX skin_model_shadow FRAGMENT model_shadow diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp index f356a5638d..6f930a2593 100644 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp +++ b/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp @@ -1 +1,2 @@ +VERTEX skin_model_shadow_dq FRAGMENT model_shadow diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index 5853ca47fc..039ad0a7d9 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -19,7 +19,7 @@ <$declareMaterialTexMapArrayBuffer()$> <@include MeshDeformer.slh@> -<$declareMeshDeformer(1, _SCRIBE_NULL, 1, 0, 1)$> +<$declareMeshDeformer(1, _SCRIBE_NULL, 1, _SCRIBE_NULL, 1)$> <$declareMeshDeformerActivation(1, 1)$> <@include LightingModel.slh@> diff --git a/libraries/render-utils/src/skin_model_shadow.slv b/libraries/render-utils/src/skin_model_shadow.slv index 08f474a94d..cc6fb42f98 100644 --- a/libraries/render-utils/src/skin_model_shadow.slv +++ b/libraries/render-utils/src/skin_model_shadow.slv @@ -20,6 +20,8 @@ <@include render-utils/ShaderConstants.h@> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; + void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, @@ -30,5 +32,6 @@ void main(void) { TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> + <$transformModelToWorldPos(obj, deformedPosition, _positionWS)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_dq.slv b/libraries/render-utils/src/skin_model_shadow_dq.slv index e19f412bdc..84b5dfb33b 100644 --- a/libraries/render-utils/src/skin_model_shadow_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_dq.slv @@ -20,6 +20,8 @@ <@include render-utils/ShaderConstants.h@> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; + void main(void) { vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); evalMeshDeformer(inPosition, deformedPosition, @@ -30,4 +32,5 @@ void main(void) { TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> + <$transformModelToWorldPos(obj, deformedPosition, _positionWS)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slv b/libraries/render-utils/src/skin_model_shadow_fade.slv deleted file mode 100644 index 541b58ccb9..0000000000 --- a/libraries/render-utils/src/skin_model_shadow_fade.slv +++ /dev/null @@ -1,39 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Hifi Engine Team. -// Created by Olivier Prat on 06/045/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Transform.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> - -<@include MeshDeformer.slh@> -<$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, _SCRIBE_NULL, 1)$> -<$declareMeshDeformerActivation(1, 1)$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - evalMeshDeformer(inPosition, deformedPosition, - meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> - <$transformModelToWorldPos(obj, deformedPosition, _positionWS)$> -} diff --git a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv deleted file mode 100644 index c5dd46daae..0000000000 --- a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv +++ /dev/null @@ -1,39 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// <$_SCRIBE_FILENAME$> -// Generated on <$_SCRIBE_DATE$> -// -// Created by Hifi Engine Team. -// Created by Olivier Prat on 06/045/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Inputs.slh@> -<@include gpu/Transform.slh@> -<@include render-utils/ShaderConstants.h@> - -<$declareStandardTransform()$> - -<@include MeshDeformer.slh@> -<$declareMeshDeformer(_SCRIBE_NULL, _SCRIBE_NULL, 1, 1, 1)$> -<$declareMeshDeformerActivation(1, 1)$> - -<@include render-utils/ShaderConstants.h@> - -layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; - -void main(void) { - vec4 deformedPosition = vec4(0.0, 0.0, 0.0, 0.0); - evalMeshDeformer(inPosition, deformedPosition, - meshDeformer_doSkinning(_drawCallInfo.y), inSkinClusterIndex, inSkinClusterWeight, - meshDeformer_doBlendshape(_drawCallInfo.y), gl_VertexID); - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, deformedPosition, gl_Position)$> - <$transformModelToWorldPos(obj, deformedPosition, _positionWS)$> -} diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 12f75049b2..7294bf4b1f 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -86,8 +86,10 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext, RenderArgs* args = renderContext->args; int numItemsToDraw = (int)inItems.size(); + int lastItemToDraw = -1; if (maxDrawnItems != -1) { numItemsToDraw = glm::min(numItemsToDraw, maxDrawnItems); + lastItemToDraw = numItemsToDraw - 1; } using SortedPipelines = std::vector; @@ -98,7 +100,11 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext, for (auto i = 0; i < numItemsToDraw; ++i) { auto& item = scene->getItem(inItems[i].id); - + if (lastItemToDraw == i) { + if (!item.getKey().isShape()) { + qDebug() << "Item explored"; + } + } { assert(item.getKey().isShape()); auto key = item.getShapeKey() | globalKey; From cc0019479a2c0ee66022d7fb1f94fc2ca8129111 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 25 Sep 2018 14:07:07 -0700 Subject: [PATCH 021/157] fixing review comments --- libraries/render-utils/src/CauterizedModel.cpp | 5 ++--- libraries/render-utils/src/model_normal_map.slv | 3 ++- .../render-utils/src/render-utils/skin_model_shadow_fade.slp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/render-utils/src/CauterizedModel.cpp b/libraries/render-utils/src/CauterizedModel.cpp index e4f0dd0ecd..8387f0827d 100644 --- a/libraries/render-utils/src/CauterizedModel.cpp +++ b/libraries/render-utils/src/CauterizedModel.cpp @@ -86,9 +86,8 @@ void CauterizedModel::createRenderItemSet() { // Create the render payloads int numParts = (int)mesh->getNumParts(); for (int partIndex = 0; partIndex < numParts; partIndex++) { - if (_blendshapeBuffers.find(i) == _blendshapeBuffers.end()) { - initializeBlendshapes(fbxGeometry.meshes[i], i); - } + initializeBlendshapes(fbxGeometry.meshes[i], i); + auto ptr = std::make_shared(shared_from_this(), i, partIndex, shapeID, transform, offset); _modelMeshRenderItems << std::static_pointer_cast(ptr); auto material = getGeometry()->getShapeMaterial(shapeID); diff --git a/libraries/render-utils/src/model_normal_map.slv b/libraries/render-utils/src/model_normal_map.slv index e85b5521a9..94d8a43b6e 100644 --- a/libraries/render-utils/src/model_normal_map.slv +++ b/libraries/render-utils/src/model_normal_map.slv @@ -20,6 +20,7 @@ <$declareMaterialTexMapArrayBuffer()$> +layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; @@ -38,7 +39,7 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldAndEyeAndClipPos(cam, obj, inPosition, _positionWS, _positionES, gl_Position)$> <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> } diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp index bb15fd1ef5..acf9e201de 100644 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp +++ b/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp @@ -1,2 +1,2 @@ VERTEX skin_model_shadow -FRAGMENT model_shadow +FRAGMENT model_shadow_fade From efa1dd02741b9de6712d730337749e93dc6ba7e3 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 25 Sep 2018 17:32:04 -0700 Subject: [PATCH 022/157] rename the files from skin to deformed --- .../render-utils/src/HighlightEffect.cpp | 4 +- .../render-utils/src/RenderPipelines.cpp | 64 +++++++++---------- .../{skin_model.slv => deformed_model.slv} | 0 ...kin_model_dq.slv => deformed_model_dq.slv} | 0 ..._map.slv => deformed_model_normal_map.slv} | 0 ...q.slv => deformed_model_normal_map_dq.slv} | 0 ...l_shadow.slv => deformed_model_shadow.slv} | 0 ...ow_dq.slv => deformed_model_shadow_dq.slv} | 0 .../src/render-utils/deformed_model.slp | 2 + .../src/render-utils/deformed_model_dq.slp | 2 + .../src/render-utils/deformed_model_fade.slp | 2 + .../render-utils/deformed_model_fade_dq.slp | 2 + .../deformed_model_normal_map.slp | 2 + .../deformed_model_normal_map_dq.slp | 2 + .../deformed_model_normal_map_fade.slp | 2 + .../deformed_model_normal_map_fade_dq.slp | 2 + ...deformed_model_normal_map_translucent.slp} | 2 +- ...ormed_model_normal_map_translucent_dq.slp} | 2 +- ...med_model_normal_map_translucent_fade.slp} | 2 +- ..._model_normal_map_translucent_fade_dq.slp} | 2 +- .../render-utils/deformed_model_shadow.slp | 2 + .../render-utils/deformed_model_shadow_dq.slp | 2 + .../deformed_model_shadow_fade.slp | 2 + .../deformed_model_shadow_fade_dq.slp | 2 + ...ent.slp => deformed_model_translucent.slp} | 2 +- ....slp => deformed_model_translucent_dq.slp} | 2 +- ...lp => deformed_model_translucent_fade.slp} | 2 +- ...=> deformed_model_translucent_fade_dq.slp} | 2 +- ...n_model.slp => forward_deformed_model.slp} | 2 +- .../forward_deformed_model_dq.slp | 2 + ... => forward_deformed_model_normal_map.slp} | 2 +- .../forward_deformed_model_normal_map_dq.slp | 2 + ...t.slp => forward_deformed_translucent.slp} | 2 +- ...lp => forward_deformed_translucent_dq.slp} | 2 +- ...rward_deformed_translucent_normal_map.slp} | 2 +- ...ard_deformed_translucent_normal_map_dq.slp | 2 + .../render-utils/forward_skin_model_dq.slp | 2 - .../forward_skin_model_normal_map_dq.slp | 2 - ...forward_skin_translucent_normal_map_dq.slp | 2 - .../src/render-utils/skin_model.slp | 2 - .../src/render-utils/skin_model_dq.slp | 2 - .../src/render-utils/skin_model_fade.slp | 2 - .../src/render-utils/skin_model_fade_dq.slp | 2 - .../render-utils/skin_model_normal_map.slp | 2 - .../render-utils/skin_model_normal_map_dq.slp | 2 - .../skin_model_normal_map_fade.slp | 2 - .../skin_model_normal_map_fade_dq.slp | 2 - .../src/render-utils/skin_model_shadow.slp | 2 - .../src/render-utils/skin_model_shadow_dq.slp | 2 - .../render-utils/skin_model_shadow_fade.slp | 2 - .../skin_model_shadow_fade_dq.slp | 2 - 51 files changed, 77 insertions(+), 77 deletions(-) rename libraries/render-utils/src/{skin_model.slv => deformed_model.slv} (100%) rename libraries/render-utils/src/{skin_model_dq.slv => deformed_model_dq.slv} (100%) rename libraries/render-utils/src/{skin_model_normal_map.slv => deformed_model_normal_map.slv} (100%) rename libraries/render-utils/src/{skin_model_normal_map_dq.slv => deformed_model_normal_map_dq.slv} (100%) rename libraries/render-utils/src/{skin_model_shadow.slv => deformed_model_shadow.slv} (100%) rename libraries/render-utils/src/{skin_model_shadow_dq.slv => deformed_model_shadow_dq.slv} (100%) create mode 100644 libraries/render-utils/src/render-utils/deformed_model.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_dq.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_fade.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_fade_dq.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_normal_map.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_normal_map_dq.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_normal_map_fade.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_normal_map_fade_dq.slp rename libraries/render-utils/src/render-utils/{skin_model_normal_map_translucent.slp => deformed_model_normal_map_translucent.slp} (53%) rename libraries/render-utils/src/render-utils/{skin_model_normal_map_translucent_dq.slp => deformed_model_normal_map_translucent_dq.slp} (51%) rename libraries/render-utils/src/render-utils/{skin_model_normal_map_translucent_fade.slp => deformed_model_normal_map_translucent_fade.slp} (56%) rename libraries/render-utils/src/render-utils/{skin_model_normal_map_translucent_fade_dq.slp => deformed_model_normal_map_translucent_fade_dq.slp} (54%) create mode 100644 libraries/render-utils/src/render-utils/deformed_model_shadow.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_shadow_dq.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_shadow_fade.slp create mode 100644 libraries/render-utils/src/render-utils/deformed_model_shadow_fade_dq.slp rename libraries/render-utils/src/render-utils/{skin_model_translucent.slp => deformed_model_translucent.slp} (55%) rename libraries/render-utils/src/render-utils/{skin_model_translucent_dq.slp => deformed_model_translucent_dq.slp} (51%) rename libraries/render-utils/src/render-utils/{skin_model_translucent_fade.slp => deformed_model_translucent_fade.slp} (59%) rename libraries/render-utils/src/render-utils/{skin_model_translucent_fade_dq.slp => deformed_model_translucent_fade_dq.slp} (56%) rename libraries/render-utils/src/render-utils/{forward_skin_model.slp => forward_deformed_model.slp} (51%) create mode 100644 libraries/render-utils/src/render-utils/forward_deformed_model_dq.slp rename libraries/render-utils/src/render-utils/{forward_skin_model_normal_map.slp => forward_deformed_model_normal_map.slp} (50%) create mode 100644 libraries/render-utils/src/render-utils/forward_deformed_model_normal_map_dq.slp rename libraries/render-utils/src/render-utils/{forward_skin_translucent.slp => forward_deformed_translucent.slp} (61%) rename libraries/render-utils/src/render-utils/{forward_skin_translucent_dq.slp => forward_deformed_translucent_dq.slp} (58%) rename libraries/render-utils/src/render-utils/{forward_skin_translucent_normal_map.slp => forward_deformed_translucent_normal_map.slp} (51%) create mode 100644 libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/forward_skin_model_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/forward_skin_model_normal_map_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_fade.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_fade_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_normal_map.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_shadow.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp delete mode 100644 libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp diff --git a/libraries/render-utils/src/HighlightEffect.cpp b/libraries/render-utils/src/HighlightEffect.cpp index 11326b1120..882771b000 100644 --- a/libraries/render-utils/src/HighlightEffect.cpp +++ b/libraries/render-utils/src/HighlightEffect.cpp @@ -556,8 +556,8 @@ void DrawHighlightTask::initMaskPipelines(render::ShapePlumber& shapePlumber, gp ShapeKey::Filter::Builder().withoutSkinned(), modelProgram, state); - gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(shader::render_utils::program::skin_model_shadow); + gpu::ShaderPointer deformedProgram = gpu::Shader::createProgram(shader::render_utils::program::deformed_model_shadow); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned(), - skinProgram, state); + deformedProgram, state); } diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 4804416c00..a9be3fee5a 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -147,60 +147,60 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip // matrix palette skinned addPipeline( Key::Builder().withMaterial().withSkinned(), - skin_model, nullptr, nullptr); + deformed_model, nullptr, nullptr); addPipeline( Key::Builder().withMaterial().withSkinned().withTangents(), - skin_model_normal_map, nullptr, nullptr); + deformed_model_normal_map, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withFade(), - skin_model_fade, batchSetter, itemSetter); + deformed_model_fade, batchSetter, itemSetter); addPipeline( Key::Builder().withMaterial().withSkinned().withTangents().withFade(), - skin_model_normal_map_fade, batchSetter, itemSetter); + deformed_model_normal_map_fade, batchSetter, itemSetter); // matrix palette skinned and translucent addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent(), - skin_model_translucent, nullptr, nullptr); + deformed_model_translucent, nullptr, nullptr); addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), - skin_model_normal_map_translucent, nullptr, nullptr); + deformed_model_normal_map_translucent, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent().withFade(), - skin_model_translucent_fade, batchSetter, itemSetter); + deformed_model_translucent_fade, batchSetter, itemSetter); addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withFade(), - skin_model_normal_map_translucent_fade, batchSetter, itemSetter); + deformed_model_normal_map_translucent_fade, batchSetter, itemSetter); // dual quaternion skinned addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned(), - skin_model_dq, nullptr, nullptr); + deformed_model_dq, nullptr, nullptr); addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTangents(), - skin_model_normal_map_dq, nullptr, nullptr); + deformed_model_normal_map_dq, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withFade(), - skin_model_fade_dq, batchSetter, itemSetter); + deformed_model_fade_dq, batchSetter, itemSetter); addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTangents().withFade(), - skin_model_normal_map_fade_dq, batchSetter, itemSetter); + deformed_model_normal_map_fade_dq, batchSetter, itemSetter); // dual quaternion skinned and translucent addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent(), - skin_model_translucent_dq, nullptr, nullptr); + deformed_model_translucent_dq, nullptr, nullptr); addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withTangents(), - skin_model_normal_map_translucent_dq, nullptr, nullptr); + deformed_model_normal_map_translucent_dq, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withFade(), - skin_model_translucent_fade_dq, batchSetter, itemSetter); + deformed_model_translucent_fade_dq, batchSetter, itemSetter); addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withTangents().withFade(), - skin_model_normal_map_translucent_fade_dq, batchSetter, itemSetter); + deformed_model_normal_map_translucent_fade_dq, batchSetter, itemSetter); // Depth-only addPipeline( @@ -208,24 +208,24 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip model_shadow, nullptr, nullptr); addPipeline( Key::Builder().withSkinned().withDepthOnly(), - skin_model_shadow, nullptr, nullptr); + deformed_model_shadow, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withDepthOnly().withFade(), model_shadow_fade, batchSetter, itemSetter); addPipeline( Key::Builder().withSkinned().withDepthOnly().withFade(), - skin_model_shadow_fade, batchSetter, itemSetter); + deformed_model_shadow_fade, batchSetter, itemSetter); // Now repeat for dual quaternion // Depth-only addPipeline( Key::Builder().withSkinned().withDualQuatSkinned().withDepthOnly(), - skin_model_shadow_dq, nullptr, nullptr); + deformed_model_shadow_dq, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withSkinned().withDualQuatSkinned().withDepthOnly().withFade(), - skin_model_shadow_fade_dq, batchSetter, itemSetter); + deformed_model_shadow_fade_dq, batchSetter, itemSetter); } void initForwardPipelines(ShapePlumber& plumber) { @@ -257,20 +257,20 @@ void initForwardPipelines(ShapePlumber& plumber) { addPipeline(Key::Builder().withMaterial().withTangents(), forward_model_translucent); // Skinned Opaques - addPipeline(Key::Builder().withMaterial().withSkinned(), forward_skin_model); - addPipeline(Key::Builder().withMaterial().withSkinned().withTangents(), forward_skin_model_normal_map); - addPipeline(Key::Builder().withMaterial().withSkinned().withDualQuatSkinned(), forward_skin_model_dq); - addPipeline(Key::Builder().withMaterial().withSkinned().withTangents().withDualQuatSkinned(), forward_skin_model_normal_map_dq); + addPipeline(Key::Builder().withMaterial().withSkinned(), forward_deformed_model); + addPipeline(Key::Builder().withMaterial().withSkinned().withTangents(), forward_deformed_model_normal_map); + addPipeline(Key::Builder().withMaterial().withSkinned().withDualQuatSkinned(), forward_deformed_model_dq); + addPipeline(Key::Builder().withMaterial().withSkinned().withTangents().withDualQuatSkinned(), forward_deformed_model_normal_map_dq); // Translucents addPipeline(Key::Builder().withMaterial().withTranslucent(), forward_model_translucent); addPipeline(Key::Builder().withMaterial().withTranslucent().withTangents(), forward_model_normal_map_translucent); // Skinned Translucents - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent(), forward_skin_translucent); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), forward_skin_translucent_normal_map); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withDualQuatSkinned(), forward_skin_translucent_dq); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withDualQuatSkinned(), forward_skin_translucent_normal_map_dq); + addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent(), forward_deformed_translucent); + addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), forward_deformed_translucent_normal_map); + addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withDualQuatSkinned(), forward_deformed_translucent_dq); + addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withDualQuatSkinned(), forward_deformed_translucent_normal_map_dq); forceLightBatchSetter = false; } @@ -369,7 +369,7 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { ShapeKey::Filter::Builder().withoutSkinned().withoutFade(), modelProgram, state); - gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(skin_model_shadow); + gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(deformed_model_shadow); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withoutDualQuatSkinned().withoutFade(), skinProgram, state); @@ -379,17 +379,17 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { ShapeKey::Filter::Builder().withoutSkinned().withFade(), modelFadeProgram, state); - gpu::ShaderPointer skinFadeProgram = gpu::Shader::createProgram(skin_model_shadow_fade); + gpu::ShaderPointer skinFadeProgram = gpu::Shader::createProgram(deformed_model_shadow_fade); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withoutDualQuatSkinned().withFade(), skinFadeProgram, state); - gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(skin_model_shadow_dq); + gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(deformed_model_shadow_dq); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), skinModelShadowDualQuatProgram, state); - gpu::ShaderPointer skinModelShadowFadeDualQuatProgram = gpu::Shader::createProgram(skin_model_shadow_fade_dq); + gpu::ShaderPointer skinModelShadowFadeDualQuatProgram = gpu::Shader::createProgram(deformed_model_shadow_fade_dq); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), skinModelShadowFadeDualQuatProgram, state); diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/deformed_model.slv similarity index 100% rename from libraries/render-utils/src/skin_model.slv rename to libraries/render-utils/src/deformed_model.slv diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/deformed_model_dq.slv similarity index 100% rename from libraries/render-utils/src/skin_model_dq.slv rename to libraries/render-utils/src/deformed_model_dq.slv diff --git a/libraries/render-utils/src/skin_model_normal_map.slv b/libraries/render-utils/src/deformed_model_normal_map.slv similarity index 100% rename from libraries/render-utils/src/skin_model_normal_map.slv rename to libraries/render-utils/src/deformed_model_normal_map.slv diff --git a/libraries/render-utils/src/skin_model_normal_map_dq.slv b/libraries/render-utils/src/deformed_model_normal_map_dq.slv similarity index 100% rename from libraries/render-utils/src/skin_model_normal_map_dq.slv rename to libraries/render-utils/src/deformed_model_normal_map_dq.slv diff --git a/libraries/render-utils/src/skin_model_shadow.slv b/libraries/render-utils/src/deformed_model_shadow.slv similarity index 100% rename from libraries/render-utils/src/skin_model_shadow.slv rename to libraries/render-utils/src/deformed_model_shadow.slv diff --git a/libraries/render-utils/src/skin_model_shadow_dq.slv b/libraries/render-utils/src/deformed_model_shadow_dq.slv similarity index 100% rename from libraries/render-utils/src/skin_model_shadow_dq.slv rename to libraries/render-utils/src/deformed_model_shadow_dq.slv diff --git a/libraries/render-utils/src/render-utils/deformed_model.slp b/libraries/render-utils/src/render-utils/deformed_model.slp new file mode 100644 index 0000000000..9db8938e86 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model +FRAGMENT model diff --git a/libraries/render-utils/src/render-utils/deformed_model_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_dq.slp new file mode 100644 index 0000000000..ec950ac784 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_dq +FRAGMENT model diff --git a/libraries/render-utils/src/render-utils/deformed_model_fade.slp b/libraries/render-utils/src/render-utils/deformed_model_fade.slp new file mode 100644 index 0000000000..5818e5e3af --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_fade.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model +FRAGMENT model_fade diff --git a/libraries/render-utils/src/render-utils/deformed_model_fade_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_fade_dq.slp new file mode 100644 index 0000000000..9047bc1286 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_fade_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_dq +FRAGMENT model_fade diff --git a/libraries/render-utils/src/render-utils/deformed_model_normal_map.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map.slp new file mode 100644 index 0000000000..ad460652ad --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_normal_map +FRAGMENT model_normal_map diff --git a/libraries/render-utils/src/render-utils/deformed_model_normal_map_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_dq.slp new file mode 100644 index 0000000000..44d5cd5272 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_normal_map_dq +FRAGMENT model_normal_map diff --git a/libraries/render-utils/src/render-utils/deformed_model_normal_map_fade.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_fade.slp new file mode 100644 index 0000000000..99aab59169 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_fade.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_normal_map +FRAGMENT model_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/deformed_model_normal_map_fade_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_fade_dq.slp new file mode 100644 index 0000000000..0ee002b6a1 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_fade_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_normal_map_dq +FRAGMENT model_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent.slp similarity index 53% rename from libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp rename to libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent.slp index 3404358b00..f2e2b2e4da 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map +VERTEX deformed_model_normal_map FRAGMENT model_translucent_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_dq.slp similarity index 51% rename from libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp rename to libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_dq.slp index 6a8c3ada0c..577a6c1616 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_dq.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map_dq +VERTEX deformed_model_normal_map_dq FRAGMENT model_translucent_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_fade.slp similarity index 56% rename from libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp rename to libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_fade.slp index 5286615a99..de9591b45f 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_fade.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map +VERTEX deformed_model_normal_map FRAGMENT model_translucent_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_fade_dq.slp similarity index 54% rename from libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp rename to libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_fade_dq.slp index d493c20aa9..3f624f7bf7 100644 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_translucent_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_normal_map_translucent_fade_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map_dq +VERTEX deformed_model_normal_map_dq FRAGMENT model_translucent_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/deformed_model_shadow.slp b/libraries/render-utils/src/render-utils/deformed_model_shadow.slp new file mode 100644 index 0000000000..c8718dff09 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_shadow.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_shadow +FRAGMENT model_shadow diff --git a/libraries/render-utils/src/render-utils/deformed_model_shadow_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_shadow_dq.slp new file mode 100644 index 0000000000..b0f1449234 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_shadow_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_shadow_dq +FRAGMENT model_shadow diff --git a/libraries/render-utils/src/render-utils/deformed_model_shadow_fade.slp b/libraries/render-utils/src/render-utils/deformed_model_shadow_fade.slp new file mode 100644 index 0000000000..1063134d96 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_shadow_fade.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_shadow +FRAGMENT model_shadow_fade diff --git a/libraries/render-utils/src/render-utils/deformed_model_shadow_fade_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_shadow_fade_dq.slp new file mode 100644 index 0000000000..25c99c75d1 --- /dev/null +++ b/libraries/render-utils/src/render-utils/deformed_model_shadow_fade_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_shadow_dq +FRAGMENT model_shadow_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent.slp b/libraries/render-utils/src/render-utils/deformed_model_translucent.slp similarity index 55% rename from libraries/render-utils/src/render-utils/skin_model_translucent.slp rename to libraries/render-utils/src/render-utils/deformed_model_translucent.slp index 030db7b091..798fec9a5b 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_translucent.slp @@ -1,2 +1,2 @@ -VERTEX skin_model +VERTEX deformed_model FRAGMENT model_translucent diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_translucent_dq.slp similarity index 51% rename from libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp rename to libraries/render-utils/src/render-utils/deformed_model_translucent_dq.slp index e56a4cba7f..8a0b70cfcf 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent_dq.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_translucent_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_dq +VERTEX deformed_model_dq FRAGMENT model_translucent diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp b/libraries/render-utils/src/render-utils/deformed_model_translucent_fade.slp similarity index 59% rename from libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp rename to libraries/render-utils/src/render-utils/deformed_model_translucent_fade.slp index af2df840e9..68eef3624d 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent_fade.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_translucent_fade.slp @@ -1,2 +1,2 @@ -VERTEX skin_model +VERTEX deformed_model FRAGMENT model_translucent_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp b/libraries/render-utils/src/render-utils/deformed_model_translucent_fade_dq.slp similarity index 56% rename from libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp rename to libraries/render-utils/src/render-utils/deformed_model_translucent_fade_dq.slp index 3cdfdabc62..4ce321fa78 100644 --- a/libraries/render-utils/src/render-utils/skin_model_translucent_fade_dq.slp +++ b/libraries/render-utils/src/render-utils/deformed_model_translucent_fade_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_dq +VERTEX deformed_model_dq FRAGMENT model_translucent_fade diff --git a/libraries/render-utils/src/render-utils/forward_skin_model.slp b/libraries/render-utils/src/render-utils/forward_deformed_model.slp similarity index 51% rename from libraries/render-utils/src/render-utils/forward_skin_model.slp rename to libraries/render-utils/src/render-utils/forward_deformed_model.slp index 962cf69ac2..3b7c49705b 100644 --- a/libraries/render-utils/src/render-utils/forward_skin_model.slp +++ b/libraries/render-utils/src/render-utils/forward_deformed_model.slp @@ -1,2 +1,2 @@ -VERTEX skin_model +VERTEX deformed_model FRAGMENT forward_model diff --git a/libraries/render-utils/src/render-utils/forward_deformed_model_dq.slp b/libraries/render-utils/src/render-utils/forward_deformed_model_dq.slp new file mode 100644 index 0000000000..45d886529a --- /dev/null +++ b/libraries/render-utils/src/render-utils/forward_deformed_model_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_dq +FRAGMENT forward_model diff --git a/libraries/render-utils/src/render-utils/forward_skin_model_normal_map.slp b/libraries/render-utils/src/render-utils/forward_deformed_model_normal_map.slp similarity index 50% rename from libraries/render-utils/src/render-utils/forward_skin_model_normal_map.slp rename to libraries/render-utils/src/render-utils/forward_deformed_model_normal_map.slp index 5bae303829..539ca61193 100644 --- a/libraries/render-utils/src/render-utils/forward_skin_model_normal_map.slp +++ b/libraries/render-utils/src/render-utils/forward_deformed_model_normal_map.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map +VERTEX deformed_model_normal_map FRAGMENT forward_model_normal_map diff --git a/libraries/render-utils/src/render-utils/forward_deformed_model_normal_map_dq.slp b/libraries/render-utils/src/render-utils/forward_deformed_model_normal_map_dq.slp new file mode 100644 index 0000000000..c663b671fe --- /dev/null +++ b/libraries/render-utils/src/render-utils/forward_deformed_model_normal_map_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_normal_map_dq +FRAGMENT forward_model_normal_map diff --git a/libraries/render-utils/src/render-utils/forward_skin_translucent.slp b/libraries/render-utils/src/render-utils/forward_deformed_translucent.slp similarity index 61% rename from libraries/render-utils/src/render-utils/forward_skin_translucent.slp rename to libraries/render-utils/src/render-utils/forward_deformed_translucent.slp index 1468d52428..605499ebc3 100644 --- a/libraries/render-utils/src/render-utils/forward_skin_translucent.slp +++ b/libraries/render-utils/src/render-utils/forward_deformed_translucent.slp @@ -1,2 +1,2 @@ -VERTEX skin_model +VERTEX deformed_model FRAGMENT forward_model_translucent diff --git a/libraries/render-utils/src/render-utils/forward_skin_translucent_dq.slp b/libraries/render-utils/src/render-utils/forward_deformed_translucent_dq.slp similarity index 58% rename from libraries/render-utils/src/render-utils/forward_skin_translucent_dq.slp rename to libraries/render-utils/src/render-utils/forward_deformed_translucent_dq.slp index 688bf51ba2..cd20657b01 100644 --- a/libraries/render-utils/src/render-utils/forward_skin_translucent_dq.slp +++ b/libraries/render-utils/src/render-utils/forward_deformed_translucent_dq.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_dq +VERTEX deformed_model_dq FRAGMENT forward_model_translucent diff --git a/libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map.slp b/libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map.slp similarity index 51% rename from libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map.slp rename to libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map.slp index fe3db07670..85d08c1943 100644 --- a/libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map.slp +++ b/libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map.slp @@ -1,2 +1,2 @@ -VERTEX skin_model_normal_map +VERTEX deformed_model_normal_map FRAGMENT forward_model_translucent diff --git a/libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map_dq.slp b/libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map_dq.slp new file mode 100644 index 0000000000..2f13b16a5b --- /dev/null +++ b/libraries/render-utils/src/render-utils/forward_deformed_translucent_normal_map_dq.slp @@ -0,0 +1,2 @@ +VERTEX deformed_model_normal_map_dq +FRAGMENT forward_model_translucent diff --git a/libraries/render-utils/src/render-utils/forward_skin_model_dq.slp b/libraries/render-utils/src/render-utils/forward_skin_model_dq.slp deleted file mode 100644 index 8fe119440f..0000000000 --- a/libraries/render-utils/src/render-utils/forward_skin_model_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_dq -FRAGMENT forward_model diff --git a/libraries/render-utils/src/render-utils/forward_skin_model_normal_map_dq.slp b/libraries/render-utils/src/render-utils/forward_skin_model_normal_map_dq.slp deleted file mode 100644 index 551b8367c7..0000000000 --- a/libraries/render-utils/src/render-utils/forward_skin_model_normal_map_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_normal_map_dq -FRAGMENT forward_model_normal_map diff --git a/libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map_dq.slp b/libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map_dq.slp deleted file mode 100644 index 2012a77e89..0000000000 --- a/libraries/render-utils/src/render-utils/forward_skin_translucent_normal_map_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_normal_map_dq -FRAGMENT forward_model_translucent diff --git a/libraries/render-utils/src/render-utils/skin_model.slp b/libraries/render-utils/src/render-utils/skin_model.slp deleted file mode 100644 index 0d9b419365..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model -FRAGMENT model diff --git a/libraries/render-utils/src/render-utils/skin_model_dq.slp b/libraries/render-utils/src/render-utils/skin_model_dq.slp deleted file mode 100644 index c90dc802c3..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_dq -FRAGMENT model diff --git a/libraries/render-utils/src/render-utils/skin_model_fade.slp b/libraries/render-utils/src/render-utils/skin_model_fade.slp deleted file mode 100644 index 798a0a826d..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_fade.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model -FRAGMENT model_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp deleted file mode 100644 index 2d4c6cd9cd..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_fade_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_dq -FRAGMENT model_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map.slp deleted file mode 100644 index 88c5986f06..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_normal_map -FRAGMENT model_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp deleted file mode 100644 index e443eaf431..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_normal_map_dq -FRAGMENT model_normal_map diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp deleted file mode 100644 index 1730c25aad..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_normal_map -FRAGMENT model_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp deleted file mode 100644 index cac2c5d1b6..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_normal_map_fade_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_normal_map_dq -FRAGMENT model_normal_map_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow.slp b/libraries/render-utils/src/render-utils/skin_model_shadow.slp deleted file mode 100644 index bb15fd1ef5..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_shadow.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_shadow -FRAGMENT model_shadow diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp deleted file mode 100644 index 6f930a2593..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_shadow_dq -FRAGMENT model_shadow diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp deleted file mode 100644 index acf9e201de..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_fade.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_shadow -FRAGMENT model_shadow_fade diff --git a/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp b/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp deleted file mode 100644 index 57bf072969..0000000000 --- a/libraries/render-utils/src/render-utils/skin_model_shadow_fade_dq.slp +++ /dev/null @@ -1,2 +0,0 @@ -VERTEX skin_model_shadow_dq -FRAGMENT model_shadow_fade From 26b6967ba6830e3eb5eb4041a9ce1c1b6674218d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 25 Sep 2018 18:16:18 -0700 Subject: [PATCH 023/157] adding overlays to redirect domain --- interface/resources/serverless/redirect.json | 1098 ++++-------------- libraries/networking/src/DomainHandler.cpp | 1 + scripts/defaultScripts.js | 1 + scripts/system/interstitialPage.js | 18 +- scripts/system/redirectOverlays.js | 144 +++ 5 files changed, 408 insertions(+), 854 deletions(-) create mode 100644 scripts/system/redirectOverlays.js diff --git a/interface/resources/serverless/redirect.json b/interface/resources/serverless/redirect.json index 97cd75c8cd..b40b3867b3 100644 --- a/interface/resources/serverless/redirect.json +++ b/interface/resources/serverless/redirect.json @@ -5,50 +5,6 @@ "/": "/5.77,1.4,4.96/0,0.49544,0,0.868645" }, "Entities": [ - { - "clientOnly": false, - "collidesWith": "static,dynamic,kinematic,otherAvatar,", - "collisionMask": 23, - "created": "2018-09-05T18:13:00Z", - "dimensions": { - "blue": 1.159199833869934, - "green": 2.8062009811401367, - "red": 1.6216505765914917, - "x": 1.6216505765914917, - "y": 2.8062009811401367, - "z": 1.159199833869934 - }, - "id": "{d0ed60b8-9174-4c56-8e78-2c5399329ae0}", - "lastEdited": 1536171372916208, - "lastEditedBy": "{151cb20e-715a-4c80-aa0d-5b58b1c8a0c9}", - "locked": true, - "name": "Try Again Zone", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue":4.015342712402344, - "green":1.649999976158142, - "red":2.00921893119812, - "x":2.00921893119812, - "y":1.649999976158142, - "z":4.015342712402344 - }, - "queryAACube": { - "scale": 3.4421300888061523, - "x": 1.6001315116882324, - "y": -0.07100248336791992, - "z": 0.14220571517944336 - }, - "rotation": { - "w": 0.9914448857307434, - "x": 0, - "y": -0.13052619993686676, - "z": 0 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/zoneTryAgainEntityScript.js", - "shapeType": "box", - "type": "Zone", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, { "clientOnly": false, "color": { @@ -56,7 +12,7 @@ "green": 0, "red": 255 }, - "created": "2018-09-05T00:40:03Z", + "created": "2018-09-25T18:44:28Z", "dimensions": { "blue": 8.645400047302246, "green": 0.20000000298023224, @@ -65,23 +21,23 @@ "y": 0.20000000298023224, "z": 8.645400047302246 }, - "id": "{e44fb546-b34a-4966-9b11-73556f800d21}", - "lastEdited": 1536107948776951, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", + "id": "{eac57ccf-1e81-4d74-80f1-f17f23fc2f2c}", + "lastEdited": 1537901430334573, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", "locked": true, "name": "ceiling", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { "blue": 4.846520900726318, "green": 2.912982940673828, - "red": 5.739595890045166, - "x": 5.739595890045166, + "red": 6.00444221496582, + "x": 6.00444221496582, "y": 2.912982940673828, "z": 4.846520900726318 }, "queryAACube": { "scale": 21.812576293945312, - "x": -5.16669225692749, + "x": -4.901845932006836, "y": -7.993305206298828, "z": -6.059767246246338 }, @@ -103,7 +59,189 @@ "green": 0, "red": 0 }, - "created": "2018-09-05T00:40:03Z", + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 11.117486953735352, + "green": 3.580313205718994, + "red": 0.20000000298023224, + "x": 0.20000000298023224, + "y": 3.580313205718994, + "z": 11.117486953735352 + }, + "id": "{54609e9e-f729-46fc-ac06-78d44ee6b6fe}", + "lastEdited": 1537901430334887, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "backWall", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 5.268576622009277, + "green": 1.0066027641296387, + "red": 6.358620643615723, + "x": 6.358620643615723, + "y": 1.0066027641296387, + "z": 5.268576622009277 + }, + "queryAACube": { + "scale": 11.681488037109375, + "x": 0.5178766250610352, + "y": -4.834141254425049, + "z": -0.5721673965454102 + }, + "rotation": { + "w": 0.9662165641784668, + "x": -4.57763671875e-05, + "y": -0.2576791048049927, + "z": 1.52587890625e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 11.117486953735352, + "green": 3.580313205718994, + "red": 0.20000000298023224, + "x": 0.20000000298023224, + "y": 3.580313205718994, + "z": 11.117486953735352 + }, + "id": "{c9352a54-b2cd-4c0f-a898-7e79c01404d0}", + "lastEdited": 1537901430334652, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "frontWall", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 2.662257671356201, + "green": 1.0063786506652832, + "red": 1.7517199516296387, + "x": 1.7517199516296387, + "y": 1.0063786506652832, + "z": 2.662257671356201 + }, + "queryAACube": { + "scale": 11.681488037109375, + "x": -4.089024066925049, + "y": -4.834365367889404, + "z": -3.1784863471984863 + }, + "rotation": { + "w": 0.9666743278503418, + "x": -4.57763671875e-05, + "y": -0.2560006380081177, + "z": 1.52587890625e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 11.117486953735352, + "green": 3.580313205718994, + "red": 0.20000000298023224, + "x": 0.20000000298023224, + "y": 3.580313205718994, + "z": 11.117486953735352 + }, + "id": "{c4b7a530-ec5b-47fc-be60-eed22f96799d}", + "lastEdited": 1537901430334730, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "rightWall", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 0, + "green": 1.0061144828796387, + "red": 5.229935646057129, + "x": 5.229935646057129, + "y": 1.0061144828796387, + "z": 0 + }, + "queryAACube": { + "scale": 11.681488037109375, + "x": -0.6108083724975586, + "y": -4.834629535675049, + "z": -5.8407440185546875 + }, + "rotation": { + "w": 0.8637980222702026, + "x": -4.57763671875e-05, + "y": 0.5038070678710938, + "z": -1.52587890625e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 14.40000057220459, + "green": 14.40000057220459, + "red": 14.40000057220459, + "x": 14.40000057220459, + "y": 14.40000057220459, + "z": 14.40000057220459 + }, + "id": "{351ddd1e-79b3-4be7-8784-aca29bd65193}", + "lastEdited": 1537901430334210, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 2.3440732955932617, + "green": 1.6162219047546387, + "red": 2.1396677494049072, + "x": 2.1396677494049072, + "y": 1.6162219047546387, + "z": 2.3440732955932617 + }, + "queryAACube": { + "scale": 24.9415340423584, + "x": -10.331099510192871, + "y": -10.854545593261719, + "z": -10.126693725585938 + }, + "rotation": { + "w": 0.8697794675827026, + "x": -1.52587890625e-05, + "y": 0.4933699369430542, + "z": -4.57763671875e-05 + }, + "shapeType": "box", + "skyboxMode": "enabled", + "type": "Zone", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}" + }, + { + "clientOnly": false, + "color": { + "blue": 0, + "green": 0, + "red": 0 + }, + "created": "2018-09-25T18:44:28Z", "dimensions": { "blue": 6.9401350021362305, "green": 0.04553089290857315, @@ -112,9 +250,51 @@ "y": 0.04553089290857315, "z": 6.9401350021362305 }, - "id": "{33440bf8-f9ce-4d52-9b29-1b321e226982}", - "lastEdited": 1536107948774796, - "lastEditedBy": "{4eecd88f-ef9b-4a83-bb9a-7f7496209c6b}", + "id": "{81c13ed1-1873-4f21-adea-5112a0fdacd1}", + "lastEdited": 1537901430334808, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", + "locked": true, + "name": "floor", + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "blue": 3.6175529956817627, + "green": 0, + "red": 4.367232322692871, + "x": 4.367232322692871, + "y": 0, + "z": 3.6175529956817627 + }, + "queryAACube": { + "scale": 9.860417366027832, + "x": -0.5629763603210449, + "y": -4.930208683013916, + "z": -1.3126556873321533 + }, + "rotation": { + "w": 0.8660253882408142, + "x": -1.5922749298624694e-05, + "y": 0.5, + "z": -4.572480611386709e-05 + }, + "shape": "Cube", + "type": "Box", + "userData": "{\"grabbableKey\":{\"grabbable\":false}}", + "visible": false + }, + { + "clientOnly": false, + "created": "2018-09-25T18:44:28Z", + "dimensions": { + "blue": 6.9401350021362305, + "green": 0.04553089290857315, + "red": 7.004304885864258, + "x": 7.004304885864258, + "y": 0.04553089290857315, + "z": 6.9401350021362305 + }, + "id": "{5582179a-fb69-4678-af0c-c8e6d890839a}", + "lastEdited": 1537901430334966, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", "locked": true, "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/LoadingScreens/floor.fbx", "name": "floorModel", @@ -122,14 +302,14 @@ "position": { "blue": 3.6175529956817627, "green": 0, - "red": 4.102385997772217, - "x": 4.102385997772217, + "red": 4.367232322692871, + "x": 4.367232322692871, "y": 0, "z": 3.6175529956817627 }, "queryAACube": { "scale": 9.860417366027832, - "x": -0.8278226852416992, + "x": -0.5629763603210449, "y": -4.930208683013916, "z": -1.3126556873321533 }, @@ -150,54 +330,7 @@ "green": 0, "red": 0 }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 6.9401350021362305, - "green": 0.04553089290857315, - "red": 7.004304885864258, - "x": 7.004304885864258, - "y": 0.04553089290857315, - "z": 6.9401350021362305 - }, - "id": "{8cd93fe5-16c0-44b7-b1e9-e7e06c4e9228}", - "lastEdited": 1536107948774796, - "lastEditedBy": "{4eecd88f-ef9b-4a83-bb9a-7f7496209c6b}", - "locked": true, - "name": "floor", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 3.6175529956817627, - "green": 0, - "red": 4.102385997772217, - "x": 4.102385997772217, - "y": 0, - "z": 3.6175529956817627 - }, - "queryAACube": { - "scale": 9.860417366027832, - "x": -0.8278226852416992, - "y": -4.930208683013916, - "z": -1.3126556873321533 - }, - "rotation": { - "w": 0.8660253882408142, - "x": -1.5922749298624694e-05, - "y": 0.5, - "z": -4.572480611386709e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", + "created": "2018-09-25T18:44:28Z", "dimensions": { "blue": 11.117486953735352, "green": 3.580313205718994, @@ -206,23 +339,23 @@ "y": 3.580313205718994, "z": 11.117486953735352 }, - "id": "{147272dc-a344-4171-9621-efc1c2095997}", - "lastEdited": 1536107948776823, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", + "id": "{366ec0b9-5106-4172-a9f6-2143f6c279aa}", + "lastEdited": 1537901430334307, + "lastEditedBy": "{69540019-db48-4375-86c8-ac1a4a90d043}", "locked": true, "name": "leftWall", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { "blue": 6.1806135177612305, "green": 1.0066027641296387, - "red": 1.4690406322479248, - "x": 1.4690406322479248, + "red": 1.7338871955871582, + "x": 1.7338871955871582, "y": 1.0066027641296387, "z": 6.1806135177612305 }, "queryAACube": { "scale": 11.681488037109375, - "x": -4.371703147888184, + "x": -4.106856822967529, "y": -4.834141254425049, "z": 0.33986949920654297 }, @@ -236,747 +369,8 @@ "type": "Box", "userData": "{\"grabbableKey\":{\"grabbable\":false}}", "visible": false - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 11.117486953735352, - "green": 3.580313205718994, - "red": 0.20000000298023224, - "x": 0.20000000298023224, - "y": 3.580313205718994, - "z": 11.117486953735352 - }, - "id": "{5f2b89b8-47e3-4915-a966-d46307a40f06}", - "lastEdited": 1536107948774605, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", - "locked": true, - "name": "backWall", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 5.268576622009277, - "green": 1.0066027641296387, - "red": 6.093774318695068, - "x": 6.093774318695068, - "y": 1.0066027641296387, - "z": 5.268576622009277 - }, - "queryAACube": { - "scale": 11.681488037109375, - "x": 0.25303030014038086, - "y": -4.834141254425049, - "z": -0.5721673965454102 - }, - "rotation": { - "w": 0.9662165641784668, - "x": -4.57763671875e-05, - "y": -0.2576791048049927, - "z": 1.52587890625e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 14.40000057220459, - "green": 14.40000057220459, - "red": 14.40000057220459, - "x": 14.40000057220459, - "y": 14.40000057220459, - "z": 14.40000057220459 - }, - "id": "{baf96345-8f68-4068-af4c-3c690035852a}", - "lastEdited": 1536107948775591, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 2.3440732955932617, - "green": 1.6162219047546387, - "red": 1.8748211860656738, - "x": 1.8748211860656738, - "y": 1.6162219047546387, - "z": 2.3440732955932617 - }, - "queryAACube": { - "scale": 24.9415340423584, - "x": -10.595945358276367, - "y": -10.854545593261719, - "z": -10.126693725585938 - }, - "rotation": { - "w": 0.8697794675827026, - "x": -1.52587890625e-05, - "y": 0.4933699369430542, - "z": -4.57763671875e-05 - }, - "shapeType": "box", - "skyboxMode": "enabled", - "type": "Zone", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 1, - "clientOnly": false, - "color": { - "blue": 211, - "green": 227, - "red": 104 - }, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 211, - "green": 227, - "red": 104, - "x": 104, - "y": 227, - "z": 211 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.5, - "green": 2.5, - "red": 2.5, - "x": 2.5, - "y": 2.5, - "z": 2.5 - }, - "emitAcceleration": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 0.9993909597396851, - "x": 0.034897372126579285, - "y": -1.525880907138344e-05, - "z": -1.525880907138344e-05 - }, - "emitRate": 2, - "emitSpeed": 0, - "id": "{639a51f0-8613-4e46-bc7e-fef24597df73}", - "lastEdited": 1536107948776693, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 40, - "name": "Rays", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.75, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 1.3553659915924072, - "green": 1.2890124320983887, - "red": 2.5663273334503174, - "x": 2.5663273334503174, - "y": 1.2890124320983887, - "z": 1.3553659915924072 - }, - "queryAACube": { - "scale": 4.330127239227295, - "x": 0.4012637138366699, - "y": -0.8760511875152588, - "z": -0.8096976280212402 - }, - "radiusFinish": 0.10000000149011612, - "radiusStart": 0, - "rotation": { - "w": 0.9803768396377563, - "x": -1.52587890625e-05, - "y": 0.19707024097442627, - "z": -7.62939453125e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/stripe.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 1, - "clientOnly": false, - "color": { - "blue": 255, - "green": 205, - "red": 3 - }, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 255, - "green": 204, - "red": 0, - "x": 0, - "y": 204, - "z": 255 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.5, - "green": 2.5, - "red": 2.5, - "x": 2.5, - "y": 2.5, - "z": 2.5 - }, - "emitAcceleration": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 0.9993909597396851, - "x": 0.034897372126579285, - "y": -1.525880907138344e-05, - "z": -1.525880907138344e-05 - }, - "emitRate": 2, - "emitSpeed": 0, - "emitterShouldTrail": true, - "id": "{e62ced49-fa18-4ae1-977f-abef5bc0f3ba}", - "lastEdited": 1536107948775366, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 40, - "name": "Rays", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.75, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 3.814434051513672, - "green": 1.2890124320983887, - "red": 1.2254328727722168, - "x": 1.2254328727722168, - "y": 1.2890124320983887, - "z": 3.814434051513672 - }, - "queryAACube": { - "scale": 4.330127239227295, - "x": -0.9396307468414307, - "y": -0.8760511875152588, - "z": 1.6493704319000244 - }, - "radiusFinish": 0.10000000149011612, - "radiusStart": 0, - "rotation": { - "w": 0.9594720602035522, - "x": -1.52587890625e-05, - "y": 0.28178834915161133, - "z": -4.57763671875e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/stripe.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 0.25, - "clientOnly": false, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 255, - "green": 255, - "red": 255, - "x": 255, - "y": 255, - "z": 255 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 13.24000072479248, - "green": 13.24000072479248, - "red": 13.24000072479248, - "x": 13.24000072479248, - "y": 13.24000072479248, - "z": 13.24000072479248 - }, - "emitAcceleration": { - "blue": 0, - "green": 0.10000000149011612, - "red": 0, - "x": 0, - "y": 0.10000000149011612, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 1, - "x": -1.52587890625e-05, - "y": -1.52587890625e-05, - "z": -1.52587890625e-05 - }, - "emitRate": 6, - "emitSpeed": 0, - "id": "{298c0571-cbd8-487b-8640-64037d6a8414}", - "lastEdited": 1536107948776382, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 10, - "name": "Stars", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.07000000029802322, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 1.3712034225463867, - "green": 0.3698839843273163, - "red": 2.6216418743133545, - "x": 2.6216418743133545, - "y": 0.3698839843273163, - "z": 1.3712034225463867 - }, - "queryAACube": { - "scale": 22.932353973388672, - "x": -8.844534873962402, - "y": -11.096293449401855, - "z": -10.09497356414795 - }, - "radiusFinish": 0, - "radiusStart": 0, - "rotation": { - "w": 0.9852597713470459, - "x": -1.52587890625e-05, - "y": -0.17106890678405762, - "z": -7.62939453125e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/star.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.1097896099090576, - "green": 0.04847164824604988, - "red": 1.458284616470337, - "x": 1.458284616470337, - "y": 0.04847164824604988, - "z": 2.1097896099090576 - }, - "id": "{6625dbb8-ff25-458d-a92e-644b58460604}", - "lastEdited": 1536107948776195, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/portal1.fbx", - "name": "Try Again", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 3.946338653564453, - "green": 0.09449335932731628, - "red": 1.594836711883545, - "x": 1.594836711883545, - "y": 0.09449335932731628, - "z": 3.946338653564453 - }, - "queryAACube": { - "scale": 2.5651814937591553, - "x": 0.3122459650039673, - "y": -1.188097357749939, - "z": 2.663747787475586 - }, - "rotation": { - "w": 0.8220492601394653, - "x": -1.52587890625e-05, - "y": 0.5693598985671997, - "z": -0.0001068115234375 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/tryAgainEntityScript.js", - "shapeType": "static-mesh", - "type": "Model", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 0.06014331430196762, - "green": 2.582186460494995, - "red": 2.582186698913574, - "x": 2.582186698913574, - "y": 2.582186460494995, - "z": 0.06014331430196762 - }, - "id": "{dfe92dce-f09d-4e9e-b3ed-c68ecd4d476f}", - "lastEdited": 1536108160862286, - "lastEditedBy": "{4656d4a8-5e61-4230-ab34-2888d7945bd6}", - "modelURL": "", - "name": "Oops Dialog", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 1.45927095413208, - "green": 1.6763916015625, - "red": 0, - "x": 0, - "y": 1.6763916015625, - "z": 1.45927095413208 - }, - "queryAACube": { - "scale": 3.6522583961486816, - "x": -1.8261291980743408, - "y": -0.14973759651184082, - "z": -0.36685824394226074 - }, - "rotation": { - "w": 0.8684672117233276, - "x": -4.57763671875e-05, - "y": 0.4957197904586792, - "z": -7.62939453125e-05 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/oopsEntityScript.js", - "scriptTimestamp": 1536102551825, - "type": "Model", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 11.117486953735352, - "green": 3.580313205718994, - "red": 0.20000000298023224, - "x": 0.20000000298023224, - "y": 3.580313205718994, - "z": 11.117486953735352 - }, - "id": "{144a8cf4-b0e8-489a-9403-d74d4dc4cb3e}", - "lastEdited": 1536107948775774, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", - "locked": true, - "name": "rightWall", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 0, - "green": 1.0061144828796387, - "red": 4.965089321136475, - "x": 4.965089321136475, - "y": 1.0061144828796387, - "z": 0 - }, - "queryAACube": { - "scale": 11.681488037109375, - "x": -0.8756546974182129, - "y": -4.834629535675049, - "z": -5.8407440185546875 - }, - "rotation": { - "w": 0.8637980222702026, - "x": -4.57763671875e-05, - "y": 0.5038070678710938, - "z": -1.52587890625e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "collidesWith": "static,dynamic,kinematic,otherAvatar,", - "collisionMask": 23, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 1.159199833869934, - "green": 2.8062009811401367, - "red": 1.6216505765914917, - "x": 1.6216505765914917, - "y": 2.8062009811401367, - "z": 1.159199833869934 - }, - "id": "{37f53408-3d0c-42a5-9891-e6c40a227349}", - "lastEdited": 1536107948775010, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "name": "Back Zone", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 1.8632707595825195, - "green": 1.6500625610351562, - "red": 3.3211965560913086, - "x": 3.3211965560913086, - "y": 1.6500625610351562, - "z": 1.8632707595825195 - }, - "queryAACube": { - "scale": 3.4421300888061523, - "x": 1.6001315116882324, - "y": -0.07100248336791992, - "z": 0.14220571517944336 - }, - "rotation": { - "w": 0.9304176568984985, - "x": 0, - "y": -0.36650121212005615, - "z": 0 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/zoneBackEntityScript.js", - "shapeType": "box", - "type": "Zone", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "clientOnly": false, - "color": { - "blue": 0, - "green": 0, - "red": 0 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 11.117486953735352, - "green": 3.580313205718994, - "red": 0.20000000298023224, - "x": 0.20000000298023224, - "y": 3.580313205718994, - "z": 11.117486953735352 - }, - "id": "{aa6e680c-6750-4776-95bc-ef3118cace5c}", - "lastEdited": 1536107948775945, - "lastEditedBy": "{ce82d352-3002-44ae-9b76-66492989a1db}", - "locked": true, - "name": "frontWall", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 2.662257671356201, - "green": 1.0063786506652832, - "red": 1.4868733882904053, - "x": 1.4868733882904053, - "y": 1.0063786506652832, - "z": 2.662257671356201 - }, - "queryAACube": { - "scale": 11.681488037109375, - "x": -4.353870391845703, - "y": -4.834365367889404, - "z": -3.1784863471984863 - }, - "rotation": { - "w": 0.9666743278503418, - "x": -4.57763671875e-05, - "y": -0.2560006380081177, - "z": 1.52587890625e-05 - }, - "shape": "Cube", - "type": "Box", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}", - "visible": false - }, - { - "clientOnly": false, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 2.1097896099090576, - "green": 0.04847164824604988, - "red": 1.458284616470337, - "x": 1.458284616470337, - "y": 0.04847164824604988, - "z": 2.1097896099090576 - }, - "id": "{303631f1-04f3-42a6-b8a8-8dd4b65d1231}", - "lastEdited": 1536107948776513, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "locked": true, - "modelURL": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/portal2.fbx", - "name": "Back", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "position": { - "blue": 1.5835940837860107, - "green": 0.09449335932731628, - "red": 3.028078079223633, - "x": 3.028078079223633, - "y": 0.09449335932731628, - "z": 1.5835940837860107 - }, - "queryAACube": { - "scale": 2.5651814937591553, - "x": 1.7454873323440552, - "y": -1.188097357749939, - "z": 0.3010033369064331 - }, - "rotation": { - "w": 0.9084458351135254, - "x": -1.52587890625e-05, - "y": 0.4179598093032837, - "z": -0.0001068115234375 - }, - "script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/backEntityScript.js", - "scriptTimestamp": 1535751754379, - "shapeType": "static-mesh", - "type": "Model", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" - }, - { - "alpha": 0, - "alphaFinish": 0, - "alphaStart": 0.25, - "clientOnly": false, - "colorFinish": { - "blue": 0, - "green": 0, - "red": 0, - "x": 0, - "y": 0, - "z": 0 - }, - "colorStart": { - "blue": 255, - "green": 255, - "red": 255, - "x": 255, - "y": 255, - "z": 255 - }, - "created": "2018-09-05T00:40:03Z", - "dimensions": { - "blue": 13.24000072479248, - "green": 13.24000072479248, - "red": 13.24000072479248, - "x": 13.24000072479248, - "y": 13.24000072479248, - "z": 13.24000072479248 - }, - "emitAcceleration": { - "blue": 0, - "green": 0.10000000149011612, - "red": 0, - "x": 0, - "y": 0.10000000149011612, - "z": 0 - }, - "emitDimensions": { - "blue": 1, - "green": 1, - "red": 1, - "x": 1, - "y": 1, - "z": 1 - }, - "emitOrientation": { - "w": 1, - "x": -1.52587890625e-05, - "y": -1.52587890625e-05, - "z": -1.52587890625e-05 - }, - "emitRate": 6, - "emitSpeed": 0, - "emitterShouldTrail": true, - "id": "{8ded39e6-303c-48f2-be79-81b715cca9f7}", - "lastEdited": 1536107948777127, - "lastEditedBy": "{b5bba536-25e5-4b12-a1be-5c7cd196a06a}", - "lifespan": 10, - "locked": true, - "maxParticles": 10, - "name": "Stars", - "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", - "particleRadius": 0.07000000029802322, - "polarFinish": 3.1415927410125732, - "position": { - "blue": 3.78922963142395, - "green": 0.3698839843273163, - "red": 1.1863799095153809, - "x": 1.1863799095153809, - "y": 0.3698839843273163, - "z": 3.78922963142395 - }, - "queryAACube": { - "scale": 22.932353973388672, - "x": -10.279796600341797, - "y": -11.096293449401855, - "z": -7.676947593688965 - }, - "radiusFinish": 0, - "radiusStart": 0, - "rotation": { - "w": 0.996429443359375, - "x": -1.52587890625e-05, - "y": -0.08442819118499756, - "z": -4.57763671875e-05 - }, - "speedSpread": 0, - "spinFinish": null, - "spinStart": null, - "textures": "http://hifi-content.s3.amazonaws.com/alexia/Models/Portal/star.png", - "type": "ParticleEffect", - "userData": "{\"grabbableKey\":{\"grabbable\":false}}" } ], - "Id": "{18abccad-2d57-4176-9d89-24dc424916f5}", + "Id": "{6ec356c4-abf2-41b7-9980-c47dd08343b2}", "Version": 93 } diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index f34a93de96..64841295de 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -311,6 +311,7 @@ void DomainHandler::setIsConnected(bool isConnected) { _isConnected = isConnected; if (_isConnected) { + _lastDomainConnectionError = -1; emit connectedToDomain(_domainURL); if (_domainURL.scheme() == URL_SCHEME_HIFI && !_domainURL.host().isEmpty()) { diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index aaf5ca7260..e11891bb33 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -40,6 +40,7 @@ var DEFAULT_SCRIPTS_SEPARATE = [ if (Settings.getValue("enableInterstitialMode", false)) { DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); + DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); } // add a menu item for debugging diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 0c786dad87..c8a7dc3e83 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -178,7 +178,7 @@ localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 180.0, z: 0.0 }), parentID: anchorOverlay }); - + var TARGET_UPDATE_HZ = 60; // 50hz good enough, but we're using update var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; var lastInterval = Date.now(); @@ -347,7 +347,6 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); if (!HMD.active) { toolbar.writeProperty("visible", physicsEnabled); @@ -399,6 +398,18 @@ }; Overlays.editOverlay(loadingBarProgress, properties); + + + var hardRefusalErrorsIdx = hardRefusalErrors.indexOf(Window.getLastDomainConnectionError()); + + var redirectProperties = { + visible: (hardRefusalErrorsIdx >= 0) + }; + + Overlays.editOverlay(redirectOopsText, redirectProperties); + Overlays.editOverlay(tryAgainImage, redirectProperties); + Overlays.editOverlay(backImage, redirectProperties); + if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); endAudio(); @@ -457,6 +468,9 @@ Overlays.deleteOverlay(loadingBarPlacard); Overlays.deleteOverlay(loadingBarProgress); Overlays.deleteOverlay(anchorOverlay); + Overlays.deleteOverlay(redirectOopsText); + Overlays.deleteOverlay(tryAgainImage); + Overlays.deleteOverlay(backImage); if (DEBUG) { tablet.removeButton(button); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js new file mode 100644 index 0000000000..c3aca60a94 --- /dev/null +++ b/scripts/system/redirectOverlays.js @@ -0,0 +1,144 @@ +"use strict"; +(function() { + + var ERROR_MESSAGE_MAP = [ + "Oops! Protocol version mismatch.", + "Oops! Not authorized to join domain.", + "Oops! Connection timed out.", + "Oops! Something went wrong." + ]; + + var PROTOCOL_VERSION_MISMATCH = 1; + var NOT_AUTHORIZED = 3; + var TIMEOUT = 5; + var hardRefusalErrors = [PROTOCOL_VERSION_MISMATCH, + NOT_AUTHORIZED, TIMEOUT]; + var error = -1; + var timer = null; + + function getOopsText() { + error = Window.getLastDomainConnectionError(); + if (hardRefusalErrors.indexOf(error) >= 0) { + return ERROR_MESSAGE_MAP[error]; + } else { + // some other text. + return ERROR_MESSAGE_MAP[4]; + } + }; + + var redirectOopsText = Overlays.addOverlay("text3d", { + name: "oopsText", + // position: { x: 0.2656, y: 1.6764, z: 1.4593}, + position: { x: 0.0, y: 1.6764, z: 1.4593}, + text: getOopsText(), + textAlpha: 1, + backgroundAlpha: 0, + lineHeight: 0.13, + // dimensions: {x: 2.58, y: 2.58}, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + parentID: MyAvatar.SELF_ID + }); + print("redirect oops text = " + redirectOopsText); + + var tryAgainImage = Overlays.addOverlay("image3d", { + name: "tryAgainImage", + position: { x: 0.0, y: 1.0695, z: 1.9094}, + url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", + alpha: 1, + // dimensions: {x: 0.9, y: 0.4}, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + parentID: MyAvatar.SELF_ID + }); + print("try again image = " + tryAgainImage); + + var backImage = Overlays.addOverlay("image3d", { + name: "backImage", + position: { x: 0.525, y: 1.0695, z: 1.0186}, + url: Script.resourcesPath() + "images/interstitialPage/button_back.png", + alpha: 1, + // dimensions: {x: 0.9, y: 0.4}, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 180.0, z: 0.0 }), + orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + parentID: MyAvatar.SELF_ID + }); + print("back image = " + backImage); + + var TARGET_UPDATE_HZ = 60; + var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; + + function toggleOverlays() { + var overlaysVisible = false; + error = Window.getLastDomainConnectionError(); + var oopsText = ""; + if (error === -1) { + overlaysVisible = false; + } else if (hardRefusalErrors.indexOf(error) >= 0) { + overlaysVisible = true; + oopsText = ERROR_MESSAGE_MAP[error]; + } else { + overlaysVisible = true; + oopsText = ERROR_MESSAGE_MAP[4]; + } + var properties = { + visible: overlaysVisible + }; + var oopsTextProperties = { + visible: overlaysVisible, + text: oopsText + }; + + Overlays.editOverlay(redirectOopsText, oopsTextProperties); + Overlays.editOverlay(tryAgainImage, properties); + Overlays.editOverlay(backImage, properties) + } + + function clickedOnOverlay(overlayID, event) { + if (tryAgainImage === overlayID) { + location.goToLastAddress(); + } else if (backImage === overlayID) { + location.goBack(); + } + } + + function cleanup() { + timer = null; + Overlays.deleteOverlay(redirectOopsText); + Overlays.deleteOverlay(tryAgainImage); + Overlays.deleteOverlay(backImage); + } + + var whiteColor = {red: 255, green: 255, blue: 255}; + var greyColor = {red: 125, green: 125, blue: 125}; + Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); + Overlays.hoverEnterOverlay.connect(function(overlayID, event) { + if (overlayID === backImage || overlayID === tryAgainImage) { + Overlays.editOverlay(overlayID, { color: greyColor }); + } + }); + + Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { + if (overlayID === backImage || overlayID === tryAgainImage) { + Overlays.editOverlay(overlayID, { color: whiteColor }); + } + }); + + // timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); + Script.update.connect(toggleOverlays); + + Script.scriptEnding.connect(cleanup); +}()); From 42579f3d167a67aa2f2a1ebd72f6a488b15fcbfa Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 25 Sep 2018 18:21:51 -0700 Subject: [PATCH 024/157] fixing oops dialog text index lookups --- scripts/system/redirectOverlays.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index c3aca60a94..fdd69fdab3 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -18,8 +18,9 @@ function getOopsText() { error = Window.getLastDomainConnectionError(); - if (hardRefusalErrors.indexOf(error) >= 0) { - return ERROR_MESSAGE_MAP[error]; + var errorMessageMapIndex = hardRefusalErrors.indexOf(error); + if (errorMessageMapIndex >= 0) { + return ERROR_MESSAGE_MAP[errorMessageMapIndex]; } else { // some other text. return ERROR_MESSAGE_MAP[4]; @@ -84,12 +85,13 @@ function toggleOverlays() { var overlaysVisible = false; error = Window.getLastDomainConnectionError(); + var errorMessageMapIndex = hardRefusalErrors.indexOf(error); var oopsText = ""; if (error === -1) { overlaysVisible = false; - } else if (hardRefusalErrors.indexOf(error) >= 0) { + } else if (errorMessageMapIndex >= 0) { overlaysVisible = true; - oopsText = ERROR_MESSAGE_MAP[error]; + oopsText = ERROR_MESSAGE_MAP[errorMessageMapIndex]; } else { overlaysVisible = true; oopsText = ERROR_MESSAGE_MAP[4]; From 54f800fbda08b9e859a050dcaf2b312540651f2f Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 25 Sep 2018 20:21:05 -0700 Subject: [PATCH 025/157] including images/parent buttons to text --- .../images/interstitialPage/button_back.png | Bin 0 -> 3842 bytes .../interstitialPage/button_tryAgain.png | Bin 0 -> 4512 bytes scripts/system/redirectOverlays.js | 26 ++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 interface/resources/images/interstitialPage/button_back.png create mode 100644 interface/resources/images/interstitialPage/button_tryAgain.png diff --git a/interface/resources/images/interstitialPage/button_back.png b/interface/resources/images/interstitialPage/button_back.png new file mode 100644 index 0000000000000000000000000000000000000000..cb9c9098361abd4aebc4778c26824e907ec290dc GIT binary patch literal 3842 zcmV~$2Ot#s0|4OPIU}O$Daw5ODTk{f>{;BK;~Q(dKv# zid#b7kqTv|m&7yBv4xU(g_4$f?Sb$~4cJ7DB}oTu3dCbY7R?V!kHA86hpn z@@+3>2idiico-qNt$*Xc(f%i+{BGK>apQF=1gNkOS3{Jd23W4E7696WRE;Fdi3{r@ zH@XXKZ@k=J*JoSGX{P*n)bnYnebh!-|+GR5S9+DunnTkQdT3<0)VtGPA+}d3KR!l<{ z_e-{i@G{&}j8vMi5Y~=L7HG3?jC-pMU#9&EMQ9!MxtzIJrwFo%=jyvXjQS zyD{1Qgn&}9Ur7fQyb~#Wl^^3IuMf!dbUSROp1*cb1djUUtFykSQz`nUQLONE8B))( zif}Q3xHq6SZ^;433tl8$T2`Cr*}Db9@8)0IFK#S;IQ4=68+!vIpU~6XvjeG4v;&f+ zht3|atc;VC&h+v%Vt@d`r$?mj^o4P)E5CKq-Ee7IvEOQc z3~nFR7By6YNB_O^*d2gcN(zo5Wr-h6txd4oG%v+d%?1H@`tYPrLR*Qe{N16r*`Vd# z1Tzroju;k?lq!j&F_{g%#`yyfSH9we;F`WzMwm5Gg@Wo4@e`BY&`c9m{iV|$Q`PpH z1PHh-;<&QYNcmPP?lD_%Gw~l;0E&(xL(txz2G~{#lK5BvP}HglOiQMrnCsNGDCUuA zp^vWta9h`gpp$BjoG_v5F>QL!w9W4^0ONn9^k-d}_V@;qwQ-gJh?@_){1Ob>Z;Bg( zj8wT>rmpZa1H|3v{;51yrs;j3jT_V}0E0Y|sn2C!dCukubJU4GJE^Dd*VqiO8TW-K z?W5K-WC(Wsld_Ti(6k3@2i}1@SZ`K^0U_YckJJd)_hUp{KTg@-461Mv2!4dgTlQM^ zQ)R46MTZ@~+`aHqa4Z~NXoF+JuqpMzPDZZ{T^YDB7qW1K(=9svE|Fk(v%-y)da;FF zA*RC+`wwHt2GUb8P#$v%LtfQt8|?Xa>Nz~wjaDQG;n)!2Ax-%;x<~M|wz8akuX)K+ z@>gm7h@sc8Cp+1*nWu$)g&V?gf6#&=Lm7M{3qdTwgA?xu2A}g-UD?ze8`f$=X9a59 zRn^depNcXy-p!BlbXM2(HI@9XzV42;2x&=m(X}rPc*P(QUB)@&pn&c`ex@8c9u`&E z8E&3%M*7!3I%Ha||EDgva@nyul+N&aP@ z^`9yN7R^&_5+lwB!OppX@h)~2YkE+Jc$kn1;aD27|4;C&M5n4~o`U_(NCKsgNU3~l zvqL6389EAF_)z+bWtXFBqs@#F^g)n_bWPjF@ zBVN{E62Wo6Zb0rJiPMN&?e3&nLHRwklCr~ho_x1WHH=Dr=(S8QKL(@h{mvT!c<63j zj!lC0nQd{7qFjT5r0J5p$*|XtupPC=)-G1GAmU$)WZ)>rTv={<&1a-szR0tmjq3Ed za_RbDO6)W47P(FTyiwvF|2cNopUOllf(j90_p6;ki>jToH4>aw_EcV@ z_eU)tyu~mZe{d2fMDff^WbH)hEVb|xTTdyQ34#^;q6Sllwp1y?5_G2Dn#x6mmDVTW zSJNddmm*&MwbuMAYuDzDzWGNj15RQ7+%DCow9U3@v%EpRr=3CS$x(Oy2tkhoy?QXd zMQuj*=Dj{Hp)k|6pH1(Zr_keCk~g*S$sAzzY~$iePm)?U;3k!oN79b^`guvWU+^ix z%Zf9)evGF20en&nWHZv)ykgqVR0}FsIsJi?i)b8&+_np4f{K zjDjP$IDU#wFDf4}hS_D&x_+Yb;apfHePpfk>qEsQOIWmfvIEsUN{aejNnswsXx2miBaN;yFynzRY4e~BApHSxRel^#j8|&tTNc-;kW93@1`_r`kA%|UO{a= zk6CSf^%vpG^~>4siLMBANDO&$6K-IN2<5bR*uqa*o*VNz96F*W>K5I7Sp6lWRnAIz0>W zQiKmG{v+<)TmZzEyU*TT(4pk=3}NTm1g9TI!T>^blo)b}FAAzuokUyRBLE=O9+~>` zd~7@7grynsUQew!i5U<$9V{O0tFT{MY1K4(wW^+`cnE;2#h^_13;#dqeU&d6;I!N! z8xi@4{^~mb2riXO1-Hr4bQ+e`UU*5(sYa*0$rNZ>wuFF=8`nC|RraS+V&*4L&d$!F z(P#(p%_^6AtFfB()Z-WcO7VYV8_wsg4LViNv4?3AwL2q4D?WGiZ% zKq@Xp8%*j;CDFc~otGXVP6{k|zM{?D9tb+iU<4Ghk?y5sAKGw}gbCIU6p~5;7 zXqunLk0vRso}eQbMos5-Y2G^3f91QCH7!Qh9;t}ptQPN|1{mt~0r%K>3G3sAm4kvL z<-;LwWx{{lJ4fH=8o~j9E8uRup+hPjEelL+eAL`rzPz#4;=NM zTh|)mO@@7CaNq1l^G1`7jKja`h;J(AF>nBkFB>(H-9}4coO6hGB!fZtEMVUWmRU0b zFutr*mtSZZbKiN1cUTyqpa{)>#7Q~U7<~=^;jLq~O3S56toKFg1QZD?*6pgfm9w*f zyW|Qm9Bfos`cn5l`!(fqI6l@DP2I#9O$V%}F6@{HK;^wREl9a8CVTjBK-K%96kavm z=D}#&ZB$UY=t;mO04#X=N|=)M@BN%Aujf)geu5l6CKoi;#+@W3@q+5NpM37Wk;)~1 z@X%tB>Sr8ToEH1NlVj(%$QJ+m2f$#1^pZO9%)z!YxifG|k0SCntKyFglk7fik=@9& z6=P;_`_)6v@BWX;5{?lTBQ=W1FFmisl@?>igq_ZYB}9bW-*5w=JHgKHGhr#`VkyGr zyN>2Dh419>buRCVZRC6mtDHr6$vdIi9?*_~_?oNFYPc~U`WEm(c04y?-VInps0?F` zig8USWBFSVMK|7_#jCpjvX?rx>wR?|Hcp{;NCHcAuTbmuxH3=&*U;5HJZ^ykA51;d zt~OJMcjkJ&U9l88TV`HEsUXw?K}YS{AS9BK4*ok&XmhZ@Uu!! z^O(X|f!%OMP%4&LglwbyH2gLU&okJ3J1&=e&&Tdh8vsnYm!+s9mVPG$N4(%V6sL5oY^0#K6drj z6389?jsalp4fW@Zecai{NFFxC?+EDmhOvZjra|1LG6n!tRoWWf65PX8s=8Muplv8i z2*1-{CXfLD(+2jyKCW$8j|k{ymGZs@bIRWp0AN$XdMN|i26NB;IMiwx0DxJOfWEXr z-6x>k!7SDC3Dq(HU_qo)*`!Cc|s983gt5BAUJz642Ts`@E$CInsxO@o3q5@z`_GtLi(MC^)#d~JeYMgoy_TA9GQnE?Ybn0`{tqRJC!m3pv`Pb&BI(9 zhf`M7Qc0h#WI$`P!qpUKDNEDM9RRQqVJ$&D&1fRIHoZ5CtV(9Mv(q$b6U+dBMF;hH z&5HU?L%P*Y%E^p&P(t}*%^mEUhaPeSGXP+bAuZW;Wa@QjZhbgbGJ_r4*UGt0^T1rY zt^)uNk!PvqSytm|2W^G)iv@?XTwwp@_VzaCPXPe1Ol&sY*~j(v_VzdX&p+G8pCX>t zv&(nv^Zv6m6?DyT&dnUUr~?4dQpVNoSJk%}cd+mZx@I`bBqM*d8~$J3asa@JRMWrN z%J^UQKYxl0>2A|Xx^V?vGn}P&_AzfY0APiy={mVL^)=}i4L4HGBK}=tBY)+s1pusg zH9fM`@n`#=e=*_f(sE7ut2}3J6?BcER13Qk2mk;xtfcD0;me>vAzHwBoCT=a|KSeBhz%^$8z$UR7nMGE~dolBX)UBXnx|LrL&H#W7tfVD$VdKMYkaDL6(0RX_W43%EpnP-v8 z2~4&EE8Y);v*6|z006ih7=Kf@^yWTt{g2Q!=##+z?{iOQ007)0P2Yty8Jl1n5%*g-Ab}gI0FDMl~9lF z#};f?Kp!?-IRF5tC~}Q|Ty)PF(0adTU+F#6FS+b71EhWTt{l)g3;=*ugqpd##R@tLtn7y4 z2>?JVLYbQVQ257ggR}>L)_wo}ecu#1t|m!x%2B~O7>~yTTP6Dz*)3MkzUJ+m-rJbt zmvZ*Kec2ium-m5ve7}Z&4l*Y6r0@XN$Wexv7faT(A=I-1Fw2puF z`OI+y7Fs>aXS5SotfR{TSp5pxOs+wPKGY+QBjzYKH7AviSUz8~>iJAR+*#>ZWNY?$ z<+}&#%=`D9Xa#+0JlA)|<8i`q#FAB%-=F*;TWh|*a(%ftkfWS5cmaxZj}0L)nB$@><^1{+*eckSb&hJY)iZUU8TOvQT_8S1g? zdsdB4a~)a(?2~Etnsr)pc?r)eyDhzz-`e*Y*r8!*UB?LkurvYvL&TG5;>J3X>M9fr zuFCWxBKV3y)u+k6P?w6L6?}NLD?}p-XvhJ_? z->)3U{oKrMD&dj7zRczDv!0L?-ybp7J@&O z-?h-vP~4wO^Kgwjcf9^p=~&5hq69RS&eqP(PR3!t2FtZ7mVlD6#RsL1NW(xyYaCT} zOvM}PO^piL7wo>1lgp~>uo{}hpzrCmYuB=Q%ns=~%Ym4-_?}+d*SPR(&vB{n;5!h@ z8PFU8Y$yqdw;IaFp6cx;5SYI38#U>@t-X-DG3(QSE$%~CpC5ZHd_K=0Ov{~5=Qc&D z<5-!hlMZ0f0ZkJ&HqnQeVK$CsGEbmpEmzNV*H@>C<^*ka6+F;RK##{`I)MT4!RM!?kKSGle~doM@T zxDH+3pMAUBk!u^Y$8+&J;I8V#LzkB^$TIo=Wa1aTKY$rl(7;BM4rDfXB>Xy_%C!8u zwue`xI;l$C6Y6Kxz78Lgp6kU>mRY^d&C_wvu8v!mp4Wcw*zQ~(a{N9Qem5Co4Q#q@ zD4>U?x;g9>#}Bx#i1!O&Ssu6B_VB9m`Z{L1PG7sm-5h_WUkq8`#Gt5hoU_gbR(!4m z@>@@}O=S)I@!59TYVu@YgM_C2EDo>ATbOjCt?4hbidKO;y>E2PiG-Y-$eh&&HBKmw zTet=fY=WOd74*n+=G^7@0oBufmhXDiw0d^jo$1-Q-GJiuNVT6<%&3)?KKFa2Me5vz z%XP;p0AXn;pnXFQIy*Z%o$+|gcxh~`z_g#`liQ}ltIF#e1gh6^@XEF1qtg2Njzx=i zfErQp0t-=996vU3hd!88(LnXIpRv<%#@cNd__5=md!;J9iM!aU0KfxV{CYnplYq{r zO?Y5~R89Mtl`7GuVV5-w{NWUz-}}2dX>)xW$L7S<5lkm4kqW;&wwlhUpn7%%^mshZ z182~Dc(Cyt(|#V=u=(Dw+ARlITB<&42fkxGbXw7Cy0}00_hz<_Pv6~smtkJ^aau99 zdf=#_zu09z>GOWqVhYi=CwG{Z}=ec@? zADj55?a45&6Aj*O>7+nT@?H1Jo($!R84c3qy9QLykMd$b`zBV9j$&Mg2K=9syB0cH zwKbl4=v%K=!RKbWVU!)Mgv*t?1pZkd^d~|7(mq~0wv*1N*a&+4*_W%sA4(tS6VJl$ zOueBVz%1?6T)tllgM7-@y)aK_+j`$(^(J1U3OrV!y;4BSsr(t2 z;O*&Le9`0|j?_*ZQu81n7|Gp(NYY_1Ny0j(DxgtIqeUxe0vdwYAgy}d1!cIH_u zm1XR*L*5Sn0M+w-)Am0Ci^*uHU#tG-R^)5Rga&zFnGhYx%U zLRG}$G^9$Z=BQaXYX!8H<1s7V*9`>#U=zaGbwPiJ#@Nsu zN%)#@J3Ao_09f~Mj%hKL>(0N_S@+ho8)aWedUcN?7Nxlx0I-hXd>R?fl9jdZ{+Kk} zxcgq)5tXzUm>O;G001m;I7=|^M=UCtC--?C)qRbmg^i543H6h+24tA8Je%NYvervU&h<&qSQJq_k`%4~W&%TCV8oDayU9*k+pY-BR8 z_ka#%0DviSNJ9CIiJJwi%3L}&Ckr?@Qboty&^jipZ_L94D!sUjTp_B#0+-X)OInpJbJf yv`)_^59vp&p0R{lj)4fZfwJUM}0000= 0) - }; - - Overlays.editOverlay(redirectOopsText, redirectProperties); - Overlays.editOverlay(tryAgainImage, redirectProperties); - Overlays.editOverlay(backImage, redirectProperties); - if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); endAudio(); @@ -468,9 +457,6 @@ Overlays.deleteOverlay(loadingBarPlacard); Overlays.deleteOverlay(loadingBarProgress); Overlays.deleteOverlay(anchorOverlay); - Overlays.deleteOverlay(redirectOopsText); - Overlays.deleteOverlay(tryAgainImage); - Overlays.deleteOverlay(backImage); if (DEBUG) { tablet.removeButton(button); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index b0caba7c52..5d37078a26 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -33,7 +33,7 @@ text: getOopsText(), textAlpha: 1, backgroundAlpha: 0, - lineHeight: 0.13, + lineHeight: 0.10, visible: false, emissive: true, ignoreRayIntersection: false, @@ -43,11 +43,10 @@ parentID: MyAvatar.SELF_ID, parentJointIndex: MyAvatar.getJointIndex("Head") }); - print("redirect oops text = " + redirectOopsText); var tryAgainImage = Overlays.addOverlay("image3d", { name: "tryAgainImage", - localPosition: { x: -0.15, y: -0.4, z: 0.0}, + localPosition: {x: -0.15, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", alpha: 1, visible: false, @@ -58,12 +57,10 @@ orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, parentID: redirectOopsText }); - print("try again image = " + tryAgainImage); - Window.copyToClipboard(redirectOopsText); var backImage = Overlays.addOverlay("image3d", { name: "backImage", - localPosition: { x: 1.0, y: -0.4, z: 0.0}, + localPosition: {x: 1.0, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_back.png", alpha: 1, visible: false, @@ -74,7 +71,6 @@ orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, parentID: redirectOopsText }); - print("back image = " + backImage); var TARGET_UPDATE_HZ = 60; var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; @@ -84,7 +80,7 @@ error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); var oopsText = ""; - if (error === -1) { + if (error === -1 || !Window.isPhysicsEnabled() || location.isConnected) { overlaysVisible = false; } else if (errorMessageMapIndex >= 0) { overlaysVisible = true; @@ -96,6 +92,7 @@ var properties = { visible: overlaysVisible }; + var oopsTextProperties = { visible: overlaysVisible, text: oopsText @@ -121,6 +118,7 @@ } function cleanup() { + Script.clearInterval(timer); timer = null; Overlays.deleteOverlay(redirectOopsText); Overlays.deleteOverlay(tryAgainImage); @@ -142,8 +140,8 @@ } }); - // timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); - Script.update.connect(toggleOverlays); + timer = Script.setInterval(toggleOverlays, 500); + // Script.update.connect(toggleOverlays); Script.scriptEnding.connect(cleanup); }()); From be87773b2c9d5e0bcd6cad9cb895217502381219 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 26 Sep 2018 10:46:19 -0700 Subject: [PATCH 028/157] Checkpoint sysTray Installer --- cmake/macros/SetPackagingParameters.cmake | 10 +- cmake/templates/CPackProperties.cmake.in | 2 +- cmake/templates/NSIS.template.in | 173 +++++++++++----------- server-console/CMakeLists.txt | 4 +- server-console/src/main.js | 76 +++++----- server-console/src/modules/hf-app.js | 2 +- 6 files changed, 127 insertions(+), 140 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 0f8975e9b5..164d326b20 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -18,7 +18,7 @@ macro(SET_PACKAGING_PARAMETERS) set(BUILD_GLOBAL_SERVICES "DEVELOPMENT") set(USE_STABLE_GLOBAL_SERVICES 0) set(BUILD_NUMBER 0) - set(APP_USER_MODEL_ID "com.highfidelity.sandbox-dev") + set(APP_USER_MODEL_ID "com.highfidelity.console") set_from_env(RELEASE_TYPE RELEASE_TYPE "DEV") set_from_env(RELEASE_NUMBER RELEASE_NUMBER "") @@ -176,15 +176,15 @@ macro(SET_PACKAGING_PARAMETERS) # shortcut names if (PRODUCTION_BUILD) set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface") - set(CONSOLE_SHORTCUT_NAME "Sandbox") - set(APP_USER_MODEL_ID "com.highfidelity.sandbox") + set(CONSOLE_SHORTCUT_NAME "High Fidelity Console") + set(APP_USER_MODEL_ID "com.highfidelity.console") else () set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface - ${BUILD_VERSION_NO_SHA}") - set(CONSOLE_SHORTCUT_NAME "Sandbox - ${BUILD_VERSION_NO_SHA}") + set(CONSOLE_SHORTCUT_NAME "High Fidelity Console - ${BUILD_VERSION_NO_SHA}") endif () set(INTERFACE_HF_SHORTCUT_NAME "${INTERFACE_SHORTCUT_NAME}") - set(CONSOLE_HF_SHORTCUT_NAME "High Fidelity ${CONSOLE_SHORTCUT_NAME}") + set(CONSOLE_HF_SHORTCUT_NAME "${CONSOLE_SHORTCUT_NAME}") set(PRE_SANDBOX_INTERFACE_SHORTCUT_NAME "High Fidelity") set(PRE_SANDBOX_CONSOLE_SHORTCUT_NAME "Server Console") diff --git a/cmake/templates/CPackProperties.cmake.in b/cmake/templates/CPackProperties.cmake.in index 1d7effd18f..0a56181138 100644 --- a/cmake/templates/CPackProperties.cmake.in +++ b/cmake/templates/CPackProperties.cmake.in @@ -13,7 +13,7 @@ set(INTERFACE_DISPLAY_NAME "Interface") set(INTERFACE_SHORTCUT_NAME "@INTERFACE_SHORTCUT_NAME@") set(INTERFACE_HF_SHORTCUT_NAME "@INTERFACE_HF_SHORTCUT_NAME@") set(INTERFACE_WIN_EXEC_NAME "@INTERFACE_EXEC_PREFIX@.exe") -set(CONSOLE_DISPLAY_NAME "Sandbox") +set(CONSOLE_DISPLAY_NAME "Console") set(CONSOLE_INSTALL_SUBDIR "@CONSOLE_INSTALL_DIR@") set(CONSOLE_SHORTCUT_NAME "@CONSOLE_SHORTCUT_NAME@") set(CONSOLE_HF_SHORTCUT_NAME "@CONSOLE_HF_SHORTCUT_NAME@") diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 7f6884f478..b7564f45e5 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -405,6 +405,14 @@ Var GAClientID Section "-Previous Install Cleanup" ; Remove the resources folder so we don't end up including removed QML files RMDir /r "$INSTDIR\resources" + + ; delete old assignment-client and domain-server so they're no longer present + ; in client only installs. + Delete "$INSTDIR\@DS_EXEC_NAME@" + Delete "$INSTDIR\@AC_EXEC_NAME@" + + ; delete interface so it's not there for server-only installs + Delete "$INSTDIR\@INTERFACE_WIN_EXEC_NAME@" SectionEnd @CPACK_NSIS_INSTALLATION_TYPES@ @@ -532,9 +540,9 @@ SectionEnd Var PostInstallDialog Var DesktopClientCheckbox -Var DesktopServerCheckbox -Var ServerStartupCheckbox -Var LaunchServerNowCheckbox +Var DesktopConsoleCheckbox +Var ConsoleStartupCheckbox +Var LaunchConsoleNowCheckbox Var LaunchClientNowCheckbox Var CleanInstallCheckbox Var CurrentOffset @@ -746,28 +754,8 @@ Function PostInstallOptionsPage !insertmacro SetInstallOption $DesktopClientCheckbox @CLIENT_DESKTOP_SHORTCUT_REG_KEY@ ${BST_CHECKED} ${EndIf} - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @CONSOLE_HF_SHORTCUT_NAME@" - Pop $DesktopServerCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $DesktopServerCheckbox @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ ${BST_UNCHECKED} - ${EndIf} - - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ after install" - Pop $LaunchServerNowCheckbox - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $LaunchServerNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} - ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE - ${IfNot} $substringResult == "" - ${NSD_SetState} $LaunchServerNowCheckbox ${BST_UNCHECKED} - ${EndIf} - - IntOp $CurrentOffset $CurrentOffset + 15 - ${EndIf} + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $DesktopConsoleCheckbox @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ ${BST_UNCHECKED} ${If} @CLIENT_COMPONENT_CONDITIONAL@ ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @INTERFACE_HF_SHORTCUT_NAME@ after install" @@ -782,28 +770,42 @@ Function PostInstallOptionsPage ${EndIf} ${EndIf} - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ on startup" - Pop $ServerStartupCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @CONSOLE_HF_SHORTCUT_NAME@" + Pop $DesktopConsoleCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $ServerStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ after install" + Pop $LaunchConsoleNowCheckbox + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} + ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE + ${IfNot} $substringResult == "" + ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} ${EndIf} + IntOp $CurrentOffset $CurrentOffset + 15 + + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ on startup" + Pop $ConsoleStartupCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Perform a clean install (Delete older settings and content)" Pop $CleanInstallCheckbox IntOp $CurrentOffset $CurrentOffset + 15 ${If} @PR_BUILD@ == 1 - ; a PR build defaults all install options expect LaunchServerNowCheckbox, LaunchClientNowCheckbox and the settings copy to unchecked + ; a PR build defaults all install options expect LaunchConsoleNowCheckbox, LaunchClientNowCheckbox and the settings copy to unchecked ${If} @CLIENT_COMPONENT_CONDITIONAL@ ${NSD_SetState} $DesktopClientCheckbox ${BST_UNCHECKED} ${EndIf} ${If} @SERVER_COMPONENT_CONDITIONAL@ - ${NSD_SetState} $DesktopServerCheckbox ${BST_UNCHECKED} - ${NSD_SetState} $ServerStartupCheckbox ${BST_UNCHECKED} + ${NSD_SetState} $DesktopConsoleCheckbox ${BST_UNCHECKED} + ${NSD_SetState} $ConsoleStartupCheckbox ${BST_UNCHECKED} ${EndIf} ; push the offset @@ -824,9 +826,9 @@ FunctionEnd !macroend Var DesktopClientState -Var DesktopServerState -Var ServerStartupState -Var LaunchServerNowState +Var DesktopConsoleState +Var ConsoleStartupState +Var LaunchConsoleNowState Var LaunchClientNowState Var CopyFromProductionState Var CleanInstallState @@ -842,11 +844,11 @@ Function ReadInstallTypes StrCpy $Express "1" StrCpy $DesktopClientState ${BST_CHECKED} - StrCpy $ServerStartupState ${BST_CHECKED} - StrCpy $LaunchServerNowState ${BST_CHECKED} + StrCpy $ConsoleStartupState ${BST_CHECKED} + StrCpy $LaunchConsoleNowState ${BST_CHECKED} StrCpy $LaunchClientNowState ${BST_CHECKED} StrCpy $CleanInstallState ${BST_UNCHECKED} - StrCpy $DesktopServerState ${BST_UNCHECKED} + StrCpy $DesktopConsoleState ${BST_UNCHECKED} ${If} @PR_BUILD@ == 1 StrCpy $CopyFromProductionState ${BST_UNCHECKED} @@ -860,28 +862,25 @@ Function ReadInstallTypes FunctionEnd Function ReadPostInstallOptions + + ; check if the user asked for a desktop shortcut to console + ${NSD_GetState} $DesktopConsoleCheckbox $DesktopConsoleState + + ; check if the user asked to have console launched every startup + ${NSD_GetState} $ConsoleStartupCheckbox $ConsoleStartupState + ${If} @CLIENT_COMPONENT_CONDITIONAL@ ; check if the user asked for a desktop shortcut to High Fidelity ${NSD_GetState} $DesktopClientCheckbox $DesktopClientState ${EndIf} - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ; check if the user asked for a desktop shortcut to Sandbox - ${NSD_GetState} $DesktopServerCheckbox $DesktopServerState - - ; check if the user asked to have Sandbox launched every startup - ${NSD_GetState} $ServerStartupCheckbox $ServerStartupState - ${EndIf} - ${If} @PR_BUILD@ == 1 ; check if we need to copy settings/content from production for this PR build ${NSD_GetState} $CopyFromProductionCheckbox $CopyFromProductionState ${EndIf} - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ; check if we need to launch the server post-install - ${NSD_GetState} $LaunchServerNowCheckbox $LaunchServerNowState - ${EndIf} + ; check if we need to launch the console post-install + ${NSD_GetState} $LaunchConsoleNowCheckbox $LaunchConsoleNowState ${If} @CLIENT_COMPONENT_CONDITIONAL@ ; check if we need to launch the client post-install @@ -893,6 +892,17 @@ Function ReadPostInstallOptions FunctionEnd Function HandlePostInstallOptions + + ; check if the user asked for a desktop shortcut to the console + ${If} $DesktopConsoleState == ${BST_CHECKED} + CreateShortCut "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" + !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES + ; Set appUserModelId + ApplicationID::Set "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${Else} + !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ NO + ${EndIf} + ${If} @CLIENT_COMPONENT_CONDITIONAL@ ; check if the user asked for a desktop shortcut to High Fidelity ${If} $DesktopClientState == ${BST_CHECKED} @@ -901,38 +911,24 @@ Function HandlePostInstallOptions ${Else} !insertmacro WriteInstallOption @CLIENT_DESKTOP_SHORTCUT_REG_KEY@ NO ${EndIf} - ${EndIf} - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ; check if the user asked for a desktop shortcut to Sandbox - ${If} $DesktopServerState == ${BST_CHECKED} - CreateShortCut "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" - !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES - ; Set appUserModelId - ApplicationID::Set "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" - ${Else} - !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ NO - ${EndIf} + ; check if the user asked to have Console launched every startup + ${If} $ConsoleStartupState == ${BST_CHECKED} + ; in case we added a shortcut in the global context, pull that now + SetShellVarContext all + Delete "$SMSTARTUP\@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@.lnk" + ; make a startup shortcut in this user's current context + SetShellVarContext current + CreateShortCut "$SMSTARTUP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" - ; check if the user asked to have Sandbox launched every startup - ${If} $ServerStartupState == ${BST_CHECKED} - ; in case we added a shortcut in the global context, pull that now - SetShellVarContext all - Delete "$SMSTARTUP\@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@.lnk" + ; reset the shell var context back + SetShellVarContext all - ; make a startup shortcut in this user's current context - SetShellVarContext current - CreateShortCut "$SMSTARTUP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" - - ; reset the shell var context back - SetShellVarContext all - - !insertmacro WriteInstallOption @CONSOLE_STARTUP_REG_KEY@ YES - ${Else} - !insertmacro WriteInstallOption @CONSOLE_STARTUP_REG_KEY@ NO - ${EndIf} + !insertmacro WriteInstallOption @CONSOLE_STARTUP_REG_KEY@ YES + ${Else} + !insertmacro WriteInstallOption @CONSOLE_STARTUP_REG_KEY@ NO ${EndIf} ; check if the user asked for a clean install @@ -982,16 +978,15 @@ Function HandlePostInstallOptions ${EndIf} ${EndIf} - ${If} @SERVER_COMPONENT_CONDITIONAL@ - ${AndIf} $LaunchServerNowState == ${BST_CHECKED} + ${If} $LaunchConsoleNowState == ${BST_CHECKED} !insertmacro WriteInstallOption @SERVER_LAUNCH_NOW_REG_KEY@ YES ; both launches use the explorer trick in case the user has elevated permissions for the installer ${If} $LaunchClientNowState == ${BST_CHECKED} !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ YES ; create shortcut with ARGUMENTS - CreateShortCut "$TEMP\SandboxShortcut.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" "-- --launchInterface" - Exec '"$WINDIR\explorer.exe" "$TEMP\SandboxShortcut.lnk"' + CreateShortCut "$TEMP\ConsoleShortcut.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" "-- --launchInterface" + Exec '"$WINDIR\explorer.exe" "$TEMP\ConsoleShortcut.lnk"' ${Else} !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ NO Exec '"$WINDIR\explorer.exe" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@"' @@ -1164,13 +1159,11 @@ Section "-Core installation" ${EndIf} - ; Conditional handling for server console shortcut - ${If} @SERVER_COMPONENT_CONDITIONAL@ - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" \ - "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" - ; Set appUserModelId - ApplicationID::Set "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" - ${EndIf} + ; handling for server console shortcut + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" \ + "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" + ; Set appUserModelId + ApplicationID::Set "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\@UNINSTALLER_NAME@" diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 1c6e40c582..bdcefda5d8 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -19,7 +19,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Server Console") set_target_properties(${TARGET_NAME}-npm-install PROPERTIES FOLDER "hidden/Server Console") # add a dependency from the package target to the server components -add_dependencies(${TARGET_NAME} assignment-client domain-server) +add_dependencies(${TARGET_NAME} assignment-client domain-server interface) # set the packaged console folder depending on platform, so we can copy it if (APPLE) @@ -36,6 +36,7 @@ if (APPLE) PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} + COMPONENT ${CLIENT_COMPONENT} ) elseif (WIN32) set(CONSOLE_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}") @@ -44,6 +45,7 @@ elseif (WIN32) DIRECTORY "${CONSOLE_DESTINATION}/" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} + COMPONENT ${CLIENT_COMPONENT} ) # sign the copied server console executable after install diff --git a/server-console/src/main.js b/server-console/src/main.js index 95b5935255..08692fbd50 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -104,12 +104,12 @@ userConfig.load(configPath); const ipcMain = electron.ipcMain; -function isServerInstalled() { - return interfacePath && userConfig.get("serverInstalled", true); +function isInterfaceInstalled() { + return interfacePath; } -function isInterfaceInstalled() { - return dsPath && acPath && userConfig.get("interfaceInstalled", true); +function isServerInstalled() { + return dsPath && acPath; } var isShuttingDown = false; @@ -263,6 +263,10 @@ interfacePath = pathFinder.discoveredPath("Interface", binaryType, buildInfo.rel dsPath = pathFinder.discoveredPath("domain-server", binaryType, buildInfo.releaseType); acPath = pathFinder.discoveredPath("assignment-client", binaryType, buildInfo.releaseType); +console.log("Domain Server Path: " + dsPath); +console.log("Assignment Client Path: " + acPath); +console.log("Interface Path: " + interfacePath); + function binaryMissingMessage(displayName, executableName, required) { var message = "The " + displayName + " executable was not found.\n"; @@ -286,18 +290,6 @@ function binaryMissingMessage(displayName, executableName, required) { return message; } -// if at this point any of the paths are null, we're missing something we wanted to find - -if (!dsPath) { - dialog.showErrorBox("Domain Server Not Found", binaryMissingMessage("domain-server", "domain-server", true)); - app.exit(0); -} - -if (!acPath) { - dialog.showErrorBox("Assignment Client Not Found", binaryMissingMessage("assignment-client", "assignment-client", true)); - app.exit(0); -} - function openFileBrowser(path) { // Add quotes around path path = '"' + path + '"'; @@ -815,33 +807,33 @@ function onContentLoaded() { // Disable splash window for now. // maybeShowSplash(); - if (buildInfo.releaseType == 'PRODUCTION' && !argv.noUpdater) { - - const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30; - var hasShownUpdateNotification = false; - const updateChecker = new updater.UpdateChecker(buildInfo, CHECK_FOR_UPDATES_INTERVAL_SECONDS); - updateChecker.on('update-available', function(latestVersion, url) { - if (!hasShownUpdateNotification) { - notifier.notify({ - icon: notificationIcon, - title: 'An update is available!', - message: 'High Fidelity version ' + latestVersion + ' is available', - wait: true, - appID: buildInfo.appUserModelId, - url: url - }); - hasShownUpdateNotification = true; - } - }); - notifier.on('click', function(notifierObject, options) { - log.debug("Got click", options.url); - shell.openExternal(options.url); - }); - } - - deleteOldFiles(logPath, DELETE_LOG_FILES_OLDER_THAN_X_SECONDS, LOG_FILE_REGEX); - if (isServerInstalled()) { + if (buildInfo.releaseType == 'PRODUCTION' && !argv.noUpdater) { + + const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30; + var hasShownUpdateNotification = false; + const updateChecker = new updater.UpdateChecker(buildInfo, CHECK_FOR_UPDATES_INTERVAL_SECONDS); + updateChecker.on('update-available', function(latestVersion, url) { + if (!hasShownUpdateNotification) { + notifier.notify({ + icon: notificationIcon, + title: 'An update is available!', + message: 'High Fidelity version ' + latestVersion + ' is available', + wait: true, + appID: buildInfo.appUserModelId, + url: url + }); + hasShownUpdateNotification = true; + } + }); + notifier.on('click', function(notifierObject, options) { + log.debug("Got click", options.url); + shell.openExternal(options.url); + }); + } + + deleteOldFiles(logPath, DELETE_LOG_FILES_OLDER_THAN_X_SECONDS, LOG_FILE_REGEX); + var dsArguments = ['--get-temp-name', '--parent-pid', process.pid]; domainServer = new Process('domain-server', dsPath, dsArguments, logPath); diff --git a/server-console/src/modules/hf-app.js b/server-console/src/modules/hf-app.js index 625715b392..1b1171baef 100644 --- a/server-console/src/modules/hf-app.js +++ b/server-console/src/modules/hf-app.js @@ -34,7 +34,7 @@ exports.getBuildInfo = function() { buildNumber: "0", stableBuild: "0", organization: "High Fidelity - dev", - appUserModelId: "com.highfidelity.sandbox-dev" + appUserModelId: "com.highfidelity.console" }; var buildInfo = DEFAULT_BUILD_INFO; From 7e138ebfff00edee42a2f3f4868bc3769ed62a9d Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 26 Sep 2018 10:52:45 -0700 Subject: [PATCH 029/157] update to new enabling method --- interface/src/Application.cpp | 15 ++++++++++----- interface/src/octree/SafeLanding.cpp | 3 +-- scripts/defaultScripts.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e0d2ab2586..e6a3ca30f3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6240,14 +6240,19 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { const bool isModifiedQuery = !_physicsEnabled; if (isModifiedQuery) { // Create modified view that is a simple sphere. + bool interstitialModeEnabled = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); ConicalViewFrustum sphericalView; - ConicalViewFrustum farView; - - farView.set(_viewFrustum); - sphericalView.setSimpleRadius(INITIAL_QUERY_RADIUS); - _octreeQuery.setConicalViews({ sphericalView, farView }); + + if (interstitialModeEnabled) { + ConicalViewFrustum farView; + farView.set(_viewFrustum); + _octreeQuery.setConicalViews({ sphericalView, farView }); + } else { + _octreeQuery.setConicalViews({ sphericalView }); + } + _octreeQuery.setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE); static constexpr float MIN_LOD_ADJUST = -20.0f; _octreeQuery.setBoundaryLevelAdjust(MIN_LOD_ADJUST); diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ba6e1dac8a..5c11c3251f 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -181,8 +181,7 @@ bool SafeLanding::isEntityLoadingComplete() { auto entityTree = qApp->getEntities(); auto entityMapIter = _trackedEntities.begin(); - Settings settings; - bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); while (entityMapIter != _trackedEntities.end()) { auto entity = entityMapIter->second; diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index aaf5ca7260..3f015930f4 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -38,7 +38,7 @@ var DEFAULT_SCRIPTS_SEPARATE = [ //"system/chat.js" ]; -if (Settings.getValue("enableInterstitialMode", false)) { +if (Window.interstitialModeEnabled) { DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); } From 2c6e9349ebd87c775fd58e63582015ab3bbbe595 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 26 Sep 2018 12:59:15 -0700 Subject: [PATCH 030/157] SysTray Setup. server-console.exe should be included in client-only installs. By default, on new install, tray notifier should be enabled. --- server-console/CMakeLists.txt | 12 ++++++++++-- server-console/src/main.js | 16 +++++++--------- server-console/src/modules/hf-notifications.js | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index bdcefda5d8..16189dff9d 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -36,7 +36,11 @@ if (APPLE) PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} - COMPONENT ${CLIENT_COMPONENT} + ) + install( + PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + DESTINATION ${CONSOLE_INSTALL_DIR} + COMPONENT ${CLIENT_COMPONENT} ) elseif (WIN32) set(CONSOLE_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}") @@ -45,7 +49,11 @@ elseif (WIN32) DIRECTORY "${CONSOLE_DESTINATION}/" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} - COMPONENT ${CLIENT_COMPONENT} + ) + install( + DIRECTORY "${CONSOLE_DESTINATION}/" + DESTINATION ${CONSOLE_INSTALL_DIR} + COMPONENT ${CLIENT_COMPONENT} ) # sign the copied server console executable after install diff --git a/server-console/src/main.js b/server-console/src/main.js index 08692fbd50..cfde72e3bc 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -509,11 +509,13 @@ function buildMenuArray(serverState) { menuArray.push(labels.share); menuArray.push(separator); if (isInterfaceInstalled()) { - menuArray.push(labels.goto); - menuArray.push(labels.people); - menuArray.push(labels.wallet); - menuArray.push(labels.marketplace); - menuArray.push(separator); + if(trayNotifications.enabled()) { + menuArray.push(labels.goto); + menuArray.push(labels.people); + menuArray.push(labels.wallet); + menuArray.push(labels.marketplace); + menuArray.push(separator); + } menuArray.push(labels.showNotifications); menuArray.push(separator); } @@ -545,10 +547,6 @@ function updateLabels(serverState) { } labels.showNotifications.checked = trayNotifications.enabled(); - labels.people.visible = trayNotifications.enabled(); - labels.goto.visible = trayNotifications.enabled(); - labels.wallet.visible = trayNotifications.enabled(); - labels.marketplace.visible = trayNotifications.enabled(); labels.goto.icon = pendingNotifications[HifiNotificationType.GOTO] ? menuNotificationIcon : null; labels.people.icon = pendingNotifications[HifiNotificationType.PEOPLE] ? menuNotificationIcon : null; labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null; diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index a9ee2489a9..a95a553631 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -139,7 +139,7 @@ function HifiNotifications(config, menuNotificationCallback) { HifiNotifications.prototype = { enable: function (enabled) { - this.config.set("enableTrayNotifications", enabled); + this.config.set("disableTrayNotifications", !enabled); if (enabled) { var _this = this; this.storiesPollTimer = setInterval(function () { @@ -185,7 +185,7 @@ HifiNotifications.prototype = { } }, enabled: function () { - return this.config.get("enableTrayNotifications", true); + return !this.config.get("disableTrayNotifications", false); }, stopPolling: function () { this.config.set("storiesNotifySince", this.storiesSince.toISOString()); From 5949679c0a25769267e70bc01bf5b58b5e77514b Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 26 Sep 2018 13:00:37 -0700 Subject: [PATCH 031/157] Add mac interface-run detection to server-console --- server-console/src/modules/hf-process.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server-console/src/modules/hf-process.js b/server-console/src/modules/hf-process.js index cf94ec6b29..35da07af9c 100644 --- a/server-console/src/modules/hf-process.js +++ b/server-console/src/modules/hf-process.js @@ -275,6 +275,9 @@ Process.prototype = extend(Process.prototype, { }); } else if (os.type == 'Darwin') { console.log("TODO IsRunning Darwin"); + childProcess.exec('ps cax | grep interface', function (err, stdout, stderr) { + done(stdout.length > 0); + }); } }, From db41a1c16b22f42ae9f827f58ded23f5ed7e64e0 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 13:48:15 -0700 Subject: [PATCH 032/157] error state signal for 404/interstitial --- interface/src/octree/SafeLanding.cpp | 2 +- .../scripting/WindowScriptingInterface.cpp | 1 + .../src/scripting/WindowScriptingInterface.h | 8 +++ libraries/networking/src/DomainHandler.cpp | 2 + libraries/networking/src/DomainHandler.h | 3 +- scripts/defaultScripts.js | 2 +- scripts/system/interstitialPage.js | 38 +++++++++++-- scripts/system/redirectOverlays.js | 55 +++++++++++-------- 8 files changed, 78 insertions(+), 33 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 5d4ebe9853..333d76be66 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -172,7 +172,7 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; Settings settings; - bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool(); + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index d4eb37e0aa..4ebfc6411a 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -39,6 +39,7 @@ WindowScriptingInterface::WindowScriptingInterface() { connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &WindowScriptingInterface::disconnectedFromDomain); connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused); + connect(&domainHandler, &DomainHandler::redirectErrorStateChanged, this, &WindowScriptingInterface::redirectErrorStateChanged); connect(qApp, &Application::svoImportRequested, [this](const QString& urlString) { static const QMetaMethod svoImportRequestedSignal = diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index ddd7159f23..f6a5a5ef74 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -611,6 +611,14 @@ signals: */ void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); + /**jsdoc + * Triggered when you try to visit a domain but are redirected into the error state. + * @function Window.redirectErrorStateChanged + * @param {boolean} isInErrorState - If true, the user has been redirected to the error URL. + * @returns {Signal} + */ + void redirectErrorStateChanged(bool isInErrorState); + /**jsdoc * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with * includeAnimated = false or {@link Window.takeSecondaryCameraSnapshot|takeSecondaryCameraSnapshot}. diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 043465d18e..3ff8f29cd0 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -123,6 +123,7 @@ void DomainHandler::hardReset() { softReset(); _isInErrorState = false; + emit redirectErrorStateChanged(_isInErrorState); qCDebug(networking) << "Hard reset in NodeList DomainHandler."; _pendingDomainID = QUuid(); @@ -362,6 +363,7 @@ void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, if (getInterstitialModeEnabled()) { _errorDomainURL = errorUrl; _isInErrorState = true; + emit redirectErrorStateChanged(_isInErrorState); emit redirectToErrorDomainURL(_errorDomainURL); } else { emit domainConnectionRefused(reasonMessage, reasonCode, extraInfo); diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index e9ec20ba2e..8cf84b602a 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -187,8 +187,6 @@ private slots: signals: void domainURLChanged(QUrl domainURL); - void domainConnectionErrorChanged(int reasonCode); - // NOTE: the emission of completedSocketDiscovery does not mean a connection to DS is established // It means that, either from DNS lookup or ICE, we think we have a socket we can talk to DS on void completedSocketDiscovery(); @@ -205,6 +203,7 @@ signals: void domainConnectionRefused(QString reasonMessage, int reason, const QString& extraInfo); void redirectToErrorDomainURL(QUrl errorDomainURL); + void redirectErrorStateChanged(bool isInErrorState); void limitOfSilentDomainCheckInsReached(); diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index e11891bb33..42341a8484 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -38,7 +38,7 @@ var DEFAULT_SCRIPTS_SEPARATE = [ //"system/chat.js" ]; -if (Settings.getValue("enableInterstitialMode", false)) { +if (Window.interstitialModeEnabled) { DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 49708c44fe..218aafea2b 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -37,6 +37,8 @@ var tablet = null; var button = null; + var errorConnectingToDomain = false; + // Tips have a character limit of 69 var userTips = [ "Tip: Visit TheSpot to explore featured domains!", @@ -188,6 +190,16 @@ var connectionToDomainFailed = false; + function getOopsText() { + var error = Window.getLastDomainConnectionError(); + var errorMessageMapIndex = hardRefusalErrors.indexOf(error); + if (errorMessageMapIndex >= 0) { + return ERROR_MESSAGE_MAP[errorMessageMapIndex]; + } else { + // some other text. + return ERROR_MESSAGE_MAP[4]; + } + } function getAnchorLocalYOffset() { var loadingSpherePosition = Overlays.getProperty(loadingSphereID, "position"); @@ -235,6 +247,13 @@ } } + function toggleInterstitialPage(isInErrorState) { + errorConnectingToDomain = isInErrorState; + if (!errorConnectingToDomain) { + domainChanged(location); + } + } + function startAudio() { sample = Audio.playSound(tune, { localOnly: true, @@ -347,9 +366,11 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); - if (!HMD.active) { - toolbar.writeProperty("visible", physicsEnabled); + if (errorConnectingToDomain) { + Menu.setIsOptionChecked("Show Overlays", physicsEnabled); + if (!HMD.active) { + toolbar.writeProperty("visible", physicsEnabled); + } } resetValues(); @@ -359,7 +380,6 @@ } } - function scaleInterstitialPage(sensorToWorldScale) { var yOffset = getAnchorLocalYOffset(); var localPosition = { @@ -399,14 +419,19 @@ Overlays.editOverlay(loadingBarProgress, properties); - if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { + if (errorConnectingToDomain) { + updateOverlays(errorConnectingToDomain); + endAudio(); + currentDomain = "no domain"; + timer = null; + return; + } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); endAudio(); currentDomain = "no domain"; timer = null; return; } - timer = Script.setTimeout(update, BASIC_TIMER_INTERVAL_MS); } var whiteColor = {red: 255, green: 255, blue: 255}; @@ -430,6 +455,7 @@ connectionToDomainFailed = !location.isConnected; }, 1200); }); + Window.redirectErrorStateChanged.connect(toggleInterstitialPage); MyAvatar.sensorToWorldScaleChanged.connect(scaleInterstitialPage); MyAvatar.sessionUUIDChanged.connect(function() { diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 5d37078a26..5264112476 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -13,11 +13,10 @@ var TIMEOUT = 5; var hardRefusalErrors = [PROTOCOL_VERSION_MISMATCH, NOT_AUTHORIZED, TIMEOUT]; - var error = -1; var timer = null; function getOopsText() { - error = Window.getLastDomainConnectionError(); + var error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); if (errorMessageMapIndex >= 0) { return ERROR_MESSAGE_MAP[errorMessageMapIndex]; @@ -29,58 +28,68 @@ var redirectOopsText = Overlays.addOverlay("text3d", { name: "oopsText", - localPosition: {x: 0.5691902160644531, y: 0.6403706073760986, z: 6.68358039855957}, + localPosition: {x: 0.2691902160644531, y: 0.6403706073760986, z: 3.18358039855957}, + localRotation: Quat.fromPitchYawRollDegrees(0.0, 180.0, 0.0), text: getOopsText(), textAlpha: 1, backgroundAlpha: 0, + color: {x: 255, y: 255, z: 255}, lineHeight: 0.10, + leftMargin: 0.538373570564886, visible: false, emissive: true, ignoreRayIntersection: false, - drawInFront: true, + dimensions: {x: 4.2, y: 1}, grabbable: false, - orientation: {x: 0.0, y: 0.5, z: 0.0, w: 0.87}, parentID: MyAvatar.SELF_ID, parentJointIndex: MyAvatar.getJointIndex("Head") }); var tryAgainImage = Overlays.addOverlay("image3d", { name: "tryAgainImage", - localPosition: {x: -0.15, y: -0.4, z: 0.0}, + localPosition: {x: -0.6, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", alpha: 1, visible: false, emissive: true, ignoreRayIntersection: false, - drawInFront: true, grabbable: false, - orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), parentID: redirectOopsText }); var backImage = Overlays.addOverlay("image3d", { name: "backImage", - localPosition: {x: 1.0, y: -0.4, z: 0.0}, + localPosition: {x: 0.6, y: -0.4, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_back.png", alpha: 1, visible: false, emissive: true, ignoreRayIntersection: false, - drawInFront: true, grabbable: false, - orientation: {x: 0.0, y: 0.5, z: 0, w: 0.87}, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), parentID: redirectOopsText }); var TARGET_UPDATE_HZ = 60; var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; - function toggleOverlays() { + function toggleOverlays(isInErrorState) { + if (!isInErrorState) { + var properties = { + visible: false + }; + + Overlays.editOverlay(redirectOopsText, properties); + Overlays.editOverlay(tryAgainImage, properties); + Overlays.editOverlay(backImage, properties); + return; + } var overlaysVisible = false; - error = Window.getLastDomainConnectionError(); + var error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); var oopsText = ""; - if (error === -1 || !Window.isPhysicsEnabled() || location.isConnected) { + if (error === -1) { overlaysVisible = false; } else if (errorMessageMapIndex >= 0) { overlaysVisible = true; @@ -93,28 +102,27 @@ visible: overlaysVisible }; + var textWidth = Overlays.textSize(redirectOopsText, oopsText).width; + var textOverlayWidth = Overlays.getProperty(redirectOopsText, "dimensions").x; + var oopsTextProperties = { visible: overlaysVisible, - text: oopsText + text: oopsText, + leftMargin: (textOverlayWidth - textWidth) / 2 }; Overlays.editOverlay(redirectOopsText, oopsTextProperties); Overlays.editOverlay(tryAgainImage, properties); Overlays.editOverlay(backImage, properties); + } function clickedOnOverlay(overlayID, event) { - var properties = { - visible: false - }; if (tryAgainImage === overlayID) { location.goToLastAddress(); } else if (backImage === overlayID) { location.goBack(); } - Overlays.editOverlay(redirectOopsText, properties); - Overlays.editOverlay(tryAgainImage, properties); - Overlays.editOverlay(backImage, properties); } function cleanup() { @@ -125,6 +133,8 @@ Overlays.deleteOverlay(backImage); } + toggleOverlays(true); + var whiteColor = {red: 255, green: 255, blue: 255}; var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); @@ -140,8 +150,7 @@ } }); - timer = Script.setInterval(toggleOverlays, 500); - // Script.update.connect(toggleOverlays); + Window.redirectErrorStateChanged.connect(toggleOverlays); Script.scriptEnding.connect(cleanup); }()); From b5a47b2e76c875e7bfbe2c1f36ce35579cd3b304 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 26 Sep 2018 14:11:22 -0700 Subject: [PATCH 033/157] Finalizing the renaming from Skinned to Deformed --- interface/src/Application.cpp | 2 +- libraries/graphics/src/graphics/Material.cpp | 12 --- .../render-utils/src/HighlightEffect.cpp | 32 ++++---- .../render-utils/src/MeshPartPayload.cpp | 10 +-- .../render-utils/src/RenderPipelines.cpp | 73 +++++++++---------- .../render-utils/src/RenderShadowTask.cpp | 26 +++---- libraries/render/src/render/ShapePipeline.h | 12 +-- 7 files changed, 77 insertions(+), 90 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9bdd4baa7f..3a34c87ef1 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -315,7 +315,7 @@ static QTimer pingTimer; static bool DISABLE_WATCHDOG = true; #else static const QString DISABLE_WATCHDOG_FLAG{ "HIFI_DISABLE_WATCHDOG" }; -static bool DISABLE_WATCHDOG = true || nsightActive() || QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); +static bool DISABLE_WATCHDOG = nsightActive() || QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); #endif #if defined(USE_GLES) diff --git a/libraries/graphics/src/graphics/Material.cpp b/libraries/graphics/src/graphics/Material.cpp index 5b5f597113..ccfae2a570 100755 --- a/libraries/graphics/src/graphics/Material.cpp +++ b/libraries/graphics/src/graphics/Material.cpp @@ -20,15 +20,11 @@ using namespace gpu; Material::Material() : _key(0), _schemaBuffer(), - // _texMapArrayBuffer(), _textureMaps() { // created from nothing: create the Buffer to store the properties Schema schema; _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); - -// TexMapArraySchema TexMapArraySchema; -// _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &TexMapArraySchema)); } Material::Material(const Material& material) : @@ -40,10 +36,6 @@ Material::Material(const Material& material) : Schema schema; _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); _schemaBuffer.edit() = material._schemaBuffer.get(); - - // TexMapArraySchema texMapArraySchema; - // _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &texMapArraySchema)); - // _texMapArrayBuffer.edit() = material._texMapArrayBuffer.get(); } Material& Material::operator= (const Material& material) { @@ -60,10 +52,6 @@ Material& Material::operator= (const Material& material) { _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); _schemaBuffer.edit() = material._schemaBuffer.get(); -// TexMapArraySchema texMapArraySchema; - // _texMapArrayBuffer = gpu::BufferView(std::make_shared(sizeof(TexMapArraySchema), (const gpu::Byte*) &texMapArraySchema)); - // _texMapArrayBuffer.edit() = material._texMapArrayBuffer.get(); - return (*this); } diff --git a/libraries/render-utils/src/HighlightEffect.cpp b/libraries/render-utils/src/HighlightEffect.cpp index 0ad48268a0..2e51013bc5 100644 --- a/libraries/render-utils/src/HighlightEffect.cpp +++ b/libraries/render-utils/src/HighlightEffect.cpp @@ -181,8 +181,8 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c args->_batch = &batch; auto maskPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); - auto maskSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); - auto maskSkinnedDQPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned().withDualQuatSkinned()); + auto maskDeformedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withDeformed()); + auto maskDeformedDQPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withDeformed().withDualQuatSkinned()); // Setup camera, projection and viewport for all items batch.setViewportTransform(args->_viewport); @@ -190,37 +190,37 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c batch.setProjectionJitter(jitter.x, jitter.y); batch.setViewTransform(viewMat); - std::vector skinnedShapeKeys; - std::vector skinnedDQShapeKeys; + std::vector deformedShapeKeys; + std::vector deformedDQShapeKeys; // Iterate through all inShapes and render the unskinned args->_shapePipeline = maskPipeline; batch.setPipeline(maskPipeline->pipeline); for (const auto& items : inShapes) { itemBounds.insert(itemBounds.end(), items.second.begin(), items.second.end()); - if (items.first.isSkinned() && items.first.isDualQuatSkinned()) { - skinnedDQShapeKeys.push_back(items.first); - } else if (items.first.isSkinned()) { - skinnedShapeKeys.push_back(items.first); + if (items.first.isDeformed() && items.first.isDualQuatSkinned()) { + deformedDQShapeKeys.push_back(items.first); + } else if (items.first.isDeformed()) { + deformedShapeKeys.push_back(items.first); } else { renderItems(renderContext, items.second); } } // Reiterate to render the skinned - if (skinnedShapeKeys.size() > 0) { - args->_shapePipeline = maskSkinnedPipeline; - batch.setPipeline(maskSkinnedPipeline->pipeline); - for (const auto& key : skinnedShapeKeys) { + if (deformedShapeKeys.size() > 0) { + args->_shapePipeline = maskDeformedPipeline; + batch.setPipeline(maskDeformedPipeline->pipeline); + for (const auto& key : deformedShapeKeys) { renderItems(renderContext, inShapes.at(key)); } } // Reiterate to render the DQ skinned - if (skinnedDQShapeKeys.size() > 0) { - args->_shapePipeline = maskSkinnedDQPipeline; - batch.setPipeline(maskSkinnedDQPipeline->pipeline); - for (const auto& key : skinnedDQShapeKeys) { + if (deformedDQShapeKeys.size() > 0) { + args->_shapePipeline = maskDeformedDQPipeline; + batch.setPipeline(maskDeformedDQPipeline->pipeline); + for (const auto& key : deformedDQShapeKeys) { renderItems(renderContext, inShapes.at(key)); } } diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 8fb6c5c978..a1220c04fa 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -352,10 +352,10 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe bool hasLightmap = drawMaterialKey.isLightmapMap(); bool isUnlit = drawMaterialKey.isUnlit(); - bool isSkinned = _isBlendShaped || _isSkinned; + bool isDeformed = _isBlendShaped || _isSkinned; if (isWireframe) { - isTranslucent = hasTangents = hasLightmap = isSkinned = false; + isTranslucent = hasTangents = hasLightmap = isDeformed = false; } ShapeKey::Builder builder; @@ -373,13 +373,13 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe if (isUnlit) { builder.withUnlit(); } - if (isSkinned) { - builder.withSkinned(); + if (isDeformed) { + builder.withDeformed(); } if (isWireframe) { builder.withWireframe(); } - if (isSkinned && useDualQuaternionSkinning) { + if (isDeformed && useDualQuaternionSkinning) { builder.withDualQuatSkinned(); } diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index a9be3fee5a..5551bbdfa8 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -146,60 +146,60 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip // matrix palette skinned addPipeline( - Key::Builder().withMaterial().withSkinned(), + Key::Builder().withMaterial().withDeformed(), deformed_model, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents(), + Key::Builder().withMaterial().withDeformed().withTangents(), deformed_model_normal_map, nullptr, nullptr); // Same thing but with Fade on addPipeline( - Key::Builder().withMaterial().withSkinned().withFade(), + Key::Builder().withMaterial().withDeformed().withFade(), deformed_model_fade, batchSetter, itemSetter); addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents().withFade(), + Key::Builder().withMaterial().withDeformed().withTangents().withFade(), deformed_model_normal_map_fade, batchSetter, itemSetter); // matrix palette skinned and translucent addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent(), + Key::Builder().withMaterial().withDeformed().withTranslucent(), deformed_model_translucent, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), + Key::Builder().withMaterial().withDeformed().withTranslucent().withTangents(), deformed_model_normal_map_translucent, nullptr, nullptr); // Same thing but with Fade on addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withFade(), + Key::Builder().withMaterial().withDeformed().withTranslucent().withFade(), deformed_model_translucent_fade, batchSetter, itemSetter); addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withFade(), + Key::Builder().withMaterial().withDeformed().withTranslucent().withTangents().withFade(), deformed_model_normal_map_translucent_fade, batchSetter, itemSetter); // dual quaternion skinned addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned(), deformed_model_dq, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTangents(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withTangents(), deformed_model_normal_map_dq, nullptr, nullptr); // Same thing but with Fade on addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withFade(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withFade(), deformed_model_fade_dq, batchSetter, itemSetter); addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTangents().withFade(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withTangents().withFade(), deformed_model_normal_map_fade_dq, batchSetter, itemSetter); // dual quaternion skinned and translucent addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withTranslucent(), deformed_model_translucent_dq, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withTangents(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withTranslucent().withTangents(), deformed_model_normal_map_translucent_dq, nullptr, nullptr); // Same thing but with Fade on addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withFade(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withTranslucent().withFade(), deformed_model_translucent_fade_dq, batchSetter, itemSetter); addPipeline( - Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withTangents().withFade(), + Key::Builder().withMaterial().withDeformed().withDualQuatSkinned().withTranslucent().withTangents().withFade(), deformed_model_normal_map_translucent_fade_dq, batchSetter, itemSetter); // Depth-only @@ -207,24 +207,24 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip Key::Builder().withDepthOnly(), model_shadow, nullptr, nullptr); addPipeline( - Key::Builder().withSkinned().withDepthOnly(), + Key::Builder().withDeformed().withDepthOnly(), deformed_model_shadow, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withDepthOnly().withFade(), model_shadow_fade, batchSetter, itemSetter); addPipeline( - Key::Builder().withSkinned().withDepthOnly().withFade(), + Key::Builder().withDeformed().withDepthOnly().withFade(), deformed_model_shadow_fade, batchSetter, itemSetter); // Now repeat for dual quaternion // Depth-only addPipeline( - Key::Builder().withSkinned().withDualQuatSkinned().withDepthOnly(), + Key::Builder().withDeformed().withDualQuatSkinned().withDepthOnly(), deformed_model_shadow_dq, nullptr, nullptr); // Same thing but with Fade on addPipeline( - Key::Builder().withSkinned().withDualQuatSkinned().withDepthOnly().withFade(), + Key::Builder().withDeformed().withDualQuatSkinned().withDepthOnly().withFade(), deformed_model_shadow_fade_dq, batchSetter, itemSetter); } @@ -256,21 +256,21 @@ void initForwardPipelines(ShapePlumber& plumber) { addPipeline(Key::Builder().withMaterial().withUnlit(), forward_model_unlit); addPipeline(Key::Builder().withMaterial().withTangents(), forward_model_translucent); - // Skinned Opaques - addPipeline(Key::Builder().withMaterial().withSkinned(), forward_deformed_model); - addPipeline(Key::Builder().withMaterial().withSkinned().withTangents(), forward_deformed_model_normal_map); - addPipeline(Key::Builder().withMaterial().withSkinned().withDualQuatSkinned(), forward_deformed_model_dq); - addPipeline(Key::Builder().withMaterial().withSkinned().withTangents().withDualQuatSkinned(), forward_deformed_model_normal_map_dq); + // Deformed Opaques + addPipeline(Key::Builder().withMaterial().withDeformed(), forward_deformed_model); + addPipeline(Key::Builder().withMaterial().withDeformed().withTangents(), forward_deformed_model_normal_map); + addPipeline(Key::Builder().withMaterial().withDeformed().withDualQuatSkinned(), forward_deformed_model_dq); + addPipeline(Key::Builder().withMaterial().withDeformed().withTangents().withDualQuatSkinned(), forward_deformed_model_normal_map_dq); // Translucents addPipeline(Key::Builder().withMaterial().withTranslucent(), forward_model_translucent); addPipeline(Key::Builder().withMaterial().withTranslucent().withTangents(), forward_model_normal_map_translucent); - // Skinned Translucents - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent(), forward_deformed_translucent); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), forward_deformed_translucent_normal_map); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withDualQuatSkinned(), forward_deformed_translucent_dq); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withDualQuatSkinned(), forward_deformed_translucent_normal_map_dq); + // Deformed Translucents + addPipeline(Key::Builder().withMaterial().withDeformed().withTranslucent(), forward_deformed_translucent); + addPipeline(Key::Builder().withMaterial().withDeformed().withTranslucent().withTangents(), forward_deformed_translucent_normal_map); + addPipeline(Key::Builder().withMaterial().withDeformed().withTranslucent().withDualQuatSkinned(), forward_deformed_translucent_dq); + addPipeline(Key::Builder().withMaterial().withDeformed().withTranslucent().withTangents().withDualQuatSkinned(), forward_deformed_translucent_normal_map_dq); forceLightBatchSetter = false; } @@ -366,32 +366,32 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { using namespace shader::render_utils::program; gpu::ShaderPointer modelProgram = gpu::Shader::createProgram(model_shadow); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withoutSkinned().withoutFade(), + ShapeKey::Filter::Builder().withoutDeformed().withoutFade(), modelProgram, state); gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(deformed_model_shadow); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withoutDualQuatSkinned().withoutFade(), + ShapeKey::Filter::Builder().withDeformed().withoutDualQuatSkinned().withoutFade(), skinProgram, state); gpu::ShaderPointer modelFadeProgram = gpu::Shader::createProgram(model_shadow_fade); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withoutSkinned().withFade(), + ShapeKey::Filter::Builder().withoutDeformed().withFade(), modelFadeProgram, state); gpu::ShaderPointer skinFadeProgram = gpu::Shader::createProgram(deformed_model_shadow_fade); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withoutDualQuatSkinned().withFade(), + ShapeKey::Filter::Builder().withDeformed().withoutDualQuatSkinned().withFade(), skinFadeProgram, state); gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(deformed_model_shadow_dq); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), + ShapeKey::Filter::Builder().withDeformed().withDualQuatSkinned().withoutFade(), skinModelShadowDualQuatProgram, state); gpu::ShaderPointer skinModelShadowFadeDualQuatProgram = gpu::Shader::createProgram(deformed_model_shadow_fade_dq); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), + ShapeKey::Filter::Builder().withDeformed().withDualQuatSkinned().withFade(), skinModelShadowFadeDualQuatProgram, state); } @@ -404,7 +404,6 @@ void RenderPipelines::bindMaterial(const graphics::MaterialPointer& material, gp auto textureCache = DependencyManager::get(); batch.setUniformBuffer(gr::Buffer::Material, material->getSchemaBuffer()); - // batch.setUniformBuffer(gr::Buffer::TexMapArray, material->getTexMapArrayBuffer()); const auto& materialKey = material->getKey(); const auto& textureMaps = material->getTextureMaps(); diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index 137ee07c96..7c24c08c27 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -249,22 +249,22 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con batch.setViewTransform(viewMat, false); auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); - auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); - auto shadowSkinnedDQPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned().withDualQuatSkinned()); + auto shadowDeformedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withDeformed()); + auto shadowDeformedDQPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withDeformed().withDualQuatSkinned()); - std::vector skinnedShapeKeys{}; - std::vector skinnedDQShapeKeys{}; + std::vector deformedShapeKeys{}; + std::vector deformedDQShapeKeys{}; std::vector ownPipelineShapeKeys{}; // Iterate through all inShapes and render the unskinned args->_shapePipeline = shadowPipeline; batch.setPipeline(shadowPipeline->pipeline); for (auto items : inShapes) { - if (items.first.isSkinned()) { + if (items.first.isDeformed()) { if (items.first.isDualQuatSkinned()) { - skinnedDQShapeKeys.push_back(items.first); + deformedDQShapeKeys.push_back(items.first); } else { - skinnedShapeKeys.push_back(items.first); + deformedShapeKeys.push_back(items.first); } } else if (!items.first.hasOwnPipeline()) { renderItems(renderContext, items.second); @@ -274,16 +274,16 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con } // Reiterate to render the skinned - args->_shapePipeline = shadowSkinnedPipeline; - batch.setPipeline(shadowSkinnedPipeline->pipeline); - for (const auto& key : skinnedShapeKeys) { + args->_shapePipeline = shadowDeformedPipeline; + batch.setPipeline(shadowDeformedPipeline->pipeline); + for (const auto& key : deformedShapeKeys) { renderItems(renderContext, inShapes.at(key)); } // Reiterate to render the DQ skinned - args->_shapePipeline = shadowSkinnedDQPipeline; - batch.setPipeline(shadowSkinnedDQPipeline->pipeline); - for (const auto& key : skinnedDQShapeKeys) { + args->_shapePipeline = shadowDeformedDQPipeline; + batch.setPipeline(shadowDeformedDQPipeline->pipeline); + for (const auto& key : deformedDQShapeKeys) { renderItems(renderContext, inShapes.at(key)); } diff --git a/libraries/render/src/render/ShapePipeline.h b/libraries/render/src/render/ShapePipeline.h index bac1076dd6..bd6ac6521a 100644 --- a/libraries/render/src/render/ShapePipeline.h +++ b/libraries/render/src/render/ShapePipeline.h @@ -30,7 +30,7 @@ public: LIGHTMAP, TANGENTS, UNLIT, - SKINNED, + DEFORMED, DUAL_QUAT_SKINNED, DEPTH_ONLY, DEPTH_BIAS, @@ -78,7 +78,7 @@ public: Builder& withLightmap() { _flags.set(LIGHTMAP); return (*this); } Builder& withTangents() { _flags.set(TANGENTS); return (*this); } Builder& withUnlit() { _flags.set(UNLIT); return (*this); } - Builder& withSkinned() { _flags.set(SKINNED); return (*this); } + Builder& withDeformed() { _flags.set(DEFORMED); return (*this); } Builder& withDualQuatSkinned() { _flags.set(DUAL_QUAT_SKINNED); return (*this); } Builder& withDepthOnly() { _flags.set(DEPTH_ONLY); return (*this); } Builder& withDepthBias() { _flags.set(DEPTH_BIAS); return (*this); } @@ -127,8 +127,8 @@ public: Builder& withUnlit() { _flags.set(UNLIT); _mask.set(UNLIT); return (*this); } Builder& withoutUnlit() { _flags.reset(UNLIT); _mask.set(UNLIT); return (*this); } - Builder& withSkinned() { _flags.set(SKINNED); _mask.set(SKINNED); return (*this); } - Builder& withoutSkinned() { _flags.reset(SKINNED); _mask.set(SKINNED); return (*this); } + Builder& withDeformed() { _flags.set(DEFORMED); _mask.set(DEFORMED); return (*this); } + Builder& withoutDeformed() { _flags.reset(DEFORMED); _mask.set(DEFORMED); return (*this); } Builder& withDualQuatSkinned() { _flags.set(DUAL_QUAT_SKINNED); _mask.set(DUAL_QUAT_SKINNED); return (*this); } Builder& withoutDualQuatSkinned() { _flags.reset(DUAL_QUAT_SKINNED); _mask.set(DUAL_QUAT_SKINNED); return (*this); } @@ -169,7 +169,7 @@ public: bool hasTangents() const { return _flags[TANGENTS]; } bool isUnlit() const { return _flags[UNLIT]; } bool isTranslucent() const { return _flags[TRANSLUCENT]; } - bool isSkinned() const { return _flags[SKINNED]; } + bool isDeformed() const { return _flags[DEFORMED]; } bool isDualQuatSkinned() const { return _flags[DUAL_QUAT_SKINNED]; } bool isDepthOnly() const { return _flags[DEPTH_ONLY]; } bool isDepthBiased() const { return _flags[DEPTH_BIAS]; } @@ -209,7 +209,7 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) { << "hasTangents:" << key.hasTangents() << "isUnlit:" << key.isUnlit() << "isTranslucent:" << key.isTranslucent() - << "isSkinned:" << key.isSkinned() + << "isDeformed:" << key.isDeformed() << "isDualQuatSkinned:" << key.isDualQuatSkinned() << "isDepthOnly:" << key.isDepthOnly() << "isDepthBiased:" << key.isDepthBiased() From 1e112d3c8414f5fd6a879c7cd9bf546e729fbd48 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 26 Sep 2018 14:15:42 -0700 Subject: [PATCH 034/157] bringing back a bug fix from samuel --- libraries/render-utils/src/Model.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 09831a5646..b04f1f4386 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1533,11 +1533,11 @@ void Model::setBlendedVertices(int blendNumber, const QVector& for (int i = 0; i < fbxGeometry.meshes.size(); i++) { const FBXMesh& mesh = fbxGeometry.meshes.at(i); auto meshBlendshapeOffsets = _blendshapeOffsets.find(i); - if (mesh.blendshapes.isEmpty() || meshBlendshapeOffsets == _blendshapeOffsets.end() || meshBlendshapeOffsets == _blendshapeOffsets.end()) { + const auto& buffer = _blendshapeBuffers.find(i); + if (mesh.blendshapes.isEmpty() || meshBlendshapeOffsets == _blendshapeOffsets.end() || buffer == _blendshapeBuffers.end()) { continue; } - const auto& buffer = _blendshapeBuffers.find(i); const auto blendshapeOffsetSize = meshBlendshapeOffsets->second.size() * sizeof(BlendshapeOffset); buffer->second->setData(blendshapeOffsetSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset)); From db77cbcbc1281b0026ed34c0a6eefd32c980684a Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 15:12:48 -0700 Subject: [PATCH 035/157] new location drop - unparent overlays --- interface/resources/serverless/redirect.json | 2 +- scripts/system/interstitialPage.js | 32 ++++++++++---------- scripts/system/redirectOverlays.js | 16 +++++----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/interface/resources/serverless/redirect.json b/interface/resources/serverless/redirect.json index b40b3867b3..0b96bad961 100644 --- a/interface/resources/serverless/redirect.json +++ b/interface/resources/serverless/redirect.json @@ -2,7 +2,7 @@ "DataVersion": 0, "Paths": { - "/": "/5.77,1.4,4.96/0,0.49544,0,0.868645" + "/": "/2.3,0.4,2.89/0,0.49544,0,0.868645" }, "Entities": [ { diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 218aafea2b..22ff6eb4b4 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -38,6 +38,7 @@ var button = null; var errorConnectingToDomain = false; + var resettingError = false; // Tips have a character limit of 69 var userTips = [ @@ -190,17 +191,6 @@ var connectionToDomainFailed = false; - function getOopsText() { - var error = Window.getLastDomainConnectionError(); - var errorMessageMapIndex = hardRefusalErrors.indexOf(error); - if (errorMessageMapIndex >= 0) { - return ERROR_MESSAGE_MAP[errorMessageMapIndex]; - } else { - // some other text. - return ERROR_MESSAGE_MAP[4]; - } - } - function getAnchorLocalYOffset() { var loadingSpherePosition = Overlays.getProperty(loadingSphereID, "position"); var loadingSphereOrientation = Overlays.getProperty(loadingSphereID, "rotation"); @@ -366,11 +356,10 @@ Overlays.editOverlay(loadingBarPlacard, properties); Overlays.editOverlay(loadingBarProgress, loadingBarProperties); - if (errorConnectingToDomain) { - Menu.setIsOptionChecked("Show Overlays", physicsEnabled); - if (!HMD.active) { - toolbar.writeProperty("visible", physicsEnabled); - } + Menu.setIsOptionChecked("Show Overlays", physicsEnabled); + if (!HMD.active) { + print("Show toolbar: " + physicsEnabled); + toolbar.writeProperty("visible", physicsEnabled); } resetValues(); @@ -391,6 +380,15 @@ Overlays.editOverlay(anchorOverlay, { localPosition: localPosition }); } + function sleep(milliseconds) { + var start = new Date().getTime(); + for (var i = 0; i < 1e7; i++) { + if ((new Date().getTime() - start) > milliseconds){ + break; + } + } + } + function update() { var physicsEnabled = Window.isPhysicsEnabled(); var thisInterval = Date.now(); @@ -424,6 +422,8 @@ endAudio(); currentDomain = "no domain"; timer = null; + sleep(300); + toolbar.writeProperty("visible", true); return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 5264112476..165e8ae27a 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -26,10 +26,12 @@ } }; + var oopsDimensions = {x: 4.2, y: 1}; + var redirectOopsText = Overlays.addOverlay("text3d", { name: "oopsText", - localPosition: {x: 0.2691902160644531, y: 0.6403706073760986, z: 3.18358039855957}, - localRotation: Quat.fromPitchYawRollDegrees(0.0, 180.0, 0.0), + position: {x: 0, y: 1.6763916015625, z: 1.45927095413208}, + rotation: {x: -4.57763671875e-05, y: 0.4957197904586792, z: -7.62939453125e-05, w: 0.8684672117233276}, text: getOopsText(), textAlpha: 1, backgroundAlpha: 0, @@ -39,15 +41,13 @@ visible: false, emissive: true, ignoreRayIntersection: false, - dimensions: {x: 4.2, y: 1}, + dimensions: oopsDimensions, grabbable: false, - parentID: MyAvatar.SELF_ID, - parentJointIndex: MyAvatar.getJointIndex("Head") }); var tryAgainImage = Overlays.addOverlay("image3d", { name: "tryAgainImage", - localPosition: {x: -0.6, y: -0.4, z: 0.0}, + localPosition: {x: -0.6, y: -0.6, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", alpha: 1, visible: false, @@ -60,7 +60,7 @@ var backImage = Overlays.addOverlay("image3d", { name: "backImage", - localPosition: {x: 0.6, y: -0.4, z: 0.0}, + localPosition: {x: 0.6, y: -0.6, z: 0.0}, url: Script.resourcesPath() + "images/interstitialPage/button_back.png", alpha: 1, visible: false, @@ -103,7 +103,7 @@ }; var textWidth = Overlays.textSize(redirectOopsText, oopsText).width; - var textOverlayWidth = Overlays.getProperty(redirectOopsText, "dimensions").x; + var textOverlayWidth = oopsDimensions.x; var oopsTextProperties = { visible: overlaysVisible, From afae4f3b9682e723380481e781f9f5c8dc04ec0d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 15:33:57 -0700 Subject: [PATCH 036/157] adding toolbar reappearing --- scripts/system/interstitialPage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 22ff6eb4b4..4b48ce66d4 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -422,8 +422,14 @@ endAudio(); currentDomain = "no domain"; timer = null; + // The toolbar doesn't become visible in time to match the speed of + // the signal handling of redirectErrorStateChanged in both this script + // and the redirectOverlays.js script. Use a sleep function to ensure + // the toolbar becomes visible again. sleep(300); - toolbar.writeProperty("visible", true); + if (!HMD.active) { + toolbar.writeProperty("visible", true); + } return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); From db772fc3fecd2b0c6df65a1a84c0546bb1dbd503 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 26 Sep 2018 15:39:45 -0700 Subject: [PATCH 037/157] Update console name for osx build --- cmake/macros/GenerateInstallers.cmake | 6 +++--- cmake/macros/InstallBesideConsole.cmake | 4 ++-- cmake/macros/SetPackagingParameters.cmake | 2 +- server-console/CMakeLists.txt | 2 +- server-console/package.json | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/macros/GenerateInstallers.cmake b/cmake/macros/GenerateInstallers.cmake index acafd9b6c7..64919172f7 100644 --- a/cmake/macros/GenerateInstallers.cmake +++ b/cmake/macros/GenerateInstallers.cmake @@ -20,9 +20,9 @@ macro(GENERATE_INSTALLERS) set(INSTALLER_TYPE "client_only") string(REGEX REPLACE "High Fidelity" "High Fidelity Interface" _DISPLAY_NAME ${BUILD_ORGANIZATION}) elseif (SERVER_ONLY) - set(_PACKAGE_NAME_EXTRA "-Sandbox") + set(_PACKAGE_NAME_EXTRA "-Console") set(INSTALLER_TYPE "server_only") - string(REGEX REPLACE "High Fidelity" "High Fidelity Sandbox" _DISPLAY_NAME ${BUILD_ORGANIZATION}) + string(REGEX REPLACE "High Fidelity" "High Fidelity Console" _DISPLAY_NAME ${BUILD_ORGANIZATION}) else () set(_DISPLAY_NAME ${BUILD_ORGANIZATION}) set(INSTALLER_TYPE "full") @@ -122,7 +122,7 @@ macro(GENERATE_INSTALLERS) endif () if (BUILD_SERVER) - cpack_add_component(${SERVER_COMPONENT} DISPLAY_NAME "High Fidelity Sandbox") + cpack_add_component(${SERVER_COMPONENT} DISPLAY_NAME "High Fidelity Console") endif () include(CPack) diff --git a/cmake/macros/InstallBesideConsole.cmake b/cmake/macros/InstallBesideConsole.cmake index 3c991acf86..e3186501f4 100644 --- a/cmake/macros/InstallBesideConsole.cmake +++ b/cmake/macros/InstallBesideConsole.cmake @@ -66,8 +66,8 @@ macro(install_beside_console) install(CODE " set(MACOSX_BUNDLE_EXECUTABLE_NAME domain-server) set(MACOSX_BUNDLE_GUI_IDENTIFIER com.highfidelity.server-components) - set(MACOSX_BUNDLE_BUNDLE_NAME Sandbox\\ Components) - configure_file(${HF_CMAKE_DIR}/templates/MacOSXBundleSandboxComponentsInfo.plist.in ${ESCAPED_BUNDLE_NAME}/Contents/Info.plist) + set(MACOSX_BUNDLE_BUNDLE_NAME Console\\ Components) + configure_file(${HF_CMAKE_DIR}/templates/MacOSXBundleConsoleComponentsInfo.plist.in ${ESCAPED_BUNDLE_NAME}/Contents/Info.plist) execute_process(COMMAND ${MACDEPLOYQT_COMMAND} ${ESCAPED_BUNDLE_NAME} -verbose=2 -executable=${ESCAPED_EXECUTABLE_NAME})" COMPONENT ${SERVER_COMPONENT} ) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 164d326b20..aaba3bc201 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -142,7 +142,7 @@ macro(SET_PACKAGING_PARAMETERS) set(CONSOLE_INSTALL_DIR ${DMG_SUBFOLDER_NAME}) set(INTERFACE_INSTALL_DIR ${DMG_SUBFOLDER_NAME}) - set(CONSOLE_EXEC_NAME "Sandbox.app") + set(CONSOLE_EXEC_NAME "Console.app") set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME}") set(CONSOLE_APP_CONTENTS "${CONSOLE_INSTALL_APP_PATH}/Contents") diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 16189dff9d..df51409151 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -23,7 +23,7 @@ add_dependencies(${TARGET_NAME} assignment-client domain-server interface) # set the packaged console folder depending on platform, so we can copy it if (APPLE) - set(PACKAGED_CONSOLE_FOLDER "Sandbox-darwin-x64/${CONSOLE_EXEC_NAME}") + set(PACKAGED_CONSOLE_FOLDER "Console-darwin-x64/${CONSOLE_EXEC_NAME}") elseif (WIN32) set(PACKAGED_CONSOLE_FOLDER "server-console-win32-x64") elseif (UNIX) diff --git a/server-console/package.json b/server-console/package.json index 565658702b..b0d181c65a 100644 --- a/server-console/package.json +++ b/server-console/package.json @@ -1,6 +1,6 @@ { - "name": "HighFidelitySandbox", - "description": "High Fidelity Sandbox", + "name": "HighFidelityConsole", + "description": "High Fidelity Console", "author": "High Fidelity", "license": "Apache-2.0", "version": "1.0.0", From fda3ec87ceb59c6f341e0c05a5a4f239d83f9d8e Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 15:57:57 -0700 Subject: [PATCH 038/157] removing lingering print statement --- scripts/system/interstitialPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 4b48ce66d4..36184ef3cc 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -358,7 +358,6 @@ Menu.setIsOptionChecked("Show Overlays", physicsEnabled); if (!HMD.active) { - print("Show toolbar: " + physicsEnabled); toolbar.writeProperty("visible", physicsEnabled); } From 33db8e1f24128018046e5f3411214326d821c71c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 26 Sep 2018 16:40:43 -0700 Subject: [PATCH 039/157] only allow right-click for buttons --- scripts/system/redirectOverlays.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 165e8ae27a..66b338e49c 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -118,6 +118,10 @@ } function clickedOnOverlay(overlayID, event) { + if (event.isRightButton) { + // don't allow right-clicks. + return; + } if (tryAgainImage === overlayID) { location.goToLastAddress(); } else if (backImage === overlayID) { From ba1bae6408b82a5b8d230f442249b9e4467e5d58 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 26 Sep 2018 17:43:04 -0700 Subject: [PATCH 040/157] OSX Build fix --- ...fo.plist.in => MacOSXBundleConsoleComponentsInfo.plist.in} | 0 server-console/packager.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename cmake/templates/{MacOSXBundleSandboxComponentsInfo.plist.in => MacOSXBundleConsoleComponentsInfo.plist.in} (100%) diff --git a/cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in b/cmake/templates/MacOSXBundleConsoleComponentsInfo.plist.in similarity index 100% rename from cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in rename to cmake/templates/MacOSXBundleConsoleComponentsInfo.plist.in diff --git a/server-console/packager.js b/server-console/packager.js index 89bcd7cb71..5e4fbfe568 100644 --- a/server-console/packager.js +++ b/server-console/packager.js @@ -27,8 +27,8 @@ var options = { } const EXEC_NAME = "server-console"; -const SHORT_NAME = "Sandbox"; -const FULL_NAME = "High Fidelity Sandbox"; +const SHORT_NAME = "Console"; +const FULL_NAME = "High Fidelity Console"; // setup per OS options if (osType == "Darwin") { From 4078be3df5d20e44f8d30d226d6bafdead0acc01 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 26 Sep 2018 17:58:06 -0700 Subject: [PATCH 041/157] Better naming and simpler template maybe --- libraries/graphics/src/graphics/Material.slh | 5 - .../src/graphics/MaterialTextures.slh | 36 ---- libraries/render-utils/src/Blendshape.slh | 4 +- libraries/render-utils/src/MeshDeformer.slh | 28 ++- libraries/render-utils/src/Skinning.slh | 176 ++++-------------- 5 files changed, 52 insertions(+), 197 deletions(-) diff --git a/libraries/graphics/src/graphics/Material.slh b/libraries/graphics/src/graphics/Material.slh index e147860730..ea59059cf1 100644 --- a/libraries/graphics/src/graphics/Material.slh +++ b/libraries/graphics/src/graphics/Material.slh @@ -24,11 +24,6 @@ struct TexMapArray { <@func declareMaterialTexMapArrayBuffer()@> -//layout(binding=GRAPHICS_BUFFER_TEXMAPARRAY) uniform texMapArrayBuffer { -// TexMapArray _texMapArray; -//}; - - <@func evalTexMapArrayTexcoord0(texMapArray, inTexcoord0, outTexcoord0)@> { <$outTexcoord0$> = (<$texMapArray$>._texcoordTransforms0 * vec4(<$inTexcoord0$>.st, 0.0, 1.0)).st; diff --git a/libraries/graphics/src/graphics/MaterialTextures.slh b/libraries/graphics/src/graphics/MaterialTextures.slh index 1c381e9d98..0a60feccfc 100644 --- a/libraries/graphics/src/graphics/MaterialTextures.slh +++ b/libraries/graphics/src/graphics/MaterialTextures.slh @@ -11,44 +11,8 @@ <@if not MODEL_MATERIAL_TEXTURES_SLH@> <@def MODEL_MATERIAL_TEXTURES_SLH@> -!> <@include graphics/Material.slh@> - - -const int MAX_TEXCOORDS = 2; - -struct TexMapArray { -// mat4 _texcoordTransforms[MAX_TEXCOORDS]; - mat4 _texcoordTransforms0; - mat4 _texcoordTransforms1; - vec4 _lightmapParams; -}; - -layout(binding=GRAPHICS_BUFFER_TEXMAPARRAY) uniform texMapArrayBuffer { - TexMapArray _texMapArray; -}; - -TexMapArray getTexMapArray() { - return _texMapArray; -} - -<@func evalTexMapArrayTexcoord0(texMapArray, inTexcoord0, outTexcoord0)@> -{ - <$outTexcoord0$> = (<$texMapArray$>._texcoordTransforms0 * vec4(<$inTexcoord0$>.st, 0.0, 1.0)).st; -} -<@endfunc@> - -<@func evalTexMapArrayTexcoord1(texMapArray, inTexcoord1, outTexcoord1)@> -{ - <$outTexcoord1$> = (<$texMapArray$>._texcoordTransforms1 * vec4(<$inTexcoord1$>.st, 0.0, 1.0)).st; -} -<@endfunc@> - -<@endfunc@> -!> - <@func declareMaterialTextures(withAlbedo, withRoughness, withNormal, withMetallic, withEmissive, withOcclusion, withScattering)@> #define TAA_TEXTURE_LOD_BIAS -1.0 diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 8f62626829..2dfb0c1540 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -8,7 +8,7 @@ <@if not BLENDSHAPE_SLH@> <@def BLENDSHAPE_SLH@> -<@func declareApplyBlendshapeOffsets(USE_NORMAL, USE_TANGENT)@> +<@func declareBlendshape(USE_NORMAL, USE_TANGENT)@> struct BlendshapeOffset { vec4 position; @@ -39,7 +39,7 @@ BlendshapeOffset getBlendshapeOffset(int i) { } #endif -void applyBlendshapeOffset(int i, vec4 inPosition, out vec4 position +void evalBlendshape(int i, vec4 inPosition, out vec4 position <@if USE_NORMAL@> , vec3 inNormal, out vec3 normal <@endif@> diff --git a/libraries/render-utils/src/MeshDeformer.slh b/libraries/render-utils/src/MeshDeformer.slh index fb96b63a1b..1041522a5a 100644 --- a/libraries/render-utils/src/MeshDeformer.slh +++ b/libraries/render-utils/src/MeshDeformer.slh @@ -14,12 +14,12 @@ <@if USE_SKINNING@> <@include Skinning.slh@> -<$declareUseDualQuaternionSkinning($USE_DUAL_QUATERNION$) $> +<$declareSkinning($USE_DUAL_QUATERNION$, $USE_NORMAL$, $USE_TANGENT$)$> <@endif@> <@if USE_BLENDSHAPE@> <@include Blendshape.slh@> -<$declareApplyBlendshapeOffsets($USE_NORMAL$, $USE_TANGENT$)$> +<$declareBlendshape($USE_NORMAL$, $USE_TANGENT$)$> <@endif@> void evalMeshDeformer(vec4 inPosition, out vec4 outPosition @@ -47,30 +47,28 @@ void evalMeshDeformer(vec4 inPosition, out vec4 outPosition <@if USE_BLENDSHAPE@> if (isBlendshapeEnabled) { - - <@if USE_TANGENT@> - applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal, inTangent, _deformedTangent); - <@else@> + evalBlendshape(vertexIndex, inPosition, _deformedPosition <@if USE_NORMAL@> - applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition, inNormal, _deformedNormal); - <@else@> - applyBlendshapeOffset(vertexIndex, inPosition, _deformedPosition); + , inNormal, _deformedNormal <@endif@> + <@if USE_TANGENT@> + , inTangent, _deformedTangent <@endif@> + ); } <@endif@> <@if USE_SKINNING@> if (isSkinningEnabled) { - <@if USE_TANGENT@> - skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedTangent, _deformedPosition, _deformedNormal, _deformedTangent); - <@else@> + + evalSkinning(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedPosition <@if USE_NORMAL@> - skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedNormal, _deformedPosition, _deformedNormal); - <@else@> - skinPosition(inSkinClusterIndex, inSkinClusterWeight, _deformedPosition, _deformedPosition); + , _deformedNormal, _deformedNormal <@endif@> + <@if USE_TANGENT@> + , _deformedTangent, _deformedTangent <@endif@> + ); } <@endif@> diff --git a/libraries/render-utils/src/Skinning.slh b/libraries/render-utils/src/Skinning.slh index a35948f026..622ca946c2 100644 --- a/libraries/render-utils/src/Skinning.slh +++ b/libraries/render-utils/src/Skinning.slh @@ -13,11 +13,11 @@ <@include graphics/ShaderConstants.h@> +<@func declareSkinning(USE_DUAL_QUATERNION_SKINNING, USE_NORMAL, USE_TANGENT)@> + const int MAX_CLUSTERS = 128; const int INDICES_PER_VERTEX = 4; -<@func declareUseDualQuaternionSkinning(USE_DUAL_QUATERNION_SKINNING)@> - layout(std140, binding=GRAPHICS_BUFFER_SKINNING) uniform skinClusterBuffer { mat4 clusterMatrices[MAX_CLUSTERS]; }; @@ -55,7 +55,14 @@ mat4 dualQuatToMat4(vec4 real, vec4 dual) { } // dual quaternion linear blending -void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, out vec4 skinnedPosition) { +void evalSkinning(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, out vec4 skinnedPosition +<@if USE_NORMAL@> + , vec3 inNormal, out vec3 skinnedNormal +<@endif@> +<@if USE_TANGENT@> + , vec3 inTangent, out vec3 skinnedTangent +<@endif@> +) { // linearly blend scale and dual quaternion components vec4 sAccum = vec4(0.0, 0.0, 0.0, 0.0); @@ -102,166 +109,57 @@ void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPositio sAccum.w = 1.0; skinnedPosition = m * (sAccum * inPosition); } -} - -void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, vec3 inNormal, - out vec4 skinnedPosition, out vec3 skinnedNormal) { - - // linearly blend scale and dual quaternion components - vec4 sAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 rAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 dAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 cAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 polarityReference = clusterMatrices[skinClusterIndex[0]][1]; - - for (int i = 0; i < INDICES_PER_VERTEX; i++) { - mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])]; - float clusterWeight = skinClusterWeight[i]; - - vec4 scale = clusterMatrix[0]; - vec4 real = clusterMatrix[1]; - vec4 dual = clusterMatrix[2]; - vec4 cauterizedPos = clusterMatrix[3]; - - // to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity. - float dqClusterWeight = clusterWeight; - if (dot(real, polarityReference) < 0.0) { - dqClusterWeight = -clusterWeight; - } - - sAccum += scale * clusterWeight; - rAccum += real * dqClusterWeight; - dAccum += dual * dqClusterWeight; - cAccum += cauterizedPos * clusterWeight; - } - - // normalize dual quaternion - float norm = length(rAccum); - rAccum /= norm; - dAccum /= norm; - - // conversion from dual quaternion to 4x4 matrix. - mat4 m = dualQuatToMat4(rAccum, dAccum); - - // sAccum.w indicates the amount of cauterization for this vertex. - // 0 indicates no cauterization and 1 indicates full cauterization. - // TODO: make this cauterization smoother or implement full dual-quaternion scale support. - const float CAUTERIZATION_THRESHOLD = 0.1; - if (sAccum.w > CAUTERIZATION_THRESHOLD) { - skinnedPosition = cAccum; - } else { - sAccum.w = 1.0; - skinnedPosition = m * (sAccum * inPosition); - } - - skinnedNormal = vec3(m * vec4(inNormal, 0)); -} - -void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, vec3 inNormal, vec3 inTangent, - out vec4 skinnedPosition, out vec3 skinnedNormal, out vec3 skinnedTangent) { - - // linearly blend scale and dual quaternion components - vec4 sAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 rAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 dAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 cAccum = vec4(0.0, 0.0, 0.0, 0.0); - vec4 polarityReference = clusterMatrices[skinClusterIndex[0]][1]; - - for (int i = 0; i < INDICES_PER_VERTEX; i++) { - mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])]; - float clusterWeight = skinClusterWeight[i]; - - vec4 scale = clusterMatrix[0]; - vec4 real = clusterMatrix[1]; - vec4 dual = clusterMatrix[2]; - vec4 cauterizedPos = clusterMatrix[3]; - - // to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity. - float dqClusterWeight = clusterWeight; - if (dot(real, polarityReference) < 0.0) { - dqClusterWeight = -clusterWeight; - } - - sAccum += scale * clusterWeight; - rAccum += real * dqClusterWeight; - dAccum += dual * dqClusterWeight; - cAccum += cauterizedPos * clusterWeight; - } - - // normalize dual quaternion - float norm = length(rAccum); - rAccum /= norm; - dAccum /= norm; - - // conversion from dual quaternion to 4x4 matrix. - mat4 m = dualQuatToMat4(rAccum, dAccum); - - // sAccum.w indicates the amount of cauterization for this vertex. - // 0 indicates no cauterization and 1 indicates full cauterization. - // TODO: make this cauterization smoother or implement full dual-quaternion scale support. - const float CAUTERIZATION_THRESHOLD = 0.1; - if (sAccum.w > CAUTERIZATION_THRESHOLD) { - skinnedPosition = cAccum; - } else { - sAccum.w = 1.0; - skinnedPosition = m * (sAccum * inPosition); - } + <@if USE_NORMAL@> skinnedNormal = vec3(m * vec4(inNormal, 0)); +<@endif@> +<@if USE_TANGENT@> skinnedTangent = vec3(m * vec4(inTangent, 0)); +<@endif@> } -<@else@> // USE_DUAL_QUATERNION_SKINNING +<@else@> // NOT USE_DUAL_QUATERNION_SKINNING -void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, out vec4 skinnedPosition) { - vec4 newPosition = vec4(0.0, 0.0, 0.0, 0.0); - - for (int i = 0; i < INDICES_PER_VERTEX; i++) { - mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])]; - float clusterWeight = skinClusterWeight[i]; - newPosition += clusterMatrix * inPosition * clusterWeight; - } - - skinnedPosition = newPosition; -} - -void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, vec3 inNormal, - out vec4 skinnedPosition, out vec3 skinnedNormal) { - vec4 newPosition = vec4(0.0, 0.0, 0.0, 0.0); - vec4 newNormal = vec4(0.0, 0.0, 0.0, 0.0); - - for (int i = 0; i < INDICES_PER_VERTEX; i++) { - mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])]; - float clusterWeight = skinClusterWeight[i]; - newPosition += clusterMatrix * inPosition * clusterWeight; - newNormal += clusterMatrix * vec4(inNormal.xyz, 0.0) * clusterWeight; - } - - skinnedPosition = newPosition; - skinnedNormal = newNormal.xyz; -} - -void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, vec3 inNormal, vec3 inTangent, - out vec4 skinnedPosition, out vec3 skinnedNormal, out vec3 skinnedTangent) { +// LiNEAR BLENDING +void evalSkinning(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, out vec4 skinnedPosition +<@if USE_NORMAL@> + , vec3 inNormal, out vec3 skinnedNormal +<@endif@> +<@if USE_TANGENT@> + , vec3 inTangent, out vec3 skinnedTangent +<@endif@> +) { vec4 newPosition = vec4(0.0, 0.0, 0.0, 0.0); +<@if USE_NORMAL@> vec4 newNormal = vec4(0.0, 0.0, 0.0, 0.0); +<@endif@> +<@if USE_TANGENT@> vec4 newTangent = vec4(0.0, 0.0, 0.0, 0.0); +<@endif@> for (int i = 0; i < INDICES_PER_VERTEX; i++) { mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])]; float clusterWeight = skinClusterWeight[i]; newPosition += clusterMatrix * inPosition * clusterWeight; +<@if USE_NORMAL@> newNormal += clusterMatrix * vec4(inNormal.xyz, 0.0) * clusterWeight; +<@endif@> +<@if USE_TANGENT@> newTangent += clusterMatrix * vec4(inTangent.xyz, 0.0) * clusterWeight; +<@endif@> } skinnedPosition = newPosition; +<@if USE_NORMAL@> skinnedNormal = newNormal.xyz; +<@endif@> +<@if USE_TANGENT@> skinnedTangent = newTangent.xyz; +<@endif@> } <@endif@> // if USE_DUAL_QUATERNION_SKINNING -<@endfunc@> // func declareUseDualQuaternionSkinning(USE_DUAL_QUATERNION_SKINNING) +<@endfunc@> // func declareSkinning() <@endif@> // if not SKINNING_SLH From b6fd302a837f7de0fe58bba1b62f974f6ee4efc2 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 26 Sep 2018 18:40:54 -0700 Subject: [PATCH 042/157] OSX Interface-running detection fixes --- server-console/src/modules/hf-app.js | 6 +++++- server-console/src/modules/hf-process.js | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server-console/src/modules/hf-app.js b/server-console/src/modules/hf-app.js index 1b1171baef..d7c54d3e4d 100644 --- a/server-console/src/modules/hf-app.js +++ b/server-console/src/modules/hf-app.js @@ -67,7 +67,11 @@ exports.startInterface = function(url) { } exports.isInterfaceRunning = function(done) { - var pInterface = new Process('interface', 'interface.exe'); + if (osType == 'Windows_NT') { + var pInterface = new Process('interface', 'interface.exe'); + } else if (osType == 'Darwin') { + var pInterface = new Process('interface', 'Interface'); + } return pInterface.isRunning(done); } diff --git a/server-console/src/modules/hf-process.js b/server-console/src/modules/hf-process.js index 35da07af9c..7736de0e55 100644 --- a/server-console/src/modules/hf-process.js +++ b/server-console/src/modules/hf-process.js @@ -274,8 +274,7 @@ Process.prototype = extend(Process.prototype, { done(running); }); } else if (os.type == 'Darwin') { - console.log("TODO IsRunning Darwin"); - childProcess.exec('ps cax | grep interface', function (err, stdout, stderr) { + childProcess.exec('ps cax | grep ' + _command, function (err, stdout, stderr) { done(stdout.length > 0); }); } From 8923055e91552a5b1ee7e6695697617cc4b449aa Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 27 Sep 2018 00:15:34 -0700 Subject: [PATCH 043/157] Exploring the bad peroformances --- .../gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp | 7 ++++--- libraries/gpu/src/gpu/Batch.cpp | 3 +++ libraries/gpu/src/gpu/Context.cpp | 3 +++ libraries/gpu/src/gpu/Frame.cpp | 2 ++ libraries/render-utils/src/Model.cpp | 15 +++------------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp index cb0591c31c..62e763e488 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp @@ -61,9 +61,10 @@ GLBuffer* GL45Backend::syncGPUObject(const Buffer& buffer) { bool GL45Backend::bindResourceBuffer(uint32_t slot, const BufferPointer& buffer) { - GLBuffer* object = syncGPUObject((*buffer)); - if (object) { - glBindBufferBase(GL_SHADER_STORAGE_BUFFER, slot, object->_id); + // GLBuffer* object = syncGPUObject((*buffer)); + auto bo = getBufferIDUnsynced((*buffer)); + if (bo) { + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, slot, bo); (void)CHECK_GL_ERROR(); diff --git a/libraries/gpu/src/gpu/Batch.cpp b/libraries/gpu/src/gpu/Batch.cpp index f8337fdb91..26222a2cc0 100644 --- a/libraries/gpu/src/gpu/Batch.cpp +++ b/libraries/gpu/src/gpu/Batch.cpp @@ -685,6 +685,8 @@ void Batch::_glColor4f(float red, float green, float blue, float alpha) { } void Batch::finishFrame(BufferUpdates& updates) { + PROFILE_RANGE(render_gpu, __FUNCTION__); + for (auto& mapItem : _namedData) { auto& name = mapItem.first; auto& instance = mapItem.second; @@ -713,6 +715,7 @@ void Batch::finishFrame(BufferUpdates& updates) { } void Batch::flush() { + PROFILE_RANGE(render_gpu, __FUNCTION__); for (auto& mapItem : _namedData) { auto& name = mapItem.first; auto& instance = mapItem.second; diff --git a/libraries/gpu/src/gpu/Context.cpp b/libraries/gpu/src/gpu/Context.cpp index 5783b7f59e..dd0d510509 100644 --- a/libraries/gpu/src/gpu/Context.cpp +++ b/libraries/gpu/src/gpu/Context.cpp @@ -84,6 +84,7 @@ void Context::appendFrameBatch(const BatchPointer& batch) { } FramePointer Context::endFrame() { + PROFILE_RANGE(render_gpu, __FUNCTION__); assert(_frameActive); auto result = _currentFrame; _currentFrame.reset(); @@ -101,10 +102,12 @@ void Context::executeBatch(Batch& batch) const { } void Context::recycle() const { + PROFILE_RANGE(render_gpu, __FUNCTION__); _backend->recycle(); } void Context::consumeFrameUpdates(const FramePointer& frame) const { + PROFILE_RANGE(render_gpu, __FUNCTION__); frame->preRender(); } diff --git a/libraries/gpu/src/gpu/Frame.cpp b/libraries/gpu/src/gpu/Frame.cpp index f1001d97d2..9d8bc7e973 100644 --- a/libraries/gpu/src/gpu/Frame.cpp +++ b/libraries/gpu/src/gpu/Frame.cpp @@ -25,12 +25,14 @@ Frame::~Frame() { } void Frame::finish() { + PROFILE_RANGE(render_gpu, __FUNCTION__); for (const auto& batch : batches) { batch->finishFrame(bufferUpdates); } } void Frame::preRender() { + PROFILE_RANGE(render_gpu, __FUNCTION__); for (auto& update : bufferUpdates) { update.apply(); } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 02ba4fd4fe..e36a7d58ff 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1669,15 +1669,6 @@ void Blender::run() { currentBlendshapeOffset.tangentOffsetAndSpare += glm::vec4(blendshape.tangents.at(j) * normalCoefficient, 0.0f); } } -/*#if FBX_PACK_NORMALS - glm::uint32 finalNormal; - glm::uint32 finalTangent; - buffer_helpers::packNormalAndTangent(normal, tangent, finalNormal, finalTangent); -#else - const auto& finalNormal = normal; - const auto& finalTangent = tangent; -#endif*/ - } }); } @@ -1697,6 +1688,7 @@ bool Model::maybeStartBlender() { } void Model::setBlendedVertices(int blendNumber, const QVector& blendshapeOffsets) { + PROFILE_RANGE(render, __FUNCTION__); if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendshapeBuffersInitialized) { return; } @@ -1712,7 +1704,7 @@ void Model::setBlendedVertices(int blendNumber, const QVector& } const auto blendshapeOffsetSize = meshBlendshapeOffsets->second.size() * sizeof(BlendshapeOffset); - buffer->second->setData(blendshapeOffsetSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset)); + buffer->second->setSubData(0, blendshapeOffsetSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset)); index += meshBlendshapeOffsets->second.size(); } @@ -1728,11 +1720,10 @@ void Model::initializeBlendshapes(const FBXMesh& mesh, int index) { } // Mesh has blendshape, let s allocate the local buffer if not done yet if (_blendshapeBuffers.find(index) == _blendshapeBuffers.end()) { - _blendshapeBuffers[index] = std::make_shared(); QVector blendshapeOffset; blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size()); const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset); - _blendshapeBuffers[index]->setData(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData()); + _blendshapeBuffers[index] = std::make_shared(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData(), blendshapeOffsetsSize); _blendshapeOffsets[index] = blendshapeOffset; } } From a9164f96b9f9edd7a2219988bda570785a596fdd Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 09:53:42 -0700 Subject: [PATCH 044/157] Fix some inaccuracies in the pick parenting doc --- docs/interface/raypick/pick-parenting.md.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/interface/raypick/pick-parenting.md.html b/docs/interface/raypick/pick-parenting.md.html index cb3e935317..d495e21419 100644 --- a/docs/interface/raypick/pick-parenting.md.html +++ b/docs/interface/raypick/pick-parenting.md.html @@ -8,7 +8,7 @@ Picks are immutable to allow efficient use by scripts. There are currently four - Ray pick - Finds the first intersected object along a straight path - Parabola pick - Finds the first intersected object along a parabolic path -- Stylus pick - Finds the distance between a point and a list of whitelisted objects +- Stylus pick - Finds the distance between a point and the XZ planes of a list of whitelisted objects - Collision pick - Uses a volume to check for collisions in the physics engine With the exception of collision picks, all picks use the visible appearance of the object to check for collisions. @@ -21,17 +21,17 @@ Pick parenting allows the pick's transform to be calculated relative to another # What can be parented to what? -Child type: | Entity | My Avatar | Other Avatar | 3D Overlay | Pick^1 | Pointer^1 + | Entity | My Avatar | Other Avatar | 3D Overlay | Pick^1 | Pointer^1 ---------------|----------|-------------|----------------|--------------|----------|--------------- -Entity | yes | no | no | yes | yes | yes +Entity | yes | yes | no | yes | yes | yes My Avatar | yes | no | no | yes | yes | yes -Other Avatar | yes | no | no | yes | yes | yes -3D Overlay | yes | no | no | yes | yes | yes +Other Avatar | yes | yes | no | yes | yes | yes +3D Overlay | yes | yes | no | yes | yes | yes Pick | no | no | no | no | yes | yes Pointer | no | no | no | no | no | no The Mouse | no | no | no | no | yes | yes -- ^1 Excluding stylus, which can only be parented to My Avatar's hands +- ^1 Excluding stylus, which can only be parented to My Avatar's hands for now # How pick parenting works From 747aab2097326e78c76bb105d1ccf0f40982648e Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 10:16:11 -0700 Subject: [PATCH 045/157] persisting signed values --- interface/src/Application.cpp | 5 ++--- interface/src/Application.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2ffd49a0b7..69f2445dd3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -365,7 +365,6 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI static const uint32_t INVALID_FRAME = UINT32_MAX; -static const float PHYSICS_READY_RANGE = 3.0f; // how far from avatar to check for entities that aren't ready for simulation static const float INITIAL_QUERY_RADIUS = 10.0f; // priority radius for entities before physics enabled static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); @@ -6569,8 +6568,8 @@ bool Application::gpuTextureMemSizeStable() { auto renderConfig = qApp->getRenderEngine()->getConfiguration(); auto renderStats = renderConfig->getConfig("Stats"); - quint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; - quint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; + qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; + qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { _gpuTextureMemSizeStabilityCount++; diff --git a/interface/src/Application.h b/interface/src/Application.h index d9fff89915..cb37e655fc 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -730,8 +730,8 @@ private: std::atomic _fullSceneReceivedCounter { 0 }; // how many times have we received a full-scene octree stats packet uint32_t _fullSceneCounterAtLastPhysicsCheck { 0 }; // _fullSceneReceivedCounter last time we checked physics ready - quint64 _gpuTextureMemSizeStabilityCount { 0 }; - quint64 _gpuTextureMemSizeAtLastCheck { 0 }; + qint64 _gpuTextureMemSizeStabilityCount { 0 }; + qint64 _gpuTextureMemSizeAtLastCheck { 0 }; quint64 _lastPhysicsCheckTime { usecTimestampNow() }; // when did we last check to see if physics was ready From 61aef14c64cfb2cf40858ff2df03c6a36991c2b3 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 10:16:21 -0700 Subject: [PATCH 046/157] OSX notifications dismiss the previous notifications immediately when sent, preventing 'click' behavior --- .../src/modules/hf-notifications.js | 63 +++++++++++++++---- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index a95a553631..c7f4e24a17 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -7,12 +7,14 @@ const path = require('path'); const AccountInfo = require('./hf-acctinfo').AccountInfo; const GetBuildInfo = hfApp.getBuildInfo; const buildInfo = GetBuildInfo(); +const osType = os.type(); const notificationIcon = path.join(__dirname, '../../resources/console-notification.png'); const STORIES_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 120 * 1000; const PEOPLE_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 120 * 1000; const WALLET_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 600 * 1000; const MARKETPLACE_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 600 * 1000; +const OSX_CLICK_DELAY_TIMEOUT = 500; const METAVERSE_SERVER_URL= process.env.HIFI_METAVERSE_URL ? process.env.HIFI_METAVERSE_URL : 'https://metaverse.highfidelity.com' const STORIES_URL= '/api/v1/user_stories'; @@ -33,13 +35,15 @@ const NotificationType = { MARKETPLACE: 'marketplace' }; + function HifiNotification(notificationType, notificationData, menuNotificationCallback) { this.type = notificationType; this.data = notificationData; } HifiNotification.prototype = { - show: function () { + show: function (finished) { + var _finished = finished; var text = ""; var message = ""; var url = null; @@ -114,8 +118,16 @@ HifiNotification.prototype = { message: message, wait: true, appID: buildInfo.appUserModelId, - url: url - }); + url: url, + timeout: 5 + }, + function (error, reason, metadata) { + if (osType == 'Darwin') { + setTimeout(_finished, OSX_CLICK_DELAY_TIMEOUT); + } else { + _finished(); + } + }); } } @@ -129,9 +141,12 @@ function HifiNotifications(config, menuNotificationCallback) { this.marketplaceSince = new Date(this.config.get("marketplaceNotifySince", "1970-01-01T00:00:00.000Z")); this.enable(this.enabled()); + this.pendingNotifications = []; + var _menuNotificationCallback = menuNotificationCallback; notifier.on('click', function (notifierObject, options) { + console.log("click."); StartInterface(options.url); _menuNotificationCallback(options.notificationType, false); }); @@ -195,6 +210,36 @@ HifiNotifications.prototype = { this.enable(false); }, + _showNotification: function () { + var _this = this; + + if (osType == 'Darwin') { + this.pendingNotifications[0].show(function () { + // For OSX + // don't attempt to show the next notification + // until the current is clicked or times out + // as the OSX Notifier stuff will dismiss + // the previous notification immediately + // when a new one is submitted + _this.pendingNotifications.shift(); + if(_this.pendingNotifications.length > 0) { + _this._showNotification(); + } + }); + } else { + // For Windows + // All notifications are sent immediately as they are queued + // by windows in Tray Notifications and can be bulk seen and + // dismissed + _this._showNotification(_this.pendingNotifications.shift()); + } + }, + _addNotification: function (notification) { + this.pendingNotifications.push(notification); + if(this.pendingNotifications.length == 1) { + this._showNotification(); + } + }, _pollToDisableHighlight: function (notifyType, error, data) { if (error || !data.body) { console.log("Error: unable to get " + url); @@ -248,8 +293,7 @@ HifiNotifications.prototype = { } _this.menuNotificationCallback(notifyType, true); if (content.total_entries >= maxNotificationItemCount) { - var notification = new HifiNotification(notifyType, content.total_entries); - notification.show(); + _this._addNotification(new HifiNotification(notifyType, content.total_entries)); } else { var notifyData = [] switch (notifyType) { @@ -268,8 +312,7 @@ HifiNotifications.prototype = { } notifyData.forEach(function (notifyDataEntry) { - var notification = new HifiNotification(notifyType, notifyDataEntry); - notification.show(); + _this._addNotification(new HifiNotification(notifyType, notifyDataEntry)); }); } finished(true, token); @@ -376,13 +419,11 @@ HifiNotifications.prototype = { } if (newUsers.size >= maxNotificationItemCount) { - var notification = new HifiNotification(NotificationType.PEOPLE, newUsers.size); - notification.show(); + _this._addNotification(new HifiNotification(NotificationType.PEOPLE, newUsers.size)); return; } newUsers.forEach(function (user) { - var notification = new HifiNotification(NotificationType.PEOPLE, user); - notification.show(); + _this._addNotification(new HifiNotification(NotificationType.PEOPLE, user)); }); }); }); From 14b30935069b4e7a913b284547692bc0b50b2452 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 10:33:21 -0700 Subject: [PATCH 047/157] Clarify 'what can be parented to what' table in pick parenting doc --- docs/interface/raypick/pick-parenting.md.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/interface/raypick/pick-parenting.md.html b/docs/interface/raypick/pick-parenting.md.html index d495e21419..82f38a1494 100644 --- a/docs/interface/raypick/pick-parenting.md.html +++ b/docs/interface/raypick/pick-parenting.md.html @@ -21,15 +21,15 @@ Pick parenting allows the pick's transform to be calculated relative to another # What can be parented to what? - | Entity | My Avatar | Other Avatar | 3D Overlay | Pick^1 | Pointer^1 ----------------|----------|-------------|----------------|--------------|----------|--------------- -Entity | yes | yes | no | yes | yes | yes -My Avatar | yes | no | no | yes | yes | yes -Other Avatar | yes | yes | no | yes | yes | yes -3D Overlay | yes | yes | no | yes | yes | yes -Pick | no | no | no | no | yes | yes -Pointer | no | no | no | no | no | no -The Mouse | no | no | no | no | yes | yes +This object... | | Entity | My Avatar | 3D Overlay | Pick^1 | Pointer^1 +---------------------|----------------|--------|-----------|------------|--------|----------- +Can be parented to...| Entity | yes | yes | yes | yes | yes + | My Avatar | yes | no | yes | yes | yes + | Other Avatar | yes | yes | yes | yes | yes + | 3D Overlay | yes | yes | yes | yes | yes + | Pick | no | no | no | yes | yes + | Pointer | no | no | no | no | no + | The Mouse | no | no | no | yes | yes - ^1 Excluding stylus, which can only be parented to My Avatar's hands for now From 9079c8a6b76c94cf395cb13e44589ae359703b1c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 10:42:21 -0700 Subject: [PATCH 048/157] adding log for redirect cases --- libraries/networking/src/DomainHandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 3ff8f29cd0..3a8253bfc6 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -363,6 +363,7 @@ void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, if (getInterstitialModeEnabled()) { _errorDomainURL = errorUrl; _isInErrorState = true; + qCDebug(networking) << "Error connecting to domain: " << reasonMessage; emit redirectErrorStateChanged(_isInErrorState); emit redirectToErrorDomainURL(_errorDomainURL); } else { From b68031b9696436d9dafbb8891f51537675636a8b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 10:53:10 -0700 Subject: [PATCH 049/157] Add simpler RayPick constructor with position/direction values set to default --- interface/src/Application.cpp | 3 +-- interface/src/raypick/RayPick.h | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index db89b0a9cd..8bb362b9cb 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2271,8 +2271,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo // Setup the mouse ray pick and related operators { - auto mouseRayPick = std::make_shared(glm::vec3(), Vectors::UP, - PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true); + auto mouseRayPick = std::make_shared(PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true); mouseRayPick->parentTransform = std::make_shared(); auto mouseRayPickID = DependencyManager::get()->addPick(PickQuery::Ray, mouseRayPick); DependencyManager::get()->setMouseRayPickID(mouseRayPickID); diff --git a/interface/src/raypick/RayPick.h b/interface/src/raypick/RayPick.h index 7c7ea5758a..07e2136864 100644 --- a/interface/src/raypick/RayPick.h +++ b/interface/src/raypick/RayPick.h @@ -70,6 +70,11 @@ public: class RayPick : public Pick { public: + RayPick(const PickFilter& filter, float maxDistance, bool enabled) : + Pick(filter, maxDistance, enabled) { + _mathPick = PickRay(Vectors::ZERO, Vectors::UP); + } + RayPick(glm::vec3 position, glm::vec3 direction, const PickFilter& filter, float maxDistance, bool enabled) : Pick(filter, maxDistance, enabled) { _mathPick = PickRay(position, direction); From bb38efa061803d325baff4b41ab0b4b0999b47dc Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 10:58:21 -0700 Subject: [PATCH 050/157] Set joint state for the mouse RayPick of the EntityTreeRenderer --- interface/src/Application.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8bb362b9cb..35c071b512 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2273,6 +2273,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo { auto mouseRayPick = std::make_shared(PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true); mouseRayPick->parentTransform = std::make_shared(); + mouseRayPick->setJointState(PickQuery::JOINT_STATE_MOUSE); auto mouseRayPickID = DependencyManager::get()->addPick(PickQuery::Ray, mouseRayPick); DependencyManager::get()->setMouseRayPickID(mouseRayPickID); } From d851e3994e78df3492a3740124c92bd908e89d8a Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 11:10:51 -0700 Subject: [PATCH 051/157] Search for interface should check peer package Also, retain enabled/disabled state for notifications across restarts --- .../src/modules/hf-notifications.js | 27 +++++++++---------- server-console/src/modules/path-finder.js | 3 +++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index c7f4e24a17..d487462ba5 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -146,7 +146,6 @@ function HifiNotifications(config, menuNotificationCallback) { var _menuNotificationCallback = menuNotificationCallback; notifier.on('click', function (notifierObject, options) { - console.log("click."); StartInterface(options.url); _menuNotificationCallback(options.notificationType, false); }); @@ -185,18 +184,7 @@ HifiNotifications.prototype = { }, MARKETPLACE_NOTIFICATION_POLL_TIME_MS); } else { - if (this.storiesPollTimer) { - clearInterval(this.storiesPollTimer); - } - if (this.peoplePollTimer) { - clearInterval(this.peoplePollTimer); - } - if (this.walletPollTimer) { - clearInterval(this.walletPollTimer); - } - if (this.marketplacePollTimer) { - clearInterval(this.marketplacePollTimer); - } + this.stopPolling(); } }, enabled: function () { @@ -208,7 +196,18 @@ HifiNotifications.prototype = { this.config.set("walletNotifySince", this.walletSince.toISOString()); this.config.set("marketplaceNotifySince", this.marketplaceSince.toISOString()); - this.enable(false); + if (this.storiesPollTimer) { + clearInterval(this.storiesPollTimer); + } + if (this.peoplePollTimer) { + clearInterval(this.peoplePollTimer); + } + if (this.walletPollTimer) { + clearInterval(this.walletPollTimer); + } + if (this.marketplacePollTimer) { + clearInterval(this.marketplacePollTimer); + } }, _showNotification: function () { var _this = this; diff --git a/server-console/src/modules/path-finder.js b/server-console/src/modules/path-finder.js index 5ecd2c74ff..e9e7e48a5f 100644 --- a/server-console/src/modules/path-finder.js +++ b/server-console/src/modules/path-finder.js @@ -55,6 +55,9 @@ exports.searchPaths = function(name, binaryType, releaseType) { // check beside the app bundle for the binaries paths.push(path.join(path.dirname(appPath), name + extension)); + + // check in the peer bundle for the binaries + paths.push(path.join("..", name + extension)); } } } From 85b3b883f9fb9d2dd5ebae47075084bd32a29c1f Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 27 Sep 2018 11:11:14 -0700 Subject: [PATCH 052/157] REmove cruft --- libraries/render/src/render/DrawTask.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 7294bf4b1f..0ec643ac39 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -86,10 +86,8 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext, RenderArgs* args = renderContext->args; int numItemsToDraw = (int)inItems.size(); - int lastItemToDraw = -1; if (maxDrawnItems != -1) { numItemsToDraw = glm::min(numItemsToDraw, maxDrawnItems); - lastItemToDraw = numItemsToDraw - 1; } using SortedPipelines = std::vector; @@ -100,11 +98,6 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext, for (auto i = 0; i < numItemsToDraw; ++i) { auto& item = scene->getItem(inItems[i].id); - if (lastItemToDraw == i) { - if (!item.getKey().isShape()) { - qDebug() << "Item explored"; - } - } { assert(item.getKey().isShape()); auto key = item.getShapeKey() | globalKey; From 3ac9478101ccd4d02a1783fa5e5140a31c7fd97b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 11:27:25 -0700 Subject: [PATCH 053/157] Assign _mathPick in the Pick constructor --- interface/src/raypick/CollisionPick.cpp | 3 +-- interface/src/raypick/ParabolaPick.cpp | 3 +-- interface/src/raypick/RayPick.h | 6 ++---- interface/src/raypick/StylusPick.cpp | 7 +++---- interface/src/raypick/StylusPick.h | 7 ++----- libraries/pointers/src/Pick.h | 2 +- libraries/shared/src/RegisteredMetaTypes.h | 2 ++ 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp index f79879bf93..5b5ecd09ff 100644 --- a/interface/src/raypick/CollisionPick.cpp +++ b/interface/src/raypick/CollisionPick.cpp @@ -346,9 +346,8 @@ void CollisionPick::computeShapeInfo(const CollisionRegion& pick, ShapeInfo& sha } CollisionPick::CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine) : - Pick(filter, maxDistance, enabled), + Pick(collisionRegion, filter, maxDistance, enabled), _physicsEngine(physicsEngine) { - _mathPick = collisionRegion; if (collisionRegion.shouldComputeShapeInfo()) { _cachedResource = DependencyManager::get()->getCollisionGeometryResource(collisionRegion.modelURL); } diff --git a/interface/src/raypick/ParabolaPick.cpp b/interface/src/raypick/ParabolaPick.cpp index e8aa42140b..eb95d03f13 100644 --- a/interface/src/raypick/ParabolaPick.cpp +++ b/interface/src/raypick/ParabolaPick.cpp @@ -16,11 +16,10 @@ #include "PickManager.h" ParabolaPick::ParabolaPick(const glm::vec3& position, const glm::vec3& direction, float speed, const glm::vec3& accelerationAxis, bool rotateAccelerationWithAvatar, bool rotateAccelerationWithParent, bool scaleWithParent, const PickFilter& filter, float maxDistance, bool enabled) : - Pick(filter, maxDistance, enabled), + Pick(PickParabola(position, speed * direction, accelerationAxis), filter, maxDistance, enabled), _rotateAccelerationWithAvatar(rotateAccelerationWithAvatar), _rotateAccelerationWithParent(rotateAccelerationWithParent), _scaleWithParent(scaleWithParent) { - _mathPick = PickParabola(position, speed*direction, accelerationAxis); } PickParabola ParabolaPick::getMathematicalPick() const { diff --git a/interface/src/raypick/RayPick.h b/interface/src/raypick/RayPick.h index 07e2136864..4af8490fdc 100644 --- a/interface/src/raypick/RayPick.h +++ b/interface/src/raypick/RayPick.h @@ -71,13 +71,11 @@ class RayPick : public Pick { public: RayPick(const PickFilter& filter, float maxDistance, bool enabled) : - Pick(filter, maxDistance, enabled) { - _mathPick = PickRay(Vectors::ZERO, Vectors::UP); + Pick(PickRay(Vectors::ZERO, Vectors::UP), filter, maxDistance, enabled) { } RayPick(glm::vec3 position, glm::vec3 direction, const PickFilter& filter, float maxDistance, bool enabled) : - Pick(filter, maxDistance, enabled) { - _mathPick = PickRay(position, direction); + Pick(PickRay(position, direction), filter, maxDistance, enabled) { } PickRay getMathematicalPick() const override; diff --git a/interface/src/raypick/StylusPick.cpp b/interface/src/raypick/StylusPick.cpp index 69f605e7f9..c495ddd194 100644 --- a/interface/src/raypick/StylusPick.cpp +++ b/interface/src/raypick/StylusPick.cpp @@ -65,8 +65,7 @@ bool StylusPickResult::checkOrFilterAgainstMaxDistance(float maxDistance) { } StylusPick::StylusPick(Side side, const PickFilter& filter, float maxDistance, bool enabled) : - Pick(filter, maxDistance, enabled), - _side(side) + Pick(StylusTip(side), filter, maxDistance, enabled) { } @@ -130,9 +129,9 @@ static StylusTip getControllerWorldLocation(Side side) { StylusTip StylusPick::getMathematicalPick() const { StylusTip result; if (qApp->getPreferAvatarFingerOverStylus()) { - result = getFingerWorldLocation(_side); + result = getFingerWorldLocation(_mathPick.side); } else { - result = getControllerWorldLocation(_side); + result = getControllerWorldLocation(_mathPick.side); } return result; } diff --git a/interface/src/raypick/StylusPick.h b/interface/src/raypick/StylusPick.h index e6b1da9914..cd01df20e9 100644 --- a/interface/src/raypick/StylusPick.h +++ b/interface/src/raypick/StylusPick.h @@ -68,12 +68,9 @@ public: PickResultPointer getHUDIntersection(const StylusTip& pick) override; Transform getResultTransform() const override; - bool isLeftHand() const override { return _side == Side::Left; } - bool isRightHand() const override { return _side == Side::Right; } + bool isLeftHand() const override { return _mathPick.side == Side::Left; } + bool isRightHand() const override { return _mathPick.side == Side::Right; } bool isMouse() const override { return false; } - -private: - const Side _side; }; #endif // hifi_StylusPick_h \ No newline at end of file diff --git a/libraries/pointers/src/Pick.h b/libraries/pointers/src/Pick.h index 42a9354122..2ae1048249 100644 --- a/libraries/pointers/src/Pick.h +++ b/libraries/pointers/src/Pick.h @@ -243,7 +243,7 @@ Q_DECLARE_METATYPE(PickQuery::PickType) template class Pick : public PickQuery { public: - Pick(const PickFilter& filter, const float maxDistance, const bool enabled) : PickQuery(filter, maxDistance, enabled) {} + Pick(const T& mathPick, const PickFilter& filter, const float maxDistance, const bool enabled) : PickQuery(filter, maxDistance, enabled), _mathPick(mathPick) {} virtual T getMathematicalPick() const = 0; virtual PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const = 0; diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index 46f112f5c6..58b99bc0f7 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -200,6 +200,8 @@ void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay); class StylusTip : public MathPick { public: StylusTip() : position(NAN), velocity(NAN) {} + StylusTip(bilateral::Side side, glm::vec3 position = Vectors::ZERO, glm::quat orientation = Quaternions::IDENTITY, glm::vec3 velocity = Vectors::ZERO) : + side(side), position(position), orientation(orientation), velocity(velocity) {} StylusTip(const QVariantMap& pickVariant) : side(bilateral::Side(pickVariant["side"].toInt())), position(vec3FromVariant(pickVariant["position"])), orientation(quatFromVariant(pickVariant["orientation"])), velocity(vec3FromVariant(pickVariant["velocity"])) {} From 12a755310f1037bda9c0a8676cd4a91dfec49daf Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 11:37:30 -0700 Subject: [PATCH 054/157] Fix wrong velocity in ParabolaPick::getMathematicalPick --- interface/src/raypick/ParabolaPick.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/raypick/ParabolaPick.cpp b/interface/src/raypick/ParabolaPick.cpp index eb95d03f13..b10f82c9bd 100644 --- a/interface/src/raypick/ParabolaPick.cpp +++ b/interface/src/raypick/ParabolaPick.cpp @@ -36,6 +36,8 @@ PickParabola ParabolaPick::getMathematicalPick() const { glm::vec3 position = currentParentTransform.transform(_mathPick.origin); glm::vec3 velocity = _mathPick.velocity; if (_scaleWithParent) { + velocity = currentParentTransform.transform(velocity); + } else { velocity = currentParentTransform.transformDirection(velocity); } glm::vec3 acceleration = _mathPick.acceleration; From ed987ffe9e2f848ad2a1608dafcd98e49c3c0a9b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 11:42:19 -0700 Subject: [PATCH 055/157] Improve style/compatibility for default position/direction when creating parabola pick --- interface/src/raypick/PickScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 600be743fe..7de69b537d 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -207,8 +207,8 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti scaleWithParent = propMap["scaleWithAvatar"].toBool(); } - glm::vec3 position = glm::vec3(); - glm::vec3 direction = -Vectors::FRONT; + glm::vec3 position = Vectors::ZERO; + glm::vec3 direction = propMap["joint"].isValid() ? Vectors::UP : -Vectors::FRONT; if (propMap["position"].isValid()) { position = vec3FromVariant(propMap["position"]); } else if (propMap["posOffset"].isValid()) { From 6a3b286a074ec28693a684200eb4e0771b39aea3 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 11:44:00 -0700 Subject: [PATCH 056/157] Fix windows notification popups:w --- .../src/modules/hf-notifications.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index c7f4e24a17..b089e16983 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -10,10 +10,10 @@ const buildInfo = GetBuildInfo(); const osType = os.type(); const notificationIcon = path.join(__dirname, '../../resources/console-notification.png'); -const STORIES_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 120 * 1000; -const PEOPLE_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 120 * 1000; -const WALLET_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 600 * 1000; -const MARKETPLACE_NOTIFICATION_POLL_TIME_MS = 15 * 1000; // 600 * 1000; +const STORIES_NOTIFICATION_POLL_TIME_MS = 120 * 1000; +const PEOPLE_NOTIFICATION_POLL_TIME_MS = 120 * 1000; +const WALLET_NOTIFICATION_POLL_TIME_MS = 600 * 1000; +const MARKETPLACE_NOTIFICATION_POLL_TIME_MS = 600 * 1000; const OSX_CLICK_DELAY_TIMEOUT = 500; const METAVERSE_SERVER_URL= process.env.HIFI_METAVERSE_URL ? process.env.HIFI_METAVERSE_URL : 'https://metaverse.highfidelity.com' @@ -122,10 +122,12 @@ HifiNotification.prototype = { timeout: 5 }, function (error, reason, metadata) { - if (osType == 'Darwin') { - setTimeout(_finished, OSX_CLICK_DELAY_TIMEOUT); - } else { - _finished(); + if(_finished) { + if (osType == 'Darwin') { + setTimeout(_finished, OSX_CLICK_DELAY_TIMEOUT); + } else { + _finished(); + } } }); } @@ -231,7 +233,7 @@ HifiNotifications.prototype = { // All notifications are sent immediately as they are queued // by windows in Tray Notifications and can be bulk seen and // dismissed - _this._showNotification(_this.pendingNotifications.shift()); + _this.pendingNotifications.shift().show(); } }, _addNotification: function (notification) { From b0b2c6f3ee88372883fc9d80c470b28f8c53ba2b Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 13:31:28 -0700 Subject: [PATCH 057/157] Fixup path finding for interface --- server-console/src/modules/path-finder.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server-console/src/modules/path-finder.js b/server-console/src/modules/path-finder.js index e9e7e48a5f..3fab8b2808 100644 --- a/server-console/src/modules/path-finder.js +++ b/server-console/src/modules/path-finder.js @@ -1,5 +1,6 @@ var fs = require('fs'); var path = require('path'); +const { app } = require('electron'); function platformExtension(name) { if (name == "Interface") { @@ -53,12 +54,9 @@ exports.searchPaths = function(name, binaryType, releaseType) { var componentsPath = appPath + "/Contents/MacOS/Components.app/Contents/MacOS/"; paths.push(componentsPath + name + extension); - // check beside the app bundle for the binaries - paths.push(path.join(path.dirname(appPath), name + extension)); - - // check in the peer bundle for the binaries - paths.push(path.join("..", name + extension)); } + // check beside the app bundle for the binaries + paths.push(path.join(path.dirname(app.getAppPath()), "../../..", name + extension)); } } From 9e0d35e40d4b02f1bb51b21e94874c39e94e3700 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 14:28:10 -0700 Subject: [PATCH 058/157] Combine PickScriptingInterface::getPickJointState and createTransformNode into one function --- .../src/raypick/PickScriptingInterface.cpp | 126 ++++++++---------- .../src/raypick/PickScriptingInterface.h | 3 +- 2 files changed, 53 insertions(+), 76 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 7de69b537d..2e8f790da5 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -98,8 +98,7 @@ unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) { } auto rayPick = std::make_shared(position, direction, filter, maxDistance, enabled); - rayPick->parentTransform = createTransformNode(propMap); - rayPick->setJointState(getPickJointState(propMap)); + setParentTransform(rayPick, propMap); return DependencyManager::get()->addPick(PickQuery::Ray, rayPick); } @@ -224,8 +223,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti auto parabolaPick = std::make_shared(position, direction, speed, accelerationAxis, rotateAccelerationWithAvatar, rotateAccelerationWithParent, scaleWithParent, filter, maxDistance, enabled); - parabolaPick->parentTransform = createTransformNode(propMap); - parabolaPick->setJointState(getPickJointState(propMap)); + setParentTransform(parabolaPick, propMap); return DependencyManager::get()->addPick(PickQuery::Parabola, parabolaPick); } @@ -277,8 +275,7 @@ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& propert CollisionRegion collisionRegion(propMap); auto collisionPick = std::make_shared(filter, maxDistance, enabled, collisionRegion, qApp->getPhysicsEngine()); - collisionPick->parentTransform = createTransformNode(propMap); - collisionPick->setJointState(getPickJointState(propMap)); + setParentTransform(collisionPick, propMap); return DependencyManager::get()->addPick(PickQuery::Collision, collisionPick); } @@ -355,82 +352,63 @@ void PickScriptingInterface::setPerFrameTimeBudget(unsigned int numUsecs) { DependencyManager::get()->setPerFrameTimeBudget(numUsecs); } -PickQuery::JointState PickScriptingInterface::getPickJointState(const QVariantMap& propMap) { +void PickScriptingInterface::setParentTransform(std::shared_ptr pick, const QVariantMap& propMap) { + QUuid parentUuid; + int parentJointIndex = 0; + auto myAvatar = DependencyManager::get()->getMyAvatar(); + if (propMap["parentID"].isValid()) { - QUuid parentUuid = propMap["parentID"].toUuid(); - if (propMap["parentJointIndex"].isValid() && parentUuid == DependencyManager::get()->getMyAvatar()->getSessionUUID()) { - int jointIndex = propMap["parentJointIndes"].toInt(); - if (jointIndex == CONTROLLER_LEFTHAND_INDEX || jointIndex == CAMERA_RELATIVE_CONTROLLER_LEFTHAND_INDEX) { - return PickQuery::JOINT_STATE_LEFT_HAND; - } else if (jointIndex == CONTROLLER_RIGHTHAND_INDEX || jointIndex == CAMERA_RELATIVE_CONTROLLER_RIGHTHAND_INDEX) { - return PickQuery::JOINT_STATE_RIGHT_HAND; - } else { - return PickQuery::JOINT_STATE_NONE; - } - } else { - return PickQuery::JOINT_STATE_NONE; + parentUuid = propMap["parentID"].toUuid(); + if (propMap["parentJointIndex"].isValid()) { + parentJointIndex = propMap["parentJointIndex"].toInt(); } } else if (propMap["joint"].isValid()) { QString joint = propMap["joint"].toString(); if (joint == "Mouse") { - return PickQuery::JOINT_STATE_MOUSE; - } else if (joint == "_CONTROLLER_LEFTHAND" || joint == "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND") { - return PickQuery::JOINT_STATE_LEFT_HAND; - } else if (joint== "_CONTROLLER_RIGHTHAND" || joint == "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND") { - return PickQuery::JOINT_STATE_RIGHT_HAND; + pick->parentTransform = std::make_shared(); + pick->setJointState(PickQuery::JOINT_STATE_MOUSE); + return; + } else if (joint == "Avatar") { + pick->parentTransform = std::make_shared(); + return; } else { - return PickQuery::JOINT_STATE_NONE; + parentUuid = myAvatar->getSessionUUID(); + parentJointIndex = myAvatar->getJointIndex(joint); + } + } + + if (parentUuid == myAvatar->getSessionUUID()) { + if (parentJointIndex == CONTROLLER_LEFTHAND_INDEX || parentJointIndex == CAMERA_RELATIVE_CONTROLLER_LEFTHAND_INDEX) { + pick->setJointState(PickQuery::JOINT_STATE_LEFT_HAND); + } else if (parentJointIndex == CONTROLLER_RIGHTHAND_INDEX || parentJointIndex == CAMERA_RELATIVE_CONTROLLER_RIGHTHAND_INDEX) { + pick->setJointState(PickQuery::JOINT_STATE_RIGHT_HAND); + } + + pick->parentTransform = std::make_shared(myAvatar, parentJointIndex); + } else if (!parentUuid.isNull()) { + // Infer object type from parentID + // For now, assume a QUuid is a SpatiallyNestable. This should change when picks are converted over to QUuids. + bool success; + std::weak_ptr nestablePointer = DependencyManager::get()->find(parentUuid, success, nullptr); + auto sharedNestablePointer = nestablePointer.lock(); + + if (success && sharedNestablePointer) { + NestableType nestableType = sharedNestablePointer->getNestableType(); + if (nestableType == NestableType::Avatar) { + pick->parentTransform = std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } else if (nestableType == NestableType::Overlay) { + pick->parentTransform = std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } else if (nestableType == NestableType::Entity) { + pick->parentTransform = std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } else { + pick->parentTransform = std::make_shared(nestablePointer, parentJointIndex); + } } } else { - return PickQuery::JOINT_STATE_NONE; - } -} - -std::shared_ptr PickScriptingInterface::createTransformNode(const QVariantMap& propMap) { - if (propMap["parentID"].isValid()) { - QUuid parentUuid = propMap["parentID"].toUuid(); - if (!parentUuid.isNull()) { - // Infer object type from parentID - // For now, assume a QUuuid is a SpatiallyNestable. This should change when picks are converted over to QUuids. - bool success; - std::weak_ptr nestablePointer = DependencyManager::get()->find(parentUuid, success, nullptr); - int parentJointIndex = 0; - if (propMap["parentJointIndex"].isValid()) { - parentJointIndex = propMap["parentJointIndex"].toInt(); - } - auto sharedNestablePointer = nestablePointer.lock(); - if (success && sharedNestablePointer) { - NestableType nestableType = sharedNestablePointer->getNestableType(); - if (nestableType == NestableType::Avatar) { - return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); - } else if (nestableType == NestableType::Overlay) { - return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); - } else if (nestableType == NestableType::Entity) { - return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); - } else { - return std::make_shared(nestablePointer, parentJointIndex); - } - } - } - unsigned int pickID = propMap["parentID"].toUInt(); - if (pickID != 0) { - return std::make_shared(pickID); - } - } - - if (propMap["joint"].isValid()) { - QString joint = propMap["joint"].toString(); - if (joint == "Mouse") { - return std::make_shared(); - } else if (joint == "Avatar") { - return std::make_shared(); - } else if (!joint.isNull()) { - auto myAvatar = DependencyManager::get()->getMyAvatar(); - int jointIndex = myAvatar->getJointIndex(joint); - return std::make_shared(myAvatar, jointIndex); - } - } - return std::shared_ptr(); + if (pickID != 0) { + pick->parentTransform = std::make_shared(pickID); + } + } } \ No newline at end of file diff --git a/interface/src/raypick/PickScriptingInterface.h b/interface/src/raypick/PickScriptingInterface.h index 224f7a547e..94112d5fae 100644 --- a/interface/src/raypick/PickScriptingInterface.h +++ b/interface/src/raypick/PickScriptingInterface.h @@ -320,8 +320,7 @@ public slots: static constexpr unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; } protected: - static PickQuery::JointState getPickJointState(const QVariantMap& propMap); - static std::shared_ptr createTransformNode(const QVariantMap& propMap); + static void setParentTransform(std::shared_ptr pick, const QVariantMap& propMap); }; #endif // hifi_PickScriptingInterface_h From bfa270375a891ea0292138f8108106988a67824f Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 14:33:29 -0700 Subject: [PATCH 059/157] Simplify PickRay calculations in RayPick::getMathematicalPick --- interface/src/raypick/RayPick.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/raypick/RayPick.cpp b/interface/src/raypick/RayPick.cpp index 07e583ea1b..227b4e2f32 100644 --- a/interface/src/raypick/RayPick.cpp +++ b/interface/src/raypick/RayPick.cpp @@ -21,9 +21,9 @@ PickRay RayPick::getMathematicalPick() const { } Transform currentParentTransform = parentTransform->getTransform(); - Transform relativeTransform(rotationBetween(Vectors::UP, _mathPick.direction), glm::vec3(1.0f), _mathPick.origin); - Transform pickTransform = currentParentTransform.worldTransform(relativeTransform); - return PickRay(pickTransform.getTranslation(), pickTransform.getRotation() * Vectors::UP); + glm::vec3 origin = currentParentTransform.transform(_mathPick.origin); + glm::vec3 direction = currentParentTransform.transformDirection(_mathPick.direction); + return PickRay(origin, direction); } PickResultPointer RayPick::getEntityIntersection(const PickRay& pick) { From c3df7103962d671fac948ba85cb3a43e93001bef Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 14:34:36 -0700 Subject: [PATCH 060/157] Use bracket default initialization for PickQuery::_jointState --- libraries/pointers/src/Pick.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/pointers/src/Pick.h b/libraries/pointers/src/Pick.h index 2ae1048249..0354e81163 100644 --- a/libraries/pointers/src/Pick.h +++ b/libraries/pointers/src/Pick.h @@ -236,7 +236,7 @@ private: QVector _ignoreItems; QVector _includeItems; - JointState _jointState = JOINT_STATE_NONE; + JointState _jointState { JOINT_STATE_NONE }; }; Q_DECLARE_METATYPE(PickQuery::PickType) From 74937a1979a5d4700ccd1384cdfbe92b32e7171f Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 14:41:38 -0700 Subject: [PATCH 061/157] Serialize PickRay according to its variables --- libraries/shared/src/RegisteredMetaTypes.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index 58b99bc0f7..f4624686ab 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -178,9 +178,7 @@ public: QVariantMap toVariantMap() const override { QVariantMap pickRay; pickRay["origin"] = vec3toVariant(origin); - pickRay["position"] = vec3toVariant(origin); pickRay["direction"] = vec3toVariant(direction); - pickRay["orientation"] = quatToVariant(rotationBetween(Vectors::UP, direction)); return pickRay; } }; From c1c853790b3b4e98f62d04f0885fc7c1c8fea046 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 27 Sep 2018 14:53:28 -0700 Subject: [PATCH 062/157] update soft entities and fix deadlock --- .../qml/hifi/avatarapp/AdjustWearables.qml | 20 +++++++++++++++++++ .../src/avatars-renderer/Avatar.cpp | 8 ++++++-- .../entities/src/EntityScriptingInterface.cpp | 10 ++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml index 5bf867a331..d4a574411e 100644 --- a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml +++ b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml @@ -100,6 +100,21 @@ Rectangle { wearablesModel.setProperty(wearableIndex, 'properties', wearableModelItemProperties); } + function entityHasAvatarJoints(entityID) { + console.log(entityID); + var hasAvatarJoint = false; + var entityJointNames = Entities.getJointNames(entityID); + for (var index = 0; index < entityJointNames.length; index++) { + var avatarJointIndex = MyAvatar.getJointIndex(entityJointNames[index]); + if (avatarJointIndex >= 0) { + hasAvatarJoint = true; + break; + } + } + + return hasAvatarJoint; + } + function getCurrentWearable() { return wearablesCombobox.currentIndex !== -1 ? wearablesCombobox.model.get(wearablesCombobox.currentIndex) : null; } @@ -109,6 +124,7 @@ Rectangle { var wearable = wearablesCombobox.model.get(i); if (wearable.id === entityID) { wearablesCombobox.currentIndex = i; + isSoft.enabled = entityHasAvatarJoints(entityID); break; } } @@ -248,12 +264,16 @@ Rectangle { var scale = currentWearable ? currentWearable.dimensions.x / currentWearable.naturalDimensions.x : 1.0; var joint = currentWearable ? currentWearable.parentJointIndex : -1; var soft = currentWearable ? currentWearable.relayParentJoints : false; + var softEnabled = currentWearable ? entityHasAvatarJoints(currentWearable.id) : false; + positionVector.set(position); rotationVector.set(rotation); scalespinner.set(scale); jointsCombobox.set(joint); isSoft.set(soft); + isSoft.enabled = softEnabled; + if (currentWearable) { wearableSelected(currentWearable.id); diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 914a3b7c6e..57d44bd9bb 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -436,9 +436,13 @@ void Avatar::relayJointDataToChildren() { modelEntity->setLocalJointTranslation(jointIndex, jointTranslation); } } + + Transform finalTransform; Transform avatarTransform = _skeletonModel->getTransform(); - avatarTransform.setScale(_skeletonModel->getScale()); - modelEntity->setOverrideTransform(avatarTransform, _skeletonModel->getOffset()); + Transform entityTransform = modelEntity->getLocalTransform(); + Transform::mult(finalTransform, avatarTransform, entityTransform); + finalTransform.setScale(_skeletonModel->getScale()); + modelEntity->setOverrideTransform(finalTransform, _skeletonModel->getOffset()); modelEntity->simulateRelayedJoints(); } } diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 8f0fde5c9a..f05971e9d7 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -1626,8 +1626,9 @@ int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString return -1; } int result; - BLOCKING_INVOKE_METHOD(_entityTree.get(), "getJointIndex", - Q_RETURN_ARG(int, result), Q_ARG(QUuid, entityID), Q_ARG(QString, name)); + _entityTree->withReadLock([&] { + result = _entityTree->getJointIndex(entityID, name); + }); return result; } @@ -1636,8 +1637,9 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) { return QStringList(); } QStringList result; - BLOCKING_INVOKE_METHOD(_entityTree.get(), "getJointNames", - Q_RETURN_ARG(QStringList, result), Q_ARG(QUuid, entityID)); + _entityTree->withReadLock([&] { + result = _entityTree->getJointNames(entityID); + }); return result; } From c3e956932bc652acb0081694a4ad0d2bcf2ca4b9 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 15:22:04 -0700 Subject: [PATCH 063/157] Fix OSX Build --- server-console/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index df51409151..b47a46e596 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -33,12 +33,12 @@ endif () # install the packaged Server Console in our install directory if (APPLE) install( - PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} ) install( - PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${CLIENT_COMPONENT} ) From 6d0996c254298c78809299cbdc0e9c6c03568729 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 16:52:03 -0700 Subject: [PATCH 064/157] Show "Sandbox" as the server component for server installs, show "Console" for client-only installs --- cmake/macros/GenerateInstallers.cmake | 6 +- cmake/macros/SetPackagingParameters.cmake | 5 +- cmake/templates/NSIS.template.in | 91 ++++++++++++++++------- 3 files changed, 72 insertions(+), 30 deletions(-) diff --git a/cmake/macros/GenerateInstallers.cmake b/cmake/macros/GenerateInstallers.cmake index 64919172f7..acafd9b6c7 100644 --- a/cmake/macros/GenerateInstallers.cmake +++ b/cmake/macros/GenerateInstallers.cmake @@ -20,9 +20,9 @@ macro(GENERATE_INSTALLERS) set(INSTALLER_TYPE "client_only") string(REGEX REPLACE "High Fidelity" "High Fidelity Interface" _DISPLAY_NAME ${BUILD_ORGANIZATION}) elseif (SERVER_ONLY) - set(_PACKAGE_NAME_EXTRA "-Console") + set(_PACKAGE_NAME_EXTRA "-Sandbox") set(INSTALLER_TYPE "server_only") - string(REGEX REPLACE "High Fidelity" "High Fidelity Console" _DISPLAY_NAME ${BUILD_ORGANIZATION}) + string(REGEX REPLACE "High Fidelity" "High Fidelity Sandbox" _DISPLAY_NAME ${BUILD_ORGANIZATION}) else () set(_DISPLAY_NAME ${BUILD_ORGANIZATION}) set(INSTALLER_TYPE "full") @@ -122,7 +122,7 @@ macro(GENERATE_INSTALLERS) endif () if (BUILD_SERVER) - cpack_add_component(${SERVER_COMPONENT} DISPLAY_NAME "High Fidelity Console") + cpack_add_component(${SERVER_COMPONENT} DISPLAY_NAME "High Fidelity Sandbox") endif () include(CPack) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index aaba3bc201..f67f6526cf 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -177,15 +177,18 @@ macro(SET_PACKAGING_PARAMETERS) if (PRODUCTION_BUILD) set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface") set(CONSOLE_SHORTCUT_NAME "High Fidelity Console") + set(SANDBOX_SHORTCUT_NAME "High Fidelity Sandbox") set(APP_USER_MODEL_ID "com.highfidelity.console") else () set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface - ${BUILD_VERSION_NO_SHA}") set(CONSOLE_SHORTCUT_NAME "High Fidelity Console - ${BUILD_VERSION_NO_SHA}") + set(SANDBOX_SHORTCUT_NAME "High Fidelity Sandbox - ${BUILD_VERSION_NO_SHA}") endif () set(INTERFACE_HF_SHORTCUT_NAME "${INTERFACE_SHORTCUT_NAME}") set(CONSOLE_HF_SHORTCUT_NAME "${CONSOLE_SHORTCUT_NAME}") - + set(SANDBOX_HF_SHORTCUT_NAME "${SANDBOX_SHORTCUT_NAME}") + set(PRE_SANDBOX_INTERFACE_SHORTCUT_NAME "High Fidelity") set(PRE_SANDBOX_CONSOLE_SHORTCUT_NAME "Server Console") diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index b7564f45e5..d1a32245bb 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -770,29 +770,54 @@ Function PostInstallOptionsPage ${EndIf} ${EndIf} - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @CONSOLE_HF_SHORTCUT_NAME@" - Pop $DesktopConsoleCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 + ${If} @SERVER_COMPONENT_CONDITIONAL@ + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @SANDBOX_HF_SHORTCUT_NAME@" + Pop $DesktopConsoleCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ after install" - Pop $LaunchConsoleNowCheckbox + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @SANDBOX_HF_SHORTCUT_NAME@ after install" + Pop $LaunchConsoleNowCheckbox - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} - ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE - ${IfNot} $substringResult == "" - ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} + ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE + ${IfNot} $substringResult == "" + ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} + ${EndIf} + + IntOp $CurrentOffset $CurrentOffset + 15 + + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @SANDBOX_HF_SHORTCUT_NAME@ on startup" + Pop $ConsoleStartupCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} + ${Else} + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @CONSOLE_HF_SHORTCUT_NAME@" + Pop $DesktopConsoleCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 + + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ after install" + Pop $LaunchConsoleNowCheckbox + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} + ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE + ${IfNot} $substringResult == "" + ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} + ${EndIf} + + IntOp $CurrentOffset $CurrentOffset + 15 + + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ on startup" + Pop $ConsoleStartupCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} ${EndIf} - IntOp $CurrentOffset $CurrentOffset + 15 - - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ on startup" - Pop $ConsoleStartupCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Perform a clean install (Delete older settings and content)" Pop $CleanInstallCheckbox IntOp $CurrentOffset $CurrentOffset + 15 @@ -893,14 +918,26 @@ FunctionEnd Function HandlePostInstallOptions - ; check if the user asked for a desktop shortcut to the console - ${If} $DesktopConsoleState == ${BST_CHECKED} - CreateShortCut "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" - !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES - ; Set appUserModelId - ApplicationID::Set "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${If} @SERVER_COMPONENT_CONDITIONAL@ + ; check if the user asked for a desktop shortcut to the console + ${If} $DesktopConsoleState == ${BST_CHECKED} + CreateShortCut "$DESKTOP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" + !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES + ; Set appUserModelId + ApplicationID::Set "$DESKTOP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${Else} + !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ NO + ${EndIf} ${Else} - !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ NO + ; check if the user asked for a desktop shortcut to the console + ${If} $DesktopConsoleState == ${BST_CHECKED} + CreateShortCut "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" + !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES + ; Set appUserModelId + ApplicationID::Set "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${Else} + !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ NO + ${EndIf} ${EndIf} ${If} @CLIENT_COMPONENT_CONDITIONAL@ @@ -1371,10 +1408,12 @@ Section "Uninstall" Delete "$SMPROGRAMS\$MUI_TEMP\@CONSOLE_SHORTCUT_NAME@.lnk" Delete "$DESKTOP\@INTERFACE_HF_SHORTCUT_NAME@.lnk" Delete "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" + Delete "$DESKTOP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" ; if it exists, delete the startup shortcut for the current user SetShellVarContext current Delete "$SMSTARTUP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" + Delete "$SMSTARTUP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" SetShellVarContext all @CPACK_NSIS_DELETE_ICONS@ From 8b29f7c2944d45c742eece967ab58e362cdc9bf2 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 16:56:45 -0700 Subject: [PATCH 065/157] making text box smaller for no occlusion --- scripts/system/redirectOverlays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 66b338e49c..4de9ee354c 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -26,7 +26,7 @@ } }; - var oopsDimensions = {x: 4.2, y: 1}; + var oopsDimensions = {x: 4.2, y: 0.8}; var redirectOopsText = Overlays.addOverlay("text3d", { name: "oopsText", From 5d27cddab5d42801b390ab1e5730381424469233 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 17:16:18 -0700 Subject: [PATCH 066/157] consolidating getting oops message --- scripts/system/redirectOverlays.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 4de9ee354c..b4a89a7a4e 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -18,7 +18,10 @@ function getOopsText() { var error = Window.getLastDomainConnectionError(); var errorMessageMapIndex = hardRefusalErrors.indexOf(error); - if (errorMessageMapIndex >= 0) { + if (error === -1) { + // not an error. + return ""; + } else if (errorMessageMapIndex >= 0) { return ERROR_MESSAGE_MAP[errorMessageMapIndex]; } else { // some other text. @@ -71,9 +74,6 @@ parentID: redirectOopsText }); - var TARGET_UPDATE_HZ = 60; - var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ; - function toggleOverlays(isInErrorState) { if (!isInErrorState) { var properties = { @@ -85,19 +85,9 @@ Overlays.editOverlay(backImage, properties); return; } - var overlaysVisible = false; - var error = Window.getLastDomainConnectionError(); - var errorMessageMapIndex = hardRefusalErrors.indexOf(error); - var oopsText = ""; - if (error === -1) { - overlaysVisible = false; - } else if (errorMessageMapIndex >= 0) { - overlaysVisible = true; - oopsText = ERROR_MESSAGE_MAP[errorMessageMapIndex]; - } else { - overlaysVisible = true; - oopsText = ERROR_MESSAGE_MAP[4]; - } + var oopsText = getOopsText(); + // if oopsText === "", it was a success. + var overlaysVisible = (oopsText !== ""); var properties = { visible: overlaysVisible }; From 215818e31353de09428d7e05f3084d16dfaecde0 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 27 Sep 2018 17:18:43 -0700 Subject: [PATCH 067/157] adjusting page size but still seeing a perf drop --- libraries/graphics/src/graphics/Material.cpp | 6 +++--- libraries/render-utils/src/LightingModel.cpp | 2 +- libraries/render-utils/src/Model.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/graphics/src/graphics/Material.cpp b/libraries/graphics/src/graphics/Material.cpp index ccfae2a570..ab890cecca 100755 --- a/libraries/graphics/src/graphics/Material.cpp +++ b/libraries/graphics/src/graphics/Material.cpp @@ -24,7 +24,7 @@ Material::Material() : { // created from nothing: create the Buffer to store the properties Schema schema; - _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); + _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema, sizeof(Schema))); } Material::Material(const Material& material) : @@ -34,7 +34,7 @@ Material::Material(const Material& material) : { // copied: create the Buffer to store the properties, avoid holding a ref to the old Buffer Schema schema; - _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); + _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema, sizeof(Schema))); _schemaBuffer.edit() = material._schemaBuffer.get(); } @@ -49,7 +49,7 @@ Material& Material::operator= (const Material& material) { // copied: create the Buffer to store the properties, avoid holding a ref to the old Buffer Schema schema; - _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema)); + _schemaBuffer = gpu::BufferView(std::make_shared(sizeof(Schema), (const gpu::Byte*) &schema, sizeof(Schema))); _schemaBuffer.edit() = material._schemaBuffer.get(); return (*this); diff --git a/libraries/render-utils/src/LightingModel.cpp b/libraries/render-utils/src/LightingModel.cpp index 3781d0e0b1..05002a5daf 100644 --- a/libraries/render-utils/src/LightingModel.cpp +++ b/libraries/render-utils/src/LightingModel.cpp @@ -12,7 +12,7 @@ LightingModel::LightingModel() { Parameters parameters; - _parametersBuffer = gpu::BufferView(std::make_shared(sizeof(Parameters), (const gpu::Byte*) ¶meters)); + _parametersBuffer = gpu::BufferView(std::make_shared(sizeof(Parameters), (const gpu::Byte*) ¶meters, sizeof(Parameters))); } void LightingModel::setUnlit(bool enable) { diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index e36a7d58ff..c15f3bf2c1 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1721,7 +1721,7 @@ void Model::initializeBlendshapes(const FBXMesh& mesh, int index) { // Mesh has blendshape, let s allocate the local buffer if not done yet if (_blendshapeBuffers.find(index) == _blendshapeBuffers.end()) { QVector blendshapeOffset; - blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size()); + blendshapeOffset.fill(BlendshapeOffset(), mesh.vertices.size()); const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset); _blendshapeBuffers[index] = std::make_shared(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData(), blendshapeOffsetsSize); _blendshapeOffsets[index] = blendshapeOffset; From eb97f0d19380123073a25365ce7ec1d0354e3bc1 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 27 Sep 2018 17:27:55 -0700 Subject: [PATCH 068/157] Bringing back packed normal and tangents for static mesh! --- libraries/fbx/src/FBX.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fbx/src/FBX.h b/libraries/fbx/src/FBX.h index 3eb963550e..fdebb16bc8 100644 --- a/libraries/fbx/src/FBX.h +++ b/libraries/fbx/src/FBX.h @@ -31,7 +31,7 @@ #if defined(Q_OS_ANDROID) #define FBX_PACK_NORMALS 0 #else -#define FBX_PACK_NORMALS 0 +#define FBX_PACK_NORMALS 1 #endif #if FBX_PACK_NORMALS From bc861c1368e736a76c64674e66809dff0b2cb6e6 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 16:20:19 -0700 Subject: [PATCH 069/157] Make path pointers use scaleWithParent behind the scenes instead of scaleWithAvatar --- interface/src/raypick/LaserPointer.cpp | 21 ++++++++++---------- interface/src/raypick/LaserPointer.h | 9 ++------- interface/src/raypick/ParabolaPointer.cpp | 6 +++--- interface/src/raypick/ParabolaPointer.h | 8 ++------ interface/src/raypick/PathPointer.cpp | 24 +++++++++++++---------- interface/src/raypick/PathPointer.h | 10 +++++++--- libraries/pointers/src/PickManager.cpp | 11 +++++++++++ libraries/pointers/src/PickManager.h | 1 + 8 files changed, 50 insertions(+), 40 deletions(-) diff --git a/interface/src/raypick/LaserPointer.cpp b/interface/src/raypick/LaserPointer.cpp index 5fbe3a90b5..e5d76483df 100644 --- a/interface/src/raypick/LaserPointer.cpp +++ b/interface/src/raypick/LaserPointer.cpp @@ -14,13 +14,14 @@ #include "avatar/AvatarManager.h" #include +#include "PickManager.h" #include "RayPick.h" LaserPointer::LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, bool faceAvatar, bool followNormal, float followNormalTime, bool centerEndY, bool lockEnd, - bool distanceScaleEnd, bool scaleWithAvatar, bool enabled) : + bool distanceScaleEnd, bool scaleWithParent, bool enabled) : PathPointer(PickQuery::Ray, rayProps, renderStates, defaultRenderStates, hover, triggers, faceAvatar, followNormal, followNormalTime, - centerEndY, lockEnd, distanceScaleEnd, scaleWithAvatar, enabled) + centerEndY, lockEnd, distanceScaleEnd, scaleWithParent, enabled) { } @@ -28,9 +29,9 @@ void LaserPointer::editRenderStatePath(const std::string& state, const QVariant& auto renderState = std::static_pointer_cast(_renderStates[state]); if (renderState) { updateRenderStateOverlay(renderState->getPathID(), pathProps); - QVariant lineWidth = pathProps.toMap()["lineWidth"]; - if (lineWidth.isValid()) { - renderState->setLineWidth(lineWidth.toFloat()); + QVariant pathWidth = pathProps.toMap()["lineWidth"]; + if (pathWidth.isValid()) { + renderState->setPathWidth(pathWidth.toFloat()); } } } @@ -117,7 +118,7 @@ LaserPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID { if (!_pathID.isNull()) { _pathIgnoreRays = qApp->getOverlays().getProperty(_pathID, "ignoreRayIntersection").value.toBool(); - _lineWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat(); + _pathWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat(); } } @@ -138,9 +139,9 @@ void LaserPointer::RenderState::disable() { } } -void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY, +void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) { - StartEndRenderState::update(origin, end, surfaceNormal, scaleWithAvatar, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult); + StartEndRenderState::update(origin, end, surfaceNormal, parentScale, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult); QVariant endVariant = vec3toVariant(end); if (!getPathID().isNull()) { QVariantMap pathProps; @@ -148,9 +149,7 @@ void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& pathProps.insert("end", endVariant); pathProps.insert("visible", true); pathProps.insert("ignoreRayIntersection", doesPathIgnoreRays()); - if (scaleWithAvatar) { - pathProps.insert("lineWidth", getLineWidth() * DependencyManager::get()->getMyAvatar()->getSensorToWorldScale()); - } + pathProps.insert("lineWidth", getPathWidth() * parentScale); qApp->getOverlays().editOverlay(getPathID(), pathProps); } } diff --git a/interface/src/raypick/LaserPointer.h b/interface/src/raypick/LaserPointer.h index c0ac3259d9..e5c195f9d4 100644 --- a/interface/src/raypick/LaserPointer.h +++ b/interface/src/raypick/LaserPointer.h @@ -24,23 +24,18 @@ public: const OverlayID& getPathID() const { return _pathID; } const bool& doesPathIgnoreRays() const { return _pathIgnoreRays; } - void setLineWidth(const float& lineWidth) { _lineWidth = lineWidth; } - const float& getLineWidth() const { return _lineWidth; } - void cleanup() override; void disable() override; - void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY, + void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override; private: OverlayID _pathID; bool _pathIgnoreRays; - - float _lineWidth; }; LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, - bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, bool distanceScaleEnd, bool scaleWithAvatar, bool enabled); + bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, bool distanceScaleEnd, bool scaleWithParent, bool enabled); QVariantMap toVariantMap() const override; diff --git a/interface/src/raypick/ParabolaPointer.cpp b/interface/src/raypick/ParabolaPointer.cpp index ad698c409b..71e4caeb76 100644 --- a/interface/src/raypick/ParabolaPointer.cpp +++ b/interface/src/raypick/ParabolaPointer.cpp @@ -190,9 +190,9 @@ void ParabolaPointer::RenderState::editParabola(const glm::vec3& color, float al } } -void ParabolaPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY, +void ParabolaPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) { - StartEndRenderState::update(origin, end, surfaceNormal, scaleWithAvatar, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult); + StartEndRenderState::update(origin, end, surfaceNormal, parentScale, distanceScaleEnd, centerEndY, faceAvatar, followNormal, followNormalStrength, distance, pickResult); auto parabolaPickResult = std::static_pointer_cast(pickResult); if (parabolaPickResult && render::Item::isValidID(_pathID)) { render::Transaction transaction; @@ -202,7 +202,7 @@ void ParabolaPointer::RenderState::update(const glm::vec3& origin, const glm::ve glm::vec3 velocity = parabola.velocity; glm::vec3 acceleration = parabola.acceleration; float parabolicDistance = distance > 0.0f ? distance : parabolaPickResult->parabolicDistance; - float width = scaleWithAvatar ? getPathWidth() * DependencyManager::get()->getMyAvatar()->getSensorToWorldScale() : getPathWidth(); + float width = getPathWidth() * parentScale; transaction.updateItem(_pathID, [origin, velocity, acceleration, parabolicDistance, width](ParabolaRenderItem& item) { item.setVisible(true); item.setOrigin(origin); diff --git a/interface/src/raypick/ParabolaPointer.h b/interface/src/raypick/ParabolaPointer.h index 526abe3b0d..e4394bc509 100644 --- a/interface/src/raypick/ParabolaPointer.h +++ b/interface/src/raypick/ParabolaPointer.h @@ -76,22 +76,18 @@ public: }; RenderState() {} - RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth, + RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float parentScale, bool isVisibleInSecondaryCamera, bool pathEnabled); - void setPathWidth(float width) { _pathWidth = width; } - float getPathWidth() const { return _pathWidth; } - void cleanup() override; void disable() override; - void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY, + void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override; void editParabola(const glm::vec3& color, float alpha, float width, bool isVisibleInSecondaryCamera, bool enabled); private: int _pathID; - float _pathWidth; }; ParabolaPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, diff --git a/interface/src/raypick/PathPointer.cpp b/interface/src/raypick/PathPointer.cpp index 0301136bfa..6cc3dfba56 100644 --- a/interface/src/raypick/PathPointer.cpp +++ b/interface/src/raypick/PathPointer.cpp @@ -17,7 +17,7 @@ PathPointer::PathPointer(PickQuery::PickType type, const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, - bool distanceScaleEnd, bool scaleWithAvatar, bool enabled) : + bool distanceScaleEnd, bool scaleWithParent, bool enabled) : Pointer(DependencyManager::get()->createPick(type, rayProps), enabled, hover), _renderStates(renderStates), _defaultRenderStates(defaultRenderStates), @@ -28,7 +28,7 @@ PathPointer::PathPointer(PickQuery::PickType type, const QVariant& rayProps, con _centerEndY(centerEndY), _lockEnd(lockEnd), _distanceScaleEnd(distanceScaleEnd), - _scaleWithAvatar(scaleWithAvatar) + _scaleWithParent(scaleWithParent) { for (auto& state : _renderStates) { if (!enabled || state.first != _currentRenderState) { @@ -146,12 +146,18 @@ void PathPointer::updateVisuals(const PickResultPointer& pickResult) { IntersectionType type = getPickedObjectType(pickResult); auto renderState = _renderStates.find(_currentRenderState); auto defaultRenderState = _defaultRenderStates.find(_currentRenderState); + float parentScale = 1; + if (_enabled && _scaleWithParent) { + glm::vec3 dimensions = DependencyManager::get()->getParentTransform(_pickUID).getScale(); + parentScale = glm::max(glm::max(dimensions.x, dimensions.y), dimensions.z); + } + if (_enabled && !_currentRenderState.empty() && renderState != _renderStates.end() && (type != IntersectionType::NONE || _pathLength > 0.0f)) { glm::vec3 origin = getPickOrigin(pickResult); glm::vec3 end = getPickEnd(pickResult, _pathLength); glm::vec3 surfaceNormal = getPickedObjectNormal(pickResult); - renderState->second->update(origin, end, surfaceNormal, _scaleWithAvatar, _distanceScaleEnd, _centerEndY, _faceAvatar, + renderState->second->update(origin, end, surfaceNormal, parentScale, _distanceScaleEnd, _centerEndY, _faceAvatar, _followNormal, _followNormalStrength, _pathLength, pickResult); if (defaultRenderState != _defaultRenderStates.end() && defaultRenderState->second.second->isEnabled()) { defaultRenderState->second.second->disable(); @@ -162,7 +168,7 @@ void PathPointer::updateVisuals(const PickResultPointer& pickResult) { } glm::vec3 origin = getPickOrigin(pickResult); glm::vec3 end = getPickEnd(pickResult, defaultRenderState->second.first); - defaultRenderState->second.second->update(origin, end, Vectors::UP, _scaleWithAvatar, _distanceScaleEnd, _centerEndY, + defaultRenderState->second.second->update(origin, end, Vectors::UP, parentScale, _distanceScaleEnd, _centerEndY, _faceAvatar, _followNormal, _followNormalStrength, defaultRenderState->second.first, pickResult); } else if (!_currentRenderState.empty()) { if (renderState != _renderStates.end() && renderState->second->isEnabled()) { @@ -281,15 +287,13 @@ void StartEndRenderState::disable() { _enabled = false; } -void StartEndRenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY, +void StartEndRenderState::update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) { if (!getStartID().isNull()) { QVariantMap startProps; startProps.insert("position", vec3toVariant(origin)); startProps.insert("visible", true); - if (scaleWithAvatar) { - startProps.insert("dimensions", vec3toVariant(getStartDim() * DependencyManager::get()->getMyAvatar()->getSensorToWorldScale())); - } + startProps.insert("dimensions", vec3toVariant(getStartDim() * parentScale)); startProps.insert("ignoreRayIntersection", doesStartIgnoreRays()); qApp->getOverlays().editOverlay(getStartID(), startProps); } @@ -300,8 +304,8 @@ void StartEndRenderState::update(const glm::vec3& origin, const glm::vec3& end, if (distanceScaleEnd) { dim = getEndDim() * glm::distance(origin, end); endProps.insert("dimensions", vec3toVariant(dim)); - } else if (scaleWithAvatar) { - dim = getEndDim() * DependencyManager::get()->getMyAvatar()->getSensorToWorldScale(); + } else { + dim = getEndDim() * parentScale; endProps.insert("dimensions", vec3toVariant(dim)); } diff --git a/interface/src/raypick/PathPointer.h b/interface/src/raypick/PathPointer.h index b3638d1f7d..5001d3d1bd 100644 --- a/interface/src/raypick/PathPointer.h +++ b/interface/src/raypick/PathPointer.h @@ -42,9 +42,12 @@ public: void setEndRot(const glm::quat& endRot) { _endRot = endRot; } const glm::quat& getEndRot() const { return _endRot; } + void setPathWidth(float width) { _pathWidth = width; } + float getPathWidth() const { return _pathWidth; } + virtual void cleanup(); virtual void disable(); - virtual void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY, + virtual void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult); bool isEnabled() const { return _enabled; } @@ -58,6 +61,7 @@ protected: glm::vec3 _startDim; glm::vec3 _endDim; glm::quat _endRot; + float _pathWidth; glm::quat _avgEndRot; bool _avgEndRotInitialized { false }; @@ -73,7 +77,7 @@ class PathPointer : public Pointer { public: PathPointer(PickQuery::PickType type, const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, bool faceAvatar, bool followNormal, float followNormalStrength, bool centerEndY, bool lockEnd, - bool distanceScaleEnd, bool scaleWithAvatar, bool enabled); + bool distanceScaleEnd, bool scaleWithParent, bool enabled); virtual ~PathPointer(); void setRenderState(const std::string& state) override; @@ -97,7 +101,7 @@ protected: bool _centerEndY; bool _lockEnd; bool _distanceScaleEnd; - bool _scaleWithAvatar; + bool _scaleWithParent; LockEndObject _lockEndObject; struct TriggerState { diff --git a/libraries/pointers/src/PickManager.cpp b/libraries/pointers/src/PickManager.cpp index f7553cb66e..caa62f3397 100644 --- a/libraries/pointers/src/PickManager.cpp +++ b/libraries/pointers/src/PickManager.cpp @@ -90,6 +90,17 @@ void PickManager::setIncludeItems(unsigned int uid, const QVector& includ } } +Transform PickManager::getParentTransform(unsigned int uid) const { + auto pick = findPick(uid); + if (pick) { + auto parentTransform = pick->parentTransform; + if (parentTransform) { + return parentTransform->getTransform(); + } + } + return Transform(); +} + Transform PickManager::getResultTransform(unsigned int uid) const { auto pick = findPick(uid); if (pick) { diff --git a/libraries/pointers/src/PickManager.h b/libraries/pointers/src/PickManager.h index cf911236a1..9d5971078d 100644 --- a/libraries/pointers/src/PickManager.h +++ b/libraries/pointers/src/PickManager.h @@ -43,6 +43,7 @@ public: void setIgnoreItems(unsigned int uid, const QVector& ignore) const; void setIncludeItems(unsigned int uid, const QVector& include) const; + Transform getParentTransform(unsigned int uid) const; Transform getResultTransform(unsigned int uid) const; bool isLeftHand(unsigned int uid); From 2dd8140158435dde4efe6e02e870d974f71438a9 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 16:37:40 -0700 Subject: [PATCH 070/157] Make scaleWithAvatar an alias for scaleWithParent in PointerScriptingInterface and make true the default for parabola pointers --- .../src/raypick/PointerScriptingInterface.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/interface/src/raypick/PointerScriptingInterface.cpp b/interface/src/raypick/PointerScriptingInterface.cpp index 7209e402a1..1f1bf76d21 100644 --- a/interface/src/raypick/PointerScriptingInterface.cpp +++ b/interface/src/raypick/PointerScriptingInterface.cpp @@ -97,7 +97,8 @@ unsigned int PointerScriptingInterface::createStylus(const QVariant& properties) * @property {boolean} [centerEndY=true] If false, the end of the Pointer will be moved up by half of its height. * @property {boolean} [lockEnd=false] If true, the end of the Pointer will lock on to the center of the object at which the pointer is pointing. * @property {boolean} [distanceScaleEnd=false] If true, the dimensions of the end of the Pointer will scale linearly with distance. - * @property {boolean} [scaleWithAvatar=false] If true, the width of the Pointer's path will scale linearly with your avatar's scale. + * @property {boolean} [scaleWithParent=false] If true, the width of the Pointer's path will scale linearly with the pick parent's scale. + * @property {boolean} [scaleWithAvatar] Alias for scaleWithParent * @property {boolean} [followNormal=false] If true, the end of the Pointer will rotate to follow the normal of the intersected surface. * @property {number} [followNormalStrength=0.0] The strength of the interpolation between the real normal and the visual normal if followNormal is true. 0-1. If 0 or 1, * the normal will follow exactly. @@ -134,9 +135,11 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope distanceScaleEnd = propertyMap["distanceScaleEnd"].toBool(); } - bool scaleWithAvatar = false; - if (propertyMap["scaleWithAvatar"].isValid()) { - scaleWithAvatar = propertyMap["scaleWithAvatar"].toBool(); + bool scaleWithParent = false; + if (propertyMap["scaleWithParent"].isValid()) { + scaleWithParent = propertyMap["scaleWithParent"].toBool(); + } else if (propertyMap["scaleWithAvatar"].isValid()) { + scaleWithParent = propertyMap["scaleWithAvatar"].toBool(); } bool followNormal = false; @@ -207,7 +210,7 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope return DependencyManager::get()->addPointer(std::make_shared(properties, renderStates, defaultRenderStates, hover, triggers, faceAvatar, followNormal, followNormalStrength, centerEndY, lockEnd, - distanceScaleEnd, scaleWithAvatar, enabled)); + distanceScaleEnd, scaleWithParent, enabled)); } /**jsdoc @@ -248,7 +251,8 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope * @property {boolean} [centerEndY=true] If false, the end of the Pointer will be moved up by half of its height. * @property {boolean} [lockEnd=false] If true, the end of the Pointer will lock on to the center of the object at which the pointer is pointing. * @property {boolean} [distanceScaleEnd=false] If true, the dimensions of the end of the Pointer will scale linearly with distance. -* @property {boolean} [scaleWithAvatar=false] If true, the width of the Pointer's path will scale linearly with your avatar's scale. +* @property {boolean} [scaleWithParent=true] If true, the width of the Pointer's path will scale linearly with the pick parent's scale. +* @property {boolean} [scaleWithAvatar] Alias for scaleWithParent * @property {boolean} [followNormal=false] If true, the end of the Pointer will rotate to follow the normal of the intersected surface. * @property {number} [followNormalStrength=0.0] The strength of the interpolation between the real normal and the visual normal if followNormal is true. 0-1. If 0 or 1, * the normal will follow exactly. @@ -285,9 +289,11 @@ unsigned int PointerScriptingInterface::createParabolaPointer(const QVariant& pr distanceScaleEnd = propertyMap["distanceScaleEnd"].toBool(); } - bool scaleWithAvatar = false; - if (propertyMap["scaleWithAvatar"].isValid()) { - scaleWithAvatar = propertyMap["scaleWithAvatar"].toBool(); + bool scaleWithParent = true; + if (propertyMap["scaleWithParent"].isValid()) { + scaleWithParent = propertyMap["scaleWithParent"].toBool(); + } else if (propertyMap["scaleWithAvatar"].isValid()) { + scaleWithParent = propertyMap["scaleWithAvatar"].toBool(); } bool followNormal = false; @@ -358,7 +364,7 @@ unsigned int PointerScriptingInterface::createParabolaPointer(const QVariant& pr return DependencyManager::get()->addPointer(std::make_shared(properties, renderStates, defaultRenderStates, hover, triggers, faceAvatar, followNormal, followNormalStrength, centerEndY, lockEnd, distanceScaleEnd, - scaleWithAvatar, enabled)); + scaleWithParent, enabled)); } void PointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) const { From e1761430258023faa0547a6af50c2933c09e8aac Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 16:39:37 -0700 Subject: [PATCH 071/157] Make scaleWithParent true by default for parabola picks --- interface/src/raypick/PickScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 2e8f790da5..18677fa6e7 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -158,7 +158,7 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties * @property {Vec3} [accelerationAxis=-Vec3.UP] The acceleration of the parabola, i.e. the acceleration of the projectile whose trajectory defines the parabola, both magnitude and direction. * @property {boolean} [rotateAccelerationWithAvatar=true] Whether or not the acceleration axis should rotate with the avatar's local Y axis. * @property {boolean} [rotateAccelerationWithParent=false] Whether or not the acceleration axis should rotate with the parent's local Y axis, if available. - * @property {boolean} [scaleWithParent=false] If true, the velocity and acceleration of the Pick will scale linearly with the parent, if available. + * @property {boolean} [scaleWithParent=true] If true, the velocity and acceleration of the Pick will scale linearly with the parent, if available. * @property {boolean} [scaleWithAvatar] Alias for scaleWithParent. Deprecated. */ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properties) { @@ -199,7 +199,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti rotateAccelerationWithParent = propMap["rotateAccelerationWithParent"].toBool(); } - bool scaleWithParent = false; + bool scaleWithParent = true; if (propMap["scaleWithParent"].isValid()) { scaleWithParent = propMap["scaleWithParent"].toBool(); } else if (propMap["scaleWithAvatar"].isValid()) { From 44efe648e083f7fd80393775424e1897e9f83ca7 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 17:05:31 -0700 Subject: [PATCH 072/157] Add scaleWithParent option to collision pick creation --- interface/src/raypick/CollisionPick.cpp | 15 +++++++++++---- interface/src/raypick/CollisionPick.h | 4 +++- interface/src/raypick/PickScriptingInterface.cpp | 8 +++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp index 5b5ecd09ff..7ea739be06 100644 --- a/interface/src/raypick/CollisionPick.cpp +++ b/interface/src/raypick/CollisionPick.cpp @@ -345,8 +345,9 @@ void CollisionPick::computeShapeInfo(const CollisionRegion& pick, ShapeInfo& sha } } -CollisionPick::CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine) : +CollisionPick::CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, bool scaleWithParent, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine) : Pick(collisionRegion, filter, maxDistance, enabled), + _scaleWithParent(scaleWithParent), _physicsEngine(physicsEngine) { if (collisionRegion.shouldComputeShapeInfo()) { _cachedResource = DependencyManager::get()->getCollisionGeometryResource(collisionRegion.modelURL); @@ -360,9 +361,15 @@ CollisionRegion CollisionPick::getMathematicalPick() const { if (parentTransform) { Transform parentTransformValue = parentTransform->getTransform(); mathPick.transform = parentTransformValue.worldTransform(mathPick.transform); - glm::vec3 scale = parentTransformValue.getScale(); - float largestDimension = glm::max(glm::max(scale.x, scale.y), scale.z); - mathPick.threshold *= largestDimension; + + if (_scaleWithParent) { + glm::vec3 scale = parentTransformValue.getScale(); + float largestDimension = glm::max(glm::max(scale.x, scale.y), scale.z); + mathPick.threshold *= largestDimension; + } else { + // We need to undo parent scaling after-the-fact because the parent's scale was needed to calculate this mathPick's position + mathPick.transform.setScale(_mathPick.transform.getScale()); + } } return mathPick; } diff --git a/interface/src/raypick/CollisionPick.h b/interface/src/raypick/CollisionPick.h index 79238b37fc..67e39e4d72 100644 --- a/interface/src/raypick/CollisionPick.h +++ b/interface/src/raypick/CollisionPick.h @@ -47,7 +47,7 @@ public: class CollisionPick : public Pick { public: - CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine); + CollisionPick(const PickFilter& filter, float maxDistance, bool enabled, bool scaleWithParent, CollisionRegion collisionRegion, PhysicsEnginePointer physicsEngine); CollisionRegion getMathematicalPick() const override; PickResultPointer getDefaultResult(const QVariantMap& pickVariant) const override { @@ -67,6 +67,8 @@ protected: void computeShapeInfoDimensionsOnly(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource); void filterIntersections(std::vector& intersections) const; + bool _scaleWithParent; + PhysicsEnginePointer _physicsEngine; QSharedPointer _cachedResource; diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 18677fa6e7..4218d593aa 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -254,6 +254,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. +* @property {boolean} [scaleWithParent=true] If true, the collision pick's dimensions and threshold will adjust according to the scale of the parent. */ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) { QVariantMap propMap = properties.toMap(); @@ -273,8 +274,13 @@ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& propert maxDistance = propMap["maxDistance"].toFloat(); } + bool scaleWithParent = true; + if (propMap["scaleWithParent"].isValid()) { + scaleWithParent = propMap["scaleWithParent"].toBool(); + } + CollisionRegion collisionRegion(propMap); - auto collisionPick = std::make_shared(filter, maxDistance, enabled, collisionRegion, qApp->getPhysicsEngine()); + auto collisionPick = std::make_shared(filter, maxDistance, enabled, scaleWithParent, collisionRegion, qApp->getPhysicsEngine()); setParentTransform(collisionPick, propMap); return DependencyManager::get()->addPick(PickQuery::Collision, collisionPick); From e7c70705b27ab0e9d0a05c7c6a9e3ba63e4106ab Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 17:07:03 -0700 Subject: [PATCH 073/157] Actually make the result transform of a collision pick just a position, as documented --- interface/src/raypick/CollisionPick.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp index 7ea739be06..25927c5b68 100644 --- a/interface/src/raypick/CollisionPick.cpp +++ b/interface/src/raypick/CollisionPick.cpp @@ -430,5 +430,7 @@ PickResultPointer CollisionPick::getHUDIntersection(const CollisionRegion& pick) } Transform CollisionPick::getResultTransform() const { - return Transform(getMathematicalPick().transform); + Transform transform; + transform.setTranslation(_mathPick.transform.getTranslation()); + return transform; } \ No newline at end of file From 411dbbbad3f424aef1b735c6ec82f6ab00c3b0c0 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 27 Sep 2018 17:14:30 -0700 Subject: [PATCH 074/157] Make scripts use the default scaleWithParent when creating ray/parabola picks --- scripts/system/controllers/controllerDispatcher.js | 8 ++++---- scripts/system/controllers/controllerModules/teleport.js | 8 ++++---- scripts/system/controllers/grab.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/controllerDispatcher.js b/scripts/system/controllers/controllerDispatcher.js index 7a916392b9..f23b61a5b1 100644 --- a/scripts/system/controllers/controllerDispatcher.js +++ b/scripts/system/controllers/controllerDispatcher.js @@ -408,7 +408,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); triggers: [{action: Controller.Standard.LTClick, button: "Focus"}, {action: Controller.Standard.LTClick, button: "Primary"}], posOffset: getGrabPointSphereOffset(Controller.Standard.LeftHand, true), hover: true, - scaleWithAvatar: true, + scaleWithParent: true, distanceScaleEnd: true, hand: LEFT_HAND }); @@ -418,7 +418,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); triggers: [{action: Controller.Standard.RTClick, button: "Focus"}, {action: Controller.Standard.RTClick, button: "Primary"}], posOffset: getGrabPointSphereOffset(Controller.Standard.RightHand, true), hover: true, - scaleWithAvatar: true, + scaleWithParent: true, distanceScaleEnd: true, hand: RIGHT_HAND }); @@ -429,7 +429,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); posOffset: getGrabPointSphereOffset(Controller.Standard.LeftHand, true), triggers: [{action: Controller.Standard.LTClick, button: "Focus"}, {action: Controller.Standard.LTClick, button: "Primary"}], hover: true, - scaleWithAvatar: true, + scaleWithParent: true, distanceScaleEnd: true, hand: LEFT_HAND }); @@ -440,7 +440,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); posOffset: getGrabPointSphereOffset(Controller.Standard.RightHand, true), triggers: [{action: Controller.Standard.RTClick, button: "Focus"}, {action: Controller.Standard.RTClick, button: "Primary"}], hover: true, - scaleWithAvatar: true, + scaleWithParent: true, distanceScaleEnd: true, hand: RIGHT_HAND }); diff --git a/scripts/system/controllers/controllerModules/teleport.js b/scripts/system/controllers/controllerModules/teleport.js index deaa934f99..077d529262 100644 --- a/scripts/system/controllers/controllerModules/teleport.js +++ b/scripts/system/controllers/controllerModules/teleport.js @@ -169,7 +169,7 @@ Script.include("/~/system/libraries/controllers.js"); posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 }, filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, faceAvatar: true, - scaleWithAvatar: true, + scaleWithParent: true, centerEndY: false, speed: speed, accelerationAxis: accelerationAxis, @@ -185,7 +185,7 @@ Script.include("/~/system/libraries/controllers.js"); posOffset: { x: (_this.hand === RIGHT_HAND) ? 0.03 : -0.03, y: 0.2, z: 0.02 }, filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, faceAvatar: true, - scaleWithAvatar: true, + scaleWithParent: true, centerEndY: false, speed: speed, accelerationAxis: accelerationAxis, @@ -198,7 +198,7 @@ Script.include("/~/system/libraries/controllers.js"); joint: "Avatar", filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, faceAvatar: true, - scaleWithAvatar: true, + scaleWithParent: true, centerEndY: false, speed: speed, accelerationAxis: accelerationAxis, @@ -212,7 +212,7 @@ Script.include("/~/system/libraries/controllers.js"); joint: "Avatar", filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_INVISIBLE, faceAvatar: true, - scaleWithAvatar: true, + scaleWithParent: true, centerEndY: false, speed: speed, accelerationAxis: accelerationAxis, diff --git a/scripts/system/controllers/grab.js b/scripts/system/controllers/grab.js index 066ef18c97..48229ac9d9 100644 --- a/scripts/system/controllers/grab.js +++ b/scripts/system/controllers/grab.js @@ -272,7 +272,7 @@ function Grabber() { joint: "Mouse", filter: Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE, faceAvatar: true, - scaleWithAvatar: true, + scaleWithParent: true, enabled: true, renderStates: renderStates }); From 308deeaa8d976cbe8c50a3660fa68154c4e60358 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 19:54:42 -0700 Subject: [PATCH 075/157] Refactoring of NSIS setup files with respect to Sandbox vs Console --- cmake/macros/SetPackagingParameters.cmake | 12 +-- cmake/templates/CPackProperties.cmake.in | 2 + cmake/templates/NSIS.template.in | 97 ++++++++++++----------- server-console/CMakeLists.txt | 5 +- 4 files changed, 59 insertions(+), 57 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index f67f6526cf..30fa37ea14 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -176,18 +176,18 @@ macro(SET_PACKAGING_PARAMETERS) # shortcut names if (PRODUCTION_BUILD) set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface") - set(CONSOLE_SHORTCUT_NAME "High Fidelity Console") - set(SANDBOX_SHORTCUT_NAME "High Fidelity Sandbox") + set(CONSOLE_SHORTCUT_NAME "Console") + set(SANDBOX_SHORTCUT_NAME "Sandbox") set(APP_USER_MODEL_ID "com.highfidelity.console") else () set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface - ${BUILD_VERSION_NO_SHA}") - set(CONSOLE_SHORTCUT_NAME "High Fidelity Console - ${BUILD_VERSION_NO_SHA}") - set(SANDBOX_SHORTCUT_NAME "High Fidelity Sandbox - ${BUILD_VERSION_NO_SHA}") + set(CONSOLE_SHORTCUT_NAME "Console - ${BUILD_VERSION_NO_SHA}") + set(SANDBOX_SHORTCUT_NAME "Sandbox - ${BUILD_VERSION_NO_SHA}") endif () set(INTERFACE_HF_SHORTCUT_NAME "${INTERFACE_SHORTCUT_NAME}") - set(CONSOLE_HF_SHORTCUT_NAME "${CONSOLE_SHORTCUT_NAME}") - set(SANDBOX_HF_SHORTCUT_NAME "${SANDBOX_SHORTCUT_NAME}") + set(CONSOLE_HF_SHORTCUT_NAME "High Fidelity ${CONSOLE_SHORTCUT_NAME}") + set(SANDBOX_HF_SHORTCUT_NAME "High Fidelity ${SANDBOX_SHORTCUT_NAME}") set(PRE_SANDBOX_INTERFACE_SHORTCUT_NAME "High Fidelity") set(PRE_SANDBOX_CONSOLE_SHORTCUT_NAME "Server Console") diff --git a/cmake/templates/CPackProperties.cmake.in b/cmake/templates/CPackProperties.cmake.in index 0a56181138..a38c3d5361 100644 --- a/cmake/templates/CPackProperties.cmake.in +++ b/cmake/templates/CPackProperties.cmake.in @@ -17,6 +17,8 @@ set(CONSOLE_DISPLAY_NAME "Console") set(CONSOLE_INSTALL_SUBDIR "@CONSOLE_INSTALL_DIR@") set(CONSOLE_SHORTCUT_NAME "@CONSOLE_SHORTCUT_NAME@") set(CONSOLE_HF_SHORTCUT_NAME "@CONSOLE_HF_SHORTCUT_NAME@") +set(SANDBOX_SHORTCUT_NAME "@SANDBOX_SHORTCUT_NAME@") +set(SANDBOX_HF_SHORTCUT_NAME "@SANDBOX_HF_SHORTCUT_NAME@") set(CONSOLE_WIN_EXEC_NAME "@CONSOLE_EXEC_NAME@") set(PRE_SANDBOX_INTERFACE_SHORTCUT_NAME "@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@") set(PRE_SANDBOX_CONSOLE_SHORTCUT_NAME "@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@") diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index d1a32245bb..b67cdf3eea 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -754,13 +754,21 @@ Function PostInstallOptionsPage !insertmacro SetInstallOption $DesktopClientCheckbox @CLIENT_DESKTOP_SHORTCUT_REG_KEY@ ${BST_CHECKED} ${EndIf} + ${If} @SERVER_COMPONENT_CONDITIONAL@ + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @SANDBOX_HF_SHORTCUT_NAME@" + ${Else} + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @CONSOLE_HF_SHORTCUT_NAME@" + ${EndIf} + + Pop $DesktopConsoleCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 ; set the checkbox state depending on what is present in the registry !insertmacro SetInstallOption $DesktopConsoleCheckbox @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ ${BST_UNCHECKED} ${If} @CLIENT_COMPONENT_CONDITIONAL@ ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @INTERFACE_HF_SHORTCUT_NAME@ after install" Pop $LaunchClientNowCheckbox - IntOp $CurrentOffset $CurrentOffset + 30 + IntOp $CurrentOffset $CurrentOffset + 15 ; set the checkbox state depending on what is present in the registry !insertmacro SetInstallOption $LaunchClientNowCheckbox @CLIENT_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} @@ -771,52 +779,30 @@ Function PostInstallOptionsPage ${EndIf} ${If} @SERVER_COMPONENT_CONDITIONAL@ - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @SANDBOX_HF_SHORTCUT_NAME@" - Pop $DesktopConsoleCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @SANDBOX_HF_SHORTCUT_NAME@ after install" - Pop $LaunchConsoleNowCheckbox - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} - ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE - ${IfNot} $substringResult == "" - ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} - ${EndIf} - - IntOp $CurrentOffset $CurrentOffset + 15 - - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @SANDBOX_HF_SHORTCUT_NAME@ on startup" - Pop $ConsoleStartupCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} ${Else} - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Create a desktop shortcut for @CONSOLE_HF_SHORTCUT_NAME@" - Pop $DesktopConsoleCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ after install" - Pop $LaunchConsoleNowCheckbox - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} - ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE - ${IfNot} $substringResult == "" - ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} - ${EndIf} - - IntOp $CurrentOffset $CurrentOffset + 15 - - ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ on startup" - Pop $ConsoleStartupCheckbox - IntOp $CurrentOffset $CurrentOffset + 15 - - ; set the checkbox state depending on what is present in the registry - !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} ${EndIf} + Pop $LaunchConsoleNowCheckbox + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $LaunchConsoleNowCheckbox @SERVER_LAUNCH_NOW_REG_KEY@ ${BST_CHECKED} + ${StrContains} $substringResult "/forceNoLaunchServer" $CMDLINE + ${IfNot} $substringResult == "" + ${NSD_SetState} $LaunchConsoleNowCheckbox ${BST_UNCHECKED} + ${EndIf} + IntOp $CurrentOffset $CurrentOffset + 30 + + ${If} @SERVER_COMPONENT_CONDITIONAL@ + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @SANDBOX_HF_SHORTCUT_NAME@ on startup" + ${Else} + ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Launch @CONSOLE_HF_SHORTCUT_NAME@ on startup" + ${EndIf} + Pop $ConsoleStartupCheckbox + IntOp $CurrentOffset $CurrentOffset + 15 + + ; set the checkbox state depending on what is present in the registry + !insertmacro SetInstallOption $ConsoleStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED} ${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Perform a clean install (Delete older settings and content)" Pop $CleanInstallCheckbox @@ -921,6 +907,7 @@ Function HandlePostInstallOptions ${If} @SERVER_COMPONENT_CONDITIONAL@ ; check if the user asked for a desktop shortcut to the console ${If} $DesktopConsoleState == ${BST_CHECKED} + Delete "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" CreateShortCut "$DESKTOP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES ; Set appUserModelId @@ -931,6 +918,7 @@ Function HandlePostInstallOptions ${Else} ; check if the user asked for a desktop shortcut to the console ${If} $DesktopConsoleState == ${BST_CHECKED} + Delete "$DESKTOP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" CreateShortCut "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" !insertmacro WriteInstallOption @CONSOLE_DESKTOP_SHORTCUT_REG_KEY@ YES ; Set appUserModelId @@ -957,6 +945,7 @@ Function HandlePostInstallOptions Delete "$SMSTARTUP\@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@.lnk" ; make a startup shortcut in this user's current context + ; use the console shortcut name regardless of server/interface install SetShellVarContext current CreateShortCut "$SMSTARTUP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" @@ -1196,11 +1185,21 @@ Section "-Core installation" ${EndIf} - ; handling for server console shortcut - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" \ - "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" - ; Set appUserModelId - ApplicationID::Set "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${If} @SERVER_COMPONENT_CONDITIONAL@ + ; handling for server console shortcut + Delete "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@SANDBOX_SHORTCUT_NAME@.lnk" \ + "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" + ; Set appUserModelId + ApplicationID::Set "$SMPROGRAMS\$STARTMENU_FOLDER\@SANDBOX_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${Else} + ; handling for interface only console shortcut + Delete "$SMPROGRAMS\$STARTMENU_FOLDER\@SANDBOX_SHORTCUT_NAME@.lnk" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" \ + "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" + ; Set appUserModelId + ApplicationID::Set "$SMPROGRAMS\$STARTMENU_FOLDER\@CONSOLE_SHORTCUT_NAME@.lnk" "@APP_USER_MODEL_ID@" + ${EndIf} CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\@UNINSTALLER_NAME@" @@ -1406,6 +1405,7 @@ Section "Uninstall" Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\@INTERFACE_SHORTCUT_NAME@.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\@CONSOLE_SHORTCUT_NAME@.lnk" + Delete "$SMPROGRAMS\$MUI_TEMP\@SANDBOX_SHORTCUT_NAME@.lnk" Delete "$DESKTOP\@INTERFACE_HF_SHORTCUT_NAME@.lnk" Delete "$DESKTOP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" Delete "$DESKTOP\@SANDBOX_HF_SHORTCUT_NAME@.lnk" @@ -1446,6 +1446,7 @@ Section "Uninstall" Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\@INTERFACE_SHORTCUT_NAME@.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\@CONSOLE_SHORTCUT_NAME@.lnk" + Delete "$SMPROGRAMS\$MUI_TEMP\@SANDBOX_SHORTCUT_NAME@.lnk" @CPACK_NSIS_DELETE_ICONS_EXTRA@ ;Delete empty start menu parent diretories diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 982f142e64..e8d61e77f7 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -33,13 +33,12 @@ endif () # install the packaged Server Console in our install directory if (APPLE) install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} - COMPONENT ${CLIENT_COMPONENT} ) install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${CLIENT_COMPONENT} ) From d5950db2a4f1ab48ab7d108214fa512bd9e96f6f Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 21:20:06 -0700 Subject: [PATCH 076/157] fix for showing the text overlay in mac --- scripts/system/redirectOverlays.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index b4a89a7a4e..4d6d185adc 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -37,8 +37,8 @@ rotation: {x: -4.57763671875e-05, y: 0.4957197904586792, z: -7.62939453125e-05, w: 0.8684672117233276}, text: getOopsText(), textAlpha: 1, + backgroundColor: {x: 0, y: 0, z:0}, backgroundAlpha: 0, - color: {x: 255, y: 255, z: 255}, lineHeight: 0.10, leftMargin: 0.538373570564886, visible: false, @@ -98,10 +98,15 @@ var oopsTextProperties = { visible: overlaysVisible, text: oopsText, + textAlpha: overlaysVisible, + // either visible or invisible. 0 doesn't work in Mac. + backgroundAlpha: overlaysVisible * 0.00393, leftMargin: (textOverlayWidth - textWidth) / 2 }; + Window.copyToClipboard(redirectOopsText); Overlays.editOverlay(redirectOopsText, oopsTextProperties); + print("toggleOverlays: setting alpha to " + Overlays.getProperty(redirectOopsText, "alpha")); Overlays.editOverlay(tryAgainImage, properties); Overlays.editOverlay(backImage, properties); From 5c9094d81f32128847582cbcaddc0f9bd6bd7232 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 27 Sep 2018 21:24:04 -0700 Subject: [PATCH 077/157] removing debug print statement --- scripts/system/redirectOverlays.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 4d6d185adc..307bd2b95f 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -106,7 +106,6 @@ Window.copyToClipboard(redirectOopsText); Overlays.editOverlay(redirectOopsText, oopsTextProperties); - print("toggleOverlays: setting alpha to " + Overlays.getProperty(redirectOopsText, "alpha")); Overlays.editOverlay(tryAgainImage, properties); Overlays.editOverlay(backImage, properties); From 4257a4dfdd6b9f132be8b988926f36e1176f7b44 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 27 Sep 2018 23:12:24 -0700 Subject: [PATCH 078/157] Try fixing binary name for 'running process' detection of interface --- server-console/src/modules/hf-app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-console/src/modules/hf-app.js b/server-console/src/modules/hf-app.js index d7c54d3e4d..3c9505abdd 100644 --- a/server-console/src/modules/hf-app.js +++ b/server-console/src/modules/hf-app.js @@ -50,7 +50,7 @@ exports.getBuildInfo = function() { } const buildInfo = exports.getBuildInfo(); -const interfacePath = pathFinder.discoveredPath("Interface", binaryType, buildInfo.releaseType); +const interfacePath = pathFinder.discoveredPath("interface", binaryType, buildInfo.releaseType); exports.startInterface = function(url) { var argArray = []; @@ -70,7 +70,7 @@ exports.isInterfaceRunning = function(done) { if (osType == 'Windows_NT') { var pInterface = new Process('interface', 'interface.exe'); } else if (osType == 'Darwin') { - var pInterface = new Process('interface', 'Interface'); + var pInterface = new Process('interface', 'interface'); } return pInterface.isRunning(done); } From faf489855c0fdd1ee3e9664c3d1769f77193bc75 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 28 Sep 2018 02:13:08 -0700 Subject: [PATCH 079/157] Packing the offsets and catching up performances --- .../gpu-gl-common/src/gpu/gl/GLBackend.cpp | 3 +- libraries/render-utils/src/Blendshape.slh | 19 +++++++++- libraries/render-utils/src/Model.cpp | 37 ++++++++++++++++++- libraries/render-utils/src/Model.h | 21 ++++++++++- 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp index 68fe38fc72..13c21d89e7 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp @@ -274,8 +274,9 @@ void GLBackend::renderPassDraw(const Batch& batch) { case Batch::COMMAND_drawIndexedInstanced: case Batch::COMMAND_multiDrawIndirect: case Batch::COMMAND_multiDrawIndexedIndirect: { +#ifdef GPU_BATCH_DETAILED_TRACING PROFILE_RANGE(render_gpu_gl_detail, "drawcall"); - +#endif // updates for draw calls ++_currentDraw; updateInput(); diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 2dfb0c1540..344964173c 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -10,6 +10,10 @@ <@func declareBlendshape(USE_NORMAL, USE_TANGENT)@> +struct PackedBlendshapeOffset { + ivec4 packedPosNorTan; +}; + struct BlendshapeOffset { vec4 position; vec4 normal; @@ -32,10 +36,21 @@ BlendshapeOffset getBlendshapeOffset(int i) { } #else layout(std140, binding=0) buffer blendshapeOffsetsBuffer { - BlendshapeOffset _blendshapeOffsets[]; + ivec4 _blendshapeOffsets[]; + // BlendshapeOffset _blendshapeOffsets[]; }; BlendshapeOffset getBlendshapeOffset(int i) { - return _blendshapeOffsets[i]; + // return _blendshapeOffsets[i]; + + + ivec4 elem_packed = _blendshapeOffsets[i]; + + BlendshapeOffset unpacked; + unpacked.position = vec4(unpackHalf2x16(uint(elem_packed.x)), unpackHalf2x16(uint(elem_packed.y))); + unpacked.normal = vec4(0.0); + unpacked.tangent = vec4(0.0); + + return unpacked; } #endif diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index c15f3bf2c1..8c1ad8a2db 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1632,6 +1632,7 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe _blendshapeCoefficients(blendshapeCoefficients) { } + void Blender::run() { QVector blendshapeOffsets; if (_model && _model->isLoaded()) { @@ -1648,6 +1649,8 @@ void Blender::run() { blendshapeOffsets += modelMeshBlendshapeOffsets->second; BlendshapeOffset* meshBlendshapeOffsets = blendshapeOffsets.data() + offset; offset += modelMeshBlendshapeOffsets->second.size(); + std::vector unpackedBlendshapeOffsets(modelMeshBlendshapeOffsets->second.size()); + const float NORMAL_COEFFICIENT_SCALE = 0.01f; for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) { float vertexCoefficient = _blendshapeCoefficients.at(i); @@ -1655,12 +1658,25 @@ void Blender::run() { if (vertexCoefficient < EPSILON) { continue; } + float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE; const FBXBlendshape& blendshape = mesh.blendshapes.at(i); + bool doTangent = (mesh.tangents.size()) && (blendshape.tangents.size()); + tbb::parallel_for(tbb::blocked_range(0, blendshape.indices.size()), [&](const tbb::blocked_range& range) { for (auto j = range.begin(); j < range.end(); j++) { int index = blendshape.indices.at(j); - auto& currentBlendshapeOffset = meshBlendshapeOffsets[index]; + +#ifdef PACKED_BLENDSHAPE_OFFSET + auto& currentBlendshapeOffset = unpackedBlendshapeOffsets[index]; + currentBlendshapeOffset.positionOffsetAndSpare += blendshape.vertices.at(j) * vertexCoefficient; + + currentBlendshapeOffset.normalOffsetAndSpare += blendshape.normals.at(j) * normalCoefficient; + if (doTangent) { + currentBlendshapeOffset.tangentOffsetAndSpare += blendshape.tangents.at(j) * normalCoefficient; + } +#else + auto& currentBlendshapeOffset = blendshapeOffsets[index]; currentBlendshapeOffset.positionOffsetAndSpare += glm::vec4(blendshape.vertices.at(j) * vertexCoefficient, 0.0f); currentBlendshapeOffset.normalOffsetAndSpare += glm::vec4(blendshape.normals.at(j) * normalCoefficient, 0.0f); @@ -1669,9 +1685,28 @@ void Blender::run() { currentBlendshapeOffset.tangentOffsetAndSpare += glm::vec4(blendshape.tangents.at(j) * normalCoefficient, 0.0f); } } +#endif } }); } + +#ifdef PACKED_BLENDSHAPE_OFFSET + + auto unpacked = unpackedBlendshapeOffsets.data(); + auto packed = meshBlendshapeOffsets; + + for (int i = 0; i < unpackedBlendshapeOffsets.size(); i++) { + auto pposXY = glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)); + auto pposZ = glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)); + auto pnor = glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)); + auto ptan = glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)); + (*packed).packedPosNorTan = glm::uvec4(pposXY, pposZ, pnor, ptan); + + unpacked++; + packed++; + } +#endif + } } // post the result to the ModelBlender, which will dispatch to the model if still alive diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 45171a0c31..98451a7620 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -75,11 +75,30 @@ struct SortedTriangleSet { int subMeshIndex; }; -struct BlendshapeOffset { + + +#define PACKED_BLENDSHAPE_OFFSET 1 +#ifdef PACKED_BLENDSHAPE_OFFSET +struct BlendshapeOffsetPacked { + glm::ivec4 packedPosNorTan; +}; + +struct BlendshapeOffsetUnpacked { + glm::vec3 positionOffsetAndSpare; + glm::vec3 normalOffsetAndSpare; + glm::vec3 tangentOffsetAndSpare; +}; + +using BlendshapeOffset = BlendshapeOffsetPacked; +#else + +struct BlendshapeOffsetUnpacked { glm::vec4 positionOffsetAndSpare; glm::vec4 normalOffsetAndSpare; glm::vec4 tangentOffsetAndSpare; }; +using BlendshapeOffset = BlendshapeOffsetUnpacked; +#endif /// A generic 3D model displaying geometry loaded from a URL. class Model : public QObject, public std::enable_shared_from_this, public scriptable::ModelProvider { From a8b86bd555c1fbf17a2cfd63ca1e3bb7c0c916f5 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 28 Sep 2018 08:44:49 -0700 Subject: [PATCH 080/157] removing debug statement --- scripts/system/redirectOverlays.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 307bd2b95f..8dd7d0d26a 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -103,7 +103,6 @@ backgroundAlpha: overlaysVisible * 0.00393, leftMargin: (textOverlayWidth - textWidth) / 2 }; - Window.copyToClipboard(redirectOopsText); Overlays.editOverlay(redirectOopsText, oopsTextProperties); Overlays.editOverlay(tryAgainImage, properties); From dde106e42ef6cf358c59e8e715d51cd3b1fc58cf Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 09:24:00 -0700 Subject: [PATCH 081/157] Make tray icon light map to notification status of various menus --- server-console/src/main.js | 41 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index cfde72e3bc..771c2736dd 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -60,7 +60,10 @@ const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial const buildInfo = GetBuildInfo(); - +const NotificationState = { + UNNOTIFIED: 'unnotified', + NOTIFIED: 'notified' +}; // Update lock filepath const UPDATER_LOCK_FILENAME = ".updating"; @@ -324,12 +327,21 @@ const HifiNotifications = hfNotifications.HifiNotifications; const HifiNotificationType = hfNotifications.NotificationType; var pendingNotifications = {} -function notificationCallback(notificationType, pending = true) { +var notificationState = NotificationState.UNNOTIFIED; + +function setNotificationState(notificationType, pending = true) { pendingNotifications[notificationType] = pending; + notificationState = NotificationState.UNNOTIFIED; + for (var key in pendingNotifications) { + if (pendingNotifications[key]) { + notificationState = NotificationState.NOTIFIED; + break; + } + } updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); } -var trayNotifications = new HifiNotifications(userConfig, notificationCallback); +var trayNotifications = new HifiNotifications(userConfig, setNotificationState); var LogWindow = function(ac, ds) { this.ac = ac; @@ -389,7 +401,7 @@ var labels = { type: 'checkbox', checked: true, click: function () { - trayNotifications.enable(!trayNotifications.enabled(), notificationCallback); + trayNotifications.enable(!trayNotifications.enabled(), setNotificationState); userConfig.save(configPath); updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); } @@ -398,32 +410,28 @@ var labels = { label: 'GoTo', click: function () { StartInterface("hifiapp:GOTO"); - pendingNotifications[HifiNotificationType.GOTO] = false; - updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); + setNotificationState(HifiNotificationType.GOTO, false); } }, people: { label: 'People', click: function () { StartInterface("hifiapp:PEOPLE"); - pendingNotifications[HifiNotificationType.PEOPLE] = false; - updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); + setNotificationState(HifiNotificationType.PEOPLE, false); } }, wallet: { label: 'Wallet', click: function () { StartInterface("hifiapp:WALLET"); - pendingNotifications[HifiNotificationType.WALLET] = false; - updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); + setNotificationState(HifiNotificationType.WALLET, false); } }, marketplace: { label: 'Market', click: function () { StartInterface("hifiapp:MARKET"); - pendingNotifications[HifiNotificationType.MARKETPLACE] = false; - updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); + setNotificationState(HifiNotificationType.MARKETPLACE, false); } }, restart: { @@ -557,7 +565,7 @@ function updateLabels(serverState) { function updateTrayMenu(serverState) { if (tray) { var menuArray = buildMenuArray(isShuttingDown ? null : serverState); - tray.setImage(trayIcons[serverState]); + tray.setImage(trayIcons[notificationState]); tray.setContextMenu(Menu.buildFromTemplate(menuArray)); if (isShuttingDown) { tray.setToolTip('High Fidelity - Shutting Down'); @@ -777,9 +785,8 @@ function maybeShowSplash() { const trayIconOS = (osType == "Darwin") ? "osx" : "win"; var trayIcons = {}; -trayIcons[ProcessGroupStates.STARTED] = "console-tray-" + trayIconOS + ".png"; -trayIcons[ProcessGroupStates.STOPPED] = "console-tray-" + trayIconOS + "-stopped.png"; -trayIcons[ProcessGroupStates.STOPPING] = "console-tray-" + trayIconOS + "-stopping.png"; +trayIcons[NotificationState.UNNOTIFIED] = "console-tray-" + trayIconOS + ".png"; +trayIcons[NotificationState.NOTIFIED] = "console-tray-" + trayIconOS + "-stopped.png"; for (var key in trayIcons) { var fullPath = path.join(__dirname, '../resources/' + trayIcons[key]); var img = nativeImage.createFromPath(fullPath); @@ -892,7 +899,7 @@ app.on('ready', function() { } // Create tray icon - tray = new Tray(trayIcons[ProcessGroupStates.STOPPED]); + tray = new Tray(trayIcons[NotificationState.UNNOTIFIED]); tray.setToolTip('High Fidelity'); tray.on('click', function() { From 8f2d3b17d3d8e5e3dcec715c4e741785aad7894a Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Fri, 28 Sep 2018 09:27:38 -0700 Subject: [PATCH 082/157] Fix parabola scaling issues and raypick velocity denormalization due to transform affecting direction scale --- interface/src/raypick/ParabolaPick.cpp | 5 +++-- interface/src/raypick/RayPick.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/interface/src/raypick/ParabolaPick.cpp b/interface/src/raypick/ParabolaPick.cpp index b10f82c9bd..e8986f7ce9 100644 --- a/interface/src/raypick/ParabolaPick.cpp +++ b/interface/src/raypick/ParabolaPick.cpp @@ -36,9 +36,10 @@ PickParabola ParabolaPick::getMathematicalPick() const { glm::vec3 position = currentParentTransform.transform(_mathPick.origin); glm::vec3 velocity = _mathPick.velocity; if (_scaleWithParent) { - velocity = currentParentTransform.transform(velocity); - } else { velocity = currentParentTransform.transformDirection(velocity); + } else { + glm::vec3 transformedVelocity = currentParentTransform.transformDirection(velocity); + velocity = glm::normalize(transformedVelocity) * glm::distance(velocity, Vectors::ZERO); } glm::vec3 acceleration = _mathPick.acceleration; if (_rotateAccelerationWithAvatar) { diff --git a/interface/src/raypick/RayPick.cpp b/interface/src/raypick/RayPick.cpp index 227b4e2f32..ad12db4df2 100644 --- a/interface/src/raypick/RayPick.cpp +++ b/interface/src/raypick/RayPick.cpp @@ -22,7 +22,7 @@ PickRay RayPick::getMathematicalPick() const { Transform currentParentTransform = parentTransform->getTransform(); glm::vec3 origin = currentParentTransform.transform(_mathPick.origin); - glm::vec3 direction = currentParentTransform.transformDirection(_mathPick.direction); + glm::vec3 direction = glm::normalize(currentParentTransform.transformDirection(_mathPick.direction)); return PickRay(origin, direction); } From e51f48d7ef6a8091802c8991dfd2d40e8c3fea53 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Fri, 28 Sep 2018 09:55:02 -0700 Subject: [PATCH 083/157] Add collision pick documentation on scaleWithParent option --- docs/interface/raypick/pick-parenting.md.html | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/docs/interface/raypick/pick-parenting.md.html b/docs/interface/raypick/pick-parenting.md.html index 82f38a1494..5c2ceb37ac 100644 --- a/docs/interface/raypick/pick-parenting.md.html +++ b/docs/interface/raypick/pick-parenting.md.html @@ -247,29 +247,31 @@ The collision pick's threshold also rescales. The change is proportional to the dimension of the parent. So, if the largest dimension of the parent was 3.0 and is now 6.0, the threshold doubles. -************************************************************ -* * -* before after * -* * -* pick * -* +------------+ * -* | | * -* | ........ | * -* | . . | * -* | . . | * -* | . . | * -* pick | . . | * -* +-----+ | ........ +___ * -* |.....| | | theshold * -* |. .| theshold +------------+--- * -* |.....|___ | * -* +-----+--- <-+ * -* +----------+ * -* +---+ / \ * -* +-----+ +--------------+ * -* parent parent * -* * -************************************************************ +************************************************************************************** +* * +* before after after * +* (scaleWithParent (scaleWithParent * +* is false) is true) * +* * +* pick * +* +------------+ * +* | | * +* pick | ........ | * +* +-----+ | . . | * +* |.....| | . . | * +* |. .| theshold | . . | * +* pick |.....|___ | | . . | * +* +-----+ +-----+--- <-+ | ........ +___ * +* |.....| | | theshold * +* |. .| theshold +------------+--- * +* |.....|___ | * +* +-----+--- <-+ * +* +----------+ +----------+ * +* +---+ / \ / \ * +* +-----+ +--------------+ +--------------+ * +* parent parent parent * +* * +************************************************************************************** From fb3205a847755811bc2b77faa3091c78e35fab0f Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 10:02:03 -0700 Subject: [PATCH 084/157] More OSX Path fixes --- server-console/src/main.js | 2 +- server-console/src/modules/path-finder.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index cfde72e3bc..6abac30344 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -259,7 +259,7 @@ var debug = argv.debug; var binaryType = argv.binaryType; -interfacePath = pathFinder.discoveredPath("Interface", binaryType, buildInfo.releaseType); +interfacePath = pathFinder.discoveredPath("interface", binaryType, buildInfo.releaseType); dsPath = pathFinder.discoveredPath("domain-server", binaryType, buildInfo.releaseType); acPath = pathFinder.discoveredPath("assignment-client", binaryType, buildInfo.releaseType); diff --git a/server-console/src/modules/path-finder.js b/server-console/src/modules/path-finder.js index 3fab8b2808..a7ccee2631 100644 --- a/server-console/src/modules/path-finder.js +++ b/server-console/src/modules/path-finder.js @@ -3,7 +3,7 @@ var path = require('path'); const { app } = require('electron'); function platformExtension(name) { - if (name == "Interface") { + if (name == "interface") { if (process.platform == "darwin") { return ".app/Contents/MacOS/" + name } else if (process.platform == "win32") { From 1aaaca4e6c97a6403709327511c0a363d7815fd6 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 10:48:20 -0700 Subject: [PATCH 085/157] Code review changes --- cmake/templates/NSIS.template.in | 2 +- server-console/src/modules/hf-acctinfo.js | 6 ++--- server-console/src/modules/hf-app.js | 12 +++++----- .../src/modules/hf-notifications.js | 22 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index b67cdf3eea..3226712519 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -945,7 +945,7 @@ Function HandlePostInstallOptions Delete "$SMSTARTUP\@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@.lnk" ; make a startup shortcut in this user's current context - ; use the console shortcut name regardless of server/interface install + ; use the console shortcut name regardless of server/interface install SetShellVarContext current CreateShortCut "$SMSTARTUP\@CONSOLE_HF_SHORTCUT_NAME@.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" diff --git a/server-console/src/modules/hf-acctinfo.js b/server-console/src/modules/hf-acctinfo.js index 828bc781b8..d20748544f 100644 --- a/server-console/src/modules/hf-acctinfo.js +++ b/server-console/src/modules/hf-acctinfo.js @@ -66,7 +66,7 @@ AccountInfo.prototype = { case VariantTypes.USER_TYPE: //user type var userTypeName = this._parseByteArray().toString('ascii').slice(0,-1); - if (userTypeName == "DataServerAccountInfo") { + if (userTypeName === "DataServerAccountInfo") { return this._parseDataServerAccountInfo(); } else { @@ -77,7 +77,7 @@ AccountInfo.prototype = { }, _parseByteArray: function () { var length = this._parseUInt32(); - if (length == 0xffffffff) { + if (length === 0xffffffff) { return null; } var result = this.rawData.slice(this.parseOffset, this.parseOffset+length); @@ -91,7 +91,7 @@ AccountInfo.prototype = { } // length in bytes; var length = this._parseUInt32(); - if (length == 0xFFFFFFFF) { + if (length === 0xFFFFFFFF) { return null; } diff --git a/server-console/src/modules/hf-app.js b/server-console/src/modules/hf-app.js index 3c9505abdd..3db48bd9c4 100644 --- a/server-console/src/modules/hf-app.js +++ b/server-console/src/modules/hf-app.js @@ -15,9 +15,9 @@ const osType = os.type(); exports.getBuildInfo = function() { var buildInfoPath = null; - if (osType == 'Windows_NT') { + if (osType === 'Windows_NT') { buildInfoPath = path.join(path.dirname(process.execPath), 'build-info.json'); - } else if (osType == 'Darwin') { + } else if (osType === 'Darwin') { var contentPath = ".app/Contents/"; var contentEndIndex = __dirname.indexOf(contentPath); @@ -67,9 +67,9 @@ exports.startInterface = function(url) { } exports.isInterfaceRunning = function(done) { - if (osType == 'Windows_NT') { + if (osType === 'Windows_NT') { var pInterface = new Process('interface', 'interface.exe'); - } else if (osType == 'Darwin') { + } else if (osType === 'Darwin') { var pInterface = new Process('interface', 'interface'); } return pInterface.isRunning(done); @@ -78,13 +78,13 @@ exports.isInterfaceRunning = function(done) { exports.getRootHifiDataDirectory = function(local) { var organization = buildInfo.organization; - if (osType == 'Windows_NT') { + if (osType === 'Windows_NT') { if (local) { return path.resolve(osHomeDir(), 'AppData/Local', organization); } else { return path.resolve(osHomeDir(), 'AppData/Roaming', organization); } - } else if (osType == 'Darwin') { + } else if (osType === 'Darwin') { return path.resolve(osHomeDir(), 'Library/Application Support', organization); } else { return path.resolve(osHomeDir(), '.local/share/', organization); diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index 2953075523..0cc4da02c0 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -51,8 +51,8 @@ HifiNotification.prototype = { var app = null; switch (this.type) { case NotificationType.GOTO: - if (typeof(this.data) == "number") { - if (this.data == 1) { + if (typeof(this.data) === "number") { + if (this.data === 1) { text = "You have " + this.data + " event invitation pending." } else { text = "You have " + this.data + " event invitations pending." @@ -67,8 +67,8 @@ HifiNotification.prototype = { break; case NotificationType.PEOPLE: - if (typeof(this.data) == "number") { - if (this.data == 1) { + if (typeof(this.data) === "number") { + if (this.data === 1) { text = this.data + " of your connections is online." } else { text = this.data + " of your connections are online." @@ -83,8 +83,8 @@ HifiNotification.prototype = { break; case NotificationType.WALLET: - if (typeof(this.data) == "number") { - if (this.data == 1) { + if (typeof(this.data) === "number") { + if (this.data === 1) { text = "You have " + this.data + " unread Wallet transaction."; } else { text = "You have " + this.data + " unread Wallet transactions."; @@ -99,8 +99,8 @@ HifiNotification.prototype = { break; case NotificationType.MARKETPLACE: - if (typeof(this.data) == "number") { - if (this.data == 1) { + if (typeof(this.data) === "number") { + if (this.data === 1) { text = this.data + " of your purchased items has an update available."; } else { text = this.data + " of your purchased items have updates available."; @@ -124,7 +124,7 @@ HifiNotification.prototype = { }, function (error, reason, metadata) { if(_finished) { - if (osType == 'Darwin') { + if (osType === 'Darwin') { setTimeout(_finished, OSX_CLICK_DELAY_TIMEOUT); } else { _finished(); @@ -215,7 +215,7 @@ HifiNotifications.prototype = { _showNotification: function () { var _this = this; - if (osType == 'Darwin') { + if (osType === 'Darwin') { this.pendingNotifications[0].show(function () { // For OSX // don't attempt to show the next notification @@ -238,7 +238,7 @@ HifiNotifications.prototype = { }, _addNotification: function (notification) { this.pendingNotifications.push(notification); - if(this.pendingNotifications.length == 1) { + if(this.pendingNotifications.length === 1) { this._showNotification(); } }, From ee8290f71cd62a34f2ccbb5a713283595fd685c5 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 11:10:42 -0700 Subject: [PATCH 086/157] Fix comment --- server-console/src/modules/hf-notifications.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index 0cc4da02c0..c69c81aff2 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -218,11 +218,11 @@ HifiNotifications.prototype = { if (osType === 'Darwin') { this.pendingNotifications[0].show(function () { // For OSX - // don't attempt to show the next notification + // Don't attempt to show the next notification // until the current is clicked or times out - // as the OSX Notifier stuff will dismiss - // the previous notification immediately - // when a new one is submitted + // as the OSX Notifier stuff will dismiss the + // previous notification immediately when a + // new one is submitted _this.pendingNotifications.shift(); if(_this.pendingNotifications.length > 0) { _this._showNotification(); From 6393f907b87afadaec07c42b3c7d00cfb19e526b Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 12:33:38 -0700 Subject: [PATCH 087/157] Add temporary code to test for interface paths --- server-console/src/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server-console/src/main.js b/server-console/src/main.js index 6abac30344..e92749908c 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -885,6 +885,9 @@ function onContentLoaded() { // This method will be called when Electron has finished // initialization and is ready to create browser windows. app.on('ready', function() { + var paths = pathFinder.searchPaths("interface", binaryType, buildInfo.releaseType); + dialog.showMessageBox({type: 'question', buttons: ['Yes', 'No'], title: "Paths", message: paths.join(", ")}, function () {}); + if (app.dock) { // hide the dock icon on OS X @@ -902,4 +905,5 @@ app.on('ready', function() { updateTrayMenu(ProcessGroupStates.STOPPED); maybeInstallDefaultContentSet(onContentLoaded); + }); From 537c0aaf2590f18331a2f3aa84cde34289a3d520 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 13:15:04 -0700 Subject: [PATCH 088/157] Revert "Add temporary code to test for interface paths" This reverts commit 6393f907b87afadaec07c42b3c7d00cfb19e526b. --- server-console/src/main.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index e92749908c..6abac30344 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -885,9 +885,6 @@ function onContentLoaded() { // This method will be called when Electron has finished // initialization and is ready to create browser windows. app.on('ready', function() { - var paths = pathFinder.searchPaths("interface", binaryType, buildInfo.releaseType); - dialog.showMessageBox({type: 'question', buttons: ['Yes', 'No'], title: "Paths", message: paths.join(", ")}, function () {}); - if (app.dock) { // hide the dock icon on OS X @@ -905,5 +902,4 @@ app.on('ready', function() { updateTrayMenu(ProcessGroupStates.STOPPED); maybeInstallDefaultContentSet(onContentLoaded); - }); From 42cdf24f5bbd2dcb0037bed184c3ae6405988df8 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 14:52:21 -0700 Subject: [PATCH 089/157] Move OSX Back to Sandbox.app --- cmake/macros/SetPackagingParameters.cmake | 2 +- server-console/CMakeLists.txt | 2 +- server-console/packager.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 30fa37ea14..dce419a0e4 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -142,7 +142,7 @@ macro(SET_PACKAGING_PARAMETERS) set(CONSOLE_INSTALL_DIR ${DMG_SUBFOLDER_NAME}) set(INTERFACE_INSTALL_DIR ${DMG_SUBFOLDER_NAME}) - set(CONSOLE_EXEC_NAME "Console.app") + set(CONSOLE_EXEC_NAME "Sandbox.app") set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME}") set(CONSOLE_APP_CONTENTS "${CONSOLE_INSTALL_APP_PATH}/Contents") diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index e8d61e77f7..420230c33c 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -23,7 +23,7 @@ add_dependencies(${TARGET_NAME} assignment-client domain-server interface) # set the packaged console folder depending on platform, so we can copy it if (APPLE) - set(PACKAGED_CONSOLE_FOLDER "Console-darwin-x64/${CONSOLE_EXEC_NAME}") + set(PACKAGED_CONSOLE_FOLDER "Sandbox-darwin-x64/${CONSOLE_EXEC_NAME}") elseif (WIN32) set(PACKAGED_CONSOLE_FOLDER "server-console-win32-x64") elseif (UNIX) diff --git a/server-console/packager.js b/server-console/packager.js index 5e4fbfe568..31655fe565 100644 --- a/server-console/packager.js +++ b/server-console/packager.js @@ -28,12 +28,13 @@ var options = { const EXEC_NAME = "server-console"; const SHORT_NAME = "Console"; +const OSX_SHORT_NAME = "Sandbox"; const FULL_NAME = "High Fidelity Console"; // setup per OS options if (osType == "Darwin") { options["app-bundle-id"] = "com.highfidelity.server-console" + (argv.production ? "" : "-dev") - options["name"] = SHORT_NAME + options["name"] = OSX_SHORT_NAME } else if (osType == "Windows_NT") { options["version-string"] = { CompanyName: "High Fidelity, Inc.", From edd354d109551b84e3aef190b6bd75ec8e8e4762 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 14:52:50 -0700 Subject: [PATCH 090/157] "Add temporary code to test for interface paths"" --- server-console/src/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server-console/src/main.js b/server-console/src/main.js index d1b3dd2dd3..f0d6ae13ae 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -892,6 +892,9 @@ function onContentLoaded() { // This method will be called when Electron has finished // initialization and is ready to create browser windows. app.on('ready', function() { + var paths = pathFinder.searchPaths("interface", binaryType, buildInfo.releaseType); + dialog.showMessageBox({type: 'question', buttons: ['Yes', 'No'], title: "Paths", message: paths.join(", ")}, function () {}); + if (app.dock) { // hide the dock icon on OS X @@ -909,4 +912,5 @@ app.on('ready', function() { updateTrayMenu(ProcessGroupStates.STOPPED); maybeInstallDefaultContentSet(onContentLoaded); + }); From 0c3f55d6eff89c84b8cc2eabd42800b4635b9882 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Fri, 28 Sep 2018 15:39:37 -0700 Subject: [PATCH 091/157] Code style for floating point literal --- interface/src/raypick/PathPointer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/raypick/PathPointer.cpp b/interface/src/raypick/PathPointer.cpp index 6cc3dfba56..00ab32bde4 100644 --- a/interface/src/raypick/PathPointer.cpp +++ b/interface/src/raypick/PathPointer.cpp @@ -146,7 +146,7 @@ void PathPointer::updateVisuals(const PickResultPointer& pickResult) { IntersectionType type = getPickedObjectType(pickResult); auto renderState = _renderStates.find(_currentRenderState); auto defaultRenderState = _defaultRenderStates.find(_currentRenderState); - float parentScale = 1; + float parentScale = 1.0f; if (_enabled && _scaleWithParent) { glm::vec3 dimensions = DependencyManager::get()->getParentTransform(_pickUID).getScale(); parentScale = glm::max(glm::max(dimensions.x, dimensions.y), dimensions.z); From b60a62da8f87e7ba05f73074696766a69db36c58 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Fri, 28 Sep 2018 16:04:34 -0700 Subject: [PATCH 092/157] Move pathWidth variable in PathPointer back down to specialized classes --- interface/src/raypick/LaserPointer.cpp | 10 +++++----- interface/src/raypick/LaserPointer.h | 5 +++++ interface/src/raypick/ParabolaPointer.h | 4 ++++ interface/src/raypick/PathPointer.h | 4 ---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/interface/src/raypick/LaserPointer.cpp b/interface/src/raypick/LaserPointer.cpp index e5d76483df..8c34f1ab0b 100644 --- a/interface/src/raypick/LaserPointer.cpp +++ b/interface/src/raypick/LaserPointer.cpp @@ -29,9 +29,9 @@ void LaserPointer::editRenderStatePath(const std::string& state, const QVariant& auto renderState = std::static_pointer_cast(_renderStates[state]); if (renderState) { updateRenderStateOverlay(renderState->getPathID(), pathProps); - QVariant pathWidth = pathProps.toMap()["lineWidth"]; - if (pathWidth.isValid()) { - renderState->setPathWidth(pathWidth.toFloat()); + QVariant lineWidth = pathProps.toMap()["lineWidth"]; + if (lineWidth.isValid()) { + renderState->setLineWidth(lineWidth.toFloat()); } } } @@ -118,7 +118,7 @@ LaserPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID { if (!_pathID.isNull()) { _pathIgnoreRays = qApp->getOverlays().getProperty(_pathID, "ignoreRayIntersection").value.toBool(); - _pathWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat(); + _lineWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat(); } } @@ -149,7 +149,7 @@ void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3& pathProps.insert("end", endVariant); pathProps.insert("visible", true); pathProps.insert("ignoreRayIntersection", doesPathIgnoreRays()); - pathProps.insert("lineWidth", getPathWidth() * parentScale); + pathProps.insert("lineWidth", getLineWidth() * parentScale); qApp->getOverlays().editOverlay(getPathID(), pathProps); } } diff --git a/interface/src/raypick/LaserPointer.h b/interface/src/raypick/LaserPointer.h index e5c195f9d4..9b53d8da4b 100644 --- a/interface/src/raypick/LaserPointer.h +++ b/interface/src/raypick/LaserPointer.h @@ -24,6 +24,9 @@ public: const OverlayID& getPathID() const { return _pathID; } const bool& doesPathIgnoreRays() const { return _pathIgnoreRays; } + void setLineWidth(float width) { _lineWidth = width; } + float getLineWidth() const { return _lineWidth; } + void cleanup() override; void disable() override; void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, @@ -32,6 +35,8 @@ public: private: OverlayID _pathID; bool _pathIgnoreRays; + + float _lineWidth; }; LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, diff --git a/interface/src/raypick/ParabolaPointer.h b/interface/src/raypick/ParabolaPointer.h index e4394bc509..aaae66fadf 100644 --- a/interface/src/raypick/ParabolaPointer.h +++ b/interface/src/raypick/ParabolaPointer.h @@ -79,6 +79,9 @@ public: RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float parentScale, bool isVisibleInSecondaryCamera, bool pathEnabled); + void setPathWidth(float width) { _pathWidth = width; } + float getPathWidth() const { return _pathWidth; } + void cleanup() override; void disable() override; void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, @@ -88,6 +91,7 @@ public: private: int _pathID; + float _pathWidth; }; ParabolaPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers, diff --git a/interface/src/raypick/PathPointer.h b/interface/src/raypick/PathPointer.h index 5001d3d1bd..aed6ed4f71 100644 --- a/interface/src/raypick/PathPointer.h +++ b/interface/src/raypick/PathPointer.h @@ -42,9 +42,6 @@ public: void setEndRot(const glm::quat& endRot) { _endRot = endRot; } const glm::quat& getEndRot() const { return _endRot; } - void setPathWidth(float width) { _pathWidth = width; } - float getPathWidth() const { return _pathWidth; } - virtual void cleanup(); virtual void disable(); virtual void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY, @@ -61,7 +58,6 @@ protected: glm::vec3 _startDim; glm::vec3 _endDim; glm::quat _endRot; - float _pathWidth; glm::quat _avgEndRot; bool _avgEndRotInitialized { false }; From f3f9976cfb89ea12134eb39b1db4c84c742a8274 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Fri, 28 Sep 2018 16:10:17 -0700 Subject: [PATCH 093/157] Cache ParabolaPick speed --- interface/src/raypick/ParabolaPick.cpp | 5 +++-- interface/src/raypick/ParabolaPick.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/interface/src/raypick/ParabolaPick.cpp b/interface/src/raypick/ParabolaPick.cpp index e8986f7ce9..2b55bb9c94 100644 --- a/interface/src/raypick/ParabolaPick.cpp +++ b/interface/src/raypick/ParabolaPick.cpp @@ -19,7 +19,8 @@ ParabolaPick::ParabolaPick(const glm::vec3& position, const glm::vec3& direction Pick(PickParabola(position, speed * direction, accelerationAxis), filter, maxDistance, enabled), _rotateAccelerationWithAvatar(rotateAccelerationWithAvatar), _rotateAccelerationWithParent(rotateAccelerationWithParent), - _scaleWithParent(scaleWithParent) { + _scaleWithParent(scaleWithParent), + _speed(speed) { } PickParabola ParabolaPick::getMathematicalPick() const { @@ -39,7 +40,7 @@ PickParabola ParabolaPick::getMathematicalPick() const { velocity = currentParentTransform.transformDirection(velocity); } else { glm::vec3 transformedVelocity = currentParentTransform.transformDirection(velocity); - velocity = glm::normalize(transformedVelocity) * glm::distance(velocity, Vectors::ZERO); + velocity = glm::normalize(transformedVelocity) * _speed; } glm::vec3 acceleration = _mathPick.acceleration; if (_rotateAccelerationWithAvatar) { diff --git a/interface/src/raypick/ParabolaPick.h b/interface/src/raypick/ParabolaPick.h index 7089228d21..8cbbc79bf5 100644 --- a/interface/src/raypick/ParabolaPick.h +++ b/interface/src/raypick/ParabolaPick.h @@ -89,6 +89,8 @@ protected: bool _rotateAccelerationWithAvatar; bool _rotateAccelerationWithParent; bool _scaleWithParent; + // Cached magnitude of _mathPick.velocity + float _speed; }; #endif // hifi_ParabolaPick_h From b6877bca5787efc79bc21d29095e42dbdd86592a Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 28 Sep 2018 16:26:44 -0700 Subject: [PATCH 094/157] Revert ""Add temporary code to test for interface paths""" This reverts commit edd354d109551b84e3aef190b6bd75ec8e8e4762. --- server-console/src/main.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index f0d6ae13ae..d1b3dd2dd3 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -892,9 +892,6 @@ function onContentLoaded() { // This method will be called when Electron has finished // initialization and is ready to create browser windows. app.on('ready', function() { - var paths = pathFinder.searchPaths("interface", binaryType, buildInfo.releaseType); - dialog.showMessageBox({type: 'question', buttons: ['Yes', 'No'], title: "Paths", message: paths.join(", ")}, function () {}); - if (app.dock) { // hide the dock icon on OS X @@ -912,5 +909,4 @@ app.on('ready', function() { updateTrayMenu(ProcessGroupStates.STOPPED); maybeInstallDefaultContentSet(onContentLoaded); - }); From 1ff4c54c1ca40e0dcec66b7739abab756c8b483d Mon Sep 17 00:00:00 2001 From: sam gateau Date: Fri, 28 Sep 2018 17:49:52 -0700 Subject: [PATCH 095/157] Packing normal and tangents --- libraries/render-utils/src/Blendshape.slh | 41 ++++++++++++++++------- libraries/render-utils/src/Model.cpp | 27 +++++++-------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 344964173c..c4458770ea 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -15,11 +15,27 @@ struct PackedBlendshapeOffset { }; struct BlendshapeOffset { - vec4 position; - vec4 normal; - vec4 tangent; + vec3 position; +<@if USE_NORMAL@> + vec3 normal; +<@endif@> +<@if USE_TANGENT@> + vec3 tangent; +<@endif@> }; +const float oneOver511 = 1.0 / 511.0; + +vec3 unpackSnorm3x10_1x2(int packed) { + vec4 unpacked = vec4( + float( (packed & 0x000003FF) - 512 ), + float( ((packed >> 10) & 0x000003FF) - 512 ), + float( ((packed >> 20) & 0x000003FF) - 512 ), + float( (packed >> 30) & 0x00000003 ) + ); + return clamp(unpacked.xyz * oneOver511, vec3(-1.0), vec3(1.0)); +} + #if defined(GPU_GL410) layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; BlendshapeOffset getBlendshapeOffset(int i) { @@ -36,19 +52,20 @@ BlendshapeOffset getBlendshapeOffset(int i) { } #else layout(std140, binding=0) buffer blendshapeOffsetsBuffer { - ivec4 _blendshapeOffsets[]; - // BlendshapeOffset _blendshapeOffsets[]; + ivec4 _packedBlendshapeOffsets[]; }; BlendshapeOffset getBlendshapeOffset(int i) { - // return _blendshapeOffsets[i]; - - ivec4 elem_packed = _blendshapeOffsets[i]; + ivec4 elem_packed = _packedBlendshapeOffsets[i]; BlendshapeOffset unpacked; - unpacked.position = vec4(unpackHalf2x16(uint(elem_packed.x)), unpackHalf2x16(uint(elem_packed.y))); - unpacked.normal = vec4(0.0); - unpacked.tangent = vec4(0.0); + unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), unpackHalf2x16(uint(elem_packed.y)).x); +<@if USE_NORMAL@> + unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz; +<@endif@> +<@if USE_TANGENT@> + unpacked.tangent = unpackSnorm3x10_1x2((elem_packed.w)).xyz; +<@endif@> return unpacked; } @@ -63,7 +80,7 @@ void evalBlendshape(int i, vec4 inPosition, out vec4 position <@endif@> ) { BlendshapeOffset blendshapeOffset = getBlendshapeOffset(i); - position = inPosition + blendshapeOffset.position; + position = inPosition + vec4(blendshapeOffset.position, 0.0); <@if USE_NORMAL@> normal = normalize(inNormal + blendshapeOffset.normal.xyz); <@endif@> diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 8c1ad8a2db..67004a930c 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1691,20 +1691,19 @@ void Blender::run() { } #ifdef PACKED_BLENDSHAPE_OFFSET - - auto unpacked = unpackedBlendshapeOffsets.data(); - auto packed = meshBlendshapeOffsets; - - for (int i = 0; i < unpackedBlendshapeOffsets.size(); i++) { - auto pposXY = glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)); - auto pposZ = glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)); - auto pnor = glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)); - auto ptan = glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)); - (*packed).packedPosNorTan = glm::uvec4(pposXY, pposZ, pnor, ptan); - - unpacked++; - packed++; - } + tbb::parallel_for(tbb::blocked_range(0, unpackedBlendshapeOffsets.size()), [&](const tbb::blocked_range& range) { + auto unpacked = unpackedBlendshapeOffsets.data() + range.begin(); + auto packed = meshBlendshapeOffsets + range.begin(); + for (auto j = range.begin(); j < range.end(); j++) { + (*packed).packedPosNorTan = glm::uvec4( + glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)), + glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f))); + unpacked++; + packed++; + } + }); #endif } From 113ad3d9170d2e1f1b7c9a6b8c5e03a04cd9ccbc Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Sun, 30 Sep 2018 13:11:15 -0700 Subject: [PATCH 096/157] Fixes for OSX App Translocation makes it nearly impossible to find the interface executable from the running server-console, specifically in downloaded builds launched from the Finder. To enable OSX detection and and launch of the interface, the code has been changed to: * Assume interface is installed on OSX as we don't produce a server-only build. * Launch the interface by using 'open' with the appid. NOTE: This may launch the wrong version of the app if multiple instances of the app are installed, but this is the best we can do for now. For most users, the behavior should be as expected. Second, polling was happening even if interface couldn't be detected if it was previously enabled. --- cmake/macros/SetPackagingParameters.cmake | 1 + cmake/modules/MacOSXBundleInfo.plist.in | 8 ++++ cmake/templates/CPackProperties.cmake.in | 1 + server-console/src/main.js | 16 +++++++- server-console/src/modules/hf-app.js | 37 ++++++++++++++----- .../src/modules/hf-notifications.js | 4 +- 6 files changed, 55 insertions(+), 12 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index dce419a0e4..297382b4e5 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -37,6 +37,7 @@ macro(SET_PACKAGING_PARAMETERS) set(BUILD_VERSION ${RELEASE_NUMBER}) set(BUILD_ORGANIZATION "High Fidelity") set(HIGH_FIDELITY_PROTOCOL "hifi") + set(HIGH_FIDELITY_APP_PROTOCOL "hifiapp") set(INTERFACE_BUNDLE_NAME "Interface") set(INTERFACE_ICON_PREFIX "interface") diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in index a06fac092f..b9558cf361 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/cmake/modules/MacOSXBundleInfo.plist.in @@ -42,6 +42,14 @@ hifi + + CFBundleURLName + ${MACOSX_BUNDLE_BUNDLE_NAME} APP URL + CFBundleURLSchemes + + hifiapp + + NSHighResolutionCapable diff --git a/cmake/templates/CPackProperties.cmake.in b/cmake/templates/CPackProperties.cmake.in index a38c3d5361..cb6474b010 100644 --- a/cmake/templates/CPackProperties.cmake.in +++ b/cmake/templates/CPackProperties.cmake.in @@ -27,6 +27,7 @@ set(DS_EXEC_NAME "@DS_EXEC_NAME@") set(AC_DISPLAY_NAME "Assignment Client") set(AC_EXEC_NAME "@AC_EXEC_NAME@") set(HIGH_FIDELITY_PROTOCOL "@HIGH_FIDELITY_PROTOCOL@") +set(HIGH_FIDELITY_APP_PROTOCOL "@HIGH_FIDELITY_APP_PROTOCOL@") set(PRODUCTION_BUILD "@PRODUCTION_BUILD@") set(PR_BUILD "@PR_BUILD@") set(BUILD_ORGANIZATION "@BUILD_ORGANIZATION@") diff --git a/server-console/src/main.js b/server-console/src/main.js index d1b3dd2dd3..04e77315bc 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -108,7 +108,16 @@ const ipcMain = electron.ipcMain; function isInterfaceInstalled() { - return interfacePath; + if (osType == "Darwin") { + // In OSX Sierra, the app translocation process moves + // the executable to a random location before starting it + // which makes finding the interface near impossible using + // relative paths. For now, as there are no server-only + // installs, we just assume the interface is installed here + return true; + } else { + return interfacePath; + } } function isServerInstalled() { @@ -377,7 +386,7 @@ LogWindow.prototype = { }; function visitSandboxClicked() { - if (interfacePath) { + if (isInterfaceInstalled()) { StartInterface('hifi://localhost'); } else { // show an error to say that we can't go home without an interface instance @@ -906,6 +915,9 @@ app.on('ready', function() { tray.popUpContextMenu(tray.menu); }); + if (isInterfaceInstalled()) { + trayNotifications.startPolling(); + } updateTrayMenu(ProcessGroupStates.STOPPED); maybeInstallDefaultContentSet(onContentLoaded); diff --git a/server-console/src/modules/hf-app.js b/server-console/src/modules/hf-app.js index 3db48bd9c4..af6c38cdb3 100644 --- a/server-console/src/modules/hf-app.js +++ b/server-console/src/modules/hf-app.js @@ -7,6 +7,7 @@ const path = require('path'); const argv = require('yargs').argv; const hfprocess = require('./hf-process'); const osHomeDir = require('os-homedir'); +const childProcess = require('child_process'); const Process = hfprocess.Process; const binaryType = argv.binaryType; @@ -53,17 +54,35 @@ const buildInfo = exports.getBuildInfo(); const interfacePath = pathFinder.discoveredPath("interface", binaryType, buildInfo.releaseType); exports.startInterface = function(url) { - var argArray = []; - // check if we have a url parameter to include - if (url) { - argArray = ["--url", url]; + if (osType === 'Darwin') { + if (!url) { + log.debug("No URL given for startInterface"); + return; + } + + // do this as a workaround for app translocation on osx, which makes + // it nearly impossible to find the interface executable + var bundle_id = 'com.highfidelity.interface-dev'; + if (buildInfo.releaseType == 'PR') { + bundle_id = 'com.highfidelity.interface-pr'; + } else if (buildInfo.releaseType == 'PRODUCTION') { + bundle_id = 'com.highfidelity.interface'; + } + childProcess.exec('open -b ' + bundle_id + ' --args --url ' + url); + } else { + var argArray = []; + + // check if we have a url parameter to include + if (url) { + argArray = ["--url", url]; + } + console.log("Starting with " + url); + // create a new Interface instance - Interface makes sure only one is running at a time + var pInterface = new Process('Interface', interfacePath, argArray); + pInterface.detached = true; + pInterface.start(); } - console.log("Starting with " + url); - // create a new Interface instance - Interface makes sure only one is running at a time - var pInterface = new Process('Interface', interfacePath, argArray); - pInterface.detached = true; - pInterface.start(); } exports.isInterfaceRunning = function(done) { diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index c69c81aff2..13c5a6d8fa 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -143,7 +143,6 @@ function HifiNotifications(config, menuNotificationCallback) { this.walletSince = new Date(this.config.get("walletNotifySince", "1970-01-01T00:00:00.000Z")); this.marketplaceSince = new Date(this.config.get("marketplaceNotifySince", "1970-01-01T00:00:00.000Z")); - this.enable(this.enabled()); this.pendingNotifications = []; @@ -193,6 +192,9 @@ HifiNotifications.prototype = { enabled: function () { return !this.config.get("disableTrayNotifications", false); }, + startPolling: function () { + this.enable(this.enabled()); + }, stopPolling: function () { this.config.set("storiesNotifySince", this.storiesSince.toISOString()); this.config.set("peopleNotifySince", this.peopleSince.toISOString()); From 5842416ae6d4f7d9cbb7aff885bdb7c2f004f678 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Sun, 30 Sep 2018 23:11:36 -0700 Subject: [PATCH 097/157] Exploring the possible packing schemes and trying to debug the tangent --- libraries/render-utils/src/Blendshape.slh | 24 ++++++++++++----------- libraries/render-utils/src/Model.cpp | 13 +++++++----- libraries/render-utils/src/Model.h | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index c4458770ea..8a26ba7676 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -11,7 +11,7 @@ <@func declareBlendshape(USE_NORMAL, USE_TANGENT)@> struct PackedBlendshapeOffset { - ivec4 packedPosNorTan; + uvec4 packedPosNorTan; }; struct BlendshapeOffset { @@ -26,14 +26,14 @@ struct BlendshapeOffset { const float oneOver511 = 1.0 / 511.0; -vec3 unpackSnorm3x10_1x2(int packed) { - vec4 unpacked = vec4( - float( (packed & 0x000003FF) - 512 ), - float( ((packed >> 10) & 0x000003FF) - 512 ), - float( ((packed >> 20) & 0x000003FF) - 512 ), - float( (packed >> 30) & 0x00000003 ) +vec3 unpackSnorm3x10_1x2(int packedX10Y10Z10A2) { + vec4 my_unpacked = vec4( + clamp( float( (packedX10Y10Z10A2 & 0x000003FF) - 511 ) / 511.0, -1.0, 1.0), + clamp( float( ((packedX10Y10Z10A2 >> 10) & 0x000003FF) - 511 ) / 511.0, -1.0, 1.0), + clamp( float( ((packedX10Y10Z10A2 >> 20) & 0x000003FF) - 511 ) / 511.0, -1.0, 1.0), + 0.0//clamp( float( int((packedX10Y10Z10A2 >> 30) & 0x00000003) - 1 ), -1.0, 1.0) ); - return clamp(unpacked.xyz * oneOver511, vec3(-1.0), vec3(1.0)); + return my_unpacked.xyz; } #if defined(GPU_GL410) @@ -59,9 +59,11 @@ BlendshapeOffset getBlendshapeOffset(int i) { ivec4 elem_packed = _packedBlendshapeOffsets[i]; BlendshapeOffset unpacked; - unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), unpackHalf2x16(uint(elem_packed.y)).x); + vec2 pZnZ = unpackHalf2x16(uint(elem_packed.y)); + unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), pZnZ.x); <@if USE_NORMAL@> - unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz; + unpacked.normal = vec3(unpackHalf2x16(uint(elem_packed.z)), pZnZ.y); + //unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz; <@endif@> <@if USE_TANGENT@> unpacked.tangent = unpackSnorm3x10_1x2((elem_packed.w)).xyz; @@ -85,7 +87,7 @@ void evalBlendshape(int i, vec4 inPosition, out vec4 position normal = normalize(inNormal + blendshapeOffset.normal.xyz); <@endif@> <@if USE_TANGENT@> - tangent = normalize(inTangent + blendshapeOffset.tangent.xyz); + tangent = normalize(inTangent /*+ blendshapeOffset.tangent.xyz*/); <@endif@> } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 67004a930c..da21ddf39f 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1651,7 +1651,8 @@ void Blender::run() { offset += modelMeshBlendshapeOffsets->second.size(); std::vector unpackedBlendshapeOffsets(modelMeshBlendshapeOffsets->second.size()); - const float NORMAL_COEFFICIENT_SCALE = 0.01f; + // const float NORMAL_COEFFICIENT_SCALE = 0.01f; + const float NORMAL_COEFFICIENT_SCALE = 1.0f; for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) { float vertexCoefficient = _blendshapeCoefficients.at(i); const float EPSILON = 0.0001f; @@ -1691,15 +1692,17 @@ void Blender::run() { } #ifdef PACKED_BLENDSHAPE_OFFSET - tbb::parallel_for(tbb::blocked_range(0, unpackedBlendshapeOffsets.size()), [&](const tbb::blocked_range& range) { + tbb::parallel_for(tbb::blocked_range(0, (int) unpackedBlendshapeOffsets.size()), [&](const tbb::blocked_range& range) { auto unpacked = unpackedBlendshapeOffsets.data() + range.begin(); auto packed = meshBlendshapeOffsets + range.begin(); for (auto j = range.begin(); j < range.end(); j++) { (*packed).packedPosNorTan = glm::uvec4( glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)), - glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f))); + glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, unpacked->normalOffsetAndSpare.z)), + glm::packHalf2x16(glm::vec2(unpacked->normalOffsetAndSpare)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)) + ); + unpacked++; packed++; } diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 98451a7620..c6dfff535c 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -80,7 +80,7 @@ struct SortedTriangleSet { #define PACKED_BLENDSHAPE_OFFSET 1 #ifdef PACKED_BLENDSHAPE_OFFSET struct BlendshapeOffsetPacked { - glm::ivec4 packedPosNorTan; + glm::uvec4 packedPosNorTan; }; struct BlendshapeOffsetUnpacked { From 728f8aeecdf6e3f8086596f4e6c6649d67f8b24e Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Mon, 1 Oct 2018 09:02:41 -0700 Subject: [PATCH 098/157] Scale Parabola Pick acceleration before rotating it --- interface/src/raypick/ParabolaPick.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/raypick/ParabolaPick.cpp b/interface/src/raypick/ParabolaPick.cpp index 2b55bb9c94..571f4a6ea6 100644 --- a/interface/src/raypick/ParabolaPick.cpp +++ b/interface/src/raypick/ParabolaPick.cpp @@ -43,14 +43,14 @@ PickParabola ParabolaPick::getMathematicalPick() const { velocity = glm::normalize(transformedVelocity) * _speed; } glm::vec3 acceleration = _mathPick.acceleration; + if (_scaleWithParent) { + acceleration *= currentParentTransform.getScale(); + } if (_rotateAccelerationWithAvatar) { acceleration = DependencyManager::get()->getMyAvatar()->getWorldOrientation() * acceleration; } else if (_rotateAccelerationWithParent) { acceleration = currentParentTransform.getRotation() * acceleration; } - if (_scaleWithParent) { - acceleration *= currentParentTransform.getScale(); - } return PickParabola(position, velocity, acceleration); } From f0de3ef31c0ac1d83000d01d2f4effea592b782f Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Mon, 1 Oct 2018 09:18:39 -0700 Subject: [PATCH 099/157] jsdocs: Do not list scaleWithAvatar as separate property, and document 0 as default for parentJointIndex --- interface/src/raypick/PickScriptingInterface.cpp | 11 +++++------ interface/src/raypick/PointerScriptingInterface.cpp | 6 ++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 4218d593aa..3d1a198d66 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -52,8 +52,8 @@ unsigned int PickScriptingInterface::createPick(const PickQuery::PickType type, * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results. * @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid. - * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. - * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) + * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, an overlay, or a pick. + * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Ray Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral * @property {Vec3} [dirOffset=Vec3.UP] Only for Joint Ray Picks. A local joint direction offset. x = upward, y = forward, z = lateral @@ -148,7 +148,7 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties * @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid. * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. - * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) + * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Parabola Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral * @property {Vec3} [dirOffset=Vec3.UP] Only for Joint Parabola Picks. A local joint direction offset. x = upward, y = forward, z = lateral @@ -158,8 +158,7 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties * @property {Vec3} [accelerationAxis=-Vec3.UP] The acceleration of the parabola, i.e. the acceleration of the projectile whose trajectory defines the parabola, both magnitude and direction. * @property {boolean} [rotateAccelerationWithAvatar=true] Whether or not the acceleration axis should rotate with the avatar's local Y axis. * @property {boolean} [rotateAccelerationWithParent=false] Whether or not the acceleration axis should rotate with the parent's local Y axis, if available. - * @property {boolean} [scaleWithParent=true] If true, the velocity and acceleration of the Pick will scale linearly with the parent, if available. - * @property {boolean} [scaleWithAvatar] Alias for scaleWithParent. Deprecated. + * @property {boolean} [scaleWithParent=true] If true, the velocity and acceleration of the Pick will scale linearly with the parent, if available. scaleWithAvatar is an alias but is deprecated. */ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properties) { QVariantMap propMap = properties.toMap(); @@ -252,7 +251,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti * @property {CollisionMask} [collisionGroup=8] - The type of object this collision pick collides as. Objects whose collision masks overlap with the pick's collision group * will be considered colliding with the pick. * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. -* @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) +* @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {boolean} [scaleWithParent=true] If true, the collision pick's dimensions and threshold will adjust according to the scale of the parent. */ diff --git a/interface/src/raypick/PointerScriptingInterface.cpp b/interface/src/raypick/PointerScriptingInterface.cpp index 1f1bf76d21..ac9319b2f8 100644 --- a/interface/src/raypick/PointerScriptingInterface.cpp +++ b/interface/src/raypick/PointerScriptingInterface.cpp @@ -97,8 +97,7 @@ unsigned int PointerScriptingInterface::createStylus(const QVariant& properties) * @property {boolean} [centerEndY=true] If false, the end of the Pointer will be moved up by half of its height. * @property {boolean} [lockEnd=false] If true, the end of the Pointer will lock on to the center of the object at which the pointer is pointing. * @property {boolean} [distanceScaleEnd=false] If true, the dimensions of the end of the Pointer will scale linearly with distance. - * @property {boolean} [scaleWithParent=false] If true, the width of the Pointer's path will scale linearly with the pick parent's scale. - * @property {boolean} [scaleWithAvatar] Alias for scaleWithParent + * @property {boolean} [scaleWithParent=false] If true, the width of the Pointer's path will scale linearly with the pick parent's scale. scaleWithAvatar is an alias but is deprecated. * @property {boolean} [followNormal=false] If true, the end of the Pointer will rotate to follow the normal of the intersected surface. * @property {number} [followNormalStrength=0.0] The strength of the interpolation between the real normal and the visual normal if followNormal is true. 0-1. If 0 or 1, * the normal will follow exactly. @@ -251,8 +250,7 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope * @property {boolean} [centerEndY=true] If false, the end of the Pointer will be moved up by half of its height. * @property {boolean} [lockEnd=false] If true, the end of the Pointer will lock on to the center of the object at which the pointer is pointing. * @property {boolean} [distanceScaleEnd=false] If true, the dimensions of the end of the Pointer will scale linearly with distance. -* @property {boolean} [scaleWithParent=true] If true, the width of the Pointer's path will scale linearly with the pick parent's scale. -* @property {boolean} [scaleWithAvatar] Alias for scaleWithParent +* @property {boolean} [scaleWithParent=true] If true, the width of the Pointer's path will scale linearly with the pick parent's scale. scaleWithAvatar is an alias but is deprecated. * @property {boolean} [followNormal=false] If true, the end of the Pointer will rotate to follow the normal of the intersected surface. * @property {number} [followNormalStrength=0.0] The strength of the interpolation between the real normal and the visual normal if followNormal is true. 0-1. If 0 or 1, * the normal will follow exactly. From 0cf7e954ccea73288da7bc11df23256a3d9b032d Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Mon, 1 Oct 2018 09:19:56 -0700 Subject: [PATCH 100/157] Simplify a RayPick and StylusTip constructor --- interface/src/raypick/RayPick.h | 2 +- libraries/shared/src/RegisteredMetaTypes.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/raypick/RayPick.h b/interface/src/raypick/RayPick.h index 4af8490fdc..adacd78487 100644 --- a/interface/src/raypick/RayPick.h +++ b/interface/src/raypick/RayPick.h @@ -71,7 +71,7 @@ class RayPick : public Pick { public: RayPick(const PickFilter& filter, float maxDistance, bool enabled) : - Pick(PickRay(Vectors::ZERO, Vectors::UP), filter, maxDistance, enabled) { + Pick(PickRay(), filter, maxDistance, enabled) { } RayPick(glm::vec3 position, glm::vec3 direction, const PickFilter& filter, float maxDistance, bool enabled) : diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index f4624686ab..3d7231aed7 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -198,7 +198,7 @@ void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay); class StylusTip : public MathPick { public: StylusTip() : position(NAN), velocity(NAN) {} - StylusTip(bilateral::Side side, glm::vec3 position = Vectors::ZERO, glm::quat orientation = Quaternions::IDENTITY, glm::vec3 velocity = Vectors::ZERO) : + StylusTip(const bilateral::Side& side, const glm::vec3& position = Vectors::ZERO, const glm::quat& orientation = Quaternions::IDENTITY, const glm::vec3& velocity = Vectors::ZERO) : side(side), position(position), orientation(orientation), velocity(velocity) {} StylusTip(const QVariantMap& pickVariant) : side(bilateral::Side(pickVariant["side"].toInt())), position(vec3FromVariant(pickVariant["position"])), orientation(quatFromVariant(pickVariant["orientation"])), velocity(vec3FromVariant(pickVariant["velocity"])) {} From 7a89f959d1176f092525edaa294a6be7fa8c2fc5 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Mon, 1 Oct 2018 09:34:07 -0700 Subject: [PATCH 101/157] Fix not mentioning pick parenting in all pick parenting jsdocs for parentID --- interface/src/raypick/PickScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 3d1a198d66..26b5aacac5 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -147,7 +147,7 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results. * @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid. - * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. + * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, an overlay, or a pick. * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Parabola Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral @@ -250,7 +250,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti * The depth is measured in world space, but will scale with the parent if defined. * @property {CollisionMask} [collisionGroup=8] - The type of object this collision pick collides as. Objects whose collision masks overlap with the pick's collision group * will be considered colliding with the pick. -* @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. +* @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, an overlay, or a pick. * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. * @property {boolean} [scaleWithParent=true] If true, the collision pick's dimensions and threshold will adjust according to the scale of the parent. From ad92b172cb6f50af229bedd914e9218c78722f68 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 1 Oct 2018 09:47:07 -0700 Subject: [PATCH 102/157] removing comment --- interface/resources/qml/hifi/avatarapp/AdjustWearables.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml index d4a574411e..08c74794fc 100644 --- a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml +++ b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml @@ -101,7 +101,6 @@ Rectangle { } function entityHasAvatarJoints(entityID) { - console.log(entityID); var hasAvatarJoint = false; var entityJointNames = Entities.getJointNames(entityID); for (var index = 0; index < entityJointNames.length; index++) { From 5f05be554f3d079a52c36b30adc7f6733847d555 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Mon, 1 Oct 2018 10:06:13 -0700 Subject: [PATCH 103/157] check for hard refusal to 404 --- libraries/networking/src/DomainHandler.cpp | 7 ++++++- libraries/networking/src/DomainHandler.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 3a8253bfc6..615546b410 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -139,6 +139,11 @@ void DomainHandler::hardReset() { _pendingPath.clear(); } +bool DomainHandler::isHardRefusal(int reasonCode) { + return (reasonCode == (int)ConnectionRefusedReason::ProtocolMismatch || reasonCode == (int)ConnectionRefusedReason::NotAuthorized || + reasonCode == (int)ConnectionRefusedReason::TimedOut); +} + bool DomainHandler::getInterstitialModeEnabled() const { return _interstitialModeSettingLock.resultWithReadLock([&] { return _enableInterstitialMode.get(); @@ -360,7 +365,7 @@ void DomainHandler::loadedErrorDomain(std::map namedPaths) { void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, int reasonCode, const QString& extraInfo) { _lastDomainConnectionError = reasonCode; - if (getInterstitialModeEnabled()) { + if (getInterstitialModeEnabled() && isHardRefusal(reasonCode)) { _errorDomainURL = errorUrl; _isInErrorState = true; qCDebug(networking) << "Error connecting to domain: " << reasonMessage; diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index 8cf84b602a..1ff88b425d 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -212,6 +212,8 @@ private: void sendDisconnectPacket(); void hardReset(); + bool isHardRefusal(int reasonCode); + QUuid _uuid; Node::LocalID _localID; QUrl _domainURL; From b9883829183b9ecddf110d34e4ca7aa9f7338959 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Mon, 1 Oct 2018 11:07:02 -0700 Subject: [PATCH 104/157] Remove smaller RayPick constructor --- interface/src/Application.cpp | 2 +- interface/src/raypick/RayPick.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 35c071b512..5fa9c94f05 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2271,7 +2271,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo // Setup the mouse ray pick and related operators { - auto mouseRayPick = std::make_shared(PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true); + auto mouseRayPick = std::make_shared(Vectors::ZERO, Vectors::UP, PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true); mouseRayPick->parentTransform = std::make_shared(); mouseRayPick->setJointState(PickQuery::JOINT_STATE_MOUSE); auto mouseRayPickID = DependencyManager::get()->addPick(PickQuery::Ray, mouseRayPick); diff --git a/interface/src/raypick/RayPick.h b/interface/src/raypick/RayPick.h index adacd78487..ba67ceebb1 100644 --- a/interface/src/raypick/RayPick.h +++ b/interface/src/raypick/RayPick.h @@ -70,10 +70,6 @@ public: class RayPick : public Pick { public: - RayPick(const PickFilter& filter, float maxDistance, bool enabled) : - Pick(PickRay(), filter, maxDistance, enabled) { - } - RayPick(glm::vec3 position, glm::vec3 direction, const PickFilter& filter, float maxDistance, bool enabled) : Pick(PickRay(position, direction), filter, maxDistance, enabled) { } From f8409b39770a496fff348684eead2cff29db18b5 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Mon, 1 Oct 2018 11:29:55 -0700 Subject: [PATCH 105/157] dd server-console to client build --- CMakeLists.txt | 3 ++- server-console/CMakeLists.txt | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a01b18a57..a887a35fcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ if (USE_GLES AND (NOT ANDROID)) set(DISABLE_QML_OPTION ON) endif() + option(BUILD_CLIENT "Build client components" ${BUILD_CLIENT_OPTION}) option(BUILD_SERVER "Build server components" ${BUILD_SERVER_OPTION}) option(BUILD_TESTS "Build tests" ${BUILD_TESTS_OPTION}) @@ -162,7 +163,6 @@ if (BUILD_SERVER) set_target_properties(domain-server PROPERTIES FOLDER "Apps") add_subdirectory(ice-server) set_target_properties(ice-server PROPERTIES FOLDER "Apps") - add_subdirectory(server-console) endif() if (BUILD_CLIENT) @@ -174,6 +174,7 @@ endif() if (BUILD_CLIENT OR BUILD_SERVER) add_subdirectory(plugins) + add_subdirectory(server-console) endif() # BUILD_TOOLS option will be handled inside the tools's CMakeLists.txt because 'scribe' tool is required for build anyway diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index e8d61e77f7..df51409151 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -49,7 +49,6 @@ elseif (WIN32) DIRECTORY "${CONSOLE_DESTINATION}/" DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} - COMPONENT ${CLIENT_COMPONENT} ) install( DIRECTORY "${CONSOLE_DESTINATION}/" From c12115bfda3c78c1fc29d1514d25b390aa126636 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Mon, 1 Oct 2018 11:51:46 -0700 Subject: [PATCH 106/157] Addressing the 4.1 pass and make sure it works on windows pc and mac --- libraries/render-utils/src/Blendshape.slh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 8a26ba7676..bba0c615a9 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -39,16 +39,21 @@ vec3 unpackSnorm3x10_1x2(int packedX10Y10Z10A2) { #if defined(GPU_GL410) layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; BlendshapeOffset getBlendshapeOffset(int i) { - int offset = 3 * i; - BlendshapeOffset blendshapeOffset; - blendshapeOffset.position = texelFetch(blendshapeOffsetsBuffer, offset); + vec4 fetched = texelFetch(blendshapeOffsetsBuffer, i); + ivec4 elem_packed = ivec4(floatBitsToUint(fetched.x), floatBitsToUint(fetched.y), floatBitsToUint(fetched.z), floatBitsToUint(fetched.w)); + + BlendshapeOffset unpacked; + vec2 pZnZ = unpackHalf2x16(uint(elem_packed.y)); + unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), pZnZ.x); <@if USE_NORMAL@> - blendshapeOffset.normal = texelFetch(blendshapeOffsetsBuffer, offset + 1); + unpacked.normal = vec3(unpackHalf2x16(uint(elem_packed.z)), pZnZ.y); + //unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz; <@endif@> <@if USE_TANGENT@> - blendshapeOffset.tangent = texelFetch(blendshapeOffsetsBuffer, offset + 2); + unpacked.tangent = unpackSnorm3x10_1x2((elem_packed.w)).xyz; <@endif@> - return blendshapeOffset; + + return unpacked; } #else layout(std140, binding=0) buffer blendshapeOffsetsBuffer { From fbaac4254e9002d5233ae3428a800612bc6a02c1 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Mon, 1 Oct 2018 12:45:56 -0700 Subject: [PATCH 107/157] Set build targets properly for client-only install of console --- server-console/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index df51409151..fc6238bd9a 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -19,7 +19,13 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Server Console") set_target_properties(${TARGET_NAME}-npm-install PROPERTIES FOLDER "hidden/Server Console") # add a dependency from the package target to the server components -add_dependencies(${TARGET_NAME} assignment-client domain-server interface) +if (BUILD_CLIENT) + add_dependencies(${TARGET_NAME} interface) +endif() + +if (BUILD_SERVER) + add_dependencies(${TARGET_NAME} assignment-client domain-server interface) +endif() # set the packaged console folder depending on platform, so we can copy it if (APPLE) From 652ec2210d927fbd3b911eebb0b066f42fe8ef42 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 1 Oct 2018 13:58:14 -0700 Subject: [PATCH 108/157] fixing loading issues --- interface/src/octree/SafeLanding.cpp | 32 +++++++++++++------ .../src/RenderableModelEntityItem.cpp | 9 +++++- .../src/RenderableModelEntityItem.h | 1 + .../src/model-networking/ModelCache.cpp | 5 +++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index d181348276..6f341c1990 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -14,7 +14,7 @@ #include #include "EntityTreeRenderer.h" -#include "ModelEntityItem.h" +#include "RenderableModelEntityItem.h" #include "InterfaceLogging.h" #include "Application.h" @@ -124,18 +124,30 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); + float sequencePercentage = 0.0f; + + if (_initialStart != INVALID_SEQUENCE && _initialEnd != 0) { + int sequenceSize = _initialStart <= _initialEnd ? _initialEnd - _initialStart: + _initialEnd + SEQUENCE_MODULO - _initialStart; + + auto startIter = _sequenceNumbers.find(_initialStart); + auto endIter = _sequenceNumbers.find(_initialEnd - 1); + + sequencePercentage = (distance(startIter, endIter) / (sequenceSize - 1)); + } + static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; - float percentage = 0.0f; + float entityReadyPercentage = 0.0f; if (_maxTrackedEntityCount > 0) { - percentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); + entityReadyPercentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); } if (_trackedEntityStabilityCount < MINIMUM_TRACKED_ENTITY_STABILITY_COUNT) { - percentage *= 0.20f; + entityReadyPercentage *= 0.20f; } - return percentage; + return ((sequencePercentage *= 0.50f) + (entityReadyPercentage *= 0.50f)); } bool SafeLanding::isSequenceNumbersComplete() { @@ -148,7 +160,7 @@ bool SafeLanding::isSequenceNumbersComplete() { if (sequenceSize == 0 || (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() - && distance(startIter, endIter) == sequenceSize - 1) ) { + && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. return true; } @@ -160,13 +172,13 @@ bool isEntityPhysicsReady(const EntityItemPointer& entity) { if (entity && !entity->getCollisionless()) { const auto& entityType = entity->getType(); if (entityType == EntityTypes::Model) { - ModelEntityItem * modelEntity = std::dynamic_pointer_cast(entity).get(); + RenderableModelEntityItem * modelEntity = std::dynamic_pointer_cast(entity).get(); static const std::set downloadedCollisionTypes { SHAPE_TYPE_COMPOUND, SHAPE_TYPE_SIMPLE_COMPOUND, SHAPE_TYPE_STATIC_MESH, SHAPE_TYPE_SIMPLE_HULL }; bool hasAABox; entity->getAABox(hasAABox); if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) { - return (!entity->shouldBePhysical() || entity->isReadyToComputeShape()); + return (!entity->shouldBePhysical() || entity->isReadyToComputeShape() || modelEntity->computeShapeFailedToLoad()); } } } @@ -193,7 +205,7 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); - qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; + //qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -209,7 +221,7 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { _trackedEntityStabilityCount++; - qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; + //qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 3a01650a04..7df9762158 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -314,6 +314,14 @@ void RenderableModelEntityItem::getCollisionGeometryResource() { _compoundShapeResource = DependencyManager::get()->getCollisionGeometryResource(hullURL); } +bool RenderableModelEntityItem::computeShapeFailedToLoad() { + if (!_compoundShapeResource) { + getCollisionGeometryResource(); + } + + return (_compoundShapeResource && _compoundShapeResource->isFailed()); +} + void RenderableModelEntityItem::setShapeType(ShapeType type) { ModelEntityItem::setShapeType(type); if (getShapeType() == SHAPE_TYPE_COMPOUND) { @@ -342,7 +350,6 @@ void RenderableModelEntityItem::setCompoundShapeURL(const QString& url) { bool RenderableModelEntityItem::isReadyToComputeShape() const { ShapeType type = getShapeType(); - auto model = getModel(); if (type == SHAPE_TYPE_COMPOUND) { if (!model || getCompoundShapeURL().isEmpty()) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 75f35fae9c..6fcfa04a1d 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -81,6 +81,7 @@ public: virtual bool isReadyToComputeShape() const override; virtual void computeShapeInfo(ShapeInfo& shapeInfo) override; + bool computeShapeFailedToLoad(); virtual bool contains(const glm::vec3& point) const override; void stopModelOverrideIfNoParent(); diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index f669e8aaef..4d6297303b 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -551,6 +551,11 @@ QUrl NetworkMaterial::getTextureUrl(const QUrl& baseUrl, const FBXTexture& textu graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, image::TextureUsage::Type type, MapChannel channel) { + + if (baseUrl.isEmpty()) { + return nullptr; + } + const auto url = getTextureUrl(baseUrl, fbxTexture); const auto texture = DependencyManager::get()->getTexture(url, type, fbxTexture.content, fbxTexture.maxNumPixels); _textures[channel] = Texture { fbxTexture.name, texture }; From 010e2091fad99a9a547b917231247e63924b3ad5 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Mon, 1 Oct 2018 14:35:47 -0700 Subject: [PATCH 109/157] Fixup CPack install items for OSX to hopefully properly handle OSX .app directories --- server-console/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 1b6a644e7c..a30027989e 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -39,12 +39,14 @@ endif () # install the packaged Server Console in our install directory if (APPLE) install( - PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + USE_SOURCE_PERMISSIONS DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} ) install( - PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + USE_SOURCE_PERMISSIONS DESTINATION ${CONSOLE_INSTALL_DIR} COMPONENT ${CLIENT_COMPONENT} ) From 66bb5f68d28d2455001266b2ef96d3e086cc1395 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 1 Oct 2018 15:26:56 -0700 Subject: [PATCH 110/157] updating interstitialmode --- interface/src/octree/SafeLanding.cpp | 18 +----------------- scripts/system/interstitialPage.js | 1 + 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6f341c1990..6b28d9c713 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -123,19 +123,6 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); - - float sequencePercentage = 0.0f; - - if (_initialStart != INVALID_SEQUENCE && _initialEnd != 0) { - int sequenceSize = _initialStart <= _initialEnd ? _initialEnd - _initialStart: - _initialEnd + SEQUENCE_MODULO - _initialStart; - - auto startIter = _sequenceNumbers.find(_initialStart); - auto endIter = _sequenceNumbers.find(_initialEnd - 1); - - sequencePercentage = (distance(startIter, endIter) / (sequenceSize - 1)); - } - static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; float entityReadyPercentage = 0.0f; @@ -147,7 +134,7 @@ float SafeLanding::loadingProgressPercentage() { entityReadyPercentage *= 0.20f; } - return ((sequencePercentage *= 0.50f) + (entityReadyPercentage *= 0.50f)); + return entityReadyPercentage; } bool SafeLanding::isSequenceNumbersComplete() { @@ -204,8 +191,6 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); - - //qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -221,7 +206,6 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { _trackedEntityStabilityCount++; - //qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 00d62d7fc6..f066529375 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -264,6 +264,7 @@ function domainChanged(domain) { if (domain !== currentDomain) { MyAvatar.restoreAnimation(); + resetValues(); var name = location.placename; domainName = name.charAt(0).toUpperCase() + name.slice(1); var doRequest = true; From 69b547a9fe16cfe7422ab8ec4095cb353d06362c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Mon, 1 Oct 2018 16:11:27 -0700 Subject: [PATCH 111/157] text overlays for consistency --- scripts/system/interstitialPage.js | 64 +++++++++++--- scripts/system/redirectOverlays.js | 132 ++++++++++++++++++++++++----- 2 files changed, 164 insertions(+), 32 deletions(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 00d62d7fc6..38521208c7 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -38,7 +38,6 @@ var button = null; var errorConnectingToDomain = false; - var resettingError = false; // Tips have a character limit of 69 var userTips = [ @@ -128,7 +127,7 @@ localPosition: { x: 0.0 , y: -1.6, z: 0.0 }, text: toolTip, textAlpha: 1, - backgroundAlpha: 1, + backgroundAlpha: 0.00393, lineHeight: 0.13, visible: isVisible, ignoreRayIntersection: true, @@ -138,17 +137,47 @@ parentID: anchorOverlay }); - var loadingToTheSpotID = Overlays.addOverlay("image3d", { + var loadingToTheSpotText = Overlays.addOverlay("text3d", { name: "Loading-Destination-Card-Text", - localPosition: { x: 0.0 , y: -1.5, z: -0.3 }, - url: Script.resourcesPath() + "images/interstitialPage/goTo_button.png", + localPosition: { x: 0.0 , y: -1.687, z: -0.3 }, + text: "Go To TheSpot", + textAlpha: 1, + backgroundAlpha: 0.00393, + lineHeight: 0.10, + visible: isVisible, + ignoreRayIntersection: true, + dimensions: {x: 1, y: 0.17}, + drawInFront: true, + grabbable: false, + localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), + parentID: anchorOverlay + }); + + var loadingToTheSpotID = Overlays.addOverlay("image3d", { + name: "Loading-Destination-Card-GoTo-Image", + localPosition: { x: 0.0 , y: -1.75, z: -0.3 }, + url: Script.resourcesPath() + "images/interstitialPage/button.png", alpha: 1, visible: isVisible, emissive: true, ignoreRayIntersection: false, drawInFront: true, grabbable: false, - localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 180.0, z: 0.0 }), + localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), + parentID: anchorOverlay + }); + + var loadingToTheSpotHoverID = Overlays.addOverlay("image3d", { + name: "Loading-Destination-Card-GoTo-Image-Hover", + localPosition: { x: 0.0 , y: -1.75, z: -0.3 }, + url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", + alpha: 1, + visible: false, + emissive: true, + ignoreRayIntersection: false, + drawInFront: true, + grabbable: false, + localOrientation: Quat.fromVec3Degrees({ x: 0, y: 180, z: 0 }), parentID: anchorOverlay }); @@ -268,7 +297,7 @@ domainName = name.charAt(0).toUpperCase() + name.slice(1); var doRequest = true; if (name.length === 0 && location.href === "file:///~/serverless/tutorial.json") { - domainName = "Serveless Domain (Tutorial)"; + domainName = "Serverless Domain (Tutorial)"; doRequest = false; } var domainNameLeftMargin = getLeftMargin(domainNameTextID, domainName); @@ -319,8 +348,10 @@ var THE_PLACE = (HifiAbout.buildVersion === "dev") ? "hifi://TheSpot-dev": "hifi://TheSpot"; function clickedOnOverlay(overlayID, event) { - if (loadingToTheSpotID === overlayID) { + if (loadingToTheSpotHoverID === overlayID) { location.handleLookupString(THE_PLACE); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); } } @@ -353,6 +384,7 @@ renderViewTask.getConfig("LightingModel")["enableDirectionalLight"] = physicsEnabled; renderViewTask.getConfig("LightingModel")["enablePointLight"] = physicsEnabled; Overlays.editOverlay(loadingSphereID, mainSphereProperties); + Overlays.editOverlay(loadingToTheSpotText, properties); Overlays.editOverlay(loadingToTheSpotID, properties); Overlays.editOverlay(domainNameTextID, properties); Overlays.editOverlay(domainDescription, domainTextProperties); @@ -475,13 +507,15 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, { color: greyColor }); + Overlays.editOverlay(loadingToTheSpotID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); } }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, { color: whiteColor }); + if (overlayID === loadingToTheSpotHoverID) { + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); } }); @@ -510,9 +544,17 @@ }); } + // set left margin of text. + var loadingTextProperties = { + leftMargin: getLeftMargin(loadingToTheSpotText, "Go To TheSpot") + 0.045 + }; + + Overlays.editOverlay(loadingToTheSpotText, loadingTextProperties); + function cleanup() { Overlays.deleteOverlay(loadingSphereID); Overlays.deleteOverlay(loadingToTheSpotID); + Overlays.deleteOverlay(loadingToTheSpotHoverID); Overlays.deleteOverlay(domainNameTextID); Overlays.deleteOverlay(domainDescription); Overlays.deleteOverlay(domainToolTip); diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 8dd7d0d26a..49844db5b0 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -43,15 +43,15 @@ leftMargin: 0.538373570564886, visible: false, emissive: true, - ignoreRayIntersection: false, + ignoreRayIntersection: true, dimensions: oopsDimensions, grabbable: false, }); - var tryAgainImage = Overlays.addOverlay("image3d", { + var tryAgainImageNeutral = Overlays.addOverlay("image3d", { name: "tryAgainImage", localPosition: {x: -0.6, y: -0.6, z: 0.0}, - url: Script.resourcesPath() + "images/interstitialPage/button_tryAgain.png", + url: Script.resourcesPath() + "images/interstitialPage/button.png", alpha: 1, visible: false, emissive: true, @@ -61,10 +61,10 @@ parentID: redirectOopsText }); - var backImage = Overlays.addOverlay("image3d", { - name: "backImage", - localPosition: {x: 0.6, y: -0.6, z: 0.0}, - url: Script.resourcesPath() + "images/interstitialPage/button_back.png", + var tryAgainImageHover = Overlays.addOverlay("image3d", { + name: "tryAgainImageHover", + localPosition: {x: -0.6, y: -0.6, z: 0.0}, + url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", alpha: 1, visible: false, emissive: true, @@ -74,6 +74,62 @@ parentID: redirectOopsText }); + var tryAgainText = Overlays.addOverlay("text3d", { + name: "tryAgainText", + localPosition: {x: -0.6, y: -0.962, z: 0.0}, + text: "Try Again", + textAlpha: 1, + backgroundAlpha: 0.00393, + lineHeight: 0.08, + visible: false, + emissive: true, + ignoreRayIntersection: true, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + + var backImageNeutral = Overlays.addOverlay("image3d", { + name: "backImage", + localPosition: {x: 0.6, y: -0.6, z: 0.0}, + url: Script.resourcesPath() + "images/interstitialPage/button.png", + alpha: 1, + visible: false, + emissive: true, + ignoreRayIntersection: false, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + + var backImageHover = Overlays.addOverlay("image3d", { + name: "backImageHover", + localPosition: {x: 0.6, y: -0.6, z: 0.0}, + url: Script.resourcesPath() + "images/interstitialPage/button_hover.png", + alpha: 1, + visible: false, + emissive: true, + ignoreRayIntersection: false, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + + var backText = Overlays.addOverlay("text3d", { + name: "backText", + localPosition: {x: 0.6, y: -0.962, z: 0.0}, + text: "Back", + textAlpha: 1, + backgroundAlpha: 0.00393, + lineHeight: 0.08, + visible: false, + emissive: true, + ignoreRayIntersection: true, + grabbable: false, + orientation: Overlays.getProperty(redirectOopsText, "orientation"), + parentID: redirectOopsText + }); + function toggleOverlays(isInErrorState) { if (!isInErrorState) { var properties = { @@ -81,8 +137,10 @@ }; Overlays.editOverlay(redirectOopsText, properties); - Overlays.editOverlay(tryAgainImage, properties); - Overlays.editOverlay(backImage, properties); + Overlays.editOverlay(tryAgainImageNeutral, properties); + Overlays.editOverlay(tryAgainImageHover, properties); + Overlays.editOverlay(backImageNeutral, properties); + Overlays.editOverlay(backImageHover, properties); return; } var oopsText = getOopsText(); @@ -104,9 +162,29 @@ leftMargin: (textOverlayWidth - textWidth) / 2 }; + var tryAgainTextWidth = Overlays.textSize(tryAgainText, "Try Again").width; + var tryAgainImageWidth = Overlays.getProperty(tryAgainImageNeutral, "dimensions").x; + + var tryAgainTextProperties = { + visible: overlaysVisible, + leftMargin: (tryAgainImageWidth - tryAgainTextWidth) / 2 + }; + + var backTextWidth = Overlays.textSize(backText, "Back").width; + var backImageWidth = Overlays.getProperty(backImageNeutral, "dimensions").x; + + var backTextProperties = { + visible: overlaysVisible, + leftMargin: (backImageWidth - backTextWidth) / 2 + }; + Overlays.editOverlay(redirectOopsText, oopsTextProperties); - Overlays.editOverlay(tryAgainImage, properties); - Overlays.editOverlay(backImage, properties); + Overlays.editOverlay(tryAgainImageNeutral, properties); + Overlays.editOverlay(backImageNeutral, properties); + Overlays.editOverlay(tryAgainImageHover, {visible: false}); + Overlays.editOverlay(backImageHover, {visible: false}); + Overlays.editOverlay(tryAgainText, tryAgainTextProperties); + Overlays.editOverlay(backText, backTextProperties); } @@ -115,9 +193,9 @@ // don't allow right-clicks. return; } - if (tryAgainImage === overlayID) { + if (tryAgainImageHover === overlayID) { location.goToLastAddress(); - } else if (backImage === overlayID) { + } else if (backImageHover === overlayID) { location.goBack(); } } @@ -126,24 +204,36 @@ Script.clearInterval(timer); timer = null; Overlays.deleteOverlay(redirectOopsText); - Overlays.deleteOverlay(tryAgainImage); - Overlays.deleteOverlay(backImage); + Overlays.deleteOverlay(tryAgainImageNeutral); + Overlays.deleteOverlay(backImageNeutral); + Overlays.deleteOverlay(tryAgainImageHover); + Overlays.deleteOverlay(backImageHover); + Overlays.deleteOverlay(tryAgainText); + Overlays.deleteOverlay(backText); } toggleOverlays(true); - var whiteColor = {red: 255, green: 255, blue: 255}; - var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === backImage || overlayID === tryAgainImage) { - Overlays.editOverlay(overlayID, { color: greyColor }); + if (overlayID === backImageNeutral) { + Overlays.editOverlay(backImageNeutral, {visible: false}); + Overlays.editOverlay(backImageHover, {visible: true}); + } + if (overlayID === tryAgainImageNeutral) { + Overlays.editOverlay(tryAgainImageNeutral, {visible: false}); + Overlays.editOverlay(tryAgainImageHover, {visible: true}); } }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === backImage || overlayID === tryAgainImage) { - Overlays.editOverlay(overlayID, { color: whiteColor }); + if (overlayID === backImageHover) { + Overlays.editOverlay(backImageHover, {visible: false}); + Overlays.editOverlay(backImageNeutral, {visible: true}); + } + if (overlayID === tryAgainImageHover) { + Overlays.editOverlay(tryAgainImageHover, {visible: false}); + Overlays.editOverlay(tryAgainImageNeutral, {visible: true}); } }); From 392e2ff5356eea2a30397b31bd045847dcdf2342 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Mon, 1 Oct 2018 17:45:16 -0700 Subject: [PATCH 112/157] trying and failing andad trying and rince and repeat --- libraries/fbx/src/FBXReader_Mesh.cpp | 29 +-------------- libraries/render-utils/src/Blendshape.slh | 43 ++++++++++++----------- libraries/render-utils/src/Model.cpp | 32 ++++++++--------- libraries/render-utils/src/Model.h | 13 ------- 4 files changed, 38 insertions(+), 79 deletions(-) diff --git a/libraries/fbx/src/FBXReader_Mesh.cpp b/libraries/fbx/src/FBXReader_Mesh.cpp index 692c55d297..6b5a4d4d4c 100644 --- a/libraries/fbx/src/FBXReader_Mesh.cpp +++ b/libraries/fbx/src/FBXReader_Mesh.cpp @@ -585,7 +585,6 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { FBXMesh& fbxMesh = extractedMesh; graphics::MeshPointer mesh(new graphics::Mesh()); - bool hasBlendShapes = !fbxMesh.blendshapes.empty(); int numVerts = extractedMesh.vertices.size(); if (!fbxMesh.normals.empty() && fbxMesh.tangents.empty()) { @@ -761,33 +760,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { bool interleavePositions = true; bool interleaveNormalsTangents = true; - // TODO: We are using the same vertex format layout for all meshes because this is more efficient - // This work is going into rc73 release which is meant to be used for the SPot500 event and we are picking the format - // that works best for blendshaped and skinned meshes aka the avatars. - // We will improve this technique in a hot fix to 73. - hasBlendShapes = false; - - // If has blend shapes allocate and assign buffers for pos and tangents now - if (hasBlendShapes) { - auto posBuffer = std::make_shared(); - posBuffer->setData(positionsSize, (const gpu::Byte*) vertBuffer->getData() + positionsOffset); - vertexBufferStream->addBuffer(posBuffer, 0, positionElement.getSize()); - - auto normalsAndTangentsBuffer = std::make_shared(); - normalsAndTangentsBuffer->setData(normalsAndTangentsSize, (const gpu::Byte*) vertBuffer->getData() + normalsAndTangentsOffset); - vertexBufferStream->addBuffer(normalsAndTangentsBuffer, 0, normalsAndTangentsStride); - - // update channels and attribBuffer size accordingly - interleavePositions = false; - interleaveNormalsTangents = false; - - tangentChannel = 1; - attribChannel = 2; - - totalAttribBufferSize = totalVertsSize - positionsSize - normalsAndTangentsSize; - } - - // Define the vertex format, compute the offset for each attributes as we append them to the vertex format + // Define the vertex format, compute the offset for each attributes as we append them to the vertex format gpu::Offset bufOffset = 0; if (positionsSize) { vertexFormat->setAttribute(gpu::Stream::POSITION, posChannel, positionElement, bufOffset); diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index bba0c615a9..35effed2fb 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -26,52 +26,53 @@ struct BlendshapeOffset { const float oneOver511 = 1.0 / 511.0; -vec3 unpackSnorm3x10_1x2(int packedX10Y10Z10A2) { - vec4 my_unpacked = vec4( - clamp( float( (packedX10Y10Z10A2 & 0x000003FF) - 511 ) / 511.0, -1.0, 1.0), - clamp( float( ((packedX10Y10Z10A2 >> 10) & 0x000003FF) - 511 ) / 511.0, -1.0, 1.0), - clamp( float( ((packedX10Y10Z10A2 >> 20) & 0x000003FF) - 511 ) / 511.0, -1.0, 1.0), - 0.0//clamp( float( int((packedX10Y10Z10A2 >> 30) & 0x00000003) - 1 ), -1.0, 1.0) +vec3 unpackSnorm3x10_1x2(int packed) { + vec4 _unpacked = vec4( + clamp( float( bitfieldExtract(packed, 0, 10)) * oneOver511, -1.0, 1.0), + clamp( float( bitfieldExtract(packed, 10, 10)) * oneOver511, -1.0, 1.0), + clamp( float( bitfieldExtract(packed, 20, 10)) * oneOver511, -1.0, 1.0), + 0.0 ); - return my_unpacked.xyz; + return _unpacked.xyz; } #if defined(GPU_GL410) layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; + +vec2 gpu_unpackHalf2x16(uint packed) { + return unpackHalf2x16(packed); +} + BlendshapeOffset getBlendshapeOffset(int i) { vec4 fetched = texelFetch(blendshapeOffsetsBuffer, i); - ivec4 elem_packed = ivec4(floatBitsToUint(fetched.x), floatBitsToUint(fetched.y), floatBitsToUint(fetched.z), floatBitsToUint(fetched.w)); + uvec4 elem_packed = uvec4(floatBitsToUint(fetched.x), floatBitsToUint(fetched.y), floatBitsToUint(fetched.z), floatBitsToUint(fetched.w)); BlendshapeOffset unpacked; - vec2 pZnZ = unpackHalf2x16(uint(elem_packed.y)); - unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), pZnZ.x); + unpacked.position = vec3(gpu_unpackHalf2x16((elem_packed.x)), gpu_unpackHalf2x16(uint(elem_packed.y)).x); <@if USE_NORMAL@> - unpacked.normal = vec3(unpackHalf2x16(uint(elem_packed.z)), pZnZ.y); - //unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz; + unpacked.normal = unpackSnorm3x10_1x2(int(elem_packed.z)).xyz; <@endif@> <@if USE_TANGENT@> - unpacked.tangent = unpackSnorm3x10_1x2((elem_packed.w)).xyz; + unpacked.tangent = unpackSnorm3x10_1x2(int(elem_packed.w)).xyz; <@endif@> return unpacked; } #else layout(std140, binding=0) buffer blendshapeOffsetsBuffer { - ivec4 _packedBlendshapeOffsets[]; + uvec4 _packedBlendshapeOffsets[]; }; BlendshapeOffset getBlendshapeOffset(int i) { - ivec4 elem_packed = _packedBlendshapeOffsets[i]; + uvec4 elem_packed = _packedBlendshapeOffsets[i]; BlendshapeOffset unpacked; - vec2 pZnZ = unpackHalf2x16(uint(elem_packed.y)); - unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), pZnZ.x); + unpacked.position = vec3(unpackHalf2x16((elem_packed.x)), unpackHalf2x16(uint(elem_packed.y)).x); <@if USE_NORMAL@> - unpacked.normal = vec3(unpackHalf2x16(uint(elem_packed.z)), pZnZ.y); - //unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz; + unpacked.normal = unpackSnorm3x10_1x2(int(elem_packed.z)).xyz; <@endif@> <@if USE_TANGENT@> - unpacked.tangent = unpackSnorm3x10_1x2((elem_packed.w)).xyz; + unpacked.tangent = unpackSnorm3x10_1x2(int(elem_packed.w)).xyz; <@endif@> return unpacked; @@ -92,7 +93,7 @@ void evalBlendshape(int i, vec4 inPosition, out vec4 position normal = normalize(inNormal + blendshapeOffset.normal.xyz); <@endif@> <@if USE_TANGENT@> - tangent = normalize(inTangent /*+ blendshapeOffset.tangent.xyz*/); + tangent = normalize(inTangent + blendshapeOffset.tangent.xyz); <@endif@> } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index da21ddf39f..765651c626 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1633,6 +1633,8 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe } +//#define DEBUG_PACKED_BLENDSHAPE_OFFSET 1 + void Blender::run() { QVector blendshapeOffsets; if (_model && _model->isLoaded()) { @@ -1651,8 +1653,7 @@ void Blender::run() { offset += modelMeshBlendshapeOffsets->second.size(); std::vector unpackedBlendshapeOffsets(modelMeshBlendshapeOffsets->second.size()); - // const float NORMAL_COEFFICIENT_SCALE = 0.01f; - const float NORMAL_COEFFICIENT_SCALE = 1.0f; + const float NORMAL_COEFFICIENT_SCALE = 0.01f; for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) { float vertexCoefficient = _blendshapeCoefficients.at(i); const float EPSILON = 0.0001f; @@ -1668,38 +1669,37 @@ void Blender::run() { for (auto j = range.begin(); j < range.end(); j++) { int index = blendshape.indices.at(j); -#ifdef PACKED_BLENDSHAPE_OFFSET auto& currentBlendshapeOffset = unpackedBlendshapeOffsets[index]; currentBlendshapeOffset.positionOffsetAndSpare += blendshape.vertices.at(j) * vertexCoefficient; currentBlendshapeOffset.normalOffsetAndSpare += blendshape.normals.at(j) * normalCoefficient; if (doTangent) { - currentBlendshapeOffset.tangentOffsetAndSpare += blendshape.tangents.at(j) * normalCoefficient; - } -#else - auto& currentBlendshapeOffset = blendshapeOffsets[index]; - currentBlendshapeOffset.positionOffsetAndSpare += glm::vec4(blendshape.vertices.at(j) * vertexCoefficient, 0.0f); - - currentBlendshapeOffset.normalOffsetAndSpare += glm::vec4(blendshape.normals.at(j) * normalCoefficient, 0.0f); - if (index < mesh.tangents.size()) { if ((int)j < blendshape.tangents.size()) { - currentBlendshapeOffset.tangentOffsetAndSpare += glm::vec4(blendshape.tangents.at(j) * normalCoefficient, 0.0f); + currentBlendshapeOffset.tangentOffsetAndSpare += blendshape.tangents.at(j) * normalCoefficient; } } + +#ifdef DEBUG_PACKED_BLENDSHAPE_OFFSET + if (glm::any(glm::greaterThan(glm::abs(currentBlendshapeOffset.normalOffsetAndSpare), glm::vec3(1.0f)))) { + currentBlendshapeOffset.normalOffsetAndSpare = glm::clamp(currentBlendshapeOffset.normalOffsetAndSpare, glm::vec3(-1.0f), glm::vec3(1.0f)); + } + if (glm::any(glm::greaterThan(glm::abs(currentBlendshapeOffset.tangentOffsetAndSpare), glm::vec3(1.0f)))) { + currentBlendshapeOffset.tangentOffsetAndSpare = glm::clamp(currentBlendshapeOffset.tangentOffsetAndSpare, glm::vec3(-1.0f), glm::vec3(1.0f)); + } #endif } }); } -#ifdef PACKED_BLENDSHAPE_OFFSET + // Blendshape offsets are generrated, now let's pack it on its way to gpu tbb::parallel_for(tbb::blocked_range(0, (int) unpackedBlendshapeOffsets.size()), [&](const tbb::blocked_range& range) { auto unpacked = unpackedBlendshapeOffsets.data() + range.begin(); auto packed = meshBlendshapeOffsets + range.begin(); for (auto j = range.begin(); j < range.end(); j++) { (*packed).packedPosNorTan = glm::uvec4( glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)), - glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, unpacked->normalOffsetAndSpare.z)), - glm::packHalf2x16(glm::vec2(unpacked->normalOffsetAndSpare)), + glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)) ); @@ -1707,8 +1707,6 @@ void Blender::run() { packed++; } }); -#endif - } } // post the result to the ModelBlender, which will dispatch to the model if still alive diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index c6dfff535c..b7a3088a48 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -75,10 +75,6 @@ struct SortedTriangleSet { int subMeshIndex; }; - - -#define PACKED_BLENDSHAPE_OFFSET 1 -#ifdef PACKED_BLENDSHAPE_OFFSET struct BlendshapeOffsetPacked { glm::uvec4 packedPosNorTan; }; @@ -90,15 +86,6 @@ struct BlendshapeOffsetUnpacked { }; using BlendshapeOffset = BlendshapeOffsetPacked; -#else - -struct BlendshapeOffsetUnpacked { - glm::vec4 positionOffsetAndSpare; - glm::vec4 normalOffsetAndSpare; - glm::vec4 tangentOffsetAndSpare; -}; -using BlendshapeOffset = BlendshapeOffsetUnpacked; -#endif /// A generic 3D model displaying geometry loaded from a URL. class Model : public QObject, public std::enable_shared_from_this, public scriptable::ModelProvider { From 34a7aff2efc33d78d3647341574f70b5779092c8 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Mon, 1 Oct 2018 20:12:00 -0700 Subject: [PATCH 113/157] Differentiate name of Console.app/Sandbox.app depending on client_only build --- cmake/macros/SetPackagingParameters.cmake | 7 ++++++- server-console/CMakeLists.txt | 16 ++++++++++++---- server-console/packager.js | 7 +++---- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 297382b4e5..3bf984534b 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -143,7 +143,12 @@ macro(SET_PACKAGING_PARAMETERS) set(CONSOLE_INSTALL_DIR ${DMG_SUBFOLDER_NAME}) set(INTERFACE_INSTALL_DIR ${DMG_SUBFOLDER_NAME}) - set(CONSOLE_EXEC_NAME "Sandbox.app") + if (CLIENT_ONLY) + set(CONSOLE_EXEC_NAME "Console.app") + else () + set(CONSOLE_EXEC_NAME "Sandbox.app") + endif() + set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME}") set(CONSOLE_APP_CONTENTS "${CONSOLE_INSTALL_APP_PATH}/Contents") diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index a30027989e..150561ffbb 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -4,13 +4,17 @@ if (PRODUCTION_BUILD) set(PRODUCTION_OPTION "--production") endif() +if (CLIENT_ONLY) + set(CLIENT_ONLY_OPTION "--client_only") +endif() + # add a target that will package the console add_custom_target(${TARGET_NAME}-npm-install COMMAND npm install WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) add_custom_target(${TARGET_NAME} - COMMAND npm run packager -- --out ${CMAKE_CURRENT_BINARY_DIR} ${PRODUCTION_OPTION} + COMMAND npm run packager -- --out ${CMAKE_CURRENT_BINARY_DIR} ${PRODUCTION_OPTION} ${CLIENT_ONLY_OPTION} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${TARGET_NAME}-npm-install ) @@ -29,7 +33,11 @@ endif() # set the packaged console folder depending on platform, so we can copy it if (APPLE) - set(PACKAGED_CONSOLE_FOLDER "Sandbox-darwin-x64/${CONSOLE_EXEC_NAME}") + if (CLIENT_ONLY) + set(PACKAGED_CONSOLE_FOLDER "Console-darwin-x64/${CONSOLE_EXEC_NAME}") + else () + set(PACKAGED_CONSOLE_FOLDER "Sandbox-darwin-x64/${CONSOLE_EXEC_NAME}") + endif() elseif (WIN32) set(PACKAGED_CONSOLE_FOLDER "server-console-win32-x64") elseif (UNIX) @@ -45,9 +53,9 @@ if (APPLE) COMPONENT ${SERVER_COMPONENT} ) install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}/" USE_SOURCE_PERMISSIONS - DESTINATION ${CONSOLE_INSTALL_DIR} + DESTINATION ${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME} COMPONENT ${CLIENT_COMPONENT} ) elseif (WIN32) diff --git a/server-console/packager.js b/server-console/packager.js index 31655fe565..00866ee1be 100644 --- a/server-console/packager.js +++ b/server-console/packager.js @@ -27,14 +27,13 @@ var options = { } const EXEC_NAME = "server-console"; -const SHORT_NAME = "Console"; -const OSX_SHORT_NAME = "Sandbox"; -const FULL_NAME = "High Fidelity Console"; +var SHORT_NAME = argv.client_only ? "Console" : "Sandbox"; +var FULL_NAME = argv.client_only ? "High Fidelity Console" : "High Fidelity Sandbox"; // setup per OS options if (osType == "Darwin") { options["app-bundle-id"] = "com.highfidelity.server-console" + (argv.production ? "" : "-dev") - options["name"] = OSX_SHORT_NAME + options["name"] = SHORT_NAME } else if (osType == "Windows_NT") { options["version-string"] = { CompanyName: "High Fidelity, Inc.", From d1d4920c35b411ddcd60dccbb80f6c4f9f741fec Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 1 Oct 2018 21:35:18 -0700 Subject: [PATCH 114/157] Check and fixed the shader for nvidia regarding the unpacked variable name, adjust luci.js to be able to move the viewport --- libraries/render-utils/src/Blendshape.slh | 16 +++++++--------- libraries/render-utils/src/Model.cpp | 11 +---------- scripts/developer/utilities/render/luci.js | 6 +++--- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 35effed2fb..c6ba6f8fd3 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -26,21 +26,19 @@ struct BlendshapeOffset { const float oneOver511 = 1.0 / 511.0; -vec3 unpackSnorm3x10_1x2(int packed) { - vec4 _unpacked = vec4( - clamp( float( bitfieldExtract(packed, 0, 10)) * oneOver511, -1.0, 1.0), - clamp( float( bitfieldExtract(packed, 10, 10)) * oneOver511, -1.0, 1.0), - clamp( float( bitfieldExtract(packed, 20, 10)) * oneOver511, -1.0, 1.0), - 0.0 +vec3 unpackSnorm3x10_1x2(int packedValue) { + return vec3( + clamp( float( bitfieldExtract(packedValue, 0, 10)) * oneOver511, -1.0, 1.0), + clamp( float( bitfieldExtract(packedValue, 10, 10)) * oneOver511, -1.0, 1.0), + clamp( float( bitfieldExtract(packedValue, 20, 10)) * oneOver511, -1.0, 1.0) ); - return _unpacked.xyz; } #if defined(GPU_GL410) layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; -vec2 gpu_unpackHalf2x16(uint packed) { - return unpackHalf2x16(packed); +vec2 gpu_unpackHalf2x16(uint packedValue) { + return unpackHalf2x16(packedValue); } BlendshapeOffset getBlendshapeOffset(int i) { diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 765651c626..50abaef01f 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1633,7 +1633,7 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe } -//#define DEBUG_PACKED_BLENDSHAPE_OFFSET 1 +#define DEBUG_PACKED_BLENDSHAPE_OFFSET 1 void Blender::run() { QVector blendshapeOffsets; @@ -1678,15 +1678,6 @@ void Blender::run() { currentBlendshapeOffset.tangentOffsetAndSpare += blendshape.tangents.at(j) * normalCoefficient; } } - -#ifdef DEBUG_PACKED_BLENDSHAPE_OFFSET - if (glm::any(glm::greaterThan(glm::abs(currentBlendshapeOffset.normalOffsetAndSpare), glm::vec3(1.0f)))) { - currentBlendshapeOffset.normalOffsetAndSpare = glm::clamp(currentBlendshapeOffset.normalOffsetAndSpare, glm::vec3(-1.0f), glm::vec3(1.0f)); - } - if (glm::any(glm::greaterThan(glm::abs(currentBlendshapeOffset.tangentOffsetAndSpare), glm::vec3(1.0f)))) { - currentBlendshapeOffset.tangentOffsetAndSpare = glm::clamp(currentBlendshapeOffset.tangentOffsetAndSpare, glm::vec3(-1.0f), glm::vec3(1.0f)); - } -#endif } }); } diff --git a/scripts/developer/utilities/render/luci.js b/scripts/developer/utilities/render/luci.js index 005d96780a..cb5b01f9b2 100644 --- a/scripts/developer/utilities/render/luci.js +++ b/scripts/developer/utilities/render/luci.js @@ -81,10 +81,10 @@ function setDebugCursor(x, y) { - nx = (x / Window.innerWidth); - ny = 1.0 - ((y) / (Window.innerHeight - 32)); + nx = 2.0 * (x / Window.innerWidth) - 1.0; + ny = 1.0 - 2.0 * ((y) / (Window.innerHeight)); - Render.getConfig("RenderMainView").getConfig("Antialiasing").debugCursorTexcoord = { x: nx, y: ny }; + Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 }; } From c95c736b1ffe480b7a76a431e8f2c6528c71c7e0 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 1 Oct 2018 22:50:29 -0700 Subject: [PATCH 115/157] FOUnd a working path for gl41 --- libraries/render-utils/src/Blendshape.slh | 11 +++-------- libraries/render-utils/src/Model.cpp | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index c6ba6f8fd3..34bd43cabb 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -37,16 +37,11 @@ vec3 unpackSnorm3x10_1x2(int packedValue) { #if defined(GPU_GL410) layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; -vec2 gpu_unpackHalf2x16(uint packedValue) { - return unpackHalf2x16(packedValue); -} - BlendshapeOffset getBlendshapeOffset(int i) { - vec4 fetched = texelFetch(blendshapeOffsetsBuffer, i); - uvec4 elem_packed = uvec4(floatBitsToUint(fetched.x), floatBitsToUint(fetched.y), floatBitsToUint(fetched.z), floatBitsToUint(fetched.w)); - + uvec4 elem_packed = floatBitsToUint(texelFetch(blendshapeOffsetsBuffer, i)); + BlendshapeOffset unpacked; - unpacked.position = vec3(gpu_unpackHalf2x16((elem_packed.x)), gpu_unpackHalf2x16(uint(elem_packed.y)).x); + unpacked.position = unpackSnorm3x10_1x2(int(elem_packed.y)).xyz * uintBitsToFloat(elem_packed.x); <@if USE_NORMAL@> unpacked.normal = unpackSnorm3x10_1x2(int(elem_packed.z)).xyz; <@endif@> diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 50abaef01f..6ee39ca3aa 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1687,13 +1687,29 @@ void Blender::run() { auto unpacked = unpackedBlendshapeOffsets.data() + range.begin(); auto packed = meshBlendshapeOffsets + range.begin(); for (auto j = range.begin(); j < range.end(); j++) { + +#ifdef Q_OS_MAC + float len = glm::compMax(glm::abs(unpacked->positionOffsetAndSpare)); + if (len > 1.0f) { + unpacked->positionOffsetAndSpare /= len; + } else { + len = 1.0f; + } + + (*packed).packedPosNorTan = glm::uvec4( + glm::floatBitsToUint(len), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->positionOffsetAndSpare, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)) + ); +#else (*packed).packedPosNorTan = glm::uvec4( glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)), glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)), glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)) ); - +#endif unpacked++; packed++; } From 95ef46d77c35e606a7bd952633e16313833b95d1 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Tue, 2 Oct 2018 10:00:42 -0700 Subject: [PATCH 116/157] fix some coding standards issues --- server-console/src/main.js | 8 ++++---- server-console/src/modules/hf-notifications.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index 04e77315bc..c26938745b 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -107,7 +107,7 @@ userConfig.load(configPath); const ipcMain = electron.ipcMain; -function isInterfaceInstalled() { +function isInterfaceInstalled () { if (osType == "Darwin") { // In OSX Sierra, the app translocation process moves // the executable to a random location before starting it @@ -120,7 +120,7 @@ function isInterfaceInstalled() { } } -function isServerInstalled() { +function isServerInstalled () { return dsPath && acPath; } @@ -338,7 +338,7 @@ const HifiNotificationType = hfNotifications.NotificationType; var pendingNotifications = {} var notificationState = NotificationState.UNNOTIFIED; -function setNotificationState(notificationType, pending = true) { +function setNotificationState (notificationType, pending = true) { pendingNotifications[notificationType] = pending; notificationState = NotificationState.UNNOTIFIED; for (var key in pendingNotifications) { @@ -526,7 +526,7 @@ function buildMenuArray(serverState) { menuArray.push(labels.share); menuArray.push(separator); if (isInterfaceInstalled()) { - if(trayNotifications.enabled()) { + if (trayNotifications.enabled()) { menuArray.push(labels.goto); menuArray.push(labels.people); menuArray.push(labels.wallet); diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index 13c5a6d8fa..f3b6912c08 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -123,7 +123,7 @@ HifiNotification.prototype = { timeout: 5 }, function (error, reason, metadata) { - if(_finished) { + if (_finished) { if (osType === 'Darwin') { setTimeout(_finished, OSX_CLICK_DELAY_TIMEOUT); } else { From ff24a9903295d4bdb2549d9389b4f57ab01865f0 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 2 Oct 2018 11:18:20 -0700 Subject: [PATCH 117/157] Unify the the packing of the blendshape offset for simplicity and settle on the name DrawcallUniform --- libraries/gpu/src/gpu/Batch.cpp | 14 +++-- libraries/gpu/src/gpu/Batch.h | 12 +++- libraries/render-utils/src/Blendshape.slh | 53 +++++++---------- .../render-utils/src/MeshPartPayload.cpp | 2 +- libraries/render-utils/src/Model.cpp | 59 +++++++++++-------- 5 files changed, 72 insertions(+), 68 deletions(-) diff --git a/libraries/gpu/src/gpu/Batch.cpp b/libraries/gpu/src/gpu/Batch.cpp index 26222a2cc0..018ca8f02f 100644 --- a/libraries/gpu/src/gpu/Batch.cpp +++ b/libraries/gpu/src/gpu/Batch.cpp @@ -98,7 +98,8 @@ void Batch::clear() { _name = nullptr; _invalidModel = true; _currentModel = Transform(); - _drawcallUserInfo = 0; + _drawcallUniform = 0; + _drawcallUniformReset = 0; _projectionJitter = glm::vec2(0.0f); _enableStereo = true; _enableSkybox = false; @@ -113,8 +114,11 @@ size_t Batch::cacheData(size_t size, const void* data) { return offset; } -void Batch::setDrawcallInfo(uint16_t user) { - _drawcallUserInfo = user; +void Batch::setDrawcallUniform(uint16_t uniform) { + _drawcallUniform = uniform; +} +void Batch::setDrawcallUniformReset(uint16_t uniformReset) { + _drawcallUniformReset = uniformReset; } void Batch::draw(Primitive primitiveType, uint32 numVertices, uint32 startVertex) { @@ -550,8 +554,8 @@ void Batch::captureDrawCallInfoImpl() { } auto& drawCallInfos = getDrawCallInfoBuffer(); - drawCallInfos.emplace_back((uint16)_objects.size() - 1, _drawcallUserInfo); - _drawcallUserInfo = 0; + drawCallInfos.emplace_back((uint16)_objects.size() - 1, _drawcallUniform); + _drawcallUniform = _drawcallUniformReset; } void Batch::captureDrawCallInfo() { diff --git a/libraries/gpu/src/gpu/Batch.h b/libraries/gpu/src/gpu/Batch.h index 6e74d210ed..0f9c2f554b 100644 --- a/libraries/gpu/src/gpu/Batch.h +++ b/libraries/gpu/src/gpu/Batch.h @@ -112,8 +112,13 @@ public: void enableSkybox(bool enable = true); bool isSkyboxEnabled() const; - // Push user Drawcall info - void setDrawcallInfo(uint16 user); + // Drawcall Uniform value + // One 16bit word uniform value is available during the drawcall + // its value must be set before each drawcall + void setDrawcallUniform(uint16 uniform); + // It is reset to the reset value between each drawcalls + // The reset value is 0 by default and can be changed as a batch state with this call + void setDrawcallUniformReset(uint16 resetUniform); // Drawcalls void draw(Primitive primitiveType, uint32 numVertices, uint32 startVertex = 0); @@ -503,7 +508,8 @@ public: NamedBatchDataMap _namedData; - uint16_t _drawcallUserInfo{ 0 }; + uint16_t _drawcallUniform{ 0 }; + uint16_t _drawcallUniformReset{ 0 }; glm::vec2 _projectionJitter{ 0.0f, 0.0f }; bool _enableStereo{ true }; diff --git a/libraries/render-utils/src/Blendshape.slh b/libraries/render-utils/src/Blendshape.slh index 34bd43cabb..df62af5a77 100644 --- a/libraries/render-utils/src/Blendshape.slh +++ b/libraries/render-utils/src/Blendshape.slh @@ -10,9 +10,19 @@ <@func declareBlendshape(USE_NORMAL, USE_TANGENT)@> -struct PackedBlendshapeOffset { - uvec4 packedPosNorTan; +#if defined(GPU_GL410) +layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; +uvec4 getPackedBlendshapeOffset(int i) { + return floatBitsToUint(texelFetch(blendshapeOffsetsBuffer, i)); +} +#else +layout(std140, binding=0) buffer blendshapeOffsetsBuffer { + uvec4 _packedBlendshapeOffsets[]; }; +uvec4 getPackedBlendshapeOffset(int i) { + return _packedBlendshapeOffsets[i]; +} +#endif struct BlendshapeOffset { vec3 position; @@ -24,9 +34,8 @@ struct BlendshapeOffset { <@endif@> }; -const float oneOver511 = 1.0 / 511.0; - -vec3 unpackSnorm3x10_1x2(int packedValue) { +vec3 unpackSnorm3x10_1x2(int packedValue) { + const float oneOver511 = 1.0 / 511.0; return vec3( clamp( float( bitfieldExtract(packedValue, 0, 10)) * oneOver511, -1.0, 1.0), clamp( float( bitfieldExtract(packedValue, 10, 10)) * oneOver511, -1.0, 1.0), @@ -34,43 +43,21 @@ vec3 unpackSnorm3x10_1x2(int packedValue) { ); } -#if defined(GPU_GL410) -layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; - -BlendshapeOffset getBlendshapeOffset(int i) { - uvec4 elem_packed = floatBitsToUint(texelFetch(blendshapeOffsetsBuffer, i)); - +BlendshapeOffset unpackBlendshapeOffset(uvec4 packedValue) { BlendshapeOffset unpacked; - unpacked.position = unpackSnorm3x10_1x2(int(elem_packed.y)).xyz * uintBitsToFloat(elem_packed.x); + unpacked.position = unpackSnorm3x10_1x2(int(packedValue.y)).xyz * uintBitsToFloat(packedValue.x); <@if USE_NORMAL@> - unpacked.normal = unpackSnorm3x10_1x2(int(elem_packed.z)).xyz; + unpacked.normal = unpackSnorm3x10_1x2(int(packedValue.z)).xyz; <@endif@> <@if USE_TANGENT@> - unpacked.tangent = unpackSnorm3x10_1x2(int(elem_packed.w)).xyz; + unpacked.tangent = unpackSnorm3x10_1x2(int(packedValue.w)).xyz; <@endif@> - return unpacked; } -#else -layout(std140, binding=0) buffer blendshapeOffsetsBuffer { - uvec4 _packedBlendshapeOffsets[]; -}; + BlendshapeOffset getBlendshapeOffset(int i) { - - uvec4 elem_packed = _packedBlendshapeOffsets[i]; - - BlendshapeOffset unpacked; - unpacked.position = vec3(unpackHalf2x16((elem_packed.x)), unpackHalf2x16(uint(elem_packed.y)).x); -<@if USE_NORMAL@> - unpacked.normal = unpackSnorm3x10_1x2(int(elem_packed.z)).xyz; -<@endif@> -<@if USE_TANGENT@> - unpacked.tangent = unpackSnorm3x10_1x2(int(elem_packed.w)).xyz; -<@endif@> - - return unpacked; + return unpackBlendshapeOffset(getPackedBlendshapeOffset(i)); } -#endif void evalBlendshape(int i, vec4 inPosition, out vec4 position <@if USE_NORMAL@> diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index a1220c04fa..13ee688fac 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -423,7 +423,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) { // IF deformed pass the mesh key auto drawcallInfo = (uint16_t) (((_isBlendShaped && args->_enableBlendshape) << 0) | ((_isSkinned && args->_enableSkinning) << 1)); if (drawcallInfo) { - batch.setDrawcallInfo(drawcallInfo); + batch.setDrawcallUniform(drawcallInfo); } // apply material properties diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 6ee39ca3aa..5d46ee49f1 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1610,6 +1610,37 @@ public: } }; + +using packBlendshapeOffsetTo = void(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked); + +void packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked) { + float len = glm::compMax(glm::abs(unpacked.positionOffsetAndSpare)); + glm::vec3 normalizedPos(unpacked.positionOffsetAndSpare); + if (len > 1.0f) { + normalizedPos /= len; + } + else { + len = 1.0f; + } + + packed = glm::uvec4( + glm::floatBitsToUint(len), + glm::packSnorm3x10_1x2(glm::vec4(normalizedPos, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked.normalOffsetAndSpare, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked.tangentOffsetAndSpare, 0.0f)) + ); +} + +void packBlendshapeOffsetTo_Pos_3xF16_Nor_3xSN10_Tan_3xSN10(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked) { + packed = glm::uvec4( + glm::packHalf2x16(glm::vec2(unpacked.positionOffsetAndSpare)), + glm::packHalf2x16(glm::vec2(unpacked.positionOffsetAndSpare.z, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked.normalOffsetAndSpare, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked.tangentOffsetAndSpare, 0.0f)) + ); +} + + class Blender : public QRunnable { public: @@ -1632,9 +1663,6 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe _blendshapeCoefficients(blendshapeCoefficients) { } - -#define DEBUG_PACKED_BLENDSHAPE_OFFSET 1 - void Blender::run() { QVector blendshapeOffsets; if (_model && _model->isLoaded()) { @@ -1687,29 +1715,8 @@ void Blender::run() { auto unpacked = unpackedBlendshapeOffsets.data() + range.begin(); auto packed = meshBlendshapeOffsets + range.begin(); for (auto j = range.begin(); j < range.end(); j++) { - -#ifdef Q_OS_MAC - float len = glm::compMax(glm::abs(unpacked->positionOffsetAndSpare)); - if (len > 1.0f) { - unpacked->positionOffsetAndSpare /= len; - } else { - len = 1.0f; - } - - (*packed).packedPosNorTan = glm::uvec4( - glm::floatBitsToUint(len), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->positionOffsetAndSpare, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)) - ); -#else - (*packed).packedPosNorTan = glm::uvec4( - glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare)), - glm::packHalf2x16(glm::vec2(unpacked->positionOffsetAndSpare.z, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->normalOffsetAndSpare, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked->tangentOffsetAndSpare, 0.0f)) - ); -#endif + packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10((*packed).packedPosNorTan, (*unpacked)); + unpacked++; packed++; } From 182c92b95116fbb1a62942a710fdab49b0a72d2e Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 2 Oct 2018 11:23:13 -0700 Subject: [PATCH 118/157] fix mac issue --- .../qml/hifi/avatarapp/AdjustWearables.qml | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml index 08c74794fc..361ac838fe 100644 --- a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml +++ b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml @@ -123,7 +123,7 @@ Rectangle { var wearable = wearablesCombobox.model.get(i); if (wearable.id === entityID) { wearablesCombobox.currentIndex = i; - isSoft.enabled = entityHasAvatarJoints(entityID); + softWearableTimer.restart(); break; } } @@ -145,6 +145,20 @@ Rectangle { hoverEnabled: true; } + Timer { + id: softWearableTimer + interval: 500 + running: false + repeat: false + onTriggered: { + var currentWearable = getCurrentWearable(); + var soft = currentWearable ? currentWearable.relayParentJoints : false; + var softEnabled = currentWearable ? entityHasAvatarJoints(currentWearable.id) : false; + isSoft.set(soft); + isSoft.enabled = softEnabled; + } + } + Column { anchors.top: parent.top anchors.topMargin: 12 @@ -262,16 +276,12 @@ Rectangle { var rotation = currentWearable ? currentWearable.localRotationAngles : { x : 0, y : 0, z : 0 }; var scale = currentWearable ? currentWearable.dimensions.x / currentWearable.naturalDimensions.x : 1.0; var joint = currentWearable ? currentWearable.parentJointIndex : -1; - var soft = currentWearable ? currentWearable.relayParentJoints : false; - var softEnabled = currentWearable ? entityHasAvatarJoints(currentWearable.id) : false; - + softWearableTimer.restart(); positionVector.set(position); rotationVector.set(rotation); scalespinner.set(scale); jointsCombobox.set(joint); - isSoft.set(soft); - isSoft.enabled = softEnabled; if (currentWearable) { From e5df35677404d8494a6e9295ff5c8dc41360f51e Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 2 Oct 2018 12:38:14 -0700 Subject: [PATCH 119/157] Fixing warnings from jenkins --- libraries/fbx/src/FBXReader_Mesh.cpp | 1 - libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/libraries/fbx/src/FBXReader_Mesh.cpp b/libraries/fbx/src/FBXReader_Mesh.cpp index 6b5a4d4d4c..c9b004c3a8 100644 --- a/libraries/fbx/src/FBXReader_Mesh.cpp +++ b/libraries/fbx/src/FBXReader_Mesh.cpp @@ -617,7 +617,6 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { qWarning() << "Unexpected tangents in " << url; } const auto normalsAndTangentsSize = normalsSize + tangentsSize; - const int normalsAndTangentsStride = 2 * normalElement.getSize(); // Color attrib const auto colorElement = FBX_COLOR_ELEMENT; diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp index 62e763e488..07e52f9fea 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp @@ -61,7 +61,6 @@ GLBuffer* GL45Backend::syncGPUObject(const Buffer& buffer) { bool GL45Backend::bindResourceBuffer(uint32_t slot, const BufferPointer& buffer) { - // GLBuffer* object = syncGPUObject((*buffer)); auto bo = getBufferIDUnsynced((*buffer)); if (bo) { glBindBufferBase(GL_SHADER_STORAGE_BUFFER, slot, bo); From 5d0f2e3035a26feb922933c69ae15defe50ff658 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 2 Oct 2018 13:09:04 -0700 Subject: [PATCH 120/157] And more changes for better syntax and less useless stuff --- .../render-utils/src/MeshPartPayload.cpp | 2 +- libraries/render-utils/src/Model.cpp | 32 ++++++------------- libraries/render-utils/src/Model.h | 6 ++-- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 13ee688fac..643642c350 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -355,7 +355,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe bool isDeformed = _isBlendShaped || _isSkinned; if (isWireframe) { - isTranslucent = hasTangents = hasLightmap = isDeformed = false; + isTranslucent = hasTangents = hasLightmap = false; } ShapeKey::Builder builder; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 5d46ee49f1..a700c200f8 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1614,33 +1614,22 @@ public: using packBlendshapeOffsetTo = void(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked); void packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked) { - float len = glm::compMax(glm::abs(unpacked.positionOffsetAndSpare)); - glm::vec3 normalizedPos(unpacked.positionOffsetAndSpare); + float len = glm::compMax(glm::abs(unpacked.positionOffset)); + glm::vec3 normalizedPos(unpacked.positionOffset); if (len > 1.0f) { normalizedPos /= len; - } - else { + } else { len = 1.0f; } packed = glm::uvec4( glm::floatBitsToUint(len), glm::packSnorm3x10_1x2(glm::vec4(normalizedPos, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked.normalOffsetAndSpare, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked.tangentOffsetAndSpare, 0.0f)) + glm::packSnorm3x10_1x2(glm::vec4(unpacked.normalOffset, 0.0f)), + glm::packSnorm3x10_1x2(glm::vec4(unpacked.tangentOffset, 0.0f)) ); } -void packBlendshapeOffsetTo_Pos_3xF16_Nor_3xSN10_Tan_3xSN10(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked) { - packed = glm::uvec4( - glm::packHalf2x16(glm::vec2(unpacked.positionOffsetAndSpare)), - glm::packHalf2x16(glm::vec2(unpacked.positionOffsetAndSpare.z, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked.normalOffsetAndSpare, 0.0f)), - glm::packSnorm3x10_1x2(glm::vec4(unpacked.tangentOffsetAndSpare, 0.0f)) - ); -} - - class Blender : public QRunnable { public: @@ -1691,20 +1680,17 @@ void Blender::run() { float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE; const FBXBlendshape& blendshape = mesh.blendshapes.at(i); - bool doTangent = (mesh.tangents.size()) && (blendshape.tangents.size()); tbb::parallel_for(tbb::blocked_range(0, blendshape.indices.size()), [&](const tbb::blocked_range& range) { for (auto j = range.begin(); j < range.end(); j++) { int index = blendshape.indices.at(j); auto& currentBlendshapeOffset = unpackedBlendshapeOffsets[index]; - currentBlendshapeOffset.positionOffsetAndSpare += blendshape.vertices.at(j) * vertexCoefficient; + currentBlendshapeOffset.positionOffset += blendshape.vertices.at(j) * vertexCoefficient; - currentBlendshapeOffset.normalOffsetAndSpare += blendshape.normals.at(j) * normalCoefficient; - if (doTangent) { - if ((int)j < blendshape.tangents.size()) { - currentBlendshapeOffset.tangentOffsetAndSpare += blendshape.tangents.at(j) * normalCoefficient; - } + currentBlendshapeOffset.normalOffset += blendshape.normals.at(j) * normalCoefficient; + if (j < blendshape.tangents.size()) { + currentBlendshapeOffset.tangentOffset += blendshape.tangents.at(j) * normalCoefficient; } } }); diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index b7a3088a48..e42da4ecb1 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -80,9 +80,9 @@ struct BlendshapeOffsetPacked { }; struct BlendshapeOffsetUnpacked { - glm::vec3 positionOffsetAndSpare; - glm::vec3 normalOffsetAndSpare; - glm::vec3 tangentOffsetAndSpare; + glm::vec3 positionOffset; + glm::vec3 normalOffset; + glm::vec3 tangentOffset; }; using BlendshapeOffset = BlendshapeOffsetPacked; From da6e3991611ee3c8d80bc097e6a4e4c0b2b8dda6 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Tue, 2 Oct 2018 17:15:07 -0700 Subject: [PATCH 121/157] INtroduce a safe destruction of the TBO defined when using a gpu::Buffer as REsourceBuffer in gl41 backend --- libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp index d5193f892a..d6add03c4f 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp @@ -20,7 +20,10 @@ namespace gpu { ~GL41Buffer() { if (_texBuffer) { - glDeleteTextures(1, &_texBuffer); + auto backend = _backend.lock(); + if (backend) { + backend->releaseTexture(_texBuffer, 0); + } } } From 2d85f882b8b87c69f8bb7cda58b0fcac7eb7fa2d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 2 Oct 2018 17:47:09 -0700 Subject: [PATCH 122/157] adding buttons --- .../resources/images/interstitialPage/button.png | Bin 0 -> 2884 bytes .../images/interstitialPage/button_hover.png | Bin 0 -> 2174 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 interface/resources/images/interstitialPage/button.png create mode 100644 interface/resources/images/interstitialPage/button_hover.png diff --git a/interface/resources/images/interstitialPage/button.png b/interface/resources/images/interstitialPage/button.png new file mode 100644 index 0000000000000000000000000000000000000000..064e44758128b86bf7e43f6e280223517b87fd5f GIT binary patch literal 2884 zcmV-K3%m4*P)>C%^e5e6K>Llp?bUM zouRkfrL){6m2sE1GW-SLE}e0gw=z^I4P~kqSD93={1;enmqIgEy0;>@OqX3)81O4@ z_oUM=c%GTFY;!tJE6sfL-P_&kRFA~=_V#9Y=v4qb1mn?YG=9i0u=9WdxE~(6X?vdj zI|lNm&oRJ*H%O14!gdk1VcbH9UkK>MhH(txehT8A${2wAD(w{BF}MfoRCTXSK!;F{ zA^bW8vp@!5+Q2>w+i3{vp@5#PQr=C$-1WHv;IV}DN(OWY=AH1cpQ>d5n70_v$04Xs z1oY%!j@9y8)iMA}5(kwXhwW(D1I$(;panAkf_jAlI(22gpF=PYQ{#S0{~o6efQO@d zD?hHM*Y@WS)Nhv2^}UpUP9w74x73isw8bzUuKK7v02Y!l-4xm}XWE$gGfY7}c(4H- z8t$;V>du};9Ci1xTC+KA04yc2`OAqWA(yvokPa_tFd-JZQI}2)zgX*eFyQvt&C)L%^ca<^#ZDv!qx>{>v zf6A&lR?>%S8PKU);lmW)QdVY|I{=R&tYc75Gn*)0n|?8mtm@41#ZJ?uEtmmVc2K`> zSW#c3kZyI5a%WC2FoyEa4PW3%bu~gxFaxm6kdE1PP&FIS-1>B^&KzFYZmOJ{bPp_a z=sExtRCrb|Jc!B+g^Yinuj{*RzBxKV?*iN^$w!Vgc{xNL7D|p&Y z*ncxT?_VoZK{pKNakYRU>HyGE#x)&RbrLdeZ|N0u!*Gs^jQlyA_`kj70IW$h{cEU< z{}KNBU13P~X04=WuAm!+a~z%h##;@*8duXza&PKu(obeQ$@neepAAm(M{g|vYhFzc zLv{R1`0Jml{B`MgP5M9aISZ?x8%(8I+MPfEV2+h^lPSf|n$DB%OnFk9>7;V~@N=2G z4FGEv(lHOeZ?e|M#+2t&GLlU=1Mr}wjC+wXug-O0TdZ+FryF0CtgZbgbj2wrD)l8>GRrJOT)$_4Y+W=7HUDGOh zGXN~KioVlx-I-85$IAIjrh5KfKm$NC1yh%ARu`L8LFaBIc_N$vU@Ey0-8VhhlLC5w z#)AU@_Y}ER{k-U%i2!Q1xh#D- zDWG3wo^+;N0br&odQjC*xw>0HrwP(^_pUrMI1B(wI2Y?#pWy(^rrR$ zfVucXE})0gl-~frOuD&%uDfH^=JxisDjERV*Uts?Aaej!Gyt?H6u;fNpI-;`c-n*q z0NSmdZvuKW8pVLFTk_LLZUAW4(~=508mgcHU?nQ(@$G>ARI_6oDCRme0JI=of3C~b z!R>$^WRCY*lLElptLMw2`6i%8qfrd#iy00E0F-%|`T5}6mBi|*=w5C}H~>&Dtu3-s zv&%3J-u^bAKW2`*uW12bCOf(6IsWl&K%dQcPynD_ZcNwdZvr}$)EAkM?uOD_NCUtW z(xu{l%`W4R#luMzbflXb0OsRuN%b6c?n(InR`s`;{64Kd1^|>*&oNiOl;-Pw_k%u} z@f!dDaMwX5oX>6-zxM_7apsronsNmIjjHF|CE`2TJ29YBg6Bqbzt`jd&`R|@P78)r zxeB_Zirxv|2>RL_0BWn}Zk4|@{O;TTxHq6vk`GkT05FqWR>tc2q&T4OOZ0EV)&G~cKx;4ASb+?~Q`oTuQ?|75> zc|3s+-Uf6MF^=RN;; z-w!tmf7emi#+iNI8r2PeaNh1!`JUx?d3djGhoXQ^H__ND*!8E>=MDgmF`Tb2`{uIn zUCP$k0y>5CAXUWpsy3Z%6E0g6Ei;=fX7xn$8gR~ zsftzetCHh23g}dhmmGLEohSf2hH#E+g6tOTx|i$PzV@W)Nt~ab|GKrc^`C-o3B9mi zH|+n>TL-`c4(Axme=peeD1`HI>2aS-b21@xhcSGsd_TL82H>HGb4ibJyzcx%lVfj8 zds5*S#ZleEf?aiY1Mm>T`LHmYV^+Rudi>6eCwDn&yP%Se;_WMo``!Uyg~K@p^KQYe zG4o!8>>D=y9i0|VGKTb*DnIAz=39hyy8&3!V2)WA?@`g8XE;Y2vz~0Kh+m`=$%&Qr z=d=VG0IX9uUuM`M!nu`zP9Z&P5Ym_5KEew%R~mqI3Fm_xV>j9l!Op}3Q*W!|A?+hRVV1>f@Fg)y6Wn-*b4d=N8 z^sSICy@-BooI?7<#{z&Q26I1E&D{o18>Vn>tbaM^>SY$B2 zZCG4JCn>jD?FH^E;05ngWw+j%6x7EmY5-O=n5z`bNAozZ&VpWi>?Vj^-n}WFJ`USy z{DxxwGypB-QY;#GQZRR?%%)fK9OT?taDyDC#+X)IjV!L~eP%!z08`{p4CR+q*(zZ7 zS;)ZV&Jr3YR?#Ilv@QwjPu0}|Fe!7osZxGkC;)~mQKsF#Vrn}@2Ri>NN!KR i9mKz{+X7er7hnKB;CO`nlfqa40000g8*F zlCs~f#Nlw56gSh~0JsFZEX#J6{06fN3gB6BlgIIU{NEvvC%(r37jGSJpNjEPj7=Ct zh`$Kv^M-K<;aLpgsmd6D_bTle-XXZxW2(AG6VOE{hYy3bJ zRw*xHFz3Ek09;F04>F*OV4fE@pJTNQ09^|KeOCnaR{{NYFo$aSi)tBwo`j~dyJGyO z?*_9$1hilVKu`}TpyN{ZZ3n@;iIe*j|9ck)0GA^_%8%E>YiAt<^}qU9`tBv5V@LLF zOB17f z=Qf_1^0I!>6yv$Uq&&t6c4jaDn&iUnfoRdY#OFaywcQ15GG*K{mza9ZOH-V0^`29RNs z8V$|+cutSO|N5x9JTUW>0AOHwmd6I=Di%Y1GmER)!4AN+1ochDRpHw)hx1m|48Vv& zx@uq5{TRb}WnVJ@BMj+D?3WrxC0#L`Z+*l7j6A3pgWo3|Oa5{1I0u00`8ThyUwU!w z7ngb{)m}IQaDgFR<&fg(xn9&HacB8>4&DZUZj05)IbP68I0HbXkbds^h1}TZ3;?x4 z`nJm#Ae;f<*NmJcX5_4kCx3P*6#%@OlZ&(Ok4`*s_@j>pfGZE_`?H;CES@kt<@BA- z5C(vdPFr!Fweducy{xGNz&HasPiPw3Hhq%0t5N|#<@~(qG(Y3gb$`co0l;`e`mvLS zvBYk)nU4Sf-ptXIrS4^&4R6oVg$4kZ8`8^GtLTL4d9Q0509q+{m;G!E0IoZr+bMbz zI=5BN0MKp~y-3-}O7#o?XRV^QWgEy<&j8R%6+L_X+YfI%eqOTuuUVG8m}UT|?5^bg zPfgN2H@^T-tAd`C92dQR?}1ZSs{(*dL%Qs0SAVT!|GdOqw!Hn#)B->wWm)>iTd7`l zc`VIg0MNXO-j*$Me>nQ%5WdqB+k4O)1^}&iIB{RtPdzF~z4P8~Lw!1b|kZ zEPh`r=(2#`m`4C;)g~pN^HYD6W!c(10ziA>q076nfc|)58#~ho0G%ie=!t*^fV10_ z1$18L!2m!b-4To!FHHGypKNfVRX90B4pG(5_$w0Ote(K}~fOdUMsi1?63K{?gQ9Tp`#>;V8k)o`AaWbI!C@z1CF{Ig`c zpG_?QG%_!_e_bclx8@Z98dcDbC0RRt?}25@+;h_l0JXw7Pc4Msx|)?`ZUE@Umy-Lx zl_mUMvlsxhT0Kvyc+~N z#a5;q0Fp9w+1gQ3A;}Y}=$UB;fRlNevMRl(y3xm!vz-6{?`G+$^>d6QR?#=69{}FW z(Ru6DbA{yJYZwE7U-C0FhHX1riB4QQfAmoRz~A!ozVlwLgzmFo>Ei%^LJ~XG zgfsw`7|zSY3_O4HbcJ^EL+otR-3`DcgmdaDa%c*h_VprDE<%0$D6b@967J@wH8FwkJm zD=cXbGn|j!OqIs5AJw!5G5`jaXUmE!!~4M(ofUVYzY3N2!dC)-o-=G#aW!~+*P%$f zxW-#=a^@=nKo7zESR=RYN4W|dFIv5?8PqCj0EQaO?O!&shc}q#dY;TMaj!w$mG#lTLuh~ZH3k^9f5Z@eHEk(~-}1E>|1QFLckVZt4PmBZ16T;@ zh3_2z1JGMA4=SL43hEHjpF8|D1ORUdOW6;72lF5U`Y5PFIL~8HYXSqHOCgN!Le*RZ z^UF|PR5tWki&gdK7}&Y*5dbZPa;TQS4YjE_8`EsY4!v11{)o2#kSYZ6pCOpXaHLN* z=9!MiqlFRL>8C1e0HWi=Z`a}9Lt4I0@jn3u0DhI-AzTnMNB{r;07*qoM6N<$f~*Gz AB>(^b literal 0 HcmV?d00001 From b28c375ad3d8d988f2027c53ab965589ebc5ab5c Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 09:56:07 -0700 Subject: [PATCH 123/157] better loading check logic --- interface/src/octree/SafeLanding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..62bd1b7b89 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -116,9 +116,10 @@ bool SafeLanding::isLoadSequenceComplete() { _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); + return true; } - return !_trackingEntities; + return false; } float SafeLanding::loadingProgressPercentage() { @@ -149,10 +150,9 @@ bool SafeLanding::isSequenceNumbersComplete() { && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. - return true; } } - return false; + return !_trackingEntities; } bool isEntityPhysicsReady(const EntityItemPointer& entity) { From efeb598495335918561bb8637096d41c0ae33b1d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 10:12:07 -0700 Subject: [PATCH 124/157] fixing bug with hover overlay --- scripts/system/interstitialPage.js | 38 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 869c47bd2a..bd542b298d 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -356,6 +356,26 @@ } } + function onEnterOverlay(overlayID, event) { + if (currentDomain === "no domain") { + return; + } + if (overlayID === loadingToTheSpotID) { + Overlays.editOverlay(loadingToTheSpotID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); + } + } + + function onLeaveOverlay(overlayID, event) { + if (currentDomain === "no domain") { + return; + } + if (overlayID === loadingToTheSpotHoverID) { + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); + } + } + var currentProgress = 0.1; function updateOverlays(physicsEnabled) { @@ -482,6 +502,8 @@ if (errorConnectingToDomain) { updateOverlays(errorConnectingToDomain); + // setting hover id to invisible + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); endAudio(); currentDomain = "no domain"; timer = null; @@ -496,6 +518,8 @@ return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); + // setting hover id to invisible + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); endAudio(); currentDomain = "no domain"; timer = null; @@ -506,19 +530,9 @@ var whiteColor = {red: 255, green: 255, blue: 255}; var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); - Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, {visible: false}); - Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); - } - }); + Overlays.hoverEnterOverlay.connect(onEnterOverlay); - Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotHoverID) { - Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); - Overlays.editOverlay(loadingToTheSpotID, {visible: true}); - } - }); + Overlays.hoverLeaveOverlay.connect(onLeaveOverlay); location.hostChanged.connect(domainChanged); location.lookupResultsFinished.connect(function() { From c0ae95f853deba8dc723888ba3b1e12b2e390f1b Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Wed, 3 Oct 2018 12:54:49 -0700 Subject: [PATCH 125/157] Bug fix for rotation culling in AvatarData::toByteArray() The commit 5a0de0f103c inadvertently introduced a regression in how the AvatarMixer and clients encode AvatarData packets. When encoding packets that with the cullSmallChanges flag set to true, we only include rotations that have changed significantly from the previous packet. A bug was introduced that incorrectly preformed the comparison to detect changed rotations, this needs to handle the case when two quaternions are almost equal but have negative signs. Previously, this was preformed with an absolute value after the 4-component dot product. In commit 5a0de0f103c, this absolute value was removed, causing the culling to happen much more frequently. This PR re-introduces that absolute value. --- libraries/avatars/src/AvatarData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 2168dff1f6..5fb4ef3156 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -594,7 +594,7 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent // The dot product for larger rotations is a lower number. // So if the dot() is less than the value, then the rotation is a larger angle of rotation if (sendAll || last.rotationIsDefaultPose || (!cullSmallChanges && last.rotation != data.rotation) - || (cullSmallChanges && glm::dot(last.rotation, data.rotation) < minRotationDOT) ) { + || (cullSmallChanges && fabsf(glm::dot(last.rotation, data.rotation)) < minRotationDOT) ) { validity |= (1 << validityBit); #ifdef WANT_DEBUG rotationSentCount++; From 5734c24af49dde576013b96645e706a4556911a1 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 13:51:02 -0700 Subject: [PATCH 126/157] another PR fix --- .../qml/hifi/avatarapp/AdjustWearables.qml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml index 361ac838fe..c4b1443731 100644 --- a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml +++ b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml @@ -23,6 +23,9 @@ Rectangle { property bool modified: false; Component.onCompleted: { modified = false; + MyAavatar.animGraphLoaded.connect(function() { + softWearableTimer.restart(); + }); } property var jointNames: [] @@ -102,13 +105,20 @@ Rectangle { function entityHasAvatarJoints(entityID) { var hasAvatarJoint = false; - var entityJointNames = Entities.getJointNames(entityID); - for (var index = 0; index < entityJointNames.length; index++) { - var avatarJointIndex = MyAvatar.getJointIndex(entityJointNames[index]); - if (avatarJointIndex >= 0) { - hasAvatarJoint = true; - break; + + var props = Entities.getEntityProperties(entityID); + var avatarJointsCount = MyAvatar.getJointNames().length; + if (props && avatarJointsCount >= 0 ) { + var entityJointNames = Entities.getJointNames(entityID); + for (var index = 0; index < entityJointNames.length; index++) { + var avatarJointIndex = MyAvatar.getJointIndex(entityJointNames[index]); + if (avatarJointIndex >= 0) { + hasAvatarJoint = true; + break; + } } + } else { + softWearableTimer.restart(); } return hasAvatarJoint; @@ -133,6 +143,7 @@ Rectangle { visible = false; adjustWearablesClosed(status, avatarName); } + HifiConstants { id: hifi } From 397fe2a5344460f9de8c82866a05d89d008b1dbf Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 3 Oct 2018 13:53:46 -0700 Subject: [PATCH 127/157] Code Review Fixes --- server-console/src/modules/hf-notifications.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index f3b6912c08..464d268c5e 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -44,7 +44,6 @@ function HifiNotification(notificationType, notificationData, menuNotificationCa HifiNotification.prototype = { show: function (finished) { - var _finished = finished; var text = ""; var message = ""; var url = null; @@ -123,11 +122,11 @@ HifiNotification.prototype = { timeout: 5 }, function (error, reason, metadata) { - if (_finished) { + if (finished) { if (osType === 'Darwin') { - setTimeout(_finished, OSX_CLICK_DELAY_TIMEOUT); + setTimeout(finished, OSX_CLICK_DELAY_TIMEOUT); } else { - _finished(); + finished(); } } }); @@ -240,7 +239,7 @@ HifiNotifications.prototype = { }, _addNotification: function (notification) { this.pendingNotifications.push(notification); - if(this.pendingNotifications.length === 1) { + if (this.pendingNotifications.length === 1) { this._showNotification(); } }, From 78268001c4c7ca668d473a6df7d9170085f2b6d0 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 15:13:42 -0700 Subject: [PATCH 128/157] reverting logic change --- interface/src/octree/SafeLanding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 62bd1b7b89..f1deb06e3b 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -116,10 +116,9 @@ bool SafeLanding::isLoadSequenceComplete() { _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); - return true; } - return false; + return !_trackingEntities; } float SafeLanding::loadingProgressPercentage() { @@ -150,9 +149,10 @@ bool SafeLanding::isSequenceNumbersComplete() { && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. + returnm true; } } - return !_trackingEntities; + return false; } bool isEntityPhysicsReady(const EntityItemPointer& entity) { From b46d2319b11e77552992186422a11a1beb0906eb Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 15:22:53 -0700 Subject: [PATCH 129/157] fix spelling error --- interface/src/octree/SafeLanding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index f1deb06e3b..6b28d9c713 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -149,7 +149,7 @@ bool SafeLanding::isSequenceNumbersComplete() { && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. - returnm true; + return true; } } return false; From 702d26d2bd4bfb43ea519b2e296941a84f0208f1 Mon Sep 17 00:00:00 2001 From: sam gateau Date: Wed, 3 Oct 2018 16:03:09 -0700 Subject: [PATCH 130/157] Addressing the bug on Mac AMD --- libraries/render-utils/src/MeshPartPayload.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 643642c350..d0d6c98b2e 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -244,6 +244,16 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in _blendshapeBuffer = buffer->second; } } + +#ifdef Q_OS_MAC + // On mac AMD, we specifically need to have a _blendshapeBuffer bound when using a deformed mesh pipeline + // it cannot be null otherwise we crash in the drawcall using a deformed pipeline with a skinned only (not blendshaped) mesh + if ((_isBlendShaped || _isSkinned) && !_blendshapeBuffer) { + glm::vec4 data; + _blendshapeBuffer = std::make_shared(sizeof(glm::vec4), reinterpret_cast(data)); + } +#endif + } void ModelMeshPartPayload::initCache(const ModelPointer& model) { From 87efeb1a70e691edc517cef0696b83a7e15bc059 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 3 Oct 2018 16:15:07 -0700 Subject: [PATCH 131/157] make sure that we compile, dah --- libraries/render-utils/src/MeshPartPayload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index d0d6c98b2e..c5df2c3e01 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -250,7 +250,7 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in // it cannot be null otherwise we crash in the drawcall using a deformed pipeline with a skinned only (not blendshaped) mesh if ((_isBlendShaped || _isSkinned) && !_blendshapeBuffer) { glm::vec4 data; - _blendshapeBuffer = std::make_shared(sizeof(glm::vec4), reinterpret_cast(data)); + _blendshapeBuffer = std::make_shared(sizeof(glm::vec4), reinterpret_cast(&data)); } #endif From 676293c880ba6738b2d1321365efc3a79ad31b4a Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Oct 2018 16:19:47 -0700 Subject: [PATCH 132/157] trying another fix --- interface/resources/qml/hifi/avatarapp/AdjustWearables.qml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml index c4b1443731..6ed13835f9 100644 --- a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml +++ b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml @@ -117,8 +117,6 @@ Rectangle { break; } } - } else { - softWearableTimer.restart(); } return hasAvatarJoint; @@ -158,9 +156,9 @@ Rectangle { Timer { id: softWearableTimer - interval: 500 + interval: 1000 running: false - repeat: false + repeat: true onTriggered: { var currentWearable = getCurrentWearable(); var soft = currentWearable ? currentWearable.relayParentJoints : false; From bb98457d09525b7ff04fb7505601f15455c74180 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Wed, 3 Oct 2018 16:23:09 -0700 Subject: [PATCH 133/157] Fix avatars transit on domain enter --- interface/src/avatar/AvatarManager.cpp | 6 +++++- libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp | 5 +++++ libraries/avatars-renderer/src/avatars-renderer/Avatar.h | 1 + libraries/avatars/src/AvatarData.h | 4 ++++ libraries/avatars/src/AvatarHashMap.cpp | 6 ++++-- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 7d91681c0e..661b13d6d1 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -275,7 +275,11 @@ void AvatarManager::updateOtherAvatars(float deltaTime) { if (inView && avatar->hasNewJointData()) { numAvatarsUpdated++; } - avatar->_transit.update(deltaTime, avatar->_globalPosition, _transitConfig); + auto transitStatus = avatar->_transit.update(deltaTime, avatar->_globalPosition, _transitConfig); + if (avatar->getIsNewAvatar() && transitStatus == AvatarTransit::Status::START_TRANSIT) { + avatar->_transit.reset(); + avatar->setIsNewAvatar(false); + } avatar->simulate(deltaTime, inView); avatar->updateRenderItem(renderTransaction); avatar->updateSpaceProxy(workloadTransaction); diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index b4b213dc87..fe3e1644c4 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -126,6 +126,11 @@ AvatarTransit::Status AvatarTransit::update(float deltaTime, const glm::vec3& av return _status; } +void AvatarTransit::reset() { + _lastPosition = _endPosition; + _currentPosition = _endPosition; + _isTransiting = false; +} void AvatarTransit::start(float deltaTime, const glm::vec3& startPosition, const glm::vec3& endPosition, const AvatarTransit::TransitConfig& config) { _startPosition = startPosition; _endPosition = endPosition; diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h index fe5d310812..7764d0ef54 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h @@ -84,6 +84,7 @@ public: glm::vec3 getEndPosition() { return _endPosition; } float getTransitTime() { return _totalTime; } void setScale(float scale) { _scale = scale; } + void reset(); private: Status updatePosition(float deltaTime); diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index a890482e9a..860772b7c9 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -1190,6 +1190,9 @@ public: void setReplicaIndex(int replicaIndex) { _replicaIndex = replicaIndex; } int getReplicaIndex() { return _replicaIndex; } + void setIsNewAvatar(bool isNewAvatar) { _isNewAvatar = isNewAvatar; } + bool getIsNewAvatar() { return _isNewAvatar; } + signals: /**jsdoc @@ -1452,6 +1455,7 @@ protected: bool _hasProcessedFirstIdentity { false }; float _density; int _replicaIndex { 0 }; + bool _isNewAvatar { true }; // null unless MyAvatar or ScriptableAvatar sending traits data to mixer std::unique_ptr _clientTraitsHandler; diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index c8ea68dae4..af65a32ef5 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -259,18 +259,20 @@ AvatarSharedPointer AvatarHashMap::parseAvatarData(QSharedPointersetIsNewAvatar(true); auto replicaIDs = _replicas.getReplicaIDs(sessionUUID); for (auto replicaID : replicaIDs) { auto replicaAvatar = addAvatar(replicaID, sendingNode); + replicaAvatar->setIsNewAvatar(true); _replicas.addReplica(sessionUUID, replicaAvatar); } } - - + // have the matching (or new) avatar parse the data from the packet int bytesRead = avatar->parseDataFromBuffer(byteArray); message->seek(positionBeforeRead + bytesRead); _replicas.parseDataFromBuffer(sessionUUID, byteArray); + return avatar; } else { From a05e493e0634dbb57b71fb75dfbddf11134609a0 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Wed, 3 Oct 2018 17:09:51 -0700 Subject: [PATCH 134/157] Long distance avatars should not be new --- interface/src/avatar/AvatarManager.cpp | 2 +- .../avatars-renderer/src/avatars-renderer/Avatar.cpp | 9 +++++++-- libraries/avatars-renderer/src/avatars-renderer/Avatar.h | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 661b13d6d1..c268561a8d 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -276,7 +276,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) { numAvatarsUpdated++; } auto transitStatus = avatar->_transit.update(deltaTime, avatar->_globalPosition, _transitConfig); - if (avatar->getIsNewAvatar() && transitStatus == AvatarTransit::Status::START_TRANSIT) { + if (avatar->getIsNewAvatar() && (transitStatus == AvatarTransit::Status::START_TRANSIT || transitStatus == AvatarTransit::Status::ABORT_TRANSIT)) { avatar->_transit.reset(); avatar->setIsNewAvatar(false); } diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index fe3e1644c4..e3d6e707a2 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -118,8 +118,13 @@ AvatarTransit::Status AvatarTransit::update(float deltaTime, const glm::vec3& av float oneFrameDistance = glm::length(currentPosition - _lastPosition); const float MAX_TRANSIT_DISTANCE = 30.0f; float scaledMaxTransitDistance = MAX_TRANSIT_DISTANCE * _scale; - if (oneFrameDistance > config._triggerDistance && oneFrameDistance < scaledMaxTransitDistance && !_isTransiting) { - start(deltaTime, _lastPosition, currentPosition, config); + if (oneFrameDistance > config._triggerDistance && !_isTransiting) { + if (oneFrameDistance < scaledMaxTransitDistance) { + start(deltaTime, _lastPosition, currentPosition, config); + } else { + _lastPosition = currentPosition; + return Status::ABORT_TRANSIT; + } } _lastPosition = currentPosition; _status = updatePosition(deltaTime); diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h index 7764d0ef54..1087f74c07 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h @@ -56,7 +56,8 @@ public: IDLE = 0, START_TRANSIT, TRANSITING, - END_TRANSIT + END_TRANSIT, + ABORT_TRANSIT }; enum EaseType { From d6af09ca62f8e5d07b66e69499f64691882c714b Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 17:40:42 -0700 Subject: [PATCH 135/157] ignoring entities in interstitial/saving address on 404 error --- libraries/networking/src/AddressManager.cpp | 12 +++++++- libraries/networking/src/AddressManager.h | 6 ++++ .../controllerModules/farActionGrabEntity.js | 30 +++++++++++++++++++ scripts/system/interstitialPage.js | 2 +- scripts/system/redirectOverlays.js | 4 +-- 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 8085039b02..f8ab8ceaec 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -161,8 +161,14 @@ void AddressManager::storeCurrentAddress() { // be loaded over http(s) // url.scheme() == URL_SCHEME_HTTP || // url.scheme() == URL_SCHEME_HTTPS || + bool isInErrorState = DependencyManager::get()->getDomainHandler().isInErrorState(); if (isConnected()) { - currentAddressHandle.set(url); + if (isInErrorState) { + // save the last address visited before the problem url. + currentAddressHandle.set(lastAddress()); + } else { + currentAddressHandle.set(url); + } } else { qCWarning(networking) << "Ignoring attempt to save current address because not connected to domain:" << url; } @@ -861,6 +867,10 @@ void AddressManager::goToUser(const QString& username, bool shouldMatchOrientati QByteArray(), nullptr, requestParams); } +bool AddressManager::canGoBack() const { + return (_backStack.size() > 0); +} + void AddressManager::refreshPreviousLookup() { // if we have a non-empty previous lookup, fire it again now (but don't re-store it in the history) if (!_previousAPILookup.isEmpty()) { diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 17041a5fd7..5318822cdc 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -254,6 +254,12 @@ public slots: */ void goToLastAddress() { handleUrl(_lastVisitedURL, LookupTrigger::AttemptedRefresh); } + /**jsdoc + * Returns if going back is possible. + * @function location.canGoBack + */ + bool canGoBack() const; + /**jsdoc * Refresh the current address, e.g., after connecting to a domain in order to position the user to the desired location. * @function location.refreshPreviousLookup diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 5e798ed680..2e73526728 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -110,6 +110,8 @@ Script.include("/~/system/libraries/Xform.js"); this.reticleMinY = MARGIN; this.reticleMaxY; + this.ignoredEntities = []; + var ACTION_TTL = 15; // seconds var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand and object @@ -314,6 +316,17 @@ Script.include("/~/system/libraries/Xform.js"); return point2d; }; + this.restoreIgnoredEntities = function() { + for (var i = 0; i < this.ignoredEntities; i++) { + var data = { + action: 'remove', + id: this.ignoredEntities[i] + }; + Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data)); + } + this.ignoredEntities = []; + }; + this.notPointingAtEntity = function(controllerData) { var intersection = controllerData.rayPicks[this.hand]; var entityProperty = Entities.getEntityProperties(intersection.objectID); @@ -323,6 +336,15 @@ Script.include("/~/system/libraries/Xform.js"); if ((intersection.type === Picks.INTERSECTED_ENTITY && entityType === "Web") || intersection.type === Picks.INTERSECTED_OVERLAY || Window.isPointOnDesktopWindow(point2d)) { return true; + } else if (intersection.type === Picks.INTERSECTED_ENTITY && !Window.isPhysicsEnabled()) { + // add to ignored items. + var data = { + action: 'add', + id: intersection.objectID + }; + Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data)); + this.ignoredEntities.push(intersection.objectID); + } return false; }; @@ -383,6 +405,7 @@ Script.include("/~/system/libraries/Xform.js"); this.isReady = function (controllerData) { if (HMD.active) { if (this.notPointingAtEntity(controllerData)) { + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } @@ -394,9 +417,11 @@ Script.include("/~/system/libraries/Xform.js"); return makeRunningValues(true, [], []); } else { this.destroyContextOverlay(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); }; @@ -407,6 +432,7 @@ Script.include("/~/system/libraries/Xform.js"); Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity); this.highlightedEntity = null; + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } this.intersectionDistance = controllerData.rayPicks[this.hand].distance; @@ -437,6 +463,7 @@ Script.include("/~/system/libraries/Xform.js"); if (nearGrabReadiness[k].active && (nearGrabReadiness[k].targets[0] === this.grabbedThingID || HMD.tabletID && nearGrabReadiness[k].targets[0] === HMD.tabletID)) { this.endFarGrabAction(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } @@ -448,6 +475,7 @@ Script.include("/~/system/libraries/Xform.js"); for (var j = 0; j < nearGrabReadiness.length; j++) { if (nearGrabReadiness[j].active) { this.endFarGrabAction(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } @@ -466,6 +494,7 @@ Script.include("/~/system/libraries/Xform.js"); ]); if (targetProps.href !== "") { AddressManager.handleLookupString(targetProps.href); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } @@ -583,6 +612,7 @@ Script.include("/~/system/libraries/Xform.js"); Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity); this.highlightedEntity = null; + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index bd542b298d..39b4821192 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -475,7 +475,7 @@ if (textureMemSizeStabilityCount >= 15) { if (textureResourceGPUMemSize > 0) { - print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); + // print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); var totalProgress = progress + gpuPercantage; if (totalProgress >= target) { diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 49844db5b0..7f4193e4e9 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -195,7 +195,7 @@ } if (tryAgainImageHover === overlayID) { location.goToLastAddress(); - } else if (backImageHover === overlayID) { + } else if (backImageHover === overlayID && location.canGoBack()) { location.goBack(); } } @@ -216,7 +216,7 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === backImageNeutral) { + if (overlayID === backImageNeutral && location.canGoBack()) { Overlays.editOverlay(backImageNeutral, {visible: false}); Overlays.editOverlay(backImageHover, {visible: true}); } From 22a9030fb50b1cb5367ebe7390cc3e3795212866 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 17:54:46 -0700 Subject: [PATCH 136/157] hiding text overlays when out of error state --- scripts/system/redirectOverlays.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 7f4193e4e9..eeccb25334 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -141,6 +141,8 @@ Overlays.editOverlay(tryAgainImageHover, properties); Overlays.editOverlay(backImageNeutral, properties); Overlays.editOverlay(backImageHover, properties); + Overlays.editOverlay(tryAgainText, properties); + Overlays.editOverlay(backText, properties); return; } var oopsText = getOopsText(); From c785efec844f80e9dee9e88739643b6f5c5d9d7b Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 10:56:04 -0700 Subject: [PATCH 137/157] removing extraneous bool --- interface/src/octree/SafeLanding.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..62fbe12acb 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -187,8 +187,6 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; - bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); - if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); } From ee3fd8107050088598512f98f2217578d01e79e7 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 4 Oct 2018 11:33:01 -0700 Subject: [PATCH 138/157] Code review fixes from birarda --- cmake/macros/SetPackagingParameters.cmake | 2 +- cmake/templates/NSIS.template.in | 3 ++- server-console/CMakeLists.txt | 8 +------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 3bf984534b..1b7243d4f2 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -18,7 +18,7 @@ macro(SET_PACKAGING_PARAMETERS) set(BUILD_GLOBAL_SERVICES "DEVELOPMENT") set(USE_STABLE_GLOBAL_SERVICES 0) set(BUILD_NUMBER 0) - set(APP_USER_MODEL_ID "com.highfidelity.console") + set(APP_USER_MODEL_ID "com.highfidelity.console-dev") set_from_env(RELEASE_TYPE RELEASE_TYPE "DEV") set_from_env(RELEASE_NUMBER RELEASE_NUMBER "") diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 3226712519..b3c3145672 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -412,7 +412,7 @@ Section "-Previous Install Cleanup" Delete "$INSTDIR\@AC_EXEC_NAME@" ; delete interface so it's not there for server-only installs - Delete "$INSTDIR\@INTERFACE_WIN_EXEC_NAME@" + Delete "$INSTDIR\@INTERFACE_WIN_EXEC_NAME@" SectionEnd @CPACK_NSIS_INSTALLATION_TYPES@ @@ -1005,6 +1005,7 @@ Function HandlePostInstallOptions ${EndIf} ${If} $LaunchConsoleNowState == ${BST_CHECKED} + ${AndIf} @SERVER_COMPONENT_CONDITIONAL@ !insertmacro WriteInstallOption @SERVER_LAUNCH_NOW_REG_KEY@ YES ; both launches use the explorer trick in case the user has elevated permissions for the installer diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 150561ffbb..6e02c2df00 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -28,7 +28,7 @@ if (BUILD_CLIENT) endif() if (BUILD_SERVER) - add_dependencies(${TARGET_NAME} assignment-client domain-server interface) + add_dependencies(${TARGET_NAME} assignment-client domain-server) endif() # set the packaged console folder depending on platform, so we can copy it @@ -64,12 +64,6 @@ elseif (WIN32) install( DIRECTORY "${CONSOLE_DESTINATION}/" DESTINATION ${CONSOLE_INSTALL_DIR} - COMPONENT ${SERVER_COMPONENT} - ) - install( - DIRECTORY "${CONSOLE_DESTINATION}/" - DESTINATION ${CONSOLE_INSTALL_DIR} - COMPONENT ${CLIENT_COMPONENT} ) # sign the copied server console executable after install From 8a05cc2ede6f8015ca9943c2567eb9ab5a4fe3aa Mon Sep 17 00:00:00 2001 From: sam gateau Date: Thu, 4 Oct 2018 11:49:11 -0700 Subject: [PATCH 139/157] FIx the bad world position evaluation in the new all in one call --- libraries/gpu/src/gpu/Transform.slh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gpu/src/gpu/Transform.slh b/libraries/gpu/src/gpu/Transform.slh index c6780a64d2..fd2cb86177 100644 --- a/libraries/gpu/src/gpu/Transform.slh +++ b/libraries/gpu/src/gpu/Transform.slh @@ -218,7 +218,7 @@ TransformObject getTransformObject() { { // transformModelToEyeAndClipPos vec4 eyeWAPos; <$transformModelToEyeWorldAlignedPos($cameraTransform$, $objectTransform$, $modelPos$, eyeWAPos)$> - <$worldPos$> = vec4(eyeWAPos.xyz - <$cameraTransform$>._view[3].xyz, 1.0); + <$worldPos$> = vec4(eyeWAPos.xyz + <$cameraTransform$>._viewInverse[3].xyz, 1.0); <$clipPos$> = <$cameraTransform$>._projectionViewUntranslated * eyeWAPos; <$eyePos$> = vec4((<$cameraTransform$>._view * vec4(eyeWAPos.xyz, 0.0)).xyz, 1.0); From 613a6ab8cde7ec0992f601f7d97ac509fa964032 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 12:18:18 -0700 Subject: [PATCH 140/157] removing unneeded code --- interface/resources/qml/hifi/avatarapp/AdjustWearables.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml index 6ed13835f9..a78ebfa940 100644 --- a/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml +++ b/interface/resources/qml/hifi/avatarapp/AdjustWearables.qml @@ -23,9 +23,6 @@ Rectangle { property bool modified: false; Component.onCompleted: { modified = false; - MyAavatar.animGraphLoaded.connect(function() { - softWearableTimer.restart(); - }); } property var jointNames: [] From f74d9ada209205fb15def68874be2197c97fabad Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 4 Oct 2018 12:38:34 -0700 Subject: [PATCH 141/157] Code review fix --- server-console/CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 6e02c2df00..0c35567d28 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -49,14 +49,7 @@ if (APPLE) install( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" USE_SOURCE_PERMISSIONS - DESTINATION ${CONSOLE_INSTALL_DIR} - COMPONENT ${SERVER_COMPONENT} - ) - install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}/" - USE_SOURCE_PERMISSIONS - DESTINATION ${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME} - COMPONENT ${CLIENT_COMPONENT} + DESTINATION ${CONSOLE_INSTALL_DIR} ) elseif (WIN32) set(CONSOLE_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}") From 2e3566bc73d80df75b40b0c5adbb33dd77e494da Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 14:24:43 -0700 Subject: [PATCH 142/157] hide overlays after clicking on them --- scripts/system/redirectOverlays.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index eeccb25334..2669cb0120 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -196,8 +196,22 @@ return; } if (tryAgainImageHover === overlayID) { + // hide try again overlays. + var properties = { + visible: false + }; + Overlays.editOverlay(tryAgainImageNeutral, properties); + Overlays.editOverlay(tryAgainImageHover, properties); + Overlays.editOverlay(tryAgainText, properties); location.goToLastAddress(); } else if (backImageHover === overlayID && location.canGoBack()) { + // hide back overlays. + var properties = { + visible: false + }; + Overlays.editOverlay(backImageNeutral, properties); + Overlays.editOverlay(backImageHover, properties); + Overlays.editOverlay(backText, properties); location.goBack(); } } From bda9735b5dc077eec1ab246d8e0b8646b42b88ae Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 15:01:16 -0700 Subject: [PATCH 143/157] fix loading progress --- interface/src/Application.cpp | 5 ++++- interface/src/Application.h | 2 +- interface/src/octree/SafeLanding.cpp | 14 +++++++------- .../entities-renderer/src/EntityTreeRenderer.cpp | 2 +- .../src/RenderableParticleEffectEntityItem.cpp | 10 ++++++++++ .../entities/src/ParticleEffectEntityItem.cpp | 3 ++- libraries/networking/src/DomainHandler.h | 2 +- scripts/defaultScripts.js | 4 ++-- scripts/system/interstitialPage.js | 2 +- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 757007267f..358b0c94ba 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6575,6 +6575,7 @@ bool Application::gpuTextureMemSizeStable() { qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; + qint64 textureTransferSize = renderStats->texturePendingGPUTransferSize; if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { _gpuTextureMemSizeStabilityCount++; @@ -6584,8 +6585,10 @@ bool Application::gpuTextureMemSizeStable() { _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { - return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); + qDebug() << "GPU checking"; + return (textureResourceGPUMemSize == texturePopulatedGPUMemSize) && (textureTransferSize == 0); } + qDebug() << "GPU not ready"; return false; } diff --git a/interface/src/Application.h b/interface/src/Application.h index cb37e655fc..01c0f3770c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -587,7 +587,7 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; - int _minimumGPUTextureMemSizeStabilityCount { 15 }; + int _minimumGPUTextureMemSizeStabilityCount { 20 }; ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..a4dc086ad8 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -83,8 +83,6 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) { } qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); } - } else { - qCDebug(interfaceapp) << "Safe Landing: Null Entity: " << entityID; } } @@ -109,12 +107,13 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { + qDebug() << "is sequence complete" << isSequenceNumbersComplete(); if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { Locker lock(_lock); - _trackedEntities.clear(); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; + _trackingEntities = false; // Don't track anything else that comes in. EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); } @@ -148,7 +147,6 @@ bool SafeLanding::isSequenceNumbersComplete() { (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { - _trackingEntities = false; // Don't track anything else that comes in. return true; } } @@ -187,10 +185,12 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; - bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); - if (enableInterstitial) { - isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); + auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); + if (!entityRenderable) { + entityTree->addingEntity(entityMapIter->first); + } + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } if (isEntityPhysicsReady(entity) && isVisuallyReady) { diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index dbbf8af4b9..6e82d26f29 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -310,10 +310,10 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r } auto entityID = entity->getEntityItemID(); - processedIds.insert(entityID); auto renderable = EntityRenderer::addToScene(*this, entity, scene, transaction); if (renderable) { _entitiesInScene.insert({ entityID, renderable }); + processedIds.insert(entityID); } } diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp index 1a263fba79..f51a3f7740 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp @@ -104,6 +104,10 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi _networkTexture.reset(); }); } + + withWriteLock([&] { + entity->setVisuallyReady(true); + }); } else { bool textureNeedsUpdate = resultWithReadLock([&]{ return !_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures); @@ -113,6 +117,12 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi _networkTexture = DependencyManager::get()->getTexture(_particleProperties.textures); }); } + + if (_networkTexture) { + withWriteLock([&] { + entity->setVisuallyReady(_networkTexture->isFailed() || _networkTexture->isLoaded()); + }); + } } void* key = (void*)this; diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index 238f41b05f..a0c12d8ee0 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -166,6 +166,7 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte { _type = EntityTypes::ParticleEffect; setColor(DEFAULT_COLOR); + _visuallyReady = false; } void ParticleEffectEntityItem::setAlpha(float alpha) { @@ -777,4 +778,4 @@ particle::Properties ParticleEffectEntityItem::getParticleProperties() const { } return result; -} \ No newline at end of file +} diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index 1ff88b425d..ddd23339df 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -231,7 +231,7 @@ private: QString _pendingPath; QTimer _settingsTimer; mutable ReadWriteLockable _interstitialModeSettingLock; - Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", false }; + Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", true }; QSet _domainConnectionRefusals; bool _hasCheckedForAccessToken { false }; diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 42341a8484..b8dcd22923 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -39,8 +39,8 @@ var DEFAULT_SCRIPTS_SEPARATE = [ ]; if (Window.interstitialModeEnabled) { - DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); - DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); + DEFAULT_SCRIPTS_COMBINED.push("system/interstitialPage.js"); + DEFAULT_SCRIPTS_COMBINED.push("system/redirectOverlays.js"); } // add a menu item for debugging diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index bd542b298d..00db9b1909 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -472,7 +472,7 @@ textureMemSizeAtLastCheck = textureResourceGPUMemSize; - if (textureMemSizeStabilityCount >= 15) { + if (textureMemSizeStabilityCount >= 20) { if (textureResourceGPUMemSize > 0) { print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); From 265bafecba22f5d5959b2f636b779a2af37e5911 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Thu, 4 Oct 2018 15:36:31 -0700 Subject: [PATCH 144/157] More CR Fixes --- cmake/templates/NSIS.template.in | 38 ++++++++++++++++++-------------- server-console/CMakeLists.txt | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index b3c3145672..fd48a792dc 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -1004,32 +1004,38 @@ Function HandlePostInstallOptions ${EndIf} ${EndIf} - ${If} $LaunchConsoleNowState == ${BST_CHECKED} - ${AndIf} @SERVER_COMPONENT_CONDITIONAL@ - !insertmacro WriteInstallOption @SERVER_LAUNCH_NOW_REG_KEY@ YES - - ; both launches use the explorer trick in case the user has elevated permissions for the installer - ${If} $LaunchClientNowState == ${BST_CHECKED} + ${If} $LaunchClientNowState == ${BST_CHECKED} !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ YES + ${Else} + !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ NO + ${EndIf} + + ${If} $LaunchConsoleNowState == ${BST_CHECKED} + !insertmacro WriteInstallOption @SERVER_LAUNCH_NOW_REG_KEY@ YES + ${Else} + !insertmacro WriteInstallOption @SERVER_LAUNCH_NOW_REG_KEY@ NO + ${EndIf} + + ${If} $LaunchConsoleNowState == ${BST_CHECKED} + ${If} @SERVER_COMPONENT_CONDITIONAL@ + ${AndIf} $LaunchClientNowState == ${BST_CHECKED} + ${AndIf} @CLIENT_COMPONENT_CONDITIONAL@ + ; both launches use the explorer trick in case the user has elevated permissions for the installer ; create shortcut with ARGUMENTS CreateShortCut "$TEMP\ConsoleShortcut.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" "-- --launchInterface" Exec '"$WINDIR\explorer.exe" "$TEMP\ConsoleShortcut.lnk"' ${Else} - !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ NO Exec '"$WINDIR\explorer.exe" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@"' ${EndIf} + ${EndIf} - ${ElseIf} @CLIENT_COMPONENT_CONDITIONAL@ - !insertmacro WriteInstallOption @SERVER_LAUNCH_NOW_REG_KEY@ NO - - ; launch uses the explorer trick in case the user has elevated permissions for the installer - ${If} $LaunchClientNowState == ${BST_CHECKED} - !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ YES + ${If} $LaunchClientNowState == ${BST_CHECKED} + ${AndIf} @CLIENT_COMPONENT_CONDITIONAL@ + ${Unless} $LaunchConsoleNowState == ${BST_CHECKED} + ${OrUnless} @SERVER_COMPONENT_CONDITIONAL@ + ; launch uses the explorer trick in case the user has elevated permissions for the installer Exec '"$WINDIR\explorer.exe" "$INSTDIR\@INTERFACE_WIN_EXEC_NAME@"' - ${Else} - !insertmacro WriteInstallOption @CLIENT_LAUNCH_NOW_REG_KEY@ NO ${EndIf} - ${EndIf} FunctionEnd diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 0c35567d28..49742cacf0 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -49,7 +49,7 @@ if (APPLE) install( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}" USE_SOURCE_PERMISSIONS - DESTINATION ${CONSOLE_INSTALL_DIR} + DESTINATION ${CONSOLE_INSTALL_DIR} ) elseif (WIN32) set(CONSOLE_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}") From 2a3b4a85c7cffbf39883d7bfce39d2a763d60628 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 15:57:05 -0700 Subject: [PATCH 145/157] debugging --- interface/src/octree/SafeLanding.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index a4dc086ad8..3077762a08 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -186,10 +186,13 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; if (enableInterstitial) { + bool hasRenderable = true; auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); if (!entityRenderable) { + hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } + qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } @@ -204,6 +207,10 @@ bool SafeLanding::isEntityLoadingComplete() { } } + if (!_trackedEntities.empty()) { + qDebug() << "\n"; + } + if (enableInterstitial) { _trackedEntityStabilityCount++; } From c423305bd1639f697f6737e3499b873a05de2a34 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 16:30:48 -0700 Subject: [PATCH 146/157] check overlay visibility before showing back up again --- scripts/system/redirectOverlays.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 2669cb0120..d7b58eb668 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -243,11 +243,11 @@ }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === backImageHover) { + if (overlayID === backImageHover && Overlays.getProperty(backImageHover, "visible")) { Overlays.editOverlay(backImageHover, {visible: false}); Overlays.editOverlay(backImageNeutral, {visible: true}); } - if (overlayID === tryAgainImageHover) { + if (overlayID === tryAgainImageHover && Overlays.getProperty(tryAgainImageHover, "visible")) { Overlays.editOverlay(tryAgainImageHover, {visible: false}); Overlays.editOverlay(tryAgainImageNeutral, {visible: true}); } From a2237aa48a3e4793d4a3825648566f874ea35e92 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 16:41:14 -0700 Subject: [PATCH 147/157] reverting click overlay behavior --- scripts/system/redirectOverlays.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index d7b58eb668..8f42990b7d 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -196,22 +196,8 @@ return; } if (tryAgainImageHover === overlayID) { - // hide try again overlays. - var properties = { - visible: false - }; - Overlays.editOverlay(tryAgainImageNeutral, properties); - Overlays.editOverlay(tryAgainImageHover, properties); - Overlays.editOverlay(tryAgainText, properties); location.goToLastAddress(); } else if (backImageHover === overlayID && location.canGoBack()) { - // hide back overlays. - var properties = { - visible: false - }; - Overlays.editOverlay(backImageNeutral, properties); - Overlays.editOverlay(backImageHover, properties); - Overlays.editOverlay(backText, properties); location.goBack(); } } From 5d011bafb26b3e034e0f4228b1231136c9187264 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 17:02:44 -0700 Subject: [PATCH 148/157] small tweaks --- interface/src/Application.h | 2 +- interface/src/octree/SafeLanding.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index 1ceae9cd02..750d9ce987 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -583,7 +583,7 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; - int _minimumGPUTextureMemSizeStabilityCount { 20 }; + int _minimumGPUTextureMemSizeStabilityCount { 30 }; ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 3077762a08..d5eb4c23c2 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -147,6 +147,10 @@ bool SafeLanding::isSequenceNumbersComplete() { (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); + if (!enableInterstitial) { + _trackingEntities = false; // Don't track anything else that comes in. + } return true; } } @@ -193,7 +197,7 @@ bool SafeLanding::isEntityLoadingComplete() { entityTree->addingEntity(entityMapIter->first); } qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); - isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } if (isEntityPhysicsReady(entity) && isVisuallyReady) { From d2850801976a8a585a67c4dfab5b033ece31b869 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Thu, 4 Oct 2018 18:38:25 -0700 Subject: [PATCH 149/157] remmoving some debug statements --- interface/src/Application.cpp | 2 -- interface/src/octree/SafeLanding.cpp | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4688160a34..1e158c30be 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6607,10 +6607,8 @@ bool Application::gpuTextureMemSizeStable() { _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { - qDebug() << "GPU checking"; return (textureResourceGPUMemSize == texturePopulatedGPUMemSize) && (textureTransferSize == 0); } - qDebug() << "GPU not ready"; return false; } diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index d5eb4c23c2..ed0ce3c278 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -107,7 +107,6 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { - qDebug() << "is sequence complete" << isSequenceNumbersComplete(); if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { Locker lock(_lock); _initialStart = INVALID_SEQUENCE; @@ -196,7 +195,7 @@ bool SafeLanding::isEntityLoadingComplete() { hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } - qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } @@ -211,10 +210,6 @@ bool SafeLanding::isEntityLoadingComplete() { } } - if (!_trackedEntities.empty()) { - qDebug() << "\n"; - } - if (enableInterstitial) { _trackedEntityStabilityCount++; } From 8abbd51bb1734fea69ce6cfa9bbfa7da45435a62 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 4 Oct 2018 23:11:27 -0700 Subject: [PATCH 150/157] removing unused variable --- interface/src/octree/SafeLanding.cpp | 2 -- scripts/system/redirectOverlays.js | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ed0ce3c278..94dfe77ba7 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -189,10 +189,8 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; if (enableInterstitial) { - bool hasRenderable = true; auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); if (!entityRenderable) { - hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 8f42990b7d..b1180e0cd0 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -14,6 +14,7 @@ var hardRefusalErrors = [PROTOCOL_VERSION_MISMATCH, NOT_AUTHORIZED, TIMEOUT]; var timer = null; + var isErrorState = false; function getOopsText() { var error = Window.getLastDomainConnectionError(); @@ -131,6 +132,7 @@ }); function toggleOverlays(isInErrorState) { + isErrorState = isInErrorState; if (!isInErrorState) { var properties = { visible: false @@ -148,6 +150,8 @@ var oopsText = getOopsText(); // if oopsText === "", it was a success. var overlaysVisible = (oopsText !== ""); + // for catching init or if error state were to be different. + isErrorState = overlaysVisible; var properties = { visible: overlaysVisible }; @@ -218,6 +222,10 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { + if (!isErrorState) { + // don't allow hover overlay events to get caught if it's not in error state anymore. + return; + } if (overlayID === backImageNeutral && location.canGoBack()) { Overlays.editOverlay(backImageNeutral, {visible: false}); Overlays.editOverlay(backImageHover, {visible: true}); @@ -229,11 +237,15 @@ }); Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === backImageHover && Overlays.getProperty(backImageHover, "visible")) { + if (!isErrorState) { + // don't allow hover overlay events to get caught if it's not in error state anymore. + return; + } + if (overlayID === backImageHover) { Overlays.editOverlay(backImageHover, {visible: false}); Overlays.editOverlay(backImageNeutral, {visible: true}); } - if (overlayID === tryAgainImageHover && Overlays.getProperty(tryAgainImageHover, "visible")) { + if (overlayID === tryAgainImageHover) { Overlays.editOverlay(tryAgainImageHover, {visible: false}); Overlays.editOverlay(tryAgainImageNeutral, {visible: true}); } From 88f76ac7601c3a5536e6638903ce0573af583435 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 4 Oct 2018 14:57:08 -0700 Subject: [PATCH 151/157] suppress traits larger than INT16_MAX bytes --- .../src/avatars/AvatarMixerClientData.cpp | 44 ++++++++++++++----- .../src/avatars/AvatarMixerSlave.cpp | 3 ++ libraries/avatars/src/AvatarData.cpp | 41 +++++++++++------ libraries/avatars/src/AvatarTraits.h | 1 + libraries/networking/src/NodeList.cpp | 1 - 5 files changed, 64 insertions(+), 26 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp index 187c9ed0f2..09bdfbc564 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.cpp +++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp @@ -112,6 +112,11 @@ void AvatarMixerClientData::processSetTraitsMessage(ReceivedMessage& message, AvatarTraits::TraitWireSize traitSize; message.readPrimitive(&traitSize); + if (traitSize < -1 || traitSize > message.getBytesLeftToRead()) { + qWarning() << "Refusing to process simple trait of size" << traitSize << "from" << message.getSenderSockAddr(); + break; + } + if (packetTraitVersion > _lastReceivedTraitVersions[traitType]) { _avatar->processTrait(traitType, message.read(traitSize)); _lastReceivedTraitVersions[traitType] = packetTraitVersion; @@ -128,26 +133,41 @@ void AvatarMixerClientData::processSetTraitsMessage(ReceivedMessage& message, } else { AvatarTraits::TraitInstanceID instanceID = QUuid::fromRfc4122(message.readWithoutCopy(NUM_BYTES_RFC4122_UUID)); + if (message.getBytesLeftToRead() == 0) { + qWarning () << "Received an instanced trait with no size from" << message.getSenderSockAddr(); + break; + } + AvatarTraits::TraitWireSize traitSize; message.readPrimitive(&traitSize); - auto& instanceVersionRef = _lastReceivedTraitVersions.getInstanceValueRef(traitType, instanceID); + if (traitSize < -1 || traitSize > message.getBytesLeftToRead()) { + qWarning() << "Refusing to process instanced trait of size" << traitSize << "from" << message.getSenderSockAddr(); + break; + } - if (packetTraitVersion > instanceVersionRef) { - if (traitSize == AvatarTraits::DELETED_TRAIT_SIZE) { - _avatar->processDeletedTraitInstance(traitType, instanceID); + if (traitType == AvatarTraits::AvatarEntity) { + auto& instanceVersionRef = _lastReceivedTraitVersions.getInstanceValueRef(traitType, instanceID); - // to track a deleted instance but keep version information - // the avatar mixer uses the negative value of the sent version - instanceVersionRef = -packetTraitVersion; + if (packetTraitVersion > instanceVersionRef) { + if (traitSize == AvatarTraits::DELETED_TRAIT_SIZE) { + _avatar->processDeletedTraitInstance(traitType, instanceID); + + // to track a deleted instance but keep version information + // the avatar mixer uses the negative value of the sent version + instanceVersionRef = -packetTraitVersion; + } else { + _avatar->processTraitInstance(traitType, instanceID, message.read(traitSize)); + instanceVersionRef = packetTraitVersion; + } + + anyTraitsChanged = true; } else { - _avatar->processTraitInstance(traitType, instanceID, message.read(traitSize)); - instanceVersionRef = packetTraitVersion; + message.seek(message.getPosition() + traitSize); } - - anyTraitsChanged = true; } else { - message.seek(message.getPosition() + traitSize); + qWarning() << "Refusing to process traits packet with instanced trait of unprocessable type from" << message.getSenderSockAddr(); + break; } } } diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp index 9c88580b99..b6ec006c39 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp @@ -152,6 +152,7 @@ qint64 AvatarMixerSlave::addChangedTraitsToBulkPacket(AvatarMixerClientData* lis }); if (!isDeleted && (sentInstanceIt == sentIDValuePairs.end() || receivedVersion > sentInstanceIt->value)) { + // this instance version exists and has never been sent or is newer so we need to send it bytesWritten += sendingAvatar->packTraitInstance(traitType, instanceID, traitsPacketList, receivedVersion); @@ -161,6 +162,7 @@ qint64 AvatarMixerSlave::addChangedTraitsToBulkPacket(AvatarMixerClientData* lis sentIDValuePairs.emplace_back(instanceID, receivedVersion); } } else if (isDeleted && sentInstanceIt != sentIDValuePairs.end() && absoluteReceivedVersion > sentInstanceIt->value) { + // this instance version was deleted and we haven't sent the delete to this client yet bytesWritten += AvatarTraits::packInstancedTraitDelete(traitType, instanceID, traitsPacketList, absoluteReceivedVersion); @@ -180,6 +182,7 @@ qint64 AvatarMixerSlave::addChangedTraitsToBulkPacket(AvatarMixerClientData* lis listeningNodeData->setLastOtherAvatarTraitsSendPoint(otherNodeLocalID, timeOfLastTraitsChange); } + return bytesWritten; } diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 2168dff1f6..62eaee0f46 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -1802,15 +1802,24 @@ QUrl AvatarData::getWireSafeSkeletonModelURL() const { qint64 AvatarData::packTrait(AvatarTraits::TraitType traitType, ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion) { - qint64 bytesWritten = 0; - bytesWritten += destination.writePrimitive(traitType); - if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { - bytesWritten += destination.writePrimitive(traitVersion); - } + qint64 bytesWritten = 0; if (traitType == AvatarTraits::SkeletonModelURL) { + QByteArray encodedSkeletonURL = getWireSafeSkeletonModelURL().toEncoded(); + + if (encodedSkeletonURL.size() > AvatarTraits::MAXIMUM_TRAIT_SIZE) { + qWarning() << "Refusing to pack simple trait" << traitType << "of size" << encodedSkeletonURL.size() + << "bytes since it exceeds the maximum size" << AvatarTraits::MAXIMUM_TRAIT_SIZE << "bytes"; + return 0; + } + + bytesWritten += destination.writePrimitive(traitType); + + if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { + bytesWritten += destination.writePrimitive(traitVersion); + } AvatarTraits::TraitWireSize encodedURLSize = encodedSkeletonURL.size(); bytesWritten += destination.writePrimitive(encodedURLSize); @@ -1825,14 +1834,6 @@ qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTr ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion) { qint64 bytesWritten = 0; - bytesWritten += destination.writePrimitive(traitType); - - if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { - bytesWritten += destination.writePrimitive(traitVersion); - } - - bytesWritten += destination.write(traitInstanceID.toRfc4122()); - if (traitType == AvatarTraits::AvatarEntity) { // grab a read lock on the avatar entities and check for entity data for the given ID QByteArray entityBinaryData; @@ -1843,6 +1844,20 @@ qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTr } }); + if (entityBinaryData.size() > AvatarTraits::MAXIMUM_TRAIT_SIZE) { + qWarning() << "Refusing to pack instanced trait" << traitType << "of size" << entityBinaryData.size() + << "bytes since it exceeds the maximum size " << AvatarTraits::MAXIMUM_TRAIT_SIZE << "bytes"; + return 0; + } + + bytesWritten += destination.writePrimitive(traitType); + + if (traitVersion > AvatarTraits::DEFAULT_TRAIT_VERSION) { + bytesWritten += destination.writePrimitive(traitVersion); + } + + bytesWritten += destination.write(traitInstanceID.toRfc4122()); + if (!entityBinaryData.isNull()) { AvatarTraits::TraitWireSize entityBinarySize = entityBinaryData.size(); diff --git a/libraries/avatars/src/AvatarTraits.h b/libraries/avatars/src/AvatarTraits.h index f0c807a432..5e28515d12 100644 --- a/libraries/avatars/src/AvatarTraits.h +++ b/libraries/avatars/src/AvatarTraits.h @@ -39,6 +39,7 @@ namespace AvatarTraits { using TraitWireSize = int16_t; const TraitWireSize DELETED_TRAIT_SIZE = -1; + const TraitWireSize MAXIMUM_TRAIT_SIZE = INT16_MAX; inline qint64 packInstancedTraitDelete(TraitType traitType, TraitInstanceID instanceID, ExtendedIODevice& destination, TraitVersion traitVersion = NULL_TRAIT_VERSION) { diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index e458ffab7e..917a4ca791 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -332,7 +332,6 @@ void NodeList::sendDomainServerCheckIn() { qCDebug(networking) << "Local domain-server port read from shared memory (or default) is" << domainPort; _domainHandler.setPort(domainPort); } - } // check if we're missing a keypair we need to verify ourselves with the domain-server From c3478dc018a34e5e392d96b8819ce2955633348e Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 5 Oct 2018 13:48:35 -0700 Subject: [PATCH 152/157] remove expired avatarEntities from their avatars --- interface/src/Application.cpp | 4 ++++ interface/src/avatar/AvatarManager.cpp | 11 +++++++++++ interface/src/avatar/AvatarManager.h | 2 ++ interface/src/avatar/MyAvatar.cpp | 2 +- libraries/entities/src/EntitySimulation.h | 2 +- libraries/physics/src/PhysicalEntitySimulation.cpp | 8 ++++++++ libraries/physics/src/PhysicalEntitySimulation.h | 2 ++ 7 files changed, 29 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4b45541e1a..c708676b17 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5921,6 +5921,10 @@ void Application::update(float deltaTime) { // update the rendering without any simulation getEntities()->update(false); } + // remove recently dead avatarEntities + SetOfEntities deadAvatarEntities; + _entitySimulation->takeDeadAvatarEntities(deadAvatarEntities); + avatarManager->removeDeadAvatarEntities(deadAvatarEntities); } // AvatarManager update diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index c268561a8d..d31b201dc7 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -452,6 +452,17 @@ void AvatarManager::handleProcessedPhysicsTransaction(PhysicsEngine::Transaction transaction.clear(); } +void AvatarManager::removeDeadAvatarEntities(const SetOfEntities& deadEntities) { + for (auto entity : deadEntities) { + QUuid sessionID = entity->getOwningAvatarID(); + AvatarSharedPointer avatar = getAvatarBySessionID(sessionID); + if (avatar) { + const bool REQUIRES_REMOVAL_FROM_TREE = false; + avatar->clearAvatarEntity(entity->getID(), REQUIRES_REMOVAL_FROM_TREE); + } + } +} + void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) { auto avatar = std::static_pointer_cast(removedAvatar); { diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index 3ed156f673..209b976c44 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -26,6 +26,7 @@ #include #include #include +#include // for SetOfEntities #include "AvatarMotionState.h" #include "MyAvatar.h" @@ -187,6 +188,7 @@ public: void queuePhysicsChange(const OtherAvatarPointer& avatar); void buildPhysicsTransaction(PhysicsEngine::Transaction& transaction); void handleProcessedPhysicsTransaction(PhysicsEngine::Transaction& transaction); + void removeDeadAvatarEntities(const SetOfEntities& deadEntities); public slots: /**jsdoc diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 086cbb3425..b347963cf1 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -137,7 +137,7 @@ MyAvatar::MyAvatar(QThread* thread) : _useSnapTurnSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "useSnapTurn", _useSnapTurn), _userHeightSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "userHeight", DEFAULT_AVATAR_HEIGHT), _flyingHMDSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "flyingHMD", _flyingPrefHMD), - _avatarEntityCountSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData" << "size", _flyingPrefHMD) + _avatarEntityCountSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData" << "size", 0) { _clientTraitsHandler = std::unique_ptr(new ClientTraitsHandler(this)); diff --git a/libraries/entities/src/EntitySimulation.h b/libraries/entities/src/EntitySimulation.h index b19e1c33d3..f107bcae6e 100644 --- a/libraries/entities/src/EntitySimulation.h +++ b/libraries/entities/src/EntitySimulation.h @@ -104,7 +104,7 @@ protected: QMutex _dynamicsMutex { QMutex::Recursive }; protected: - SetOfEntities _deadEntities; + SetOfEntities _deadEntities; // dead entities that might still be in the _entityTree private: void moveSimpleKinematics(); diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index 2004f8953d..ab8bfb8290 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -79,6 +79,9 @@ void PhysicalEntitySimulation::removeEntityInternal(EntityItemPointer entity) { _deadEntities.insert(entity); } } + if (entity->getClientOnly()) { + _deadAvatarEntities.insert(entity); + } } void PhysicalEntitySimulation::removeOwnershipData(EntityMotionState* motionState) { @@ -123,6 +126,11 @@ void PhysicalEntitySimulation::takeDeadEntities(SetOfEntities& deadEntities) { _deadEntities.clear(); } +void PhysicalEntitySimulation::takeDeadAvatarEntities(SetOfEntities& deadEntities) { + _deadAvatarEntities.swap(deadEntities); + _deadAvatarEntities.clear(); +} + void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) { // queue incoming changes: from external sources (script, EntityServer, etc) to physics engine QMutexLocker lock(&_mutex); diff --git a/libraries/physics/src/PhysicalEntitySimulation.h b/libraries/physics/src/PhysicalEntitySimulation.h index fdf996df25..843069e247 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.h +++ b/libraries/physics/src/PhysicalEntitySimulation.h @@ -60,6 +60,7 @@ public: virtual void applyDynamicChanges() override; virtual void takeDeadEntities(SetOfEntities& deadEntities) override; + void takeDeadAvatarEntities(SetOfEntities& deadEntities); signals: void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision); @@ -112,6 +113,7 @@ private: VectorOfEntityMotionStates _owned; VectorOfEntityMotionStates _bids; + SetOfEntities _deadAvatarEntities; workload::SpacePointer _space; uint64_t _nextBidExpiry; uint32_t _lastStepSendPackets { 0 }; From 82170a66edb67c552eb42d0bdeae8448cf78783f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 5 Oct 2018 14:43:57 -0700 Subject: [PATCH 153/157] avoid backwards seek for skipped trait deletes --- libraries/avatars/src/AvatarHashMap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index c8ea68dae4..2f3b12e0ed 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -337,7 +337,7 @@ void AvatarHashMap::processBulkAvatarTraits(QSharedPointer mess // grab the last trait versions for this avatar auto& lastProcessedVersions = _processedTraitVersions[avatarID]; - while (traitType != AvatarTraits::NullTrait) { + while (traitType != AvatarTraits::NullTrait && message->getBytesLeftToRead() > 0) { AvatarTraits::TraitVersion packetTraitVersion; message->readPrimitive(&packetTraitVersion); @@ -378,7 +378,7 @@ void AvatarHashMap::processBulkAvatarTraits(QSharedPointer mess } } - if (skipBinaryTrait) { + if (skipBinaryTrait && traitBinarySize > 0) { // we didn't read this trait because it was older or because we didn't have an avatar to process it for message->seek(message->getPosition() + traitBinarySize); } From 36c2cceb577a6daeb16024ad967d5e4710484e0f Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 5 Oct 2018 15:39:51 -0700 Subject: [PATCH 154/157] fix for failing to enter domain --- interface/src/Application.cpp | 5 ++++- interface/src/Application.h | 4 ++++ interface/src/octree/SafeLanding.cpp | 4 +++- interface/src/scripting/WindowScriptingInterface.cpp | 4 ---- interface/src/scripting/WindowScriptingInterface.h | 2 -- scripts/system/interstitialPage.js | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1e158c30be..57ed19c021 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5617,7 +5617,8 @@ void Application::update(float deltaTime) { // for nearby entities before starting bullet up. quint64 now = usecTimestampNow(); if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) { - if (gpuTextureMemSizeStable()) { + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); + if (gpuTextureMemSizeStable() || !enableInterstitial) { // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway _lastPhysicsCheckTime = now; _fullSceneCounterAtLastPhysicsCheck = _fullSceneReceivedCounter; @@ -6241,6 +6242,8 @@ int Application::sendNackPackets() { missingSequenceNumbers = sequenceNumberStats.getMissingSet(); }); + _isMissingSequenceNumbers = (missingSequenceNumbers.size() != 0); + // construct nack packet(s) for this node foreach(const OCTREE_PACKET_SEQUENCE& missingNumber, missingSequenceNumbers) { nackPacketList->writePrimitive(missingNumber); diff --git a/interface/src/Application.h b/interface/src/Application.h index 750d9ce987..75260b910f 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -183,6 +183,8 @@ public: // passes, mirror window passes, etc void copyDisplayViewFrustum(ViewFrustum& viewOut) const; + bool isMissingSequenceNumbers() { return _isMissingSequenceNumbers; } + const ConicalViewFrustums& getConicalViews() const override { return _conicalViews; } const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; } @@ -713,6 +715,8 @@ private: bool _fakedMouseEvent { false }; + bool _isMissingSequenceNumbers { false }; + void checkChangeCursor(); mutable QMutex _changeCursorLock { QMutex::Recursive }; Qt::CursorShape _desiredCursor{ Qt::BlankCursor }; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ed0ce3c278..02a8441fab 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -142,10 +142,12 @@ bool SafeLanding::isSequenceNumbersComplete() { _initialEnd + SEQUENCE_MODULO - _initialStart; auto startIter = _sequenceNumbers.find(_initialStart); auto endIter = _sequenceNumbers.find(_initialEnd - 1); + + bool missingSequenceNumbers = qApp->isMissingSequenceNumbers(); if (sequenceSize == 0 || (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() - && distance(startIter, endIter) == sequenceSize - 1)) { + && ((distance(startIter, endIter) == sequenceSize - 1) || !missingSequenceNumbers))) { bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); if (!enableInterstitial) { _trackingEntities = false; // Don't track anything else that comes in. diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index c09bff7b5e..75f17def20 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -399,10 +399,6 @@ void WindowScriptingInterface::showAssetServer(const QString& upload) { QMetaObject::invokeMethod(qApp, "showAssetServerWidget", Qt::QueuedConnection, Q_ARG(QString, upload)); } -void WindowScriptingInterface::setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount) { - QMetaObject::invokeMethod(qApp, " setMinimumGPUTextureMemStabilityCount", Qt::QueuedConnection, Q_ARG(int, stabilityCount)); -} - QString WindowScriptingInterface::checkVersion() { return QCoreApplication::applicationVersion(); } diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index fe0113b770..f6a5a5ef74 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -571,8 +571,6 @@ public slots: float domainLoadingProgress(); - void setMinimumGPUTextureMemSizeStabilityCount(int stabilityCount); - private slots: void onWindowGeometryChanged(const QRect& geometry); void onMessageBoxSelected(int button); diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 1c2f83bb04..19e603b4ab 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -50,7 +50,7 @@ "Tip: Use the Create app to import models and create custom entities.", "Tip: We're open source! Feel free to contribute to our code on GitHub!", "Tip: What emotes have you used in the Emote app?", - "Tip: Take and share your snapshots with the everyone using the Snap app.", + "Tip: Take and share your snapshots with everyone using the Snap app.", "Tip: Did you know you can show websites in-world by creating a web entity?", "Tip: Find out more information about domains by visiting our website!", "Tip: Did you know you can get cool new apps from the Marketplace?", From 335c60e6b8afd91e7cda6eb1ccca34668286a545 Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Fri, 5 Oct 2018 17:29:25 -0700 Subject: [PATCH 155/157] Reduce the glitches of far away animating avatars Currently, the avatars that are further then 10 meters away have a very aggressive 15 degree rotation threshold, used to reduce the amount of rotation joint changes sent over the network. This PR tunes both the distances and rotation thresholds used for this LOD culling. --- libraries/avatars/src/AvatarData.cpp | 8 +++++--- libraries/avatars/src/AvatarData.h | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 5fb4ef3156..5930b79074 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -206,11 +206,13 @@ float AvatarData::getDistanceBasedMinRotationDOT(glm::vec3 viewerPosition) const if (distance < AVATAR_DISTANCE_LEVEL_1) { result = AVATAR_MIN_ROTATION_DOT; } else if (distance < AVATAR_DISTANCE_LEVEL_2) { - result = ROTATION_CHANGE_15D; + result = ROTATION_CHANGE_2D; } else if (distance < AVATAR_DISTANCE_LEVEL_3) { - result = ROTATION_CHANGE_45D; + result = ROTATION_CHANGE_4D; } else if (distance < AVATAR_DISTANCE_LEVEL_4) { - result = ROTATION_CHANGE_90D; + result = ROTATION_CHANGE_6D; + } else if (distance < AVATAR_DISTANCE_LEVEL_5) { + result = ROTATION_CHANGE_15D; } return result; } diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 860772b7c9..46489451f7 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -309,16 +309,19 @@ const float AVATAR_SEND_FULL_UPDATE_RATIO = 0.02f; const float AVATAR_MIN_ROTATION_DOT = 0.9999999f; const float AVATAR_MIN_TRANSLATION = 0.0001f; -const float ROTATION_CHANGE_15D = 0.9914449f; -const float ROTATION_CHANGE_45D = 0.9238795f; -const float ROTATION_CHANGE_90D = 0.7071068f; -const float ROTATION_CHANGE_179D = 0.0087266f; - -const float AVATAR_DISTANCE_LEVEL_1 = 10.0f; -const float AVATAR_DISTANCE_LEVEL_2 = 100.0f; -const float AVATAR_DISTANCE_LEVEL_3 = 1000.0f; -const float AVATAR_DISTANCE_LEVEL_4 = 10000.0f; +// quaternion dot products +const float ROTATION_CHANGE_2D = 0.99984770f; // 2 degrees +const float ROTATION_CHANGE_4D = 0.99939083f; // 4 degrees +const float ROTATION_CHANGE_6D = 0.99862953f; // 6 degrees +const float ROTATION_CHANGE_15D = 0.99144486f; // 15 degrees +const float ROTATION_CHANGE_179D = 0.00872653f; // 179 degrees +// rotation culling distance thresholds +const float AVATAR_DISTANCE_LEVEL_1 = 12.5f; // meters +const float AVATAR_DISTANCE_LEVEL_2 = 16.6f; // meters +const float AVATAR_DISTANCE_LEVEL_3 = 25.0f; // meters +const float AVATAR_DISTANCE_LEVEL_4 = 50.0f; // meters +const float AVATAR_DISTANCE_LEVEL_5 = 200.0f; // meters // Where one's own Avatar begins in the world (will be overwritten if avatar data file is found). // This is the start location in the Sandbox (xyz: 6270, 211, 6000). From 1719f4a4748b7ace4fd07a214c61558ccedce794 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Fri, 5 Oct 2018 23:49:06 -0300 Subject: [PATCH 156/157] Build libplugins_libhifiCodec.so --- android/app/CMakeLists.txt | 2 ++ android/app/build.gradle | 2 ++ android/build.gradle | 28 +++++++++++++++++++------ cmake/macros/TargetHifiAudioCodec.cmake | 22 +++++++++++++++++++ plugins/hifiCodec/CMakeLists.txt | 5 +---- 5 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 cmake/macros/TargetHifiAudioCodec.cmake diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt index d24a84c6a5..9930a9e152 100644 --- a/android/app/CMakeLists.txt +++ b/android/app/CMakeLists.txt @@ -7,6 +7,8 @@ target_bullet() set(INTERFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../interface") add_subdirectory("${INTERFACE_DIR}" "libraries/interface") include_directories("${INTERFACE_DIR}/src") +set(HIFI_CODEC_PLUGIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../plugins/hifiCodec") +add_subdirectory("${HIFI_CODEC_PLUGIN_DIR}" "libraries/hifiCodecPlugin") target_link_libraries(native-lib android log m interface) diff --git a/android/app/build.gradle b/android/app/build.gradle index 24c067b176..13d3a0fc41 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -80,8 +80,10 @@ android { if (Os.isFamily(Os.FAMILY_UNIX)) { def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() + def renameHifiACTask = rootProject.getTasksByName("renameHifiACTask${variant.name.capitalize()}", false).first() runDumpSymsTask.dependsOn(task) variant.assemble.dependsOn(uploadDumpSymsTask) + variant.assemble.dependsOn(renameHifiACTask) } } diff --git a/android/build.gradle b/android/build.gradle index aa7aa399b2..72015aab2e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -143,11 +143,9 @@ def packages = [ includeLibs: ['libtbb.so', 'libtbbmalloc.so'], ], hifiAC: [ - file: 'libplugins_libhifiCodec.zip', - versionId: 'i31pW.qNbvFOXRxbyiJUxg3sphaFNmZU', - checksum: '9412a8e12c88a4096c1fc843bb9fe52d', - sharedLibFolder: '', - includeLibs: ['libplugins_libhifiCodec.so'] + baseUrl: 'http://s3.amazonaws.com/hifi-public/dependencies/', + file: 'codecSDK-android_armv8-2.0.zip', + checksum: '1cbef929675818fc64c4101b72f84a6a' ], etc2comp: [ file: 'etc2comp-patched-armv8-libcpp.tgz', @@ -367,7 +365,8 @@ task downloadDependencies { doLast { packages.each { entry -> def filename = entry.value['file']; - def url = baseUrl + filename; + def dependencyBaseUrl = entry.value['baseUrl'] + def url = (dependencyBaseUrl?.trim() ? dependencyBaseUrl : baseUrl) + filename; if (entry.value.containsKey('versionId')) { url = url + '?versionId=' + entry.value['versionId'] } @@ -668,6 +667,23 @@ task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, d } } +task renameHifiACTaskDebug() { + doLast { + def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") + def destinationFile = new File("${appDir}/src/main/jniLibs/", "libplugins_libhifiCodec.so)") + copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } + } +} +task renameHifiACTaskRelease(type: Copy) { + doLast { + doLast { + def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") + def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") + copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } + } + } +} + // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above /* diff --git a/cmake/macros/TargetHifiAudioCodec.cmake b/cmake/macros/TargetHifiAudioCodec.cmake new file mode 100644 index 0000000000..98c24e684c --- /dev/null +++ b/cmake/macros/TargetHifiAudioCodec.cmake @@ -0,0 +1,22 @@ +# +# Copyright 2018 High Fidelity, Inc. +# Created by Gabriel Calero and Cristian Duarte on 2018/10/05 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_HIFIAUDIOCODEC) + if (ANDROID) + set(HIFIAC_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/hifiAC/codecSDK) + set(HIFIAC_LIB_DIR "${HIFIAC_INSTALL_DIR}/Release") + set(HIFIAC_INCLUDE_DIRS "${HIFIAC_INSTALL_DIR}/include" CACHE TYPE INTERNAL) + list(APPEND HIFIAC_LIBS "${HIFIAC_LIB_DIR}/libaudio.a") + set(HIFIAC_LIBRARIES ${HIFIAC_LIBS} CACHE TYPE INTERNAL) + else() + add_dependency_external_projects(hifiAudioCodec) + target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES}) + endif() + target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAC_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${HIFIAC_LIBRARIES}) +endmacro() diff --git a/plugins/hifiCodec/CMakeLists.txt b/plugins/hifiCodec/CMakeLists.txt index 9ecaf7b511..0d4f093fc2 100644 --- a/plugins/hifiCodec/CMakeLists.txt +++ b/plugins/hifiCodec/CMakeLists.txt @@ -9,10 +9,7 @@ set(TARGET_NAME hifiCodec) setup_hifi_client_server_plugin() link_hifi_libraries(audio plugins) -add_dependency_external_projects(hifiAudioCodec) -target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES}) - +target_hifiAudioCodec() if (BUILD_SERVER) install_beside_console() endif () From 42285245d5eda94c12fa52c3d943739f1efe5bc1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Sat, 6 Oct 2018 00:43:19 -0300 Subject: [PATCH 157/157] Fix gradle script --- android/app/build.gradle | 2 +- android/build.gradle | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 13d3a0fc41..76f5acfaea 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -83,7 +83,7 @@ android { def renameHifiACTask = rootProject.getTasksByName("renameHifiACTask${variant.name.capitalize()}", false).first() runDumpSymsTask.dependsOn(task) variant.assemble.dependsOn(uploadDumpSymsTask) - variant.assemble.dependsOn(renameHifiACTask) + variant.mergeResources.dependsOn(renameHifiACTask) } } diff --git a/android/build.gradle b/android/build.gradle index 72015aab2e..14f9e4803f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -670,17 +670,15 @@ task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, d task renameHifiACTaskDebug() { doLast { def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/", "libplugins_libhifiCodec.so)") + def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } } } task renameHifiACTaskRelease(type: Copy) { doLast { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } + def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") + def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") + copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } } }