mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Fading of propertyowners through GUI, and more owners with fade property (#2557)
* Add property in OpenSpaceEngine for fading duration when enabling / disabling * Add interface for fadeable components and apply to renderable * Make layers a fadeable component * Make globelabels a fadeable component * Make labelscomponent a fadeable, and give it an enabled property * Make screenspace renderables fadeable components * Introduce concept of parent fadeables, to fade out subowners with parent * Make rings fadeable as well --------- Co-authored-by: Alexander Bock <alexander.bock@liu.se>
This commit is contained in:
@@ -55,14 +55,7 @@ namespace {
|
||||
"This value specifies the line width of the spherical grid"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DrawLabelInfo = {
|
||||
"DrawLabels",
|
||||
"Draw Labels",
|
||||
"Determines whether labels should be drawn or hidden"
|
||||
};
|
||||
|
||||
static const openspace::properties::PropertyOwner::PropertyOwnerInfo LabelsInfo =
|
||||
{
|
||||
static const openspace::properties::PropertyOwner::PropertyOwnerInfo LabelsInfo = {
|
||||
"Labels",
|
||||
"Labels",
|
||||
"The labels for the grid"
|
||||
@@ -78,9 +71,6 @@ namespace {
|
||||
// [[codegen::verbatim(LineWidthInfo.description)]]
|
||||
std::optional<float> lineWidth;
|
||||
|
||||
// [[codegen::verbatim(DrawLabelInfo.description)]]
|
||||
std::optional<bool> drawLabels;
|
||||
|
||||
// [[codegen::verbatim(LabelsInfo.description)]]
|
||||
std::optional<ghoul::Dictionary> labels
|
||||
[[codegen::reference("space_labelscomponent")]];
|
||||
@@ -100,7 +90,6 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _segments(SegmentsInfo, 36, 4, 200)
|
||||
, _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f)
|
||||
, _drawLabels(DrawLabelInfo, false)
|
||||
{
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
@@ -127,12 +116,11 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
setBoundingSphere(1.0);
|
||||
|
||||
if (p.labels.has_value()) {
|
||||
_drawLabels = p.drawLabels.value_or(_drawLabels);
|
||||
addProperty(_drawLabels);
|
||||
|
||||
_labels = std::make_unique<LabelsComponent>(*p.labels);
|
||||
_hasLabels = true;
|
||||
addPropertySubOwner(_labels.get());
|
||||
// Fading of the labels should also depend on the fading of the renderable
|
||||
_labels->setParentFadeable(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +220,7 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
global::renderEngine->openglStateCache().resetDepthState();
|
||||
|
||||
// Draw labels
|
||||
if (_drawLabels && _hasLabels) {
|
||||
if (_hasLabels && _labels->enabled()) {
|
||||
const glm::vec3 lookup = data.camera.lookUpVectorWorldSpace();
|
||||
const glm::vec3 viewDirection = data.camera.viewDirectionWorldSpace();
|
||||
glm::vec3 right = glm::cross(viewDirection, lookup);
|
||||
|
||||
Reference in New Issue
Block a user