This commit is contained in:
HifiExperiments 2020-12-23 21:29:59 -08:00
parent f33c7de67a
commit 1475cae504
5 changed files with 9 additions and 9 deletions

View file

@ -152,11 +152,11 @@ void SkeletonModel::updateAttitude(const glm::quat& orientation) {
// Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed),
// but just before head has been simulated.
void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
void SkeletonModel::simulate(float deltaTime, bool fullUpdate, bool skeleton) {
updateAttitude(_owningAvatar->getWorldOrientation());
setBlendshapeCoefficients(_owningAvatar->getHead()->getSummedBlendshapeCoefficients());
Parent::simulate(deltaTime, fullUpdate);
Parent::simulate(deltaTime, fullUpdate, true);
if (fullUpdate) {
// let rig compute the model offset
glm::vec3 registrationPoint;

View file

@ -36,7 +36,7 @@ public:
void initJointStates() override;
void simulate(float deltaTime, bool fullUpdate = true) override;
void simulate(float deltaTime, bool fullUpdate = true, bool skeleton = false) override;
glm::vec3 avoidCrossedEyes(const glm::vec3& lookAt);
void updateRig(float deltaTime, glm::mat4 parentTransform) override;
void updateAttitude(const glm::quat& orientation);

View file

@ -241,9 +241,6 @@ EntityItemID EntityTreeElement::evalDetailedRayIntersection(const glm::vec3& ori
// now ask the entity if we actually intersect
if (entity->supportsDetailedIntersection()) {
QVariantMap localExtraInfo;
if (entity->getName().contains("boop")) {
qDebug() << entity->getName() << entity->getPivot() << entityFrameBox;
}
if (entity->findDetailedRayIntersection(origin, direction, element, localDistance,
localFace, localSurfaceNormal, localExtraInfo, searchFilter.isPrecise())) {
if (localDistance < distance) {

View file

@ -362,6 +362,9 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g
// we can use the AABox's intersection by mapping our origin and direction into the model frame
// and testing intersection there.
if (modelFrameBox.findRayIntersection(modelFrameOrigin, modelFrameDirection, 1.0f / modelFrameDirection, distance, face, surfaceNormal)) {
if (getURL().toString().toLower().contains("sink")) {
qDebug() << "boop" << modelFrameBox;
}
QMutexLocker locker(&_mutex);
float bestDistance = FLT_MAX;
@ -1427,7 +1430,7 @@ void Model::setUseDualQuaternionSkinning(bool value) {
_useDualQuaternionSkinning = value;
}
void Model::simulate(float deltaTime, bool fullUpdate) {
void Model::simulate(float deltaTime, bool fullUpdate, bool skeleton) {
DETAILED_PROFILE_RANGE(simulation_detail, __FUNCTION__);
fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit)
|| (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint) || _needsTransformUpdate;
@ -1443,7 +1446,7 @@ void Model::simulate(float deltaTime, bool fullUpdate) {
snapToRegistrationPoint();
}
// update the world space transforms for all joints
glm::mat4 parentTransform = glm::scale(_scale) * (_snapModelToRegistrationPoint ?
glm::mat4 parentTransform = glm::scale(_scale) * ((_snapModelToRegistrationPoint || skeleton) ?
glm::translate(_offset) : glm::translate(getNaturalDimensions() * (0.5f - _registrationPoint)));
updateRig(deltaTime, parentTransform);
_needsTransformUpdate = false;

View file

@ -169,7 +169,7 @@ public:
bool getSnapModelToRegistrationPoint() { return _snapModelToRegistrationPoint; }
bool getSnappedToRegistrationPoint() { return _snappedToRegistrationPoint; }
virtual void simulate(float deltaTime, bool fullUpdate = true);
virtual void simulate(float deltaTime, bool fullUpdate = true, bool skeleton = false);
virtual void updateClusterMatrices();
virtual void updateBlendshapes();