Fix compilation warnings

This commit is contained in:
Daniel Chappuis 2018-04-14 19:53:44 +02:00
parent 4697b9fcef
commit 5339b5ea4a
5 changed files with 14 additions and 12 deletions

View File

@ -170,7 +170,6 @@ bool SATAlgorithm::testCollisionCapsuleVsConvexPolyhedron(NarrowPhaseInfo* narro
// Minimum penetration depth // Minimum penetration depth
decimal minPenetrationDepth = DECIMAL_LARGEST; decimal minPenetrationDepth = DECIMAL_LARGEST;
uint minFaceIndex = 0; uint minFaceIndex = 0;
uint minEdgeIndex = 0;
bool isMinPenetrationFaceNormal = false; bool isMinPenetrationFaceNormal = false;
Vector3 separatingAxisCapsuleSpace; Vector3 separatingAxisCapsuleSpace;
Vector3 separatingPolyhedronEdgeVertex1; Vector3 separatingPolyhedronEdgeVertex1;
@ -235,7 +234,6 @@ bool SATAlgorithm::testCollisionCapsuleVsConvexPolyhedron(NarrowPhaseInfo* narro
// Check if we have found a new minimum penetration axis // Check if we have found a new minimum penetration axis
if (penetrationDepth < minPenetrationDepth) { if (penetrationDepth < minPenetrationDepth) {
minPenetrationDepth = penetrationDepth; minPenetrationDepth = penetrationDepth;
minEdgeIndex = e;
isMinPenetrationFaceNormal = false; isMinPenetrationFaceNormal = false;
separatingAxisCapsuleSpace = outAxis; separatingAxisCapsuleSpace = outAxis;
separatingPolyhedronEdgeVertex1 = edgeVertex1; separatingPolyhedronEdgeVertex1 = edgeVertex1;
@ -474,7 +472,8 @@ bool SATAlgorithm::testCollisionConvexPolyhedronVsConvexPolyhedron(NarrowPhaseIn
uint minFaceIndex = 0; uint minFaceIndex = 0;
bool isMinPenetrationFaceNormal = false; bool isMinPenetrationFaceNormal = false;
bool isMinPenetrationFaceNormalPolyhedron1 = false; bool isMinPenetrationFaceNormalPolyhedron1 = false;
uint minSeparatingEdge1Index, minSeparatingEdge2Index; uint minSeparatingEdge1Index = 0;
uint minSeparatingEdge2Index = 0;
Vector3 separatingEdge1A, separatingEdge1B; Vector3 separatingEdge1A, separatingEdge1B;
Vector3 separatingEdge2A, separatingEdge2B; Vector3 separatingEdge2A, separatingEdge2B;
Vector3 minEdgeVsEdgeSeparatingAxisPolyhedron2Space; Vector3 minEdgeVsEdgeSeparatingAxisPolyhedron2Space;

View File

@ -206,6 +206,9 @@ inline Vector3 BoxShape::getVertexPosition(uint vertexIndex) const {
case 6: return Vector3(extent.x, extent.y, -extent.z); case 6: return Vector3(extent.x, extent.y, -extent.z);
case 7: return Vector3(-extent.x, extent.y, -extent.z); case 7: return Vector3(-extent.x, extent.y, -extent.z);
} }
assert(false);
return Vector3::zero();
} }
// Return the normal vector of a given face of the polyhedron // Return the normal vector of a given face of the polyhedron

View File

@ -183,7 +183,7 @@ class Map {
for (int i=0; i<mNbUsedEntries; i++) { for (int i=0; i<mNbUsedEntries; i++) {
// If the entry is not free // If the entry is not free
if (newEntries[i].hashCode != -1) { if (newEntries[i].keyValue != nullptr) {
// Get the corresponding bucket // Get the corresponding bucket
int bucket = newEntries[i].hashCode % newCapacity; int bucket = newEntries[i].hashCode % newCapacity;
@ -551,7 +551,7 @@ class Map {
mAllocator.release(mEntries[i].keyValue, sizeof(Pair<K,V>)); mAllocator.release(mEntries[i].keyValue, sizeof(Pair<K,V>));
mEntries[i].keyValue = nullptr; mEntries[i].keyValue = nullptr;
} }
mEntries[i].hashCode = -1; assert(mEntries[i].keyValue == nullptr);
mEntries[i].next = mFreeIndex; mEntries[i].next = mFreeIndex;
mFreeIndex = i; mFreeIndex = i;
mNbFreeEntries++; mNbFreeEntries++;

View File

@ -50,9 +50,9 @@ class Set {
/// An entry of the set /// An entry of the set
struct Entry { struct Entry {
size_t hashCode; // Hash code of the entry size_t hashCode; // Hash code of the entry
int next; // Index of the next entry int next; // Index of the next entry
V* value; // Pointer to the value stored in the entry V* value; // Pointer to the value stored in the entry
/// Constructor /// Constructor
Entry() { Entry() {
@ -182,7 +182,7 @@ class Set {
for (int i=0; i<mNbUsedEntries; i++) { for (int i=0; i<mNbUsedEntries; i++) {
// If the entry is not free // If the entry is not free
if (newEntries[i].hashCode != -1) { if (newEntries[i].value != nullptr) {
// Get the corresponding bucket // Get the corresponding bucket
int bucket = newEntries[i].hashCode % newCapacity; int bucket = newEntries[i].hashCode % newCapacity;
@ -426,7 +426,7 @@ class Set {
} }
/// Allocate memory for a given number of elements /// Allocate memory for a given number of elements
void reserve(size_t capacity) { void reserve(int capacity) {
if (capacity <= mCapacity) return; if (capacity <= mCapacity) return;
@ -537,7 +537,7 @@ class Set {
mAllocator.release(mEntries[i].value, sizeof(V)); mAllocator.release(mEntries[i].value, sizeof(V));
mEntries[i].value = nullptr; mEntries[i].value = nullptr;
} }
mEntries[i].hashCode = -1; assert(mEntries[i].value == nullptr);
mEntries[i].next = mFreeIndex; mEntries[i].next = mFreeIndex;
mFreeIndex = i; mFreeIndex = i;
mNbFreeEntries++; mNbFreeEntries++;

View File

@ -38,7 +38,7 @@ bool VisualContactPoint::mStaticDataCreated = false;
// Constructor // Constructor
VisualContactPoint::VisualContactPoint(const openglframework::Vector3& position, const std::string& meshFolderPath, VisualContactPoint::VisualContactPoint(const openglframework::Vector3& position, const std::string& meshFolderPath,
const openglframework::Vector3& normalLineEndPointLocal, const openglframework::Color& color) const openglframework::Vector3& normalLineEndPointLocal, const openglframework::Color& color)
: mColor(color), mVBOVerticesNormalLine(GL_ARRAY_BUFFER) { : mVBOVerticesNormalLine(GL_ARRAY_BUFFER), mColor(color) {
mContactNormalLinePoints[0] = openglframework::Vector3(0, 0, 0); mContactNormalLinePoints[0] = openglframework::Vector3(0, 0, 0);
mContactNormalLinePoints[1] = (normalLineEndPointLocal - position) * 0.5f; mContactNormalLinePoints[1] = (normalLineEndPointLocal - position) * 0.5f;