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