Move RenderItemStatusIcon to Item.h

This commit is contained in:
sabrina-shanman 2019-05-20 12:07:41 -07:00
parent 5aff4d9f69
commit 03a8e77ade
3 changed files with 25 additions and 27 deletions

View file

@ -32,19 +32,6 @@
using namespace render;
using namespace render::entities;
// These or the icon "name" used by the render item status value, they correspond to the atlas texture used by the DrawStatus
// job in the current rendering pipeline defined as of now (2019/05) in render-utils/RenderDeferredTask.cpp.
enum class RenderItemStatusIcon {
ACTIVE_IN_BULLET = 0,
PACKET_SENT = 1,
PACKET_RECEIVED = 2,
SIMULATION_OWNER = 3,
HAS_ACTIONS = 4,
OTHER_SIMULATION_OWNER = 5,
ENTITY_HOST_TYPE = 6,
NONE = 255
};
void EntityRenderer::initEntityRenderers() {
REGISTER_ENTITY_TYPE_WITH_FACTORY(Model, RenderableModelEntityItem::factory)
REGISTER_ENTITY_TYPE_WITH_FACTORY(PolyVox, RenderablePolyVoxEntityItem::factory)
@ -67,7 +54,7 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St
return render::Item::Status::Value(1.0f - normalizedDelta, (normalizedDelta > 1.0f ?
render::Item::Status::Value::GREEN :
render::Item::Status::Value::RED),
(unsigned char)RenderItemStatusIcon::PACKET_RECEIVED);
(unsigned char)render::Item::Status::Icon::PACKET_RECEIVED);
});
statusGetters.push_back([entity] () -> render::Item::Status::Value {
@ -79,17 +66,17 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St
return render::Item::Status::Value(1.0f - normalizedDelta, (normalizedDelta > 1.0f ?
render::Item::Status::Value::MAGENTA :
render::Item::Status::Value::CYAN),
(unsigned char)RenderItemStatusIcon::PACKET_SENT);
(unsigned char)render::Item::Status::Icon::PACKET_SENT);
});
statusGetters.push_back([entity] () -> render::Item::Status::Value {
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(entity->getPhysicsInfo());
if (motionState && motionState->isActive()) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::ACTIVE_IN_BULLET);
(unsigned char)render::Item::Status::Icon::ACTIVE_IN_BULLET);
}
return render::Item::Status::Value(0.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::ACTIVE_IN_BULLET);
(unsigned char)render::Item::Status::Icon::ACTIVE_IN_BULLET);
});
statusGetters.push_back([entity, myNodeID] () -> render::Item::Status::Value {
@ -98,39 +85,39 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St
if (weOwnSimulation) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::SIMULATION_OWNER);
(unsigned char)render::Item::Status::Icon::SIMULATION_OWNER);
} else if (otherOwnSimulation) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED,
(unsigned char)RenderItemStatusIcon::OTHER_SIMULATION_OWNER);
(unsigned char)render::Item::Status::Icon::OTHER_SIMULATION_OWNER);
}
return render::Item::Status::Value(0.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::SIMULATION_OWNER);
(unsigned char)render::Item::Status::Icon::SIMULATION_OWNER);
});
statusGetters.push_back([entity] () -> render::Item::Status::Value {
if (entity->hasActions()) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN,
(unsigned char)RenderItemStatusIcon::HAS_ACTIONS);
(unsigned char)render::Item::Status::Icon::HAS_ACTIONS);
}
return render::Item::Status::Value(0.0f, render::Item::Status::Value::GREEN,
(unsigned char)RenderItemStatusIcon::HAS_ACTIONS);
(unsigned char)render::Item::Status::Icon::HAS_ACTIONS);
});
statusGetters.push_back([entity, myNodeID] () -> render::Item::Status::Value {
if (entity->isAvatarEntity()) {
if (entity->getOwningAvatarID() == myNodeID) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
(unsigned char)render::Item::Status::Icon::ENTITY_HOST_TYPE);
} else {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
(unsigned char)render::Item::Status::Icon::ENTITY_HOST_TYPE);
}
} else if (entity->isLocalEntity()) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
(unsigned char)render::Item::Status::Icon::ENTITY_HOST_TYPE);
}
return render::Item::Status::Value(0.0f, render::Item::Status::Value::GREEN,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
(unsigned char)render::Item::Status::Icon::ENTITY_HOST_TYPE);
});
}

View file

@ -143,7 +143,7 @@ void DrawStatus::run(const RenderContextPointer& renderContext, const Input& inp
Item::Status::Value status;
status.setColor(Item::Status::Value::CYAN);
status.setIcon(3); // RenderItemStatusIcon::SIMULATION_OWNER (RenderableModelEntityItem.cpp)
status.setIcon((unsigned char)Item::Status::Icon::SIMULATION_OWNER);
if (itemScene.getTransitionId() != INVALID_INDEX) {
// We have a transition. Show this icon.
status.setScale(1.0f);

View file

@ -354,6 +354,17 @@ public:
// This is Used for monitoring and dynamically adjust the quality
class Status {
public:
enum class Icon {
ACTIVE_IN_BULLET = 0,
PACKET_SENT = 1,
PACKET_RECEIVED = 2,
SIMULATION_OWNER = 3,
HAS_ACTIONS = 4,
OTHER_SIMULATION_OWNER = 5,
ENTITY_HOST_TYPE = 6,
NONE = 255
};
// Status::Value class is the data used to represent the transient information of a status as a square icon
// The "icon" is a square displayed in the 3D scene over the render::Item AABB center.