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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ bool VisualContactPoint::mStaticDataCreated = false;
// Constructor
VisualContactPoint::VisualContactPoint(const openglframework::Vector3& position, const std::string& meshFolderPath,
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[1] = (normalLineEndPointLocal - position) * 0.5f;