mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 22:47:49 +02:00
maybe i have solved the passing of the status
This commit is contained in:
parent
dcd61fd417
commit
0c55130548
5 changed files with 46 additions and 43 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
Script.include("cookies.js");
|
Script.include("cookies.js");
|
||||||
|
|
||||||
var panel = new Panel(10, 800);
|
var panel = new Panel(10, 100);
|
||||||
|
|
||||||
panel.newSlider("Num Feed Opaques", 0, 1000,
|
panel.newSlider("Num Feed Opaques", 0, 1000,
|
||||||
function(value) { },
|
function(value) { },
|
||||||
|
|
|
@ -170,12 +170,13 @@ namespace render {
|
||||||
void makeEntityItemStatusGetters(RenderableModelEntityItem* entity, render::Item::Status::Getters& statusGetters) {
|
void makeEntityItemStatusGetters(RenderableModelEntityItem* entity, render::Item::Status::Getters& statusGetters) {
|
||||||
statusGetters.push_back([entity] () -> render::Item::Status::Value {
|
statusGetters.push_back([entity] () -> render::Item::Status::Value {
|
||||||
quint64 delta = usecTimestampNow() - entity->getLastEditedFromRemote();
|
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 {
|
statusGetters.push_back([entity] () -> render::Item::Status::Value {
|
||||||
quint64 delta = usecTimestampNow() - entity->getLastBroadcast();
|
quint64 delta = usecTimestampNow() - entity->getLastBroadcast();
|
||||||
// return render::Item::Status::Value((delta / (0.02f * USECS_PER_SECOND)), 0.5f);
|
float ndelta = (delta / (0.4f * USECS_PER_SECOND));
|
||||||
return render::Item::Status::Value(1.0f, 0.5f);
|
return render::Item::Status::Value(1.0f - ndelta, (ndelta > 1.0f ? 0.01f : 0.5f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ void ItemBucketMap::allocateStandardOpaqueTranparentBuckets() {
|
||||||
(*this)[ItemFilter::Builder::transparentShape().withLayered()];
|
(*this)[ItemFilter::Builder::transparentShape().withLayered()];
|
||||||
}
|
}
|
||||||
|
|
||||||
const Item::Status::Value Item::Status::Value::INVALID{ std::numeric_limits<short>::min(), std::numeric_limits<short>::min() };
|
const Item::Status::Value Item::Status::Value::INVALID = Item::Status::Value();
|
||||||
|
|
||||||
void Item::Status::getCompressedValues(glm::ivec4& values) {
|
void Item::Status::getCompressedValues(glm::ivec4& values) {
|
||||||
for (int i = 0; i < values.length(); i++) {
|
for (int i = 0; i < values.length(); i++) {
|
||||||
|
|
|
@ -202,15 +202,15 @@ public:
|
||||||
class Status {
|
class Status {
|
||||||
public:
|
public:
|
||||||
class Value {
|
class Value {
|
||||||
short _x = 0;
|
unsigned short _x = 0xFFFF;
|
||||||
short _y = 0;
|
unsigned short _y = 0xFFFF;
|
||||||
Value(short x, short y) : _x(x), _y(y) {}
|
Value() {}
|
||||||
public:
|
public:
|
||||||
const static Value INVALID; // Invlaid value meanss the status won't show
|
const static Value INVALID; // Invlaid value meanss the status won't show
|
||||||
|
|
||||||
Value(float x, float y = 1.0f) { setX(x); setY(y); }
|
Value(float x, float y = 1.0f) { setX(x); setY(y); }
|
||||||
void setX(float x) { _x = std::numeric_limits<short>::max() * std::max(std::min(x, 1.0f), -1.0f); }
|
void setX(float x) { _x = (std::numeric_limits<unsigned short>::max() -1) * 0.5f * (1.0f + std::max(std::min(x, 1.0f), -1.0f)); }
|
||||||
void setY(float y) { _y = std::numeric_limits<short>::max() * std::max(std::min(y, 1.0f), -1.0f); }
|
void setY(float y) { _y = (std::numeric_limits<unsigned short>::max() - 1) * 0.5f * (1.0f + std::max(std::min(y, 1.0f), -1.0f)); }
|
||||||
|
|
||||||
int getRaw() const { return *((const int*) this); }
|
int getRaw() const { return *((const int*) this); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// drawItemStatus.slv
|
// drawItemStatus.slv
|
||||||
// vertex shader
|
// vertex shader
|
||||||
//
|
//
|
||||||
// Created by Sam Gateau on 6/30/2015.
|
// Created by Sam Gateau on 6/30/2015.
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
varying vec4 varColor;
|
varying vec4 varColor;
|
||||||
|
|
||||||
uniform vec3 inBoundPos;
|
uniform vec3 inBoundPos;
|
||||||
uniform vec3 inBoundDim;
|
uniform vec3 inBoundDim;
|
||||||
uniform ivec4 inStatus;
|
uniform ivec4 inStatus;
|
||||||
|
|
||||||
vec3 paintRainbow(float nv) {
|
vec3 paintRainbow(float nv) {
|
||||||
float v = nv * 5.f;
|
float v = nv * 5.f;
|
||||||
if ( v < 0.f )
|
if ( v < 0.f )
|
||||||
|
@ -38,14 +38,16 @@ vec3 paintRainbow(float nv) {
|
||||||
return vec3((v-4.f), 0.f, 1.f );
|
return vec3((v-4.f), 0.f, 1.f );
|
||||||
else
|
else
|
||||||
return vec3(1.f, 1.f, 1.f);
|
return vec3(1.f, 1.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 unpackStatus(int v) {
|
vec2 unpackStatus(int v) {
|
||||||
// return unpackSnorm2x16(uint(packed));
|
// return unpackSnorm2x16(uint(packed));
|
||||||
return vec2(clamp(float((v & 0xFFFF) - 32727) / 32727.0, -1.0, 1.0),
|
// 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));
|
// 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) {
|
void main(void) {
|
||||||
const vec2 ICON_PIXEL_SIZE = vec2(10, 10);
|
const vec2 ICON_PIXEL_SIZE = vec2(10, 10);
|
||||||
const vec2 MARGIN_PIXEL_SIZE = vec2(2, 2);
|
const vec2 MARGIN_PIXEL_SIZE = vec2(2, 2);
|
||||||
|
@ -69,7 +71,7 @@ void main(void) {
|
||||||
int iconNum = gl_VertexID / NUM_VERTICES;
|
int iconNum = gl_VertexID / NUM_VERTICES;
|
||||||
|
|
||||||
// if invalid, just kill
|
// if invalid, just kill
|
||||||
if (inStatus[iconNum] == 0x80008000) {
|
if (inStatus[iconNum] == 0xFFFFFFFF) {
|
||||||
gl_Position = anchorPoint;
|
gl_Position = anchorPoint;
|
||||||
varColor = vec4(1.0);
|
varColor = vec4(1.0);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue