Replace NULL pointer by nullptr

This commit is contained in:
Daniel Chappuis 2016-05-19 22:47:19 +02:00
parent 2640fbd48a
commit 942b63b48d
7 changed files with 25 additions and 25 deletions

View File

@ -906,8 +906,8 @@ void ContactSolver::computeFrictionVectors(const Vector3& deltaVelocity,
// Clean up the constraint solver // Clean up the constraint solver
void ContactSolver::cleanup() { void ContactSolver::cleanup() {
if (mContactConstraints != NULL) { if (mContactConstraints != nullptr) {
delete[] mContactConstraints; delete[] mContactConstraints;
mContactConstraints = NULL; mContactConstraints = nullptr;
} }
} }

View File

@ -257,12 +257,12 @@ void Box::render(openglframework::Shader& shader,
GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false); GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false);
glEnableVertexAttribArray(vertexPositionLoc); glEnableVertexAttribArray(vertexPositionLoc);
glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, NULL); glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
mVBONormals.bind(); mVBONormals.bind();
if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc); if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc);
if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, NULL); if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
// Draw the geometry of the box // Draw the geometry of the box
glDrawArrays(GL_TRIANGLES, 0, 36); glDrawArrays(GL_TRIANGLES, 0, 36);
@ -321,7 +321,7 @@ void Box::resetTransform(const rp3d::Transform& transform) {
// Reset the velocity of the rigid body // Reset the velocity of the rigid body
rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
if (rigidBody != NULL) { if (rigidBody != nullptr) {
rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
} }

View File

@ -183,16 +183,16 @@ void Capsule::render(openglframework::Shader& shader,
GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false); GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false);
glEnableVertexAttribArray(vertexPositionLoc); glEnableVertexAttribArray(vertexPositionLoc);
glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
mVBONormals.bind(); mVBONormals.bind();
if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc); if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc);
// For each part of the mesh // For each part of the mesh
for (unsigned int i=0; i<getNbParts(); i++) { for (unsigned int i=0; i<getNbParts(); i++) {
glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)NULL); glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)nullptr);
} }
glDisableVertexAttribArray(vertexPositionLoc); glDisableVertexAttribArray(vertexPositionLoc);
@ -274,7 +274,7 @@ void Capsule::resetTransform(const rp3d::Transform& transform) {
// Reset the velocity of the rigid body // Reset the velocity of the rigid body
rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
if (rigidBody != NULL) { if (rigidBody != nullptr) {
rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
} }

View File

@ -196,16 +196,16 @@ void ConcaveMesh::render(openglframework::Shader& shader,
GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false); GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false);
glEnableVertexAttribArray(vertexPositionLoc); glEnableVertexAttribArray(vertexPositionLoc);
glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
mVBONormals.bind(); mVBONormals.bind();
if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc); if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc);
// For each part of the mesh // For each part of the mesh
for (unsigned int i=0; i<getNbParts(); i++) { for (unsigned int i=0; i<getNbParts(); i++) {
glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)NULL); glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)nullptr);
} }
glDisableVertexAttribArray(vertexPositionLoc); glDisableVertexAttribArray(vertexPositionLoc);
@ -287,7 +287,7 @@ void ConcaveMesh::resetTransform(const rp3d::Transform& transform) {
// Reset the velocity of the rigid body // Reset the velocity of the rigid body
rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
if (rigidBody != NULL) { if (rigidBody != nullptr) {
rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
} }

View File

@ -180,16 +180,16 @@ void Cone::render(openglframework::Shader& shader,
GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false); GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false);
glEnableVertexAttribArray(vertexPositionLoc); glEnableVertexAttribArray(vertexPositionLoc);
glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
mVBONormals.bind(); mVBONormals.bind();
if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc); if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc);
// For each part of the mesh // For each part of the mesh
for (unsigned int i=0; i<getNbParts(); i++) { for (unsigned int i=0; i<getNbParts(); i++) {
glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)NULL); glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)nullptr);
} }
glDisableVertexAttribArray(vertexPositionLoc); glDisableVertexAttribArray(vertexPositionLoc);
@ -271,7 +271,7 @@ void Cone::resetTransform(const rp3d::Transform& transform) {
// Reset the velocity of the rigid body // Reset the velocity of the rigid body
rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
if (rigidBody != NULL) { if (rigidBody != nullptr) {
rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
} }

View File

@ -177,16 +177,16 @@ void ConvexMesh::render(openglframework::Shader& shader,
GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false); GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false);
glEnableVertexAttribArray(vertexPositionLoc); glEnableVertexAttribArray(vertexPositionLoc);
glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
mVBONormals.bind(); mVBONormals.bind();
if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc); if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc);
// For each part of the mesh // For each part of the mesh
for (unsigned int i=0; i<getNbParts(); i++) { for (unsigned int i=0; i<getNbParts(); i++) {
glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)NULL); glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)nullptr);
} }
glDisableVertexAttribArray(vertexPositionLoc); glDisableVertexAttribArray(vertexPositionLoc);
@ -268,7 +268,7 @@ void ConvexMesh::resetTransform(const rp3d::Transform& transform) {
// Reset the velocity of the rigid body // Reset the velocity of the rigid body
rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
if (rigidBody != NULL) { if (rigidBody != nullptr) {
rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
} }

View File

@ -181,16 +181,16 @@ void Cylinder::render(openglframework::Shader& shader,
GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false); GLint vertexNormalLoc = shader.getAttribLocation("vertexNormal", false);
glEnableVertexAttribArray(vertexPositionLoc); glEnableVertexAttribArray(vertexPositionLoc);
glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); glVertexAttribPointer(vertexPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
mVBONormals.bind(); mVBONormals.bind();
if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)NULL); if (vertexNormalLoc != -1) glVertexAttribPointer(vertexNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, (char*)nullptr);
if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc); if (vertexNormalLoc != -1) glEnableVertexAttribArray(vertexNormalLoc);
// For each part of the mesh // For each part of the mesh
for (unsigned int i=0; i<getNbParts(); i++) { for (unsigned int i=0; i<getNbParts(); i++) {
glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)NULL); glDrawElements(GL_TRIANGLES, getNbFaces(i) * 3, GL_UNSIGNED_INT, (char*)nullptr);
} }
glDisableVertexAttribArray(vertexPositionLoc); glDisableVertexAttribArray(vertexPositionLoc);
@ -272,7 +272,7 @@ void Cylinder::resetTransform(const rp3d::Transform& transform) {
// Reset the velocity of the rigid body // Reset the velocity of the rigid body
rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody);
if (rigidBody != NULL) { if (rigidBody != nullptr) {
rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0));
rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0));
} }