mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
adding changes to add the orb when an avatar is processed by the avatar mixer
and when a new model is being loaded for an avatar. The orb is removed when the geometry has loaded.
This commit is contained in:
parent
acfd562309
commit
b8dea4b869
3 changed files with 46 additions and 1 deletions
|
@ -193,6 +193,14 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
|||
const SortableAvatar& sortData = sortedAvatars.top();
|
||||
const auto avatar = std::static_pointer_cast<Avatar>(sortData.getAvatar());
|
||||
|
||||
//if the geometry is loaded then turn off the orb
|
||||
if (avatar->getSkeletonModel()->isLoaded()) {
|
||||
//remove the orb if it is there
|
||||
avatar->removeOrb();
|
||||
} else {
|
||||
avatar->updateOrbPosition();
|
||||
}
|
||||
|
||||
bool ignoring = DependencyManager::get<NodeList>()->isPersonalMutingNode(avatar->getID());
|
||||
if (ignoring) {
|
||||
sortedAvatars.pop();
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <render/TransitionStage.h>
|
||||
#include "ModelEntityItem.h"
|
||||
#include "RenderableModelEntityItem.h"
|
||||
#include "../../interface/src/Application.h"
|
||||
|
||||
#include <graphics-scripting/Forward.h>
|
||||
|
||||
|
@ -1338,6 +1339,27 @@ void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const {
|
|||
}
|
||||
|
||||
void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||
if (!isMyAvatar()) {
|
||||
if (_purpleOrbMeshPlaceholderID == UNKNOWN_OVERLAY_ID ||
|
||||
!qApp->getOverlays().isAddedOverlay(_purpleOrbMeshPlaceholderID)) {
|
||||
qCWarning(avatars_renderer) << "change model add the purple orb************************";
|
||||
_purpleOrbMeshPlaceholder = std::make_shared<Sphere3DOverlay>();
|
||||
_purpleOrbMeshPlaceholder->setAlpha(1.0f);
|
||||
_purpleOrbMeshPlaceholder->setColor({ 0xFF, 0x00, 0xFF });
|
||||
_purpleOrbMeshPlaceholder->setIsSolid(false);
|
||||
_purpleOrbMeshPlaceholder->setPulseMin(0.5);
|
||||
_purpleOrbMeshPlaceholder->setPulseMax(1.0);
|
||||
_purpleOrbMeshPlaceholder->setColorPulse(1.0);
|
||||
_purpleOrbMeshPlaceholder->setIgnoreRayIntersection(true);
|
||||
_purpleOrbMeshPlaceholder->setDrawInFront(false);
|
||||
_purpleOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(_purpleOrbMeshPlaceholder);
|
||||
// Position focus
|
||||
_purpleOrbMeshPlaceholder->setWorldOrientation(glm::quat(0.0f, 0.0f, 0.0f, 1.0));
|
||||
_purpleOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition());
|
||||
_purpleOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
|
||||
_purpleOrbMeshPlaceholder->setVisible(true);
|
||||
}
|
||||
}
|
||||
AvatarData::setSkeletonModelURL(skeletonModelURL);
|
||||
if (QThread::currentThread() == thread()) {
|
||||
_skeletonModel->setURL(_skeletonModelURL);
|
||||
|
@ -1869,7 +1891,16 @@ 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();
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include "Head.h"
|
||||
#include "SkeletonModel.h"
|
||||
#include "Rig.h"
|
||||
#include "../../interface/src/ui/overlays/Overlays.h"
|
||||
#include "../../interface/src/ui/overlays/Sphere3DOverlay.h"
|
||||
|
||||
#include <ThreadSafeValueCache.h>
|
||||
|
||||
namespace render {
|
||||
|
@ -364,7 +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 };
|
||||
public slots:
|
||||
|
||||
// FIXME - these should be migrated to use Pose data instead
|
||||
|
|
Loading…
Reference in a new issue