diff --git a/interface/src/raypick/StylusPick.cpp b/interface/src/raypick/StylusPick.cpp index a9dbf9b950..0e95959566 100644 --- a/interface/src/raypick/StylusPick.cpp +++ b/interface/src/raypick/StylusPick.cpp @@ -18,6 +18,8 @@ #include #include +#include + using namespace bilateral; float StylusPick::WEB_STYLUS_LENGTH = 0.2f; @@ -146,13 +148,7 @@ PickResultPointer StylusPick::getEntityIntersection(const StylusTip& pick) { continue; } - bool visible = entity->getVisible(); - bool collisionless = entity->getCollisionless(); - if ((!visible && !getFilter().doesPickInvisible()) || (visible && !getFilter().doesPickVisible()) || - (!collisionless && !getFilter().doesPickCollidable()) || (collisionless && !getFilter().doesPickNonCollidable()) || - (entity->isLocalEntity() && !getFilter().doesPickLocalEntities()) || - (entity->isAvatarEntity() && !getFilter().doesPickAvatarEntities()) || - (entity->isDomainEntity() && !getFilter().doesPickDomainEntities())) { + if (!EntityTreeElement::checkFilterSettings(entity, getFilter())) { continue; } diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 280c14167b..0a19ac7488 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -628,8 +628,8 @@ void Keyboard::handleTriggerContinue(const QUuid& id, const PointerEvent& event) auto stylusPickResult = std::dynamic_pointer_cast(pickResult); float distance = stylusPickResult->distance; - static const float PENATRATION_THRESHOLD = 0.025f; - if (distance < PENATRATION_THRESHOLD) { + static const float PENETRATION_THRESHOLD = 0.025f; + if (distance < PENETRATION_THRESHOLD) { static const float Z_OFFSET = 0.002f; auto entityScriptingInterface = DependencyManager::get(); diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 13476e4841..a6d3d4fedb 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -514,7 +514,9 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove auto iter = overlayProps.find("lineWidth"); if (iter != overlayProps.end()) { QVariantList widths; - widths.append(iter.value()); + QVariant width = iter.value(); + widths.append(width); + widths.append(width); overlayProps["strokeWidths"] = widths; } } diff --git a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp index 7ad050e86c..bacb9adac6 100644 --- a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp @@ -25,6 +25,7 @@ using namespace render; using namespace render::entities; gpu::PipelinePointer PolyLineEntityRenderer::_pipeline = nullptr; +gpu::PipelinePointer PolyLineEntityRenderer::_glowPipeline = nullptr; static const QUrl DEFAULT_POLYLINE_TEXTURE = PathUtils::resourcesUrl("images/paintStroke.png"); @@ -44,14 +45,26 @@ PolyLineEntityRenderer::PolyLineEntityRenderer(const EntityItemPointer& entity) void PolyLineEntityRenderer::buildPipeline() { // FIXME: opaque pipeline gpu::ShaderPointer program = gpu::Shader::createProgram(shader::entities_renderer::program::paintStroke); - gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - state->setCullMode(gpu::State::CullMode::CULL_NONE); - state->setDepthTest(true, true, gpu::LESS_EQUAL); - PrepareStencil::testMask(*state); - state->setBlendFunction(true, - gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, - gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); - _pipeline = gpu::Pipeline::create(program, state); + { + gpu::StatePointer state = gpu::StatePointer(new gpu::State()); + state->setCullMode(gpu::State::CullMode::CULL_NONE); + state->setDepthTest(true, true, gpu::LESS_EQUAL); + PrepareStencil::testMask(*state); + state->setBlendFunction(true, + gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, + gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); + _pipeline = gpu::Pipeline::create(program, state); + } + { + gpu::StatePointer state = gpu::StatePointer(new gpu::State()); + state->setCullMode(gpu::State::CullMode::CULL_NONE); + state->setDepthTest(true, false, gpu::LESS_EQUAL); + PrepareStencil::testMask(*state); + state->setBlendFunction(true, + gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, + gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); + _glowPipeline = gpu::Pipeline::create(program, state); + } } ItemKey PolyLineEntityRenderer::getKey() { @@ -257,11 +270,11 @@ void PolyLineEntityRenderer::doRender(RenderArgs* args) { Q_ASSERT(args->_batch); gpu::Batch& batch = *args->_batch; - if (!_pipeline) { + if (!_pipeline || !_glowPipeline) { buildPipeline(); } - batch.setPipeline(_pipeline); + batch.setPipeline(_glow ? _glowPipeline : _pipeline); batch.setModelTransform(_renderTransform); batch.setResourceTexture(0, _textureLoaded ? _texture->getGPUTexture() : DependencyManager::get()->getWhiteTexture()); batch.setResourceBuffer(0, _polylineGeometryBuffer); diff --git a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.h b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.h index fd37a49598..b8a3ad3b3e 100644 --- a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.h +++ b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.h @@ -59,6 +59,7 @@ protected: gpu::BufferPointer _polylineDataBuffer; gpu::BufferPointer _polylineGeometryBuffer; static gpu::PipelinePointer _pipeline; + static gpu::PipelinePointer _glowPipeline; }; } } // namespace diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index abc4507fe0..a0fafbd8f9 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -139,7 +139,7 @@ bool EntityTreeElement::bestFitBounds(const glm::vec3& minPoint, const glm::vec3 return false; } -bool checkFilterSettings(const EntityItemPointer& entity, PickFilter searchFilter) { +bool EntityTreeElement::checkFilterSettings(const EntityItemPointer& entity, PickFilter searchFilter) { bool visible = entity->isVisible(); entity::HostType hostType = entity->getEntityHostType(); if ((!searchFilter.doesPickVisible() && visible) || (!searchFilter.doesPickInvisible() && !visible) || diff --git a/libraries/entities/src/EntityTreeElement.h b/libraries/entities/src/EntityTreeElement.h index 3f1fda57bd..f82eaa7fb1 100644 --- a/libraries/entities/src/EntityTreeElement.h +++ b/libraries/entities/src/EntityTreeElement.h @@ -134,6 +134,7 @@ public: virtual bool isRendered() const override { return getShouldRender(); } virtual bool deleteApproved() const override { return !hasEntities(); } + static bool checkFilterSettings(const EntityItemPointer& entity, PickFilter searchFilter); virtual bool canPickIntersect() const override { return hasEntities(); } virtual EntityItemID evalRayIntersection(const glm::vec3& origin, const glm::vec3& direction, OctreeElementPointer& element, float& distance, BoxFace& face, glm::vec3& surfaceNormal,