Removing warnings

This commit is contained in:
Alexander Bock
2020-04-14 22:32:26 +02:00
parent f1fe2f197b
commit 5a94c486f0
20 changed files with 93 additions and 68 deletions

View File

@@ -636,9 +636,8 @@ void RenderableLabels::render(const RenderData& data, RendererTasks&) {
float fadeInVariable = 1.f;
if (_enableFadingEffect) {
float distanceNodeToCamera = glm::distance(
data.camera.positionVec3(),
data.modelTransform.translation
float distanceNodeToCamera = static_cast<float>(
glm::distance(data.camera.positionVec3(), data.modelTransform.translation)
);
float sUnit = unit(_fadeStartUnitOption);
float eUnit = unit(_fadeEndUnitOption);
@@ -743,6 +742,7 @@ float RenderableLabels::changedPerlinSmoothStepFunc(float x, float startX,
else if (x >= endX) {
return std::clamp(f2, 0.f, 1.f);
}
return x;
}
float RenderableLabels::linearSmoothStepFunc(float x, float startX, float endX,
@@ -763,17 +763,18 @@ float RenderableLabels::linearSmoothStepFunc(float x, float startX, float endX,
else if (x >= endX) {
return std::clamp(f2, 0.f, 1.f);
}
return x;
}
float RenderableLabels::unit(int unit) const {
switch (static_cast<Unit>(unit)) {
case Meter: return 1.f;
case Kilometer: return 1e3;
case Megameter: return 1e6;
case Gigameter: return 1e9;
case Kilometer: return 1e3f;
case Megameter: return 1e6f;
case Gigameter: return 1e9f;
case AU: return 149597870700.f;
case Terameter: return 1e12;
case Petameter: return 1e15;
case Terameter: return 1e12f;
case Petameter: return 1e15f;
case Parsec: return static_cast<float>(PARSEC);
case Kiloparsec: return static_cast<float>(1e3 * PARSEC);
case Megaparsec: return static_cast<float>(1e6 * PARSEC);

View File

@@ -240,13 +240,13 @@ void RenderableNodeLine::updateVertexData() {
global::renderEngine.scene()->sceneGraphNode(_end)->worldPosition()
);
_vertexArray.push_back(_startPos.x);
_vertexArray.push_back(_startPos.y);
_vertexArray.push_back(_startPos.z);
_vertexArray.push_back(static_cast<float>(_startPos.x));
_vertexArray.push_back(static_cast<float>(_startPos.y));
_vertexArray.push_back(static_cast<float>(_startPos.z));
_vertexArray.push_back(_endPos.x);
_vertexArray.push_back(_endPos.y);
_vertexArray.push_back(_endPos.z);
_vertexArray.push_back(static_cast<float>(_endPos.x));
_vertexArray.push_back(static_cast<float>(_endPos.y));
_vertexArray.push_back(static_cast<float>(_endPos.z));
_vertexArray;

View File

@@ -373,7 +373,7 @@ void RenderableTrailOrbit::update(const UpdateData& data) {
std::for_each(_vertexArray.begin(), _vertexArray.end(), setMax);
setBoundingSphere(glm::distance(maxVertex, minVertex) / 2.0);
setBoundingSphere(glm::distance(maxVertex, minVertex) / 2.f);
}
RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(

View File

@@ -350,7 +350,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) {
std::for_each(_vertexArray.begin(), _vertexArray.end(), setMax);
setBoundingSphere(glm::distance(maxVertex, minVertex) / 2.0);
setBoundingSphere(glm::distance(maxVertex, minVertex) / 2.f);
}

View File

@@ -463,9 +463,9 @@ void RenderableGalaxy::initializeGL() {
}
else {
FileSys.cacheManager()->removeCacheFile(_pointsFilename);
Result res = loadPointFile(_pointsFilename);
pointPositions = std::move(res.positions);
pointColors = std::move(res.color);
Result resPoint = loadPointFile(_pointsFilename);
pointPositions = std::move(resPoint.positions);
pointColors = std::move(resPoint.color);
saveCachedFile(
cachedPointsFile,
pointPositions,
@@ -561,7 +561,7 @@ void RenderableGalaxy::update(const UpdateData& data) {
_pointTransform[3] += translation;
_raycaster->setDownscaleRender(_downScaleVolumeRendering);
_raycaster->setMaxSteps(_numberOfRayCastingSteps);
_raycaster->setMaxSteps(static_cast<int>(_numberOfRayCastingSteps));
_raycaster->setStepSize(_stepSize);
_raycaster->setAspect(_aspect);
_raycaster->setModelTransform(volumeTransform);
@@ -798,7 +798,7 @@ float RenderableGalaxy::safeLength(const glm::vec3& vector) const {
return glm::length(vector / maxComponent) * maxComponent;
}
RenderableGalaxy::Result RenderableGalaxy::loadPointFile(const std::string& file) {
RenderableGalaxy::Result RenderableGalaxy::loadPointFile(const std::string&) {
std::vector<glm::vec3> pointPositions;
std::vector<glm::vec3> pointColors;
int64_t nPoints;

View File

@@ -626,8 +626,7 @@ void GlobeBrowsingModule::goToGeodetic2(const globebrowsing::RenderableGlobe& gl
}
void GlobeBrowsingModule::goToGeodetic3(const globebrowsing::RenderableGlobe& globe,
globebrowsing::Geodetic3 geo3,
bool doResetCameraDirection)
globebrowsing::Geodetic3 geo3, bool)
{
using namespace globebrowsing;
const glm::dvec3 positionModelSpace = globe.ellipsoid().cartesianPosition(geo3);

View File

@@ -394,7 +394,8 @@ PixelRegion highestResPixelRegion(const GeodeticPatch& geodeticPatch,
return region;
}
RawTile::ReadError postProcessErrorCheck(const RawTile& rawTile, size_t nRasters,
RawTile::ReadError postProcessErrorCheck(const RawTile& rawTile,
[[ maybe_unused ]] size_t nRasters,
float noDataValue)
{
// This check was implicit before and just made explicit here

View File

@@ -199,8 +199,8 @@ ShadowComponent::ShadowComponent(const ghoul::Dictionary& dictionary)
if (_shadowMapDictionary.hasKey(DepthMapSizeInfo.identifier)) {
glm::vec2 depthMapSize =
_shadowMapDictionary.value<glm::vec2>(DepthMapSizeInfo.identifier);
_shadowDepthTextureWidth = depthMapSize.x;
_shadowDepthTextureHeight = depthMapSize.y;
_shadowDepthTextureWidth = static_cast<int>(depthMapSize.x);
_shadowDepthTextureHeight = static_cast<int>(depthMapSize.y);
_dynamicDepthTextureRes = false;
}
else {

View File

@@ -540,7 +540,7 @@ void TimeQuantizer::doFirstApproximation(DateTime& quantized, DateTime& unQ,
static_cast<double>(_start.year());
minIncrementsAdjust = minYearsToAdjust / value;
quantized.setYear(
_start.year() + static_cast<int>(minIncrementsAdjust) * value
_start.year() + static_cast<int>(minIncrementsAdjust * value)
);
break;
case 'M':

View File

@@ -216,7 +216,7 @@ void FlightControllerTopic::handleJson(const nlohmann::json& json) {
void FlightControllerTopic::connect() {
_isDone = false;
std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0);
std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0.f);
_payload[TypeKey] = Connect;
setFocusNodes();
setInterestingTimes();
@@ -376,7 +376,7 @@ void FlightControllerTopic::engageAutopilot(const nlohmann::json &json) {
setFriction(false);
auto input = json[AutopilotInputKey][ValuesKey];
std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0);
std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0.f);
_inputState.isConnected = true;
for (auto it = input.begin(); it != input.end(); ++it) {
@@ -413,7 +413,7 @@ void FlightControllerTopic::handleAutopilot(const nlohmann::json &json) {
}
void FlightControllerTopic::processInputState(const nlohmann::json& json) {
std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0);
std::fill(_inputState.axes.begin(), _inputState.axes.end(), 0.f);
_inputState.isConnected = true;
// Get "inputState" object from "payload"

View File

@@ -69,7 +69,7 @@ namespace {
}
};
constexpr const LeapSecond Epoch = { 2000, 1 };
constexpr const LeapSecond LeapEpoch = { 2000, 1 };
// List taken from: https://www.ietf.org/timezones/data/leap-seconds.list
constexpr const std::array<LeapSecond, 28> LeapSeconds = {
@@ -194,7 +194,7 @@ namespace {
const auto y2000 = std::lower_bound(
LeapSeconds.begin(),
LeapSeconds.end(),
Epoch
LeapEpoch
);
// The distance between the two iterators gives us the number of leap years
@@ -387,15 +387,15 @@ RenderableOrbitalKepler::RenderableOrbitalKepler(const ghoul::Dictionary& dict)
_upperLimit = dict.hasKeyAndValue<double>(UpperLimitInfo.identifier) ?
static_cast<unsigned int>(dict.value<double>(UpperLimitInfo.identifier)) :
0.f;
0u;
_startRenderIdx = dict.hasKeyAndValue<double>(StartRenderIdxInfo.identifier) ?
static_cast<unsigned int>(dict.value<double>(StartRenderIdxInfo.identifier)) :
0;
0u;
_sizeRender = dict.hasKeyAndValue<double>(RenderSizeInfo.identifier) ?
static_cast<unsigned int>(dict.value<double>(RenderSizeInfo.identifier)) :
0;
0u;
_appearance.lineWidth = dict.hasKeyAndValue<double>(LineWidthInfo.identifier) ?
static_cast<float>(dict.value<double>(LineWidthInfo.identifier)) :
@@ -500,8 +500,8 @@ void RenderableOrbitalKepler::render(const RenderData& data, RendererTasks&) {
glBindVertexArray(_vertexArray);
for (size_t i = 0; i < nrOrbits; ++i) {
glDrawArrays(GL_LINE_STRIP, vertices, _segmentSize[i] + 1);
vertices = vertices + _segmentSize[i] + 1;
glDrawArrays(GL_LINE_STRIP, vertices, static_cast<GLsizei>(_segmentSize[i] + 1));
vertices = vertices + static_cast<GLint>(_segmentSize[i]) + 1;
}
glBindVertexArray(0);
@@ -513,7 +513,7 @@ void RenderableOrbitalKepler::updateBuffers() {
size_t nVerticesTotal = 0;
int numOrbits = _data.size();
int numOrbits = static_cast<int>(_data.size());
for (size_t i = 0; i < numOrbits; ++i) {
nVerticesTotal += _segmentSize[i] + 1;
}

View File

@@ -152,7 +152,7 @@ void RenderableSatellites::readDataFile(const std::string& filename) {
std::string line = "-";
std::string name;
unsigned int endElement = _startRenderIdx + _sizeRender - 1;
long long endElement = _startRenderIdx + _sizeRender - 1;
endElement = (endElement >= _numObjects) ? _numObjects - 1 : endElement;
//Burn lines if not starting at first element
for (unsigned int k = 0; k < _startRenderIdx; ++k) {
@@ -265,8 +265,8 @@ void RenderableSatellites::readDataFile(const std::string& filename) {
void RenderableSatellites::initializeFileReading() {
_startRenderIdx.removeOnChange(_startRenderIdxCallbackHandle);
_sizeRender.removeOnChange(_sizeRenderCallbackHandle);
_startRenderIdx.setMaxValue(_numObjects - 1);
_sizeRender.setMaxValue(_numObjects);
_startRenderIdx.setMaxValue(static_cast<unsigned int>(_numObjects - 1));
_sizeRender.setMaxValue(static_cast<unsigned int>(_numObjects));
_startRenderIdx = static_cast<unsigned int>(0);
_sizeRender = static_cast<unsigned int>(_numObjects);
_startRenderIdxCallbackHandle = _startRenderIdx.onChange(

View File

@@ -202,7 +202,10 @@ void RenderableSmallBody::readDataFile(const std::string& filename) {
unsigned int sequentialLineErrors = 0;
unsigned int endElement = _startRenderIdx + _sizeRender - 1;
endElement = (endElement >= _numObjects) ? _numObjects - 1 : endElement;
endElement =
(endElement >= _numObjects) ?
static_cast<unsigned int>(_numObjects - 1) :
endElement;
// Burn lines if not starting at first element
for (unsigned int k = 0; k < _startRenderIdx; ++k) {
skipSingleLineInFile(file);
@@ -269,8 +272,8 @@ void RenderableSmallBody::readDataFile(const std::string& filename) {
void RenderableSmallBody::initializeFileReading() {
_startRenderIdx.removeOnChange(_startRenderIdxCallbackHandle);
_sizeRender.removeOnChange(_sizeRenderCallbackHandle);
_startRenderIdx.setMaxValue(_numObjects - 1);
_sizeRender.setMaxValue(_numObjects);
_startRenderIdx.setMaxValue(static_cast<unsigned int>(_numObjects - 1));
_sizeRender.setMaxValue(static_cast<unsigned int>(_numObjects));
_startRenderIdx = static_cast<unsigned int>(0);
_sizeRender = static_cast<unsigned int>(_numObjects);
_startRenderIdxCallbackHandle = _startRenderIdx.onChange(_updateStartRenderIdxSelect);
@@ -278,7 +281,7 @@ void RenderableSmallBody::initializeFileReading() {
// If a limit wasn't specified in dictionary, set it to # lines in file
// minus the header line (but temporarily disable callback to avoid 2nd call)
_upperLimit.removeOnChange(_upperLimitCallbackHandle);
_upperLimit.setMaxValue(_numObjects);
_upperLimit.setMaxValue(static_cast<unsigned int>(_numObjects));
_upperLimit = static_cast<unsigned int>(_numObjects);
_upperLimitCallbackHandle = _upperLimit.onChange(_reinitializeTrailBuffers);
}
@@ -390,7 +393,9 @@ void RenderableSmallBody::readOrbitalParamsFromThisLine(bool firstDataLine,
_data.push_back(keplerElements);
_sbNames.push_back(name);
const double scale = static_cast<double>(_segmentQuality) * 10.0;
_segmentSize.push_back(scale + (scale / pow(1 - keplerElements.eccentricity, 1.2)));
_segmentSize.push_back(
static_cast<size_t>(scale + (scale / pow(1 - keplerElements.eccentricity, 1.2)))
);
}
static double importAngleValue(const std::string& angle) {

View File

@@ -1082,13 +1082,13 @@ void TouchInteraction::step(double dt, bool directTouch) {
bool willNewPositionViolateZoomInLimit =
(newPosDistance < zoomInBounds);
bool willNewPositionViolateDirection =
(currentPosDistance <= length(zoomDistanceIncrement));
(currentPosDistance <= length(zoomDistanceInc));
if (!willNewPositionViolateZoomInLimit &&
!willNewPositionViolateDirection &&
!willNewPositionViolateZoomOutLimit)
{
camPos += zoomDistanceIncrement;
camPos += zoomDistanceInc;
}
else if (currentPosViolatingZoomOutLimit) {
#ifdef TOUCH_DEBUG_PROPERTIES
@@ -1098,7 +1098,7 @@ void TouchInteraction::step(double dt, bool directTouch) {
#endif
// Only allow zooming in if you are outside the zoom out limit
if (newPosDistance < currentPosDistance) {
camPos += zoomDistanceIncrement;
camPos += zoomDistanceInc;
}
}
else {

View File

@@ -297,7 +297,7 @@ LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
}
LPMSLLHOOKSTRUCT msg = reinterpret_cast<LPMSLLHOOKSTRUCT>(lParam);
// block injected events (in most cases generated by touches)
bool isFromTouch = (msg->dwExtraInfo || SIGNATURE_MASK) == MOUSEEVENTF_FROMTOUCH;
bool isFromTouch = (msg->dwExtraInfo | SIGNATURE_MASK) == MOUSEEVENTF_FROMTOUCH;
if (msg->flags & LLMHF_INJECTED || isFromTouch) {
return 1;
}

View File

@@ -478,7 +478,7 @@ CefTouchEvent EventHandler::touchEvent(const TouchInput& input,
const std::vector<std::pair<Key, KeyModifier>>& keyModVec =
global::navigationHandler.inputState().pressedKeys();
for (const std::pair<Key, KeyModifier>& keyModPair : keyModVec) {
const KeyModifier mods = keyModVec[0].second;
const KeyModifier mods = keyModPair.second;
event.modifiers |= static_cast<uint32_t>(mapToCefModifiers(mods));
}
event.pointer_type = cef_pointer_type_t::CEF_POINTER_TYPE_TOUCH;

View File

@@ -35,9 +35,7 @@ namespace openspace::interaction {
ScriptCameraStates::ScriptCameraStates() : CameraInteractionStates(1.0, 1.0) {}
void ScriptCameraStates::updateStateFromInput(const InputState& inputState,
double deltaTime)
{
void ScriptCameraStates::updateStateFromInput(const InputState&, double deltaTime) {
if (_localRotation != glm::dvec2(0.0)) {
_localRotationState.velocity.set(
_localRotation * _sensitivity,
@@ -114,5 +112,4 @@ void ScriptCameraStates::addGlobalRoll(const glm::dvec2& delta) {
_globalRoll += delta;
}
} // namespace openspace::interaction

View File

@@ -61,7 +61,7 @@ namespace {
glPushDebugGroup(
GL_DEBUG_SOURCE_APPLICATION,
0,
name.length(),
static_cast<GLsizei>(name.length()),
name.data()
);
}
@@ -608,8 +608,12 @@ void FramebufferRenderer::updateDownscaleTextures() {
GL_TEXTURE_2D,
0,
GL_RGBA32F,
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor,
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor,
static_cast<GLsizei>(
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor
),
static_cast<GLsizei>(
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor
),
0,
GL_RGBA,
GL_FLOAT,
@@ -625,8 +629,12 @@ void FramebufferRenderer::updateDownscaleTextures() {
GL_TEXTURE_2D,
0,
GL_DEPTH_COMPONENT32F,
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor,
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor,
static_cast<GLsizei>(
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor
),
static_cast<GLsizei>(
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor
),
0,
GL_DEPTH_COMPONENT,
GL_FLOAT,
@@ -928,8 +936,12 @@ void FramebufferRenderer::updateResolution() {
GL_TEXTURE_2D,
0,
GL_RGBA32F,
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor,
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor,
static_cast<GLsizei>(
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor
),
static_cast<GLsizei>(
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor
),
0,
GL_RGBA,
GL_FLOAT,
@@ -945,8 +957,12 @@ void FramebufferRenderer::updateResolution() {
GL_TEXTURE_2D,
0,
GL_DEPTH_COMPONENT32F,
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor,
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor,
static_cast<GLsizei>(
_resolution.x * _downscaleVolumeRendering.currentDownscaleFactor
),
static_cast<GLsizei>(
_resolution.y * _downscaleVolumeRendering.currentDownscaleFactor
),
0,
GL_DEPTH_COMPONENT,
GL_FLOAT,
@@ -1313,7 +1329,12 @@ void FramebufferRenderer::performRaycasterTasks(const std::vector<RaycasterTask>
if (raycaster->downscaleRender() < 1.f) {
glBindFramebuffer(GL_FRAMEBUFFER, _downscaleVolumeRendering.framebuffer);
const float s = raycaster->downscaleRender();
glViewport(viewport[0], viewport[1], viewport[2] * s, viewport[3] * s);
glViewport(
viewport[0],
viewport[1],
static_cast<GLsizei>(viewport[2] * s),
static_cast<GLsizei>(viewport[3] * s)
);
if (_downscaleVolumeRendering.currentDownscaleFactor != s) {
_downscaleVolumeRendering.currentDownscaleFactor = s;
updateDownscaleTextures();

View File

@@ -39,8 +39,9 @@ SyncBuffer::~SyncBuffer() {} // NOLINT
void SyncBuffer::encode(const std::string& s) {
ZoneScoped
int32_t anticpatedBufferSize = _encodeOffset + (sizeof(char) * s.size())
+ sizeof(int32_t);
int32_t anticpatedBufferSize = static_cast<int32_t>(
_encodeOffset + (sizeof(char) * s.size()) + sizeof(int32_t)
);
if (anticpatedBufferSize >= _n) {
_dataStream.resize(anticpatedBufferSize);
}