From a4b31802716b1c36135eefb49808ff0c8816a107 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 23 Oct 2017 14:48:25 -0700 Subject: [PATCH 01/86] Fix sparse rectification for small textures --- libraries/image/src/image/Image.cpp | 52 +++++++++++++---------------- tests/gpu-test/src/main.cpp | 41 ++++++++--------------- 2 files changed, 37 insertions(+), 56 deletions(-) diff --git a/libraries/image/src/image/Image.cpp b/libraries/image/src/image/Image.cpp index 9f584c844f..42480450a5 100644 --- a/libraries/image/src/image/Image.cpp +++ b/libraries/image/src/image/Image.cpp @@ -19,15 +19,6 @@ #include #include - -#if defined(Q_OS_ANDROID) -#define CPU_MIPMAPS 0 -#else -#define CPU_MIPMAPS 1 -#include -#endif - - #include #include #include @@ -37,6 +28,12 @@ using namespace gpu; +#if defined(Q_OS_ANDROID) +#define CPU_MIPMAPS 0 +#else +#define CPU_MIPMAPS 1 +#include +#endif static const glm::uvec2 SPARSE_PAGE_SIZE(128); static const glm::uvec2 MAX_TEXTURE_SIZE(4096); @@ -51,25 +48,21 @@ static std::atomic compressNormalTextures { false }; static std::atomic compressGrayscaleTextures { false }; static std::atomic compressCubeTextures { false }; -bool needsSparseRectification(const glm::uvec2& size) { - // Don't attempt to rectify small textures (textures less than the sparse page size in any dimension) - if (glm::any(glm::lessThan(size, SPARSE_PAGE_SIZE))) { - return false; +uint rectifyDimension(const uint& dimension) { + if (dimension < SPARSE_PAGE_SIZE.x) { + uint newSize = SPARSE_PAGE_SIZE.x; + while (dimension <= newSize / 2) { + newSize /= 2; + } + return newSize; + } else { + uint pages = (dimension / SPARSE_PAGE_SIZE.x) + (dimension % SPARSE_PAGE_SIZE.x == 0 ? 0 : 1); + return pages * SPARSE_PAGE_SIZE.x; } - - // Don't rectify textures that are already an exact multiple of sparse page size - if (glm::uvec2(0) == (size % SPARSE_PAGE_SIZE)) { - return false; - } - - // Texture is not sparse compatible, but is bigger than the sparse page size in both dimensions, rectify! - return true; } -glm::uvec2 rectifyToSparseSize(const glm::uvec2& size) { - glm::uvec2 pages = ((size / SPARSE_PAGE_SIZE) + glm::clamp(size % SPARSE_PAGE_SIZE, glm::uvec2(0), glm::uvec2(1))); - glm::uvec2 result = pages * SPARSE_PAGE_SIZE; - return result; +glm::uvec2 rectifySize(const glm::uvec2& size) { + return { rectifyDimension(size.x), rectifyDimension(size.y) }; } @@ -307,9 +300,12 @@ QImage processSourceImage(const QImage& srcImage, bool cubemap) { ++DECIMATED_TEXTURE_COUNT; } - if (!cubemap && needsSparseRectification(targetSize)) { - ++RECTIFIED_TEXTURE_COUNT; - targetSize = rectifyToSparseSize(targetSize); + if (!cubemap) { + auto rectifiedSize = rectifySize(targetSize); + if (rectifiedSize != targetSize) { + ++RECTIFIED_TEXTURE_COUNT; + targetSize = rectifiedSize; + } } if (DEV_DECIMATE_TEXTURES && glm::all(glm::greaterThanEqual(targetSize / SPARSE_PAGE_SIZE, glm::uvec2(2)))) { diff --git a/tests/gpu-test/src/main.cpp b/tests/gpu-test/src/main.cpp index d37be7c790..6a509afe4e 100644 --- a/tests/gpu-test/src/main.cpp +++ b/tests/gpu-test/src/main.cpp @@ -163,46 +163,31 @@ class MyTestWindow : public TestWindow { } }; -extern bool needsSparseRectification(const uvec2& size); -extern uvec2 rectifyToSparseSize(const uvec2& size); +extern uvec2 rectifySize(const uvec2& size); void testSparseRectify() { - std::vector> NEEDS_SPARSE_TESTS {{ + std::vector> SPARSE_SIZE_TESTS { // Already sparse - { {1024, 1024 }, false }, - { { 128, 128 }, false }, + { {1024, 1024 }, { 1024, 1024 } }, + { { 128, 128 }, { 128, 128 } }, // Too small in one dimension - { { 127, 127 }, false }, - { { 1, 1 }, false }, - { { 1000, 1 }, false }, - { { 1024, 1 }, false }, - { { 100, 100 }, false }, - // needs rectification - { { 1000, 1000 }, true }, - { { 1024, 1000 }, true }, - } }; - - for (const auto& test : NEEDS_SPARSE_TESTS) { - const auto& size = test.first; - const auto& expected = test.second; - auto result = needsSparseRectification(size); - Q_ASSERT(expected == result); - result = needsSparseRectification(uvec2(size.y, size.x)); - Q_ASSERT(expected == result); - } - - std::vector> SPARSE_SIZE_TESTS { { + { { 127, 127 }, { 128, 128 } }, + { { 1, 1 }, { 1, 1 } }, + { { 1000, 1 }, { 1024, 1 } }, + { { 1024, 1 }, { 1024, 1 } }, + { { 100, 100 }, { 128, 128 } }, + { { 57, 510 }, { 64, 512 } }, // needs rectification { { 1000, 1000 }, { 1024, 1024 } }, { { 1024, 1000 }, { 1024, 1024 } }, - } }; + }; for (const auto& test : SPARSE_SIZE_TESTS) { const auto& size = test.first; const auto& expected = test.second; - auto result = rectifyToSparseSize(size); + auto result = rectifySize(size); Q_ASSERT(expected == result); - result = rectifyToSparseSize(uvec2(size.y, size.x)); + result = rectifySize(uvec2(size.y, size.x)); Q_ASSERT(expected == uvec2(result.y, result.x)); } } From 5688a166f8e245c8b3a7a798e516ab1eaeed03ba Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 5 Dec 2017 12:18:57 -0800 Subject: [PATCH 02/86] fix folder name creation for duplicated models --- tools/oven/src/DomainBaker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/oven/src/DomainBaker.cpp b/tools/oven/src/DomainBaker.cpp index 535d9a49a9..edc2492e82 100644 --- a/tools/oven/src/DomainBaker.cpp +++ b/tools/oven/src/DomainBaker.cpp @@ -195,9 +195,9 @@ void DomainBaker::enumerateEntities() { auto filename = modelURL.fileName(); auto baseName = filename.left(filename.lastIndexOf('.')); auto subDirName = "/" + baseName; - int i = 0; + int i = 1; while (QDir(_contentOutputPath + subDirName).exists()) { - subDirName = "/" + baseName + "-" + i++; + subDirName = "/" + baseName + "-" + QString::number(i++); } QSharedPointer baker { new FBXBaker(modelURL, []() -> QThread* { From 30bbe6e41b0bd6f16b38903551175d81eb0292af Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 28 Dec 2017 15:43:59 -0800 Subject: [PATCH 03/86] added relayParentJoints property --- libraries/entities/src/EntityItemProperties.cpp | 9 +++++++++ libraries/entities/src/EntityItemProperties.h | 1 + .../entities/src/EntityItemPropertiesDefaults.h | 2 ++ libraries/entities/src/EntityPropertyFlags.h | 1 + libraries/entities/src/ModelEntityItem.cpp | 17 +++++++++++++++++ libraries/entities/src/ModelEntityItem.h | 4 ++++ libraries/networking/src/udt/PacketHeaders.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.h | 1 + 8 files changed, 36 insertions(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 13ebd9ef9f..b739726bce 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -507,6 +507,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS, jointTranslations); + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_RELAY_PARENT_JOINTS, relayParentJoints); } if (_type == EntityTypes::Model || _type == EntityTypes::Zone || _type == EntityTypes::ParticleEffect) { @@ -732,6 +733,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool COPY_PROPERTY_FROM_QSCRIPTVALUE(radiusSpread, float, setRadiusSpread); COPY_PROPERTY_FROM_QSCRIPTVALUE(radiusStart, float, setRadiusStart); COPY_PROPERTY_FROM_QSCRIPTVALUE(radiusFinish, float, setRadiusFinish); + COPY_PROPERTY_FROM_QSCRIPTVALUE(relayParentJoints, bool, setRelayParentJoints); // Certifiable Properties COPY_PROPERTY_FROM_QSCRIPTVALUE(itemName, QString, setItemName); @@ -1137,6 +1139,7 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector); ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector); ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS, JointTranslations, jointTranslations, QVector); + ADD_PROPERTY_TO_MAP(PROP_RELAY_PARENT_JOINTS, RelayParentJoints, relayParentJoints, bool); ADD_PROPERTY_TO_MAP(PROP_SHAPE, Shape, shape, QString); @@ -1364,6 +1367,7 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, properties.getJointRotations()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, properties.getJointTranslationsSet()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, properties.getJointTranslations()); + APPEND_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, properties.getRelayParentJoints()); } if (properties.getType() == EntityTypes::Light) { @@ -1721,6 +1725,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_ROTATIONS, QVector, setJointRotations); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS_SET, QVector, setJointTranslationsSet); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_JOINT_TRANSLATIONS, QVector, setJointTranslations); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_RELAY_PARENT_JOINTS, bool, setRelayParentJoints); } if (properties.getType() == EntityTypes::Light) { @@ -2062,6 +2067,7 @@ void EntityItemProperties::markAllChanged() { _owningAvatarIDChanged = true; _dpiChanged = true; + _relayParentJointsChanged = true; } // The minimum bounding box for the entity. @@ -2420,6 +2426,9 @@ QList EntityItemProperties::listChangedProperties() { if (jointTranslationsChanged()) { out += "jointTranslations"; } + if (relayParentJointsChanged()) { + out += "relayParentJoints"; + } if (queryAACubeChanged()) { out += "queryAACube"; } diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 4f7ba1317b..96036c1a2c 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -245,6 +245,7 @@ public: DEFINE_PROPERTY_REF(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid, ENTITY_ITEM_DEFAULT_LAST_EDITED_BY); DEFINE_PROPERTY_REF(PROP_SERVER_SCRIPTS, ServerScripts, serverScripts, QString, ENTITY_ITEM_DEFAULT_SERVER_SCRIPTS); + DEFINE_PROPERTY(PROP_RELAY_PARENT_JOINTS, RelayParentJoints, relayParentJoints, bool, ENTITY_ITEM_DEFAULT_RELAY_PARENT_JOINTS); static QString getBackgroundModeString(BackgroundMode mode); static QString getHazeModeString(uint32_t mode); diff --git a/libraries/entities/src/EntityItemPropertiesDefaults.h b/libraries/entities/src/EntityItemPropertiesDefaults.h index 49bce37fbd..eb09a64628 100644 --- a/libraries/entities/src/EntityItemPropertiesDefaults.h +++ b/libraries/entities/src/EntityItemPropertiesDefaults.h @@ -92,4 +92,6 @@ const uint16_t ENTITY_ITEM_DEFAULT_DPI = 30; const QUuid ENTITY_ITEM_DEFAULT_LAST_EDITED_BY = QUuid(); +const bool ENTITY_ITEM_DEFAULT_RELAY_PARENT_JOINTS = false; + #endif // hifi_EntityItemPropertiesDefaults_h diff --git a/libraries/entities/src/EntityPropertyFlags.h b/libraries/entities/src/EntityPropertyFlags.h index 41c1e77bb8..9ec11fccfc 100644 --- a/libraries/entities/src/EntityPropertyFlags.h +++ b/libraries/entities/src/EntityPropertyFlags.h @@ -40,6 +40,7 @@ enum EntityPropertyList { PROP_ANIMATION_FRAME_INDEX, PROP_ANIMATION_PLAYING, PROP_ANIMATION_ALLOW_TRANSLATION, + PROP_RELAY_PARENT_JOINTS, // these properties are supported by the EntityItem base class PROP_REGISTRATION_POINT, diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 3a79df34c6..4304f50be0 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -62,6 +62,7 @@ EntityItemProperties ModelEntityItem::getProperties(EntityPropertyFlags desiredP COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotations, getJointRotations); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslations, getJointTranslations); + COPY_ENTITY_PROPERTY_TO_PROPERTIES(relayParentJoints, getRelayParentJoints); _animationProperties.getProperties(properties); return properties; @@ -80,6 +81,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) { SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotations, setJointRotations); SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointTranslationsSet, setJointTranslationsSet); SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointTranslations, setJointTranslations); + SET_ENTITY_PROPERTY_FROM_PROPERTIES(relayParentJoints, setRelayParentJoints); bool somethingChangedInAnimations = _animationProperties.setProperties(properties); @@ -138,6 +140,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, QVector, setJointRotations); READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, QVector, setJointTranslationsSet); READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, QVector, setJointTranslations); + READ_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, bool, setRelayParentJoints); return bytesRead; } @@ -155,6 +158,7 @@ EntityPropertyFlags ModelEntityItem::getEntityProperties(EncodeBitstreamParams& requestedProperties += PROP_JOINT_ROTATIONS; requestedProperties += PROP_JOINT_TRANSLATIONS_SET; requestedProperties += PROP_JOINT_TRANSLATIONS; + requestedProperties += PROP_RELAY_PARENT_JOINTS; return requestedProperties; } @@ -185,6 +189,7 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, getJointRotations()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, getJointTranslationsSet()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, getJointTranslations()); + APPEND_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, getRelayParentJoints()); } @@ -586,6 +591,18 @@ QString ModelEntityItem::getModelURL() const { }); } +void ModelEntityItem::setRelayParentJoints(bool relayJoints) { + withWriteLock([&] { + _relayParentJoints = relayJoints; + }); +} + +bool ModelEntityItem::getRelayParentJoints() const { + return resultWithReadLock([&] { + return _relayParentJoints; + }); +} + QString ModelEntityItem::getCompoundShapeURL() const { return _compoundShapeURL.get(); } diff --git a/libraries/entities/src/ModelEntityItem.h b/libraries/entities/src/ModelEntityItem.h index 7fee022011..6169039f52 100644 --- a/libraries/entities/src/ModelEntityItem.h +++ b/libraries/entities/src/ModelEntityItem.h @@ -99,6 +99,9 @@ public: void setAnimationHold(bool hold); bool getAnimationHold() const; + void setRelayParentJoints(bool relayJoints); + bool getRelayParentJoints() const; + void setAnimationFirstFrame(float firstFrame); float getAnimationFirstFrame() const; @@ -157,6 +160,7 @@ protected: rgbColor _color; QString _modelURL; + bool _relayParentJoints; ThreadSafeValueCache _compoundShapeURL; diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 0a75e8c31b..eceef28b0e 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -30,7 +30,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityEdit: case PacketType::EntityData: case PacketType::EntityPhysics: - return static_cast(EntityVersion::OwnershipChallengeFix); + return static_cast(EntityVersion::SoftEntities); case PacketType::EntityQuery: return static_cast(EntityQueryPacketVersion::ConnectionIdentifier); diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 85f321a198..15eb326fe2 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -202,6 +202,7 @@ enum class EntityVersion : PacketVersion { HazeEffect, StaticCertJsonVersionOne, OwnershipChallengeFix, + SoftEntities }; enum class EntityScriptCallMethodVersion : PacketVersion { From 0ebbb76b49b7d16fad3de626d63ca865466488d8 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Fri, 29 Dec 2017 16:12:40 -0800 Subject: [PATCH 04/86] fixed property over written issue and start relaying joints --- .../src/avatars-renderer/Avatar.cpp | 16 ++++++++++++++++ .../src/avatars-renderer/Avatar.h | 1 + .../src/RenderableModelEntityItem.cpp | 2 ++ libraries/entities/src/ModelEntityItem.cpp | 5 ++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index c532e7659f..a26f907c97 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -32,6 +32,7 @@ #include #include #include +#include "ModelEntityItem.h" #include "Logging.h" @@ -347,6 +348,20 @@ void Avatar::updateAvatarEntities() { setAvatarEntityDataChanged(false); } +void Avatar::relayJointDataToChildren() { + forEachChild([&](SpatiallyNestablePointer child) { + if (child->getNestableType() == NestableType::Entity) { + auto entity = std::dynamic_pointer_cast(child); + if (entity) { + auto modelEntity = std::dynamic_pointer_cast(entity); + if (modelEntity) { + qDebug() << "--------> update modelEntityJoints <----------"; + } + } + } + }); +} + void Avatar::simulate(float deltaTime, bool inView) { PROFILE_RANGE(simulation, "simulate"); @@ -379,6 +394,7 @@ void Avatar::simulate(float deltaTime, bool inView) { } head->setScale(getModelScale()); head->simulate(deltaTime); + relayJointDataToChildren(); } else { // a non-full update is still required so that the position, rotation, scale and bounds of the skeletonModel are updated. _skeletonModel->simulate(deltaTime, false); diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h index c75b54fdc4..0c845c0a9b 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h @@ -329,6 +329,7 @@ protected: // protected methods... bool isLookingAtMe(AvatarSharedPointer avatar) const; + void relayJointDataToChildren(); void fade(render::Transaction& transaction, render::Transition::Type type); diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index e40e9a2f0c..930738ea43 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -1202,6 +1202,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce return; } + if (entity->_relayParentJoints) { + } // Check for addition if (_hasModel && !(bool)_model) { model = std::make_shared(nullptr, entity.get()); diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 4304f50be0..1044700816 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -63,7 +63,6 @@ EntityItemProperties ModelEntityItem::getProperties(EntityPropertyFlags desiredP COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslations, getJointTranslations); COPY_ENTITY_PROPERTY_TO_PROPERTIES(relayParentJoints, getRelayParentJoints); - _animationProperties.getProperties(properties); return properties; } @@ -117,6 +116,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL); READ_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures); + READ_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, bool, setRelayParentJoints); int bytesFromAnimation; withWriteLock([&] { @@ -140,7 +140,6 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, QVector, setJointRotations); READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, QVector, setJointTranslationsSet); READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, QVector, setJointTranslations); - READ_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, bool, setRelayParentJoints); return bytesRead; } @@ -177,6 +176,7 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, getModelURL()); APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, getCompoundShapeURL()); APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures()); + APPEND_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, getRelayParentJoints()); withReadLock([&] { _animationProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties, @@ -189,7 +189,6 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, getJointRotations()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, getJointTranslationsSet()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS, getJointTranslations()); - APPEND_ENTITY_PROPERTY(PROP_RELAY_PARENT_JOINTS, getRelayParentJoints()); } From 6fa3446c57d15c336c03e4982dbf2be6c00559f7 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 2 Jan 2018 13:54:13 -0800 Subject: [PATCH 05/86] joints are being relayed to children --- interface/src/avatar/MyAvatar.cpp | 1 + .../src/avatars-renderer/Avatar.cpp | 21 ++++++++++++++++++- .../src/RenderableModelEntityItem.cpp | 6 ++++++ .../entities/src/EntityItemProperties.cpp | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 02a1959a95..24f53aef82 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -536,6 +536,7 @@ void MyAvatar::simulate(float deltaTime) { // we've achived our final adjusted position and rotation for the avatar // and all of its joints, now update our attachements. Avatar::simulateAttachments(deltaTime); + Avatar::relayJointDataToChildren(); if (!_skeletonModel->hasSkeleton()) { // All the simulation that can be done has been done diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index a26f907c97..b5fe2f27b8 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -349,13 +349,32 @@ void Avatar::updateAvatarEntities() { } void Avatar::relayJointDataToChildren() { + int index = 0; forEachChild([&](SpatiallyNestablePointer child) { if (child->getNestableType() == NestableType::Entity) { auto entity = std::dynamic_pointer_cast(child); if (entity) { auto modelEntity = std::dynamic_pointer_cast(entity); if (modelEntity) { - qDebug() << "--------> update modelEntityJoints <----------"; + index++; + if (modelEntity->getRelayParentJoints()) { + QVector jointRotations; + QVector jointRotationsSet; + QStringList modelJointNames = modelEntity->getJointNames(); + QStringList avatarJointNames = getJointNames(); + foreach (const QString& jointName, modelJointNames) { + bool containsJoint = avatarJointNames.contains(jointName); + if (!containsJoint) { + return; + } + int jointIndex = getJointIndex(jointName); + int modelJointIndex = modelEntity->getJointIndex(jointName); + jointRotationsSet.append(true); + jointRotations.append(getJointRotation(jointIndex)); + } + modelEntity->setJointRotationsSet(jointRotationsSet); + modelEntity->setJointRotations(jointRotations); + } } } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 034704a59c..771d0458df 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -1203,6 +1203,12 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce } if (entity->_relayParentJoints) { + ModelPointer model = entity->getModel(); + if (model && model->isLoaded()) { + qDebug() << "relaying joints"; + entity->copyAnimationJointDataToModel(); + model->simulate(0.0f); + } } // Check for addition if (_hasModel && !(bool)_model) { diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index e62369f32b..3c3939059d 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -376,6 +376,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); CHECK_PROPERTY_CHANGE(PROP_DPI, dpi); + CHECK_PROPERTY_CHANGE(PROP_RELAY_PARENT_JOINTS, relayParentJoints); changedProperties += _animation.getChangedProperties(); changedProperties += _keyLight.getChangedProperties(); From e1a7f9bfb86f5009e911dd83d3c9e60d38bb72a1 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 3 Jan 2018 08:47:11 -0800 Subject: [PATCH 06/86] working on imporving soft-entities --- .../src/avatars-renderer/Avatar.cpp | 13 +++++++++---- .../src/RenderableModelEntityItem.cpp | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index b5fe2f27b8..38f249a075 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -359,21 +359,26 @@ void Avatar::relayJointDataToChildren() { index++; if (modelEntity->getRelayParentJoints()) { QVector jointRotations; - QVector jointRotationsSet; + QVector jointTranslations; + QVector jointSet; QStringList modelJointNames = modelEntity->getJointNames(); QStringList avatarJointNames = getJointNames(); foreach (const QString& jointName, modelJointNames) { bool containsJoint = avatarJointNames.contains(jointName); if (!containsJoint) { - return; + qDebug() << "Warning: Parent does not have joint -" << jointName; + continue; } int jointIndex = getJointIndex(jointName); int modelJointIndex = modelEntity->getJointIndex(jointName); - jointRotationsSet.append(true); + jointSet.append(true); jointRotations.append(getJointRotation(jointIndex)); + jointTranslations.append(getJointTranslation(jointIndex)); } - modelEntity->setJointRotationsSet(jointRotationsSet); + modelEntity->setJointRotationsSet(jointSet); + //modelEntity->setJointTranslationsSet(jointSet); modelEntity->setJointRotations(jointRotations); + //modelEntity->setJointTranslations(jointTranslations); } } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 771d0458df..74e24fd997 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -1205,7 +1205,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce if (entity->_relayParentJoints) { ModelPointer model = entity->getModel(); if (model && model->isLoaded()) { - qDebug() << "relaying joints"; entity->copyAnimationJointDataToModel(); model->simulate(0.0f); } From 527d00871a8a6d8d7bd5e55095c2e0131f1b6a88 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Jan 2018 11:57:51 -0800 Subject: [PATCH 07/86] making relaying translation work --- .../src/avatars-renderer/Avatar.cpp | 55 ++++++++++--------- .../src/RenderableModelEntityItem.cpp | 16 +++--- .../src/RenderableModelEntityItem.h | 2 +- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 38f249a075..61994db85e 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -33,6 +33,7 @@ #include #include #include "ModelEntityItem.h" +#include "RenderableModelEntityItem.h" #include "Logging.h" @@ -349,37 +350,39 @@ void Avatar::updateAvatarEntities() { } void Avatar::relayJointDataToChildren() { - int index = 0; forEachChild([&](SpatiallyNestablePointer child) { if (child->getNestableType() == NestableType::Entity) { - auto entity = std::dynamic_pointer_cast(child); - if (entity) { - auto modelEntity = std::dynamic_pointer_cast(entity); - if (modelEntity) { - index++; - if (modelEntity->getRelayParentJoints()) { - QVector jointRotations; - QVector jointTranslations; - QVector jointSet; - QStringList modelJointNames = modelEntity->getJointNames(); - QStringList avatarJointNames = getJointNames(); - foreach (const QString& jointName, modelJointNames) { - bool containsJoint = avatarJointNames.contains(jointName); - if (!containsJoint) { - qDebug() << "Warning: Parent does not have joint -" << jointName; - continue; - } + auto modelEntity = std::dynamic_pointer_cast(child); + if (modelEntity) { + if (modelEntity->getRelayParentJoints()) { + QVector jointRotations; + QVector jointTranslations; + QVector jointSet; + QStringList modelJointNames = modelEntity->getJointNames(); + QStringList avatarJointNames = getJointNames(); + foreach (const QString& jointName, modelJointNames) { + bool containsJoint = avatarJointNames.contains(jointName); + glm::quat jointRotation; + glm::vec3 jointTranslation; + if (!containsJoint) { + int jointIndex = modelEntity->getJointIndex(jointName); + jointRotation = modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); + jointTranslation - modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); + } else { int jointIndex = getJointIndex(jointName); - int modelJointIndex = modelEntity->getJointIndex(jointName); - jointSet.append(true); - jointRotations.append(getJointRotation(jointIndex)); - jointTranslations.append(getJointTranslation(jointIndex)); + jointRotation = getJointRotation(jointIndex); + jointTranslation = getJointTranslation(jointIndex); } - modelEntity->setJointRotationsSet(jointSet); - //modelEntity->setJointTranslationsSet(jointSet); - modelEntity->setJointRotations(jointRotations); - //modelEntity->setJointTranslations(jointTranslations); + jointSet.append(true); + jointRotations.append(jointRotation); + jointTranslations.append(jointTranslation); } + + modelEntity->setJointRotationsSet(jointSet); + modelEntity->setJointTranslationsSet(jointSet); + modelEntity->setJointRotations(jointRotations); + modelEntity->setJointTranslations(jointTranslations); + modelEntity->simulateRelayedJoints(); } } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 74e24fd997..bccd989ed0 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -929,6 +929,15 @@ bool RenderableModelEntityItem::getMeshes(MeshProxyList& result) { return !result.isEmpty(); } +void RenderableModelEntityItem::simulateRelayedJoints() { + ModelPointer model = getModel(); + if (model && model->isLoaded()) { + copyAnimationJointDataToModel(); + model->simulate(0.0f); + model->updateRenderItems(); + } +} + void RenderableModelEntityItem::copyAnimationJointDataToModel() { auto model = getModel(); if (!model || !model->isLoaded()) { @@ -1202,13 +1211,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce return; } - if (entity->_relayParentJoints) { - ModelPointer model = entity->getModel(); - if (model && model->isLoaded()) { - entity->copyAnimationJointDataToModel(); - model->simulate(0.0f); - } - } // Check for addition if (_hasModel && !(bool)_model) { model = std::make_shared(nullptr, entity.get()); diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 7af10b09fd..6dbf85061b 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -83,6 +83,7 @@ public: virtual bool contains(const glm::vec3& point) const override; virtual bool shouldBePhysical() const override; + void simulateRelayedJoints(); // these are in the frame of this object (model space) virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override; @@ -90,7 +91,6 @@ public: virtual bool setAbsoluteJointRotationInObjectFrame(int index, const glm::quat& rotation) override; virtual bool setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) override; - virtual glm::quat getLocalJointRotation(int index) const override; virtual glm::vec3 getLocalJointTranslation(int index) const override; virtual bool setLocalJointRotation(int index, const glm::quat& rotation) override; From a2046855667c59746be50a32085f93c1f57340b6 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Jan 2018 13:44:04 -0800 Subject: [PATCH 08/86] don't do unnecessary work --- .../avatars-renderer/src/avatars-renderer/Avatar.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 61994db85e..b8158338d9 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -367,21 +367,17 @@ void Avatar::relayJointDataToChildren() { if (!containsJoint) { int jointIndex = modelEntity->getJointIndex(jointName); jointRotation = modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); - jointTranslation - modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); + jointTranslation = modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); } else { int jointIndex = getJointIndex(jointName); jointRotation = getJointRotation(jointIndex); jointTranslation = getJointTranslation(jointIndex); } jointSet.append(true); - jointRotations.append(jointRotation); - jointTranslations.append(jointTranslation); + int modelJointIndex = modelEntity->getJointIndex(jointName); + modelEntity->setLocalJointRotation(modelJointIndex, jointRotation); + modelEntity->setLocalJointTranslation(modelJointIndex, jointTranslation); } - - modelEntity->setJointRotationsSet(jointSet); - modelEntity->setJointTranslationsSet(jointSet); - modelEntity->setJointRotations(jointRotations); - modelEntity->setJointTranslations(jointTranslations); modelEntity->simulateRelayedJoints(); } } From 597cb6ae9ed6f2d0b62d92348064c3573f7e821b Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Jan 2018 13:57:15 -0800 Subject: [PATCH 09/86] remove unused variables --- libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index b8158338d9..f1e2c5d00d 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -355,9 +355,6 @@ void Avatar::relayJointDataToChildren() { auto modelEntity = std::dynamic_pointer_cast(child); if (modelEntity) { if (modelEntity->getRelayParentJoints()) { - QVector jointRotations; - QVector jointTranslations; - QVector jointSet; QStringList modelJointNames = modelEntity->getJointNames(); QStringList avatarJointNames = getJointNames(); foreach (const QString& jointName, modelJointNames) { @@ -373,7 +370,6 @@ void Avatar::relayJointDataToChildren() { jointRotation = getJointRotation(jointIndex); jointTranslation = getJointTranslation(jointIndex); } - jointSet.append(true); int modelJointIndex = modelEntity->getJointIndex(jointName); modelEntity->setLocalJointRotation(modelJointIndex, jointRotation); modelEntity->setLocalJointTranslation(modelJointIndex, jointTranslation); From 3cd0ec3336618235188002ee348d9ff16c0e6aa2 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 5 Jan 2018 13:20:41 -0800 Subject: [PATCH 10/86] default run speed is faster, advanced movement on by default --- interface/src/avatar/MyAvatar.cpp | 2 +- libraries/shared/src/AvatarConstants.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 02a1959a95..5d0625642c 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -94,7 +94,7 @@ MyAvatar::MyAvatar(QThread* thread) : _eyeContactTarget(LEFT_EYE), _realWorldFieldOfView("realWorldFieldOfView", DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES), - _useAdvancedMovementControls("advancedMovementForHandControllersIsChecked", false), + _useAdvancedMovementControls("advancedMovementForHandControllersIsChecked", true), _smoothOrientationTimer(std::numeric_limits::max()), _smoothOrientationInitial(), _smoothOrientationTarget(), diff --git a/libraries/shared/src/AvatarConstants.h b/libraries/shared/src/AvatarConstants.h index 4942c63e27..bec0355d27 100644 --- a/libraries/shared/src/AvatarConstants.h +++ b/libraries/shared/src/AvatarConstants.h @@ -44,7 +44,7 @@ const glm::quat DEFAULT_AVATAR_LEFTFOOT_ROT { -0.40167322754859924f, 0.915459036 const glm::vec3 DEFAULT_AVATAR_RIGHTFOOT_POS { 0.08f, -0.96f, 0.029f }; const glm::quat DEFAULT_AVATAR_RIGHTFOOT_ROT { -0.4016716778278351f, 0.9154615998268127f, 0.0053307069465518f, 0.023696165531873703f }; -const float DEFAULT_AVATAR_MAX_WALKING_SPEED = 2.6f; // meters / second +const float DEFAULT_AVATAR_MAX_WALKING_SPEED = 4.5f; // meters / second const float DEFAULT_AVATAR_MAX_FLYING_SPEED = 30.0f; // meters / second const float DEFAULT_AVATAR_GRAVITY = -5.0f; // meters / second^2 From f1c03b2d40ab992c2800561e3590fbee076b9b5d Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 8 Jan 2018 12:27:35 -0800 Subject: [PATCH 11/86] adjust RENDER_HEAD_CUTOFF_DISTANCE so that I don't see my head when I run --- interface/src/avatar/MyAvatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 8bb74211da..d86681f618 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1929,7 +1929,7 @@ void MyAvatar::preDisplaySide(RenderArgs* renderArgs) { _prevShouldDrawHead = shouldDrawHead; } -const float RENDER_HEAD_CUTOFF_DISTANCE = 0.3f; +const float RENDER_HEAD_CUTOFF_DISTANCE = 0.47; bool MyAvatar::cameraInsideHead(const glm::vec3& cameraPosition) const { return glm::length(cameraPosition - getHeadPosition()) < (RENDER_HEAD_CUTOFF_DISTANCE * getModelScale()); From ad389e5072efb2be5961bc014f6b99143bb47b16 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 8 Jan 2018 15:27:41 -0800 Subject: [PATCH 12/86] make avatar walk-speed adjustable from js. add a tablet button to control walking vs running --- interface/src/avatar/MyAvatar.cpp | 10 +++++++++- interface/src/avatar/MyAvatar.h | 8 ++++++++ scripts/system/run.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 scripts/system/run.js diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index de2381342d..601985ff2a 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2100,7 +2100,7 @@ void MyAvatar::updateActionMotor(float deltaTime) { _actionMotorVelocity = motorSpeed * direction; } else { // we're interacting with a floor --> simple horizontal speed and exponential decay - _actionMotorVelocity = getSensorToWorldScale() * DEFAULT_AVATAR_MAX_WALKING_SPEED * direction; + _actionMotorVelocity = getSensorToWorldScale() * _walkSpeed.get() * direction; } float boomChange = getDriveKey(ZOOM); @@ -2692,6 +2692,14 @@ float MyAvatar::getUserEyeHeight() const { return userHeight - userHeight * ratio; } +float MyAvatar::getWalkSpeed() const { + return _walkSpeed.get(); +} + +void MyAvatar::setWalkSpeed(float value) { + _walkSpeed.set(value); +} + glm::vec3 MyAvatar::getPositionForAudio() { switch (_audioListenerMode) { case AudioListenerMode::FROM_HEAD: diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index ab74460d4e..59f7cdb935 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -163,6 +163,8 @@ class MyAvatar : public Avatar { Q_PROPERTY(QUuid SELF_ID READ getSelfID CONSTANT) + Q_PROPERTY(float walkSpeed READ getWalkSpeed WRITE setWalkSpeed); + const QString DOMINANT_LEFT_HAND = "left"; const QString DOMINANT_RIGHT_HAND = "right"; @@ -557,6 +559,9 @@ public: const QUuid& getSelfID() const { return AVATAR_SELF_ID; } + void setWalkSpeed(float value); + float getWalkSpeed() const; + public slots: void increaseSize(); void decreaseSize(); @@ -841,6 +846,9 @@ private: // height of user in sensor space, when standing erect. ThreadSafeValueCache _userHeight { DEFAULT_AVATAR_HEIGHT }; + + // max unscaled forward movement speed + ThreadSafeValueCache _walkSpeed { DEFAULT_AVATAR_MAX_WALKING_SPEED }; }; QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode); diff --git a/scripts/system/run.js b/scripts/system/run.js new file mode 100644 index 0000000000..849e67e4ba --- /dev/null +++ b/scripts/system/run.js @@ -0,0 +1,28 @@ +"use strict"; + +/* global Script, Tablet, MyAvatar */ + +(function() { // BEGIN LOCAL_SCOPE + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + var button = tablet.addButton({ + icon: Script.resolvePath("run.svg"), + text: "Run", + sortOrder: 15 + }); + + function onClicked() { + if (MyAvatar.walkSpeed < 4) { + MyAvatar.walkSpeed = 4.5; + } else { + MyAvatar.walkSpeed = 3.0; + } + } + + function cleanup() { + button.clicked.disconnect(onClicked); + tablet.removeButton(button); + } + + + button.clicked.connect(onClicked); +}) From 6626f556520e0e16f2331466aa3b121c24b52cf2 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 8 Jan 2018 15:52:50 -0800 Subject: [PATCH 13/86] fix run script --- scripts/system/run.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/system/run.js b/scripts/system/run.js index 849e67e4ba..7940be600b 100644 --- a/scripts/system/run.js +++ b/scripts/system/run.js @@ -5,7 +5,7 @@ (function() { // BEGIN LOCAL_SCOPE var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var button = tablet.addButton({ - icon: Script.resolvePath("run.svg"), + icon: Script.resolvePath("assets/images/icon-particles.svg"), text: "Run", sortOrder: 15 }); @@ -23,6 +23,5 @@ tablet.removeButton(button); } - button.clicked.connect(onClicked); -}) +}()); From d0ddbc0092c6f223bff695a0a840a17d059b5c00 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 8 Jan 2018 16:52:07 -0800 Subject: [PATCH 14/86] fix warning --- interface/src/avatar/MyAvatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 601985ff2a..a825c6f3fe 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1929,7 +1929,7 @@ void MyAvatar::preDisplaySide(RenderArgs* renderArgs) { _prevShouldDrawHead = shouldDrawHead; } -const float RENDER_HEAD_CUTOFF_DISTANCE = 0.47; +const float RENDER_HEAD_CUTOFF_DISTANCE = 0.47f; bool MyAvatar::cameraInsideHead(const glm::vec3& cameraPosition) const { return glm::length(cameraPosition - getHeadPosition()) < (RENDER_HEAD_CUTOFF_DISTANCE * getModelScale()); From 43cd5586f337a3f92cb1f0a37c09aae363a7e59b Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 8 Jan 2018 17:25:58 -0800 Subject: [PATCH 15/86] nuke AccountScriptingInterface, rename GlobalServicesScriptingInterface to AccountServicesScriptingInterface --- interface/src/Application.cpp | 10 ++-- .../scripting/AccountScriptingInterface.cpp | 36 ----------- .../src/scripting/AccountScriptingInterface.h | 60 ------------------- ... => AccountServicesScriptingInterface.cpp} | 54 ++++++++--------- ....h => AccountServicesScriptingInterface.h} | 16 ++--- interface/src/ui/overlays/Web3DOverlay.cpp | 6 +- 6 files changed, 43 insertions(+), 139 deletions(-) delete mode 100644 interface/src/scripting/AccountScriptingInterface.cpp delete mode 100644 interface/src/scripting/AccountScriptingInterface.h rename interface/src/scripting/{GlobalServicesScriptingInterface.cpp => AccountServicesScriptingInterface.cpp} (71%) rename interface/src/scripting/{GlobalServicesScriptingInterface.h => AccountServicesScriptingInterface.h} (84%) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f3c41565f8..cc0ee445fc 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -157,7 +157,7 @@ #include "scripting/AssetMappingsScriptingInterface.h" #include "scripting/ClipboardScriptingInterface.h" #include "scripting/DesktopScriptingInterface.h" -#include "scripting/GlobalServicesScriptingInterface.h" +#include "scripting/AccountServicesScriptingInterface.h" #include "scripting/HMDScriptingInterface.h" #include "scripting/MenuScriptingInterface.h" #include "scripting/SettingsScriptingInterface.h" @@ -2373,9 +2373,9 @@ void Application::initializeUi() { surfaceContext->setContextProperty("SoundCache", DependencyManager::get().data()); surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get().data()); - surfaceContext->setContextProperty("Account", GlobalServicesScriptingInterface::getInstance()); + surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface); - surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance()); + surfaceContext->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); surfaceContext->setContextProperty("FaceTracker", DependencyManager::get().data()); surfaceContext->setContextProperty("AvatarManager", DependencyManager::get().data()); surfaceContext->setContextProperty("UndoStack", &_undoStackScriptingInterface); @@ -5744,10 +5744,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get().data()); scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get().data()); - scriptEngine->registerGlobalObject("Account", GlobalServicesScriptingInterface::getInstance()); + scriptEngine->registerGlobalObject("Account", AccountServicesScriptingInterface::getInstance()); scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); - scriptEngine->registerGlobalObject("GlobalServices", GlobalServicesScriptingInterface::getInstance()); + scriptEngine->registerGlobalObject("GlobalServices", AccountServicesScriptingInterface::getInstance()); qScriptRegisterMetaType(scriptEngine.data(), DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue); scriptEngine->registerGlobalObject("FaceTracker", DependencyManager::get().data()); diff --git a/interface/src/scripting/AccountScriptingInterface.cpp b/interface/src/scripting/AccountScriptingInterface.cpp deleted file mode 100644 index fd54198b3c..0000000000 --- a/interface/src/scripting/AccountScriptingInterface.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// AccountScriptingInterface.cpp -// interface/src/scripting -// -// Created by Stojce Slavkovski on 6/07/14. -// Copyright 2014 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 "AccountManager.h" - -#include "AccountScriptingInterface.h" -#include "GlobalServicesScriptingInterface.h" - -AccountScriptingInterface* AccountScriptingInterface::getInstance() { - static AccountScriptingInterface sharedInstance; - return &sharedInstance; -} - -bool AccountScriptingInterface::isLoggedIn() { - return GlobalServicesScriptingInterface::getInstance()->isLoggedIn(); -} - -void AccountScriptingInterface::logOut() { - GlobalServicesScriptingInterface::getInstance()->logOut(); -} - -bool AccountScriptingInterface::loggedIn() const { - return GlobalServicesScriptingInterface::getInstance()->loggedIn(); -} - -QString AccountScriptingInterface::getUsername() { - return GlobalServicesScriptingInterface::getInstance()->getUsername(); -} diff --git a/interface/src/scripting/AccountScriptingInterface.h b/interface/src/scripting/AccountScriptingInterface.h deleted file mode 100644 index 10d33ffa36..0000000000 --- a/interface/src/scripting/AccountScriptingInterface.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// AccountScriptingInterface.h -// interface/src/scripting -// -// Created by Stojce Slavkovski on 6/07/14. -// Copyright 2014 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_AccountScriptingInterface_h -#define hifi_AccountScriptingInterface_h - -#include - -class AccountScriptingInterface : public QObject { - Q_OBJECT - - /**jsdoc - * @namespace Account - * @property username {String} username if user is logged in, otherwise it returns "Unknown user" - */ - Q_PROPERTY(QString username READ getUsername) - Q_PROPERTY(bool loggedIn READ loggedIn) - -signals: - - /**jsdoc - * Triggered when username has changed. - * @function Account.usernameChanged - * @return {Signal} - */ - void usernameChanged(); - void loggedInChanged(bool loggedIn); - -public slots: - static AccountScriptingInterface* getInstance(); - - /**jsdoc - * Returns the username for the currently logged in High Fidelity metaverse account. - * @function Account.getUsername - * @return {string} username if user is logged in, otherwise it returns "Unknown user" - */ - QString getUsername(); - - /**jsdoc - * Determine if the user is logged into the High Fidleity metaverse. - * @function Account.isLoggedIn - * @return {bool} true when user is logged into the High Fidelity metaverse. - */ - bool isLoggedIn(); - void logOut(); - -public: - AccountScriptingInterface(QObject* parent = nullptr) {} - bool loggedIn() const; -}; - -#endif // hifi_AccountScriptingInterface_h diff --git a/interface/src/scripting/GlobalServicesScriptingInterface.cpp b/interface/src/scripting/AccountServicesScriptingInterface.cpp similarity index 71% rename from interface/src/scripting/GlobalServicesScriptingInterface.cpp rename to interface/src/scripting/AccountServicesScriptingInterface.cpp index 305bfa3e79..fc293098bb 100644 --- a/interface/src/scripting/GlobalServicesScriptingInterface.cpp +++ b/interface/src/scripting/AccountServicesScriptingInterface.cpp @@ -1,5 +1,5 @@ // -// GlobalServicesScriptingInterface.cpp +// AccountServicesScriptingInterface.cpp // interface/src/scripting // // Created by Thijs Wenker on 9/10/14. @@ -14,41 +14,41 @@ #include "DiscoverabilityManager.h" #include "ResourceCache.h" -#include "GlobalServicesScriptingInterface.h" +#include "AccountServicesScriptingInterface.h" -GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() { +AccountServicesScriptingInterface::AccountServicesScriptingInterface() { auto accountManager = DependencyManager::get(); - connect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::onUsernameChanged); - connect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut); - connect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected); + connect(accountManager.data(), &AccountManager::usernameChanged, this, &AccountServicesScriptingInterface::onUsernameChanged); + connect(accountManager.data(), &AccountManager::logoutComplete, this, &AccountServicesScriptingInterface::loggedOut); + connect(accountManager.data(), &AccountManager::loginComplete, this, &AccountServicesScriptingInterface::connected); _downloading = false; QTimer* checkDownloadTimer = new QTimer(this); - connect(checkDownloadTimer, &QTimer::timeout, this, &GlobalServicesScriptingInterface::checkDownloadInfo); + connect(checkDownloadTimer, &QTimer::timeout, this, &AccountServicesScriptingInterface::checkDownloadInfo); const int CHECK_DOWNLOAD_INTERVAL = MSECS_PER_SECOND / 2; checkDownloadTimer->start(CHECK_DOWNLOAD_INTERVAL); auto discoverabilityManager = DependencyManager::get(); connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged, - this, &GlobalServicesScriptingInterface::discoverabilityModeChanged); + this, &AccountServicesScriptingInterface::discoverabilityModeChanged); _loggedIn = isLoggedIn(); emit loggedInChanged(_loggedIn); } -GlobalServicesScriptingInterface::~GlobalServicesScriptingInterface() { +AccountServicesScriptingInterface::~AccountServicesScriptingInterface() { auto accountManager = DependencyManager::get(); - disconnect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::onUsernameChanged); - disconnect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut); - disconnect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected); + disconnect(accountManager.data(), &AccountManager::usernameChanged, this, &AccountServicesScriptingInterface::onUsernameChanged); + disconnect(accountManager.data(), &AccountManager::logoutComplete, this, &AccountServicesScriptingInterface::loggedOut); + disconnect(accountManager.data(), &AccountManager::loginComplete, this, &AccountServicesScriptingInterface::connected); } -GlobalServicesScriptingInterface* GlobalServicesScriptingInterface::getInstance() { - static GlobalServicesScriptingInterface sharedInstance; +AccountServicesScriptingInterface* AccountServicesScriptingInterface::getInstance() { + static AccountServicesScriptingInterface sharedInstance; return &sharedInstance; } -const QString GlobalServicesScriptingInterface::getUsername() const { +const QString AccountServicesScriptingInterface::getUsername() const { auto accountManager = DependencyManager::get(); if (accountManager->isLoggedIn()) { return accountManager->getAccountInfo().getUsername(); @@ -57,31 +57,31 @@ const QString GlobalServicesScriptingInterface::getUsername() const { } } -bool GlobalServicesScriptingInterface::isLoggedIn() { +bool AccountServicesScriptingInterface::isLoggedIn() { auto accountManager = DependencyManager::get(); return accountManager->isLoggedIn(); } -bool GlobalServicesScriptingInterface::checkAndSignalForAccessToken() { +bool AccountServicesScriptingInterface::checkAndSignalForAccessToken() { auto accountManager = DependencyManager::get(); return accountManager->checkAndSignalForAccessToken(); } -void GlobalServicesScriptingInterface::logOut() { +void AccountServicesScriptingInterface::logOut() { auto accountManager = DependencyManager::get(); return accountManager->logout(); } -void GlobalServicesScriptingInterface::loggedOut() { - emit GlobalServicesScriptingInterface::disconnected(QString("logout")); +void AccountServicesScriptingInterface::loggedOut() { + emit AccountServicesScriptingInterface::disconnected(QString("logout")); } -QString GlobalServicesScriptingInterface::getFindableBy() const { +QString AccountServicesScriptingInterface::getFindableBy() const { auto discoverabilityManager = DependencyManager::get(); return DiscoverabilityManager::findableByString(discoverabilityManager->getDiscoverabilityMode()); } -void GlobalServicesScriptingInterface::setFindableBy(const QString& discoverabilityMode) { +void AccountServicesScriptingInterface::setFindableBy(const QString& discoverabilityMode) { auto discoverabilityManager = DependencyManager::get(); if (discoverabilityMode.toLower() == "none") { discoverabilityManager->setDiscoverabilityMode(Discoverability::None); @@ -96,11 +96,11 @@ void GlobalServicesScriptingInterface::setFindableBy(const QString& discoverabil } } -void GlobalServicesScriptingInterface::discoverabilityModeChanged(Discoverability::Mode discoverabilityMode) { +void AccountServicesScriptingInterface::discoverabilityModeChanged(Discoverability::Mode discoverabilityMode) { emit findableByChanged(DiscoverabilityManager::findableByString(discoverabilityMode)); } -void GlobalServicesScriptingInterface::onUsernameChanged(const QString& username) { +void AccountServicesScriptingInterface::onUsernameChanged(const QString& username) { _loggedIn = (username != QString()); emit myUsernameChanged(username); emit loggedInChanged(_loggedIn); @@ -135,7 +135,7 @@ void DownloadInfoResultFromScriptValue(const QScriptValue& object, DownloadInfoR result.pending = object.property("pending").toVariant().toFloat(); } -DownloadInfoResult GlobalServicesScriptingInterface::getDownloadInfo() { +DownloadInfoResult AccountServicesScriptingInterface::getDownloadInfo() { DownloadInfoResult result; foreach(const auto& resource, ResourceCache::getLoadingRequests()) { result.downloading.append(resource->getProgress() * 100.0f); @@ -144,7 +144,7 @@ DownloadInfoResult GlobalServicesScriptingInterface::getDownloadInfo() { return result; } -void GlobalServicesScriptingInterface::checkDownloadInfo() { +void AccountServicesScriptingInterface::checkDownloadInfo() { DownloadInfoResult downloadInfo = getDownloadInfo(); bool downloading = downloadInfo.downloading.count() > 0 || downloadInfo.pending > 0; @@ -155,7 +155,7 @@ void GlobalServicesScriptingInterface::checkDownloadInfo() { } } -void GlobalServicesScriptingInterface::updateDownloadInfo() { +void AccountServicesScriptingInterface::updateDownloadInfo() { emit downloadInfoChanged(getDownloadInfo()); } diff --git a/interface/src/scripting/GlobalServicesScriptingInterface.h b/interface/src/scripting/AccountServicesScriptingInterface.h similarity index 84% rename from interface/src/scripting/GlobalServicesScriptingInterface.h rename to interface/src/scripting/AccountServicesScriptingInterface.h index 93d35e9ce8..012c37305d 100644 --- a/interface/src/scripting/GlobalServicesScriptingInterface.h +++ b/interface/src/scripting/AccountServicesScriptingInterface.h @@ -1,5 +1,5 @@ // -// GlobalServicesScriptingInterface.h +// AccountServicesScriptingInterface.h // interface/src/scripting // // Created by Thijs Wenker on 9/10/14. @@ -9,8 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#ifndef hifi_GlobalServicesScriptingInterface_h -#define hifi_GlobalServicesScriptingInterface_h +#ifndef hifi_AccountServicesScriptingInterface_h +#define hifi_AccountServicesScriptingInterface_h #include #include @@ -32,7 +32,7 @@ Q_DECLARE_METATYPE(DownloadInfoResult) QScriptValue DownloadInfoResultToScriptValue(QScriptEngine* engine, const DownloadInfoResult& result); void DownloadInfoResultFromScriptValue(const QScriptValue& object, DownloadInfoResult& result); -class GlobalServicesScriptingInterface : public QObject { +class AccountServicesScriptingInterface : public QObject { Q_OBJECT Q_PROPERTY(QString username READ getUsername NOTIFY myUsernameChanged) @@ -41,7 +41,7 @@ class GlobalServicesScriptingInterface : public QObject { Q_PROPERTY(QUrl metaverseServerURL READ getMetaverseServerURL) public: - static GlobalServicesScriptingInterface* getInstance(); + static AccountServicesScriptingInterface* getInstance(); const QString getUsername() const; bool loggedIn() const { return _loggedIn; } @@ -74,11 +74,11 @@ signals: void loggedInChanged(bool loggedIn); private: - GlobalServicesScriptingInterface(); - ~GlobalServicesScriptingInterface(); + AccountServicesScriptingInterface(); + ~AccountServicesScriptingInterface(); bool _downloading; bool _loggedIn{ false }; }; -#endif // hifi_GlobalServicesScriptingInterface_h +#endif // hifi_AccountServicesScriptingInterface_h diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index a5da5e99b6..0850e43590 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -50,7 +50,7 @@ #include "ui/DomainConnectionModel.h" #include "ui/AvatarInputs.h" #include "avatar/AvatarManager.h" -#include "scripting/GlobalServicesScriptingInterface.h" +#include "scripting/AccountServicesScriptingInterface.h" #include #include "ui/Snapshot.h" #include "SoundCache.h" @@ -192,7 +192,7 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("offscreenFlags", flags); _webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get().data()); - _webSurface->getSurfaceContext()->setContextProperty("Account", GlobalServicesScriptingInterface::getInstance()); + _webSurface->getSurfaceContext()->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // in Qt 5.10.0 there is already an "Audio" object in the QML context // though I failed to find it (from QtMultimedia??). So.. let it be "AudioScriptingInterface" @@ -208,7 +208,7 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("OctreeStats", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("DCModel", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); - _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance()); + _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("AvatarList", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get().data()); From 13c34b2d3321fcdea7a0f21103cd91258435104f Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 8 Jan 2018 17:37:48 -0800 Subject: [PATCH 16/86] add AccountServices context --- interface/src/Application.cpp | 11 +++++++---- interface/src/ui/overlays/Web3DOverlay.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index cc0ee445fc..bd5ba93b5f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2373,9 +2373,11 @@ void Application::initializeUi() { surfaceContext->setContextProperty("SoundCache", DependencyManager::get().data()); surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get().data()); - surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); + surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + surfaceContext->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + surfaceContext->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance()); + surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface); - surfaceContext->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); surfaceContext->setContextProperty("FaceTracker", DependencyManager::get().data()); surfaceContext->setContextProperty("AvatarManager", DependencyManager::get().data()); surfaceContext->setContextProperty("UndoStack", &_undoStackScriptingInterface); @@ -5744,10 +5746,11 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get().data()); scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get().data()); - scriptEngine->registerGlobalObject("Account", AccountServicesScriptingInterface::getInstance()); scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface); - scriptEngine->registerGlobalObject("GlobalServices", AccountServicesScriptingInterface::getInstance()); + scriptEngine->registerGlobalObject("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + scriptEngine->registerGlobalObject("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + scriptEngine->registerGlobalObject("AccountServices", AccountServicesScriptingInterface::getInstance()); qScriptRegisterMetaType(scriptEngine.data(), DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue); scriptEngine->registerGlobalObject("FaceTracker", DependencyManager::get().data()); diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 0850e43590..f073cc7413 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -192,7 +192,10 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("offscreenFlags", flags); _webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get().data()); - _webSurface->getSurfaceContext()->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); + + _webSurface->getSurfaceContext()->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + _webSurface->getSurfaceContext()->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance()); // in Qt 5.10.0 there is already an "Audio" object in the QML context // though I failed to find it (from QtMultimedia??). So.. let it be "AudioScriptingInterface" @@ -208,7 +211,6 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("OctreeStats", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("DCModel", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); - _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("AvatarList", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get().data()); From 72ac1dd216f13a827b82fec20e636cfb29ea1b70 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 9 Jan 2018 08:50:20 -0800 Subject: [PATCH 17/86] walk by default, put old walk speed back --- libraries/shared/src/AvatarConstants.h | 2 +- scripts/system/run.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/shared/src/AvatarConstants.h b/libraries/shared/src/AvatarConstants.h index bec0355d27..4942c63e27 100644 --- a/libraries/shared/src/AvatarConstants.h +++ b/libraries/shared/src/AvatarConstants.h @@ -44,7 +44,7 @@ const glm::quat DEFAULT_AVATAR_LEFTFOOT_ROT { -0.40167322754859924f, 0.915459036 const glm::vec3 DEFAULT_AVATAR_RIGHTFOOT_POS { 0.08f, -0.96f, 0.029f }; const glm::quat DEFAULT_AVATAR_RIGHTFOOT_ROT { -0.4016716778278351f, 0.9154615998268127f, 0.0053307069465518f, 0.023696165531873703f }; -const float DEFAULT_AVATAR_MAX_WALKING_SPEED = 4.5f; // meters / second +const float DEFAULT_AVATAR_MAX_WALKING_SPEED = 2.6f; // meters / second const float DEFAULT_AVATAR_MAX_FLYING_SPEED = 30.0f; // meters / second const float DEFAULT_AVATAR_GRAVITY = -5.0f; // meters / second^2 diff --git a/scripts/system/run.js b/scripts/system/run.js index 7940be600b..edd6e20021 100644 --- a/scripts/system/run.js +++ b/scripts/system/run.js @@ -14,7 +14,7 @@ if (MyAvatar.walkSpeed < 4) { MyAvatar.walkSpeed = 4.5; } else { - MyAvatar.walkSpeed = 3.0; + MyAvatar.walkSpeed = 2.6; } } From a6259a5ef5cbc4af133ac9ccfcfd6f43207542fa Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 9 Jan 2018 13:39:28 -0800 Subject: [PATCH 18/86] Initial progress --- .../qml/hifi/commerce/wallet/SendMoney.qml | 73 ----- .../qml/hifi/commerce/wallet/Wallet.qml | 26 +- .../commerce/wallet/sendMoney/SendMoney.qml | 286 ++++++++++++++++++ interface/src/Application.cpp | 2 +- 4 files changed, 306 insertions(+), 81 deletions(-) delete mode 100644 interface/resources/qml/hifi/commerce/wallet/SendMoney.qml create mode 100644 interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml diff --git a/interface/resources/qml/hifi/commerce/wallet/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/SendMoney.qml deleted file mode 100644 index 11a6c99b0c..0000000000 --- a/interface/resources/qml/hifi/commerce/wallet/SendMoney.qml +++ /dev/null @@ -1,73 +0,0 @@ -// -// SendMoney.qml -// qml/hifi/commerce/wallet -// -// SendMoney -// -// Created by Zach Fox on 2017-08-18 -// 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 -// - -import Hifi 1.0 as Hifi -import QtQuick 2.5 -import QtQuick.Controls 1.4 -import "../../../styles-uit" -import "../../../controls-uit" as HifiControlsUit -import "../../../controls" as HifiControls - -// references XXX from root context - -Item { - HifiConstants { id: hifi; } - - id: root; - - Connections { - target: Commerce; - } - - // "Unavailable" - RalewayRegular { - text: "You currently cannot send money to other High Fidelity users."; - // Anchors - anchors.fill: parent; - // Text size - size: 24; - // Style - color: hifi.colors.faintGray; - wrapMode: Text.WordWrap; - // Alignment - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignVCenter; - } - - // - // FUNCTION DEFINITIONS START - // - // - // Function Name: fromScript() - // - // Relevant Variables: - // None - // - // Arguments: - // message: The message sent from the JavaScript. - // Messages are in format "{method, params}", like json-rpc. - // - // Description: - // Called when a message is received from a script. - // - function fromScript(message) { - switch (message.method) { - default: - console.log('Unrecognized message from wallet.js:', JSON.stringify(message)); - } - } - signal sendSignalToWallet(var msg); - // - // FUNCTION DEFINITIONS END - // -} diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index ef2b007dc8..c2ac2e19a1 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -19,6 +19,7 @@ import "../../../styles-uit" import "../../../controls-uit" as HifiControlsUit import "../../../controls" as HifiControls import "../common" as HifiCommerceCommon +import "./sendMoney" // references XXX from root context @@ -324,10 +325,9 @@ Rectangle { SendMoney { id: sendMoney; visible: root.activeView === "sendMoney"; - anchors.top: titleBarContainer.bottom; - anchors.bottom: tabButtonsContainer.top; - anchors.left: parent.left; - anchors.right: parent.right; + anchors.fill: parent; + parentAppTitleBarHeight: titleBarContainer.height; + parentAppNavBarHeight: tabButtonsContainer.height; } Security { @@ -497,7 +497,7 @@ Rectangle { Rectangle { id: sendMoneyButtonContainer; visible: !walletSetup.visible; - color: hifi.colors.black; + color: root.activeView === "sendMoney" ? hifi.colors.blueAccent : hifi.colors.black; anchors.top: parent.top; anchors.left: exchangeMoneyButtonContainer.right; anchors.bottom: parent.bottom; @@ -513,7 +513,7 @@ Rectangle { anchors.top: parent.top; anchors.topMargin: -2; // Style - color: hifi.colors.lightGray50; + color: root.activeView === "sendMoney" || sendMoneyTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight; } RalewaySemiBold { @@ -528,12 +528,24 @@ Rectangle { anchors.right: parent.right; anchors.rightMargin: 4; // Style - color: hifi.colors.lightGray50; + color: root.activeView === "sendMoney" || sendMoneyTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight; wrapMode: Text.WordWrap; // Alignment horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignTop; } + + MouseArea { + id: sendMoneyTabMouseArea; + anchors.fill: parent; + hoverEnabled: enabled; + onClicked: { + root.activeView = "sendMoney"; + tabButtonsContainer.resetTabButtonColors(); + } + onEntered: parent.color = hifi.colors.blueHighlight; + onExited: parent.color = root.activeView === "sendMoney" ? hifi.colors.blueAccent : hifi.colors.black; + } } // "SECURITY" tab button diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml new file mode 100644 index 0000000000..e8339266f7 --- /dev/null +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -0,0 +1,286 @@ +// +// SendMoney.qml +// qml/hifi/commerce/wallet/sendMoney +// +// SendMoney +// +// Created by Zach Fox on 2018-01-09 +// 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 +// + +import Hifi 1.0 as Hifi +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import "../../../../styles-uit" +import "../../../../controls-uit" as HifiControlsUit +import "../../../../controls" as HifiControls +import "../../common" as HifiCommerceCommon + +// references XXX from root context + +Item { + HifiConstants { id: hifi; } + + id: root; + + property int parentAppTitleBarHeight; + property int parentAppNavBarHeight; + property string activeView: "sendMoneyHome"; + + Connections { + target: Commerce; + + onBalanceResult : { + balanceText.text = result.data.balance; + } + } + + Connections { + target: GlobalServices + onMyUsernameChanged: { + transactionHistoryModel.clear(); + usernameText.text = Account.username; + } + } + + // Send Money Home BEGIN + Item { + id: sendMoneyHome; + visible: root.activeView === "sendMoneyHome"; + anchors.fill: parent; + anchors.topMargin: parentAppTitleBarHeight; + anchors.bottomMargin: parentAppNavBarHeight; + + // Username Text + RalewayRegular { + id: usernameText; + text: Account.username; + // Text size + size: 24; + // Style + color: hifi.colors.white; + elide: Text.ElideRight; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: parent.width/2; + height: 80; + } + + // HFC Balance Container + Item { + id: hfcBalanceContainer; + // Anchors + anchors.top: parent.top; + anchors.right: parent.right; + anchors.leftMargin: 20; + width: parent.width/2; + height: 80; + + // "HFC" balance label + HiFiGlyphs { + id: balanceLabel; + text: hifi.glyphs.hfc; + // Size + size: 40; + // Anchors + anchors.left: parent.left; + anchors.top: parent.top; + anchors.bottom: parent.bottom; + // Style + color: hifi.colors.white; + } + + // Balance Text + FiraSansRegular { + id: balanceText; + text: "--"; + // Text size + size: 28; + // Anchors + anchors.top: balanceLabel.top; + anchors.bottom: balanceLabel.bottom; + anchors.left: balanceLabel.right; + anchors.leftMargin: 10; + anchors.right: parent.right; + anchors.rightMargin: 4; + // Style + color: hifi.colors.white; + // Alignment + verticalAlignment: Text.AlignVCenter; + + onVisibleChanged: { + if (visible) { + Commerce.balance(); + } + } + } + + // "balance" text below field + RalewayRegular { + text: "BALANCE (HFC)"; + // Text size + size: 14; + // Anchors + anchors.top: balanceLabel.top; + anchors.topMargin: balanceText.paintedHeight + 20; + anchors.bottom: balanceLabel.bottom; + anchors.left: balanceText.left; + anchors.right: balanceText.right; + height: paintedHeight; + // Style + color: hifi.colors.white; + } + } + + // Send Money + Rectangle { + id: sendMoneyContainer; + anchors.left: parent.left; + anchors.right: parent.right; + anchors.bottom: parent.bottom; + height: 440; + + + RalewaySemiBold { + id: sendMoneyText; + text: "Send Money To:"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 26; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: paintedWidth; + height: 30; + // Text size + size: 22; + // Style + color: hifi.colors.baseGrayHighlight; + } + + Item { + id: connectionButton; + // Anchors + anchors.top: sendMoneyText.bottom; + anchors.topMargin: 40; + anchors.left: parent.left; + anchors.leftMargin: 75; + height: 95; + width: 95; + + Image { + anchors.top: parent.top; + source: "../images/wallet-bg.jpg"; + height: 60; + width: parent.width; + fillMode: Image.PreserveAspectFit; + horizontalAlignment: Image.AlignHCenter; + verticalAlignment: Image.AlignTop; + } + + RalewaySemiBold { + text: "Connection"; + // Anchors + anchors.bottom: parent.bottom; + height: 15; + width: parent.width; + // Text size + size: 18; + // Style + color: hifi.colors.baseGrayHighlight; + horizontalAlignment: Text.AlignHCenter; + } + + MouseArea { + anchors.fill: parent; + onClicked: { + root.activeView = "chooseRecipientConnection"; + } + } + } + + Item { + id: nearbyButton; + // Anchors + anchors.top: sendMoneyText.bottom; + anchors.topMargin: connectionButton.anchors.topMargin; + anchors.right: parent.right; + anchors.rightMargin: connectionButton.anchors.leftMargin; + height: connectionButton.height; + width: connectionButton.width; + + Image { + anchors.top: parent.top; + source: "../images/wallet-bg.jpg"; + height: 60; + width: parent.width; + fillMode: Image.PreserveAspectFit; + horizontalAlignment: Image.AlignHCenter; + verticalAlignment: Image.AlignTop; + } + + RalewaySemiBold { + text: "Someone Nearby"; + // Anchors + anchors.bottom: parent.bottom; + height: 15; + width: parent.width; + // Text size + size: 18; + // Style + color: hifi.colors.baseGrayHighlight; + horizontalAlignment: Text.AlignHCenter; + } + + MouseArea { + anchors.fill: parent; + onClicked: { + root.activeView = "chooseRecipientNearby"; + } + } + } + } + } + // Send Money Home END + + // Choose Recipient Connection BEGIN + Item { + id: chooseRecipientConnection; + visible: root.activeView === "chooseRecipientConnection"; + anchors.fill: parent; + } + // Choose Recipient Connection END + + + + // + // FUNCTION DEFINITIONS START + // + // + // Function Name: fromScript() + // + // Relevant Variables: + // None + // + // Arguments: + // message: The message sent from the JavaScript. + // Messages are in format "{method, params}", like json-rpc. + // + // Description: + // Called when a message is received from a script. + // + function fromScript(message) { + switch (message.method) { + default: + console.log('Unrecognized message from wallet.js:', JSON.stringify(message)); + } + } + signal sendSignalToWallet(var msg); + // + // FUNCTION DEFINITIONS END + // +} diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f3c41565f8..db2b778cc3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2284,7 +2284,7 @@ void Application::initializeUi() { QUrl{ "hifi/commerce/wallet/SecurityImageChange.qml" }, QUrl{ "hifi/commerce/wallet/SecurityImageModel.qml" }, QUrl{ "hifi/commerce/wallet/SecurityImageSelection.qml" }, - QUrl{ "hifi/commerce/wallet/SendMoney.qml" }, + QUrl{ "hifi/commerce/wallet/sendMoney/SendMoney.qml" }, QUrl{ "hifi/commerce/wallet/Wallet.qml" }, QUrl{ "hifi/commerce/wallet/WalletHome.qml" }, QUrl{ "hifi/commerce/wallet/WalletSetup.qml" }, From 40a3f8b31bd6b5058d07593e41ab378a64c5f958 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 9 Jan 2018 14:13:36 -0800 Subject: [PATCH 19/86] Progress --- .../qml/hifi/commerce/wallet/Wallet.qml | 1 + .../commerce/wallet/sendMoney/SendMoney.qml | 125 +++++++++++++++++- 2 files changed, 121 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index c2ac2e19a1..ba7a43cb1e 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -324,6 +324,7 @@ Rectangle { SendMoney { id: sendMoney; + z: 997; visible: root.activeView === "sendMoney"; anchors.fill: parent; parentAppTitleBarHeight: titleBarContainer.height; diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index e8339266f7..87a40b497f 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -29,6 +29,14 @@ Item { property int parentAppTitleBarHeight; property int parentAppNavBarHeight; property string activeView: "sendMoneyHome"; + + // This object is always used in a popup or full-screen Wallet section. + // This MouseArea is used to prevent a user from being + // able to click on a button/mouseArea underneath the popup/section. + MouseArea { + anchors.fill: parent; + propagateComposedEvents: false; + } Connections { target: Commerce; @@ -145,7 +153,6 @@ Item { anchors.bottom: parent.bottom; height: 440; - RalewaySemiBold { id: sendMoneyText; text: "Send Money To:"; @@ -159,7 +166,7 @@ Item { // Text size size: 22; // Style - color: hifi.colors.baseGrayHighlight; + color: hifi.colors.baseGray; } Item { @@ -191,7 +198,7 @@ Item { // Text size size: 18; // Style - color: hifi.colors.baseGrayHighlight; + color: hifi.colors.baseGray; horizontalAlignment: Text.AlignHCenter; } @@ -232,7 +239,7 @@ Item { // Text size size: 18; // Style - color: hifi.colors.baseGrayHighlight; + color: hifi.colors.baseGray; horizontalAlignment: Text.AlignHCenter; } @@ -248,10 +255,108 @@ Item { // Send Money Home END // Choose Recipient Connection BEGIN - Item { + Rectangle { id: chooseRecipientConnection; visible: root.activeView === "chooseRecipientConnection"; anchors.fill: parent; + color: "#AAAAAA"; + + onVisibleChanged: { + if (visible) { + // Refresh connections model + connectionsLoading.visible = false; + connectionsLoading.visible = true; + pal.sendToScript({method: 'refreshConnections'}); + } + } + + ListModel { + id: connectionsModel; + } + ListModel { + id: filteredConnectionsModel; + } + + Rectangle { + anchors.centerIn: parent; + width: parent.width - 30; + height: parent.height - 30; + + RalewaySemiBold { + id: chooseRecipientText; + text: "Choose Recipient:"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 26; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: paintedWidth; + height: 30; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + } + + HiFiGlyphs { + id: closeGlyphButton; + text: hifi.glyphs.close; + size: 26; + anchors.top: parent.top; + anchors.topMargin: 10; + anchors.right: parent.right; + anchors.rightMargin: 10; + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: { + parent.text = hifi.glyphs.closeInverted; + } + onExited: { + parent.text = hifi.glyphs.close; + } + onClicked: { + root.activeView = "sendMoneyHome"; + } + } + } + + // + // FILTER BAR START + // + Item { + id: filterBarContainer; + // Size + height: 40; + // Anchors + anchors.left: parent.left; + anchors.leftMargin: 16; + anchors.right: parent.right; + anchors.rightMargin: 16; + anchors.top: chooseRecipientText.bottom; + anchors.topMargin: 12; + + HifiControlsUit.TextField { + id: filterBar; + colorScheme: hifi.colorSchemes.faintGray; + hasClearButton: true; + hasRoundedBorder: true; + anchors.fill: parent; + placeholderText: "filter recipients"; + + onTextChanged: { + buildFilteredConnectionsModel(); + } + + onAccepted: { + focus = false; + } + } + } + // + // FILTER BAR END + // + } } // Choose Recipient Connection END @@ -260,6 +365,16 @@ Item { // // FUNCTION DEFINITIONS START // + + function buildFilteredConnectionsModel() { + filteredConnectionsModel.clear(); + for (var i = 0; i < connectionsModel.count; i++) { + if (connectionsModel.get(i).displayName.toLowerCase().indexOf(filterBar.text.toLowerCase()) !== -1) { + filteredConnectionsModel.insert(0, connectionsModel.get(i)); + } + } + } + // // Function Name: fromScript() // From 530df5447d769e6bec6488a0eb78d5911ef9cc12 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 9 Jan 2018 15:19:50 -0800 Subject: [PATCH 20/86] Even more proress --- .../qml/hifi/commerce/wallet/Wallet.qml | 9 ++ .../wallet/sendMoney/ConnectionItem.qml | 111 ++++++++++++++++++ .../commerce/wallet/sendMoney/SendMoney.qml | 59 +++++++++- scripts/system/commerce/wallet.js | 83 +++++++++++++ 4 files changed, 259 insertions(+), 3 deletions(-) create mode 100644 interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index ba7a43cb1e..fa3e8a16f6 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -329,6 +329,12 @@ Rectangle { anchors.fill: parent; parentAppTitleBarHeight: titleBarContainer.height; parentAppNavBarHeight: tabButtonsContainer.height; + + Connections { + onSendSignalToWallet: { + sendToScript(msg); + } + } } Security { @@ -726,6 +732,9 @@ Rectangle { case 'inspectionCertificate_resetCert': // NOP break; + case 'updateConnections': + sendMoney.updateConnections(message.connections); + break; default: console.log('Unrecognized message from wallet.js:', JSON.stringify(message)); } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml new file mode 100644 index 0000000000..604f006353 --- /dev/null +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml @@ -0,0 +1,111 @@ +// +// ConnectionItem.qml +// qml/hifi/commerce/wallet/sendMoney +// +// ConnectionItem +// +// Created by Zach Fox on 2018-01-09 +// 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 +// + +import Hifi 1.0 as Hifi +import QtQuick 2.5 +import QtGraphicalEffects 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import "../../../../styles-uit" +import "../../../../controls-uit" as HifiControlsUit +import "../../../../controls" as HifiControls +import "../../wallet" as HifiWallet + +// references XXX from root context + +Item { + HifiConstants { id: hifi; } + + id: root; + property bool isSelected: false; + property string userName; + property string profilePicUrl; + + height: 65; + width: parent.width; + + Rectangle { + id: mainContainer; + // Style + color: root.isSelected ? hifi.colors.faintGray : hifi.colors.white; + // Size + anchors.left: parent.left; + anchors.right: parent.right; + anchors.top: parent.top; + height: root.height; + + Item { + id: avatarImage; + visible: profileUrl !== "" && userName !== ""; + // Size + anchors.verticalCenter: parent.verticalCenter; + anchors.left: parent.left; + anchors.leftMargin: 36; + height: root.height - 15; + width: visible ? height : 0; + clip: true; + Image { + id: userImage; + source: root.profilePicUrl !== "" ? ((0 === root.profilePicUrl.indexOf("http")) ? + root.profilePicUrl : (Account.metaverseServerURL + root.profilePicUrl)) : ""; + mipmap: true; + // Anchors + anchors.fill: parent + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Item { + width: userImage.width; + height: userImage.height; + Rectangle { + anchors.centerIn: parent; + width: userImage.width; // This works because userImage is square + height: width; + radius: width; + } + } + } + } + AnimatedImage { + source: "../../../../../icons/profilePicLoading.gif" + anchors.fill: parent; + visible: userImage.status != Image.Ready; + } + } + + RalewaySemiBold { + id: userName; + anchors.left: avatarImage.right; + anchors.leftMargin: 14; + anchors.top: parent.top; + anchors.bottom: parent.bottom; + anchors.right: parent.right; + // Text size + size: 24; + // Style + color: hifi.colors.baseGray; + text: root.userName; + elide: Text.ElideRight; + // Alignment + horizontalAlignment: Text.AlignLeft; + verticalAlignment: Text.AlignVCenter; + } + } + + // + // FUNCTION DEFINITIONS START + // + signal sendToSendMoney(var msg); + // + // FUNCTION DEFINITIONS END + // +} diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 87a40b497f..10e35f1179 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -266,7 +266,7 @@ Item { // Refresh connections model connectionsLoading.visible = false; connectionsLoading.visible = true; - pal.sendToScript({method: 'refreshConnections'}); + sendSignalToWallet({method: 'refreshConnections'}); } } @@ -356,6 +356,52 @@ Item { // // FILTER BAR END // + + Item { + id: connectionsContainer; + anchors.top: filterBarContainer.bottom; + anchors.topMargin: 16; + anchors.left: parent.left; + anchors.right: parent.right; + anchors.bottom: parent.bottom; + + Rectangle { + id: connectionsLoading; + anchors.fill: parent; + color: "red"; + } + + ListView { + id: connectionsList; + visible: !connectionsLoading.visible; + clip: true; + model: filteredConnectionsModel; + snapMode: ListView.SnapToItem; + // Anchors + anchors.fill: parent; + delegate: ConnectionItem { + isSelected: connectionsList.currentIndex === index; + userName: userName; + profilePicUrl: profileUrl; + anchors.topMargin: 6; + anchors.bottomMargin: 6; + + Connections { + onSendToSendMoney: { + // TODO + } + } + + MouseArea { + anchors.fill: parent; + propagateComposedEvents: false; + onClicked: { + connectionsList.currentIndex = index; + } + } + } + } + } } } // Choose Recipient Connection END @@ -366,11 +412,18 @@ Item { // FUNCTION DEFINITIONS START // + function updateConnections(connections) { + connectionsModel.clear(); + connectionsModel.append(connections); + buildFilteredConnectionsModel(); + connectionsLoading.visible = false; + } + function buildFilteredConnectionsModel() { filteredConnectionsModel.clear(); for (var i = 0; i < connectionsModel.count; i++) { - if (connectionsModel.get(i).displayName.toLowerCase().indexOf(filterBar.text.toLowerCase()) !== -1) { - filteredConnectionsModel.insert(0, connectionsModel.get(i)); + if (connectionsModel.get(i).userName.toLowerCase().indexOf(filterBar.text.toLowerCase()) !== -1) { + filteredConnectionsModel.append(connectionsModel.get(i)); } } } diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index b3e3134380..6e210582b1 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -15,6 +15,7 @@ (function () { // BEGIN LOCAL_SCOPE Script.include("/~/system/libraries/accountUtils.js"); + var request = Script.require('request').request; var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace"; @@ -51,6 +52,84 @@ tablet.sendToQml(message); } + // Function Names: + // - requestJSON + // - getAvailableConnections + // - getInfoAboutUser + // - getConnectionData + // + // Description: + // - Update all the usernames that I am entitled to see, using my login but not dependent on canKick. + var METAVERSE_BASE = Account.metaverseServerURL; + function requestJSON(url, callback) { // callback(data) if successfull. Logs otherwise. + request({ + uri: url + }, function (error, response) { + if (error || (response.status !== 'success')) { + print("Error: unable to get", url, error || response.status); + return; + } + callback(response.data); + }); + } + function getAvailableConnections(domain, callback) { // callback([{usename, location}...]) if successful. (Logs otherwise) + url = METAVERSE_BASE + '/api/v1/users?' + if (domain) { + url += 'status=' + domain.slice(1, -1); // without curly braces + } else { + url += 'filter=connections'; // regardless of whether online + } + requestJSON(url, function (connectionsData) { + callback(connectionsData.users); + }); + } + function getInfoAboutUser(specificUsername, callback) { + url = METAVERSE_BASE + '/api/v1/users?filter=connections' + requestJSON(url, function (connectionsData) { + for (user in connectionsData.users) { + if (connectionsData.users[user].username === specificUsername) { + callback(connectionsData.users[user]); + return; + } + } + callback(false); + }); + } + function getConnectionData(specificUsername, domain) { + function frob(user) { // get into the right format + var formattedSessionId = user.location.node_id || ''; + if (formattedSessionId !== '' && formattedSessionId.indexOf("{") != 0) { + formattedSessionId = "{" + formattedSessionId + "}"; + } + return { + sessionId: formattedSessionId, + userName: user.username, + connection: user.connection, + profileUrl: user.images.thumbnail, + placeName: (user.location.root || user.location.domain || {}).name || '' + }; + } + if (specificUsername) { + getInfoAboutUser(specificUsername, function (user) { + if (user) { + updateUser(frob(user)); + } else { + print('Error: Unable to find information about ' + specificUsername + ' in connectionsData!'); + } + }); + } else { + getAvailableConnections(domain, function (users) { + if (domain) { + users.forEach(function (user) { + updateUser(frob(user)); + }); + } else { + sendToQml({ method: 'updateConnections', connections: users.map(frob) }); + } + }); + } + } + // Function Name: fromQml() // // Description: @@ -110,6 +189,10 @@ case 'goToMarketplaceItemPage': tablet.gotoWebScreen(MARKETPLACE_URL + '/items/' + message.itemId, MARKETPLACES_INJECT_SCRIPT_URL); break; + case 'refreshConnections': + print('Refreshing Connections...'); + getConnectionData(false); + break; default: print('Unrecognized message from QML:', JSON.stringify(message)); } From 54690251132287b12b929112d5674e127bb7b0a2 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 9 Jan 2018 15:38:54 -0800 Subject: [PATCH 21/86] More more more --- .../qml/hifi/commerce/wallet/WalletHome.qml | 20 +++++----- .../wallet/sendMoney/ConnectionItem.qml | 24 ++++++++++-- .../commerce/wallet/sendMoney/SendMoney.qml | 38 ++++++++++++++----- scripts/system/marketplaces/marketplaces.js | 3 ++ 4 files changed, 62 insertions(+), 23 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 42ee44d584..889a743c23 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -28,6 +28,16 @@ Item { property bool historyReceived: false; property int pendingCount: 0; + onVisibleChanged: { + if (visible) { + historyReceived = false; + Commerce.balance(); + Commerce.history(); + } else { + refreshTimer.stop(); + } + } + Connections { target: Commerce; @@ -131,16 +141,6 @@ Item { color: hifi.colors.white; // Alignment verticalAlignment: Text.AlignVCenter; - - onVisibleChanged: { - if (visible) { - historyReceived = false; - Commerce.balance(); - Commerce.history(); - } else { - refreshTimer.stop(); - } - } } // "balance" text below field diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml index 604f006353..d9adbee710 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml @@ -85,12 +85,13 @@ Item { RalewaySemiBold { id: userName; anchors.left: avatarImage.right; - anchors.leftMargin: 14; + anchors.leftMargin: 16; anchors.top: parent.top; anchors.bottom: parent.bottom; - anchors.right: parent.right; + anchors.right: chooseButton.visible ? chooseButton.left : parent.right; + anchors.rightMargin: chooseButton.visible ? 10 : 0; // Text size - size: 24; + size: 20; // Style color: hifi.colors.baseGray; text: root.userName; @@ -99,6 +100,23 @@ Item { horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter; } + + // "Choose" button + HifiControlsUit.Button { + id: chooseButton; + visible: root.isSelected; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.verticalCenter: parent.verticalCenter; + anchors.right: parent.right; + anchors.rightMargin: 24; + height: root.height - 20; + width: 110; + text: "CHOOSE"; + onClicked: { + + } + } } // diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 10e35f1179..6497f32995 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -13,7 +13,7 @@ import Hifi 1.0 as Hifi import QtQuick 2.5 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.2 import "../../../../styles-uit" import "../../../../controls-uit" as HifiControlsUit import "../../../../controls" as HifiControls @@ -29,12 +29,17 @@ Item { property int parentAppTitleBarHeight; property int parentAppNavBarHeight; property string activeView: "sendMoneyHome"; + property bool isCurrentlyFullScreen: chooseRecipientConnection.visible; // This object is always used in a popup or full-screen Wallet section. // This MouseArea is used to prevent a user from being // able to click on a button/mouseArea underneath the popup/section. MouseArea { - anchors.fill: parent; + anchors.top: parent.top; + anchors.left: parent.left; + anchors.right: parent.right; + y: root.isCurrentlyFullScreen ? root.parentAppTitleBarHeight : 0; + height: root.isCurrentlyFullScreen ? parent.height : parent.height - root.parentAppTitleBarHeight - root.parentAppNavBarHeight; propagateComposedEvents: false; } @@ -59,8 +64,8 @@ Item { id: sendMoneyHome; visible: root.activeView === "sendMoneyHome"; anchors.fill: parent; - anchors.topMargin: parentAppTitleBarHeight; - anchors.bottomMargin: parentAppNavBarHeight; + anchors.topMargin: root.parentAppTitleBarHeight; + anchors.bottomMargin: root.parentAppNavBarHeight; // Username Text RalewayRegular { @@ -364,15 +369,27 @@ Item { anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom; - - Rectangle { + + AnimatedImage { id: connectionsLoading; - anchors.fill: parent; - color: "red"; + source: "../../../../../icons/profilePicLoading.gif" + width: 120; + height: width; + anchors.top: parent.top; + anchors.topMargin: 185; + anchors.horizontalCenter: parent.horizontalCenter; } ListView { id: connectionsList; + ScrollBar.vertical: ScrollBar { + policy: connectionsList.contentHeight > parent.parent.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded; + parent: connectionsList.parent; + anchors.top: connectionsList.top; + anchors.right: connectionsList.right; + anchors.bottom: connectionsList.bottom; + width: 20; + } visible: !connectionsLoading.visible; clip: true; model: filteredConnectionsModel; @@ -381,8 +398,8 @@ Item { anchors.fill: parent; delegate: ConnectionItem { isSelected: connectionsList.currentIndex === index; - userName: userName; - profilePicUrl: profileUrl; + userName: model.userName; + profilePicUrl: model.profileUrl; anchors.topMargin: 6; anchors.bottomMargin: 6; @@ -393,6 +410,7 @@ Item { } MouseArea { + enabled: connectionsList.currentIndex !== index; anchors.fill: parent; propagateComposedEvents: false; onClicked: { diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index a5360974f6..3b9c639d91 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -565,6 +565,9 @@ var selectionDisplay = null; // for gridTool.js to ignore method: 'purchases_showMyItems' }); break; + case 'refreshConnections': + // NOP + break; default: print('Unrecognized message from Checkout.qml or Purchases.qml: ' + JSON.stringify(message)); } From f366fdf6951625a19eb65b12ee7640b58e6d03fa Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 9 Jan 2018 17:53:24 -0800 Subject: [PATCH 22/86] Beginnings of nearby --- .../commerce/wallet/sendMoney/SendMoney.qml | 129 +++++- scripts/system/commerce/wallet.js | 368 ++++++++++++++++++ 2 files changed, 493 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 6497f32995..3ff02f95ac 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -29,7 +29,7 @@ Item { property int parentAppTitleBarHeight; property int parentAppNavBarHeight; property string activeView: "sendMoneyHome"; - property bool isCurrentlyFullScreen: chooseRecipientConnection.visible; + property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || chooseRecipientNearby.visible; // This object is always used in a popup or full-screen Wallet section. // This MouseArea is used to prevent a user from being @@ -288,7 +288,7 @@ Item { height: parent.height - 30; RalewaySemiBold { - id: chooseRecipientText; + id: chooseRecipientText_connections; text: "Choose Recipient:"; // Anchors anchors.top: parent.top; @@ -304,7 +304,7 @@ Item { } HiFiGlyphs { - id: closeGlyphButton; + id: closeGlyphButton_connections; text: hifi.glyphs.close; size: 26; anchors.top: parent.top; @@ -338,7 +338,7 @@ Item { anchors.leftMargin: 16; anchors.right: parent.right; anchors.rightMargin: 16; - anchors.top: chooseRecipientText.bottom; + anchors.top: chooseRecipientText_connections.bottom; anchors.topMargin: 12; HifiControlsUit.TextField { @@ -423,6 +423,120 @@ Item { } } // Choose Recipient Connection END + + // Choose Recipient Nearby BEGIN + Rectangle { + id: chooseRecipientNearby; + + property string selectedRecipient; + + visible: root.activeView === "chooseRecipientNearby"; + anchors.fill: parent; + color: "#AAAAAA"; + + onVisibleChanged: { + if (visible) { + sendSignalToWallet({method: 'enable_ChooseRecipientNearbyMode'}); + } else { + selectedRecipient = ""; + sendSignalToWallet({method: 'disable_ChooseRecipientNearbyMode'}); + } + } + + Rectangle { + anchors.centerIn: parent; + width: parent.width - 30; + height: parent.height - 30; + + RalewaySemiBold { + id: chooseRecipientText_nearby; + text: "Choose Recipient:"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 26; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: paintedWidth; + height: 30; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + } + + HiFiGlyphs { + id: closeGlyphButton_nearby; + text: hifi.glyphs.close; + size: 26; + anchors.top: parent.top; + anchors.topMargin: 10; + anchors.right: parent.right; + anchors.rightMargin: 10; + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: { + parent.text = hifi.glyphs.closeInverted; + } + onExited: { + parent.text = hifi.glyphs.close; + } + onClicked: { + root.activeView = "sendMoneyHome"; + } + } + } + + Item { + id: selectionInstructionsContainer; + visible: chooseRecipientNearby.selectedRecipient === ""; + anchors.fill: parent; + + RalewaySemiBold { + id: selectionInstructions; + text: "Click/trigger on an avatar nearby to select them..."; + // Anchors + anchors.bottom: parent.bottom; + anchors.bottomMargin: 100; + anchors.left: parent.left; + anchors.leftMargin: 50; + anchors.right: parent.right; + anchors.rightMargin: anchors.leftMargin; + height: paintedHeight; + // Text size + size: 20; + // Style + color: hifi.colors.baseGray; + horizontalAlignment: Text.AlignHCenter; + } + } + + Item { + id: selectionMadeContainer; + visible: !selectionInstructionsContainer.visible; + anchors.fill: parent; + + RalewaySemiBold { + id: selectionInstructions; + text: "Click/trigger on another avatar nearby to select them...\n\nor press 'Next' to continue."; + // Anchors + anchors.bottom: parent.bottom; + anchors.bottomMargin: 100; + anchors.left: parent.left; + anchors.leftMargin: 50; + anchors.right: parent.right; + anchors.rightMargin: anchors.leftMargin; + height: paintedHeight; + // Text size + size: 20; + // Style + color: hifi.colors.baseGray; + horizontalAlignment: Text.AlignHCenter; + } + } + } + } + // Choose Recipient Nearby END @@ -461,6 +575,13 @@ Item { // function fromScript(message) { switch (message.method) { + case 'selectRecipient': + if (message.isSelected) { + chooseRecipientNearby.selectedRecipient = message.id; + } else { + chooseRecipientNearby.selectedRecipient = ""; + } + break; default: console.log('Unrecognized message from wallet.js:', JSON.stringify(message)); } diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index 6e210582b1..48cdf961c4 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -52,6 +52,11 @@ tablet.sendToQml(message); } + //*********************************************** + // + // BEGIN Connection logic + // + //*********************************************** // Function Names: // - requestJSON // - getAvailableConnections @@ -129,6 +134,352 @@ }); } } + //*********************************************** + // + // END Connection logic + // + //*********************************************** + + //*********************************************** + // + // BEGIN Avatar Selector logic + // + //*********************************************** + var UNSELECTED_TEXTURES = { + "idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-idle.png"), + "idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-idle.png") + }; + var SELECTED_TEXTURES = { + "idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-selected.png"), + "idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-selected.png") + }; + var HOVER_TEXTURES = { + "idle-D": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-hover.png"), + "idle-E": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx/Avatar-Overlay-v1.fbm/avatar-overlay-hover.png") + }; + + var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6 }; + var SELECTED_COLOR = { red: 0xF3, green: 0x91, blue: 0x29 }; + var HOVER_COLOR = { red: 0xD0, green: 0xD0, blue: 0xD0 }; + var conserveResources = true; + + var overlays = {}; // Keeps track of all our extended overlay data objects, keyed by target identifier. + + function ExtendedOverlay(key, type, properties, selected, hasModel) { // A wrapper around overlays to store the key it is associated with. + overlays[key] = this; + if (hasModel) { + var modelKey = key + "-m"; + this.model = new ExtendedOverlay(modelKey, "model", { + url: Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx"), + textures: textures(selected), + ignoreRayIntersection: true + }, false, false); + } else { + this.model = undefined; + } + this.key = key; + this.selected = selected || false; // not undefined + this.hovering = false; + this.activeOverlay = Overlays.addOverlay(type, properties); // We could use different overlays for (un)selected... + } + // Instance methods: + ExtendedOverlay.prototype.deleteOverlay = function () { // remove display and data of this overlay + Overlays.deleteOverlay(this.activeOverlay); + delete overlays[this.key]; + }; + + ExtendedOverlay.prototype.editOverlay = function (properties) { // change display of this overlay + Overlays.editOverlay(this.activeOverlay, properties); + }; + + function color(selected, hovering) { + var base = hovering ? HOVER_COLOR : selected ? SELECTED_COLOR : UNSELECTED_COLOR; + function scale(component) { + var delta = 0xFF - component; + return component; + } + return { red: scale(base.red), green: scale(base.green), blue: scale(base.blue) }; + } + + function textures(selected, hovering) { + return hovering ? HOVER_TEXTURES : selected ? SELECTED_TEXTURES : UNSELECTED_TEXTURES; + } + // so we don't have to traverse the overlays to get the last one + var lastHoveringId = 0; + ExtendedOverlay.prototype.hover = function (hovering) { + this.hovering = hovering; + if (this.key === lastHoveringId) { + if (hovering) { + return; + } + lastHoveringId = 0; + } + this.editOverlay({ color: color(this.selected, hovering) }); + if (this.model) { + this.model.editOverlay({ textures: textures(this.selected, hovering) }); + } + if (hovering) { + // un-hover the last hovering overlay + if (lastHoveringId && lastHoveringId !== this.key) { + ExtendedOverlay.get(lastHoveringId).hover(false); + } + lastHoveringId = this.key; + } + }; + ExtendedOverlay.prototype.select = function (selected) { + if (this.selected === selected) { + return; + } + + this.editOverlay({ color: color(selected, this.hovering) }); + if (this.model) { + this.model.editOverlay({ textures: textures(selected) }); + } + this.selected = selected; + }; + // Class methods: + var selectedIds = []; + ExtendedOverlay.isSelected = function (id) { + return -1 !== selectedIds.indexOf(id); + }; + ExtendedOverlay.get = function (key) { // answer the extended overlay data object associated with the given avatar identifier + return overlays[key]; + }; + ExtendedOverlay.some = function (iterator) { // Bails early as soon as iterator returns truthy. + var key; + for (key in overlays) { + if (iterator(ExtendedOverlay.get(key))) { + return; + } + } + }; + ExtendedOverlay.unHover = function () { // calls hover(false) on lastHoveringId (if any) + if (lastHoveringId) { + ExtendedOverlay.get(lastHoveringId).hover(false); + } + }; + + // hit(overlay) on the one overlay intersected by pickRay, if any. + // noHit() if no ExtendedOverlay was intersected (helps with hover) + ExtendedOverlay.applyPickRay = function (pickRay, hit, noHit) { + var pickedOverlay = Overlays.findRayIntersection(pickRay); // Depends on nearer coverOverlays to extend closer to us than farther ones. + if (!pickedOverlay.intersects) { + if (noHit) { + return noHit(); + } + return; + } + ExtendedOverlay.some(function (overlay) { // See if pickedOverlay is one of ours. + if ((overlay.activeOverlay) === pickedOverlay.overlayID) { + hit(overlay); + return true; + } + }); + }; + + function HighlightedEntity(id, entityProperties) { + this.id = id; + this.overlay = Overlays.addOverlay('cube', { + position: entityProperties.position, + rotation: entityProperties.rotation, + dimensions: entityProperties.dimensions, + solid: false, + color: { + red: 0xF3, + green: 0x91, + blue: 0x29 + }, + ignoreRayIntersection: true, + drawInFront: false // Arguable. For now, let's not distract with mysterious wires around the scene. + }); + HighlightedEntity.overlays.push(this); + } + HighlightedEntity.overlays = []; + HighlightedEntity.clearOverlays = function clearHighlightedEntities() { + HighlightedEntity.overlays.forEach(function (highlighted) { + Overlays.deleteOverlay(highlighted.overlay); + }); + HighlightedEntity.overlays = []; + }; + HighlightedEntity.updateOverlays = function updateHighlightedEntities() { + HighlightedEntity.overlays.forEach(function (highlighted) { + var properties = Entities.getEntityProperties(highlighted.id, ['position', 'rotation', 'dimensions']); + Overlays.editOverlay(highlighted.overlay, { + position: properties.position, + rotation: properties.rotation, + dimensions: properties.dimensions + }); + }); + }; + + + function addAvatarNode(id) { + var selected = ExtendedOverlay.isSelected(id); + return new ExtendedOverlay(id, "sphere", { + drawInFront: true, + solid: true, + alpha: 0.8, + color: color(selected, false), + ignoreRayIntersection: false + }, selected, !conserveResources); + } + + var pingPong = true; + function updateOverlays() { + var eye = Camera.position; + AvatarList.getAvatarIdentifiers().forEach(function (id) { + if (!id) { + return; // don't update ourself, or avatars we're not interested in + } + var avatar = AvatarList.getAvatar(id); + if (!avatar) { + return; // will be deleted below if there had been an overlay. + } + var overlay = ExtendedOverlay.get(id); + if (!overlay) { // For now, we're treating this as a temporary loss, as from the personal space bubble. Add it back. + overlay = addAvatarNode(id); + } + var target = avatar.position; + var distance = Vec3.distance(target, eye); + var offset = 0.2; + var diff = Vec3.subtract(target, eye); // get diff between target and eye (a vector pointing to the eye from avatar position) + var headIndex = avatar.getJointIndex("Head"); // base offset on 1/2 distance from hips to head if we can + if (headIndex > 0) { + offset = avatar.getAbsoluteJointTranslationInObjectFrame(headIndex).y / 2; + } + + // move a bit in front, towards the camera + target = Vec3.subtract(target, Vec3.multiply(Vec3.normalize(diff), offset)); + + // now bump it up a bit + target.y = target.y + offset; + + overlay.ping = pingPong; + overlay.editOverlay({ + color: color(ExtendedOverlay.isSelected(id), overlay.hovering), + position: target, + dimensions: 0.032 * distance + }); + if (overlay.model) { + overlay.model.ping = pingPong; + overlay.model.editOverlay({ + position: target, + scale: 0.2 * distance, // constant apparent size + rotation: Camera.orientation + }); + } + }); + pingPong = !pingPong; + ExtendedOverlay.some(function (overlay) { // Remove any that weren't updated. (User is gone.) + if (overlay.ping === pingPong) { + overlay.deleteOverlay(); + } + }); + // We could re-populateNearbyUserList if anything added or removed, but not for now. + HighlightedEntity.updateOverlays(); + } + function removeOverlays() { + selectedIds = []; + lastHoveringId = 0; + HighlightedEntity.clearOverlays(); + ExtendedOverlay.some(function (overlay) { + overlay.deleteOverlay(); + }); + } + + // + // Clicks. + // + function handleClick(pickRay) { + ExtendedOverlay.applyPickRay(pickRay, function (overlay) { + var message = { method: 'selectRecipient', id: [overlay.key], isSelected: !overlay.selected }; + sendToQml(message); + return true; + }); + } + function handleMouseEvent(mousePressEvent) { // handleClick if we get one. + if (!mousePressEvent.isLeftButton) { + return; + } + handleClick(Camera.computePickRay(mousePressEvent.x, mousePressEvent.y)); + } + function handleMouseMove(pickRay) { // given the pickRay, just do the hover logic + ExtendedOverlay.applyPickRay(pickRay, function (overlay) { + overlay.hover(true); + }, function () { + ExtendedOverlay.unHover(); + }); + } + + // handy global to keep track of which hand is the mouse (if any) + var currentHandPressed = 0; + var TRIGGER_CLICK_THRESHOLD = 0.85; + var TRIGGER_PRESS_THRESHOLD = 0.05; + + function handleMouseMoveEvent(event) { // find out which overlay (if any) is over the mouse position + var pickRay; + if (HMD.active) { + if (currentHandPressed !== 0) { + pickRay = controllerComputePickRay(currentHandPressed); + } else { + // nothing should hover, so + ExtendedOverlay.unHover(); + return; + } + } else { + pickRay = Camera.computePickRay(event.x, event.y); + } + handleMouseMove(pickRay); + } + function handleTriggerPressed(hand, value) { + // The idea is if you press one trigger, it is the one + // we will consider the mouse. Even if the other is pressed, + // we ignore it until this one is no longer pressed. + var isPressed = value > TRIGGER_PRESS_THRESHOLD; + if (currentHandPressed === 0) { + currentHandPressed = isPressed ? hand : 0; + return; + } + if (currentHandPressed === hand) { + currentHandPressed = isPressed ? hand : 0; + return; + } + // otherwise, the other hand is still triggered + // so do nothing. + } + + // We get mouseMoveEvents from the handControllers, via handControllerPointer. + // But we don't get mousePressEvents. + var triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); + var triggerPressMapping = Controller.newMapping(Script.resolvePath('') + '-press'); + function controllerComputePickRay(hand) { + var controllerPose = getControllerWorldLocation(hand, true); + if (controllerPose.valid) { + return { origin: controllerPose.position, direction: Quat.getUp(controllerPose.orientation) }; + } + } + function makeClickHandler(hand) { + return function (clicked) { + if (clicked > TRIGGER_CLICK_THRESHOLD) { + var pickRay = controllerComputePickRay(hand); + handleClick(pickRay); + } + }; + } + function makePressHandler(hand) { + return function (value) { + handleTriggerPressed(hand, value); + }; + } + triggerMapping.from(Controller.Standard.RTClick).peek().to(makeClickHandler(Controller.Standard.RightHand)); + triggerMapping.from(Controller.Standard.LTClick).peek().to(makeClickHandler(Controller.Standard.LeftHand)); + triggerPressMapping.from(Controller.Standard.RT).peek().to(makePressHandler(Controller.Standard.RightHand)); + triggerPressMapping.from(Controller.Standard.LT).peek().to(makePressHandler(Controller.Standard.LeftHand)); + //*********************************************** + // + // END Avatar Selector logic + // + //*********************************************** // Function Name: fromQml() // @@ -193,6 +544,13 @@ print('Refreshing Connections...'); getConnectionData(false); break; + case 'enable_ChooseRecipientNearbyMode': + Script.update.connect(updateOverlays); + break; + case 'disable_ChooseRecipientNearbyMode': + Script.update.disconnect(updateOverlays); + removeOverlays(); + break; default: print('Unrecognized message from QML:', JSON.stringify(message)); } @@ -257,6 +615,10 @@ }); button.clicked.connect(onButtonClicked); tablet.screenChanged.connect(onTabletScreenChanged); + Controller.mousePressEvent.connect(handleMouseEvent); + Controller.mouseMoveEvent.connect(handleMouseMoveEvent); + triggerMapping.enable(); + triggerPressMapping.enable(); } } function shutdown() { @@ -268,6 +630,12 @@ tablet.gotoHomeScreen(); } } + Script.update.disconnect(updateOverlays); + Controller.mousePressEvent.disconnect(handleMouseEvent); + Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); + triggerMapping.disable(); // It's ok if we disable twice. + triggerPressMapping.disable(); // see above + removeOverlays(); } // From c5a5bddbc92f876a7642d5c2fcdbc63f74151b78 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 12:12:02 -0800 Subject: [PATCH 23/86] More progress --- .../qml/hifi/commerce/wallet/Wallet.qml | 3 + .../commerce/wallet/sendMoney/SendMoney.qml | 158 +++++++++++++----- scripts/system/commerce/wallet.js | 54 +++++- scripts/system/marketplaces/marketplaces.js | 2 + 4 files changed, 167 insertions(+), 50 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index fa3e8a16f6..5340f0e202 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -735,6 +735,9 @@ Rectangle { case 'updateConnections': sendMoney.updateConnections(message.connections); break; + case 'selectRecipient': + sendMoney.fromScript(message); + break; default: console.log('Unrecognized message from wallet.js:', JSON.stringify(message)); } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 3ff02f95ac..4b7f7b4033 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -28,16 +28,15 @@ Item { property int parentAppTitleBarHeight; property int parentAppNavBarHeight; - property string activeView: "sendMoneyHome"; + property string currentActiveView: "sendMoneyHome"; + property string nextActiveView: ""; property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || chooseRecipientNearby.visible; // This object is always used in a popup or full-screen Wallet section. // This MouseArea is used to prevent a user from being // able to click on a button/mouseArea underneath the popup/section. MouseArea { - anchors.top: parent.top; - anchors.left: parent.left; - anchors.right: parent.right; + x: 0; y: root.isCurrentlyFullScreen ? root.parentAppTitleBarHeight : 0; height: root.isCurrentlyFullScreen ? parent.height : parent.height - root.parentAppTitleBarHeight - root.parentAppNavBarHeight; propagateComposedEvents: false; @@ -59,10 +58,34 @@ Item { } } + Component.onCompleted: { + Commerce.balance(); + } + + onNextActiveViewChanged: { + root.currentActiveView = root.nextActiveView; + if (root.currentActiveView === 'chooseRecipientConnection') { + // Refresh connections model + connectionsLoading.visible = false; + connectionsLoading.visible = true; + sendSignalToWallet({method: 'refreshConnections'}); + } + + if (root.currentActiveView === 'chooseRecipientNearby') { + sendSignalToWallet({method: 'enable_ChooseRecipientNearbyMode'}); + } else { + sendSignalToWallet({method: 'disable_ChooseRecipientNearbyMode'}); + } + + if (root.currentActiveView === 'sendMoneyHome') { + Commerce.balance(); + } + } + // Send Money Home BEGIN Item { id: sendMoneyHome; - visible: root.activeView === "sendMoneyHome"; + visible: root.currentActiveView === "sendMoneyHome"; anchors.fill: parent; anchors.topMargin: root.parentAppTitleBarHeight; anchors.bottomMargin: root.parentAppNavBarHeight; @@ -125,12 +148,6 @@ Item { color: hifi.colors.white; // Alignment verticalAlignment: Text.AlignVCenter; - - onVisibleChanged: { - if (visible) { - Commerce.balance(); - } - } } // "balance" text below field @@ -210,7 +227,7 @@ Item { MouseArea { anchors.fill: parent; onClicked: { - root.activeView = "chooseRecipientConnection"; + root.nextActiveView = "chooseRecipientConnection"; } } } @@ -251,7 +268,7 @@ Item { MouseArea { anchors.fill: parent; onClicked: { - root.activeView = "chooseRecipientNearby"; + root.nextActiveView = "chooseRecipientNearby"; } } } @@ -262,18 +279,9 @@ Item { // Choose Recipient Connection BEGIN Rectangle { id: chooseRecipientConnection; - visible: root.activeView === "chooseRecipientConnection"; + visible: root.currentActiveView === "chooseRecipientConnection"; anchors.fill: parent; color: "#AAAAAA"; - - onVisibleChanged: { - if (visible) { - // Refresh connections model - connectionsLoading.visible = false; - connectionsLoading.visible = true; - sendSignalToWallet({method: 'refreshConnections'}); - } - } ListModel { id: connectionsModel; @@ -321,7 +329,7 @@ Item { parent.text = hifi.glyphs.close; } onClicked: { - root.activeView = "sendMoneyHome"; + root.nextActiveView = "sendMoneyHome"; } } } @@ -430,19 +438,10 @@ Item { property string selectedRecipient; - visible: root.activeView === "chooseRecipientNearby"; + visible: root.currentActiveView === "chooseRecipientNearby"; anchors.fill: parent; color: "#AAAAAA"; - onVisibleChanged: { - if (visible) { - sendSignalToWallet({method: 'enable_ChooseRecipientNearbyMode'}); - } else { - selectedRecipient = ""; - sendSignalToWallet({method: 'disable_ChooseRecipientNearbyMode'}); - } - } - Rectangle { anchors.centerIn: parent; width: parent.width - 30; @@ -482,7 +481,8 @@ Item { parent.text = hifi.glyphs.close; } onClicked: { - root.activeView = "sendMoneyHome"; + root.nextActiveView = "sendMoneyHome"; + chooseRecipientNearby.selectedRecipient = ""; } } } @@ -493,13 +493,13 @@ Item { anchors.fill: parent; RalewaySemiBold { - id: selectionInstructions; + id: selectionInstructions_deselected; text: "Click/trigger on an avatar nearby to select them..."; // Anchors anchors.bottom: parent.bottom; - anchors.bottomMargin: 100; + anchors.bottomMargin: 200; anchors.left: parent.left; - anchors.leftMargin: 50; + anchors.leftMargin: 58; anchors.right: parent.right; anchors.rightMargin: anchors.leftMargin; height: paintedHeight; @@ -508,6 +508,7 @@ Item { // Style color: hifi.colors.baseGray; horizontalAlignment: Text.AlignHCenter; + wrapMode: Text.WordWrap; } } @@ -517,13 +518,47 @@ Item { anchors.fill: parent; RalewaySemiBold { - id: selectionInstructions; + id: sendToText; + text: "Send To:"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 120; + anchors.left: parent.left; + anchors.leftMargin: 12; + width: paintedWidth; + height: paintedHeight; + // Text size + size: 20; + // Style + color: hifi.colors.baseGray; + } + + RalewaySemiBold { + id: avatarNodeID; + text: chooseRecipientNearby.selectedRecipient; + // Anchors + anchors.top: sendToText.bottom; + anchors.topMargin: 60; + anchors.left: parent.left; + anchors.leftMargin: 30; + anchors.right: parent.right; + anchors.rightMargin: 30; + height: paintedHeight; + // Text size + size: 18; + // Style + horizontalAlignment: Text.AlignHCenter; + color: hifi.colors.baseGray; + } + + RalewaySemiBold { + id: selectionInstructions_selected; text: "Click/trigger on another avatar nearby to select them...\n\nor press 'Next' to continue."; // Anchors anchors.bottom: parent.bottom; - anchors.bottomMargin: 100; + anchors.bottomMargin: 200; anchors.left: parent.left; - anchors.leftMargin: 50; + anchors.leftMargin: 58; anchors.right: parent.right; anchors.rightMargin: anchors.leftMargin; height: paintedHeight; @@ -532,6 +567,43 @@ Item { // Style color: hifi.colors.baseGray; horizontalAlignment: Text.AlignHCenter; + wrapMode: Text.WordWrap; + } + } + + // "Cancel" button + HifiControlsUit.Button { + id: cancelButton; + color: hifi.buttons.noneBorderless; + colorScheme: hifi.colorSchemes.dark; + anchors.left: parent.left; + anchors.leftMargin: 60; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 80; + height: 50; + width: 120; + text: "Cancel"; + onClicked: { + root.nextActiveView = "sendMoneyHome"; + chooseRecipientNearby.selectedRecipient = ""; + } + } + + // "Next" button + HifiControlsUit.Button { + id: nextButton; + enabled: chooseRecipientNearby.selectedRecipient !== ""; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.right: parent.right; + anchors.rightMargin: 60; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 80; + height: 50; + width: 120; + text: "Next"; + onClicked: { + } } } @@ -577,13 +649,13 @@ Item { switch (message.method) { case 'selectRecipient': if (message.isSelected) { - chooseRecipientNearby.selectedRecipient = message.id; + chooseRecipientNearby.selectedRecipient = message.id[0]; } else { chooseRecipientNearby.selectedRecipient = ""; } break; default: - console.log('Unrecognized message from wallet.js:', JSON.stringify(message)); + console.log('SendMoney: Unrecognized message from wallet.js:', JSON.stringify(message)); } } signal sendSignalToWallet(var msg); diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index 48cdf961c4..e8156ae5fc 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -392,8 +392,35 @@ // function handleClick(pickRay) { ExtendedOverlay.applyPickRay(pickRay, function (overlay) { - var message = { method: 'selectRecipient', id: [overlay.key], isSelected: !overlay.selected }; + var nextSelectedStatus = !overlay.selected; + var message = { method: 'selectRecipient', id: [overlay.key], isSelected: nextSelectedStatus }; sendToQml(message); + + selectedIds = nextSelectedStatus ? [overlay.key] : []; + ExtendedOverlay.some(function (overlay) { + var id = overlay.key; + var selected = ExtendedOverlay.isSelected(id); + overlay.select(selected); + }); + + HighlightedEntity.clearOverlays(); + if (selectedIds.length) { + Entities.findEntitiesInFrustum(Camera.frustum).forEach(function (id) { + // Because lastEditedBy is per session, the vast majority of entities won't match, + // so it would probably be worth reducing marshalling costs by asking for just we need. + // However, providing property name(s) is advisory and some additional properties are + // included anyway. As it turns out, asking for 'lastEditedBy' gives 'position', 'rotation', + // and 'dimensions', too, so we might as well make use of them instead of making a second + // getEntityProperties call. + // It would be nice if we could harden this against future changes by specifying all + // and only these four in an array, but see + // https://highfidelity.fogbugz.com/f/cases/2728/Entities-getEntityProperties-id-lastEditedBy-name-lastEditedBy-doesn-t-work + var properties = Entities.getEntityProperties(id, 'lastEditedBy'); + if (ExtendedOverlay.isSelected(properties.lastEditedBy)) { + new HighlightedEntity(id, properties); + } + }); + } return true; }); } @@ -595,6 +622,12 @@ if (button) { button.editProperties({ isActive: onWalletScreen }); } + + if (onWalletScreen) { + isWired = true; + } else { + off(); + } } // @@ -621,6 +654,18 @@ triggerPressMapping.enable(); } } + var isWired = false; + function off() { + if (isWired) { // It is not ok to disconnect these twice, hence guard. + Script.update.disconnect(updateOverlays); + Controller.mousePressEvent.disconnect(handleMouseEvent); + Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); + isWired = false; + } + triggerMapping.disable(); // It's ok if we disable twice. + triggerPressMapping.disable(); // see above + removeOverlays(); + } function shutdown() { button.clicked.disconnect(onButtonClicked); tablet.removeButton(button); @@ -630,12 +675,7 @@ tablet.gotoHomeScreen(); } } - Script.update.disconnect(updateOverlays); - Controller.mousePressEvent.disconnect(handleMouseEvent); - Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); - triggerMapping.disable(); // It's ok if we disable twice. - triggerPressMapping.disable(); // see above - removeOverlays(); + off(); } // diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 594b6c5509..ee3a9ce7ec 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -576,6 +576,8 @@ var selectionDisplay = null; // for gridTool.js to ignore }); break; case 'refreshConnections': + case 'enable_ChooseRecipientNearbyMode': + case 'disable_ChooseRecipientNearbyMode': // NOP break; default: From 22631065e451274a0d71c534582d554c3551db93 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 15:09:15 -0800 Subject: [PATCH 24/86] Serious flow state --- .../resources/qml/controls-uit/TextField.qml | 15 +- .../commerce/wallet/sendMoney/SendMoney.qml | 319 +++++++++++++++++- 2 files changed, 329 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index e636bfc27f..b942c8b4ab 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -27,10 +27,12 @@ TextField { property bool hasRoundedBorder: false property bool error: false; property bool hasClearButton: false; + property string leftPlaceholderGlyph: ""; placeholderText: textField.placeholderText FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: hifiGlyphs; source: "../../fonts/hifi-glyphs.ttf"; } font.family: firaSansSemiBold.name font.pixelSize: hifi.fontSizes.textFieldInput font.italic: textField.text == "" @@ -54,6 +56,7 @@ TextField { } style: TextFieldStyle { + id: style; textColor: { if (isLightColorScheme) { if (textField.activeFocus) { @@ -102,6 +105,16 @@ TextField { border.width: textField.activeFocus || hasRoundedBorder || textField.error ? 1 : 0 radius: isSearchField ? textField.height / 2 : (hasRoundedBorder ? 4 : 0) + HiFiGlyphs { + text: textField.leftPlaceholderGlyph; + color: textColor; + size: hifi.fontSizes.textFieldSearchIcon; + anchors.left: parent.left; + anchors.verticalCenter: parent.verticalCenter; + anchors.leftMargin: hifi.dimensions.textPadding - 2; + visible: text; + } + HiFiGlyphs { text: hifi.glyphs.search color: textColor @@ -132,7 +145,7 @@ TextField { placeholderTextColor: isFaintGrayColorScheme ? hifi.colors.lightGrayText : hifi.colors.lightGray selectedTextColor: hifi.colors.black selectionColor: hifi.colors.primaryHighlight - padding.left: (isSearchField ? textField.height - 2 : 0) + hifi.dimensions.textPadding + padding.left: ((isSearchField || textField.leftPlaceholderGlyph !== "") ? textField.height - 2 : 0) + hifi.dimensions.textPadding padding.right: (hasClearButton ? textField.height - 2 : 0) + hifi.dimensions.textPadding } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 4b7f7b4033..e7cdc0dd4d 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -12,7 +12,7 @@ // import Hifi 1.0 as Hifi -import QtQuick 2.5 +import QtQuick 2.6 import QtQuick.Controls 2.2 import "../../../../styles-uit" import "../../../../controls-uit" as HifiControlsUit @@ -30,7 +30,8 @@ Item { property int parentAppNavBarHeight; property string currentActiveView: "sendMoneyHome"; property string nextActiveView: ""; - property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || chooseRecipientNearby.visible; + property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || chooseRecipientNearby.visible || sendMoneyStep.visible; + property bool isCurrentlySendingMoney: false; // This object is always used in a popup or full-screen Wallet section. // This MouseArea is used to prevent a user from being @@ -603,12 +604,322 @@ Item { width: 120; text: "Next"; onClicked: { - + sendMoneyStep.referrer = "nearby"; + sendMoneyStep.selectedRecipientNodeID = chooseRecipientNearby.selectedRecipient; + sendMoneyStep.selectedRecipientDisplayName = ""; + sendMoneyStep.selectedRecipientUserName = ""; + chooseRecipientNearby.selectedRecipient = ""; + + root.nextActiveView = "sendMoneyStep"; } } } } - // Choose Recipient Nearby END + // Choose Recipient Nearby + + // Send Money Screen BEGIN + Rectangle { + id: sendMoneyStep; + z: 997; + + property string referrer; // either "connections" or "nearby" + property string selectedRecipientNodeID; + property string selectedRecipientDisplayName; + property string selectedRecipientUserName; + + visible: root.currentActiveView === "sendMoneyStep"; + anchors.fill: parent; + color: "#AAAAAA"; + + Rectangle { + anchors.centerIn: parent; + width: parent.width - 30; + height: parent.height - 30; + + RalewaySemiBold { + id: sendMoneyText_sendMoneyStep; + text: "Send Money To:"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 26; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: paintedWidth; + height: 30; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + } + + Item { + id: sendToContainer; + anchors.top: sendMoneyText_sendMoneyStep.bottom; + anchors.topMargin: 20; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + RalewaySemiBold { + id: sendToText_sendMoneyStep; + text: "Send To:"; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: 90; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + RalewaySemiBold { + id: recipientDisplayName; + text: '"ZRF Changeme"'; + // Anchors + anchors.top: parent.top; + anchors.left: sendToText_sendMoneyStep.right; + anchors.right: changeButton.left; + anchors.rightMargin: 12; + height: parent.height/2; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignBottom; + } + + RalewaySemiBold { + id: recipientUsername; + text: "unknown username"; + // Anchors + anchors.bottom: parent.bottom; + anchors.left: recipientDisplayName.anchors.left; + anchors.leftMargin: recipientDisplayName.anchors.leftMargin; + anchors.right: recipientDisplayName.anchors.right; + anchors.rightMargin: recipientDisplayName.anchors.rightMargin; + height: parent.height/2; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + } + + // "CHANGE" button + HifiControlsUit.Button { + id: changeButton; + color: hifi.buttons.black; + colorScheme: hifi.colorSchemes.dark; + anchors.right: parent.right; + anchors.verticalCenter: parent.verticalCenter; + height: 35; + width: 120; + text: "CHANGE"; + onClicked: { + root.nextActiveView = "chooseRecipientNearby"; + } + } + } + + Item { + id: amountContainer; + anchors.top: sendToContainer.bottom; + anchors.topMargin: 16; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + RalewaySemiBold { + id: amountText; + text: "Amount:"; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: 90; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + HifiControlsUit.TextField { + id: amountTextField; + colorScheme: hifi.colorSchemes.light; + inputMethodHints: Qt.ImhDigitsOnly; + // Anchors + anchors.verticalCenter: parent.verticalCenter; + anchors.left: amountText.right; + anchors.right: parent.right; + height: 50; + // Style + leftPlaceholderGlyph: hifi.glyphs.hfc; + activeFocusOnPress: true; + activeFocusOnTab: true; + + onAccepted: { + optionalMessage.focus = true; + } + } + } + + Item { + id: messageContainer; + anchors.top: amountContainer.bottom; + anchors.topMargin: 16; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 180; + + FontLoader { id: firaSansSemiBold; source: "../../../../../fonts/FiraSans-SemiBold.ttf"; } + TextArea { + id: optionalMessage; + property int maximumLength: 255; + property string previousText: text; + placeholderText: "Optional Message"; + font.family: firaSansSemiBold.name; + font.pixelSize: 20; + // Anchors + anchors.fill: parent; + // Style + background: Rectangle { + anchors.fill: parent; + color: optionalMessage.activeFocus ? hifi.colors.white : hifi.colors.textFieldLightBackground; + border.width: optionalMessage.activeFocus ? 1 : 0; + border.color: optionalMessage.activeFocus ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground; + } + color: hifi.colors.black; + textFormat: TextEdit.PlainText; + wrapMode: TextEdit.Wrap; + activeFocusOnPress: true; + activeFocusOnTab: true; + // Workaround for no max length on TextAreas + onTextChanged: { + if (text.length > maximumLength) { + var cursor = cursorPosition; + text = previousText; + if (cursor > text.length) { + cursorPosition = text.length; + } else { + cursorPosition = cursor-1; + } + } + previousText = text; + } + } + } + + Item { + id: bottomBarContainer; + anchors.top: messageContainer.bottom; + anchors.topMargin: 30; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + HifiControlsUit.CheckBox { + id: sendPubliclyCheckbox; + text: "Send Publicly" + // Anchors + anchors.verticalCenter: parent.verticalCenter; + anchors.left: parent.left; + anchors.right: cancelButton_sendMoneyStep.left; + anchors.rightMargin: 16; + boxSize: 24; + } + + // "CANCEL" button + HifiControlsUit.Button { + id: cancelButton_sendMoneyStep; + color: hifi.buttons.noneBorderless; + colorScheme: hifi.colorSchemes.dark; + anchors.right: sendButton.left; + anchors.rightMargin: 16; + anchors.verticalCenter: parent.verticalCenter; + height: 35; + width: 100; + text: "CANCEL"; + onClicked: { + sendMoneyStep.selectedRecipientNodeID = ""; + sendMoneyStep.selectedRecipientDisplayName = ""; + sendMoneyStep.selectedRecipientUserName = ""; + root.nextActiveView = "sendMoneyHome"; + } + } + + // "SEND" button + HifiControlsUit.Button { + id: sendButton; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.right: parent.right; + anchors.verticalCenter: parent.verticalCenter; + height: 35; + width: 100; + text: "SEND"; + onClicked: { + root.isCurrentlySendingMoney = true; + } + } + } + } + } + // Send Money Screen END + + // Sending Money Overlay START + Rectangle { + id: sendingMoneyOverlay; + z: 998; + + visible: root.isCurrentlySendingMoney; + anchors.fill: parent; + color: Qt.rgba(0.0, 0.0, 0.0, 0.5); + + // This object is always used in a popup or full-screen Wallet section. + // This MouseArea is used to prevent a user from being + // able to click on a button/mouseArea underneath the popup/section. + MouseArea { + anchors.fill: parent; + propagateComposedEvents: false; + } + + AnimatedImage { + id: sendingMoneyImage; + source: "../../../../../icons/profilePicLoading.gif" + width: 160; + height: width; + anchors.top: parent.top; + anchors.topMargin: 185; + anchors.horizontalCenter: parent.horizontalCenter; + } + + RalewaySemiBold { + text: "Sending"; + // Anchors + anchors.top: sendingMoneyImage.bottom; + anchors.topMargin: 22; + anchors.horizontalCenter: parent.horizontalCenter; + width: paintedWidth; + // Text size + size: 24; + // Style + color: hifi.colors.white; + verticalAlignment: Text.AlignVCenter; + } + } + // Sending Money Overlay END From 68120106608c24a0113789b73936e24762c6b7b4 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 15:33:18 -0800 Subject: [PATCH 25/86] The skeleton is there --- .../commerce/wallet/sendMoney/SendMoney.qml | 243 +++++++++++++++++- 1 file changed, 231 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index e7cdc0dd4d..6c04bb946d 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -30,7 +30,8 @@ Item { property int parentAppNavBarHeight; property string currentActiveView: "sendMoneyHome"; property string nextActiveView: ""; - property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || chooseRecipientNearby.visible || sendMoneyStep.visible; + property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || + chooseRecipientNearby.visible || sendMoneyStep.visible || paymentSuccess.visible; property bool isCurrentlySendingMoney: false; // This object is always used in a popup or full-screen Wallet section. @@ -449,7 +450,6 @@ Item { height: parent.height - 30; RalewaySemiBold { - id: chooseRecipientText_nearby; text: "Choose Recipient:"; // Anchors anchors.top: parent.top; @@ -483,7 +483,7 @@ Item { } onClicked: { root.nextActiveView = "sendMoneyHome"; - chooseRecipientNearby.selectedRecipient = ""; + resetSendMoneyData(); } } } @@ -586,7 +586,7 @@ Item { text: "Cancel"; onClicked: { root.nextActiveView = "sendMoneyHome"; - chooseRecipientNearby.selectedRecipient = ""; + resetSendMoneyData(); } } @@ -606,8 +606,8 @@ Item { onClicked: { sendMoneyStep.referrer = "nearby"; sendMoneyStep.selectedRecipientNodeID = chooseRecipientNearby.selectedRecipient; - sendMoneyStep.selectedRecipientDisplayName = ""; - sendMoneyStep.selectedRecipientUserName = ""; + sendMoneyStep.selectedRecipientDisplayName = '"ZRF Changeme"'; + sendMoneyStep.selectedRecipientUserName = 'unknown username'; chooseRecipientNearby.selectedRecipient = ""; root.nextActiveView = "sendMoneyStep"; @@ -615,7 +615,7 @@ Item { } } } - // Choose Recipient Nearby + // Choose Recipient Nearby END // Send Money Screen BEGIN Rectangle { @@ -679,7 +679,7 @@ Item { RalewaySemiBold { id: recipientDisplayName; - text: '"ZRF Changeme"'; + text: sendMoneyStep.selectedRecipientDisplayName; // Anchors anchors.top: parent.top; anchors.left: sendToText_sendMoneyStep.right; @@ -695,7 +695,7 @@ Item { RalewaySemiBold { id: recipientUsername; - text: "unknown username"; + text: sendMoneyStep.selectedRecipientUserName; // Anchors anchors.bottom: parent.bottom; anchors.left: recipientDisplayName.anchors.left; @@ -852,9 +852,7 @@ Item { width: 100; text: "CANCEL"; onClicked: { - sendMoneyStep.selectedRecipientNodeID = ""; - sendMoneyStep.selectedRecipientDisplayName = ""; - sendMoneyStep.selectedRecipientUserName = ""; + resetSendMoneyData(); root.nextActiveView = "sendMoneyHome"; } } @@ -871,6 +869,18 @@ Item { text: "SEND"; onClicked: { root.isCurrentlySendingMoney = true; + amountTextField.focus = false; + optionalMessage.focus = false; + tempTimer.interval = 250; + tempTimer.start(); + } + } + + Timer { + id: tempTimer; + onTriggered: { + root.isCurrentlySendingMoney = false; + root.nextActiveView = "paymentSuccess"; } } } @@ -920,7 +930,209 @@ Item { } } // Sending Money Overlay END + + // Payment Success BEGIN + Rectangle { + id: paymentSuccess; + visible: root.currentActiveView === "paymentSuccess"; + anchors.fill: parent; + color: "#AAAAAA"; + + Rectangle { + anchors.centerIn: parent; + width: parent.width - 30; + height: parent.height - 30; + + RalewaySemiBold { + id: paymentSentText; + text: "Payment Sent"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 26; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: paintedWidth; + height: 30; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + } + + HiFiGlyphs { + id: closeGlyphButton_paymentSuccess; + text: hifi.glyphs.close; + size: 26; + anchors.top: parent.top; + anchors.topMargin: 10; + anchors.right: parent.right; + anchors.rightMargin: 10; + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: { + parent.text = hifi.glyphs.closeInverted; + } + onExited: { + parent.text = hifi.glyphs.close; + } + onClicked: { + root.nextActiveView = "sendMoneyHome"; + resetSendMoneyData(); + } + } + } + + Item { + id: sendToContainer_paymentSuccess; + anchors.top: paymentSentText.bottom; + anchors.topMargin: 20; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + RalewaySemiBold { + id: sendToText_paymentSuccess; + text: "Sent To:"; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: 90; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + RalewaySemiBold { + id: recipientDisplayName_paymentSuccess; + text: sendMoneyStep.selectedRecipientDisplayName; + // Anchors + anchors.top: parent.top; + anchors.left: sendToText_paymentSuccess.right; + anchors.right: parent.right; + height: parent.height/2; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignBottom; + } + + RalewaySemiBold { + id: recipientUsername_paymentSuccess; + text: sendMoneyStep.selectedRecipientUserName; + // Anchors + anchors.bottom: parent.bottom; + anchors.left: recipientDisplayName_paymentSuccess.anchors.left; + anchors.leftMargin: recipientDisplayName_paymentSuccess.anchors.leftMargin; + anchors.right: recipientDisplayName_paymentSuccess.anchors.right; + anchors.rightMargin: recipientDisplayName_paymentSuccess.anchors.rightMargin; + height: parent.height/2; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + } + } + + Item { + id: amountContainer_paymentSuccess; + anchors.top: sendToContainer_paymentSuccess.bottom; + anchors.topMargin: 16; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + RalewaySemiBold { + id: amountText_paymentSuccess; + text: "Amount:"; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: 90; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + // "HFC" balance label + HiFiGlyphs { + id: amountSentLabel; + text: hifi.glyphs.hfc; + // Size + size: 32; + // Anchors + anchors.left: amountText_paymentSuccess.right; + anchors.verticalCenter: parent.verticalCenter; + height: 50; + // Style + color: hifi.colors.baseGray; + } + + RalewaySemiBold { + id: amountSentText; + text: amountTextField.text; + // Anchors + anchors.verticalCenter: parent.verticalCenter; + anchors.left: amountSentLabel.right; + anchors.leftMargin: 20; + anchors.right: parent.right; + height: 50; + // Style + size: 22; + color: hifi.colors.baseGray; + } + } + + RalewaySemiBold { + id: optionalMessage_paymentSuccess; + text: optionalMessage.text; + // Anchors + anchors.top: amountContainer_paymentSuccess.bottom; + anchors.left: parent.left; + anchors.leftMargin: 110; + anchors.right: parent.right; + anchors.bottom: closeButton.top; + anchors.bottomMargin: 40; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + wrapMode: Text.WordWrap; + verticalAlignment: Text.AlignTop; + } + + // "Close" button + HifiControlsUit.Button { + id: closeButton; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.horizontalCenter: parent.horizontalCenter; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 80; + height: 50; + width: 120; + text: "Close"; + onClicked: { + root.nextActiveView = "sendMoneyHome"; + resetSendMoneyData(); + } + } + } + } + // Payment Success END // @@ -943,6 +1155,13 @@ Item { } } + function resetSendMoneyData() { + chooseRecipientNearby.selectedRecipient = ""; + sendMoneyStep.selectedRecipientNodeID = ""; + sendMoneyStep.selectedRecipientDisplayName = ""; + sendMoneyStep.selectedRecipientUserName = ""; + } + // // Function Name: fromScript() // From 93b15c0aa6a70e96fbe9980719bfa703b0d9eba2 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 15:53:13 -0800 Subject: [PATCH 26/86] Payment Failure --- .../commerce/wallet/sendMoney/SendMoney.qml | 250 +++++++++++++++++- 1 file changed, 245 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 6c04bb946d..e24cbda07d 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -31,7 +31,7 @@ Item { property string currentActiveView: "sendMoneyHome"; property string nextActiveView: ""; property bool isCurrentlyFullScreen: chooseRecipientConnection.visible || - chooseRecipientNearby.visible || sendMoneyStep.visible || paymentSuccess.visible; + chooseRecipientNearby.visible || sendMoneyStep.visible || paymentSuccess.visible || paymentFailure.visible; property bool isCurrentlySendingMoney: false; // This object is always used in a popup or full-screen Wallet section. @@ -509,7 +509,7 @@ Item { // Style color: hifi.colors.baseGray; horizontalAlignment: Text.AlignHCenter; - wrapMode: Text.WordWrap; + wrapMode: Text.Wrap; } } @@ -568,7 +568,7 @@ Item { // Style color: hifi.colors.baseGray; horizontalAlignment: Text.AlignHCenter; - wrapMode: Text.WordWrap; + wrapMode: Text.Wrap; } } @@ -880,7 +880,7 @@ Item { id: tempTimer; onTriggered: { root.isCurrentlySendingMoney = false; - root.nextActiveView = "paymentSuccess"; + root.nextActiveView = "paymentFailure"; } } } @@ -1104,13 +1104,14 @@ Item { anchors.left: parent.left; anchors.leftMargin: 110; anchors.right: parent.right; + anchors.rightMargin: 16; anchors.bottom: closeButton.top; anchors.bottomMargin: 40; // Text size size: 22; // Style color: hifi.colors.baseGray; - wrapMode: Text.WordWrap; + wrapMode: Text.Wrap; verticalAlignment: Text.AlignTop; } @@ -1133,6 +1134,243 @@ Item { } } // Payment Success END + + // Payment Failure BEGIN + Rectangle { + id: paymentFailure; + + visible: root.currentActiveView === "paymentFailure"; + anchors.fill: parent; + color: "#AAAAAA"; + + Rectangle { + anchors.centerIn: parent; + width: parent.width - 30; + height: parent.height - 30; + + RalewaySemiBold { + id: paymentFailureText; + text: "Payment Failed"; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 26; + anchors.left: parent.left; + anchors.leftMargin: 20; + width: paintedWidth; + height: 30; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + } + + HiFiGlyphs { + id: closeGlyphButton_paymentFailure; + text: hifi.glyphs.close; + size: 26; + anchors.top: parent.top; + anchors.topMargin: 10; + anchors.right: parent.right; + anchors.rightMargin: 10; + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: { + parent.text = hifi.glyphs.closeInverted; + } + onExited: { + parent.text = hifi.glyphs.close; + } + onClicked: { + root.nextActiveView = "sendMoneyHome"; + resetSendMoneyData(); + } + } + } + + RalewaySemiBold { + id: paymentFailureDetailText; + text: "The recipient you specified was unable to receive your payment."; + anchors.top: paymentFailureText.bottom; + anchors.topMargin: 20; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + Item { + id: sendToContainer_paymentFailure; + anchors.top: paymentFailureDetailText.bottom; + anchors.topMargin: 20; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + RalewaySemiBold { + id: paymentFailureText_paymentFailure; + text: "Sent To:"; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: 90; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + RalewaySemiBold { + id: recipientDisplayName_paymentFailure; + text: sendMoneyStep.selectedRecipientDisplayName; + // Anchors + anchors.top: parent.top; + anchors.left: sendToText_paymentFailure.right; + anchors.right: parent.right; + height: parent.height/2; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignBottom; + } + + RalewaySemiBold { + id: recipientUsername_paymentFailure; + text: sendMoneyStep.selectedRecipientUserName; + // Anchors + anchors.bottom: parent.bottom; + anchors.left: recipientDisplayName_paymentFailure.anchors.left; + anchors.leftMargin: recipientDisplayName_paymentFailure.anchors.leftMargin; + anchors.right: recipientDisplayName_paymentFailure.anchors.right; + anchors.rightMargin: recipientDisplayName_paymentFailure.anchors.rightMargin; + height: parent.height/2; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + } + } + + Item { + id: amountContainer_paymentFailure; + anchors.top: sendToContainer_paymentFailure.bottom; + anchors.topMargin: 16; + anchors.left: parent.left; + anchors.leftMargin: 20; + anchors.right: parent.right; + anchors.rightMargin: 20; + height: 80; + + RalewaySemiBold { + id: amountText_paymentFailure; + text: "Amount:"; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: 90; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } + + // "HFC" balance label + HiFiGlyphs { + id: amountSentLabel_paymentFailure; + text: hifi.glyphs.hfc; + // Size + size: 32; + // Anchors + anchors.left: amountText_paymentFailure.right; + anchors.verticalCenter: parent.verticalCenter; + height: 50; + // Style + color: hifi.colors.baseGray; + } + + RalewaySemiBold { + id: amountSentText_paymentFailure; + text: amountTextField.text; + // Anchors + anchors.verticalCenter: parent.verticalCenter; + anchors.left: amountSentLabel_paymentFailure.right; + anchors.leftMargin: 20; + anchors.right: parent.right; + height: 50; + // Style + size: 22; + color: hifi.colors.baseGray; + } + } + + RalewaySemiBold { + id: optionalMessage_paymentFailuire; + text: optionalMessage.text; + // Anchors + anchors.top: amountContainer_paymentFailure.bottom; + anchors.left: parent.left; + anchors.leftMargin: 110; + anchors.right: parent.right; + anchors.rightMargin: 16; + anchors.bottom: closeButton.top; + anchors.bottomMargin: 40; + // Text size + size: 22; + // Style + color: hifi.colors.baseGray; + wrapMode: Text.Wrap; + verticalAlignment: Text.AlignTop; + } + + // "Close" button + HifiControlsUit.Button { + id: closeButton_paymentFailure; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.horizontalCenter: parent.horizontalCenter; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 80; + height: 50; + width: 120; + text: "Cancel"; + onClicked: { + root.nextActiveView = "sendMoneyHome"; + resetSendMoneyData(); + } + } + + // "Retry" button + HifiControlsUit.Button { + id: retryButton_paymentFailure; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.right: parent.right; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 80; + height: 50; + width: 120; + text: "Retry"; + onClicked: { + + } + } + } + } + // Payment Failure END // @@ -1160,6 +1398,8 @@ Item { sendMoneyStep.selectedRecipientNodeID = ""; sendMoneyStep.selectedRecipientDisplayName = ""; sendMoneyStep.selectedRecipientUserName = ""; + amountTextField.text = ""; + optionalMessage.text = ""; } // From 260aee42a87d0a5a3b6231bda3c622384dbb347f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 16:18:34 -0800 Subject: [PATCH 27/86] Improvements --- .../wallet/sendMoney/ConnectionItem.qml | 3 +- .../commerce/wallet/sendMoney/SendMoney.qml | 68 +++++++++++++++---- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml index d9adbee710..80c87e307b 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml @@ -114,7 +114,8 @@ Item { width: 110; text: "CHOOSE"; onClicked: { - + var msg = { method: 'chooseConnection', userName: root.userName }; + sendToSendMoney(msg); } } } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index e24cbda07d..38d3259b49 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -415,7 +415,12 @@ Item { Connections { onSendToSendMoney: { - // TODO + sendMoneyStep.referrer = "connections"; + sendMoneyStep.selectedRecipientNodeID = ''; + sendMoneyStep.selectedRecipientDisplayName = msg.userName; + sendMoneyStep.selectedRecipientUserName = 'connection'; + + root.nextActiveView = "sendMoneyStep"; } } @@ -721,7 +726,12 @@ Item { width: 120; text: "CHANGE"; onClicked: { - root.nextActiveView = "chooseRecipientNearby"; + if (sendMoneyStep.referrer === "connections") { + root.nextActiveView = "chooseRecipientConnection"; + } else if (sendMoneyStep.referrer === "nearby") { + root.nextActiveView = "chooseRecipientNearby"; + } + resetSendMoneyData(); } } } @@ -765,10 +775,28 @@ Item { activeFocusOnPress: true; activeFocusOnTab: true; + validator: IntValidator { bottom: 0; } + onAccepted: { optionalMessage.focus = true; } } + + RalewaySemiBold { + id: amountTextFieldError; + // Anchors + anchors.top: amountTextField.bottom; + anchors.topMargin: 2; + anchors.left: amountTextField.left; + anchors.right: amountTextField.right; + height: 40; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + horizontalAlignment: Text.AlignRight; + } } Item { @@ -868,11 +896,19 @@ Item { width: 100; text: "SEND"; onClicked: { - root.isCurrentlySendingMoney = true; - amountTextField.focus = false; - optionalMessage.focus = false; - tempTimer.interval = 250; - tempTimer.start(); + if (parseInt(amountTextField.text) > parseInt(balanceText.text)) { + amountTextField.focus = true; + amountTextField.error = true; + amountTextFieldError.text = "amount exceeds available funds"; + } else { + amountTextFieldError.text = ""; + amountTextField.error = false; + root.isCurrentlySendingMoney = true; + amountTextField.focus = false; + optionalMessage.focus = false; + tempTimer.interval = 250; + tempTimer.start(); + } } } @@ -1203,12 +1239,13 @@ Item { // Style color: hifi.colors.baseGray; verticalAlignment: Text.AlignVCenter; + wrapMode: Text.Wrap; } Item { id: sendToContainer_paymentFailure; anchors.top: paymentFailureDetailText.bottom; - anchors.topMargin: 20; + anchors.topMargin: 8; anchors.left: parent.left; anchors.leftMargin: 20; anchors.right: parent.right; @@ -1216,7 +1253,7 @@ Item { height: 80; RalewaySemiBold { - id: paymentFailureText_paymentFailure; + id: sentToText_paymentFailure; text: "Sent To:"; // Anchors anchors.top: parent.top; @@ -1235,7 +1272,7 @@ Item { text: sendMoneyStep.selectedRecipientDisplayName; // Anchors anchors.top: parent.top; - anchors.left: sendToText_paymentFailure.right; + anchors.left: sentToText_paymentFailure.right; anchors.right: parent.right; height: parent.height/2; // Text size @@ -1339,7 +1376,7 @@ Item { // "Close" button HifiControlsUit.Button { id: closeButton_paymentFailure; - color: hifi.buttons.blue; + color: hifi.buttons.noneBorderless; colorScheme: hifi.colorSchemes.dark; anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; @@ -1359,13 +1396,16 @@ Item { color: hifi.buttons.blue; colorScheme: hifi.colorSchemes.dark; anchors.right: parent.right; + anchors.rightMargin: 12; anchors.bottom: parent.bottom; anchors.bottomMargin: 80; height: 50; width: 120; text: "Retry"; onClicked: { - + root.isCurrentlySendingMoney = true; + tempTimer.interval = 250; + tempTimer.start(); } } } @@ -1394,6 +1434,10 @@ Item { } function resetSendMoneyData() { + amountTextField.focus = false; + optionalMessage.focus = false; + amountTextFieldError.text = ""; + amountTextField.error = false; chooseRecipientNearby.selectedRecipient = ""; sendMoneyStep.selectedRecipientNodeID = ""; sendMoneyStep.selectedRecipientDisplayName = ""; From b3e3af4ee777db12631fed12080418de1ebfca2d Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 16:23:29 -0800 Subject: [PATCH 28/86] Add character count :) --- .../hifi/commerce/wallet/sendMoney/SendMoney.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 38d3259b49..cf80ef3816 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -833,6 +833,7 @@ Item { activeFocusOnTab: true; // Workaround for no max length on TextAreas onTextChanged: { + optionalMessageCharacterCount.text = optionalMessage.text.length + "/" + optionalMessage.maximumLength; if (text.length > maximumLength) { var cursor = cursorPosition; text = previousText; @@ -845,6 +846,20 @@ Item { previousText = text; } } + RalewaySemiBold { + id: optionalMessageCharacterCount; + // Anchors + anchors.top: optionalMessage.bottom; + anchors.topMargin: 2; + anchors.right: optionalMessage.right; + height: paintedHeight; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + horizontalAlignment: Text.AlignRight; + } } Item { From 0d137d62c833d76a5af3ed72b1c977b09b5db7d9 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 16:37:47 -0800 Subject: [PATCH 29/86] HMD tweaks --- .../qml/hifi/commerce/wallet/sendMoney/SendMoney.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index cf80ef3816..eb6aa3bb0d 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -739,7 +739,7 @@ Item { Item { id: amountContainer; anchors.top: sendToContainer.bottom; - anchors.topMargin: 16; + anchors.topMargin: 2; anchors.left: parent.left; anchors.leftMargin: 20; anchors.right: parent.right; @@ -807,7 +807,7 @@ Item { anchors.leftMargin: 20; anchors.right: parent.right; anchors.rightMargin: 20; - height: 180; + height: 140; FontLoader { id: firaSansSemiBold; source: "../../../../../fonts/FiraSans-SemiBold.ttf"; } TextArea { @@ -833,7 +833,6 @@ Item { activeFocusOnTab: true; // Workaround for no max length on TextAreas onTextChanged: { - optionalMessageCharacterCount.text = optionalMessage.text.length + "/" + optionalMessage.maximumLength; if (text.length > maximumLength) { var cursor = cursorPosition; text = previousText; @@ -848,6 +847,7 @@ Item { } RalewaySemiBold { id: optionalMessageCharacterCount; + text: optionalMessage.text.length + "/" + optionalMessage.maximumLength; // Anchors anchors.top: optionalMessage.bottom; anchors.topMargin: 2; From 980807c657479cdd4f05ee21b1ccf05ed7436d5a Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 10 Jan 2018 16:50:41 -0800 Subject: [PATCH 30/86] make changes --- .../src/avatars-renderer/Avatar.cpp | 62 ++++++++++++++----- .../src/RenderableModelEntityItem.cpp | 19 ++++++ .../src/RenderableModelEntityItem.h | 5 ++ 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index f1e2c5d00d..765764da47 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -355,24 +355,52 @@ void Avatar::relayJointDataToChildren() { auto modelEntity = std::dynamic_pointer_cast(child); if (modelEntity) { if (modelEntity->getRelayParentJoints()) { - QStringList modelJointNames = modelEntity->getJointNames(); - QStringList avatarJointNames = getJointNames(); - foreach (const QString& jointName, modelJointNames) { - bool containsJoint = avatarJointNames.contains(jointName); - glm::quat jointRotation; - glm::vec3 jointTranslation; - if (!containsJoint) { - int jointIndex = modelEntity->getJointIndex(jointName); - jointRotation = modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); - jointTranslation = modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); - } else { - int jointIndex = getJointIndex(jointName); - jointRotation = getJointRotation(jointIndex); - jointTranslation = getJointTranslation(jointIndex); + qDebug() << modelEntity->getJointMapCompleted(); + if (!(modelEntity->getJointMapCompleted())) { + qDebug() << "constructing map"; + QStringList modelJointNames = modelEntity->getJointNames(); + int numJoints = modelJointNames.count(); + std::vector map; + map.reserve(numJoints); + for (int jointIndex = 0; jointIndex < numJoints; jointIndex++) { + QString jointName = modelJointNames.at(jointIndex); + int avatarJointIndex = getJointIndex(jointName); + glm::quat jointRotation; + glm::vec3 jointTranslation; + qDebug() << avatarJointIndex; + if (avatarJointIndex < 0) { + jointRotation = modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); + jointTranslation = modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); + map.push_back(-1); + } else { + int jointIndex = getJointIndex(jointName); + jointRotation = getJointRotation(jointIndex); + jointTranslation = getJointTranslation(jointIndex); + map.push_back(avatarJointIndex); + } + modelEntity->setLocalJointRotation(jointIndex, jointRotation); + modelEntity->setLocalJointTranslation(jointIndex, jointTranslation); + } + modelEntity->setJointMap(map); + } else { + QStringList modelJointNames = modelEntity->getJointNames(); + int numJoints = modelJointNames.count(); + for (int jointIndex = 0; jointIndex < numJoints; jointIndex++) { + int avatarJointIndex = modelEntity->avatarJointIndex(jointIndex); + int index = modelEntity->getJointIndex(modelJointNames.at(jointIndex)); + //qDebug() << jointIndex << "------" << index; + glm::quat jointRotation; + glm::vec3 jointTranslation; + if (avatarJointIndex >=0) { + jointRotation = getJointRotation(avatarJointIndex); + jointTranslation = getJointTranslation(avatarJointIndex); + } else { + jointRotation = modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); + jointTranslation = modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); + } + modelEntity->setLocalJointRotation(jointIndex, jointRotation); + modelEntity->setLocalJointTranslation(jointIndex, jointTranslation); } - int modelJointIndex = modelEntity->getJointIndex(jointName); - modelEntity->setLocalJointRotation(modelJointIndex, jointRotation); - modelEntity->setLocalJointTranslation(modelJointIndex, jointTranslation); } modelEntity->simulateRelayedJoints(); } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index d60a82e678..84d19f4fb3 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -708,6 +708,21 @@ void RenderableModelEntityItem::setCollisionShape(const btCollisionShape* shape) } } +void RenderableModelEntityItem::setJointMap(std::vector jointMap) { + _jointMap = jointMap; + _jointMapCompleted = true; +}; + +int RenderableModelEntityItem::avatarJointIndex(int modelJointIndex) { + int result = -1; + int mapSize = _jointMap.size(); + if (modelJointIndex >=0 && modelJointIndex < mapSize) { + result = _jointMap[modelJointIndex]; + } + + return result; +} + bool RenderableModelEntityItem::contains(const glm::vec3& point) const { auto model = getModel(); if (EntityItem::contains(point) && model && _compoundShapeResource && _compoundShapeResource->isLoaded()) { @@ -813,6 +828,10 @@ bool RenderableModelEntityItem::setAbsoluteJointTranslationInObjectFrame(int ind return setLocalJointTranslation(index, jointRelativePose.trans()); } +bool RenderableModelEntityItem::getJointMapCompleted() { + return _jointMapCompleted; +} + glm::quat RenderableModelEntityItem::getLocalJointRotation(int index) const { auto model = getModel(); if (model) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index e8244e6f1d..8315a44328 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -84,6 +84,9 @@ public: virtual bool shouldBePhysical() const override; void simulateRelayedJoints(); + bool getJointMapCompleted(); + void setJointMap(std::vector jointMap); + int avatarJointIndex(int modelJointIndex); // these are in the frame of this object (model space) virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override; @@ -119,7 +122,9 @@ private: void getCollisionGeometryResource(); GeometryResource::Pointer _compoundShapeResource; + bool _jointMapCompleted { false }; bool _originalTexturesRead { false }; + std::vector _jointMap; QVariantMap _originalTextures; bool _dimensionsInitialized { true }; bool _needsJointSimulation { false }; From 939012a2d0454fdda76bfeae32820dedd9e91744 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jan 2018 17:10:05 -0800 Subject: [PATCH 31/86] Hook up the endpoints! --- .../commerce/wallet/sendMoney/SendMoney.qml | 38 +++++++++++++------ interface/src/commerce/Ledger.cpp | 24 ++++++++++++ interface/src/commerce/Ledger.h | 8 ++++ interface/src/commerce/QmlCommerce.cpp | 26 +++++++++++++ interface/src/commerce/QmlCommerce.h | 6 +++ 5 files changed, 90 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index eb6aa3bb0d..a7ca8e2194 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -50,6 +50,26 @@ Item { onBalanceResult : { balanceText.text = result.data.balance; } + + onTransferHfcToNodeResult: { + root.isCurrentlySendingMoney = false; + + if (result.status === 'success') { + root.nextActiveView = 'paymentSuccess'; + } else { + root.nextActiveView = 'paymentFailure'; + } + } + + onTransferHfcToUsernameResult: { + root.isCurrentlySendingMoney = false; + + if (result.status === 'success') { + root.nextActiveView = 'paymentSuccess'; + } else { + root.nextActiveView = 'paymentFailure'; + } + } } Connections { @@ -874,6 +894,7 @@ Item { HifiControlsUit.CheckBox { id: sendPubliclyCheckbox; + visible: false; // FIXME ONCE PARTICLE EFFECTS ARE IN text: "Send Publicly" // Anchors anchors.verticalCenter: parent.verticalCenter; @@ -921,19 +942,14 @@ Item { root.isCurrentlySendingMoney = true; amountTextField.focus = false; optionalMessage.focus = false; - tempTimer.interval = 250; - tempTimer.start(); + if (sendMoneyStep.referrer = "connections") { + + } else if (sendMoneyStep.referrer = "nearby") { + + } } } } - - Timer { - id: tempTimer; - onTriggered: { - root.isCurrentlySendingMoney = false; - root.nextActiveView = "paymentFailure"; - } - } } } } @@ -1419,8 +1435,6 @@ Item { text: "Retry"; onClicked: { root.isCurrentlySendingMoney = true; - tempTimer.interval = 250; - tempTimer.start(); } } } diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index 51658ddef8..98df9e4997 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -46,6 +46,8 @@ Handler(buy) Handler(receiveAt) Handler(balance) Handler(inventory) +Handler(transferHfcToNode) +Handler(transferHfcToUsername) void Ledger::send(const QString& endpoint, const QString& success, const QString& fail, QNetworkAccessManager::Operation method, AccountManagerAuth::Type authType, QJsonObject request) { auto accountManager = DependencyManager::get(); @@ -268,3 +270,25 @@ void Ledger::certificateInfo(const QString& certificateId) { request["certificate_id"] = certificateId; send(endpoint, "certificateInfoSuccess", "certificateInfoFailure", QNetworkAccessManager::PutOperation, AccountManagerAuth::None, request); } + +void Ledger::transferHfcToNode(const QString& hfc_key, const QString& nodeID, const int& amount, const QString& optionalMessage) { + QJsonObject transaction; + transaction["hfc_key"] = hfc_key; + transaction["node_id"] = nodeID; + transaction["quantity"] = amount; + transaction["message"] = optionalMessage; + QJsonDocument transactionDoc{ transaction }; + auto transactionString = transactionDoc.toJson(QJsonDocument::Compact); + signedSend("transaction", transactionString, hfc_key, "transfer_hfc_to_node", "transferHfcToNodeSuccess", "transferHfcToNodeFailure"); +} + +void Ledger::transferHfcToUsername(const QString& hfc_key, const QString& username, const int& amount, const QString& optionalMessage) { + QJsonObject transaction; + transaction["hfc_key"] = hfc_key; + transaction["username"] = username; + transaction["quantity"] = amount; + transaction["message"] = optionalMessage; + QJsonDocument transactionDoc{ transaction }; + auto transactionString = transactionDoc.toJson(QJsonDocument::Compact); + signedSend("transaction", transactionString, hfc_key, "transfer_hfc_to_user", "transferHfcToUsernameSuccess", "transferHfcToUsernameFailure"); +} diff --git a/interface/src/commerce/Ledger.h b/interface/src/commerce/Ledger.h index 5d90aa0808..9a781978e4 100644 --- a/interface/src/commerce/Ledger.h +++ b/interface/src/commerce/Ledger.h @@ -34,6 +34,8 @@ public: void reset(); void updateLocation(const QString& asset_id, const QString location, const bool controlledFailure = false); void certificateInfo(const QString& certificateId); + void transferHfcToNode(const QString& hfc_key, const QString& nodeID, const int& amount, const QString& optionalMessage); + void transferHfcToUsername(const QString& hfc_key, const QString& username, const int& amount, const QString& optionalMessage); enum CertificateStatus { CERTIFICATE_STATUS_UNKNOWN = 0, @@ -52,6 +54,8 @@ signals: void accountResult(QJsonObject result); void locationUpdateResult(QJsonObject result); void certificateInfoResult(QJsonObject result); + void transferHfcToNodeResult(QJsonObject result); + void transferHfcToUsernameResult(QJsonObject result); void updateCertificateStatus(const QString& certID, uint certStatus); @@ -74,6 +78,10 @@ public slots: void updateLocationFailure(QNetworkReply& reply); void certificateInfoSuccess(QNetworkReply& reply); void certificateInfoFailure(QNetworkReply& reply); + void transferHfcToNodeSuccess(QNetworkReply& reply); + void transferHfcToNodeFailure(QNetworkReply& reply); + void transferHfcToUsernameSuccess(QNetworkReply& reply); + void transferHfcToUsernameFailure(QNetworkReply& reply); private: QJsonObject apiResponse(const QString& label, QNetworkReply& reply); diff --git a/interface/src/commerce/QmlCommerce.cpp b/interface/src/commerce/QmlCommerce.cpp index 320c7e041c..963028ccdf 100644 --- a/interface/src/commerce/QmlCommerce.cpp +++ b/interface/src/commerce/QmlCommerce.cpp @@ -29,6 +29,8 @@ QmlCommerce::QmlCommerce() { connect(wallet.data(), &Wallet::walletStatusResult, this, &QmlCommerce::walletStatusResult); connect(ledger.data(), &Ledger::certificateInfoResult, this, &QmlCommerce::certificateInfoResult); connect(ledger.data(), &Ledger::updateCertificateStatus, this, &QmlCommerce::updateCertificateStatus); + connect(ledger.data(), &Ledger::transferHfcToNodeResult, this, &QmlCommerce::transferHfcToNodeResult); + connect(ledger.data(), &Ledger::transferHfcToUsernameResult, this, &QmlCommerce::transferHfcToUsernameResult); auto accountManager = DependencyManager::get(); connect(accountManager.data(), &AccountManager::usernameChanged, this, [&]() { @@ -149,3 +151,27 @@ void QmlCommerce::certificateInfo(const QString& certificateId) { auto ledger = DependencyManager::get(); ledger->certificateInfo(certificateId); } + +void QmlCommerce::transferHfcToNode(const QString& nodeID, const int& amount, const QString& optionalMessage) { + auto ledger = DependencyManager::get(); + auto wallet = DependencyManager::get(); + QStringList keys = wallet->listPublicKeys(); + if (keys.count() == 0) { + QJsonObject result{ { "status", "fail" },{ "message", "Uninitialized Wallet." } }; + return emit buyResult(result); + } + QString key = keys[0]; + ledger->transferHfcToNode(key, nodeID, amount, optionalMessage); +} + +void QmlCommerce::transferHfcToUsername(const QString& username, const int& amount, const QString& optionalMessage) { + auto ledger = DependencyManager::get(); + auto wallet = DependencyManager::get(); + QStringList keys = wallet->listPublicKeys(); + if (keys.count() == 0) { + QJsonObject result{ { "status", "fail" },{ "message", "Uninitialized Wallet." } }; + return emit buyResult(result); + } + QString key = keys[0]; + ledger->transferHfcToUsername(key, username, amount, optionalMessage); +} diff --git a/interface/src/commerce/QmlCommerce.h b/interface/src/commerce/QmlCommerce.h index f2e6c82021..791097d7cf 100644 --- a/interface/src/commerce/QmlCommerce.h +++ b/interface/src/commerce/QmlCommerce.h @@ -45,6 +45,9 @@ signals: void updateCertificateStatus(const QString& certID, uint certStatus); + void transferHfcToNodeResult(QJsonObject result); + void transferHfcToUsernameResult(QJsonObject result); + protected: Q_INVOKABLE void getWalletStatus(); @@ -67,6 +70,9 @@ protected: Q_INVOKABLE void account(); Q_INVOKABLE void certificateInfo(const QString& certificateId); + + Q_INVOKABLE void transferHfcToNode(const QString& nodeID, const int& amount, const QString& optionalMessage); + Q_INVOKABLE void transferHfcToUsername(const QString& username, const int& amount, const QString& optionalMessage); }; #endif // hifi_QmlCommerce_h From 0f4206d330d47add73fe93c6296f39ff1eb097ef Mon Sep 17 00:00:00 2001 From: Nissim Hadar Date: Wed, 10 Jan 2018 18:21:34 -0800 Subject: [PATCH 32/86] Added option to delete old snapshots. --- tools/auto-tester/CMakeLists.txt | 44 ++-- tools/auto-tester/src/ImageComparer.cpp | 8 +- tools/auto-tester/src/Test.cpp | 239 +++++++++++++++++--- tools/auto-tester/src/Test.h | 26 ++- tools/auto-tester/src/common.h | 7 +- tools/auto-tester/src/main.cpp | 2 +- tools/auto-tester/src/ui/AutoTester.cpp | 12 +- tools/auto-tester/src/ui/AutoTester.h | 8 +- tools/auto-tester/src/ui/AutoTester.ui | 80 +++++-- tools/auto-tester/src/ui/MismatchWindow.cpp | 56 ++++- tools/auto-tester/src/ui/MismatchWindow.h | 7 +- tools/auto-tester/src/ui/MismatchWindow.ui | 105 ++++++--- 12 files changed, 459 insertions(+), 135 deletions(-) diff --git a/tools/auto-tester/CMakeLists.txt b/tools/auto-tester/CMakeLists.txt index e5f2c1fb97..a875f5676a 100644 --- a/tools/auto-tester/CMakeLists.txt +++ b/tools/auto-tester/CMakeLists.txt @@ -1,47 +1,41 @@ -set(TARGET_NAME auto-tester) +set (TARGET_NAME auto-tester) project(${TARGET_NAME}) # Automatically run UIC and MOC. This replaces the older WRAP macros -SET(CMAKE_AUTOUIC ON) -SET(CMAKE_AUTOMOC ON) +SET (CMAKE_AUTOUIC ON) +SET (CMAKE_AUTOMOC ON) -setup_hifi_project(Core Widgets) -link_hifi_libraries() +setup_hifi_project (Core Widgets) +link_hifi_libraries () # FIX: Qt was built with -reduce-relocations if (Qt5_POSITION_INDEPENDENT_CODE) - SET(CMAKE_POSITION_INDEPENDENT_CODE ON) + SET (CMAKE_POSITION_INDEPENDENT_CODE ON) endif() # Qt includes -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${Qt5Core_INCLUDE_DIRS}) -include_directories(${Qt5Widgets_INCLUDE_DIRS}) +include_directories (${CMAKE_CURRENT_SOURCE_DIR}) +include_directories (${Qt5Core_INCLUDE_DIRS}) +include_directories (${Qt5Widgets_INCLUDE_DIRS}) -set(QT_LIBRARIES Qt5::Core Qt5::Widgets) - -# Find all sources files -file (GLOB_RECURSE SOURCES src/*.cpp) -file (GLOB_RECURSE HEADERS src/*.h) -file (GLOB_RECURSE UIS src/ui/*.ui) +set (QT_LIBRARIES Qt5::Core Qt5::Widgets) if (WIN32) # Do not show Console - set_property(TARGET auto-tester PROPERTY WIN32_EXECUTABLE true) + set_property (TARGET auto-tester PROPERTY WIN32_EXECUTABLE true) endif() -add_executable(PROJECT_NAME ${SOURCES} ${HEADERS} ${UIS}) +target_zlib() +add_dependency_external_projects (quazip) +find_package (QuaZip REQUIRED) +target_include_directories( ${TARGET_NAME} SYSTEM PUBLIC ${QUAZIP_INCLUDE_DIRS}) +target_link_libraries(${TARGET_NAME} ${QUAZIP_LIBRARIES}) -target_link_libraries(PROJECT_NAME ${QT_LIBRARIES}) - -# Copy required dll's. -add_custom_command(TARGET auto-tester POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ -) +package_libraries_for_deployment() if (WIN32) + add_paths_to_fixup_libs (${QUAZIP_DLL_PATH}) + find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) if (NOT WINDEPLOYQT_COMMAND) diff --git a/tools/auto-tester/src/ImageComparer.cpp b/tools/auto-tester/src/ImageComparer.cpp index 121c98e16e..94b95a5ab6 100644 --- a/tools/auto-tester/src/ImageComparer.cpp +++ b/tools/auto-tester/src/ImageComparer.cpp @@ -8,6 +8,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "ImageComparer.h" +#include "common.h" #include @@ -26,11 +27,6 @@ double ImageComparer::compareImages(QImage resultImage, QImage expectedImage) co const double c1 = pow((K1 * L), 2); const double c2 = pow((K2 * L), 2); - // Coefficients for luminosity calculation - const double R_Y = 0.212655f; - const double G_Y = 0.715158f; - const double B_Y = 0.072187f; - // First go over all full 8x8 blocks // This is done in 3 loops // 1) Read the pixels into a linear array (an optimization) @@ -116,4 +112,4 @@ double ImageComparer::compareImages(QImage resultImage, QImage expectedImage) co } return ssim / windowCounter; -}; +}; \ No newline at end of file diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 8cb36fcfca..6c637ab404 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -13,18 +13,62 @@ #include #include +#include +#include + Test::Test() { - snapshotFilenameFormat = QRegularExpression("hifi-snap-by-.+-on-\\d\\d\\d\\d-\\d\\d-\\d\\d_\\d\\d-\\d\\d-\\d\\d.jpg"); + snapshotFilenameFormat = QRegularExpression("hifi-snap-by-.*-on-\\d\\d\\d\\d-\\d\\d-\\d\\d_\\d\\d-\\d\\d-\\d\\d.jpg"); expectedImageFilenameFormat = QRegularExpression("ExpectedImage_\\d+.jpg"); mismatchWindow.setModal(true); } -bool Test::compareImageLists(QStringList expectedImages, QStringList resultImages) { +bool Test::createTestResultsFolderPathIfNeeded(QString directory) { + // The test results folder is located in the root of the tests (i.e. for recursive test evaluation) + if (testResultsFolderPath == "") { + testResultsFolderPath = directory + "/" + TEST_RESULTS_FOLDER; + QDir testResultsFolder(testResultsFolderPath); + + if (testResultsFolder.exists()) { + testResultsFolder.removeRecursively(); + } + + // Create a new test results folder + return QDir().mkdir(testResultsFolderPath); + } else { + return true; + } +} + +void Test::zipAndDeleteTestResultsFolder() { + QString zippedResultsFileName { testResultsFolderPath + ".zip" }; + QFileInfo fileInfo(zippedResultsFileName); + if (!fileInfo.exists()) { + QFile::remove(zippedResultsFileName); + } + + QDir testResultsFolder(testResultsFolderPath); + if (!testResultsFolder.isEmpty()) { + JlCompress::compressDir(testResultsFolderPath + ".zip", testResultsFolderPath); + } + + testResultsFolder.removeRecursively(); + + //In all cases, for the next evaluation + testResultsFolderPath = ""; + index = 1; +} + +bool Test::compareImageLists(QStringList expectedImages, QStringList resultImages, QString testDirectory, bool interactiveMode, QProgressBar* progressBar) { + progressBar->setMinimum(0); + progressBar->setMaximum(expectedImages.length() - 1); + progressBar->setValue(0); + progressBar->setVisible(true); + // Loop over both lists and compare each pair of images // Quit loop if user has aborted due to a failed test. - const double THRESHOLD{ 0.999 }; + const double THRESHOLD { 0.999 }; bool success{ true }; bool keepOn{ true }; for (int i = 0; keepOn && i < expectedImages.length(); ++i) { @@ -45,42 +89,107 @@ bool Test::compareImageLists(QStringList expectedImages, QStringList resultImage } if (similarityIndex < THRESHOLD) { - mismatchWindow.setTestFailure(TestFailure{ + TestFailure testFailure = TestFailure{ (float)similarityIndex, expectedImages[i].left(expectedImages[i].lastIndexOf("/") + 1), // path to the test (including trailing /) QFileInfo(expectedImages[i].toStdString().c_str()).fileName(), // filename of expected image QFileInfo(resultImages[i].toStdString().c_str()).fileName() // filename of result image - }); + }; - mismatchWindow.exec(); + mismatchWindow.setTestFailure(testFailure); - switch (mismatchWindow.getUserResponse()) { - case USER_RESPONSE_PASS: - break; - case USE_RESPONSE_FAIL: - success = false; - break; - case USER_RESPONSE_ABORT: - keepOn = false; - success = false; - break; - default: - assert(false); - break; + if (!interactiveMode) { + appendTestResultsToFile(testResultsFolderPath, testFailure, mismatchWindow.getComparisonImage()); + success = false; + } else { + mismatchWindow.exec(); + + switch (mismatchWindow.getUserResponse()) { + case USER_RESPONSE_PASS: + break; + case USE_RESPONSE_FAIL: + appendTestResultsToFile(testResultsFolderPath, testFailure, mismatchWindow.getComparisonImage()); + success = false; + break; + case USER_RESPONSE_ABORT: + keepOn = false; + success = false; + break; + default: + assert(false); + break; + } } } + + progressBar->setValue(i); } + progressBar->setVisible(false); return success; } -void Test::evaluateTests() { +void Test::appendTestResultsToFile(QString testResultsFolderPath, TestFailure testFailure, QPixmap comparisonImage) { + if (!QDir().exists(testResultsFolderPath)) { + messageBox.critical(0, "Internal error", "Folder " + testResultsFolderPath + " not found"); + exit(-1); + } + + QString failureFolderPath { testResultsFolderPath + "/" + "Failure_" + QString::number(index) }; + if (!QDir().mkdir(failureFolderPath)) { + messageBox.critical(0, "Internal error", "Failed to create folder " + failureFolderPath); + exit(-1); + } + ++index; + + QFile descriptionFile(failureFolderPath + "/" + TEST_RESULTS_FILENAME); + if (!descriptionFile.open(QIODevice::ReadWrite)) { + messageBox.critical(0, "Internal error", "Failed to create file " + TEST_RESULTS_FILENAME); + exit(-1); + } + + // Create text file describing the failure + QTextStream stream(&descriptionFile); + stream << "Test failed in folder " << testFailure._pathname.left(testFailure._pathname.length() - 1) << endl; // remove trailing '/' + stream << "Expected image was " << testFailure._expectedImageFilename << endl; + stream << "Actual image was " << testFailure._actualImageFilename << endl; + stream << "Similarity index was " << testFailure._error << endl; + + descriptionFile.close(); + + // Copy expected and actual images, and save the difference image + QString sourceFile; + QString destinationFile; + + sourceFile = testFailure._pathname + testFailure._expectedImageFilename; + destinationFile = failureFolderPath + "/" + "Expected Image.jpg"; + if (!QFile::copy(sourceFile, destinationFile)) { + messageBox.critical(0, "Internal error", "Failed to copy " + sourceFile + " to " + destinationFile); + exit(-1); + } + + sourceFile = testFailure._pathname + testFailure._actualImageFilename; + destinationFile = failureFolderPath + "/" + "Actual Image.jpg"; + if (!QFile::copy(sourceFile, destinationFile)) { + messageBox.critical(0, "Internal error", "Failed to copy " + sourceFile + " to " + destinationFile); + exit(-1); + } + + comparisonImage.save(failureFolderPath + "/" + "Difference Image.jpg"); +} + +void Test::evaluateTests(bool interactiveMode, QProgressBar* progressBar) { // Get list of JPEG images in folder, sorted by name QString pathToImageDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", ".", QFileDialog::ShowDirsOnly); if (pathToImageDirectory == "") { return; } + // Leave if test results folder could not be created + if (!createTestResultsFolderPathIfNeeded(pathToImageDirectory)) { + return; + } + QStringList sortedImageFilenames = createListOfAllJPEGimagesInDirectory(pathToImageDirectory); // Separate images into two lists. The first is the expected images, the second is the test results @@ -107,36 +216,57 @@ void Test::evaluateTests() { exit(-1); } - bool success = compareImageLists(expectedImages, resultImages); + bool success = compareImageLists(expectedImages, resultImages, pathToImageDirectory, interactiveMode, progressBar); if (success) { messageBox.information(0, "Success", "All images are as expected"); } else { messageBox.information(0, "Failure", "One or more images are not as expected"); } + + zipAndDeleteTestResultsFolder(); +} + +bool Test::isAValidDirectory(QString pathname) { + // Only process directories + QDir dir(pathname); + if (!dir.exists()) { + return false; + } + + // Ignore '.', '..' directories + if (pathname[pathname.length() - 1] == '.') { + return false; + } + + return true; } // Two criteria are used to decide if a folder contains valid test results. // 1) a 'test'js' file exists in the folder // 2) the folder has the same number of actual and expected images -void Test::evaluateTestsRecursively() { +void Test::evaluateTestsRecursively(bool interactiveMode, QProgressBar* progressBar) { // Select folder to start recursing from QString topLevelDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder that will contain the top level test script", ".", QFileDialog::ShowDirsOnly); if (topLevelDirectory == "") { return; } + // Leave if test results folder could not be created + if (!createTestResultsFolderPathIfNeeded(topLevelDirectory)) { + return; + } + bool success{ true }; QDirIterator it(topLevelDirectory.toStdString().c_str(), QDirIterator::Subdirectories); while (it.hasNext()) { QString directory = it.next(); - if (directory[directory.length() - 1] == '.') { - // ignore '.', '..' directories + + if (!isAValidDirectory(directory)) { continue; } - // - const QString testPathname{ directory + "/" + testFilename }; + const QString testPathname{ directory + "/" + TEST_FILENAME }; QFileInfo fileInfo(testPathname); if (!fileInfo.exists()) { // Folder does not contain 'test.js' @@ -164,7 +294,7 @@ void Test::evaluateTestsRecursively() { } // Set success to false if any test has failed - success &= compareImageLists(expectedImages, resultImages); + success &= compareImageLists(expectedImages, resultImages, directory, interactiveMode, progressBar); } if (success) { @@ -172,6 +302,8 @@ void Test::evaluateTestsRecursively() { } else { messageBox.information(0, "Failure", "One or more images are not as expected"); } + + zipAndDeleteTestResultsFolder(); } void Test::importTest(QTextStream& textStream, const QString& testPathname, int testNumber) { @@ -191,7 +323,8 @@ void Test::createRecursiveScript() { if (!allTestsFilename.open(QIODevice::WriteOnly | QIODevice::Text)) { messageBox.critical(0, "Internal Error", - "Failed to create \"allTests.js\" in directory \"" + topLevelDirectory + "\""); + "Failed to create \"allTests.js\" in directory \"" + topLevelDirectory + "\"" + ); exit(-1); } @@ -206,7 +339,7 @@ void Test::createRecursiveScript() { QVector testPathnames; // First test if top-level folder has a test.js file - const QString testPathname{ topLevelDirectory + "/" + testFilename }; + const QString testPathname{ topLevelDirectory + "/" + TEST_FILENAME }; QFileInfo fileInfo(testPathname); if (fileInfo.exists()) { // Current folder contains a test @@ -219,12 +352,14 @@ void Test::createRecursiveScript() { QDirIterator it(topLevelDirectory.toStdString().c_str(), QDirIterator::Subdirectories); while (it.hasNext()) { QString directory = it.next(); - if (directory[directory.length() - 1] == '.') { - // ignore '.', '..' directories + + // Only process directories + QDir dir(directory); + if (!isAValidDirectory(directory)) { continue; } - const QString testPathname{ directory + "/" + testFilename }; + const QString testPathname{ directory + "/" + TEST_FILENAME }; QFileInfo fileInfo(testPathname); if (fileInfo.exists()) { // Current folder contains a test @@ -264,7 +399,7 @@ void Test::createRecursiveScript() { // The script produced will look as follows: // if (test1HasNotStarted) { // test1HasNotStarted = false; - // test1.test(); + // test1.test("auto"); // print("******started test 1******"); // } // | @@ -287,7 +422,7 @@ void Test::createRecursiveScript() { textStream << tab << tab << "if (test" << i - 1 << ".complete && test" << i << "HasNotStarted) {" << endl; } textStream << tab << tab << tab << "test" << i << "HasNotStarted = false;" << endl; - textStream << tab << tab << tab << "test" << i << "." << testFunction << "();" << endl; + textStream << tab << tab << tab << "test" << i << "." << testFunction << "(\"auto\");" << endl; textStream << tab << tab << tab << "print(\"******started test " << i << "******\");" << endl; textStream << tab << tab << "}" << endl << endl; @@ -366,6 +501,41 @@ void Test::createTest() { messageBox.information(0, "Success", "Test images have been created"); } +void Test::deleteOldSnapshots() { + // Select folder to start recursing from + QString topLevelDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select root folder for snapshot deletion", ".", QFileDialog::ShowDirsOnly); + if (topLevelDirectory == "") { + return; + } + + // Recurse over folders + QDirIterator it(topLevelDirectory.toStdString().c_str(), QDirIterator::Subdirectories); + while (it.hasNext()) { + QString directory = it.next(); + + // Only process directories + QDir dir(directory); + if (!isAValidDirectory(directory)) { + continue; + } + + QStringList sortedImageFilenames = createListOfAllJPEGimagesInDirectory(directory); + + // Delete any file that is a snapshot (NOT the Expected Images) + QStringList expectedImages; + QStringList resultImages; + foreach(QString currentFilename, sortedImageFilenames) { + QString fullCurrentFilename = directory + "/" + currentFilename; + if (isInSnapshotFilenameFormat(currentFilename)) { + if (!QFile::remove(fullCurrentFilename)) { + messageBox.critical(0, "Error", "Could not delete existing file: " + currentFilename + "\nSnapshot deletion aborted"); + exit(-1); + } + } + } + } +} + QStringList Test::createListOfAllJPEGimagesInDirectory(QString pathToImageDirectory) { imageDirectory = QDir(pathToImageDirectory); QStringList nameFilters; @@ -374,6 +544,7 @@ QStringList Test::createListOfAllJPEGimagesInDirectory(QString pathToImageDirect return imageDirectory.entryList(nameFilters, QDir::Files, QDir::Name); } +// Use regular expressions to check if files are in specific format bool Test::isInSnapshotFilenameFormat(QString filename) { return (snapshotFilenameFormat.match(filename).hasMatch()); } diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index 1f7b1e92a7..aa1346fa2a 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -1,6 +1,5 @@ // // Test.h -// zone/ambientLightInheritence // // Created by Nissim Hadar on 2 Nov 2017. // Copyright 2013 High Fidelity, Inc. @@ -15,6 +14,7 @@ #include #include #include +#include #include "ImageComparer.h" #include "ui/MismatchWindow.h" @@ -23,10 +23,13 @@ class Test { public: Test(); - void evaluateTests(); - void evaluateTestsRecursively(); + void evaluateTests(bool interactiveMode, QProgressBar* progressBar); + void evaluateTestsRecursively(bool interactiveMode, QProgressBar* progressBar); void createRecursiveScript(); void createTest(); + void deleteOldSnapshots(); + + bool compareImageLists(QStringList expectedImages, QStringList resultImages, QString testDirectory, bool interactiveMode, QProgressBar* progressBar); QStringList createListOfAllJPEGimagesInDirectory(QString pathToImageDirectory); @@ -35,8 +38,17 @@ public: void importTest(QTextStream& textStream, const QString& testPathname, int testNumber); + void appendTestResultsToFile(QString testResultsFolderPath, TestFailure testFailure, QPixmap comparisonImage); + + bool createTestResultsFolderPathIfNeeded(QString directory); + void zipAndDeleteTestResultsFolder(); + + bool isAValidDirectory(QString pathname); + private: - const QString testFilename{ "test.js" }; + const QString TEST_FILENAME { "test.js" }; + const QString TEST_RESULTS_FOLDER { "TestResults" }; + const QString TEST_RESULTS_FILENAME { "TestResults.txt" }; QMessageBox messageBox; @@ -49,7 +61,9 @@ private: ImageComparer imageComparer; - bool compareImageLists(QStringList expectedImages, QStringList resultImages); + + QString testResultsFolderPath { "" }; + int index { 1 }; }; -#endif // hifi_test_h +#endif // hifi_test_h \ No newline at end of file diff --git a/tools/auto-tester/src/common.h b/tools/auto-tester/src/common.h index 126177358f..939814df62 100644 --- a/tools/auto-tester/src/common.h +++ b/tools/auto-tester/src/common.h @@ -34,4 +34,9 @@ enum UserResponse { USER_RESPONSE_ABORT }; -#endif // hifi_common_h +// Coefficients for luminosity calculation +const double R_Y = 0.212655f; +const double G_Y = 0.715158f; +const double B_Y = 0.072187f; + +#endif // hifi_common_h \ No newline at end of file diff --git a/tools/auto-tester/src/main.cpp b/tools/auto-tester/src/main.cpp index 6e5e06b732..45a3743482 100644 --- a/tools/auto-tester/src/main.cpp +++ b/tools/auto-tester/src/main.cpp @@ -17,4 +17,4 @@ int main(int argc, char *argv[]) { autoTester.show(); return application.exec(); -} +} \ No newline at end of file diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index 105baddb92..2834ff81e0 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -12,14 +12,18 @@ AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); + + ui.checkBoxInteractiveMode->setChecked(true); + + ui.progressBar->setVisible(false); } void AutoTester::on_evaluateTestsButton_clicked() { - test.evaluateTests(); + test.evaluateTests(ui.checkBoxInteractiveMode->isChecked(), ui.progressBar); } void AutoTester::on_evaluateTestsRecursivelyButton_clicked() { - test.evaluateTestsRecursively(); + test.evaluateTestsRecursively(ui.checkBoxInteractiveMode->isChecked(), ui.progressBar); } void AutoTester::on_createRecursiveScriptButton_clicked() { @@ -30,6 +34,10 @@ void AutoTester::on_createTestButton_clicked() { test.createTest(); } +void AutoTester::on_deleteOldSnapshotsButton_clicked() { + test.deleteOldSnapshots(); +} + void AutoTester::on_closeButton_clicked() { exit(0); } \ No newline at end of file diff --git a/tools/auto-tester/src/ui/AutoTester.h b/tools/auto-tester/src/ui/AutoTester.h index acfea32ba1..35f609a89d 100644 --- a/tools/auto-tester/src/ui/AutoTester.h +++ b/tools/auto-tester/src/ui/AutoTester.h @@ -1,6 +1,5 @@ // // AutoTester.h -// zone/ambientLightInheritence // // Created by Nissim Hadar on 2 Nov 2017. // Copyright 2013 High Fidelity, Inc. @@ -22,10 +21,11 @@ public: AutoTester(QWidget *parent = Q_NULLPTR); private slots: -void on_evaluateTestsButton_clicked(); -void on_evaluateTestsRecursivelyButton_clicked(); -void on_createRecursiveScriptButton_clicked(); + void on_evaluateTestsButton_clicked(); + void on_evaluateTestsRecursivelyButton_clicked(); + void on_createRecursiveScriptButton_clicked(); void on_createTestButton_clicked(); + void on_deleteOldSnapshotsButton_clicked(); void on_closeButton_clicked(); private: diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index 7032ef9710..d06255acf6 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -6,8 +6,8 @@ 0 0 - 286 - 470 + 607 + 395 @@ -17,9 +17,9 @@ - 60 - 360 - 160 + 190 + 300 + 220 40 @@ -30,9 +30,9 @@ - 60 - 270 - 160 + 360 + 130 + 220 40 @@ -43,9 +43,9 @@ - 60 - 20 - 160 + 20 + 75 + 220 40 @@ -56,9 +56,9 @@ - 60 - 210 - 160 + 360 + 75 + 220 40 @@ -69,9 +69,9 @@ - 60 - 75 - 160 + 20 + 130 + 220 40 @@ -79,13 +79,55 @@ Evaluate Tests Recursively + + + + 23 + 40 + 131 + 20 + + + + <html><head/><body><p>If unchecked, will not show results during evaluation</p></body></html> + + + Interactive Mode + + + + + + 20 + 190 + 255 + 23 + + + + 24 + + + + + + 360 + 240 + 220 + 40 + + + + Delete Old Snapshots + + 0 0 - 286 + 607 21 @@ -103,4 +145,4 @@ - + \ No newline at end of file diff --git a/tools/auto-tester/src/ui/MismatchWindow.cpp b/tools/auto-tester/src/ui/MismatchWindow.cpp index 07664a1667..d880a1abdc 100644 --- a/tools/auto-tester/src/ui/MismatchWindow.cpp +++ b/tools/auto-tester/src/ui/MismatchWindow.cpp @@ -11,11 +11,48 @@ #include +#include + MismatchWindow::MismatchWindow(QWidget *parent) : QDialog(parent) { setupUi(this); expectedImage->setScaledContents(true); resultImage->setScaledContents(true); + diffImage->setScaledContents(true); +} + +QPixmap MismatchWindow::computeDiffPixmap(QImage expectedImage, QImage resultImage) { + // This is an optimization, as QImage.setPixel() is embarrassingly slow + unsigned char* buffer = new unsigned char[expectedImage.height() * expectedImage.width() * 3]; + + // loop over each pixel + for (int y = 0; y < expectedImage.height(); ++y) { + for (int x = 0; x < expectedImage.width(); ++x) { + QRgb pixelP = expectedImage.pixel(QPoint(x, y)); + QRgb pixelQ = resultImage.pixel(QPoint(x, y)); + + // Convert to luminance + double p = R_Y * qRed(pixelP) + G_Y * qGreen(pixelP) + B_Y * qBlue(pixelP); + double q = R_Y * qRed(pixelQ) + G_Y * qGreen(pixelQ) + B_Y * qBlue(pixelQ); + + // The intensity value is modified to increase the brightness of the displayed image + double absoluteDifference = fabs(p - q) / 255.0; + double modifiedDifference = sqrt(absoluteDifference); + + int difference = (int)(modifiedDifference * 255.0); + + buffer[3 * (x + y * expectedImage.width()) + 0] = difference; + buffer[3 * (x + y * expectedImage.width()) + 1] = difference; + buffer[3 * (x + y * expectedImage.width()) + 2] = difference; + } + } + + QImage diffImage(buffer, expectedImage.width(), expectedImage.height(), QImage::Format_RGB888); + QPixmap resultPixmap = QPixmap::fromImage(diffImage); + + delete[] buffer; + + return resultPixmap; } void MismatchWindow::setTestFailure(TestFailure testFailure) { @@ -24,10 +61,19 @@ void MismatchWindow::setTestFailure(TestFailure testFailure) { imagePath->setText("Path to test: " + testFailure._pathname); expectedFilename->setText(testFailure._expectedImageFilename); - expectedImage->setPixmap(QPixmap(testFailure._pathname + testFailure._expectedImageFilename)); - resultFilename->setText(testFailure._actualImageFilename); - resultImage->setPixmap(QPixmap(testFailure._pathname + testFailure._actualImageFilename)); + + QPixmap expectedPixmap = QPixmap(testFailure._pathname + testFailure._expectedImageFilename); + QPixmap actualPixmap = QPixmap(testFailure._pathname + testFailure._actualImageFilename); + + diffPixmap = computeDiffPixmap( + QImage(testFailure._pathname + testFailure._expectedImageFilename), + QImage(testFailure._pathname + testFailure._actualImageFilename) + ); + + expectedImage->setPixmap(expectedPixmap); + resultImage->setPixmap(actualPixmap); + diffImage->setPixmap(diffPixmap); } void MismatchWindow::on_passTestButton_clicked() { @@ -44,3 +90,7 @@ void MismatchWindow::on_abortTestsButton_clicked() { _userResponse = USER_RESPONSE_ABORT; close(); } + +QPixmap MismatchWindow::getComparisonImage() { + return diffPixmap; +} diff --git a/tools/auto-tester/src/ui/MismatchWindow.h b/tools/auto-tester/src/ui/MismatchWindow.h index 7c72b7b0b7..cdbdcb4098 100644 --- a/tools/auto-tester/src/ui/MismatchWindow.h +++ b/tools/auto-tester/src/ui/MismatchWindow.h @@ -25,6 +25,9 @@ public: UserResponse getUserResponse() { return _userResponse; } + QPixmap computeDiffPixmap(QImage expectedImage, QImage resultImage); + QPixmap getComparisonImage(); + private slots: void on_passTestButton_clicked(); void on_failTestButton_clicked(); @@ -32,7 +35,9 @@ private slots: private: UserResponse _userResponse{ USER_RESPONSE_INVALID }; + + QPixmap diffPixmap; }; -#endif // hifi_MismatchWindow_h +#endif // hifi_MismatchWindow_h \ No newline at end of file diff --git a/tools/auto-tester/src/ui/MismatchWindow.ui b/tools/auto-tester/src/ui/MismatchWindow.ui index cab6c61e1c..72f86261ab 100644 --- a/tools/auto-tester/src/ui/MismatchWindow.ui +++ b/tools/auto-tester/src/ui/MismatchWindow.ui @@ -6,8 +6,8 @@ 0 0 - 1585 - 694 + 1782 + 942 @@ -16,10 +16,10 @@ - 20 - 170 - 720 - 362 + 10 + 25 + 800 + 450 @@ -29,28 +29,41 @@ - 760 - 170 - 720 - 362 + 900 + 25 + 800 + 450 result image + + + + 540 + 480 + 800 + 450 + + + + diff image + + - 760 - 90 - 800 + 60 + 660 + 480 28 - 16 + 12 @@ -60,15 +73,15 @@ - 40 - 90 - 700 + 60 + 630 + 480 28 - 16 + 12 @@ -78,15 +91,15 @@ - 40 - 30 + 20 + 600 1200 28 - 16 + 12 @@ -97,7 +110,7 @@ 30 - 600 + 790 75 23 @@ -109,8 +122,8 @@ - 330 - 600 + 120 + 790 75 23 @@ -122,36 +135,62 @@ - 630 - 600 - 75 + 210 + 790 + 121 23 - Abort Tests + Abort current test - 810 - 600 - 720 + 30 + 850 + 500 28 - 16 + 12 similarity + + + + 30 + 5 + 151 + 16 + + + + Expected Image + + + + + + 930 + 5 + 151 + 16 + + + + Actual Image + + - + \ No newline at end of file From 3f8865594b4370026d0c18728e7dfb80ae4cf2d8 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 11 Jan 2018 08:37:56 +0100 Subject: [PATCH 33/86] Fixed typo error that could potentially launch an assert when loading objects with blend shapes with normals but without tangents --- libraries/fbx/src/FBXReader_Mesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fbx/src/FBXReader_Mesh.cpp b/libraries/fbx/src/FBXReader_Mesh.cpp index b9549e2c4e..4b1184f875 100644 --- a/libraries/fbx/src/FBXReader_Mesh.cpp +++ b/libraries/fbx/src/FBXReader_Mesh.cpp @@ -603,7 +603,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { if (!blendShape.normals.empty() && blendShape.tangents.empty()) { // Fill with a dummy value to force tangents to be present if there are normals blendShape.tangents.reserve(blendShape.normals.size()); - std::fill_n(std::back_inserter(fbxMesh.tangents), blendShape.normals.size(), Vectors::UNIT_X); + std::fill_n(std::back_inserter(blendShape.tangents), blendShape.normals.size(), Vectors::UNIT_X); } } From d577b2e9e887b59f793c9ce1dc90cb01f43ce6e7 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 11 Jan 2018 11:45:43 -0800 Subject: [PATCH 34/86] Actually add the API calls --- .../qml/hifi/commerce/wallet/sendMoney/SendMoney.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index a7ca8e2194..b3bdbab96d 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -943,9 +943,9 @@ Item { amountTextField.focus = false; optionalMessage.focus = false; if (sendMoneyStep.referrer = "connections") { - + Commerce.transferHfcToUsername(sendMoneyStep.selectedRecipientUserName, parseInt(amountTextField.text), optionalMessage.text); } else if (sendMoneyStep.referrer = "nearby") { - + Commerce.transferHfcToNode(sendMoneyStep.selectedRecipientNodeID, parseInt(amountTextField.text), optionalMessage.text); } } } From 81ab5ac81c9afb9a1c443d8a01731ee0ba8641ef Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 11 Jan 2018 12:50:25 -0800 Subject: [PATCH 35/86] hfc_key -> public_key --- interface/src/commerce/Ledger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index 98df9e4997..1e46fb3436 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -273,7 +273,7 @@ void Ledger::certificateInfo(const QString& certificateId) { void Ledger::transferHfcToNode(const QString& hfc_key, const QString& nodeID, const int& amount, const QString& optionalMessage) { QJsonObject transaction; - transaction["hfc_key"] = hfc_key; + transaction["public_key"] = hfc_key; transaction["node_id"] = nodeID; transaction["quantity"] = amount; transaction["message"] = optionalMessage; @@ -284,7 +284,7 @@ void Ledger::transferHfcToNode(const QString& hfc_key, const QString& nodeID, co void Ledger::transferHfcToUsername(const QString& hfc_key, const QString& username, const int& amount, const QString& optionalMessage) { QJsonObject transaction; - transaction["hfc_key"] = hfc_key; + transaction["public_key"] = hfc_key; transaction["username"] = username; transaction["quantity"] = amount; transaction["message"] = optionalMessage; From df58065e757d6d8e3463e5f959e1a77dca14c487 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 11 Jan 2018 13:02:00 -0800 Subject: [PATCH 36/86] Silly bug --- .../resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 851e8903bc..9e21cb7289 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -39,7 +39,8 @@ Item { // able to click on a button/mouseArea underneath the popup/section. MouseArea { x: 0; - y: root.isCurrentlyFullScreen ? root.parentAppTitleBarHeight : 0; + y: root.isCurrentlyFullScreen ? 0 : root.parentAppTitleBarHeight; + width: parent.width; height: root.isCurrentlyFullScreen ? parent.height : parent.height - root.parentAppTitleBarHeight - root.parentAppNavBarHeight; propagateComposedEvents: false; } From 1e608b13b2b869aeedb7d7cc2efe84faa44f1495 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 11 Jan 2018 14:45:43 -0800 Subject: [PATCH 37/86] Show username when admin (this probably isn't the way to get username --- .../qml/hifi/commerce/wallet/Wallet.qml | 1 + .../wallet/sendMoney/ConnectionItem.qml | 2 +- .../commerce/wallet/sendMoney/SendMoney.qml | 162 ++++++++++++++---- libraries/avatars/src/AvatarData.h | 3 +- libraries/avatars/src/ScriptAvatarData.cpp | 1 + libraries/avatars/src/ScriptAvatarData.h | 3 +- scripts/system/commerce/wallet.js | 35 +++- scripts/system/pal.js | 4 +- 8 files changed, 169 insertions(+), 42 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index 5340f0e202..6b350f9f93 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -736,6 +736,7 @@ Rectangle { sendMoney.updateConnections(message.connections); break; case 'selectRecipient': + case 'updateSelectedRecipientUsername': sendMoney.fromScript(message); break; default: diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml index 80c87e307b..84d6b304f6 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml @@ -114,7 +114,7 @@ Item { width: 110; text: "CHOOSE"; onClicked: { - var msg = { method: 'chooseConnection', userName: root.userName }; + var msg = { method: 'chooseConnection', userName: root.userName, profilePicUrl: root.profilePicUrl }; sendToSendMoney(msg); } } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 9e21cb7289..0d948bbe4b 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -14,6 +14,7 @@ import Hifi 1.0 as Hifi import QtQuick 2.6 import QtQuick.Controls 2.2 +import QtGraphicalEffects 1.0 import "../../../../styles-uit" import "../../../../controls-uit" as HifiControlsUit import "../../../../controls" as HifiControls @@ -440,6 +441,7 @@ Item { sendMoneyStep.selectedRecipientNodeID = ''; sendMoneyStep.selectedRecipientDisplayName = msg.userName; sendMoneyStep.selectedRecipientUserName = 'connection'; + sendMoneyStep.selectedRecipientProfilePic = msg.profilePicUrl; root.nextActiveView = "sendMoneyStep"; } @@ -561,8 +563,8 @@ Item { } RalewaySemiBold { - id: avatarNodeID; - text: chooseRecipientNearby.selectedRecipient; + id: avatarDisplayName; + text: '"' + AvatarList.getAvatar(chooseRecipientNearby.selectedRecipient).sessionDisplayName + '"'; // Anchors anchors.top: sendToText.bottom; anchors.topMargin: 60; @@ -572,7 +574,43 @@ Item { anchors.rightMargin: 30; height: paintedHeight; // Text size - size: 18; + size: 22; + // Style + horizontalAlignment: Text.AlignHCenter; + color: hifi.colors.baseGray; + } + + RalewaySemiBold { + id: avatarNodeID; + text: chooseRecipientNearby.selectedRecipient; + // Anchors + anchors.top: avatarDisplayName.bottom; + anchors.topMargin: 6; + anchors.left: parent.left; + anchors.leftMargin: 30; + anchors.right: parent.right; + anchors.rightMargin: 30; + height: paintedHeight; + // Text size + size: 14; + // Style + horizontalAlignment: Text.AlignHCenter; + color: hifi.colors.lightGrayText; + } + + RalewaySemiBold { + id: avatarUserName; + text: sendMoneyStep.selectedRecipientUserName; + // Anchors + anchors.top: avatarNodeID.bottom; + anchors.topMargin: 12; + anchors.left: parent.left; + anchors.leftMargin: 30; + anchors.right: parent.right; + anchors.rightMargin: 30; + height: paintedHeight; + // Text size + size: 22; // Style horizontalAlignment: Text.AlignHCenter; color: hifi.colors.baseGray; @@ -632,8 +670,6 @@ Item { onClicked: { sendMoneyStep.referrer = "nearby"; sendMoneyStep.selectedRecipientNodeID = chooseRecipientNearby.selectedRecipient; - sendMoneyStep.selectedRecipientDisplayName = '"ZRF Changeme"'; - sendMoneyStep.selectedRecipientUserName = 'unknown username'; chooseRecipientNearby.selectedRecipient = ""; root.nextActiveView = "sendMoneyStep"; @@ -652,6 +688,7 @@ Item { property string selectedRecipientNodeID; property string selectedRecipientDisplayName; property string selectedRecipientUserName; + property string selectedRecipientProfilePic; visible: root.currentActiveView === "sendMoneyStep"; anchors.fill: parent; @@ -703,37 +740,94 @@ Item { verticalAlignment: Text.AlignVCenter; } - RalewaySemiBold { - id: recipientDisplayName; - text: sendMoneyStep.selectedRecipientDisplayName; - // Anchors + Item { + id: recipientIsNearby; + visible: sendMoneyStep.referrer === "nearby"; anchors.top: parent.top; anchors.left: sendToText_sendMoneyStep.right; anchors.right: changeButton.left; anchors.rightMargin: 12; - height: parent.height/2; - // Text size - size: 18; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignBottom; + height: parent.height; + + RalewaySemiBold { + id: recipientDisplayName; + text: sendMoneyStep.selectedRecipientDisplayName; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.right: parent.right; + anchors.rightMargin: 12; + height: parent.height/2; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignBottom; + } + + RalewaySemiBold { + text: sendMoneyStep.selectedRecipientUserName; + // Anchors + anchors.bottom: parent.bottom; + anchors.left: recipientDisplayName.anchors.left; + anchors.leftMargin: recipientDisplayName.anchors.leftMargin; + anchors.right: recipientDisplayName.anchors.right; + anchors.rightMargin: recipientDisplayName.anchors.rightMargin; + height: parent.height/2; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + } } - RalewaySemiBold { - id: recipientUsername; - text: sendMoneyStep.selectedRecipientUserName; - // Anchors - anchors.bottom: parent.bottom; - anchors.left: recipientDisplayName.anchors.left; - anchors.leftMargin: recipientDisplayName.anchors.leftMargin; - anchors.right: recipientDisplayName.anchors.right; - anchors.rightMargin: recipientDisplayName.anchors.rightMargin; - height: parent.height/2; - // Text size - size: 16; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignTop; + Item { + id: recipientIsConnection; + visible: sendMoneyStep.referrer === "connections"; + anchors.top: parent.top; + anchors.left: sendToText_sendMoneyStep.right; + anchors.right: changeButton.left; + anchors.rightMargin: 12; + height: parent.height; + + Image { + id: userImage; + source: sendMoneyStep.selectedRecipientProfilePic !== "" ? ((0 === sendMoneyStep.selectedRecipientProfilePic.indexOf("http")) ? + sendMoneyStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendMoneyStep.selectedRecipientProfilePic)) : ""; + mipmap: true; + // Anchors + anchors.left: parent.left; + anchors.verticalCenter: parent.verticalCenter; + height: parent.height - 4; + layer.enabled: true; + layer.effect: OpacityMask { + maskSource: Item { + width: userImage.width; + height: userImage.height; + Rectangle { + anchors.centerIn: parent; + width: userImage.width; // This works because userImage is square + height: width; + radius: width; + } + } + } + } + + RalewaySemiBold { + text: sendMoneyStep.selectedRecipientUserName; + // Anchors + anchors.left: userImage.right; + anchors.leftMargin: 8; + anchors.verticalCenter: parent.verticalCenter; + height: parent.height - 4; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + } } // "CHANGE" button @@ -1472,6 +1566,7 @@ Item { sendMoneyStep.selectedRecipientNodeID = ""; sendMoneyStep.selectedRecipientDisplayName = ""; sendMoneyStep.selectedRecipientUserName = ""; + sendMoneyStep.selectedRecipientProfilePic = ""; amountTextField.text = ""; optionalMessage.text = ""; } @@ -1494,10 +1589,17 @@ Item { case 'selectRecipient': if (message.isSelected) { chooseRecipientNearby.selectedRecipient = message.id[0]; + sendMoneyStep.selectedRecipientDisplayName = message.displayName; + sendMoneyStep.selectedRecipientUserName = message.userName; } else { chooseRecipientNearby.selectedRecipient = ""; + sendMoneyStep.selectedRecipientDisplayName = ''; + sendMoneyStep.selectedRecipientUserName = ''; } break; + case 'updateSelectedRecipientUsername': + sendMoneyStep.selectedRecipientUserName = message.userName; + break; default: console.log('SendMoney: Unrecognized message from wallet.js:', JSON.stringify(message)); } diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index d7dd2837cb..00cc760658 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -358,7 +358,7 @@ class AvatarData : public QObject, public SpatiallyNestable { Q_PROPERTY(QString displayName READ getDisplayName WRITE setDisplayName NOTIFY displayNameChanged) // sessionDisplayName is sanitized, defaulted version displayName that is defined by the AvatarMixer rather than by Interface clients. // The result is unique among all avatars present at the time. - Q_PROPERTY(QString sessionDisplayName READ getSessionDisplayName WRITE setSessionDisplayName) + Q_PROPERTY(QString sessionDisplayName READ getSessionDisplayName WRITE setSessionDisplayName NOTIFY sessionDisplayNameChanged) Q_PROPERTY(bool lookAtSnappingEnabled MEMBER _lookAtSnappingEnabled NOTIFY lookAtSnappingChanged) Q_PROPERTY(QString skeletonModelURL READ getSkeletonModelURLFromScript WRITE setSkeletonModelURLFromScript) Q_PROPERTY(QVector attachmentData READ getAttachmentData WRITE setAttachmentData) @@ -685,6 +685,7 @@ public: signals: void displayNameChanged(); + void sessionDisplayNameChanged(); void lookAtSnappingChanged(bool enabled); void sessionUUIDChanged(); diff --git a/libraries/avatars/src/ScriptAvatarData.cpp b/libraries/avatars/src/ScriptAvatarData.cpp index 64cd534c8b..1fd001e536 100644 --- a/libraries/avatars/src/ScriptAvatarData.cpp +++ b/libraries/avatars/src/ScriptAvatarData.cpp @@ -15,6 +15,7 @@ ScriptAvatarData::ScriptAvatarData(AvatarSharedPointer avatarData) : _avatarData(avatarData) { QObject::connect(avatarData.get(), &AvatarData::displayNameChanged, this, &ScriptAvatarData::displayNameChanged); + QObject::connect(avatarData.get(), &AvatarData::sessionDisplayNameChanged, this, &ScriptAvatarData::sessionDisplayNameChanged); QObject::connect(avatarData.get(), &AvatarData::lookAtSnappingChanged, this, &ScriptAvatarData::lookAtSnappingChanged); } diff --git a/libraries/avatars/src/ScriptAvatarData.h b/libraries/avatars/src/ScriptAvatarData.h index 46dfb5325f..68074b838d 100644 --- a/libraries/avatars/src/ScriptAvatarData.h +++ b/libraries/avatars/src/ScriptAvatarData.h @@ -44,7 +44,7 @@ class ScriptAvatarData : public QObject { // Q_PROPERTY(QUuid sessionUUID READ getSessionUUID) Q_PROPERTY(QString displayName READ getDisplayName NOTIFY displayNameChanged) - Q_PROPERTY(QString sessionDisplayName READ getSessionDisplayName) + Q_PROPERTY(QString sessionDisplayName READ getSessionDisplayName NOTIFY sessionDisplayNameChanged) Q_PROPERTY(bool isReplicated READ getIsReplicated) Q_PROPERTY(bool lookAtSnappingEnabled READ getLookAtSnappingEnabled NOTIFY lookAtSnappingChanged) @@ -131,6 +131,7 @@ public: signals: void displayNameChanged(); + void sessionDisplayNameChanged(); void lookAtSnappingChanged(bool enabled); public slots: diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index e8156ae5fc..0826325a57 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -390,13 +390,32 @@ // // Clicks. // + function usernameFromIDReply(id, username, machineFingerprint, isAdmin) { + if (selectedIds[0] === id) { + var message = { + method: 'updateSelectedRecipientUsername', + userName: username === "" ? "unknown username" : username + }; + sendToQml(message); + } + } function handleClick(pickRay) { ExtendedOverlay.applyPickRay(pickRay, function (overlay) { var nextSelectedStatus = !overlay.selected; - var message = { method: 'selectRecipient', id: [overlay.key], isSelected: nextSelectedStatus }; + var avatarId = overlay.key; + selectedIds = nextSelectedStatus ? [avatarId] : []; + if (nextSelectedStatus) { + Users.requestUsernameFromID(avatarId); + } + var message = { + method: 'selectRecipient', + id: [avatarId], + isSelected: nextSelectedStatus, + displayName: '"' + AvatarList.getAvatar(avatarId).sessionDisplayName + '"', + userName: '' + }; sendToQml(message); - - selectedIds = nextSelectedStatus ? [overlay.key] : []; + ExtendedOverlay.some(function (overlay) { var id = overlay.key; var selected = ExtendedOverlay.isSelected(id); @@ -625,6 +644,11 @@ if (onWalletScreen) { isWired = true; + Users.usernameFromIDReply.connect(usernameFromIDReply); + Controller.mousePressEvent.connect(handleMouseEvent); + Controller.mouseMoveEvent.connect(handleMouseMoveEvent); + triggerMapping.enable(); + triggerPressMapping.enable(); } else { off(); } @@ -648,15 +672,12 @@ }); button.clicked.connect(onButtonClicked); tablet.screenChanged.connect(onTabletScreenChanged); - Controller.mousePressEvent.connect(handleMouseEvent); - Controller.mouseMoveEvent.connect(handleMouseMoveEvent); - triggerMapping.enable(); - triggerPressMapping.enable(); } } var isWired = false; function off() { if (isWired) { // It is not ok to disconnect these twice, hence guard. + Users.usernameFromIDReply.disconnect(usernameFromIDReply); Script.update.disconnect(updateOverlays); Controller.mousePressEvent.disconnect(handleMouseEvent); Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); diff --git a/scripts/system/pal.js b/scripts/system/pal.js index ed7059f9f3..1b93bdde32 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -685,7 +685,6 @@ function startup() { }); button.clicked.connect(onTabletButtonClicked); tablet.screenChanged.connect(onTabletScreenChanged); - Users.usernameFromIDReply.connect(usernameFromIDReply); Window.domainChanged.connect(clearLocalQMLDataAndClosePAL); Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL); Messages.subscribe(CHANNEL); @@ -708,6 +707,7 @@ function off() { Controller.mousePressEvent.disconnect(handleMouseEvent); Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); tablet.tabletShownChanged.disconnect(tabletVisibilityChanged); + Users.usernameFromIDReply.disconnect(usernameFromIDReply); isWired = false; ContextOverlay.enabled = true } @@ -744,6 +744,7 @@ function onTabletButtonClicked() { Script.update.connect(updateOverlays); Controller.mousePressEvent.connect(handleMouseEvent); Controller.mouseMoveEvent.connect(handleMouseMoveEvent); + Users.usernameFromIDReply.connect(usernameFromIDReply); triggerMapping.enable(); triggerPressMapping.enable(); audioTimer = createAudioInterval(conserveResources ? AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS : AUDIO_LEVEL_UPDATE_INTERVAL_MS); @@ -890,7 +891,6 @@ function shutdown() { button.clicked.disconnect(onTabletButtonClicked); tablet.removeButton(button); tablet.screenChanged.disconnect(onTabletScreenChanged); - Users.usernameFromIDReply.disconnect(usernameFromIDReply); Window.domainChanged.disconnect(clearLocalQMLDataAndClosePAL); Window.domainConnectionRefused.disconnect(clearLocalQMLDataAndClosePAL); Messages.subscribe(CHANNEL); From 9b0fb19cfa54e93e568a79216a534938dde0d394 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 12 Jan 2018 12:16:58 +1300 Subject: [PATCH 38/86] Remove unused "anchor" Overlays property --- interface/src/ui/overlays/Circle3DOverlay.cpp | 2 -- interface/src/ui/overlays/Cube3DOverlay.cpp | 2 -- interface/src/ui/overlays/Grid3DOverlay.cpp | 2 -- interface/src/ui/overlays/Image3DOverlay.cpp | 2 -- interface/src/ui/overlays/Line3DOverlay.cpp | 2 -- interface/src/ui/overlays/ModelOverlay.cpp | 2 -- interface/src/ui/overlays/Overlay.cpp | 18 ++---------------- interface/src/ui/overlays/Overlay.h | 8 -------- interface/src/ui/overlays/OverlaysPayload.cpp | 18 +----------------- .../src/ui/overlays/Rectangle3DOverlay.cpp | 2 -- interface/src/ui/overlays/Shape3DOverlay.cpp | 2 -- interface/src/ui/overlays/Sphere3DOverlay.cpp | 2 -- interface/src/ui/overlays/Text3DOverlay.cpp | 2 -- interface/src/ui/overlays/Web3DOverlay.cpp | 2 -- 14 files changed, 3 insertions(+), 63 deletions(-) diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp index a7c586df1f..5e38f28a06 100644 --- a/interface/src/ui/overlays/Circle3DOverlay.cpp +++ b/interface/src/ui/overlays/Circle3DOverlay.cpp @@ -386,8 +386,6 @@ void Circle3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Cube3DOverlay.cpp b/interface/src/ui/overlays/Cube3DOverlay.cpp index c3a772e565..f13f782482 100644 --- a/interface/src/ui/overlays/Cube3DOverlay.cpp +++ b/interface/src/ui/overlays/Cube3DOverlay.cpp @@ -154,8 +154,6 @@ void Cube3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Grid3DOverlay.cpp b/interface/src/ui/overlays/Grid3DOverlay.cpp index 679a4afbd2..621c19944b 100644 --- a/interface/src/ui/overlays/Grid3DOverlay.cpp +++ b/interface/src/ui/overlays/Grid3DOverlay.cpp @@ -132,8 +132,6 @@ void Grid3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Image3DOverlay.cpp b/interface/src/ui/overlays/Image3DOverlay.cpp index ca7af3a08b..df93245922 100644 --- a/interface/src/ui/overlays/Image3DOverlay.cpp +++ b/interface/src/ui/overlays/Image3DOverlay.cpp @@ -208,8 +208,6 @@ void Image3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Line3DOverlay.cpp b/interface/src/ui/overlays/Line3DOverlay.cpp index a8425d482f..7200abf74e 100644 --- a/interface/src/ui/overlays/Line3DOverlay.cpp +++ b/interface/src/ui/overlays/Line3DOverlay.cpp @@ -275,8 +275,6 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index ec586771af..d29ee93e62 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -306,8 +306,6 @@ vectorType ModelOverlay::mapJoints(mapFunction function) const { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Overlay.cpp b/interface/src/ui/overlays/Overlay.cpp index 5cf9fc7c8b..3c952b8338 100644 --- a/interface/src/ui/overlays/Overlay.cpp +++ b/interface/src/ui/overlays/Overlay.cpp @@ -31,8 +31,7 @@ Overlay::Overlay() : _alphaPulse(0.0f), _colorPulse(0.0f), _color(DEFAULT_OVERLAY_COLOR), - _visible(true), - _anchor(NO_ANCHOR) + _visible(true) { } @@ -49,8 +48,7 @@ Overlay::Overlay(const Overlay* overlay) : _alphaPulse(overlay->_alphaPulse), _colorPulse(overlay->_colorPulse), _color(overlay->_color), - _visible(overlay->_visible), - _anchor(overlay->_anchor) + _visible(overlay->_visible) { } @@ -92,13 +90,6 @@ void Overlay::setProperties(const QVariantMap& properties) { bool visible = properties["visible"].toBool(); setVisible(visible); } - - if (properties["anchor"].isValid()) { - QString property = properties["anchor"].toString(); - if (property == "MyAvatar") { - setAnchor(MY_AVATAR); - } - } } // JSDoc for copying to @typedefs of overlay types that inherit Overlay. @@ -119,8 +110,6 @@ void Overlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. */ QVariant Overlay::getProperty(const QString& property) { if (property == "type") { @@ -150,9 +139,6 @@ QVariant Overlay::getProperty(const QString& property) { if (property == "visible") { return _visible; } - if (property == "anchor") { - return _anchor == MY_AVATAR ? "MyAvatar" : ""; - } return QVariant(); } diff --git a/interface/src/ui/overlays/Overlay.h b/interface/src/ui/overlays/Overlay.h index 9b07f24600..e9271f3c3f 100644 --- a/interface/src/ui/overlays/Overlay.h +++ b/interface/src/ui/overlays/Overlay.h @@ -26,11 +26,6 @@ class Overlay : public QObject { Q_OBJECT public: - enum Anchor { - NO_ANCHOR, - MY_AVATAR - }; - typedef std::shared_ptr Pointer; typedef render::Payload Payload; typedef std::shared_ptr PayloadPointer; @@ -63,7 +58,6 @@ public: virtual bool isTransparent() { return getAlphaPulse() != 0.0f || getAlpha() != 1.0f; }; xColor getColor(); float getAlpha(); - Anchor getAnchor() const { return _anchor; } float getPulseMax() const { return _pulseMax; } float getPulseMin() const { return _pulseMin; } @@ -78,7 +72,6 @@ public: void setDrawHUDLayer(bool drawHUDLayer); void setColor(const xColor& color) { _color = color; } void setAlpha(float alpha) { _alpha = alpha; } - void setAnchor(Anchor anchor) { _anchor = anchor; } void setPulseMax(float value) { _pulseMax = value; } void setPulseMin(float value) { _pulseMin = value; } @@ -118,7 +111,6 @@ protected: xColor _color; bool _visible; // should the overlay be drawn at all - Anchor _anchor; unsigned int _stackOrder { 0 }; diff --git a/interface/src/ui/overlays/OverlaysPayload.cpp b/interface/src/ui/overlays/OverlaysPayload.cpp index fceb261503..449ac62998 100644 --- a/interface/src/ui/overlays/OverlaysPayload.cpp +++ b/interface/src/ui/overlays/OverlaysPayload.cpp @@ -65,23 +65,7 @@ namespace render { } template <> void payloadRender(const Overlay::Pointer& overlay, RenderArgs* args) { if (args) { - if (overlay->getAnchor() == Overlay::MY_AVATAR) { - auto batch = args->_batch; - auto avatar = DependencyManager::get()->getMyAvatar(); - glm::quat myAvatarRotation = avatar->getWorldOrientation(); - glm::vec3 myAvatarPosition = avatar->getWorldPosition(); - float angle = glm::degrees(glm::angle(myAvatarRotation)); - glm::vec3 axis = glm::axis(myAvatarRotation); - float myAvatarScale = avatar->getModelScale(); - Transform transform = Transform(); - transform.setTranslation(myAvatarPosition); - transform.setRotation(glm::angleAxis(angle, axis)); - transform.setScale(myAvatarScale); - batch->setModelTransform(transform); - overlay->render(args); - } else { - overlay->render(args); - } + overlay->render(args); } } template <> const ShapeKey shapeGetShapeKey(const Overlay::Pointer& overlay) { diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.cpp b/interface/src/ui/overlays/Rectangle3DOverlay.cpp index c535b7e503..e765f3fc18 100644 --- a/interface/src/ui/overlays/Rectangle3DOverlay.cpp +++ b/interface/src/ui/overlays/Rectangle3DOverlay.cpp @@ -127,8 +127,6 @@ const render::ShapeKey Rectangle3DOverlay::getShapeKey() { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Shape3DOverlay.cpp b/interface/src/ui/overlays/Shape3DOverlay.cpp index 1ae0dc6fd3..97342a80ab 100644 --- a/interface/src/ui/overlays/Shape3DOverlay.cpp +++ b/interface/src/ui/overlays/Shape3DOverlay.cpp @@ -128,8 +128,6 @@ void Shape3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Sphere3DOverlay.cpp b/interface/src/ui/overlays/Sphere3DOverlay.cpp index 137d273c7d..3021aa4404 100644 --- a/interface/src/ui/overlays/Sphere3DOverlay.cpp +++ b/interface/src/ui/overlays/Sphere3DOverlay.cpp @@ -47,8 +47,6 @@ Sphere3DOverlay::Sphere3DOverlay(const Sphere3DOverlay* Sphere3DOverlay) : * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Text3DOverlay.cpp b/interface/src/ui/overlays/Text3DOverlay.cpp index f036516f1e..bed20be698 100644 --- a/interface/src/ui/overlays/Text3DOverlay.cpp +++ b/interface/src/ui/overlays/Text3DOverlay.cpp @@ -224,8 +224,6 @@ void Text3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 96b68f5ae0..7c9bd120ab 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -482,8 +482,6 @@ void Web3DOverlay::setProperties(const QVariantMap& properties) { * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {boolean} visible=true - If true, the overlay is rendered, otherwise it is not rendered. - * @property {string} anchor="" - If set to "MyAvatar" then the overlay is attached to your avatar, moving and - * rotating as you move your avatar. * * @property {string} name="" - A friendly name for the overlay. * @property {Vec3} position - The position of the overlay center. Synonyms: p1, point, and From 464bbe5d438496b971421cf5d080a19efbdd14a2 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 11 Jan 2018 15:26:51 -0800 Subject: [PATCH 39/86] Bugfixes, refactoring, and improvements --- .../wallet/sendMoney/RecipientDisplay.qml | 118 +++++++++++ .../commerce/wallet/sendMoney/SendMoney.qml | 188 ++++-------------- 2 files changed, 159 insertions(+), 147 deletions(-) create mode 100644 interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml new file mode 100644 index 0000000000..f9613bea92 --- /dev/null +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml @@ -0,0 +1,118 @@ +// +// RecipientDisplay.qml +// qml/hifi/commerce/wallet/sendMoney +// +// RecipientDisplay +// +// Created by Zach Fox on 2018-01-11 +// 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 +// + +import Hifi 1.0 as Hifi +import QtQuick 2.6 +import QtQuick.Controls 2.2 +import QtGraphicalEffects 1.0 +import "../../../../styles-uit" +import "../../../../controls-uit" as HifiControlsUit +import "../../../../controls" as HifiControls +import "../../common" as HifiCommerceCommon + +// references XXX from root context + +Item { + HifiConstants { id: hifi; } + + id: root; + + property bool isDisplayingNearby; // as opposed to 'connections' + property string displayName; + property string userName; + property string profilePic; + + Item { + visible: root.isDisplayingNearby; + anchors.fill: parent; + + RalewaySemiBold { + id: recipientDisplayName; + text: root.displayName; + // Anchors + anchors.top: parent.top; + anchors.left: parent.left; + anchors.right: parent.right; + anchors.rightMargin: 12; + height: parent.height/2; + // Text size + size: 18; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignBottom; + elide: Text.ElideRight; + } + + RalewaySemiBold { + text: root.userName; + // Anchors + anchors.bottom: parent.bottom; + anchors.left: recipientDisplayName.anchors.left; + anchors.leftMargin: recipientDisplayName.anchors.leftMargin; + anchors.right: recipientDisplayName.anchors.right; + anchors.rightMargin: recipientDisplayName.anchors.rightMargin; + height: parent.height/2; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignTop; + elide: Text.ElideRight; + } + } + + Item { + visible: !root.isDisplayingNearby; + anchors.fill: parent; + + Image { + id: userImage; + source: root.profilePic; + mipmap: true; + // Anchors + anchors.left: parent.left; + anchors.verticalCenter: parent.verticalCenter; + height: parent.height - 36; + width: height; + layer.enabled: true; + layer.effect: OpacityMask { + maskSource: Item { + width: userImage.width; + height: userImage.height; + Rectangle { + anchors.centerIn: parent; + width: userImage.width; // This works because userImage is square + height: width; + radius: width; + } + } + } + } + + RalewaySemiBold { + text: root.userName; + // Anchors + anchors.left: userImage.right; + anchors.leftMargin: 8; + anchors.right: parent.right; + anchors.verticalCenter: parent.verticalCenter; + height: parent.height - 4; + // Text size + size: 16; + // Style + color: hifi.colors.baseGray; + verticalAlignment: Text.AlignVCenter; + elide: Text.ElideRight; + } + } +} diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 0d948bbe4b..9812de057f 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -87,22 +87,21 @@ Item { } onNextActiveViewChanged: { + if (root.currentActiveView === 'chooseRecipientNearby') { + sendSignalToWallet({method: 'disable_ChooseRecipientNearbyMode'}); + } + root.currentActiveView = root.nextActiveView; - if (root.currentActiveView === 'chooseRecipientConnection') { + + if (root.nextActiveView === 'chooseRecipientConnection') { // Refresh connections model connectionsLoading.visible = false; connectionsLoading.visible = true; sendSignalToWallet({method: 'refreshConnections'}); - } - - if (root.currentActiveView === 'chooseRecipientNearby') { - sendSignalToWallet({method: 'enable_ChooseRecipientNearbyMode'}); - } else { - sendSignalToWallet({method: 'disable_ChooseRecipientNearbyMode'}); - } - - if (root.currentActiveView === 'sendMoneyHome') { + } else if (root.nextActiveView === 'sendMoneyHome') { Commerce.balance(); + } else if (root.nextActiveView === 'chooseRecipientNearby') { + sendSignalToWallet({method: 'enable_ChooseRecipientNearbyMode'}); } } @@ -439,8 +438,8 @@ Item { onSendToSendMoney: { sendMoneyStep.referrer = "connections"; sendMoneyStep.selectedRecipientNodeID = ''; - sendMoneyStep.selectedRecipientDisplayName = msg.userName; - sendMoneyStep.selectedRecipientUserName = 'connection'; + sendMoneyStep.selectedRecipientDisplayName = 'connection'; + sendMoneyStep.selectedRecipientUserName = msg.userName; sendMoneyStep.selectedRecipientProfilePic = msg.profilePicUrl; root.nextActiveView = "sendMoneyStep"; @@ -740,94 +739,18 @@ Item { verticalAlignment: Text.AlignVCenter; } - Item { - id: recipientIsNearby; - visible: sendMoneyStep.referrer === "nearby"; + RecipientDisplay { anchors.top: parent.top; anchors.left: sendToText_sendMoneyStep.right; anchors.right: changeButton.left; anchors.rightMargin: 12; height: parent.height; - RalewaySemiBold { - id: recipientDisplayName; - text: sendMoneyStep.selectedRecipientDisplayName; - // Anchors - anchors.top: parent.top; - anchors.left: parent.left; - anchors.right: parent.right; - anchors.rightMargin: 12; - height: parent.height/2; - // Text size - size: 18; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignBottom; - } - - RalewaySemiBold { - text: sendMoneyStep.selectedRecipientUserName; - // Anchors - anchors.bottom: parent.bottom; - anchors.left: recipientDisplayName.anchors.left; - anchors.leftMargin: recipientDisplayName.anchors.leftMargin; - anchors.right: recipientDisplayName.anchors.right; - anchors.rightMargin: recipientDisplayName.anchors.rightMargin; - height: parent.height/2; - // Text size - size: 16; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignTop; - } - } - - Item { - id: recipientIsConnection; - visible: sendMoneyStep.referrer === "connections"; - anchors.top: parent.top; - anchors.left: sendToText_sendMoneyStep.right; - anchors.right: changeButton.left; - anchors.rightMargin: 12; - height: parent.height; - - Image { - id: userImage; - source: sendMoneyStep.selectedRecipientProfilePic !== "" ? ((0 === sendMoneyStep.selectedRecipientProfilePic.indexOf("http")) ? - sendMoneyStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendMoneyStep.selectedRecipientProfilePic)) : ""; - mipmap: true; - // Anchors - anchors.left: parent.left; - anchors.verticalCenter: parent.verticalCenter; - height: parent.height - 4; - layer.enabled: true; - layer.effect: OpacityMask { - maskSource: Item { - width: userImage.width; - height: userImage.height; - Rectangle { - anchors.centerIn: parent; - width: userImage.width; // This works because userImage is square - height: width; - radius: width; - } - } - } - } - - RalewaySemiBold { - text: sendMoneyStep.selectedRecipientUserName; - // Anchors - anchors.left: userImage.right; - anchors.leftMargin: 8; - anchors.verticalCenter: parent.verticalCenter; - height: parent.height - 4; - // Text size - size: 16; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignVCenter; - } + displayName: sendMoneyStep.selectedRecipientDisplayName; + userName: sendMoneyStep.selectedRecipientUserName; + profilePic: sendMoneyStep.selectedRecipientProfilePic !== "" ? ((0 === sendMoneyStep.selectedRecipientProfilePic.indexOf("http")) ? + sendMoneyStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendMoneyStep.selectedRecipientProfilePic)) : ""; + isDisplayingNearby: sendMoneyStep.referrer === "nearby"; } // "CHANGE" button @@ -1031,6 +954,10 @@ Item { amountTextField.focus = true; amountTextField.error = true; amountTextFieldError.text = "amount exceeds available funds"; + } else if (amountTextField.text === "" || parseInt(amountTextField.text) < 1) { + amountTextField.focus = true; + amountTextField.error = true; + amountTextFieldError.text = "invalid amount"; } else { amountTextFieldError.text = ""; amountTextField.error = false; @@ -1171,36 +1098,17 @@ Item { verticalAlignment: Text.AlignVCenter; } - RalewaySemiBold { - id: recipientDisplayName_paymentSuccess; - text: sendMoneyStep.selectedRecipientDisplayName; - // Anchors + RecipientDisplay { anchors.top: parent.top; anchors.left: sendToText_paymentSuccess.right; anchors.right: parent.right; - height: parent.height/2; - // Text size - size: 18; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignBottom; - } + height: parent.height; - RalewaySemiBold { - id: recipientUsername_paymentSuccess; - text: sendMoneyStep.selectedRecipientUserName; - // Anchors - anchors.bottom: parent.bottom; - anchors.left: recipientDisplayName_paymentSuccess.anchors.left; - anchors.leftMargin: recipientDisplayName_paymentSuccess.anchors.leftMargin; - anchors.right: recipientDisplayName_paymentSuccess.anchors.right; - anchors.rightMargin: recipientDisplayName_paymentSuccess.anchors.rightMargin; - height: parent.height/2; - // Text size - size: 16; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignTop; + displayName: sendMoneyStep.selectedRecipientDisplayName; + userName: sendMoneyStep.selectedRecipientUserName; + profilePic: sendMoneyStep.selectedRecipientProfilePic !== "" ? ((0 === sendMoneyStep.selectedRecipientProfilePic.indexOf("http")) ? + sendMoneyStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendMoneyStep.selectedRecipientProfilePic)) : ""; + isDisplayingNearby: sendMoneyStep.referrer === "nearby"; } } @@ -1393,36 +1301,17 @@ Item { verticalAlignment: Text.AlignVCenter; } - RalewaySemiBold { - id: recipientDisplayName_paymentFailure; - text: sendMoneyStep.selectedRecipientDisplayName; - // Anchors + RecipientDisplay { anchors.top: parent.top; anchors.left: sentToText_paymentFailure.right; anchors.right: parent.right; - height: parent.height/2; - // Text size - size: 18; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignBottom; - } + height: parent.height; - RalewaySemiBold { - id: recipientUsername_paymentFailure; - text: sendMoneyStep.selectedRecipientUserName; - // Anchors - anchors.bottom: parent.bottom; - anchors.left: recipientDisplayName_paymentFailure.anchors.left; - anchors.leftMargin: recipientDisplayName_paymentFailure.anchors.leftMargin; - anchors.right: recipientDisplayName_paymentFailure.anchors.right; - anchors.rightMargin: recipientDisplayName_paymentFailure.anchors.rightMargin; - height: parent.height/2; - // Text size - size: 16; - // Style - color: hifi.colors.baseGray; - verticalAlignment: Text.AlignTop; + displayName: sendMoneyStep.selectedRecipientDisplayName; + userName: sendMoneyStep.selectedRecipientUserName; + profilePic: sendMoneyStep.selectedRecipientProfilePic !== "" ? ((0 === sendMoneyStep.selectedRecipientProfilePic.indexOf("http")) ? + sendMoneyStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendMoneyStep.selectedRecipientProfilePic)) : ""; + isDisplayingNearby: sendMoneyStep.referrer === "nearby"; } } @@ -1489,7 +1378,7 @@ Item { anchors.leftMargin: 110; anchors.right: parent.right; anchors.rightMargin: 16; - anchors.bottom: closeButton.top; + anchors.bottom: closeButton_paymentFailure.top; anchors.bottomMargin: 40; // Text size size: 22; @@ -1530,6 +1419,11 @@ Item { text: "Retry"; onClicked: { root.isCurrentlySendingMoney = true; + if (sendMoneyStep.referrer === "connections") { + Commerce.transferHfcToUsername(sendMoneyStep.selectedRecipientUserName, parseInt(amountTextField.text), optionalMessage.text); + } else if (sendMoneyStep.referrer === "nearby") { + Commerce.transferHfcToNode(sendMoneyStep.selectedRecipientNodeID, parseInt(amountTextField.text), optionalMessage.text); + } } } } From 5dca387055efb3350dee2b0549698e19eb457a19 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 12 Jan 2018 12:47:22 +1300 Subject: [PATCH 40/86] Remove old, unused overlay panel code --- interface/src/ui/overlays/OverlayPanel.cpp | 190 ------------------ interface/src/ui/overlays/OverlayPanel.h | 86 -------- interface/src/ui/overlays/Overlays.cpp | 120 ----------- interface/src/ui/overlays/Overlays.h | 38 ---- interface/src/ui/overlays/PanelAttachable.cpp | 19 -- interface/src/ui/overlays/PanelAttachable.h | 11 - 6 files changed, 464 deletions(-) delete mode 100644 interface/src/ui/overlays/OverlayPanel.cpp delete mode 100644 interface/src/ui/overlays/OverlayPanel.h diff --git a/interface/src/ui/overlays/OverlayPanel.cpp b/interface/src/ui/overlays/OverlayPanel.cpp deleted file mode 100644 index 06480109ce..0000000000 --- a/interface/src/ui/overlays/OverlayPanel.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// -// OverlayPanel.cpp -// interface/src/ui/overlays -// -// Created by Zander Otavka on 7/2/15. -// Copyright 2014 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 "OverlayPanel.h" - -#if OVERLAY_PANELS - -#include -#include -#include -#include - -#include "avatar/AvatarManager.h" -#include "avatar/MyAvatar.h" -#include "Base3DOverlay.h" - -PropertyBinding::PropertyBinding(QString avatar, QUuid entity) : - avatar(avatar), - entity(entity) -{ -} - -QVariant propertyBindingToVariant(const PropertyBinding& value) { - QVariantMap obj; - - if (value.avatar == "MyAvatar") { - obj["avatar"] = "MyAvatar"; - } else if (!value.entity.isNull()) { - obj["entity"] = value.entity; - } - - return obj; -} - -void propertyBindingFromVariant(const QVariant& objectVar, PropertyBinding& value) { - auto object = objectVar.toMap(); - auto avatar = object["avatar"]; - auto entity = object["entity"]; - - if (avatar.isValid() && !avatar.isNull()) { - value.avatar = avatar.toString(); - } else if (entity.isValid() && !entity.isNull()) { - value.entity = entity.toUuid(); - } -} - - -void OverlayPanel::addChild(OverlayID childId) { - if (!_children.contains(childId)) { - _children.append(childId); - } -} - -void OverlayPanel::removeChild(OverlayID childId) { - if (_children.contains(childId)) { - _children.removeOne(childId); - } -} - -QVariant OverlayPanel::getProperty(const QString &property) { - if (property == "anchorPosition") { - return vec3toVariant(getAnchorPosition()); - } - if (property == "anchorPositionBinding") { - return propertyBindingToVariant(PropertyBinding(_anchorPositionBindMyAvatar ? - "MyAvatar" : "", - _anchorPositionBindEntity)); - } - if (property == "anchorRotation") { - return quatToVariant(getAnchorRotation()); - } - if (property == "anchorRotationBinding") { - return propertyBindingToVariant(PropertyBinding(_anchorRotationBindMyAvatar ? - "MyAvatar" : "", - _anchorRotationBindEntity)); - } - if (property == "anchorScale") { - return vec3toVariant(getAnchorScale()); - } - if (property == "visible") { - return getVisible(); - } - if (property == "children") { - QVariantList array; - for (int i = 0; i < _children.length(); i++) { - array.append(OverlayIDtoScriptValue(nullptr, _children[i]).toVariant()); - } - return array; - } - - auto value = Billboardable::getProperty(property); - if (value.isValid()) { - return value; - } - return PanelAttachable::getProperty(property); -} - -void OverlayPanel::setProperties(const QVariantMap& properties) { - PanelAttachable::setProperties(properties); - Billboardable::setProperties(properties); - - auto anchorPosition = properties["anchorPosition"]; - if (anchorPosition.isValid()) { - setAnchorPosition(vec3FromVariant(anchorPosition)); - } - - auto anchorPositionBinding = properties["anchorPositionBinding"]; - if (anchorPositionBinding.isValid()) { - PropertyBinding binding = {}; - propertyBindingFromVariant(anchorPositionBinding, binding); - _anchorPositionBindMyAvatar = binding.avatar == "MyAvatar"; - _anchorPositionBindEntity = binding.entity; - } - - auto anchorRotation = properties["anchorRotation"]; - if (anchorRotation.isValid()) { - setAnchorRotation(quatFromVariant(anchorRotation)); - } - - auto anchorRotationBinding = properties["anchorRotationBinding"]; - if (anchorRotationBinding.isValid()) { - PropertyBinding binding = {}; - propertyBindingFromVariant(anchorPositionBinding, binding); - _anchorRotationBindMyAvatar = binding.avatar == "MyAvatar"; - _anchorRotationBindEntity = binding.entity; - } - - auto anchorScale = properties["anchorScale"]; - if (anchorScale.isValid()) { - setAnchorScale(vec3FromVariant(anchorScale)); - } - - auto visible = properties["visible"]; - if (visible.isValid()) { - setVisible(visible.toBool()); - } -} - -void OverlayPanel::applyTransformTo(Transform& transform, bool force) { - if (force || usecTimestampNow() > _transformExpiry) { - PanelAttachable::applyTransformTo(transform, true); - if (!getParentPanel()) { - if (_anchorPositionBindMyAvatar) { - transform.setTranslation(DependencyManager::get()->getMyAvatar() - ->getPosition()); - } else if (!_anchorPositionBindEntity.isNull()) { - EntityTreePointer entityTree = DependencyManager::get()->getEntityTree(); - entityTree->withReadLock([&] { - EntityItemPointer foundEntity = entityTree->findEntityByID(_anchorPositionBindEntity); - if (foundEntity) { - transform.setTranslation(foundEntity->getPosition()); - } - }); - } else { - transform.setTranslation(getAnchorPosition()); - } - - if (_anchorRotationBindMyAvatar) { - transform.setRotation(DependencyManager::get()->getMyAvatar() - ->getOrientation()); - } else if (!_anchorRotationBindEntity.isNull()) { - EntityTreePointer entityTree = DependencyManager::get()->getEntityTree(); - entityTree->withReadLock([&] { - EntityItemPointer foundEntity = entityTree->findEntityByID(_anchorRotationBindEntity); - if (foundEntity) { - transform.setRotation(foundEntity->getRotation()); - } - }); - } else { - transform.setRotation(getAnchorRotation()); - } - - transform.setScale(getAnchorScale()); - - transform.postTranslate(getOffsetPosition()); - transform.postRotate(getOffsetRotation()); - transform.postScale(getOffsetScale()); - } - pointTransformAtCamera(transform, getOffsetRotation()); - } -} -#endif \ No newline at end of file diff --git a/interface/src/ui/overlays/OverlayPanel.h b/interface/src/ui/overlays/OverlayPanel.h deleted file mode 100644 index cff2bc224d..0000000000 --- a/interface/src/ui/overlays/OverlayPanel.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// OverlayPanel.h -// interface/src/ui/overlays -// -// Created by Zander Otavka on 7/2/15. -// Copyright 2014 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_OverlayPanel_h -#define hifi_OverlayPanel_h - -#include - -#include -#include -#include - -#include "PanelAttachable.h" -#include "Billboardable.h" -#include "Overlay.h" - -#if OVERLAY_PANELS -class PropertyBinding { -public: - PropertyBinding() {} - PropertyBinding(QString avatar, QUuid entity); - QString avatar; - QUuid entity; -}; - -QVariant propertyBindingToVariant(const PropertyBinding& value); -void propertyBindingFromVariant(const QVariant& object, PropertyBinding& value); - - -class OverlayPanel : public QObject, public PanelAttachable, public Billboardable { - Q_OBJECT - -public: - typedef std::shared_ptr Pointer; - - void init(QScriptEngine* scriptEngine) { _scriptEngine = scriptEngine; } - - // getters - glm::vec3 getAnchorPosition() const { return _anchorTransform.getTranslation(); } - glm::quat getAnchorRotation() const { return _anchorTransform.getRotation(); } - glm::vec3 getAnchorScale() const { return _anchorTransform.getScale(); } - bool getVisible() const { return _visible; } - - // setters - void setAnchorPosition(const glm::vec3& position) { _anchorTransform.setTranslation(position); } - void setAnchorRotation(const glm::quat& rotation) { _anchorTransform.setRotation(rotation); } - void setAnchorScale(float scale) { _anchorTransform.setScale(scale); } - void setAnchorScale(const glm::vec3& scale) { _anchorTransform.setScale(scale); } - void setVisible(bool visible) { _visible = visible; } - - const QList& getChildren() { return _children; } - void addChild(OverlayID childId); - void removeChild(OverlayID childId); - OverlayID popLastChild() { return _children.takeLast(); } - - void setProperties(const QVariantMap& properties); - QVariant getProperty(const QString& property); - - virtual void applyTransformTo(Transform& transform, bool force = false) override; - -private: - Transform _anchorTransform; - - bool _anchorPositionBindMyAvatar = false; - QUuid _anchorPositionBindEntity; - - bool _anchorRotationBindMyAvatar = false; - QUuid _anchorRotationBindEntity; - - bool _visible = true; - QList _children; - - QScriptEngine* _scriptEngine; -}; - -#endif - -#endif // hifi_OverlayPanel_h diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 052ef0b6d8..7f897aee4a 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -68,16 +68,10 @@ void Overlays::cleanupAllOverlays() { foreach(Overlay::Pointer overlay, overlaysWorld) { _overlaysToDelete.push_back(overlay); } -#if OVERLAY_PANELS - _panels.clear(); -#endif cleanupOverlaysToDelete(); } void Overlays::init() { -#if OVERLAY_PANELS - _scriptEngine = new QScriptEngine(); -#endif } void Overlays::update(float deltatime) { @@ -300,12 +294,6 @@ OverlayID Overlays::cloneOverlay(OverlayID id) { if (thisOverlay) { OverlayID cloneId = addOverlay(Overlay::Pointer(thisOverlay->createClone(), [](Overlay* ptr) { ptr->deleteLater(); })); -#if OVERLAY_PANELS - auto attachable = std::dynamic_pointer_cast(thisOverlay); - if (attachable && attachable->getParentPanel()) { - attachable->getParentPanel()->addChild(cloneId); - } -#endif return cloneId; } @@ -381,15 +369,6 @@ void Overlays::deleteOverlay(OverlayID id) { } } -#if OVERLAY_PANELS - auto attachable = std::dynamic_pointer_cast(overlayToDelete); - if (attachable && attachable->getParentPanel()) { - attachable->getParentPanel()->removeChild(id); - attachable->setParentPanel(nullptr); - } -#endif - - _overlaysToDelete.push_back(overlayToDelete); emit overlayDeleted(id); } @@ -424,49 +403,6 @@ QObject* Overlays::getOverlayObject(OverlayID id) { return nullptr; } -#if OVERLAY_PANELS -OverlayID Overlays::getParentPanel(OverlayID childId) const { - Overlay::Pointer overlay = getOverlay(childId); - auto attachable = std::dynamic_pointer_cast(overlay); - if (attachable) { - return _panels.key(attachable->getParentPanel()); - } else if (_panels.contains(childId)) { - return _panels.key(getPanel(childId)->getParentPanel()); - } - return UNKNOWN_OVERLAY_ID; -} - -void Overlays::setParentPanel(OverlayID childId, OverlayID panelId) { - auto attachable = std::dynamic_pointer_cast(getOverlay(childId)); - if (attachable) { - if (_panels.contains(panelId)) { - auto panel = getPanel(panelId); - panel->addChild(childId); - attachable->setParentPanel(panel); - } else { - auto panel = attachable->getParentPanel(); - if (panel) { - panel->removeChild(childId); - attachable->setParentPanel(nullptr); - } - } - } else if (_panels.contains(childId)) { - OverlayPanel::Pointer child = getPanel(childId); - if (_panels.contains(panelId)) { - auto panel = getPanel(panelId); - panel->addChild(childId); - child->setParentPanel(panel); - } else { - auto panel = child->getParentPanel(); - if (panel) { - panel->removeChild(childId); - child->setParentPanel(0); - } - } - } -} -#endif - OverlayID Overlays::getOverlayAtPoint(const glm::vec2& point) { if (!_enabled) { return UNKNOWN_OVERLAY_ID; @@ -717,62 +653,6 @@ QSizeF Overlays::textSize(OverlayID id, const QString& text) { return QSizeF(0.0f, 0.0f); } -#if OVERLAY_PANELS -OverlayID Overlays::addPanel(OverlayPanel::Pointer panel) { - QWriteLocker lock(&_lock); - - OverlayID thisID = QUuid::createUuid(); - _panels[thisID] = panel; - - return thisID; -} - -OverlayID Overlays::addPanel(const QVariant& properties) { - OverlayPanel::Pointer panel = std::make_shared(); - panel->init(_scriptEngine); - panel->setProperties(properties.toMap()); - return addPanel(panel); -} - -void Overlays::editPanel(OverlayID panelId, const QVariant& properties) { - if (_panels.contains(panelId)) { - _panels[panelId]->setProperties(properties.toMap()); - } -} - -OverlayPropertyResult Overlays::getPanelProperty(OverlayID panelId, const QString& property) { - OverlayPropertyResult result; - if (_panels.contains(panelId)) { - OverlayPanel::Pointer thisPanel = getPanel(panelId); - QReadLocker lock(&_lock); - result.value = thisPanel->getProperty(property); - } - return result; -} - - -void Overlays::deletePanel(OverlayID panelId) { - OverlayPanel::Pointer panelToDelete; - - { - QWriteLocker lock(&_lock); - if (_panels.contains(panelId)) { - panelToDelete = _panels.take(panelId); - } else { - return; - } - } - - while (!panelToDelete->getChildren().isEmpty()) { - OverlayID childId = panelToDelete->popLastChild(); - deleteOverlay(childId); - deletePanel(childId); - } - - emit panelDeleted(panelId); -} -#endif - bool Overlays::isAddedOverlay(OverlayID id) { if (QThread::currentThread() != thread()) { bool result; diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index 04c0d01fa2..fd57869048 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -27,7 +27,6 @@ #include "Overlay.h" #include "PanelAttachable.h" -#include "OverlayPanel.h" class PickRay; @@ -93,9 +92,6 @@ public: void enable(); Overlay::Pointer getOverlay(OverlayID id) const; -#if OVERLAY_PANELS - OverlayPanel::Pointer getPanel(OverlayID id) const { return _panels[id]; } -#endif /// adds an overlay that's already been created OverlayID addOverlay(Overlay* overlay) { return addOverlay(Overlay::Pointer(overlay)); } @@ -468,30 +464,6 @@ public slots: */ bool isAddedOverlay(OverlayID id); -#if OVERLAY_PANELS - OverlayID getParentPanel(OverlayID childId) const; - void setParentPanel(OverlayID childId, OverlayID panelId); - - /// adds a panel that has already been created - OverlayID addPanel(OverlayPanel::Pointer panel); - - /// creates and adds a panel based on a set of properties - OverlayID addPanel(const QVariant& properties); - - /// edit the properties of a panel - void editPanel(OverlayID panelId, const QVariant& properties); - - /// get a property of a panel - OverlayPropertyResult getPanelProperty(OverlayID panelId, const QString& property); - - /// deletes a panel and all child overlays - void deletePanel(OverlayID panelId); - - /// return true if there is a panel with that id else false - bool isAddedPanel(OverlayID id) { return _panels.contains(id); } - -#endif - /**jsdoc * Generate a mouse press event on an overlay. * @function Overlays.sendMousePressOnOverlay @@ -612,10 +584,6 @@ signals: */ void overlayDeleted(OverlayID id); -#if OVERLAY_PANELS - void panelDeleted(OverlayID id); -#endif - /**jsdoc * Triggered when a mouse press event occurs on an overlay. Only occurs for 3D overlays (unless you use * {@link Overlays.sendMousePressOnOverlay|sendMousePressOnOverlay} for a 2D overlay). @@ -732,15 +700,9 @@ private: QMap _overlaysHUD; QMap _overlaysWorld; -#if OVERLAY_PANELS - QMap _panels; -#endif QList _overlaysToDelete; unsigned int _stackOrder { 1 }; -#if OVERLAY_PANELS - QScriptEngine* _scriptEngine; -#endif bool _enabled = true; PointerEvent calculateOverlayPointerEvent(OverlayID overlayID, PickRay ray, RayToOverlayIntersectionResult rayPickResult, diff --git a/interface/src/ui/overlays/PanelAttachable.cpp b/interface/src/ui/overlays/PanelAttachable.cpp index bcd32b2850..b53474390c 100644 --- a/interface/src/ui/overlays/PanelAttachable.cpp +++ b/interface/src/ui/overlays/PanelAttachable.cpp @@ -13,18 +13,8 @@ #include -#include "OverlayPanel.h" - bool PanelAttachable::getParentVisible() const { -#if OVERLAY_PANELS - if (getParentPanel()) { - return getParentPanel()->getVisible() && getParentPanel()->getParentVisible(); - } else { - return true; - } -#else return true; -#endif } // JSDoc for copying to @typedefs of overlay types that inherit PanelAttachable. @@ -67,15 +57,6 @@ bool PanelAttachable::applyTransformTo(Transform& transform, bool force) { if (force || usecTimestampNow() > _transformExpiry) { const quint64 TRANSFORM_UPDATE_PERIOD = 100000; // frequency is 10 Hz _transformExpiry = usecTimestampNow() + TRANSFORM_UPDATE_PERIOD; -#if OVERLAY_PANELS - if (getParentPanel()) { - getParentPanel()->applyTransformTo(transform, true); - transform.postTranslate(getOffsetPosition()); - transform.postRotate(getOffsetRotation()); - transform.postScale(getOffsetScale()); - return true; - } -#endif } return false; } diff --git a/interface/src/ui/overlays/PanelAttachable.h b/interface/src/ui/overlays/PanelAttachable.h index 1598aa4700..95faf38cf2 100644 --- a/interface/src/ui/overlays/PanelAttachable.h +++ b/interface/src/ui/overlays/PanelAttachable.h @@ -30,8 +30,6 @@ #ifndef hifi_PanelAttachable_h #define hifi_PanelAttachable_h -#define OVERLAY_PANELS 0 - #include #include @@ -44,18 +42,12 @@ class OverlayPanel; class PanelAttachable { public: // getters -#if OVERLAY_PANELS - std::shared_ptr getParentPanel() const { return _parentPanel; } -#endif glm::vec3 getOffsetPosition() const { return _offset.getTranslation(); } glm::quat getOffsetRotation() const { return _offset.getRotation(); } glm::vec3 getOffsetScale() const { return _offset.getScale(); } bool getParentVisible() const; // setters -#if OVERLAY_PANELS - void setParentPanel(std::shared_ptr panel) { _parentPanel = panel; } -#endif void setOffsetPosition(const glm::vec3& position) { _offset.setTranslation(position); } void setOffsetRotation(const glm::quat& rotation) { _offset.setRotation(rotation); } void setOffsetScale(float scale) { _offset.setScale(scale); } @@ -71,9 +63,6 @@ protected: quint64 _transformExpiry = 0; private: -#if OVERLAY_PANELS - std::shared_ptr _parentPanel = nullptr; -#endif Transform _offset; }; From c216144015168521bc405ccdc698b8fe4c6aacaa Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 11 Jan 2018 16:21:59 -0800 Subject: [PATCH 41/86] Remove unnecessary comments --- interface/resources/qml/hifi/commerce/wallet/Wallet.qml | 2 -- interface/resources/qml/hifi/commerce/wallet/WalletHome.qml | 2 -- .../qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml | 2 -- .../qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml | 2 -- .../resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml | 2 -- 5 files changed, 10 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index 6b350f9f93..7b453f4cb3 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -21,8 +21,6 @@ import "../../../controls" as HifiControls import "../common" as HifiCommerceCommon import "./sendMoney" -// references XXX from root context - Rectangle { HifiConstants { id: hifi; } diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 12d119e012..e761f3e510 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -19,8 +19,6 @@ import "../../../styles-uit" import "../../../controls-uit" as HifiControlsUit import "../../../controls" as HifiControls -// references XXX from root context - Item { HifiConstants { id: hifi; } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml index 84d6b304f6..c2d9ef3b19 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/ConnectionItem.qml @@ -21,8 +21,6 @@ import "../../../../controls-uit" as HifiControlsUit import "../../../../controls" as HifiControls import "../../wallet" as HifiWallet -// references XXX from root context - Item { HifiConstants { id: hifi; } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml index f9613bea92..267cf0ed51 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/RecipientDisplay.qml @@ -20,8 +20,6 @@ import "../../../../controls-uit" as HifiControlsUit import "../../../../controls" as HifiControls import "../../common" as HifiCommerceCommon -// references XXX from root context - Item { HifiConstants { id: hifi; } diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index 9812de057f..5d2d05047f 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -20,8 +20,6 @@ import "../../../../controls-uit" as HifiControlsUit import "../../../../controls" as HifiControls import "../../common" as HifiCommerceCommon -// references XXX from root context - Item { HifiConstants { id: hifi; } From 96a97b5938694c3c5dd256f03e3c8e167cd8d31f Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 11 Jan 2018 16:41:45 -0800 Subject: [PATCH 42/86] added model transform override --- interface/src/avatar/MyAvatar.cpp | 2 +- .../src/avatars-renderer/Avatar.cpp | 5 ++--- .../src/RenderableModelEntityItem.cpp | 21 ++++++++++++++++--- .../src/RenderableModelEntityItem.h | 1 + libraries/render-utils/src/Model.cpp | 14 ++++++++++++- libraries/render-utils/src/Model.h | 8 +++++++ 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 95ccd6c6c4..1cd0c79b32 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -537,7 +537,7 @@ void MyAvatar::simulate(float deltaTime) { // we've achived our final adjusted position and rotation for the avatar // and all of its joints, now update our attachements. Avatar::simulateAttachments(deltaTime); - Avatar::relayJointDataToChildren(); + relayJointDataToChildren(); if (!_skeletonModel->hasSkeleton()) { // All the simulation that can be done has been done diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 765764da47..ebc5ef2f6c 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -355,9 +355,7 @@ void Avatar::relayJointDataToChildren() { auto modelEntity = std::dynamic_pointer_cast(child); if (modelEntity) { if (modelEntity->getRelayParentJoints()) { - qDebug() << modelEntity->getJointMapCompleted(); if (!(modelEntity->getJointMapCompleted())) { - qDebug() << "constructing map"; QStringList modelJointNames = modelEntity->getJointNames(); int numJoints = modelJointNames.count(); std::vector map; @@ -388,7 +386,6 @@ void Avatar::relayJointDataToChildren() { for (int jointIndex = 0; jointIndex < numJoints; jointIndex++) { int avatarJointIndex = modelEntity->avatarJointIndex(jointIndex); int index = modelEntity->getJointIndex(modelJointNames.at(jointIndex)); - //qDebug() << jointIndex << "------" << index; glm::quat jointRotation; glm::vec3 jointTranslation; if (avatarJointIndex >=0) { @@ -402,6 +399,8 @@ void Avatar::relayJointDataToChildren() { modelEntity->setLocalJointTranslation(jointIndex, jointTranslation); } } + + modelEntity->setOverrideTransform(_skeletonModel->getTransform()); modelEntity->simulateRelayedJoints(); } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 84d19f4fb3..85dbc2feee 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -209,6 +209,12 @@ void RenderableModelEntityItem::updateModelBounds() { updateRenderItems = true; } + if (getRelayParentJoints()) { + model->setOverrideTransform(true); + } else { + model->setOverrideTransform(false); + } + if (model->getScaleToFitDimensions() != getScaledDimensions() || model->getRegistrationPoint() != getRegistrationPoint()) { // The machinery for updateModelBounds will give existing models the opportunity to fix their @@ -709,13 +715,15 @@ void RenderableModelEntityItem::setCollisionShape(const btCollisionShape* shape) } void RenderableModelEntityItem::setJointMap(std::vector jointMap) { - _jointMap = jointMap; - _jointMapCompleted = true; + if (jointMap.size() > 0) { + _jointMap = jointMap; + _jointMapCompleted = true; + } }; int RenderableModelEntityItem::avatarJointIndex(int modelJointIndex) { int result = -1; - int mapSize = _jointMap.size(); + int mapSize = (int) _jointMap.size(); if (modelJointIndex >=0 && modelJointIndex < mapSize) { result = _jointMap[modelJointIndex]; } @@ -854,6 +862,13 @@ glm::vec3 RenderableModelEntityItem::getLocalJointTranslation(int index) const { return glm::vec3(); } +void RenderableModelEntityItem::setOverrideTransform(const Transform& transform) { + auto model = getModel(); + if (model) { + model->overrideModelTransform(transform); + } +} + bool RenderableModelEntityItem::setLocalJointRotation(int index, const glm::quat& rotation) { autoResizeJointArrays(); bool result = false; diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 8315a44328..e9e7b9ba67 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -87,6 +87,7 @@ public: bool getJointMapCompleted(); void setJointMap(std::vector jointMap); int avatarJointIndex(int modelJointIndex); + void setOverrideTransform(const Transform& transform); // these are in the frame of this object (model space) virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 539f0421b0..0c6c2223cd 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -144,7 +144,13 @@ void Model::setTransformNoUpdateRenderItems(const Transform& transform) { } Transform Model::getTransform() const { - if (_spatiallyNestableOverride) { + if (_overrideModelTransform) { + Transform transform; + transform.setTranslation(getOverrideTranslation()); + transform.setRotation(getOverrideRotation()); + transform.setScale(getScale()); + return transform; + } else if (_spatiallyNestableOverride) { bool success; Transform transform = _spatiallyNestableOverride->getTransform(success); if (success) { @@ -1363,6 +1369,12 @@ void Model::deleteGeometry() { _collisionGeometry.reset(); } +void Model::overrideModelTransform(const Transform& transform) { + _overrideTranslation = transform.getTranslation(); + _overrideRotation = transform.getRotation(); + _overrideModelTransform = true; +} + AABox Model::getRenderableMeshBound() const { if (!isLoaded()) { return AABox(); diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 77ed629962..f75e6d9c90 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -208,10 +208,14 @@ public: void setTranslation(const glm::vec3& translation); void setRotation(const glm::quat& rotation); + void overrideModelTransform(const Transform& transform); + void setOverrideTransform(bool override) { _overrideModelTransform = override; }; void setTransformNoUpdateRenderItems(const Transform& transform); // temporary HACK const glm::vec3& getTranslation() const { return _translation; } const glm::quat& getRotation() const { return _rotation; } + const glm::vec3& getOverrideTranslation() const { return _overrideTranslation; } + const glm::quat& getOverrideRotation() const { return _overrideRotation; } glm::vec3 getNaturalDimensions() const; @@ -302,6 +306,9 @@ protected: glm::quat _rotation; glm::vec3 _scale; + glm::vec3 _overrideTranslation; + glm::quat _overrideRotation; + // For entity models this is the translation for the minimum extent of the model (in original mesh coordinate space) // to the model's registration point. For avatar models this is the translation from the avatar's hips, as determined // by the default pose, to the origin. @@ -362,6 +369,7 @@ protected: QMutex _mutex; + bool _overrideModelTransform { false }; bool _triangleSetsValid { false }; void calculateTriangleSets(); QVector _modelSpaceMeshTriangleSets; // model space triangles for all sub meshes From 088f227df27181d80bd8d1d18ee03855b95fc951 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 12 Jan 2018 10:26:02 -0800 Subject: [PATCH 43/86] Pass model offset from avatar skeletonModel to attached entity --- .../src/avatars-renderer/Avatar.cpp | 2 +- .../src/RenderableModelEntityItem.cpp | 4 +- .../src/RenderableModelEntityItem.h | 2 +- libraries/networking/src/udt/PacketHeaders.h | 1 + libraries/render-utils/src/Model.cpp | 3 +- libraries/render-utils/src/Model.h | 2 +- .../developer/tests/avatarAttachmentTest.js | 77 +++++++++++++++---- 7 files changed, 69 insertions(+), 22 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index ebc5ef2f6c..2c6cf7d620 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -400,7 +400,7 @@ void Avatar::relayJointDataToChildren() { } } - modelEntity->setOverrideTransform(_skeletonModel->getTransform()); + modelEntity->setOverrideTransform(_skeletonModel->getTransform(), _skeletonModel->getOffset()); modelEntity->simulateRelayedJoints(); } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 85dbc2feee..3f5453ff04 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -862,10 +862,10 @@ glm::vec3 RenderableModelEntityItem::getLocalJointTranslation(int index) const { return glm::vec3(); } -void RenderableModelEntityItem::setOverrideTransform(const Transform& transform) { +void RenderableModelEntityItem::setOverrideTransform(const Transform& transform, const glm::vec3& offset) { auto model = getModel(); if (model) { - model->overrideModelTransform(transform); + model->overrideModelTransform(transform, offset); } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index e9e7b9ba67..1d00767030 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -87,7 +87,7 @@ public: bool getJointMapCompleted(); void setJointMap(std::vector jointMap); int avatarJointIndex(int modelJointIndex); - void setOverrideTransform(const Transform& transform); + void setOverrideTransform(const Transform& transform, const glm::vec3& offset); // these are in the frame of this object (model space) virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override; diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 66ac7ecf6c..8d823049df 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -203,6 +203,7 @@ enum class EntityVersion : PacketVersion { StaticCertJsonVersionOne, OwnershipChallengeFix, ZoneLightInheritModes, + ZoneStageRemoved, SoftEntities }; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 0c6c2223cd..874fd09a79 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1369,10 +1369,11 @@ void Model::deleteGeometry() { _collisionGeometry.reset(); } -void Model::overrideModelTransform(const Transform& transform) { +void Model::overrideModelTransform(const Transform& transform, const glm::vec3& offset) { _overrideTranslation = transform.getTranslation(); _overrideRotation = transform.getRotation(); _overrideModelTransform = true; + setOffset(offset); } AABox Model::getRenderableMeshBound() const { diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index f75e6d9c90..554d3a4f47 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -208,7 +208,7 @@ public: void setTranslation(const glm::vec3& translation); void setRotation(const glm::quat& rotation); - void overrideModelTransform(const Transform& transform); + void overrideModelTransform(const Transform& transform, const glm::vec3& offset); void setOverrideTransform(bool override) { _overrideModelTransform = override; }; void setTransformNoUpdateRenderItems(const Transform& transform); // temporary HACK diff --git a/scripts/developer/tests/avatarAttachmentTest.js b/scripts/developer/tests/avatarAttachmentTest.js index c9f2e1615b..ecc8c5a0af 100644 --- a/scripts/developer/tests/avatarAttachmentTest.js +++ b/scripts/developer/tests/avatarAttachmentTest.js @@ -57,7 +57,7 @@ ToggleButtonBuddy.prototype.addToggleHandler = function (callback) { }; ToggleButtonBuddy.prototype.removeToggleHandler = function (callback) { var index = this.callbacks.indexOf(callback); - if (index != -1) { + if (index !== -1) { this.callbacks.splice(index, 1); } }; @@ -86,13 +86,23 @@ var coatButton = new ToggleButtonBuddy(buttonPositionX, buttonPositionY, BUTTON_ down: "https://s3.amazonaws.com/hifi-public/tony/icons/coat-down.svg" }); +buttonPositionY += BUTTON_HEIGHT + BUTTON_PADDING; +var coatButton2 = new ToggleButtonBuddy(buttonPositionX, buttonPositionY, BUTTON_WIDTH, BUTTON_HEIGHT, { + up: "https://s3.amazonaws.com/hifi-public/tony/icons/coat-up.svg", + down: "https://s3.amazonaws.com/hifi-public/tony/icons/coat-down.svg" +}); + +var AVATAR_ATTACHMENT = 0; +var AVATAR_SOFT_ATTACHMENT = 1; +var ENTITY_ATTACHMENT = 2; + var HAT_ATTACHMENT = { modelURL: "https://s3.amazonaws.com/hifi-public/tony/cowboy-hat.fbx", jointName: "Head", translation: {"x": 0, "y": 0.25, "z": 0.03}, rotation: {"x": 0, "y": 0, "z": 0, "w": 1}, scale: 0.052, - isSoft: false + type: AVATAR_ATTACHMENT }; var COAT_ATTACHMENT = { @@ -101,7 +111,16 @@ var COAT_ATTACHMENT = { translation: {"x": 0, "y": 0, "z": 0}, rotation: {"x": 0, "y": 0, "z": 0, "w": 1}, scale: 1, - isSoft: true + type: AVATAR_SOFT_ATTACHMENT +}; + +var COAT_ENTITY_ATTACHMENT = { + modelURL: "https://hifi-content.s3.amazonaws.com/ozan/dev/clothes/coat/coat_rig.fbx", + jointName: "Hips", + translation: {"x": 0, "y": 0, "z": 0}, + rotation: {"x": 0, "y": 0, "z": 0, "w": 1}, + scale: 1, + type: ENTITY_ATTACHMENT }; hatButton.addToggleHandler(function (isDown) { @@ -120,28 +139,54 @@ coatButton.addToggleHandler(function (isDown) { } }); +coatButton2.addToggleHandler(function (isDown) { + if (isDown) { + wearAttachment(COAT_ENTITY_ATTACHMENT); + } else { + removeAttachment(COAT_ENTITY_ATTACHMENT); + } +}); + function wearAttachment(attachment) { - MyAvatar.attach(attachment.modelURL, - attachment.jointName, - attachment.translation, - attachment.rotation, - attachment.scale, - attachment.isSoft); + if (attachment.type === AVATAR_ATTACHMENT || attachment.type === AVATAR_SOFT_ATTACHMENT) { + MyAvatar.attach(attachment.modelURL, + attachment.jointName, + attachment.translation, + attachment.rotation, + attachment.scale, + (attachment.type === AVATAR_SOFT_ATTACHMENT)); + } else { + attachment.entityID = Entities.addEntity({ + name: "attachment", + type: "Model", + modelURL: attachment.modelURL, + parentID: MyAvatar.sessionUUID, + relayParentJoints: true, + position: attachment.position, + rotation: attachment.rotation, + parentJointIndex: -1 + }); + } } function removeAttachment(attachment) { - var attachments = MyAvatar.attachmentData; - var i, l = attachments.length; - for (i = 0; i < l; i++) { - if (attachments[i].modelURL === attachment.modelURL) { - attachments.splice(i, 1); - MyAvatar.attachmentData = attachments; - break; + if (attachment.type === AVATAR_ATTACHMENT || attachment.type === AVATAR_SOFT_ATTACHMENT) { + var attachments = MyAvatar.attachmentData; + var i, l = attachments.length; + for (i = 0; i < l; i++) { + if (attachments[i].modelURL === attachment.modelURL) { + attachments.splice(i, 1); + MyAvatar.attachmentData = attachments; + break; + } } + } else { + Entities.deleteEntity(attachment.entityID); } } Script.scriptEnding.connect(function() { hatButton.destroy(); coatButton.destroy(); + coatButton2.destroy(); }); From 1fa31d3c10545609f5816c726ba07ba1f47fa70a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 13 Jan 2018 10:27:43 +1300 Subject: [PATCH 44/86] Remove old ToolWindow code --- interface/resources/qml/ToolWindow.qml | 256 ------------------ interface/resources/qml/hifi/Desktop.qml | 4 - libraries/ui/src/OffscreenUi.cpp | 5 - libraries/ui/src/OffscreenUi.h | 2 - libraries/ui/src/QmlWindowClass.cpp | 105 ++----- libraries/ui/src/QmlWindowClass.h | 8 - .../developer/tests/playaPerformanceTest.js | 1 - scripts/developer/tests/qmlTest.js | 1 - scripts/developer/tests/textureStress.js | 1 - .../developer/tests/toolWindowStressTest.js | 31 --- 10 files changed, 28 insertions(+), 386 deletions(-) delete mode 100644 interface/resources/qml/ToolWindow.qml delete mode 100644 scripts/developer/tests/toolWindowStressTest.js diff --git a/interface/resources/qml/ToolWindow.qml b/interface/resources/qml/ToolWindow.qml deleted file mode 100644 index b1120058f9..0000000000 --- a/interface/resources/qml/ToolWindow.qml +++ /dev/null @@ -1,256 +0,0 @@ -// -// ToolWindow.qml -// -// Created by Bradley Austin Davis on 12 Jan 2016 -// Copyright 2016 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 -// - -import QtQuick 2.5 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtWebEngine 1.1 -import QtWebChannel 1.0 -import Qt.labs.settings 1.0 - -import "windows" -import "controls-uit" -import "styles-uit" - - -ScrollingWindow { - id: toolWindow - resizable: true - objectName: "ToolWindow" - destroyOnCloseButton: false - destroyOnHidden: false - closable: true - shown: false - title: "Edit" - property alias tabView: tabView - implicitWidth: 520; implicitHeight: 695 - minSize: Qt.vector2d(456, 500) - - HifiConstants { id: hifi } - - onParentChanged: { - if (parent) { - x = 120; - y = 120; - } - } - - onShownChanged: { - keyboardEnabled = HMD.active; - } - - Settings { - category: "ToolWindow.Position" - property alias x: toolWindow.x - property alias y: toolWindow.y - } - - Item { - id: toolWindowTabViewItem - height: pane.scrollHeight - width: pane.contentWidth - anchors.left: parent.left - anchors.top: parent.top - - TabView { - id: tabView - width: pane.contentWidth - // Pane height so that don't use Window's scrollbars otherwise tabs may be scrolled out of view. - height: pane.scrollHeight - property int tabCount: 0 - - Repeater { - model: 4 - Tab { - // Force loading of the content even if the tab is not visible - // (required for letting the C++ code access the webview) - active: true - enabled: false - property string originalUrl: "" - - WebView { - id: webView - anchors.fill: parent - enabled: false - Component.onCompleted: { - webChannel.registerObject("eventBridge", eventBridge); - webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper); - } - - onEnabledChanged: toolWindow.updateVisiblity() - } - } - } - - style: TabViewStyle { - - frame: Rectangle { // Background shown before content loads. - anchors.fill: parent - color: hifi.colors.baseGray - } - - frameOverlap: 0 - - tab: Rectangle { - implicitWidth: text.width - implicitHeight: 3 * text.height - color: styleData.selected ? hifi.colors.black : hifi.colors.tabBackgroundDark - - RalewayRegular { - id: text - text: styleData.title - font.capitalization: Font.AllUppercase - size: hifi.fontSizes.tabName - width: tabView.tabCount > 1 ? styleData.availableWidth / tabView.tabCount : implicitWidth + 2 * hifi.dimensions.contentSpacing.x - elide: Text.ElideRight - color: styleData.selected ? hifi.colors.primaryHighlight : hifi.colors.lightGrayText - horizontalAlignment: Text.AlignHCenter - anchors.centerIn: parent - } - - Rectangle { // Separator. - width: 1 - height: parent.height - color: hifi.colors.black - anchors.left: parent.left - anchors.top: parent.top - visible: styleData.index > 0 - - Rectangle { - width: 1 - height: 1 - color: hifi.colors.baseGray - anchors.left: parent.left - anchors.bottom: parent.bottom - } - } - - Rectangle { // Active underline. - width: parent.width - (styleData.index > 0 ? 1 : 0) - height: 1 - anchors.right: parent.right - anchors.bottom: parent.bottom - color: styleData.selected ? hifi.colors.primaryHighlight : hifi.colors.baseGray - } - } - - tabOverlap: 0 - } - } - } - - function updateVisiblity() { - if (visible) { - for (var i = 0; i < tabView.count; ++i) { - if (tabView.getTab(i).enabled) { - return; - } - } - shown = false; - } - } - - function findIndexForUrl(source) { - for (var i = 0; i < tabView.count; ++i) { - var tab = tabView.getTab(i); - if (tab.originalUrl === source) { - return i; - } - } - return -1; - } - - function findTabForUrl(source) { - var index = findIndexForUrl(source); - if (index < 0) { - return; - } - return tabView.getTab(index); - } - - function showTabForUrl(source, newVisible) { - var index = findIndexForUrl(source); - if (index < 0) { - return; - } - - var tab = tabView.getTab(index); - if (newVisible) { - toolWindow.shown = true - tab.enabled = true - } else { - tab.enabled = false; - updateVisiblity(); - } - } - - function findFreeTab() { - for (var i = 0; i < tabView.count; ++i) { - var tab = tabView.getTab(i); - if (tab && (!tab.originalUrl || tab.originalUrl === "")) { - return i; - } - } - return -1; - } - - function removeTabForUrl(source) { - var index = findIndexForUrl(source); - if (index < 0) { - return; - } - - var tab = tabView.getTab(index); - tab.title = ""; - tab.enabled = false; - tab.originalUrl = ""; - tab.item.url = "about:blank"; - tab.item.enabled = false; - tabView.tabCount--; - } - - function addWebTab(properties) { - if (!properties.source) { - console.warn("Attempted to open Web Tool Pane without URL"); - return; - } - - var existingTabIndex = findIndexForUrl(properties.source); - if (existingTabIndex >= 0) { - var tab = tabView.getTab(existingTabIndex); - return tab.item; - } - - var freeTabIndex = findFreeTab(); - if (freeTabIndex === -1) { - console.warn("Unable to add new tab"); - return; - } - - if (properties.width) { - tabView.width = Math.min(Math.max(tabView.width, properties.width), toolWindow.maxSize.x); - } - - if (properties.height) { - tabView.height = Math.min(Math.max(tabView.height, properties.height), toolWindow.maxSize.y); - } - - var tab = tabView.getTab(freeTabIndex); - tab.title = properties.title || "Unknown"; - tab.enabled = true; - tab.originalUrl = properties.source; - - var result = tab.item; - result.enabled = true; - tabView.tabCount++; - result.url = properties.source; - return result; - } -} diff --git a/interface/resources/qml/hifi/Desktop.qml b/interface/resources/qml/hifi/Desktop.qml index 896b3cf10e..8c732aac40 100644 --- a/interface/resources/qml/hifi/Desktop.qml +++ b/interface/resources/qml/hifi/Desktop.qml @@ -22,10 +22,6 @@ OriginalDesktop.Desktop { acceptedButtons: Qt.NoButton } - // The tool window, one instance - property alias toolWindow: toolWindow - ToolWindow { id: toolWindow } - Action { text: "Open Browser" shortcut: "Ctrl+B" diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 905a224ef4..221f5013bf 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -666,7 +666,6 @@ void OffscreenUi::createDesktop(const QUrl& url) { Q_UNUSED(context) _desktop = static_cast(newObject); getSurfaceContext()->setContextProperty("desktop", _desktop); - _toolWindow = _desktop->findChild("ToolWindow"); _vrMenu = new VrMenu(this); for (const auto& menuInitializer : _queuedMenuInitializers) { @@ -686,10 +685,6 @@ QObject* OffscreenUi::getRootMenu() { return getRootItem()->findChild("rootMenu"); } -QQuickItem* OffscreenUi::getToolWindow() { - return _toolWindow; -} - void OffscreenUi::unfocusWindows() { bool invokeResult = QMetaObject::invokeMethod(_desktop, "unfocusWindows"); Q_ASSERT(invokeResult); diff --git a/libraries/ui/src/OffscreenUi.h b/libraries/ui/src/OffscreenUi.h index 76e4261cd3..ab3a209820 100644 --- a/libraries/ui/src/OffscreenUi.h +++ b/libraries/ui/src/OffscreenUi.h @@ -80,7 +80,6 @@ public: QObject* getFlags(); Q_INVOKABLE bool isPointOnDesktopWindow(QVariant point); QQuickItem* getDesktop(); - QQuickItem* getToolWindow(); QObject* getRootMenu(); enum Icon { ICON_NONE = 0, @@ -261,7 +260,6 @@ private: ModalDialogListener* assetDialogAsync(const QVariantMap& properties); QQuickItem* _desktop { nullptr }; - QQuickItem* _toolWindow { nullptr }; QList _modalDialogListeners; std::unordered_map _pressedKeys; VrMenu* _vrMenu { nullptr }; diff --git a/libraries/ui/src/QmlWindowClass.cpp b/libraries/ui/src/QmlWindowClass.cpp index 90b91c5ec2..1209d39dcf 100644 --- a/libraries/ui/src/QmlWindowClass.cpp +++ b/libraries/ui/src/QmlWindowClass.cpp @@ -32,7 +32,6 @@ static const char* const EVENT_BRIDGE_PROPERTY = "eventBridge"; static const char* const WIDTH_PROPERTY = "width"; static const char* const HEIGHT_PROPERTY = "height"; static const char* const VISIBILE_PROPERTY = "visible"; -static const char* const TOOLWINDOW_PROPERTY = "toolWindow"; static const uvec2 MAX_QML_WINDOW_SIZE { 1280, 720 }; static const uvec2 MIN_QML_WINDOW_SIZE { 120, 80 }; @@ -53,9 +52,6 @@ QVariantMap QmlWindowClass::parseArguments(QScriptContext* context) { if (context->argument(3).isNumber()) { properties[HEIGHT_PROPERTY] = context->argument(3).toInt32(); } - if (context->argument(4).isBool()) { - properties[TOOLWINDOW_PROPERTY] = context->argument(4).toBool(); - } } else { properties = context->argument(0).toVariant().toMap(); } @@ -96,52 +92,37 @@ void QmlWindowClass::initQml(QVariantMap properties) { auto offscreenUi = DependencyManager::get(); _source = properties[SOURCE_PROPERTY].toString(); -#if QML_TOOL_WINDOW - _toolWindow = properties.contains(TOOLWINDOW_PROPERTY) && properties[TOOLWINDOW_PROPERTY].toBool(); - if (_toolWindow) { - // Build the event bridge and wrapper on the main thread - _qmlWindow = offscreenUi->getToolWindow(); - properties[EVENT_BRIDGE_PROPERTY] = QVariant::fromValue(this); - QVariant newTabVar; - bool invokeResult = QMetaObject::invokeMethod(_qmlWindow, "addWebTab", Qt::DirectConnection, - Q_RETURN_ARG(QVariant, newTabVar), - Q_ARG(QVariant, QVariant::fromValue(properties))); - Q_ASSERT(invokeResult); - } else { -#endif - // Build the event bridge and wrapper on the main thread - offscreenUi->loadInNewContext(qmlSource(), [&](QQmlContext* context, QObject* object) { - _qmlWindow = object; - context->setContextProperty(EVENT_BRIDGE_PROPERTY, this); - context->engine()->setObjectOwnership(this, QQmlEngine::CppOwnership); - context->engine()->setObjectOwnership(object, QQmlEngine::CppOwnership); - if (properties.contains(TITLE_PROPERTY)) { - object->setProperty(TITLE_PROPERTY, properties[TITLE_PROPERTY].toString()); - } - if (properties.contains(HEIGHT_PROPERTY) && properties.contains(WIDTH_PROPERTY)) { - uvec2 requestedSize { properties[WIDTH_PROPERTY].toUInt(), properties[HEIGHT_PROPERTY].toUInt() }; - requestedSize = glm::clamp(requestedSize, MIN_QML_WINDOW_SIZE, MAX_QML_WINDOW_SIZE); - asQuickItem()->setSize(QSize(requestedSize.x, requestedSize.y)); - } + // Build the event bridge and wrapper on the main thread + offscreenUi->loadInNewContext(qmlSource(), [&](QQmlContext* context, QObject* object) { + _qmlWindow = object; + context->setContextProperty(EVENT_BRIDGE_PROPERTY, this); + context->engine()->setObjectOwnership(this, QQmlEngine::CppOwnership); + context->engine()->setObjectOwnership(object, QQmlEngine::CppOwnership); + if (properties.contains(TITLE_PROPERTY)) { + object->setProperty(TITLE_PROPERTY, properties[TITLE_PROPERTY].toString()); + } + if (properties.contains(HEIGHT_PROPERTY) && properties.contains(WIDTH_PROPERTY)) { + uvec2 requestedSize { properties[WIDTH_PROPERTY].toUInt(), properties[HEIGHT_PROPERTY].toUInt() }; + requestedSize = glm::clamp(requestedSize, MIN_QML_WINDOW_SIZE, MAX_QML_WINDOW_SIZE); + asQuickItem()->setSize(QSize(requestedSize.x, requestedSize.y)); + } - bool visible = !properties.contains(VISIBILE_PROPERTY) || properties[VISIBILE_PROPERTY].toBool(); - object->setProperty(OFFSCREEN_VISIBILITY_PROPERTY, visible); - object->setProperty(SOURCE_PROPERTY, _source); + bool visible = !properties.contains(VISIBILE_PROPERTY) || properties[VISIBILE_PROPERTY].toBool(); + object->setProperty(OFFSCREEN_VISIBILITY_PROPERTY, visible); + object->setProperty(SOURCE_PROPERTY, _source); - const QMetaObject *metaObject = _qmlWindow->metaObject(); - // Forward messages received from QML on to the script - connect(_qmlWindow, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection); - connect(_qmlWindow, SIGNAL(visibleChanged()), this, SIGNAL(visibleChanged()), Qt::QueuedConnection); + const QMetaObject *metaObject = _qmlWindow->metaObject(); + // Forward messages received from QML on to the script + connect(_qmlWindow, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection); + connect(_qmlWindow, SIGNAL(visibleChanged()), this, SIGNAL(visibleChanged()), Qt::QueuedConnection); + + if (metaObject->indexOfSignal("resized") >= 0) + connect(_qmlWindow, SIGNAL(resized(QSizeF)), this, SIGNAL(resized(QSizeF)), Qt::QueuedConnection); + if (metaObject->indexOfSignal("moved") >= 0) + connect(_qmlWindow, SIGNAL(moved(QVector2D)), this, SLOT(hasMoved(QVector2D)), Qt::QueuedConnection); + connect(_qmlWindow, SIGNAL(windowClosed()), this, SLOT(hasClosed()), Qt::QueuedConnection); + }); - if (metaObject->indexOfSignal("resized") >= 0) - connect(_qmlWindow, SIGNAL(resized(QSizeF)), this, SIGNAL(resized(QSizeF)), Qt::QueuedConnection); - if (metaObject->indexOfSignal("moved") >= 0) - connect(_qmlWindow, SIGNAL(moved(QVector2D)), this, SLOT(hasMoved(QVector2D)), Qt::QueuedConnection); - connect(_qmlWindow, SIGNAL(windowClosed()), this, SLOT(hasClosed()), Qt::QueuedConnection); - }); -#if QML_TOOL_WINDOW - } -#endif Q_ASSERT(_qmlWindow); Q_ASSERT(dynamic_cast(_qmlWindow.data())); } @@ -215,11 +196,6 @@ QmlWindowClass::~QmlWindowClass() { } QQuickItem* QmlWindowClass::asQuickItem() const { -#if QML_TOOL_WINDOW - if (_toolWindow) { - return DependencyManager::get()->getToolWindow(); - } -#endif return _qmlWindow.isNull() ? nullptr : dynamic_cast(_qmlWindow.data()); } @@ -230,14 +206,6 @@ void QmlWindowClass::setVisible(bool visible) { } QQuickItem* targetWindow = asQuickItem(); -#if QML_TOOL_WINDOW - if (_toolWindow) { - // For tool window tabs we special case visibility as a function call on the tab parent - // The tool window itself has special logic based on whether any tabs are visible - QMetaObject::invokeMethod(targetWindow, "showTabForUrl", Qt::QueuedConnection, Q_ARG(QVariant, _source), Q_ARG(QVariant, visible)); - return; - } -#endif targetWindow->setProperty(OFFSCREEN_VISIBILITY_PROPERTY, visible); } @@ -253,12 +221,6 @@ bool QmlWindowClass::isVisible() { return false; } -#if QML_TOOL_WINDOW - if (_toolWindow) { - return dynamic_cast(_qmlWindow.data())->isEnabled(); - } -#endif - return asQuickItem()->isVisible(); } @@ -343,17 +305,6 @@ void QmlWindowClass::close() { return; } -#if QML_TOOL_WINDOW - if (_toolWindow) { - auto offscreenUi = DependencyManager::get(); - auto toolWindow = offscreenUi->getToolWindow(); - auto invokeResult = QMetaObject::invokeMethod(toolWindow, "removeTabForUrl", Qt::DirectConnection, - Q_ARG(QVariant, _source)); - Q_ASSERT(invokeResult); - return; - } -#endif - if (_qmlWindow) { _qmlWindow->deleteLater(); } diff --git a/libraries/ui/src/QmlWindowClass.h b/libraries/ui/src/QmlWindowClass.h index e01bc8f14b..f274501d35 100644 --- a/libraries/ui/src/QmlWindowClass.h +++ b/libraries/ui/src/QmlWindowClass.h @@ -19,8 +19,6 @@ class QScriptEngine; class QScriptContext; -#define QML_TOOL_WINDOW 0 - // FIXME refactor this class to be a QQuickItem derived type and eliminate the needless wrapping class QmlWindowClass : public QObject { Q_OBJECT @@ -87,12 +85,6 @@ protected: virtual QString qmlSource() const { return "QmlWindow.qml"; } -#if QML_TOOL_WINDOW - // FIXME needs to be initialized in the ctor once we have support - // for tool window panes in QML - bool _toolWindow { false }; -#endif - QPointer _qmlWindow; QString _source; diff --git a/scripts/developer/tests/playaPerformanceTest.js b/scripts/developer/tests/playaPerformanceTest.js index 4c8a728a15..6250fe1175 100644 --- a/scripts/developer/tests/playaPerformanceTest.js +++ b/scripts/developer/tests/playaPerformanceTest.js @@ -4,7 +4,6 @@ qmlWindow = new OverlayWindow({ source: qml, height: 320, width: 640, - toolWindow: false, visible: true }); diff --git a/scripts/developer/tests/qmlTest.js b/scripts/developer/tests/qmlTest.js index 0eaabac6d1..7d248a9cc7 100644 --- a/scripts/developer/tests/qmlTest.js +++ b/scripts/developer/tests/qmlTest.js @@ -4,7 +4,6 @@ qmlWindow = new OverlayWindow({ source: "qrc:///qml/OverlayWindowTest.qml", height: 240, width: 320, - toolWindow: false, visible: true }); diff --git a/scripts/developer/tests/textureStress.js b/scripts/developer/tests/textureStress.js index 1e3cf9a367..98af4b19b7 100644 --- a/scripts/developer/tests/textureStress.js +++ b/scripts/developer/tests/textureStress.js @@ -15,7 +15,6 @@ qmlWindow = new OverlayWindow({ source: qml, height: 240, width: 320, - toolWindow: false, visible: true }); diff --git a/scripts/developer/tests/toolWindowStressTest.js b/scripts/developer/tests/toolWindowStressTest.js deleted file mode 100644 index 44b059ebda..0000000000 --- a/scripts/developer/tests/toolWindowStressTest.js +++ /dev/null @@ -1,31 +0,0 @@ -var TOGGLE_RATE = 1000; -var RUNTIME = 60 * 1000; - -var webView; -var running = true; - -function toggleWindow() { - if (!running) { - return; - } - - if (webView) { - webView.close(); - webView = null; - } else { - webView = new OverlayWebWindow({ - title: 'Entity Properties', - source: "http://www.google.com", - toolWindow: true - }); - webView.setVisible(true); - } - Script.setTimeout(toggleWindow, TOGGLE_RATE) -} - -toggleWindow(); -print("Creating window?") - -Script.setTimeout(function(){ - print("Shutting down") -}, RUNTIME) From 6cedc016c49d80d468f32e1bc3449a51ae70ea61 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 12 Jan 2018 16:08:52 -0700 Subject: [PATCH 45/86] Adding sender/recipient to transaction history for hfc transfers --- interface/src/commerce/Ledger.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index 64875c43a8..269e8b5e06 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -118,7 +118,7 @@ void Ledger::inventory(const QStringList& keys) { keysQuery("inventory", "inventorySuccess", "inventoryFailure"); } -QString amountString(const QString& label, const QString&color, const QJsonValue& moneyValue, const QJsonValue& certsValue) { +QString amountString(const QString& label, const QString&color, const QJsonValue& moneyValue, const QJsonValue& certsValue, const QJsonValue& usernameValue) { int money = moneyValue.toInt(); int certs = certsValue.toInt(); if (money <= 0 && certs <= 0) { @@ -134,7 +134,15 @@ QString amountString(const QString& label, const QString&color, const QJsonValue } result += QString((certs == 1) ? " %1 certificate" : " %1 certificates").arg(certs); } - return result + QString(""); + result += QString(""); + + // the only time we put the username in is when the money value is > 0 + // and the certificate value == 0, as we only want this for hfc transfers + // Also - we don't bother if the username is 'highfidelity' or 'marketplace' + if (money > 0 && certs == 0) { + result += QString(" %1 %2").arg(label == "sent" ? "to" : "from", usernameValue.toString()); + } + return result; } static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace/items/"; @@ -158,8 +166,8 @@ void Ledger::historySuccess(QNetworkReply& reply) { // TODO: do this with 0 copies if possible for (auto it = historyArray.begin(); it != historyArray.end(); it++) { auto valueObject = (*it).toObject(); - QString sent = amountString("sent", "EA4C5F", valueObject["sent_money"], valueObject["sent_certs"]); - QString received = amountString("received", "1FC6A6", valueObject["received_money"], valueObject["received_certs"]); + QString sent = amountString("sent", "EA4C5F", valueObject["sent_money"], valueObject["sent_certs"], valueObject["recipient_name"]); + QString received = amountString("received", "1FC6A6", valueObject["received_money"], valueObject["received_certs"], valueObject["sender_name"]); // turns out on my machine, toLocalTime convert to some weird timezone, yet the // systemTimeZone is correct. To avoid a strange bug with other's systems too, lets From 508a3b37cd87cefe0fa4a8a0e7603ef8576b5403 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 12 Jan 2018 15:28:42 -0800 Subject: [PATCH 46/86] fix icon. button lights up when run in enabled --- scripts/system/assets/images/run.svg | 1 + scripts/system/run.js | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 scripts/system/assets/images/run.svg diff --git a/scripts/system/assets/images/run.svg b/scripts/system/assets/images/run.svg new file mode 100644 index 0000000000..0957166346 --- /dev/null +++ b/scripts/system/assets/images/run.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/scripts/system/run.js b/scripts/system/run.js index edd6e20021..054cca6d9c 100644 --- a/scripts/system/run.js +++ b/scripts/system/run.js @@ -3,18 +3,24 @@ /* global Script, Tablet, MyAvatar */ (function() { // BEGIN LOCAL_SCOPE + var WALK_SPEED = 2.6; + var RUN_SPEED = 4.5; + var MIDDLE_SPEED = (WALK_SPEED + RUN_SPEED) / 2.0; + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var button = tablet.addButton({ - icon: Script.resolvePath("assets/images/icon-particles.svg"), - text: "Run", + icon: Script.resolvePath("assets/images/run.svg"), + text: "RUN", sortOrder: 15 }); function onClicked() { - if (MyAvatar.walkSpeed < 4) { - MyAvatar.walkSpeed = 4.5; + if (MyAvatar.walkSpeed < MIDDLE_SPEED) { + button.editProperties({isActive: true}); + MyAvatar.walkSpeed = RUN_SPEED; } else { - MyAvatar.walkSpeed = 2.6; + button.editProperties({isActive: false}); + MyAvatar.walkSpeed = WALK_SPEED; } } @@ -24,4 +30,10 @@ } button.clicked.connect(onClicked); + if (MyAvatar.walkSpeed < MIDDLE_SPEED) { + button.editProperties({isActive: false}); + } else { + button.editProperties({isActive: true}); + } + }()); From f6ce25405929a68acc8c5f3b550e94128350cdf3 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 12 Jan 2018 15:30:44 -0800 Subject: [PATCH 47/86] put run.js back in defaultScripts --- scripts/defaultScripts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 71755e3abb..f934bfef53 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -30,7 +30,8 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/dialTone.js", "system/firstPersonHMD.js", "system/tablet-ui/tabletUI.js", - "system/emote.js" + "system/emote.js", + "system/run.js" ]; var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js" From 283b9a8003458af3ef7f00f82760fcdbfb6c7caf Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 12 Jan 2018 15:31:54 -0800 Subject: [PATCH 48/86] fix softEntity edge cases --- .../src/avatars-renderer/Avatar.cpp | 8 +++---- .../src/avatars-renderer/Avatar.h | 1 + .../src/RenderableModelEntityItem.cpp | 23 +++++++++++++------ .../src/RenderableModelEntityItem.h | 1 + libraries/render-utils/src/Model.cpp | 2 +- libraries/render-utils/src/Model.h | 5 ++-- .../developer/tests/avatarAttachmentTest.js | 2 +- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 2c6cf7d620..fb5ca84ac7 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -352,10 +352,10 @@ void Avatar::updateAvatarEntities() { void Avatar::relayJointDataToChildren() { forEachChild([&](SpatiallyNestablePointer child) { if (child->getNestableType() == NestableType::Entity) { - auto modelEntity = std::dynamic_pointer_cast(child); + auto modelEntity = std::dynamic_pointer_cast(child); if (modelEntity) { if (modelEntity->getRelayParentJoints()) { - if (!(modelEntity->getJointMapCompleted())) { + if (!modelEntity->getJointMapCompleted() || _reconstructSoftEntitiesJointMap) { QStringList modelJointNames = modelEntity->getJointNames(); int numJoints = modelJointNames.count(); std::vector map; @@ -365,7 +365,6 @@ void Avatar::relayJointDataToChildren() { int avatarJointIndex = getJointIndex(jointName); glm::quat jointRotation; glm::vec3 jointTranslation; - qDebug() << avatarJointIndex; if (avatarJointIndex < 0) { jointRotation = modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); jointTranslation = modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); @@ -385,7 +384,6 @@ void Avatar::relayJointDataToChildren() { int numJoints = modelJointNames.count(); for (int jointIndex = 0; jointIndex < numJoints; jointIndex++) { int avatarJointIndex = modelEntity->avatarJointIndex(jointIndex); - int index = modelEntity->getJointIndex(modelJointNames.at(jointIndex)); glm::quat jointRotation; glm::vec3 jointTranslation; if (avatarJointIndex >=0) { @@ -406,6 +404,7 @@ void Avatar::relayJointDataToChildren() { } } }); + _reconstructSoftEntitiesJointMap = false; } void Avatar::simulate(float deltaTime, bool inView) { @@ -1259,6 +1258,7 @@ void Avatar::setModelURLFinished(bool success) { invalidateJointIndicesCache(); _isAnimatingScale = true; + _reconstructSoftEntitiesJointMap = true; if (!success && _skeletonModelURL != AvatarData::defaultFullAvatarModelUrl()) { const int MAX_SKELETON_DOWNLOAD_ATTEMPTS = 4; // NOTE: we don't want to be as generous as ResourceCache is, we only want 4 attempts diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h index e4efb67ebf..3fe14f980f 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h @@ -383,6 +383,7 @@ protected: bool _isAnimatingScale { false }; bool _mustFadeIn { false }; bool _isFading { false }; + bool _reconstructSoftEntitiesJointMap { false }; float _modelScale { 1.0f }; static int _jointConesID; diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index d8b1bf1540..5e68ac6a62 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -209,12 +209,6 @@ void RenderableModelEntityItem::updateModelBounds() { updateRenderItems = true; } - if (getRelayParentJoints()) { - model->setOverrideTransform(true); - } else { - model->setOverrideTransform(false); - } - if (model->getScaleToFitDimensions() != getScaledDimensions() || model->getRegistrationPoint() != getRegistrationPoint()) { // The machinery for updateModelBounds will give existing models the opportunity to fix their @@ -718,7 +712,10 @@ void RenderableModelEntityItem::setJointMap(std::vector jointMap) { if (jointMap.size() > 0) { _jointMap = jointMap; _jointMapCompleted = true; + return; } + + _jointMapCompleted = false; }; int RenderableModelEntityItem::avatarJointIndex(int modelJointIndex) { @@ -865,7 +862,7 @@ glm::vec3 RenderableModelEntityItem::getLocalJointTranslation(int index) const { void RenderableModelEntityItem::setOverrideTransform(const Transform& transform, const glm::vec3& offset) { auto model = getModel(); if (model) { - model->overrideModelTransform(transform, offset); + model->overrideModelTransformAndOffset(transform, offset); } } @@ -972,6 +969,17 @@ void RenderableModelEntityItem::simulateRelayedJoints() { } } +void RenderableModelEntityItem::stopModelOverrideIfNoParent() { + auto model = getModel(); + if (model) { + bool overriding = model->isOverridingModelTransformAndOffset(); + QUuid parentID = getParentID(); + if (overriding && (!_relayParentJoints || parentID.isNull())) { + model->stopTransformAndOffsetOverride(); + } + } +} + void RenderableModelEntityItem::copyAnimationJointDataToModel() { auto model = getModel(); if (!model || !model->isLoaded()) { @@ -1323,6 +1331,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce } entity->updateModelBounds(); + entity->stopModelOverrideIfNoParent(); if (model->isVisible() != _visible) { // FIXME: this seems like it could be optimized if we tracked our last known visible state in diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 1d00767030..b3988e0239 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -81,6 +81,7 @@ public: void setCollisionShape(const btCollisionShape* shape) override; virtual bool contains(const glm::vec3& point) const override; + void stopModelOverrideIfNoParent(); virtual bool shouldBePhysical() const override; void simulateRelayedJoints(); diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 874fd09a79..68d407ac2b 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1369,7 +1369,7 @@ void Model::deleteGeometry() { _collisionGeometry.reset(); } -void Model::overrideModelTransform(const Transform& transform, const glm::vec3& offset) { +void Model::overrideModelTransformAndOffset(const Transform& transform, const glm::vec3& offset) { _overrideTranslation = transform.getTranslation(); _overrideRotation = transform.getRotation(); _overrideModelTransform = true; diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 554d3a4f47..fa773daa6e 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -208,8 +208,9 @@ public: void setTranslation(const glm::vec3& translation); void setRotation(const glm::quat& rotation); - void overrideModelTransform(const Transform& transform, const glm::vec3& offset); - void setOverrideTransform(bool override) { _overrideModelTransform = override; }; + void overrideModelTransformAndOffset(const Transform& transform, const glm::vec3& offset); + bool isOverridingModelTransformAndOffset() { return _overrideModelTransform; }; + void stopTransformAndOffsetOverride() { _overrideModelTransform = false; }; void setTransformNoUpdateRenderItems(const Transform& transform); // temporary HACK const glm::vec3& getTranslation() const { return _translation; } diff --git a/scripts/developer/tests/avatarAttachmentTest.js b/scripts/developer/tests/avatarAttachmentTest.js index ecc8c5a0af..b9dfcf9596 100644 --- a/scripts/developer/tests/avatarAttachmentTest.js +++ b/scripts/developer/tests/avatarAttachmentTest.js @@ -165,7 +165,7 @@ function wearAttachment(attachment) { position: attachment.position, rotation: attachment.rotation, parentJointIndex: -1 - }); + }, true); } } From c76fdd1f5fe98a6710f36394bb25554330830da3 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 15 Jan 2018 10:43:26 -0800 Subject: [PATCH 49/86] adding scale --- libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp | 5 +++-- libraries/render-utils/src/Model.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index fb5ca84ac7..0f9573bb84 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -397,8 +397,9 @@ void Avatar::relayJointDataToChildren() { modelEntity->setLocalJointTranslation(jointIndex, jointTranslation); } } - - modelEntity->setOverrideTransform(_skeletonModel->getTransform(), _skeletonModel->getOffset()); + Transform avatarTransform = _skeletonModel->getTransform(); + avatarTransform.setScale(_skeletonModel->getScale()); + modelEntity->setOverrideTransform(avatarTransform, _skeletonModel->getOffset()); modelEntity->simulateRelayedJoints(); } } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 68d407ac2b..3744a0f090 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1373,6 +1373,7 @@ void Model::overrideModelTransformAndOffset(const Transform& transform, const gl _overrideTranslation = transform.getTranslation(); _overrideRotation = transform.getRotation(); _overrideModelTransform = true; + setScale(transform.getScale()); setOffset(offset); } From 6686b328c7a4aed70c2a1595eb10a0df9fec75db Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Tue, 16 Jan 2018 10:47:46 +0100 Subject: [PATCH 50/86] Fixed error in Specular shader which gave low key specular highlights --- libraries/render-utils/src/LightingModel.slh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/LightingModel.slh b/libraries/render-utils/src/LightingModel.slh index d96c565b81..7d08fdabaf 100644 --- a/libraries/render-utils/src/LightingModel.slh +++ b/libraries/render-utils/src/LightingModel.slh @@ -133,7 +133,7 @@ SurfaceData initSurfaceData(float roughness, vec3 normal, vec3 eyeDir) { SurfaceData surface; surface.eyeDir = eyeDir; surface.normal = normal; - surface.roughness = mix(0.001, 1.0, roughness); + surface.roughness = mix(0.01, 1.0, roughness); surface.roughness2 = surface.roughness * surface.roughness; surface.roughness4 = surface.roughness2 * surface.roughness2; surface.ndotv = clamp(dot(normal, eyeDir), 0.0, 1.0); @@ -181,7 +181,7 @@ float fresnelSchlickScalar(float fresnelScalar, SurfaceData surface) { float specularDistribution(SurfaceData surface) { // See https://www.khronos.org/assets/uploads/developers/library/2017-web3d/glTF-2.0-Launch_Jun17.pdf // for details of equations, especially page 20 - float denom = (surface.ndoth*surface.ndoth * (surface.roughness2 - 1.0) + 1.0); + float denom = (surface.ndoth*surface.ndoth * (surface.roughness4 - 1.0) + 1.0); denom *= denom; // Add geometric factors G1(n,l) and G1(n,v) float smithInvG1NdotL = evalSmithInvG1(surface.roughness4, surface.ndotl); From 08ccda9cfcc33cbd015ec501aac05a95cf2f5f20 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 16 Jan 2018 12:44:44 -0500 Subject: [PATCH 51/86] rename libraries/model(src/model) -> libraries/graphics(src/graphics) --- android/app/CMakeLists.txt | 2 +- assignment-client/CMakeLists.txt | 2 +- interface/CMakeLists.txt | 2 +- interface/src/Application.h | 2 +- libraries/animation/CMakeLists.txt | 2 +- libraries/avatars-renderer/CMakeLists.txt | 4 ++-- libraries/baking/CMakeLists.txt | 2 +- libraries/display-plugins/CMakeLists.txt | 2 +- libraries/entities-renderer/CMakeLists.txt | 4 ++-- .../entities-renderer/src/RenderablePolyVoxEntityItem.cpp | 2 +- .../entities-renderer/src/RenderablePolyVoxEntityItem.h | 4 ++-- .../entities-renderer/src/RenderableZoneEntityItem.cpp | 2 +- libraries/entities-renderer/src/RenderableZoneEntityItem.h | 6 +++--- libraries/entities-renderer/src/polyvox.slf | 2 +- libraries/entities-renderer/src/polyvox_fade.slf | 2 +- libraries/entities/CMakeLists.txt | 2 +- libraries/fbx/CMakeLists.txt | 2 +- libraries/fbx/src/FBX.h | 4 ++-- libraries/fbx/src/FBXReader.h | 4 ++-- libraries/fbx/src/OBJWriter.cpp | 2 +- libraries/fbx/src/OBJWriter.h | 2 +- libraries/{model => graphics}/CMakeLists.txt | 4 ++-- .../{model/src/model => graphics/src/graphics}/Asset.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/Asset.h | 2 +- .../{model/src/model => graphics/src/graphics}/Forward.h | 2 +- .../{model/src/model => graphics/src/graphics}/Geometry.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/Geometry.h | 2 +- .../src/graphics/GraphicsLogging.cpp} | 4 ++-- .../src/graphics/GraphicsLogging.h} | 4 ++-- .../{model/src/model => graphics/src/graphics}/Haze.cpp | 2 +- libraries/{model/src/model => graphics/src/graphics}/Haze.h | 2 +- .../{model/src/model => graphics/src/graphics}/Light.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/Light.h | 2 +- .../{model/src/model => graphics/src/graphics}/Light.slh | 6 +++--- .../src/graphics}/LightIrradiance.shared.slh | 0 .../model => graphics/src/graphics}/LightVolume.shared.slh | 2 +- .../{model/src/model => graphics/src/graphics}/Material.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/Material.h | 2 +- .../{model/src/model => graphics/src/graphics}/Material.slh | 0 .../{model/src/model => graphics/src/graphics}/Skybox.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/Skybox.h | 2 +- .../src/graphics}/SphericalHarmonics.shared.slh | 2 +- .../{model/src/model => graphics/src/graphics}/Stage.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/Stage.h | 2 +- .../src/model => graphics/src/graphics}/TextureMap.cpp | 2 +- .../{model/src/model => graphics/src/graphics}/TextureMap.h | 2 +- .../{model/src/model => graphics/src/graphics}/skybox.slf | 0 .../{model/src/model => graphics/src/graphics}/skybox.slv | 0 libraries/model-networking/CMakeLists.txt | 2 +- .../model-networking/src/model-networking/ModelCache.h | 4 ++-- .../src/model-networking/SimpleMeshProxy.cpp | 2 +- .../model-networking/src/model-networking/TextureCache.h | 2 +- libraries/physics/CMakeLists.txt | 2 +- libraries/physics/src/CollisionRenderMeshCache.h | 2 +- libraries/procedural/CMakeLists.txt | 4 ++-- libraries/procedural/src/procedural/ProceduralSkybox.cpp | 4 ++-- libraries/procedural/src/procedural/ProceduralSkybox.h | 2 +- libraries/render-utils/CMakeLists.txt | 4 ++-- libraries/render-utils/src/BackgroundStage.h | 2 +- libraries/render-utils/src/DeferredGlobalLight.slh | 2 +- libraries/render-utils/src/DeferredLightingEffect.h | 4 ++-- libraries/render-utils/src/DrawHaze.h | 2 +- libraries/render-utils/src/ForwardGlobalLight.slh | 2 +- libraries/render-utils/src/GeometryCache.cpp | 2 +- libraries/render-utils/src/GeometryCache.h | 4 ++-- libraries/render-utils/src/Haze.slf | 2 +- libraries/render-utils/src/HazeStage.h | 4 ++-- libraries/render-utils/src/LightPayload.h | 2 +- libraries/render-utils/src/LightStage.h | 2 +- libraries/render-utils/src/MeshPartPayload.h | 2 +- libraries/render-utils/src/StencilMaskPass.cpp | 2 +- libraries/render-utils/src/StencilMaskPass.h | 2 +- libraries/render-utils/src/deferred_light_point.slv | 2 +- libraries/render-utils/src/deferred_light_spot.slv | 2 +- libraries/render-utils/src/forward_model.slf | 2 +- libraries/render-utils/src/forward_model_normal_map.slf | 2 +- .../render-utils/src/forward_model_normal_specular_map.slf | 2 +- libraries/render-utils/src/forward_model_specular_map.slf | 2 +- libraries/render-utils/src/forward_model_translucent.slf | 2 +- libraries/render-utils/src/forward_model_unlit.slf | 2 +- .../render-utils/src/lightClusters_drawClusterContent.slf | 2 +- libraries/render-utils/src/local_lights_drawOutline.slf | 2 +- libraries/render-utils/src/local_lights_shading.slf | 2 +- libraries/render-utils/src/model.slf | 2 +- libraries/render-utils/src/model_fade.slf | 2 +- libraries/render-utils/src/model_lightmap.slf | 2 +- libraries/render-utils/src/model_lightmap_fade.slf | 2 +- libraries/render-utils/src/model_lightmap_normal_map.slf | 2 +- .../render-utils/src/model_lightmap_normal_map_fade.slf | 2 +- .../render-utils/src/model_lightmap_normal_specular_map.slf | 2 +- .../src/model_lightmap_normal_specular_map_fade.slf | 2 +- libraries/render-utils/src/model_lightmap_specular_map.slf | 2 +- .../render-utils/src/model_lightmap_specular_map_fade.slf | 2 +- libraries/render-utils/src/model_normal_map.slf | 2 +- libraries/render-utils/src/model_normal_map_fade.slf | 2 +- libraries/render-utils/src/model_normal_specular_map.slf | 2 +- .../render-utils/src/model_normal_specular_map_fade.slf | 2 +- libraries/render-utils/src/model_specular_map.slf | 2 +- libraries/render-utils/src/model_specular_map_fade.slf | 2 +- libraries/render-utils/src/model_translucent.slf | 2 +- libraries/render-utils/src/model_translucent_fade.slf | 2 +- libraries/render-utils/src/model_translucent_unlit.slf | 2 +- libraries/render-utils/src/model_translucent_unlit_fade.slf | 2 +- libraries/render-utils/src/model_unlit.slf | 2 +- libraries/render-utils/src/model_unlit_fade.slf | 2 +- libraries/render-utils/src/overlay3D.slf | 2 +- libraries/render-utils/src/overlay3D_model.slf | 2 +- libraries/render-utils/src/overlay3D_model_translucent.slf | 2 +- .../render-utils/src/overlay3D_model_translucent_unlit.slf | 2 +- libraries/render-utils/src/overlay3D_model_unlit.slf | 2 +- libraries/render-utils/src/overlay3D_translucent.slf | 2 +- libraries/render-utils/src/simple.slf | 2 +- libraries/render-utils/src/simple_fade.slf | 2 +- libraries/render-utils/src/simple_textured.slf | 2 +- libraries/render-utils/src/simple_textured_fade.slf | 2 +- .../src/subsurfaceScattering_drawScattering.slf | 2 +- libraries/render-utils/src/zone_drawAmbient.slf | 2 +- libraries/render-utils/src/zone_drawKeyLight.slf | 2 +- libraries/render/CMakeLists.txt | 4 ++-- libraries/render/src/render/Item.h | 2 +- libraries/script-engine/CMakeLists.txt | 2 +- libraries/script-engine/src/SceneScriptingInterface.h | 2 +- plugins/openvr/CMakeLists.txt | 2 +- plugins/openvr/src/ViveControllerManager.h | 2 +- tests/animation/CMakeLists.txt | 2 +- tests/entities/CMakeLists.txt | 2 +- tests/gpu-test/CMakeLists.txt | 4 ++-- tests/octree/CMakeLists.txt | 2 +- tests/physics/CMakeLists.txt | 2 +- tests/render-perf/CMakeLists.txt | 2 +- tests/render-perf/src/main.cpp | 2 +- tests/render-texture-load/CMakeLists.txt | 2 +- tests/shaders/CMakeLists.txt | 4 ++-- tests/shaders/src/main.cpp | 4 ++-- tools/oven/CMakeLists.txt | 2 +- tools/skeleton-dump/CMakeLists.txt | 2 +- tools/vhacd-util/CMakeLists.txt | 2 +- 137 files changed, 156 insertions(+), 156 deletions(-) rename libraries/{model => graphics}/CMakeLists.txt (50%) rename libraries/{model/src/model => graphics/src/graphics}/Asset.cpp (90%) rename libraries/{model/src/model => graphics/src/graphics}/Asset.h (98%) rename libraries/{model/src/model => graphics/src/graphics}/Forward.h (92%) rename libraries/{model/src/model => graphics/src/graphics}/Geometry.cpp (99%) rename libraries/{model/src/model => graphics/src/graphics}/Geometry.h (99%) rename libraries/{model/src/model/ModelLogging.cpp => graphics/src/graphics/GraphicsLogging.cpp} (75%) rename libraries/{model/src/model/ModelLogging.h => graphics/src/graphics/GraphicsLogging.h} (81%) rename libraries/{model/src/model => graphics/src/graphics}/Haze.cpp (99%) rename libraries/{model/src/model => graphics/src/graphics}/Haze.h (99%) rename libraries/{model/src/model => graphics/src/graphics}/Light.cpp (99%) rename libraries/{model/src/model => graphics/src/graphics}/Light.h (99%) rename libraries/{model/src/model => graphics/src/graphics}/Light.slh (93%) rename libraries/{model/src/model => graphics/src/graphics}/LightIrradiance.shared.slh (100%) rename libraries/{model/src/model => graphics/src/graphics}/LightVolume.shared.slh (98%) rename libraries/{model/src/model => graphics/src/graphics}/Material.cpp (99%) rename libraries/{model/src/model => graphics/src/graphics}/Material.h (99%) rename libraries/{model/src/model => graphics/src/graphics}/Material.slh (100%) rename libraries/{model/src/model => graphics/src/graphics}/Skybox.cpp (99%) rename libraries/{model/src/model => graphics/src/graphics}/Skybox.h (97%) rename libraries/{model/src/model => graphics/src/graphics}/SphericalHarmonics.shared.slh (97%) rename libraries/{model/src/model => graphics/src/graphics}/Stage.cpp (99%) rename libraries/{model/src/model => graphics/src/graphics}/Stage.h (99%) rename libraries/{model/src/model => graphics/src/graphics}/TextureMap.cpp (96%) rename libraries/{model/src/model => graphics/src/graphics}/TextureMap.h (97%) rename libraries/{model/src/model => graphics/src/graphics}/skybox.slf (100%) rename libraries/{model/src/model => graphics/src/graphics}/skybox.slv (100%) diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt index 4411b7b1bb..5682611151 100644 --- a/android/app/CMakeLists.txt +++ b/android/app/CMakeLists.txt @@ -11,7 +11,7 @@ link_hifi_libraries( physics audio audio-client ui midi controllers pointers - model model-networking fbx animation + graphics model-networking fbx animation entities entities-renderer avatars avatars-renderer ui-plugins input-plugins diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index e657587a7a..acdc1cbc53 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -11,7 +11,7 @@ setup_memory_debugger() # link in the shared libraries link_hifi_libraries( - audio avatars octree gpu model fbx entities + audio avatars octree gpu graphics fbx entities networking animation recording shared script-engine embedded-webserver controllers physics plugins midi image ) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 6b78826d75..21225756b4 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -201,7 +201,7 @@ endif() # link required hifi libraries link_hifi_libraries( - shared octree ktx gpu gl procedural model render + shared octree ktx gpu gl procedural graphics render pointers recording fbx networking model-networking entities avatars trackers audio audio-client animation script-engine physics diff --git a/interface/src/Application.h b/interface/src/Application.h index effb35caee..6b70e88b89 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -71,7 +71,7 @@ #include "UndoStackScriptingInterface.h" #include -#include +#include #include #include "FrameTimingsScriptingInterface.h" diff --git a/libraries/animation/CMakeLists.txt b/libraries/animation/CMakeLists.txt index b9fef19fbb..1ec6194afd 100644 --- a/libraries/animation/CMakeLists.txt +++ b/libraries/animation/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME animation) setup_hifi_library(Network Script) -link_hifi_libraries(shared model fbx) +link_hifi_libraries(shared graphics fbx) include_hifi_library_headers(networking) include_hifi_library_headers(gpu) diff --git a/libraries/avatars-renderer/CMakeLists.txt b/libraries/avatars-renderer/CMakeLists.txt index 148835965e..53edc692f2 100644 --- a/libraries/avatars-renderer/CMakeLists.txt +++ b/libraries/avatars-renderer/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_NAME avatars-renderer) -AUTOSCRIBE_SHADER_LIB(gpu model render render-utils) +AUTOSCRIBE_SHADER_LIB(gpu graphics render render-utils) setup_hifi_library(Widgets Network Script) -link_hifi_libraries(shared gpu model animation model-networking script-engine render render-utils image trackers entities-renderer) +link_hifi_libraries(shared gpu graphics animation model-networking script-engine render render-utils image trackers entities-renderer) include_hifi_library_headers(avatars) include_hifi_library_headers(networking) include_hifi_library_headers(fbx) diff --git a/libraries/baking/CMakeLists.txt b/libraries/baking/CMakeLists.txt index 66cf791776..ec7caf574b 100644 --- a/libraries/baking/CMakeLists.txt +++ b/libraries/baking/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_NAME baking) setup_hifi_library(Concurrent) -link_hifi_libraries(shared model networking ktx image fbx) +link_hifi_libraries(shared graphics networking ktx image fbx) include_hifi_library_headers(gpu) add_dependency_external_projects(draco) diff --git a/libraries/display-plugins/CMakeLists.txt b/libraries/display-plugins/CMakeLists.txt index 1fd855e6aa..1d9d42d579 100644 --- a/libraries/display-plugins/CMakeLists.txt +++ b/libraries/display-plugins/CMakeLists.txt @@ -5,7 +5,7 @@ link_hifi_libraries(shared plugins ui-plugins gl ui render-utils ${PLATFORM_GL_B include_hifi_library_headers(gpu) include_hifi_library_headers(model-networking) include_hifi_library_headers(networking) -include_hifi_library_headers(model) +include_hifi_library_headers(graphics) include_hifi_library_headers(fbx) include_hifi_library_headers(image) include_hifi_library_headers(ktx) diff --git a/libraries/entities-renderer/CMakeLists.txt b/libraries/entities-renderer/CMakeLists.txt index 19987197b8..ea75367e1e 100644 --- a/libraries/entities-renderer/CMakeLists.txt +++ b/libraries/entities-renderer/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_NAME entities-renderer) -AUTOSCRIBE_SHADER_LIB(gpu model procedural render render-utils) +AUTOSCRIBE_SHADER_LIB(gpu graphics procedural render render-utils) setup_hifi_library(Widgets Network Script) -link_hifi_libraries(shared gpu procedural model model-networking script-engine render render-utils image ui pointers) +link_hifi_libraries(shared gpu procedural graphics model-networking script-engine render render-utils image ui pointers) include_hifi_library_headers(networking) include_hifi_library_headers(gl) include_hifi_library_headers(ktx) diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index ad0202457e..365ba5189a 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -65,7 +65,7 @@ #pragma warning(pop) #endif -#include "model/Geometry.h" +#include "graphics/Geometry.h" #include "StencilMaskPass.h" diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h index 6ac518f79b..8dbe1dd0f1 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index 3ecce5ec38..4161b65ead 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -13,7 +13,7 @@ #include -#include +#include #include #include diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.h b/libraries/entities-renderer/src/RenderableZoneEntityItem.h index 3174f00f4f..e1f696ca89 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.h +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.h @@ -13,9 +13,9 @@ #define hifi_RenderableZoneEntityItem_h #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/libraries/entities-renderer/src/polyvox.slf b/libraries/entities-renderer/src/polyvox.slf index 56f6f31d71..50034db48c 100644 --- a/libraries/entities-renderer/src/polyvox.slf +++ b/libraries/entities-renderer/src/polyvox.slf @@ -11,7 +11,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include DeferredBufferWrite.slh@> in vec3 _normal; diff --git a/libraries/entities-renderer/src/polyvox_fade.slf b/libraries/entities-renderer/src/polyvox_fade.slf index 7af43be53f..4c179a15b6 100644 --- a/libraries/entities-renderer/src/polyvox_fade.slf +++ b/libraries/entities-renderer/src/polyvox_fade.slf @@ -11,7 +11,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include DeferredBufferWrite.slh@> <@include Fade.slh@> diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index c23740654e..d6d9058e44 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME entities) setup_hifi_library(Network Script) include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") -link_hifi_libraries(shared networking octree avatars model) +link_hifi_libraries(shared networking octree avatars graphics) diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index 683ddb52f7..e422af3629 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_NAME fbx) setup_hifi_library() -link_hifi_libraries(shared model networking image) +link_hifi_libraries(shared graphics networking image) include_hifi_library_headers(gpu image) target_draco() diff --git a/libraries/fbx/src/FBX.h b/libraries/fbx/src/FBX.h index 50d40c35ac..21f8fe51aa 100644 --- a/libraries/fbx/src/FBX.h +++ b/libraries/fbx/src/FBX.h @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include static const QByteArray FBX_BINARY_PROLOG = "Kaydara FBX Binary "; static const int FBX_HEADER_BYTES_BEFORE_VERSION = 23; diff --git a/libraries/fbx/src/FBXReader.h b/libraries/fbx/src/FBXReader.h index 34d63b098a..e446861627 100644 --- a/libraries/fbx/src/FBXReader.h +++ b/libraries/fbx/src/FBXReader.h @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include class QIODevice; class FBXNode; diff --git a/libraries/fbx/src/OBJWriter.cpp b/libraries/fbx/src/OBJWriter.cpp index e0d3d36b06..42ef2be646 100644 --- a/libraries/fbx/src/OBJWriter.cpp +++ b/libraries/fbx/src/OBJWriter.cpp @@ -11,7 +11,7 @@ #include #include -#include "model/Geometry.h" +#include "graphics/Geometry.h" #include "OBJWriter.h" #include "ModelFormatLogging.h" diff --git a/libraries/fbx/src/OBJWriter.h b/libraries/fbx/src/OBJWriter.h index b6e20e1ae6..7f8b0ddbed 100644 --- a/libraries/fbx/src/OBJWriter.h +++ b/libraries/fbx/src/OBJWriter.h @@ -15,7 +15,7 @@ #include #include -#include +#include using MeshPointer = std::shared_ptr; diff --git a/libraries/model/CMakeLists.txt b/libraries/graphics/CMakeLists.txt similarity index 50% rename from libraries/model/CMakeLists.txt rename to libraries/graphics/CMakeLists.txt index da85b6aa3d..2b15604fdf 100755 --- a/libraries/model/CMakeLists.txt +++ b/libraries/graphics/CMakeLists.txt @@ -1,4 +1,4 @@ -set(TARGET_NAME model) -AUTOSCRIBE_SHADER_LIB(gpu model) +set(TARGET_NAME graphics) +AUTOSCRIBE_SHADER_LIB(gpu graphics) setup_hifi_library() link_hifi_libraries(shared ktx gpu image) \ No newline at end of file diff --git a/libraries/model/src/model/Asset.cpp b/libraries/graphics/src/graphics/Asset.cpp similarity index 90% rename from libraries/model/src/model/Asset.cpp rename to libraries/graphics/src/graphics/Asset.cpp index d839dad809..84d7560257 100644 --- a/libraries/model/src/model/Asset.cpp +++ b/libraries/graphics/src/graphics/Asset.cpp @@ -1,6 +1,6 @@ // // Asset.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 08/21/2015. // Copyright 2015 High Fidelity, Inc. diff --git a/libraries/model/src/model/Asset.h b/libraries/graphics/src/graphics/Asset.h similarity index 98% rename from libraries/model/src/model/Asset.h rename to libraries/graphics/src/graphics/Asset.h index 51fc177538..c2e4ff3d3a 100644 --- a/libraries/model/src/model/Asset.h +++ b/libraries/graphics/src/graphics/Asset.h @@ -1,6 +1,6 @@ // // Asset.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 08/21/2015. // Copyright 2015 High Fidelity, Inc. diff --git a/libraries/model/src/model/Forward.h b/libraries/graphics/src/graphics/Forward.h similarity index 92% rename from libraries/model/src/model/Forward.h rename to libraries/graphics/src/graphics/Forward.h index 90f55fa64f..7f728b44fc 100644 --- a/libraries/model/src/model/Forward.h +++ b/libraries/graphics/src/graphics/Forward.h @@ -1,6 +1,6 @@ // // Forward.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Bradley Austin Davis on 2017/06/21 // Copyright 2013-2017 High Fidelity, Inc. diff --git a/libraries/model/src/model/Geometry.cpp b/libraries/graphics/src/graphics/Geometry.cpp similarity index 99% rename from libraries/model/src/model/Geometry.cpp rename to libraries/graphics/src/graphics/Geometry.cpp index 210b4ae8f3..930449c5e6 100755 --- a/libraries/model/src/model/Geometry.cpp +++ b/libraries/graphics/src/graphics/Geometry.cpp @@ -1,6 +1,6 @@ // // Geometry.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 12/5/2014. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Geometry.h b/libraries/graphics/src/graphics/Geometry.h similarity index 99% rename from libraries/model/src/model/Geometry.h rename to libraries/graphics/src/graphics/Geometry.h index 260de313ab..510cf54742 100755 --- a/libraries/model/src/model/Geometry.h +++ b/libraries/graphics/src/graphics/Geometry.h @@ -1,6 +1,6 @@ // // Geometry.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 12/5/2014. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/ModelLogging.cpp b/libraries/graphics/src/graphics/GraphicsLogging.cpp similarity index 75% rename from libraries/model/src/model/ModelLogging.cpp rename to libraries/graphics/src/graphics/GraphicsLogging.cpp index 3b3fbed82c..9c46e89331 100644 --- a/libraries/model/src/model/ModelLogging.cpp +++ b/libraries/graphics/src/graphics/GraphicsLogging.cpp @@ -6,6 +6,6 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ModelLogging.h" +#include "GraphicsLogging.h" -Q_LOGGING_CATEGORY(modelLog, "hifi.model") \ No newline at end of file +Q_LOGGING_CATEGORY(graphicsLog, "hifi.graphics") diff --git a/libraries/model/src/model/ModelLogging.h b/libraries/graphics/src/graphics/GraphicsLogging.h similarity index 81% rename from libraries/model/src/model/ModelLogging.h rename to libraries/graphics/src/graphics/GraphicsLogging.h index 33ed6fb059..29e3a7ffcd 100644 --- a/libraries/model/src/model/ModelLogging.h +++ b/libraries/graphics/src/graphics/GraphicsLogging.h @@ -1,5 +1,5 @@ // -// ModelLogging.h +// GraphicsLogging.h // hifi // // Created by Sam Gateau on 9/20/15. @@ -11,4 +11,4 @@ #include -Q_DECLARE_LOGGING_CATEGORY(modelLog) +Q_DECLARE_LOGGING_CATEGORY(graphicsLog) diff --git a/libraries/model/src/model/Haze.cpp b/libraries/graphics/src/graphics/Haze.cpp similarity index 99% rename from libraries/model/src/model/Haze.cpp rename to libraries/graphics/src/graphics/Haze.cpp index b56932e131..dd07afc6d6 100644 --- a/libraries/model/src/model/Haze.cpp +++ b/libraries/graphics/src/graphics/Haze.cpp @@ -1,6 +1,6 @@ // // Haze.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Nissim Hadar on 9/13/2017. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Haze.h b/libraries/graphics/src/graphics/Haze.h similarity index 99% rename from libraries/model/src/model/Haze.h rename to libraries/graphics/src/graphics/Haze.h index 2a575eb151..260f5f0097 100644 --- a/libraries/model/src/model/Haze.h +++ b/libraries/graphics/src/graphics/Haze.h @@ -1,6 +1,6 @@ // // MakeHaze.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Nissim Hadar on 9/13/2017. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Light.cpp b/libraries/graphics/src/graphics/Light.cpp similarity index 99% rename from libraries/model/src/model/Light.cpp rename to libraries/graphics/src/graphics/Light.cpp index 19da084f84..8b6aae7759 100755 --- a/libraries/model/src/model/Light.cpp +++ b/libraries/graphics/src/graphics/Light.cpp @@ -1,6 +1,6 @@ // // Light.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 1/26/2014. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Light.h b/libraries/graphics/src/graphics/Light.h similarity index 99% rename from libraries/model/src/model/Light.h rename to libraries/graphics/src/graphics/Light.h index 4c82eb5d77..58d5c0cf2a 100755 --- a/libraries/model/src/model/Light.h +++ b/libraries/graphics/src/graphics/Light.h @@ -1,6 +1,6 @@ // // Light.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 12/10/2014. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Light.slh b/libraries/graphics/src/graphics/Light.slh similarity index 93% rename from libraries/model/src/model/Light.slh rename to libraries/graphics/src/graphics/Light.slh index 093a87adc8..6b24f89c3c 100644 --- a/libraries/model/src/model/Light.slh +++ b/libraries/graphics/src/graphics/Light.slh @@ -11,8 +11,8 @@ <@if not MODEL_LIGHT_SLH@> <@def MODEL_LIGHT_SLH@> -<@include model/LightVolume.shared.slh@> -<@include model/LightIrradiance.shared.slh@> +<@include graphics/LightVolume.shared.slh@> +<@include graphics/LightIrradiance.shared.slh@> // NOw lets define Light struct Light { @@ -30,7 +30,7 @@ float getLightIntensity(Light l) { return lightIrradiance_getIntensity(l.irradia vec3 getLightIrradiance(Light l) { return lightIrradiance_getIrradiance(l.irradiance); } // AMbient lighting needs extra info provided from a different Buffer -<@include model/SphericalHarmonics.shared.slh@> +<@include graphics/SphericalHarmonics.shared.slh@> // Light Ambient struct LightAmbient { vec4 _ambient; diff --git a/libraries/model/src/model/LightIrradiance.shared.slh b/libraries/graphics/src/graphics/LightIrradiance.shared.slh similarity index 100% rename from libraries/model/src/model/LightIrradiance.shared.slh rename to libraries/graphics/src/graphics/LightIrradiance.shared.slh diff --git a/libraries/model/src/model/LightVolume.shared.slh b/libraries/graphics/src/graphics/LightVolume.shared.slh similarity index 98% rename from libraries/model/src/model/LightVolume.shared.slh rename to libraries/graphics/src/graphics/LightVolume.shared.slh index a78667ed6c..3f0cb135f5 100644 --- a/libraries/model/src/model/LightVolume.shared.slh +++ b/libraries/graphics/src/graphics/LightVolume.shared.slh @@ -3,7 +3,7 @@ #define LightVolume_Shared_slh // Light.shared.slh -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 14/9/2016. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Material.cpp b/libraries/graphics/src/graphics/Material.cpp similarity index 99% rename from libraries/model/src/model/Material.cpp rename to libraries/graphics/src/graphics/Material.cpp index 4e01c4b866..0cfb9916ac 100755 --- a/libraries/model/src/model/Material.cpp +++ b/libraries/graphics/src/graphics/Material.cpp @@ -1,6 +1,6 @@ // // Material.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 12/10/2014. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Material.h b/libraries/graphics/src/graphics/Material.h similarity index 99% rename from libraries/model/src/model/Material.h rename to libraries/graphics/src/graphics/Material.h index 8851ef4ce9..6a2b1c2bee 100755 --- a/libraries/model/src/model/Material.h +++ b/libraries/graphics/src/graphics/Material.h @@ -1,6 +1,6 @@ // // Material.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 12/10/2014. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Material.slh b/libraries/graphics/src/graphics/Material.slh similarity index 100% rename from libraries/model/src/model/Material.slh rename to libraries/graphics/src/graphics/Material.slh diff --git a/libraries/model/src/model/Skybox.cpp b/libraries/graphics/src/graphics/Skybox.cpp similarity index 99% rename from libraries/model/src/model/Skybox.cpp rename to libraries/graphics/src/graphics/Skybox.cpp index fd3061afa5..feb9fb86b7 100755 --- a/libraries/model/src/model/Skybox.cpp +++ b/libraries/graphics/src/graphics/Skybox.cpp @@ -1,6 +1,6 @@ // // Skybox.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 5/4/2015. // Copyright 2015 High Fidelity, Inc. diff --git a/libraries/model/src/model/Skybox.h b/libraries/graphics/src/graphics/Skybox.h similarity index 97% rename from libraries/model/src/model/Skybox.h rename to libraries/graphics/src/graphics/Skybox.h index 90896fd8c6..99155bdd98 100755 --- a/libraries/model/src/model/Skybox.h +++ b/libraries/graphics/src/graphics/Skybox.h @@ -1,6 +1,6 @@ // // Skybox.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 5/4/2015. // Copyright 2015 High Fidelity, Inc. diff --git a/libraries/model/src/model/SphericalHarmonics.shared.slh b/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh similarity index 97% rename from libraries/model/src/model/SphericalHarmonics.shared.slh rename to libraries/graphics/src/graphics/SphericalHarmonics.shared.slh index 664c9e52db..312824c5a3 100644 --- a/libraries/model/src/model/SphericalHarmonics.shared.slh +++ b/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh @@ -3,7 +3,7 @@ #define SphericalHarmonics_Shared_slh // SphericalHarmonics.shared.slh -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 14/9/2016. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Stage.cpp b/libraries/graphics/src/graphics/Stage.cpp similarity index 99% rename from libraries/model/src/model/Stage.cpp rename to libraries/graphics/src/graphics/Stage.cpp index 5854162cfa..3a300858fe 100644 --- a/libraries/model/src/model/Stage.cpp +++ b/libraries/graphics/src/graphics/Stage.cpp @@ -1,6 +1,6 @@ // // Stage.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 2/24/2015. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/Stage.h b/libraries/graphics/src/graphics/Stage.h similarity index 99% rename from libraries/model/src/model/Stage.h rename to libraries/graphics/src/graphics/Stage.h index 5f48824568..65c7b016d6 100644 --- a/libraries/model/src/model/Stage.h +++ b/libraries/graphics/src/graphics/Stage.h @@ -1,6 +1,6 @@ // // Stage.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 2/24/2015. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/TextureMap.cpp b/libraries/graphics/src/graphics/TextureMap.cpp similarity index 96% rename from libraries/model/src/model/TextureMap.cpp rename to libraries/graphics/src/graphics/TextureMap.cpp index b308dd72f8..7a4eb6391e 100755 --- a/libraries/model/src/model/TextureMap.cpp +++ b/libraries/graphics/src/graphics/TextureMap.cpp @@ -1,6 +1,6 @@ // // TextureMap.cpp -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 5/6/2015. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/TextureMap.h b/libraries/graphics/src/graphics/TextureMap.h similarity index 97% rename from libraries/model/src/model/TextureMap.h rename to libraries/graphics/src/graphics/TextureMap.h index 1785d44730..268c3daef8 100755 --- a/libraries/model/src/model/TextureMap.h +++ b/libraries/graphics/src/graphics/TextureMap.h @@ -1,6 +1,6 @@ // // TextureMap.h -// libraries/model/src/model +// libraries/graphics/src/graphics // // Created by Sam Gateau on 5/6/2015. // Copyright 2014 High Fidelity, Inc. diff --git a/libraries/model/src/model/skybox.slf b/libraries/graphics/src/graphics/skybox.slf similarity index 100% rename from libraries/model/src/model/skybox.slf rename to libraries/graphics/src/graphics/skybox.slf diff --git a/libraries/model/src/model/skybox.slv b/libraries/graphics/src/graphics/skybox.slv similarity index 100% rename from libraries/model/src/model/skybox.slv rename to libraries/graphics/src/graphics/skybox.slv diff --git a/libraries/model-networking/CMakeLists.txt b/libraries/model-networking/CMakeLists.txt index db5563d7ea..696f4feb9a 100644 --- a/libraries/model-networking/CMakeLists.txt +++ b/libraries/model-networking/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME model-networking) setup_hifi_library() -link_hifi_libraries(shared networking model fbx ktx image) +link_hifi_libraries(shared networking graphics fbx ktx image) include_hifi_library_headers(gpu) diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h index a122e03eb9..5c49ec683a 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.h +++ b/libraries/model-networking/src/model-networking/ModelCache.h @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include "FBXReader.h" #include "TextureCache.h" diff --git a/libraries/model-networking/src/model-networking/SimpleMeshProxy.cpp b/libraries/model-networking/src/model-networking/SimpleMeshProxy.cpp index b44ea1ff56..741478789e 100644 --- a/libraries/model-networking/src/model-networking/SimpleMeshProxy.cpp +++ b/libraries/model-networking/src/model-networking/SimpleMeshProxy.cpp @@ -11,7 +11,7 @@ #include "SimpleMeshProxy.h" -#include +#include MeshPointer SimpleMeshProxy::getMeshPointer() const { return _mesh; diff --git a/libraries/model-networking/src/model-networking/TextureCache.h b/libraries/model-networking/src/model-networking/TextureCache.h index 5a96fcf5e6..742d003d02 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.h +++ b/libraries/model-networking/src/model-networking/TextureCache.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index e219d3dbcd..ad082c1a6e 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME physics) setup_hifi_library() -link_hifi_libraries(shared fbx entities model) +link_hifi_libraries(shared fbx entities graphics) include_hifi_library_headers(networking) include_hifi_library_headers(gpu) include_hifi_library_headers(avatars) diff --git a/libraries/physics/src/CollisionRenderMeshCache.h b/libraries/physics/src/CollisionRenderMeshCache.h index 10b2440db2..64f161e229 100644 --- a/libraries/physics/src/CollisionRenderMeshCache.h +++ b/libraries/physics/src/CollisionRenderMeshCache.h @@ -16,7 +16,7 @@ #include #include -#include +#include class CollisionRenderMeshCache { diff --git a/libraries/procedural/CMakeLists.txt b/libraries/procedural/CMakeLists.txt index daf6fefccc..9ec7cb6431 100644 --- a/libraries/procedural/CMakeLists.txt +++ b/libraries/procedural/CMakeLists.txt @@ -1,5 +1,5 @@ set(TARGET_NAME procedural) -AUTOSCRIBE_SHADER_LIB(gpu model) +AUTOSCRIBE_SHADER_LIB(gpu graphics) setup_hifi_library() -link_hifi_libraries(shared gpu networking model model-networking ktx image) +link_hifi_libraries(shared gpu networking graphics model-networking ktx image) diff --git a/libraries/procedural/src/procedural/ProceduralSkybox.cpp b/libraries/procedural/src/procedural/ProceduralSkybox.cpp index 9544759037..60cb4d8fc4 100644 --- a/libraries/procedural/src/procedural/ProceduralSkybox.cpp +++ b/libraries/procedural/src/procedural/ProceduralSkybox.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include ProceduralSkybox::ProceduralSkybox() : model::Skybox() { _procedural._vertexSource = skybox_vert; diff --git a/libraries/procedural/src/procedural/ProceduralSkybox.h b/libraries/procedural/src/procedural/ProceduralSkybox.h index 5a1133a766..14481a57c7 100644 --- a/libraries/procedural/src/procedural/ProceduralSkybox.h +++ b/libraries/procedural/src/procedural/ProceduralSkybox.h @@ -13,7 +13,7 @@ #ifndef hifi_ProceduralSkybox_h #define hifi_ProceduralSkybox_h -#include +#include #include "Procedural.h" diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index 94232c81b2..6be3057c93 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -1,9 +1,9 @@ set(TARGET_NAME render-utils) -AUTOSCRIBE_SHADER_LIB(gpu model render) +AUTOSCRIBE_SHADER_LIB(gpu graphics render) # pull in the resources.qrc file qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc") setup_hifi_library(Widgets OpenGL Network Qml Quick Script) -link_hifi_libraries(shared ktx gpu model model-networking render animation fbx image procedural) +link_hifi_libraries(shared ktx gpu graphics model-networking render animation fbx image procedural) include_hifi_library_headers(networking) include_hifi_library_headers(octree) include_hifi_library_headers(audio) diff --git a/libraries/render-utils/src/BackgroundStage.h b/libraries/render-utils/src/BackgroundStage.h index 4e0e09db5b..b890a8cb28 100644 --- a/libraries/render-utils/src/BackgroundStage.h +++ b/libraries/render-utils/src/BackgroundStage.h @@ -11,7 +11,7 @@ #ifndef hifi_render_utils_BackgroundStage_h #define hifi_render_utils_BackgroundStage_h -#include +#include #include #include #include diff --git a/libraries/render-utils/src/DeferredGlobalLight.slh b/libraries/render-utils/src/DeferredGlobalLight.slh index ad4a9a3006..2901b4796e 100644 --- a/libraries/render-utils/src/DeferredGlobalLight.slh +++ b/libraries/render-utils/src/DeferredGlobalLight.slh @@ -11,7 +11,7 @@ <@if not DEFERRED_GLOBAL_LIGHT_SLH@> <@def DEFERRED_GLOBAL_LIGHT_SLH@> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <@include LightingModel.slh@> <$declareLightBuffer()$> diff --git a/libraries/render-utils/src/DeferredLightingEffect.h b/libraries/render-utils/src/DeferredLightingEffect.h index 212d17db12..8d0fc619e5 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.h +++ b/libraries/render-utils/src/DeferredLightingEffect.h @@ -17,8 +17,8 @@ #include #include -#include "model/Light.h" -#include "model/Geometry.h" +#include "graphics/Light.h" +#include "graphics/Geometry.h" #include diff --git a/libraries/render-utils/src/DrawHaze.h b/libraries/render-utils/src/DrawHaze.h index f158daa0c6..3ad42b23aa 100644 --- a/libraries/render-utils/src/DrawHaze.h +++ b/libraries/render-utils/src/DrawHaze.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "SurfaceGeometryPass.h" diff --git a/libraries/render-utils/src/ForwardGlobalLight.slh b/libraries/render-utils/src/ForwardGlobalLight.slh index 3f77f85b51..e86f0c7fe3 100644 --- a/libraries/render-utils/src/ForwardGlobalLight.slh +++ b/libraries/render-utils/src/ForwardGlobalLight.slh @@ -11,7 +11,7 @@ <@if not DEFERRED_GLOBAL_LIGHT_SLH@> <@def DEFERRED_GLOBAL_LIGHT_SLH@> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <@include LightingModel.slh@> <$declareLightBuffer()$> diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 2616d08600..1fd6ca2980 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -31,7 +31,7 @@ #include "gpu/StandardShaderLib.h" -#include "model/TextureMap.h" +#include "graphics/TextureMap.h" #include "render/Args.h" #include "standardTransformPNTC_vert.h" diff --git a/libraries/render-utils/src/GeometryCache.h b/libraries/render-utils/src/GeometryCache.h index 0585cc9e55..31aa4b10ea 100644 --- a/libraries/render-utils/src/GeometryCache.h +++ b/libraries/render-utils/src/GeometryCache.h @@ -28,8 +28,8 @@ #include -#include -#include +#include +#include class SimpleProgramKey; diff --git a/libraries/render-utils/src/Haze.slf b/libraries/render-utils/src/Haze.slf index 0270aa58f0..2d7daf1f98 100644 --- a/libraries/render-utils/src/Haze.slf +++ b/libraries/render-utils/src/Haze.slf @@ -12,7 +12,7 @@ <@include DeferredTransform.slh@> <$declareDeferredFrameTransform()$> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <@include LightingModel.slh@> <$declareLightBuffer()$> diff --git a/libraries/render-utils/src/HazeStage.h b/libraries/render-utils/src/HazeStage.h index c355f06644..9e729f1ef9 100644 --- a/libraries/render-utils/src/HazeStage.h +++ b/libraries/render-utils/src/HazeStage.h @@ -11,7 +11,7 @@ #ifndef hifi_render_utils_HazeStage_h #define hifi_render_utils_HazeStage_h -#include +#include #include #include #include @@ -19,7 +19,7 @@ #include #include -#include +#include // Haze stage to set up haze-related rendering tasks class HazeStage : public render::Stage { diff --git a/libraries/render-utils/src/LightPayload.h b/libraries/render-utils/src/LightPayload.h index b55373c9a8..a3032ccd90 100644 --- a/libraries/render-utils/src/LightPayload.h +++ b/libraries/render-utils/src/LightPayload.h @@ -12,7 +12,7 @@ #define hifi_LightPayload_h -#include +#include #include #include "LightStage.h" #include "TextureCache.h" diff --git a/libraries/render-utils/src/LightStage.h b/libraries/render-utils/src/LightStage.h index 3dcae550f7..8db5c19950 100644 --- a/libraries/render-utils/src/LightStage.h +++ b/libraries/render-utils/src/LightStage.h @@ -17,7 +17,7 @@ #include -#include +#include #include #include diff --git a/libraries/render-utils/src/MeshPartPayload.h b/libraries/render-utils/src/MeshPartPayload.h index 8d36395610..6e165508f2 100644 --- a/libraries/render-utils/src/MeshPartPayload.h +++ b/libraries/render-utils/src/MeshPartPayload.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include "Model.h" diff --git a/libraries/render-utils/src/StencilMaskPass.cpp b/libraries/render-utils/src/StencilMaskPass.cpp index f71111b64e..ab1ac7c1aa 100644 --- a/libraries/render-utils/src/StencilMaskPass.cpp +++ b/libraries/render-utils/src/StencilMaskPass.cpp @@ -129,7 +129,7 @@ void PrepareStencil::testNoAA(gpu::State& state) { } // Pass if this area WAS marked as BACKGROUND -// (see: model/src/Skybox.cpp, procedural/src/ProceduralSkybox.cpp) +// (see: graphics/src/Skybox.cpp, procedural/src/ProceduralSkybox.cpp) void PrepareStencil::testBackground(gpu::State& state) { state.setStencilTest(true, 0x00, gpu::State::StencilTest(STENCIL_BACKGROUND, 0xFF, gpu::EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); diff --git a/libraries/render-utils/src/StencilMaskPass.h b/libraries/render-utils/src/StencilMaskPass.h index fc258b607a..ef1371d04e 100644 --- a/libraries/render-utils/src/StencilMaskPass.h +++ b/libraries/render-utils/src/StencilMaskPass.h @@ -14,7 +14,7 @@ #include #include -#include +#include class PrepareStencilConfig : public render::Job::Config { Q_OBJECT diff --git a/libraries/render-utils/src/deferred_light_point.slv b/libraries/render-utils/src/deferred_light_point.slv index 88da7dd04c..2b75ee3915 100644 --- a/libraries/render-utils/src/deferred_light_point.slv +++ b/libraries/render-utils/src/deferred_light_point.slv @@ -18,7 +18,7 @@ <$declareStandardTransform()$> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer(256)$> diff --git a/libraries/render-utils/src/deferred_light_spot.slv b/libraries/render-utils/src/deferred_light_spot.slv index f6dc7faaf1..7e3e45b3b6 100644 --- a/libraries/render-utils/src/deferred_light_spot.slv +++ b/libraries/render-utils/src/deferred_light_spot.slv @@ -18,7 +18,7 @@ <$declareStandardTransform()$> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer(256)$> uniform lightIndexBuffer { diff --git a/libraries/render-utils/src/forward_model.slf b/libraries/render-utils/src/forward_model.slf index 7b708a1d24..41ff4afc81 100644 --- a/libraries/render-utils/src/forward_model.slf +++ b/libraries/render-utils/src/forward_model.slf @@ -16,7 +16,7 @@ <@include ForwardGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include gpu/Transform.slh@> <$declareStandardCameraTransform()$> diff --git a/libraries/render-utils/src/forward_model_normal_map.slf b/libraries/render-utils/src/forward_model_normal_map.slf index a199483b9f..e5fcab4945 100644 --- a/libraries/render-utils/src/forward_model_normal_map.slf +++ b/libraries/render-utils/src/forward_model_normal_map.slf @@ -14,7 +14,7 @@ <@include ForwardBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$> diff --git a/libraries/render-utils/src/forward_model_normal_specular_map.slf b/libraries/render-utils/src/forward_model_normal_specular_map.slf index ca6bbec3da..01a4251e8d 100644 --- a/libraries/render-utils/src/forward_model_normal_specular_map.slf +++ b/libraries/render-utils/src/forward_model_normal_specular_map.slf @@ -14,7 +14,7 @@ <@include ForwardBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/forward_model_specular_map.slf b/libraries/render-utils/src/forward_model_specular_map.slf index d2fdd18794..77d34d4309 100644 --- a/libraries/render-utils/src/forward_model_specular_map.slf +++ b/libraries/render-utils/src/forward_model_specular_map.slf @@ -14,7 +14,7 @@ <@include ForwardBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/forward_model_translucent.slf b/libraries/render-utils/src/forward_model_translucent.slf index 906393db1f..7f752d893a 100644 --- a/libraries/render-utils/src/forward_model_translucent.slf +++ b/libraries/render-utils/src/forward_model_translucent.slf @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include ForwardGlobalLight.slh@> diff --git a/libraries/render-utils/src/forward_model_unlit.slf b/libraries/render-utils/src/forward_model_unlit.slf index fb760467c9..72ee61e28c 100644 --- a/libraries/render-utils/src/forward_model_unlit.slf +++ b/libraries/render-utils/src/forward_model_unlit.slf @@ -14,7 +14,7 @@ <@include ForwardBufferWrite.slh@> <@include LightingModel.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO)$> diff --git a/libraries/render-utils/src/lightClusters_drawClusterContent.slf b/libraries/render-utils/src/lightClusters_drawClusterContent.slf index 447f8bd634..739709418d 100644 --- a/libraries/render-utils/src/lightClusters_drawClusterContent.slf +++ b/libraries/render-utils/src/lightClusters_drawClusterContent.slf @@ -15,7 +15,7 @@ <@include DeferredBufferRead.slh@> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer(256)$> <@include LightClusterGrid.slh@> diff --git a/libraries/render-utils/src/local_lights_drawOutline.slf b/libraries/render-utils/src/local_lights_drawOutline.slf index 3aa210a241..56ce1e61a5 100644 --- a/libraries/render-utils/src/local_lights_drawOutline.slf +++ b/libraries/render-utils/src/local_lights_drawOutline.slf @@ -18,7 +18,7 @@ <$declareDeferredCurvature()$> // Everything about light -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer(128)$> <@include LightingModel.slh@> diff --git a/libraries/render-utils/src/local_lights_shading.slf b/libraries/render-utils/src/local_lights_shading.slf index a935a8cb89..c3208de726 100644 --- a/libraries/render-utils/src/local_lights_shading.slf +++ b/libraries/render-utils/src/local_lights_shading.slf @@ -18,7 +18,7 @@ <$declareDeferredCurvature()$> // Everything about light -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer(256)$> <@include LightingModel.slh@> diff --git a/libraries/render-utils/src/model.slf b/libraries/render-utils/src/model.slf index daeead65ec..4747b69278 100644 --- a/libraries/render-utils/src/model.slf +++ b/libraries/render-utils/src/model.slf @@ -13,7 +13,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_fade.slf b/libraries/render-utils/src/model_fade.slf index d232667660..40c156a3a4 100644 --- a/libraries/render-utils/src/model_fade.slf +++ b/libraries/render-utils/src/model_fade.slf @@ -13,7 +13,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_lightmap.slf b/libraries/render-utils/src/model_lightmap.slf index 3a8cfde290..b22a1029f9 100644 --- a/libraries/render-utils/src/model_lightmap.slf +++ b/libraries/render-utils/src/model_lightmap.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS)$> diff --git a/libraries/render-utils/src/model_lightmap_fade.slf b/libraries/render-utils/src/model_lightmap_fade.slf index 92d00a2046..55cb24d35d 100644 --- a/libraries/render-utils/src/model_lightmap_fade.slf +++ b/libraries/render-utils/src/model_lightmap_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS)$> diff --git a/libraries/render-utils/src/model_lightmap_normal_map.slf b/libraries/render-utils/src/model_lightmap_normal_map.slf index 81de1e5d5b..1510ea9ba3 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map.slf +++ b/libraries/render-utils/src/model_lightmap_normal_map.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL)$> diff --git a/libraries/render-utils/src/model_lightmap_normal_map_fade.slf b/libraries/render-utils/src/model_lightmap_normal_map_fade.slf index 825e84d666..6b63943a9a 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map_fade.slf +++ b/libraries/render-utils/src/model_lightmap_normal_map_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL)$> diff --git a/libraries/render-utils/src/model_lightmap_normal_specular_map.slf b/libraries/render-utils/src/model_lightmap_normal_specular_map.slf index 944da27b01..3a66aaad3d 100644 --- a/libraries/render-utils/src/model_lightmap_normal_specular_map.slf +++ b/libraries/render-utils/src/model_lightmap_normal_specular_map.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> diff --git a/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf b/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf index 791d5bf552..b785a8a6ab 100644 --- a/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf +++ b/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> diff --git a/libraries/render-utils/src/model_lightmap_specular_map.slf b/libraries/render-utils/src/model_lightmap_specular_map.slf index 4dbc10a834..1c97d435bd 100644 --- a/libraries/render-utils/src/model_lightmap_specular_map.slf +++ b/libraries/render-utils/src/model_lightmap_specular_map.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> diff --git a/libraries/render-utils/src/model_lightmap_specular_map_fade.slf b/libraries/render-utils/src/model_lightmap_specular_map_fade.slf index e82018eefb..1adedb9328 100644 --- a/libraries/render-utils/src/model_lightmap_specular_map_fade.slf +++ b/libraries/render-utils/src/model_lightmap_specular_map_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> diff --git a/libraries/render-utils/src/model_normal_map.slf b/libraries/render-utils/src/model_normal_map.slf index 063950609a..bed85b4b15 100644 --- a/libraries/render-utils/src/model_normal_map.slf +++ b/libraries/render-utils/src/model_normal_map.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$> diff --git a/libraries/render-utils/src/model_normal_map_fade.slf b/libraries/render-utils/src/model_normal_map_fade.slf index d8b864260c..5a166b1c2c 100644 --- a/libraries/render-utils/src/model_normal_map_fade.slf +++ b/libraries/render-utils/src/model_normal_map_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$> diff --git a/libraries/render-utils/src/model_normal_specular_map.slf b/libraries/render-utils/src/model_normal_specular_map.slf index 9e079b33a0..3eb3d43fdc 100644 --- a/libraries/render-utils/src/model_normal_specular_map.slf +++ b/libraries/render-utils/src/model_normal_specular_map.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_normal_specular_map_fade.slf b/libraries/render-utils/src/model_normal_specular_map_fade.slf index 5492b24763..0985d5d493 100644 --- a/libraries/render-utils/src/model_normal_specular_map_fade.slf +++ b/libraries/render-utils/src/model_normal_specular_map_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_specular_map.slf b/libraries/render-utils/src/model_specular_map.slf index 47b5e3389d..e65dbaeda6 100644 --- a/libraries/render-utils/src/model_specular_map.slf +++ b/libraries/render-utils/src/model_specular_map.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_specular_map_fade.slf b/libraries/render-utils/src/model_specular_map_fade.slf index 6eb56c0929..17173d8bc3 100644 --- a/libraries/render-utils/src/model_specular_map_fade.slf +++ b/libraries/render-utils/src/model_specular_map_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_translucent.slf b/libraries/render-utils/src/model_translucent.slf index 7e64c5ab8b..0924389dba 100644 --- a/libraries/render-utils/src/model_translucent.slf +++ b/libraries/render-utils/src/model_translucent.slf @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include DeferredGlobalLight.slh@> diff --git a/libraries/render-utils/src/model_translucent_fade.slf b/libraries/render-utils/src/model_translucent_fade.slf index 0d5a452fed..8ac442476f 100644 --- a/libraries/render-utils/src/model_translucent_fade.slf +++ b/libraries/render-utils/src/model_translucent_fade.slf @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include DeferredGlobalLight.slh@> diff --git a/libraries/render-utils/src/model_translucent_unlit.slf b/libraries/render-utils/src/model_translucent_unlit.slf index b397cea5aa..4c3a0f0195 100644 --- a/libraries/render-utils/src/model_translucent_unlit.slf +++ b/libraries/render-utils/src/model_translucent_unlit.slf @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_translucent_unlit_fade.slf b/libraries/render-utils/src/model_translucent_unlit_fade.slf index 6a77efe4ca..210060d54d 100644 --- a/libraries/render-utils/src/model_translucent_unlit_fade.slf +++ b/libraries/render-utils/src/model_translucent_unlit_fade.slf @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> diff --git a/libraries/render-utils/src/model_unlit.slf b/libraries/render-utils/src/model_unlit.slf index 750b51fe8c..ccfc7d4935 100644 --- a/libraries/render-utils/src/model_unlit.slf +++ b/libraries/render-utils/src/model_unlit.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> <@include LightingModel.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO)$> diff --git a/libraries/render-utils/src/model_unlit_fade.slf b/libraries/render-utils/src/model_unlit_fade.slf index 0fe9f2ebac..65c97f9e21 100644 --- a/libraries/render-utils/src/model_unlit_fade.slf +++ b/libraries/render-utils/src/model_unlit_fade.slf @@ -14,7 +14,7 @@ <@include DeferredBufferWrite.slh@> <@include LightingModel.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include Fade.slh@> <$declareFadeFragment()$> diff --git a/libraries/render-utils/src/overlay3D.slf b/libraries/render-utils/src/overlay3D.slf index b58dd5afac..dcded917b4 100644 --- a/libraries/render-utils/src/overlay3D.slf +++ b/libraries/render-utils/src/overlay3D.slf @@ -12,7 +12,7 @@ // -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer()$> <$declareLightAmbientBuffer()$> diff --git a/libraries/render-utils/src/overlay3D_model.slf b/libraries/render-utils/src/overlay3D_model.slf index ea61c2bb75..d4de0ee69f 100644 --- a/libraries/render-utils/src/overlay3D_model.slf +++ b/libraries/render-utils/src/overlay3D_model.slf @@ -14,7 +14,7 @@ <@include DeferredGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include gpu/Transform.slh@> <$declareStandardCameraTransform()$> diff --git a/libraries/render-utils/src/overlay3D_model_translucent.slf b/libraries/render-utils/src/overlay3D_model_translucent.slf index b6ae8eb75e..8dd3a81443 100644 --- a/libraries/render-utils/src/overlay3D_model_translucent.slf +++ b/libraries/render-utils/src/overlay3D_model_translucent.slf @@ -13,7 +13,7 @@ <@include DeferredGlobalLight.slh@> <$declareEvalGlobalLightingAlphaBlended()$> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include gpu/Transform.slh@> <$declareStandardCameraTransform()$> diff --git a/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf b/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf index 3dd8138272..3b79818cd9 100644 --- a/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf +++ b/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf @@ -12,7 +12,7 @@ // <@include LightingModel.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO)$> diff --git a/libraries/render-utils/src/overlay3D_model_unlit.slf b/libraries/render-utils/src/overlay3D_model_unlit.slf index 80c2bb971e..eab975e810 100644 --- a/libraries/render-utils/src/overlay3D_model_unlit.slf +++ b/libraries/render-utils/src/overlay3D_model_unlit.slf @@ -12,7 +12,7 @@ // <@include LightingModel.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO)$> diff --git a/libraries/render-utils/src/overlay3D_translucent.slf b/libraries/render-utils/src/overlay3D_translucent.slf index 72bd0d740e..64035ac984 100644 --- a/libraries/render-utils/src/overlay3D_translucent.slf +++ b/libraries/render-utils/src/overlay3D_translucent.slf @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer()$> <$declareLightAmbientBuffer()$> diff --git a/libraries/render-utils/src/simple.slf b/libraries/render-utils/src/simple.slf index fd45c6c134..7b32541c63 100644 --- a/libraries/render-utils/src/simple.slf +++ b/libraries/render-utils/src/simple.slf @@ -13,7 +13,7 @@ // <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> // the interpolated normal in vec3 _normal; diff --git a/libraries/render-utils/src/simple_fade.slf b/libraries/render-utils/src/simple_fade.slf index 245d32e81e..ce9251b9a5 100644 --- a/libraries/render-utils/src/simple_fade.slf +++ b/libraries/render-utils/src/simple_fade.slf @@ -13,7 +13,7 @@ // <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include Fade.slh@> <$declareFadeFragmentInstanced()$> diff --git a/libraries/render-utils/src/simple_textured.slf b/libraries/render-utils/src/simple_textured.slf index 550f6546fd..34fcbc77dc 100644 --- a/libraries/render-utils/src/simple_textured.slf +++ b/libraries/render-utils/src/simple_textured.slf @@ -14,7 +14,7 @@ <@include gpu/Color.slh@> <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> // the albedo texture uniform sampler2D originalTexture; diff --git a/libraries/render-utils/src/simple_textured_fade.slf b/libraries/render-utils/src/simple_textured_fade.slf index 025fe5fca6..2061cabdfc 100644 --- a/libraries/render-utils/src/simple_textured_fade.slf +++ b/libraries/render-utils/src/simple_textured_fade.slf @@ -14,7 +14,7 @@ <@include gpu/Color.slh@> <@include DeferredBufferWrite.slh@> -<@include model/Material.slh@> +<@include graphics/Material.slh@> <@include Fade.slh@> diff --git a/libraries/render-utils/src/subsurfaceScattering_drawScattering.slf b/libraries/render-utils/src/subsurfaceScattering_drawScattering.slf index 981993615c..ad6918d727 100644 --- a/libraries/render-utils/src/subsurfaceScattering_drawScattering.slf +++ b/libraries/render-utils/src/subsurfaceScattering_drawScattering.slf @@ -12,7 +12,7 @@ <@include DeferredBufferRead.slh@> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <$declareLightBuffer()$> <$declareDeferredCurvature()$> diff --git a/libraries/render-utils/src/zone_drawAmbient.slf b/libraries/render-utils/src/zone_drawAmbient.slf index f104e5be44..3407fe8467 100644 --- a/libraries/render-utils/src/zone_drawAmbient.slf +++ b/libraries/render-utils/src/zone_drawAmbient.slf @@ -10,7 +10,7 @@ // <@include zone_draw.slh@> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <@include LightingModel.slh@> <$declareLightAmbientBuffer()$> diff --git a/libraries/render-utils/src/zone_drawKeyLight.slf b/libraries/render-utils/src/zone_drawKeyLight.slf index e96239b6dc..ea11c775b4 100644 --- a/libraries/render-utils/src/zone_drawKeyLight.slf +++ b/libraries/render-utils/src/zone_drawKeyLight.slf @@ -10,7 +10,7 @@ // <@include zone_draw.slh@> -<@include model/Light.slh@> +<@include graphics/Light.slh@> <@include LightingModel.slh@> <$declareLightBuffer()$> diff --git a/libraries/render/CMakeLists.txt b/libraries/render/CMakeLists.txt index 8fd05bd320..1d88c3e5f5 100644 --- a/libraries/render/CMakeLists.txt +++ b/libraries/render/CMakeLists.txt @@ -1,8 +1,8 @@ set(TARGET_NAME render) -AUTOSCRIBE_SHADER_LIB(gpu model) +AUTOSCRIBE_SHADER_LIB(gpu graphics) setup_hifi_library() # render needs octree only for getAccuracyAngle(float, int) -link_hifi_libraries(shared ktx gpu model octree) +link_hifi_libraries(shared ktx gpu graphics octree) target_nsight() diff --git a/libraries/render/src/render/Item.h b/libraries/render/src/render/Item.h index 77f5910b9e..e977c95fa0 100644 --- a/libraries/render/src/render/Item.h +++ b/libraries/render/src/render/Item.h @@ -25,7 +25,7 @@ #include "Args.h" -#include +#include #include "ShapePipeline.h" namespace render { diff --git a/libraries/script-engine/CMakeLists.txt b/libraries/script-engine/CMakeLists.txt index 87296b187f..478e4c4765 100644 --- a/libraries/script-engine/CMakeLists.txt +++ b/libraries/script-engine/CMakeLists.txt @@ -16,6 +16,6 @@ if (NOT ANDROID) endif () -link_hifi_libraries(shared networking octree gpu procedural model model-networking ktx recording avatars fbx entities controllers animation audio physics image midi) +link_hifi_libraries(shared networking octree gpu procedural graphics model-networking ktx recording avatars fbx entities controllers animation audio physics image midi) # ui includes gl, but link_hifi_libraries does not use transitive includes, so gl must be explicit include_hifi_library_headers(gl) diff --git a/libraries/script-engine/src/SceneScriptingInterface.h b/libraries/script-engine/src/SceneScriptingInterface.h index 7bc22eb3e6..160c37284c 100644 --- a/libraries/script-engine/src/SceneScriptingInterface.h +++ b/libraries/script-engine/src/SceneScriptingInterface.h @@ -15,7 +15,7 @@ #include // QObject #include // Dependency -#include "model/Stage.h" +#include "graphics/Stage.h" // TODO: if QT moc ever supports nested classes, subclass these to the interface instead of namespacing namespace SceneScripting { diff --git a/plugins/openvr/CMakeLists.txt b/plugins/openvr/CMakeLists.txt index 7878ae2d7e..9ae9b25b65 100644 --- a/plugins/openvr/CMakeLists.txt +++ b/plugins/openvr/CMakeLists.txt @@ -13,7 +13,7 @@ if (WIN32) setup_hifi_plugin(OpenGL Script Qml Widgets Multimedia) link_hifi_libraries(shared gl networking controllers ui plugins display-plugins ui-plugins input-plugins script-engine - audio-client render-utils model gpu gpu-gl render model-networking fbx ktx image procedural) + audio-client render-utils graphics gpu gpu-gl render model-networking fbx ktx image procedural) include_hifi_library_headers(octree) diff --git a/plugins/openvr/src/ViveControllerManager.h b/plugins/openvr/src/ViveControllerManager.h index 772facc21f..b5db1db5a8 100644 --- a/plugins/openvr/src/ViveControllerManager.h +++ b/plugins/openvr/src/ViveControllerManager.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include diff --git a/tests/animation/CMakeLists.txt b/tests/animation/CMakeLists.txt index 2a07f6f429..40f76ee362 100644 --- a/tests/animation/CMakeLists.txt +++ b/tests/animation/CMakeLists.txt @@ -1,7 +1,7 @@ # Declare dependencies macro (setup_testcase_dependencies) # link in the shared libraries - link_hifi_libraries(shared animation gpu fbx model networking) + link_hifi_libraries(shared animation gpu fbx graphics networking) package_libraries_for_deployment() endmacro () diff --git a/tests/entities/CMakeLists.txt b/tests/entities/CMakeLists.txt index 0c33eb8555..6d0bf9f149 100644 --- a/tests/entities/CMakeLists.txt +++ b/tests/entities/CMakeLists.txt @@ -7,7 +7,7 @@ setup_memory_debugger() set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") # link in the shared libraries -link_hifi_libraries(entities avatars shared octree gpu model fbx networking animation audio gl) +link_hifi_libraries(entities avatars shared octree gpu graphics fbx networking animation audio gl) if (WIN32) add_dependency_external_projects(wasapi) diff --git a/tests/gpu-test/CMakeLists.txt b/tests/gpu-test/CMakeLists.txt index 8e49d523b8..9772320812 100644 --- a/tests/gpu-test/CMakeLists.txt +++ b/tests/gpu-test/CMakeLists.txt @@ -1,10 +1,10 @@ set(TARGET_NAME gpu-test) -AUTOSCRIBE_SHADER_LIB(gpu model render-utils) +AUTOSCRIBE_SHADER_LIB(gpu graphics render-utils) # This is not a testcase -- just set it up as a regular hifi project setup_hifi_project(Quick Gui OpenGL Script Widgets) setup_memory_debugger() set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") -link_hifi_libraries(networking gl gpu gpu-gl procedural shared fbx model model-networking animation script-engine render render-utils octree image ktx) +link_hifi_libraries(networking gl gpu gpu-gl procedural shared fbx graphics model-networking animation script-engine render render-utils octree image ktx) if (WIN32) add_dependency_external_projects(wasapi) diff --git a/tests/octree/CMakeLists.txt b/tests/octree/CMakeLists.txt index 224b97c75c..a685e06172 100644 --- a/tests/octree/CMakeLists.txt +++ b/tests/octree/CMakeLists.txt @@ -2,7 +2,7 @@ # Declare dependencies macro (setup_testcase_dependencies) # link in the shared libraries - link_hifi_libraries(shared octree gpu model fbx networking entities avatars audio animation script-engine physics) + link_hifi_libraries(shared octree gpu graphics fbx networking entities avatars audio animation script-engine physics) package_libraries_for_deployment() endmacro () diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index 755886ebbf..1f1b52bf28 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -2,7 +2,7 @@ # Declare dependencies macro (SETUP_TESTCASE_DEPENDENCIES) target_bullet() - link_hifi_libraries(shared physics gpu model) + link_hifi_libraries(shared physics gpu graphics) package_libraries_for_deployment() endmacro () diff --git a/tests/render-perf/CMakeLists.txt b/tests/render-perf/CMakeLists.txt index 09b2dc6a50..9739533fd2 100644 --- a/tests/render-perf/CMakeLists.txt +++ b/tests/render-perf/CMakeLists.txt @@ -12,7 +12,7 @@ setup_hifi_project(Quick Gui OpenGL) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") # link in the shared libraries -link_hifi_libraries(shared networking model fbx ktx image octree gl gpu gpu-gl render model-networking networking render-utils entities entities-renderer animation audio avatars script-engine physics procedural midi ui) +link_hifi_libraries(shared networking graphics fbx ktx image octree gl gpu gpu-gl render model-networking networking render-utils entities entities-renderer animation audio avatars script-engine physics procedural midi ui) if (WIN32) target_link_libraries(${TARGET_NAME} Winmm.lib) diff --git a/tests/render-perf/src/main.cpp b/tests/render-perf/src/main.cpp index c70a74cd7f..921ceb079e 100644 --- a/tests/render-perf/src/main.cpp +++ b/tests/render-perf/src/main.cpp @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/render-texture-load/CMakeLists.txt b/tests/render-texture-load/CMakeLists.txt index 432a1f00d6..302ddd0f97 100644 --- a/tests/render-texture-load/CMakeLists.txt +++ b/tests/render-texture-load/CMakeLists.txt @@ -12,7 +12,7 @@ setup_hifi_project(Quick Gui OpenGL) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") # link in the shared libraries -link_hifi_libraries(shared octree gl gpu gpu-gl render model model-networking networking render-utils fbx entities entities-renderer animation audio avatars script-engine physics ktx image) +link_hifi_libraries(shared octree gl gpu gpu-gl render graphics model-networking networking render-utils fbx entities entities-renderer animation audio avatars script-engine physics ktx image) package_libraries_for_deployment() diff --git a/tests/shaders/CMakeLists.txt b/tests/shaders/CMakeLists.txt index ba4ca88127..a6796b8601 100644 --- a/tests/shaders/CMakeLists.txt +++ b/tests/shaders/CMakeLists.txt @@ -8,14 +8,14 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") setup_memory_debugger() # link in the shared libraries -link_hifi_libraries(shared octree gl gpu gpu-gl model render fbx networking entities +link_hifi_libraries(shared octree gl gpu gpu-gl graphics render fbx networking entities script-engine physics render-utils entities-renderer) include_directories("${PROJECT_BINARY_DIR}/../../libraries/gpu/") include_directories("${PROJECT_BINARY_DIR}/../../libraries/render-utils/") include_directories("${PROJECT_BINARY_DIR}/../../libraries/entities-renderer/") -include_directories("${PROJECT_BINARY_DIR}/../../libraries/model/") +include_directories("${PROJECT_BINARY_DIR}/../../libraries/graphics/") if (WIN32) add_dependency_external_projects(wasapi) diff --git a/tests/shaders/src/main.cpp b/tests/shaders/src/main.cpp index 7c6886ad93..cd307ba362 100644 --- a/tests/shaders/src/main.cpp +++ b/tests/shaders/src/main.cpp @@ -64,8 +64,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/tools/oven/CMakeLists.txt b/tools/oven/CMakeLists.txt index 00344179bd..549414cbab 100644 --- a/tools/oven/CMakeLists.txt +++ b/tools/oven/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME oven) setup_hifi_project(Widgets Gui Concurrent) -link_hifi_libraries(networking shared image gpu ktx fbx baking model) +link_hifi_libraries(networking shared image gpu ktx fbx baking graphics) setup_memory_debugger() diff --git a/tools/skeleton-dump/CMakeLists.txt b/tools/skeleton-dump/CMakeLists.txt index bb2fe24f51..1c30e322d6 100644 --- a/tools/skeleton-dump/CMakeLists.txt +++ b/tools/skeleton-dump/CMakeLists.txt @@ -1,5 +1,5 @@ set(TARGET_NAME skeleton-dump) setup_hifi_project(Core Widgets) setup_memory_debugger() -link_hifi_libraries(shared fbx model gpu gl animation) +link_hifi_libraries(shared fbx graphics gpu gl animation) diff --git a/tools/vhacd-util/CMakeLists.txt b/tools/vhacd-util/CMakeLists.txt index c28aa9efa4..599561bd2d 100644 --- a/tools/vhacd-util/CMakeLists.txt +++ b/tools/vhacd-util/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME vhacd-util) setup_hifi_project(Core Widgets) -link_hifi_libraries(shared fbx model gpu gl) +link_hifi_libraries(shared fbx graphics gpu gl) add_dependency_external_projects(vhacd) From b91d536dd0ee17c0572e4cb39b8bd0b337fa9e5e Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 16 Jan 2018 12:46:16 -0500 Subject: [PATCH 52/86] rename model:: -> graphics:: --- interface/src/Application.cpp | 2 +- interface/src/Application.h | 4 +- .../src/RenderableLightEntityItem.cpp | 4 +- .../src/RenderableModelEntityItem.cpp | 24 +++++----- .../src/RenderablePolyVoxEntityItem.cpp | 20 ++++----- .../src/RenderablePolyVoxEntityItem.h | 6 +-- .../src/RenderableZoneEntityItem.cpp | 14 +++--- .../src/RenderableZoneEntityItem.h | 18 ++++---- libraries/fbx/src/FBX.h | 4 +- libraries/fbx/src/FBXReader.cpp | 2 +- libraries/fbx/src/FBXReader_Material.cpp | 4 +- libraries/fbx/src/FBXReader_Mesh.cpp | 28 ++++++------ libraries/fbx/src/GLTFReader.cpp | 2 +- libraries/fbx/src/OBJReader.cpp | 6 +-- libraries/fbx/src/OBJWriter.cpp | 6 +-- libraries/fbx/src/OBJWriter.h | 2 +- libraries/graphics/src/graphics/Asset.cpp | 2 +- libraries/graphics/src/graphics/Asset.h | 2 +- libraries/graphics/src/graphics/Forward.h | 2 +- libraries/graphics/src/graphics/Geometry.cpp | 24 +++++----- libraries/graphics/src/graphics/Geometry.h | 4 +- libraries/graphics/src/graphics/Haze.cpp | 2 +- libraries/graphics/src/graphics/Haze.h | 2 +- libraries/graphics/src/graphics/Light.cpp | 2 +- libraries/graphics/src/graphics/Light.h | 2 +- libraries/graphics/src/graphics/Material.cpp | 2 +- libraries/graphics/src/graphics/Material.h | 2 +- libraries/graphics/src/graphics/Skybox.cpp | 2 +- libraries/graphics/src/graphics/Skybox.h | 2 +- libraries/graphics/src/graphics/Stage.cpp | 2 +- libraries/graphics/src/graphics/Stage.h | 2 +- .../graphics/src/graphics/TextureMap.cpp | 2 +- libraries/graphics/src/graphics/TextureMap.h | 2 +- .../src/model-networking/ModelCache.cpp | 10 ++--- .../src/model-networking/ModelCache.h | 10 ++--- .../physics/src/CollisionRenderMeshCache.cpp | 24 +++++----- .../physics/src/CollisionRenderMeshCache.h | 4 +- .../src/procedural/ProceduralSkybox.cpp | 2 +- .../src/procedural/ProceduralSkybox.h | 2 +- .../render-utils/src/BackgroundStage.cpp | 10 ++--- libraries/render-utils/src/BackgroundStage.h | 4 +- .../src/DeferredLightingEffect.cpp | 42 +++++++++--------- .../render-utils/src/DeferredLightingEffect.h | 20 ++++----- libraries/render-utils/src/DrawHaze.cpp | 18 ++++---- libraries/render-utils/src/DrawHaze.h | 44 +++++++++---------- libraries/render-utils/src/HazeStage.cpp | 14 +++--- libraries/render-utils/src/HazeStage.h | 28 ++++++------ libraries/render-utils/src/LightPayload.cpp | 4 +- libraries/render-utils/src/LightPayload.h | 8 ++-- libraries/render-utils/src/LightStage.cpp | 32 +++++++------- libraries/render-utils/src/LightStage.h | 20 ++++----- .../render-utils/src/MeshPartPayload.cpp | 28 ++++++------ libraries/render-utils/src/MeshPartPayload.h | 18 ++++---- libraries/render-utils/src/Model.cpp | 14 +++--- libraries/render-utils/src/Model.h | 2 +- .../render-utils/src/RenderDeferredTask.cpp | 2 +- .../render-utils/src/RenderPipelines.cpp | 2 +- .../render-utils/src/RenderShadowTask.cpp | 2 +- .../render-utils/src/StencilMaskPass.cpp | 6 +-- libraries/render-utils/src/StencilMaskPass.h | 4 +- libraries/render-utils/src/ZoneRenderer.cpp | 6 +-- .../src/ModelScriptingInterface.cpp | 30 ++++++------- .../src/SceneScriptingInterface.cpp | 12 ++--- .../src/SceneScriptingInterface.h | 20 ++++----- libraries/shared/src/RegisteredMetaTypes.h | 4 +- plugins/openvr/src/ViveControllerManager.h | 2 +- tests/gpu-test/src/TestFbx.h | 2 +- tests/gpu-test/src/TestWindow.cpp | 2 +- tests/gpu-test/src/TestWindow.h | 2 +- .../src/CollisionRenderMeshCacheTests.cpp | 16 +++---- tests/render-perf/src/main.cpp | 6 +-- 71 files changed, 340 insertions(+), 340 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 449b014c13..1cee7ea9f3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5465,7 +5465,7 @@ void Application::clearDomainOctreeDetails() { auto skyStage = DependencyManager::get()->getSkyStage(); - skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT); + skyStage->setBackgroundMode(graphics::SunSkyStage::SKY_DEFAULT); DependencyManager::get()->clearUnusedResources(); DependencyManager::get()->clearUnusedResources(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 6b70e88b89..ddb8ce11e5 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -270,7 +270,7 @@ public: void takeSecondaryCameraSnapshot(); void shareSnapshot(const QString& filename, const QUrl& href = QUrl("")); - model::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; } + graphics::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; } gpu::TexturePointer getDefaultSkyboxTexture() const { return _defaultSkyboxTexture; } gpu::TexturePointer getDefaultSkyboxAmbientTexture() const { return _defaultSkyboxAmbientTexture; } @@ -667,7 +667,7 @@ private: ConnectionMonitor _connectionMonitor; - model::SkyboxPointer _defaultSkybox { new ProceduralSkybox() } ; + graphics::SkyboxPointer _defaultSkybox { new ProceduralSkybox() } ; gpu::TexturePointer _defaultSkyboxTexture; gpu::TexturePointer _defaultSkyboxAmbientTexture; diff --git a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp index fc33ebc498..4ea293a3da 100644 --- a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp @@ -52,9 +52,9 @@ void LightEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint float exponent = entity->getExponent(); float cutoff = glm::radians(entity->getCutoff()); if (!entity->getIsSpotlight()) { - light->setType(model::Light::POINT); + light->setType(graphics::Light::POINT); } else { - light->setType(model::Light::SPOT); + light->setType(graphics::Light::SPOT); light->setSpotAngle(cutoff); light->setSpotExponent(exponent); diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 86237e75a4..3f42a353d1 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -558,10 +558,10 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { if (type == SHAPE_TYPE_STATIC_MESH) { // copy into triangleIndices triangleIndices.reserve((int32_t)((gpu::Size)(triangleIndices.size()) + indices.getNumElements())); - gpu::BufferView::Iterator partItr = parts.cbegin(); - while (partItr != parts.cend()) { + gpu::BufferView::Iterator partItr = parts.cbegin(); + while (partItr != parts.cend()) { auto numIndices = partItr->_numIndices; - if (partItr->_topology == model::Mesh::TRIANGLES) { + if (partItr->_topology == graphics::Mesh::TRIANGLES) { // TODO: assert rather than workaround after we start sanitizing FBXMesh higher up //assert(numIndices % TRIANGLE_STRIDE == 0); numIndices -= numIndices % TRIANGLE_STRIDE; // WORKAROUND lack of sanity checking in FBXReader @@ -572,7 +572,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { triangleIndices.push_back(*indexItr + meshIndexOffset); ++indexItr; } - } else if (partItr->_topology == model::Mesh::TRIANGLE_STRIP) { + } else if (partItr->_topology == graphics::Mesh::TRIANGLE_STRIP) { // TODO: resurrect assert after we start sanitizing FBXMesh higher up //assert(numIndices > 2); @@ -593,7 +593,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { // the rest use previous and next index uint32_t triangleCount = 1; while (indexItr != indexEnd) { - if ((*indexItr) != model::Mesh::PRIMITIVE_RESTART_INDEX) { + if ((*indexItr) != graphics::Mesh::PRIMITIVE_RESTART_INDEX) { if (triangleCount % 2 == 0) { // even triangles use first two indices in order triangleIndices.push_back(*(indexItr - 2) + meshIndexOffset); @@ -613,12 +613,12 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { } } else if (type == SHAPE_TYPE_SIMPLE_COMPOUND) { // for each mesh copy unique part indices, separated by special bogus (flag) index values - gpu::BufferView::Iterator partItr = parts.cbegin(); - while (partItr != parts.cend()) { + gpu::BufferView::Iterator partItr = parts.cbegin(); + while (partItr != parts.cend()) { // collect unique list of indices for this part std::set uniqueIndices; auto numIndices = partItr->_numIndices; - if (partItr->_topology == model::Mesh::TRIANGLES) { + if (partItr->_topology == graphics::Mesh::TRIANGLES) { // TODO: assert rather than workaround after we start sanitizing FBXMesh higher up //assert(numIndices% TRIANGLE_STRIDE == 0); numIndices -= numIndices % TRIANGLE_STRIDE; // WORKAROUND lack of sanity checking in FBXReader @@ -629,7 +629,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { uniqueIndices.insert(*indexItr); ++indexItr; } - } else if (partItr->_topology == model::Mesh::TRIANGLE_STRIP) { + } else if (partItr->_topology == graphics::Mesh::TRIANGLE_STRIP) { // TODO: resurrect assert after we start sanitizing FBXMesh higher up //assert(numIndices > TRIANGLE_STRIDE - 1); @@ -644,7 +644,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& shapeInfo) { // the rest use previous and next index uint32_t triangleCount = 1; while (indexItr != indexEnd) { - if ((*indexItr) != model::Mesh::PRIMITIVE_RESTART_INDEX) { + if ((*indexItr) != graphics::Mesh::PRIMITIVE_RESTART_INDEX) { if (triangleCount % 2 == 0) { // EVEN triangles use first two indices in order uniqueIndices.insert(*(indexItr - 2)); @@ -1295,7 +1295,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce ShapeType type = entity->getShapeType(); if (DependencyManager::get()->shouldRenderDebugHulls() && type != SHAPE_TYPE_STATIC_MESH && type != SHAPE_TYPE_NONE) { // NOTE: it is OK if _collisionMeshKey is nullptr - model::MeshPointer mesh = collisionMeshCache.getMesh(_collisionMeshKey); + graphics::MeshPointer mesh = collisionMeshCache.getMesh(_collisionMeshKey); // NOTE: the model will render the collisionGeometry if it has one _model->setCollisionMesh(mesh); } else { @@ -1304,7 +1304,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce collisionMeshCache.releaseMesh(_collisionMeshKey); } // clear model's collision geometry - model::MeshPointer mesh = nullptr; + graphics::MeshPointer mesh = nullptr; _model->setCollisionMesh(mesh); } } diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index 365ba5189a..b4412e441f 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -1060,7 +1060,7 @@ void RenderablePolyVoxEntityItem::recomputeMesh() { auto entity = std::static_pointer_cast(getThisPointer()); QtConcurrent::run([entity, voxelSurfaceStyle] { - model::MeshPointer mesh(new model::Mesh()); + graphics::MeshPointer mesh(new graphics::Mesh()); // A mesh object to hold the result of surface extraction PolyVox::SurfaceMesh polyVoxMesh; @@ -1122,18 +1122,18 @@ void RenderablePolyVoxEntityItem::recomputeMesh() { sizeof(PolyVox::PositionMaterialNormal), gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ))); - std::vector parts; - parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex - (model::Index)vecIndices.size(), // numIndices - (model::Index)0, // baseVertex - model::Mesh::TRIANGLES)); // topology - mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), + std::vector parts; + parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex + (graphics::Index)vecIndices.size(), // numIndices + (graphics::Index)0, // baseVertex + graphics::Mesh::TRIANGLES)); // topology + mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); entity->setMesh(mesh); }); } -void RenderablePolyVoxEntityItem::setMesh(model::MeshPointer mesh) { +void RenderablePolyVoxEntityItem::setMesh(graphics::MeshPointer mesh) { // this catches the payload from recomputeMesh bool neighborsNeedUpdate; withWriteLock([&] { @@ -1164,7 +1164,7 @@ void RenderablePolyVoxEntityItem::computeShapeInfoWorker() { PolyVoxSurfaceStyle voxelSurfaceStyle; glm::vec3 voxelVolumeSize; - model::MeshPointer mesh; + graphics::MeshPointer mesh; withReadLock([&] { voxelSurfaceStyle = _voxelSurfaceStyle; @@ -1582,7 +1582,7 @@ void PolyVoxEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& s void PolyVoxEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { _lastVoxelToWorldMatrix = entity->voxelToWorldMatrix(); - model::MeshPointer newMesh; + graphics::MeshPointer newMesh; entity->withReadLock([&] { newMesh = entity->_mesh; }); diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h index 8dbe1dd0f1..03c7351a59 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.h @@ -104,7 +104,7 @@ public: void forEachVoxelValue(const ivec3& voxelSize, std::function thunk); QByteArray volDataToArray(quint16 voxelXSize, quint16 voxelYSize, quint16 voxelZSize) const; - void setMesh(model::MeshPointer mesh); + void setMesh(graphics::MeshPointer mesh); void setCollisionPoints(ShapeInfo::PointCollection points, AABox box); PolyVox::SimpleVolume* getVolData() { return _volData.get(); } @@ -134,7 +134,7 @@ private: // may not match _voxelVolumeSize. bool _meshDirty { true }; // does collision-shape need to be recomputed? bool _meshReady{ false }; - model::MeshPointer _mesh; + graphics::MeshPointer _mesh; ShapeInfo _shapeInfo; @@ -178,7 +178,7 @@ private: bool _hasTransitioned{ false }; #endif - model::MeshPointer _mesh; + graphics::MeshPointer _mesh; std::array _xyzTextures; glm::vec3 _lastVoxelVolumeSize; glm::mat4 _lastVoxelToWorldMatrix; diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index 4161b65ead..17cc4d2d4f 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -319,7 +319,7 @@ void ZoneEntityRenderer::updateKeySunFromEntity(const TypedEntityPointer& entity setKeyLightMode((ComponentMode)entity->getKeyLightMode()); const auto& sunLight = editSunLight(); - sunLight->setType(model::Light::SUN); + sunLight->setType(graphics::Light::SUN); sunLight->setPosition(_lastPosition); sunLight->setOrientation(_lastRotation); @@ -333,7 +333,7 @@ void ZoneEntityRenderer::updateAmbientLightFromEntity(const TypedEntityPointer& setAmbientLightMode((ComponentMode)entity->getAmbientLightMode()); const auto& ambientLight = editAmbientLight(); - ambientLight->setType(model::Light::AMBIENT); + ambientLight->setType(graphics::Light::AMBIENT); ambientLight->setPosition(_lastPosition); ambientLight->setOrientation(_lastRotation); @@ -357,23 +357,23 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity) haze->setHazeActive(hazeMode == COMPONENT_MODE_ENABLED); haze->setAltitudeBased(_hazeProperties.getHazeAltitudeEffect()); - haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange())); + haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange())); xColor hazeColor = _hazeProperties.getHazeColor(); haze->setHazeColor(glm::vec3(hazeColor.red / 255.0, hazeColor.green / 255.0, hazeColor.blue / 255.0)); xColor hazeGlareColor = _hazeProperties.getHazeGlareColor(); haze->setHazeGlareColor(glm::vec3(hazeGlareColor.red / 255.0, hazeGlareColor.green / 255.0, hazeGlareColor.blue / 255.0)); haze->setHazeEnableGlare(_hazeProperties.getHazeEnableGlare()); - haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle())); + haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle())); float hazeAltitude = _hazeProperties.getHazeCeiling() - _hazeProperties.getHazeBaseRef(); - haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude)); + haze->setHazeAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude)); haze->setHazeBaseReference(_hazeProperties.getHazeBaseRef()); haze->setHazeBackgroundBlend(_hazeProperties.getHazeBackgroundBlend()); haze->setHazeAttenuateKeyLight(_hazeProperties.getHazeAttenuateKeyLight()); - haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange())); - haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(_hazeProperties.getHazeKeyLightAltitude())); + haze->setHazeKeyLightRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange())); + haze->setHazeKeyLightAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(_hazeProperties.getHazeKeyLightAltitude())); haze->setZoneTransform(entity->getTransform().getMatrix()); } diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.h b/libraries/entities-renderer/src/RenderableZoneEntityItem.h index e1f696ca89..69f0663c06 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.h +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.h @@ -63,11 +63,11 @@ private: void setSkyboxColor(const glm::vec3& color); void setProceduralUserData(const QString& userData); - model::LightPointer editSunLight() { _needSunUpdate = true; return _sunLight; } - model::LightPointer editAmbientLight() { _needAmbientUpdate = true; return _ambientLight; } - model::SunSkyStagePointer editBackground() { _needBackgroundUpdate = true; return _background; } - model::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); } - model::HazePointer editHaze() { _needHazeUpdate = true; return _haze; } + graphics::LightPointer editSunLight() { _needSunUpdate = true; return _sunLight; } + graphics::LightPointer editAmbientLight() { _needAmbientUpdate = true; return _ambientLight; } + graphics::SunSkyStagePointer editBackground() { _needBackgroundUpdate = true; return _background; } + graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); } + graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; } bool _needsInitialSimulation{ true }; glm::vec3 _lastPosition; @@ -83,10 +83,10 @@ private: #endif LightStagePointer _stage; - const model::LightPointer _sunLight{ std::make_shared() }; - const model::LightPointer _ambientLight{ std::make_shared() }; - const model::SunSkyStagePointer _background{ std::make_shared() }; - const model::HazePointer _haze{ std::make_shared() }; + const graphics::LightPointer _sunLight{ std::make_shared() }; + const graphics::LightPointer _ambientLight{ std::make_shared() }; + const graphics::SunSkyStagePointer _background{ std::make_shared() }; + const graphics::HazePointer _haze{ std::make_shared() }; ComponentMode _keyLightMode { COMPONENT_MODE_INHERIT }; ComponentMode _ambientLightMode { COMPONENT_MODE_INHERIT }; diff --git a/libraries/fbx/src/FBX.h b/libraries/fbx/src/FBX.h index 21f8fe51aa..e40b218344 100644 --- a/libraries/fbx/src/FBX.h +++ b/libraries/fbx/src/FBX.h @@ -183,7 +183,7 @@ public: QString materialID; QString name; QString shadingModel; - model::MaterialPointer _material; + graphics::MaterialPointer _material; FBXTexture normalTexture; FBXTexture albedoTexture; @@ -238,7 +238,7 @@ public: unsigned int meshIndex; // the order the meshes appeared in the object file - model::MeshPointer _mesh; + graphics::MeshPointer _mesh; bool wasCompressed { false }; }; diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 42d25c96ea..4bc5eb1b6d 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -72,7 +72,7 @@ Extents FBXGeometry::getUnscaledMeshExtents() const { return scaledExtents; } -// TODO: Move to model::Mesh when Sam's ready +// TODO: Move to graphics::Mesh when Sam's ready bool FBXGeometry::convexHullContains(const glm::vec3& point) const { if (!getUnscaledMeshExtents().containsPoint(point)) { return false; diff --git a/libraries/fbx/src/FBXReader_Material.cpp b/libraries/fbx/src/FBXReader_Material.cpp index ef6496cd10..4aa3044934 100644 --- a/libraries/fbx/src/FBXReader_Material.cpp +++ b/libraries/fbx/src/FBXReader_Material.cpp @@ -279,7 +279,7 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) { } // Finally create the true material representation - material._material = std::make_shared(); + material._material = std::make_shared(); // Emissive color is the mix of emissiveColor with emissiveFactor auto emissive = material.emissiveColor * (isMaterialLambert ? 1.0f : material.emissiveFactor); // In lambert there is not emissiveFactor @@ -293,7 +293,7 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) { material._material->setRoughness(material.roughness); material._material->setMetallic(material.metallic); } else { - material._material->setRoughness(model::Material::shininessToRoughness(material.shininess)); + material._material->setRoughness(graphics::Material::shininessToRoughness(material.shininess)); float metallic = std::max(material.specularColor.x, std::max(material.specularColor.y, material.specularColor.z)); material._material->setMetallic(metallic); diff --git a/libraries/fbx/src/FBXReader_Mesh.cpp b/libraries/fbx/src/FBXReader_Mesh.cpp index 309c421052..bc7daa98f4 100644 --- a/libraries/fbx/src/FBXReader_Mesh.cpp +++ b/libraries/fbx/src/FBXReader_Mesh.cpp @@ -584,7 +584,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { } FBXMesh& fbxMesh = extractedMesh; - model::MeshPointer mesh(new model::Mesh()); + graphics::MeshPointer mesh(new graphics::Mesh()); // Grab the vertices in a buffer auto vb = std::make_shared(); @@ -721,45 +721,45 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { if (normalsSize) { mesh->addAttribute(gpu::Stream::NORMAL, - model::BufferView(attribBuffer, normalsOffset, normalsAndTangentsSize, + graphics::BufferView(attribBuffer, normalsOffset, normalsAndTangentsSize, normalsAndTangentsStride, FBX_NORMAL_ELEMENT)); mesh->addAttribute(gpu::Stream::TANGENT, - model::BufferView(attribBuffer, tangentsOffset, normalsAndTangentsSize, + graphics::BufferView(attribBuffer, tangentsOffset, normalsAndTangentsSize, normalsAndTangentsStride, FBX_NORMAL_ELEMENT)); } if (colorsSize) { mesh->addAttribute(gpu::Stream::COLOR, - model::BufferView(attribBuffer, colorsOffset, colorsSize, FBX_COLOR_ELEMENT)); + graphics::BufferView(attribBuffer, colorsOffset, colorsSize, FBX_COLOR_ELEMENT)); } if (texCoordsSize) { mesh->addAttribute(gpu::Stream::TEXCOORD, - model::BufferView( attribBuffer, texCoordsOffset, texCoordsSize, + graphics::BufferView( attribBuffer, texCoordsOffset, texCoordsSize, gpu::Element(gpu::VEC2, gpu::HALF, gpu::UV))); } if (texCoords1Size) { mesh->addAttribute( gpu::Stream::TEXCOORD1, - model::BufferView(attribBuffer, texCoords1Offset, texCoords1Size, + graphics::BufferView(attribBuffer, texCoords1Offset, texCoords1Size, gpu::Element(gpu::VEC2, gpu::HALF, gpu::UV))); } else if (texCoordsSize) { mesh->addAttribute(gpu::Stream::TEXCOORD1, - model::BufferView(attribBuffer, texCoordsOffset, texCoordsSize, + graphics::BufferView(attribBuffer, texCoordsOffset, texCoordsSize, gpu::Element(gpu::VEC2, gpu::HALF, gpu::UV))); } if (clusterIndicesSize) { if (fbxMesh.clusters.size() < UINT8_MAX) { mesh->addAttribute(gpu::Stream::SKIN_CLUSTER_INDEX, - model::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize, + graphics::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::XYZW))); } else { mesh->addAttribute(gpu::Stream::SKIN_CLUSTER_INDEX, - model::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize, + graphics::BufferView(attribBuffer, clusterIndicesOffset, clusterIndicesSize, gpu::Element(gpu::VEC4, gpu::UINT16, gpu::XYZW))); } } if (clusterWeightsSize) { mesh->addAttribute(gpu::Stream::SKIN_CLUSTER_WEIGHT, - model::BufferView(attribBuffer, clusterWeightsOffset, clusterWeightsSize, + graphics::BufferView(attribBuffer, clusterWeightsOffset, clusterWeightsSize, gpu::Element(gpu::VEC4, gpu::NUINT16, gpu::XYZW))); } @@ -780,12 +780,12 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { int indexNum = 0; int offset = 0; - std::vector< model::Mesh::Part > parts; + std::vector< graphics::Mesh::Part > parts; if (extractedMesh.parts.size() > 1) { indexNum = 0; } foreach(const FBXMeshPart& part, extractedMesh.parts) { - model::Mesh::Part modelPart(indexNum, 0, 0, model::Mesh::TRIANGLES); + graphics::Mesh::Part modelPart(indexNum, 0, 0, graphics::Mesh::TRIANGLES); if (part.quadTrianglesIndices.size()) { indexBuffer->setSubData(offset, @@ -813,7 +813,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { if (parts.size()) { auto pb = std::make_shared(); - pb->setData(parts.size() * sizeof(model::Mesh::Part), (const gpu::Byte*) parts.data()); + pb->setData(parts.size() * sizeof(graphics::Mesh::Part), (const gpu::Byte*) parts.data()); gpu::BufferView pbv(pb, gpu::Element(gpu::VEC4, gpu::UINT32, gpu::XYZW)); mesh->setPartBuffer(pbv); } else { @@ -821,7 +821,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) { return; } - // model::Box box = + // graphics::Box box = mesh->evalPartBound(0); extractedMesh._mesh = mesh; diff --git a/libraries/fbx/src/GLTFReader.cpp b/libraries/fbx/src/GLTFReader.cpp index c8501688ac..0c04b3d733 100644 --- a/libraries/fbx/src/GLTFReader.cpp +++ b/libraries/fbx/src/GLTFReader.cpp @@ -748,7 +748,7 @@ bool GLTFReader::buildGeometry(FBXGeometry& geometry, const QUrl& url) { QString& matid = materialIDs[i]; geometry.materials[matid] = FBXMaterial(); FBXMaterial& fbxMaterial = geometry.materials[matid]; - fbxMaterial._material = std::make_shared(); + fbxMaterial._material = std::make_shared(); setFBXMaterial(fbxMaterial, _file.materials[i]); } diff --git a/libraries/fbx/src/OBJReader.cpp b/libraries/fbx/src/OBJReader.cpp index 7fb916efde..ba93a49cb9 100644 --- a/libraries/fbx/src/OBJReader.cpp +++ b/libraries/fbx/src/OBJReader.cpp @@ -750,8 +750,8 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping, objMaterial.opacity); FBXMaterial& fbxMaterial = geometry.materials[materialID]; fbxMaterial.materialID = materialID; - fbxMaterial._material = std::make_shared(); - model::MaterialPointer modelMaterial = fbxMaterial._material; + fbxMaterial._material = std::make_shared(); + graphics::MaterialPointer modelMaterial = fbxMaterial._material; if (!objMaterial.diffuseTextureFilename.isEmpty()) { fbxMaterial.albedoTexture.filename = objMaterial.diffuseTextureFilename; @@ -763,7 +763,7 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping, modelMaterial->setEmissive(fbxMaterial.emissiveColor); modelMaterial->setAlbedo(fbxMaterial.diffuseColor); modelMaterial->setMetallic(glm::length(fbxMaterial.specularColor)); - modelMaterial->setRoughness(model::Material::shininessToRoughness(fbxMaterial.shininess)); + modelMaterial->setRoughness(graphics::Material::shininessToRoughness(fbxMaterial.shininess)); if (fbxMaterial.opacity <= 0.0f) { modelMaterial->setOpacity(1.0f); diff --git a/libraries/fbx/src/OBJWriter.cpp b/libraries/fbx/src/OBJWriter.cpp index 42ef2be646..4441ae6649 100644 --- a/libraries/fbx/src/OBJWriter.cpp +++ b/libraries/fbx/src/OBJWriter.cpp @@ -105,13 +105,13 @@ bool writeOBJToTextStream(QTextStream& out, QList meshes) { const gpu::BufferView& partBuffer = mesh->getPartBuffer(); const gpu::BufferView& indexBuffer = mesh->getIndexBuffer(); - model::Index partCount = (model::Index)mesh->getNumParts(); + graphics::Index partCount = (graphics::Index)mesh->getNumParts(); for (int partIndex = 0; partIndex < partCount; partIndex++) { - const model::Mesh::Part& part = partBuffer.get(partIndex); + const graphics::Mesh::Part& part = partBuffer.get(partIndex); out << "g part-" << nth++ << "\n"; - // model::Mesh::TRIANGLES + // graphics::Mesh::TRIANGLES // TODO -- handle other formats gpu::BufferView::Iterator indexItr = indexBuffer.cbegin(); indexItr += part._startIndex; diff --git a/libraries/fbx/src/OBJWriter.h b/libraries/fbx/src/OBJWriter.h index 7f8b0ddbed..536e8cf837 100644 --- a/libraries/fbx/src/OBJWriter.h +++ b/libraries/fbx/src/OBJWriter.h @@ -17,7 +17,7 @@ #include #include -using MeshPointer = std::shared_ptr; +using MeshPointer = std::shared_ptr; bool writeOBJToTextStream(QTextStream& out, QList meshes); bool writeOBJToFile(QString path, QList meshes); diff --git a/libraries/graphics/src/graphics/Asset.cpp b/libraries/graphics/src/graphics/Asset.cpp index 84d7560257..ef5f010b4e 100644 --- a/libraries/graphics/src/graphics/Asset.cpp +++ b/libraries/graphics/src/graphics/Asset.cpp @@ -10,7 +10,7 @@ // #include "Asset.h" -using namespace model; +using namespace graphics; Asset::Asset() { } diff --git a/libraries/graphics/src/graphics/Asset.h b/libraries/graphics/src/graphics/Asset.h index c2e4ff3d3a..86d98c1a69 100644 --- a/libraries/graphics/src/graphics/Asset.h +++ b/libraries/graphics/src/graphics/Asset.h @@ -17,7 +17,7 @@ #include "Material.h" #include "Geometry.h" -namespace model { +namespace graphics { template class Table { diff --git a/libraries/graphics/src/graphics/Forward.h b/libraries/graphics/src/graphics/Forward.h index 7f728b44fc..95d2d73099 100644 --- a/libraries/graphics/src/graphics/Forward.h +++ b/libraries/graphics/src/graphics/Forward.h @@ -11,7 +11,7 @@ #ifndef hifi_model_Forward_h #define hifi_model_Forward_h -namespace model { +namespace graphics { class Mesh; using MeshPointer = std::shared_ptr; } diff --git a/libraries/graphics/src/graphics/Geometry.cpp b/libraries/graphics/src/graphics/Geometry.cpp index 930449c5e6..ba5afcbc62 100755 --- a/libraries/graphics/src/graphics/Geometry.cpp +++ b/libraries/graphics/src/graphics/Geometry.cpp @@ -13,7 +13,7 @@ #include -using namespace model; +using namespace graphics; Mesh::Mesh() : _vertexBuffer(gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)), @@ -137,7 +137,7 @@ Box Mesh::evalPartsBound(int partStart, int partEnd) const { } -model::MeshPointer Mesh::map(std::function vertexFunc, +graphics::MeshPointer Mesh::map(std::function vertexFunc, std::function colorFunc, std::function normalFunc, std::function indexFunc) const { @@ -223,7 +223,7 @@ model::MeshPointer Mesh::map(std::function vertexFunc, indexDataCursor += sizeof(index); } - model::MeshPointer result(new model::Mesh()); + graphics::MeshPointer result(new graphics::Mesh()); gpu::Element vertexElement = gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ); gpu::Buffer* resultVertexBuffer = new gpu::Buffer(vertexSize, resultVertexData.get()); @@ -252,12 +252,12 @@ model::MeshPointer Mesh::map(std::function vertexFunc, // TODO -- shouldn't assume just one part - std::vector parts; - parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex - (model::Index)result->getNumIndices(), // numIndices - (model::Index)0, // baseVertex - model::Mesh::TRIANGLES)); // topology - result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), + std::vector parts; + parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex + (graphics::Index)result->getNumIndices(), // numIndices + (graphics::Index)0, // baseVertex + graphics::Mesh::TRIANGLES)); // topology + result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); return result; @@ -350,9 +350,9 @@ MeshPointer Mesh::createIndexedTriangles_P3F(uint32_t numVertices, uint32_t numI } - std::vector parts; - parts.push_back(model::Mesh::Part(0, numIndices, 0, model::Mesh::TRIANGLES)); - mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); + std::vector parts; + parts.push_back(graphics::Mesh::Part(0, numIndices, 0, graphics::Mesh::TRIANGLES)); + mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); return mesh; } diff --git a/libraries/graphics/src/graphics/Geometry.h b/libraries/graphics/src/graphics/Geometry.h index 510cf54742..cd64a7c185 100755 --- a/libraries/graphics/src/graphics/Geometry.h +++ b/libraries/graphics/src/graphics/Geometry.h @@ -18,7 +18,7 @@ #include #include -namespace model { +namespace graphics { typedef gpu::BufferView::Index Index; typedef gpu::BufferView BufferView; typedef AABox Box; @@ -40,7 +40,7 @@ public: typedef gpu::Stream::Format VertexFormat; typedef std::map< Slot, BufferView > BufferViewMap; - typedef model::Vec3 Vec3; + typedef graphics::Vec3 Vec3; Mesh(); Mesh(const Mesh& mesh); diff --git a/libraries/graphics/src/graphics/Haze.cpp b/libraries/graphics/src/graphics/Haze.cpp index dd07afc6d6..c788bc57db 100644 --- a/libraries/graphics/src/graphics/Haze.cpp +++ b/libraries/graphics/src/graphics/Haze.cpp @@ -12,7 +12,7 @@ #include #include "Haze.h" -using namespace model; +using namespace graphics; const float Haze::INITIAL_HAZE_RANGE{ 1000.0f }; const float Haze::INITIAL_HAZE_HEIGHT{ 200.0f }; diff --git a/libraries/graphics/src/graphics/Haze.h b/libraries/graphics/src/graphics/Haze.h index 260f5f0097..608449a97e 100644 --- a/libraries/graphics/src/graphics/Haze.h +++ b/libraries/graphics/src/graphics/Haze.h @@ -17,7 +17,7 @@ #include "Transform.h" #include "NumericalConstants.h" -namespace model { +namespace graphics { // Haze range is defined here as the range the visibility is reduced by 95% // Haze altitude is defined here as the altitude (above 0) that the haze is reduced by 95% diff --git a/libraries/graphics/src/graphics/Light.cpp b/libraries/graphics/src/graphics/Light.cpp index 8b6aae7759..cb5209d4cf 100755 --- a/libraries/graphics/src/graphics/Light.cpp +++ b/libraries/graphics/src/graphics/Light.cpp @@ -10,7 +10,7 @@ // #include "Light.h" -using namespace model; +using namespace graphics; Light::Light() { updateLightRadius(); diff --git a/libraries/graphics/src/graphics/Light.h b/libraries/graphics/src/graphics/Light.h index 58d5c0cf2a..360e3f224e 100755 --- a/libraries/graphics/src/graphics/Light.h +++ b/libraries/graphics/src/graphics/Light.h @@ -19,7 +19,7 @@ #include "gpu/Resource.h" #include "gpu/Texture.h" -namespace model { +namespace graphics { typedef gpu::BufferView UniformBufferView; typedef gpu::TextureView TextureView; typedef glm::vec3 Vec3; diff --git a/libraries/graphics/src/graphics/Material.cpp b/libraries/graphics/src/graphics/Material.cpp index 0cfb9916ac..ea5bd331c9 100755 --- a/libraries/graphics/src/graphics/Material.cpp +++ b/libraries/graphics/src/graphics/Material.cpp @@ -12,7 +12,7 @@ #include "TextureMap.h" -using namespace model; +using namespace graphics; using namespace gpu; Material::Material() : diff --git a/libraries/graphics/src/graphics/Material.h b/libraries/graphics/src/graphics/Material.h index 6a2b1c2bee..cfbfaa61ea 100755 --- a/libraries/graphics/src/graphics/Material.h +++ b/libraries/graphics/src/graphics/Material.h @@ -20,7 +20,7 @@ #include -namespace model { +namespace graphics { class TextureMap; typedef std::shared_ptr< TextureMap > TextureMapPointer; diff --git a/libraries/graphics/src/graphics/Skybox.cpp b/libraries/graphics/src/graphics/Skybox.cpp index feb9fb86b7..6fb7226089 100755 --- a/libraries/graphics/src/graphics/Skybox.cpp +++ b/libraries/graphics/src/graphics/Skybox.cpp @@ -18,7 +18,7 @@ #include "skybox_vert.h" #include "skybox_frag.h" -using namespace model; +using namespace graphics; Skybox::Skybox() { Schema schema; diff --git a/libraries/graphics/src/graphics/Skybox.h b/libraries/graphics/src/graphics/Skybox.h index 99155bdd98..d06989a457 100755 --- a/libraries/graphics/src/graphics/Skybox.h +++ b/libraries/graphics/src/graphics/Skybox.h @@ -19,7 +19,7 @@ class ViewFrustum; namespace gpu { class Batch; } -namespace model { +namespace graphics { typedef glm::vec3 Color; diff --git a/libraries/graphics/src/graphics/Stage.cpp b/libraries/graphics/src/graphics/Stage.cpp index 3a300858fe..312ece6889 100644 --- a/libraries/graphics/src/graphics/Stage.cpp +++ b/libraries/graphics/src/graphics/Stage.cpp @@ -15,7 +15,7 @@ #include #include -using namespace model; +using namespace graphics; void EarthSunModel::updateAll() const { diff --git a/libraries/graphics/src/graphics/Stage.h b/libraries/graphics/src/graphics/Stage.h index 65c7b016d6..55f6145ee0 100644 --- a/libraries/graphics/src/graphics/Stage.h +++ b/libraries/graphics/src/graphics/Stage.h @@ -16,7 +16,7 @@ #include "Light.h" #include "Skybox.h" -namespace model { +namespace graphics { typedef glm::dvec3 Vec3d; typedef glm::dvec4 Vec4d; diff --git a/libraries/graphics/src/graphics/TextureMap.cpp b/libraries/graphics/src/graphics/TextureMap.cpp index 7a4eb6391e..e2f24d68ff 100755 --- a/libraries/graphics/src/graphics/TextureMap.cpp +++ b/libraries/graphics/src/graphics/TextureMap.cpp @@ -10,7 +10,7 @@ // #include "TextureMap.h" -using namespace model; +using namespace graphics; using namespace gpu; void TextureMap::setTextureSource(TextureSourcePointer& textureSource) { diff --git a/libraries/graphics/src/graphics/TextureMap.h b/libraries/graphics/src/graphics/TextureMap.h index 268c3daef8..1678d9df98 100755 --- a/libraries/graphics/src/graphics/TextureMap.h +++ b/libraries/graphics/src/graphics/TextureMap.h @@ -15,7 +15,7 @@ #include "Transform.h" -namespace model { +namespace graphics { class TextureMap { public: diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index 6a14e6d6b7..07f7283bfa 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -516,13 +516,13 @@ QUrl NetworkMaterial::getTextureUrl(const QUrl& baseUrl, const FBXTexture& textu } } -model::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, +graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, image::TextureUsage::Type type, MapChannel channel) { const auto url = getTextureUrl(baseUrl, fbxTexture); const auto texture = DependencyManager::get()->getTexture(url, type, fbxTexture.content, fbxTexture.maxNumPixels); _textures[channel] = Texture { fbxTexture.name, texture }; - auto map = std::make_shared(); + auto map = std::make_shared(); if (texture) { map->setTextureSource(texture->_textureSource); } @@ -531,18 +531,18 @@ model::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, c return map; } -model::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel) { +graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel) { const auto texture = DependencyManager::get()->getTexture(url, type); _textures[channel].texture = texture; - auto map = std::make_shared(); + auto map = std::make_shared(); map->setTextureSource(texture->_textureSource); return map; } NetworkMaterial::NetworkMaterial(const FBXMaterial& material, const QUrl& textureBaseUrl) : - model::Material(*material._material) + graphics::Material(*material._material) { _textures = Textures(MapChannel::NUM_MAP_CHANNELS); if (!material.albedoTexture.filename.isEmpty()) { diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h index 5c49ec683a..f650b3f2eb 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.h +++ b/libraries/model-networking/src/model-networking/ModelCache.h @@ -38,7 +38,7 @@ public: Geometry(const Geometry& geometry); // Immutable over lifetime - using GeometryMeshes = std::vector>; + using GeometryMeshes = std::vector>; using GeometryMeshParts = std::vector>; // Mutable, but must retain structure of vector @@ -157,9 +157,9 @@ private: virtual ~ModelCache() = default; }; -class NetworkMaterial : public model::Material { +class NetworkMaterial : public graphics::Material { public: - using MapChannel = model::Material::MapChannel; + using MapChannel = graphics::Material::MapChannel; NetworkMaterial(const FBXMaterial& material, const QUrl& textureBaseUrl); @@ -185,9 +185,9 @@ protected: private: // Helpers for the ctors QUrl getTextureUrl(const QUrl& baseUrl, const FBXTexture& fbxTexture); - model::TextureMapPointer fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, + graphics::TextureMapPointer fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, image::TextureUsage::Type type, MapChannel channel); - model::TextureMapPointer fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel); + graphics::TextureMapPointer fetchTextureMap(const QUrl& url, image::TextureUsage::Type type, MapChannel channel); Transform _albedoTransform; Transform _lightmapTransform; diff --git a/libraries/physics/src/CollisionRenderMeshCache.cpp b/libraries/physics/src/CollisionRenderMeshCache.cpp index 40a8a4aff9..6f66b9af10 100644 --- a/libraries/physics/src/CollisionRenderMeshCache.cpp +++ b/libraries/physics/src/CollisionRenderMeshCache.cpp @@ -21,7 +21,7 @@ const int32_t MAX_HULL_INDICES = 6 * MAX_HULL_POINTS; const int32_t MAX_HULL_NORMALS = MAX_HULL_INDICES; float tempVertices[MAX_HULL_NORMALS]; -model::Index tempIndexBuffer[MAX_HULL_INDICES]; +graphics::Index tempIndexBuffer[MAX_HULL_INDICES]; bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape, gpu::BufferView& vertices, gpu::BufferView& indices, gpu::BufferView& parts, @@ -40,21 +40,21 @@ bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape, assert(numHullVertices <= MAX_HULL_POINTS); { // new part - model::Mesh::Part part; - part._startIndex = (model::Index)indices.getNumElements(); - part._numIndices = (model::Index)numHullIndices; + graphics::Mesh::Part part; + part._startIndex = (graphics::Index)indices.getNumElements(); + part._numIndices = (graphics::Index)numHullIndices; // FIXME: the render code cannot handle the case where part._baseVertex != 0 //part._baseVertex = vertices.getNumElements(); // DOES NOT WORK part._baseVertex = 0; - gpu::BufferView::Size numBytes = sizeof(model::Mesh::Part); + gpu::BufferView::Size numBytes = sizeof(graphics::Mesh::Part); const gpu::Byte* data = reinterpret_cast(&part); parts._buffer->append(numBytes, data); parts._size = parts._buffer->getSize(); } const int32_t SIZE_OF_VEC3 = 3 * sizeof(float); - model::Index indexOffset = (model::Index)vertices.getNumElements(); + graphics::Index indexOffset = (graphics::Index)vertices.getNumElements(); { // new indices const uint32_t* hullIndices = hull.getIndexPointer(); @@ -64,7 +64,7 @@ bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape, tempIndexBuffer[i] = hullIndices[i] + indexOffset; } const gpu::Byte* data = reinterpret_cast(tempIndexBuffer); - gpu::BufferView::Size numBytes = (gpu::BufferView::Size)(sizeof(model::Index) * numHullIndices); + gpu::BufferView::Size numBytes = (gpu::BufferView::Size)(sizeof(graphics::Index) * numHullIndices); indices._buffer->append(numBytes, data); indices._size = indices._buffer->getSize(); } @@ -105,8 +105,8 @@ bool copyShapeToMesh(const btTransform& transform, const btConvexShape* shape, return true; } -model::MeshPointer createMeshFromShape(const void* pointer) { - model::MeshPointer mesh; +graphics::MeshPointer createMeshFromShape(const void* pointer) { + graphics::MeshPointer mesh; if (!pointer) { return mesh; } @@ -147,7 +147,7 @@ model::MeshPointer createMeshFromShape(const void* pointer) { } } if (numSuccesses > 0) { - mesh = std::make_shared(); + mesh = std::make_shared(); mesh->setVertexBuffer(vertices); mesh->setIndexBuffer(indices); mesh->setPartBuffer(parts); @@ -167,8 +167,8 @@ CollisionRenderMeshCache::~CollisionRenderMeshCache() { _pendingGarbage.clear(); } -model::MeshPointer CollisionRenderMeshCache::getMesh(CollisionRenderMeshCache::Key key) { - model::MeshPointer mesh; +graphics::MeshPointer CollisionRenderMeshCache::getMesh(CollisionRenderMeshCache::Key key) { + graphics::MeshPointer mesh; if (key) { CollisionMeshMap::const_iterator itr = _meshMap.find(key); if (itr == _meshMap.end()) { diff --git a/libraries/physics/src/CollisionRenderMeshCache.h b/libraries/physics/src/CollisionRenderMeshCache.h index 64f161e229..c5b643c0cc 100644 --- a/libraries/physics/src/CollisionRenderMeshCache.h +++ b/libraries/physics/src/CollisionRenderMeshCache.h @@ -27,7 +27,7 @@ public: ~CollisionRenderMeshCache(); /// \return pointer to geometry - model::MeshPointer getMesh(Key key); + graphics::MeshPointer getMesh(Key key); /// \return true if geometry was found and released bool releaseMesh(Key key); @@ -40,7 +40,7 @@ public: bool hasMesh(Key key) const { return _meshMap.find(key) == _meshMap.end(); } private: - using CollisionMeshMap = std::unordered_map; + using CollisionMeshMap = std::unordered_map; CollisionMeshMap _meshMap; std::vector _pendingGarbage; }; diff --git a/libraries/procedural/src/procedural/ProceduralSkybox.cpp b/libraries/procedural/src/procedural/ProceduralSkybox.cpp index 60cb4d8fc4..f0c60e2101 100644 --- a/libraries/procedural/src/procedural/ProceduralSkybox.cpp +++ b/libraries/procedural/src/procedural/ProceduralSkybox.cpp @@ -18,7 +18,7 @@ #include #include -ProceduralSkybox::ProceduralSkybox() : model::Skybox() { +ProceduralSkybox::ProceduralSkybox() : graphics::Skybox() { _procedural._vertexSource = skybox_vert; _procedural._fragmentSource = skybox_frag; // Adjust the pipeline state for background using the stencil test diff --git a/libraries/procedural/src/procedural/ProceduralSkybox.h b/libraries/procedural/src/procedural/ProceduralSkybox.h index 14481a57c7..5db1078a5f 100644 --- a/libraries/procedural/src/procedural/ProceduralSkybox.h +++ b/libraries/procedural/src/procedural/ProceduralSkybox.h @@ -17,7 +17,7 @@ #include "Procedural.h" -class ProceduralSkybox: public model::Skybox { +class ProceduralSkybox: public graphics::Skybox { public: ProceduralSkybox(); diff --git a/libraries/render-utils/src/BackgroundStage.cpp b/libraries/render-utils/src/BackgroundStage.cpp index 2d2c0ed150..493c28d840 100644 --- a/libraries/render-utils/src/BackgroundStage.cpp +++ b/libraries/render-utils/src/BackgroundStage.cpp @@ -64,8 +64,8 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext, auto backgroundStage = renderContext->_scene->getStage(); assert(backgroundStage); - model::SunSkyStagePointer background; - model::SkyboxPointer skybox; + graphics::SunSkyStagePointer background; + graphics::SkyboxPointer skybox; if (backgroundStage->_currentFrame._backgrounds.size()) { auto backgroundId = backgroundStage->_currentFrame._backgrounds.front(); auto background = backgroundStage->getBackground(backgroundId); @@ -76,7 +76,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext, /* auto backgroundMode = skyStage->getBackgroundMode(); switch (backgroundMode) { - case model::SunSkyStage::SKY_DEFAULT: { + case graphics::SunSkyStage::SKY_DEFAULT: { auto scene = DependencyManager::get()->getStage(); auto sceneKeyLight = scene->getKeyLight(); @@ -88,7 +88,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext, // fall through: render a skybox (if available), or the defaults (if requested) } - case model::SunSkyStage::SKY_BOX: {*/ + case graphics::SunSkyStage::SKY_BOX: {*/ if (skybox && !skybox->empty()) { PerformanceTimer perfTimer("skybox"); auto args = renderContext->args; @@ -118,7 +118,7 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext, // fall through: render defaults (if requested) // } /* - case model::SunSkyStage::SKY_DEFAULT_AMBIENT_TEXTURE: { + case graphics::SunSkyStage::SKY_DEFAULT_AMBIENT_TEXTURE: { if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) { auto scene = DependencyManager::get()->getStage(); auto sceneKeyLight = scene->getKeyLight(); diff --git a/libraries/render-utils/src/BackgroundStage.h b/libraries/render-utils/src/BackgroundStage.h index b890a8cb28..db876b1993 100644 --- a/libraries/render-utils/src/BackgroundStage.h +++ b/libraries/render-utils/src/BackgroundStage.h @@ -30,8 +30,8 @@ public: static const Index INVALID_INDEX; static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; } - using BackgroundPointer = model::SunSkyStagePointer; - using Backgrounds = render::indexed_container::IndexedPointerVector; + using BackgroundPointer = graphics::SunSkyStagePointer; + using Backgrounds = render::indexed_container::IndexedPointerVector; using BackgroundMap = std::unordered_map; using BackgroundIndices = std::vector; diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 81a33f17e3..b4fc2fd32d 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -103,13 +103,13 @@ void DeferredLightingEffect::init() { void DeferredLightingEffect::setupKeyLightBatch(const RenderArgs* args, gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) { PerformanceTimer perfTimer("DLE->setupBatch()"); - model::LightPointer keySunLight; + graphics::LightPointer keySunLight; auto lightStage = args->_scene->getStage(); if (lightStage) { keySunLight = lightStage->getCurrentKeyLight(); } - model::LightPointer keyAmbiLight; + graphics::LightPointer keyAmbiLight; if (lightStage) { keyAmbiLight = lightStage->getCurrentAmbientLight(); } @@ -229,9 +229,9 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo #include -model::MeshPointer DeferredLightingEffect::getPointLightMesh() { +graphics::MeshPointer DeferredLightingEffect::getPointLightMesh() { if (!_pointLightMesh) { - _pointLightMesh = std::make_shared(); + _pointLightMesh = std::make_shared(); // let's use a icosahedron auto solid = geometry::icosahedron(); @@ -256,19 +256,19 @@ model::MeshPointer DeferredLightingEffect::getPointLightMesh() { delete[] indexData; - std::vector parts; - parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::TRIANGLES)); - parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::LINE_STRIP)); // outline version + std::vector parts; + parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::TRIANGLES)); + parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::LINE_STRIP)); // outline version - _pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); + _pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); } return _pointLightMesh; } -model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { +graphics::MeshPointer DeferredLightingEffect::getSpotLightMesh() { if (!_spotLightMesh) { - _spotLightMesh = std::make_shared(); + _spotLightMesh = std::make_shared(); int slices = 16; int rings = 3; @@ -353,12 +353,12 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { delete[] indexData; - std::vector parts; - parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::TRIANGLES)); - parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::LINE_STRIP)); // outline version + std::vector parts; + parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::TRIANGLES)); + parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::LINE_STRIP)); // outline version - _spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); + _spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); } return _spotLightMesh; } @@ -439,7 +439,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, const DeferredFrameTransformPointer& frameTransform, const DeferredFramebufferPointer& deferredFramebuffer, const LightingModelPointer& lightingModel, - const model::HazePointer& haze, + const graphics::HazePointer& haze, const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer, const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer, const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) { @@ -513,7 +513,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, auto keyLight = lightAndShadow.first; - model::LightPointer keyAmbientLight; + graphics::LightPointer keyAmbientLight; if (lightStage && lightStage->_currentFrame._ambientLights.size()) { keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front()); } @@ -744,12 +744,12 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { if (lightStage) { // Allocate a default global light directional and ambient - auto lp = std::make_shared(); - lp->setType(model::Light::SUN); + auto lp = std::make_shared(); + lp->setType(graphics::Light::SUN); lp->setDirection(glm::vec3(-1.0f)); lp->setColor(glm::vec3(1.0f)); lp->setIntensity(1.0f); - lp->setType(model::Light::SUN); + lp->setType(graphics::Light::SUN); lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE); lp->setAmbientIntensity(0.5f); @@ -771,7 +771,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { auto backgroundStage = renderContext->_scene->getStage(); if (backgroundStage) { - auto background = std::make_shared(); + auto background = std::make_shared(); background->setSkybox(_defaultSkybox); // capture deault background @@ -786,7 +786,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { auto hazeStage = renderContext->_scene->getStage(); if (hazeStage) { - auto haze = std::make_shared(); + auto haze = std::make_shared(); _defaultHaze = haze; _defaultHazeID = hazeStage->addHaze(_defaultHaze); diff --git a/libraries/render-utils/src/DeferredLightingEffect.h b/libraries/render-utils/src/DeferredLightingEffect.h index 8d0fc619e5..6d2c0a6819 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.h +++ b/libraries/render-utils/src/DeferredLightingEffect.h @@ -61,10 +61,10 @@ private: bool _shadowMapEnabled{ false }; bool _ambientOcclusionEnabled{ false }; - model::MeshPointer _pointLightMesh; - model::MeshPointer getPointLightMesh(); - model::MeshPointer _spotLightMesh; - model::MeshPointer getSpotLightMesh(); + graphics::MeshPointer _pointLightMesh; + graphics::MeshPointer getPointLightMesh(); + graphics::MeshPointer _spotLightMesh; + graphics::MeshPointer getSpotLightMesh(); gpu::PipelinePointer _directionalSkyboxLight; gpu::PipelinePointer _directionalAmbientSphereLight; @@ -121,7 +121,7 @@ public: const DeferredFrameTransformPointer& frameTransform, const DeferredFramebufferPointer& deferredFramebuffer, const LightingModelPointer& lightingModel, - const model::HazePointer& haze, + const graphics::HazePointer& haze, const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer, const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer, const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource); @@ -158,7 +158,7 @@ class RenderDeferred { public: using Inputs = render::VaryingSet8 < DeferredFrameTransformPointer, DeferredFramebufferPointer, LightingModelPointer, SurfaceGeometryFramebufferPointer, - AmbientOcclusionFramebufferPointer, SubsurfaceScatteringResourcePointer, LightClustersPointer, model::HazePointer>; + AmbientOcclusionFramebufferPointer, SubsurfaceScatteringResourcePointer, LightClustersPointer, graphics::HazePointer>; using Config = RenderDeferredConfig; using JobModel = render::Job::ModelI; @@ -184,13 +184,13 @@ public: void run(const render::RenderContextPointer& renderContext); protected: - model::LightPointer _defaultLight; + graphics::LightPointer _defaultLight; LightStage::Index _defaultLightID{ LightStage::INVALID_INDEX }; - model::SunSkyStagePointer _defaultBackground; + graphics::SunSkyStagePointer _defaultBackground; BackgroundStage::Index _defaultBackgroundID{ BackgroundStage::INVALID_INDEX }; - model::HazePointer _defaultHaze{ nullptr }; + graphics::HazePointer _defaultHaze{ nullptr }; HazeStage::Index _defaultHazeID{ HazeStage::INVALID_INDEX }; - model::SkyboxPointer _defaultSkybox { new ProceduralSkybox() }; + graphics::SkyboxPointer _defaultSkybox { new ProceduralSkybox() }; gpu::TexturePointer _defaultSkyboxTexture; gpu::TexturePointer _defaultSkyboxAmbientTexture; }; diff --git a/libraries/render-utils/src/DrawHaze.cpp b/libraries/render-utils/src/DrawHaze.cpp index da07f5bd9b..64a106a09c 100644 --- a/libraries/render-utils/src/DrawHaze.cpp +++ b/libraries/render-utils/src/DrawHaze.cpp @@ -78,12 +78,12 @@ void HazeConfig::setHazeBackgroundBlend(const float value) { } MakeHaze::MakeHaze() { - _haze = std::make_shared(); + _haze = std::make_shared(); } void MakeHaze::configure(const Config& config) { _haze->setHazeColor(config.hazeColor); - _haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(config.hazeGlareAngle)); + _haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(config.hazeGlareAngle)); _haze->setHazeGlareColor(config.hazeGlareColor); _haze->setHazeBaseReference(config.hazeBaseReference); @@ -94,16 +94,16 @@ void MakeHaze::configure(const Config& config) { _haze->setModulateColorActive(config.isModulateColorActive); _haze->setHazeEnableGlare(config.isHazeEnableGlare); - _haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange)); - _haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); + _haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange)); + _haze->setHazeAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); - _haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); - _haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); + _haze->setHazeKeyLightRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); + _haze->setHazeKeyLightAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); _haze->setHazeBackgroundBlend(config.hazeBackgroundBlend); } -void MakeHaze::run(const render::RenderContextPointer& renderContext, model::HazePointer& haze) { +void MakeHaze::run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze) { haze = _haze; } @@ -168,7 +168,7 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu auto hazeStage = args->_scene->getStage(); if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) { - model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front()); + graphics::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front()); if (hazePointer) { batch.setUniformBuffer(HazeEffect_ParamsSlot, hazePointer->getHazeParametersBuffer()); } else { @@ -181,7 +181,7 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu auto lightStage = args->_scene->getStage(); if (lightStage) { - model::LightPointer keyLight; + graphics::LightPointer keyLight; keyLight = lightStage->getCurrentKeyLight(); if (keyLight) { batch.setUniformBuffer(HazeEffect_LightingMapSlot, keyLight->getLightSchemaBuffer()); diff --git a/libraries/render-utils/src/DrawHaze.h b/libraries/render-utils/src/DrawHaze.h index 3ad42b23aa..e7d4e15d77 100644 --- a/libraries/render-utils/src/DrawHaze.h +++ b/libraries/render-utils/src/DrawHaze.h @@ -51,11 +51,11 @@ class MakeHazeConfig : public render::Job::Config { public: MakeHazeConfig() : render::Job::Config() {} - glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR }; - float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE }; + glm::vec3 hazeColor{ graphics::Haze::INITIAL_HAZE_COLOR }; + float hazeGlareAngle{ graphics::Haze::INITIAL_HAZE_GLARE_ANGLE }; - glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR }; - float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE }; + glm::vec3 hazeGlareColor{ graphics::Haze::INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ graphics::Haze::INITIAL_HAZE_BASE_REFERENCE }; bool isHazeActive{ false }; bool isAltitudeBased{ false }; @@ -63,13 +63,13 @@ public: bool isModulateColorActive{ false }; bool isHazeEnableGlare{ false }; - float hazeRange{ model::Haze::INITIAL_HAZE_RANGE }; - float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT }; + float hazeRange{ graphics::Haze::INITIAL_HAZE_RANGE }; + float hazeHeight{ graphics::Haze::INITIAL_HAZE_HEIGHT }; - float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE }; - float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; + float hazeKeyLightRange{ graphics::Haze::INITIAL_KEY_LIGHT_RANGE }; + float hazeKeyLightAltitude{ graphics::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; - float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; + float hazeBackgroundBlend{ graphics::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; public slots: void setHazeColor(const glm::vec3 value) { hazeColor = value; emit dirty(); } @@ -99,15 +99,15 @@ signals: class MakeHaze { public: using Config = MakeHazeConfig; - using JobModel = render::Job::ModelO; + using JobModel = render::Job::ModelO; MakeHaze(); void configure(const Config& config); - void run(const render::RenderContextPointer& renderContext, model::HazePointer& haze); + void run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze); private: - model::HazePointer _haze; + graphics::HazePointer _haze; }; class HazeConfig : public render::Job::Config { @@ -115,11 +115,11 @@ public: HazeConfig() : render::Job::Config(true) {} // attributes - glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR }; - float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE }; + glm::vec3 hazeColor{ graphics::Haze::INITIAL_HAZE_COLOR }; + float hazeGlareAngle{ graphics::Haze::INITIAL_HAZE_GLARE_ANGLE }; - glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR }; - float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE }; + glm::vec3 hazeGlareColor{ graphics::Haze::INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ graphics::Haze::INITIAL_HAZE_BASE_REFERENCE }; bool isHazeActive{ false }; // Setting this to true will set haze to on bool isAltitudeBased{ false }; @@ -127,13 +127,13 @@ public: bool isModulateColorActive{ false }; bool isHazeEnableGlare{ false }; - float hazeRange{ model::Haze::INITIAL_HAZE_RANGE }; - float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT }; + float hazeRange{ graphics::Haze::INITIAL_HAZE_RANGE }; + float hazeHeight{ graphics::Haze::INITIAL_HAZE_HEIGHT }; - float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE }; - float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; + float hazeKeyLightRange{ graphics::Haze::INITIAL_KEY_LIGHT_RANGE }; + float hazeKeyLightAltitude{ graphics::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; - float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; + float hazeBackgroundBlend{ graphics::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; // methods void setHazeColor(const glm::vec3 value); @@ -159,7 +159,7 @@ public: class DrawHaze { public: - using Inputs = render::VaryingSet5; + using Inputs = render::VaryingSet5; using Config = HazeConfig; using JobModel = render::Job::ModelI; diff --git a/libraries/render-utils/src/HazeStage.cpp b/libraries/render-utils/src/HazeStage.cpp index 016282d16f..e56b715b8c 100644 --- a/libraries/render-utils/src/HazeStage.cpp +++ b/libraries/render-utils/src/HazeStage.cpp @@ -17,12 +17,12 @@ std::string HazeStage::_stageName { "HAZE_STAGE"}; const HazeStage::Index HazeStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX }; FetchHazeStage::FetchHazeStage() { - _haze = std::make_shared(); + _haze = std::make_shared(); } void FetchHazeStage::configure(const Config& config) { _haze->setHazeColor(config.hazeColor); - _haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(config.hazeGlareAngle)); + _haze->setHazeGlareBlend(graphics::Haze::convertGlareAngleToPower(config.hazeGlareAngle)); _haze->setHazeGlareColor(config.hazeGlareColor); _haze->setHazeBaseReference(config.hazeBaseReference); @@ -33,11 +33,11 @@ void FetchHazeStage::configure(const Config& config) { _haze->setModulateColorActive(config.isModulateColorActive); _haze->setHazeEnableGlare(config.isHazeEnableGlare); - _haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange)); - _haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); + _haze->setHazeRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange)); + _haze->setHazeAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); - _haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); - _haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); + _haze->setHazeKeyLightRangeFactor(graphics::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); + _haze->setHazeKeyLightAltitudeFactor(graphics::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); _haze->setHazeBackgroundBlend(config.hazeBackgroundBlend); } @@ -86,7 +86,7 @@ void HazeStageSetup::run(const render::RenderContextPointer& renderContext) { } } -void FetchHazeStage::run(const render::RenderContextPointer& renderContext, model::HazePointer& haze) { +void FetchHazeStage::run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze) { auto hazeStage = renderContext->_scene->getStage(); assert(hazeStage); diff --git a/libraries/render-utils/src/HazeStage.h b/libraries/render-utils/src/HazeStage.h index 9e729f1ef9..8f137cb280 100644 --- a/libraries/render-utils/src/HazeStage.h +++ b/libraries/render-utils/src/HazeStage.h @@ -31,8 +31,8 @@ public: static const Index INVALID_INDEX; static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; } - using HazePointer = model::HazePointer; - using Hazes = render::indexed_container::IndexedPointerVector; + using HazePointer = graphics::HazePointer; + using Hazes = render::indexed_container::IndexedPointerVector; using HazeMap = std::unordered_map; using HazeIndices = std::vector; @@ -106,11 +106,11 @@ class FetchHazeConfig : public render::Job::Config { public: FetchHazeConfig() : render::Job::Config() {} - glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR }; - float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE }; + glm::vec3 hazeColor{ graphics::Haze::INITIAL_HAZE_COLOR }; + float hazeGlareAngle{ graphics::Haze::INITIAL_HAZE_GLARE_ANGLE }; - glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR }; - float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE }; + glm::vec3 hazeGlareColor{ graphics::Haze::INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ graphics::Haze::INITIAL_HAZE_BASE_REFERENCE }; bool isHazeActive{ false }; bool isAltitudeBased{ false }; @@ -118,13 +118,13 @@ public: bool isModulateColorActive{ false }; bool isHazeEnableGlare{ false }; - float hazeRange{ model::Haze::INITIAL_HAZE_RANGE }; - float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT }; + float hazeRange{ graphics::Haze::INITIAL_HAZE_RANGE }; + float hazeHeight{ graphics::Haze::INITIAL_HAZE_HEIGHT }; - float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE }; - float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; + float hazeKeyLightRange{ graphics::Haze::INITIAL_KEY_LIGHT_RANGE }; + float hazeKeyLightAltitude{ graphics::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; - float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; + float hazeBackgroundBlend{ graphics::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; public slots: void setHazeColor(const glm::vec3 value) { hazeColor = value; emit dirty(); } @@ -154,15 +154,15 @@ signals: class FetchHazeStage { public: using Config = FetchHazeConfig; - using JobModel = render::Job::ModelO; + using JobModel = render::Job::ModelO; FetchHazeStage(); void configure(const Config& config); - void run(const render::RenderContextPointer& renderContext, model::HazePointer& haze); + void run(const render::RenderContextPointer& renderContext, graphics::HazePointer& haze); private: - model::HazePointer _haze; + graphics::HazePointer _haze; gpu::PipelinePointer _hazePipeline; }; #endif diff --git a/libraries/render-utils/src/LightPayload.cpp b/libraries/render-utils/src/LightPayload.cpp index afa17bee19..09334faa13 100644 --- a/libraries/render-utils/src/LightPayload.cpp +++ b/libraries/render-utils/src/LightPayload.cpp @@ -40,7 +40,7 @@ namespace render { } LightPayload::LightPayload() : - _light(std::make_shared()) + _light(std::make_shared()) { } @@ -109,7 +109,7 @@ namespace render { } KeyLightPayload::KeyLightPayload() : -_light(std::make_shared()) +_light(std::make_shared()) { } diff --git a/libraries/render-utils/src/LightPayload.h b/libraries/render-utils/src/LightPayload.h index a3032ccd90..44b79ce10c 100644 --- a/libraries/render-utils/src/LightPayload.h +++ b/libraries/render-utils/src/LightPayload.h @@ -26,14 +26,14 @@ public: ~LightPayload(); void render(RenderArgs* args); - model::LightPointer editLight() { _needUpdate = true; return _light; } + graphics::LightPointer editLight() { _needUpdate = true; return _light; } render::Item::Bound& editBound() { _needUpdate = true; return _bound; } void setVisible(bool visible) { _isVisible = visible; } bool isVisible() const { return _isVisible; } protected: - model::LightPointer _light; + graphics::LightPointer _light; render::Item::Bound _bound; LightStagePointer _stage; LightStage::Index _index { LightStage::INVALID_INDEX }; @@ -56,7 +56,7 @@ public: ~KeyLightPayload(); void render(RenderArgs* args); - model::LightPointer editLight() { _needUpdate = true; return _light; } + graphics::LightPointer editLight() { _needUpdate = true; return _light; } render::Item::Bound& editBound() { _needUpdate = true; return _bound; } void setVisible(bool visible) { _isVisible = visible; } @@ -69,7 +69,7 @@ public: bool _pendingAmbientTexture { false }; protected: - model::LightPointer _light; + graphics::LightPointer _light; render::Item::Bound _bound; LightStagePointer _stage; LightStage::Index _index { LightStage::INVALID_INDEX }; diff --git a/libraries/render-utils/src/LightStage.cpp b/libraries/render-utils/src/LightStage.cpp index 42b161ba74..f146cd6e0a 100644 --- a/libraries/render-utils/src/LightStage.cpp +++ b/libraries/render-utils/src/LightStage.cpp @@ -29,32 +29,32 @@ const LightStage::Index LightStage::INVALID_INDEX { render::indexed_container::I LightStage::LightStage() { // Add off lights - const LightPointer ambientOffLight { std::make_shared() }; + const LightPointer ambientOffLight { std::make_shared() }; ambientOffLight->setAmbientIntensity(0.0f); - ambientOffLight->setColor(model::Vec3(0.0)); + ambientOffLight->setColor(graphics::Vec3(0.0)); ambientOffLight->setIntensity(0.0f); - ambientOffLight->setType(model::Light::Type::AMBIENT); + ambientOffLight->setType(graphics::Light::Type::AMBIENT); _ambientOffLightId = addLight(ambientOffLight); - const LightPointer pointOffLight { std::make_shared() }; + const LightPointer pointOffLight { std::make_shared() }; pointOffLight->setAmbientIntensity(0.0f); - pointOffLight->setColor(model::Vec3(0.0)); + pointOffLight->setColor(graphics::Vec3(0.0)); pointOffLight->setIntensity(0.0f); - pointOffLight->setType(model::Light::Type::POINT); + pointOffLight->setType(graphics::Light::Type::POINT); _pointOffLightId = addLight(pointOffLight); - const LightPointer spotOffLight { std::make_shared() }; + const LightPointer spotOffLight { std::make_shared() }; spotOffLight->setAmbientIntensity(0.0f); - spotOffLight->setColor(model::Vec3(0.0)); + spotOffLight->setColor(graphics::Vec3(0.0)); spotOffLight->setIntensity(0.0f); - spotOffLight->setType(model::Light::Type::SPOT); + spotOffLight->setType(graphics::Light::Type::SPOT); _spotOffLightId = addLight(spotOffLight); - const LightPointer sunOffLight { std::make_shared() }; + const LightPointer sunOffLight { std::make_shared() }; sunOffLight->setAmbientIntensity(0.0f); - sunOffLight->setColor(model::Vec3(0.0)); + sunOffLight->setColor(graphics::Vec3(0.0)); sunOffLight->setIntensity(0.0f); - sunOffLight->setType(model::Light::Type::SUN); + sunOffLight->setType(graphics::Light::Type::SUN); _sunOffLightId = addLight(sunOffLight); // Set default light to the off ambient light (until changed) @@ -123,7 +123,7 @@ float LightStage::Shadow::Cascade::computeFarDistance(const ViewFrustum& viewFru return far; } -LightStage::Shadow::Shadow(model::LightPointer light, float maxDistance, unsigned int cascadeCount) : +LightStage::Shadow::Shadow(graphics::LightPointer light, float maxDistance, unsigned int cascadeCount) : _light{ light } { cascadeCount = std::min(cascadeCount, (unsigned int)SHADOW_CASCADE_MAX_COUNT); Schema schema; @@ -404,14 +404,14 @@ LightStage::Index LightStage::getShadowId(Index lightId) const { } void LightStage::updateLightArrayBuffer(Index lightId) { - auto lightSize = sizeof(model::Light::LightSchema); + auto lightSize = sizeof(graphics::Light::LightSchema); if (!_lightArrayBuffer) { _lightArrayBuffer = std::make_shared(lightSize); } assert(checkLightId(lightId)); - if (lightId > (Index)_lightArrayBuffer->getNumTypedElements()) { + if (lightId > (Index)_lightArrayBuffer->getNumTypedElements()) { _lightArrayBuffer->resize(lightSize * (lightId + 10)); } @@ -419,7 +419,7 @@ void LightStage::updateLightArrayBuffer(Index lightId) { auto light = _lights._elements[lightId]; if (light) { const auto& lightSchema = light->getLightSchemaBuffer().get(); - _lightArrayBuffer->setSubData(lightId, lightSchema); + _lightArrayBuffer->setSubData(lightId, lightSchema); } else { // this should not happen ? } diff --git a/libraries/render-utils/src/LightStage.h b/libraries/render-utils/src/LightStage.h index 8db5c19950..d1a8680706 100644 --- a/libraries/render-utils/src/LightStage.h +++ b/libraries/render-utils/src/LightStage.h @@ -35,8 +35,8 @@ public: static const Index INVALID_INDEX; static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; } - using LightPointer = model::LightPointer; - using Lights = render::indexed_container::IndexedPointerVector; + using LightPointer = graphics::LightPointer; + using Lights = render::indexed_container::IndexedPointerVector; using LightMap = std::unordered_map; using LightIndices = std::vector; @@ -75,7 +75,7 @@ public: float left, float right, float bottom, float top, float viewMaxShadowDistance) const; }; - Shadow(model::LightPointer light, float maxDistance, unsigned int cascadeCount = 1); + Shadow(graphics::LightPointer light, float maxDistance, unsigned int cascadeCount = 1); void setKeylightFrustum(const ViewFrustum& viewFrustum, float nearDepth = 1.0f, float farDepth = 1000.0f); @@ -91,7 +91,7 @@ public: float getMaxDistance() const { return _maxDistance; } void setMaxDistance(float value); - const model::LightPointer& getLight() const { return _light; } + const graphics::LightPointer& getLight() const { return _light; } protected: @@ -101,7 +101,7 @@ public: static const glm::mat4 _biasMatrix; - model::LightPointer _light; + graphics::LightPointer _light; float _maxDistance; Cascades _cascades; @@ -165,12 +165,12 @@ public: Frame() {} void clear() { _pointLights.clear(); _spotLights.clear(); _sunLights.clear(); _ambientLights.clear(); } - void pushLight(LightStage::Index index, model::Light::Type type) { + void pushLight(LightStage::Index index, graphics::Light::Type type) { switch (type) { - case model::Light::POINT: { pushPointLight(index); break; } - case model::Light::SPOT: { pushSpotLight(index); break; } - case model::Light::SUN: { pushSunLight(index); break; } - case model::Light::AMBIENT: { pushAmbientLight(index); break; } + case graphics::Light::POINT: { pushPointLight(index); break; } + case graphics::Light::SPOT: { pushSpotLight(index); break; } + case graphics::Light::SUN: { pushSunLight(index); break; } + case graphics::Light::AMBIENT: { pushAmbientLight(index); break; } default: { break; } } } diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index d6ab2ff416..c506887fc4 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -45,17 +45,17 @@ template <> void payloadRender(const MeshPartPayload::Pointer& payload, RenderAr } } -MeshPartPayload::MeshPartPayload(const std::shared_ptr& mesh, int partIndex, model::MaterialPointer material) { +MeshPartPayload::MeshPartPayload(const std::shared_ptr& mesh, int partIndex, graphics::MaterialPointer material) { updateMeshPart(mesh, partIndex); updateMaterial(material); } -void MeshPartPayload::updateMeshPart(const std::shared_ptr& drawMesh, int partIndex) { +void MeshPartPayload::updateMeshPart(const std::shared_ptr& drawMesh, int partIndex) { _drawMesh = drawMesh; if (_drawMesh) { auto vertexFormat = _drawMesh->getVertexFormat(); _hasColorAttrib = vertexFormat->hasAttribute(gpu::Stream::COLOR); - _drawPart = _drawMesh->getPartBuffer().get(partIndex); + _drawPart = _drawMesh->getPartBuffer().get(partIndex); _localBound = _drawMesh->evalPartBound(partIndex); } } @@ -67,7 +67,7 @@ void MeshPartPayload::updateTransform(const Transform& transform, const Transfor _worldBound.transform(_drawTransform); } -void MeshPartPayload::updateMaterial(model::MaterialPointer drawMaterial) { +void MeshPartPayload::updateMaterial(graphics::MaterialPointer drawMaterial) { _drawMaterial = drawMaterial; } @@ -90,7 +90,7 @@ Item::Bound MeshPartPayload::getBound() const { } ShapeKey MeshPartPayload::getShapeKey() const { - model::MaterialKey drawMaterialKey; + graphics::MaterialKey drawMaterialKey; if (_drawMaterial) { drawMaterialKey = _drawMaterial->getKey(); } @@ -156,7 +156,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Albedo if (materialKey.isAlbedoMap()) { - auto itr = textureMaps.find(model::MaterialKey::ALBEDO_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::ALBEDO_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, itr->second->getTextureView()); } else { @@ -166,7 +166,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Roughness map if (materialKey.isRoughnessMap()) { - auto itr = textureMaps.find(model::MaterialKey::ROUGHNESS_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::ROUGHNESS_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, itr->second->getTextureView()); @@ -178,7 +178,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Normal map if (materialKey.isNormalMap()) { - auto itr = textureMaps.find(model::MaterialKey::NORMAL_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::NORMAL_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, itr->second->getTextureView()); @@ -190,7 +190,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Metallic map if (materialKey.isMetallicMap()) { - auto itr = textureMaps.find(model::MaterialKey::METALLIC_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::METALLIC_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, itr->second->getTextureView()); @@ -202,7 +202,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Occlusion map if (materialKey.isOcclusionMap()) { - auto itr = textureMaps.find(model::MaterialKey::OCCLUSION_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::OCCLUSION_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, itr->second->getTextureView()); @@ -214,7 +214,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Scattering map if (materialKey.isScatteringMap()) { - auto itr = textureMaps.find(model::MaterialKey::SCATTERING_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::SCATTERING_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, itr->second->getTextureView()); @@ -226,7 +226,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat // Emissive / Lightmap if (materialKey.isLightmapMap()) { - auto itr = textureMaps.find(model::MaterialKey::LIGHTMAP_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::LIGHTMAP_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView()); @@ -234,7 +234,7 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getGrayTexture()); } } else if (materialKey.isEmissiveMap()) { - auto itr = textureMaps.find(model::MaterialKey::EMISSIVE_MAP); + auto itr = textureMaps.find(graphics::MaterialKey::EMISSIVE_MAP); if (itr != textureMaps.end() && itr->second->isDefined()) { batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, itr->second->getTextureView()); @@ -439,7 +439,7 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe return; } - model::MaterialKey drawMaterialKey; + graphics::MaterialKey drawMaterialKey; if (_drawMaterial) { drawMaterialKey = _drawMaterial->getKey(); } diff --git a/libraries/render-utils/src/MeshPartPayload.h b/libraries/render-utils/src/MeshPartPayload.h index 6e165508f2..8160b9f009 100644 --- a/libraries/render-utils/src/MeshPartPayload.h +++ b/libraries/render-utils/src/MeshPartPayload.h @@ -28,17 +28,17 @@ class Model; class MeshPartPayload { public: MeshPartPayload() {} - MeshPartPayload(const std::shared_ptr& mesh, int partIndex, model::MaterialPointer material); + MeshPartPayload(const std::shared_ptr& mesh, int partIndex, graphics::MaterialPointer material); typedef render::Payload Payload; typedef Payload::DataPointer Pointer; - virtual void updateMeshPart(const std::shared_ptr& drawMesh, int partIndex); + virtual void updateMeshPart(const std::shared_ptr& drawMesh, int partIndex); virtual void notifyLocationChanged() {} void updateTransform(const Transform& transform, const Transform& offsetTransform); - virtual void updateMaterial(model::MaterialPointer drawMaterial); + virtual void updateMaterial(graphics::MaterialPointer drawMaterial); // Render Item interface virtual render::ItemKey getKey() const; @@ -58,13 +58,13 @@ public: int _partIndex = 0; bool _hasColorAttrib { false }; - model::Box _localBound; - model::Box _adjustedLocalBound; - mutable model::Box _worldBound; - std::shared_ptr _drawMesh; + graphics::Box _localBound; + graphics::Box _adjustedLocalBound; + mutable graphics::Box _worldBound; + std::shared_ptr _drawMesh; - std::shared_ptr _drawMaterial; - model::Mesh::Part _drawPart; + std::shared_ptr _drawMaterial; + graphics::Mesh::Part _drawPart; size_t getVerticesCount() const { return _drawMesh ? _drawMesh->getNumVertices() : 0; } size_t getMaterialTextureSize() { return _drawMaterial ? _drawMaterial->getTextureSize() : 0; } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 9c1c579341..d7c038ea7d 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -46,7 +46,7 @@ float Model::FAKE_DIMENSION_PLACEHOLDER = -1.0f; #define HTTP_INVALID_COM "http://invalid.com" const int NUM_COLLISION_HULL_COLORS = 24; -std::vector _collisionMaterials; +std::vector _collisionMaterials; void initCollisionMaterials() { // generates bright colors in red, green, blue, yellow, magenta, and cyan spectrums @@ -72,8 +72,8 @@ void initCollisionMaterials() { // so they don't tend to group together for large models for (int i = 0; i < sectionWidth; ++i) { for (int j = 0; j < numComponents; ++j) { - model::MaterialPointer material; - material = std::make_shared(); + graphics::MaterialPointer material; + material = std::make_shared(); int index = j * sectionWidth + i; float red = component[index]; float green = component[(index + greenPhase) % NUM_COLLISION_HULL_COLORS]; @@ -559,7 +559,7 @@ MeshProxyList Model::getMeshes() const { offset.postTranslate(_offset); glm::mat4 offsetMat = offset.getMatrix(); - for (std::shared_ptr mesh : meshes) { + for (std::shared_ptr mesh : meshes) { if (!mesh) { continue; } @@ -1481,7 +1481,7 @@ void Model::createCollisionRenderItemSet() { // Create the render payloads int numParts = (int)mesh->getNumParts(); for (int partIndex = 0; partIndex < numParts; partIndex++) { - model::MaterialPointer& material = _collisionMaterials[partIndex % NUM_COLLISION_HULL_COLORS]; + graphics::MaterialPointer& material = _collisionMaterials[partIndex % NUM_COLLISION_HULL_COLORS]; auto payload = std::make_shared(mesh, partIndex, material); payload->updateTransform(identity, offset); _collisionRenderItems << payload; @@ -1495,7 +1495,7 @@ bool Model::isRenderable() const { class CollisionRenderGeometry : public Geometry { public: - CollisionRenderGeometry(model::MeshPointer mesh) { + CollisionRenderGeometry(graphics::MeshPointer mesh) { _fbxGeometry = std::make_shared(); std::shared_ptr meshes = std::make_shared(); meshes->push_back(mesh); @@ -1504,7 +1504,7 @@ public: } }; -void Model::setCollisionMesh(model::MeshPointer mesh) { +void Model::setCollisionMesh(graphics::MeshPointer mesh) { if (mesh) { _collisionGeometry = std::make_shared(mesh); } else { diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 623f869666..6c1f9cb75c 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -240,7 +240,7 @@ public: // returns 'true' if needs fullUpdate after geometry change virtual bool updateGeometry(); - void setCollisionMesh(model::MeshPointer mesh); + void setCollisionMesh(graphics::MeshPointer mesh); void setLoadingPriority(float priority) { _loadingPriority = priority; } diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index f860c0494e..8b97f902ac 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -338,7 +338,7 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& // Setup haze iff curretn zone has haze auto hazeStage = args->_scene->getStage(); if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) { - model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front()); + graphics::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front()); batch.setUniformBuffer(render::ShapePipeline::Slot::HAZE_MODEL, hazePointer->getHazeParametersBuffer()); } diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 7f644add72..2eb063e9e8 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -546,7 +546,7 @@ void batchSetter(const ShapePipeline& pipeline, gpu::Batch& batch, RenderArgs* a if (pipeline.locations->materialBufferUnit >= 0) { // Create a default schema static bool isMaterialSet = false; - static model::Material material; + static graphics::Material material; if (!isMaterialSet) { material.setAlbedo(vec3(1.0f)); material.setOpacity(1.0f); diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index 2e5b7132e4..d83dfd73a5 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -271,7 +271,7 @@ void RenderShadowCascadeSetup::run(const render::RenderContextPointer& renderCon // Set the keylight render args args->pushViewFrustum(*(globalShadow->getCascade(_cascadeIndex).getFrustum())); args->_renderMode = RenderArgs::SHADOW_RENDER_MODE; - if (lightStage->getCurrentKeyLight()->getType() == model::Light::SUN) { + if (lightStage->getCurrentKeyLight()->getType() == graphics::Light::SUN) { const float shadowSizeScale = 1e16f; // Set the size scale to a ridiculously high value to prevent small object culling which assumes // the view frustum is a perspective projection. But this isn't the case for the sun which diff --git a/libraries/render-utils/src/StencilMaskPass.cpp b/libraries/render-utils/src/StencilMaskPass.cpp index ab1ac7c1aa..de8de9abcf 100644 --- a/libraries/render-utils/src/StencilMaskPass.cpp +++ b/libraries/render-utils/src/StencilMaskPass.cpp @@ -26,7 +26,7 @@ void PrepareStencil::configure(const Config& config) { _forceDraw = config.forceDraw; } -model::MeshPointer PrepareStencil::getMesh() { +graphics::MeshPointer PrepareStencil::getMesh() { if (!_mesh) { std::vector vertices { @@ -36,7 +36,7 @@ model::MeshPointer PrepareStencil::getMesh() { { 1.0f, -1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f } }; std::vector indices { 0, 7, 1, 1, 3, 2, 3, 5, 4, 5, 7, 6 }; - _mesh = model::Mesh::createIndexedTriangles_P3F((uint32_t) vertices.size(), (uint32_t) indices.size(), vertices.data(), indices.data()); + _mesh = graphics::Mesh::createIndexedTriangles_P3F((uint32_t) vertices.size(), (uint32_t) indices.size(), vertices.data(), indices.data()); } return _mesh; } @@ -95,7 +95,7 @@ void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::F batch.setInputStream(0, mesh->getVertexStream()); // Draw - auto part = mesh->getPartBuffer().get(0); + auto part = mesh->getPartBuffer().get(0); batch.drawIndexed(gpu::TRIANGLES, part._numIndices, part._startIndex); } else { batch.setPipeline(getPaintStencilPipeline()); diff --git a/libraries/render-utils/src/StencilMaskPass.h b/libraries/render-utils/src/StencilMaskPass.h index ef1371d04e..a8e4d1e1f2 100644 --- a/libraries/render-utils/src/StencilMaskPass.h +++ b/libraries/render-utils/src/StencilMaskPass.h @@ -63,8 +63,8 @@ private: gpu::PipelinePointer _paintStencilPipeline; gpu::PipelinePointer getPaintStencilPipeline(); - model::MeshPointer _mesh; - model::MeshPointer getMesh(); + graphics::MeshPointer _mesh; + graphics::MeshPointer getMesh(); int _maskMode { 0 }; bool _forceDraw { false }; diff --git a/libraries/render-utils/src/ZoneRenderer.cpp b/libraries/render-utils/src/ZoneRenderer.cpp index c0d01c2eaf..c39e6068b7 100644 --- a/libraries/render-utils/src/ZoneRenderer.cpp +++ b/libraries/render-utils/src/ZoneRenderer.cpp @@ -145,14 +145,14 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I auto deferredTransform = inputs; auto lightStage = context->_scene->getStage(LightStage::getName()); - std::vector keyLightStack; + std::vector keyLightStack; if (lightStage && lightStage->_currentFrame._sunLights.size()) { for (auto index : lightStage->_currentFrame._sunLights) { keyLightStack.push_back(lightStage->getLight(index)); } } - std::vector ambientLightStack; + std::vector ambientLightStack; if (lightStage && lightStage->_currentFrame._ambientLights.size()) { for (auto index : lightStage->_currentFrame._ambientLights) { ambientLightStack.push_back(lightStage->getLight(index)); @@ -160,7 +160,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I } auto backgroundStage = context->_scene->getStage(BackgroundStage::getName()); - std::vector skyboxStack; + std::vector skyboxStack; if (backgroundStage && backgroundStage->_currentFrame._backgrounds.size()) { for (auto index : backgroundStage->_currentFrame._backgrounds) { auto background = backgroundStage->getBackground(index); diff --git a/libraries/script-engine/src/ModelScriptingInterface.cpp b/libraries/script-engine/src/ModelScriptingInterface.cpp index e58afeaba8..c693083ebf 100644 --- a/libraries/script-engine/src/ModelScriptingInterface.cpp +++ b/libraries/script-engine/src/ModelScriptingInterface.cpp @@ -102,7 +102,7 @@ QScriptValue ModelScriptingInterface::appendMeshes(MeshProxyList in) { indexStartOffset += numVertices; } - model::MeshPointer result(new model::Mesh()); + graphics::MeshPointer result(new graphics::Mesh()); gpu::Element vertexElement = gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ); gpu::Buffer* combinedVertexBuffer = new gpu::Buffer(combinedVertexSize, combinedVertexData.get()); @@ -130,12 +130,12 @@ QScriptValue ModelScriptingInterface::appendMeshes(MeshProxyList in) { gpu::BufferView combinedIndexesBufferView(combinedIndexesBufferPointer, indexElement); result->setIndexBuffer(combinedIndexesBufferView); - std::vector parts; - parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex - (model::Index)result->getNumIndices(), // numIndices - (model::Index)0, // baseVertex - model::Mesh::TRIANGLES)); // topology - result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), + std::vector parts; + parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex + (graphics::Index)result->getNumIndices(), // numIndices + (graphics::Index)0, // baseVertex + graphics::Mesh::TRIANGLES)); // topology + result->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); @@ -153,7 +153,7 @@ QScriptValue ModelScriptingInterface::transformMesh(glm::mat4 transform, MeshPro } const auto inverseTransposeTransform = glm::inverse(glm::transpose(transform)); - model::MeshPointer result = mesh->map([&](glm::vec3 position){ return glm::vec3(transform * glm::vec4(position, 1.0f)); }, + graphics::MeshPointer result = mesh->map([&](glm::vec3 position){ return glm::vec3(transform * glm::vec4(position, 1.0f)); }, [&](glm::vec3 color){ return color; }, [&](glm::vec3 normal){ return glm::vec3(inverseTransposeTransform * glm::vec4(normal, 0.0f)); }, [&](uint32_t index){ return index; }); @@ -199,7 +199,7 @@ QScriptValue ModelScriptingInterface::getVertex(MeshProxy* meshProxy, int vertex QScriptValue ModelScriptingInterface::newMesh(const QVector& vertices, const QVector& normals, const QVector& faces) { - model::MeshPointer mesh(new model::Mesh()); + graphics::MeshPointer mesh(new graphics::Mesh()); // vertices auto vertexBuffer = std::make_shared(vertices.size() * sizeof(glm::vec3), (gpu::Byte*)vertices.data()); @@ -236,12 +236,12 @@ QScriptValue ModelScriptingInterface::newMesh(const QVector& vertices mesh->setIndexBuffer(indexBufferView); // parts - std::vector parts; - parts.emplace_back(model::Mesh::Part((model::Index)0, // startIndex - (model::Index)faces.size() * 3, // numIndices - (model::Index)0, // baseVertex - model::Mesh::TRIANGLES)); // topology - mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), + std::vector parts; + parts.emplace_back(graphics::Mesh::Part((graphics::Index)0, // startIndex + (graphics::Index)faces.size() * 3, // numIndices + (graphics::Index)0, // baseVertex + graphics::Mesh::TRIANGLES)); // topology + mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); diff --git a/libraries/script-engine/src/SceneScriptingInterface.cpp b/libraries/script-engine/src/SceneScriptingInterface.cpp index 3883b948df..7b36b815fb 100644 --- a/libraries/script-engine/src/SceneScriptingInterface.cpp +++ b/libraries/script-engine/src/SceneScriptingInterface.cpp @@ -112,17 +112,17 @@ bool SceneScripting::Stage::isSunModelEnabled() const { void SceneScripting::Stage::setBackgroundMode(const QString& mode) { if (mode == QString("inherit")) { - _skyStage->setBackgroundMode(model::SunSkyStage::NO_BACKGROUND); + _skyStage->setBackgroundMode(graphics::SunSkyStage::NO_BACKGROUND); } else if (mode == QString("skybox")) { - _skyStage->setBackgroundMode(model::SunSkyStage::SKY_BOX); + _skyStage->setBackgroundMode(graphics::SunSkyStage::SKY_BOX); } } QString SceneScripting::Stage::getBackgroundMode() const { switch (_skyStage->getBackgroundMode()) { - case model::SunSkyStage::NO_BACKGROUND: + case graphics::SunSkyStage::NO_BACKGROUND: return QString("inherit"); - case model::SunSkyStage::SKY_BOX: + case graphics::SunSkyStage::SKY_BOX: return QString("skybox"); default: return QString("inherit"); @@ -131,7 +131,7 @@ QString SceneScripting::Stage::getBackgroundMode() const { SceneScriptingInterface::SceneScriptingInterface() : _stage{ new SceneScripting::Stage{ _skyStage } } { // Let's make sure the sunSkyStage is using a proceduralSkybox - _skyStage->setSkybox(model::SkyboxPointer(new ProceduralSkybox())); + _skyStage->setSkybox(graphics::SkyboxPointer(new ProceduralSkybox())); } void SceneScriptingInterface::setShouldRenderAvatars(bool shouldRenderAvatars) { @@ -148,6 +148,6 @@ void SceneScriptingInterface::setShouldRenderEntities(bool shouldRenderEntities) } } -model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const { +graphics::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const { return _skyStage; } diff --git a/libraries/script-engine/src/SceneScriptingInterface.h b/libraries/script-engine/src/SceneScriptingInterface.h index 160c37284c..07b8c22ca6 100644 --- a/libraries/script-engine/src/SceneScriptingInterface.h +++ b/libraries/script-engine/src/SceneScriptingInterface.h @@ -23,7 +23,7 @@ namespace SceneScripting { Q_OBJECT public: - Location(model::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {} + Location(graphics::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {} Q_PROPERTY(float longitude READ getLongitude WRITE setLongitude) Q_PROPERTY(float latitude READ getLatitude WRITE setLatitude) @@ -37,7 +37,7 @@ namespace SceneScripting { void setAltitude(float altitude); protected: - model::SunSkyStagePointer _skyStage; + graphics::SunSkyStagePointer _skyStage; }; using LocationPointer = std::unique_ptr; @@ -45,7 +45,7 @@ namespace SceneScripting { Q_OBJECT public: - Time(model::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {} + Time(graphics::SunSkyStagePointer skyStage) : _skyStage{ skyStage } {} Q_PROPERTY(float hour READ getHour WRITE setHour) Q_PROPERTY(int day READ getDay WRITE setDay) @@ -56,7 +56,7 @@ namespace SceneScripting { void setDay(int day); protected: - model::SunSkyStagePointer _skyStage; + graphics::SunSkyStagePointer _skyStage; }; using TimePointer = std::unique_ptr