Remove a bunch of compiler warnings

* Remove compile warnings
* Coding style fix
This commit is contained in:
Alexander Bock
2023-05-16 11:59:28 +02:00
committed by GitHub
parent f8d7d5386a
commit bde840ad03
67 changed files with 342 additions and 260 deletions

View File

@@ -89,7 +89,7 @@ SgctEdit::SgctEdit(sgct::config::Cluster& cluster, const std::string& configName
size_t nWindows = _cluster.nodes.front().windows.size();
bool firstWindowGuiIsEnabled = (nWindows > 1);
std::vector<QRect> monitorSizes = createMonitorInfoSet();
createWidgets(monitorSizes, nWindows, false);
createWidgets(monitorSizes, static_cast<unsigned int>(nWindows), false);
size_t existingWindowsControlSize = _displayWidget->windowControls().size();
for (size_t i = 0; i < nWindows; ++i) {
sgct::config::Window& w = _cluster.nodes.front().windows[i];
@@ -459,7 +459,7 @@ void SgctEdit::generateConfigResizeWindowsAccordingToSelected(sgct::config::Node
void SgctEdit::generateConfigIndividualWindowSettings(sgct::config::Node& node) {
for (size_t i = 0; i < node.windows.size(); ++i) {
// First apply default settings to each window...
node.windows[i].id = i;
node.windows[i].id = static_cast<int>(i);
node.windows[i].draw2D = true;
node.windows[i].draw3D = true;
node.windows[i].viewports.back().isTracked = true;

View File

@@ -102,7 +102,7 @@ public:
/**
* Returns the associated link of this MissionPhase. If no link is associated, this
* string will be empty.
*
*
* \return The associated link of the MissionPhase or the empty string
*/
const std::string& link() const;
@@ -179,7 +179,7 @@ protected:
std::string _link;
/// Actions associated with the phase
std::vector<std::string> _actions;
/// Important dates
/// Important dates
std::vector<Milestone> _milestones;
};

View File

@@ -116,9 +116,10 @@ public:
GLuint gBufferColorTexture() const;
/**
* Gives access to the position texture of the G-buffer. NOTE: This texture is used for
* the majority of rendering the scene and might be already in use. Use CAUTION when
* using this function. The size of the texture is the resolution of the viewport.
* Gives access to the position texture of the G-buffer. NOTE: This texture is used
* for the majority of rendering the scene and might be already in use. Use CAUTION
* when using this function. The size of the texture is the resolution of the
* viewport.
*
* \return identifier of the position texture of the G-buffer
*/

View File

@@ -67,8 +67,8 @@ template <typename T>
std::string formatJson(T value);
/**
* Sort a json object that is an array of objects with the structure
* [ key = {}, key = {} ...]. Sorts it by the provided key
* Sort a json object that is an array of objects with the structure
* [ key = {}, key = {} ...]. Sorts it by the provided key
*
* \param json The json to sort
* \param key The key the json should be sorted by

View File

@@ -74,6 +74,8 @@ public:
explicit Time(const std::string& time);
Time(const Time& other) = default;
Time& operator=(const Time& other) = default;
/**
* Initializes the Time singleton.
*

View File

@@ -562,7 +562,11 @@ void RenderableModel::initializeGL() {
std::filesystem::path fs =
absPath("${MODULE_BASE}/shaders/modelOpacity_fs.glsl");
return global::renderEngine->buildRenderProgram("ModelOpacityProgram", vs, fs);
return global::renderEngine->buildRenderProgram(
"ModelOpacityProgram",
vs,
fs
);
}
);
ghoul::opengl::updateUniformLocations(

View File

@@ -224,7 +224,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
// We need to recalcuate the _totalSampleInterval if _numberOfVertices eqals
// maxNumberOfVertices. If we don't do this the position for each vertex
// will not be correct for the number of vertices we are doing along the trail.
// will not be correct for the number of vertices we are doing along the trail
_totalSampleInterval = (_numberOfVertices == maxNumberOfVertices) ?
(timespan / _numberOfVertices) : _totalSampleInterval;

View File

@@ -97,7 +97,7 @@ void MilkywayConversionTask::perform(const Task::ProgressCallback& onProgress) {
resolutionRatio
);
std::function<glm::tvec4<GLfloat>(glm::ivec3)> sampleFunction =
[this, resolutionRatio, sampler](glm::ivec3 outCoord) {
[resolutionRatio, sampler](glm::ivec3 outCoord) {
const glm::vec3 inCoord = ((glm::vec3(outCoord) + glm::vec3(0.5f)) *
resolutionRatio) - glm::vec3(0.5f);
const glm::tvec4<GLfloat> value = sampler.sample(inCoord);

View File

@@ -205,7 +205,10 @@ namespace {
// [[codegen::verbatim(CoordinateOffsetInfo.description)]]
std::optional<glm::vec2> coordinateOffset;
enum class [[codegen::map(openspace::globebrowsing::GlobeGeometryFeature::PointRenderMode)]] PointRenderMode {
enum class
[[codegen::map(openspace::globebrowsing::GlobeGeometryFeature::PointRenderMode)]]
PointRenderMode
{
AlignToCameraDir [[codegen::key("Camera Direction")]],
AlignToCameraPos [[codegen::key("Camera Position")]],
AlignToGlobeNormal [[codegen::key("Globe Normal")]],
@@ -240,7 +243,6 @@ GeoJsonComponent::SubFeatureProps::SubFeatureProps(
properties::PropertyOwner::PropertyOwnerInfo info)
: properties::PropertyOwner(info)
, enabled(EnabledInfo, true)
, flyToFeature(FlyToFeatureInfo)
, centroidLatLong(
CentroidCoordinateInfo,
glm::vec2(0.f),
@@ -253,6 +255,7 @@ GeoJsonComponent::SubFeatureProps::SubFeatureProps(
glm::vec4(-90.f, -180.f, -90.f, -180.f),
glm::vec4(90.f, 180.f, 90.f, 180.f)
)
, flyToFeature(FlyToFeatureInfo)
{
_opacity.setVisibility(openspace::properties::Property::Visibility::AdvancedUser);
addProperty(Fadeable::_opacity);
@@ -277,7 +280,6 @@ GeoJsonComponent::GeoJsonComponent(const ghoul::Dictionary& dictionary,
dictionary.hasKey(KeyDesc) ? dictionary.value<std::string>(KeyDesc) : ""
})
, _enabled(EnabledInfo, true)
, _globeNode(globe)
, _geoJsonFile(FileInfo)
, _heightOffset(HeightOffsetInfo, 10.f, -1e12f, 1e12f)
, _latLongOffset(
@@ -288,15 +290,14 @@ GeoJsonComponent::GeoJsonComponent(const ghoul::Dictionary& dictionary,
)
, _pointSizeScale(PointSizeScaleInfo, 1.f, 0.01f, 100.f)
, _lineWidthScale(LineWidthScaleInfo, 1.f, 0.01f, 10.f)
, _drawWireframe(DrawWireframeInfo, false)
, _preventUpdatesFromHeightMap(PreventHeightUpdateInfo, false)
, _forceUpdateHeightData(ForceUpdateHeightDataInfo)
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
, _featuresPropertyOwner({ "Features", "Features" })
, _pointRenderModeOption(
PointRenderModeInfo,
properties::OptionProperty::DisplayType::Dropdown
)
, _drawWireframe(DrawWireframeInfo, false)
, _preventUpdatesFromHeightMap(PreventHeightUpdateInfo, false)
, _forceUpdateHeightData(ForceUpdateHeightDataInfo)
, _globeNode(globe)
, _centerLatLong(
CentroidCoordinateInfo,
glm::vec2(0.f),
@@ -304,6 +305,8 @@ GeoJsonComponent::GeoJsonComponent(const ghoul::Dictionary& dictionary,
glm::vec2(90.f, 180.f)
)
, _flyToFeature(FlyToFeatureInfo)
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
, _featuresPropertyOwner({ "Features", "Features" })
{
const Parameters p = codegen::bake<Parameters>(dictionary);
@@ -680,7 +683,8 @@ void GeoJsonComponent::addMetaPropertiesToFeature(SubFeatureProps& feature, int
feature.centroidLatLong = centroidLatLong;
std::unique_ptr<geos::geom::Geometry> boundingbox = geometry->getEnvelope();
std::unique_ptr<geos::geom::CoordinateSequence> coords = boundingbox->getCoordinates();
std::unique_ptr<geos::geom::CoordinateSequence> coords =
boundingbox->getCoordinates();
glm::vec4 boundingboxLatLong;
if (boundingbox->isRectangle()) {
// A rectangle has 5 coordinates, where the first and third are two corners

View File

@@ -66,7 +66,7 @@ class RenderableGlobe;
class GeoJsonComponent : public properties::PropertyOwner, public Fadeable {
public:
GeoJsonComponent(const ghoul::Dictionary& dictionary, RenderableGlobe& globe);
virtual ~GeoJsonComponent();
virtual ~GeoJsonComponent() override;
void initialize();
void initializeGL();

View File

@@ -28,13 +28,13 @@
#include <openspace/documentation/documentation.h>
#include <ghoul/logging/logmanager.h>
#include <geos/io/GeoJSON.h>
#include <scn/scn.h>
#include <algorithm>
#include <cstdio>
// Keys used to read properties from GeoJson files
namespace geojson::propertykeys {
constexpr std::string_view Name = "name";
constexpr std::string_view Description = "description";
constexpr std::string_view Opacity = "opacity";
@@ -44,16 +44,18 @@ namespace geojson::propertykeys {
constexpr std::string_view LineWidth = "stroke-width";
constexpr std::string_view PointSize = "point-size";
constexpr std::array<std::string_view, 3> Texture = { "texture", "sprite", "point-texture" };
constexpr std::array<std::string_view, 3> Texture = {
"texture", "sprite", "point-texture"
};
constexpr std::array<std::string_view, 2> PointTextureAnchor = { "point-anchor", "anchor" };
constexpr std::array<std::string_view, 2> PointTextureAnchor = {
"point-anchor", "anchor"
};
constexpr std::string_view PointTextureAnchorBottom = "bottom";
constexpr std::string_view PointTextureAnchorCenter = "center";
constexpr std::string_view Extrude = "extrude";
constexpr std::string_view PerformShading = "performShading";
constexpr std::string_view Tessellate = "tessellate";
constexpr std::string_view TessellationLevel = "tessellationLevel";
constexpr std::string_view TessellationMaxDistance = "tessellationDistance";
@@ -72,7 +74,11 @@ namespace {
const std::array<std::string_view, SIZE>& keyAlternativesArray,
std::optional<const PropertyInfo> propInfo = std::nullopt)
{
auto it = std::find(keyAlternativesArray.begin(), keyAlternativesArray.end(), key);
auto it = std::find(
keyAlternativesArray.begin(),
keyAlternativesArray.end(),
key
);
if (it != keyAlternativesArray.end()) {
return true;
}
@@ -91,23 +97,32 @@ namespace {
return keyMatches(key, array, propInfo);
}
glm::vec3 hexToRbg(std::string_view hexColor) {
int r, g, b;
// @TODO: Consider using scn::scan instead of sscanf
int ret = std::sscanf(hexColor.data(), "#%02x%02x%02x", &r, &g, &b);
// @TODO: Handle return value to validate color
return (1.f / 255.f) * glm::vec3(r, g, b);
std::optional<glm::vec3> hexToRgb(std::string_view hexColor) {
glm::ivec3 rgb;
auto ret = scn::scan(hexColor, "#{:2x}{:2x}{:2x}", rgb.r, rgb.g, rgb.b);
if (ret) {
return (1.f / 255.f) * glm::vec3(rgb);
}
else {
return std::nullopt;
}
}
glm::vec3 getColorValue(const geos::io::GeoJSONValue& value) {
glm::vec3 color;
// Default garish color used for when the color loading fails
glm::vec3 color = glm::vec3(1.f, 0.f, 1.f);
if (value.isArray()) {
const std::vector<geos::io::GeoJSONValue>& val = value.getArray();
if (val.size() != 3) {
// @TODO: Should add some more information on which file the reading failed for
LERRORC("GeoJson", fmt::format(
"Failed reading color property. Expected 3 values, got {}", val.size()
));
// @TODO:
// Should add some more information on which file the reading failed for
LERRORC(
"GeoJson",
fmt::format(
"Failed reading color property. Expected 3 values, got {}",
val.size()
)
);
}
// @TODO Use verifiers to verify color values
// @TODO Parse values given in RGB in ranges 0-255?
@@ -119,8 +134,19 @@ namespace {
}
else if (value.isString()) {
const std::string hex = value.getString();
// @TODO Verify color
color = hexToRbg(hex);
std::optional<glm::vec3> c = hexToRgb(hex);
if (!c) {
LERRORC(
"GeoJson",
fmt::format(
"Failed reading color property. Did not find a hex color, got {}",
hex
)
);
}
else {
color = *c;
}
}
return color;
};
@@ -285,14 +311,20 @@ namespace {
// [[codegen::verbatim(PerformShadingInfo.description)]]
std::optional<bool> performShading;
enum class [[codegen::map(openspace::globebrowsing::GeoJsonProperties::AltitudeMode)]] AltitudeMode {
enum class
[[codegen::map(openspace::globebrowsing::GeoJsonProperties::AltitudeMode)]]
AltitudeMode
{
Absolute,
RelativeToGround
};
// [[codegen::verbatim(AltitudeModeInfo.description)]]
std::optional<AltitudeMode> altitudeMode;
enum class [[codegen::map(openspace::globebrowsing::GeoJsonProperties::PointTextureAnchor)]] PointTextureAnchor {
enum class
[[codegen::map(openspace::globebrowsing::GeoJsonProperties::PointTextureAnchor)]]
PointTextureAnchor
{
Bottom,
Center
};
@@ -345,16 +377,16 @@ GeoJsonProperties::GeoJsonProperties()
, lineWidth(LineWidthInfo, 2.f, 0.01f, 10.f)
, pointSize(PointSizeInfo, 10.f, 0.01f, 100.f)
, pointTexture(PointTextureInfo)
, pointAnchorOption(
PointAnchorOptionInfo,
properties::OptionProperty::DisplayType::Dropdown
)
, extrude(ExtrudeInfo, false)
, performShading(PerformShadingInfo, false)
, altitudeModeOption(
AltitudeModeInfo,
properties::OptionProperty::DisplayType::Dropdown
)
, pointAnchorOption(
PointAnchorOptionInfo,
properties::OptionProperty::DisplayType::Dropdown
)
{
addProperty(opacity);
color.setViewOption(properties::Property::ViewOptions::Color);
@@ -415,7 +447,9 @@ void GeoJsonProperties::createFromDictionary(const ghoul::Dictionary& dictionary
performShading = p.performShading.value_or(performShading);
if (p.altitudeMode.has_value()) {
altitudeModeOption = static_cast<int>(codegen::map<AltitudeMode>(*p.altitudeMode));
altitudeModeOption = static_cast<int>(
codegen::map<AltitudeMode>(*p.altitudeMode)
);
}
// Set up default value and max value for tessellation distance based on globe size.
@@ -524,9 +558,10 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu
else if (keyMatches(key, propertykeys::Tessellate, TessellationEnabledInfo)) {
result.tessellationEnabled = value.getBoolean();
}
else if (keyMatches(key, propertykeys::TessellationLevel, TessellationLevelInfo)) {
else if (keyMatches(key, propertykeys::TessellationLevel, TessellationLevelInfo))
{
result.useTessellationLevel = true;
result.tessellationLevel = static_cast<float>(value.getNumber());
result.tessellationLevel = static_cast<int>(value.getNumber());
}
else if (keyMatches(key, propertykeys::TessellationMaxDistance, TessellationDistanceInfo)) {
result.tessellationDistance = static_cast<float>(value.getNumber());
@@ -538,7 +573,7 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu
parseProperty(key, value);
}
catch (const geos::io::GeoJSONValue::GeoJSONTypeError&) {
// @TODO: Should add some more information on which file the reading failed for
// @TODO: Should add some more information on which file the reading failed
LERRORC("GeoJson", fmt::format(
"Error reading GeoJson property '{}'. Value has wrong type", key
));

View File

@@ -56,8 +56,9 @@ struct GeoJsonProperties : public properties::PropertyOwner {
Absolute = 0,
// Compute position using altitude above the height map
RelativeToGround
// Stick to planet surface (TODO: use GDAL to render layer instead and use as default)
//ClampToGround
// Stick to planet surface (TODO: use GDAL to render layer instead and use as
// default)
// ClampToGround
};
enum class PointTextureAnchor {

View File

@@ -138,7 +138,9 @@ void GlobeGeometryFeature::updateTexture(bool isInitializeStep) {
if (isInitializeStep || !_pointTexture) {
_pointTexture = std::make_unique<TextureComponent>(2);
_pointTexture->setFilterMode(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
_pointTexture->setFilterMode(
ghoul::opengl::Texture::FilterMode::AnisotropicMipMap
);
_pointTexture->setWrapping(ghoul::opengl::Texture::WrappingMode::ClampToEdge);
}
@@ -178,10 +180,11 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet
}
case geos::geom::GEOS_POLYGON: {
try {
const geos::geom::Polygon* p = dynamic_cast<const geos::geom::Polygon*>(geo);
auto p = dynamic_cast<const geos::geom::Polygon*>(geo);
// Triangles
// Note that Constrained Delaunay triangulation supports polygons with holes :)
// Note that Constrained Delaunay triangulation supports polygons with
// holes :)
std::vector<geos::geom::Coordinate> triCoords;
TriList<Tri> triangles;
using geos::triangulate::polygon::ConstrainedDelaunayTriangulator;
@@ -217,7 +220,8 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet
// Inner bounds (holes)
for (int i = 0; i < nHoles; ++i) {
const geos::geom::LinearRing* hole = pNormalized->getInteriorRingN(i);
const geos::geom::LinearRing* hole =
pNormalized->getInteriorRingN(i);
std::vector<Geodetic3> ringGeoCoords =
geometryhelper::geometryCoordsAsGeoVector(hole);
@@ -352,7 +356,6 @@ void GlobeGeometryFeature::render(const RenderData& renderData, int pass,
}
default:
throw ghoul::MissingCaseException();
break;
}
shader->deactivate();
@@ -475,7 +478,8 @@ bool GlobeGeometryFeature::shouldUpdateDueToHeightMapChange() const {
return false;
}
// TODO: Change computation so that we return true immediately if even one height value is different
// TODO: Change computation so that we return true immediately if even one height
// value is different
// Check if last height values for the control positions have changed
std::vector<double> newHeights = getCurrentReferencePointsHeights();
@@ -544,11 +548,13 @@ std::vector<std::vector<glm::vec3>> GlobeGeometryFeature::createLineGeometry() {
std::vector<std::vector<glm::vec3>> resultPositions;
resultPositions.reserve(_geoCoordinates.size());
for (int i = 0; i < _geoCoordinates.size(); ++i) {
for (size_t i = 0; i < _geoCoordinates.size(); ++i) {
std::vector<Vertex> vertices;
std::vector<glm::vec3> positions;
vertices.reserve(_geoCoordinates[i].size() * 3); // TODO: this is not correct anymore
positions.reserve(_geoCoordinates[i].size() * 3); // TODO: this is not correct anymore
// TODO: this is not correct anymore
vertices.reserve(_geoCoordinates[i].size() * 3);
// TODO: this is not correct anymore
positions.reserve(_geoCoordinates[i].size() * 3);
glm::dvec3 lastPos = glm::dvec3(0.0);
double lastHeightValue = 0.0;
@@ -591,7 +597,7 @@ std::vector<std::vector<glm::vec3>> GlobeGeometryFeature::createLineGeometry() {
);
// Don't add the first position. Has been added as last in previous step
for (int si = 1; si < subdividedPositions.size(); ++si) {
for (size_t si = 1; si < subdividedPositions.size(); ++si) {
const geometryhelper::PosHeightPair& pair = subdividedPositions[si];
addLinePos(glm::vec3(pair.position));
}
@@ -872,7 +878,7 @@ void GlobeGeometryFeature::bufferVertexData(const RenderFeature& feature,
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
};
}
void GlobeGeometryFeature::bufferDynamicHeightData(const RenderFeature& feature) {
ghoul_assert(_pointsProgram, "Shader program must be initialized");
@@ -907,6 +913,6 @@ void GlobeGeometryFeature::bufferDynamicHeightData(const RenderFeature& feature)
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
};
}
} // namespace openspace::globebrowsing

View File

@@ -97,8 +97,8 @@ public:
size_t nVertices = 0;
bool isExtrusionFeature = false;
// Store the geodetic lat long coordinates of each vertex, so we can quickly recompute
// the height values for these points
// Store the geodetic lat long coordinates of each vertex, so we can quickly
// recompute the height values for these points
std::vector<Geodetic2> vertices;
// Keep the heights around
@@ -194,12 +194,14 @@ private:
// and any following are the inner rings (holes)
std::vector<std::vector<Geodetic3>> _geoCoordinates;
// Coordinates for any triangles representing the geometry (only relevant for polygons)
// Coordinates for any triangles representing the geometry (only relevant for
// polygons)
std::vector<Geodetic3> _triangleCoordinates;
std::vector<RenderFeature> _renderFeatures;
glm::vec3 _offsets = glm::vec3(0.f); // lat, long, distance (meters). Passed from parent on property change
// lat, long, distance (meters). Passed from parent on property change
glm::vec3 _offsets = glm::vec3(0.f);
std::string _key;
const PropertySet _properties;

View File

@@ -105,7 +105,7 @@ createExtrudedGeometryVertices(const std::vector<std::vector<glm::vec3>>& edgeVe
// Extrude polygon
for (size_t nBound = 0; nBound < edgeVertices.size(); ++nBound) {
const std::vector<glm::vec3>& boundary = edgeVertices[nBound];
for (int i = 1; i < boundary.size(); ++i) {
for (size_t i = 1; i < boundary.size(); ++i) {
glm::vec3 v0 = boundary[i - 1];
glm::vec3 v1 = boundary[i ];
@@ -115,7 +115,9 @@ createExtrudedGeometryVertices(const std::vector<std::vector<glm::vec3>>& edgeVe
// Outer boundary is the first one
if (nBound == 0) {
glm::vec3 n = glm::vec3(glm::normalize(glm::cross(v1 - vOrigin, v0 - vOrigin)));
glm::vec3 n = glm::vec3(
glm::normalize(glm::cross(v1 - vOrigin, v0 - vOrigin))
);
vertices.push_back({ vOrigin.x, vOrigin.y, vOrigin.z, n.x, n.y, n.z });
vertices.push_back({ v1.x, v1.y, v1.z, n.x, n.y, n.z });
vertices.push_back({ v0.x, v0.y, v0.z, n.x, n.y, n.z });
@@ -129,8 +131,8 @@ createExtrudedGeometryVertices(const std::vector<std::vector<glm::vec3>>& edgeVe
vertices.push_back({ v1.x, v1.y, v1.z, n.x, n.y, n.z });
}
// TODO: Fix faulty triangle directions and draw triangles with correct shading on
// both sides of the mesh
// TODO: Fix faulty triangle directions and draw triangles with correct
// shading on both sides of the mesh
}
}
@@ -298,13 +300,16 @@ subdivideTriangle(const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2,
// @TODO (emmbr, 2023-04-18): This is a bit of a temporary workaround to make the
// createMultiPoint call compile on Mac. It should work with just passing in the
// pointCoords variable directly, but for some reason it didn't. We should come up
// with a solution that does not iterate over the (quite big) std::vector an extra time
// with a solution that does not iterate over the (quite big) std::vector an extra
// time
std::vector<std::unique_ptr<Point>> geosPoints;
geosPoints.reserve(pointCoords.size());
for (const Coordinate& c : pointCoords) {
geosPoints.emplace_back(geometryFactory->createPoint(c));
}
std::unique_ptr<MultiPoint> points = geometryFactory->createMultiPoint(std::move(geosPoints));
std::unique_ptr<MultiPoint> points = geometryFactory->createMultiPoint(
std::move(geosPoints)
);
// Create triangulation of points
geos::triangulate::DelaunayTriangulationBuilder builder;
builder.setSites(*points->getCoordinates());

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___GLOBEGEOMETRYHELPER___H__
#define __OPENSPACE_MODULE_GLOBEBROWSING___GLOBEGEOMETRYHELPER___H__
#include <glm/glm.hpp>
#include <ghoul/glm.h>
#include <vector>
namespace openspace::globebrowsing {

View File

@@ -213,11 +213,11 @@ documentation::Documentation GlobeLabelsComponent::Documentation() {
GlobeLabelsComponent::GlobeLabelsComponent()
: properties::PropertyOwner({ "Labels" })
, _enabled(EnabledInfo, false)
, _color(ColorInfo, glm::vec3(1.f, 1.f, 0.f), glm::vec3(0.f), glm::vec3(1.f))
, _fontSize(FontSizeInfo, 30.f, 1.f, 300.f)
, _size(SizeInfo, 2.5, 0, 30)
, _minMaxSize(MinMaxSizeInfo, glm::ivec2(1, 1000), glm::ivec2(1), glm::ivec2(1000))
, _heightOffset(HeightOffsetInfo, 100.f, 0.f, 10000.f)
, _color(ColorInfo, glm::vec3(1.f, 1.f, 0.f), glm::vec3(0.f), glm::vec3(1.f))
, _fadeDistances(
FadeDistancesInfo,
glm::vec2(1e4f, 1e6f),
@@ -416,7 +416,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) {
if (token.empty()) {
std::getline(issFeature, token, '=');
}
strncpy(lEntry.feature, token.c_str(), 256);
strncpy(lEntry.feature, token.c_str(), 255);
GlobeBrowsingModule* _globeBrowsingModule =
global::moduleEngine->module<openspace::GlobeBrowsingModule>();

View File

@@ -259,7 +259,7 @@ Layer::Layer(layers::Group::ID id, const ghoul::Dictionary& layerDict, LayerGrou
_typeOption.addOption(static_cast<int>(li.id), std::string(li.identifier));
}
_typeOption.setValue(static_cast<int>(typeID));
_type = static_cast<layers::Layer::ID>(_typeOption.value());
_typeId = static_cast<layers::Layer::ID>(_typeOption.value());
for (const layers::Blend& bi : layers::Blends) {
_blendModeOption.addOption(static_cast<int>(bi.id), std::string(bi.identifier));
@@ -341,7 +341,7 @@ Layer::Layer(layers::Group::ID id, const ghoul::Dictionary& layerDict, LayerGrou
throw ghoul::MissingCaseException();
}
_type = static_cast<layers::Layer::ID>(_typeOption.value());
_typeId = static_cast<layers::Layer::ID>(_typeOption.value());
initializeBasedOnType(type(), {});
addVisibleProperties();
if (_onChangeCallback) {
@@ -417,7 +417,7 @@ Tile::Status Layer::tileStatus(const TileIndex& index) const {
}
layers::Layer::ID Layer::type() const {
return _type;
return _typeId;
}
layers::Blend::ID Layer::blendMode() const {
@@ -511,7 +511,6 @@ void Layer::initializeBasedOnType(layers::Layer::ID id, ghoul::Dictionary initDi
LDEBUG("Initializing tile provider for layer: '" + name + "'");
}
_tileProvider = TileProvider::createFromDictionary(id, std::move(initDict));
break;
case layers::Layer::ID::SolidColor:
if (initDict.hasValue<glm::dvec3>(ColorInfo.identifier)) {

View File

@@ -87,7 +87,7 @@ private:
properties::TriggerProperty _remove;
properties::StringProperty _guiDescription;
layers::Layer::ID _type;
layers::Layer::ID _typeId;
std::unique_ptr<TileProvider> _tileProvider;
properties::Vec3Property _solidColor;
LayerRenderSettings _renderSettings;

View File

@@ -87,7 +87,7 @@ LayerAdjustment::LayerAdjustment()
_typeOption.addOption(static_cast<int>(ai.id), std::string(ai.identifier));
}
_typeOption.setValue(static_cast<int>(layers::Adjustment::ID::None));
_type = static_cast<layers::Adjustment::ID>(_typeOption.value());
_typeId = static_cast<layers::Adjustment::ID>(_typeOption.value());
_typeOption.onChange([this]() {
switch (type()) {
@@ -100,7 +100,7 @@ LayerAdjustment::LayerAdjustment()
case layers::Adjustment::ID::TransferFunction:
break;
}
_type = static_cast<layers::Adjustment::ID>(_typeOption.value());
_typeId = static_cast<layers::Adjustment::ID>(_typeOption.value());
addVisibleProperties();
if (_onChangeCallback) {
_onChangeCallback();
@@ -136,7 +136,7 @@ void LayerAdjustment::setValuesFromDictionary(const ghoul::Dictionary& adjustmen
}
layers::Adjustment::ID LayerAdjustment::type() const {
return _type;
return _typeId;
}
void LayerAdjustment::addVisibleProperties() {

View File

@@ -59,7 +59,7 @@ private:
properties::FloatProperty _chromaKeyTolerance;
properties::OptionProperty _typeOption;
layers::Adjustment::ID _type;
layers::Adjustment::ID _typeId;
std::function<void(void)> _onChangeCallback;
};

View File

@@ -485,7 +485,8 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
// Already existing directories causes a 'failure' but no error
if (ec) {
LWARNING(fmt::format(
"Failed to create directories for cache at: {}. Error Code: {}, message: {}",
"Failed to create directories for cache at: {}. "
"Error Code: {}, message: {}",
root, std::to_string(ec.value()), ec.message()
));
return std::nullopt;
@@ -494,7 +495,9 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("MRF");
if (driver != nullptr) {
GDALDataset* src = static_cast<GDALDataset*>(GDALOpen(_datasetFilePath.c_str(), GA_ReadOnly));
GDALDataset* src = static_cast<GDALDataset*>(
GDALOpen(_datasetFilePath.c_str(), GA_ReadOnly)
);
if (!src) {
LWARNING(fmt::format(
"Failed to load dataset: {}. GDAL Error: {}",
@@ -506,16 +509,34 @@ std::optional<std::string> RawTileDataReader::mrfCache() {
defer{ GDALClose(src); };
char** createOpts = nullptr;
createOpts = CSLSetNameValue(createOpts, "CACHEDSOURCE", _datasetFilePath.c_str());
createOpts = CSLSetNameValue(
createOpts,
"CACHEDSOURCE",
_datasetFilePath.c_str()
);
createOpts = CSLSetNameValue(createOpts, "NOCOPY", "true");
createOpts = CSLSetNameValue(createOpts, "uniform_scale", "2");
createOpts = CSLSetNameValue(createOpts, "compress", _cacheProperties.compression.c_str());
createOpts = CSLSetNameValue(createOpts, "quality", std::to_string(_cacheProperties.quality).c_str());
createOpts = CSLSetNameValue(createOpts, "blocksize", std::to_string(_cacheProperties.blockSize).c_str());
createOpts = CSLSetNameValue(
createOpts,
"compress",
_cacheProperties.compression.c_str()
);
createOpts = CSLSetNameValue(
createOpts,
"quality",
std::to_string(_cacheProperties.quality).c_str()
);
createOpts = CSLSetNameValue(
createOpts,
"blocksize",
std::to_string(_cacheProperties.blockSize).c_str()
);
createOpts = CSLSetNameValue(createOpts, "indexname", cache.c_str());
createOpts = CSLSetNameValue(createOpts, "DATANAME", cache.c_str());
GDALDataset* dst = static_cast<GDALDataset*>(driver->CreateCopy(mrf.c_str(), src, false, createOpts, nullptr, nullptr));
GDALDataset* dst = static_cast<GDALDataset*>(
driver->CreateCopy(mrf.c_str(), src, false, createOpts, nullptr, nullptr)
);
if (!dst) {
LWARNING(fmt::format(
"Failed to create MRF Caching dataset dataset: {}. GDAL Error: {}",

View File

@@ -68,7 +68,7 @@ public:
private:
std::optional<std::string> mrfCache();
void initialize();
RawTile::ReadError rasterRead(int rasterBand, const IODescription& io,

View File

@@ -158,7 +158,11 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
return gi.id == id;
}
);
auto layerGroup = it != layers::Groups.end() ? it->name : std::to_string(static_cast<int>(_layerGroupID));
std::string layerGroup =
it != layers::Groups.end() ?
std::string(it->name) :
std::to_string(static_cast<int>(_layerGroupID));
std::string identifier = p.identifier.value_or("unspecified");
std::string enclosing = p.globeName.value_or("unspecified");
@@ -168,7 +172,9 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
GlobeBrowsingModule& module = *global::moduleEngine->module<GlobeBrowsingModule>();
bool enabled = module.isMRFCachingEnabled();
Compression compression =
_layerGroupID == layers::Group::ID::HeightLayers ? Compression::LERC : Compression::JPEG;
_layerGroupID == layers::Group::ID::HeightLayers ?
Compression::LERC :
Compression::JPEG;
int quality = 75;
int blockSize = 1024;
if (p.cacheSettings.has_value()) {
@@ -196,7 +202,9 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
addProperty(_tilePixelSize);
}
void DefaultTileProvider::initAsyncTileDataReader(TileTextureInitData initData, TileCacheProperties cacheProperties) {
void DefaultTileProvider::initAsyncTileDataReader(TileTextureInitData initData,
TileCacheProperties cacheProperties)
{
ZoneScoped;
_asyncTextureDataProvider = std::make_unique<AsyncTileDataProvider>(

View File

@@ -48,7 +48,8 @@ public:
static documentation::Documentation Documentation();
private:
void initAsyncTileDataReader(TileTextureInitData initData, TileCacheProperties cacheProperties);
void initAsyncTileDataReader(TileTextureInitData initData,
TileCacheProperties cacheProperties);
properties::StringProperty _filePath;
properties::IntProperty _tilePixelSize;

View File

@@ -118,8 +118,8 @@ void TileProvider::deinitializeDefaultTile() {
DefaultTileTexture = nullptr;
}
TileProvider::TileProvider()
: properties::PropertyOwner({ "TileProvider", "Tile Provider" })
TileProvider::TileProvider()
: properties::PropertyOwner({ "TileProvider", "Tile Provider" })
{}
void TileProvider::initialize() {
@@ -152,9 +152,9 @@ void TileProvider::deinitialize() {
internalDeinitialize();
}
ChunkTile TileProvider::traverseTree(TileIndex tileIndex, int parents, int maxParents,
std::function<void(TileIndex&, TileUvTransform&)>& ascendToParent,
TileUvTransform& uvTransform)
ChunkTile TileProvider::traverseTree(TileIndex tileIndex, int parents, int maxParents,
std::function<void(TileIndex&, TileUvTransform&)>& ascendToParent,
TileUvTransform& uvTransform)
{
// Step 1. Traverse 0 or more parents up the chunkTree as requested by the caller
for (int i = 0; i < parents && tileIndex.level > 1; i++) {

View File

@@ -132,7 +132,7 @@ struct TileProvider : public properties::PropertyOwner {
virtual float noDataValueAsFloat() = 0;
virtual ChunkTile chunkTile(TileIndex tileIndex, int parents = 0,
virtual ChunkTile chunkTile(TileIndex tileIndex, int parents = 0,
int maxParents = 1337);
ChunkTilePile chunkTilePile(TileIndex tileIndex, int pileSize);
@@ -142,8 +142,8 @@ struct TileProvider : public properties::PropertyOwner {
uint16_t uniqueIdentifier = 0;
bool isInitialized = false;
protected:
ChunkTile traverseTree(TileIndex tileIndex, int parents, int maxParents,
std::function<void(TileIndex&, TileUvTransform&)>& ascendToParent,
ChunkTile traverseTree(TileIndex tileIndex, int parents, int maxParents,
std::function<void(TileIndex&, TileUvTransform&)>& ascendToParent,
TileUvTransform& uvTransform);
private:

View File

@@ -348,7 +348,7 @@ void GuiSpaceTimeComponent::render() {
openspace::TimeUnits.end(),
std::string(""),
[](const std::string& a, const openspace::TimeUnit& unit) {
return fmt::format("{}{} / second", a, nameForTimeUnit(unit, true)) + '\0';
return fmt::format("{}{} / second\0", a, nameForTimeUnit(unit, true));
}
);

View File

@@ -67,7 +67,7 @@ private:
Allow
};
properties::OptionProperty _type;
properties::OptionProperty _socketType;
properties::IntProperty _port;
properties::BoolProperty _enabled;
properties::StringListProperty _allowAddresses;

View File

@@ -33,7 +33,7 @@ namespace openspace {
class CameraTopic : public Topic {
public:
CameraTopic();
virtual ~CameraTopic();
~CameraTopic() override;
void handleJson(const nlohmann::json& json) override;
bool isDone() const override;

View File

@@ -36,7 +36,7 @@ namespace openspace {
class MissionTopic : public Topic {
public:
MissionTopic() = default;
virtual ~MissionTopic() = default;
~MissionTopic() override = default;
void handleJson(const nlohmann::json& json) override;
bool isDone() const override;

View File

@@ -108,7 +108,7 @@ std::unique_ptr<ServerInterface> ServerInterface::createFromDictionary(
ServerInterface::ServerInterface(const ghoul::Dictionary& config)
: properties::PropertyOwner({ "", "", "" })
, _type(TypeInfo)
, _socketType(TypeInfo)
, _port(PortInfo, 0)
, _enabled(EnabledInfo)
, _allowAddresses(AllowAddressesInfo)
@@ -118,11 +118,11 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
, _password(PasswordInfo)
{
_type.addOption(
_socketType.addOption(
static_cast<int>(InterfaceType::TcpSocket),
std::string(TcpSocketType)
);
_type.addOption(
_socketType.addOption(
static_cast<int>(InterfaceType::WebSocket),
std::string(WebSocketType)
);
@@ -195,7 +195,7 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
initialize();
};
_type.onChange(reinitialize);
_socketType.onChange(reinitialize);
_port.onChange(reinitialize);
_enabled.onChange(reinitialize);
_defaultAccess.onChange(reinitialize);
@@ -203,7 +203,7 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
_requirePasswordAddresses.onChange(reinitialize);
_denyAddresses.onChange(reinitialize);
addProperty(_type);
addProperty(_socketType);
addProperty(_port);
addProperty(_enabled);
addProperty(_defaultAccess);
@@ -219,7 +219,7 @@ void ServerInterface::initialize() {
if (!_enabled) {
return;
}
switch (static_cast<InterfaceType>(_type.value())) {
switch (static_cast<InterfaceType>(_socketType.value())) {
case InterfaceType::TcpSocket:
_socketServer = std::make_unique<ghoul::io::TcpSocketServer>();
break;

View File

@@ -71,7 +71,7 @@ nlohmann::json MissionTopic::createPhaseJson(const MissionPhase& phase) const {
json subphaseJson = createPhaseJson(missionPhase);
phases.push_back(subphaseJson);
}
json milestones = json::array();
const std::vector<Milestone>& dates = phase.milestones();
for (const Milestone& date : dates) {
@@ -79,7 +79,7 @@ nlohmann::json MissionTopic::createPhaseJson(const MissionPhase& phase) const {
{ "date", std::string(date.date.ISO8601()) },
{ "name", date.name }
};
if (date.description.has_value()) {
jsonDate["description"] = *date.description;;
}

View File

@@ -61,7 +61,6 @@ public:
glm::dvec3 rightVector() const;
glm::dvec3 upVector() const;
private:
// Properties
properties::FloatProperty _crossHairSize;
properties::FloatProperty _showRectangleThreshold;
properties::FloatProperty _lineWidth;

View File

@@ -46,13 +46,12 @@ public:
void render() override;
void update() override;
float opacity() const noexcept;
float opacity() const noexcept override;
glm::dvec2 fineTuneVector(const glm::dvec2& drag);
bool isInitialized() const;
bool isPointingSpacecraft() const;
double setVerticalFovWithScroll(float scroll);
void setOpacity(float opacity);
void setIdInBrowser() const;
void setIsInitialized(bool isInitialized);
void setPointSpaceCraft(bool shouldPoint);

View File

@@ -42,8 +42,6 @@
#include <ghoul/opengl/textureunit.h>
namespace {
constexpr std::string_view _loggerCat = "RenderableSkyTarget";
enum BlendMode {
Normal = 0,
Additive
@@ -121,8 +119,8 @@ RenderableSkyTarget::RenderableSkyTarget(const ghoul::Dictionary& dictionary)
, _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)
, _applyRoll(ApplyRollInfo, true)
, _borderColor(220, 220, 220)
{
// Handle target dimension property
_autoScale = false;
@@ -175,12 +173,14 @@ glm::ivec3 RenderableSkyTarget::borderColor() const {
}
glm::dvec3 RenderableSkyTarget::rightVector() const {
double scaling = (_verticalFov / 70)* static_cast<double>(glm::compMax(_size.value()));
double scaling =
(_verticalFov / 70) * static_cast<double>(glm::compMax(_size.value()));
return scaling * _rightVector;
}
glm::dvec3 RenderableSkyTarget::upVector() const {
double scaling = (_verticalFov / 70) * static_cast<double>(glm::compMax(_size.value()));
double scaling =
(_verticalFov / 70) * static_cast<double>(glm::compMax(_size.value()));
return scaling * _upVector;
}

View File

@@ -38,8 +38,6 @@
#include <random>
namespace {
constexpr std::string_view _loggerCat = "ScreenSpaceSkyBrowser";
constexpr openspace::properties::Property::PropertyInfo TextureQualityInfo = {
"TextureQuality",
"Quality of Texture",
@@ -380,10 +378,6 @@ glm::mat4 ScreenSpaceSkyBrowser::scaleMatrix() {
return scale;
}
void ScreenSpaceSkyBrowser::setOpacity(float opacity) {
_opacity = opacity;
}
float ScreenSpaceSkyBrowser::opacity() const noexcept {
return _opacity;
}

View File

@@ -32,8 +32,6 @@
#include <deque>
namespace {
constexpr std::string_view _loggerCat = "WwtCommunicator";
// WWT messages
ghoul::Dictionary moveCameraMessage(const glm::dvec2& celestCoords, double fov,
double roll)

View File

@@ -330,7 +330,7 @@ void WwtDataHandler::loadImages(const std::string& root,
}
);
// Set the identifiers to the correct order
for (int i = 0; i < _imageVector.size(); i++) {
for (size_t i = 0; i < _imageVector.size(); i++) {
_images[_imageVector[i].imageUrl].identifier = std::to_string(i);
}

View File

@@ -86,14 +86,14 @@ public:
* Main function call
* 1 Checks if doubleTap occured
* 2 If the node in focus is large enough and all contact points have selected it,
* calls directControl() function for direct-manipulation
* 3 Updates std::vector<SelectedBody> _selectedContactPoints (only if LMA successfully
* converged, avoids interaction to snap on LMA fails)
* calls directControl() function for direct-manipulation
* 3 Updates std::vector<SelectedBody> _selectedContactPoints (only if LMA
* successfully converged, avoids interaction to snap on LMA fails)
* 4 If directControl() wasn't called this frame, interpret the incoming
* list and decide what type of interaction this frame should do
* list and decide what type of interaction this frame should do
* 5 Compute the new total velocities after interaction
* 6 Evaluate if directControl should be called next frame- true if all contact points
* select the same node and said node is larger than _nodeRadiusThreshold
* select the same node and said node is larger than _nodeRadiusThreshold
*/
void updateStateFromInput(const std::vector<TouchInputHolder>& list,

View File

@@ -302,12 +302,17 @@ TouchInteraction::TouchInteraction()
0.01f,
0.25f
)
, _zoomInBoundarySphereMultiplier(ZoomInBoundarySphereMultiplierInfo, 1.001f, 0.01f, 4e+27)
, _zoomInBoundarySphereMultiplier(
ZoomInBoundarySphereMultiplierInfo,
1.001f,
0.01f,
4e+27f
)
, _zoomOutBoundarySphereMultiplier(
ZoomOutBoundarySphereMultiplierInfo,
4e+27,
4e+27f,
1.f,
4e+27
4e+27f
)
, _zoomInLimit(ZoomInLimitInfo, -1.0, 0.0, 4e+27)
, _zoomOutLimit(
@@ -474,7 +479,12 @@ void TouchInteraction::directControl(const std::vector<TouchInputHolder>& list)
std::vector<double> par(6, 0.0);
par[0] = _lastVel.orbit.x; // use _lastVel for orbit
par[1] = _lastVel.orbit.y;
bool lmSuccess = _directInputSolver.solve(list, _selectedNodeSurfacePoints, &par, *_camera);
bool lmSuccess = _directInputSolver.solve(
list,
_selectedNodeSurfacePoints,
&par,
*_camera
);
int nDof = _directInputSolver.nDof();
if (lmSuccess && !_unitTest) {
@@ -505,7 +515,8 @@ void TouchInteraction::directControl(const std::vector<TouchInputHolder>& list)
}
}
void TouchInteraction::updateNodeSurfacePoints(const std::vector<TouchInputHolder>& list) {
void TouchInteraction::updateNodeSurfacePoints(const std::vector<TouchInputHolder>& list)
{
_selectedNodeSurfacePoints.clear();
const SceneGraphNode* anchor =

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOPLANE___H__
#define __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOPLANE___H__
#ifndef __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOPLANE___H__
#define __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOPLANE___H__
#include <modules/base/rendering/renderableplane.h>
@@ -55,4 +55,4 @@ private:
} // namespace openspace
#endif // __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOPLANE___H__
#endif // __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOPLANE___H__

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOSPHERE___H__
#define __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOSPHERE___H__
#ifndef __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOSPHERE___H__
#define __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOSPHERE___H__
#include <openspace/rendering/renderable.h>
@@ -91,4 +91,4 @@ private:
} // namespace openspace
#endif // __OPENSPACE_MODULE_BASE___RENDERABLEVIDEOSPHERE___H__
#endif // __OPENSPACE_MODULE_VIDEO___RENDERABLEVIDEOSPHERE___H__

View File

@@ -52,7 +52,7 @@ BooleanType(PauseAfterSeek);
public:
VideoPlayer(const ghoul::Dictionary& dictionary);
~VideoPlayer();
~VideoPlayer() override;
void initialize();
@@ -141,12 +141,10 @@ private:
// Syncing with multiple nodes
double _correctPlaybackTime = 0.0;
double _deltaTime = 0.0;
// Video stretching: map to simulation time animation mode
double _startJ200Time = 0.0;
double _endJ200Time = 0.0;
double _timeAtLastRender = 0.0;
double _frameDuration = 0.0;
// Libmpv

View File

@@ -39,24 +39,22 @@
namespace openspace { struct Documentation; }
namespace openspace {
namespace openspace::globebrowsing {
class VideoTileProvider : public globebrowsing::TileProvider {
class VideoTileProvider : public TileProvider {
public:
VideoTileProvider(const ghoul::Dictionary& dictionary);
~VideoTileProvider();
~VideoTileProvider() override;
void update() override final;
void reset() override final;
int minLevel() override final;
int maxLevel() override final;
float noDataValueAsFloat() override final;
globebrowsing::ChunkTile chunkTile(globebrowsing::TileIndex tileIndex, int parents,
int maxParents = 1337) override;
globebrowsing::Tile tile(const globebrowsing::TileIndex& tileIndex) override final;
globebrowsing::Tile::Status tileStatus(
const globebrowsing::TileIndex& tileIndex) override final;
globebrowsing::TileDepthTransform depthTransform() override final;
ChunkTile chunkTile(TileIndex tileIndex, int parents, int maxParents = 1337) override;
Tile tile(const TileIndex& tileIndex) override final;
Tile::Status tileStatus(const TileIndex& tileIndex) override final;
TileDepthTransform depthTransform() override final;
private:
void internalInitialize() override final;
@@ -64,12 +62,12 @@ private:
// Tile handling
// Cache for rendering 1 frame
std::map<globebrowsing::TileIndex::TileHashKey, globebrowsing::Tile> _tileCache;
std::map<TileIndex::TileHashKey, Tile> _tileCache;
bool _tileIsReady = false;
VideoPlayer _videoPlayer;
};
} // namespace openspace
} // namespace openspace::globebrowsing
#endif // __OPENSPACE_MODULE_VIDEO___VIDEOTILEPROVIDER___H__

View File

@@ -89,13 +89,6 @@ namespace {
"'YYYY MM DD hh:mm:ss'."
};
constexpr openspace::properties::Property::PropertyInfo PlaybackModeInfo = {
"PlaybackMode",
"Playback Mode",
"Determines the way the video should be played. The start and end time of the "
"video can be set, or the video can be played as a loop in real time."
};
constexpr openspace::properties::Property::PropertyInfo LoopVideoInfo = {
"LoopVideo",
"Loop Video",
@@ -269,7 +262,7 @@ VideoPlayer::VideoPlayer(const ghoul::Dictionary& dictionary)
_reset.onChange([this]() { reset(); });
addProperty(_reset);
if (p.playbackMode.has_value()) {
switch (*p.playbackMode) {
case Parameters::PlaybackMode::RealTimeLoop:
@@ -292,7 +285,7 @@ VideoPlayer::VideoPlayer(const ghoul::Dictionary& dictionary)
addProperty(_pause);
_goToStart.onChange([this]() { goToStart(); });
addProperty(_goToStart);
_loopVideo.onChange([this]() {
_loopVideo.onChange([this]() {
std::string newValue = _loopVideo ? "inf" : "no";
setPropertyAsyncMpv(newValue.c_str(), MpvKey::Loop);
});
@@ -387,7 +380,7 @@ void VideoPlayer::initializeMpv() {
// https://mpv.io/manual/master/#options-gpu-api
setPropertyStringMpv("gpu-api", "opengl");
// Keep open the file. Even when we reach EOF we want to keep the video player
// Keep open the file. Even when we reach EOF we want to keep the video player
// running, in case the user starts the video from the beginning again
// https://mpv.io/manual/stable/#options-keep-open
setPropertyStringMpv("keep-open", "yes");
@@ -484,7 +477,7 @@ void VideoPlayer::initializeMpv() {
}
void VideoPlayer::seekToTime(double time, PauseAfterSeek pauseAfter) {
if (_isSeeking || abs(_currentVideoTime - time) < glm::epsilon<double>()) {
if (_isSeeking || std::abs(_currentVideoTime - time) < glm::epsilon<double>()) {
return;
}
pause();
@@ -623,7 +616,7 @@ void VideoPlayer::handleMpvProperties(mpv_event* event) {
}
// Cast event to node or property depending on its format
mpv_event_property* prop = nullptr;
mpv_node node;
mpv_node node = {};
if (formats[key] == MPV_FORMAT_NODE) {
int result = mpv_event_to_node(&node, event);
if (!checkMpvError(result)) {

View File

@@ -39,14 +39,7 @@ namespace {
constexpr std::string_view _loggerCat = "VideoTileProvider";
} // namespace
namespace openspace {
namespace {
bool isDifferent(double first, double second) {
return abs(first - second) > glm::epsilon<double>();
}
}
namespace openspace::globebrowsing {
VideoTileProvider::VideoTileProvider(const ghoul::Dictionary& dictionary)
: _videoPlayer(dictionary)
@@ -61,7 +54,7 @@ globebrowsing::Tile VideoTileProvider::tile(const globebrowsing::TileIndex& tile
ZoneScoped;
if (!_videoPlayer.isInitialized()) {
return globebrowsing::Tile();
return Tile();
}
// Always check that our framebuffer is ok
@@ -76,28 +69,28 @@ globebrowsing::Tile VideoTileProvider::tile(const globebrowsing::TileIndex& tile
foundTile->second.texture != _videoPlayer.frameTexture().get();
if (foundTile == _tileCache.end() || textureChanged) {
_tileCache[hash] = globebrowsing::Tile{
_tileCache[hash] = Tile {
_videoPlayer.frameTexture().get(),
std::nullopt,
globebrowsing::Tile::Status::OK
Tile::Status::OK
};
}
return _tileCache[hash];
}
globebrowsing::Tile::Status VideoTileProvider::tileStatus(const globebrowsing::TileIndex& tileIndex) {
Tile::Status VideoTileProvider::tileStatus(const TileIndex& tileIndex) {
if (tileIndex.level > maxLevel()) {
return globebrowsing::Tile::Status::OutOfRange;
return Tile::Status::OutOfRange;
}
else if (_tileIsReady) {
return globebrowsing::Tile::Status::OK;
return Tile::Status::OK;
}
else {
return globebrowsing::Tile::Status::Unavailable;
return Tile::Status::Unavailable;
}
}
globebrowsing::TileDepthTransform VideoTileProvider::depthTransform() {
TileDepthTransform VideoTileProvider::depthTransform() {
return { 0.f, 1.f };
}
@@ -109,17 +102,15 @@ void VideoTileProvider::reset() {
_videoPlayer.reset();
}
globebrowsing::ChunkTile VideoTileProvider::chunkTile(globebrowsing::TileIndex tileIndex,
int parents, int maxParents) {
using namespace globebrowsing;
ChunkTile VideoTileProvider::chunkTile(TileIndex tileIndex, int parents, int maxParents) {
std::function<void(TileIndex&, TileUvTransform&)> ascendToParent =
[](TileIndex& ti, TileUvTransform&) {
ti.level--;
};
glm::vec2 noOfTiles = {
std::pow(2, tileIndex.level),
std::pow(2, tileIndex.level - 1)
glm::vec2 noOfTiles = {
std::pow(2, tileIndex.level),
std::pow(2, tileIndex.level - 1)
};
glm::vec2 ratios = { 1.f / noOfTiles.x, 1.f / noOfTiles.y };
float offsetX = ratios.x * static_cast<float>(tileIndex.x);
@@ -153,4 +144,4 @@ void VideoTileProvider::internalDeinitialize() {
_videoPlayer.destroy();
}
} // namespace openspace
} // namespace openspace::globebrowsing

View File

@@ -65,7 +65,7 @@ void VideoModule::internalInitialize(const ghoul::Dictionary& dict) {
ghoul::TemplateFactory<globebrowsing::TileProvider>* fTileProvider =
FactoryManager::ref().factory<globebrowsing::TileProvider>();
ghoul_assert(fTileProvider, "TileProvider factory was not created");
fTileProvider->registerClass<VideoTileProvider>("VideoTileLayer");
fTileProvider->registerClass<globebrowsing::VideoTileProvider>("VideoTileLayer");
ghoul::TemplateFactory<ScreenSpaceRenderable>* fSsRenderable =
FactoryManager::ref().factory<ScreenSpaceRenderable>();

View File

@@ -90,7 +90,9 @@ add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper SYSTEM)
mark_as_advanced(CEF_DEBUG_INFO_FLAG USE_ATL USE_OFFICIAL_BUILD_SANDBOX USE_SANDBOX)
target_compile_options(libcef_dll_wrapper PRIVATE "-w")
if (UNIX)
target_compile_options(libcef_dll_wrapper PRIVATE "-w")
endif ()
target_precompile_headers(libcef_dll_wrapper PRIVATE
[["include/cef_client.h"]]

View File

@@ -35,14 +35,6 @@
#include <fstream>
namespace {
constexpr std::string_view HandlebarsFilename =
"${WEB}/documentation/handlebars-v4.0.5.js";
constexpr std::string_view BootstrapFilename = "${WEB}/common/bootstrap.min.css";
constexpr std::string_view CssFilename = "${WEB}/documentation/style.css";
constexpr std::string_view JsFilename = "${WEB}/documentation/script.js";
} // namespace
namespace openspace::documentation {
DocumentationEngine* DocumentationEngine::_instance = nullptr;
@@ -118,9 +110,9 @@ nlohmann::json generateJsonDocumentation(const Documentation& d) {
}
}
else if (tv) {
nlohmann::json json = generateJsonDocumentation(tv->documentations);
nlohmann::json restrictions = generateJsonDocumentation(tv->documentations);
// We have a TableVerifier, so we need to recurse
entry["restrictions"] = json;
entry["restrictions"] = restrictions;
}
else {
entry["description"] = p.verifier->documentation();

View File

@@ -1055,17 +1055,17 @@ void OpenSpaceEngine::writeDocumentation() {
nlohmann::json license = writer.generateJsonGroupedByLicense();
nlohmann::json sceneProperties = settings.get();
nlohmann::json sceneGraph = scene.get();
sceneProperties["name"] = "Settings";
sceneGraph["name"] = "Scene";
// Add this here so that the generateJson function is the same as before to ensure
// backwards compatibility
nlohmann::json scriptingResult;
scriptingResult["name"] = "Scripting API";
scriptingResult["data"] = scripting;
nlohmann::json documentation = {
nlohmann::json documentation = {
sceneGraph, sceneProperties, keybindings, license, scriptingResult, factory
};

View File

@@ -119,7 +119,7 @@ struct [[codegen::Dictionary(Action)]] Action {
if (!a.guiPath.starts_with('/')) {
throw ghoul::RuntimeError(
fmt::format(
"Tried to register action: '{}'. The field 'GuiPath' is set to '{}' but "
"Tried to register action: '{}'. The field 'GuiPath' is set to '{}' but "
"should be '/{}' ", a.name, a.guiPath, a.guiPath)
);
}

View File

@@ -43,7 +43,8 @@ namespace {
std::optional<std::string> description;
struct TimeRange {
std::string start [[codegen::annotation("A string representing a valid date")]];
std::string start
[[codegen::annotation("A string representing a valid date")]];
std::optional<std::string> end
[[codegen::annotation("A string representing a valid date")]];
};
@@ -163,7 +164,10 @@ MissionPhase::MissionPhase(const ghoul::Dictionary& dictionary) {
for (const Parameters::Milestone& milestone : *p.milestones) {
std::string name = milestone.name;
Time newTime = Time(milestone.date);
Milestone newDate = { name, newTime };
Milestone newDate = {
.name = name,
.date = newTime
};
if (milestone.description.has_value()) {
newDate.description = milestone.description.value();
}
@@ -172,7 +176,7 @@ MissionPhase::MissionPhase(const ghoul::Dictionary& dictionary) {
}
if (milestone.link.has_value()) {
newDate.link = milestone.link.value();
}
}
if (milestone.actions.has_value()) {
newDate.actions = milestone.actions.value();
}

View File

@@ -1711,7 +1711,8 @@ glm::dvec3 OrbitalNavigator::pushToSurface(const glm::dvec3& cameraPosition,
// Adjustment for if the camera is outside the max distance
// Only apply if the min adjustment not already applied
if (maxHeight > 0.0 && std::abs(adjustment) < std::numeric_limits<double>::epsilon()) {
if (maxHeight > 0.0 && std::abs(adjustment) < std::numeric_limits<double>::epsilon())
{
adjustment = glm::min(maxHeight - surfaceToCameraSigned, 0.0);
}

View File

@@ -66,7 +66,7 @@ namespace {
json["properties"].push_back(propertyJson);
}
sortJson(json["properties"], "name");
sortJson(json["properties"], "name");
auto propertyOwners = owner->propertySubOwners();
for (properties::PropertyOwner* o : propertyOwners) {

View File

@@ -80,7 +80,7 @@ float Fadeable::opacity() const noexcept {
float fadeFromParent = 1.f;
if (_parentFadeable) {
// Note that we only care about the fade here, not the full opacity of the
// parent. A subowner might still be visible even if the opacity of the
// parent. A subowner might still be visible even if the opacity of the
// parent is set to zero
fadeFromParent = _parentFadeable->fade();
}

View File

@@ -1269,7 +1269,7 @@ void RenderEngine::renderVersionInformation() {
);
}
float debugOffset = 0.f;
[[maybe_unused]] float debugOffset = 0.f;
#ifdef _DEBUG
{
const glm::vec2 debugBox = _fontVersionInfo->boundingBox("Debug build");

View File

@@ -803,7 +803,8 @@ scripting::LuaLibrary Scene::luaLibrary() {
"The URI is interpreted using a wildcard in which '*' is expanded to "
"'(.*)' and bracketed components '{ }' are interpreted as group tag "
"names. Then, the passed value will be set on all properties that fit "
"the regex + group name combination."
"the regex + group name combination.",
{}
},
{
"setPropertyValueSingle",
@@ -817,30 +818,33 @@ scripting::LuaLibrary Scene::luaLibrary() {
"the value is interpolated at each step in between. The fourth "
"parameter is an optional easing function if a 'duration' has been "
"specified. If 'duration' is 0, this parameter value is ignored. "
"Otherwise, it has to be one of the easing functions defined in the list below. "
"This is the same as calling the setValue method and passing 'single' as "
"the fourth argument to setPropertyValue. The fifth argument is another "
"Lua script that will be executed when the interpolation provided in "
"parameter 3 finishes. "
"\n Avaiable easing functions: "
"Otherwise, it has to be one of the easing functions defined in the list "
"below. This is the same as calling the setValue method and passing "
"'single' as the fourth argument to setPropertyValue. The fifth argument "
"is another Lua script that will be executed when the interpolation "
"provided in parameter 3 finishes.\n Avaiable easing functions: "
"Linear, QuadraticEaseIn, QuadraticEaseOut, QuadraticEaseInOut, "
"CubicEaseIn, CubicEaseOut, CubicEaseInOut, QuarticEaseIn, "
"QuarticEaseOut, QuarticEaseInOut, QuinticEaseIn, QuinticEaseOut, "
"QuinticEaseInOut, SineEaseIn, SineEaseOut, SineEaseInOut, CircularEaseIn, "
"CircularEaseOut, CircularEaseInOut, ExponentialEaseIn, ExponentialEaseOut, "
"ExponentialEaseInOut, ElasticEaseIn, ElasticEaseOut, ElasticEaseInOut, "
"BounceEaseIn, BounceEaseOut, BounceEaseInOut"
"QuinticEaseInOut, SineEaseIn, SineEaseOut, SineEaseInOut, "
"CircularEaseIn, CircularEaseOut, CircularEaseInOut, ExponentialEaseIn, "
"ExponentialEaseOut, ExponentialEaseInOut, ElasticEaseIn, "
"ElasticEaseOut, ElasticEaseInOut, BounceEaseIn, BounceEaseOut, "
"BounceEaseInOut",
{}
},
{
"getPropertyValue",
&luascriptfunctions::propertyGetValue,
{},
"",
"Returns the value the property, identified by the provided URI"
"Returns the value the property, identified by the provided URI",
{}
},
codegen::lua::HasProperty,
codegen::lua::GetProperty,
codegen::lua::AddCustomProperty,
codegen::lua::AddCustomProperty,
codegen::lua::RemoveCustomProperty,
codegen::lua::AddSceneGraphNode,
codegen::lua::RemoveSceneGraphNode,

View File

@@ -535,8 +535,8 @@ SceneGraphNode::SceneGraphNode()
, _distFromCamToNode(DistanceFromCamToNodeInfo, -1.0)
, _screenSizeRadius(ScreenSizeRadiusInfo, 0)
, _visibilityDistance(VisibilityDistanceInfo, 6e10f)
, _showDebugSphere(ShowDebugSphereInfo, false)
, _supportsDirectInteraction(SupportsDirectInteractionInfo, false)
, _showDebugSphere(ShowDebugSphereInfo, false)
{
addProperty(_computeScreenSpaceValues);
addProperty(_screenSpacePosition);

View File

@@ -45,7 +45,6 @@ nlohmann::json SceneLicenseWriter::generateJsonGroupedByLicense() const {
global::openSpaceEngine->assetManager().allAssets();
int metaTotal = 0;
int metaCount = 0;
for (const Asset* asset : assets) {
std::optional<Asset::MetaInformation> meta = asset->metaInformation();
if (!meta.has_value()) {
@@ -99,12 +98,14 @@ nlohmann::json SceneLicenseWriter::generateJsonGroupedByLicense() const {
assetLicenses[license].push_back(assetJson);
}
}
nlohmann::json assetsJson;
assetsJson["name"] = "Assets";
assetsJson["type"] = "Licenses";
for (const std::pair<std::string, nlohmann::json>& assetLicense : assetLicenses) {
using K = const std::string;
using V = nlohmann::json;
for (const std::pair<K, V>& assetLicense : assetLicenses) {
nlohmann::json entry;
entry["name"] = assetLicense.first;
entry["assets"] = assetLicense.second;
@@ -116,7 +117,7 @@ nlohmann::json SceneLicenseWriter::generateJsonGroupedByLicense() const {
nlohmann::json result;
result["name"] = "Licenses";
result["data"] = json;
return result;
}

View File

@@ -81,8 +81,8 @@ namespace {
return result;
}
nlohmann::json toJson(const openspace::scripting::LuaLibrary::Function& f,
bool includeSourceLocation)
nlohmann::json toJson(const openspace::scripting::LuaLibrary::Function& f,
bool includeSourceLocation)
{
using namespace openspace;
using namespace openspace::scripting;
@@ -638,7 +638,8 @@ void ScriptEngine::addBaseLibrary() {
"",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Trace'. For Boolean, numbers, and strings, the internal values are "
"printed, for all other types, the type is printed instead"
"printed, for all other types, the type is printed instead",
{}
},
{
"printDebug",
@@ -647,7 +648,8 @@ void ScriptEngine::addBaseLibrary() {
"",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Debug'. For Boolean, numbers, and strings, the internal values are "
"printed, for all other types, the type is printed instead"
"printed, for all other types, the type is printed instead",
{}
},
{
"printInfo",
@@ -656,7 +658,8 @@ void ScriptEngine::addBaseLibrary() {
"",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Info'. For Boolean, numbers, and strings, the internal values are "
"printed, for all other types, the type is printed instead"
"printed, for all other types, the type is printed instead",
{}
},
{
"printWarning",
@@ -665,7 +668,8 @@ void ScriptEngine::addBaseLibrary() {
"",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Warning'. For Boolean, numbers, and strings, the internal values are "
"printed, for all other types, the type is printed instead"
"printed, for all other types, the type is printed instead",
{}
},
{
"printError",
@@ -674,7 +678,8 @@ void ScriptEngine::addBaseLibrary() {
"",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Error'. For Boolean, numbers, and strings, the internal values are "
"printed, for all other types, the type is printed instead"
"printed, for all other types, the type is printed instead",
{}
},
{
"printFatal",
@@ -683,7 +688,8 @@ void ScriptEngine::addBaseLibrary() {
"",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Fatal'. For Boolean, numbers, and strings, the internal values are "
"printed, for all other types, the type is printed instead"
"printed, for all other types, the type is printed instead",
{}
},
codegen::lua::AbsolutePath,
codegen::lua::SetPathToken,

View File

@@ -24,7 +24,7 @@
#include <openspace/util/factorymanager.h>
#include <openspace/documentation/documentationengine.h>
#include <openspace/documentation/documentationengine.h>
#include <openspace/documentation/documentation.h>
#include <openspace/json.h>
#include <openspace/rendering/dashboarditem.h>
@@ -80,9 +80,9 @@ nlohmann::json generateJsonDocumentation(const Documentation& d) {
}
}
else if (tv) {
nlohmann::json json = generateJsonDocumentation(tv->documentations);
nlohmann::json restrictions = generateJsonDocumentation(tv->documentations);
// We have a TableVerifier, so we need to recurse
entry["restrictions"] = json;
entry["restrictions"] = restrictions;
}
else {
entry["description"] = p.verifier->documentation();
@@ -142,7 +142,7 @@ FactoryManager& FactoryManager::ref() {
nlohmann::json FactoryManager::generateJson() const {
nlohmann::json json;
std::vector<Documentation> docs = DocEng.documentations();
std::vector<Documentation> docs = DocEng.documentations();
for (const FactoryInfo& factoryInfo : _factories) {
nlohmann::json factory;
@@ -161,7 +161,7 @@ nlohmann::json FactoryManager::generateJson() const {
nlohmann::json documentation = generateJsonDocumentation(*factoryDoc);
factory["classes"].push_back(documentation);
// Remove documentation from list check at the end if all docs got put in
docs.erase(factoryDoc);
docs.erase(factoryDoc);
}
else {
nlohmann::json documentation;
@@ -210,7 +210,7 @@ nlohmann::json FactoryManager::generateJson() const {
nlohmann::json result;
result["name"] = "Asset Types";
result["data"] = json;
return result;
}

View File

@@ -74,7 +74,7 @@ namespace {
"when interpolating"
};
constexpr std::string_view DeltaTimeStepsKeybindsGuiPath = "/Time/Simulation Speed/Steps";
constexpr std::string_view DeltaTimeStepsGuiPath = "/Time/Simulation Speed/Steps";
}
namespace openspace {
@@ -508,7 +508,7 @@ void TimeManager::addDeltaTimesKeybindings() {
"Setting the simulation speed to {} seconds per realtime second", s
);
action.name = fmt::format("Set: {}", s);
action.guiPath = DeltaTimeStepsKeybindsGuiPath;
action.guiPath = DeltaTimeStepsGuiPath;
action.isLocal = interaction::Action::IsLocal::Yes;
global::actionManager->registerAction(std::move(action));
global::keybindingManager->bindKey(key, mod, std::move(identifier));

View File

@@ -138,6 +138,7 @@ function (set_openspace_compile_settings target)
"-Wzero-as-null-pointer-constant"
"-Wno-attributes"
"-Wno-deprecated-enum-enum-conversion"
"-Wno-missing-braces"
"-Wno-unknown-attributes"
)
@@ -172,6 +173,7 @@ function (set_openspace_compile_settings target)
"-Wno-attributes"
"-Wno-deprecated-copy"
"-Wno-deprecated-enum-enum-conversion"
"-Wno-float-equal"
"-Wno-long-long"
"-Wno-missing-field-initializers"