mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:37:27 +02:00
Move RenderItemStatusIcon to Item.h
This commit is contained in:
parent
5aff4d9f69
commit
03a8e77ade
3 changed files with 25 additions and 27 deletions
|
@ -32,19 +32,6 @@
|
||||||
using namespace render;
|
using namespace render;
|
||||||
using namespace render::entities;
|
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() {
|
void EntityRenderer::initEntityRenderers() {
|
||||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Model, RenderableModelEntityItem::factory)
|
REGISTER_ENTITY_TYPE_WITH_FACTORY(Model, RenderableModelEntityItem::factory)
|
||||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(PolyVox, RenderablePolyVoxEntityItem::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 ?
|
return render::Item::Status::Value(1.0f - normalizedDelta, (normalizedDelta > 1.0f ?
|
||||||
render::Item::Status::Value::GREEN :
|
render::Item::Status::Value::GREEN :
|
||||||
render::Item::Status::Value::RED),
|
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 {
|
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 ?
|
return render::Item::Status::Value(1.0f - normalizedDelta, (normalizedDelta > 1.0f ?
|
||||||
render::Item::Status::Value::MAGENTA :
|
render::Item::Status::Value::MAGENTA :
|
||||||
render::Item::Status::Value::CYAN),
|
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 {
|
statusGetters.push_back([entity] () -> render::Item::Status::Value {
|
||||||
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(entity->getPhysicsInfo());
|
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(entity->getPhysicsInfo());
|
||||||
if (motionState && motionState->isActive()) {
|
if (motionState && motionState->isActive()) {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
|
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,
|
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 {
|
statusGetters.push_back([entity, myNodeID] () -> render::Item::Status::Value {
|
||||||
|
@ -98,39 +85,39 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St
|
||||||
|
|
||||||
if (weOwnSimulation) {
|
if (weOwnSimulation) {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
|
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) {
|
} else if (otherOwnSimulation) {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED,
|
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,
|
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 {
|
statusGetters.push_back([entity] () -> render::Item::Status::Value {
|
||||||
if (entity->hasActions()) {
|
if (entity->hasActions()) {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN,
|
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,
|
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 {
|
statusGetters.push_back([entity, myNodeID] () -> render::Item::Status::Value {
|
||||||
if (entity->isAvatarEntity()) {
|
if (entity->isAvatarEntity()) {
|
||||||
if (entity->getOwningAvatarID() == myNodeID) {
|
if (entity->getOwningAvatarID() == myNodeID) {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN,
|
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 {
|
} else {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED,
|
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()) {
|
} else if (entity->isLocalEntity()) {
|
||||||
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
|
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,
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void DrawStatus::run(const RenderContextPointer& renderContext, const Input& inp
|
||||||
|
|
||||||
Item::Status::Value status;
|
Item::Status::Value status;
|
||||||
status.setColor(Item::Status::Value::CYAN);
|
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) {
|
if (itemScene.getTransitionId() != INVALID_INDEX) {
|
||||||
// We have a transition. Show this icon.
|
// We have a transition. Show this icon.
|
||||||
status.setScale(1.0f);
|
status.setScale(1.0f);
|
||||||
|
|
|
@ -355,6 +355,17 @@ public:
|
||||||
class Status {
|
class Status {
|
||||||
public:
|
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
|
// 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.
|
// The "icon" is a square displayed in the 3D scene over the render::Item AABB center.
|
||||||
// It can be scaled in the range [0, 1] and the color hue in the range [0, 360] representing the color wheel hue
|
// It can be scaled in the range [0, 1] and the color hue in the range [0, 360] representing the color wheel hue
|
||||||
|
|
Loading…
Reference in a new issue