mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Fixed issue.
This commit is contained in:
@@ -362,48 +362,49 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
float adjustedTransparency = _opacity;
|
||||
|
||||
if (_fadeInThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeInThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
if (!_disableFadeInDistance) {
|
||||
if (_fadeInThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeInThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= fadeFactor;
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= fadeFactor;
|
||||
}
|
||||
else if (logDistCamera <= startLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
}
|
||||
}
|
||||
else if (logDistCamera <= startLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= (1.f - fadeFactor);
|
||||
}
|
||||
else if (logDistCamera >= stopLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
const float logDistCamera = glm::log(static_cast<float>(
|
||||
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
|
||||
));
|
||||
const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold);
|
||||
const float stopLogFadeDistance = startLogFadeDistance + 1.f;
|
||||
|
||||
if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) {
|
||||
const float fadeFactor = glm::clamp(
|
||||
(logDistCamera - startLogFadeDistance) /
|
||||
(stopLogFadeDistance - startLogFadeDistance),
|
||||
0.f,
|
||||
1.f
|
||||
);
|
||||
adjustedTransparency *= (1.f - fadeFactor);
|
||||
}
|
||||
else if (logDistCamera >= stopLogFadeDistance) {
|
||||
adjustedTransparency = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
// Performance wise
|
||||
if (adjustedTransparency < 0.01f) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user