mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-04 09:59:44 -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() {
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
bool getVertices(std::vector<Vertex>* vertexList);
|
||||
bool getIndices(std::vector<int>* indexList);
|
||||
|
||||
double boundingRadius() const;
|
||||
|
||||
virtual void setUniforms(ghoul::opengl::ProgramObject& program);
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user