Merge remote-tracking branch 'origin/master' into issue/997

# Conflicts:
#	data/assets/scene/solarsystem/planets/mercury/mercury.asset
This commit is contained in:
Alexander Bock
2020-07-31 15:02:30 +02:00
8 changed files with 50 additions and 32 deletions

View File

@@ -58,10 +58,12 @@ asset.onInitialize(function ()
-- Add local patches described at the top of this file
for obj, list in pairs(vrt_folders) do
for _, dir in pairs(list) do
openspace.globebrowsing.addBlendingLayersFromDirectory(dir, obj)
if (dir ~= '') then
openspace.globebrowsing.addBlendingLayersFromDirectory(dir, obj)
if CreateFocusNodes then
openspace.globebrowsing.addFocusNodesFromDirectory(dir, obj)
if CreateFocusNodes then
openspace.globebrowsing.addFocusNodesFromDirectory(dir, obj)
end
end
end
end

View File

@@ -58,7 +58,7 @@ local sunstar = {
MagnitudeExponent = 6.2,
SizeComposition = "Distance Modulus",
RenderMethod = "Texture Based", -- or PSF
FadeInDistances = {0.0001, 0.1}
FadeInDistances = { 0.0001, 0.1 }
},
GUI = {
Name = "Sun",

View File

@@ -24,6 +24,7 @@ local initializeAndAddNodes = function()
local iss = {
Identifier = "ISS",
Parent = transforms.EarthInertial.Identifier,
BoundingSphere = 30,
Transform = {
Translation = {
Type = "TLETranslation",

View File

@@ -187,11 +187,10 @@ private:
glm::dmat3 _worldRotationCached = glm::dmat3(1.0);
glm::dvec3 _worldScaleCached = glm::dvec3(1.0);
float _fixedBoundingSphere = 0.f;
glm::dmat4 _modelTransformCached = glm::dmat4(1.0);
glm::dmat4 _inverseModelTransformCached = glm::dmat4(1.0);
properties::FloatProperty _boundingSphere;
properties::BoolProperty _computeScreenSpaceValues;
properties::IVec2Property _screenSpacePosition;
properties::BoolProperty _screenVisibility;

View File

@@ -424,7 +424,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
glm::vec2(-10.f, -10.f),
glm::vec2(10.f, 10.f)
)
, _fixedColor(FixedColorInfo, glm::vec4(1.f), glm::vec4(0.f), glm::vec4(1.f))
, _fixedColor(FixedColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
, _filterOutOfRange(FilterOutOfRangeInfo, false)
, _pointSpreadFunctionTexturePath(PsfTextureInfo)
, _psfMethodOption(

View File

@@ -33,7 +33,7 @@
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/vector/vec2property.h>
#include <openspace/properties/vector/vec4property.h>
#include <openspace/properties/vector/vec3property.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/opengl/uniformcache.h>
#include <optional>
@@ -98,7 +98,7 @@ private:
properties::StringProperty _otherDataColorMapPath;
properties::Vec2Property _otherDataRange;
std::unique_ptr<ghoul::opengl::Texture> _otherDataColorMapTexture;
properties::Vec4Property _fixedColor;
properties::Vec3Property _fixedColor;
properties::BoolProperty _filterOutOfRange;
properties::StringProperty _pointSpreadFunctionTexturePath;
std::unique_ptr<ghoul::opengl::Texture> _pointSpreadFunctionTexture;

View File

@@ -36,7 +36,7 @@ uniform sampler1D colorTexture;
uniform sampler2D psfTexture;
uniform float alphaValue;
uniform vec4 fixedColor;
uniform vec3 fixedColor;
uniform int colorOption;
@@ -93,17 +93,13 @@ Fragment getFragment() {
}
break;
case COLOROPTION_FIXEDCOLOR:
color = fixedColor;
color = vec4(fixedColor, 1.0);
break;
}
vec4 textureColor = texture(psfTexture, 0.5 * psfCoords + 0.5);
vec4 fullColor = vec4(color.rgb, textureColor.a);
fullColor.a *= alphaValue;
if (colorOption == COLOROPTION_FIXEDCOLOR) {
fullColor.a *= fixedColor.a;
}
if (fullColor.a == 0) {
discard;

View File

@@ -56,7 +56,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo ComputeScreenSpaceInfo =
{
"ComputeScreenSpaceData",
"Screen Space Data",
"Compute Screen Space Data",
"If this value is set to 'true', the screenspace-based properties are calculated "
"at regular intervals. If these values are set to 'false', they are not updated."
};
@@ -64,35 +64,43 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo ScreenSpacePositionInfo = {
"ScreenSpacePosition",
"ScreenSpacePosition",
"" // @TODO Missing documentation
"The x,y position in screen space. Can be used for placing GUI elements",
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo ScreenVisibilityInfo = {
"ScreenVisibility",
"ScreenVisibility",
"" // @TODO Missing documentation
"Determines if the node is currently visible on screen",
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo DistanceFromCamToNodeInfo = {
"DistanceFromCamToNode",
"DistanceFromCamToNode",
"" // @TODO Missing documentation
"The distance from the camera to the node surface",
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo ScreenSizeRadiusInfo = {
"ScreenSizeRadius",
"ScreenSizeRadius",
"" // @TODO Missing documentation
"The screen size of the radius of the node",
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo VisibilityDistanceInfo = {
"VisibilityDistance",
"VisibilityDistance",
"" // @TODO Missing documentation
"The distace in world coordinates between node and camera "
"at which the screenspace object will become visible",
openspace::properties::Property::Visibility::Hidden
};
constexpr const char* KeyFixedBoundingSphere = "FixedBoundingSphere";
constexpr openspace::properties::Property::PropertyInfo BoundingSphereInfo = {
"BoundingSphere",
"Bounding Sphere",
"The bounding sphere of the scene graph node. This can be the "
"bounding sphere of a renderable or a fixed bounding sphere. "
"bounding sphere of an attached renderable or directly specified to the node. "
"If there is a boundingsphere on both the renderable and the node, the largest "
"number will be picked.",
openspace::properties::Property::Visibility::Hidden
};
constexpr openspace::properties::Property::PropertyInfo GuiPathInfo = {
@@ -155,6 +163,11 @@ std::unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
result->addProperty(result->_guiHidden);
}
if (dictionary.hasKey(BoundingSphereInfo.identifier)) {
result->_boundingSphere = dictionary.value<float>(BoundingSphereInfo.identifier);
result->_boundingSphere.setVisibility(properties::Property::Visibility::All);
}
if (dictionary.hasKey(KeyTransformTranslation)) {
ghoul::Dictionary translationDictionary;
dictionary.getValue(KeyTransformTranslation, translationDictionary);
@@ -246,6 +259,19 @@ std::unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
LDEBUG(fmt::format(
"Successfully created renderable for '{}'", result->identifier()
));
// If the renderable child has a larger bounding sphere, we allow it tooverride
if (result->_renderable->boundingSphere() > result->_boundingSphere) {
result->_boundingSphere = result->_renderable->boundingSphere();
if (dictionary.hasKey(BoundingSphereInfo.identifier)) {
LWARNING(fmt::format(
"The specified property 'BoundingSphere' for '{}' was overwritten "
"by a child renderable",
result->_identifier
));
}
}
}
if (dictionary.hasKey(KeyTag)) {
@@ -273,11 +299,6 @@ std::unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
result->addProperty(result->_guiPath);
}
if (dictionary.hasKey(KeyFixedBoundingSphere)) {
result->_fixedBoundingSphere = static_cast<float>(
dictionary.value<double>(KeyFixedBoundingSphere)
);
}
LDEBUG(fmt::format("Successfully created SceneGraphNode '{}'", result->identifier()));
@@ -295,6 +316,7 @@ SceneGraphNode::SceneGraphNode()
std::make_unique<StaticRotation>(),
std::make_unique<StaticScale>()
}
, _boundingSphere(properties::FloatProperty(BoundingSphereInfo, 0.f))
, _computeScreenSpaceValues(ComputeScreenSpaceInfo, false)
, _screenSpacePosition(
properties::IVec2Property(ScreenSpacePositionInfo, glm::ivec2(-1, -1))
@@ -310,6 +332,7 @@ SceneGraphNode::SceneGraphNode()
addProperty(_distFromCamToNode);
addProperty(_screenSizeRadius);
addProperty(_visibilityDistance);
addProperty(_boundingSphere);
}
SceneGraphNode::~SceneGraphNode() {} // NOLINT
@@ -905,10 +928,7 @@ std::vector<SceneGraphNode*> SceneGraphNode::children() const {
}
float SceneGraphNode::boundingSphere() const {
if (_renderable) {
return _renderable->boundingSphere();
}
return _fixedBoundingSphere;
return _boundingSphere;
}
// renderable