bool EditorUtility::calculateMeshBounds(const HSceneObject& object, AABox& bounds) { bounds = AABox(Vector3::ZERO, Vector3::ZERO); if (object.isDestroyed()) return false; bool foundOne = false; const Vector<HComponent>& components = object->getComponents(); for (auto& component : components) { Bounds curBounds; if (component->calculateBounds(curBounds)) { if (!foundOne) { bounds = curBounds.getBox(); foundOne = true; } else bounds.merge(curBounds.getBox()); } else { if (!foundOne) bounds = curBounds.getBox(); } } return foundOne; }
void ScriptMesh::internal_GetBounds(ScriptMesh* thisPtr, AABox* box, Sphere* sphere) { HMesh mesh = thisPtr->getHandle(); Bounds bounds = mesh->getProperties().getBounds(); *box = bounds.getBox(); *sphere = bounds.getSphere(); }