attempting to have visual indicator of simulatorID

This commit is contained in:
Seth Alves 2015-04-24 10:55:43 -07:00
parent 6fdbce9ee3
commit 1b84be6e10
4 changed files with 43 additions and 6 deletions

View file

@ -677,10 +677,26 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
if (bigEnoughToRender) {
renderProxies(entityItem, args);
// XXX
// auto nodeList = DependencyManager::get<NodeList>();
// const QUuid& myNodeID = nodeList->getSessionUUID();
// XXX
Glower* glower = NULL;
if (entityItem->getGlowLevel() > 0.0f) {
glower = new Glower(entityItem->getGlowLevel());
}
// XXX glow things we are simulating
// if (entityItem->getSimulatorID() == myNodeID) {
// if (glower) delete glower;
// glower = new Glower();
// }
// XXX glow things we are simulating
entityItem->render(args);
args->_itemsRendered++;
if (glower) {

View file

@ -118,13 +118,26 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
glm::vec3 position = getPosition();
glm::vec3 dimensions = getDimensions();
float size = glm::length(dimensions);
// XXX
auto nodeList = DependencyManager::get<NodeList>();
const QUuid& myNodeID = nodeList->getSessionUUID();
// XXX
if (drawAsModel) {
if (drawAsModel
&& getSimulatorID() != myNodeID
) {
remapTextures();
glPushMatrix();
{
float alpha = getLocalRenderAlpha();
// XXX
// if (getSimulatorID() == myNodeID) {
// alpha = 1.0;
// }
// XXX
if (!_model || _needsModelReload) {
// TODO: this getModel() appears to be about 3% of model render time. We should optimize
PerformanceTimer perfTimer("getModel");

View file

@ -140,16 +140,24 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro
// A Node is trying to take ownership of the simulation of this entity from another Node. Only allow this
// if ownership hasn't recently changed.
if (usecTimestampNow() - entity->getSimulatorIDChangedTime() < SIMULATOR_CHANGE_LOCKOUT_PERIOD) {
qCDebug(entities) << "simulator_change_lockout_period:"
<< entity->getSimulatorID() << "to" << properties.getSimulatorID();
// XXX
// qCDebug(entities) << "simulator_change_lockout_period:"
// << entity->getSimulatorID() << "to" << properties.getSimulatorID();
// XXX
// squash the physics-related changes.
properties.setSimulatorIDChanged(false);
properties.setPositionChanged(false);
properties.setVelocityChanged(false);
properties.setAccelerationChanged(false);
} else {
qCDebug(entities) << "allowing simulatorID change";
}
// else {
// qCDebug(entities) << "allowing simulatorID change";
// }
}
QString entityScriptBefore = entity->getScript();

View file

@ -306,7 +306,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
} else if (simulatorID == myNodeID && zeroSpeed && zeroSpin) {
// we are the simulator and the entity has stopped. give up "simulator" status
// _entity->setSimulatorID(QUuid());
properties.setSimulatorID(QUuid());
// properties.setSimulatorID(QUuid());
}
// RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit.