Merge pull request #2782 from OpenSpace/issue/1867

Add border to screenspace renderables
This commit is contained in:
Ylva Selling
2023-06-28 17:14:37 -04:00
committed by GitHub
6 changed files with 61 additions and 9 deletions
+10
View File
@@ -33,6 +33,8 @@ uniform vec3 color = vec3(1.0);
uniform float opacity = 1.0;
uniform vec4 backgroundColor = vec4(0.0);
uniform float gamma = 1.0;
uniform vec2 borderWidth = vec2(0.1);
uniform vec3 borderColor = vec3(0.0);
Fragment getFragment() {
@@ -41,6 +43,14 @@ Fragment getFragment() {
vec4 texColor = texture(tex, vs_st) * vec4(color, opacity);
frag.color = texColor.a * texColor + (1.0 - texColor.a) * backgroundColor;
// Set border color
if (vs_st.x < borderWidth.x || vs_st.x > 1 - borderWidth.x ||
vs_st.y < borderWidth.y || vs_st.y > 1 - borderWidth.y)
{
frag.color = vec4(borderColor, 1.0);
}
if (frag.color.a == 0.0) {
discard;
}
+1 -1
View File
@@ -76,7 +76,7 @@ protected:
properties::DoubleProperty _verticalFov;
double _borderRadius = 0.0;
glm::ivec3 _borderColor = glm::ivec3(70);
glm::ivec3 _wwtBorderColor = glm::ivec3(70);
glm::dvec2 _equatorialAim = glm::dvec2(0.0);
double _targetRoll = 0.0;
bool _isImageCollectionLoaded = false;
@@ -159,7 +159,7 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
_textureQuality.onChange([this]() { _isDimensionsDirty = true; });
if (global::windowDelegate->isMaster()) {
_borderColor = randomBorderColor();
_wwtBorderColor = randomBorderColor();
}
_useRadiusAzimuthElevation.onChange(
+3 -3
View File
@@ -242,7 +242,7 @@ void WwtCommunicator::setEquatorialAim(glm::dvec2 equatorial) {
}
void WwtCommunicator::setBorderColor(glm::ivec3 color) {
_borderColor = std::move(color);
_wwtBorderColor = std::move(color);
_borderColorIsDirty = true;
}
@@ -255,7 +255,7 @@ void WwtCommunicator::setBorderRadius(double radius) {
void WwtCommunicator::updateBorderColor() const {
std::string script = fmt::format(
"setBackgroundColor('rgb({},{},{})');",
_borderColor.x, _borderColor.y, _borderColor.z
_wwtBorderColor.x, _wwtBorderColor.y, _wwtBorderColor.z
);
executeJavascript(script);
}
@@ -355,7 +355,7 @@ void WwtCommunicator::setIdInBrowser(const std::string& id) const {
}
glm::ivec3 WwtCommunicator::borderColor() const {
return _borderColor;
return _wwtBorderColor;
}
double WwtCommunicator::verticalFov() const {