bundle the flags that EntitySimulation cares about

This commit is contained in:
Andrew Meadows 2014-12-09 12:55:58 -08:00
parent 699e632e68
commit bc22e5723c
2 changed files with 15 additions and 2 deletions

View file

@ -16,8 +16,21 @@
#include <PerfStat.h>
#include "EntityItem.h"
#include "EntityTree.h"
// the EntitySimulation needs to know when these things change on an entity,
// so it can sort EntityItem or relay its state to the PhysicsEngine.
const int DIRTY_SIMULATION_FLAGS =
EntityItem::DIRTY_POSITION |
EntityItem::DIRTY_VELOCITY |
EntityItem::DIRTY_MASS |
EntityItem::DIRTY_COLLISION_GROUP |
EntityItem::DIRTY_MOTION_TYPE |
EntityItem::DIRTY_SHAPE |
EntityItem::DIRTY_LIFETIME |
EntityItem::DIRTY_UPDATEABLE;
class EntitySimulation {
public:
EntitySimulation() : _entityTree(NULL) { }

View file

@ -137,7 +137,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro
entity->setOldMaximumAACube(entity->getMaximumAACube());
_isDirty = true;
uint32_t newFlags = entity->getDirtyFlags() & ~oldFlags;
uint32_t newFlags = entity->getDirtyFlags() & ~preFlags;
if (newFlags) {
if (newFlags & EntityItem::DIRTY_SCRIPT) {
emit entityScriptChanging(entity->getEntityItemID());
@ -145,7 +145,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro
}
if (_simulation) {
if (newFlags & ENTITY_SIMULATION_FLAGS) {
if (newFlags & DIRTY_SIMULATION_FLAGS) {
_simulation->entityChanged(entity);
}
} else {