Fix warnings

This commit is contained in:
Daniel Chappuis 2021-11-08 17:06:36 +01:00
parent c55d9c7c61
commit a33a10440c
23 changed files with 44 additions and 59 deletions

View File

@ -225,7 +225,7 @@ class BallAndSocketJointComponents : public Components {
void setConeLimitImpulse(Entity jointEntity, decimal impulse); void setConeLimitImpulse(Entity jointEntity, decimal impulse);
/// Return the cone limit half angle /// Return the cone limit half angle
bool getConeLimitHalfAngle(Entity jointEntity) const; decimal getConeLimitHalfAngle(Entity jointEntity) const;
/// Set the cone limit half angle /// Set the cone limit half angle
void setConeLimitHalfAngle(Entity jointEntity, decimal halfAngle); void setConeLimitHalfAngle(Entity jointEntity, decimal halfAngle);
@ -423,7 +423,7 @@ RP3D_FORCE_INLINE void BallAndSocketJointComponents::setConeLimitImpulse(Entity
} }
// Return the cone limit half angle // Return the cone limit half angle
RP3D_FORCE_INLINE bool BallAndSocketJointComponents::getConeLimitHalfAngle(Entity jointEntity) const { RP3D_FORCE_INLINE decimal BallAndSocketJointComponents::getConeLimitHalfAngle(Entity jointEntity) const {
assert(mMapEntityToComponentIndex.containsKey(jointEntity)); assert(mMapEntityToComponentIndex.containsKey(jointEntity));
return mConeLimitHalfAngle[mMapEntityToComponentIndex[jointEntity]]; return mConeLimitHalfAngle[mMapEntityToComponentIndex[jointEntity]];

View File

@ -111,30 +111,30 @@ class Array {
return &(mBuffer[mCurrentIndex]); return &(mBuffer[mCurrentIndex]);
} }
/// Post increment (it++) /// Pre increment (++it)
Iterator& operator++() { Iterator& operator++() {
assert(mCurrentIndex < mSize); assert(mCurrentIndex < mSize);
mCurrentIndex++; mCurrentIndex++;
return *this; return *this;
} }
/// Pre increment (++it) /// Post increment (it++)
Iterator operator++(int number) { Iterator operator++(int) {
assert(mCurrentIndex < mSize); assert(mCurrentIndex < mSize);
Iterator tmp = *this; Iterator tmp = *this;
mCurrentIndex++; mCurrentIndex++;
return tmp; return tmp;
} }
/// Post decrement (it--) /// Pre decrement (--it)
Iterator& operator--() { Iterator& operator--() {
assert(mCurrentIndex > 0); assert(mCurrentIndex > 0);
mCurrentIndex--; mCurrentIndex--;
return *this; return *this;
} }
/// Pre decrement (--it) /// Post decrement (it--)
Iterator operator--(int number) { Iterator operator--(int) {
assert(mCurrentIndex > 0); assert(mCurrentIndex > 0);
Iterator tmp = *this; Iterator tmp = *this;
mCurrentIndex--; mCurrentIndex--;

View File

@ -196,19 +196,11 @@ class Deque {
using const_reference = const T&; using const_reference = const T&;
using iterator_category = std::random_access_iterator_tag; using iterator_category = std::random_access_iterator_tag;
/// Constructor
Iterator() = default;
/// Constructor /// Constructor
Iterator(const Deque<T>* deque, size_t virtualIndex) : mVirtualIndex(virtualIndex), mDeque(deque) { Iterator(const Deque<T>* deque, size_t virtualIndex) : mVirtualIndex(virtualIndex), mDeque(deque) {
} }
/// Copy constructor
Iterator(const Iterator& it) : mVirtualIndex(it.mVirtualIndex), mDeque(it.mDeque) {
}
/// Deferencable /// Deferencable
reference operator*() { reference operator*() {
assert(mVirtualIndex < mDeque->mSize); assert(mVirtualIndex < mDeque->mSize);
@ -227,29 +219,29 @@ class Deque {
return &(mDeque->getItem(mVirtualIndex)); return &(mDeque->getItem(mVirtualIndex));
} }
/// Post increment (it++) /// Pre increment (++it)
Iterator& operator++() { Iterator& operator++() {
assert(mVirtualIndex < mDeque->mSize); assert(mVirtualIndex < mDeque->mSize);
mVirtualIndex++; mVirtualIndex++;
return *this; return *this;
} }
/// Pre increment (++it) /// Post increment (it++)
Iterator operator++(int number) { Iterator operator++(int /*number*/) {
assert(mVirtualIndex < mDeque->mSize); assert(mVirtualIndex < mDeque->mSize);
Iterator tmp = *this; Iterator tmp = *this;
mVirtualIndex++; mVirtualIndex++;
return tmp; return tmp;
} }
/// Post decrement (it--) /// Pre decrement (--it)
Iterator& operator--() { Iterator& operator--() {
mVirtualIndex--; mVirtualIndex--;
return *this; return *this;
} }
/// Pre decrement (--it) /// Post decrement (it--)
Iterator operator--(int number) { Iterator operator--(int /*number*/) {
Iterator tmp = *this; Iterator tmp = *this;
mVirtualIndex--; mVirtualIndex--;
return tmp; return tmp;

View File

@ -47,7 +47,7 @@ HeightFieldShape::HeightFieldShape(int nbGridColumns, int nbGridRows, decimal mi
HalfEdgeStructure& triangleHalfEdgeStructure, int upAxis, HalfEdgeStructure& triangleHalfEdgeStructure, int upAxis,
decimal integerHeightScale, const Vector3& scaling) decimal integerHeightScale, const Vector3& scaling)
: ConcaveShape(CollisionShapeName::HEIGHTFIELD, allocator, scaling), mNbColumns(nbGridColumns), mNbRows(nbGridRows), : ConcaveShape(CollisionShapeName::HEIGHTFIELD, allocator, scaling), mNbColumns(nbGridColumns), mNbRows(nbGridRows),
mWidth(nbGridColumns - 1), mLength(nbGridRows - 1), mMinHeight(minHeight), mWidth(static_cast<decimal>(nbGridColumns - 1)), mLength(static_cast<decimal>(nbGridRows - 1)), mMinHeight(minHeight),
mMaxHeight(maxHeight), mUpAxis(upAxis), mIntegerHeightScale(integerHeightScale), mMaxHeight(maxHeight), mUpAxis(upAxis), mIntegerHeightScale(integerHeightScale),
mHeightDataType(dataType), mTriangleHalfEdgeStructure(triangleHalfEdgeStructure) { mHeightDataType(dataType), mTriangleHalfEdgeStructure(triangleHalfEdgeStructure) {

View File

@ -79,8 +79,7 @@ struct ContactPairData {
std::vector<CollisionPointData>::const_iterator it; std::vector<CollisionPointData>::const_iterator it;
for (it = contactPoints.cbegin(); it != contactPoints.cend(); ++it) { for (it = contactPoints.cbegin(); it != contactPoints.cend(); ++it) {
Vector3 vec = it->localPointBody1; if (it->isContactPointSimilarTo(localPointBody1, localPointBody2, penetrationDepth, epsilon)) {
if (it->isContactPointSimilarTo(localPointBody1, localPointBody2, penetrationDepth)) {
return true; return true;
} }
} }
@ -127,7 +126,7 @@ struct CollisionData {
std::vector<ContactPairData>::const_iterator it; std::vector<ContactPairData>::const_iterator it;
for (it = contactPairs.cbegin(); it != contactPairs.cend(); ++it) { for (it = contactPairs.cbegin(); it != contactPairs.cend(); ++it) {
if (it->hasContactPointSimilarTo(localPointBody1, localPointBody2, penetrationDepth)) { if (it->hasContactPointSimilarTo(localPointBody1, localPointBody2, penetrationDepth, epsilon)) {
return true; return true;
} }
} }

View File

@ -44,7 +44,7 @@ class DynamicTreeRaycastCallback : public DynamicAABBTreeRaycastCallback {
std::vector<int> mHitNodes; std::vector<int> mHitNodes;
// Called when the AABB of a leaf node is hit by a ray // Called when the AABB of a leaf node is hit by a ray
virtual decimal raycastBroadPhaseShape(int32 nodeId, const Ray& ray) override { virtual decimal raycastBroadPhaseShape(int32 nodeId, const Ray& /*ray*/) override {
mHitNodes.push_back(nodeId); mHitNodes.push_back(nodeId);
return 1.0; return 1.0;
} }
@ -76,7 +76,7 @@ class DefaultTestTreeAllocator : public MemoryAllocator {
} }
/// Release previously allocated memory. /// Release previously allocated memory.
virtual void release(void* pointer, size_t size) override { virtual void release(void* pointer, size_t /*size*/) override {
free(pointer); free(pointer);
} }
}; };

View File

@ -49,7 +49,7 @@ namespace std {
template <> struct hash<reactphysics3d::TestKey> { template <> struct hash<reactphysics3d::TestKey> {
size_t operator()(const reactphysics3d::TestKey& key) const { size_t operator()(const reactphysics3d::TestKey& /*key*/) const {
return 1; return 1;
} }
}; };
@ -421,7 +421,7 @@ class TestMap : public Test {
rp3d_test(itBegin == it); rp3d_test(itBegin == it);
int size = 0; size_t size = 0;
for (auto it = map1.begin(); it != map1.end(); ++it) { for (auto it = map1.begin(); it != map1.end(); ++it) {
rp3d_test(map1.containsKey(it->first)); rp3d_test(map1.containsKey(it->first));
size++; size++;

View File

@ -49,7 +49,7 @@ namespace std {
template <> struct hash<reactphysics3d::TestValueSet> { template <> struct hash<reactphysics3d::TestValueSet> {
size_t operator()(const reactphysics3d::TestValueSet& value) const { size_t operator()(const reactphysics3d::TestValueSet& /*value*/) const {
return 1; return 1;
} }
}; };
@ -415,7 +415,7 @@ class TestSet : public Test {
rp3d_test(itBegin == it); rp3d_test(itBegin == it);
int size = 0; size_t size = 0;
for (auto it = set1.begin(); it != set1.end(); ++it) { for (auto it = set1.begin(); it != set1.end(); ++it) {
rp3d_test(set1.contains(*it)); rp3d_test(set1.contains(*it));
size++; size++;

View File

@ -254,7 +254,7 @@ class TestMathematicsFunctions : public Test {
polygonPlanesPoints.add(Vector3(10, 5, 0)); polygonPlanesPoints.add(Vector3(10, 5, 0));
Array<Vector3> clipPolygonVertices(mAllocator); Array<Vector3> clipPolygonVertices(mAllocator);
for (int i=0; i < polygonPlanesPoints.size(); i++) { for (size_t i=0; i < polygonPlanesPoints.size(); i++) {
clipPolygonVertices.clear(); clipPolygonVertices.clear();
clipPolygonWithPlane(polygonVertices, polygonPlanesPoints[i], polygonPlanesNormals[i], clipPolygonVertices); clipPolygonWithPlane(polygonVertices, polygonPlanesPoints[i], polygonPlanesNormals[i], clipPolygonVertices);

View File

@ -239,7 +239,7 @@ void ConvexMesh::createVBOAndVAO() {
// Return the index of a given vertex in the mesh // Return the index of a given vertex in the mesh
int ConvexMesh::findVertexIndex(const std::vector<openglframework::Vector3>& vertices, const openglframework::Vector3& vertex) { int ConvexMesh::findVertexIndex(const std::vector<openglframework::Vector3>& vertices, const openglframework::Vector3& vertex) {
for (int i = 0; i < vertices.size(); i++) { for (size_t i = 0; i < vertices.size(); i++) {
if (vertices[i] == vertex) { if (vertices[i] == vertex) {
return i; return i;
} }

View File

@ -36,7 +36,7 @@ openglframework::Mesh VisualContactPoint::mMesh;
bool VisualContactPoint::mStaticDataCreated = false; bool VisualContactPoint::mStaticDataCreated = false;
// Constructor // Constructor
VisualContactPoint::VisualContactPoint(const openglframework::Vector3& position, const std::string& meshFolderPath, VisualContactPoint::VisualContactPoint(const openglframework::Vector3& position,
const openglframework::Vector3& normalLineEndPointLocal, const openglframework::Color& color) const openglframework::Vector3& normalLineEndPointLocal, const openglframework::Color& color)
: mVBOVerticesNormalLine(GL_ARRAY_BUFFER), mColor(color) { : mVBOVerticesNormalLine(GL_ARRAY_BUFFER), mColor(color) {

View File

@ -88,8 +88,8 @@ class VisualContactPoint : public openglframework::Object3D {
// -------------------- Methods -------------------- // // -------------------- Methods -------------------- //
/// Constructor /// Constructor
VisualContactPoint(const openglframework::Vector3& position, const std::string &meshFolderPath, VisualContactPoint(const openglframework::Vector3& position, const openglframework::Vector3& normalLineEndPointLocal,
const openglframework::Vector3& normalLineEndPointLocal, const openglframework::Color& color); const openglframework::Color& color);
/// Destructor /// Destructor
~VisualContactPoint(); ~VisualContactPoint();

View File

@ -188,9 +188,6 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) {
else { else {
tmp = line.substr(found1+1); tmp = line.substr(found1+1);
found2 = (int)tmp.find("/"); found2 = (int)tmp.find("/");
if (found2 > 1000) {
int test = 2;
}
// If the face definition is of the form "f vert1//normal1 vert2//normal2 ..." // If the face definition is of the form "f vert1//normal1 vert2//normal2 ..."
if(found2 == 0) { if(found2 == 0) {

View File

@ -142,9 +142,7 @@ void BallAndSocketJointsNetScene::createJoints() {
// Create the joint info object // Create the joint info object
rp3d::RigidBody* body1 = mNetSpheres[i-1][j]->getRigidBody(); rp3d::RigidBody* body1 = mNetSpheres[i-1][j]->getRigidBody();
rp3d::RigidBody* body2 = mNetSpheres[i][j]->getRigidBody(); rp3d::RigidBody* body2 = mNetSpheres[i][j]->getRigidBody();
rp3d::Vector3 body1Position = body1->getTransform().getPosition();
rp3d::Vector3 body2Position = body2->getTransform().getPosition(); rp3d::Vector3 body2Position = body2->getTransform().getPosition();
//const rp3d::Vector3 anchorPointWorldSpace = 0.5 * (body1Position + body2Position);
const rp3d::Vector3 anchorPointWorldSpace = body2Position; const rp3d::Vector3 anchorPointWorldSpace = body2Position;
rp3d::BallAndSocketJointInfo jointInfo(body1, body2, anchorPointWorldSpace); rp3d::BallAndSocketJointInfo jointInfo(body1, body2, anchorPointWorldSpace);
jointInfo.isCollisionEnabled = false; jointInfo.isCollisionEnabled = false;
@ -157,7 +155,6 @@ void BallAndSocketJointsNetScene::createJoints() {
// Create the joint info object // Create the joint info object
rp3d::RigidBody* body1 = mNetSpheres[i][j-1]->getRigidBody(); rp3d::RigidBody* body1 = mNetSpheres[i][j-1]->getRigidBody();
rp3d::RigidBody* body2 = mNetSpheres[i][j]->getRigidBody(); rp3d::RigidBody* body2 = mNetSpheres[i][j]->getRigidBody();
rp3d::Vector3 body1Position = body1->getTransform().getPosition();
rp3d::Vector3 body2Position = body2->getTransform().getPosition(); rp3d::Vector3 body2Position = body2->getTransform().getPosition();
const rp3d::Vector3 anchorPointWorldSpace = body2Position; const rp3d::Vector3 anchorPointWorldSpace = body2Position;
rp3d::BallAndSocketJointInfo jointInfo(body1, body2, anchorPointWorldSpace); rp3d::BallAndSocketJointInfo jointInfo(body1, body2, anchorPointWorldSpace);

View File

@ -220,7 +220,7 @@ void CollisionDetectionScene::selectNextShape() {
} }
// Called when a keyboard event occurs // Called when a keyboard event occurs
bool CollisionDetectionScene::keyboardEvent(int key, int scancode, int action, int mods) { bool CollisionDetectionScene::keyboardEvent(int key, int /*scancode*/, int action, int /*mods*/) {
// If the space key has been pressed // If the space key has been pressed
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) { if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {

View File

@ -71,7 +71,7 @@ class ContactManager : public rp3d::CollisionCallback {
public: public:
ContactManager(openglframework::Shader& shader, const std::string& meshFolderPath, ContactManager(openglframework::Shader& /*shader*/, const std::string& meshFolderPath,
std::vector<SceneContactPoint>& contactPoints) std::vector<SceneContactPoint>& contactPoints)
: mMeshFolderPath(meshFolderPath), mContactPoints(contactPoints) { : mMeshFolderPath(meshFolderPath), mContactPoints(contactPoints) {
@ -151,12 +151,12 @@ inline void CollisionDetectionScene::showHideNormals() {
} }
// Enabled/Disable the shadow mapping // Enabled/Disable the shadow mapping
inline void CollisionDetectionScene::setIsShadowMappingEnabled(bool isShadowMappingEnabled) { inline void CollisionDetectionScene::setIsShadowMappingEnabled(bool /*isShadowMappingEnabled*/) {
SceneDemo::setIsShadowMappingEnabled(false); SceneDemo::setIsShadowMappingEnabled(false);
} }
// Display/Hide the contact points // Display/Hide the contact points
inline void CollisionDetectionScene::setAreContactPointsDisplayed(bool display) { inline void CollisionDetectionScene::setAreContactPointsDisplayed(bool /*display*/) {
SceneDemo::setAreContactPointsDisplayed(true); SceneDemo::setAreContactPointsDisplayed(true);
} }

View File

@ -346,7 +346,7 @@ void RaycastScene::createVBOAndVAO() {
} }
// Called when a keyboard event occurs // Called when a keyboard event occurs
bool RaycastScene::keyboardEvent(int key, int scancode, int action, int mods) { bool RaycastScene::keyboardEvent(int key, int /*scancode*/, int action, int /*mods*/) {
// If the space key has been pressed // If the space key has been pressed
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) { if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {

View File

@ -183,12 +183,12 @@ inline void RaycastScene::showHideNormals() {
} }
// Enabled/Disable the shadow mapping // Enabled/Disable the shadow mapping
inline void RaycastScene::setIsShadowMappingEnabled(bool isShadowMappingEnabled) { inline void RaycastScene::setIsShadowMappingEnabled(bool /*isShadowMappingEnabled*/) {
SceneDemo::setIsShadowMappingEnabled(false); SceneDemo::setIsShadowMappingEnabled(false);
} }
// Display/Hide the contact points // Display/Hide the contact points
inline void RaycastScene::setAreContactPointsDisplayed(bool display) { inline void RaycastScene::setAreContactPointsDisplayed(bool /*display*/) {
SceneDemo::setAreContactPointsDisplayed(true); SceneDemo::setAreContactPointsDisplayed(true);
} }

View File

@ -209,14 +209,14 @@ void Gui::createSettingsPanel() {
Button* buttonPhysics = new Button(buttonsPanel, "Physics"); Button* buttonPhysics = new Button(buttonsPanel, "Physics");
buttonPhysics->set_flags(Button::RadioButton); buttonPhysics->set_flags(Button::RadioButton);
buttonPhysics->set_pushed(true); buttonPhysics->set_pushed(true);
buttonPhysics->set_change_callback([&](bool state) { buttonPhysics->set_change_callback([&](bool /*state*/) {
mPhysicsPanel->set_visible(true); mPhysicsPanel->set_visible(true);
mRenderingPanel->set_visible(false); mRenderingPanel->set_visible(false);
mScreen->perform_layout(); mScreen->perform_layout();
}); });
Button* buttonRendering = new Button(buttonsPanel, "Rendering"); Button* buttonRendering = new Button(buttonsPanel, "Rendering");
buttonRendering->set_flags(Button::RadioButton); buttonRendering->set_flags(Button::RadioButton);
buttonRendering->set_change_callback([&](bool state) { buttonRendering->set_change_callback([&](bool /*state*/) {
mRenderingPanel->set_visible(true); mRenderingPanel->set_visible(true);
mPhysicsPanel->set_visible(false); mPhysicsPanel->set_visible(false);
mScreen->perform_layout(); mScreen->perform_layout();

View File

@ -94,7 +94,7 @@ bool Scene::mapMouseCoordinatesToSphere(double xMouse, double yMouse,
} }
// Called when a mouse button event occurs // Called when a mouse button event occurs
bool Scene::mouseButtonEvent(int button, bool down, int mods, double mousePosX, double mousePosY) { bool Scene::mouseButtonEvent(int /*button*/, bool down, int /*mods*/, double mousePosX, double mousePosY) {
// If the mouse button is pressed // If the mouse button is pressed
if (down) { if (down) {
@ -137,7 +137,7 @@ bool Scene::mouseMotionEvent(double xMouse, double yMouse, int leftButtonState,
} }
// Called when a scrolling event occurs // Called when a scrolling event occurs
bool Scene::scrollingEvent(float xAxis, float yAxis, float scrollSensitivy) { bool Scene::scrollingEvent(float /*xAxis*/, float yAxis, float scrollSensitivy) {
zoom(yAxis * scrollSensitivy); zoom(yAxis * scrollSensitivy);
return true; return true;

View File

@ -268,7 +268,7 @@ class Scene : public rp3d::EventListener {
}; };
// Called when a keyboard event occurs // Called when a keyboard event occurs
inline bool Scene::keyboardEvent(int key, int scancode, int action, int mods) { inline bool Scene::keyboardEvent(int /*key*/, int /*scancode*/, int /*action*/, int /*mods*/) {
return false; return false;
} }

View File

@ -467,13 +467,13 @@ void SceneDemo::updateSnapshotContactPoints() {
for (it = mSnapshotsContactPoints.begin(); it != mSnapshotsContactPoints.end(); ++it) { for (it = mSnapshotsContactPoints.begin(); it != mSnapshotsContactPoints.end(); ++it) {
// Create a visual contact point for rendering // Create a visual contact point for rendering
VisualContactPoint* point = new VisualContactPoint(it->point, mMeshFolderPath, it->point + it->normal, it->color); VisualContactPoint* point = new VisualContactPoint(it->point, it->point + it->normal, it->color);
mVisualContactPoints.push_back(point); mVisualContactPoints.push_back(point);
} }
} }
// Render the contact points // Render the contact points
void SceneDemo::renderSnapshotsContactPoints(openglframework::Shader& shader, const openglframework::Matrix4& worldToCameraMatrix) { void SceneDemo::renderSnapshotsContactPoints(openglframework::Shader& /*shader*/, const openglframework::Matrix4& worldToCameraMatrix) {
// Render all the contact points // Render all the contact points
for (std::vector<VisualContactPoint*>::iterator it = mVisualContactPoints.begin(); for (std::vector<VisualContactPoint*>::iterator it = mVisualContactPoints.begin();

View File

@ -544,8 +544,8 @@ void TestbedApplication::notifyEngineSetttingsChanged() {
mCurrentScene->updateEngineSettings(); mCurrentScene->updateEngineSettings();
} }
void GLAPIENTRY TestbedApplication::onOpenGLError(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, void GLAPIENTRY TestbedApplication::onOpenGLError(GLenum /*source*/, GLenum type, GLuint /*id*/, GLenum /*severity*/, GLsizei /*length*/,
const GLchar* message, const void* userParam ) { const GLchar* /*message*/, const void* /*userParam*/ ) {
#ifdef GL_DEBUG_OUTPUT #ifdef GL_DEBUG_OUTPUT
if (type == GL_DEBUG_TYPE_ERROR) { if (type == GL_DEBUG_TYPE_ERROR) {