mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:56:45 +02:00
bundle the flags that EntitySimulation cares about
This commit is contained in:
parent
699e632e68
commit
bc22e5723c
2 changed files with 15 additions and 2 deletions
|
@ -16,8 +16,21 @@
|
||||||
|
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
|
#include "EntityItem.h"
|
||||||
#include "EntityTree.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 {
|
class EntitySimulation {
|
||||||
public:
|
public:
|
||||||
EntitySimulation() : _entityTree(NULL) { }
|
EntitySimulation() : _entityTree(NULL) { }
|
||||||
|
|
|
@ -137,7 +137,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro
|
||||||
entity->setOldMaximumAACube(entity->getMaximumAACube());
|
entity->setOldMaximumAACube(entity->getMaximumAACube());
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
|
||||||
uint32_t newFlags = entity->getDirtyFlags() & ~oldFlags;
|
uint32_t newFlags = entity->getDirtyFlags() & ~preFlags;
|
||||||
if (newFlags) {
|
if (newFlags) {
|
||||||
if (newFlags & EntityItem::DIRTY_SCRIPT) {
|
if (newFlags & EntityItem::DIRTY_SCRIPT) {
|
||||||
emit entityScriptChanging(entity->getEntityItemID());
|
emit entityScriptChanging(entity->getEntityItemID());
|
||||||
|
@ -145,7 +145,7 @@ bool EntityTree::updateEntityWithElement(EntityItem* entity, const EntityItemPro
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
if (newFlags & ENTITY_SIMULATION_FLAGS) {
|
if (newFlags & DIRTY_SIMULATION_FLAGS) {
|
||||||
_simulation->entityChanged(entity);
|
_simulation->entityChanged(entity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue