Fix drawInFront bugs

This commit is contained in:
Zach Pomerantz 2016-02-26 15:24:37 -08:00
parent 5995c3717f
commit 56aac35348
2 changed files with 7 additions and 2 deletions

View file

@ -315,9 +315,9 @@ public:
// Main scene / item managment interface reset/update/kill
void resetPayload(const PayloadPointer& payload);
void resetCell(ItemCell cell, bool _small) { _cell = cell; _key.setSmaller(_small); }
void resetCell(ItemCell cell = INVALID_CELL, bool _small = false) { _cell = cell; _key.setSmaller(_small); }
void update(const UpdateFunctorPointer& updateFunctor); // communicate update to payload
void kill() { _payload.reset(); _key._flags.reset(); _cell = INVALID_CELL; } // forget the payload, key, cell
void kill() { _payload.reset(); resetCell(); _key._flags.reset(); } // forget the payload, key, cell
// Check heuristic key
const ItemKey& getKey() const { return _key; }

View file

@ -104,6 +104,8 @@ void Scene::resetItems(const ItemIDs& ids, Payloads& payloads) {
if (newKey.isSpatial()) {
auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), resetID, newKey);
item.resetCell(newCell, newKey.isSmall());
} else {
_masterNonspatialSet.insert(resetID);
}
// next loop
@ -152,10 +154,13 @@ void Scene::updateItems(const ItemIDs& ids, UpdateFunctors& functors) {
} else {
if (newKey.isSpatial()) {
_masterNonspatialSet.erase(updateID);
auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), updateID, newKey);
item.resetCell(newCell, newKey.isSmall());
} else {
_masterSpatialTree.removeItem(oldCell, oldKey, updateID);
item.resetCell();
_masterNonspatialSet.insert(updateID);
}
}