diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/optionproperty.h index 91c1f490d5..c9b966fabe 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/optionproperty.h @@ -69,7 +69,8 @@ public: * Adds the passed option to the list of available options. The value of * the option must not have been registered previously, or a warning will * be logged. - * \param option The option that will be added to the list of available options + * \param value The option that will be added to the list of available options + * \param desc The description of the value that will be added */ void addOption(int value, std::string desc); diff --git a/include/openspace/rendering/renderabletrail.h b/include/openspace/rendering/renderabletrail.h index 214eb4f7bf..7dd62e329a 100644 --- a/include/openspace/rendering/renderabletrail.h +++ b/include/openspace/rendering/renderabletrail.h @@ -85,7 +85,6 @@ private: float _increment; float _oldTime = 0; - float _dtEt; }; } // namespace openspace diff --git a/include/openspace/tests/test_spicemanager.inl b/include/openspace/tests/test_spicemanager.inl index a2db64311c..6336564961 100644 --- a/include/openspace/tests/test_spicemanager.inl +++ b/include/openspace/tests/test_spicemanager.inl @@ -420,7 +420,7 @@ TEST_F(SpiceManagerTest, getSubObserverPoint){ double targetEt; double subObserverPoint_ref[3]; double vectorToSurfacePoint_ref[3]; - static SpiceChar * method[2] = { "Intercept: ellipsoid", "Near point: ellipsoid" }; + static SpiceChar* method[2] = { static_cast("Intercept: ellipsoid"), static_cast("Near point: ellipsoid") }; str2et_c("2004 jun 11 19:32:00", &et); diff --git a/include/openspace/util/powerscaledsphere.h b/include/openspace/util/powerscaledsphere.h index 19f290bf08..1d028dc950 100644 --- a/include/openspace/util/powerscaledsphere.h +++ b/include/openspace/util/powerscaledsphere.h @@ -38,6 +38,7 @@ public: PowerScaledSphere(const PowerScaledScalar& radius, int segments = 8); ~PowerScaledSphere(); + PowerScaledSphere(const PowerScaledSphere& cpy); bool initialize(); diff --git a/src/rendering/renderablevolume.cpp b/src/rendering/renderablevolume.cpp index aaddefcab3..07915c1adc 100644 --- a/src/rendering/renderablevolume.cpp +++ b/src/rendering/renderablevolume.cpp @@ -345,8 +345,7 @@ ghoul::opengl::Texture* RenderableVolume::loadTransferFunction(const std::string } else if(key == "upper" && tokenSize == 2) { upper = stringToNumber(tokens.at(1),upperLowerValidator); } else if(key == "mappingkey" && tokenSize == 6) { - float intensity = 1.0f; - intensity = stringToNumber(tokens.at(1), intensityValidator); + float intensity = stringToNumber(tokens.at(1), intensityValidator); for(int i = 0; i < 4; ++i) rgba[i] = stringToNumber(tokens.at(i+2)); diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index a1231d1f35..09446d5435 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -124,6 +124,8 @@ namespace openspace { return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); const int type = lua_type(L, -1); + if (type != LUA_TBOOLEAN) + return luaL_error(L, "Expected argument of type 'bool'"); bool b = lua_toboolean(L, -1) != 0; OsEng.renderEngine()->toggleVisualizeABuffer(b); return 0; @@ -140,6 +142,8 @@ namespace openspace { return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); const int type = lua_type(L, -1); + if (type != LUA_TBOOLEAN) + return luaL_error(L, "Expected argument of type 'bool'"); bool b = lua_toboolean(L, -1) != 0; OsEng.renderEngine()->toggleInfoText(b); return 0; @@ -508,8 +512,7 @@ namespace openspace { PrintText(i++, "Scaling: (% .5f, % .5f)", scaling[0], scaling[1]); double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - Time::ref().currentTime(); - double t = 0.0; - t = 1.f - remaining / openspace::ImageSequencer::ref().getIntervalLength(); + double t = 1.f - remaining / openspace::ImageSequencer::ref().getIntervalLength(); std::string progress = "|"; int g = ((t)* 20) + 1; for (int i = 0; i < g; i++) progress.append("-"); progress.append(">"); diff --git a/src/util/powerscaledsphere.cpp b/src/util/powerscaledsphere.cpp index 934ba6f1c8..dcdd88dc28 100644 --- a/src/util/powerscaledsphere.cpp +++ b/src/util/powerscaledsphere.cpp @@ -125,8 +125,22 @@ PowerScaledSphere::PowerScaledSphere(const PowerScaledScalar& radius, int segmen } } -PowerScaledSphere::~PowerScaledSphere() +PowerScaledSphere::PowerScaledSphere(const PowerScaledSphere& cpy) + : _vaoID(cpy._vaoID) + , _vBufferID(cpy._vBufferID) + , _iBufferID(cpy._iBufferID) + , _isize(cpy._isize) + , _vsize(cpy._vsize) + , _varray(new Vertex[_vsize]) + , _iarray(new int[_isize]) { + // @TODO This needs to be tested ---abock + + std::memcpy(_varray, cpy._varray, _vsize * sizeof(Vertex)); + std::memcpy(_iarray, cpy._iarray, _isize * sizeof(int)); +} + +PowerScaledSphere::~PowerScaledSphere() { if (_varray) delete[] _varray; if (_iarray) @@ -140,10 +154,8 @@ PowerScaledSphere::~PowerScaledSphere() glDeleteVertexArrays(1, &_vaoID); } -bool PowerScaledSphere::initialize() -{ +bool PowerScaledSphere::initialize() { // Initialize and upload to graphics card - GLuint errorID; if (_vaoID == 0) glGenVertexArrays(1, &_vaoID); @@ -188,8 +200,7 @@ bool PowerScaledSphere::initialize() return true; } -void PowerScaledSphere::render() -{ +void PowerScaledSphere::render() { glBindVertexArray(_vaoID); // select first VAO glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _iBufferID); glDrawElements(GL_TRIANGLES, _isize, GL_UNSIGNED_INT, 0); diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 86d04d3784..1bcfb53c7f 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -46,9 +46,9 @@ void SpiceManager::initialize() { _manager->_lastAssignedKernel = 0; // Set the SPICE library to not exit the program if an error occurs - erract_c("SET", 0, "REPORT"); + erract_c("SET", 0, static_cast("REPORT")); // But we do not want SPICE to print the errors, we will fetch them ourselves - errprt_c("SET", 0, "NONE"); + errprt_c("SET", 0, static_cast("NONE")); } void SpiceManager::deinitialize() { @@ -59,8 +59,8 @@ void SpiceManager::deinitialize() { _manager = nullptr; // Set values back to default - erract_c("SET", 0, "DEFAULT"); - errprt_c("SET", 0, "DEFAULT"); + erract_c("SET", 0, static_cast("DEFAULT")); + errprt_c("SET", 0, static_cast("DEFAULT")); } SpiceManager& SpiceManager::ref() { @@ -307,12 +307,12 @@ bool SpiceManager::getTargetPosition(const std::string& target, psc& position, double& lightTime) const { - double pos[3] = { NULL, NULL, NULL }; + double pos[3] = { 0.0, 0.0, 0.0}; spkpos_c(target.c_str(), ephemerisTime, referenceFrame.c_str(), aberrationCorrection.c_str(), observer.c_str(), pos, &lightTime); - if (pos[0] == NULL || pos[1] == NULL || pos[2] == NULL) + if (pos[0] == 0.0 || pos[1] == 0.0|| pos[2] == 0.0) return false; position = PowerScaledCoordinate::CreatePowerScaledCoordinate(pos[0], pos[1], pos[2]); @@ -507,7 +507,7 @@ bool SpiceManager::getPositionPrimeMeridian(const std::string& fromFrame, glm::dmat3& positionMatrix) const{ int id; - getNaifId(body.c_str(), id); + getNaifId(body, id); tipbod_c(fromFrame.c_str(), id, ephemerisTime, (double(*)[3])glm::value_ptr(positionMatrix)); bool hasError = checkForError("Error retrieving position transform matrix from " @@ -690,10 +690,10 @@ void SpiceManager::applyTransformationMatrix(glm::dvec3& position, } bool SpiceManager::checkForError(std::string errorMessage) { - static char msg[1024]; int failed = failed_c(); if (failed) { + static char msg[1024]; if (!errorMessage.empty()) { getmsg_c("LONG", 1024, msg); LERROR(errorMessage);