Commit 4cfd51a2 authored by GPayne's avatar GPayne
Browse files

Merged with master to prepare for pull request

parents bdf859cd b08759ff
master content/2012EventProfile elumenati/spout-implementation elumenati/spoutImplementation feature/2012Fieldlines feature/WSA feature/arrow-renderable feature/asset-helper feature/asset-meta-update-part2 feature/asset-require feature/atmosphere-stars-rendering feature/bufferTransferTestings feature/camera-control-during-path feature/camera-path-stability feature/cef-update feature/change-renderbin-runtime feature/cmake feature/codegen-lua feature/codegen-lua-jenkins feature/compile-times feature/direction-hint-renderable feature/du-meshes-selection feature/fieldlines feature/gamma-correction feature/geojson feature/geojson-renderable feature/getting-started-tour feature/grid-labels feature/grids-update feature/gui-mouseinteraction-fix feature/horizons-framework feature/horizons-unit-tests feature/idle-behavior-updates feature/imageTestKeys2Actions feature/jenkins-codegen feature/jenkins-fix feature/jenkins-timeout feature/juice feature/jwst-pointing feature/jwst-trail-update feature/jwst-update feature/labels-rendering feature/location-measure feature/macos feature/mars-moons feature/mas-model feature/missions feature/model-opacity feature/molecule_rendering feature/mollwide-projection feature/orientation-check feature/paper-atmosphere feature/properties-visibility feature/renderable-enabled-event feature/satellites feature/saturn-shepherd-moons feature/science-on-the-sphere feature/sgct-framebuffer-fixes feature/sgct-gui feature/sgct-gui-editable feature/sgct-gui-jenkins feature/sgct-json feature/sgct-ui feature/side-by-side-removal feature/skybrowser feature/skybrowser-cleanup feature/skybrowser-drag-and-drop feature/skybrowser-reload feature/spacecraft-instruments feature/spice-update feature/tileprovider-minlevel feature/tileproviders feature/ubuntu2204 feature/unit-tests feature/userproperties feature/various-changes feature/video-on-globe feature/visual-testing-try2 feature/warnings feature/wormhole feature/xbox-update hotfix/scaling integration/paper-atmosphere issue/1161 issue/1279 issue/1366-2 issue/1479 issue/1559 issue/1607 issue/1666 issue/1707 issue/1751 issue/1814 issue/1827 issue/1842 issue/1845 issue/1851 issue/1905 issue/1908 issue/1910 issue/1911 issue/1964 issue/1989 issue/1995 issue/2029 issue/2055 issue/2093 issue/2111 issue/2118 issue/2121 issue/2127 issue/2133 issue/2137 issue/2194 issue/2207 issue/2209 issue/2212 issue/2236 issue/2259 issue/2261 issue/2266 issue/2269 issue/843 issue/888 jenkins/1 jenkins/2 jenkins/2286 jenkins/utah-test-1 project/2021-wisdome-installation project/climate project/exoplanet-explorer project/exoplanets-expert-tool project/lights-2020-installation project/spaceship-installation rc/0.18.1 temp/skybrowser-animation-fixes-merge thesis/2020/software-integration thesis/2020/sonification thesis/2021/airtraffic thesis/2021/fieldlines thesis/2021/multiuser-collab thesis/2021/multiuser-collab3 thesis/2021/skybrowser thesis/2022/climate thesis/2022/cosmic-view thesis/2022/fieldline-rendering thesis/2022/remote-streaming thesis/2022/software-integration thesis/2022/software-integration_dod thesis/2022/software-integration_receive-ra-dec thesis/2022/software-integration_refactor-simp thesis/2022/software-integration_velocity-support thesis/2022/streaming vislabs/release/2.1 research/atmospheres releases/v0.18.0 releases/v0.17.2 releases/v0.17.1 releases/v0.17.0 releases/v0.16.1 releases/v0.16.0 releases/v0.15.2 releases/beta/beta-9 releases/beta/beta-8 releases/beta/beta-7
No related merge requests found
Showing with 87 additions and 10 deletions
+87 -10
......@@ -8,6 +8,6 @@ The project stems from the same academic collaboration between Sweden’s [Link
OpenSpace requires graphics support for [OpenGL](https://www.opengl.org/) version 3.3.
This repository contains the source code and example scenes for OpenSpace, but does not contain any data. To build and install the client, we refer to the [OpenSpace Wiki](http://wiki.openspaceproject.com/), specifically [building](http://wiki.openspaceproject.com/developer/compiling/general) for [Windows](http://wiki.openspaceproject.com/developer/compiling/windows), [Linux (Ubuntu)](http://wiki.openspaceproject.com/developer/compiling/ubuntu), and [MacOS](http://wiki.openspaceproject.com/developer/compiling/macos). Required preexisting dependencies are: [Boost](http://www.boost.org/) and [Qt](http://www.qt.io/download). Feel free to create issues for missing features, bug reports, or compile problems or contact us via [email](mailto:alexander.bock@me.com?subject=OpenSpace:).
This repository contains the source code and example scenes for OpenSpace, but does not contain any data. To build and install the client, we refer to the [OpenSpace Wiki](http://wiki.openspaceproject.com/), specifically [building](http://wiki.openspaceproject.com/docs/developers/compiling/general) for [Windows](http://wiki.openspaceproject.com/docs/developers/compiling/windows), [Linux (Ubuntu)](http://wiki.openspaceproject.com/docs/developers/compiling/ubuntu), and [MacOS](http://wiki.openspaceproject.com/docs/developers/compiling/macos). Required preexisting dependencies are: [Boost](http://www.boost.org/) and [Qt](http://www.qt.io/download). Feel free to create issues for missing features, bug reports, or compile problems or contact us via [email](mailto:alexander.bock@me.com?subject=OpenSpace:).
Regarding any issues, you are very welcome on our [Slack support channel](https://openspacesupport.slack.com) to which you can freely [sign-up](https://join.slack.com/t/openspacesupport/shared_invite/enQtMjUxNzUyMTQ1ODQxLTI4YjNmMTY3ZDI1N2Q1NWM1ZjQ1NTQyNzAxM2YyMGQ5Y2NmYWJiNjI1NjU4YTkyNTc5ZDE5NzdhNGM2YmUzYTk).
......@@ -36,6 +36,7 @@
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/scalar/doubleproperty.h>
#include <openspace/properties/triggerproperty.h>
#include <ghoul/glm.h>
#include <glm/gtx/quaternion.hpp>
......@@ -143,8 +144,8 @@ private:
properties::FloatProperty _followAnchorNodeRotationDistance;
properties::FloatProperty _minimumAllowedDistance;
properties::FloatProperty _flightDestinationDistance;
properties::DoubleProperty _flightDestinationFactor;
properties::BoolProperty _applyLinearFlight;
properties::FloatProperty _velocitySensitivity;
properties::FloatProperty _mouseSensitivity;
......
......@@ -784,4 +784,22 @@ float RenderableLabels::unit(int unit) const {
}
}
std::string RenderableLabels::toString(int unit) const {
switch (static_cast<Unit>(unit)) {
case Meter: return MeterUnit;
case Kilometer: return KilometerUnit;
case Megameter: return MegameterUnit;
case Gigameter: return GigameterUnit;
case AU: return AstronomicalUnit;
case Terameter: return TerameterUnit;
case Petameter: return PetameterUnit;
case Parsec: return ParsecUnit;
case Kiloparsec: return KiloparsecUnit;
case Megaparsec: return MegaparsecUnit;
case Gigaparsec: return GigaparsecUnit;
case GigalightYears: return GigalightyearUnit;
default: throw std::logic_error("Missing case label");
}
}
} // namespace openspace
......@@ -74,6 +74,8 @@ protected:
float unit(int unit) const;
std::string toString(int unit) const;
// Data may require some type of transformation prior the spice transformation being
// applied.
glm::dmat4 _transformationMatrix = glm::dmat4(1.0);
......
......@@ -57,6 +57,8 @@ private:
std::vector<unsigned int> _indexBufferData;
};
static double importAngleValue(const std::string& angle);
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACE___RENDERABLESMALLBODY___H__
......
......@@ -42,6 +42,20 @@ namespace {
"Property to track a nodeline. When tracking the label text will be updating the "
"distance from the nodeline start and end."
};
constexpr openspace::properties::Property::PropertyInfo DistanceUnitInfo = {
"DistanceUnit",
"Distance Unit",
"Property to define the unit in which the distance should be displayed."
"Defaults to 'km' if not specified."
};
constexpr openspace::properties::Property::PropertyInfo CustomUnitDescriptorInfo = {
"CustomUnitDescriptor",
"Custom Unit Descriptor",
"Property to define a custom unit descriptor to use to describe the distance value."
"Defaults to the units SI descriptor if not specified."
};
}
namespace openspace {
......@@ -58,6 +72,18 @@ documentation::Documentation RenderableDistanceLabel::Documentation() {
Optional::No,
NodeLineInfo.description
},
{
DistanceUnitInfo.identifier,
new IntVerifier,
Optional::Yes,
DistanceUnitInfo.description
},
{
CustomUnitDescriptorInfo.identifier,
new StringVerifier,
Optional::Yes,
CustomUnitDescriptorInfo.description
}
}
};
}
......@@ -65,6 +91,8 @@ documentation::Documentation RenderableDistanceLabel::Documentation() {
RenderableDistanceLabel::RenderableDistanceLabel(const ghoul::Dictionary& dictionary)
: RenderableLabels(dictionary)
, _nodelineId(NodeLineInfo)
, _distanceUnit(DistanceUnitInfo, 1, 0, 11)
, _customUnitDescriptor(CustomUnitDescriptorInfo)
{
documentation::testSpecificationAndThrow(
Documentation(),
......@@ -76,6 +104,16 @@ RenderableDistanceLabel::RenderableDistanceLabel(const ghoul::Dictionary& dictio
_nodelineId = dictionary.value<std::string>(NodeLineInfo.identifier);
addProperty(_nodelineId);
}
if (dictionary.hasKey(DistanceUnitInfo.identifier)) {
_distanceUnit = static_cast<int>(
dictionary.value<double>(DistanceUnitInfo.identifier)
);
addProperty(_distanceUnit);
}
if (dictionary.hasKey(CustomUnitDescriptorInfo.identifier)) {
_customUnitDescriptor = dictionary.value<std::string>(CustomUnitDescriptorInfo.identifier);
addProperty(_customUnitDescriptor);
}
}
void RenderableDistanceLabel::update(const UpdateData&) {
......@@ -87,7 +125,6 @@ void RenderableDistanceLabel::update(const UpdateData&) {
SceneGraphNode* nodelineNode = RE.scene()->sceneGraphNode(_nodelineId);
if (nodelineNode) {
// Calculate distance
RenderableNodeLine* nodeline = dynamic_cast<RenderableNodeLine*>(
nodelineNode->renderable()
);
......@@ -97,15 +134,23 @@ void RenderableDistanceLabel::update(const UpdateData&) {
return;
}
double myDistance = nodeline->distance();
// Get used unit scale
const float scale = unit(_distanceUnit);
// Format string
float scale = unit(Kilometer);
std::string distanceText = std::to_string(std::round(myDistance / scale));
// Get unit descriptor text
std::string unitDescriptor = toString(_distanceUnit);
if (!_customUnitDescriptor.value().empty()) {
unitDescriptor = _customUnitDescriptor.value();
}
// Get distance as string and remove fractional part
std::string distanceText = std::to_string(std::round(nodeline->distance() / scale));
int pos = static_cast<int>(distanceText.find("."));
std::string subStr = distanceText.substr(pos);
distanceText.erase(pos, subStr.size());
std::string finalText = distanceText + " Km";
// Create final label text and set it
const std::string finalText = distanceText + " " + unitDescriptor;
setLabelText(finalText);
// Update placement of label with transformation matrix
......
......@@ -40,6 +40,8 @@ public:
private:
properties::StringProperty _nodelineId;
properties::IntProperty _distanceUnit;
properties::StringProperty _customUnitDescriptor;
bool _errorThrown = false;
};
......
......@@ -34,7 +34,6 @@ namespace {
constexpr const double AngleEpsilon = 1E-7;
constexpr const double DistanceRatioAimThreshold = 1E-4;
constexpr const double FlightDestinationFactor = 1E-4;
constexpr const openspace::properties::Property::PropertyInfo AnchorInfo = {
"Anchor",
......@@ -155,6 +154,12 @@ namespace {
"The final distance we want to fly to, with regards to the anchor node."
};
constexpr openspace::properties::Property::PropertyInfo FlightDestinationFactorInfo = {
"FlightDestinationFactor",
"Flight Destination Factor",
"The minimal distance factor that we need to reach to end linear flight."
};
constexpr openspace::properties::Property::PropertyInfo
StereoInterpolationTimeInfo = {
"StereoInterpolationTime",
......@@ -232,6 +237,7 @@ OrbitalNavigator::OrbitalNavigator()
, _velocitySensitivity(VelocityZoomControlInfo, 0.02f, 0.01f, 0.15f)
, _applyLinearFlight(ApplyLinearFlightInfo, false)
, _flightDestinationDistance(FlightDestinationDistanceInfo, 2e8f, 0.0f, 1e10f)
, _flightDestinationFactor(FlightDestinationFactorInfo, 1E-4, 1E-6, 0.5)
, _mouseSensitivity(MouseSensitivityInfo, 15.0f, 1.0f, 50.f)
, _joystickSensitivity(JoystickSensitivityInfo, 10.0f, 1.0f, 50.f)
, _websocketSensitivity(WebsocketSensitivityInfo, 10.0f, 1.0f, 50.f)
......@@ -362,6 +368,7 @@ OrbitalNavigator::OrbitalNavigator()
addProperty(_minimumAllowedDistance);
addProperty(_velocitySensitivity);
addProperty(_flightDestinationDistance);
addProperty(_flightDestinationFactor);
addProperty(_applyLinearFlight);
addProperty(_useAdaptiveStereoscopicDepth);
......@@ -440,7 +447,7 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) {
double distFromCameraToFocus = glm::distance(prevCameraPosition, anchorPos) - nodeRadius;
// Make the approximation delta size depending on the flight distance
double arrivalThreshold = _flightDestinationDistance.value() * FlightDestinationFactor;
double arrivalThreshold = _flightDestinationDistance.value() * _flightDestinationFactor;
// Fly towards the flight destination distance. When getting closer than arrivalThreshold terminate the flight
if (abs(distFromCameraToFocus - _flightDestinationDistance.value()) > arrivalThreshold) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment