mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-20 19:21:00 -06:00
Merge remote-tracking branch 'origin/master' into thesis/2021/skybrowser
# Conflicts: # data/assets/util/asset_helper.asset # data/assets/util/webgui.asset
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2021 *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
@@ -42,8 +42,8 @@
|
||||
#include <variant>
|
||||
|
||||
namespace {
|
||||
constexpr const std::array<const char*, 4> UniformNames = {
|
||||
"color", "opacity", "mvpMatrix", "tex"
|
||||
constexpr const std::array<const char*, 5> UniformNames = {
|
||||
"color", "opacity", "mvpMatrix", "tex", "backgroundColor"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo EnabledInfo = {
|
||||
@@ -107,6 +107,15 @@ namespace {
|
||||
"Useful for applying a color grayscale images."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo BackgroundColorInfo =
|
||||
{
|
||||
"BackgroundColor",
|
||||
"Background Color",
|
||||
"The fixed color that is combined with the screen space renderable to create the "
|
||||
"final color. The actual color of the screen space renderable is alpha-blended "
|
||||
"with the background color to produce the final result."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo OpacityInfo = {
|
||||
"Opacity",
|
||||
"Opacity",
|
||||
@@ -147,7 +156,6 @@ namespace {
|
||||
return glm::vec3(r, theta, phi);
|
||||
}
|
||||
|
||||
|
||||
glm::vec3 sphericalToCartesian(glm::vec3 spherical) {
|
||||
// First convert to ISO convention spherical coordinates according to
|
||||
// https://en.wikipedia.org/wiki/Spherical_coordinate_system
|
||||
@@ -254,6 +262,9 @@ namespace {
|
||||
// [[codegen::verbatim(MultiplyColorInfo.description)]]
|
||||
std::optional<glm::vec3> multiplyColor [[codegen::color()]];
|
||||
|
||||
// [[codegen::verbatim(BackgroundColorInfo.description)]]
|
||||
std::optional<glm::vec4> backgroundColor [[codegen::color()]];
|
||||
|
||||
// [codegen::verbatim(OpacityInfo.description)]]
|
||||
std::optional<float> opacity [[codegen::inrange(0.f, 1.f)]];
|
||||
|
||||
@@ -332,6 +343,7 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
|
||||
)
|
||||
, _scale(ScaleInfo, 0.25f, 0.f, 2.f)
|
||||
, _multiplyColor(MultiplyColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _backgroundColor(BackgroundColorInfo)
|
||||
, _opacity(OpacityInfo, 1.f, 0.f, 1.f)
|
||||
, _delete(DeleteInfo)
|
||||
{
|
||||
@@ -364,6 +376,7 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
|
||||
|
||||
addProperty(_scale);
|
||||
addProperty(_multiplyColor);
|
||||
addProperty(_backgroundColor);
|
||||
addProperty(_opacity);
|
||||
addProperty(_localRotation);
|
||||
|
||||
@@ -371,6 +384,9 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
|
||||
_multiplyColor = p.multiplyColor.value_or(_multiplyColor);
|
||||
_multiplyColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
|
||||
_backgroundColor = p.backgroundColor.value_or(_backgroundColor);
|
||||
_backgroundColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
|
||||
_enabled = p.enabled.value_or(_enabled);
|
||||
_useRadiusAzimuthElevation =
|
||||
p.useRadiusAzimuthElevation.value_or(_useRadiusAzimuthElevation);
|
||||
@@ -632,6 +648,8 @@ void ScreenSpaceRenderable::draw(glm::mat4 modelTransform) {
|
||||
|
||||
_shader->setUniform(_uniformCache.color, _multiplyColor);
|
||||
_shader->setUniform(_uniformCache.opacity, _opacity);
|
||||
_shader->setUniform(_uniformCache.backgroundColor, _backgroundColor);
|
||||
|
||||
_shader->setUniform(
|
||||
_uniformCache.mvp,
|
||||
global::renderEngine->scene()->camera()->viewProjectionMatrix() * modelTransform
|
||||
|
||||
Reference in New Issue
Block a user