Turn vertical fov into properties to ensure that the fov is synchronized on all nodes

This commit is contained in:
Ylva Selling
2022-09-22 05:10:05 -04:00
parent a88ea892db
commit a49e37fedc
5 changed files with 39 additions and 4 deletions
@@ -61,8 +61,7 @@ private:
properties::FloatProperty _crossHairSize;
properties::FloatProperty _showRectangleThreshold;
properties::FloatProperty _lineWidth;
double _verticalFov = 10.0;
properties::DoubleProperty _verticalFov;
glm::ivec3 _borderColor = glm::ivec3(230);
float _ratio = 1.f;
+3 -1
View File
@@ -26,6 +26,7 @@
#define __OPENSPACE_MODULE_SKYBROWSER___WWTCOMMUNICATOR___H__
#include <modules/skybrowser/include/browser.h>
#include <openspace/properties/scalar/doubleproperty.h>
#include <deque>
@@ -69,7 +70,8 @@ protected:
void setIdInBrowser(const std::string& id) const;
std::deque<std::pair<int, double>>::iterator findSelectedImage(int i);
double _verticalFov = 10.0f;
properties::DoubleProperty _verticalFov;
glm::ivec3 _borderColor = glm::ivec3(70);
glm::dvec2 _equatorialAim = glm::dvec2(0.0);
double _targetRoll = 0.0;
@@ -68,6 +68,12 @@ namespace {
"The thickness of the line of the target. The larger number, the thicker line"
};
constexpr openspace::properties::Property::PropertyInfo VerticalFovInfo = {
"VerticalFov",
"Vertical Field Of View",
"The vertical field of view of the target."
};
struct [[codegen::Dictionary(RenderableSkyTarget)]] Parameters {
// [[codegen::verbatim(crossHairSizeInfo.description)]]
std::optional<float> crossHairSize;
@@ -77,6 +83,9 @@ namespace {
// [[codegen::verbatim(LineWidthInfo.description)]]
std::optional<float> lineWidth;
// [[codegen::verbatim(VerticalFovInfo.description)]]
std::optional<double> verticalFov;
};
#include "renderableskytarget_codegen.cpp"
@@ -93,6 +102,7 @@ RenderableSkyTarget::RenderableSkyTarget(const ghoul::Dictionary& dictionary)
, _crossHairSize(crossHairSizeInfo, 2.f, 1.f, 10.f)
, _showRectangleThreshold(RectangleThresholdInfo, 5.f, 0.1f, 70.f)
, _lineWidth(LineWidthInfo, 13.f, 1.f, 100.f)
, _verticalFov(VerticalFovInfo, 10.0, 0.00000000001, 70.0)
, _borderColor(220, 220, 220)
{
// Handle target dimension property
@@ -104,7 +114,12 @@ RenderableSkyTarget::RenderableSkyTarget(const ghoul::Dictionary& dictionary)
_showRectangleThreshold = p.rectangleThreshold.value_or(_showRectangleThreshold);
addProperty(_showRectangleThreshold);
_lineWidth = p.lineWidth.value_or(_lineWidth);
addProperty(_lineWidth);
_verticalFov= p.verticalFov.value_or(_verticalFov);
_verticalFov.setReadOnly(true);
addProperty(_verticalFov);
}
void RenderableSkyTarget::bindTexture() {}
@@ -119,6 +119,7 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
addProperty(_browserDimensions);
addProperty(_reload);
addProperty(_textureQuality);
addProperty(_verticalFov);
_textureQuality.onChange([this]() { _textureDimensionsIsDirty = true; });
+19 -1
View File
@@ -116,13 +116,31 @@ namespace {
MessageCounter++;
return msg;
}
constexpr openspace::properties::Property::PropertyInfo VerticalFovInfo = {
"VerticalFov",
"Vertical Field Of View",
"The vertical field of view of the target."
};
struct [[codegen::Dictionary(WwtCommunicator)]] Parameters {
// [[codegen::verbatim(VerticalFovInfo.description)]]
std::optional<double> verticalFov;
};
#include "wwtcommunicator_codegen.cpp"
} // namespace
namespace openspace {
WwtCommunicator::WwtCommunicator(const ghoul::Dictionary& dictionary)
: Browser(dictionary)
{}
, _verticalFov(VerticalFovInfo, 10.0, 0.00000000001, 70.0)
{
// Handle target dimension property
const Parameters p = codegen::bake<Parameters>(dictionary);
_verticalFov = p.verticalFov.value_or(_verticalFov);
_verticalFov.setReadOnly(true);
}
void WwtCommunicator::update() {
// Cap how messages are passed