use dispatchTable for shape-vs-shape collision queries
Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 17 files). Show all
Unified · Split
| @@ -620,19 +620,19 @@ void SkeletonModel::buildShapes() { · 619 unmodified lines | ||
| 620 | 620 | Shape::Type type = joint.shapeType; |
| 621 | 621 | int parentIndex = joint.parentIndex; |
| 622 | 622 | if (parentIndex == -1 || radius < EPSILON) { |
| 623 | − type = Shape::UNKNOWN_SHAPE; | |
| 624 | − } else if (type == Shape::CAPSULE_SHAPE && halfHeight < EPSILON) { | |
| 623 | + type = UNKNOWN_SHAPE; | |
| 624 | + } else if (type == CAPSULE_SHAPE && halfHeight < EPSILON) { | |
| 625 | 625 | // this shape is forced to be a sphere |
| 626 | − type = Shape::SPHERE_SHAPE; | |
| 626 | + type = SPHERE_SHAPE; | |
| 627 | 627 | } |
| 628 | 628 | Shape* shape = NULL; |
| 629 | − if (type == Shape::SPHERE_SHAPE) { | |
| 629 | + if (type == SPHERE_SHAPE) { | |
| 630 | 630 | shape = new VerletSphereShape(radius, &(points[i])); |
| 631 | 631 | shape->setEntity(this); |
| 632 | 632 | float mass = massScale * glm::max(MIN_JOINT_MASS, DENSITY_OF_WATER * shape->getVolume()); |
| 633 | 633 | points[i].setMass(mass); |
| 634 | 634 | totalMass += mass; |
| 635 | − } else if (type == Shape::CAPSULE_SHAPE) { | |
| 635 | + } else if (type == CAPSULE_SHAPE) { | |
| 636 | 636 | assert(parentIndex != -1); |
| 637 | 637 | shape = new VerletCapsuleShape(radius, &(points[parentIndex]), &(points[i])); |
| 638 | 638 | shape->setEntity(this); |
| @@ -731,7 +731,7 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { · 92 unmodified lines | ||
| 731 | 731 | shapeExtents.reset(); |
| 732 | 732 | glm::vec3 localPosition = shape->getTranslation(); |
| 733 | 733 | int type = shape->getType(); |
| 734 | − if (type == Shape::CAPSULE_SHAPE) { | |
| 734 | + if (type == CAPSULE_SHAPE) { | |
| 735 | 735 | // add the two furthest surface points of the capsule |
| 736 | 736 | CapsuleShape* capsule = static_cast<CapsuleShape*>(shape); |
| 737 | 737 | glm::vec3 axis; |
| @@ -743,7 +743,7 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { · 5 unmodified lines | ||
| 743 | 743 | shapeExtents.addPoint(localPosition + axis); |
| 744 | 744 | shapeExtents.addPoint(localPosition - axis); |
| 745 | 745 | totalExtents.addExtents(shapeExtents); |
| 746 | − } else if (type == Shape::SPHERE_SHAPE) { | |
| 746 | + } else if (type == SPHERE_SHAPE) { | |
| 747 | 747 | float radius = shape->getBoundingRadius(); |
| 748 | 748 | glm::vec3 axis = glm::vec3(radius); |
| 749 | 749 | shapeExtents.addPoint(localPosition + axis); |
| @@ -847,13 +847,13 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 97 unmodified lines | ||
| 847 | 847 | |
| 848 | 848 | glPushMatrix(); |
| 849 | 849 | // shapes are stored in simulation-frame but we want position to be model-relative |
| 850 | − if (shape->getType() == Shape::SPHERE_SHAPE) { | |
| 850 | + if (shape->getType() == SPHERE_SHAPE) { | |
| 851 | 851 | glm::vec3 position = shape->getTranslation() - simulationTranslation; |
| 852 | 852 | glTranslatef(position.x, position.y, position.z); |
| 853 | 853 | // draw a grey sphere at shape position |
| 854 | 854 | glColor4f(0.75f, 0.75f, 0.75f, alpha); |
| 855 | 855 | glutSolidSphere(shape->getBoundingRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 856 | − } else if (shape->getType() == Shape::CAPSULE_SHAPE) { | |
| 856 | + } else if (shape->getType() == CAPSULE_SHAPE) { | |
| 857 | 857 | CapsuleShape* capsule = static_cast<CapsuleShape*>(shape); |
| 858 | 858 | |
| 859 | 859 | // draw a blue sphere at the capsule endpoint |