hydra lasers are now rendering again

This commit is contained in:
ericrius1 2015-07-01 15:12:37 -07:00
parent 8b00864175
commit 8129d0eb1f
3 changed files with 8 additions and 10 deletions

View file

@ -449,7 +449,7 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo
getHead()->getFaceModel().renderJointCollisionShapes(0.7f); getHead()->getFaceModel().renderJointCollisionShapes(0.7f);
} }
if (renderBounding && shouldRenderHead(renderArgs)) { if (renderBounding && shouldRenderHead(renderArgs)) {
_skeletonModel.renderBoundingCollisionShapes(0.7f); _skeletonModel.renderBoundingCollisionShapes(*renderArgs->_batch, 0.7f);
} }
// If this is the avatar being looked at, render a little ball above their head // If this is the avatar being looked at, render a little ball above their head

View file

@ -776,24 +776,24 @@ void SkeletonModel::resetShapePositionsToDefaultPose() {
_boundingShape.setRotation(_rotation); _boundingShape.setRotation(_rotation);
} }
void SkeletonModel::renderBoundingCollisionShapes(float alpha) { void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha) {
const int BALL_SUBDIVISIONS = 10; const int BALL_SUBDIVISIONS = 10;
if (_shapes.isEmpty()) { if (_shapes.isEmpty()) {
// the bounding shape has not been propery computed // the bounding shape has not been propery computed
// so no need to render it // so no need to render it
return; return;
} }
glPushMatrix();
Application::getInstance()->loadTranslatedViewMatrix(_translation); Application::getInstance()->loadTranslatedViewMatrix(_translation);
// draw a blue sphere at the capsule endpoint // draw a blue sphere at the capsule endpoint
glm::vec3 endPoint; glm::vec3 endPoint;
_boundingShape.getEndPoint(endPoint); _boundingShape.getEndPoint(endPoint);
endPoint = endPoint - _translation; endPoint = endPoint - _translation;
glTranslatef(endPoint.x, endPoint.y, endPoint.z); Transform transform = Transform();
transform.setTranslation(endPoint);
batch.setModelTransform(transform);
auto geometryCache = DependencyManager::get<GeometryCache>(); auto geometryCache = DependencyManager::get<GeometryCache>();
geometryCache->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, glm::vec4(0.6f, 0.6f, 0.8f, alpha)); 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 startpoint
glm::vec3 startPoint; glm::vec3 startPoint;
@ -805,9 +805,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) {
// draw a green cylinder between the two points // draw a green cylinder between the two points
glm::vec3 origin(0.0f); glm::vec3 origin(0.0f);
// Avatar::renderJointConnectingCone( origin, axis, _boundingShape.getRadius(), _boundingShape.getRadius(), glm::vec4(0.6f, 0.8f, 0.6f, alpha)); Avatar::renderJointConnectingCone(batch, origin, axis, _boundingShape.getRadius(), _boundingShape.getRadius(), glm::vec4(0.6f, 0.8f, 0.6f, alpha));
glPopMatrix();
} }
bool SkeletonModel::hasSkeleton() { bool SkeletonModel::hasSkeleton() {

View file

@ -101,7 +101,7 @@ public:
const glm::vec3& getStandingOffset() const { return _standingOffset; } const glm::vec3& getStandingOffset() const { return _standingOffset; }
void computeBoundingShape(const FBXGeometry& geometry); void computeBoundingShape(const FBXGeometry& geometry);
void renderBoundingCollisionShapes(float alpha); void renderBoundingCollisionShapes(gpu::Batch& batch, float alpha);
float getBoundingShapeRadius() const { return _boundingShape.getRadius(); } float getBoundingShapeRadius() const { return _boundingShape.getRadius(); }
const CapsuleShape& getBoundingShape() const { return _boundingShape; } const CapsuleShape& getBoundingShape() const { return _boundingShape; }
const glm::vec3 getBoundingShapeOffset() const { return _boundingShapeLocalOffset; } const glm::vec3 getBoundingShapeOffset() const { return _boundingShapeLocalOffset; }