mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Some changes to PR #432
This commit is contained in:
@@ -236,11 +236,15 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
_texturePath.onChange([this]() { loadTexture(); });
|
||||
|
||||
if (dictionary.hasKey(FadeOutThreshouldInfo.identifier)) {
|
||||
_fadeOutThreshold = static_cast<float>(dictionary.value<double>(FadeOutThreshouldInfo.identifier));
|
||||
_fadeOutThreshold = static_cast<float>(
|
||||
dictionary.value<double>(FadeOutThreshouldInfo.identifier)
|
||||
);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(FadeInThreshouldInfo.identifier)) {
|
||||
_fadeInThreshold = static_cast<float>(dictionary.value<double>(FadeInThreshouldInfo.identifier));
|
||||
_fadeInThreshold = static_cast<float>(
|
||||
dictionary.value<double>(FadeInThreshouldInfo.identifier)
|
||||
);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(FadeOutThreshouldInfo.identifier) ||
|
||||
@@ -299,14 +303,21 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
if (_fadeInThreshold > 0.0) {
|
||||
float distCamera = glm::length(data.camera.positionVec3());
|
||||
float funcValue = static_cast<float>((1.0 / double(_fadeInThreshold/1E24))*(distCamera / 1E24));
|
||||
float funcValue = static_cast<float>(
|
||||
(1.0 / double(_fadeInThreshold/1E24))*(distCamera / 1E24)
|
||||
);
|
||||
|
||||
adjustedTransparency *= funcValue > 1.0 ? 1.0 : funcValue;
|
||||
}
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
float distCamera = glm::distance(data.camera.positionVec3(), data.position.dvec3());
|
||||
double term = std::exp((-distCamera + _size * _fadeOutThreshold) / (_size * _fadeOutThreshold));
|
||||
float distCamera = glm::distance(
|
||||
data.camera.positionVec3(),
|
||||
data.position.dvec3()
|
||||
);
|
||||
double term = std::exp(
|
||||
(-distCamera + _size * _fadeOutThreshold) / (_size * _fadeOutThreshold)
|
||||
);
|
||||
|
||||
adjustedTransparency *= static_cast<float>(term / (term + 1.0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user