Feature/warnings (#1885)

Remove many warnings from MSVC, Clang, and GCC
This commit is contained in:
Alexander Bock
2022-02-16 18:33:12 +01:00
committed by GitHub
parent 40ed640bc8
commit e8072495ec
47 changed files with 92 additions and 195 deletions
@@ -39,8 +39,6 @@
#include <optional>
namespace {
constexpr const char _loggerCat[] = "RenderableDisc";
constexpr const std::array<const char*, 4> UniformNames = {
"modelViewProjectionTransform", "opacity", "width", "colorTexture"
};
+1 -4
View File
@@ -586,10 +586,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)) *
glm::scale(
glm::dmat4(_modelTransform.value()),
glm::dvec3(_modelScale) // Model scale unit
);
glm::scale(_modelTransform.value(), glm::dvec3(_modelScale));
const glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() *
modelTransform;
@@ -291,7 +291,7 @@ void RenderablePlaneTimeVaryingImage::computeSequenceEndTime() {
const double lastTriggerTime = _startTimes[_sourceFiles.size() - 1];
const double sequenceDuration = lastTriggerTime - _startTimes[0];
const double averageStateDuration = sequenceDuration /
(static_cast<double>(_sourceFiles.size() - 1.0));
static_cast<double>(_sourceFiles.size() - 1);
_sequenceEndTime = lastTriggerTime + averageStateDuration;
}
}
@@ -36,8 +36,6 @@
#include <optional>
namespace {
constexpr const char _loggerCat[] = "RenderablePrism";
constexpr const std::array<const char*, 2> UniformNames = {
"modelViewProjectionTransform", "vs_color"
};
@@ -44,7 +44,7 @@
namespace {
constexpr const char* ProgramName = "Timevarying Sphere";
constexpr const char* _loggerCat = "RenderableTimeVaryingSphere";
constexpr const std::array<const char*, 5> UniformNames = {
"opacity", "modelViewProjection", "modelViewRotation", "colorTexture",
"mirrorTexture"
+3 -5
View File
@@ -108,7 +108,7 @@ int renderCameraPath(lua_State* L) {
return fmt::format("Point_{}", i);
};
auto addPoint = [pointIdentifier] (const std::string& id, glm::dvec3 p) {
auto addPoint = [](const std::string& id, glm::dvec3 p) {
const std::string pointNode = "{"
"Identifier = '" + id + "',"
"Parent = '" + RenderedPathIdentifier + "',"
@@ -126,10 +126,8 @@ int renderCameraPath(lua_State* L) {
);
};
auto addLineBetweenPoints = [pointIdentifier] (const std::string& id1,
const std::string& id2,
const glm::vec3& color,
float lineWidth)
auto addLineBetweenPoints = [](const std::string& id1, const std::string& id2,
const glm::vec3& color, float lineWidth)
{
const std::string lineNode = "{"
"Identifier = '" + fmt::format("Line{}", id1) + "',"
@@ -67,8 +67,6 @@ namespace {
"hasColorMap", "enabledRectSizeControl", "hasDvarScaling"
};
constexpr double PARSEC = 0.308567756E17;
enum RenderOption {
ViewDirection = 0,
PositionNormal
@@ -59,8 +59,6 @@ namespace {
constexpr const int RenderOptionViewDirection = 0;
constexpr const int RenderOptionPositionNormal = 1;
constexpr const double PARSEC = 0.308567756E17;
constexpr openspace::properties::Property::PropertyInfo TextColorInfo = {
"TextColor",
"Text Color",
@@ -55,8 +55,6 @@ namespace {
"spriteTexture", "hasColorMap"
};
constexpr double PARSEC = 0.308567756E17;
constexpr openspace::properties::Property::PropertyInfo SpriteTextureInfo = {
"Texture",
"Point Sprite Texture",
@@ -365,7 +365,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) {
// atlas)
// Once this limitation is fixed, we can remove the next piece of code
// Removing non ASCII characters:
strncpy(lEntry.feature, token.c_str(), 256);
strncpy(lEntry.feature, token.c_str(), 255);
int tokenChar = 0;
while (tokenChar < 256) {
if (lEntry.feature[tokenChar] < 0 && lEntry.feature[tokenChar] != '\0') {
@@ -112,7 +112,7 @@ TileDepthTransform ImageSequenceTileProvider::depthTransform() {
void ImageSequenceTileProvider::update() {
if (_isImageDirty && !_imagePaths.empty() &&
_index >= 0 && _index < _imagePaths.size())
_index >= 0 && _index < static_cast<int>(_imagePaths.size()))
{
if (_currentTileProvider) {
_currentTileProvider->deinitialize();
@@ -104,7 +104,7 @@ Tile SizeReferenceTileProvider::tile(const TileIndex& tileIndex) {
return TextTileProvider::renderTile(tileIndex, text, textPosition, glm::vec4(1.f));
}
Tile::Status SizeReferenceTileProvider::tileStatus(const TileIndex& index) {
Tile::Status SizeReferenceTileProvider::tileStatus(const TileIndex&) {
return Tile::Status::OK;
}
@@ -44,17 +44,8 @@
#include <sstream>
namespace {
constexpr const char* KeyBasePath = "BasePath";
constexpr const char* TimePlaceholder = "${OpenSpaceTimeId}";
constexpr openspace::properties::Property::PropertyInfo FilePathInfo = {
"FilePath",
"File Path",
"This is the path to the XML configuration file that describes the temporal tile "
"information."
};
constexpr openspace::properties::Property::PropertyInfo UseFixedTimeInfo = {
"UseFixedTime",
"Use Fixed Time",
@@ -450,8 +441,8 @@ DefaultTileProvider* TemporalTileProvider::retrieveTileProvider(const Time& t) {
_folder.files.cbegin(),
_folder.files.cend(),
time,
[](const std::pair<double, std::string>& p, double time) {
return p.first < time;
[](const std::pair<double, std::string>& p, double sec) {
return p.first < sec;
}
);
return std::string_view(it->second);
@@ -721,9 +712,10 @@ Tile TemporalTileProvider::InterpolateTileProvider::tile(const TileIndex& tileIn
Tile prev = t1->tile(tileIndex);
Tile next = t2->tile(tileIndex);
// the tile before and the tile after the interpolation interval are loaded so the
// interpolation goes smoother
Tile prevprev = before->tile(tileIndex);
Tile nextnext = future->tile(tileIndex);
// interpolation goes smoother. It is on purpose that we are not actually storing the
// return tile here, we just want to trigger the load already
before->tile(tileIndex);
future->tile(tileIndex);
cache::ProviderTileKey key = { tileIndex, uniqueIdentifier };
if (!prev.texture || !next.texture) {
@@ -65,8 +65,6 @@ namespace {
std::unique_ptr<ghoul::opengl::Texture> DefaultTileTexture;
Tile DefaultTile = Tile { nullptr, std::nullopt, Tile::Status::Unavailable };
constexpr const char* KeyFilePath = "FilePath";
} // namespace
unsigned int TileProvider::NumTileProviders = 0;
@@ -27,23 +27,32 @@
#include <openspace/documentation/documentation.h>
namespace {
constexpr const char* KeyDefaultProvider = "DefaultProvider";
constexpr const char* KeyProviders = "IndexTileProviders";
constexpr const char* KeyTileIndex = "TileIndex";
constexpr const char* KeyTileProvider = "TileProvider";
struct [[codegen::Dictionary(TileProviderByIndex)]] Parameters {
ghoul::Dictionary defaultProvider;
struct IndexProvider {
struct Index {
// The x coordinate for this index. This specifies the horizontal
// direction (longitude) component
int x [[codegen::greaterequal(0)]];
// The y coordinate for this index. This specifies the vertical direction
// (latitude) component
int y [[codegen::greaterequal(0)]];
// The z-level which corresponds to the depth of the tile pyramid, which
// directly impacts the applied resolution of the tileprovider shown here
int level [[codegen::inrange(0, 255)]];
};
// The index for which the provided tile provider is used
Index tileIndex;
// The dictionary that described the tileprovider to be used by the provided
// index
ghoul::Dictionary tileProvider;
};
// The list of all tileprovides and the indices at which they are used
std::vector<IndexProvider> indexTileProviders;
};
#include "tileproviderbyindex_codegen.cpp"
+1 -2
View File
@@ -630,9 +630,8 @@ std::vector<std::string> TimeQuantizer::quantized(Time& start, Time& end) {
const double startSeconds = s.J2000();
const double endSeconds = e.J2000();
const double delta = endSeconds - startSeconds;
ghoul_assert(
static_cast<int>(delta) % static_cast<int>(_resolution) == 0,
static_cast<int>(endSeconds - startSeconds) % static_cast<int>(_resolution) == 0,
"Quantization error"
);
+4 -4
View File
@@ -698,10 +698,10 @@ ghoul::Event<>& IswaManager::iswaEvent() {
}
void IswaManager::addCdfFiles(std::string cdfpath) {
std::filesystem::path cdf = absPath(cdfpath);
if (std::filesystem::is_regular_file(cdf)) {
std::filesystem::path cdfFile = absPath(cdfpath);
if (std::filesystem::is_regular_file(cdfFile)) {
//std::string basePath = path.substr(0, path.find_last_of("/\\"));
std::ifstream jsonFile(cdf);
std::ifstream jsonFile(cdfFile);
if (jsonFile.is_open()) {
json cdfGroups = json::parse(jsonFile);
@@ -740,7 +740,7 @@ void IswaManager::addCdfFiles(std::string cdfpath) {
}
}
else {
LWARNING(fmt::format("{} is not a cdf file or can't be found", cdf));
LWARNING(fmt::format("{} is not a cdf file or can't be found", cdfFile));
}
}
+19 -35
View File
@@ -155,11 +155,6 @@ namespace {
"Skipping Nodes By Radius",
"Select nodes to skip depending on Radius."
};
constexpr openspace::properties::Property::PropertyInfo DistanceplanetInfo = {
"Distanceplanet",
"Distance Planet",
"Deciding what planet to check distance to."
};
constexpr openspace::properties::Property::PropertyInfo DistanceThresholdInfo = {
"DistancePlanetThreshold",
"Threshold for distance between planet",
@@ -170,11 +165,6 @@ namespace {
"Earths Proximity Nodes Size",
"Changes size of nodes only close to earth."
};
constexpr openspace::properties::Property::PropertyInfo MisalignedIndexInfo = {
"MisalignedIndex",
"Index to shift sequence number",
"The misalignment number for sequence for fluxnodes vs Fieldlines"
};
constexpr openspace::properties::Property::PropertyInfo MaxNodeDistanceSizeInfo = {
"MaxNodeDistanceSize",
"Max Node Distance Size",
@@ -248,42 +238,43 @@ documentation::Documentation RenderableFluxNodes::Documentation() {
RenderableFluxNodes::RenderableFluxNodes(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _earthdistGroup({ "Earthfocus" })
, _goesEnergyBins(GoesEnergyBinsInfo, properties::OptionProperty::DisplayType::Radio)
, _styleGroup({ "Style" })
, _colorMode(ColorModeInfo, properties::OptionProperty::DisplayType::Radio)
, _scalingMethod(ScalingmethodInfo, properties::OptionProperty::DisplayType::Radio)
, _nodeskipMethod(NodeskipMethodInfo, properties::OptionProperty::DisplayType::Radio)
, _streamColor(
StreamColorInfo,
glm::vec4(0.96f, 0.88f, 0.8f, 1.f),
glm::vec4(0.f),
glm::vec4(1.f))
, _streamGroup({ "Streams" })
, _nodesAmountGroup({ "NodeGroup" })
, _nodeSize(NodeSizeInfo, 2.f, 1.f, 10.f)
glm::vec4(1.f)
)
, _colorTablePath(ColorTablePathInfo)
, _colorTableRange(colorTableRangeInfo, { -2.f, 4.f }, { -8.f, -8.f }, { 8.f, 8.f })
, _domainZ(DomainZInfo, { -2.5f, 2.5f }, { -2.5f, -2.5f }, { 2.5f, 2.5f})
, _fluxColorAlpha(FluxColorAlphaInfo, 1.f, 0.f, 1.f)
, _streamGroup({ "Streams" })
, _scalingMethod(ScalingmethodInfo, properties::OptionProperty::DisplayType::Radio)
, _nodesAmountGroup({ "NodeGroup" })
, _nodeSize(NodeSizeInfo, 2.f, 1.f, 10.f)
, _distanceThreshold(DistanceThresholdInfo, 0.f, 0.f, 1.f)
, _proximityNodesSize(ProximityNodesSizeInfo, 1.f, 0.f, 100.f)
, _maxNodeDistanceSize(MaxNodeDistanceSizeInfo, 1.f, 1.f, 10.f)
, _minMaxNodeSize(MinMaxNodeSizeInfo, { 2.f, 30.f }, { 1.f, 1.f }, { 10.f, 200.f })
, _domainZ(DomainZInfo, { -2.5f, 2.5f }, { -2.5f, -2.5f }, { 2.5f, 2.5f })
, _thresholdFlux(ThresholdFluxInfo, -1.5f, -50.f, 10.f)
, _filteringLower(FilteringInfo, 0.f, 0.f, 5.f)
, _filteringUpper(FilteringUpperInfo, 5.f, 0.f, 5.f)
, _amountofNodes(AmountofNodesInfo, 1, 1, 100)
, _nodeskipMethod(NodeskipMethodInfo, properties::OptionProperty::DisplayType::Radio)
, _defaultNodeSkip(DefaultNodeSkipInfo, 1, 1, 100)
, _earthNodeSkip(EarthNodeSkipInfo, 1, 1, 100)
, _fluxNodeskipThreshold(FluxNodeskipThresholdInfo, 0, -20, 10)
, _earthNodeSkip(EarthNodeSkipInfo, 1, 1, 100)
, _radiusNodeSkipThreshold(RadiusNodeSkipThresholdInfo, 0.f, 0.f, 5.f)
, _earthdistGroup({ "Earthfocus" })
, _distanceThreshold(DistanceThresholdInfo, 0.f, 0.f, 1.f)
, _proximityNodesSize(ProximityNodesSizeInfo, 1.f, 0.f, 100.f)
, _maxNodeDistanceSize(MaxNodeDistanceSizeInfo, 1.f, 1.f, 10.f)
, _cameraPerspectiveGroup({ "CameraPerspective" })
, _cameraPerspectiveEnabled(CameraPerspectiveEnabledInfo, false)
, _drawingCircles(DrawingCirclesInfo, true)
, _cameraPerspectiveGroup({ "CameraPerspective" })
, _drawingHollow(DrawingHollowInfo, false)
, _gaussianAlphaFilter(GaussiandAlphaFilterInfo, false)
, _perspectiveDistanceFactor(PerspectiveDistanceFactorInfo, 2.67f, 1.f, 20.f)
, _minMaxNodeSize(MinMaxNodeSizeInfo, {2.f, 30.f}, {1.f, 1.f}, {10.f, 200.f})
, _pulseEnabled(pulseEnabledInfo, false)
, _gaussianPulseEnabled(gaussianPulseEnabledInfo, false)
{
@@ -528,10 +519,6 @@ bool RenderableFluxNodes::isReady() const {
}
void RenderableFluxNodes::populateStartTimes() {
// number of characters in UTC ISO8601 format (without additional Z)
// 'YYYY-MM-DDTHH-MM-SS-XXX'
constexpr const int timeFormatSize = 23;
std::string timeFile;
std::string fileType;
for (const std::string& filePath : _binarySourceFiles) {
@@ -641,10 +628,7 @@ void RenderableFluxNodes::render(const RenderData& data, RendererTasks&) {
const glm::dmat4 rotMat = glm::dmat4(data.modelTransform.rotation);
const glm::dmat4 modelMat =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
rotMat *
glm::dmat4(glm::scale(
glm::dmat4(1.0), data.modelTransform.scale
));
rotMat * glm::scale(glm::dmat4(1.0), data.modelTransform.scale);
const glm::dmat4 modelViewMat = data.camera.combinedViewMatrix() * modelMat;
_shaderProgram->setUniform("modelViewProjection",
@@ -812,7 +796,7 @@ void RenderableFluxNodes::updatePositionBuffer() {
glEnableVertexAttribArray(0);
glEnable(GL_PROGRAM_POINT_SIZE);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
@@ -830,7 +814,7 @@ void RenderableFluxNodes::updateVertexColorBuffer() {
);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
@@ -848,7 +832,7 @@ void RenderableFluxNodes::updateVertexFilteringBuffer() {
);
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
@@ -100,8 +100,7 @@ private:
nodeSkipFluxThreshold, nodeSkipRadiusThreshold, fluxColorAlpha,
earthPos, distanceThreshold, time, maxNodeDistanceSize, usingCameraPerspective,
drawCircles, drawHollow, useGaussian, perspectiveDistanceFactor, minMaxNodeSize,
usingPulse, usingGaussianPulse)
_uniformCache;
usingPulse, usingGaussianPulse) _uniformCache;
std::filesystem::path _binarySourceFolderPath;
@@ -121,8 +120,6 @@ private:
GLuint _vertexColorBuffer = 0;
// OpenGL Vertex Buffer Object containing the positions to filter the nodes
GLuint _vertexFilteringBuffer = 0;
// OpenGL Vertex Buffer Object containing the index of nodes
GLuint _vertexindexBuffer = 0;
std::unique_ptr<ghoul::opengl::ProgramObject> _shaderProgram;
@@ -40,8 +40,6 @@
#include <optional>
namespace {
constexpr const char* _loggerCat = "RenderableHabitableZone";
constexpr const std::array<const char*, 6> UniformNames = {
"modelViewProjectionTransform", "opacity", "width", "transferFunctionTexture",
"conservativeBounds", "showOptimistic"
@@ -45,7 +45,6 @@
#include <vector>
namespace {
constexpr const char* _loggerCat = "OrbitalKepler";
constexpr const char* ProgramName = "OrbitalKepler";
// Fragile! Keep in sync with documentation
@@ -37,8 +37,6 @@
#include <optional>
namespace {
constexpr const char* _loggerCat = "renderableTravelSpeed";
constexpr const std::array<const char*, 2> UniformNames = {"lineColor", "opacity"};
constexpr openspace::properties::Property::PropertyInfo SpeedInfo = {
@@ -126,9 +124,9 @@ RenderableTravelSpeed::RenderableTravelSpeed(const ghoul::Dictionary& dictionary
)
, _indicatorLength(IndicatorLengthInfo, 1, 1, 360)
, _fadeLength(FadeLengthInfo, 1, 0, 360)
, _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
, _opacity(LineOpacityInfo, 1.f, 0.f, 1.f)
, _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f)
, _opacity(LineOpacityInfo, 1.f, 0.f, 1.f)
, _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
{
const Parameters p = codegen::bake<Parameters>(dictionary);
setRenderBin(RenderBin::Overlay);
@@ -38,8 +38,6 @@
#include <ghoul/opengl/textureunit.h>
namespace {
constexpr const char* _loggerCat = "RenderableModelProjection";
constexpr const char* DestinationFrame = "GALACTIC";
constexpr const std::array<const char*, 7> MainUniformNames = {
-4
View File
@@ -44,10 +44,6 @@
#include "syncmodule_lua.inl"
namespace {
constexpr const char* KeyHttpSynchronizationRepositories =
"HttpSynchronizationRepositories";
constexpr const char* KeySynchronizationRoot = "SynchronizationRoot";
struct [[codegen::Dictionary(SyncModule)]] Parameters {
// The list of all repository URLs that are used to fetch data from for
// HTTPSynchronizations
@@ -35,9 +35,6 @@ namespace {
constexpr const char* TempSuffix = ".tmp";
constexpr const char* QueryKeyIdentifier = "identifier";
constexpr const char* QueryKeyFileVersion = "file_version";
constexpr const char* QueryKeyApplicationVersion = "application_version";
constexpr const int ApplicationVersion = 1;
struct [[codegen::Dictionary(HttpSynchronization)]] Parameters {
+1 -1
View File
@@ -104,7 +104,7 @@ std::unique_ptr<RawVolume<VoxelType>> RawVolumeReader<VoxelType>::read(bool inve
std::unique_ptr<RawVolume<VoxelType>> newVolume =
std::make_unique<RawVolume<VoxelType>>(dims);
for (int i = 0; i < volume->nCells(); ++i) {
for (size_t i = 0; i < volume->nCells(); ++i) {
const glm::uvec3& coords = volume->indexToCoords(i);
glm::uvec3 newcoords = glm::uvec3(coords.x, coords.y, dims.z - coords.z - 1);
+4 -2
View File
@@ -82,8 +82,10 @@ TextureSliceVolumeReader<VoxelType>::getSlice(int sliceIndex) const
std::shared_ptr<ghoul::opengl::Texture> texture =
ghoul::io::TextureReader::ref().loadTexture(_paths[sliceIndex], 2);
glm::ivec2 dimensions = glm::uvec2(texture->dimensions());
ghoul_assert(dimensions == _sliceDimensions, "Slice dimensions do not agree.");
ghoul_assert(
glm::ivec2(texture->dimensions()) == _sliceDimensions,
"Slice dimensions do not agree"
);
_cache.set(sliceIndex, std::move(texture));
}
return *_cache.get(sliceIndex).get();