diff --git a/examples/utilities/tools/renderEngineDebug.js b/examples/utilities/tools/renderEngineDebug.js index d337290927..d50a9c545c 100755 --- a/examples/utilities/tools/renderEngineDebug.js +++ b/examples/utilities/tools/renderEngineDebug.js @@ -10,7 +10,7 @@ Script.include("cookies.js"); -var panel = new Panel(10, 800); +var panel = new Panel(10, 100); panel.newSlider("Num Feed Opaques", 0, 1000, function(value) { }, diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 3b801fd9f6..5870b22a04 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -170,12 +170,13 @@ namespace render { void makeEntityItemStatusGetters(RenderableModelEntityItem* entity, render::Item::Status::Getters& statusGetters) { statusGetters.push_back([entity] () -> render::Item::Status::Value { quint64 delta = usecTimestampNow() - entity->getLastEditedFromRemote(); - return render::Item::Status::Value((delta / (0.01f * USECS_PER_SECOND)), 1.0f); + float ndelta = (delta / (0.2f * USECS_PER_SECOND)); + return render::Item::Status::Value(1.0f - ndelta, (ndelta > 1.0f ? 0.01f : 0.5f)); }); statusGetters.push_back([entity] () -> render::Item::Status::Value { quint64 delta = usecTimestampNow() - entity->getLastBroadcast(); - // return render::Item::Status::Value((delta / (0.02f * USECS_PER_SECOND)), 0.5f); - return render::Item::Status::Value(1.0f, 0.5f); + float ndelta = (delta / (0.4f * USECS_PER_SECOND)); + return render::Item::Status::Value(1.0f - ndelta, (ndelta > 1.0f ? 0.01f : 0.5f)); }); } diff --git a/libraries/render/src/render/Scene.cpp b/libraries/render/src/render/Scene.cpp index ca56f00960..1ed66e4912 100644 --- a/libraries/render/src/render/Scene.cpp +++ b/libraries/render/src/render/Scene.cpp @@ -53,7 +53,7 @@ void ItemBucketMap::allocateStandardOpaqueTranparentBuckets() { (*this)[ItemFilter::Builder::transparentShape().withLayered()]; } -const Item::Status::Value Item::Status::Value::INVALID{ std::numeric_limits::min(), std::numeric_limits::min() }; +const Item::Status::Value Item::Status::Value::INVALID = Item::Status::Value(); void Item::Status::getCompressedValues(glm::ivec4& values) { for (int i = 0; i < values.length(); i++) { diff --git a/libraries/render/src/render/Scene.h b/libraries/render/src/render/Scene.h index 5b66f8fcf9..b846c60cfe 100644 --- a/libraries/render/src/render/Scene.h +++ b/libraries/render/src/render/Scene.h @@ -202,15 +202,15 @@ public: class Status { public: class Value { - short _x = 0; - short _y = 0; - Value(short x, short y) : _x(x), _y(y) {} + unsigned short _x = 0xFFFF; + unsigned short _y = 0xFFFF; + Value() {} public: const static Value INVALID; // Invlaid value meanss the status won't show Value(float x, float y = 1.0f) { setX(x); setY(y); } - void setX(float x) { _x = std::numeric_limits::max() * std::max(std::min(x, 1.0f), -1.0f); } - void setY(float y) { _y = std::numeric_limits::max() * std::max(std::min(y, 1.0f), -1.0f); } + void setX(float x) { _x = (std::numeric_limits::max() -1) * 0.5f * (1.0f + std::max(std::min(x, 1.0f), -1.0f)); } + void setY(float y) { _y = (std::numeric_limits::max() - 1) * 0.5f * (1.0f + std::max(std::min(y, 1.0f), -1.0f)); } int getRaw() const { return *((const int*) this); } }; diff --git a/libraries/render/src/render/drawItemStatus.slv b/libraries/render/src/render/drawItemStatus.slv index eb56095d13..f99bf006a4 100644 --- a/libraries/render/src/render/drawItemStatus.slv +++ b/libraries/render/src/render/drawItemStatus.slv @@ -1,27 +1,27 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// drawItemStatus.slv -// vertex shader -// -// Created by Sam Gateau on 6/30/2015. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include gpu/Transform.slh@> - -<$declareStandardTransform()$> - -varying vec4 varColor; - -uniform vec3 inBoundPos; -uniform vec3 inBoundDim; -uniform ivec4 inStatus; - +<@include gpu/Config.slh@> +<$VERSION_HEADER$> +// Generated on <$_SCRIBE_DATE$> +// +// drawItemStatus.slv +// vertex shader +// +// Created by Sam Gateau on 6/30/2015. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +<@include gpu/Transform.slh@> + +<$declareStandardTransform()$> + +varying vec4 varColor; + +uniform vec3 inBoundPos; +uniform vec3 inBoundDim; +uniform ivec4 inStatus; + vec3 paintRainbow(float nv) { float v = nv * 5.f; if ( v < 0.f ) @@ -38,14 +38,16 @@ vec3 paintRainbow(float nv) { return vec3((v-4.f), 0.f, 1.f ); else return vec3(1.f, 1.f, 1.f); -} - -vec2 unpackStatus(int v) { - // return unpackSnorm2x16(uint(packed)); - return vec2(clamp(float((v & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0), - clamp(float(((v >> 16) & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0)); -} - +} + +vec2 unpackStatus(int v) { + // return unpackSnorm2x16(uint(packed)); + // return vec2(clamp(float((v & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0), + // clamp(float(((v >> 16) & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0)); + return vec2(clamp(float(int((v >> 0) & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0), + clamp(float(int((v >> 16) & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0)); +} + void main(void) { const vec2 ICON_PIXEL_SIZE = vec2(10, 10); const vec2 MARGIN_PIXEL_SIZE = vec2(2, 2); @@ -69,7 +71,7 @@ void main(void) { int iconNum = gl_VertexID / NUM_VERTICES; // if invalid, just kill - if (inStatus[iconNum] == 0x80008000) { + if (inStatus[iconNum] == 0xFFFFFFFF) { gl_Position = anchorPoint; varColor = vec4(1.0); return;