remove unused legacy Shapes from Model and friends
Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 9 files). Show all
Unified · Split
| @@ -12,9 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <glm/gtx/transform.hpp> |
| 13 | 13 | #include <QMultiMap> |
| 14 | 14 | |
| 15 | −#include <CapsuleShape.h> | |
| 16 | 15 | #include <DeferredLightingEffect.h> |
| 17 | −#include <SphereShape.h> | |
| 18 | 16 | |
| 19 | 17 | #include "Application.h" |
| 20 | 18 | #include "Avatar.h" |
| @@ -34,8 +32,9 @@ SkeletonModel::SkeletonModel(Avatar* owningAvatar, QObject* parent, RigPointer r · 13 unmodified lines | ||
| 34 | 32 | Model(rig, parent), |
| 35 | 33 | _triangleFanID(DependencyManager::get<GeometryCache>()->allocateID()), |
| 36 | 34 | _owningAvatar(owningAvatar), |
| 37 | − _boundingShape(), | |
| 38 | − _boundingShapeLocalOffset(0.0f), | |
| 35 | + _boundingCapsuleLocalOffset(0.0f), | |
| 36 | + _boundingCapsuleRadius(0.0f), | |
| 37 | + _boundingCapsuleHeight(0.0f), | |
| 39 | 38 | _defaultEyeModelPosition(glm::vec3(0.0f, 0.0f, 0.0f)), |
| 40 | 39 | _standingFoot(NO_FOOT), |
| 41 | 40 | _standingOffset(0.0f), |
| @@ -44,7 +43,6 @@ SkeletonModel::SkeletonModel(Avatar* owningAvatar, QObject* parent, RigPointer r · 2 unmodified lines | ||
| 44 | 43 | { |
| 45 | 44 | assert(_rig); |
| 46 | 45 | assert(_owningAvatar); |
| 47 | − _enableShapes = true; | |
| 48 | 46 | } |
| 49 | 47 | |
| 50 | 48 | SkeletonModel::~SkeletonModel() { |
| @@ -81,10 +79,7 @@ void SkeletonModel::initJointStates(QVector<JointState> states) { · 30 unmodified lines | ||
| 81 | 79 | _rig->updateJointState(i, parentTransform); |
| 82 | 80 | } |
| 83 | 81 | |
| 84 | − clearShapes(); | |
| 85 | − if (_enableShapes) { | |
| 86 | − buildShapes(); | |
| 87 | − } | |
| 82 | + buildShapes(); | |
| 88 | 83 | |
| 89 | 84 | Extents meshExtents = getMeshExtents(); |
| 90 | 85 | _headClipDistance = -(meshExtents.minimum.z / _scale.z - _defaultEyeModelPosition.z); |
| @@ -183,9 +178,6 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { · 92 unmodified lines | ||
| 183 | 178 | if (_rig->getJointsAreDirty()) { |
| 184 | 179 | updateClusterMatrices(); |
| 185 | 180 | } |
| 186 | − | |
| 187 | − _boundingShape.setTranslation(_translation + _rotation * _boundingShapeLocalOffset); | |
| 188 | − _boundingShape.setRotation(_rotation); | |
| 189 | 181 | } |
| 190 | 182 | |
| 191 | 183 | void SkeletonModel::renderIKConstraints(gpu::Batch& batch) { |
| @@ -677,12 +669,11 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { · 485 unmodified lines | ||
| 677 | 669 | // NOTE: we assume that the longest side of totalExtents is the yAxis... |
| 678 | 670 | glm::vec3 diagonal = totalExtents.maximum - totalExtents.minimum; |
| 679 | 671 | // ... and assume the radius is half the RMS of the X and Z sides: |
| 680 | − float capsuleRadius = 0.5f * sqrtf(0.5f * (diagonal.x * diagonal.x + diagonal.z * diagonal.z)); | |
| 681 | − _boundingShape.setRadius(capsuleRadius); | |
| 682 | − _boundingShape.setHalfHeight(0.5f * diagonal.y - capsuleRadius); | |
| 672 | + _boundingCapsuleRadius = 0.5f * sqrtf(0.5f * (diagonal.x * diagonal.x + diagonal.z * diagonal.z)); | |
| 673 | + _boundingCapsuleHeight = diagonal.y - 2.0f * _boundingCapsuleRadius; | |
| 683 | 674 | |
| 684 | 675 | glm::vec3 rootPosition = _rig->getJointState(geometry.rootJointIndex).getPosition(); |
| 685 | − _boundingShapeLocalOffset = 0.5f * (totalExtents.maximum + totalExtents.minimum) - rootPosition; | |
| 676 | + _boundingCapsuleLocalOffset = 0.5f * (totalExtents.maximum + totalExtents.minimum) - rootPosition; | |
| 686 | 677 | _boundingRadius = 0.5f * glm::length(diagonal); |
| 687 | 678 | } |
| 688 | 679 | |
| @@ -693,30 +684,26 @@ void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha · 4 unmodified lines | ||
| 693 | 684 | auto deferredLighting = DependencyManager::get<DeferredLightingEffect>(); |
| 694 | 685 | Transform transform; // = Transform(); |
| 695 | 686 | |
| 696 | − // draw a blue sphere at the capsule end point | |
| 697 | − glm::vec3 endPoint; | |
| 698 | − _boundingShape.getEndPoint(endPoint); | |
| 699 | − endPoint = endPoint + _translation; | |
| 700 | − transform.setTranslation(endPoint); | |
| 687 | + // draw a blue sphere at the capsule top point | |
| 688 | + glm::vec3 topPoint = _translation + _boundingCapsuleLocalOffset + (0.5f * _boundingCapsuleHeight) * glm::vec3(0.0f, 1.0f, 0.0f); | |
| 689 | + transform.setTranslation(topPoint); | |
| 701 | 690 | batch.setModelTransform(transform); |
| 702 | 691 | deferredLighting->bindSimpleProgram(batch); |
| 703 | − geometryCache->renderSphere(batch, _boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, | |
| 692 | + geometryCache->renderSphere(batch, _boundingCapsuleRadius, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, | |
| 704 | 693 | glm::vec4(0.6f, 0.6f, 0.8f, alpha)); |
| 705 | 694 | |
| 706 | − // draw a yellow sphere at the capsule start point | |
| 707 | − glm::vec3 startPoint; | |
| 708 | − _boundingShape.getStartPoint(startPoint); | |
| 709 | − startPoint = startPoint + _translation; | |
| 710 | − glm::vec3 axis = endPoint - startPoint; | |
| 711 | − transform.setTranslation(startPoint); | |
| 695 | + // draw a yellow sphere at the capsule bottom point | |
| 696 | + glm::vec3 bottomPoint = topPoint - glm::vec3(0.0f, -_boundingCapsuleHeight, 0.0f); | |
| 697 | + glm::vec3 axis = topPoint - bottomPoint; | |
| 698 | + transform.setTranslation(bottomPoint); | |
| 712 | 699 | batch.setModelTransform(transform); |
| 713 | 700 | deferredLighting->bindSimpleProgram(batch); |
| 714 | − geometryCache->renderSphere(batch, _boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, | |
| 701 | + geometryCache->renderSphere(batch, _boundingCapsuleRadius, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS, | |
| 715 | 702 | glm::vec4(0.8f, 0.8f, 0.6f, alpha)); |
| 716 | 703 | |
| 717 | 704 | // draw a green cylinder between the two points |
| 718 | 705 | glm::vec3 origin(0.0f); |
| 719 | − Avatar::renderJointConnectingCone(batch, origin, axis, _boundingShape.getRadius(), _boundingShape.getRadius(), | |
| 706 | + Avatar::renderJointConnectingCone(batch, origin, axis, _boundingCapsuleRadius, _boundingCapsuleRadius, | |
| 720 | 707 | glm::vec4(0.6f, 0.8f, 0.6f, alpha)); |
| 721 | 708 | } |
| 722 | 709 | |