Merge pull request #11375 from hyperlogic/bug-fix/avatar-attachments-rendering

Avatar Attachments now render correctly
This commit is contained in:
Anthony Thibault 2017-09-15 13:28:00 -07:00 committed by GitHub
commit c7fc45e0ae
8 changed files with 14 additions and 16 deletions

View file

@ -5209,7 +5209,7 @@ void Application::update(float deltaTime) {
}
}
avatarManager->postUpdate(deltaTime);
avatarManager->postUpdate(deltaTime, getMain3DScene());
{
PROFILE_RANGE_EX(app, "PreRenderLambdas", 0xffff0000, (uint64_t)0);

View file

@ -259,12 +259,12 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
simulateAvatarFades(deltaTime);
}
void AvatarManager::postUpdate(float deltaTime) {
void AvatarManager::postUpdate(float deltaTime, const render::ScenePointer& scene) {
auto hashCopy = getHashCopy();
AvatarHash::iterator avatarIterator = hashCopy.begin();
for (avatarIterator = hashCopy.begin(); avatarIterator != hashCopy.end(); avatarIterator++) {
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
avatar->postUpdate(deltaTime);
avatar->postUpdate(deltaTime, scene);
}
}

View file

@ -55,7 +55,7 @@ public:
void updateMyAvatar(float deltaTime);
void updateOtherAvatars(float deltaTime);
void postUpdate(float deltaTime);
void postUpdate(float deltaTime, const render::ScenePointer& scene);
void clearOtherAvatars();
void deleteAllAvatars();

View file

@ -1814,11 +1814,11 @@ void MyAvatar::destroyAnimGraph() {
_skeletonModel->getRig().destroyAnimGraph();
}
void MyAvatar::postUpdate(float deltaTime) {
void MyAvatar::postUpdate(float deltaTime, const render::ScenePointer& scene) {
Avatar::postUpdate(deltaTime);
Avatar::postUpdate(deltaTime, scene);
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars() && _skeletonModel->initWhenReady(qApp->getMain3DScene())) {
if (_skeletonModel->isLoaded() && !_skeletonModel->getRig().getAnimNode()) {
initHeadBones();
_skeletonModel->setCauterizeBoneSet(_headBoneSet);
_fstAnimGraphOverrideUrl = _skeletonModel->getGeometry()->getAnimGraphOverrideUrl();

View file

@ -197,7 +197,7 @@ public:
Q_INVOKABLE void clearIKJointLimitHistory(); // thread-safe
void update(float deltaTime);
virtual void postUpdate(float deltaTime) override;
virtual void postUpdate(float deltaTime, const render::ScenePointer& scene) override;
void preDisplaySide(RenderArgs* renderArgs);
const glm::mat4& getHMDSensorMatrix() const { return _hmdSensorMatrix; }

View file

@ -553,7 +553,7 @@ void Avatar::updateRenderItem(render::Transaction& transaction) {
}
}
void Avatar::postUpdate(float deltaTime) {
void Avatar::postUpdate(float deltaTime, const render::ScenePointer& scene) {
if (isMyAvatar() ? showMyLookAtVectors : showOtherLookAtVectors) {
const float EYE_RAY_LENGTH = 10.0;
@ -577,6 +577,8 @@ void Avatar::postUpdate(float deltaTime) {
DebugDraw::getInstance().drawRay(rightEyePosition, rightEyePosition + rightEyeRotation * Vectors::UNIT_Z * EYE_RAY_LENGTH, RED);
}
}
fixupModelsInScene(scene);
}
void Avatar::render(RenderArgs* renderArgs) {
@ -648,10 +650,6 @@ void Avatar::render(RenderArgs* renderArgs) {
return;
}
if (!isMyAvatar()) {
fixupModelsInScene(renderArgs->_scene);
}
if (showCollisionShapes && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) {
PROFILE_RANGE_BATCH(batch, __FUNCTION__":skeletonBoundingCollisionShapes");
const float BOUNDING_SHAPE_ALPHA = 0.7f;

View file

@ -98,7 +98,7 @@ public:
void updateRenderItem(render::Transaction& transaction);
virtual void postUpdate(float deltaTime);
virtual void postUpdate(float deltaTime, const render::ScenePointer& scene);
//setters
void setIsLookAtTarget(const bool isLookAtTarget) { _isLookAtTarget = isLookAtTarget; }

View file

@ -89,9 +89,9 @@ var coatButton = new ToggleButtonBuddy(buttonPositionX, buttonPositionY, BUTTON_
var HAT_ATTACHMENT = {
modelURL: "https://s3.amazonaws.com/hifi-public/tony/cowboy-hat.fbx",
jointName: "Head",
translation: {"x": 0, "y": 0.2, "z": 0},
translation: {"x": 0, "y": 0.25, "z": 0.03},
rotation: {"x": 0, "y": 0, "z": 0, "w": 1},
scale: 1,
scale: 0.052,
isSoft: false
};