mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
added notes on experimental new replacement for addOrUpdateEntity()
This commit is contained in:
parent
76ae4c9721
commit
dd3d4be73b
2 changed files with 30 additions and 0 deletions
|
@ -331,6 +331,33 @@ bool UpdateEntityOperator::PreRecursion(OctreeElement* element) {
|
||||||
|
|
||||||
// If this element is the best fit for the new entity properties, then add/or update it
|
// If this element is the best fit for the new entity properties, then add/or update it
|
||||||
if (entityTreeElement->bestFitBounds(_newEntityCube)) {
|
if (entityTreeElement->bestFitBounds(_newEntityCube)) {
|
||||||
|
|
||||||
|
|
||||||
|
/*********
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// LOOK AT THIS NEXT... this is crashing... the old code was working.... but this is not...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
// if we are the existing containing element, then we can just do the update of the entity properties
|
||||||
|
if (entityTreeElement == _containingElement) {
|
||||||
|
assert(!_removeOld); // We shouldn't be in a remove old case and also be the new best fit
|
||||||
|
|
||||||
|
// set the entity properties and mark our element as changed.
|
||||||
|
_existingEntity->setProperties(_properties);
|
||||||
|
entityTreeElement->markWithChangedTime();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// otherwise, this is an add case.
|
||||||
|
entityTreeElement->addEntityItem(_existingEntity);
|
||||||
|
_existingEntity->setProperties(_properties); // still need to update the properties!
|
||||||
|
entityTreeElement->markWithChangedTime();
|
||||||
|
_tree->setContainingElement(_entityItemID, entityTreeElement);
|
||||||
|
}
|
||||||
|
*************/
|
||||||
|
|
||||||
if (entityTreeElement->addOrUpdateEntity(_existingEntity, _properties)) {
|
if (entityTreeElement->addOrUpdateEntity(_existingEntity, _properties)) {
|
||||||
|
|
||||||
//qDebug() << "UpdateEntityOperator::PreRecursion()... entity was updated!";
|
//qDebug() << "UpdateEntityOperator::PreRecursion()... entity was updated!";
|
||||||
|
|
|
@ -401,6 +401,9 @@ bool EntityTreeElement::findSpherePenetration(const glm::vec3& center, float rad
|
||||||
|
|
||||||
|
|
||||||
// TODO... how do we handle older/newer with this interface?
|
// TODO... how do we handle older/newer with this interface?
|
||||||
|
// Look at getting rid of this, and moving this logic to Entity Tree
|
||||||
|
// AND/OR remove the O(n) lookup for the entity since we know it should already exist in this
|
||||||
|
// element list.
|
||||||
bool EntityTreeElement::addOrUpdateEntity(EntityItem* entity, const EntityItemProperties& properties) {
|
bool EntityTreeElement::addOrUpdateEntity(EntityItem* entity, const EntityItemProperties& properties) {
|
||||||
const bool wantDebug = false;
|
const bool wantDebug = false;
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
|
|
Loading…
Reference in a new issue