diff --git a/Examples/PBD/PBDCollisionMultipleObjects/PBDCollisionMultipleObjectsExample.cpp b/Examples/PBD/PBDCollisionMultipleObjects/PBDCollisionMultipleObjectsExample.cpp index aa670f72b4ff2d771dace948cd363cdb631deaaf..de21e113b48561211f5aa4d5b84c0def89f1b9f3 100644 --- a/Examples/PBD/PBDCollisionMultipleObjects/PBDCollisionMultipleObjectsExample.cpp +++ b/Examples/PBD/PBDCollisionMultipleObjects/PBDCollisionMultipleObjectsExample.cpp @@ -229,9 +229,9 @@ main() const double distanceY = 5.0; const double minHeight = -5.0; - std::vector<std::shared_ptr<SurfaceMesh>> surfaceMeshes; - std::vector<std::shared_ptr<PbdObject>> pbdObjs; - std::vector<std::shared_ptr<PbdSolver>> pbdSolvers; + std::vector<std::shared_ptr<SurfaceMesh>> surfaceMeshes; + std::vector<std::shared_ptr<PbdObject>> pbdObjs; + //std::vector<std::shared_ptr<PbdSolver>> pbdSolvers; std::vector<std::shared_ptr<CollisionData>> allCollisionData; size_t numTriangles = 0; @@ -260,7 +260,7 @@ main() generateDragon(scene, translation, mesh, pbdObj, solver); surfaceMeshes.push_back(mesh); pbdObjs.push_back(pbdObj); - pbdSolvers.push_back(solver); + //pbdSolvers.push_back(solver); numTriangles += mesh->getNumTriangles(); // Collision between dragon with floor diff --git a/Examples/RigidBodyVirtualCoupling/RigidBodyVirtualCouplingExample.cpp b/Examples/RigidBodyVirtualCoupling/RigidBodyVirtualCouplingExample.cpp index e47006f2b1c3616c732561c0dfceffff2dc6e2e1..418f4ee1e85f811eb927ffb2c0c1f932da292438 100644 --- a/Examples/RigidBodyVirtualCoupling/RigidBodyVirtualCouplingExample.cpp +++ b/Examples/RigidBodyVirtualCoupling/RigidBodyVirtualCouplingExample.cpp @@ -20,16 +20,8 @@ =========================================================================*/ #include "imstkSimulationManager.h" -#include "imstkRigidObject.h" -#include "imstkRigidBodyModel.h" #include "imstkSceneObject.h" #include "imstkTetrahedralMesh.h" -#include "imstkCube.h" -#include "imstkPlane.h" -#include "imstkSphere.h" -#include "imstkMeshIO.h" -#include "imstkIsometricMap.h" - #include "imstkSimulationManager.h" #include "imstkVirtualCouplingCH.h" #include "imstkHDAPIDeviceServer.h" diff --git a/Source/Animation/Particles/imstkRenderParticleEmitter.h b/Source/Animation/Particles/imstkRenderParticleEmitter.h index 802165cbbfc9ea6a6d2b95dcd549a929d1713878..593242e7bcfc5fd4fea0e4383114e4876aedd311 100644 --- a/Source/Animation/Particles/imstkRenderParticleEmitter.h +++ b/Source/Animation/Particles/imstkRenderParticleEmitter.h @@ -77,9 +77,9 @@ public: /// /// \brief Constructor /// - RenderParticleEmitter(std::shared_ptr<Geometry> geometry, - const float time = 3000.0f, - Mode mode = Mode::CONTINUOUS); + explicit RenderParticleEmitter(std::shared_ptr<Geometry> geometry, + const float time = 3000.0f, + Mode mode = Mode::CONTINUOUS); /// /// \brief Set animation geometry diff --git a/Source/Collision/CollisionDetection/imstkCollisionDetection.cpp b/Source/Collision/CollisionDetection/imstkCollisionDetection.cpp index 8ef9ffb22893b0e99eb6a66dc86d63c6fecc9246..520284ce2d92feffdfe9991784c60c0d575dace6 100644 --- a/Source/Collision/CollisionDetection/imstkCollisionDetection.cpp +++ b/Source/Collision/CollisionDetection/imstkCollisionDetection.cpp @@ -178,9 +178,9 @@ CollisionDetection::makeCollisionDetectionObject(const Type } } -CollisionDetection::CollisionDetection(const CollisionDetection::Type& type, std::shared_ptr<CollisionData> colData) : m_type(type) +CollisionDetection::CollisionDetection(const CollisionDetection::Type& type, std::shared_ptr<CollisionData> colData) : m_type(type), + m_colData((colData == nullptr) ? std::make_shared<CollisionData>() : colData) { - m_colData = (colData == nullptr) ? std::make_shared<CollisionData>() : colData; } // Static functions ==> diff --git a/Source/Collision/CollisionDetection/imstkOctreeBasedCD.h b/Source/Collision/CollisionDetection/imstkOctreeBasedCD.h index 5a7a89fddd2674834af36589f5799227f22d7e89..01778ee68451ed2a877b9e80313bce5d6931eecb 100644 --- a/Source/Collision/CollisionDetection/imstkOctreeBasedCD.h +++ b/Source/Collision/CollisionDetection/imstkOctreeBasedCD.h @@ -47,7 +47,7 @@ public: /// \param name Name of the octree /// explicit OctreeBasedCD(const Vec3r& center, const Real width, const Real minWidth, - const Real minWidthRatio = 1.0, const std::string name = "OctreeBasedCD") : + const Real minWidthRatio = 1.0, const std::string& name = "OctreeBasedCD") : LooseOctree(center, width, minWidth, minWidthRatio, name) {} /// diff --git a/Source/Collision/CollisionDetection/imstkSurfaceMeshToSurfaceMeshCCD.cpp b/Source/Collision/CollisionDetection/imstkSurfaceMeshToSurfaceMeshCCD.cpp index defcb122b2e88c7b4f4f1932781cb8dcfa3927ab..459091b8915131af9c1d726cbd07c45a0214a519 100644 --- a/Source/Collision/CollisionDetection/imstkSurfaceMeshToSurfaceMeshCCD.cpp +++ b/Source/Collision/CollisionDetection/imstkSurfaceMeshToSurfaceMeshCCD.cpp @@ -34,10 +34,12 @@ SurfaceMeshToSurfaceMeshCCD::SurfaceMeshToSurfaceMeshCCD(std::shared_ptr<Surface std::shared_ptr<CollisionData> colData) : CollisionDetection(CollisionDetection::Type::SurfaceMeshToSurfaceMeshCCD, colData), m_meshA(meshA), - m_meshB(meshB) + m_meshB(meshB), + m_modelA(std::make_shared<DeformModel>(meshA->getVertexPositions(), meshA->getTrianglesVertices())), + m_modelB(std::make_shared<DeformModel>(meshB->getVertexPositions(), meshB->getTrianglesVertices())) { - m_modelA = std::make_shared<DeformModel>(meshA->getVertexPositions(), meshA->getTrianglesVertices()); - m_modelB = std::make_shared<DeformModel>(meshB->getVertexPositions(), meshB->getTrianglesVertices()); + //m_modelA = std::make_shared<DeformModel>(meshA->getVertexPositions(), meshA->getTrianglesVertices()); + //m_modelB = std::make_shared<DeformModel>(meshB->getVertexPositions(), meshB->getTrianglesVertices()); // Setup Callbacks m_modelA->SetEECallBack(SurfaceMeshToSurfaceMeshCCD::EECallback, this); diff --git a/Source/Collision/CollisionHandling/imstkPickingCH.h b/Source/Collision/CollisionHandling/imstkPickingCH.h index c6c5bf585a0fdfd53e886080bc2e735438d3b9ca..ebda819e9cc0d1bccfc31f19496e769dc02ecb18 100644 --- a/Source/Collision/CollisionHandling/imstkPickingCH.h +++ b/Source/Collision/CollisionHandling/imstkPickingCH.h @@ -86,6 +86,6 @@ public: private: std::shared_ptr<DeformableObject> m_object; ///> Deformable object - std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints; + std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints = nullptr; }; } diff --git a/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp b/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp index 1c6dabc9d70335209239825b44f9669b6fb0f897..1ee4ddb66a4f21ff96d5680bb3d31720fa55411b 100644 --- a/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp +++ b/Source/Collision/Testing/imstkTetraToTetraCDTest.cpp @@ -39,7 +39,7 @@ protected: }; std::shared_ptr<TetrahedralMesh> -loadMesh(std::string externalDataSuffix) +loadMesh(const std::string& externalDataSuffix) { std::string file = iMSTK_DATA_ROOT + externalDataSuffix; std::shared_ptr<TetrahedralMesh> volMesh diff --git a/Source/Collision/imstkInteractionPair.cpp b/Source/Collision/imstkInteractionPair.cpp index 8ba68ecc4a5a79cc9f77a10bf49cc40ebca6c133..3da4a79cb673789ba3e278ac99c46921df52a216 100644 --- a/Source/Collision/imstkInteractionPair.cpp +++ b/Source/Collision/imstkInteractionPair.cpp @@ -29,12 +29,10 @@ InteractionPair::InteractionPair(std::shared_ptr<CollidingObject> A, std::shared_ptr<CollidingObject> B, CollisionDetection::Type CDType, CollisionHandling::Type CHAType, - CollisionHandling::Type CHBType) + CollisionHandling::Type CHBType) : + m_colData(std::make_shared<CollisionData>()), + m_valid(false) { - m_colData = std::make_shared<CollisionData>(); - - m_valid = false; - // Check that objects exist CHECK(A != nullptr && B != nullptr) << "InteractionPair error: invalid objects (nullptr)."; diff --git a/Source/Collision/imstkPbdInteractionPair.h b/Source/Collision/imstkPbdInteractionPair.h index f204272faa9077997c0c6e11bb147cc20b2f62a2..106f3f062260102c8988d4423863b441183c1080 100644 --- a/Source/Collision/imstkPbdInteractionPair.h +++ b/Source/Collision/imstkPbdInteractionPair.h @@ -78,8 +78,8 @@ private: std::shared_ptr<PbdObject> m_firstObj; std::shared_ptr<PbdObject> m_secondObj; - double m_firstObjProximity; - double m_secondObjProximity; - unsigned int maxIter; + double m_firstObjProximity = MAX_D; + double m_secondObjProximity = MAX_D; + unsigned int maxIter = 50; }; } diff --git a/Source/Constraint/imstkLinearProjectionConstraint.h b/Source/Constraint/imstkLinearProjectionConstraint.h index 56d590f316338bc6500102c6e956b93a69cb5218..855266af3a514f2595490263489af33e5d5cf675 100644 --- a/Source/Constraint/imstkLinearProjectionConstraint.h +++ b/Source/Constraint/imstkLinearProjectionConstraint.h @@ -36,7 +36,7 @@ public: /// /// \brief Constructor /// - LinearProjectionConstraint(const size_t& nodeId, const bool isFixed = false); + explicit LinearProjectionConstraint(const size_t& nodeId, const bool isFixed = false); LinearProjectionConstraint() = delete; /// diff --git a/Source/Core/Utils/imstkTimer.h b/Source/Core/Utils/imstkTimer.h index 7498e891c48a7d810312fcd7557247f66d364588..3bbf64c491faf1d65a99c9edc7ab664c89a4e3d5 100644 --- a/Source/Core/Utils/imstkTimer.h +++ b/Source/Core/Utils/imstkTimer.h @@ -108,7 +108,7 @@ public: /// void printTimeElapsed(std::string const& name = std::string("noName"), const TimeUnitType unitType = TimeUnitType::milliSeconds); private: - TimerState state; + TimerState state = TimerState::stopped; std::vector<double> lapTimes; std::vector<std::string> lapNames; std::chrono::high_resolution_clock::time_point wallClockTimeKeeper; ///> time keeper for wall clock time @@ -145,7 +145,7 @@ public: double getTimeElapsed(const TimeUnitType unitType = TimeUnitType::milliSeconds) override; private: - std::clock_t cpuTimeKeeper; ///> time keeper for cpu time + std::clock_t cpuTimeKeeper = std::clock_t(); ///> time keeper for cpu time }; /// diff --git a/Source/Core/imstkLogger.cpp b/Source/Core/imstkLogger.cpp index 443bb25360d3d21f96dca365d2a0f80a631da33a..780f7e5cabc038aa024efe031c8598b9d3721823 100644 --- a/Source/Core/imstkLogger.cpp +++ b/Source/Core/imstkLogger.cpp @@ -20,22 +20,20 @@ =========================================================================*/ #include "imstkLogger.h" +#include "imstkLogUtility.h" #include <cstring> namespace imstk { -Logger::Logger(std::string filename) +Logger::Logger(const std::string& filename) : + m_filename(filename + "_" + this->getCurrentTimeFormatted() + ".log"), + m_thread(std::thread(Logger::eventLoop, this)) { - m_filename = filename + "_" + this->getCurrentTimeFormatted() + ".log"; - m_mutex = new std::mutex(); - m_thread = new std::thread(Logger::eventLoop, this); } Logger::~Logger() { - delete m_mutex; - m_thread->join(); - delete m_thread; + m_thread.join(); } std::string @@ -85,8 +83,14 @@ Logger::eventLoop(Logger* logger) std::ofstream file(logger->m_filename); std::string buffer; - while (logger->m_running) { - std::unique_lock<std::mutex> ul(*logger->m_mutex); + if (!file.is_open()) + { + LOG(FATAL) << "Failed to open file: " << logger->m_filename; + } + + while (logger->m_running) + { + std::unique_lock<std::mutex> ul(logger->m_mutex); logger->m_condition.wait(ul, [logger] { return logger->m_changed; }); if (!logger->m_running) @@ -109,7 +113,7 @@ Logger::eventLoop(Logger* logger) } void -Logger::log(std::string message, bool prependTime /* = false */) +Logger::log(const std::string& message, bool prependTime /* = false */) { m_message = ""; if (prependTime) @@ -120,12 +124,12 @@ Logger::log(std::string message, bool prependTime /* = false */) // Safely setting the change state { - std::lock_guard<std::mutex> guard(*m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); m_changed = true; } m_condition.notify_one(); - std::unique_lock<std::mutex> ul(*m_mutex); + std::unique_lock<std::mutex> ul(m_mutex); m_condition.wait(ul, [this] { return !m_changed; }); ul.unlock(); } @@ -165,13 +169,13 @@ Logger::shutdown() { // Safely setting the running state { - std::lock_guard<std::mutex> guard(*m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); m_changed = true; m_running = false; } m_condition.notify_one(); - std::unique_lock<std::mutex> ul(*m_mutex); + std::unique_lock<std::mutex> ul(m_mutex); m_condition.wait(ul, [this] { return !m_changed; }); ul.unlock(); } diff --git a/Source/Core/imstkLogger.h b/Source/Core/imstkLogger.h index a260cbbc8429bc61a2947f60030210098f521f86..388a64dd8d013aed94e754ee0ba61a925f247c7f 100644 --- a/Source/Core/imstkLogger.h +++ b/Source/Core/imstkLogger.h @@ -47,7 +47,7 @@ public: /// \brief Logger instantiation method /// \params filename this name will be used in the file name of the log file /// - Logger(std::string filename); + explicit Logger(const std::string& filename); virtual ~Logger(); /// @@ -56,7 +56,7 @@ public: /// \params prependTime defines if the current time is prepended to /// the message. Disabled by default. /// - void log(std::string message, bool prependTime = false); + void log(const std::string& message, bool prependTime = false); /// /// \brief Sets the frequency in Hz. This also updates the period. @@ -102,7 +102,7 @@ private: static std::string getCurrentTimeFormatted(); // Mutex for performance reasons - std::mutex* m_mutex; + std::mutex m_mutex; std::string m_message; bool m_changed = false; bool m_running = true; @@ -111,8 +111,8 @@ private: int m_period = 1000 / 30; long long m_lastLogTime = 0; - std::string m_filename; - std::thread* m_thread; + std::string m_filename; + std::thread m_thread; std::condition_variable m_condition; }; } diff --git a/Source/Core/imstkModule.h b/Source/Core/imstkModule.h index 1ce4f6cbb63c0ba4ebb75c7c50d17d6d508b6de7..2289dcc996762874939ae00cac4d7debc3cd515f 100644 --- a/Source/Core/imstkModule.h +++ b/Source/Core/imstkModule.h @@ -55,7 +55,7 @@ public: /// /// \brief Constructor /// - Module(std::string name, int loopDelay = 0) : + Module(const std::string& name, int loopDelay = 0) : m_name(name), m_loopDelay(loopDelay) {} diff --git a/Source/DataStructures/imstkGraph.h b/Source/DataStructures/imstkGraph.h index 27f0ab5741477550f4128f2cc76fa05dac4f317a..175bc7e4a011180f255e3c148935ef9ad1378341 100644 --- a/Source/DataStructures/imstkGraph.h +++ b/Source/DataStructures/imstkGraph.h @@ -44,7 +44,7 @@ public: /// /// \brief Constructor/destructor /// - Graph(const size_t size) { m_adjList.resize(size); } + explicit Graph(const size_t size) { m_adjList.resize(size); } ~Graph() = default; /// diff --git a/Source/DataStructures/imstkGridBasedNeighborSearch.h b/Source/DataStructures/imstkGridBasedNeighborSearch.h index f2a90fcd9fc04e86ff0e5af81f0feb337b5d449c..fdd382ac5ffeda5877a190e1cbad2529a2e3dadb 100644 --- a/Source/DataStructures/imstkGridBasedNeighborSearch.h +++ b/Source/DataStructures/imstkGridBasedNeighborSearch.h @@ -38,7 +38,7 @@ public: /// \brief Construct class with search radius /// \param radius The search radius /// - GridBasedNeighborSearch(const Real radius) : m_SearchRadius(radius), m_SearchRadiusSqr(radius * radius) {} + explicit GridBasedNeighborSearch(const Real radius) : m_SearchRadius(radius), m_SearchRadiusSqr(radius * radius) {} /// /// \brief Set the search radius diff --git a/Source/DataStructures/imstkNeighborSearch.h b/Source/DataStructures/imstkNeighborSearch.h index 6029f0e5ebc22eaa745bcb07bc9e1363de7b2537..9b993cdcf57035ea4c45c6d29f6ee6f002781fc8 100644 --- a/Source/DataStructures/imstkNeighborSearch.h +++ b/Source/DataStructures/imstkNeighborSearch.h @@ -46,7 +46,7 @@ public: /// \brief Constructor /// \param The selected search method /// - NeighborSearch(Method searchMethod, Real searchRadius = 0); + explicit NeighborSearch(Method searchMethod, Real searchRadius = 0); /// /// \brief Set the search radius diff --git a/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp b/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp index 9065b4633582e681b5e4d74e10933458225db438..94a053dc06fdebb780e13032f1da97ba48def79f 100644 --- a/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp +++ b/Source/DataStructures/imstkSpatialHashTableSeparateChaining.cpp @@ -23,10 +23,10 @@ namespace imstk { -SpatialHashTableSeparateChaining::SpatialHashTableSeparateChaining() - : SpatialHashTable() +SpatialHashTableSeparateChaining::SpatialHashTableSeparateChaining() : + SpatialHashTable(), + m_table(std::make_shared<std::unordered_set<PointEntry>>()) { - m_table = std::make_shared<std::unordered_set<PointEntry>>(); this->clear(); } diff --git a/Source/Devices/imstkDeviceClient.h b/Source/Devices/imstkDeviceClient.h index 3a8a8b5c00a7c9976651d5fd74d5dcd294fec9dc..6a209cfe9ec61c6e27558f41bd141cc6dd4eb18c 100644 --- a/Source/Devices/imstkDeviceClient.h +++ b/Source/Devices/imstkDeviceClient.h @@ -100,7 +100,7 @@ protected: /// /// \brief Constructor /// - DeviceClient(std::string name, std::string ip) : + DeviceClient(const std::string& name, const std::string& ip) : m_deviceName(name), m_ip(ip) {} diff --git a/Source/Devices/imstkDummyClient.h b/Source/Devices/imstkDummyClient.h index 3842e88ff394074a0e57e0670b6b2226a7e1688f..967196417979f8ed00b6ebab96b74cdcc0cc9fa8 100644 --- a/Source/Devices/imstkDummyClient.h +++ b/Source/Devices/imstkDummyClient.h @@ -37,7 +37,7 @@ public: /// /// \brief Constructor/Destructor /// - DummyClient(std::string name) : DeviceClient(name, "localhost") {} + explicit DummyClient(const std::string& name) : DeviceClient(name, "localhost") {} virtual ~DummyClient() {} protected: diff --git a/Source/Devices/imstkHDAPIDeviceClient.h b/Source/Devices/imstkHDAPIDeviceClient.h index 86791014ae41d46d1e816240fc32f3c447bd730e..bd16f0da0dc68bda8be1cfa265ba1a242bcee6a5 100644 --- a/Source/Devices/imstkHDAPIDeviceClient.h +++ b/Source/Devices/imstkHDAPIDeviceClient.h @@ -53,7 +53,7 @@ public: /// /// \brief Constructor/Destructor /// - HDAPIDeviceClient(std::string name) : DeviceClient(name, "localhost") {} + explicit HDAPIDeviceClient(const std::string& name) : DeviceClient(name, "localhost") {} virtual ~HDAPIDeviceClient() {} protected: diff --git a/Source/Devices/imstkVRPNArduinoDeviceClient.h b/Source/Devices/imstkVRPNArduinoDeviceClient.h index 4b5369a7036cb7b623013da18b7c57bdd7bc46e3..3d0b4abbf4d97b1f55a3031ca3d5f96b28f60a37 100644 --- a/Source/Devices/imstkVRPNArduinoDeviceClient.h +++ b/Source/Devices/imstkVRPNArduinoDeviceClient.h @@ -44,7 +44,7 @@ public: /// /// \brief Constructor /// - VRPNArduinoDeviceClient(std::string deviceName, std::string ip) : + VRPNArduinoDeviceClient(const std::string& deviceName, const std::string& ip) : DeviceClient(deviceName, ip), Module(deviceName + "@" + ip) {} diff --git a/Source/Devices/imstkVRPNDeviceClient.h b/Source/Devices/imstkVRPNDeviceClient.h index 833326ee472dda0c265b7356f787db49bdc51ac7..07f80bbf5725c6a97f776f1b1bbf526624e44310 100644 --- a/Source/Devices/imstkVRPNDeviceClient.h +++ b/Source/Devices/imstkVRPNDeviceClient.h @@ -47,7 +47,7 @@ public: /// /// \brief Constructor /// - VRPNDeviceClient(std::string deviceName, std::string ip) : + VRPNDeviceClient(const std::string& deviceName, const std::string& ip) : DeviceClient(deviceName, ip), Module(deviceName + "@" + ip) {} diff --git a/Source/Devices/imstkVRPNDeviceServer.cpp b/Source/Devices/imstkVRPNDeviceServer.cpp index c3245f6aa057396926ebdb056bf981c60d28b526..4211358fa4b7c4d626c4c3bb34e62d259052d1b5 100644 --- a/Source/Devices/imstkVRPNDeviceServer.cpp +++ b/Source/Devices/imstkVRPNDeviceServer.cpp @@ -34,7 +34,7 @@ namespace imstk { void -VRPNDeviceServer::addDevice(std::string deviceName, DeviceType deviceType, int id) +VRPNDeviceServer::addDevice(const std::string& deviceName, DeviceType deviceType, int id) { m_deviceInfoMap[deviceName] = std::make_pair(deviceType, id); @@ -47,7 +47,7 @@ VRPNDeviceServer::addDevice(std::string deviceName, DeviceType deviceType, int i } void -VRPNDeviceServer::addSerialDevice(std::string deviceName, DeviceType deviceType, std::string port, int baudRate, int id) +VRPNDeviceServer::addSerialDevice(const std::string& deviceName, DeviceType deviceType, const std::string& port, int baudRate, int id) { SerialInfo serialSettings; serialSettings.baudRate = baudRate; diff --git a/Source/Devices/imstkVRPNDeviceServer.h b/Source/Devices/imstkVRPNDeviceServer.h index 493b598aebc260305ab23f235c6b2cda64d13890..f8546ef63ef1c0591e09d200334e8c71dd8a9a3e 100644 --- a/Source/Devices/imstkVRPNDeviceServer.h +++ b/Source/Devices/imstkVRPNDeviceServer.h @@ -59,7 +59,7 @@ public: /// /// \brief Constructor /// - VRPNDeviceServer(std::string machine = "localhost", int port = vrpn_DEFAULT_LISTEN_PORT_NO) : + VRPNDeviceServer(const std::string& machine = "localhost", int port = vrpn_DEFAULT_LISTEN_PORT_NO) : m_machine(machine), m_port(port), Module(machine + ":" + std::to_string(port)) @@ -73,12 +73,12 @@ public: /// /// \brief Add device /// - void addDevice(std::string deviceName, DeviceType deviceType, int id = 0); + void addDevice(const std::string& deviceName, DeviceType deviceType, int id = 0); /// /// \brief Add serial device /// - void addSerialDevice(std::string deviceName, DeviceType deviceType, std::string port = "COM6", int baudRate = 57600, int id = 0); + void addSerialDevice(const std::string& deviceName, DeviceType deviceType, const std::string& port = "COM6", int baudRate = 57600, int id = 0); protected: @@ -110,7 +110,7 @@ private: std::map<std::string, std::pair<DeviceType, int>> m_deviceInfoMap; ///< list of iMSTK client info std::map<std::string, SerialInfo> m_SerialInfoMap; - vrpn_Connection* m_serverConnection; ///< VRPN server connection - vrpn_MainloopContainer* m_deviceConnections; ///< VRPN device connections + vrpn_Connection* m_serverConnection = nullptr; ///< VRPN server connection + vrpn_MainloopContainer* m_deviceConnections = nullptr; ///< VRPN device connections }; } // imstk diff --git a/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h index e0996c9fbb55c28a94f676d1d4960d65781178b6..fe5ef98dd1ddfc2368dc0cf0673d72c3b617f2c4 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkCorotationalFEMForceModel.h @@ -47,7 +47,7 @@ public: /// /// \brief /// - CorotationalFEMForceModel(std::shared_ptr<vega::VolumetricMesh> mesh, const int warp = 1); + explicit CorotationalFEMForceModel(std::shared_ptr<vega::VolumetricMesh> mesh, const int warp = 1); CorotationalFEMForceModel() = delete; /// diff --git a/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.cpp b/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.cpp index e6868445554aa93e1ebb168bb53686bafbaed932..5d67b33e73154ff4db7b5900e7e67c016dfa9f1e 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.cpp +++ b/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.cpp @@ -23,9 +23,8 @@ namespace imstk { -MassSpringForceModel::MassSpringForceModel(std::shared_ptr<vega::MassSpringSystem> massSpringSystem) : InternalForceModel() +MassSpringForceModel::MassSpringForceModel(std::shared_ptr<vega::MassSpringSystem> massSpringSystem) : m_massSpringSystem(massSpringSystem), InternalForceModel() { - m_massSpringSystem = massSpringSystem; } void diff --git a/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h b/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h index 777a4241ba997847faea915d781e00ed650c5f7e..9e933011093da4151e1ac2647e2a4467c43be64b 100644 --- a/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h +++ b/Source/DynamicalModels/InternalForceModel/imstkMassSpringForceModel.h @@ -44,7 +44,7 @@ public: /// /// \brief Constructor /// - MassSpringForceModel(std::shared_ptr<vega::MassSpringSystem> massSpringSystem); + explicit MassSpringForceModel(std::shared_ptr<vega::MassSpringSystem> massSpringSystem); MassSpringForceModel() = delete; /// @@ -55,17 +55,17 @@ public: /// /// \brief Set the internal force /// - void getInternalForce(const Vectord& u, Vectord& internalForce); + void getInternalForce(const Vectord& u, Vectord& internalForce) override; /// /// \brief Set the tangent stiffness matrix topology /// - virtual void getTangentStiffnessMatrixTopology(vega::SparseMatrix** tangentStiffnessMatrix); + virtual void getTangentStiffnessMatrixTopology(vega::SparseMatrix** tangentStiffnessMatrix) override; /// /// \brief Set the tangent stiffness matrix /// - void getTangentStiffnessMatrix(const Vectord& u, SparseMatrixd& tangentStiffnessMatrix); + void getTangentStiffnessMatrix(const Vectord& u, SparseMatrixd& tangentStiffnessMatrix) override; protected: std::shared_ptr<vega::MassSpringSystem> m_massSpringSystem;// Need to be initialized diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdAreaConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdAreaConstraint.h index 95ed8f64414cc8b679a6bce76cd117bfebd9f090..88eb5a15daaa61c12932ca36f9815916597694aa 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdAreaConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdAreaConstraint.h @@ -41,7 +41,7 @@ public: /// /// \brief Returns PBD constraint of type Type::Area /// - Type getType() const { return Type::Area; } + Type getType() const override { return Type::Area; } /// /// \brief Initializes the area constraint @@ -53,10 +53,10 @@ public: /// /// \brief Solves the area constraint /// - bool solvePositionConstraint(PbdModel& model); + bool solvePositionConstraint(PbdModel& model) override; public: - double m_restArea; ///> Area at the rest position - double m_stiffness; ///> Stiffness of the area constraint + double m_restArea = 0.; ///> Area at the rest position + double m_stiffness = 0.; ///> Stiffness of the area constraint }; } // imstk diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdBendConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdBendConstraint.h index c50dcaffc426e17347930b00b601fa9cf79a3c9d..c51f9efc11d98f8a0385e49c627177ad11e0c6e0 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdBendConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdBendConstraint.h @@ -68,7 +68,7 @@ public: bool solvePositionConstraint(PbdModel& model) override; public: - double m_restLength; ///> Rest length - double m_stiffness; ///> Bend stiffness + double m_restLength = 0.; ///> Rest length + double m_stiffness = 0.; ///> Bend stiffness }; } //imstk diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdConstantDensityConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdConstantDensityConstraint.h index d91244688eea2cc07c0e7960505bd9bd66ba7de6..9c5bccc7952b47b4b5859817d4aa025f53ad14ef 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdConstantDensityConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdConstantDensityConstraint.h @@ -37,7 +37,14 @@ public: /// /// \brief constructor /// - PbdConstantDensityConstraint() : PbdConstraint() {} + PbdConstantDensityConstraint() : PbdConstraint() + { + // constraint parameters + // Refer: Miller, et al 2003 "Particle-Based Fluid Simulation for Interactive Applications." + /// \todo Check if these numbers can be variable + m_wPoly6Coeff = 315.0 / (64.0 * PI * pow(m_maxDist, 9)); + m_wSpikyCoeff = 15.0 / (PI * pow(m_maxDist, 6)); + } /// /// \Constant Density Constraint Initialization @@ -47,12 +54,12 @@ public: /// /// \brief Returns PBD constraint of type Type::ConstantDensity /// - Type getType() const { return Type::ConstantDensity; } + Type getType() const override { return Type::ConstantDensity; } /// /// \brief Solves the constant density constraint /// - bool solvePositionConstraint(PbdModel& model); + bool solvePositionConstraint(PbdModel& model) override; private: /// diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDihedralConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDihedralConstraint.h index fee96a26f36adcdb26f8d57688c865e067a13455..500b6f6f64e92f8369990f8d986699bf65345cc5 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDihedralConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDihedralConstraint.h @@ -70,7 +70,7 @@ public: bool solvePositionConstraint(PbdModel& model) override; public: - double m_restAngle; ///> Rest angle - double m_stiffness; ///> Angular stiffness + double m_restAngle = 0.; ///> Rest angle + double m_stiffness = 0.; ///> Angular stiffness }; } //imstk diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDistanceConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDistanceConstraint.h index 37aba6055f9e2edc9514e0a8c709f6069d7d4607..4d4c2f706abf4e17d12a902104afbeb25e12e2df 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDistanceConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdDistanceConstraint.h @@ -55,7 +55,7 @@ public: bool solvePositionConstraint(PbdModel& model) override; public: - double m_restLength; ///> Rest length between the nodes - double m_stiffness; ///> Stiffness of the constaint + double m_restLength = 0.; ///> Rest length between the nodes + double m_stiffness = 0.; ///> Stiffness of the constaint }; -} // imstk +} // imstk \ No newline at end of file diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdEdgeEdgeCollisionConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdEdgeEdgeCollisionConstraint.h index f0640afbfb6e8509ab1a32e42daf52cdfe9ae782..2f27b3e317a456d28c1e4606be852ad73d8ff90f 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdEdgeEdgeCollisionConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdEdgeEdgeCollisionConstraint.h @@ -54,6 +54,6 @@ public: /// /// \brief Solve edge-edge collision constraint /// - bool solvePositionConstraint(); + bool solvePositionConstraint() override; }; } diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdFEMConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdFEMConstraint.h index 9c2e342be2a2f60f281b564970d2d59f1f615f83..d6cd035f1ca547fb6aeb037d82bce7d14aaa6238 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdFEMConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdFEMConstraint.h @@ -49,14 +49,14 @@ public: /// \brief Constructor /// explicit PbdFEMConstraint(const unsigned int cardinality, MaterialType mtype = MaterialType::StVK) : - PbdConstraint(), m_material(mtype) + PbdConstraint(), m_material(mtype), m_invRestMat(Mat3d::Identity()) { m_vertexIds.resize(cardinality); } public: - double m_elementVolume; ///> Volume of the element - MaterialType m_material; ///> Material type - Mat3d m_invRestMat; ///> + double m_elementVolume = 0.; ///> Volume of the element + MaterialType m_material; ///> Material type + Mat3d m_invRestMat; ///> }; } diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdPointTriCollisionConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdPointTriCollisionConstraint.h index e3cb754cbb2b433b25d2cd73e9c0d49914329969..6861542386833e79b9c4c8a07844008aed3e4380 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdPointTriCollisionConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdPointTriCollisionConstraint.h @@ -57,6 +57,6 @@ public: /// /// \brief /// - bool solvePositionConstraint(); + bool solvePositionConstraint() override; }; } diff --git a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdVolumeConstraint.h b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdVolumeConstraint.h index a1bac099275f8c71946d95bd1922e5ad05d95472..74683b391b89aa8d883a94b2892f78c37267fbc1 100644 --- a/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdVolumeConstraint.h +++ b/Source/DynamicalModels/ObjectModels/PbdConstraints/imstkPbdVolumeConstraint.h @@ -56,7 +56,7 @@ public: bool solvePositionConstraint(PbdModel& model) override; public: - double m_restVolume; ///> Rest volume - double m_stiffness; ///> Stiffness of the volume constraint + double m_restVolume = 0.; ///> Rest volume + double m_stiffness = 0.; ///> Stiffness of the volume constraint }; } diff --git a/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp index 3b1552570a61bcafa78cefa018f01041824ea6fa..a336d58a95fb101cdaa95ed0d9406d4db299b1bc 100644 --- a/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkFEMDeformableBodyModel.cpp @@ -356,7 +356,7 @@ FEMDeformableBodyModel::initializeDampingMatrix() return false; } - auto imstkVolMesh = std::static_pointer_cast<VolumetricMesh>(m_geometry); + //auto imstkVolMesh = std::static_pointer_cast<VolumetricMesh>(m_geometry); //std::shared_ptr<vega::VolumetricMesh> vegaMesh = VegaMeshReader::getVegaVolumeMeshFromVolumeMesh(imstkVolMesh); auto meshGraph = std::make_shared<vega::Graph>(*vega::GenerateMeshGraph::Generate(m_vegaPhysicsMesh.get())); @@ -441,10 +441,10 @@ FEMDeformableBodyModel::computeImplicitSystemRHS(kinematicState& stateAtT, kinematicState& newState, const StateUpdateType updateType) { - auto& uPrev = stateAtT.getQ(); - auto& vPrev = stateAtT.getQDot(); - auto& u = newState.getQ(); - auto& v = newState.getQDot(); + const auto& uPrev = stateAtT.getQ(); + const auto& vPrev = stateAtT.getQDot(); + auto& u = newState.getQ(); + const auto& v = newState.getQDot(); // Do checks if there are uninitialized matrices m_internalForceModel->getTangentStiffnessMatrix(u, m_K); @@ -481,8 +481,8 @@ FEMDeformableBodyModel::computeSemiImplicitSystemRHS(kinematicState& state const StateUpdateType updateType) { //auto& uPrev = stateAtT.getQ(); - auto& vPrev = stateAtT.getQDot(); - auto& u = newState.getQ(); + const auto& vPrev = stateAtT.getQDot(); + auto& u = newState.getQ(); //auto& v = newState.getQDot(); // Do checks if there are uninitialized matrices @@ -652,9 +652,9 @@ FEMDeformableBodyModel::updateBodyIntermediateStates( const Vectord& solution, const StateUpdateType updateType) { - auto& uPrev = m_previousState->getQ(); + const auto& uPrev = m_previousState->getQ(); //auto& u = m_currentState->getQ(); - auto& v = m_currentState->getQDot(); + const auto& v = m_currentState->getQDot(); const double dT = m_timeIntegrator->getTimestepSize(); switch (updateType) diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp index ff422455e2a77c45973fb0c4d3b6b982e0655ba5..e71316fd546a40edbaf02b91bb8c10ea0f48b717 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.cpp @@ -132,7 +132,6 @@ RigidBodyModel::createPlane() (PxReal)m_material->m_restitution); const auto physics = m_rigidBodyWorld->m_Physics; - const auto PxScene = m_rigidBodyWorld->m_Scene; const auto planeGeo = std::dynamic_pointer_cast<imstk::Plane>(m_geometry); @@ -150,7 +149,7 @@ RigidBodyModel::createPlane() *physxMaterial); if (m_pxStaticActor) { - PxScene->addActor(*m_pxStaticActor); + m_rigidBodyWorld->m_Scene->addActor(*m_pxStaticActor); } } else diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h index cc3b5bcde8bb0dc78e1ea9ed8197bb81f2ecbff9..f46c11a2e95bd5d4a3005144585f4864fbb08620 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel.h @@ -39,7 +39,8 @@ struct RigidBodyPropertyDesc enum class RigidBodyType { Static, Dynamic, - Kinematic }; + Kinematic, + none }; using namespace physx; @@ -131,7 +132,7 @@ public: if (m_pxDynamicActor) { auto p = m_initialState->getPosition(); - auto r = m_initialState->getRotation(); + //auto r = m_initialState->getRotation(); //auto q = Quatd(r); PxTransform pose; @@ -148,8 +149,8 @@ protected: std::shared_ptr<RigidBodyPropertyDesc> m_material; PxRigidDynamic* m_pxDynamicActor = NULL; PxRigidStatic* m_pxStaticActor = NULL; - bool m_isStatic; ///> Indicates if the body is static or dynamic - RigidBodyType m_type; ///> Indicates if the body is static, dynamic + bool m_isStatic = true; ///> Indicates if the body is static or dynamic + RigidBodyType m_type = RigidBodyType::none; ///> Indicates if the body is static, dynamic Vec3d m_force = Vec3d(0., 0., 0.); Vec3d m_forcePos; diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHModel.h b/Source/DynamicalModels/ObjectModels/imstkSPHModel.h index 3095a9b4fe808c7a6b697f7371c512a19c7fa2ee..9a9ecc2dcca0749ad88828c91019bbd28a293b27 100644 --- a/Source/DynamicalModels/ObjectModels/imstkSPHModel.h +++ b/Source/DynamicalModels/ObjectModels/imstkSPHModel.h @@ -39,7 +39,7 @@ private: void initialize(); public: - SPHModelConfig(const Real particleRadius); + explicit SPHModelConfig(const Real particleRadius); /// \todo Move this to solver or time integrator in the future Real m_minTimestep = Real(1e-6); diff --git a/Source/DynamicalModels/ObjectStates/imstkVectorizedState.h b/Source/DynamicalModels/ObjectStates/imstkVectorizedState.h index 13e2b6da74af0215859eeffa5bc3a0a1a59ecabd..3fb0a0d109ede9882244857f576d21a8bc1baeef 100644 --- a/Source/DynamicalModels/ObjectStates/imstkVectorizedState.h +++ b/Source/DynamicalModels/ObjectStates/imstkVectorizedState.h @@ -40,7 +40,7 @@ public: /// \brief Constructor /// VectorizedState() = default; - VectorizedState(const size_t size) { initialize(size); } + explicit VectorizedState(const size_t size) { initialize(size); } //ProblemState(const Vectord& u, const Vectord& v, const Vectord& a); /// diff --git a/Source/DynamicalModels/TimeIntegrators/imstkBackwardEuler.h b/Source/DynamicalModels/TimeIntegrators/imstkBackwardEuler.h index d597138957621705e411f76be620c3f82d53722d..a9ff2e6b0bda37f957d5565a24b3ad9400bf2e02 100644 --- a/Source/DynamicalModels/TimeIntegrators/imstkBackwardEuler.h +++ b/Source/DynamicalModels/TimeIntegrators/imstkBackwardEuler.h @@ -50,28 +50,28 @@ public: /// void updateStateGivenDv(std::shared_ptr<VectorizedState> prevState, std::shared_ptr<VectorizedState> currentState, - Vectord& dV); + Vectord& dV) override; /// /// \brief Update state given change in displacement /// void updateStateGivenDu(std::shared_ptr<VectorizedState> prevState, std::shared_ptr<VectorizedState> currentState, - Vectord& dU); + Vectord& dU) override; /// /// \brief Update state given updated velocity /// void updateStateGivenV(std::shared_ptr<VectorizedState> prevState, std::shared_ptr<VectorizedState> currentState, - Vectord& v); + Vectord& v) override; /// /// \brief Update state given updated displacement /// void updateStateGivenU(std::shared_ptr<VectorizedState> prevState, std::shared_ptr<VectorizedState> currentState, - Vectord& u); + Vectord& u) override; protected: // // Coefficients of the time integrator diff --git a/Source/Geometry/Analytic/imstkAnalyticalGeometry.h b/Source/Geometry/Analytic/imstkAnalyticalGeometry.h index e346bf6b580d43f86c36879c6264a5d86d44bec7..a8da2462ace88c46a19356fbddd0d2d78acb253d 100644 --- a/Source/Geometry/Analytic/imstkAnalyticalGeometry.h +++ b/Source/Geometry/Analytic/imstkAnalyticalGeometry.h @@ -57,7 +57,7 @@ public: protected: - AnalyticalGeometry(Type type, const std::string name = std::string("")) : Geometry(type, name) {} + explicit AnalyticalGeometry(Type type, const std::string& name = std::string("")) : Geometry(type, name) {} void applyTranslation(const Vec3d t) override; void applyRotation(const Mat3d r) override; diff --git a/Source/Geometry/Analytic/imstkCapsule.h b/Source/Geometry/Analytic/imstkCapsule.h index c86f1034d640be64044b2320b2ace615bf2ae78e..7191995f1a2b9827e7a95d06dfaaf7475e6578ef 100644 --- a/Source/Geometry/Analytic/imstkCapsule.h +++ b/Source/Geometry/Analytic/imstkCapsule.h @@ -37,7 +37,7 @@ public: /// /// \brief Constructor /// - Capsule(const std::string name = std::string("")) : AnalyticalGeometry(Type::Capsule, name) {} + Capsule(const std::string& name = std::string("")) : AnalyticalGeometry(Type::Capsule, name) {} /// /// \brief Print the capsule info diff --git a/Source/Geometry/Analytic/imstkCube.h b/Source/Geometry/Analytic/imstkCube.h index a50de6ecefef19cca1980237f86d4258f45037fa..7291f976957a6e29526da84f07ede79d90c5efde 100644 --- a/Source/Geometry/Analytic/imstkCube.h +++ b/Source/Geometry/Analytic/imstkCube.h @@ -34,7 +34,7 @@ class Cube : public AnalyticalGeometry { public: - Cube(const std::string name = std::string("")) : AnalyticalGeometry(Type::Cube, name) {} + explicit Cube(const std::string& name = std::string("")) : AnalyticalGeometry(Type::Cube, name) {} /// /// \brief Print the cube info diff --git a/Source/Geometry/Analytic/imstkCylinder.h b/Source/Geometry/Analytic/imstkCylinder.h index 7c190d68e927dccb19bdf233c51edfcf3607d30e..d3f160faec2811a05088ff2745ed927516a9af81 100644 --- a/Source/Geometry/Analytic/imstkCylinder.h +++ b/Source/Geometry/Analytic/imstkCylinder.h @@ -37,7 +37,7 @@ public: /// /// \brief Constructor /// - Cylinder(const std::string name = std::string("")) : AnalyticalGeometry(Type::Cylinder, name) {} + Cylinder(const std::string& name = std::string("")) : AnalyticalGeometry(Type::Cylinder, name) {} /// /// \brief Print the cylinder info diff --git a/Source/Geometry/Analytic/imstkPlane.h b/Source/Geometry/Analytic/imstkPlane.h index c4c536ba435553823796f9082a6c20cdba167218..724913d5b638149766abd86ad4337b272480937d 100644 --- a/Source/Geometry/Analytic/imstkPlane.h +++ b/Source/Geometry/Analytic/imstkPlane.h @@ -37,7 +37,7 @@ public: /// /// \brief Constructor /// - Plane(const std::string name = std::string("")) : AnalyticalGeometry(Type::Plane, name) {} + Plane(const std::string& name = std::string("")) : AnalyticalGeometry(Type::Plane, name) {} /// /// \brief Print the plane info diff --git a/Source/Geometry/Analytic/imstkSphere.h b/Source/Geometry/Analytic/imstkSphere.h index 9b5b848d8f21f9d3c8f055672d763d2a615cc922..0ee237edea41e04b4c8c3833d95339ef9a3366dc 100644 --- a/Source/Geometry/Analytic/imstkSphere.h +++ b/Source/Geometry/Analytic/imstkSphere.h @@ -37,7 +37,7 @@ public: /// /// \brief Constructor /// - Sphere(const std::string name = std::string("")) : AnalyticalGeometry(Type::Sphere, name) {} + Sphere(const std::string& name = std::string("")) : AnalyticalGeometry(Type::Sphere, name) {} /// /// \brief Print the sphere info diff --git a/Source/Geometry/Decal/imstkDecal.cpp b/Source/Geometry/Decal/imstkDecal.cpp index a037fc8257da20daddfc4c0bbffd8123d07c2768..4e858b98055e0cb73b25dd8f5ec9f09a7a9e21fd 100644 --- a/Source/Geometry/Decal/imstkDecal.cpp +++ b/Source/Geometry/Decal/imstkDecal.cpp @@ -23,9 +23,8 @@ namespace imstk { -Decal::Decal(const std::string name) : AnalyticalGeometry(Geometry::Type::Decal, name) +Decal::Decal(const std::string& name) : m_dimensions(glm::vec3(1)), AnalyticalGeometry(Geometry::Type::Decal, name) { - m_dimensions = glm::vec3(1); } void diff --git a/Source/Geometry/Decal/imstkDecal.h b/Source/Geometry/Decal/imstkDecal.h index 780bf247ebff04a2ffbfc7d530128bc9476b80e2..961f16ed25efffa1042ef7aa2166898091006951 100644 --- a/Source/Geometry/Decal/imstkDecal.h +++ b/Source/Geometry/Decal/imstkDecal.h @@ -36,7 +36,7 @@ namespace imstk class Decal : public AnalyticalGeometry { public: - Decal(const std::string name = std::string("")); + Decal(const std::string& name = std::string("")); /// /// \brief Print the cube info diff --git a/Source/Geometry/Decal/imstkDecalPool.cpp b/Source/Geometry/Decal/imstkDecalPool.cpp index 0580a80e36b93b973cdbd0b94c5ccc382456bba4..17d6d7c23fd864398feac51c906c8cc2b494f944 100644 --- a/Source/Geometry/Decal/imstkDecalPool.cpp +++ b/Source/Geometry/Decal/imstkDecalPool.cpp @@ -23,7 +23,7 @@ namespace imstk { -DecalPool::DecalPool(unsigned int maxNumDecals /*= 128*/, const std::string name) +DecalPool::DecalPool(unsigned int maxNumDecals /*= 128*/, const std::string& name) : Geometry(Geometry::Type::DecalPool, name) { if (maxNumDecals <= 128) diff --git a/Source/Geometry/Decal/imstkDecalPool.h b/Source/Geometry/Decal/imstkDecalPool.h index 83acdf8d571719b834143abc6f92ae120eeff203..787136b914d831e862d0e6bca6008a5786b2b99c 100644 --- a/Source/Geometry/Decal/imstkDecalPool.h +++ b/Source/Geometry/Decal/imstkDecalPool.h @@ -33,7 +33,7 @@ namespace imstk class DecalPool : public Geometry { public: - DecalPool(unsigned int maxNumDecals = 128, const std::string name = std::string("")); + DecalPool(unsigned int maxNumDecals = 128, const std::string& name = std::string("")); std::shared_ptr<Decal> addDecal(); diff --git a/Source/Geometry/Map/imstkOneToOneMap.cpp b/Source/Geometry/Map/imstkOneToOneMap.cpp index f2630e4f4b6cbee99e753f843be5f5e6ed7e45f5..3e43bd6129b2833c066dcfe927b904550ff2c6be 100644 --- a/Source/Geometry/Map/imstkOneToOneMap.cpp +++ b/Source/Geometry/Map/imstkOneToOneMap.cpp @@ -127,11 +127,6 @@ OneToOneMap::isValid() const { ParallelUtils::parallelFor(meshSlave->getNumVertices(), [&](const size_t nodeId) { - if (!valid) // If map is invalid, no need to check further - { - return; - } - const auto p = meshSlave->getVertexPosition(nodeId); bool matchFound = false; for (size_t idx = 0; idx < meshMaster->getNumVertices(); ++idx) diff --git a/Source/Geometry/Mesh/imstkHexahedralMesh.h b/Source/Geometry/Mesh/imstkHexahedralMesh.h index 7a719f117d87a1d247c9755908543d1818818792..b85cd83c39316d4a8e2f43e1d31ca9ef4f6e4bfe 100644 --- a/Source/Geometry/Mesh/imstkHexahedralMesh.h +++ b/Source/Geometry/Mesh/imstkHexahedralMesh.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructor /// - HexahedralMesh(const std::string name = std::string("")) : VolumetricMesh(Geometry::Type::HexahedralMesh, name) {} + HexahedralMesh(const std::string& name = std::string("")) : VolumetricMesh(Geometry::Type::HexahedralMesh, name) {} /// /// \brief Initializes the rest of the data structures given vertex positions and diff --git a/Source/Geometry/Mesh/imstkImageData.cpp b/Source/Geometry/Mesh/imstkImageData.cpp index 34d17a2a134c0732d5dcd54beaf053bafcdd88de..2132f8a628640e5748f230fcab29bb7a3382bcaf 100644 --- a/Source/Geometry/Mesh/imstkImageData.cpp +++ b/Source/Geometry/Mesh/imstkImageData.cpp @@ -27,7 +27,7 @@ namespace imstk { -ImageData::ImageData(const std::string name) +ImageData::ImageData(const std::string& name) : PointSet(Geometry::Type::ImageData, name), m_dataTransform(vtkSmartPointer<vtkTransform>::New()) { diff --git a/Source/Geometry/Mesh/imstkImageData.h b/Source/Geometry/Mesh/imstkImageData.h index a90b1073ddac36e8b25b246d7abb81a472eaf088..ad0e6c441030ebf5ea3fa0d11956fe663b3ad290 100644 --- a/Source/Geometry/Mesh/imstkImageData.h +++ b/Source/Geometry/Mesh/imstkImageData.h @@ -44,7 +44,7 @@ public: /// /// \brief Constructor /// - ImageData(const std::string name = std::string("")); + ImageData(const std::string& name = std::string("")); /// /// \brief Print the image data info diff --git a/Source/Geometry/Mesh/imstkLineMesh.h b/Source/Geometry/Mesh/imstkLineMesh.h index b45aedbca580ab864446949144b290d23f78acc2..9420814dbb8f5f03dfe38c7b5c55abc80c3edf9b 100644 --- a/Source/Geometry/Mesh/imstkLineMesh.h +++ b/Source/Geometry/Mesh/imstkLineMesh.h @@ -43,7 +43,7 @@ public: /// /// \brief Constructor /// - LineMesh(const std::string name = std::string("")) : PointSet(Geometry::Type::LineMesh, name) {} + LineMesh(const std::string& name = std::string("")) : PointSet(Geometry::Type::LineMesh, name) {} /// /// \brief Initializes the rest of the data structures given vertex positions and diff --git a/Source/Geometry/Mesh/imstkPointSet.h b/Source/Geometry/Mesh/imstkPointSet.h index 0521489d0ca5f1659716a0fd9f7304794723e2b6..63be53e6c62dddcc38ef5aa76349c5205331adac 100644 --- a/Source/Geometry/Mesh/imstkPointSet.h +++ b/Source/Geometry/Mesh/imstkPointSet.h @@ -38,7 +38,7 @@ public: /// /// \brief Protected constructor /// - PointSet(const Type type = Geometry::Type::PointSet, const std::string name = std::string("")) : + PointSet(const Type type = Geometry::Type::PointSet, const std::string& name = std::string("")) : Geometry(type, name) {} /// diff --git a/Source/Geometry/Mesh/imstkSurfaceMesh.cpp b/Source/Geometry/Mesh/imstkSurfaceMesh.cpp index 0760cdf30773cb0376de4b7557b3ffcfcb09e1b7..e6bf09b9acc124fead3cfdd77922edc56b3001ca 100644 --- a/Source/Geometry/Mesh/imstkSurfaceMesh.cpp +++ b/Source/Geometry/Mesh/imstkSurfaceMesh.cpp @@ -154,10 +154,6 @@ SurfaceMesh::computeTrianglesNormals() if (hasUVs) { UVs = this->getPointDataArray(m_defaultTCoords); - } - - if (hasUVs) - { for (size_t triangleId = 0; triangleId < m_triangleNormals.size(); ++triangleId) { const auto& t = m_trianglesVertices.at(triangleId); @@ -208,13 +204,12 @@ SurfaceMesh::computeVertexNormals() } // Correct for UV seams - Vec3d normal, tangent; - bool hasUVs = this->hasPointDataArray(m_defaultTCoords); - const StdVectorOfVectorf* UVs; + Vec3d normal, tangent; + bool hasUVs = this->hasPointDataArray(m_defaultTCoords); if (hasUVs) { - UVs = this->getPointDataArray(m_defaultTCoords); + auto UVs = this->getPointDataArray(m_defaultTCoords); } for (size_t vertexId = 0; vertexId < m_vertexNormals.size(); ++vertexId) @@ -286,7 +281,7 @@ SurfaceMesh::optimizeForDataLocality() // B. Iterate till all the nodes are added to optimized mesh size_t vertId[3]; auto connectivity = this->getTrianglesVertices(); - while (triUnderConsideration.size() != 0) + while (!triUnderConsideration.empty()) { // B.1 Add new nodes and triangles for (const auto& triId : triUnderConsideration) @@ -448,7 +443,7 @@ SurfaceMesh::getNumTriangles() const } void -SurfaceMesh::setDefaultTCoords(std::string arrayName) +SurfaceMesh::setDefaultTCoords(const std::string& arrayName) { m_defaultTCoords = arrayName; } diff --git a/Source/Geometry/Mesh/imstkSurfaceMesh.h b/Source/Geometry/Mesh/imstkSurfaceMesh.h index 6a53c5c7a9bc3d664d6db972a1cda35e9e2ff385..a21e1646ea03fe2b71b88aa30fd5b370c0f75ba3 100644 --- a/Source/Geometry/Mesh/imstkSurfaceMesh.h +++ b/Source/Geometry/Mesh/imstkSurfaceMesh.h @@ -83,7 +83,7 @@ public: /// /// \brief Constructor /// - SurfaceMesh(const std::string name = std::string("")) : PointSet(Geometry::Type::SurfaceMesh, name) {} + SurfaceMesh(const std::string& name = std::string("")) : PointSet(Geometry::Type::SurfaceMesh, name) {} /// /// \brief Initializes the rest of the data structures given vertex positions and @@ -182,7 +182,7 @@ public: /// /// \brief Set/Get the array defining the default material coordinates /// - void setDefaultTCoords(std::string arrayName); + void setDefaultTCoords(const std::string& arrayName); std::string getDefaultTCoords(); /// diff --git a/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp b/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp index 2de16dbebeb1603a4629316dca330ba9322cb28e..b56a38bef3be8948367d19a813aee4adf08923b4 100644 --- a/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp +++ b/Source/Geometry/Mesh/imstkTetrahedralMesh.cpp @@ -75,8 +75,7 @@ TetrahedralMesh::getVolume() const v[i] = m_vertexPositions[tetVertices[i]]; } - A << v[0][0], v[0][1], v[0][2], 1, v[1][0], v[1][1], v[1][2], 1, v[2][0], v[2][1], v[2][2], - 1, v[3][0], v[3][1], v[3][2], 1; + A << v[0][0], v[0][1], v[0][2], 1, v[1][0], v[1][1], v[1][2], 1, v[2][0], v[2][1], v[2][2], 1, v[3][0], v[3][1], v[3][2], 1; double det = A.determinant(); if (det < 0) @@ -116,8 +115,8 @@ TetrahedralMesh::extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh, std::vector<triArray> surfaceTri; std::vector<size_t> surfaceTriTet; std::vector<size_t> tetRemainingVert; - bool unique = true; - size_t foundAt = 0, tetId = 0; + bool unique; + size_t foundAt, tetId = 0; size_t a, b, c; for (auto& tetVertArray : vertArray) @@ -236,8 +235,7 @@ TetrahedralMesh::computeBarycentricWeights(const size_t& tetId, const Vec3d& pos } Mat4d A; - A << v[0][0], v[0][1], v[0][2], 1, v[1][0], v[1][1], v[1][2], 1, v[2][0], v[2][1], v[2][2], 1, - v[3][0], v[3][1], v[3][2], 1; + A << v[0][0], v[0][1], v[0][2], 1, v[1][0], v[1][1], v[1][2], 1, v[2][0], v[2][1], v[2][2], 1, v[3][0], v[3][1], v[3][2], 1; det = A.determinant(); diff --git a/Source/Geometry/Mesh/imstkTetrahedralMesh.h b/Source/Geometry/Mesh/imstkTetrahedralMesh.h index 0aeb2c944596d030acb5fef413e7077a7bb0c33b..de3c7f28541cdf09f7554490705b23904fb3eedf 100644 --- a/Source/Geometry/Mesh/imstkTetrahedralMesh.h +++ b/Source/Geometry/Mesh/imstkTetrahedralMesh.h @@ -47,7 +47,7 @@ public: /// /// \brief Constructor /// - TetrahedralMesh(const std::string name = std::string("")) : VolumetricMesh(Geometry::Type::TetrahedralMesh, name) {} + TetrahedralMesh(const std::string& name = std::string("")) : VolumetricMesh(Geometry::Type::TetrahedralMesh, name) {} /// /// \brief Initializes the rest of the data structures given vertex positions and diff --git a/Source/Geometry/Mesh/imstkVolumetricMesh.h b/Source/Geometry/Mesh/imstkVolumetricMesh.h index ec274ffe7e76a5f212d2d764ebe1365d92bd2e1d..dacee1fa664b0a8e3968c09a71e42056dd71a2dc 100644 --- a/Source/Geometry/Mesh/imstkVolumetricMesh.h +++ b/Source/Geometry/Mesh/imstkVolumetricMesh.h @@ -60,7 +60,7 @@ public: protected: - VolumetricMesh(Geometry::Type type, const std::string name = std::string("")) : PointSet(type, name) {} + VolumetricMesh(Geometry::Type type, const std::string& name = std::string("")) : PointSet(type, name) {} std::shared_ptr<SurfaceMesh> m_attachedSurfaceMesh; ///> Attached surface mesh }; diff --git a/Source/Geometry/Particles/imstkRenderParticles.cpp b/Source/Geometry/Particles/imstkRenderParticles.cpp index 9edc6404cc9a2d2a9b20ccf1f44bc10385a059cb..644c18012205fd4a82b0366b8b69e4ac100c64bb 100644 --- a/Source/Geometry/Particles/imstkRenderParticles.cpp +++ b/Source/Geometry/Particles/imstkRenderParticles.cpp @@ -23,7 +23,7 @@ namespace imstk { -RenderParticles::RenderParticles(const unsigned int maxNumParticles /*=128*/, const std::string name /*= std::string("")*/) +RenderParticles::RenderParticles(const unsigned int maxNumParticles /*=128*/, const std::string& name /*= std::string("")*/) : Geometry(Geometry::Type::RenderParticles, name) { if (maxNumParticles <= 128) diff --git a/Source/Geometry/Particles/imstkRenderParticles.h b/Source/Geometry/Particles/imstkRenderParticles.h index 504380e70e676b3e0bd481cbcce1fa67f0fcf775..d86522e82cc8a52c95ffaaeccea32d1e8017308f 100644 --- a/Source/Geometry/Particles/imstkRenderParticles.h +++ b/Source/Geometry/Particles/imstkRenderParticles.h @@ -71,7 +71,7 @@ public: /// \param time Lifespan of each particle (in milliseconds) /// \param mode Mode for emitter /// - RenderParticles(const unsigned int maxNumParticles = 128, const std::string name = std::string("")); + RenderParticles(const unsigned int maxNumParticles = 128, const std::string& name = std::string("")); /// /// \brief Set size of particle diff --git a/Source/Geometry/Reader/imstkMSHMeshIO.cpp b/Source/Geometry/Reader/imstkMSHMeshIO.cpp index a2480cff4c43337875c6caea450d378aed68cc42..87941fe7c0de5d53ee7c406d55e7ab907184afde 100644 --- a/Source/Geometry/Reader/imstkMSHMeshIO.cpp +++ b/Source/Geometry/Reader/imstkMSHMeshIO.cpp @@ -208,7 +208,7 @@ MSHMeshIO::read(const std::string& filePath, const MeshFileType meshType) { break; } - elemID = stoul(subString); // Read the element ID + //elemID = stoul(subString); // Read the element ID subString.clear(); mshLineStream >> subString; // Read the element type elemType = stoul(subString); diff --git a/Source/Geometry/imstkDebugRenderGeometry.h b/Source/Geometry/imstkDebugRenderGeometry.h index 4ead652ba2e96a5930106a4dc6fddeca96b3885d..9a4c2943f39afbfa996b85c4967a6cbd6ce27be8 100644 --- a/Source/Geometry/imstkDebugRenderGeometry.h +++ b/Source/Geometry/imstkDebugRenderGeometry.h @@ -122,7 +122,7 @@ protected: /// /// \brief Constructor /// - DebugRenderGeometry(const std::string& name, const Type type) : + explicit DebugRenderGeometry(const std::string& name, const Type type) : m_name(name), m_type(type), m_renderMaterial(std::make_shared<RenderMaterial>()) { } @@ -149,7 +149,7 @@ public: /// /// \brief Constructor /// - DebugRenderPoints(const std::string& name) : DebugRenderGeometry(name, Type::Points) {} + explicit DebugRenderPoints(const std::string& name) : DebugRenderGeometry(name, Type::Points) {} }; /// @@ -163,7 +163,7 @@ public: /// /// \brief Constructor /// - DebugRenderLines(const std::string& name) : DebugRenderGeometry(name, Type::Lines) {} + explicit DebugRenderLines(const std::string& name) : DebugRenderGeometry(name, Type::Lines) {} /// /// \brief Reserve memory for fast push_back @@ -182,7 +182,7 @@ public: /// /// \brief Constructor /// - DebugRenderTriangles(const std::string& name) : DebugRenderGeometry(name, Type::Triangles) {} + explicit DebugRenderTriangles(const std::string& name) : DebugRenderGeometry(name, Type::Triangles) {} /// /// \brief Reserve memory for fast push_back diff --git a/Source/Geometry/imstkGeometry.cpp b/Source/Geometry/imstkGeometry.cpp index 48d7cd0432220a2b6ac60f519e88afa43d85adfc..07307d6258808afc9e748b3fd7abd8fe13880912 100644 --- a/Source/Geometry/imstkGeometry.cpp +++ b/Source/Geometry/imstkGeometry.cpp @@ -24,7 +24,7 @@ namespace imstk { -Geometry::Geometry(const Geometry::Type type, const std::string name) : +Geometry::Geometry(const Geometry::Type type, const std::string& name) : m_type(type), m_name(name), m_geometryIndex(Geometry::getUniqueID()) { // If the geometry name is empty, enumerate it by name (which will not be duplicated) @@ -65,7 +65,7 @@ Geometry::print() const void Geometry::computeBoundingBox(Vec3d&, Vec3d&, const double) const { - LOG(FATAL) << "computeBoundingBox() must be called from an instance of a specific geometry class"; + LOG(WARNING) << "computeBoundingBox() must be called from an instance of a specific geometry class"; } void diff --git a/Source/Geometry/imstkGeometry.h b/Source/Geometry/imstkGeometry.h index 901165bf6e863a596d39cfbffa850bf5487f1b47..9fa317e9b7445b8cd23c257ebf34862772a73061 100644 --- a/Source/Geometry/imstkGeometry.h +++ b/Source/Geometry/imstkGeometry.h @@ -83,7 +83,7 @@ public: /// /// \brief Constructor /// - Geometry(const Type type, const std::string name = std::string("")); + explicit Geometry(const Geometry::Type type, const std::string& name = std::string("")); /// /// \brief Destructor diff --git a/Source/Geometry/imstkGeometryUtilities.cpp b/Source/Geometry/imstkGeometryUtilities.cpp index 90efc43f7ffcf97ffee0b53d2e3fd5c2a0ebe894..0aa58f60a5e9ef7e5a21df62feb3f3ff54002039 100644 --- a/Source/Geometry/imstkGeometryUtilities.cpp +++ b/Source/Geometry/imstkGeometryUtilities.cpp @@ -416,12 +416,10 @@ buildVertexToVertexConnectivity(const std::vector<ElemConn>& conn, { const auto ptr0 = vertToElemPtr[i]; const auto ptr1 = vertToElemPtr[i + 1]; - size_t eid; for (auto ptr = ptr0; ptr < ptr1; ++ptr) { - eid = vertToElem[ptr]; - for (auto vid : conn[eid]) + for (auto vid : conn[vertToElem[ptr]]) { // vertex-i itself is also included. vertToVert[i].insert(vid); diff --git a/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp b/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp index 51e8711b8bf27403c3cc70094dff3507896d4b88..126f37b7b01cf4df11c75ef988b02229042f17db 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp +++ b/Source/Rendering/GUIOverlay/imstkGUIWidget.cpp @@ -25,11 +25,10 @@ namespace imstk { namespace GUIOverlay { -Widget::Widget(std::string name, float x, float y) +Widget::Widget(const std::string& name, const float x, const float y) : + m_name(name), + m_position(Vec2f(x, y)) { - m_name = name; - m_position[0] = x; - m_position[1] = y; } Widget::~Widget() diff --git a/Source/Rendering/GUIOverlay/imstkGUIWidget.h b/Source/Rendering/GUIOverlay/imstkGUIWidget.h index c7a73a8a7088f17a0b962a58a9337520e52ac9f8..12f5034c8523d8596f78d09b772bd495daf917da 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWidget.h +++ b/Source/Rendering/GUIOverlay/imstkGUIWidget.h @@ -52,7 +52,7 @@ public: /// /// \brief Protected constructor /// - Widget(std::string name, float x = 0.0f, float y = 0.0f); + Widget(const std::string& name, float x = 0.0f, float y = 0.0f); /// /// \brief Destructor diff --git a/Source/Rendering/GUIOverlay/imstkGUIWidgetList.cpp b/Source/Rendering/GUIOverlay/imstkGUIWidgetList.cpp index ed3119621737e6c3f219a1f9e9bec5f441c4488d..629ff5e12d9cf84af072ba466433d1e1c44168cc 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWidgetList.cpp +++ b/Source/Rendering/GUIOverlay/imstkGUIWidgetList.cpp @@ -39,7 +39,7 @@ WidgetList::addWidget(std::shared_ptr<Widget> widget) } bool -WidgetList::removeWidget(std::string name) +WidgetList::removeWidget(const std::string& name) { int index = 0; @@ -56,7 +56,7 @@ WidgetList::removeWidget(std::string name) } std::shared_ptr<Widget> -WidgetList::getWidget(std::string name) +WidgetList::getWidget(const std::string& name) { for (auto widget : m_widgets) { diff --git a/Source/Rendering/GUIOverlay/imstkGUIWidgetList.h b/Source/Rendering/GUIOverlay/imstkGUIWidgetList.h index 738cc5ad68547ba0a756acf87129053f0ab42a89..891fe94c51a92d0037ac4c7a3e5313882d2ee25a 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWidgetList.h +++ b/Source/Rendering/GUIOverlay/imstkGUIWidgetList.h @@ -56,12 +56,12 @@ public: /// /// \brief Remove widget /// - bool removeWidget(std::string name); + bool removeWidget(const std::string& name); /// /// \brief Get widget /// - std::shared_ptr<Widget> getWidget(std::string name); + std::shared_ptr<Widget> getWidget(const std::string& name); /// /// \brief Get number of widgets diff --git a/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp b/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp index ab5b6b8c52cfcde208225a76022dbce7dc4f5357..e9c070f115e183f887c18f9c0f1fad7eff151576 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp +++ b/Source/Rendering/GUIOverlay/imstkGUIWindow.cpp @@ -26,17 +26,18 @@ namespace imstk { namespace GUIOverlay { -Window::Window(std::string name, - std::string title, - float width, - float height, - float x, - float y) : Widget(name, x, y) +Window::Window(const std::string& name, + const std::string& title, + const float width, + const float height, + const float x, + const float y) : + Widget(name, x, y), + m_title(title), + m_width(width), + m_height(height) { - m_type = Widget::Type::Window; - m_title = title; - m_width = width; - m_height = height; + m_type = Widget::Type::Window; } Window::~Window() diff --git a/Source/Rendering/GUIOverlay/imstkGUIWindow.h b/Source/Rendering/GUIOverlay/imstkGUIWindow.h index f469d4357e6f26d824efb921ce70dbf09e489168..b012f6f4e79bd4a6cde1b068038726e7b05bb3c4 100644 --- a/Source/Rendering/GUIOverlay/imstkGUIWindow.h +++ b/Source/Rendering/GUIOverlay/imstkGUIWindow.h @@ -46,12 +46,12 @@ public: /// /// \brief Protected constructor /// - Window(std::string name, - std::string title = "", - float width = 100, - float height = 50, - float x = 0, - float y = 0); + explicit Window(const std::string& name, + const std::string& title = "", + const float width = 100, + const float height = 50, + const float x = 0, + const float y = 0); /// /// \brief Destructor @@ -66,7 +66,7 @@ public: /// /// \brief Render /// - virtual void render(const bool inWindow); + virtual void render(const bool inWindow) override; /// /// \brief Add widget diff --git a/Source/Rendering/Materials/imstkColor.cpp b/Source/Rendering/Materials/imstkColor.cpp index d541d8b36f0a4cb42179e31a96a5693255950463..8a8cc79284da498befb60c8693d2a000eee12497 100644 --- a/Source/Rendering/Materials/imstkColor.cpp +++ b/Source/Rendering/Materials/imstkColor.cpp @@ -60,7 +60,7 @@ Color::Color(const double* rgba) setValue(rgba[0], rgba[1], rgba[2], rgba[3]); } -Color::Color(const Color color, const double a) +Color::Color(const Color& color, const double a) { setValue(color.r, color.g, color.b, a); } diff --git a/Source/Rendering/Materials/imstkColor.h b/Source/Rendering/Materials/imstkColor.h index 0122639849275bc24dba5dc0a1f28545d0fa3a08..7b7ca429731a51690be6df8b15094f4eb1833933 100644 --- a/Source/Rendering/Materials/imstkColor.h +++ b/Source/Rendering/Materials/imstkColor.h @@ -51,12 +51,12 @@ struct Color /// Color(); Color(const double r, const double g, const double b, const double a = 1.0); - Color(const double* rgba); + explicit Color(const double* rgba); /// /// \brief Constructor overwrites the alpha component /// - Color(const Color color, const double a); + Color(const Color& color, const double a); /// /// \brief Equality operator diff --git a/Source/Rendering/Materials/imstkRenderMaterial.cpp b/Source/Rendering/Materials/imstkRenderMaterial.cpp index f54f0ead3ca6ceccf340edbee0ed6c42ab077275..731dc736395b21fd148ac3fc02ed668cce296046 100644 --- a/Source/Rendering/Materials/imstkRenderMaterial.cpp +++ b/Source/Rendering/Materials/imstkRenderMaterial.cpp @@ -141,7 +141,7 @@ RenderMaterial::getColor() const } void -RenderMaterial::setColor(const Color color) +RenderMaterial::setColor(const Color& color) { m_color = color; m_modified = true; @@ -154,7 +154,7 @@ RenderMaterial::getDebugColor() const } void -RenderMaterial::setDebugColor(const Color color) +RenderMaterial::setDebugColor(const Color& color) { m_debugColor = color; m_modified = true; diff --git a/Source/Rendering/Materials/imstkRenderMaterial.h b/Source/Rendering/Materials/imstkRenderMaterial.h index 2564aea0e1d5c9c90c044ce9f76bd526e80ff028..77915612029b9050c4c38351c8e2d315ea7b5095 100644 --- a/Source/Rendering/Materials/imstkRenderMaterial.h +++ b/Source/Rendering/Materials/imstkRenderMaterial.h @@ -93,13 +93,13 @@ public: /// it affects the specular color in the case of metals. /// const Color& getColor() const; - void setColor(const Color color); + void setColor(const Color& color); /// /// \brief Get/Set the color of the wireframe and points /// const Color& getDebugColor() const; - void setDebugColor(const Color color); + void setDebugColor(const Color& color); /// /// \brief Get/Set the metalness diff --git a/Source/Rendering/Materials/imstkTexture.cpp b/Source/Rendering/Materials/imstkTexture.cpp index 45dc77d473f04f62c7a72f8508b125ba19409eac..5e1a866a5b7b9709f5bdb6ce916440778ef9656f 100644 --- a/Source/Rendering/Materials/imstkTexture.cpp +++ b/Source/Rendering/Materials/imstkTexture.cpp @@ -23,10 +23,9 @@ namespace imstk { -Texture::Texture(std::string path, Type type) +Texture::Texture(std::string path, Type type) : + m_path(path), m_type(type) { - m_path = path; - m_type = type; } Texture::Type diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCapsuleRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCapsuleRenderDelegate.h index d147ec6094f2c1c93623788443e23d50c106ffcd..0ab268328c317db11d2c2fdc53a7bd15a94e8bac 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCapsuleRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCapsuleRenderDelegate.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructor /// - VTKCapsuleRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKCapsuleRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.cpp index f009aa5019df2157311d0129c2ecf9f8cf5c4918..e1c2e0981ad074f0da835ade2be5f3f8172f903d 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.cpp @@ -30,7 +30,7 @@ VTKCubeRenderDelegate::VTKCubeRenderDelegate(std::shared_ptr<VisualModel> visual { m_visualModel = visualModel; - auto geometry = std::static_pointer_cast<Cube>(visualModel->getGeometry()); + //auto geometry = std::static_pointer_cast<Cube>(visualModel->getGeometry()); auto cubeSource = vtkSmartPointer<vtkCubeSource>::New(); cubeSource->SetCenter(0, 0, 0); diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.h index 122afeb1c0656cc280aab060449b52e556e99195..5a4ea230588835786ccca05b16d74d23aec78c5a 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCubeRenderDelegate.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructor /// - VTKCubeRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKCubeRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.h index 1bf9d7eaa111d7001d3867e1cf74353b36544bd3..22a7ca5ae50a055278bbb76d3476a0d8c5083ba6 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKCylinderRenderDelegate.h @@ -42,7 +42,7 @@ public: /// /// \brief Constructor /// - VTKCylinderRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKCylinderRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKHexahedralMeshRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKHexahedralMeshRenderDelegate.h index 8a88aaeb9d9734cbd4e7f29e77383f1cb6c59e13..6082fd0b056893256e1388554b915c89cc56b191 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKHexahedralMeshRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKHexahedralMeshRenderDelegate.h @@ -42,7 +42,7 @@ public: /// /// \brief Constructor /// - VTKHexahedralMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKHexahedralMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKImageDataRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKImageDataRenderDelegate.h index 6f4709dc1de9d66270b21a1a0df609f297e328ef..0dd71a964f8faa47564abf5682472937e2af710e 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKImageDataRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKImageDataRenderDelegate.h @@ -37,7 +37,7 @@ public: /// /// \brief Constructor /// - VTKImageDataRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKImageDataRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKLineMeshRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKLineMeshRenderDelegate.h index c352fb1b08c437b2f71c5417f7ef6b5ca7ffb586..a09b2d1fb633d1656bb3d11047752df9f921139f 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKLineMeshRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKLineMeshRenderDelegate.h @@ -42,7 +42,7 @@ public: /// /// \brief Constructor /// - VTKLineMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKLineMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Update line source based on the line mesh diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.cpp index 10ad0af56669030fa0fb39fcc671035b8495390a..d1177c75ff4aab6d30ee0219f5385b09c2716a0f 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.cpp @@ -30,7 +30,7 @@ VTKPlaneRenderDelegate::VTKPlaneRenderDelegate(std::shared_ptr<VisualModel> visu { m_visualModel = visualModel; - auto geometry = std::static_pointer_cast<Plane>(m_visualModel->getGeometry()); + //auto geometry = std::static_pointer_cast<Plane>(m_visualModel->getGeometry()); auto planeSource = vtkSmartPointer<vtkPlaneSource>::New(); planeSource->SetCenter(0, 0, 0); diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.h index 71b2cf95ead7affd776e311f168baad19f546236..7afc394db02d7ecf571040ec5d4c71806d35ff9f 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPlaneRenderDelegate.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructor /// - VTKPlaneRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKPlaneRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPointSetRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPointSetRenderDelegate.h index b66aea30e1d5d216a691854de55ac81f019a628b..b3f118cabf9f5fb3bde71d7d41b3c611ba07b06a 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPointSetRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKPointSetRenderDelegate.h @@ -43,7 +43,7 @@ public: /// /// \brief Constructor /// - VTKPointSetRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKPointSetRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKRenderDelegate.h index 64c328b86f16e4fffb5b74b6b97faef19260bb0b..8886bc23c8adad30f0a895bac7e6e70de4e73313 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKRenderDelegate.h @@ -105,17 +105,17 @@ protected: /// /// \brief Default constructor (protected) /// - VTKRenderDelegate() + VTKRenderDelegate() : + m_actor(vtkSmartPointer<vtkActor>::New()), + m_mapper(vtkSmartPointer<VTKCustomPolyDataMapper>::New()), + m_transform(vtkSmartPointer<vtkTransform>::New()), + m_volumeMapper(vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New()), + m_volume(vtkSmartPointer<vtkVolume>::New()), + m_modelIsVolume(false) { - m_actor = vtkSmartPointer<vtkActor>::New(); - m_mapper = vtkSmartPointer<VTKCustomPolyDataMapper>::New(); - m_transform = vtkSmartPointer<vtkTransform>::New(); m_actor->SetMapper(m_mapper); m_actor->SetUserTransform(m_transform); - m_volumeMapper = vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New(); - m_volume = vtkSmartPointer<vtkVolume>::New(); m_volume->SetMapper(m_volumeMapper); - m_modelIsVolume = false; } virtual ~VTKRenderDelegate() = default; diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSphereRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSphereRenderDelegate.h index c82eb93200b66da7b50bf739633bde284440457b..ef63b0cd7145dda9f6f735e9f0291c81df8bc181 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSphereRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSphereRenderDelegate.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructor /// - VTKSphereRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKSphereRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.h index 9a0e63d7a1df6ae5f3d636ea3ffe3fc30c501d7d..cfc97b20657186394ccd2f3d146e86e57158bf7c 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.h @@ -44,7 +44,7 @@ public: /// /// \brief Constructor /// - VTKSurfaceMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKSurfaceMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.h index b46eeaaf032c2eb4e62e089ab7543bf65be9b49c..4916f04a71dc08e854a07891a6f7872caf33b0c3 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.h @@ -43,7 +43,7 @@ public: /// /// \brief Constructor /// - VTKTetrahedralMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); + explicit VTKTetrahedralMeshRenderDelegate(std::shared_ptr<VisualModel> visualModel); /// /// \brief Destructor diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.cpp index c1b141a7ef206d0fbea2e43e475781484df51848..b3326aea9dd245a5731143f1443cfcbb97018d11 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.cpp @@ -63,7 +63,7 @@ VTKdbgLinesRenderDelegate::VTKdbgLinesRenderDelegate(const std::shared_ptr<Debug updateActorProperties(); setUpMapper(source->GetOutputPort(), false, m_RenderGeoData->getRenderMaterial()); - updateDataSource(); + //updateDataSource(); } void diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.h index f7be68ce9a7012f534351b9b5c49aed38162f3cc..bedd7344b12231a86869e23cfe88cdefc6013e49 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.h @@ -43,7 +43,7 @@ public: /// /// \brief Constructor /// - VTKdbgLinesRenderDelegate(const std::shared_ptr<DebugRenderLines>& lineData); + explicit VTKdbgLinesRenderDelegate(const std::shared_ptr<DebugRenderLines>& lineData); /// /// \brief Update polydata source based on the surface mesh geometry diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.cpp index b004e4ac792329794afd9893dbd53b4741c16c86..ccbc293927767b3f342807a8f9a48c61629a7597 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.cpp @@ -63,7 +63,7 @@ VTKdbgPointsRenderDelegate::VTKdbgPointsRenderDelegate(const std::shared_ptr<Deb updateActorProperties(); setUpMapper(m_glyph->GetOutputPort(), false, m_RenderGeoData->getRenderMaterial()); - updateDataSource(); + //updateDataSource(); } void diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.h index 69329316fc425146dd1cf1c5bdb47f2280ccda3b..7aef38f53e3974e50f83562c91fa4f0b1996e356 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugPointsRenderDelegate.h @@ -43,7 +43,7 @@ public: /// /// \brief Constructor /// - VTKdbgPointsRenderDelegate(const std::shared_ptr<DebugRenderPoints>& pointData); + explicit VTKdbgPointsRenderDelegate(const std::shared_ptr<DebugRenderPoints>& pointData); /// /// \brief Update polydata source based on the surface mesh geometry diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.cpp b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.cpp index 3bdc7ec5c37d4268b465333088cb60b0e98f219e..1af58f53c91d36465ce99448e8f3c8bf154900e1 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.cpp +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.cpp @@ -56,8 +56,8 @@ VTKdbgTrianglesRenderDelegate::VTKdbgTrianglesRenderDelegate(const std::shared_p source->SetOutput(m_polyData); // Update Transform, Render Properties - updateDataSource(); - updateActorProperties(); + //updateDataSource(); + //updateActorProperties(); setUpMapper(source->GetOutputPort(), true, m_RenderGeoData->getRenderMaterial()); } diff --git a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.h b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.h index 58b0c53a3bc246ccfd2458040577439e88362ca9..f1b045fe0b477eaea61315a0cd103790e4351d45 100644 --- a/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.h +++ b/Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugTrianglesRenderDelegate.h @@ -42,7 +42,7 @@ public: /// /// \brief Constructor /// - VTKdbgTrianglesRenderDelegate(const std::shared_ptr<DebugRenderTriangles>& renderTriangles); + explicit VTKdbgTrianglesRenderDelegate(const std::shared_ptr<DebugRenderTriangles>& renderTriangles); /// /// \brief Update polydata source based on the surface mesh geometry diff --git a/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.cpp b/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.cpp index bcd0fe3552c21bbe6ed9d59215fc716ecbbc8b1e..27a549b861ebb382847ce31241c72df8533bb6a6 100644 --- a/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.cpp +++ b/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.cpp @@ -204,17 +204,16 @@ VTKCustomPolyDataMapper::SetMapperShaderParameters( helper.Program->SetUniformf("metalness", material->getMetalness()); helper.Program->SetUniformf("roughness", material->getRoughness()); - unsigned int textureCount = 0; - unsigned int currentTexture = 0; - auto renderWindow = (vtkOpenGLRenderWindow*)(renderer->GetRenderWindow()); if (this->GetOpenGLMode(actor->GetProperty()->GetRepresentation(), helper.PrimitiveType) == GL_TRIANGLES) { - auto diffuseColorTemp = material->getColor(); - float diffuseColor[3] = { (float)diffuseColorTemp.r, - (float)diffuseColorTemp.g, - (float)diffuseColorTemp.b }; + unsigned int textureCount = 0; + unsigned int currentTexture = 0; + auto diffuseColorTemp = material->getColor(); + float diffuseColor[3] = { (float)diffuseColorTemp.r, + (float)diffuseColorTemp.g, + (float)diffuseColorTemp.b }; helper.Program->SetUniform3f("diffuseColorUniform", diffuseColor); auto diffuseTexture = material->getTexture(Texture::Type::DIFFUSE); @@ -287,7 +286,7 @@ VTKCustomPolyDataMapper::UpdateShaders( } void -VTKCustomPolyDataMapper::loadShader(const std::string filename, std::string& source) +VTKCustomPolyDataMapper::loadShader(const std::string& filename, std::string& source) { std::stringstream stream; std::ifstream file(filename); diff --git a/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.h b/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.h index fcd556c896ede0c28fbd59fc007c56f16540785b..a5c9f3f10daf48858144efeff23e3f578426503d 100644 --- a/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.h +++ b/Source/Rendering/VTKRenderer/imstkVTKCustomPolyDataMapper.h @@ -142,7 +142,7 @@ protected: /// /// \brief Loads a shader /// - void loadShader(const std::string filename, std::string& source); + void loadShader(const std::string& filename, std::string& source); std::shared_ptr<RenderMaterial> m_renderMaterial; ///< Geometry reference diff --git a/Source/Rendering/VTKRenderer/imstkVTKRenderer.cpp b/Source/Rendering/VTKRenderer/imstkVTKRenderer.cpp index 9c1a7f8f5ce5de63f35b009de1537855fa223ca4..cf108e1fd06bb01868c95722bee8188f32881f95 100644 --- a/Source/Rendering/VTKRenderer/imstkVTKRenderer.cpp +++ b/Source/Rendering/VTKRenderer/imstkVTKRenderer.cpp @@ -36,10 +36,8 @@ namespace imstk { -VTKRenderer::VTKRenderer(std::shared_ptr<Scene> scene, const bool enableVR) +VTKRenderer::VTKRenderer(std::shared_ptr<Scene> scene, const bool enableVR) : m_scene(scene) { - m_scene = scene; - // create m_vtkRenderer depending on enableVR if (!enableVR) { @@ -70,7 +68,7 @@ VTKRenderer::VTKRenderer(std::shared_ptr<Scene> scene, const bool enableVR) // Create lights specified in the scene switch (light->getType()) { - case imstk::LightType::DIRECTIONAL_LIGHT: + case imstk::LightType::directional: { auto m_vtkLight = vtkSmartPointer<vtkLight>::New(); m_vtkLight->SetPositional(false); @@ -83,7 +81,7 @@ VTKRenderer::VTKRenderer(std::shared_ptr<Scene> scene, const bool enableVR) } break; - case imstk::LightType::SPOT_LIGHT: + case imstk::LightType::spot: { auto m_vtkLight = vtkSmartPointer<vtkLight>::New(); m_vtkLight->SetPositional(true); @@ -105,7 +103,7 @@ VTKRenderer::VTKRenderer(std::shared_ptr<Scene> scene, const bool enableVR) } break; - case imstk::LightType::POINT_LIGHT: + case imstk::LightType::point: { auto m_vtkLight = vtkSmartPointer<vtkLight>::New(); m_vtkLight->SetPositional(true); diff --git a/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcess.cpp b/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcess.cpp index 5b1247700248feb1b9610b9aedf69490837ea2c7..d26a4fa143cb5bfe202d50255b6835549ddca59d 100644 --- a/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcess.cpp +++ b/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcess.cpp @@ -422,7 +422,7 @@ VulkanPostProcess::createDescriptorSets(VulkanRenderer* renderer) descriptorSetAllocationInfo[0].descriptorSetCount = (uint32_t)m_descriptorSetLayouts.size(); descriptorSetAllocationInfo[0].pSetLayouts = &m_descriptorSetLayouts[0]; - VkDeviceSize size = { VK_WHOLE_SIZE }; + //VkDeviceSize size = { VK_WHOLE_SIZE }; std::vector<VkDescriptorImageInfo> fragmentTextureInfo; diff --git a/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcessingChain.h b/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcessingChain.h index 7048038c5639e5d4392f6fc8f345057e57970bb4..267f62071c34b661dcc1b65ba9aade2a30774fa3 100644 --- a/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcessingChain.h +++ b/Source/Rendering/VulkanRenderer/PostProcessing/imstkVulkanPostProcessingChain.h @@ -39,7 +39,7 @@ public: /// /// \brief Constructor /// - VulkanPostProcessingChain(VulkanRenderer* renderer); + explicit VulkanPostProcessingChain(VulkanRenderer* renderer); std::vector<std::shared_ptr<VulkanPostProcess>>& getPostProcesses(); diff --git a/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanDecalRenderDelegate.cpp b/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanDecalRenderDelegate.cpp index 69da6d6d76e8bdf8b4515758d1b7bf5628da3a40..e8e0c4296dde2d08f461595f62877b4570dbf391 100644 --- a/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanDecalRenderDelegate.cpp +++ b/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanDecalRenderDelegate.cpp @@ -29,7 +29,7 @@ VulkanDecalRenderDelegate::VulkanDecalRenderDelegate(std::shared_ptr<VisualModel { this->initialize(visualModel); - auto geometry = std::static_pointer_cast<DecalPool>(visualModel->getGeometry()); + //auto geometry = std::static_pointer_cast<DecalPool>(visualModel->getGeometry()); m_numVertices = 8; m_numTriangles = 12; diff --git a/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanParticleRenderDelegate.cpp b/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanParticleRenderDelegate.cpp index 208525d0bfa8e3580ed6f55be30f270e34e58c9f..e894a1618ccde707fb3d6b8590582a04202dcf92 100644 --- a/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanParticleRenderDelegate.cpp +++ b/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanParticleRenderDelegate.cpp @@ -85,7 +85,7 @@ VulkanParticleRenderDelegate::initializeData(VulkanMemoryManager& memoryManager, void VulkanParticleRenderDelegate::update(const uint32_t frameIndex, std::shared_ptr<Camera> camera) { - unsigned int index = 0; + //unsigned int index = 0; auto particles = std::static_pointer_cast<RenderParticles>(m_visualModel->getGeometry()); @@ -97,7 +97,7 @@ VulkanParticleRenderDelegate::update(const uint32_t frameIndex, std::shared_ptr< camera->getViewUp()[1], camera->getViewUp()[2]); - auto matColor = mat->getColor(); + //auto matColor = mat->getColor(); this->sortParticles(particles->getParticles(), particles->getNumParticles(), cameraPosition); diff --git a/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanRenderDelegate.cpp b/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanRenderDelegate.cpp index e39f620f8eb4fdc66a02eba3b9ddff688ae76b2e..0545484a7a1a0839034cc785e5d441c2c9e64bdf 100644 --- a/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanRenderDelegate.cpp +++ b/Source/Rendering/VulkanRenderer/RenderDelegate/imstkVulkanRenderDelegate.cpp @@ -197,7 +197,7 @@ VulkanRenderDelegate::updateTransform() void VulkanRenderDelegate::updateUniforms(uint32_t frameIndex) { - auto geometry = this->getVisualModel()->getGeometry(); + //auto geometry = this->getVisualModel()->getGeometry(); this->updateTransform(); m_vertexUniformBuffer->updateUniforms(sizeof(VulkanLocalVertexUniforms), (void*)&m_localVertexUniforms, diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanMaterialDelegate.cpp b/Source/Rendering/VulkanRenderer/imstkVulkanMaterialDelegate.cpp index 7dd19ec491b83b7af71d5ae9845054db5ab2e69e..c2b70a5ccbbbeb037fb647a22db76719eaa4c5af 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanMaterialDelegate.cpp +++ b/Source/Rendering/VulkanRenderer/imstkVulkanMaterialDelegate.cpp @@ -30,11 +30,10 @@ VulkanMaterialDelegate::VulkanMaterialDelegate( std::shared_ptr<VulkanUniformBuffer> fragmentUniformBuffer, std::shared_ptr<RenderMaterial> material, VulkanMemoryManager& memoryManager, - VulkanMaterialType type) + VulkanMaterialType type) : + m_vertexUniformBuffer(vertexUniformBuffer), + m_fragmentUniformBuffer(fragmentUniformBuffer) { - m_vertexUniformBuffer = vertexUniformBuffer; - m_fragmentUniformBuffer = fragmentUniformBuffer; - m_shadowPass = (type == VulkanMaterialType::Shadow); m_depthPrePass = (type == VulkanMaterialType::Depth); m_wireframe = (type == VulkanMaterialType::Wireframe); @@ -922,7 +921,7 @@ VulkanMaterialDelegate::createDescriptorSets(VulkanRenderer* renderer) descriptorSetAllocationInfo[0].descriptorSetCount = (uint32_t)m_descriptorSetLayouts.size(); descriptorSetAllocationInfo[0].pSetLayouts = &m_descriptorSetLayouts[0]; - VkDeviceSize size = { VK_WHOLE_SIZE }; + //VkDeviceSize size = { VK_WHOLE_SIZE }; // Global Buffers std::vector<VkDescriptorBufferInfo> vertexBufferInfo(2); diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanRenderPassGenerator.cpp b/Source/Rendering/VulkanRenderer/imstkVulkanRenderPassGenerator.cpp index e78fda2535bcd54f85b98e964be87f867452ccfb..58f8da352f1da243c30bc6fbab2f643314f89544 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanRenderPassGenerator.cpp +++ b/Source/Rendering/VulkanRenderer/imstkVulkanRenderPassGenerator.cpp @@ -25,10 +25,10 @@ namespace imstk { void VulkanRenderPassGenerator::generateDepthRenderPass( - VkDevice& device, - VkRenderPass& renderPass, - VkSampleCountFlagBits& samples, - const uint32_t numViews) + VkDevice& device, + VkRenderPass& renderPass, + const VkSampleCountFlagBits& samples, + const uint32_t numViews) { VkAttachmentDescription attachments[1]; @@ -103,10 +103,10 @@ VulkanRenderPassGenerator::generateDepthRenderPass( void VulkanRenderPassGenerator::generateOpaqueRenderPass( - VkDevice& device, - VkRenderPass& renderPass, - VkSampleCountFlagBits& samples, - const uint32_t numViews) + VkDevice& device, + VkRenderPass& renderPass, + const VkSampleCountFlagBits& samples, + const uint32_t numViews) { VkAttachmentDescription attachments[4]; @@ -230,10 +230,10 @@ VulkanRenderPassGenerator::generateOpaqueRenderPass( void VulkanRenderPassGenerator::generateDecalRenderPass( - VkDevice& device, - VkRenderPass& renderPass, - VkSampleCountFlagBits& samples, - const uint32_t numViews) + VkDevice& device, + VkRenderPass& renderPass, + const VkSampleCountFlagBits& samples, + const uint32_t numViews) { VkAttachmentDescription attachments[3]; @@ -341,10 +341,10 @@ VulkanRenderPassGenerator::generateDecalRenderPass( void VulkanRenderPassGenerator::generateParticleRenderPass( - VkDevice& device, - VkRenderPass& renderPass, - VkSampleCountFlagBits& samples, - uint32_t numViews) + VkDevice& device, + VkRenderPass& renderPass, + const VkSampleCountFlagBits& samples, + uint32_t numViews) { VkAttachmentDescription attachments[3]; @@ -452,10 +452,10 @@ VulkanRenderPassGenerator::generateParticleRenderPass( void VulkanRenderPassGenerator::generateShadowRenderPass( - VkDevice& device, - VkRenderPass& renderPass, - VkSampleCountFlagBits& samples, - const uint32_t numViews) + VkDevice& device, + VkRenderPass& renderPass, + const VkSampleCountFlagBits& samples, + const uint32_t numViews) { VkAttachmentDescription attachments[1]; @@ -523,10 +523,10 @@ VulkanRenderPassGenerator::generateShadowRenderPass( void VulkanRenderPassGenerator::generateGUIRenderPass( - VkDevice& device, - VkRenderPass& renderPass, - VkSampleCountFlagBits& samples, - const uint32_t numViews) + VkDevice& device, + VkRenderPass& renderPass, + const VkSampleCountFlagBits& samples, + const uint32_t numViews) { VkAttachmentDescription attachments[1]; diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.cpp b/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.cpp index 121391fdbcafcbb0ebaa3da1c5798cf366e813d4..1e90feb8fbf0d0092ddf4f418d69747ecac15246 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.cpp +++ b/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.cpp @@ -23,9 +23,8 @@ namespace imstk { -VulkanRenderer::VulkanRenderer(std::shared_ptr<Scene> scene) +VulkanRenderer::VulkanRenderer(std::shared_ptr<Scene> scene) : m_scene(scene) { - m_scene = scene; } void @@ -129,8 +128,8 @@ VulkanRenderer::initialize(const unsigned int width, this->createGlobalUniformBuffers(); this->createShadowMaps(m_shadowMapResolution); - std::vector<VkPipeline> graphicsPipelines; - std::vector<VkGraphicsPipelineCreateInfo> graphicsPipelinesInfo; + //std::vector<VkPipeline> graphicsPipelines; + //std::vector<VkGraphicsPipelineCreateInfo> graphicsPipelinesInfo; VkPhysicalDeviceProperties deviceProperties; vkGetPhysicalDeviceProperties(m_renderPhysicalDevice, &deviceProperties); diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.h b/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.h index 081786354fb504cc196c33a838434de53c327b46..dc29a043b800f7f6cb85adac58dae3b8caf7c167 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.h +++ b/Source/Rendering/VulkanRenderer/imstkVulkanRenderer.h @@ -72,7 +72,7 @@ struct VulkanRendererConstants class VulkanRenderer : public Renderer { public: - VulkanRenderer(std::shared_ptr<Scene> scene); + explicit VulkanRenderer(std::shared_ptr<Scene> scene); ~VulkanRenderer(); void setShadowMapResolution(uint32_t resolution); diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanResources.h b/Source/Rendering/VulkanRenderer/imstkVulkanResources.h index af08d3edd8c6f5fa440ff600fb19193b51f7bc18..f8696eeb2915932be1bd28c1af10ed8203a01a23 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanResources.h +++ b/Source/Rendering/VulkanRenderer/imstkVulkanResources.h @@ -126,7 +126,7 @@ protected: class VulkanInternalBufferGroup : public VulkanInternalResource { public: - VulkanInternalBufferGroup(VulkanMemoryType type) + explicit VulkanInternalBufferGroup(VulkanMemoryType type) { m_type = type; m_buffer = new VkBuffer(); @@ -155,7 +155,7 @@ protected: class VulkanInternalBuffer { public: - VulkanInternalBuffer(VulkanInternalBufferGroup* bufferGroup) + explicit VulkanInternalBuffer(VulkanInternalBufferGroup* bufferGroup) { m_bufferGroup = bufferGroup; }; diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanTextureDelegate.cpp b/Source/Rendering/VulkanRenderer/imstkVulkanTextureDelegate.cpp index 07c4903c73800d7be89f78605d295674a9379deb..f94103d9a2b4367d8a7277f23e425d84ea317bf5 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanTextureDelegate.cpp +++ b/Source/Rendering/VulkanRenderer/imstkVulkanTextureDelegate.cpp @@ -26,12 +26,11 @@ namespace imstk VulkanTextureDelegate::VulkanTextureDelegate( VulkanMemoryManager& memoryManager, std::shared_ptr<Texture> texture, - float anisotropyAmount) + float anisotropyAmount) : + m_path(texture->getPath()), + m_type(texture->getType()), + m_fileType(texture->getFileType()) { - m_path = texture->getPath(); - m_type = texture->getType(); - m_fileType = texture->getFileType(); - // Load textures and get texture information if ((m_type == Texture::Type::IRRADIANCE_CUBEMAP) || (m_type == Texture::Type::RADIANCE_CUBEMAP)) @@ -323,7 +322,6 @@ VulkanTextureDelegate::uploadTexture(VulkanMemoryManager& memoryManager) auto imageEditData = (unsigned char*)m_stagingBuffer->getMemoryData(memoryManager.m_device); - unsigned int y_offset = 0; unsigned int totalChannels = this->getNumChannels(m_format); unsigned int colorChannels = std::min(std::min(m_channels, 3u), totalChannels); @@ -331,7 +329,7 @@ VulkanTextureDelegate::uploadTexture(VulkanMemoryManager& memoryManager) { for (unsigned int y = 0; y < m_height; y++) { - y_offset = y * m_width; + unsigned int y_offset = y * m_width; for (unsigned int x = 0; x < m_width; x++) { // Fill in image data @@ -551,7 +549,7 @@ VulkanTextureDelegate::uploadCubemapTexture(VulkanMemoryManager& memoryManager) void VulkanTextureDelegate::changeImageLayout(VkCommandBuffer& commandBuffer, - VkImage& image, + const VkImage& image, VkImageLayout layout1, VkImageLayout layout2, VkAccessFlags sourceFlags, @@ -709,6 +707,7 @@ VulkanTextureDelegate::getStride(const VkFormat& format) break; case VK_FORMAT_R8_UNORM: stride = 1; + /// \\todo add break here? case VK_FORMAT_BC1_RGB_UNORM_BLOCK: case VK_FORMAT_BC1_RGB_SRGB_BLOCK: case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanUniformBuffer.cpp b/Source/Rendering/VulkanRenderer/imstkVulkanUniformBuffer.cpp index 877d13048d0a302132529615fa9dc7cf397cfb29..777ef63ab3e074043b5054c9440acf83e05c9e3f 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanUniformBuffer.cpp +++ b/Source/Rendering/VulkanRenderer/imstkVulkanUniformBuffer.cpp @@ -23,10 +23,9 @@ namespace imstk { -VulkanUniformBuffer::VulkanUniformBuffer(VulkanMemoryManager& memoryManager, uint32_t uniformSize) +VulkanUniformBuffer::VulkanUniformBuffer(VulkanMemoryManager& memoryManager, uint32_t uniformSize) : + m_renderDevice(memoryManager.m_device) { - m_renderDevice = memoryManager.m_device; - // Uniform buffer VkBufferCreateInfo uniformBufferInfo; uniformBufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; diff --git a/Source/Rendering/VulkanRenderer/imstkVulkanVertexBuffer.cpp b/Source/Rendering/VulkanRenderer/imstkVulkanVertexBuffer.cpp index b4ed66e908ac3c6d4135f652986026097e7c4b3a..05668c03cb7b1ef9206a109dbc8223538f168148 100644 --- a/Source/Rendering/VulkanRenderer/imstkVulkanVertexBuffer.cpp +++ b/Source/Rendering/VulkanRenderer/imstkVulkanVertexBuffer.cpp @@ -28,11 +28,10 @@ VulkanVertexBuffer::VulkanVertexBuffer(VulkanMemoryManager& memoryManager, unsigned int vertexSize, unsigned int numTriangles, double loadFactor, - VulkanVertexBufferMode mode) + VulkanVertexBufferMode mode) : m_renderDevice(memoryManager.m_device) { - m_mode = mode; - m_renderDevice = memoryManager.m_device; - m_buffering = (m_mode == VulkanVertexBufferMode::VERTEX_BUFFER_STATIC) ? 1 : memoryManager.m_buffering; + m_mode = mode; + m_buffering = (m_mode == VulkanVertexBufferMode::VERTEX_BUFFER_STATIC) ? 1 : memoryManager.m_buffering; m_vertexBufferSize = (uint32_t)(numVertices * vertexSize * loadFactor) * m_buffering; m_numIndices = numTriangles * 3; m_indexBufferSize = (uint32_t)(m_numIndices * sizeof(uint32_t) * loadFactor) * m_buffering; @@ -133,7 +132,6 @@ VulkanVertexBuffer::updateVertexBuffer(std::vector<VulkanBasicVertex>* vertices, std::vector<std::array<uint32_t, 3>>* triangles) { auto local_vertices = (VulkanBasicVertex*)this->getVertexMemory(); - for (unsigned int i = 0; i < vertices->size(); i++) { local_vertices[i].position = glm::vec3( diff --git a/Source/Rendering/vtkCapsuleSource.h b/Source/Rendering/vtkCapsuleSource.h index 30f2632b21c374cbd43a16a979950c58c3e975a9..19f70a8cd6b2a365328254aa0114495dbe3c3621 100644 --- a/Source/Rendering/vtkCapsuleSource.h +++ b/Source/Rendering/vtkCapsuleSource.h @@ -99,7 +99,7 @@ protected: int ThetaResolution; int PhiResolution; int LatLongTessellation; - int FillPoles; + //int FillPoles; double CylinderLength; private: diff --git a/Source/Scene/SceneElements/Controllers/imstkDeviceTracker.h b/Source/Scene/SceneElements/Controllers/imstkDeviceTracker.h index 0a454396774441adf26845e3773ef9f62c86cbc0..86c80fbcd66dd3af699ade1c11ff01a82d5ba039 100644 --- a/Source/Scene/SceneElements/Controllers/imstkDeviceTracker.h +++ b/Source/Scene/SceneElements/Controllers/imstkDeviceTracker.h @@ -51,7 +51,7 @@ public: /// /// \brief Constructor /// - DeviceTracker(std::shared_ptr<DeviceClient> deviceClient) : + explicit DeviceTracker(std::shared_ptr<DeviceClient> deviceClient) : m_deviceClient(deviceClient) {} /// diff --git a/Source/Scene/SceneElements/Lights/imstkIBLProbe.cpp b/Source/Scene/SceneElements/Lights/imstkIBLProbe.cpp index dc7171fe6e8ed187d8be2359dbe640375c77467d..de9840747232300769f5ec58f4daa3f0f2a57a2b 100644 --- a/Source/Scene/SceneElements/Lights/imstkIBLProbe.cpp +++ b/Source/Scene/SceneElements/Lights/imstkIBLProbe.cpp @@ -23,22 +23,6 @@ namespace imstk { -IBLProbe::IBLProbe(std::string irradianceCubemapPath, - std::string radianceCubemapPath, - std::string brdfLUTPath) -{ - m_irradianceCubemapPath = irradianceCubemapPath; - m_radianceCubemapPath = radianceCubemapPath; - m_brdfLUTPath = brdfLUTPath; - - m_irradianceCubemapTexture - = std::make_shared<Texture>(irradianceCubemapPath, Texture::Type::IRRADIANCE_CUBEMAP); - m_radianceCubemapTexture - = std::make_shared<Texture>(radianceCubemapPath, Texture::Type::RADIANCE_CUBEMAP); - m_brdfLUTTexture - = std::make_shared<Texture>(brdfLUTPath, Texture::Type::BRDF_LUT); -} - std::shared_ptr<Texture> IBLProbe::getIrradianceCubemapTexture() { diff --git a/Source/Scene/SceneElements/Lights/imstkIBLProbe.h b/Source/Scene/SceneElements/Lights/imstkIBLProbe.h index 73cafeeb4913e05055c63bdc0d7c24df2e9fee86..0e7620d9c0711efa61d89fd48b86efd9d5d6233b 100644 --- a/Source/Scene/SceneElements/Lights/imstkIBLProbe.h +++ b/Source/Scene/SceneElements/Lights/imstkIBLProbe.h @@ -47,9 +47,17 @@ public: /// \param radianceCubemapPath path to .dds radiance (specular) cubemap /// \param brdfLUTPath path to BRDF LUT (shouldn't be .dds) /// - IBLProbe(std::string irradianceCubemapPath, - std::string radianceCubemapPath, - std::string brdfLUTPath); + IBLProbe::IBLProbe(std::string irradianceCubemapPath, + std::string radianceCubemapPath, + std::string brdfLUTPath) : + m_irradianceCubemapPath(irradianceCubemapPath), + m_radianceCubemapPath(radianceCubemapPath), + m_brdfLUTPath(brdfLUTPath), + m_irradianceCubemapTexture(std::make_shared<Texture>(irradianceCubemapPath, + Texture::Type::IRRADIANCE_CUBEMAP)), + m_radianceCubemapTexture(std::make_shared<Texture>(radianceCubemapPath, + Texture::Type::RADIANCE_CUBEMAP)), + m_brdfLUTTexture(std::make_shared<Texture>(brdfLUTPath, Texture::Type::BRDF_LUT)) {} std::shared_ptr<Texture> getIrradianceCubemapTexture(); std::shared_ptr<Texture> getRadianceCubemapTexture(); diff --git a/Source/Scene/SceneElements/Lights/imstkLight.h b/Source/Scene/SceneElements/Lights/imstkLight.h index 745673219be8908291a3a2a90348fea758b43d15..dfd4ede914d0240013e80c8531aa5e3171c2060e 100644 --- a/Source/Scene/SceneElements/Lights/imstkLight.h +++ b/Source/Scene/SceneElements/Lights/imstkLight.h @@ -35,9 +35,9 @@ namespace imstk /// enum class LightType { - DIRECTIONAL_LIGHT, - POINT_LIGHT, - SPOT_LIGHT + directional, + point, + spot }; /// @@ -117,8 +117,7 @@ public: void setName(const std::string&& name) { m_name = std::move(name); }; protected: - Light(const std::string& name) : m_name(name), Entity() {}; - Light(std::string&& name) : m_name(std::move(name)), Entity() {}; + explicit Light(const std::string& name, const LightType& type) : m_name(name), m_type(type), Entity() {}; // properties with defaults float m_intensity = 100.; @@ -146,14 +145,8 @@ public: /// /// \brief Constructor /// - DirectionalLight(const std::string& name) : Light(name) + explicit DirectionalLight(const std::string& name) : Light(name, LightType::directional) { - m_type = LightType::DIRECTIONAL_LIGHT; - this->setFocalPoint(-1, -1, -1); - }; - DirectionalLight(std::string&& name) : Light(std::move(name)) - { - m_type = LightType::DIRECTIONAL_LIGHT; this->setFocalPoint(-1, -1, -1); }; @@ -199,14 +192,7 @@ public: /// /// \brief Constructors /// - PointLight(const std::string& name) : Light(name) - { - m_type = LightType::POINT_LIGHT; - }; - PointLight(std::string&& name) : Light(std::move(name)) - { - m_type = LightType::POINT_LIGHT; - }; + explicit PointLight(const std::string& name, const LightType& type = LightType::point) : Light(name, type) {}; /// /// \brief Get the cone angle @@ -253,14 +239,8 @@ public: /// /// \brief Constructors /// - SpotLight(const std::string& name) : PointLight(name) - { - m_type = LightType::SPOT_LIGHT; - m_coneAngle = 10.; - }; - SpotLight(std::string&& name) : PointLight(std::move(name)) + explicit SpotLight(const std::string& name) : PointLight(name, LightType::spot) { - m_type = LightType::SPOT_LIGHT; m_coneAngle = 10.; }; @@ -277,4 +257,4 @@ public: protected: float m_spotAngle = 45.; }; -} // imstk +} // imstk \ No newline at end of file diff --git a/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp b/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp index 25578dd4d4689b91e2358943b70f7094f5f8d535..7aa2b25bca46ad55e924bfea305fcb5105af85a9 100644 --- a/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp +++ b/Source/Scene/SceneElements/Loader/imstkVisualObjectImporter.cpp @@ -58,7 +58,7 @@ VisualObjectImporter::importVisualObject( std::vector<std::string> materialTextureCoreFileNames; std::vector<std::string> materialTextureFileExtensions; - std::string texturePath; + //std::string texturePath; // Normalizes, for examples ".png" to "png" auto cleanFileExtension = VisualObjectImporter::getSubstringGivenString(fileExtension, ".", true); @@ -208,7 +208,6 @@ VisualObjectImporter::getSubstringGivenString( { unsigned long long index = 0; unsigned long long tempIndex; - std::string output; if (lastInstance) { diff --git a/Source/Scene/SceneElements/Objects/deprecated/imstkPbdRigidObject.h b/Source/Scene/SceneElements/Objects/deprecated/imstkPbdRigidObject.h index dd171e1a03f06bfac8a39cbfdc01301d1ad02167..c74baea0f2723dd7d3d8ae0ae7861f55c1dd6431 100644 --- a/Source/Scene/SceneElements/Objects/deprecated/imstkPbdRigidObject.h +++ b/Source/Scene/SceneElements/Objects/deprecated/imstkPbdRigidObject.h @@ -38,10 +38,8 @@ public: /// /// \brief Constructor /// - PbdRigidObject(std::string name) : PbdObject(name) - { - m_type = SceneObject::Type::Pbd; - } + explicit PbdRigidObject(const std::string& name) : PbdObject(name) + { m_type = SceneObject::Type::Pbd; } /// /// \brief Destructor diff --git a/Source/Scene/SceneElements/Objects/imstkAnimationModel.cpp b/Source/Scene/SceneElements/Objects/imstkAnimationModel.cpp index 2b61db821ed7fac8c5c447f609daf14ce3125905..42f91e3a90d7cb89d2af0afa48e7f82669154e9e 100644 --- a/Source/Scene/SceneElements/Objects/imstkAnimationModel.cpp +++ b/Source/Scene/SceneElements/Objects/imstkAnimationModel.cpp @@ -23,9 +23,8 @@ namespace imstk { -AnimationModel::AnimationModel(std::shared_ptr<Geometry> geometry) +AnimationModel::AnimationModel(std::shared_ptr<Geometry> geometry) : m_geometry(geometry) { - m_geometry = geometry; } std::shared_ptr<Geometry> diff --git a/Source/Scene/SceneElements/Objects/imstkAnimationModel.h b/Source/Scene/SceneElements/Objects/imstkAnimationModel.h index 17baaf8a773bc868a27d72d74ffc6db4f33869f3..04d7bfde125818eb5b1ca6d0ba9b7f3ba411493c 100644 --- a/Source/Scene/SceneElements/Objects/imstkAnimationModel.h +++ b/Source/Scene/SceneElements/Objects/imstkAnimationModel.h @@ -38,7 +38,7 @@ public: /// /// \brief Constructor /// - AnimationModel(std::shared_ptr<Geometry> geometry); + explicit AnimationModel(std::shared_ptr<Geometry> geometry); AnimationModel() = delete; diff --git a/Source/Scene/SceneElements/Objects/imstkAnimationObject.h b/Source/Scene/SceneElements/Objects/imstkAnimationObject.h index 95ac8595b6c6849812ca6b058e39b5bb6a696042..bb0412fc317d265b4c9a51694a68eb7640b549a4 100644 --- a/Source/Scene/SceneElements/Objects/imstkAnimationObject.h +++ b/Source/Scene/SceneElements/Objects/imstkAnimationObject.h @@ -38,15 +38,7 @@ public: /// /// \brief Constructor /// - AnimationObject(const std::string& name) : SceneObject(name) - { - m_type = Type::Animation; - } - - /// - /// \brief Constructor - /// - AnimationObject(std::string&& name) : SceneObject(std::move(name)) + explicit AnimationObject(const std::string& name) : SceneObject(name) { m_type = Type::Animation; } @@ -65,7 +57,7 @@ public: /// /// \brief Initialize the scene object /// - virtual bool initialize() + virtual bool initialize() override { if (SceneObject::initialize()) { diff --git a/Source/Scene/SceneElements/Objects/imstkCollidingObject.h b/Source/Scene/SceneElements/Objects/imstkCollidingObject.h index 04d897e9ec9d6c703d643d9adff38b421c343935..8b851fafc506153000cebb7625b1da61b4f7c09e 100644 --- a/Source/Scene/SceneElements/Objects/imstkCollidingObject.h +++ b/Source/Scene/SceneElements/Objects/imstkCollidingObject.h @@ -37,12 +37,7 @@ public: /// /// \brief /// - CollidingObject(const std::string& name) : SceneObject(name) - { - m_type = Type::Colliding; - } - - CollidingObject(std::string&& name) : SceneObject(std::move(name)) + explicit CollidingObject(const std::string& name) : SceneObject(name) { m_type = Type::Colliding; } diff --git a/Source/Scene/SceneElements/Objects/imstkDeformableObject.h b/Source/Scene/SceneElements/Objects/imstkDeformableObject.h index 055a80434f4b7c550dd6f4f9f0480583bc12b781..2184502a046617e317754b78e5afbe0413e158f7 100644 --- a/Source/Scene/SceneElements/Objects/imstkDeformableObject.h +++ b/Source/Scene/SceneElements/Objects/imstkDeformableObject.h @@ -46,8 +46,7 @@ public: /// /// \brief Constructor /// - DeformableObject(const std::string& name) : DynamicObject(name) { m_type = Type::FEMDeformable; } - DeformableObject(std::string&& name) : DynamicObject(std::move(name)) { m_type = Type::FEMDeformable; } + explicit DeformableObject(const std::string& name) : DynamicObject(name) { m_type = Type::FEMDeformable; } DeformableObject() = delete; /// diff --git a/Source/Scene/SceneElements/Objects/imstkDynamicObject.h b/Source/Scene/SceneElements/Objects/imstkDynamicObject.h index 116b51210eedaa8ace4629f9ae222ae6beffbeaa..4818108864c754faa5388a7e29999bfcffb5a87b 100644 --- a/Source/Scene/SceneElements/Objects/imstkDynamicObject.h +++ b/Source/Scene/SceneElements/Objects/imstkDynamicObject.h @@ -53,7 +53,7 @@ public: /// /// \brief Get the master geometry /// - virtual std::shared_ptr<Geometry> getMasterGeometry() const { return m_physicsGeometry; } + virtual std::shared_ptr<Geometry> getMasterGeometry() const override { return m_physicsGeometry; } /// /// \brief Set/Get the Physics-to-Collision map @@ -151,8 +151,7 @@ protected: /// /// \brief Constructor /// - DynamicObject(const std::string& name) : CollidingObject(name) {} - DynamicObject(std::string&& name) : CollidingObject(std::move(name)) {} + explicit DynamicObject(const std::string& name) : CollidingObject(name) {} std::shared_ptr<AbstractDynamicalModel> m_dynamicalModel; ///> Dynamical model std::shared_ptr<Geometry> m_physicsGeometry; ///> Geometry used for Physics diff --git a/Source/Scene/SceneElements/Objects/imstkPbdObject.h b/Source/Scene/SceneElements/Objects/imstkPbdObject.h index 6b08538c8805f46fddb65da402f4f4bf21e24bfa..747263598b83537004b55a6dedcb6e67bca45f95 100644 --- a/Source/Scene/SceneElements/Objects/imstkPbdObject.h +++ b/Source/Scene/SceneElements/Objects/imstkPbdObject.h @@ -45,12 +45,7 @@ public: /// /// \brief Constructor /// - PbdObject(const std::string& name) : DynamicObject(name) - { - m_type = SceneObject::Type::Pbd; - } - - PbdObject(std::string&& name) : DynamicObject(std::move(name)) + explicit PbdObject(const std::string& name) : DynamicObject(name) { m_type = SceneObject::Type::Pbd; } diff --git a/Source/Scene/SceneElements/Objects/imstkRigidObject.h b/Source/Scene/SceneElements/Objects/imstkRigidObject.h index a87373ca1be2bb484dbca080be1cae1a685cbe46..7e0ff3a2810f87506bc782d6108e36521b841abb 100644 --- a/Source/Scene/SceneElements/Objects/imstkRigidObject.h +++ b/Source/Scene/SceneElements/Objects/imstkRigidObject.h @@ -39,7 +39,7 @@ public: /// /// \brief Constructor /// - RigidObject(std::string name) : DynamicObject(name) + explicit RigidObject(const std::string& name) : DynamicObject(name) { m_type = Type::Rigid; } diff --git a/Source/Scene/SceneElements/Objects/imstkSPHObject.h b/Source/Scene/SceneElements/Objects/imstkSPHObject.h index 9a4f8d1ce2e231e700cf813720ccb4041477f2f5..2387a2c0f201953b4e08eb41c12d40ab623030a7 100644 --- a/Source/Scene/SceneElements/Objects/imstkSPHObject.h +++ b/Source/Scene/SceneElements/Objects/imstkSPHObject.h @@ -39,7 +39,7 @@ public: /// /// \brief Constructor /// - SPHObject(const std::string& name); + explicit SPHObject(const std::string& name); /// /// \brief Destructor diff --git a/Source/Scene/SceneElements/Objects/imstkSceneObject.cpp b/Source/Scene/SceneElements/Objects/imstkSceneObject.cpp index 85ee531e7e71cb21f1f955b1638a8070959a9dcc..9741516c024728b2d1db0efa17cf724197803d38 100644 --- a/Source/Scene/SceneElements/Objects/imstkSceneObject.cpp +++ b/Source/Scene/SceneElements/Objects/imstkSceneObject.cpp @@ -31,11 +31,6 @@ SceneObject::SceneObject(const std::string& name) : m_name(name), Entity() m_type = Type::Visual; } -SceneObject::SceneObject(std::string&& name) : m_name(std::move(name)), Entity() -{ - m_type = Type::Visual; -} - std::shared_ptr<Geometry> SceneObject::getVisualGeometry() const { diff --git a/Source/Scene/SceneElements/Objects/imstkSceneObject.h b/Source/Scene/SceneElements/Objects/imstkSceneObject.h index fcfc8ed12c3af85269be922820b9099719f6dfbc..799b33576dd66c70298c5b1f1529d019c59fdcde 100644 --- a/Source/Scene/SceneElements/Objects/imstkSceneObject.h +++ b/Source/Scene/SceneElements/Objects/imstkSceneObject.h @@ -55,8 +55,7 @@ public: /// /// \brief Constructor /// - SceneObject(const std::string& name); - SceneObject(std::string&& name); + explicit SceneObject(const std::string& name); /// /// \brief Destructor diff --git a/Source/Scene/SceneElements/Objects/imstkVisualModel.cpp b/Source/Scene/SceneElements/Objects/imstkVisualModel.cpp index dcba501d94ac3c55c1f50082b09304140b94994c..70dfc1e72354476a869b71cb454518b577c79adb 100644 --- a/Source/Scene/SceneElements/Objects/imstkVisualModel.cpp +++ b/Source/Scene/SceneElements/Objects/imstkVisualModel.cpp @@ -23,9 +23,8 @@ namespace imstk { -VisualModel::VisualModel(std::shared_ptr<Geometry> geometry) +VisualModel::VisualModel(std::shared_ptr<Geometry> geometry) : m_geometry(geometry) { - m_geometry = geometry; } std::shared_ptr<Geometry> diff --git a/Source/Scene/SceneElements/Objects/imstkVisualModel.h b/Source/Scene/SceneElements/Objects/imstkVisualModel.h index 8d346561da9276667c6a550038461eab55fe92de..5d482341930d74f0d4d4974172e8a0a5cc26db69 100644 --- a/Source/Scene/SceneElements/Objects/imstkVisualModel.h +++ b/Source/Scene/SceneElements/Objects/imstkVisualModel.h @@ -39,7 +39,7 @@ public: /// /// \brief Constructor /// - VisualModel(std::shared_ptr<Geometry> geometry); + explicit VisualModel(std::shared_ptr<Geometry> geometry); VisualModel() = delete; diff --git a/Source/Scene/imstkScene.h b/Source/Scene/imstkScene.h index b81c9efdcacdc4d931217fcb17ff7e7bbfce39e3..2aa9f844a759aa8dfa65e9e0f1d07d172731c176 100644 --- a/Source/Scene/imstkScene.h +++ b/Source/Scene/imstkScene.h @@ -70,8 +70,7 @@ public: /// /// \brief Constructor /// - Scene(const std::string& name, std::shared_ptr<SceneConfig> config = std::make_shared<SceneConfig>()) : m_name(name), m_config(config) {} - Scene(std::string&& name, std::shared_ptr<SceneConfig> config = std::make_shared<SceneConfig>()) : m_name(std::move(name)), m_config(config) {} + explicit Scene(const std::string& name, std::shared_ptr<SceneConfig> config = std::make_shared<SceneConfig>()) : m_name(name), m_config(config) {} /// /// \brief Destructor diff --git a/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.h b/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.h index 82bfef11ad5c79d92faee6cbc999d45a241ddfab..aec820653d16e0e919c90f42f3ad45239b31a19f 100644 --- a/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.h +++ b/Source/SimulationManager/VTKRenderer/imstkOpenVRCommand.h @@ -58,6 +58,6 @@ protected: /// virtual ~OpenVRCommand() = default; - SimulationManager* m_simManager; ///> SimulationManager owning the current simulation being interacted with + SimulationManager* m_simManager = nullptr; ///> SimulationManager owning the current simulation being interacted with }; } // imstk diff --git a/Source/SimulationManager/VTKRenderer/imstkVTKScreenCaptureUtility.h b/Source/SimulationManager/VTKRenderer/imstkVTKScreenCaptureUtility.h index 7f897130d5a66e9512ba4dafba4ca6cd5616e1a6..4caa6718cd5f91a8eb8fec506ab0fc39c7038889 100644 --- a/Source/SimulationManager/VTKRenderer/imstkVTKScreenCaptureUtility.h +++ b/Source/SimulationManager/VTKRenderer/imstkVTKScreenCaptureUtility.h @@ -43,7 +43,7 @@ public: /// /// \brief Constructor /// - VTKScreenCaptureUtility(vtkRenderWindow* const rw, const std::string prefix = "Screenshot-"); + explicit VTKScreenCaptureUtility(vtkRenderWindow* const rw, const std::string prefix = "Screenshot-"); /// /// \brief Destructor diff --git a/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.cpp b/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.cpp index 6b9ed9a8bb07c824b93f7bb554d9584dfd6b56c6..72b9db0224674a99d014c5b558dbc5bad31ccb41 100644 --- a/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.cpp +++ b/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.cpp @@ -121,7 +121,7 @@ VTKTextStatusManager::setFPS(const double visualFPS, const double physicsFPS) } void -VTKTextStatusManager::setCustomStatus(const std::string status) +VTKTextStatusManager::setCustomStatus(const std::string& status) { auto customStatusCoordinate = computeStatusLocation(m_StatusDisplayCorners[StatusType::Custom], m_StatusFontSizes[StatusType::Custom], diff --git a/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.h b/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.h index 2f71ace38bb88aab07832e1216fc10d8e6b11082..1ffcf8aa58a7284d0016eed0b65dcf7e3da80cd9 100644 --- a/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.h +++ b/Source/SimulationManager/VTKRenderer/imstkVTKTextStatusManager.h @@ -64,7 +64,7 @@ public: LowerRight }; - VTKTextStatusManager(VTKInteractorStyle* const vtkInteractorStyle); + explicit VTKTextStatusManager(VTKInteractorStyle* const vtkInteractorStyle); virtual ~VTKTextStatusManager(); /// @@ -103,7 +103,7 @@ public: /// \brief Set custom status text /// The string parameter should be passed by value, not const reference /// - void setCustomStatus(const std::string status); + void setCustomStatus(const std::string& status); /// /// \brief Clear custom status text (and hide it) diff --git a/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleFreeCamera.h b/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleFreeCamera.h index da5537d5ec30cb717669421487eb03e3dc74acb3..d4f4dd2055aaf93038237001146abda0347bec84 100644 --- a/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleFreeCamera.h +++ b/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleFreeCamera.h @@ -54,7 +54,7 @@ public: /// /// \brief Controls camera movement /// - virtual void OnTimer(); + virtual void OnTimer() override; protected: friend class VulkanViewer; diff --git a/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.cpp b/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.cpp index 74723b76f17a5d4fc5c3765d8324a78d40d3dfdf..683c3691b8e17a231abcc7fdfe85646c20dc8e76 100644 --- a/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.cpp +++ b/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.cpp @@ -234,7 +234,7 @@ void VulkanInteractorStyleVR::OnTimer() { vr::VRCompositor()->WaitGetPoses(m_devicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0); - auto scene = m_simManager->getActiveScene(); + //auto scene = m_simManager->getActiveScene(); auto indexHMD = vr::k_unTrackedDeviceIndex_Hmd; auto nameHMD = this->getDeviceID(indexHMD); diff --git a/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.h b/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.h index 8ab1be0611825c219e0f25908e497a5c78520d00..879254c0fe131a7e96a242afa3d1f04acedac439 100644 --- a/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.h +++ b/Source/SimulationManager/VulkanRenderer/imstkVulkanInteractorStyleVR.h @@ -100,7 +100,7 @@ public: /// \brief Update function for VR /// Computes/extracts matrices for devices (HMD, controllers, etc.) /// - virtual void OnTimer(); + virtual void OnTimer() override; protected: friend VulkanViewer; diff --git a/Source/SimulationManager/imstkSceneManager.h b/Source/SimulationManager/imstkSceneManager.h index 2deef4260e17d784d6b1de56a2e924e7df3273c8..c362967b25e4cc52e4af94ff34095fc9890d4ce2 100644 --- a/Source/SimulationManager/imstkSceneManager.h +++ b/Source/SimulationManager/imstkSceneManager.h @@ -41,7 +41,7 @@ public: /// /// \brief Constructor /// - SceneManager(std::shared_ptr<Scene> scene) : + explicit SceneManager(std::shared_ptr<Scene> scene) : Module(scene->getName()), m_scene(scene) {} diff --git a/Source/SimulationManager/imstkScreenCaptureUtility.cpp b/Source/SimulationManager/imstkScreenCaptureUtility.cpp index 893f73222578d9b6da57cbf42be32e0be7a8e371..6dace4e62a89a38c60b22d2cd5d3a0a8273912d2 100644 --- a/Source/SimulationManager/imstkScreenCaptureUtility.cpp +++ b/Source/SimulationManager/imstkScreenCaptureUtility.cpp @@ -32,7 +32,7 @@ ScreenCaptureUtility::getScreenShotNumber() const } void -ScreenCaptureUtility::setScreenShotPrefix(const std::string newPrefix) +ScreenCaptureUtility::setScreenShotPrefix(const std::string& newPrefix) { if (m_screenShotPrefix.compare(newPrefix) != 0) { diff --git a/Source/SimulationManager/imstkScreenCaptureUtility.h b/Source/SimulationManager/imstkScreenCaptureUtility.h index 4b5ba71409de70face45f0ff8d8ff52c97ad90d9..51fd6e273cc82a9689ab7da0a5544fc17d79e85f 100644 --- a/Source/SimulationManager/imstkScreenCaptureUtility.h +++ b/Source/SimulationManager/imstkScreenCaptureUtility.h @@ -45,7 +45,7 @@ public: /// /// \brief set/reset the prefix amd the count numbers - void setScreenShotPrefix(const std::string newPrefix); + void setScreenShotPrefix(const std::string& newPrefix); /// /// \brief reset the screenshot number indicator @@ -62,7 +62,7 @@ protected: /// ~ScreenCaptureUtility() = default; - unsigned int m_screenShotNumber; //> screen shot number is added to the file prefix, and incremented everytime a screen shot is taken - std::string m_screenShotPrefix; //> the prefix for the screenshots to be saved + unsigned int m_screenShotNumber = 0; //> screen shot number is added to the file prefix, and incremented everytime a screen shot is taken + std::string m_screenShotPrefix; //> the prefix for the screenshots to be saved }; } // imstk diff --git a/Source/SimulationManager/imstkSimulationManager.cpp b/Source/SimulationManager/imstkSimulationManager.cpp index 8e7a1cc9a0653c64ad4ba75ec094f941620821df..411be1450209068695eaf61edb7917e7895052df 100644 --- a/Source/SimulationManager/imstkSimulationManager.cpp +++ b/Source/SimulationManager/imstkSimulationManager.cpp @@ -29,11 +29,8 @@ namespace imstk { -SimulationManager::SimulationManager(const std::shared_ptr<simManagerConfig> config) +SimulationManager::SimulationManager(const std::shared_ptr<simManagerConfig> config) : m_config(config) { - // set the configuration - m_config = config; - // Initialize the logger m_logUtil->createLogger(m_config->logFilePrefix, m_config->logPath); diff --git a/Source/Solvers/imstkConjugateGradient.cpp b/Source/Solvers/imstkConjugateGradient.cpp index 5811e31feb6a47d7a3e752148f86b032fd6353d3..bc89030b5b4d5224e8696fd42a3d2b50e49200a7 100644 --- a/Source/Solvers/imstkConjugateGradient.cpp +++ b/Source/Solvers/imstkConjugateGradient.cpp @@ -102,13 +102,11 @@ ConjugateGradient::modifiedCGSolve(Vectord& x) { applyLinearProjectionFilter(res, *m_FixedLinearProjConstraints, false); } - auto c = res; - auto delta = res.dot(res); - auto deltaPrev = delta; - const auto eps = m_tolerance * m_tolerance * delta; - double alpha = 0.0; - double dotval; - auto q = Vectord(b.size()).setZero(); + auto c = res; + auto delta = res.dot(res); + const auto eps = m_tolerance * m_tolerance * delta; + double alpha = 0.0; + Vectord q; size_t iterNum = 0; while (delta > eps) @@ -122,7 +120,7 @@ ConjugateGradient::modifiedCGSolve(Vectord& x) { applyLinearProjectionFilter(q, *m_FixedLinearProjConstraints, false); } - dotval = c.dot(q); + double dotval = c.dot(q); if (dotval != 0.0) { alpha = delta / dotval; @@ -132,12 +130,12 @@ ConjugateGradient::modifiedCGSolve(Vectord& x) LOG(WARNING) << "ConjugateGradient::modifiedCGSolve: deniminator zero. Terminating MCG iteation!"; return; } - x += alpha * c; - res -= alpha * q; - deltaPrev = delta; - delta = res.dot(res); - c *= delta / deltaPrev; - c += res; + x += alpha * c; + res -= alpha * q; + const double deltaPrev = delta; + delta = res.dot(res); + c *= delta / deltaPrev; + c += res; if (m_DynamicLinearProjConstraints) { applyLinearProjectionFilter(c, *m_DynamicLinearProjConstraints, false); diff --git a/Source/Solvers/imstkDirectLinearSolver.h b/Source/Solvers/imstkDirectLinearSolver.h index b3d70a0b245333ad552162b7916791885a2468ef..848fd52bf19692657ee8b89bda0982f476ffb24c 100644 --- a/Source/Solvers/imstkDirectLinearSolver.h +++ b/Source/Solvers/imstkDirectLinearSolver.h @@ -72,7 +72,7 @@ public: /// /// \brief Returns true if the solver is iterative /// - bool isIterative() const + bool isIterative() const override { return false; }; diff --git a/Source/Solvers/imstkIterativeLinearSolver.h b/Source/Solvers/imstkIterativeLinearSolver.h index abd69933df28673600c26c2ebae4c2bb8cda3cd1..89d22be6fd37e932ab8eff9202418096fa752ddf 100644 --- a/Source/Solvers/imstkIterativeLinearSolver.h +++ b/Source/Solvers/imstkIterativeLinearSolver.h @@ -68,7 +68,7 @@ public: /// /// \brief Solve the linear system using Gauss-Seidel iterations. /// - virtual void solve(Vectord& x); + virtual void solve(Vectord& x) override; /// /// \brief Returns true if the solver is iterative diff --git a/Source/Solvers/imstkNewtonSolver.cpp b/Source/Solvers/imstkNewtonSolver.cpp index b3468f991d559c0678a9ce71d31a942764a0af5f..3cf60fb5760d0c7db9150f223888a423d9392d32 100644 --- a/Source/Solvers/imstkNewtonSolver.cpp +++ b/Source/Solvers/imstkNewtonSolver.cpp @@ -66,9 +66,7 @@ NewtonSolver::solveGivenState(Vectord& x) m_linearSolver->solve(dx); m_updateIterate(-dx, x); - double newNorm = fnorm; - - newNorm = this->armijo(dx, x, fnorm); + double newNorm = this->armijo(dx, x, fnorm); if (m_forcingTerm > 0.0 && newNorm > stopTolerance) { @@ -93,15 +91,15 @@ NewtonSolver::solve() return; } - size_t iterNum; - auto& u = m_nonLinearSystem->getUnknownVector(); - Vectord du = u; // make this a class member in future + size_t iterNum; + const auto& u = m_nonLinearSystem->getUnknownVector(); + Vectord du = u; // make this a class member in future - double error0 = MAX_D, error = MAX_D; double epsilon = m_relativeTolerance * m_relativeTolerance; for (iterNum = 0; iterNum < m_maxIterations; ++iterNum) { - error = updateJacobian(u); + double error0 = MAX_D; + double error = updateJacobian(u); if (iterNum == 0) { diff --git a/Source/Solvers/imstkNonLinearSolver.cpp b/Source/Solvers/imstkNonLinearSolver.cpp index 220a29220105f7798ef22dd2e2434c5ae718106a..efad583aba8c50c47e9cfbcf16f19054e04e2c60 100644 --- a/Source/Solvers/imstkNonLinearSolver.cpp +++ b/Source/Solvers/imstkNonLinearSolver.cpp @@ -60,7 +60,7 @@ NonLinearSolver::armijo(const Vectord& dx, Vectord& x, const double previousFnor } // Save iterate in case this fails - auto x_old = x; + //auto x_old = x; // Starts Armijo line search loop size_t i; diff --git a/Source/Solvers/imstkNonLinearSolver.h b/Source/Solvers/imstkNonLinearSolver.h index 3de7c1b4fae6784f7874007d7e18262f6443ee36..05c2ea9604bb521074b48c2b2020c6fd10e254f0 100644 --- a/Source/Solvers/imstkNonLinearSolver.h +++ b/Source/Solvers/imstkNonLinearSolver.h @@ -53,7 +53,7 @@ public: /// \brief Main solve routine. /// virtual void solveGivenState(Vectord& x) = 0; - virtual void solve() = 0; + virtual void solve() override = 0; /// /// \brief Backtracking line search method based on the Armijo-Goldstein condition diff --git a/Source/Solvers/imstkNonlinearSystem.cpp b/Source/Solvers/imstkNonlinearSystem.cpp index 133f4c9faf5374434f0bc0ee97acf58910acf2e2..8da916dd00e427f72673dbe9523a2e453e114d26 100644 --- a/Source/Solvers/imstkNonlinearSystem.cpp +++ b/Source/Solvers/imstkNonlinearSystem.cpp @@ -25,10 +25,8 @@ namespace imstk { -NonLinearSystem::NonLinearSystem(const VectorFunctionType& F, const MatrixFunctionType& dF) +NonLinearSystem::NonLinearSystem(const VectorFunctionType& F, const MatrixFunctionType& dF) : m_F(F), m_dF(dF) { - m_F = F; - m_dF = dF; } void diff --git a/Source/Solvers/imstkNonlinearSystem.h b/Source/Solvers/imstkNonlinearSystem.h index 85e104b54ed722052b3c3c7dbf762f0939f0796a..bbe8368da5231218c4aa0c2fd487e6599395ca70 100644 --- a/Source/Solvers/imstkNonlinearSystem.h +++ b/Source/Solvers/imstkNonlinearSystem.h @@ -134,7 +134,7 @@ public: public: VectorFunctionType m_F; ///> Nonlinear function MatrixFunctionType m_dF; ///> Gradient of the Nonlinear function with respect to the unknown vector - Vectord* m_unknown; + Vectord* m_unknown = nullptr; UpdateFunctionType m_FUpdate; UpdatePrevStateFunctionType m_FUpdatePrevState; diff --git a/Source/apiUtilities/imstkAPIUtilities.h b/Source/apiUtilities/imstkAPIUtilities.h index 4f7d072c9ef68f58049b85e8a383ab6769c622be..0bfb62dc0280fe27e6665629850d7ffa32ec1db2 100644 --- a/Source/apiUtilities/imstkAPIUtilities.h +++ b/Source/apiUtilities/imstkAPIUtilities.h @@ -56,7 +56,7 @@ namespace apiutils std::shared_ptr<VisualObject> createVisualAnalyticalSceneObject(Geometry::Type type, std::shared_ptr<Scene> scene, - const std::string objName, + const std::string& objName, const double scale = 1., const Vec3d t = Vec3d(0., 0., 0.)) { @@ -107,7 +107,7 @@ createVisualAnalyticalSceneObject(Geometry::Type type, std::shared_ptr<CollidingObject> createCollidingAnalyticalSceneObject(Geometry::Type type, std::shared_ptr<Scene> scene, - const std::string objName, + const std::string& objName, const double scale = 1., const Vec3d t = Vec3d(0., 0., 0.)) { @@ -150,8 +150,8 @@ createCollidingAnalyticalSceneObject(Geometry::Type type, /// std::shared_ptr<SceneObject> createAndAddVisualSceneObject(std::shared_ptr<Scene> scene, - const std::string fileName, - const std::string objectName) + const std::string& fileName, + const std::string& objectName) { CHECK(scene != nullptr) << "createAndAddVisualSceneObject: Scene is not valid!"; CHECK(!fileName.empty()) << "createAndAddVisualSceneObject: Name is empty!";