void SgMeshBase::updateBoundingBox() { if(!vertices_){ bbox.clear(); } else { BoundingBoxf bboxf; for(SgVertexArray::const_iterator p = vertices_->begin(); p != vertices_->end(); ++p){ bboxf.expandBy(*p); } bbox = bboxf; } }
void SgMesh::updateBoundingBox() { if(!USE_FACES_FOR_BOUNDING_BOX_CALCULATION){ SgMeshBase::updateBoundingBox(); } else { if(!hasVertices()){ bbox.clear(); } else { BoundingBoxf bboxf; const SgVertexArray& v = *vertices(); for(SgIndexArray::const_iterator iter = triangleVertices_.begin(); iter != triangleVertices_.end(); ++iter){ const Vector3f& p = v[*iter]; bboxf.expandBy(p); } bbox = bboxf; } } }