History

reduce calls to DependencyManager::get<> where possible

ZappoMan committed 11 years ago

Commit 90c11321 parent 049cb253 files · +21 −14Browse files

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

Unified · Split

interface/src/avatar/SkeletonModel.cpp+11−7
@@ -554,6 +554,7 @@ void SkeletonModel::renderRagdoll() { · 553 unmodified lines
554554 float radius1 = 0.008f;
555555 float radius2 = 0.01f;
556556 glm::vec3 simulationTranslation = _ragdoll->getTranslationInSimulationFrame();
557+ GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
557558 for (int i = 0; i < numPoints; ++i) {
558559 glPushMatrix();
559560 // NOTE: ragdollPoints are in simulation-frame but we want them to be model-relative
@@ -561,9 +562,9 @@ void SkeletonModel::renderRagdoll() { · 1 unmodified line
561562 glTranslatef(position.x, position.y, position.z);
562563 // draw each point as a yellow hexagon with black border
563564 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);
565566 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);
567568 glPopMatrix();
568569 }
569570 glPopMatrix();
@@ -913,7 +914,8 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) { · 343 unmodified lines
913914 endPoint = endPoint - _translation;
914915 glTranslatef(endPoint.x, endPoint.y, endPoint.z);
915916 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);
917919
918920 // draw a yellow sphere at the capsule startpoint
919921 glm::vec3 startPoint;
@@ -922,7 +924,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) { · 2 unmodified lines
922924 glm::vec3 axis = endPoint - startPoint;
923925 glTranslatef(-axis.x, -axis.y, -axis.z);
924926 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);
926928
927929 // draw a green cylinder between the two points
928930 glm::vec3 origin(0.0f);
@@ -948,6 +950,8 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 19 unmodified lines
948950 continue;
949951 }
950952
953+ GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
954+
951955 glPushMatrix();
952956 // shapes are stored in simulation-frame but we want position to be model-relative
953957 if (shape->getType() == SPHERE_SHAPE) {
@@ -955,7 +959,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 1 unmodified line
955959 glTranslatef(position.x, position.y, position.z);
956960 // draw a grey sphere at shape position
957961 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);
959963 } else if (shape->getType() == CAPSULE_SHAPE) {
960964 CapsuleShape* capsule = static_cast<CapsuleShape*>(shape);
961965
@@ -965,7 +969,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 3 unmodified lines
965969 endPoint = endPoint - simulationTranslation;
966970 glTranslatef(endPoint.x, endPoint.y, endPoint.z);
967971 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);
969973
970974 // draw a yellow sphere at the capsule startpoint
971975 glm::vec3 startPoint;
@@ -974,7 +978,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) { · 2 unmodified lines
974978 glm::vec3 axis = endPoint - startPoint;
975979 glTranslatef(-axis.x, -axis.y, -axis.z);
976980 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);
978982
979983 // draw a green cylinder between the two points
980984 glm::vec3 origin(0.0f);

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