C++ (Cpp) vesNode Example

Introduction

The c++ (cpp) vesnode example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: C++ (Cpp)

Class/type: vesNode

Example#1

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);
}

Example#2
File: vesTransformNode.cppProject: 151706061/ves

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);
}