Create property for hiding the screenspaceskybrowser instead of placing it outside of the fov

This commit is contained in:
Ylva Selling
2022-04-14 15:52:04 -04:00
parent 3e9a590ba8
commit 17965a130d
3 changed files with 13 additions and 19 deletions

View File

@@ -67,7 +67,7 @@ public:
private:
properties::FloatProperty _textureQuality;
properties::BoolProperty _renderOnlyOnMaster;
properties::BoolProperty _isHidden;
std::vector<std::unique_ptr<properties::Vec3Property>> _renderCopies;
void bindTexture() override;

View File

@@ -430,7 +430,7 @@ namespace {
std::string idBrowser = "SkyBrowser" + std::to_string(noOfPairs);
std::string idTarget = "SkyTarget" + std::to_string(noOfPairs);
// Determine starting point on screen for the target
glm::vec3 positionBrowser = glm::vec3(-3.f, -3.f, -2.1f);
glm::vec3 positionBrowser = glm::vec3(0.f, 0.f, -2.1f);
glm::vec3 positionTarget = glm::vec3(0.9f, 0.4f, -2.1f);
glm::dvec3 galacticTarget = skybrowser::localCameraToGalactic(positionTarget);
std::string guiPath = "/Sky Browser";

View File

@@ -55,20 +55,19 @@ namespace {
"be interactive. The position is in RAE (Radius, Azimuth, Elevation) coordinates."
};
constexpr const openspace::properties::Property::PropertyInfo RenderOnMasterInfo = {
"RenderOnlyOnMaster",
"Render Only On Master",
"Render the interactive sky browser only on the master node (this setting won't "
"affect the copies). This setting allows mouse interactions in a dome "
"environment."
constexpr const openspace::properties::Property::PropertyInfo IsHiddenInfo = {
"IsHidden",
"Is hidden",
"If checked, the browser will be not be displayed. If it is not checked, it will "
"be."
};
struct [[codegen::Dictionary(ScreenSpaceSkyBrowser)]] Parameters {
// [[codegen::verbatim(TextureQualityInfo.description)]]
std::optional<float> textureQuality;
// [[codegen::verbatim(RenderOnMasterInfo.description)]]
std::optional<bool> renderOnlyOnMaster;
// [[codegen::verbatim(IsHiddenInfo.description)]]
std::optional<bool> isHidden;
};
#include "screenspaceskybrowser_codegen.cpp"
@@ -100,20 +99,20 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
: ScreenSpaceRenderable(dictionary)
, WwtCommunicator(dictionary)
, _textureQuality(TextureQualityInfo, 0.5f, 0.25f, 1.f)
, _renderOnlyOnMaster(RenderOnMasterInfo, false)
, _isHidden(IsHiddenInfo, true)
{
_identifier = makeUniqueIdentifier(_identifier);
// Handle target dimension property
const Parameters p = codegen::bake<Parameters>(dictionary);
_textureQuality = p.textureQuality.value_or(_textureQuality);
_renderOnlyOnMaster = p.renderOnlyOnMaster.value_or(_renderOnlyOnMaster);
_isHidden = p.isHidden.value_or(_isHidden);
addProperty(_isHidden);
addProperty(_url);
addProperty(_browserPixeldimensions);
addProperty(_reload);
addProperty(_textureQuality);
addProperty(_renderOnlyOnMaster);
_textureQuality.onChange([this]() { _textureDimensionsIsDirty = true; });
@@ -237,12 +236,7 @@ bool ScreenSpaceSkyBrowser::deinitializeGL() {
void ScreenSpaceSkyBrowser::render() {
WwtCommunicator::render();
// If the sky browser only should be rendered on master, don't use the
// global rotation
if (_renderOnlyOnMaster && global::windowDelegate->isMaster()) {
draw(translationMatrix() * localRotationMatrix() * scaleMatrix());
}
else if (!_renderOnlyOnMaster) {
if (!_isHidden) {
draw(
globalRotationMatrix() *
translationMatrix() *