diff --git a/Core/DataStructures.hpp b/Core/DataStructures.hpp index 55e6ca088d4ca96f216fbb2af875d7071add8c2f..f33235b03a40d80c2c14cc6812bbf069e94f2e77 100644 --- a/Core/DataStructures.hpp +++ b/Core/DataStructures.hpp @@ -28,14 +28,14 @@ template<typename T> EntryList<T>::EntryList() { totalEntries = 0; - p_entry = NULL; + p_entry = nullptr; } template<typename T> HashIterator<T>::HashIterator() { tableIndex = 0; currentIndex = 0; - bucketStart = NULL; + bucketStart = nullptr; } template<typename T> void HashIterator<T>::clone( HashIterator<T> &p_iterator ) @@ -87,7 +87,7 @@ bool Hash<T>::findandUpdateEntry( EntryList<T> &p_startEntry, T &p_prim ) while ( true ) { - if ( currentBucket == NULL ) + if ( currentBucket == nullptr ) { return false; } @@ -111,7 +111,7 @@ void Hash<T>::clearBuckets( EntryList<T> &p_startEntry ) while ( true ) { - if ( currentBucket == NULL ) + if ( currentBucket == nullptr ) { return; } @@ -134,18 +134,18 @@ SIMMEDTK_HASHRETURN_CODES Hash<T>::insert( T p_triangle, unsigned int hashIndex { EntryList<T> *currentBucket; EntryList<T> *prevBucket; - EntryList<T> *emptySpace = NULL; + EntryList<T> *emptySpace = nullptr; prevBucket = &primitiveIDs[hashIndex]; currentBucket = &primitiveIDs[hashIndex]; while ( true ) { - if ( currentBucket == NULL ) + if ( currentBucket == nullptr ) { break; } - if ( emptySpace == NULL && currentBucket->totalEntries < SIMMEDTK_HASHBUCKET_SIZE ) + if ( emptySpace == nullptr && currentBucket->totalEntries < SIMMEDTK_HASHBUCKET_SIZE ) { emptySpace = currentBucket; break; @@ -155,7 +155,7 @@ SIMMEDTK_HASHRETURN_CODES Hash<T>::insert( T p_triangle, unsigned int hashIndex currentBucket = currentBucket->p_entry; } - if ( currentBucket == NULL && emptySpace == NULL ) + if ( currentBucket == nullptr && emptySpace == nullptr ) { prevBucket->p_entry = new EntryList<T>; prevBucket->p_entry->ID[prevBucket->p_entry->totalEntries] = p_triangle; @@ -177,13 +177,13 @@ SIMMEDTK_HASHRETURN_CODES Hash<T>::checkAndInsert( T p_triangle, unsigned int ha { EntryList<T> *currentBucket; EntryList<T> *prevBucket; - EntryList<T> *emptySpace = NULL; + EntryList<T> *emptySpace = nullptr; prevBucket = &primitiveIDs[hashIndex]; currentBucket = &primitiveIDs[hashIndex]; while ( true ) { - if ( currentBucket == NULL ) + if ( currentBucket == nullptr ) { break; } @@ -193,7 +193,7 @@ SIMMEDTK_HASHRETURN_CODES Hash<T>::checkAndInsert( T p_triangle, unsigned int ha return SIMMEDTK_HASH_ENTRYALREADYEXISTS; } - if ( emptySpace == NULL && currentBucket->totalEntries < SIMMEDTK_HASHBUCKET_SIZE ) + if ( emptySpace == nullptr && currentBucket->totalEntries < SIMMEDTK_HASHBUCKET_SIZE ) { emptySpace = currentBucket; break; @@ -203,7 +203,7 @@ SIMMEDTK_HASHRETURN_CODES Hash<T>::checkAndInsert( T p_triangle, unsigned int ha currentBucket = currentBucket->p_entry; } - if ( currentBucket == NULL && emptySpace == NULL ) + if ( currentBucket == nullptr && emptySpace == nullptr ) { prevBucket->p_entry = new EntryList<T>; prevBucket->p_entry->ID[prevBucket->p_entry->totalEntries] = p_triangle; @@ -246,7 +246,7 @@ bool Hash<T>::nextBucketItem( HashIterator<T> &p_iterator, T &p_prim ) { while ( true ) { - if ( p_iterator.iterator == NULL ) + if ( p_iterator.iterator == nullptr ) { p_iterator.currentIndex = 0; return false; @@ -278,7 +278,7 @@ bool Hash<T>::next( T &p_prim ) return false; } - if ( currentIterationBucket == NULL ) + if ( currentIterationBucket == nullptr ) { currentTableIndex++; currentEntryIndex = 0; @@ -313,7 +313,7 @@ bool Hash<T>::nextByRef( T **p_prim ) return false; } - if ( currentIterationBucket == NULL ) + if ( currentIterationBucket == nullptr ) { currentTableIndex++; currentEntryIndex = 0; diff --git a/Core/Factory.hpp b/Core/Factory.hpp index e615ef8f75745ac16c128521bfdb68d1d04ce4ee..77f666e16b036977e081529b42c4336725859235 100644 --- a/Core/Factory.hpp +++ b/Core/Factory.hpp @@ -118,6 +118,6 @@ std::shared_ptr<T> Factory<T>::createSubclassForGroup( /// Class-static map from abstract class names to registered concrete children. template<typename T> -std::map<std::string, typename Factory<T>::FactoryConfigurationOptions>* Factory<T>::s_catalog = NULL; +std::map<std::string, typename Factory<T>::FactoryConfigurationOptions>* Factory<T>::s_catalog = nullptr; #endif // SMFACTORY_HPP diff --git a/Core/Simulator.cpp b/Core/Simulator.cpp index 8e82556511d767ca8853b972c02bf0128d05bed9..d9cc60e5234bc14d6718473d24a2c766fcddd297 100644 --- a/Core/Simulator.cpp +++ b/Core/Simulator.cpp @@ -88,7 +88,7 @@ void Simulator::run() { beginModule(); - if (main != NULL) + if (main != nullptr) { main->simulateMain(param); } diff --git a/Core/UnitTests/Factory.cpp b/Core/UnitTests/Factory.cpp index c6b221c9a1df4a08587bd781a6c72ca27f314064..a026be9bf8567e9634a89f92266e25f7e9e9af9e 100644 --- a/Core/UnitTests/Factory.cpp +++ b/Core/UnitTests/Factory.cpp @@ -39,19 +39,19 @@ go_bandit([](){ AssertThat(Factory<CoreClass>::optionsForClass("abstract").size(), Equals(2)); }); - it("creates a non-NULL default class instance", [&]() { + it("creates a non-nullptr default class instance", [&]() { AssertThat(!!Factory<CoreClass>::createDefault("abstract").get(), IsTrue()); }); - it("creates the *proper* non-NULL default class instance", [&]() { + it("creates the *proper* non-nullptr default class instance", [&]() { AssertThat(Factory<CoreClass>::createDefaultAs<abstract>("abstract")->stupid()[0], Equals('A')); }); - it("creates the proper non-NULL *specified group* class instance", [&]() { + it("creates the proper non-nullptr *specified group* class instance", [&]() { AssertThat(Factory<CoreClass>::createSubclassForGroupAs<abstract>("abstract", 66)->stupid()[0], Equals('B')); }); - it("creates a non-NULL instance given only a concrete class name", [&]() { + it("creates a non-nullptr instance given only a concrete class name", [&]() { AssertThat(Factory<CoreClass>::createConcreteClassAs<A>("A")->stupid()[0], Equals('A')); }); diff --git a/Core/ViewerBase.cpp b/Core/ViewerBase.cpp index a1d892723070feb8076254f12900757e005a086e..db2e9d6ddbe2976d2f3dce587038004e6a61dd2a 100644 --- a/Core/ViewerBase.cpp +++ b/Core/ViewerBase.cpp @@ -43,7 +43,7 @@ ViewerBase::ViewerBase() defaultDiffuseColor.setValue(0.8, 0.8, 0.8, 1.0); defaultSpecularColor.setValue(0.9, 0.9, 0.9, 1.0); - this->log = NULL; + this->log = nullptr; this->globalAxisLength = 1.0; @@ -94,7 +94,7 @@ void ViewerBase::initScenes() for (auto sceneObject: sceneLocal.sceneObjects) { //initialize the custom Render if there is any - if ( sceneObject->customRender != NULL && sceneObject->getType() != core::ClassType::Shader ) + if ( sceneObject->customRender != nullptr && sceneObject->getType() != core::ClassType::Shader ) { sceneObject->customRender->initDraw(); } diff --git a/Core/WorkerThread.h b/Core/WorkerThread.h index 91c7c6837ca82e19f6e13225509e2bb27ad57395..de9b8a02783c114177488e0aef3ad3386bb41429 100644 --- a/Core/WorkerThread.h +++ b/Core/WorkerThread.h @@ -59,7 +59,7 @@ public: ProcessID() { x = y = z = totalProcX = totalProcY = totalProcZ = sizeOfData = 0; - data = NULL; + data = nullptr; numbScheme = ProcessNumbering::X; } @@ -97,7 +97,7 @@ public: id.totalProcX = 0; id.totalProcY = 0; id.totalProcZ = 0; - id.data = NULL; + id.data = nullptr; id.sizeOfData = 0; id.numbScheme = ProcessID::ProcessNumbering::X; termination = false; diff --git a/Devices/NIDAQmx.h b/Devices/NIDAQmx.h index 2f8506fc1094038b9742229375feb0e55b5754f9..0826bc0ce5bffcfb3eff8713d24b6c14a1270c2d 100644 --- a/Devices/NIDAQmx.h +++ b/Devices/NIDAQmx.h @@ -97,8 +97,8 @@ typedef uInt32 CalHandle; #ifndef FALSE #define FALSE (0L) #endif -#ifndef NULL -#define NULL (0L) +#ifndef nullptr +#define nullptr (0L) #endif diff --git a/Devices/NIUSB6008Interface.cpp b/Devices/NIUSB6008Interface.cpp index 61ca8af713b761e4139fe60e030e854e9c7b4c69..f1e8b44b66cbce97b7924e1043becaebaf51839c 100644 --- a/Devices/NIUSB6008Interface.cpp +++ b/Devices/NIUSB6008Interface.cpp @@ -72,39 +72,39 @@ NIUSB6008Interface::NIUSB6008Interface(int VBLaST_Task_ID) { case 1: // peg transfer: dissect, dissect //0 1 - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai1", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai1", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); break; case 2: // pattern cutting: dissect, shear //0 2 - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); break; case 3: // ligating loop: ligating loop, shear, grasper //2 3 4 - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai3", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai4", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai3", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai4", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); break; case 4: // intracorporeal suturing: needle driver, needle driver // 5 6 - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai5", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai6", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai5", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai6", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); break; case 5: // extracorporeal suturing: needle driver, needle driver, knot pusher // 5 6 7 - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai5", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai6", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai7", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); //DAQmx_Val_Cfg_Default + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai5", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai6", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai7", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); //DAQmx_Val_Cfg_Default break; case 6: - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); // stapler - initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai3", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL)); //grasper + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); // stapler + initNI_Error(DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai3", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, nullptr)); //grasper default: break; @@ -148,7 +148,7 @@ void NIUSB6008Interface::getToolCalibrationData() FILE *fp_cali; fp_cali = fopen("config/toolCalibrationNIUSB6008.txt", "r"); - if (NULL == fp_cali) + if (nullptr == fp_cali) { printf("NI DAQ USB-6008 configuration file not found: config/toolCalibrationNIUSB6008.txt"); assert(fp_cali); @@ -190,7 +190,7 @@ void NIUSB6008Interface::setTool() FILE *fp; fp = fopen("config/toolSetting.txt", "r"); - if (NULL == fp) + if (nullptr == fp) { printf("Tool settings file not found: config/toolSetting.txt"); assert(fp); @@ -388,10 +388,10 @@ int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEvent if (NIUSB6008Interface->taskID == 1 || NIUSB6008Interface->taskID == 2 || NIUSB6008Interface->taskID == 4 || NIUSB6008Interface->taskID == 6) { - DAQmxErrChk(DAQmxReadAnalogF64(taskHandle, 10, 10.0, DAQmx_Val_GroupByChannel, NIUSB6008Interface->sampdata, 20, &read, NULL)); + DAQmxErrChk(DAQmxReadAnalogF64(taskHandle, 10, 10.0, DAQmx_Val_GroupByChannel, NIUSB6008Interface->sampdata, 20, &read, nullptr)); } - DAQmxErrChk(DAQmxReadAnalogF64(taskHandle, 10, 10.0, DAQmx_Val_GroupByChannel, NIUSB6008Interface->sampdata, 10 * NIUSB6008Interface->nbrActiveChannel, &read, NULL)); + DAQmxErrChk(DAQmxReadAnalogF64(taskHandle, 10, 10.0, DAQmx_Val_GroupByChannel, NIUSB6008Interface->sampdata, 10 * NIUSB6008Interface->nbrActiveChannel, &read, nullptr)); if (read > 0) { diff --git a/Examples/AlphaMap/AlphaMappingExample.cpp b/Examples/AlphaMap/AlphaMappingExample.cpp index 898390782b622fb4877ddcd3fd246b319afd701d..4ba8a18ffa0e1f8a8eca57a72751e6dbb17e22b4 100644 --- a/Examples/AlphaMap/AlphaMappingExample.cpp +++ b/Examples/AlphaMap/AlphaMappingExample.cpp @@ -47,8 +47,8 @@ void AlphaMapExample::initHapticCamMotion() AlphaMapExample::AlphaMapExample() { - motionTrans = NULL; - hapticInterface = NULL; + motionTrans = nullptr; + hapticInterface = nullptr; simmedtkSDK = SDK::createSDK(); object1 = new StaticSceneObject(); @@ -61,7 +61,7 @@ AlphaMapExample::AlphaMapExample() // TCHAR szEXEPath[2048]; - // cout << GetModuleFileName ( NULL, szEXEPath, 2048 ); + // cout << GetModuleFileName ( nullptr, szEXEPath, 2048 ); @@ -115,12 +115,12 @@ AlphaMapExample::~AlphaMapExample() delete object1; delete scene1; - if (motionTrans != NULL) + if (motionTrans != nullptr) { delete motionTrans; } - if (hapticInterface != NULL) + if (hapticInterface != nullptr) { delete hapticInterface; } diff --git a/Mesh/Mesh.cpp b/Mesh/Mesh.cpp index 628b95c06f8524ea07305e1bb5046d12a85e49f4..f4234d7a2fdb71f7d8d678bfbda5acf556e84dba 100644 --- a/Mesh/Mesh.cpp +++ b/Mesh/Mesh.cpp @@ -672,10 +672,10 @@ LineMesh::LineMesh( int p_nbrVertices, bool autoEdge ) : BaseMesh() texCoord = new TexCoord[nbrVertices]; /// Edge AABB should be assigned by the instance - edgeAABBs = NULL; + edgeAABBs = nullptr; /// Edges should be assigned by the instance - edges = NULL; + edges = nullptr; /// Number of edges should be assigned by the instance nbrEdges = 0; diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 58ca6cc9ebbd173eb6a7be1bcf43a4dd46c1f8d3..3fa4b1f6e957576db9129546f0f9d0274dcfc1e0 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -230,7 +230,7 @@ public: ///AABBB of the mesh. ///This value is allocated and computed by only collision detection module - ///Therefore it is initially NULL + ///Therefore it is initially nullptr std::vector<AABB> triAABBs; MeshType meshType; ///< type of mesh (rigid, deformable etc.) diff --git a/Mesh/SurfaceMesh.cpp b/Mesh/SurfaceMesh.cpp index 20c59747370a0e42627aa2edb59d901c5719ef7c..fa6ce211ccbd07a84673d4732ff5e578127bc8c9 100644 --- a/Mesh/SurfaceMesh.cpp +++ b/Mesh/SurfaceMesh.cpp @@ -80,7 +80,7 @@ bool SurfaceMesh::loadMesh(const std::string& fileName, const MeshFileType &file break; default: - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Mesh file TYPE UNIDENTIFIED"); } @@ -92,7 +92,7 @@ bool SurfaceMesh::loadMesh(const std::string& fileName, const MeshFileType &file if (ret == false) { - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Mesh file NOT FOUND"); } @@ -131,7 +131,7 @@ bool SurfaceMesh::loadMeshLegacy(const std::string& fileName, const MeshFileType break; default: - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Mesh file TYPE UNIDENTIFIED"); } @@ -144,7 +144,7 @@ bool SurfaceMesh::loadMeshLegacy(const std::string& fileName, const MeshFileType if (ret == false) { - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Mesh file NOT FOUND"); } @@ -185,9 +185,9 @@ bool SurfaceMesh::LoadMeshAssimp(const std::string& fileName) aiProcess_RemoveComponent | //Removes the components in AI_CONFIG_PP_RVC_FLAGS aiProcess_ImproveCacheLocality); //Reorders triangles for better vertex cache locality - if (scene == NULL) + if (scene == nullptr) { - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Error loading mesh: " + std::string(fileName)); } @@ -225,7 +225,7 @@ bool SurfaceMesh::LoadMeshAssimp(const std::string& fileName) //Assimp supports 3D texture coords, but we only support 2D if (mesh->mNumUVComponents[0] != 2) { - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Error loading mesh, non-two dimensional texture coordinate found."); } @@ -247,7 +247,7 @@ bool SurfaceMesh::LoadMeshAssimp(const std::string& fileName) { if (mesh->mFaces[i].mNumIndices != 3) //Make sure that the face is triangular { - if (log_SF != NULL) + if (log_SF != nullptr) { log_SF->addError("Error: Error loading mesh, non-triangular face found."); } @@ -276,7 +276,7 @@ bool SurfaceMesh::Load3dsMesh(const std::string& fileName) unsigned short temp; char l_char; - if ((l_file = fopen(fileName.c_str(), "rb")) == NULL) //Open the file + if ((l_file = fopen(fileName.c_str(), "rb")) == nullptr) //Open the file { return 0; } diff --git a/Mesh/VegaSceneObject.cpp b/Mesh/VegaSceneObject.cpp index 716cd5f8cb9b09c602c55200273a19cc9e7bf3ae..3f5f6fa165831677710860286efe5d0669f4c316 100644 --- a/Mesh/VegaSceneObject.cpp +++ b/Mesh/VegaSceneObject.cpp @@ -8,7 +8,7 @@ #include <float.h> VegaSceneObject::VegaSceneObject(char * filename): - mesh(NULL) + mesh(nullptr) { int verbose = 0; if (filename && filename[0]) @@ -90,7 +90,7 @@ void VegaSceneObject::ComputeMeshRadius(Vec3d & centroid, double * radius) void VegaSceneObject::ExportMeshGeometry(int * numVertices, double ** vertices, int * numTriangles, int ** triangles) { - mesh->exportGeometry(numVertices, vertices, numTriangles, triangles, NULL, NULL); + mesh->exportGeometry(numVertices, vertices, numTriangles, triangles, nullptr, nullptr); } void VegaSceneObject::TransformRigidly(double * centerOfMass, double * R) diff --git a/Mesh/VegaSceneObject.h b/Mesh/VegaSceneObject.h index 34068945185cfc331fddf11030bc0efc27f9959a..a1a46175a81e360ee541255847b9b0fd3e814d6b 100644 --- a/Mesh/VegaSceneObject.h +++ b/Mesh/VegaSceneObject.h @@ -40,9 +40,9 @@ public: void ExportMeshGeometry(int * numVertices, double ** vertices, int * numTriangles, int ** triangles); // finds the closest vertex using an exhaustive search - // returns distance in "distance", if distance is not NULL - // in this class, you can safely ignore the last parameter (keep it NULL) - virtual int GetClosestVertex(Vec3d & queryPos, double * distance=NULL, double * auxVertexBuffer=NULL); + // returns distance in "distance", if distance is not nullptr + // in this class, you can safely ignore the last parameter (keep it nullptr) + virtual int GetClosestVertex(Vec3d & queryPos, double * distance=nullptr, double * auxVertexBuffer=nullptr); // ==== normals ==== diff --git a/Rendering/FrameBuffer.cpp b/Rendering/FrameBuffer.cpp index 4fc13ab31f68e3a1b9e2dbb9996031746d9fe115..a98a6fc18f09aa3b5190ffcee7f38a143cdd2840 100644 --- a/Rendering/FrameBuffer.cpp +++ b/Rendering/FrameBuffer.cpp @@ -215,7 +215,7 @@ FrameBuffer::FrameBuffer() isDepthTexAttached = false; renderDepthBuff = false; renderColorBuff = false; - renderBuffer = NULL; + renderBuffer = nullptr; } void FrameBuffer::setDim( int p_width, int p_height ) { @@ -239,7 +239,7 @@ void FrameBuffer::attachRenderBuffer( RenderBuffer *p_renderBuf ) } void FrameBuffer::attachDepthTexture( Texture *p_texture ) { - if ( p_texture == NULL ) + if ( p_texture == nullptr ) { std::cout << "Error in frambuffer depth attachment" << "\n"; } diff --git a/Rendering/GLUtils.cpp b/Rendering/GLUtils.cpp index 39be9c80c8add4ede18f8a19164e0bd7303db61a..f4cbe843a112b566924d4a97ea4d04ae8769a3f9 100644 --- a/Rendering/GLUtils.cpp +++ b/Rendering/GLUtils.cpp @@ -29,7 +29,7 @@ #endif ///checks the openGL error. if there is an error then it returns -///the error text otherwise it returns NULL +///the error text otherwise it returns nullptr bool GLUtils::queryGLError(std::string& err) { GLenum errCode; diff --git a/Rendering/GLUtils.h b/Rendering/GLUtils.h index 2030614a537a7e14f4549bcc93708c727fd82e8a..0f5a97a345218eaa0d3f0ad77e879d7397e32f9a 100644 --- a/Rendering/GLUtils.h +++ b/Rendering/GLUtils.h @@ -54,7 +54,7 @@ public: public: /// \brief checks the openGL error. if there is an error then it returns - /// \brief the error text otherwise it returns NULL + /// \brief the error text otherwise it returns nullptr static bool queryGLError(std::string& err); /// \brief taken from glProgramming.com. Checks the extension. diff --git a/Rendering/MetalShader.cpp b/Rendering/MetalShader.cpp index fe86265c4cf21721dbc1f5fc1b4562b9af48bd9b..d9f7e781ad9a029b5c7d7666162e9f0edbe3bf8b 100644 --- a/Rendering/MetalShader.cpp +++ b/Rendering/MetalShader.cpp @@ -34,7 +34,7 @@ MetalShader::MetalShader( const std::string &p_verteShaderFileName, this->log = SDK::getInstance()->getErrorLog(); this->log->isOutputtoConsoleEnabled = false; this->checkErrorEnabled = true; - setShaderFileName( p_verteShaderFileName, NULL, p_fragmentFileName ); + setShaderFileName( p_verteShaderFileName, nullptr, p_fragmentFileName ); createParam( "DecalTex" ); createParam( "BumpTex" ); createParam( "SpecularTex" ); diff --git a/Rendering/Shader.cpp b/Rendering/Shader.cpp index 83b08aa392ce6f5d56e6551b526af87886aff302..c371ddbb7260b943f8cff1bf26aa67a2112b2100 100644 --- a/Rendering/Shader.cpp +++ b/Rendering/Shader.cpp @@ -113,14 +113,14 @@ bool Shader::readShaderContent(const std::string& p_file, std::string& p_content } ///this function gets the vertex,fragment and geometry shader fileNames respectively. if you don't use -/// one of them just simply send NULL pointer as a parameter. +/// one of them just simply send nullptr pointer as a parameter. bool Shader::initShaders(const std::string& p_vertexProgFileName, const std::string& p_fragmentProgFileName, const std::string& p_geometryProgFileName) { if (glewIsSupported("GL_VERSION_2_0") == GL_FALSE) { - if (log != NULL) + if (log != nullptr) { log->addError("Shader:OpenGL 2.0 not supported"); } @@ -220,7 +220,7 @@ void Shader::createShaderGLSL(GLhandleARB &p_shaderObject, { const char *shaderSrc = p_shaderContent.data(); p_shaderObject = glCreateShader(p_shaderType); - glShaderSource(p_shaderObject, 1, &shaderSrc, NULL); + glShaderSource(p_shaderObject, 1, &shaderSrc, nullptr); glCompileShader(p_shaderObject); printInfoLog(p_shaderObject); checkGLError(); @@ -250,7 +250,7 @@ void Shader::reloadShaderGLSL(const GLhandleARB p_shaderObject, const std::string& p_shaderContent) { const char *shaderSrc = p_shaderContent.data(); - glShaderSource(p_shaderObject, 1, &shaderSrc, NULL); + glShaderSource(p_shaderObject, 1, &shaderSrc, nullptr); glCompileShader(p_shaderObject); checkGLError(); } @@ -278,7 +278,7 @@ bool Shader::checkGLError() { if (GLUtils::queryGLError(errorText)) { - if (log != NULL) + if (log != nullptr) { log->addError(errorText); } @@ -355,7 +355,7 @@ void Shader::restoreAndEnableCurrent() #ifdef SIMMEDTK_OPENGL_SHADER - if (Shader::savedShader != NULL) + if (Shader::savedShader != nullptr) { Shader::currentShader = Shader::savedShader; @@ -387,7 +387,7 @@ void Shader::saveAndDisableCurrent() #ifdef SIMMEDTK_OPENGL_SHADER - if (currentShader != NULL) + if (currentShader != nullptr) { if (Shader::currentShader->vertexProgramExist) { diff --git a/Rendering/VAO.cpp b/Rendering/VAO.cpp index 0e14c8fa84b525e96259be0264636b075c99e7e8..9880bf06f00336a37b8eaf1da8dedf17bbf751c5 100644 --- a/Rendering/VAO.cpp +++ b/Rendering/VAO.cpp @@ -178,7 +178,7 @@ VBOBufferEntryInfo::VBOBufferEntryInfo() { shaderAttribLocation = -1; attributeIndex = 1; - attribPointer = NULL; + attribPointer = nullptr; nbrElements = 0; arrayBufferType = SMVBO_POS; } @@ -231,7 +231,7 @@ void VAO::setTriangleInfo( std::string p_ShaderAttribName, int p_nbrTriangles, v } bool VAO::setBufferDataFromMesh( Mesh *p_mesh, std::shared_ptr<Shader> p_shader, std::string p_POSITIONShaderName, std::string p_NORMALShaderName, std::string p_TEXTURECOORDShaderName, std::string p_TANGENTSName ) { - if ( p_shader == NULL ) + if ( p_shader == nullptr ) { shader = Shader::getShader( p_mesh->getRenderDetail()->shaders[0] ); } diff --git a/Rendering/VBO.cpp b/Rendering/VBO.cpp index ab6e895e9dea8abe4f822d299291b75c3c5083da..08dc1ed8ddb0c8dbd48f3567198757089c5bc0be 100644 --- a/Rendering/VBO.cpp +++ b/Rendering/VBO.cpp @@ -52,7 +52,7 @@ VBOResult VBO::updateVertices(const core::Vectorf &p_vectors, float *objectBufferPtr = reinterpret_cast<float*>(glMapBufferARB( GL_ARRAY_BUFFER_ARB, GL_READ_WRITE_ARB)) + dataOffsetMap[p_objectId]; - if (objectBufferPtr == NULL) + if (objectBufferPtr == nullptr) { log->addError("VBO could not map the buffer"); renderingError = true; @@ -94,7 +94,7 @@ VBOResult VBO::updateTriangleIndices(const Vector<size_t> &p_indices, size_t p_o float *objectBufferPtr = reinterpret_cast<float*>(glMapBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, GL_READ_WRITE_ARB)) + indexOffsetMap[p_objectId]; - if (objectBufferPtr == NULL) + if (objectBufferPtr == nullptr) { log->addError("VBO could not map the buffer"); renderingError = true; diff --git a/Rendering/VBO.h b/Rendering/VBO.h index 1c650b09c0c0a495d3a0771a345a43d633090a5d..67f3238d77e50a435539c0b1ff91c94f1731ffaa 100644 --- a/Rendering/VBO.h +++ b/Rendering/VBO.h @@ -66,7 +66,7 @@ private: bool renderingError; public: - /// \brief constructor. gets error log or NULL + /// \brief constructor. gets error log or nullptr VBO(ErrorLog *p_log); /// \brief init with given VBO type diff --git a/Rendering/Viewer.cpp b/Rendering/Viewer.cpp index 6d2c2705b74e27d835a8633c7b05a1d1ed097d90..b5a06bd6e3ff0edbc1cdd405350361710292c723 100644 --- a/Rendering/Viewer.cpp +++ b/Rendering/Viewer.cpp @@ -241,7 +241,7 @@ void Viewer::destroyFboListItems() if (fboListItems[i].fbo) { delete (fboListItems[i].fbo); - fboListItems[i].fbo = NULL; + fboListItems[i].fbo = nullptr; } } } diff --git a/Simulators/MyStylus.cpp b/Simulators/MyStylus.cpp index c424dfe42dccc8dbab9768a903552344461752d3..d277f5f28b49de289e1fdaf9756ac2a7527c2e32 100644 --- a/Simulators/MyStylus.cpp +++ b/Simulators/MyStylus.cpp @@ -38,19 +38,19 @@ MyStylus::MyStylus(const std::string& p_shaft, const std::string& p_lower, const angle = 0; Matrix33d rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitX()).matrix(); - SurfaceMesh *mesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + SurfaceMesh *mesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); mesh->loadMesh(p_shaft, BaseMesh::MeshFileType::ThreeDS); mesh->assignTexture("hookCautery"); mesh->scale(core::Vec3d(0.2, 0.2, 0.2)); mesh->rotate(rot); - SurfaceMesh *lowerMesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + SurfaceMesh *lowerMesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); lowerMesh->loadMesh(p_lower, BaseMesh::MeshFileType::ThreeDS); lowerMesh->assignTexture("metal"); lowerMesh->scale(core::Vec3d(0.2, 0.2, 0.2)); lowerMesh->rotate(rot); - SurfaceMesh *upperMesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + SurfaceMesh *upperMesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); upperMesh->loadMesh(p_upper, BaseMesh::MeshFileType::ThreeDS); upperMesh->assignTexture("metal"); upperMesh->scale(core::Vec3d(0.2, 0.2, 0.2)); @@ -186,7 +186,7 @@ HookCautery::HookCautery(const std::string& p_pivot) { Matrix33d rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitX()).matrix(); - SurfaceMesh *mesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + SurfaceMesh *mesh = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); mesh->loadMesh(p_pivot, BaseMesh::MeshFileType::ThreeDS); mesh->assignTexture("metal"); mesh->scale(core::Vec3d(0.2, 0.2, 0.2)); diff --git a/Simulators/StylusObject.cpp b/Simulators/StylusObject.cpp index d1a18fe8b2291db28495ad4ae2c6ecc91b82a108..cee5466cb744388580990469e78a73ad886633a5 100644 --- a/Simulators/StylusObject.cpp +++ b/Simulators/StylusObject.cpp @@ -70,7 +70,7 @@ MeshContainer *StylusRigidSceneObject::getMeshContainer(std::string p_string) co void StylusRigidSceneObject::posTraverseCallBack(MeshContainer &p_container) { - if (p_container.colModel != NULL) + if (p_container.colModel != nullptr) { p_container.colModel->transRot = p_container.currentMatrix; p_container.colModel->translateRot(); @@ -85,8 +85,8 @@ MeshContainer::MeshContainer( std::string p_name ) offsetRotZ = 0.0; preOffsetPos = core::Vec3d::Zero(); posOffsetPos = core::Vec3d::Zero(); - mesh = NULL; - colModel = NULL; + mesh = nullptr; + colModel = nullptr; } MeshContainer::MeshContainer( std::string p_name, Mesh */*p_mesh*/, core::Vec3d p_prePos, core::Vec3d p_posPos, float p_offsetRotX, float p_offsetRotY, float p_offsetRotZ ) @@ -97,7 +97,7 @@ MeshContainer::MeshContainer( std::string p_name, Mesh */*p_mesh*/, core::Vec3d preOffsetPos = p_prePos; posOffsetPos = p_posPos; name = p_name; - colModel = NULL; + colModel = nullptr; } void MeshContainer::computeCurrentMatrix() @@ -117,7 +117,7 @@ void MeshContainer::computeCurrentMatrix() StylusPoints::StylusPoints() { point = core::Vec3d::Zero(); - container = NULL; + container = nullptr; } void StylusSceneObject::serialize( void */*p_memoryBlock*/ ) diff --git a/VirtualTools/CurvedGrasper.cpp b/VirtualTools/CurvedGrasper.cpp index 905ba896347fa0294a872ed3f6e71ec38cc3ea50..52a198fca47ae5559bd5e9610535229e17ed4add 100644 --- a/VirtualTools/CurvedGrasper.cpp +++ b/VirtualTools/CurvedGrasper.cpp @@ -42,7 +42,7 @@ CurvedGrasper::CurvedGrasper(size_t p_PhantomID, this->phantomID = p_PhantomID; Matrix33d rot; - mesh_pivot = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + mesh_pivot = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); mesh_pivot->loadMesh(p_pivotModelFileName, BaseMesh::MeshFileType::ThreeDS); mesh_pivot->scale(core::Vec3d(0.5, 0.5, 0.5)); rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitX()).matrix(); @@ -50,7 +50,7 @@ CurvedGrasper::CurvedGrasper(size_t p_PhantomID, rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitZ()).matrix(); mesh_pivot->rotate(rot); - mesh_upperJaw = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + mesh_upperJaw = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); mesh_upperJaw->loadMesh(p_upperModelFileName, BaseMesh::MeshFileType::ThreeDS); mesh_upperJaw->scale(core::Vec3d(0.5, 0.5, 0.5)); rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitY()).matrix(); @@ -58,7 +58,7 @@ CurvedGrasper::CurvedGrasper(size_t p_PhantomID, rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitZ()).matrix(); mesh_upperJaw->rotate(rot); - mesh_lowerJaw = new SurfaceMesh(BaseMesh::MeshType::Rigid, NULL); + mesh_lowerJaw = new SurfaceMesh(BaseMesh::MeshType::Rigid, nullptr); mesh_lowerJaw->loadMesh(p_lowerModelFileName, BaseMesh::MeshFileType::ThreeDS); mesh_lowerJaw->scale(core::Vec3d(0.5, 0.5, 0.5)); rot = Eigen::AngleAxisd(-M_PI_2, core::Vec3d::UnitY()).matrix();