Remove warnings

This commit is contained in:
Alexander Bock
2018-03-12 22:31:01 +01:00
parent cf3992bbc8
commit f38c26eff0
33 changed files with 127 additions and 125 deletions
@@ -355,7 +355,7 @@ void RenderableFieldlines::update(const UpdateData&) {
GL_FLOAT,
GL_FALSE,
sizeof(LinePoint),
(void*)(sizeof(glm::vec3))
reinterpret_cast<void*>(sizeof(glm::vec3))
);
glBindBuffer(GL_ARRAY_BUFFER, 0);
@@ -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<std::string>& extraNamesVec = _states[0].extraQuantityNames();
for (int i = 0; i < nExtraQuantities; ++i) {
for (int i = 0; i < static_cast<int>(nExtraQuantities); ++i) {
_pColorQuantity.addOption(i, extraNamesVec[i]);
_pMaskingQuantity.addOption(i, extraNamesVec[i]);
}
@@ -962,7 +962,7 @@ void RenderableFieldlinesSequence::extractMagnitudeVarsFromStrings(
std::vector<std::string>& extraMagVars)
{
for (int i = 0; i < extraVars.size(); i++) {
for (int i = 0; i < static_cast<int>(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
@@ -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};
@@ -231,7 +231,7 @@ void addExtraQuantities(ccmc::Kameleon* kameleon,
std::make_unique<ccmc::KameleonInterpolator>(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<int>(extraScalarVars.size()); ++i) {
std::string& str = extraScalarVars[i];
bool success = kameleon->doesVariableExist(str) && kameleon->loadVariable(str);
if (!success &&
@@ -85,7 +85,7 @@ void MilkywayConversionTask::perform(const Task::ProgressCallback& progressCallb
using namespace openspace::volume;
std::vector<std::string> 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
);
+37 -32
View File
@@ -106,13 +106,14 @@ DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
registerProperties();
}
DataCygnet::~DataCygnet(){}
DataCygnet::~DataCygnet() {}
bool DataCygnet::updateTexture(){
bool DataCygnet::updateTexture() {
std::vector<float*> data = textureData();
if(data.empty())
if (data.empty()) {
return false;
}
bool texturesReady = false;
std::vector<int> 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<DownloadManager::MemoryFile> 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<int>(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<int> values;
bool success = dict.getValue<std::vector<int> >("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<bool>("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
+5 -1
View File
@@ -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<float>(M_PI_2),
glm::vec3(1.0, 0.0, 0.0)
);
if (_group) {
_dataProcessor = _group->dataProcessor();
+1 -1
View File
@@ -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)
+1
View File
@@ -147,6 +147,7 @@ protected:
std::string _programName;
glm::mat4 _rotation; //to rotate objects with fliped texture coordniates
private:
bool destroyShader();
glm::dmat3 _stateMatrix;
+6 -2
View File
@@ -27,13 +27,17 @@
#include <modules/iswa/util/dataprocessorkameleon.h>
#include <ghoul/filesystem/filesystem.h>
#ifdef __GNUC__
#ifdef __clang__
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif // __GNUC__
#include <modules/iswa/ext/json.h>
#ifdef __GNUC__
#ifdef __clang__
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif // __GNUC__
+1 -1
View File
@@ -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<row.size(); y++){
for(size_t y = 0; y < row.size(); ++y) {
json col = row.at(y);
int colsize = static_cast<int>(col.size());
+4 -4
View File
@@ -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<jsonList.size(); i++) {
for (size_t i = 0; i < jsonList.size(); ++i) {
json jCygnet = jsonList.at(i);
std::string name = jCygnet["cygnetDisplayTitle"];
@@ -689,7 +689,7 @@ void IswaManager::addCdfFiles(std::string cdfpath) {
if (jsonFile.is_open()) {
json cdfGroups = json::parse(jsonFile);
for(int i=0; i<cdfGroups.size(); i++){
for(size_t i = 0; i < cdfGroups.size(); ++i) {
json cdfGroup = cdfGroups.at(i);
std::string groupName = cdfGroup["group"];
+2
View File
@@ -45,7 +45,9 @@
#pragma warning (pop)
#endif // WIN32
#ifdef WIN32
#define _USE_MATH_DEFINES
#endif // WIN32
#include <math.h>
#include <cstdio>
#include <cstdlib>
@@ -140,7 +140,7 @@ void AtlasManager::updateAtlas(BUFFER_INDEX bufferIndex, std::vector<int>& 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]];
}
@@ -22,17 +22,13 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/multiresvolume/rendering/histogrammanager.h>
#include <openspace/util/histogram.h>
#include <cassert>
#include <float.h>
#include <math.h>
#include <string.h>
#include <cassert>
#include <modules/multiresvolume/rendering/histogrammanager.h>
#include <openspace/util/histogram.h>
namespace {
constexpr const char* _loggerCat = "HistogramManager";
} // namespace
namespace openspace {
@@ -173,11 +169,11 @@ bool HistogramManager::saveToFile(const std::string& filename) {
file.write(reinterpret_cast<char*>(&_minBin), sizeof(float));
file.write(reinterpret_cast<char*>(&_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);
}
@@ -30,10 +30,6 @@
#include <algorithm>
#include <cassert>
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");
@@ -48,10 +48,10 @@ namespace openspace {
MultiresVolumeRaycaster::MultiresVolumeRaycaster(std::shared_ptr<TSP> tsp,
std::shared_ptr<AtlasManager> atlasManager,
std::shared_ptr<TransferFunction> transferFunction)
: _tsp(tsp)
: _boundingBox(glm::vec3(1.0))
, _tsp(tsp)
, _atlasManager(atlasManager)
, _transferFunction(transferFunction)
, _boundingBox(glm::vec3(1.0))
{}
MultiresVolumeRaycaster::~MultiresVolumeRaycaster() {}
@@ -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> _tsp;
std::shared_ptr<AtlasManager> _atlasManager;
@@ -24,10 +24,6 @@
#include <modules/multiresvolume/rendering/shenbrickselector.h>
namespace {
constexpr const char* _loggerCat = "ShenBrickSelector";
} // namespace
namespace openspace {
ShenBrickSelector::ShenBrickSelector(TSP* tsp, float spatialTolerance, float temporalTolerance)
@@ -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<float>(i) / static_cast<float>(tfWidth);
float sample = histogram->interpolate(x);
@@ -30,10 +30,6 @@
#include <algorithm>
#include <cassert>
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");
+9
View File
@@ -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 <modules/touch/ext/libTUIO11/TUIO/TuioListener.h>
#include <modules/touch/ext/libTUIO11/TUIO/TuioClient.h>
#include <modules/touch/ext/libTUIO11/TUIO/UdpReceiver.h>
@@ -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 <ghoul/glm.h>