show simulation ownership with status icons

This commit is contained in:
Seth Alves 2015-11-11 08:30:04 -08:00
parent b38c1cb30f
commit c2b0ccd6b3
2 changed files with 23 additions and 11 deletions

View file

@ -75,4 +75,17 @@ void makeEntityItemStatusGetters(EntityItem* entity, render::Item::Status::Gette
return render::Item::Status::Value(0.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::ACTIVE_IN_BULLET);
});
statusGetters.push_back([entity] () -> render::Item::Status::Value {
auto nodeList = DependencyManager::get<NodeList>();
const QUuid& myNodeID = nodeList->getSessionUUID();
bool weOwnSimulation = entity->getSimulationOwner().matchesValidID(myNodeID);
if (weOwnSimulation) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::SIMULATION_OWNER);
}
return render::Item::Status::Value(0.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::SIMULATION_OWNER);
});
}

View file

@ -18,12 +18,11 @@
// These or the icon "name" used by the render item status value, they correspond to the atlas texture used by the DrawItemStatus
// job in the current rendering pipeline defined as of now (11/2015) in render-utils/RenderDeferredTask.cpp.
enum class RenderItemStatusIcon {
PACKET_RECEIVED = 2,
PACKET_SENT = 1,
ACTIVE_IN_BULLET = 0,
SIMULATION_OWNER = 3,
NONE = 255
ACTIVE_IN_BULLET = 0,
PACKET_SENT = 1,
PACKET_RECEIVED = 2,
SIMULATION_OWNER = 3,
NONE = 255
};
@ -32,7 +31,7 @@ public:
RenderableEntityItemProxy(EntityItemPointer entity) : entity(entity) { }
typedef render::Payload<RenderableEntityItemProxy> Payload;
typedef Payload::DataPointer Pointer;
EntityItemPointer entity;
};
@ -47,19 +46,19 @@ class SimpleRenderableEntityItem {
public:
bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) {
_myItem = scene->allocateID();
auto renderData = std::make_shared<RenderableEntityItemProxy>(self);
auto renderPayload = std::make_shared<RenderableEntityItemProxy::Payload>(renderData);
pendingChanges.resetItem(_myItem, renderPayload);
return true;
}
void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) {
pendingChanges.removeItem(_myItem);
}
private:
render::ItemID _myItem;
};