From 3a7f221793641bce7c8702c6a095b8f9bb6e128b Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 13 Nov 2017 16:22:07 -0500 Subject: [PATCH 01/17] Remove GCC warnings --- ext/ghoul | 2 +- .../properties/numericalproperty.inl | 32 ++++++------- modules/base/rendering/multimodelgeometry.h | 2 +- modules/base/rotation/fixedrotation.cpp | 12 ++--- modules/debugging/rendering/debugrenderer.cpp | 9 +++- .../projectedareaevaluator.h | 3 +- modules/globebrowsing/globebrowsingmodule.cpp | 9 +--- modules/globebrowsing/globes/pointglobe.cpp | 2 +- modules/globebrowsing/meshes/trianglesoup.cpp | 18 ++++---- .../rendering/layer/layergroup.cpp | 4 +- modules/globebrowsing/tile/rawtile.cpp | 2 +- modules/globebrowsing/tile/tileindex.cpp | 4 +- .../tile/tileprovider/texttileprovider.cpp | 2 +- .../tile/tiletextureinitdata.cpp | 2 +- modules/imgui/src/guiparallelcomponent.cpp | 1 - modules/imgui/src/guipropertycomponent.cpp | 2 +- modules/imgui/src/guispacetimecomponent.cpp | 4 +- modules/touch/src/touchinteraction.cpp | 7 ++- src/network/parallelconnection.cpp | 3 +- src/properties/matrix/dmat2property.cpp | 2 +- src/properties/matrix/dmat2x3property.cpp | 2 +- src/properties/matrix/dmat2x4property.cpp | 2 +- src/properties/matrix/dmat3property.cpp | 2 +- src/properties/matrix/dmat3x2property.cpp | 2 +- src/properties/matrix/dmat3x4property.cpp | 2 +- src/properties/matrix/dmat4property.cpp | 2 +- src/properties/matrix/dmat4x2property.cpp | 2 +- src/properties/matrix/dmat4x3property.cpp | 2 +- src/properties/matrix/mat2property.cpp | 2 +- src/properties/matrix/mat2x3property.cpp | 2 +- src/properties/matrix/mat2x4property.cpp | 2 +- src/properties/matrix/mat3property.cpp | 2 +- src/properties/matrix/mat3x2property.cpp | 2 +- src/properties/matrix/mat3x4property.cpp | 2 +- src/properties/matrix/mat4property.cpp | 2 +- src/properties/matrix/mat4x2property.cpp | 2 +- src/properties/matrix/mat4x3property.cpp | 2 +- src/properties/propertyowner.cpp | 8 ++-- src/properties/scalar/boolproperty.cpp | 2 +- src/properties/scalar/charproperty.cpp | 2 +- src/properties/scalar/doubleproperty.cpp | 2 +- src/properties/scalar/floatproperty.cpp | 2 +- src/properties/scalar/intproperty.cpp | 2 +- src/properties/scalar/longdoubleproperty.cpp | 2 +- src/properties/scalar/longlongproperty.cpp | 2 +- src/properties/scalar/longproperty.cpp | 2 +- src/properties/scalar/shortproperty.cpp | 2 +- src/properties/scalar/signedcharproperty.cpp | 2 +- src/properties/scalar/ucharproperty.cpp | 2 +- src/properties/scalar/uintproperty.cpp | 2 +- src/properties/scalar/ulonglongproperty.cpp | 2 +- src/properties/scalar/ulongproperty.cpp | 2 +- src/properties/scalar/ushortproperty.cpp | 2 +- src/properties/stringproperty.cpp | 45 ++++++++++--------- src/properties/vector/bvec2property.cpp | 2 +- src/properties/vector/bvec3property.cpp | 2 +- src/properties/vector/bvec4property.cpp | 2 +- src/properties/vector/dvec2property.cpp | 2 +- src/properties/vector/dvec3property.cpp | 2 +- src/properties/vector/dvec4property.cpp | 2 +- src/properties/vector/ivec2property.cpp | 2 +- src/properties/vector/ivec3property.cpp | 2 +- src/properties/vector/ivec4property.cpp | 2 +- src/properties/vector/uvec2property.cpp | 2 +- src/properties/vector/uvec3property.cpp | 2 +- src/properties/vector/uvec4property.cpp | 2 +- src/properties/vector/vec2property.cpp | 2 +- src/properties/vector/vec3property.cpp | 2 +- src/properties/vector/vec4property.cpp | 2 +- src/rendering/loadingscreen.cpp | 4 -- src/util/progressbar.cpp | 2 +- src/util/threadpool.cpp | 4 +- 72 files changed, 140 insertions(+), 139 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 4dce717aac..79a336b773 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 4dce717aac293edd8662d03cc336da355c797343 +Subproject commit 79a336b7731ca64e00ab82769c93bc799d041ed5 diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index 3a64404e31..c0a07e3127 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -141,27 +141,27 @@ namespace openspace::properties { \ template <> \ template <> \ - TYPE PropertyDelegate>::fromLuaValue(lua_State* state, \ - bool& success) \ + TYPE PropertyDelegate>::fromLuaValue(lua_State* lua, \ + bool& successful) \ { \ - return FROM_LUA_LAMBDA_EXPRESSION(state, success); \ + return FROM_LUA_LAMBDA_EXPRESSION(lua, successful); \ } \ \ template <> \ template <> \ - TYPE PropertyDelegate>::fromLuaValue(lua_State* state, \ - bool& success) \ + TYPE PropertyDelegate>::fromLuaValue(lua_State* lua, \ + bool& successful) \ { \ return PropertyDelegate>::fromLuaValue( \ - state, success); \ + lua, successful); \ } \ \ template <> \ template <> \ - bool PropertyDelegate>::toLuaValue(lua_State* state, \ + bool PropertyDelegate>::toLuaValue(lua_State* lua, \ TYPE value) \ { \ - return TO_LUA_LAMBDA_EXPRESSION(state, value); \ + return TO_LUA_LAMBDA_EXPRESSION(lua, value); \ } \ \ template <> \ @@ -187,9 +187,9 @@ namespace openspace::properties { template <> \ template <> \ TYPE PropertyDelegate>::fromString(std::string value, \ - bool& success) \ + bool& successful) \ { \ - return FROM_STRING_LAMBDA_EXPRESSION(value, success); \ + return FROM_STRING_LAMBDA_EXPRESSION(value, successful); \ } \ \ template <> \ @@ -205,18 +205,18 @@ namespace openspace::properties { \ template <> \ template <> \ - bool PropertyDelegate>::toString(std::string& outValue, \ - TYPE inValue) \ + bool PropertyDelegate>::toString(std::string& out, \ + TYPE in) \ { \ - return TO_STRING_LAMBDA_EXPRESSION(outValue, inValue); \ + return TO_STRING_LAMBDA_EXPRESSION(out, in); \ } \ \ template <> \ template <> \ - bool PropertyDelegate>::toString(std::string& outValue, \ - TYPE inValue) \ + bool PropertyDelegate>::toString(std::string& out, \ + TYPE in) \ { \ - return PropertyDelegate>::toString(outValue, inValue); \ + return PropertyDelegate>::toString(out, in); \ } diff --git a/modules/base/rendering/multimodelgeometry.h b/modules/base/rendering/multimodelgeometry.h index d062cda355..a276bdc342 100644 --- a/modules/base/rendering/multimodelgeometry.h +++ b/modules/base/rendering/multimodelgeometry.h @@ -39,7 +39,7 @@ public: MultiModelGeometry(const ghoul::Dictionary& dictionary); private: - bool loadModel(const std::string& filename); + virtual bool loadModel(const std::string& filename) override; }; } // namespace openspace::modelgeometry diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index 00729a5a5b..df05dbb397 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -574,8 +574,8 @@ glm::vec3 FixedRotation::xAxis() const { case Axis::Type::Object: if (_xAxis.node && _attachedNode) { glm::vec3 dir = glm::vec3(glm::normalize( - glm::dvec3(_xAxis.node->worldPosition()) - - glm::dvec3(_attachedNode->worldPosition()) + _xAxis.node->worldPosition() - + _attachedNode->worldPosition() )); return _xAxis.invertObject ? -dir : dir; } @@ -629,8 +629,8 @@ glm::vec3 FixedRotation::yAxis() const { case Axis::Type::Object: if (_yAxis.node && _attachedNode) { glm::vec3 dir = glm::vec3(glm::normalize( - glm::dvec3(_yAxis.node->worldPosition()) - - glm::dvec3(_attachedNode->worldPosition()) + _yAxis.node->worldPosition() - + _attachedNode->worldPosition() )); return _yAxis.invertObject ? -dir : dir; } @@ -684,8 +684,8 @@ glm::vec3 FixedRotation::zAxis() const { case Axis::Type::Object: if (_zAxis.node && _attachedNode) { glm::vec3 dir = glm::vec3(glm::normalize( - glm::dvec3(_zAxis.node->worldPosition()) - - glm::dvec3(_attachedNode->worldPosition()) + _zAxis.node->worldPosition() - + _attachedNode->worldPosition() )); return _zAxis.invertObject ? -dir : dir; } diff --git a/modules/debugging/rendering/debugrenderer.cpp b/modules/debugging/rendering/debugrenderer.cpp index bfabe1cd25..5f6ebcc8ac 100644 --- a/modules/debugging/rendering/debugrenderer.cpp +++ b/modules/debugging/rendering/debugrenderer.cpp @@ -107,7 +107,14 @@ void DebugRenderer::renderVertices(const Vertices& clippingSpacePoints, GLenum m glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(clippingSpacePoints[0]), 0); + glVertexAttribPointer( + 0, + 4, + GL_FLOAT, + GL_FALSE, + sizeof(clippingSpacePoints[0]), + nullptr + ); // Draw the vertices glDrawArrays(mode, 0, static_cast(clippingSpacePoints.size())); diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h b/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h index 8211848627..70aecee378 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h +++ b/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h @@ -38,7 +38,8 @@ namespace openspace::globebrowsing::chunklevelevaluator { */ class ProjectedArea : public Evaluator { public: - virtual int getDesiredLevel(const Chunk& chunk, const RenderData& data) const; + virtual int getDesiredLevel( + const Chunk& chunk, const RenderData& data) const override; }; } // namespace openspace::globebrowsing::chunklevelevaluator diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 4d9dc9f22d..b8fd5a5626 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -494,16 +494,11 @@ std::string GlobeBrowsingModule::layerTypeNamesList() { void GlobeBrowsingModule::loadWMSCapabilities(std::string name, std::string globe, std::string url) { - auto downloadFunction = [](const std::string& url) { + auto downloadFunction = [](const std::string& downloadUrl) { GDALDatasetH dataset = GDALOpen( - url.c_str(), + downloadUrl.c_str(), GA_ReadOnly ); - // GDAL_OF_READONLY | GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR, - // nullptr, - // nullptr, - // nullptr - //); char** subDatasets = GDALGetMetadata(dataset, "SUBDATASETS"); int nSubdatasets = CSLCount(subDatasets); diff --git a/modules/globebrowsing/globes/pointglobe.cpp b/modules/globebrowsing/globes/pointglobe.cpp index e39b47ece8..630cbd300c 100644 --- a/modules/globebrowsing/globes/pointglobe.cpp +++ b/modules/globebrowsing/globes/pointglobe.cpp @@ -95,7 +95,7 @@ void PointGlobe::initialize() { // Position at location 0 glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(glm::vec2), 0); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(glm::vec2), nullptr); glBindVertexArray(0); } diff --git a/modules/globebrowsing/meshes/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp index e83b9d4506..428aa3ed98 100644 --- a/modules/globebrowsing/meshes/trianglesoup.cpp +++ b/modules/globebrowsing/meshes/trianglesoup.cpp @@ -55,10 +55,10 @@ void TriangleSoup::setVertexPositions(std::vector positions) { _gpuDataNeedUpdate = true; _vertexData.resize(positions.size()); for (size_t i = 0; i < positions.size(); i++) { - _vertexData[i].position[0] = static_cast(positions[i].x); - _vertexData[i].position[1] = static_cast(positions[i].y); - _vertexData[i].position[2] = static_cast(positions[i].z); - _vertexData[i].position[3] = static_cast(positions[i].w); + _vertexData[i].position[0] = positions[i].x; + _vertexData[i].position[1] = positions[i].y; + _vertexData[i].position[2] = positions[i].z; + _vertexData[i].position[3] = positions[i].w; } } @@ -67,8 +67,8 @@ void TriangleSoup::setVertexTextureCoordinates(std::vector textures) _gpuDataNeedUpdate = true; _vertexData.resize(textures.size()); for (size_t i = 0; i < textures.size(); i++) { - _vertexData[i].texture[0] = static_cast(textures[i].s); - _vertexData[i].texture[1] = static_cast(textures[i].t); + _vertexData[i].texture[0] = textures[i].s; + _vertexData[i].texture[1] = textures[i].t; } } @@ -77,9 +77,9 @@ void TriangleSoup::setVertexNormals(std::vector normals) { _gpuDataNeedUpdate = true; _vertexData.resize(normals.size()); for (size_t i = 0; i < normals.size(); i++) { - _vertexData[i].normal[0] = static_cast(normals[i].x); - _vertexData[i].normal[1] = static_cast(normals[i].y); - _vertexData[i].normal[2] = static_cast(normals[i].z); + _vertexData[i].normal[0] = normals[i].x; + _vertexData[i].normal[1] = normals[i].y; + _vertexData[i].normal[2] = normals[i].z; } } diff --git a/modules/globebrowsing/rendering/layer/layergroup.cpp b/modules/globebrowsing/rendering/layer/layergroup.cpp index cd089d58c3..df0105a357 100644 --- a/modules/globebrowsing/rendering/layer/layergroup.cpp +++ b/modules/globebrowsing/rendering/layer/layergroup.cpp @@ -69,8 +69,8 @@ LayerGroup::LayerGroup(layergroupid::GroupID id, const ghoul::Dictionary& dict) try { addLayer(fallbackLayerDict); } - catch (const ghoul::RuntimeError& e) { - LERRORC(e.component, e.message); + catch (const ghoul::RuntimeError& except) { + LERRORC(except.component, except.message); continue; } } diff --git a/modules/globebrowsing/tile/rawtile.cpp b/modules/globebrowsing/tile/rawtile.cpp index 43a93496bc..e4a093f5c1 100644 --- a/modules/globebrowsing/tile/rawtile.cpp +++ b/modules/globebrowsing/tile/rawtile.cpp @@ -43,7 +43,7 @@ RawTile RawTile::createDefault(const TileTextureInitData& initData) { defaultRes.textureInitData = std::make_shared(initData); defaultRes.imageData = new char[initData.totalNumBytes()]; std::fill_n( - static_cast(defaultRes.imageData), + defaultRes.imageData, initData.totalNumBytes(), char(0) ); diff --git a/modules/globebrowsing/tile/tileindex.cpp b/modules/globebrowsing/tile/tileindex.cpp index 992e2dce67..72f66bb578 100644 --- a/modules/globebrowsing/tile/tileindex.cpp +++ b/modules/globebrowsing/tile/tileindex.cpp @@ -38,8 +38,8 @@ namespace { namespace openspace::globebrowsing { -TileIndex::TileIndex(int x, int y, int level) - : x(x), y(y), level(level) +TileIndex::TileIndex(int x_, int y_, int level_) + : x(x_), y(y_), level(level_) {} TileIndex::TileIndex(const TileIndex& other) diff --git a/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp b/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp index 7bda8f1da7..c2a966457c 100644 --- a/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/texttileprovider.cpp @@ -56,7 +56,7 @@ bool TextTileProvider::initialize() { _font = OsEng.fontManager().font("Mono", static_cast(_fontSize)); - _fontRenderer = std::unique_ptr(FontRenderer::createDefault()); + _fontRenderer = FontRenderer::createDefault(); _fontRenderer->setFramebufferSize(glm::vec2(_initData.dimensions())); glGenFramebuffers(1, &_fbo); diff --git a/modules/globebrowsing/tile/tiletextureinitdata.cpp b/modules/globebrowsing/tile/tiletextureinitdata.cpp index 683a0c9ea9..2e2e039c98 100644 --- a/modules/globebrowsing/tile/tiletextureinitdata.cpp +++ b/modules/globebrowsing/tile/tiletextureinitdata.cpp @@ -155,7 +155,7 @@ unsigned int TileTextureInitData::getUniqueIdFromTextureFormat( case Format::DepthComponent: return 6; default: - ghoul_assert(false, "Unknown texture format"); + throw ghoul::MissingCaseException(); } } diff --git a/modules/imgui/src/guiparallelcomponent.cpp b/modules/imgui/src/guiparallelcomponent.cpp index 5f155f3471..25b21479cb 100644 --- a/modules/imgui/src/guiparallelcomponent.cpp +++ b/modules/imgui/src/guiparallelcomponent.cpp @@ -56,7 +56,6 @@ void GuiParallelComponent::renderDisconnected() { } void GuiParallelComponent::renderClientWithHost() { - ParallelConnection& parallel = OsEng.parallelConnection(); std::string connectionInfo = "Session hosted by \"" + parallel.hostName() + "\"\n"; diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index 1c57c0f24a..acdf57952e 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -105,7 +105,7 @@ namespace { std::vector(path.begin() + 1, path.end()), owner ); - }; + } void simplifyTree(TreeNode& node) { // Merging consecutive nodes if they only have a single child diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp index 746e9118c4..0e23c7a945 100644 --- a/modules/imgui/src/guispacetimecomponent.cpp +++ b/modules/imgui/src/guispacetimecomponent.cpp @@ -175,10 +175,10 @@ void GuiSpaceTimeComponent::render() { double newTime = [days, j2000, seconds](){ if (days < 0) { - return static_cast(j2000 - seconds); + return j2000 - seconds; } else { - return static_cast(j2000 + seconds); + return j2000 + seconds; } }(); diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 8a66aac409..bcda496340 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -56,9 +56,8 @@ #include -#pragma warning (pop) #ifdef WIN32 - +#pragma warning (pop) #endif // WIN32 @@ -222,19 +221,19 @@ TouchInteraction::TouchInteraction() , _pickingRadiusMinimum(PickingRadiusInfo, 0.1f, 0.f, 1.f) , _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) } , _sensitivity{ glm::dvec2(0.08, 0.045), 4.0, 2.75, glm::dvec2(0.08, 0.045) } - , _centroid(glm::dvec3(0.0)) // calculated with two vectors with known diff in length, then // projDiffLength/diffLength. , _projectionScaleFactor(1.000004) , _currentRadius(1.0) , _slerpdT(1000) - , _numOfTests(0) , _timeSlack(0.0) + , _numOfTests(0) , _directTouchMode(false) , _tap(false) , _doubleTap(false) , _lmSuccess(true) , _guiON(false) + , _centroid(glm::dvec3(0.0)) { addProperty(_touchActive); addProperty(_unitTest); diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp index 38c5180af7..2dd3159e37 100644 --- a/src/network/parallelconnection.cpp +++ b/src/network/parallelconnection.cpp @@ -1235,8 +1235,7 @@ uint32_t ParallelConnection::hash(const std::string& val) { hashVal += (hashVal << 15); return hashVal; -}; - +} std::shared_ptr> ParallelConnection::connectionEvent() { return _connectionEvent; diff --git a/src/properties/matrix/dmat2property.cpp b/src/properties/matrix/dmat2property.cpp index 009afe1de4..b342547cf8 100644 --- a/src/properties/matrix/dmat2property.cpp +++ b/src/properties/matrix/dmat2property.cpp @@ -133,6 +133,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat2Property, glm::dmat2x2, glm::dmat2x2(0), DEFAULT_TO_LUA_LAMBDA(glm::dmat2x2), DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x2), DEFAULT_TO_STRING_LAMBDA(glm::dmat2x2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat2x3property.cpp b/src/properties/matrix/dmat2x3property.cpp index 8178e25617..95ea2ace90 100644 --- a/src/properties/matrix/dmat2x3property.cpp +++ b/src/properties/matrix/dmat2x3property.cpp @@ -137,6 +137,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat2x3Property, glm::dmat2x3, glm::dmat2x3(0) DEFAULT_TO_LUA_LAMBDA(glm::dmat2x3), DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x3), DEFAULT_TO_STRING_LAMBDA(glm::dmat2x3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat2x4property.cpp b/src/properties/matrix/dmat2x4property.cpp index 9706a1929c..3d65c79819 100644 --- a/src/properties/matrix/dmat2x4property.cpp +++ b/src/properties/matrix/dmat2x4property.cpp @@ -141,6 +141,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat2x4Property, glm::dmat2x4, glm::dmat2x4(0) DEFAULT_TO_LUA_LAMBDA(glm::dmat2x4), DEFAULT_FROM_STRING_LAMBDA(glm::dmat2x4), DEFAULT_TO_STRING_LAMBDA(glm::dmat2x4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat3property.cpp b/src/properties/matrix/dmat3property.cpp index acdb6af091..adb7445b2e 100644 --- a/src/properties/matrix/dmat3property.cpp +++ b/src/properties/matrix/dmat3property.cpp @@ -144,6 +144,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat3Property, glm::dmat3x3, glm::dmat3x3(0), DEFAULT_TO_LUA_LAMBDA(glm::dmat3x3), DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x3), DEFAULT_TO_STRING_LAMBDA(glm::dmat3x3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat3x2property.cpp b/src/properties/matrix/dmat3x2property.cpp index 8ee35db37f..d5e4efb0f7 100644 --- a/src/properties/matrix/dmat3x2property.cpp +++ b/src/properties/matrix/dmat3x2property.cpp @@ -137,6 +137,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat3x2Property, glm::dmat3x2, glm::dmat3x2(0) DEFAULT_TO_LUA_LAMBDA(glm::dmat3x2), DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x2), DEFAULT_TO_STRING_LAMBDA(glm::dmat3x2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat3x4property.cpp b/src/properties/matrix/dmat3x4property.cpp index d0523030e5..dbb2e309c1 100644 --- a/src/properties/matrix/dmat3x4property.cpp +++ b/src/properties/matrix/dmat3x4property.cpp @@ -150,6 +150,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat3x4Property, glm::dmat3x4, glm::dmat3x4(0) DEFAULT_TO_LUA_LAMBDA(glm::dmat3x4), DEFAULT_FROM_STRING_LAMBDA(glm::dmat3x4), DEFAULT_TO_STRING_LAMBDA(glm::dmat3x4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat4property.cpp b/src/properties/matrix/dmat4property.cpp index 283549e309..d24094ef55 100644 --- a/src/properties/matrix/dmat4property.cpp +++ b/src/properties/matrix/dmat4property.cpp @@ -159,6 +159,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat4Property, glm::dmat4x4, glm::dmat4x4(0), DEFAULT_TO_LUA_LAMBDA(glm::dmat4x4), DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x4), DEFAULT_TO_STRING_LAMBDA(glm::dmat4x4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat4x2property.cpp b/src/properties/matrix/dmat4x2property.cpp index 3a38fd9cf6..c7ac0bdbce 100644 --- a/src/properties/matrix/dmat4x2property.cpp +++ b/src/properties/matrix/dmat4x2property.cpp @@ -141,6 +141,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat4x2Property, glm::dmat4x2, glm::dmat4x2(0) DEFAULT_TO_LUA_LAMBDA(glm::dmat4x2), DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x2), DEFAULT_TO_STRING_LAMBDA(glm::dmat4x2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/dmat4x3property.cpp b/src/properties/matrix/dmat4x3property.cpp index 7edc09ecdb..20cd44d31f 100644 --- a/src/properties/matrix/dmat4x3property.cpp +++ b/src/properties/matrix/dmat4x3property.cpp @@ -150,6 +150,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DMat4x3Property, glm::dmat4x3, glm::dmat4x3(0) DEFAULT_TO_LUA_LAMBDA(glm::dmat4x3), DEFAULT_FROM_STRING_LAMBDA(glm::dmat4x3), DEFAULT_TO_STRING_LAMBDA(glm::dmat4x3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat2property.cpp b/src/properties/matrix/mat2property.cpp index 78dc903062..90870a3acc 100644 --- a/src/properties/matrix/mat2property.cpp +++ b/src/properties/matrix/mat2property.cpp @@ -133,6 +133,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat2Property, glm::mat2x2, glm::mat2x2(0), DEFAULT_TO_LUA_LAMBDA(glm::mat2x2), DEFAULT_FROM_STRING_LAMBDA(glm::mat2x2), DEFAULT_TO_STRING_LAMBDA(glm::mat2x2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat2x3property.cpp b/src/properties/matrix/mat2x3property.cpp index 0d85aa1410..5c50c6f762 100644 --- a/src/properties/matrix/mat2x3property.cpp +++ b/src/properties/matrix/mat2x3property.cpp @@ -137,6 +137,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat2x3Property, glm::mat2x3, glm::mat2x3(0), DEFAULT_TO_LUA_LAMBDA(glm::mat2x3), DEFAULT_FROM_STRING_LAMBDA(glm::mat2x3), DEFAULT_TO_STRING_LAMBDA(glm::mat2x3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat2x4property.cpp b/src/properties/matrix/mat2x4property.cpp index 19a23e60f5..7732916f79 100644 --- a/src/properties/matrix/mat2x4property.cpp +++ b/src/properties/matrix/mat2x4property.cpp @@ -141,6 +141,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat2x4Property, glm::mat2x4, glm::mat2x4(0), DEFAULT_TO_LUA_LAMBDA(glm::mat2x4), DEFAULT_FROM_STRING_LAMBDA(glm::mat2x4), DEFAULT_TO_STRING_LAMBDA(glm::mat2x4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat3property.cpp b/src/properties/matrix/mat3property.cpp index 8c3a2a5d5b..9f29b6e17f 100644 --- a/src/properties/matrix/mat3property.cpp +++ b/src/properties/matrix/mat3property.cpp @@ -144,6 +144,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat3Property, glm::mat3x3, glm::mat3x3(0), DEFAULT_TO_LUA_LAMBDA(glm::mat3x3), DEFAULT_FROM_STRING_LAMBDA(glm::mat3x3), DEFAULT_TO_STRING_LAMBDA(glm::mat3x3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat3x2property.cpp b/src/properties/matrix/mat3x2property.cpp index 5e9d7599db..da77825b01 100644 --- a/src/properties/matrix/mat3x2property.cpp +++ b/src/properties/matrix/mat3x2property.cpp @@ -137,6 +137,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat3x2Property, glm::mat3x2, glm::mat3x2(0), DEFAULT_TO_LUA_LAMBDA(glm::mat3x2), DEFAULT_FROM_STRING_LAMBDA(glm::mat3x2), DEFAULT_TO_STRING_LAMBDA(glm::mat3x2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat3x4property.cpp b/src/properties/matrix/mat3x4property.cpp index 3412134a3c..75e5de60b9 100644 --- a/src/properties/matrix/mat3x4property.cpp +++ b/src/properties/matrix/mat3x4property.cpp @@ -150,6 +150,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat3x4Property, glm::mat3x4, glm::mat3x4(0), DEFAULT_TO_LUA_LAMBDA(glm::mat3x4), DEFAULT_FROM_STRING_LAMBDA(glm::mat3x4), DEFAULT_TO_STRING_LAMBDA(glm::mat3x4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat4property.cpp b/src/properties/matrix/mat4property.cpp index e0afddd0ea..f22df74bd3 100644 --- a/src/properties/matrix/mat4property.cpp +++ b/src/properties/matrix/mat4property.cpp @@ -159,6 +159,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat4Property, glm::mat4x4, glm::mat4x4(0), DEFAULT_TO_LUA_LAMBDA(glm::mat4x4), DEFAULT_FROM_STRING_LAMBDA(glm::mat4x4), DEFAULT_TO_STRING_LAMBDA(glm::mat4x4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat4x2property.cpp b/src/properties/matrix/mat4x2property.cpp index 7bc809a0ef..646a70d288 100644 --- a/src/properties/matrix/mat4x2property.cpp +++ b/src/properties/matrix/mat4x2property.cpp @@ -141,6 +141,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat4x2Property, glm::mat4x2, glm::mat4x2(0), DEFAULT_TO_LUA_LAMBDA(glm::mat4x2), DEFAULT_FROM_STRING_LAMBDA(glm::mat4x2), DEFAULT_TO_STRING_LAMBDA(glm::mat4x2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/matrix/mat4x3property.cpp b/src/properties/matrix/mat4x3property.cpp index 22dcac9bd4..4ecd920a22 100644 --- a/src/properties/matrix/mat4x3property.cpp +++ b/src/properties/matrix/mat4x3property.cpp @@ -150,6 +150,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Mat4x3Property, glm::mat4x3, glm::mat4x3(0), DEFAULT_TO_LUA_LAMBDA(glm::mat4x3), DEFAULT_FROM_STRING_LAMBDA(glm::mat4x3), DEFAULT_TO_STRING_LAMBDA(glm::mat4x3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index a43977c718..9b5b415ea9 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -149,7 +149,7 @@ void PropertyOwner::addProperty(Property* prop) { std::vector::const_iterator it = std::find_if( _properties.begin(), _properties.end(), - [id = prop->identifier()](Property* prop) { return prop->identifier() == id; } + [id = prop->identifier()](Property* p) { return p->identifier() == id; } ); // If we found the property identifier, we need to bail out @@ -184,7 +184,7 @@ void PropertyOwner::addPropertySubOwner(openspace::properties::PropertyOwner* ow std::vector::const_iterator it = std::find_if( _subOwners.begin(), _subOwners.end(), - [name = owner->name()](PropertyOwner* owner) { return owner->name() == name; } + [name = owner->name()](PropertyOwner* o) { return o->name() == name; } ); // If we found the propertyowner's name, we need to bail out @@ -218,7 +218,7 @@ void PropertyOwner::removeProperty(Property* prop) { std::vector::const_iterator it = std::find_if( _properties.begin(), _properties.end(), - [id = prop->identifier()](Property* prop) { return prop->identifier() == id; } + [id = prop->identifier()](Property* p) { return p->identifier() == id; } ); // If we found the property identifier, we can delete it @@ -242,7 +242,7 @@ void PropertyOwner::removePropertySubOwner(openspace::properties::PropertyOwner* std::vector::const_iterator it = std::find_if( _subOwners.begin(), _subOwners.end(), - [name = owner->name()](PropertyOwner* owner) { return owner->name() == name; } + [name = owner->name()](PropertyOwner* o) { return o->name() == name; } ); // If we found the propertyowner, we can delete it diff --git a/src/properties/scalar/boolproperty.cpp b/src/properties/scalar/boolproperty.cpp index dd594a7181..704c3cab57 100644 --- a/src/properties/scalar/boolproperty.cpp +++ b/src/properties/scalar/boolproperty.cpp @@ -62,6 +62,6 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(BoolProperty, bool, false, return true; }, LUA_TBOOLEAN -); +) } // namespace openspace::properties diff --git a/src/properties/scalar/charproperty.cpp b/src/properties/scalar/charproperty.cpp index 6028165589..eedf67f61c 100644 --- a/src/properties/scalar/charproperty.cpp +++ b/src/properties/scalar/charproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(CharProperty, char, char(0), DEFAULT_TO_LUA_LAMBDA(char), DEFAULT_FROM_STRING_LAMBDA(char, char(0)), DEFAULT_TO_STRING_LAMBDA(char), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/doubleproperty.cpp b/src/properties/scalar/doubleproperty.cpp index 601458f62f..344fef6262 100644 --- a/src/properties/scalar/doubleproperty.cpp +++ b/src/properties/scalar/doubleproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DoubleProperty, double, 0.0, DEFAULT_TO_LUA_LAMBDA(double), DEFAULT_FROM_STRING_LAMBDA(double, double(0)), DEFAULT_TO_STRING_LAMBDA(double), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/floatproperty.cpp b/src/properties/scalar/floatproperty.cpp index 74ed28362d..b24316f74a 100644 --- a/src/properties/scalar/floatproperty.cpp +++ b/src/properties/scalar/floatproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(FloatProperty, float, 0.f, DEFAULT_TO_LUA_LAMBDA(float), DEFAULT_FROM_STRING_LAMBDA(float, float(0)), DEFAULT_TO_STRING_LAMBDA(float), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/intproperty.cpp b/src/properties/scalar/intproperty.cpp index 73bee46f2b..18bd6a23fe 100644 --- a/src/properties/scalar/intproperty.cpp +++ b/src/properties/scalar/intproperty.cpp @@ -76,6 +76,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(IntProperty, int, int(0), numeric_limits: DEFAULT_TO_LUA_LAMBDA(int), DEFAULT_FROM_STRING_LAMBDA(int, int(0)), DEFAULT_TO_STRING_LAMBDA(int), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/longdoubleproperty.cpp b/src/properties/scalar/longdoubleproperty.cpp index eee5554953..db0e00ffb4 100644 --- a/src/properties/scalar/longdoubleproperty.cpp +++ b/src/properties/scalar/longdoubleproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(LongDoubleProperty, long double, 0l, DEFAULT_TO_LUA_LAMBDA(long double), DEFAULT_FROM_STRING_LAMBDA(long double, 0l), DEFAULT_TO_STRING_LAMBDA(long double), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/longlongproperty.cpp b/src/properties/scalar/longlongproperty.cpp index 3cda8498b4..73868f82a5 100644 --- a/src/properties/scalar/longlongproperty.cpp +++ b/src/properties/scalar/longlongproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(LongLongProperty, long long, 0, DEFAULT_TO_LUA_LAMBDA(long long), DEFAULT_FROM_STRING_LAMBDA(long long, 0), DEFAULT_TO_STRING_LAMBDA(long long), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/longproperty.cpp b/src/properties/scalar/longproperty.cpp index e439db0c3a..2b44591b86 100644 --- a/src/properties/scalar/longproperty.cpp +++ b/src/properties/scalar/longproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(LongProperty, long, long(0), DEFAULT_TO_LUA_LAMBDA(long), DEFAULT_FROM_STRING_LAMBDA(long, long(0)), DEFAULT_TO_STRING_LAMBDA(long), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/shortproperty.cpp b/src/properties/scalar/shortproperty.cpp index c0e72ce46e..066b1dfb25 100644 --- a/src/properties/scalar/shortproperty.cpp +++ b/src/properties/scalar/shortproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(ShortProperty, short, short(0), DEFAULT_TO_LUA_LAMBDA(short), DEFAULT_FROM_STRING_LAMBDA(short, short(0)), DEFAULT_TO_STRING_LAMBDA(short), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/signedcharproperty.cpp b/src/properties/scalar/signedcharproperty.cpp index fa64500dc9..31d7aed864 100644 --- a/src/properties/scalar/signedcharproperty.cpp +++ b/src/properties/scalar/signedcharproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(SignedCharProperty, signed char, 0, DEFAULT_TO_LUA_LAMBDA(signed char), DEFAULT_FROM_STRING_LAMBDA(signed char, 0), DEFAULT_TO_STRING_LAMBDA(signed char), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/ucharproperty.cpp b/src/properties/scalar/ucharproperty.cpp index 7d9c25f501..59634c950b 100644 --- a/src/properties/scalar/ucharproperty.cpp +++ b/src/properties/scalar/ucharproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(UCharProperty, unsigned char, 0, DEFAULT_TO_LUA_LAMBDA(unsigned char), DEFAULT_FROM_STRING_LAMBDA(unsigned char, 0), DEFAULT_TO_STRING_LAMBDA(unsigned char), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/uintproperty.cpp b/src/properties/scalar/uintproperty.cpp index d620050fad..3f5786177b 100644 --- a/src/properties/scalar/uintproperty.cpp +++ b/src/properties/scalar/uintproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(UCharProperty, unsigned int, 0, DEFAULT_TO_LUA_LAMBDA(unsigned int), DEFAULT_FROM_STRING_LAMBDA(unsigned int, 0), DEFAULT_TO_STRING_LAMBDA(unsigned int), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/ulonglongproperty.cpp b/src/properties/scalar/ulonglongproperty.cpp index 04f866d41f..1ab97b704a 100644 --- a/src/properties/scalar/ulonglongproperty.cpp +++ b/src/properties/scalar/ulonglongproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(ULongLongProperty, unsigned long long, 1ull, DEFAULT_TO_LUA_LAMBDA(unsigned long long), DEFAULT_FROM_STRING_LAMBDA(unsigned long long, 0ull), DEFAULT_TO_STRING_LAMBDA(unsigned long long), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/ulongproperty.cpp b/src/properties/scalar/ulongproperty.cpp index 8631f663da..47333a58e8 100644 --- a/src/properties/scalar/ulongproperty.cpp +++ b/src/properties/scalar/ulongproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(ULongProperty, unsigned long, 0ul, DEFAULT_TO_LUA_LAMBDA(unsigned long), DEFAULT_FROM_STRING_LAMBDA(unsigned long, 0ul), DEFAULT_TO_STRING_LAMBDA(unsigned long), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/scalar/ushortproperty.cpp b/src/properties/scalar/ushortproperty.cpp index 2cda3df0f5..51adf2f061 100644 --- a/src/properties/scalar/ushortproperty.cpp +++ b/src/properties/scalar/ushortproperty.cpp @@ -77,6 +77,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(UShortProperty, unsigned short, 0, DEFAULT_TO_LUA_LAMBDA(unsigned short), DEFAULT_FROM_STRING_LAMBDA(unsigned short, 0), DEFAULT_TO_STRING_LAMBDA(unsigned short), - LUA_TNUMBER); + LUA_TNUMBER) } // namespace openspace::properties diff --git a/src/properties/stringproperty.cpp b/src/properties/stringproperty.cpp index f68587da01..7278352ef8 100644 --- a/src/properties/stringproperty.cpp +++ b/src/properties/stringproperty.cpp @@ -28,8 +28,11 @@ namespace openspace::properties { -REGISTER_TEMPLATEPROPERTY_SOURCE(StringProperty, std::string, "", -[](lua_State* state, bool& success) -> std::string { +REGISTER_TEMPLATEPROPERTY_SOURCE( + StringProperty, + std::string, + "", + [](lua_State* state, bool& success) -> std::string { success = lua_isstring(state, -1) == 1; if (success) { return lua_tostring(state, -1); @@ -38,27 +41,27 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(StringProperty, std::string, "", return ""; } }, -[](lua_State* state, std::string value) -> bool { + [](lua_State* state, std::string value) -> bool { lua_pushstring(state, value.c_str()); return true; }, -[](std::string value, bool& success) -> std::string { - // An incoming string is of the form - // "value" - // so we want to remove the leading and trailing " characters - if (value.size() > 2 && (value[0] == '"' && value[value.size() - 1] == '"')) { - // Removing the first and last " - success = true; - return value.substr(1, value.size() - 2); - } - success = false; - return value; -}, -[](std::string& outValue, std::string inValue) -> bool { - outValue = "\"" + inValue + "\""; - return true; -}, -LUA_TSTRING -); + [](std::string value, bool& success) -> std::string { + // An incoming string is of the form + // "value" + // so we want to remove the leading and trailing " characters + if (value.size() > 2 && (value[0] == '"' && value[value.size() - 1] == '"')) { + // Removing the first and last " + success = true; + return value.substr(1, value.size() - 2); + } + success = false; + return value; + }, + [](std::string& outValue, std::string inValue) -> bool { + outValue = "\"" + inValue + "\""; + return true; + }, + LUA_TSTRING +) } // namespace openspace::properties diff --git a/src/properties/vector/bvec2property.cpp b/src/properties/vector/bvec2property.cpp index 4371ba08f0..d82d8aea2a 100644 --- a/src/properties/vector/bvec2property.cpp +++ b/src/properties/vector/bvec2property.cpp @@ -110,6 +110,6 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(BVec2Property, glm::bvec2, glm::bvec2(false), DEFAULT_TO_LUA_LAMBDA(glm::bvec2), DEFAULT_FROM_STRING_LAMBDA(glm::bvec2), DEFAULT_TO_STRING_LAMBDA(glm::bvec2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/bvec3property.cpp b/src/properties/vector/bvec3property.cpp index b23f2c9acf..8260366516 100644 --- a/src/properties/vector/bvec3property.cpp +++ b/src/properties/vector/bvec3property.cpp @@ -110,6 +110,6 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(BVec3Property, glm::bvec3, glm::bvec3(false), DEFAULT_TO_LUA_LAMBDA(glm::bvec3), DEFAULT_FROM_STRING_LAMBDA(glm::bvec3), DEFAULT_TO_STRING_LAMBDA(glm::bvec3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/bvec4property.cpp b/src/properties/vector/bvec4property.cpp index 1f4860fa4a..1524d73a7e 100644 --- a/src/properties/vector/bvec4property.cpp +++ b/src/properties/vector/bvec4property.cpp @@ -110,6 +110,6 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(BVec4Property, glm::bvec4, glm::bvec4(false), DEFAULT_TO_LUA_LAMBDA(glm::bvec4), DEFAULT_FROM_STRING_LAMBDA(glm::bvec4), DEFAULT_TO_STRING_LAMBDA(glm::bvec4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/dvec2property.cpp b/src/properties/vector/dvec2property.cpp index cee97b4d10..a09f08bf62 100644 --- a/src/properties/vector/dvec2property.cpp +++ b/src/properties/vector/dvec2property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DVec2Property, glm::dvec2, glm::dvec2(0), DEFAULT_TO_LUA_LAMBDA(glm::dvec2), DEFAULT_FROM_STRING_LAMBDA(glm::dvec2), DEFAULT_TO_STRING_LAMBDA(glm::dvec2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/dvec3property.cpp b/src/properties/vector/dvec3property.cpp index cf55ddee75..39876748dc 100644 --- a/src/properties/vector/dvec3property.cpp +++ b/src/properties/vector/dvec3property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DVec3Property, glm::dvec3, glm::dvec3(0), DEFAULT_TO_LUA_LAMBDA(glm::dvec3), DEFAULT_FROM_STRING_LAMBDA(glm::dvec3), DEFAULT_TO_STRING_LAMBDA(glm::dvec3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/dvec4property.cpp b/src/properties/vector/dvec4property.cpp index adc3d789ad..fe1223dc2e 100644 --- a/src/properties/vector/dvec4property.cpp +++ b/src/properties/vector/dvec4property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(DVec4Property, glm::dvec4, glm::dvec4(0), DEFAULT_TO_LUA_LAMBDA(glm::dvec4), DEFAULT_FROM_STRING_LAMBDA(glm::dvec4), DEFAULT_TO_STRING_LAMBDA(glm::dvec4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/ivec2property.cpp b/src/properties/vector/ivec2property.cpp index 8e1163f174..b18f153efe 100644 --- a/src/properties/vector/ivec2property.cpp +++ b/src/properties/vector/ivec2property.cpp @@ -111,6 +111,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(IVec2Property, glm::ivec2, glm::ivec2(0), DEFAULT_TO_LUA_LAMBDA(glm::ivec2), DEFAULT_FROM_STRING_LAMBDA(glm::ivec2), DEFAULT_TO_STRING_LAMBDA(glm::ivec2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/ivec3property.cpp b/src/properties/vector/ivec3property.cpp index cf00fc34f5..7b7441cb23 100644 --- a/src/properties/vector/ivec3property.cpp +++ b/src/properties/vector/ivec3property.cpp @@ -111,6 +111,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(IVec3Property, glm::ivec3, glm::ivec3(0), DEFAULT_TO_LUA_LAMBDA(glm::ivec3), DEFAULT_FROM_STRING_LAMBDA(glm::ivec3), DEFAULT_TO_STRING_LAMBDA(glm::ivec3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/ivec4property.cpp b/src/properties/vector/ivec4property.cpp index cb801cc01d..7321ae23fa 100644 --- a/src/properties/vector/ivec4property.cpp +++ b/src/properties/vector/ivec4property.cpp @@ -111,6 +111,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(IVec4Property, glm::ivec4, glm::ivec4(0), DEFAULT_TO_LUA_LAMBDA(glm::ivec4), DEFAULT_FROM_STRING_LAMBDA(glm::ivec4), DEFAULT_TO_STRING_LAMBDA(glm::ivec4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/uvec2property.cpp b/src/properties/vector/uvec2property.cpp index ecccd4014f..ace65b8a17 100644 --- a/src/properties/vector/uvec2property.cpp +++ b/src/properties/vector/uvec2property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(UVec2Property, glm::uvec2, glm::uvec2(0), DEFAULT_TO_LUA_LAMBDA(glm::uvec2), DEFAULT_FROM_STRING_LAMBDA(glm::uvec2), DEFAULT_TO_STRING_LAMBDA(glm::uvec2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/uvec3property.cpp b/src/properties/vector/uvec3property.cpp index 3c3e5375af..6976411872 100644 --- a/src/properties/vector/uvec3property.cpp +++ b/src/properties/vector/uvec3property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(UVec3Property, glm::uvec3, glm::uvec3(0), DEFAULT_TO_LUA_LAMBDA(glm::uvec3), DEFAULT_FROM_STRING_LAMBDA(glm::uvec3), DEFAULT_TO_STRING_LAMBDA(glm::uvec3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/uvec4property.cpp b/src/properties/vector/uvec4property.cpp index 7f442c5d13..39daf78a01 100644 --- a/src/properties/vector/uvec4property.cpp +++ b/src/properties/vector/uvec4property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(UVec4Property, glm::uvec4, glm::uvec4(0), DEFAULT_TO_LUA_LAMBDA(glm::uvec4), DEFAULT_FROM_STRING_LAMBDA(glm::uvec4), DEFAULT_TO_STRING_LAMBDA(glm::uvec4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/vec2property.cpp b/src/properties/vector/vec2property.cpp index ccc8115151..9c4f176d87 100644 --- a/src/properties/vector/vec2property.cpp +++ b/src/properties/vector/vec2property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Vec2Property, glm::vec2, glm::vec2(0), DEFAULT_TO_LUA_LAMBDA(glm::vec2), DEFAULT_FROM_STRING_LAMBDA(glm::vec2), DEFAULT_TO_STRING_LAMBDA(glm::vec2), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/vec3property.cpp b/src/properties/vector/vec3property.cpp index 1898796bf0..a9a7e91a59 100644 --- a/src/properties/vector/vec3property.cpp +++ b/src/properties/vector/vec3property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Vec3Property, glm::vec3, glm::vec3(0), DEFAULT_TO_LUA_LAMBDA(glm::vec3), DEFAULT_FROM_STRING_LAMBDA(glm::vec3), DEFAULT_TO_STRING_LAMBDA(glm::vec3), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/properties/vector/vec4property.cpp b/src/properties/vector/vec4property.cpp index 57e15639f5..7e06bab9fc 100644 --- a/src/properties/vector/vec4property.cpp +++ b/src/properties/vector/vec4property.cpp @@ -112,6 +112,6 @@ REGISTER_NUMERICALPROPERTY_SOURCE(Vec4Property, glm::vec4, glm::vec4(0), DEFAULT_TO_LUA_LAMBDA(glm::vec4), DEFAULT_FROM_STRING_LAMBDA(glm::vec4), DEFAULT_TO_STRING_LAMBDA(glm::vec4), - LUA_TTABLE); + LUA_TTABLE) } // namespace openspace::properties diff --git a/src/rendering/loadingscreen.cpp b/src/rendering/loadingscreen.cpp index b2cfd13c40..cf4fb8aed0 100644 --- a/src/rendering/loadingscreen.cpp +++ b/src/rendering/loadingscreen.cpp @@ -112,10 +112,6 @@ LoadingScreen::LoadingScreen(ShowMessage showMessage, ShowNodeNames showNodeName , _progressbar{ 0, 0, 0, 0 } , _randomEngine(_randomDevice()) { - const glm::vec2 dpiScaling = OsEng.windowWrapper().dpiScaling(); - const glm::ivec2 res = - glm::vec2(OsEng.windowWrapper().currentWindowResolution()) / dpiScaling; - _program = ghoul::opengl::ProgramObject::Build( "Loading Screen", "${SHADERS}/loadingscreen.vert", diff --git a/src/util/progressbar.cpp b/src/util/progressbar.cpp index 6d9859cd36..a3edba9096 100644 --- a/src/util/progressbar.cpp +++ b/src/util/progressbar.cpp @@ -54,6 +54,6 @@ void ProgressBar::print(int current) { << std::flush; } _previous = iprogress; -}; +} } // namespace openspace diff --git a/src/util/threadpool.cpp b/src/util/threadpool.cpp index afc061740c..c2b52979a9 100644 --- a/src/util/threadpool.cpp +++ b/src/util/threadpool.cpp @@ -26,7 +26,9 @@ namespace openspace { -Worker::Worker(ThreadPool& pool) : pool(pool) {} +Worker::Worker(ThreadPool& pool_) + : pool(pool_) +{} void Worker::operator()() { std::function task; From 0ff9c935128afd665f4af42eb558b11e48cd19ab Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 16 Nov 2017 09:06:17 -0500 Subject: [PATCH 02/17] Enable the disabling of Tooltips in ImGUI --- modules/imgui/include/gui.h | 2 + modules/imgui/include/guipropertycomponent.h | 2 + modules/imgui/include/renderproperties.h | 52 ++++++--- modules/imgui/src/gui.cpp | 16 +++ modules/imgui/src/guipropertycomponent.cpp | 12 ++- modules/imgui/src/renderproperties.cpp | 106 ++++++++++++------- 6 files changed, 132 insertions(+), 58 deletions(-) diff --git a/modules/imgui/include/gui.h b/modules/imgui/include/gui.h index 4981eda208..41daff5d83 100644 --- a/modules/imgui/include/gui.h +++ b/modules/imgui/include/gui.h @@ -85,6 +85,8 @@ public: bool _showInternals; + properties::BoolProperty _showHelpText; + private: void renderAndUpdatePropertyVisibility(); diff --git a/modules/imgui/include/guipropertycomponent.h b/modules/imgui/include/guipropertycomponent.h index ca55b8404d..1a7078d898 100644 --- a/modules/imgui/include/guipropertycomponent.h +++ b/modules/imgui/include/guipropertycomponent.h @@ -59,6 +59,7 @@ public: void setVisibility(properties::Property::Visibility visibility); void setHasRegularProperties(bool hasOnlyRegularProperties); + void setShowHelpTooltip(bool showHelpTooltip); void render() override; @@ -76,6 +77,7 @@ protected: UseTreeLayout _useTreeLayout; bool _currentUseTreeLayout; IsTopLevelWindow _isTopLevel; + bool _showHelpTooltip; }; } // namespace openspace::gui diff --git a/modules/imgui/include/renderproperties.h b/modules/imgui/include/renderproperties.h index ce0408cc64..3ab234ba53 100644 --- a/modules/imgui/include/renderproperties.h +++ b/modules/imgui/include/renderproperties.h @@ -36,60 +36,78 @@ namespace openspace::properties { namespace openspace { using IsRegularProperty = ghoul::Boolean; +using ShowToolTip = ghoul::Boolean; void executeScript(const std::string& id, const std::string& value, IsRegularProperty isRegular = IsRegularProperty::Yes); void renderBoolProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderOptionProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderSelectionProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderStringProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderDoubleProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderIntProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderIVec2Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderIVec3Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderIVec4Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderFloatProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderVec2Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderVec3Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderVec4Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderDVec2Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderDVec3Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderDVec4Property(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); void renderTriggerProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular = IsRegularProperty::Yes); + IsRegularProperty isRegular = IsRegularProperty::Yes, + ShowToolTip showTooltip = ShowToolTip::Yes); } // namespace openspace diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index 6db4244e94..0f8f74576e 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -245,6 +245,13 @@ void addScreenSpaceRenderableOnline(std::string texturePath) { ); } +static const openspace::properties::Property::PropertyInfo ShowHelpInfo = { + "ShowHelpText", + "Show tooltip help", + "If this value is enabled these kinds of tooltips are shown for most properties " + "explaining what impact they have on the visuals." +}; + } // namespace namespace openspace::gui { @@ -268,6 +275,7 @@ GUI::GUI() GuiPropertyComponent::UseTreeLayout::No, GuiPropertyComponent::IsTopLevelWindow::Yes) , _showInternals(false) + , _showHelpText(ShowHelpInfo, true) , _currentVisibility(properties::Property::Visibility::Developer) { addPropertySubOwner(_help); @@ -285,6 +293,14 @@ GUI::GUI() #ifdef OPENSPACE_MODULE_ISWA_ENABLED addPropertySubOwner(_iswa); #endif // OPENSPACE_MODULE_ISWA_ENABLED + + addProperty(_showHelpText); + _showHelpText.onChange([this](){ + _globalProperty.setShowHelpTooltip(_showHelpText); + _property.setShowHelpTooltip(_showHelpText); + _screenSpaceProperty.setShowHelpTooltip(_showHelpText); + _virtualProperty.setShowHelpTooltip(_showHelpText); + }); } void GUI::initialize() { diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index acdf57952e..143da4826c 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -166,6 +166,10 @@ void GuiPropertyComponent::setHasRegularProperties(bool hasOnlyRegularProperties _hasOnlyRegularProperties = hasOnlyRegularProperties; } +void GuiPropertyComponent::setShowHelpTooltip(bool showHelpTooltip) { + _showHelpTooltip = showHelpTooltip; +} + void GuiPropertyComponent::renderPropertyOwner(properties::PropertyOwner* owner) { if (owner->propertiesRecursive().empty()) { return; @@ -373,7 +377,7 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop, properties::PropertyOwner* owner) { using Func = std::function< - void(properties::Property*, const std::string&, IsRegularProperty) + void(properties::Property*, const std::string&, IsRegularProperty, ShowToolTip) >; static const std::map FunctionMapping = { { "BoolProperty", &renderBoolProperty }, @@ -406,14 +410,16 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop, it->second( prop, owner->name(), - IsRegularProperty(_hasOnlyRegularProperties) + IsRegularProperty(_hasOnlyRegularProperties), + ShowToolTip(_showHelpTooltip) ); } else { it->second( prop, "", - IsRegularProperty(_hasOnlyRegularProperties) + IsRegularProperty(_hasOnlyRegularProperties), + ShowToolTip(_showHelpTooltip) ); } } diff --git a/modules/imgui/src/renderproperties.cpp b/modules/imgui/src/renderproperties.cpp index ecf12e5b92..b166a673c2 100644 --- a/modules/imgui/src/renderproperties.cpp +++ b/modules/imgui/src/renderproperties.cpp @@ -85,7 +85,7 @@ void executeScript(const std::string& id, const std::string& value, } void renderBoolProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); BoolProperty* p = static_cast(prop); @@ -94,7 +94,9 @@ void renderBoolProperty(Property* prop, const std::string& ownerName, BoolProperty::ValueType value = *p; ImGui::Checkbox(name.c_str(), &value); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript(p->fullyQualifiedIdentifier(), value ? "true" : "false", isRegular); @@ -103,7 +105,7 @@ void renderBoolProperty(Property* prop, const std::string& ownerName, } void renderOptionProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); OptionProperty* p = static_cast(prop); @@ -120,7 +122,9 @@ void renderOptionProperty(Property* prop, const std::string& ownerName, ImGui::Separator(); for (const OptionProperty::Option& o : options) { ImGui::RadioButton(o.description.c_str(), &value, o.value); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } } ImGui::Separator(); break; @@ -159,7 +163,7 @@ void renderOptionProperty(Property* prop, const std::string& ownerName, } void renderSelectionProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); SelectionProperty* p = static_cast(prop); @@ -179,7 +183,9 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName, ) != selectedIndices.end(); ImGui::Checkbox(description.c_str(), &selected); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (selected) { newSelectedIndices.push_back(i); @@ -200,7 +206,7 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName, } void renderStringProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); StringProperty* p = static_cast(prop); @@ -222,8 +228,9 @@ void renderStringProperty(Property* prop, const std::string& ownerName, bufferSize, ImGuiInputTextFlags_EnterReturnsTrue ); - renderTooltip(prop); - + if (showTooltip) { + renderTooltip(prop); + } if (hasNewValue) { executeScript( @@ -237,7 +244,7 @@ void renderStringProperty(Property* prop, const std::string& ownerName, } void renderDoubleProperty(properties::Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); DoubleProperty* p = static_cast(prop); @@ -249,7 +256,9 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa float max = static_cast(p->maxValue()); ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f"); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != static_cast(p->value())) { executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular); @@ -259,7 +268,7 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa } void renderIntProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); IntProperty* p = static_cast(prop); @@ -271,7 +280,9 @@ void renderIntProperty(Property* prop, const std::string& ownerName, int max = p->maxValue(); ImGui::SliderInt(name.c_str(), &value, min, max); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular); @@ -281,7 +292,7 @@ void renderIntProperty(Property* prop, const std::string& ownerName, } void renderIVec2Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); IVec2Property* p = static_cast(prop); @@ -297,7 +308,9 @@ void renderIVec2Property(Property* prop, const std::string& ownerName, min, max ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript( @@ -311,7 +324,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName, } void renderIVec3Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); IVec3Property* p = static_cast(prop); @@ -328,7 +341,9 @@ void renderIVec3Property(Property* prop, const std::string& ownerName, min, max ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript( @@ -342,7 +357,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName, } void renderIVec4Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); IVec4Property* p = static_cast(prop); @@ -363,7 +378,9 @@ void renderIVec4Property(Property* prop, const std::string& ownerName, min, max ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript( @@ -379,7 +396,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName, } void renderFloatProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); FloatProperty* p = static_cast(prop); @@ -390,7 +407,9 @@ void renderFloatProperty(Property* prop, const std::string& ownerName, float min = p->minValue(); float max = p->maxValue(); ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f"); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular); @@ -400,7 +419,7 @@ void renderFloatProperty(Property* prop, const std::string& ownerName, } void renderVec2Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); Vec2Property* p = static_cast(prop); @@ -417,7 +436,9 @@ void renderVec2Property(Property* prop, const std::string& ownerName, max, "%.5f" ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript( @@ -431,7 +452,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName, } void renderVec3Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); Vec3Property* p = static_cast(prop); @@ -442,8 +463,6 @@ void renderVec3Property(Property* prop, const std::string& ownerName, float min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z); float max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z); - - if (prop->viewOption(Property::ViewOptions::Color)) { ImGui::ColorEdit3( name.c_str(), @@ -459,7 +478,9 @@ void renderVec3Property(Property* prop, const std::string& ownerName, "%.5f" ); } - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript( @@ -475,7 +496,7 @@ void renderVec3Property(Property* prop, const std::string& ownerName, } void renderVec4Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); Vec4Property* p = static_cast(prop); @@ -503,8 +524,9 @@ void renderVec4Property(Property* prop, const std::string& ownerName, "%.5f" ); } - - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (value != p->value()) { executeScript( @@ -521,7 +543,7 @@ void renderVec4Property(Property* prop, const std::string& ownerName, } void renderDVec2Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); DVec2Property* p = static_cast(prop); @@ -538,7 +560,9 @@ void renderDVec2Property(Property* prop, const std::string& ownerName, max, "%.5f" ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (glm::dvec2(value) != p->value()) { executeScript( @@ -552,7 +576,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName, } void renderDVec3Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); DVec3Property* p = static_cast(prop); @@ -574,7 +598,9 @@ void renderDVec3Property(Property* prop, const std::string& ownerName, max, "%.5f" ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (changed) { executeScript( @@ -590,7 +616,7 @@ void renderDVec3Property(Property* prop, const std::string& ownerName, } void renderDVec4Property(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); DVec4Property* p = static_cast(prop); @@ -616,7 +642,9 @@ void renderDVec4Property(Property* prop, const std::string& ownerName, max, "%.5f" ); - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } if (glm::dvec4(value) != p->value()) { executeScript( @@ -633,7 +661,7 @@ void renderDVec4Property(Property* prop, const std::string& ownerName, } void renderTriggerProperty(Property* prop, const std::string& ownerName, - IsRegularProperty isRegular) + IsRegularProperty isRegular, ShowToolTip showTooltip) { ghoul_assert(prop, "prop must not be nullptr"); std::string name = prop->guiName(); @@ -643,7 +671,9 @@ void renderTriggerProperty(Property* prop, const std::string& ownerName, if (pressed) { executeScript(prop->fullyQualifiedIdentifier(), "nil", isRegular); } - renderTooltip(prop); + if (showTooltip) { + renderTooltip(prop); + } ImGui::PopID(); } From 669078201ab36f1bb8c250c4acd3789688c2f489 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 16 Nov 2017 16:12:54 -0500 Subject: [PATCH 03/17] Add check for usage of ghoul_assert instead of plain old assert Update Ghoul --- ext/ghoul | 2 +- modules/kameleon/src/kameleonwrapper.cpp | 30 +++++++++---------- .../multiresvolume/rendering/atlasmanager.cpp | 2 +- .../rendering/localtfbrickselector.cpp | 8 ++--- .../rendering/renderablemultiresvolume.cpp | 2 -- .../rendering/simpletfbrickselector.cpp | 2 +- .../rendering/tfbrickselector.cpp | 4 +-- .../rendering/renderabletimevaryingvolume.h | 6 ++-- src/util/histogram.cpp | 2 +- support/coding/check_style_guide.py | 25 ++++++++++++++++ 10 files changed, 52 insertions(+), 31 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 79a336b773..6944475ee6 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 79a336b7731ca64e00ab82769c93bc799d041ed5 +Subproject commit 6944475ee6293e4dd6671800cb28953e877e1cb7 diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index cbd4fd1e67..253870f426 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -184,12 +184,12 @@ bool KameleonWrapper::open(const std::string& filename) { } void KameleonWrapper::close() { - if (_kameleon) + if (_kameleon) { _kameleon->close(); - if (_interpolator) - delete _interpolator; - if (_kameleon) - delete _kameleon; + } + + delete _interpolator; + delete _kameleon; _kameleon = nullptr; _interpolator = nullptr; @@ -202,8 +202,7 @@ float* KameleonWrapper::getUniformSampledValues( const std::string& var, const glm::size3_t& outDimensions) { - assert(_model && _interpolator); - assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0); + ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); LINFO("Loading variable " << var << " from CDF data with a uniform sampling"); unsigned int size = static_cast( @@ -384,8 +383,7 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var, const glm::size3_t& outDimensions, const float& slice) { - assert(_model && _interpolator); - assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0); + ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); LINFO("Loading variable " << var << " from CDF data with a uniform sampling"); unsigned int size = static_cast( @@ -517,8 +515,7 @@ float* KameleonWrapper::getUniformSampledVectorValues(const std::string& xVar, const std::string& zVar, const glm::size3_t& outDimensions) { - assert(_model && _interpolator); - assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0); + ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); LINFO( "Loading variables " << xVar << " " << yVar << " " << zVar << " from CDF data with a uniform sampling" @@ -597,7 +594,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getClassifiedFieldLines( const std::vector& seedPoints, float stepSize ) { - assert(_model && _interpolator); + ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); LINFO( "Creating " << seedPoints.size() << " fieldlines from variables " << xVar << " " << yVar << " " << zVar @@ -654,7 +651,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV const std::string& yVar, const std::string& zVar, const std::vector& seedPoints, float stepSize, const glm::vec4& color) { - assert(_model && _interpolator); + ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); LINFO( "Creating " << seedPoints.size() << " fieldlines from variables " << xVar << " " << yVar << " " << zVar @@ -744,7 +741,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getLorentzTrajectories( glm::vec3 KameleonWrapper::getModelBarycenterOffset() { // ENLIL is centered, no need for offset if (_type == Model::ENLIL) { - return glm::vec3(0,0,0); + return glm::vec3(0.f); } glm::vec3 offset; @@ -770,8 +767,9 @@ glm::vec4 KameleonWrapper::getModelBarycenterOffsetScaled() { } glm::vec3 KameleonWrapper::getModelScale() { - if (_type == Model::ENLIL) - return glm::vec3(1.0f, 1.0f, 1.0f); + if (_type == Model::ENLIL) { + return glm::vec3(1.f); + } glm::vec3 scale; scale.x = _xMax - _xMin; diff --git a/modules/multiresvolume/rendering/atlasmanager.cpp b/modules/multiresvolume/rendering/atlasmanager.cpp index 83fa9646e5..389951a69b 100644 --- a/modules/multiresvolume/rendering/atlasmanager.cpp +++ b/modules/multiresvolume/rendering/atlasmanager.cpp @@ -170,7 +170,7 @@ void AtlasManager::addToAtlas(int firstBrickIndex, int lastBrickIndex, float* ma unsigned int atlasCoords = _freeAtlasCoords.back(); _freeAtlasCoords.pop_back(); int level = _nOtLevels - floor(log((7.0 * (float(brickIndex % _nOtNodes)) + 1.0))/log(8)) - 1; - assert(atlasCoords <= 0x0FFFFFFF); + ghoul_assert(atlasCoords <= 0x0FFFFFFF, "@MISSING"); unsigned int atlasData = (level << 28) + atlasCoords; _brickMap.insert(std::pair(brickIndex, atlasData)); _nStreamedBricks++; diff --git a/modules/multiresvolume/rendering/localtfbrickselector.cpp b/modules/multiresvolume/rendering/localtfbrickselector.cpp index 39f3abe12e..c5426f95a5 100644 --- a/modules/multiresvolume/rendering/localtfbrickselector.cpp +++ b/modules/multiresvolume/rendering/localtfbrickselector.cpp @@ -358,8 +358,8 @@ bool LocalTfBrickSelector::calculateBrickErrors() { for (int i = 0; i < gradients.size(); i++) { float x = (i + 0.5f) / tfWidth; float sample = histogram->interpolate(x); - assert(sample >= 0); - assert(gradients[i] >= 0); + ghoul_assert(sample >= 0, "@MISSING"); + ghoul_assert(gradients[i] >= 0, "@MISSING"); error += sample * gradients[i]; } _brickErrors[brickIndex].spatial = error; @@ -375,8 +375,8 @@ bool LocalTfBrickSelector::calculateBrickErrors() { for (int i = 0; i < gradients.size(); i++) { float x = (i + 0.5f) / tfWidth; float sample = histogram->interpolate(x); - assert(sample >= 0); - assert(gradients[i] >= 0); + ghoul_assert(sample >= 0, "@MISSING"); + ghoul_assert(gradients[i] >= 0, "@MISSING"); error += sample * gradients[i]; } _brickErrors[brickIndex].temporal = error; diff --git a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp index f563ee5485..a524ac362c 100644 --- a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp +++ b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp @@ -187,8 +187,6 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic , _rotation(RotationInfo, glm::vec3(0.f, 0.f, 0.f), glm::vec3(0.f), glm::vec3(6.28f)) { std::string name; - //bool success = dictionary.getValue(constants::scenegraphnode::keyName, name); - //assert(success); _filename = ""; bool success = dictionary.getValue(KeyDataSource, _filename); diff --git a/modules/multiresvolume/rendering/simpletfbrickselector.cpp b/modules/multiresvolume/rendering/simpletfbrickselector.cpp index 9c797fc50a..6e20188591 100644 --- a/modules/multiresvolume/rendering/simpletfbrickselector.cpp +++ b/modules/multiresvolume/rendering/simpletfbrickselector.cpp @@ -311,7 +311,7 @@ bool SimpleTfBrickSelector::calculateBrickImportances() { float x = static_cast(i) / static_cast(tfWidth); float sample = histogram->interpolate(x); - assert(sample >= 0); + ghoul_assert(sample >= 0, "@MISSING"); dotProduct += sample * tf->sample(i).w; } _brickImportances[brickIndex] = dotProduct; diff --git a/modules/multiresvolume/rendering/tfbrickselector.cpp b/modules/multiresvolume/rendering/tfbrickselector.cpp index 3ee23994a9..4406e88f17 100644 --- a/modules/multiresvolume/rendering/tfbrickselector.cpp +++ b/modules/multiresvolume/rendering/tfbrickselector.cpp @@ -367,8 +367,8 @@ bool TfBrickSelector::calculateBrickErrors() { for (int i = 0; i < gradients.size(); i++) { float x = (i + 0.5f) / tfWidth; float sample = histogram->interpolate(x); - assert(sample >= 0); - assert(gradients[i] >= 0); + ghoul_assert(sample >= 0, "@MISSING"); + ghoul_assert(gradients[i] >= 0, "@MISSING"); error += sample * gradients[i]; } _brickErrors[brickIndex] = error; diff --git a/modules/volume/rendering/renderabletimevaryingvolume.h b/modules/volume/rendering/renderabletimevaryingvolume.h index 30fd980c78..67f2b44269 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.h +++ b/modules/volume/rendering/renderabletimevaryingvolume.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_MODULE_VOLUME___RENDERABLEKAMELEONVOLUME___H__ -#define __OPENSPACE_MODULE_VOLUME___RENDERABLEKAMELEONVOLUME___H__ +#ifndef __OPENSPACE_MODULE_VOLUME___RENDERABLETIMEVARYINGVOLUME___H__ +#define __OPENSPACE_MODULE_VOLUME___RENDERABLETIMEVARYINGVOLUME___H__ #include @@ -106,4 +106,4 @@ private: } // namespace volume } // namespace openspace -#endif // __OPENSPACE_MODULE_KAMELEONVOLUME___RENDERABLEKAMELEONVOLUME___H__ +#endif // __OPENSPACE_MODULE_VOLUME___RENDERABLETIMEVARYINGVOLUME___H__ diff --git a/src/util/histogram.cpp b/src/util/histogram.cpp index ca3410c070..ea98fc0b3b 100644 --- a/src/util/histogram.cpp +++ b/src/util/histogram.cpp @@ -223,7 +223,7 @@ float Histogram::interpolate(float bin) const { } float Histogram::sample(int binIndex) const { - assert(binIndex >= 0 && binIndex < _numBins); + ghoul_assert(binIndex >= 0 && binIndex < _numBins, "@MISSING"); return _data[binIndex]; } diff --git a/support/coding/check_style_guide.py b/support/coding/check_style_guide.py index c91bc80d6e..a2c73df3b7 100644 --- a/support/coding/check_style_guide.py +++ b/support/coding/check_style_guide.py @@ -42,6 +42,8 @@ guards for correctness. At the moment this includes: * Checking that no file includes glm header directly * Checking whether any files starts with the UTF-8 Byte-order mark * Checking whether a file as empty-only lines + * Checking whether the default assert macros are used anywhere instead of the + ghoul_assert macro If this script is executed from the base directory of OpenSpace, no arguments need to be passed, otherwise the first and only argument has to point to the base directory. @@ -308,6 +310,16 @@ def check_line_length(lines): +def check_assert_usage(lines): + # _assert checks for both ghoul_assert and static_assert, which are both reasonable + index = [i + 1 for i,s in enumerate(lines) if ('assert(' in s and not '_assert(' in s) and s.strip()[0:2] != '//'] + if len(index) > 0: + return index + else: + return ''; + + + def check_line_length(lines): # Disable this check in non-strict mode if not is_strict_mode: @@ -422,6 +434,11 @@ def check_header_file(file, component): if empty_character_at_end: print(file, '\t', 'Empty character at end: ', empty_character_at_end) + assert_usage = check_assert_usage(lines) + if assert_usage: + print(file, '\t', 'Wrong assert usage: ', assert_usage) + + def check_inline_file(file, component): with open(file, 'r+', encoding="utf8") as f: @@ -471,6 +488,10 @@ def check_inline_file(file, component): if empty_character_at_end: print(file, '\t', 'Empty character at end: ', empty_character_at_end) + assert_usage = check_assert_usage(lines) + if assert_usage: + print(file, '\t', 'Wrong assert usage: ', assert_usage) + def check_source_file(file, component): @@ -510,6 +531,10 @@ def check_source_file(file, component): if empty_character_at_end: print(file, '\t', 'Empty character at end: ', empty_character_at_end) + assert_usage = check_assert_usage(lines) + if assert_usage: + print(file, '\t', 'Wrong assert usage: ', assert_usage) + def check_files(positiveList, negativeList, component, check_function): From 719130b6b77dbd041b0d09f0c5d36e0582e9d4b0 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 16 Nov 2017 21:19:28 -0500 Subject: [PATCH 04/17] Jenkinswarnings (#419) * Remove more warnings * Removing more warnings * More warning fixes * More warnings * More warnings * Update ghoul --- ext/ghoul | 2 +- .../properties/numericalproperty.inl | 8 +- .../openspace/properties/templateproperty.inl | 15 ++-- modules/base/rendering/renderablesphere.cpp | 2 +- modules/base/rotation/fixedrotation.cpp | 2 +- modules/base/rotation/luarotation.cpp | 4 +- modules/base/scale/luascale.cpp | 4 +- modules/base/translation/luatranslation.cpp | 4 +- .../renderablefieldlinessequencesetup.cpp | 8 +- .../util/fieldlinesstate.cpp | 2 +- .../fieldlinessequence/util/fieldlinesstate.h | 2 +- modules/galaxy/rendering/galaxyraycaster.cpp | 4 +- modules/galaxy/rendering/renderablegalaxy.cpp | 18 ++-- .../cache/memoryawaretilecache.cpp | 6 +- .../globebrowsing/globebrowsingmodule_lua.inl | 4 +- modules/globebrowsing/meshes/trianglesoup.cpp | 6 +- modules/globebrowsing/other/pixelbuffer.cpp | 2 +- .../globebrowsing/rendering/chunkrenderer.cpp | 2 +- modules/globebrowsing/tile/pixelregion.cpp | 8 +- .../gdalrawtiledatareader.cpp | 19 ++-- .../rawtiledatareader/rawtiledatareader.cpp | 2 +- .../simplerawtiledatareader.cpp | 12 +-- .../tile/rawtiledatareader/tiledatatype.cpp | 58 ++++++++----- modules/globebrowsing/tile/tileindex.cpp | 8 +- .../tileprovider/temporaltileprovider.cpp | 2 +- .../tile/tileprovider/tileproviderbylevel.cpp | 2 +- modules/imgui/src/guimissioncomponent.cpp | 4 +- modules/imgui/src/guispacetimecomponent.cpp | 4 +- modules/imgui/src/renderproperties.cpp | 4 +- modules/iswa/util/dataprocessor.cpp | 16 ++-- modules/iswa/util/dataprocessorjson.cpp | 19 ++-- modules/iswa/util/dataprocessorkameleon.cpp | 21 ++--- modules/iswa/util/dataprocessortext.cpp | 19 ++-- modules/kameleon/src/kameleonwrapper.cpp | 4 +- .../rendering/renderablekameleonvolume.cpp | 4 +- .../tasks/kameleonvolumetorawtask.cpp | 10 ++- .../rendering/renderablemultiresvolume.cpp | 14 ++- modules/touch/src/touchinteraction.cpp | 65 +++++++++----- modules/volume/rawvolumewriter.inl | 2 +- .../rendering/renderabletimevaryingvolume.cpp | 20 ++--- modules/volume/textureslicevolumereader.h | 2 + modules/volume/volumesampler.inl | 8 +- src/interaction/touchbar.mm | 7 +- src/properties/matrix/dmat2property.cpp | 9 +- src/properties/matrix/dmat2x3property.cpp | 9 +- src/properties/matrix/dmat2x4property.cpp | 9 +- src/properties/matrix/dmat3property.cpp | 9 +- src/properties/matrix/dmat3x2property.cpp | 9 +- src/properties/matrix/dmat3x4property.cpp | 9 +- src/properties/matrix/dmat4property.cpp | 9 +- src/properties/matrix/dmat4x2property.cpp | 9 +- src/properties/matrix/dmat4x3property.cpp | 9 +- src/properties/matrix/mat2property.cpp | 4 +- src/properties/matrix/mat2x3property.cpp | 4 +- src/properties/matrix/mat2x4property.cpp | 4 +- src/properties/matrix/mat3property.cpp | 4 +- src/properties/matrix/mat3x2property.cpp | 4 +- src/properties/matrix/mat3x4property.cpp | 4 +- src/properties/matrix/mat4property.cpp | 4 +- src/properties/matrix/mat4x2property.cpp | 4 +- src/properties/matrix/mat4x3property.cpp | 4 +- src/properties/scalar/boolproperty.cpp | 6 +- src/properties/scalar/doubleproperty.cpp | 4 +- src/properties/scalar/intproperty.cpp | 8 +- src/properties/stringproperty.cpp | 12 +-- src/properties/vector/bvec2property.cpp | 6 +- src/properties/vector/bvec3property.cpp | 6 +- src/properties/vector/bvec4property.cpp | 6 +- src/properties/vector/dvec2property.cpp | 6 +- src/properties/vector/dvec3property.cpp | 6 +- src/properties/vector/dvec4property.cpp | 6 +- src/properties/vector/ivec2property.cpp | 4 +- src/rendering/loadingscreen.cpp | 4 +- src/scene/sceneloader.cpp | 7 +- src/util/blockplaneintersectiongeometry.cpp | 2 - src/util/boxgeometry.cpp | 2 +- src/util/factorymanager.cpp | 10 +-- src/util/histogram.cpp | 86 ++++++++++--------- src/util/keys.cpp | 12 +-- tests/test_gdalwms.inl | 16 ++-- tests/test_luaconversions.inl | 15 +++- 81 files changed, 422 insertions(+), 348 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 6944475ee6..d7aec4688b 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 6944475ee6293e4dd6671800cb28953e877e1cb7 +Subproject commit d7aec4688b9673d61e8885f3ce7a0d569b54b614 diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index c0a07e3127..95b027b692 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -159,17 +159,17 @@ namespace openspace::properties { template <> \ template <> \ bool PropertyDelegate>::toLuaValue(lua_State* lua, \ - TYPE value) \ + TYPE val) \ { \ - return TO_LUA_LAMBDA_EXPRESSION(lua, value); \ + return TO_LUA_LAMBDA_EXPRESSION(lua, val); \ } \ \ template <> \ template <> \ bool PropertyDelegate>::toLuaValue(lua_State* state, \ - TYPE value) \ + TYPE val) \ { \ - return PropertyDelegate>::toLuaValue(state, value); \ + return PropertyDelegate>::toLuaValue(state, val); \ } \ \ template <> \ diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl index 32ecffb1ab..b21ff70211 100644 --- a/include/openspace/properties/templateproperty.inl +++ b/include/openspace/properties/templateproperty.inl @@ -106,16 +106,17 @@ namespace openspace::properties { template <> \ template <> \ TYPE PropertyDelegate>::fromLuaValue(lua_State* l, \ - bool& s) \ + bool& successful) \ { \ - return FROM_LUA_LAMBDA_EXPRESSION(l, s); \ + return FROM_LUA_LAMBDA_EXPRESSION(l, successful); \ } \ \ template <> \ template <> \ - bool PropertyDelegate>::toLuaValue(lua_State* l, TYPE v)\ + bool PropertyDelegate>::toLuaValue(lua_State* l, \ + TYPE value) \ { \ - return TO_LUA_LAMBDA_EXPRESSION(l, v); \ + return TO_LUA_LAMBDA_EXPRESSION(l, value); \ } \ \ template <> \ @@ -125,10 +126,10 @@ namespace openspace::properties { \ template <> \ template <> \ - TYPE PropertyDelegate>::fromString(std::string v, \ - bool& s) \ + TYPE PropertyDelegate>::fromString(std::string value, \ + bool& successful) \ { \ - return FROM_STRING_LAMBDA_EXPRESSION(v, s); \ + return FROM_STRING_LAMBDA_EXPRESSION(value, successful); \ } \ \ template <> \ diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 1f6a28e4e7..9ba2a62fcc 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -259,7 +259,7 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) { setPscUniforms(*_shader.get(), data.camera, data.position); if (_fadeOutThreshold > -1.0) { - float distCamera = glm::distance( + double distCamera = glm::distance( data.camera.positionVec3(), data.position.dvec3() ); diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index df05dbb397..4719adbfee 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -544,7 +544,7 @@ void FixedRotation::update(const UpdateData&) { glm::vec3 y = yAxis(); glm::vec3 z = zAxis(); - static const float Epsilon = 1e-3; + static const float Epsilon = 1e-3f; if (glm::dot(x, y) > 1.f - Epsilon || glm::dot(y, z) > 1.f - Epsilon || diff --git a/modules/base/rotation/luarotation.cpp b/modules/base/rotation/luarotation.cpp index 03ff884a7d..4840de00b5 100644 --- a/modules/base/rotation/luarotation.cpp +++ b/modules/base/rotation/luarotation.cpp @@ -110,7 +110,9 @@ void LuaRotation::update(const UpdateData& data) { auto now = high_resolution_clock::now(); lua_pushnumber( _state, - duration_cast(now.time_since_epoch()).count() + static_cast( + duration_cast(now.time_since_epoch()).count() + ) ); // Execute the scaling function diff --git a/modules/base/scale/luascale.cpp b/modules/base/scale/luascale.cpp index a688351003..eb3194303a 100644 --- a/modules/base/scale/luascale.cpp +++ b/modules/base/scale/luascale.cpp @@ -101,7 +101,9 @@ void LuaScale::update(const UpdateData& data) { auto now = high_resolution_clock::now(); lua_pushnumber( _state, - duration_cast(now.time_since_epoch()).count() + static_cast( + duration_cast(now.time_since_epoch()).count() + ) ); // Execute the scaling function diff --git a/modules/base/translation/luatranslation.cpp b/modules/base/translation/luatranslation.cpp index 7dd8353d9e..bb5e3ddcc3 100644 --- a/modules/base/translation/luatranslation.cpp +++ b/modules/base/translation/luatranslation.cpp @@ -118,7 +118,9 @@ void LuaTranslation::update(const UpdateData& data) { auto now = high_resolution_clock::now(); lua_pushnumber( _state, - duration_cast(now.time_since_epoch()).count() + static_cast( + duration_cast(now.time_since_epoch()).count() + ) ); // Execute the scaling function diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp index 538186e5e0..4547f444f2 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp @@ -303,8 +303,12 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary( LERROR(_name << ": The field " << std::string(KeyInputFileType) << " is missing!"); return false; } else { - std::transform(inputFileTypeString.begin(), inputFileTypeString.end(), - inputFileTypeString.begin(), ::tolower); + std::transform( + inputFileTypeString.begin(), + inputFileTypeString.end(), + inputFileTypeString.begin(), + [](char c) { return static_cast(tolower(c)); } + ); // Verify that the input type is correct if (inputFileTypeString == ValueInputFileTypeCdf) { sourceFileType = SourceFileType::Cdf; diff --git a/modules/fieldlinessequence/util/fieldlinesstate.cpp b/modules/fieldlinessequence/util/fieldlinesstate.cpp index 51c8b7b0d9..d55ba96569 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.cpp +++ b/modules/fieldlinessequence/util/fieldlinesstate.cpp @@ -373,7 +373,7 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) { // Returns one of the extra quantity vectors, _extraQuantities[index]. // If index is out of scope an empty vector is returned and the referenced bool is false. -const std::vector& FieldlinesState::extraQuantity(const size_t index, +std::vector FieldlinesState::extraQuantity(const size_t index, bool& isSuccessful) const { if (index < _extraQuantities.size()) { isSuccessful = true; diff --git a/modules/fieldlinessequence/util/fieldlinesstate.h b/modules/fieldlinessequence/util/fieldlinesstate.h index 66d417deff..10a1faa4ae 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.h +++ b/modules/fieldlinessequence/util/fieldlinesstate.h @@ -64,7 +64,7 @@ public: const std::vector& vertexPositions() const; // Special getter. Returns extraQuantities[INDEX]. - const std::vector& extraQuantity(const size_t INDEX, bool& isSuccesful) const; + std::vector extraQuantity(const size_t INDEX, bool& isSuccesful) const; void setModel(const fls::Model m) { _model = m; } void setTriggerTime(const double t) { _triggerTime = t; } diff --git a/modules/galaxy/rendering/galaxyraycaster.cpp b/modules/galaxy/rendering/galaxyraycaster.cpp index 1c3ed1d186..f5f7fc83a3 100644 --- a/modules/galaxy/rendering/galaxyraycaster.cpp +++ b/modules/galaxy/rendering/galaxyraycaster.cpp @@ -115,9 +115,7 @@ void GalaxyRaycaster::preRaycast(const RaycastData& data, program.setUniform(galaxyTextureUniformName, *_textureUnit); } -void GalaxyRaycaster::postRaycast(const RaycastData& data, - ghoul::opengl::ProgramObject& program) -{ +void GalaxyRaycaster::postRaycast(const RaycastData&, ghoul::opengl::ProgramObject&) { _textureUnit = nullptr; // release texture unit. } diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index 6ef4b4c635..39e7432dcd 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -340,22 +340,22 @@ void RenderableGalaxy::render(const RenderData& data, RendererTasks& tasks) { float maxDim = std::max(std::max(galaxySize.x, galaxySize.y), galaxySize.z); - float lowerRampStart = maxDim * 0.02; - float lowerRampEnd = maxDim * 0.5; + float lowerRampStart = maxDim * 0.02f; + float lowerRampEnd = maxDim * 0.5f; - float upperRampStart = maxDim * 2.0; - float upperRampEnd = maxDim * 10; + float upperRampStart = maxDim * 2.f; + float upperRampEnd = maxDim * 10.f; - float opacityCoefficient = 1.0; + float opacityCoefficient = 1.f; if (length < lowerRampStart) { - opacityCoefficient = 0; // camera really close + opacityCoefficient = 0.f; // camera really close } else if (length < lowerRampEnd) { opacityCoefficient = (length - lowerRampStart) / (lowerRampEnd - lowerRampStart); } else if (length < upperRampStart) { - opacityCoefficient = 1.0; // sweet spot (max) + opacityCoefficient = 1.f; // sweet spot (max) } else if (length < upperRampEnd) { - opacityCoefficient = 1.0 - (length - upperRampStart) / + opacityCoefficient = 1.f - (length - upperRampStart) / (upperRampEnd - upperRampStart); //fade out } else { opacityCoefficient = 0; @@ -363,7 +363,7 @@ void RenderableGalaxy::render(const RenderData& data, RendererTasks& tasks) { _opacityCoefficient = opacityCoefficient; ghoul_assert( - _opacityCoefficient >= 0.0 && _opacityCoefficient <= 1.0, + _opacityCoefficient >= 0.f && _opacityCoefficient <= 1.f, "Opacity coefficient was not between 0 and 1" ); if (opacityCoefficient > 0) { diff --git a/modules/globebrowsing/cache/memoryawaretilecache.cpp b/modules/globebrowsing/cache/memoryawaretilecache.cpp index 6cc13be786..ab4cf6ec52 100644 --- a/modules/globebrowsing/cache/memoryawaretilecache.cpp +++ b/modules/globebrowsing/cache/memoryawaretilecache.cpp @@ -301,7 +301,8 @@ void MemoryAwareTileCache::update() { size_t MemoryAwareTileCache::getGPUAllocatedDataSize() const { return std::accumulate( _textureContainerMap.cbegin(), - _textureContainerMap.cend(), 0, + _textureContainerMap.cend(), + size_t(0), [](size_t s, const std::pair& p) { @@ -316,7 +317,8 @@ size_t MemoryAwareTileCache::getGPUAllocatedDataSize() const { size_t MemoryAwareTileCache::getCPUAllocatedDataSize() const { size_t dataSize = std::accumulate( _textureContainerMap.cbegin(), - _textureContainerMap.cend(), 0, + _textureContainerMap.cend(), + size_t(0), [](size_t s, const std::pair& p) { diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index 85c6e6d040..b217d08138 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -162,8 +162,8 @@ int goToGeo(lua_State* L) { return luaL_error(L, "Expected 2 or 3 arguments."); } - double latitude = static_cast(lua_tonumber(L, 1)); - double longitude = static_cast(lua_tonumber(L, 2)); + double latitude = lua_tonumber(L, 1); + double longitude = lua_tonumber(L, 2); if (nArguments == 2) { OsEng.moduleEngine().module()->goToGeo(latitude, longitude); diff --git a/modules/globebrowsing/meshes/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp index 428aa3ed98..7ae355db65 100644 --- a/modules/globebrowsing/meshes/trianglesoup.cpp +++ b/modules/globebrowsing/meshes/trianglesoup.cpp @@ -87,7 +87,7 @@ void TriangleSoup::setElements(std::vector elements) { _elementData.resize(elements.size()); _gpuDataNeedUpdate = true; for (size_t i = 0; i < elements.size(); i++) { - _elementData[i] = static_cast(elements[i]); + _elementData[i] = elements[i]; } } @@ -128,8 +128,8 @@ bool TriangleSoup::updateDataOnGPU() { // Positions at location 0 if (_useVertexPositions) { glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), - reinterpret_cast(offsetof(Vertex, position))); + glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), nullptr); + //reinterpret_cast(offsetof(Vertex, position))); } // Textures at location 1 if (_useTextureCoordinates) { diff --git a/modules/globebrowsing/other/pixelbuffer.cpp b/modules/globebrowsing/other/pixelbuffer.cpp index c34050495a..001a2a8018 100644 --- a/modules/globebrowsing/other/pixelbuffer.cpp +++ b/modules/globebrowsing/other/pixelbuffer.cpp @@ -38,7 +38,7 @@ PixelBuffer::PixelBuffer(size_t numBytes, Usage usage) { glGenBuffers(1, &_id); bind(); - glBufferData(GL_PIXEL_UNPACK_BUFFER, _numBytes, 0, static_cast(_usage)); + glBufferData(GL_PIXEL_UNPACK_BUFFER, _numBytes, nullptr, static_cast(_usage)); unbind(); } diff --git a/modules/globebrowsing/rendering/chunkrenderer.cpp b/modules/globebrowsing/rendering/chunkrenderer.cpp index b420caa61f..bb712a6fee 100644 --- a/modules/globebrowsing/rendering/chunkrenderer.cpp +++ b/modules/globebrowsing/rendering/chunkrenderer.cpp @@ -293,7 +293,7 @@ void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& dat Geodetic2 corner = chunk.surfacePatch().getCorner(q); glm::dvec3 cornerModelSpace = ellipsoid.cartesianSurfacePosition(corner); glm::dvec3 cornerCameraSpace = - glm::dvec3(dmat4(modelViewTransform) * glm::dvec4(cornerModelSpace, 1)); + glm::dvec3(modelViewTransform * glm::dvec4(cornerModelSpace, 1)); cornersCameraSpace[i] = cornerCameraSpace; programObject->setUniform(cornerNames[i], vec3(cornerCameraSpace)); } diff --git a/modules/globebrowsing/tile/pixelregion.cpp b/modules/globebrowsing/tile/pixelregion.cpp index fabd02f3a7..6e884e4c50 100644 --- a/modules/globebrowsing/tile/pixelregion.cpp +++ b/modules/globebrowsing/tile/pixelregion.cpp @@ -118,12 +118,12 @@ void PixelRegion::scale(double s) { void PixelRegion::downscalePow2(int exponent, PixelCoordinate wrt) { start += wrt; - start.x = ceil(start.x / static_cast(pow(2, exponent)));// >>= exponent; - start.y = ceil(start.y / static_cast(pow(2, exponent)));// >>= exponent; + start.x = static_cast(ceil(start.x / static_cast(pow(2, exponent)))); + start.y = static_cast(ceil(start.y / static_cast(pow(2, exponent)))); numPixels.x = - ceil(numPixels.x / static_cast(pow(2, exponent)));// >>= exponent; + static_cast(ceil(numPixels.x / static_cast(pow(2, exponent)))); numPixels.y = - ceil(numPixels.y / static_cast(pow(2, exponent)));// >>= exponent; + static_cast(ceil(numPixels.y / static_cast(pow(2, exponent)))); start -= wrt; } diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp index 38b1198d33..8c02c7ddb7 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp @@ -126,12 +126,17 @@ void GdalRawTileDataReader::initialize() { // Assume all raster bands have the same data type _gdalDatasetMetaDataCached.rasterCount = _dataset->GetRasterCount(); - _gdalDatasetMetaDataCached.scale = _dataset->GetRasterBand(1)->GetScale(); - _gdalDatasetMetaDataCached.offset = _dataset->GetRasterBand(1)->GetOffset(); + _gdalDatasetMetaDataCached.scale = static_cast( + _dataset->GetRasterBand(1)->GetScale() + ); + _gdalDatasetMetaDataCached.offset = static_cast( + _dataset->GetRasterBand(1)->GetOffset() + ); _gdalDatasetMetaDataCached.rasterXSize = _dataset->GetRasterXSize(); _gdalDatasetMetaDataCached.rasterYSize = _dataset->GetRasterYSize(); - _gdalDatasetMetaDataCached.noDataValue = - _dataset->GetRasterBand(1)->GetNoDataValue(); + _gdalDatasetMetaDataCached.noDataValue = static_cast( + _dataset->GetRasterBand(1)->GetNoDataValue() + ); _gdalDatasetMetaDataCached.dataType = tiledatatype::getGdalDataType(_initData.glType()); @@ -145,7 +150,7 @@ void GdalRawTileDataReader::initialize() { calculateTileLevelDifference(_initData.dimensions().x); int numOverviews = _dataset->GetRasterBand(1)->GetOverviewCount(); - _cached._maxLevel = -_cached._tileLevelDifference; + _cached._maxLevel = static_cast(-_cached._tileLevelDifference); if (numOverviews > 0) { _cached._maxLevel += numOverviews - 1; } @@ -191,7 +196,7 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead( io.write.region.numPixels.y, // width to write y in destination _gdalDatasetMetaDataCached.dataType, // Type static_cast(_initData.bytesPerPixel()), // Pixel spacing - static_cast(-io.write.bytesPerLine) // Line spacing + -static_cast(io.write.bytesPerLine) // Line spacing ); // Convert error to RawTile::ReadError @@ -236,7 +241,7 @@ int GdalRawTileDataReader::calculateTileLevelDifference(int minimumPixelSize) co } int sizeLevel0 = maxOverview->GetXSize(); double diff = log2(minimumPixelSize) - log2(sizeLevel0); - return diff; + return static_cast(diff); } } // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp index ed49aa1620..062b4cfc4b 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp @@ -577,7 +577,7 @@ TileDepthTransform RawTileDataReader::calculateTileDepthTransform() { TileDepthTransform transform; transform.depthOffset = depthOffset(); - transform.depthScale = depthScale() * maximumValue; + transform.depthScale = static_cast(depthScale() * maximumValue); return transform; } diff --git a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp index 46d8c6052d..596e24b9c2 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp @@ -115,14 +115,16 @@ RawTile::ReadError SimpleRawTileDataReader::rasterRead( y * _initData.bytesPerLine() + x * _initData.bytesPerPixel(); - int xInSource = + int xInSource = static_cast( io.read.region.start.x + static_cast(x) / io.write.region.numPixels.x * - io.read.region.numPixels.x; - int yInSource = + io.read.region.numPixels.x + ); + int yInSource = static_cast( io.read.region.start.y + static_cast(y) / io.write.region.numPixels.y * - io.read.region.numPixels.y; + io.read.region.numPixels.y + ); glm::vec4 sourceTexel = _dataTexture->texelAsFloat(xInSource, yInSource); @@ -141,7 +143,7 @@ RawTile::ReadError SimpleRawTileDataReader::rasterRead( char value = static_cast( sourceTexel[rasterBand - 1] * 255 ); - *reinterpret_cast(pixelWriteDestination) = value; + *pixelWriteDestination = value; break; } case GL_UNSIGNED_SHORT: { diff --git a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp index ff2811e1ab..ae7b55fe98 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp @@ -141,6 +141,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { // break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; case 2: @@ -169,6 +170,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; case 3: @@ -198,6 +200,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { // break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; case 4: @@ -227,11 +230,12 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { // break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; default: LERROR("Unknown number of channels for OpenGL texture: " << rasterCount); - break; + throw ghoul::MissingCaseException(); } return format; } @@ -267,6 +271,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) // break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; case 2: @@ -295,6 +300,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; case 3: @@ -324,6 +330,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) // break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; case 4: @@ -353,11 +360,12 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) // break; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); + throw ghoul::MissingCaseException(); } break; default: LERROR("Unknown number of channels for OpenGL texture: " << rasterCount); - break; + throw ghoul::MissingCaseException(); } return format; } @@ -380,7 +388,7 @@ GLenum getOpenGLDataType(GDALDataType gdalType) { return GL_DOUBLE; default: LERROR("GDAL data type unknown to OpenGL: " << gdalType); - return GL_UNSIGNED_BYTE; + throw ghoul::MissingCaseException(); } } @@ -402,7 +410,7 @@ GDALDataType getGdalDataType(GLenum glType) { return GDT_Float64; default: LERROR("OpenGL data type unknown to GDAL: " << glType); - return GDT_Unknown; + throw ghoul::MissingCaseException(); } } @@ -410,12 +418,16 @@ GDALDataType getGdalDataType(GLenum glType) { size_t numberOfRasters(ghoul::opengl::Texture::Format format) { switch (format) { - case ghoul::opengl::Texture::Format::Red: return 1; - case ghoul::opengl::Texture::Format::RG: return 2; - case ghoul::opengl::Texture::Format::RGB:; - [[fallthrough]]; case ghoul::opengl::Texture::Format::BGR: return 3; - case ghoul::opengl::Texture::Format::RGBA:; - [[fallthrough]]; case ghoul::opengl::Texture::Format::BGRA: return 4; + case ghoul::opengl::Texture::Format::Red: + return 1; + case ghoul::opengl::Texture::Format::RG: + return 2; + case ghoul::opengl::Texture::Format::RGB: + case ghoul::opengl::Texture::Format::BGR: + return 3; + case ghoul::opengl::Texture::Format::RGBA: + case ghoul::opengl::Texture::Format::BGRA: + return 4; default: { ghoul_assert(false, "Unknown format"); return 0; @@ -436,7 +448,7 @@ size_t numberOfBytes(GLenum glType) { case GL_DOUBLE: return sizeof(GLdouble); default: { ghoul_assert(false, "Unknown data type"); - return 0; + throw ghoul::MissingCaseException(); } } } @@ -455,7 +467,7 @@ size_t getMaximumValue(GLenum glType) { return 1ULL << 31ULL; default: { ghoul_assert(false, "Unknown data type"); - return 0ULL; + throw ghoul::MissingCaseException(); } } } @@ -480,7 +492,7 @@ float interpretFloat(GLenum glType, const char* src) { return static_cast(*reinterpret_cast(src)); default: { ghoul_assert(false, "Unknown data type"); - return 0; + throw ghoul::MissingCaseException(); } } } @@ -504,7 +516,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { default: ghoul_assert(false, "glType data type unknown"); LERROR("glType data type unknown: " << glType); - return GLenum(0); + throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::RG: switch (glType) { @@ -523,7 +535,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { default: ghoul_assert(false, "glType data type unknown"); LERROR("glType data type unknown: " << glType); - return GLenum(0); + throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::RGB: switch (glType) { @@ -542,7 +554,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { default: ghoul_assert(false, "glType data type unknown"); LERROR("glType data type unknown: " << glType); - return GLenum(0); + throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::RGBA: switch (glType) { @@ -561,7 +573,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { default: ghoul_assert(false, "glType data type unknown"); LERROR("glType data type unknown: " << glType); - return GLenum(0); + throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::BGR: switch (glType) { @@ -580,7 +592,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { default: ghoul_assert(false, "glType data type unknown"); LERROR("glType data type unknown: " << glType); - return GLenum(0); + throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::BGRA: switch (glType) { @@ -599,16 +611,16 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { default: ghoul_assert(false, "glType data type unknown"); LERROR("glType data type unknown: " << glType); - return GLenum(0); + throw ghoul::MissingCaseException(); } default: LERROR( "Unknown format for OpenGL texture: " << - static_cast - >(format) + static_cast>( + format + ) ); - return GLenum(0); + throw ghoul::MissingCaseException(); } } diff --git a/modules/globebrowsing/tile/tileindex.cpp b/modules/globebrowsing/tile/tileindex.cpp index 72f66bb578..01c35b01fa 100644 --- a/modules/globebrowsing/tile/tileindex.cpp +++ b/modules/globebrowsing/tile/tileindex.cpp @@ -46,8 +46,8 @@ TileIndex::TileIndex(const TileIndex& other) : x(other.x), y(other.y), level(other.level) {} -TileIndex::TileIndex(const Geodetic2& point, int level) - : level(level) +TileIndex::TileIndex(const Geodetic2& point, int level_) + : level(level_) { int numIndicesAtLevel = 1 << level; double u = 0.5 + point.lon / (2 * glm::pi()); @@ -55,8 +55,8 @@ TileIndex::TileIndex(const Geodetic2& point, int level) double xIndexSpace = u * numIndicesAtLevel; double yIndexSpace = v * numIndicesAtLevel; - x = floor(xIndexSpace); - y = floor(yIndexSpace); + x = static_cast(floor(xIndexSpace)); + y = static_cast(floor(yIndexSpace)); } TileIndex::TileIndex(const ghoul::Dictionary& dict) { diff --git a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp index af24cfbc68..60a3eeb5d2 100644 --- a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp @@ -500,7 +500,7 @@ std::vector