setSimulationState() --> computeSimulationState()

This commit is contained in:
Andrew Meadows 2014-11-17 15:50:35 -08:00
parent 2f9a35412f
commit dd0bdabfe1
5 changed files with 10 additions and 8 deletions

View file

@ -246,7 +246,7 @@ Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) {
}
bool RenderableModelEntityItem::needsSimulation() const {
SimulationState simulationState = getSimulationState();
SimulationState simulationState = computeSimulationState();
return _needsInitialSimulation || simulationState == Moving || simulationState == Changing;
}

View file

@ -395,6 +395,8 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
quint64 lastEditedFromBuffer = 0;
quint64 lastEditedFromBufferAdjusted = 0;
// BOOKMARK: TODO: figure out if we can catch remote updates to EntityItems and build a list in the Tree
// that is then relayed to the physics engine (and other data structures that cache EntityItem data)
// TODO: we could make this encoded as a delta from _created
// _lastEdited
memcpy(&lastEditedFromBuffer, dataAt, sizeof(lastEditedFromBuffer));
@ -419,7 +421,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
qDebug() << " fromSameServerEdit=" << fromSameServerEdit;
}
bool ignoreServerPacket = false; // assume we're use this server packet
bool ignoreServerPacket = false; // assume we'll use this server packet
// If this packet is from the same server edit as the last packet we accepted from the server
// we probably want to use it.
@ -732,7 +734,7 @@ void EntityItem::update(const quint64& updateTime) {
}
}
EntityItem::SimulationState EntityItem::getSimulationState() const {
EntityItem::SimulationState EntityItem::computeSimulationState() const {
if (hasVelocity() || (hasGravity() && !isRestingOnSurface())) {
return EntityItem::Moving;
}

View file

@ -123,7 +123,7 @@ public:
Moving
} SimulationState;
virtual SimulationState getSimulationState() const;
virtual SimulationState computeSimulationState() const;
virtual void debugDump() const;
// similar to assignment/copy, but it handles keeping lifetime accurate

View file

@ -371,15 +371,15 @@ bool ModelEntityItem::isAnimatingSomething() const {
!getAnimationURL().isEmpty();
}
EntityItem::SimulationState ModelEntityItem::getSimulationState() const {
EntityItem::SimulationState baseClassState = EntityItem::getSimulationState();
EntityItem::SimulationState ModelEntityItem::computeSimulationState() const {
EntityItem::SimulationState baseClassState = EntityItem::computeSimulationState();
// if the base class is static, then consider our animation state, and upgrade to changing if
// we are animating. If the base class has a higher simulation state than static, then
// use the base class state.
if (baseClassState == EntityItem::Static) {
if (isAnimatingSomething()) {
return EntityItem::Changing;
return EntityItem::Moving;
}
}
return baseClassState;

View file

@ -46,7 +46,7 @@ public:
EntityPropertyFlags& propertyFlags, bool overwriteLocalData);
virtual void update(const quint64& now);
virtual SimulationState getSimulationState() const;
virtual SimulationState computeSimulationState() const;
virtual void debugDump() const;