everything working before trying to move otheravatar to interface

This commit is contained in:
amantley 2018-06-26 13:18:26 -07:00
parent 232dc21c7b
commit fa1a9d04e0
6 changed files with 48 additions and 11 deletions

View file

@ -196,7 +196,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
//if the geometry is loaded then turn off the orb
if (avatar->getSkeletonModel()->isLoaded()) {
//remove the orb if it is there
avatar->removeOrb();
removeOrb(avatar->_purpleOrbMeshPlaceholderID);
} else {
avatar->updateOrbPosition();
}
@ -325,7 +325,34 @@ void AvatarManager::simulateAvatarFades(float deltaTime) {
}
AvatarSharedPointer AvatarManager::newSharedAvatar() {
return AvatarSharedPointer(new OtherAvatar(qApp->thread()), [](OtherAvatar* ptr) { ptr->deleteLater(); });
auto newOtherAvatar = AvatarSharedPointer(new OtherAvatar(qApp->thread()), [](OtherAvatar* ptr) { ptr->deleteLater(); });
//add the purple orb
/*
if (newOtherAvatar->_purpleOrbMeshPlaceholderID == UNKNOWN_OVERLAY_ID ||
!qApp->getOverlays().isAddedOverlay(newOtherAvatar->_purpleOrbMeshPlaceholderID)) {
newOtherAvatar->_purpleOrbMeshPlaceholder = std::make_shared<Sphere3DOverlay>();
newOtherAvatar->_purpleOrbMeshPlaceholder->setAlpha(1.0f);
newOtherAvatar->_purpleOrbMeshPlaceholder->setColor({ 0xFF, 0x00, 0xFF });
newOtherAvatar->_purpleOrbMeshPlaceholder->setIsSolid(false);
newOtherAvatar->_purpleOrbMeshPlaceholder->setPulseMin(0.5);
newOtherAvatar->_purpleOrbMeshPlaceholder->setPulseMax(1.0);
newOtherAvatar->_purpleOrbMeshPlaceholder->setColorPulse(1.0);
newOtherAvatar->_purpleOrbMeshPlaceholder->setIgnoreRayIntersection(true);
newOtherAvatar->_purpleOrbMeshPlaceholder->setDrawInFront(false);
newOtherAvatar->_purpleOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(newOtherAvatar->_purpleOrbMeshPlaceholder);
// Position focus
newOtherAvatar->_purpleOrbMeshPlaceholder->setWorldOrientation(glm::quat(0.0f, 0.0f, 0.0f, 1.0));
newOtherAvatar->_purpleOrbMeshPlaceholder->setWorldPosition(glm::vec3(476.0f, 500.0f, 493.0f));
newOtherAvatar->_purpleOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
newOtherAvatar->_purpleOrbMeshPlaceholder->setVisible(true);
}
*/
return newOtherAvatar;
}
void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
@ -621,3 +648,12 @@ void AvatarManager::setAvatarSortCoefficient(const QString& name, const QScriptV
DependencyManager::get<NodeList>()->broadcastToNodes(std::move(packet), NodeSet() << NodeType::AvatarMixer);
}
}
void AvatarManager::removeOrb(OverlayID orbID) {
if (qApp->getOverlays().isAddedOverlay(orbID)) {
qApp->getOverlays().deleteOverlay(orbID);
//qCWarning(avatars_renderer) << "remove the purple orb***************************";
}
}

View file

@ -158,6 +158,8 @@ public:
float getMyAvatarSendRate() const { return _myAvatarSendRate.rate(); }
void removeOrb(OverlayID orbID);
public slots:
/**jsdoc

View file

@ -1891,16 +1891,11 @@ void Avatar::processMaterials() {
}
}
}
void Avatar::removeOrb() {
if (qApp->getOverlays().isAddedOverlay(_purpleOrbMeshPlaceholderID)) {
qApp->getOverlays().deleteOverlay(_purpleOrbMeshPlaceholderID);
qCWarning(avatars_renderer) << "remove the purple orb***************************";
}
}
void Avatar::updateOrbPosition() {
_purpleOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition());
}
}
scriptable::ScriptableModelBase Avatar::getScriptableModel() {
if (!_skeletonModel || !_skeletonModel->isLoaded()) {
return scriptable::ScriptableModelBase();

View file

@ -367,10 +367,10 @@ public:
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
virtual scriptable::ScriptableModelBase getScriptableModel() override;
void removeOrb();
void updateOrbPosition();
std::shared_ptr<Sphere3DOverlay> _purpleOrbMeshPlaceholder{ nullptr };
OverlayID _purpleOrbMeshPlaceholderID{ UNKNOWN_OVERLAY_ID };
OverlayID _purpleOrbMeshPlaceholderID{ UNKNOWN_OVERLAY_ID };
public slots:
// FIXME - these should be migrated to use Pose data instead

View file

@ -19,6 +19,7 @@ OtherAvatar::OtherAvatar(QThread* thread) : Avatar(thread) {
connect(_skeletonModel.get(), &Model::rigReset, this, &Avatar::rigReset);
//add the purple orb
if (_purpleOrbMeshPlaceholderID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_purpleOrbMeshPlaceholderID)) {
_purpleOrbMeshPlaceholder = std::make_shared<Sphere3DOverlay>();
_purpleOrbMeshPlaceholder->setAlpha(1.0f);
@ -36,4 +37,5 @@ OtherAvatar::OtherAvatar(QThread* thread) : Avatar(thread) {
_purpleOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
_purpleOrbMeshPlaceholder->setVisible(true);
}
}

View file

@ -55,6 +55,8 @@
#include "PathUtils.h"
#include <graphics/Material.h>
//#include "Overlays.h"
//#include "Sphere3DOverlay.h"
using AvatarSharedPointer = std::shared_ptr<AvatarData>;
using AvatarWeakPointer = std::weak_ptr<AvatarData>;