latest work

This commit is contained in:
ZappoMan 2014-07-21 09:18:21 -07:00
parent 9409d07c46
commit 30aee70346
8 changed files with 167 additions and 26 deletions

View file

@ -21,11 +21,11 @@ var roll = 180.0;
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll)
var originalProperties = {
position: { x: 10,
y: 0,
z: 0 },
position: { x: 2.0,
y: 2.0,
z: 0.5 },
radius : 0.1,
radius : 0.25,
color: { red: 0,
green: 255,
@ -41,7 +41,7 @@ var originalProperties = {
rotation: rotation
};
var positionDelta = { x: 0, y: 0, z: 0 };
var positionDelta = { x: 0.002, y: 0.002, z: 0.0 };
var entityID = Entities.addEntity(originalProperties);
@ -76,8 +76,6 @@ function moveEntity(deltaTime) {
y: originalProperties.position.y + (count * positionDelta.y),
z: originalProperties.position.z + (count * positionDelta.z)
},
radius : 0.25,
};

View file

@ -63,7 +63,11 @@ void EntityTreeRenderer::update() {
}
void EntityTreeRenderer::render(RenderMode renderMode) {
qDebug() << "EntityTreeRenderer::render() ************";
OctreeRenderer::render(renderMode);
qDebug() << "-------------------- EntityTreeRenderer::render() ------------";
static_cast<EntityTree*>(_tree)->debugDumpMap();
qDebug() << "******* DONE ******* EntityTreeRenderer::render() ************";
}
const FBXGeometry* EntityTreeRenderer::getGeometryForEntity(const EntityItem& entityItem) {
@ -144,8 +148,12 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
EntityTreeElement* entityTreeElement = static_cast<EntityTreeElement*>(element);
QList<EntityItem*>& entityItems = entityTreeElement->getEntities();
uint16_t numberOfEntities = entityItems.size();
qDebug() << "EntityTreeRenderer::renderElement() element=" << element
<< "numberOfEntities=" << numberOfEntities;
bool isShadowMode = args->_renderMode == OctreeRenderer::SHADOW_RENDER_MODE;
@ -220,6 +228,14 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
for (uint16_t i = 0; i < numberOfEntities; i++) {
EntityItem* entityItem = entityItems[i];
bool isBestFit = entityTreeElement->bestFitEntityBounds(entityItem);
qDebug() << "EntityTreeRenderer::renderElement() "
<< "entityTreeElement=" << entityTreeElement
<< "entityItems[" << i << "]=" << entityItem
<< "ID=" << entityItem->getEntityItemID()
<< "isBestFit=" << isBestFit;
// render entityItem aspoints
AACube entityCube = entityItem->getAACube();
entityCube.scale(TREE_SCALE);

View file

@ -100,7 +100,21 @@ public:
glm::vec3 getMinimumPointTreeUnits() const { return getMinimumPointMeters() / (float)TREE_SCALE; }
glm::vec3 getMaximumPointTreeUnits() const { return getMaximumPointMeters() / (float)TREE_SCALE; }
AACube getAACubeTreeUnits() const { return AACube(getMinimumPointMeters()/(float)TREE_SCALE, getMaxDimension()/(float)TREE_SCALE); } /// AACube in domain scale units (0.0 - 1.0)
/// AACube in domain scale units (0.0 - 1.0)
AACube getAACubeTreeUnits() const {
glm::vec3 cornerInTreeUnits = getMinimumPointMeters()/(float)TREE_SCALE;
float dimensionInTreeUnits = getMaxDimension()/(float)TREE_SCALE;
qDebug() << "getAACubeTreeUnits()";
qDebug() << " corner in meters=" << getMinimumPointMeters().x << "," << getMinimumPointMeters().y << "," << getMinimumPointMeters().z;
qDebug() << " dimension in meters=" << getMaxDimension();
qDebug() << " corner in tree units=" << cornerInTreeUnits.x << "," << cornerInTreeUnits.y << "," << cornerInTreeUnits.z;
qDebug() << " dimension in tree units=" << dimensionInTreeUnits;
return AACube(cornerInTreeUnits, dimensionInTreeUnits);
}
void debugDump() const;
// properties of all entities
@ -121,6 +135,8 @@ public:
// NOTE: how do we handle _defaultSettings???
bool containsBoundsProperties() const { return (_positionChanged || _radiusChanged); }
bool containsPositionChange() const { return _positionChanged; }
bool containsRadiusChange() const { return _radiusChanged; }
#ifdef HIDE_SUBCLASS_METHODS
// properties we want to move to just models and particles

View file

@ -192,7 +192,7 @@ private:
EntityTree* _tree;
EntityItem* _existingEntity;
EntityTreeElement* _containingElement;
const EntityItemProperties& _properties;
EntityItemProperties _properties;
EntityItemID _entityItemID;
bool _foundOld;
bool _foundNew;
@ -226,18 +226,40 @@ UpdateEntityOperator::UpdateEntityOperator(EntityTree* tree,
assert(_containingElement && _existingEntity);
_oldEntityCube = _existingEntity->getAACube();
// If the new properties has position OR radius changes, but not both, we need to
// get the old property value and set it in our properties in order for our bounds
// calculations to work.
if (_properties.containsPositionChange() && !_properties.containsRadiusChange()) {
float oldRadiusInMeters = _existingEntity->getRadius() * (float)TREE_SCALE;
_properties.setRadius(oldRadiusInMeters);
}
if (!_properties.containsPositionChange() && _properties.containsRadiusChange()) {
glm::vec3 oldPositionInMeters = _existingEntity->getPosition() * (float)TREE_SCALE;
_properties.setPosition(oldPositionInMeters);
}
// If our new properties don't have bounds details (no change to position, etc) or if this containing element would
// be the best fit for our new properties, then just do the new portion of the store pass, since the change path will
// be the same for both parts of the update
if (!properties.containsBoundsProperties() || _containingElement->bestFitBounds(properties)) {
if (!_properties.containsBoundsProperties() || _containingElement->bestFitBounds(_properties)) {
qDebug() << "UpdateEntityOperator NOT MOVING: "
<< "_properties.containsBoundsProperties()=" << _properties.containsBoundsProperties()
<< "_containingElement->bestFitBounds(_properties)=" << _containingElement->bestFitBounds(_properties);
_foundOld = true;
_newEntityCube = _oldEntityCube;
} else {
_newEntityCube = properties.getAACubeTreeUnits();
qDebug() << "UpdateEntityOperator will be MOVING!!!";
_newEntityCube = _properties.getAACubeTreeUnits();
_removeOld = true; // our properties are going to move us, so remember this for later processing
}
qDebug() << "UpdateEntityOperator _oldEntityCube=" << _oldEntityCube;
qDebug() << "UpdateEntityOperator _newEntityCube=" << _newEntityCube;
}
// does this entity tree element contain the old entity
@ -276,7 +298,9 @@ bool UpdateEntityOperator::PreRecursion(OctreeElement* element) {
// then we need to remove it, and the updateEntity below will store it in the
// correct element.
if (_removeOld) {
qDebug() << "UpdateEntityOperator::PreRecursion() BEFORE entityTreeElement->removeEntityItem(); element=" << entityTreeElement << "entity=" << _existingEntity << "id=" << _existingEntity->getEntityItemID() << "bestFit=" << entityTreeElement->bestFitEntityBounds(_existingEntity);
entityTreeElement->removeEntityItem(_existingEntity); // NOTE: only removes the entity, doesn't delete it
qDebug() << "UpdateEntityOperator::PreRecursion() AFTER entityTreeElement->removeEntityItem(); element=" << entityTreeElement << "entity=" << _existingEntity << "id=" << _existingEntity->getEntityItemID() << "bestFit=" << entityTreeElement->bestFitEntityBounds(_existingEntity);
// If we haven't yet found the new location, then we need to
// make sure to remove our entity to element map, because for
@ -302,14 +326,18 @@ _tree->debugDumpMap();
if (entityTreeElement->bestFitBounds(_newEntityCube)) {
if (entityTreeElement->addOrUpdateEntity(_existingEntity, _properties)) {
//qDebug() << "UpdateEntityOperator::PreRecursion()... entity was updated!";
qDebug() << "UpdateEntityOperator::PreRecursion()... entity was updated!";
_foundNew = true;
// NOTE: don't change the keepSearching here, if it came in here
// false then we stay false, if it came in here true, then it
// means we're still searching for our old entity and this branch
// contains our old entity. In which case we want to keep searching.
} else {
qDebug() << "UpdateEntityOperator::PreRecursion()... WHAT??? UNEXPECTED entity was not updated!";
}
} else {
qDebug() << "UpdateEntityOperator::PreRecursion()... correct subtree for entity, but not correct element.";
keepSearching = true;
}
}
@ -362,11 +390,18 @@ bool EntityTree::updateEntity(const EntityItemID& entityID, const EntityItemProp
return false;
}
qDebug() << "============ BEFORE UpdateEntityOperator.... recurseTreeWithOperator()..... ===================";
UpdateEntityOperator theOperator(this, containingElement, existingEntity, properties);
recurseTreeWithOperator(&theOperator);
qDebug() << "============ AFTER UpdateEntityOperator.... recurseTreeWithOperator()..... ===================";
_isDirty = true;
containingElement = getContainingElement(entityID);
if (!containingElement) {
qDebug() << "after updateEntity() we no longer have a containing element???";
assert(containingElement); // don't call updateEntity() on entity items that don't exist
}
return true;
}
@ -377,7 +412,8 @@ qDebug() << "EntityTree::addEntity()... entityID=" << entityID;
// create EntityItems that do not yet have known IDs. In the server tree however we don't want to have entities without
// known IDs.
if (!getIsViewing()) {
assert(entityID.isKnownID);
//assert(entityID.isKnownID);
qDebug() << "EntityTree::addEntity()... !getIsViewing().... assert(entityID.isKnownID)";
}
EntityItem* result = NULL;
@ -460,7 +496,7 @@ void DeleteEntityOperator::addEntityIDToDeleteList(const EntityItemID& searchEnt
//assert(false);
qDebug() << "that's UNEXPECTED, we got a _containingElement, but couldn't find the oldEntity!";
} else {
details.cube = details.entity->getAACube();
details.cube = details.containingElement->getAACube();
_entitiesToDelete << details;
_lookingCount++;
}
@ -513,7 +549,9 @@ bool DeleteEntityOperator::PreRecursion(OctreeElement* element) {
// This is a good place to delete it!!!
EntityItemID entityItemID = details.entity->getEntityItemID();
qDebug() << "DeleteEntityOperator::PreRecursion() BEFORE entityTreeElement->removeEntityWithEntityItemID(); element=" << entityTreeElement << "id=" << entityItemID;
entityTreeElement->removeEntityWithEntityItemID(entityItemID);
qDebug() << "DeleteEntityOperator::PreRecursion() AFTER entityTreeElement->removeEntityWithEntityItemID(); element=" << entityTreeElement << "id=" << entityItemID;
_tree->setContainingElement(entityItemID, NULL);
qDebug() << "DeleteEntityOperator calling setContainingElement(NULL)... entityID=" << entityItemID;
@ -546,6 +584,9 @@ bool DeleteEntityOperator::PostRecursion(OctreeElement* element) {
void EntityTree::deleteEntity(const EntityItemID& entityID) {
// NOTE: callers must lock the tree before using this method
EntityTreeElement* containingElement = getContainingElement(entityID);
qDebug() << "EntityTree::deleteEntity().... BEFORE DELETE... containingElement=" << containingElement;
debugDumpMap();
// First, look for the existing entity in the tree..
DeleteEntityOperator theOperator(this, entityID);
@ -553,7 +594,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
recurseTreeWithOperator(&theOperator);
_isDirty = true;
bool wantDebug = false;
bool wantDebug = true;
if (wantDebug) {
EntityTreeElement* containingElement = getContainingElement(entityID);
qDebug() << "EntityTree::deleteEntity().... after delete... containingElement=" << containingElement;
@ -699,7 +740,9 @@ bool UpdateEntityIDOperator::PreRecursion(OctreeElement* element) {
if (element == _containingElementKnownID) {
qDebug() << "FOUND known ID entity";
qDebug() << "FOUND known ID entity... entityTreeElement->removeEntityWithEntityItemID(_entityIDKnownID)...";
qDebug() << "UpdateEntityIDOperator::PreRecursion() BEFORE entityTreeElement->removeEntityWithEntityItemID(); element=" << entityTreeElement << "id=" << _entityIDKnownID;
entityTreeElement->removeEntityWithEntityItemID(_entityIDKnownID);
qDebug() << "UpdateEntityIDOperator::PreRecursion() AFTER entityTreeElement->removeEntityWithEntityItemID(); element=" << entityTreeElement << "id=" << _entityIDKnownID;
qDebug() << "FOUND known ID entity... entityTreeElement->setContainingElement(_entityIDKnownID, NULL)...";
_tree->setContainingElement(_entityIDKnownID, NULL);
@ -1008,7 +1051,18 @@ bool EntityTree::pruneOperation(OctreeElement* element, void* extraData) {
EntityTreeElement* entityTreeElement = static_cast<EntityTreeElement*>(element);
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
EntityTreeElement* childAt = entityTreeElement->getChildAtIndex(i);
/*
if (childAt) {
qDebug() << "consider pruning child" << i
<< "childAt=" << childAt
<< "isLeaf=" << (childAt ? childAt->isLeaf() : false)
<< "hasEntities=" << (childAt ? childAt->hasEntities() : false);
}
*/
if (childAt && childAt->isLeaf() && !childAt->hasEntities()) {
//qDebug() << "pruning child" << i;
entityTreeElement->deleteChildAtIndex(i);
}
}
@ -1016,6 +1070,10 @@ bool EntityTree::pruneOperation(OctreeElement* element, void* extraData) {
}
void EntityTree::update() {
// XXXBHG: replace storeEntity with new API!!
//qDebug() << "EntityTree::update().... NOT YET IMPLEMENTED!!!";
#if 0 //////////////////////////////////////////////////////
lockForWrite();
_isDirty = true;
@ -1028,9 +1086,6 @@ void EntityTree::update() {
for (int i = 0; i < movingEntities; i++) {
// XXXBHG: replace storeEntity with new API!!
qDebug() << "EntityTree::update().... NOT YET IMPLEMENTED!!!";
#if 0 //////////////////////////////////////////////////////
bool shouldDie = args._movingEntities[i]->getShouldBeDeleted();
// if the particle is still inside our total bounds, then re-add it
@ -1045,12 +1100,19 @@ void EntityTree::update() {
_recentlyDeletedEntityItemIDs.insert(deletedAt, entityItemID);
_recentlyDeletedEntitiesLock.unlock();
}
#endif // 0 //////////////////////////////////////////////////////
}
#endif // 0 //////////////////////////////////////////////////////
// prune the tree...
/*
lockForWrite();
qDebug() << "pruning tree";
recurseTreeWithOperation(pruneOperation, NULL);
unlock();
*/
}
@ -1271,7 +1333,8 @@ void EntityTree::setContainingElement(const EntityItemID& entityItemID, EntityTr
_entityToElementMap.remove(entityItemID);
}
//qDebug() << "setContainingElement() entityItemID=" << entityItemID << "element=" << element;
qDebug() << "setContainingElement() entityItemID=" << entityItemID << "element=" << element;
debugDumpMap();
//qDebug() << "AFTER _entityToElementMap=" << _entityToElementMap;
}

View file

@ -245,10 +245,16 @@ void EntityTreeElement::update(EntityTreeUpdateArgs& args) {
// how do we want to handle this??? We really only want to consider an element changed when it is
// edited... not just animated...
entity->update(_lastChanged);
// If the entity wants to die, or if it's left our bounding box, then move it
// into the arguments moving entities. These will be added back or deleted completely
if (entity->getShouldBeDeleted() || !bestFitEntityBounds(entity)) {
qDebug() << "EntityTreeElement::update()... OLD DELETE LOGIC CALLED BUT NOT IMPLEMENTED...";
/***
// TODO: What to do about this???
args._movingEntities.push_back(entity);
// erase this entity
@ -262,6 +268,8 @@ void EntityTreeElement::update(EntityTreeUpdateArgs& args) {
// TODO: is this a good place to change the containing element map???
qDebug() << "EntityTreeElement::update()... calling _myTree->setContainingElement(entity.getEntityItemID(), NULL); ********";
_myTree->setContainingElement(entity->getEntityItemID(), NULL);
**/
} else {
++entityItr;
@ -413,15 +421,30 @@ bool EntityTreeElement::addOrUpdateEntity(EntityItem* entity, const EntityItemPr
}
thisEntity->setProperties(properties);
markWithChangedTime();
qDebug() << "***** EntityTreeElement::addOrUpdateEntity() setting properties of existing entity... no need to setContainingElement()?????";
qDebug() << "***** EntityTreeElement::addOrUpdateEntity() this=" << this;
qDebug() << "***** EntityTreeElement::addOrUpdateEntity() _myTree->getContainingElement(entityID)=" << _myTree->getContainingElement(entity->getEntityItemID());
if (_myTree->getContainingElement(entity->getEntityItemID()) != this) {
qDebug() << "EntityTreeElement::addOrUpdateEntity() huh?? what??? looks like our containing element is wrong??";
_myTree->setContainingElement(entity->getEntityItemID(), this);
qDebug() << "EntityTreeElement::addOrUpdateEntity() CHANGED IT... NOW... _myTree->getContainingElement(entity->getEntityItemID())=" <<
_myTree->getContainingElement(entity->getEntityItemID());
}
return true;
}
}
// If we didn't find the entity here, then let's check to see if we should add it...
qDebug() << "EntityTreeElement::addOrUpdateEntity() BEFORE _entityItems->push_back(entity); element=" << this << "entity=" << entity << "id=" << entity->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entity);
_entityItems->push_back(entity);
qDebug() << "EntityTreeElement::addOrUpdateEntity() AFTER _entityItems->push_back(entity); element=" << this << "entity=" << entity << "id=" << entity->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entity);
entity->setProperties(properties); // still need to update the properties!
qDebug() << "EntityTreeElement::addOrUpdateEntity() AFTER entity->setProperties(properties); element=" << this << "entity=" << entity << "id=" << entity->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entity);
markWithChangedTime();
// Since we're adding this item to this element, we need to let the tree know about it
qDebug() << "EntityTreeElement::addOrUpdateEntity() _myTree->setContainingElement(entity->getEntityItemID(), this)........";
_myTree->setContainingElement(entity->getEntityItemID(), this);
return true;
@ -540,7 +563,10 @@ bool EntityTreeElement::removeEntityWithID(uint32_t id) {
for (uint16_t i = 0; i < numberOfEntities; i++) {
if ((*_entityItems)[i]->getID() == id) {
foundEntity = true;
EntityItem* entityItem = (*_entityItems)[i];
qDebug() << "EntityTreeElement::removeEntityWithID() BEFORE _entityItems->removeAt(i); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
_entityItems->removeAt(i);
qDebug() << "EntityTreeElement::removeEntityWithID() AFTER _entityItems->removeAt(i); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
break;
}
@ -554,7 +580,10 @@ bool EntityTreeElement::removeEntityWithEntityItemID(const EntityItemID& id) {
for (uint16_t i = 0; i < numberOfEntities; i++) {
if ((*_entityItems)[i]->getEntityItemID() == id) {
foundEntity = true;
EntityItem* entityItem = (*_entityItems)[i];
qDebug() << "EntityTreeElement::removeEntityWithEntityItemID() BEFORE _entityItems->removeAt(i); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
_entityItems->removeAt(i);
qDebug() << "EntityTreeElement::removeEntityWithEntityItemID() AFTER _entityItems->removeAt(i); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
break;
}
}
@ -567,7 +596,10 @@ bool EntityTreeElement::removeEntityItem(const EntityItem* entity) {
for (uint16_t i = 0; i < numberOfEntities; i++) {
if ((*_entityItems)[i] == entity) {
foundEntity = true;
EntityItem* entityItem = (*_entityItems)[i];
qDebug() << "EntityTreeElement::removeEntityItem() BEFORE _entityItems->removeAt(i); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
_entityItems->removeAt(i);
qDebug() << "EntityTreeElement::removeEntityItem() AFTER _entityItems->removeAt(i); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
break;
}
}
@ -628,7 +660,9 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
if (entityItem) {
bytesForThisEntity = entityItem->readEntityDataFromBuffer(dataAt, bytesLeftToRead, args);
qDebug() << "EntityTreeElement::readElementDataFromBuffer() BEFORE addEntityItem(entity); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
addEntityItem(entityItem); // add this new entity to this elements entities
qDebug() << "EntityTreeElement::readElementDataFromBuffer() AFTER addEntityItem(entity); element=" << this << "entity=" << entityItem << "id=" << entityItem->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entityItem);
_myTree->setContainingElement(entityItem->getEntityItemID(), this);
newEntity = true;
}
@ -661,7 +695,9 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
}
void EntityTreeElement::addEntityItem(EntityItem* entity) {
qDebug() << "EntityTreeElement::addEntityItem() BEFORE _entityItems->push_back(entity); element=" << this << "entity=" << entity << "id=" << entity->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entity);
_entityItems->push_back(entity);
qDebug() << "EntityTreeElement::addEntityItem() AFTER _entityItems->push_back(entity); element=" << this << "entity=" << entity << "id=" << entity->getEntityItemID() << "bestFit=" << bestFitEntityBounds(entity);
}
// will average a "common reduced LOD view" from the the child elements...

View file

@ -159,7 +159,9 @@ void OctreeRenderer::render(RenderMode renderMode) {
RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, 0, 0, 0 };
if (_tree) {
_tree->lockForRead();
qDebug() << "OctreeRenderer::render() tree locked START RENDER RECURSION...";
_tree->recurseTreeWithOperation(renderOperation, &args);
qDebug() << "OctreeRenderer::render() tree locked ENDED RENDER RECURSION...";
_tree->unlock();
}
}

View file

@ -86,8 +86,14 @@ inline bool operator==(const AABox& a, const AABox& b) {
}
inline QDebug operator<<(QDebug debug, const AABox& box) {
debug << "AABox[ (" << box.getCorner().x << "," << box.getCorner().y << "," << box.getCorner().z << " ) to ("
<< box.calcTopFarLeft().x << "," << box.calcTopFarLeft().y << "," << box.calcTopFarLeft().z << ")]";
const int TREE_SCALE = 16384; // ~10 miles.. This is the number of meters of the 0.0 to 1.0 voxel universe
debug << "AABox[ ("
<< box.getCorner().x * (float)TREE_SCALE << "," << box.getCorner().y * (float)TREE_SCALE << "," << box.getCorner().z * (float)TREE_SCALE << " ) to ("
<< box.calcTopFarLeft().x * (float)TREE_SCALE << "," << box.calcTopFarLeft().y * (float)TREE_SCALE << "," << box.calcTopFarLeft().z * (float)TREE_SCALE << ") size: ("
<< box.getDimensions().x * (float)TREE_SCALE << "," << box.getDimensions().y * (float)TREE_SCALE << "," << box.getDimensions().z * (float)TREE_SCALE << ")"
<< "]";
return debug;
}

View file

@ -75,8 +75,12 @@ inline bool operator==(const AACube& a, const AACube& b) {
}
inline QDebug operator<<(QDebug debug, const AACube& cube) {
debug << "AACube[ (" << cube.getCorner().x << "," << cube.getCorner().y << "," << cube.getCorner().z << " ) to ("
<< cube.calcTopFarLeft().x << "," << cube.calcTopFarLeft().y << "," << cube.calcTopFarLeft().z << ")]";
const int TREE_SCALE = 16384; // ~10 miles.. This is the number of meters of the 0.0 to 1.0 voxel universe
debug << "AACube[ ("
<< cube.getCorner().x * (float)TREE_SCALE << "," << cube.getCorner().y * (float)TREE_SCALE << "," << cube.getCorner().z * (float)TREE_SCALE << " ) to ("
<< cube.calcTopFarLeft().x * (float)TREE_SCALE << "," << cube.calcTopFarLeft().y * (float)TREE_SCALE << "," << cube.calcTopFarLeft().z * (float)TREE_SCALE << ") size: ("
<< cube.getDimensions().x * (float)TREE_SCALE << "," << cube.getDimensions().y * (float)TREE_SCALE << "," << cube.getDimensions().z * (float)TREE_SCALE << ")"
<< "]";
return debug;
}