fix bug where entities that were children of avatars wouldn't be included in entity-server packets to interfaces

This commit is contained in:
Seth Alves 2016-01-20 19:03:41 -08:00
parent 9c270822e4
commit 1fef78f60f
3 changed files with 28 additions and 21 deletions

View file

@ -1186,6 +1186,8 @@ void EntityItem::setDimensions(const glm::vec3& value) {
/// This accounts for the registration point (upon which rotation occurs around).
///
AACube EntityItem::getMaximumAACube(bool& success) const {
assert(!getTree() || !getTree()->getIsServer()); // the entity-server can't reliably use this method.
if (_recalcMaxAACube) {
// * we know that the position is the center of rotation
glm::vec3 centerOfRotation = getPosition(success); // also where _registration point is
@ -1218,6 +1220,8 @@ AACube EntityItem::getMaximumAACube(bool& success) const {
/// This accounts for the registration point (upon which rotation occurs around).
///
AACube EntityItem::getMinimumAACube(bool& success) const {
assert(!getTree() || !getTree()->getIsServer()); // the entity-server can't reliably use this method.
if (_recalcMinAACube) {
// _position represents the position of the registration point.
glm::vec3 registrationRemainder = glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint;
@ -1249,6 +1253,8 @@ AACube EntityItem::getMinimumAACube(bool& success) const {
}
AABox EntityItem::getAABox(bool& success) const {
assert(!getTree() || !getTree()->getIsServer()); // the entity-server can't reliably use this method.
if (_recalcAABox) {
// _position represents the position of the registration point.
glm::vec3 registrationRemainder = glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint;

View file

@ -218,7 +218,13 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
QString collisionSoundURLBefore = entity->getCollisionSoundURL();
uint32_t preFlags = entity->getDirtyFlags();
UpdateEntityOperator theOperator(getThisPointer(), containingElement, entity, properties.getQueryAACube());
AACube newQueryAACube;
if (properties.queryAACubeChanged()) {
newQueryAACube = properties.getQueryAACube();
} else {
newQueryAACube = entity->getQueryAACube();
}
UpdateEntityOperator theOperator(getThisPointer(), containingElement, entity, newQueryAACube);
recurseTreeWithOperator(&theOperator);
entity->setProperties(properties);

View file

@ -309,29 +309,24 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
}
// Now check the size of the entity, it's possible that a "too small to see" entity is included in a
// larger octree cell because of it's position (for example if it crosses the boundary of a cell it
// pops to the next higher cell. So we want to check to see that the entity is large enough to be seen
// larger octree cell because of its position (for example if it crosses the boundary of a cell it
// pops to the next higher cell. So we want to check to see that the entity is large enough to be seen
// before we consider including it.
if (includeThisEntity) {
AABox entityBounds = entity->getAABox(success);
if (success) {
auto renderAccuracy = params.viewFrustum->calculateRenderAccuracy(entityBounds,
params.octreeElementSizeScale, params.boundaryLevelAdjust);
AABox entityBounds = AABox(entityCube);
auto renderAccuracy = params.viewFrustum->calculateRenderAccuracy(entityBounds,
params.octreeElementSizeScale,
params.boundaryLevelAdjust);
if (renderAccuracy <= 0.0f) {
includeThisEntity = false; // too small, don't include it
if (renderAccuracy <= 0.0f) {
includeThisEntity = false; // too small, don't include it
#ifdef WANT_LOD_DEBUGGING
qDebug() << "skipping entity - TOO SMALL - \n"
<< "......id:" << entity->getID() << "\n"
<< "....name:" << entity->getName() << "\n"
<< "..bounds:" << entityBounds << "\n"
<< "....cell:" << getAACube();
#endif
}
} else {
includeThisEntity = false; // couldn't get box, don't include it
#ifdef WANT_LOD_DEBUGGING
qDebug() << "skipping entity - TOO SMALL - \n"
<< "......id:" << entity->getID() << "\n"
<< "....name:" << entity->getName() << "\n"
<< "..bounds:" << entityBounds << "\n"
<< "....cell:" << getAACube();
#endif
}
}
}