mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
Merge pull request #11480 from AndrewMeadows/fix-debug-build-20170928
fix interface crash in Debug build
This commit is contained in:
commit
60fe9ec5e9
2 changed files with 16 additions and 3 deletions
|
@ -278,9 +278,10 @@ Transform Line3DOverlay::evalRenderTransform() {
|
|||
auto endPos = getEnd();
|
||||
|
||||
auto vec = endPos - transform.getTranslation();
|
||||
auto scale = glm::length(vec);
|
||||
const float MIN_LINE_LENGTH = 0.0001f;
|
||||
auto scale = glm::max(glm::length(vec), MIN_LINE_LENGTH);
|
||||
auto dir = vec / scale;
|
||||
auto orientation = glm::rotation(glm::vec3(0,0,-1), dir);
|
||||
auto orientation = glm::rotation(glm::vec3(0.0f, 0.0f, -1.0f), dir);
|
||||
transform.setRotation(orientation);
|
||||
transform.setScale(scale);
|
||||
|
||||
|
|
|
@ -45,7 +45,19 @@ void Volume3DOverlay::setProperties(const QVariantMap& properties) {
|
|||
}
|
||||
|
||||
if (dimensions.isValid()) {
|
||||
setDimensions(vec3FromVariant(dimensions));
|
||||
glm::vec3 scale = vec3FromVariant(dimensions);
|
||||
// don't allow a zero or negative dimension component to reach the renderTransform
|
||||
const float MIN_DIMENSION = 0.0001f;
|
||||
if (scale.x < MIN_DIMENSION) {
|
||||
scale.x = MIN_DIMENSION;
|
||||
}
|
||||
if (scale.y < MIN_DIMENSION) {
|
||||
scale.y = MIN_DIMENSION;
|
||||
}
|
||||
if (scale.z < MIN_DIMENSION) {
|
||||
scale.z = MIN_DIMENSION;
|
||||
}
|
||||
setDimensions(scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue