diff --git a/data/assets/base.asset b/data/assets/base.asset index a758852399..3ab8f33d97 100644 --- a/data/assets/base.asset +++ b/data/assets/base.asset @@ -15,6 +15,7 @@ asset.require('scene/solarsystem/planets') asset.require('scene/solarsystem/planets/mars/moons/phobos') asset.require('scene/solarsystem/planets/mars/moons/deimos') asset.require('scene/solarsystem/dwarf_planets/pluto/system') +asset.request('scene/milkyway/milkyway/volume') assetHelper.requestAll(asset, 'scene/digitaluniverse') @@ -26,7 +27,6 @@ asset.require('util/default_joystick') -- Load web gui asset.require('util/webgui') -asset.request('customization/globebrowsing') asset.request('customization/volumes') -- Keybindings that are specific for this scene diff --git a/data/assets/customization/volumes.asset b/data/assets/scene/milkyway/milkyway/volume.asset similarity index 61% rename from data/assets/customization/volumes.asset rename to data/assets/scene/milkyway/milkyway/volume.asset index ad53d6ac6b..0f0fb1f399 100644 --- a/data/assets/customization/volumes.asset +++ b/data/assets/scene/milkyway/milkyway/volume.asset @@ -16,22 +16,22 @@ local MilkyWayVolumeGalaxy = { Renderable = { Type = "RenderableGalaxy", StepSize = 0.01, - AbsorptionMultiply = 75, - EmissionMultiply = 200, - Translation = {0.2, 0, 0}, + AbsorptionMultiply = 75, + EmissionMultiply = 200, + Translation = {0.2, 0, 0}, Rotation = {3.1415926, 3.1248, 4.45741}, Volume = { - Type = "Volume", - Filename = data .. "/MilkyWayRGBAVolume1024x1024x128.raw", - Dimensions = {1024, 1024, 128}, - Size = {1.2E21, 1.2E21, 0.15E21} - }, - Points = { - Type = "Points", - Filename = data .. "/MilkyWayPoints.off", - EnabledPointsRatio = 0.3, - Texture = data .. "/halo.png" - } + Type = "Volume", + Filename = data .. "/MilkyWayRGBAVolume1024x1024x128.raw", + Dimensions = {1024, 1024, 128}, + Size = {1.2E21, 1.2E21, 0.15E21} + }, + Points = { + Type = "Points", + Filename = data .. "/MilkyWayPoints.off", + EnabledPointsRatio = 0.3, + Texture = data .. "/halo.png" + } }, GUI = { Path = "/Milky Way" diff --git a/modules/base/shaders/model_fs.glsl b/modules/base/shaders/model_fs.glsl index db7eea1c32..b4bd1fd9ec 100644 --- a/modules/base/shaders/model_fs.glsl +++ b/modules/base/shaders/model_fs.glsl @@ -84,7 +84,7 @@ Fragment getFragment() { frag.color.rgb = diffuseAlbedo; } - frag.color.a = opacity; + frag.color.a = opacity; frag.depth = vs_screenSpaceDepth; frag.gPosition = vs_positionCameraSpace; frag.gNormal = vec4(vs_normalViewSpace, 0.0); diff --git a/modules/galaxy/include.cmake b/modules/galaxy/include.cmake index 8216f1c090..586a4f7717 100644 --- a/modules/galaxy/include.cmake +++ b/modules/galaxy/include.cmake @@ -1,3 +1,5 @@ +set(DEFAULT_MODULE ON) + set (OPENSPACE_DEPENDENCIES volume space diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index 40877451ef..14f87d7cc9 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -108,7 +108,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo StarRenderingMethodInfo = { "StarRenderingMethod", "Star Rendering Method", - "This value determines which rendering method is used for visualization of the stars." + "This value determines which rendering method is used for visualization of the " + "stars." }; constexpr openspace::properties::Property::PropertyInfo EnabledPointsRatioInfo = { @@ -127,7 +128,10 @@ namespace openspace { , _stepSize(StepSizeInfo, 0.01f, 0.0005f, 0.05f, 0.001f) , _absorptionMultiply(AbsorptionMultiplyInfo, 40.f, 0.0f, 100.0f) , _emissionMultiply(EmissionMultiplyInfo, 400.f, 0.0f, 1000.0f) - , _starRenderingMethod(StarRenderingMethodInfo, properties::OptionProperty::DisplayType::Dropdown) + , _starRenderingMethod( + StarRenderingMethodInfo, + properties::OptionProperty::DisplayType::Dropdown + ) , _enabledPointsRatio(EnabledPointsRatioInfo, 0.5f, 0.01f, 1.0f) , _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(1.f)) , _rotation(RotationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(6.28f)) @@ -143,7 +147,9 @@ namespace openspace { dictionary.getValue("Rotation", _rotation); if (dictionary.hasKeyAndValue(VolumeRenderingEnabledInfo.identifier)) { - _volumeRenderingEnabled = dictionary.value(VolumeRenderingEnabledInfo.identifier); + _volumeRenderingEnabled = dictionary.value( + VolumeRenderingEnabledInfo.identifier + ); } if (dictionary.hasKeyAndValue(StarRenderingEnabledInfo.identifier)) { @@ -155,21 +161,25 @@ namespace openspace { } if (dictionary.hasKeyAndValue(AbsorptionMultiplyInfo.identifier)) { - _absorptionMultiply = static_cast(dictionary.value(AbsorptionMultiplyInfo.identifier)); + _absorptionMultiply = static_cast( + dictionary.value(AbsorptionMultiplyInfo.identifier) + ); } if (dictionary.hasKeyAndValue(EmissionMultiplyInfo.identifier)) { - _emissionMultiply = static_cast(dictionary.value(EmissionMultiplyInfo.identifier)); + _emissionMultiply = static_cast( + dictionary.value(EmissionMultiplyInfo.identifier) + ); } _starRenderingMethod.addOptions({ - { 0, "Points" }, - { 1, "Billboards" } - }); + { 0, "Points" }, + { 1, "Billboards" } + }); if (dictionary.hasKey(StarRenderingMethodInfo.identifier)) { const std::string starRenderingMethod = dictionary.value( StarRenderingMethodInfo.identifier - ); + ); if (starRenderingMethod == "Points") { _starRenderingMethod = 0; } @@ -195,13 +205,15 @@ namespace openspace { std::string volumeFilename; if (volumeDictionary.getValue("Filename", volumeFilename)) { _volumeFilename = absPath(volumeFilename); - } else { + } + else { LERROR("No volume filename specified."); } glm::vec3 volumeDimensions; if (volumeDictionary.getValue("Dimensions", volumeDimensions)) { _volumeDimensions = static_cast(volumeDimensions); - } else { + } + else { LERROR("No volume dimensions specified."); } glm::vec3 volumeSize; @@ -220,18 +232,23 @@ namespace openspace { std::string pointsFilename; if (pointsDictionary.getValue("Filename", pointsFilename)) { _pointsFilename = absPath(pointsFilename); - } else { + } + else { LERROR("No points filename specified."); } if (pointsDictionary.hasKeyAndValue(EnabledPointsRatioInfo.identifier)) { - _enabledPointsRatio = static_cast(pointsDictionary.value(EnabledPointsRatioInfo.identifier)); + _enabledPointsRatio = static_cast( + pointsDictionary.value(EnabledPointsRatioInfo.identifier) + ); } std::string pointSpreadFunctionTexturePath; if (pointsDictionary.getValue("Texture", pointSpreadFunctionTexturePath)) { _pointSpreadFunctionTexturePath = absPath(pointSpreadFunctionTexturePath); - _pointSpreadFunctionFile = std::make_unique(_pointSpreadFunctionTexturePath); + _pointSpreadFunctionFile = std::make_unique( + _pointSpreadFunctionTexturePath + ); } else { LERROR("No points filename specified."); @@ -326,8 +343,16 @@ void RenderableGalaxy::initializeGL() { ); } - ghoul::opengl::updateUniformLocations(*_pointsProgram, _uniformCachePoints, UniformNamesPoints); - ghoul::opengl::updateUniformLocations(*_billboardsProgram, _uniformCacheBillboards, UniformNamesBillboards); + ghoul::opengl::updateUniformLocations( + *_pointsProgram, + _uniformCachePoints, + UniformNamesPoints + ); + ghoul::opengl::updateUniformLocations( + *_billboardsProgram, + _uniformCacheBillboards, + UniformNamesBillboards + ); _pointsProgram->setIgnoreUniformLocationError( ghoul::opengl::ProgramObject::IgnoreError::Yes @@ -357,7 +382,10 @@ void RenderableGalaxy::initializeGL() { // Read points float x, y, z, r, g, b, a; - for (size_t i = 0; i < static_cast(_nPoints * _enabledPointsRatio.maxValue()) + 1; ++i) { + for (size_t i = 0; + i < static_cast(_nPoints * _enabledPointsRatio.maxValue()) + 1; + ++i) + { std::getline(pointFile, line); std::istringstream issp(line); issp >> x >> y >> z >> r >> g >> b >> a; @@ -472,7 +500,8 @@ void RenderableGalaxy::render(const RenderData& data, RendererTasks& tasks) { if (length < lowerRampStart) { opacityCoefficient = 0.f; // camera really close } else if (length < lowerRampEnd) { - opacityCoefficient = (length - lowerRampStart) / (lowerRampEnd - lowerRampStart); + opacityCoefficient = (length - lowerRampStart) / + (lowerRampEnd - lowerRampStart); } else if (length < upperRampStart) { opacityCoefficient = 1.f; // sweet spot (max) } else if (length < upperRampEnd) { @@ -530,9 +559,13 @@ void RenderableGalaxy::renderPoints(const RenderData& data) { _pointsProgram->activate(); - glm::dmat4 rotMatrix = glm::rotate(glm::dmat4(1.0), 3.1415926, glm::dvec3(1.0, 0.0, 0.0)) * - glm::rotate(glm::dmat4(1.0), 3.1248, glm::dvec3(0.0, 1.0, 0.0)) * - glm::rotate(glm::dmat4(1.0), 4.45741, glm::dvec3(0.0, 0.0, 1.0)); + glm::dmat4 rotMatrix = glm::rotate( + glm::dmat4(1.0), + glm::pi(), + glm::dvec3(1.0, 0.0, 0.0)) * + glm::rotate(glm::dmat4(1.0), 3.1248, glm::dvec3(0.0, 1.0, 0.0)) * + glm::rotate(glm::dmat4(1.0), 4.45741, glm::dvec3(0.0, 0.0, 1.0) + ); glm::dmat4 modelMatrix = glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * @@ -551,10 +584,14 @@ void RenderableGalaxy::renderPoints(const RenderData& data) { ); glm::dvec3 eyePosition = glm::dvec3( - glm::inverse(data.camera.combinedViewMatrix()) * glm::dvec4(0.0, 0.0, 0.0, 1.0) + glm::inverse(data.camera.combinedViewMatrix()) * + glm::dvec4(0.0, 0.0, 0.0, 1.0) ); _pointsProgram->setUniform(_uniformCachePoints.eyePosition, eyePosition); - _pointsProgram->setUniform(_uniformCachePoints.opacityCoefficient, _opacityCoefficient); + _pointsProgram->setUniform( + _uniformCachePoints.opacityCoefficient, + _opacityCoefficient + ); glBindVertexArray(_pointsVao); glDrawArrays(GL_POINTS, 0, static_cast(_nPoints * _enabledPointsRatio)); @@ -600,9 +637,13 @@ void RenderableGalaxy::renderBillboards(const RenderData& data) { _billboardsProgram->activate(); - glm::dmat4 rotMatrix = glm::rotate(glm::dmat4(1.0), 3.1415926, glm::dvec3(1.0, 0.0, 0.0)) * - glm::rotate(glm::dmat4(1.0), 3.1248, glm::dvec3(0.0, 1.0, 0.0)) * - glm::rotate(glm::dmat4(1.0), 4.45741, glm::dvec3(0.0, 0.0, 1.0)); + glm::dmat4 rotMatrix = glm::rotate( + glm::dmat4(1.0), + glm::pi(), + glm::dvec3(1.0, 0.0, 0.0)) * + glm::rotate(glm::dmat4(1.0), 3.1248, glm::dvec3(0.0, 1.0, 0.0)) * + glm::rotate(glm::dmat4(1.0), 4.45741, glm::dvec3(0.0, 0.0, 1.0) + ); glm::dmat4 modelMatrix = glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * @@ -621,7 +662,8 @@ void RenderableGalaxy::renderBillboards(const RenderData& data) { ); glm::dvec3 eyePosition = glm::dvec3( - glm::inverse(data.camera.combinedViewMatrix()) * glm::dvec4(0.0, 0.0, 0.0, 1.0) + glm::inverse(data.camera.combinedViewMatrix()) * + glm::dvec4(0.0, 0.0, 0.0, 1.0) ); _billboardsProgram->setUniform(_uniformCacheBillboards.eyePosition, eyePosition);