From f38c26eff00621833218178014936d41792f7b89 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 12 Mar 2018 22:31:01 +0100 Subject: [PATCH] Remove warnings --- ext/ghoul | 2 +- ext/sgct | 2 +- .../util/blockplaneintersectiongeometry.h | 2 +- .../rendering/renderablefieldlines.cpp | 2 +- .../renderablefieldlinessequence.cpp | 8 +-- .../util/fieldlinesstate.cpp | 4 +- .../util/kameleonfieldlinehelper.cpp | 4 +- .../galaxy/tasks/milkywayconversiontask.cpp | 2 +- modules/iswa/rendering/datacygnet.cpp | 69 ++++++++++--------- modules/iswa/rendering/datasphere.cpp | 6 +- modules/iswa/rendering/iswacygnet.cpp | 2 +- modules/iswa/rendering/iswacygnet.h | 1 + modules/iswa/rendering/kameleonplane.cpp | 8 ++- modules/iswa/util/dataprocessorjson.cpp | 2 +- modules/iswa/util/iswamanager.cpp | 8 +-- modules/kameleon/src/kameleonwrapper.cpp | 2 + .../multiresvolume/rendering/atlasmanager.cpp | 2 +- .../rendering/histogrammanager.cpp | 16 ++--- .../rendering/localtfbrickselector.cpp | 8 +-- .../rendering/multiresvolumeraycaster.cpp | 4 +- .../rendering/multiresvolumeraycaster.h | 2 +- .../rendering/shenbrickselector.cpp | 4 -- .../rendering/simpletfbrickselector.cpp | 2 +- .../rendering/tfbrickselector.cpp | 6 +- modules/touch/include/tuioear.h | 9 +++ src/query/query.cpp | 5 -- src/rendering/renderable.cpp | 1 - src/rendering/transferfunction.cpp | 40 ++++++----- src/scene/asset.cpp | 4 +- src/util/blockplaneintersectiongeometry.cpp | 11 ++- src/util/transformationmanager.cpp | 4 -- tests/main.cpp | 1 + tests/test_rawvolumeio.inl | 9 ++- 33 files changed, 127 insertions(+), 125 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index cae1e1ffbf..1c8513b4ae 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit cae1e1ffbf07003f07a313b2213cec1c1c8de9ae +Subproject commit 1c8513b4ae8bd59245b6d9d80fb42fe3bb42e2d2 diff --git a/ext/sgct b/ext/sgct index 462cca02c6..0f689a49a8 160000 --- a/ext/sgct +++ b/ext/sgct @@ -1 +1 @@ -Subproject commit 462cca02c68e6fe74ccc3aa18580aae673ecc5aa +Subproject commit 0f689a49a8d0e47cdba9d57b9b9cf5e98fb7847a diff --git a/include/openspace/util/blockplaneintersectiongeometry.h b/include/openspace/util/blockplaneintersectiongeometry.h index b494fff259..8f1c5bfd80 100644 --- a/include/openspace/util/blockplaneintersectiongeometry.h +++ b/include/openspace/util/blockplaneintersectiongeometry.h @@ -48,7 +48,7 @@ public: private: void updateVertices(); std::vector _vertices; - bool _initialized; + // bool _initialized; GLuint _vaoId; GLuint _vBufferId; glm::vec3 _size; diff --git a/modules/fieldlines/rendering/renderablefieldlines.cpp b/modules/fieldlines/rendering/renderablefieldlines.cpp index 823eeebaf9..88dbd58b0b 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.cpp +++ b/modules/fieldlines/rendering/renderablefieldlines.cpp @@ -355,7 +355,7 @@ void RenderableFieldlines::update(const UpdateData&) { GL_FLOAT, GL_FALSE, sizeof(LinePoint), - (void*)(sizeof(glm::vec3)) + reinterpret_cast(sizeof(glm::vec3)) ); glBindBuffer(GL_ARRAY_BUFFER, 0); diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index c39cb3dd3e..68286100ec 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -588,7 +588,7 @@ bool RenderableFieldlinesSequence::prepareForOsflsStreaming() { void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM(const std::string& outputFolder) { // Load states from .osfls files into RAM! - for (const std::string filePath : _sourceFiles) { + for (const std::string& filePath : _sourceFiles) { FieldlinesState newState; if (newState.loadStateFromOsfls(filePath)) { addStateToSequence(newState); @@ -666,7 +666,7 @@ void RenderableFieldlinesSequence::setupProperties() { // the given sequence have the same extra quantities! */ const size_t nExtraQuantities = _states[0].nExtraQuantities(); const std::vector& extraNamesVec = _states[0].extraQuantityNames(); - for (int i = 0; i < nExtraQuantities; ++i) { + for (int i = 0; i < static_cast(nExtraQuantities); ++i) { _pColorQuantity.addOption(i, extraNamesVec[i]); _pMaskingQuantity.addOption(i, extraNamesVec[i]); } @@ -962,7 +962,7 @@ void RenderableFieldlinesSequence::extractMagnitudeVarsFromStrings( std::vector& extraMagVars) { - for (int i = 0; i < extraVars.size(); i++) { + for (int i = 0; i < static_cast(extraVars.size()); i++) { const std::string str = extraVars[i]; // Check if string is in the format specified for magnitude variables if (str.substr(0, 2) == "|(" && str.substr(str.size() - 2, 2) == ")|") { @@ -1120,7 +1120,7 @@ void RenderableFieldlinesSequence::update(const UpdateData& data) { // Check if current time in OpenSpace is within sequence interval if (isInInterval) { - const int nextIdx = _activeTriggerTimeIndex + 1; + const size_t nextIdx = _activeTriggerTimeIndex + 1; if ( // true => Previous frame was not within the sequence interval _activeTriggerTimeIndex < 0 diff --git a/modules/fieldlinessequence/util/fieldlinesstate.cpp b/modules/fieldlinessequence/util/fieldlinesstate.cpp index 5fa896e29a..92262b454e 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.cpp +++ b/modules/fieldlinessequence/util/fieldlinesstate.cpp @@ -345,13 +345,13 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) { const std::string timeStr = Time(_triggerTime).ISO8601(); const size_t nLines = _lineStart.size(); - const size_t nPoints = _vertexPositions.size(); + // const size_t nPoints = _vertexPositions.size(); const size_t nExtras = _extraQuantities.size(); size_t pointIndex = 0; for (size_t lineIndex = 0; lineIndex < nLines; ++lineIndex) { json jData = json::array(); - for (size_t i = 0; i < _lineCount[lineIndex]; i++, ++pointIndex) { + for (GLsizei i = 0; i < _lineCount[lineIndex]; i++, ++pointIndex) { const glm::vec3 pos = _vertexPositions[pointIndex]; json jDataElement = {pos.x, pos.y, pos.z}; diff --git a/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp b/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp index 50faa35468..81ae066664 100644 --- a/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp +++ b/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp @@ -231,7 +231,7 @@ void addExtraQuantities(ccmc::Kameleon* kameleon, std::make_unique(kameleon->model); // ------ Extract all the extraQuantities from kameleon and store in state! ------ // - for (const glm::vec3 p : state.vertexPositions()) { + for (const glm::vec3& p : state.vertexPositions()) { // Load the scalars! for (size_t i = 0; i < nXtraScalars; i++) { float val; @@ -298,7 +298,7 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon, // Load the existing SCALAR variables into kameleon. // Remove non-existing variables from vector - for (int i = 0; i < extraScalarVars.size(); ++i) { + for (int i = 0; i < static_cast(extraScalarVars.size()); ++i) { std::string& str = extraScalarVars[i]; bool success = kameleon->doesVariableExist(str) && kameleon->loadVariable(str); if (!success && diff --git a/modules/galaxy/tasks/milkywayconversiontask.cpp b/modules/galaxy/tasks/milkywayconversiontask.cpp index 5f3b11139c..ae0e1fb401 100644 --- a/modules/galaxy/tasks/milkywayconversiontask.cpp +++ b/modules/galaxy/tasks/milkywayconversiontask.cpp @@ -85,7 +85,7 @@ void MilkywayConversionTask::perform(const Task::ProgressCallback& progressCallb using namespace openspace::volume; std::vector filenames; - for (int i = 0; i < _inNSlices; i++) { + for (size_t i = 0; i < _inNSlices; i++) { filenames.push_back( _inFilenamePrefix + std::to_string(i + _inFirstIndex) + _inFilenameSuffix ); diff --git a/modules/iswa/rendering/datacygnet.cpp b/modules/iswa/rendering/datacygnet.cpp index 696a38649a..5b9618c03a 100644 --- a/modules/iswa/rendering/datacygnet.cpp +++ b/modules/iswa/rendering/datacygnet.cpp @@ -106,13 +106,14 @@ DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary) registerProperties(); } -DataCygnet::~DataCygnet(){} +DataCygnet::~DataCygnet() {} -bool DataCygnet::updateTexture(){ +bool DataCygnet::updateTexture() { std::vector data = textureData(); - if(data.empty()) + if (data.empty()) { return false; + } bool texturesReady = false; std::vector selectedOptions = _dataOptions.value(); @@ -148,16 +149,17 @@ bool DataCygnet::updateTexture(){ return texturesReady; } -bool DataCygnet::downloadTextureResource(double timestamp){ - if(_futureObject.valid()) +bool DataCygnet::downloadTextureResource(double timestamp) { + if (_futureObject.valid()) { return false; + } std::future future = IswaManager::ref().fetchDataCygnet( _data->id, timestamp ); - if(future.valid()){ + if (future.valid()) { _futureObject = std::move(future); return true; } @@ -168,8 +170,9 @@ bool DataCygnet::downloadTextureResource(double timestamp){ bool DataCygnet::updateTextureResource(){ DownloadManager::MemoryFile dataFile = _futureObject.get(); - if(dataFile.corrupted) + if (dataFile.corrupted) { return false; + } _dataBuffer = std::string(dataFile.buffer, dataFile.size); delete[] dataFile.buffer; @@ -197,8 +200,8 @@ void DataCygnet::setTextureUniforms(){ // Set Textures ghoul::opengl::TextureUnit txUnits[MAX_TEXTURES]; int j = 0; - for(int option : selectedOptions){ - if(_textures[option]){ + for (int option : selectedOptions) { + if (_textures[option]) { txUnits[j].activate(); _textures[option]->bind(); _shader->setUniform( @@ -207,7 +210,9 @@ void DataCygnet::setTextureUniforms(){ ); j++; - if(j >= MAX_TEXTURES) break; + if (j >= MAX_TEXTURES) { + break; + } } } @@ -220,17 +225,16 @@ void DataCygnet::setTextureUniforms(){ ghoul::opengl::TextureUnit tfUnits[MAX_TEXTURES]; j = 0; - if((activeTransferfunctions == 1)){ + if (activeTransferfunctions == 1) { tfUnits[0].activate(); _transferFunctions[0]->bind(); _shader->setUniform( "transferFunctions[0]", tfUnits[0] ); - }else{ - for(int option : selectedOptions){ - - if(_transferFunctions[option]){ + } else { + for (int option : selectedOptions) { + if (_transferFunctions[option]) { tfUnits[j].activate(); _transferFunctions[option]->bind(); _shader->setUniform( @@ -248,7 +252,6 @@ void DataCygnet::setTextureUniforms(){ _shader->setUniform("numTextures", activeTextures); } - void DataCygnet::readTransferFunctions(std::string tfPath){ std::string line; std::ifstream tfFile(absPath(tfPath)); @@ -280,7 +283,7 @@ void DataCygnet::fillOptions(std::string& source) { _textureDimensions ); - for (int i = 0; i < options.size(); i++) { + for (int i = 0; i < static_cast(options.size()); i++) { _dataOptions.addOption({i, options[i]}); _textures.push_back(nullptr); } @@ -297,43 +300,45 @@ void DataCygnet::fillOptions(std::string& source) { } } -void DataCygnet::setPropertyCallbacks(){ - _normValues.onChange([this](){ +void DataCygnet::setPropertyCallbacks() { + _normValues.onChange([this]() { _dataProcessor->normValues(_normValues.value()); updateTexture(); }); - _useLog.onChange([this](){ + _useLog.onChange([this]() { _dataProcessor->useLog(_useLog.value()); updateTexture(); }); - _useHistogram.onChange([this](){ + _useHistogram.onChange([this]() { _dataProcessor->useHistogram(_useHistogram.value()); updateTexture(); - if(_autoFilter.value()) + if (_autoFilter.value()) { _backgroundValues.setValue(_dataProcessor->filterValues()); + } }); - _dataOptions.onChange([this](){ - if(_dataOptions.value().size() > MAX_TEXTURES) + _dataOptions.onChange([this]() { + if (_dataOptions.value().size() > MAX_TEXTURES) { LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES)); + } updateTexture(); }); - _transferFunctionsFile.onChange([this](){ + _transferFunctionsFile.onChange([this]() { readTransferFunctions(_transferFunctionsFile.value()); }); } -void DataCygnet::subscribeToGroup(){ +void DataCygnet::subscribeToGroup() { auto groupEvent = _group->groupEvent(); groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){ LDEBUG(name() + " Event dataOptionsChanged"); std::vector values; bool success = dict.getValue >("dataOptions", values); - if(success){ + if (success) { _dataOptions.setValue(values); } }); @@ -342,7 +347,7 @@ void DataCygnet::subscribeToGroup(){ LDEBUG(name() + " Event normValuesChanged"); glm::vec2 values; bool success = dict.getValue("normValues", values); - if(success){ + if (success) { _normValues.setValue(values); } }); @@ -351,7 +356,7 @@ void DataCygnet::subscribeToGroup(){ LDEBUG(name() + " Event backgroundValuesChanged"); glm::vec2 values; bool success = dict.getValue("backgroundValues", values); - if(success){ + if (success) { _backgroundValues.setValue(values); } }); @@ -377,13 +382,13 @@ void DataCygnet::subscribeToGroup(){ _autoFilter.setValue(dict.value("autoFilter")); }); - groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict) { + groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary) { LDEBUG(name() + " Event updateGroup"); - if(_autoFilter.value()) + if (_autoFilter.value()) { _backgroundValues.setValue(_dataProcessor->filterValues()); + } updateTexture(); }); - } } //namespace openspace diff --git a/modules/iswa/rendering/datasphere.cpp b/modules/iswa/rendering/datasphere.cpp index 54219bb324..6aa0d1e378 100644 --- a/modules/iswa/rendering/datasphere.cpp +++ b/modules/iswa/rendering/datasphere.cpp @@ -54,7 +54,11 @@ void DataSphere::initialize() { IswaCygnet::initialize(); //rotate 90 degrees because of the texture coordinates in PowerScaledSphere - _rotation = glm::rotate(_rotation, (float)M_PI_2, glm::vec3(1.0, 0.0, 0.0)); + _rotation = glm::rotate( + _rotation, + static_cast(M_PI_2), + glm::vec3(1.0, 0.0, 0.0) + ); if (_group) { _dataProcessor = _group->dataProcessor(); diff --git a/modules/iswa/rendering/iswacygnet.cpp b/modules/iswa/rendering/iswacygnet.cpp index 8aed4c1d4c..3d3c9379f2 100644 --- a/modules/iswa/rendering/iswacygnet.cpp +++ b/modules/iswa/rendering/iswacygnet.cpp @@ -53,8 +53,8 @@ namespace openspace { IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary) : Renderable(dictionary) - , _delete(DeleteInfo) , _alpha(AlphaInfo, 0.9f, 0.f, 1.f) + , _delete(DeleteInfo) , _shader(nullptr) , _group(nullptr) , _textureDirty(false) diff --git a/modules/iswa/rendering/iswacygnet.h b/modules/iswa/rendering/iswacygnet.h index 238dae34b3..a4fe36bba7 100644 --- a/modules/iswa/rendering/iswacygnet.h +++ b/modules/iswa/rendering/iswacygnet.h @@ -147,6 +147,7 @@ protected: std::string _programName; glm::mat4 _rotation; //to rotate objects with fliped texture coordniates + private: bool destroyShader(); glm::dmat3 _stateMatrix; diff --git a/modules/iswa/rendering/kameleonplane.cpp b/modules/iswa/rendering/kameleonplane.cpp index a81bcd5fde..a9d93613d9 100644 --- a/modules/iswa/rendering/kameleonplane.cpp +++ b/modules/iswa/rendering/kameleonplane.cpp @@ -27,13 +27,17 @@ #include #include -#ifdef __GNUC__ +#ifdef __clang__ +#elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #endif // __GNUC__ #include -#ifdef __GNUC__ + +#ifdef __clang__ + +#elif defined(__GNUC__) #pragma GCC diagnostic pop #endif // __GNUC__ diff --git a/modules/iswa/util/dataprocessorjson.cpp b/modules/iswa/util/dataprocessorjson.cpp index 37a3ac5a56..c2616c85d0 100644 --- a/modules/iswa/util/dataprocessorjson.cpp +++ b/modules/iswa/util/dataprocessorjson.cpp @@ -85,7 +85,7 @@ void DataProcessorJson::addDataValues(std::string data, json row = variables[options[i].description]; // int rowsize = row.size(); - for(int y=0; y(col.size()); diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index acbaf7622e..7bd07d484d 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -51,8 +51,8 @@ #ifdef __clang__ #pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wuseless-cast" -#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +// #pragma clang diagnostic ignored "-Wuseless-cast" +// #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" #elif (defined __GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuseless-cast" @@ -661,7 +661,7 @@ void IswaManager::fillCygnetInfo(std::string jsonString) { for (auto list : lists) { json jsonList = j[list]; - for (int i=0; i #include #include diff --git a/modules/multiresvolume/rendering/atlasmanager.cpp b/modules/multiresvolume/rendering/atlasmanager.cpp index a2675df9cb..945d638acd 100644 --- a/modules/multiresvolume/rendering/atlasmanager.cpp +++ b/modules/multiresvolume/rendering/atlasmanager.cpp @@ -140,7 +140,7 @@ void AtlasManager::updateAtlas(BUFFER_INDEX bufferIndex, std::vector& brick glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - for (int i = 0; i < nBrickIndices; i++) { + for (size_t i = 0; i < nBrickIndices; i++) { _atlasMap[i] = _brickMap[brickIndices[i]]; } diff --git a/modules/multiresvolume/rendering/histogrammanager.cpp b/modules/multiresvolume/rendering/histogrammanager.cpp index 40a75fc836..14512c7ec4 100644 --- a/modules/multiresvolume/rendering/histogrammanager.cpp +++ b/modules/multiresvolume/rendering/histogrammanager.cpp @@ -22,17 +22,13 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + +#include +#include #include #include #include -#include - -#include -#include - -namespace { - constexpr const char* _loggerCat = "HistogramManager"; -} // namespace namespace openspace { @@ -173,11 +169,11 @@ bool HistogramManager::saveToFile(const std::string& filename) { file.write(reinterpret_cast(&_minBin), sizeof(float)); file.write(reinterpret_cast(&_maxBin), sizeof(float)); - int nFloats = numHistograms * _numBins; + size_t nFloats = numHistograms * _numBins; float* histogramData = new float[nFloats]; for (size_t i = 0; i < numHistograms; ++i) { - int offset = i*_numBins; + size_t offset = i*_numBins; memcpy(&histogramData[offset], _histograms[i].data(), sizeof(float) * _numBins); } diff --git a/modules/multiresvolume/rendering/localtfbrickselector.cpp b/modules/multiresvolume/rendering/localtfbrickselector.cpp index 11b458abe1..3f3ff53d10 100644 --- a/modules/multiresvolume/rendering/localtfbrickselector.cpp +++ b/modules/multiresvolume/rendering/localtfbrickselector.cpp @@ -30,10 +30,6 @@ #include #include -namespace { - constexpr const char* _loggerCat = "LocalTfBrickSelector"; -} // namespace - namespace openspace { LocalTfBrickSelector::LocalTfBrickSelector(TSP* tsp, LocalErrorHistogramManager* hm, @@ -355,7 +351,7 @@ bool LocalTfBrickSelector::calculateBrickErrors() { brickIndex ); float error = 0; - for (int i = 0; i < gradients.size(); i++) { + for (size_t i = 0; i < gradients.size(); i++) { float x = (i + 0.5f) / tfWidth; float sample = histogram->interpolate(x); ghoul_assert(sample >= 0, "@MISSING"); @@ -372,7 +368,7 @@ bool LocalTfBrickSelector::calculateBrickErrors() { brickIndex ); float error = 0; - for (int i = 0; i < gradients.size(); i++) { + for (size_t i = 0; i < gradients.size(); i++) { float x = (i + 0.5f) / tfWidth; float sample = histogram->interpolate(x); ghoul_assert(sample >= 0, "@MISSING"); diff --git a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp index fd45e52ecd..e409f25451 100644 --- a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp +++ b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp @@ -48,10 +48,10 @@ namespace openspace { MultiresVolumeRaycaster::MultiresVolumeRaycaster(std::shared_ptr tsp, std::shared_ptr atlasManager, std::shared_ptr transferFunction) - : _tsp(tsp) + : _boundingBox(glm::vec3(1.0)) + , _tsp(tsp) , _atlasManager(atlasManager) , _transferFunction(transferFunction) - , _boundingBox(glm::vec3(1.0)) {} MultiresVolumeRaycaster::~MultiresVolumeRaycaster() {} diff --git a/modules/multiresvolume/rendering/multiresvolumeraycaster.h b/modules/multiresvolume/rendering/multiresvolumeraycaster.h index 0df134ae2f..27b0263aef 100644 --- a/modules/multiresvolume/rendering/multiresvolumeraycaster.h +++ b/modules/multiresvolume/rendering/multiresvolumeraycaster.h @@ -77,11 +77,11 @@ public: void setModelTransform(glm::mat4 transform); //void setTime(double time); void setStepSizeCoefficient(float coefficient); + private: BoxGeometry _boundingBox; glm::mat4 _modelTransform; float _stepSizeCoefficient; - double _time; std::shared_ptr _tsp; std::shared_ptr _atlasManager; diff --git a/modules/multiresvolume/rendering/shenbrickselector.cpp b/modules/multiresvolume/rendering/shenbrickselector.cpp index 5dfabb71b8..366409b9e2 100644 --- a/modules/multiresvolume/rendering/shenbrickselector.cpp +++ b/modules/multiresvolume/rendering/shenbrickselector.cpp @@ -24,10 +24,6 @@ #include -namespace { - constexpr const char* _loggerCat = "ShenBrickSelector"; -} // namespace - namespace openspace { ShenBrickSelector::ShenBrickSelector(TSP* tsp, float spatialTolerance, float temporalTolerance) diff --git a/modules/multiresvolume/rendering/simpletfbrickselector.cpp b/modules/multiresvolume/rendering/simpletfbrickselector.cpp index faf1e4ad46..e1a64d0810 100644 --- a/modules/multiresvolume/rendering/simpletfbrickselector.cpp +++ b/modules/multiresvolume/rendering/simpletfbrickselector.cpp @@ -307,7 +307,7 @@ bool SimpleTfBrickSelector::calculateBrickImportances() { } float dotProduct = 0; - for (int i = 0; i < tf->width(); i++) { + for (size_t i = 0; i < tf->width(); i++) { float x = static_cast(i) / static_cast(tfWidth); float sample = histogram->interpolate(x); diff --git a/modules/multiresvolume/rendering/tfbrickselector.cpp b/modules/multiresvolume/rendering/tfbrickselector.cpp index 34b691ba23..e4daac6e62 100644 --- a/modules/multiresvolume/rendering/tfbrickselector.cpp +++ b/modules/multiresvolume/rendering/tfbrickselector.cpp @@ -30,10 +30,6 @@ #include #include -namespace { - constexpr const char* _loggerCat = "TfBrickSelector"; -} // namespace - namespace openspace { TfBrickSelector::TfBrickSelector(TSP* tsp, ErrorHistogramManager* hm, @@ -364,7 +360,7 @@ bool TfBrickSelector::calculateBrickErrors() { } else { const Histogram* histogram = _histogramManager->getHistogram(brickIndex); float error = 0; - for (int i = 0; i < gradients.size(); i++) { + for (size_t i = 0; i < gradients.size(); i++) { float x = (i + 0.5f) / tfWidth; float sample = histogram->interpolate(x); ghoul_assert(sample >= 0, "@MISSING"); diff --git a/modules/touch/include/tuioear.h b/modules/touch/include/tuioear.h index 66cb0b3172..8eb738fc92 100644 --- a/modules/touch/include/tuioear.h +++ b/modules/touch/include/tuioear.h @@ -25,11 +25,17 @@ #ifndef __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__ #define __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__ +// -Wold-style-cast #if (defined(__GNUC__) && !defined(__clang__)) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" #endif // defined(__GNUC__) && !defined(__clang__) +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" +#endif // __clang__ + #include #include #include @@ -38,6 +44,9 @@ #if (defined(__GNUC__) && !defined(__clang__)) #pragma GCC diagnostic pop #endif // defined(__GNUC__) && !defined(__clang__) +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // __clang__ #include diff --git a/src/query/query.cpp b/src/query/query.cpp index 9ded69df3a..61e51c4ed6 100644 --- a/src/query/query.cpp +++ b/src/query/query.cpp @@ -37,10 +37,6 @@ #include #include -namespace { - constexpr const char* _loggerCat = "Query"; -} // namespace - namespace openspace { Scene* sceneGraph() { @@ -77,5 +73,4 @@ std::vector allProperties() { return properties; } - } // namespace diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 7ddd86c41a..1deb4cdf3c 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -37,7 +37,6 @@ #include namespace { - constexpr const char* _loggerCat = "Renderable"; constexpr const char* keyStart = "StartTime"; constexpr const char* keyEnd = "EndTime"; constexpr const char* KeyType = "Type"; diff --git a/src/rendering/transferfunction.cpp b/src/rendering/transferfunction.cpp index 45480b43a9..78f61b811b 100644 --- a/src/rendering/transferfunction.cpp +++ b/src/rendering/transferfunction.cpp @@ -164,9 +164,9 @@ void TransferFunction::setTextureFromTxt() { } // allocate new float array with zeros - float* transferFunction = new float[width*4](); - for (int i = 0; i < 4*width; ++i) { - transferFunction[i] = 0.0f; + float* transferFunction = new float[width * 4]; + for (int i = 0; i < 4 * width; ++i) { + transferFunction[i] = 0.f; } size_t lowerIndex = static_cast(floorf(lower * static_cast(width-1))); @@ -176,9 +176,9 @@ void TransferFunction::setTextureFromTxt() { auto currentKey = prevKey + 1; auto lastKey = mappingKeys.end() -1; - for (size_t i=lowerIndex; i<=upperIndex; i++) { - float fpos = static_cast(i)/static_cast(width-1); - if (fpos > (*currentKey).position) { + for (size_t i = lowerIndex; i <= upperIndex; ++i) { + float fpos = static_cast(i) / static_cast(width-1); + if (fpos > currentKey->position) { prevKey = currentKey; currentKey++; if (currentKey == mappingKeys.end()) { @@ -186,18 +186,18 @@ void TransferFunction::setTextureFromTxt() { } } - float dist = fpos-(*prevKey).position; - float weight = dist/((*currentKey).position-(*prevKey).position); + float dist = fpos - prevKey->position; + float weight = dist / (currentKey->position - prevKey->position); - for (size_t channel=0; channel<4; ++channel) { - size_t position = 4*i + channel; + for (size_t channel = 0; channel < 4; ++channel) { + size_t position = 4 * i + channel; // Interpolate linearly between prev and next mapping key - float value = ((*prevKey).color[channel] * (1.f - weight) + - (*currentKey).color[channel] * weight) / 255.f; + float value = (prevKey->color[channel] * (1.f - weight) + + currentKey->color[channel] * weight) / 255.f; if (channel < 3) { // Premultiply with alpha - value *= ((*prevKey).color[3] * (1.f - weight) + - (*currentKey).color[3] * weight) / 255.f; + value *= (prevKey->color[3] * (1.f - weight) + + currentKey->color[3] * weight) / 255.f; } transferFunction[position] = value; } @@ -221,13 +221,19 @@ void TransferFunction::setTextureFromImage() { } glm::vec4 TransferFunction::sample(size_t offset) { - if (!_texture) return glm::vec4(0.0); + if (!_texture) { + return glm::vec4(0.f); + } int nPixels = _texture->width(); // Clamp to range. - if (offset >= nPixels) offset = nPixels - 1; - if (offset < 0) offset = 0; + if (offset >= nPixels) { + offset = nPixels - 1; + } + if (offset < 0) { + offset = 0; + } return _texture->texelAsFloat(offset); } diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 3ad32a7d02..1521c30823 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -122,9 +122,7 @@ void Asset::setState(Asset::State state) { } } -void Asset::requiredAssetChangedState(std::shared_ptr child, - Asset::State childState) -{ +void Asset::requiredAssetChangedState(std::shared_ptr, Asset::State childState) { if (!isLoaded()) { // Prohibit state change to SyncResolved if additional requirements // may still be added. diff --git a/src/util/blockplaneintersectiongeometry.cpp b/src/util/blockplaneintersectiongeometry.cpp index 75e7028eeb..22a059c5df 100644 --- a/src/util/blockplaneintersectiongeometry.cpp +++ b/src/util/blockplaneintersectiongeometry.cpp @@ -36,12 +36,11 @@ namespace { namespace openspace { -BlockPlaneIntersectionGeometry::BlockPlaneIntersectionGeometry( - glm::vec3 blockSize, - glm::vec3 planeNormal, - float planeDistance) - : _initialized(false) - , _vaoId(0) +BlockPlaneIntersectionGeometry::BlockPlaneIntersectionGeometry(glm::vec3 blockSize, + glm::vec3 planeNormal, + float planeDistance) + // : _initialized(false) + : _vaoId(0) , _vBufferId(0) , _size(blockSize) {} diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index eba2959ee3..05a96963db 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -26,10 +26,6 @@ #include #include -namespace { - constexpr const char* _loggerCat = "TransformationManager"; -} // namespace - namespace openspace { TransformationManager::TransformationManager(){ diff --git a/tests/main.cpp b/tests/main.cpp index 1016a8cfe3..af3fb23472 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -31,6 +31,7 @@ #pragma clang diagnostic ignored "-Wmissing-noreturn" #pragma clang diagnostic ignored "-Wshift-sign-overflow" #pragma clang diagnostic ignored "-Wsign-compare" +#pragma clang diagnostic ignored "-Wused-but-marked-unused" #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wundef" diff --git a/tests/test_rawvolumeio.inl b/tests/test_rawvolumeio.inl index f161d6cd36..cacb18b60d 100644 --- a/tests/test_rawvolumeio.inl +++ b/tests/test_rawvolumeio.inl @@ -34,12 +34,10 @@ #include #include -using namespace openspace; - class RawVolumeIoTest : public testing::Test {}; TEST_F(RawVolumeIoTest, TinyInputOutput) { - using namespace volume; + using namespace openspace::volume; glm::uvec3 dims{ 1, 1, 1 }; float value = 0.5; @@ -62,7 +60,7 @@ TEST_F(RawVolumeIoTest, TinyInputOutput) { } TEST_F(RawVolumeIoTest, BasicInputOutput) { - using namespace volume; + using namespace openspace::volume; glm::uvec3 dims{ 2, 4, 8 }; auto value = [dims](glm::uvec3 v) { @@ -70,7 +68,8 @@ TEST_F(RawVolumeIoTest, BasicInputOutput) { }; RawVolume vol(dims); - vol.forEachVoxel([&vol, &value](glm::uvec3 x, float v) { + vol.forEachVoxel([&vol, &value](glm::uvec3 x, float + ) { vol.set(x, value(x)); });