Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 3 files). Show all
Unified · Split
| @@ -554,6 +554,7 @@ void SkeletonModel::renderRagdoll() { · 553 unmodified lines | |||
| 554 | float radius1 = 0.008f; | 554 | float radius1 = 0.008f; |
| 555 | float radius2 = 0.01f; | 555 | float radius2 = 0.01f; |
| 556 | glm::vec3 simulationTranslation = _ragdoll->getTranslationInSimulationFrame(); | 556 | glm::vec3 simulationTranslation = _ragdoll->getTranslationInSimulationFrame(); |
| 557 | GeometryCache* geometryCache = DependencyManager::get<GeometryCache>(); | ||
| 557 | for (int i = 0; i < numPoints; ++i) { | 558 | for (int i = 0; i < numPoints; ++i) { |
| 558 | glPushMatrix(); | 559 | glPushMatrix(); |
| 559 | // NOTE: ragdollPoints are in simulation-frame but we want them to be model-relative | 560 | // NOTE: ragdollPoints are in simulation-frame but we want them to be model-relative |
| @@ -561,9 +562,9 @@ void SkeletonModel::renderRagdoll() { · 1 unmodified line | |||
| 561 | glTranslatef(position.x, position.y, position.z); | 562 | glTranslatef(position.x, position.y, position.z); |
| 562 | // draw each point as a yellow hexagon with black border | 563 | // draw each point as a yellow hexagon with black border |
| 563 | glColor4f(0.0f, 0.0f, 0.0f, alpha); | 564 | glColor4f(0.0f, 0.0f, 0.0f, alpha); |
| 564 | DependencyManager::get<GeometryCache>()->renderSphere(radius2, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 565 | geometryCache->renderSphere(radius2, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 565 | glColor4f(1.0f, 1.0f, 0.0f, alpha); | 566 | glColor4f(1.0f, 1.0f, 0.0f, alpha); |
| 566 | DependencyManager::get<GeometryCache>()->renderSphere(radius1, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 567 | geometryCache->renderSphere(radius1, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 567 | glPopMatrix(); | 568 | glPopMatrix(); |
| 568 | } | 569 | } |
| 569 | glPopMatrix(); | 570 | glPopMatrix(); |
| @@ -913,7 +914,8 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) { · 343 unmodified lines | |||
| 913 | endPoint = endPoint - _translation; | 914 | endPoint = endPoint - _translation; |
| 914 | glTranslatef(endPoint.x, endPoint.y, endPoint.z); | 915 | glTranslatef(endPoint.x, endPoint.y, endPoint.z); |
| 915 | glColor4f(0.6f, 0.6f, 0.8f, alpha); | 916 | glColor4f(0.6f, 0.6f, 0.8f, alpha); |
| 916 | DependencyManager::get<GeometryCache>()->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 917 | GeometryCache* geometryCache = DependencyManager::get<GeometryCache>(); |
| 918 | geometryCache->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | ||
| 917 | 919 | ||
| 918 | // draw a yellow sphere at the capsule startpoint | 920 | // draw a yellow sphere at the capsule startpoint |
| 919 | glm::vec3 startPoint; | 921 | glm::vec3 startPoint; |
| @@ -922,7 +924,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) { · 2 unmodified lines | |||
| 922 | glm::vec3 axis = endPoint - startPoint; | 924 | glm::vec3 axis = endPoint - startPoint; |
| 923 | glTranslatef(-axis.x, -axis.y, -axis.z); | 925 | glTranslatef(-axis.x, -axis.y, -axis.z); |
| 924 | glColor4f(0.8f, 0.8f, 0.6f, alpha); | 926 | glColor4f(0.8f, 0.8f, 0.6f, alpha); |
| 925 | DependencyManager::get<GeometryCache>()->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 927 | geometryCache->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 926 | 928 | ||
| 927 | // draw a green cylinder between the two points | 929 | // draw a green cylinder between the two points |
| 928 | glm::vec3 origin(0.0f); | 930 | glm::vec3 origin(0.0f); |
| @@ -948,6 +950,8 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 19 unmodified lines | |||
| 948 | continue; | 950 | continue; |
| 949 | } | 951 | } |
| 950 | 952 | ||
| 953 | GeometryCache* geometryCache = DependencyManager::get<GeometryCache>(); | ||
| 954 | |||
| 951 | glPushMatrix(); | 955 | glPushMatrix(); |
| 952 | // shapes are stored in simulation-frame but we want position to be model-relative | 956 | // shapes are stored in simulation-frame but we want position to be model-relative |
| 953 | if (shape->getType() == SPHERE_SHAPE) { | 957 | if (shape->getType() == SPHERE_SHAPE) { |
| @@ -955,7 +959,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 1 unmodified line | |||
| 955 | glTranslatef(position.x, position.y, position.z); | 959 | glTranslatef(position.x, position.y, position.z); |
| 956 | // draw a grey sphere at shape position | 960 | // draw a grey sphere at shape position |
| 957 | glColor4f(0.75f, 0.75f, 0.75f, alpha); | 961 | glColor4f(0.75f, 0.75f, 0.75f, alpha); |
| 958 | DependencyManager::get<GeometryCache>()->renderSphere(shape->getBoundingRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 962 | geometryCache->renderSphere(shape->getBoundingRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 959 | } else if (shape->getType() == CAPSULE_SHAPE) { | 963 | } else if (shape->getType() == CAPSULE_SHAPE) { |
| 960 | CapsuleShape* capsule = static_cast<CapsuleShape*>(shape); | 964 | CapsuleShape* capsule = static_cast<CapsuleShape*>(shape); |
| 961 | 965 | ||
| @@ -965,7 +969,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 3 unmodified lines | |||
| 965 | endPoint = endPoint - simulationTranslation; | 969 | endPoint = endPoint - simulationTranslation; |
| 966 | glTranslatef(endPoint.x, endPoint.y, endPoint.z); | 970 | glTranslatef(endPoint.x, endPoint.y, endPoint.z); |
| 967 | glColor4f(0.6f, 0.6f, 0.8f, alpha); | 971 | glColor4f(0.6f, 0.6f, 0.8f, alpha); |
| 968 | DependencyManager::get<GeometryCache>()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 972 | geometryCache->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 969 | 973 | ||
| 970 | // draw a yellow sphere at the capsule startpoint | 974 | // draw a yellow sphere at the capsule startpoint |
| 971 | glm::vec3 startPoint; | 975 | glm::vec3 startPoint; |
| @@ -974,7 +978,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 2 unmodified lines | |||
| 974 | glm::vec3 axis = endPoint - startPoint; | 978 | glm::vec3 axis = endPoint - startPoint; |
| 975 | glTranslatef(-axis.x, -axis.y, -axis.z); | 979 | glTranslatef(-axis.x, -axis.y, -axis.z); |
| 976 | glColor4f(0.8f, 0.8f, 0.6f, alpha); | 980 | glColor4f(0.8f, 0.8f, 0.6f, alpha); |
| 977 | DependencyManager::get<GeometryCache>()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); | 981 | geometryCache->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS); |
| 978 | 982 | ||
| 979 | // draw a green cylinder between the two points | 983 | // draw a green cylinder between the two points |
| 980 | glm::vec3 origin(0.0f); | 984 | glm::vec3 origin(0.0f); |