From 11078d0d02d50cd081a7374aaf485432de225f50 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 22 Jul 2015 16:15:17 -0700 Subject: [PATCH] Get Developer > Avatar > Show Collision Bounding Shapes working again Note: Currently doesn't display well because alpha isn't working. --- interface/src/avatar/SkeletonModel.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index d92481494a..4963571f56 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include "Application.h" @@ -785,31 +786,34 @@ void SkeletonModel::resetShapePositionsToDefaultPose() { void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha) { const int BALL_SUBDIVISIONS = 10; if (_shapes.isEmpty()) { - // the bounding shape has not been propery computed + // the bounding shape has not been properly computed // so no need to render it return; } - // draw a blue sphere at the capsule endpoint + auto geometryCache = DependencyManager::get(); + auto deferredLighting = DependencyManager::get(); + Transform transform; // = Transform(); + + // draw a blue sphere at the capsule end point glm::vec3 endPoint; _boundingShape.getEndPoint(endPoint); endPoint = endPoint + _translation; - Transform transform = Transform(); transform.setTranslation(endPoint); batch.setModelTransform(transform); - auto geometryCache = DependencyManager::get(); - geometryCache->renderSphere(batch, _boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, + deferredLighting->bindSimpleProgram(batch); + geometryCache->renderSphere(batch, _boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, glm::vec4(0.6f, 0.6f, 0.8f, alpha)); - // draw a yellow sphere at the capsule startpoint + // draw a yellow sphere at the capsule start point glm::vec3 startPoint; _boundingShape.getStartPoint(startPoint); startPoint = startPoint + _translation; glm::vec3 axis = endPoint - startPoint; - Transform axisTransform = Transform(); - axisTransform.setTranslation(-axis); - batch.setModelTransform(axisTransform); - geometryCache->renderSphere(batch, _boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, + transform.setTranslation(startPoint); + batch.setModelTransform(transform); + deferredLighting->bindSimpleProgram(batch); + geometryCache->renderSphere(batch, _boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, glm::vec4(0.8f, 0.8f, 0.6f, alpha)); // draw a green cylinder between the two points