Set model boundingsphere in initialize instead of update

This commit is contained in:
Malin E
2023-04-03 11:31:49 +02:00
parent be1b820173
commit 6c56630217
+4 -6
View File
@@ -631,6 +631,10 @@ void RenderableModel::initializeGL() {
// Initialize geometry
_geometry->initialize();
_geometry->calculateBoundingRadius();
setBoundingSphere(_geometry->boundingRadius() * _modelScale);
// Set Interaction sphere size to be 10% of the bounding sphere
setInteractionSphere(_boundingSphere * 0.1);
}
void RenderableModel::deinitializeGL() {
@@ -916,12 +920,6 @@ void RenderableModel::update(const UpdateData& data) {
ghoul::opengl::updateUniformLocations(*_program, _uniformCache, UniformNames);
}
setBoundingSphere(_geometry->boundingRadius() * _modelScale *
glm::compMax(data.modelTransform.scale)
);
// Set Interaction sphere size to be 10% of the bounding sphere
setInteractionSphere(_boundingSphere * 0.1);
if (_geometry->hasAnimation() && !_animationStart.empty()) {
double relativeTime;
double now = data.time.j2000Seconds();