mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-25 05:28:37 -05:00
Set bounding sphere of RenderableModelProjection based on its geometry
This commit is contained in:
@@ -90,6 +90,21 @@ ModelGeometry::ModelGeometry(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_magnification);
|
||||
}
|
||||
|
||||
double ModelGeometry::boundingRadius() const {
|
||||
double maxDistSquared = 0;
|
||||
double distSquared;
|
||||
for (const Vertex& v : _vertices) {
|
||||
distSquared = // x*x + y*y + z*z
|
||||
v.location[0] * v.location[0] +
|
||||
v.location[1] * v.location[1] +
|
||||
v.location[2] * v.location[2];
|
||||
maxDistSquared = glm::max(maxDistSquared, distSquared);
|
||||
}
|
||||
double maxDist = std::sqrt(maxDistSquared);
|
||||
return maxDist;
|
||||
}
|
||||
|
||||
|
||||
ModelGeometry::~ModelGeometry() {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user