Exemplo n.º 1
0
void vesGroupNode::updateBounds(vesNode &child)
{
  if (!this->boundsDirty()) {
    return;
  }

  if (child.isOverlayNode()) {
    return;
  }

  // Make sure that child bounds are upto date
  child.computeBounds();

  vesVector3f min = child.boundsMinimum();
  vesVector3f max = child.boundsMaximum();

  for (int i = 0; i < 3; ++i) {
    if (max[i] > this->m_boundsMaximum[i]) {
      this->m_boundsMaximum[i] = max[i];
    }

    if (min[i] < this->m_boundsMinimum[i]) {
      this->m_boundsMinimum[i] = min[i];
    }
  }

  // Now update the bounds, bounds size and center.
  this->setBounds(this->m_boundsMinimum, this->m_boundsMaximum);
  this->setBoundsDirty(false);
  this->setParentBoundsDirty(true);
}
Exemplo n.º 2
0
void vesTransformNode::updateBounds(vesNode &child)
{
  if (!this->boundsDirty()) {
    return;
  }

  if (child.asTransformNode()
      && child.asTransformNode()->referenceFrame() == Absolute )
  {
    return;
  }

  if (child.isOverlayNode()) {
    return;
  }

  // Make sure that child bounds are upto date
  child.computeBounds();

  vesVector3f min = child.boundsMinimum();
  vesVector3f max = child.boundsMaximum();

  min = transformPoint3f(this->matrix(), min);
  max = transformPoint3f(this->matrix(), max);

  child.setBounds(min, max);

  for (int i = 0; i < 3; ++i) {
    if (max[i] > this->m_boundsMaximum[i]) {
      this->m_boundsMaximum[i] = max[i];
    }

    if (min[i] < this->m_boundsMinimum[i]) {
      this->m_boundsMinimum[i] = min[i];
    }
  }

  // Now update the bounds, bounds size and center.
  this->setBounds(this->m_boundsMinimum, this->m_boundsMaximum);
  this->setBoundsDirty(false);
  this->setParentBoundsDirty(true);
}