History

Merge pull request #3312 from AndrewMeadows/ragdoll

use dispatchTable for shape-vs-shape collision queries

Andrzej Kapolka committed 12 years ago

Commit e29a4e72 parents 12d641d 7a5c4fd17 files · +409 −574Browse files

Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 17 files). Show all

Unified · Split

interface/src/avatar/SkeletonModel.cpp+9−9
@@ -620,19 +620,19 @@ void SkeletonModel::buildShapes() { · 619 unmodified lines
620620 Shape::Type type = joint.shapeType;
621621 int parentIndex = joint.parentIndex;
622622 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) {
625625 // this shape is forced to be a sphere
626− type = Shape::SPHERE_SHAPE;
626+ type = SPHERE_SHAPE;
627627 }
628628 Shape* shape = NULL;
629− if (type == Shape::SPHERE_SHAPE) {
629+ if (type == SPHERE_SHAPE) {
630630 shape = new VerletSphereShape(radius, &(points[i]));
631631 shape->setEntity(this);
632632 float mass = massScale * glm::max(MIN_JOINT_MASS, DENSITY_OF_WATER * shape->getVolume());
633633 points[i].setMass(mass);
634634 totalMass += mass;
635− } else if (type == Shape::CAPSULE_SHAPE) {
635+ } else if (type == CAPSULE_SHAPE) {
636636 assert(parentIndex != -1);
637637 shape = new VerletCapsuleShape(radius, &(points[parentIndex]), &(points[i]));
638638 shape->setEntity(this);
@@ -731,7 +731,7 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { · 92 unmodified lines
731731 shapeExtents.reset();
732732 glm::vec3 localPosition = shape->getTranslation();
733733 int type = shape->getType();
734− if (type == Shape::CAPSULE_SHAPE) {
734+ if (type == CAPSULE_SHAPE) {
735735 // add the two furthest surface points of the capsule
736736 CapsuleShape* capsule = static_cast<CapsuleShape*>(shape);
737737 glm::vec3 axis;
@@ -743,7 +743,7 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { · 5 unmodified lines
743743 shapeExtents.addPoint(localPosition + axis);
744744 shapeExtents.addPoint(localPosition - axis);
745745 totalExtents.addExtents(shapeExtents);
746− } else if (type == Shape::SPHERE_SHAPE) {
746+ } else if (type == SPHERE_SHAPE) {
747747 float radius = shape->getBoundingRadius();
748748 glm::vec3 axis = glm::vec3(radius);
749749 shapeExtents.addPoint(localPosition + axis);
@@ -847,13 +847,13 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 97 unmodified lines
847847
848848 glPushMatrix();
849849 // 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) {
851851 glm::vec3 position = shape->getTranslation() - simulationTranslation;
852852 glTranslatef(position.x, position.y, position.z);
853853 // draw a grey sphere at shape position
854854 glColor4f(0.75f, 0.75f, 0.75f, alpha);
855855 glutSolidSphere(shape->getBoundingRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
856− } else if (shape->getType() == Shape::CAPSULE_SHAPE) {
856+ } else if (shape->getType() == CAPSULE_SHAPE) {
857857 CapsuleShape* capsule = static_cast<CapsuleShape*>(shape);
858858
859859 // draw a blue sphere at the capsule endpoint

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t