mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-01 09:08:49 -06:00
Fixed bug in background color for atm. Adding option to enable/disable fade-in effect in DU objects. Updated Ghoul.
This commit is contained in:
@@ -128,15 +128,15 @@ return {
|
||||
Modules = {
|
||||
-- # Solar system objects
|
||||
"sun",
|
||||
--"mercury",
|
||||
--"venus",
|
||||
"mercury",
|
||||
"venus",
|
||||
"earth",
|
||||
"moon",
|
||||
"mars",
|
||||
--"jupiter",
|
||||
--"saturn",
|
||||
--"uranus",
|
||||
--"neptune",
|
||||
"jupiter",
|
||||
"saturn",
|
||||
"uranus",
|
||||
"neptune",
|
||||
-- "satellites",
|
||||
|
||||
"grids",
|
||||
|
||||
Submodule ext/ghoul updated: e50afc4291...499813d03e
@@ -688,8 +688,8 @@ void main() {
|
||||
}
|
||||
}
|
||||
else { // no intersection
|
||||
//discard;
|
||||
atmosphereFinalColor += vec4(HDR(color.xyz * backgroundConstant, atmExposure), color.a);
|
||||
discard;
|
||||
//atmosphereFinalColor += vec4(HDR(color.xyz * backgroundConstant, atmExposure), color.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,8 +169,14 @@ namespace {
|
||||
static const openspace::properties::Property::PropertyInfo FadeInThreshouldInfo = {
|
||||
"FadeInThreshould",
|
||||
"Fade-In Threshould",
|
||||
"This value determines percentage of the astronomical object is visible before starting "
|
||||
"fading-in it."
|
||||
"This value determines distance from the center of our galaxy from which the"
|
||||
"astronomical object is visible before starting fading-in it."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DisableFadeInInfo = {
|
||||
"DisableFadeIn",
|
||||
"Disable Fade-in effect",
|
||||
"Enables/Disables the Fade-in effect."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -284,6 +290,12 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() {
|
||||
Optional::Yes,
|
||||
FadeInThreshouldInfo.description
|
||||
},
|
||||
{
|
||||
DisableFadeInInfo.identifier,
|
||||
new BoolVerifier,
|
||||
Optional::Yes,
|
||||
DisableFadeInInfo.description
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -317,6 +329,8 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
|
||||
, _drawElements(DrawElementsInfo, true)
|
||||
, _drawLabels(DrawLabelInfo, false)
|
||||
, _colorOption(ColorOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _fadeInDistance(FadeInThreshouldInfo, 0.0, 0.1, 10.0)
|
||||
, _disableFadeInDistance(DisableFadeInInfo, false)
|
||||
, _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _polygonTexture(nullptr)
|
||||
, _spriteTexture(nullptr)
|
||||
@@ -357,6 +371,7 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
|
||||
_renderOption.addOption(1, "Camera Position Normal");
|
||||
_renderOption.addOption(2, "Screen center Position Normal");
|
||||
addProperty(_renderOption);
|
||||
_renderOption.set(1);
|
||||
|
||||
if (dictionary.hasKey(keyUnit)) {
|
||||
std::string unit = dictionary.value<std::string>(keyUnit);
|
||||
@@ -501,8 +516,10 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(FadeInThreshouldInfo.identifier)) {
|
||||
_fadeInThreshold = static_cast<float>(dictionary.value<double>(FadeInThreshouldInfo.identifier));
|
||||
_fadeInThreshold = static_cast<float>(dictionary.value<double>(FadeInThreshouldInfo.identifier));
|
||||
}
|
||||
addProperty(_fadeInDistance);
|
||||
addProperty(_disableFadeInDistance);
|
||||
}
|
||||
|
||||
bool RenderableBillboardsCloud::isReady() const {
|
||||
@@ -671,7 +688,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data, const g
|
||||
}
|
||||
|
||||
void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm::dmat4& modelViewProjectionMatrix,
|
||||
const glm::vec3& orthoRight, const glm::vec3& orthoUp) {
|
||||
const glm::vec3& orthoRight, const glm::vec3& orthoUp, const float fadeInVariable) {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
_fontRenderer->setFramebufferSize(renderEngine.renderingResolution());
|
||||
@@ -701,6 +718,8 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm::
|
||||
break;
|
||||
}
|
||||
|
||||
glm::vec4 textColor = _textColor;
|
||||
textColor.a *= fadeInVariable;
|
||||
for (const std::pair<glm::vec3, std::string>& pair : _labelData) {
|
||||
//glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0));
|
||||
glm::vec3 scaledPos(pair.first);
|
||||
@@ -794,7 +813,7 @@ void RenderableBillboardsCloud::render(const RenderData& data, RendererTasks&) {
|
||||
}
|
||||
|
||||
if (_drawLabels && _hasLabel) {
|
||||
renderLabels(data, modelViewProjectionMatrix, orthoRight, orthoUp);
|
||||
renderLabels(data, modelViewProjectionMatrix, orthoRight, orthoUp, fadeInVariable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
const glm::dmat4& projectionMatrix, const glm::vec3& orthoRight, const glm::vec3& orthoUp,
|
||||
const float fadeInVariable);
|
||||
void renderLabels(const RenderData& data, const glm::dmat4& modelViewProjectionMatrix,
|
||||
const glm::vec3& orthoRight, const glm::vec3& orthoUp);
|
||||
const glm::vec3& orthoRight, const glm::vec3& orthoUp, const float fadeInVariable);
|
||||
|
||||
bool loadData();
|
||||
bool readSpeckFile();
|
||||
@@ -125,6 +125,8 @@ private:
|
||||
properties::BoolProperty _drawElements;
|
||||
properties::BoolProperty _drawLabels;
|
||||
properties::OptionProperty _colorOption;
|
||||
properties::FloatProperty _fadeInDistance;
|
||||
properties::BoolProperty _disableFadeInDistance;
|
||||
|
||||
// DEBUG:
|
||||
properties::OptionProperty _renderOption;
|
||||
|
||||
@@ -310,6 +310,7 @@ RenderablePlanesCloud::RenderablePlanesCloud(const ghoul::Dictionary& dictionary
|
||||
_renderOption.addOption(1, "Camera Position Normal");
|
||||
_renderOption.addOption(2, "Screen center Position Normal");
|
||||
addProperty(_renderOption);
|
||||
_renderOption.set(1);
|
||||
|
||||
if (dictionary.hasKey(keyUnit)) {
|
||||
std::string unit = dictionary.value<std::string>(keyUnit);
|
||||
@@ -648,7 +649,7 @@ void RenderablePlanesCloud::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
float fadeInVariable = 1.0f;
|
||||
if (_fadeInThreshold > 0.0) {
|
||||
float distCamera = glm::distance(data.camera.positionVec3(), data.position.dvec3());
|
||||
float distCamera = glm::length(data.camera.positionVec3());
|
||||
double term = std::exp(distCamera / scale - _fadeInThreshold);
|
||||
float func = static_cast<float>(term / (term + 1.0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user