mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
Separate GlobeLabels vec4 color into opacity and vec3 color
This commit does not change the previous behavior. Note however that the behavior for opacity is a bit weird for this component.
This commit is contained in:
@@ -109,6 +109,12 @@ namespace {
|
||||
"Labels Color"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo LabelsOpacityInfo = {
|
||||
"LabelsOpacity",
|
||||
"Labels Opacity",
|
||||
"Labels Opacity"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
LabelsFadeInStartingDistanceInfo =
|
||||
{
|
||||
@@ -210,10 +216,16 @@ documentation::Documentation GlobeLabelsComponent::Documentation() {
|
||||
},
|
||||
{
|
||||
LabelsColorInfo.identifier,
|
||||
new Vector4Verifier<float>(),
|
||||
new DoubleVector3Verifier,
|
||||
Optional::Yes,
|
||||
LabelsColorInfo.description
|
||||
},
|
||||
{
|
||||
LabelsOpacityInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::Yes,
|
||||
LabelsOpacityInfo.description
|
||||
},
|
||||
{
|
||||
LabelsFadeInStartingDistanceInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
@@ -270,10 +282,11 @@ GlobeLabelsComponent::GlobeLabelsComponent()
|
||||
, _labelsMinHeight(LabelsMinHeightInfo, 100.0, 0.0, 10000.0)
|
||||
, _labelsColor(
|
||||
LabelsColorInfo,
|
||||
glm::vec4(1.f, 1.f, 0.f, 1.f),
|
||||
glm::vec4(0.f),
|
||||
glm::vec4(1.f)
|
||||
glm::vec3(1.f, 1.f, 0.f),
|
||||
glm::vec3(0.f),
|
||||
glm::vec3(1.f)
|
||||
)
|
||||
, _labelsOpacity(LabelsOpacityInfo, 1.f, 0.f, 1.f)
|
||||
, _labelsFadeInDist(LabelsFadeInStartingDistanceInfo, 1e6, 1e3, 1e8)
|
||||
, _labelsFadeOutDist(LabelsFadeOutStartingDistanceInfo, 1e4, 1, 1e7)
|
||||
, _labelsFadeInEnabled(LabelsFadeInEnabledInfo, false)
|
||||
@@ -291,6 +304,7 @@ GlobeLabelsComponent::GlobeLabelsComponent()
|
||||
addProperty(_labelsMinHeight);
|
||||
_labelsColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_labelsColor);
|
||||
addProperty(_labelsOpacity);
|
||||
addProperty(_labelsFadeInDist);
|
||||
addProperty(_labelsFadeOutDist);
|
||||
addProperty(_labelsMinSize);
|
||||
@@ -355,7 +369,11 @@ void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary,
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(LabelsColorInfo.identifier)) {
|
||||
_labelsColor = dictionary.value<glm::vec4>(LabelsColorInfo.identifier);
|
||||
_labelsColor = dictionary.value<glm::vec3>(LabelsColorInfo.identifier);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(LabelsOpacityInfo.identifier)) {
|
||||
_labelsOpacity = dictionary.value<float>(LabelsOpacityInfo.identifier);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(LabelsFadeInEnabledInfo.identifier)) {
|
||||
@@ -670,7 +688,7 @@ void GlobeLabelsComponent::renderLabels(const RenderData& data,
|
||||
float distToCamera,
|
||||
float fadeInVariable
|
||||
) {
|
||||
glm::vec4 textColor = _labelsColor;
|
||||
glm::vec4 textColor = glm::vec4(glm::vec3(_labelsColor), _labelsOpacity);
|
||||
textColor.a *= fadeInVariable;
|
||||
|
||||
glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/vector/vec4property.h>
|
||||
#include <openspace/properties/vector/vec3property.h>
|
||||
#include <ghoul/font/fontrenderer.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
@@ -89,7 +89,8 @@ private:
|
||||
properties::IntProperty _labelsMinSize;
|
||||
properties::FloatProperty _labelsSize;
|
||||
properties::FloatProperty _labelsMinHeight;
|
||||
properties::Vec4Property _labelsColor;
|
||||
properties::Vec3Property _labelsColor;
|
||||
properties::FloatProperty _labelsOpacity;
|
||||
properties::FloatProperty _labelsFadeInDist;
|
||||
properties::FloatProperty _labelsFadeOutDist;
|
||||
properties::BoolProperty _labelsFadeInEnabled;
|
||||
|
||||
Reference in New Issue
Block a user