mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 04:37:59 +02:00
Moved OtherAvatar class to interface project. This allows AvatarManager to create and delete the orb overlay that is drawn when an avatar is present in a domain but for some reason the geometry is not loaded. OtherAvatar has new members orbMeshPlaceholder and orbMeshPlaceholderID for a spherical orb that is drawn
This commit is contained in:
parent
fa1a9d04e0
commit
46c70d948f
7 changed files with 157 additions and 170 deletions
|
@ -36,13 +36,13 @@
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include <UsersScriptingInterface.h>
|
#include <UsersScriptingInterface.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
#include <avatars-renderer/OtherAvatar.h>
|
|
||||||
#include <shared/ConicalViewFrustum.h>
|
#include <shared/ConicalViewFrustum.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
|
#include "OtherAvatar.h"
|
||||||
#include "SceneScriptingInterface.h"
|
#include "SceneScriptingInterface.h"
|
||||||
|
|
||||||
// 50 times per second - target is 45hz, but this helps account for any small deviations
|
// 50 times per second - target is 45hz, but this helps account for any small deviations
|
||||||
|
@ -192,13 +192,14 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
||||||
while (!sortedAvatars.empty()) {
|
while (!sortedAvatars.empty()) {
|
||||||
const SortableAvatar& sortData = sortedAvatars.top();
|
const SortableAvatar& sortData = sortedAvatars.top();
|
||||||
const auto avatar = std::static_pointer_cast<Avatar>(sortData.getAvatar());
|
const auto avatar = std::static_pointer_cast<Avatar>(sortData.getAvatar());
|
||||||
|
const auto otherAvatar = std::static_pointer_cast<OtherAvatar>(sortData.getAvatar());
|
||||||
|
|
||||||
//if the geometry is loaded then turn off the orb
|
//if the geometry is loaded then turn off the orb
|
||||||
if (avatar->getSkeletonModel()->isLoaded()) {
|
if (avatar->getSkeletonModel()->isLoaded()) {
|
||||||
//remove the orb if it is there
|
//remove the orb if it is there
|
||||||
removeOrb(avatar->_purpleOrbMeshPlaceholderID);
|
otherAvatar->removeOrb();
|
||||||
} else {
|
} else {
|
||||||
avatar->updateOrbPosition();
|
otherAvatar->updateOrbPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ignoring = DependencyManager::get<NodeList>()->isPersonalMutingNode(avatar->getID());
|
bool ignoring = DependencyManager::get<NodeList>()->isPersonalMutingNode(avatar->getID());
|
||||||
|
@ -327,30 +328,6 @@ void AvatarManager::simulateAvatarFades(float deltaTime) {
|
||||||
AvatarSharedPointer AvatarManager::newSharedAvatar() {
|
AvatarSharedPointer AvatarManager::newSharedAvatar() {
|
||||||
|
|
||||||
auto newOtherAvatar = 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;
|
return newOtherAvatar;
|
||||||
}
|
}
|
||||||
|
@ -649,11 +626,6 @@ void AvatarManager::setAvatarSortCoefficient(const QString& name, const QScriptV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarManager::removeOrb(OverlayID orbID) {
|
|
||||||
if (qApp->getOverlays().isAddedOverlay(orbID)) {
|
|
||||||
qApp->getOverlays().deleteOverlay(orbID);
|
|
||||||
//qCWarning(avatars_renderer) << "remove the purple orb***************************";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
58
interface/src/avatar/OtherAvatar.cpp
Normal file
58
interface/src/avatar/OtherAvatar.cpp
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2017/04/27
|
||||||
|
// Copyright 2013-2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "OtherAvatar.h"
|
||||||
|
#include "../../interface/src/Application.h"
|
||||||
|
|
||||||
|
OtherAvatar::OtherAvatar(QThread* thread) : Avatar(thread) {
|
||||||
|
// give the pointer to our head to inherited _headData variable from AvatarData
|
||||||
|
_headData = new Head(this);
|
||||||
|
_skeletonModel = std::make_shared<SkeletonModel>(this, nullptr);
|
||||||
|
_skeletonModel->setLoadingPriority(OTHERAVATAR_LOADING_PRIORITY);
|
||||||
|
connect(_skeletonModel.get(), &Model::setURLFinished, this, &Avatar::setModelURLFinished);
|
||||||
|
connect(_skeletonModel.get(), &Model::rigReady, this, &Avatar::rigReady);
|
||||||
|
connect(_skeletonModel.get(), &Model::rigReset, this, &Avatar::rigReset);
|
||||||
|
|
||||||
|
//add the purple orb
|
||||||
|
createOrb();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OtherAvatar::removeOrb() {
|
||||||
|
if (qApp->getOverlays().isAddedOverlay(_otherAvatarOrbMeshPlaceholderID)) {
|
||||||
|
qApp->getOverlays().deleteOverlay(_otherAvatarOrbMeshPlaceholderID);
|
||||||
|
//qCWarning(avatars_renderer) << "remove the purple orb***************************";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OtherAvatar::updateOrbPosition() {
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OtherAvatar::createOrb() {
|
||||||
|
qCDebug(interfaceapp) << "we are in create orb otherAvatar.h";
|
||||||
|
if (_otherAvatarOrbMeshPlaceholderID == UNKNOWN_OVERLAY_ID ||
|
||||||
|
!qApp->getOverlays().isAddedOverlay(_otherAvatarOrbMeshPlaceholderID)) {
|
||||||
|
_otherAvatarOrbMeshPlaceholder = std::make_shared<Sphere3DOverlay>();
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setAlpha(1.0f);
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setColor({ 0xFF, 0x00, 0xFF });
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setIsSolid(false);
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setPulseMin(0.5);
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setPulseMax(1.0);
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setColorPulse(1.0);
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setIgnoreRayIntersection(true);
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setDrawInFront(false);
|
||||||
|
_otherAvatarOrbMeshPlaceholderID = qApp->getOverlays().addOverlay(_otherAvatarOrbMeshPlaceholder);
|
||||||
|
// Position focus
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setWorldOrientation(glm::quat(0.0f, 0.0f, 0.0f, 1.0));
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setWorldPosition(glm::vec3(476.0f, 500.0f, 493.0f));
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
|
||||||
|
_otherAvatarOrbMeshPlaceholder->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
28
interface/src/avatar/OtherAvatar.h
Normal file
28
interface/src/avatar/OtherAvatar.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2017/04/27
|
||||||
|
// Copyright 2013-2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_OtherAvatar_h
|
||||||
|
#define hifi_OtherAvatar_h
|
||||||
|
|
||||||
|
#include <avatars-renderer/Avatar.h>
|
||||||
|
#include "ui/overlays/Overlays.h"
|
||||||
|
#include "ui/overlays/Sphere3DOverlay.h"
|
||||||
|
#include "InterfaceLogging.h"
|
||||||
|
|
||||||
|
class OtherAvatar : public Avatar {
|
||||||
|
public:
|
||||||
|
explicit OtherAvatar(QThread* thread);
|
||||||
|
virtual void instantiableAvatar() override{};
|
||||||
|
void createOrb() override;
|
||||||
|
void updateOrbPosition();
|
||||||
|
void removeOrb();
|
||||||
|
std::shared_ptr<Sphere3DOverlay> _otherAvatarOrbMeshPlaceholder{ nullptr };
|
||||||
|
OverlayID _otherAvatarOrbMeshPlaceholderID{ UNKNOWN_OVERLAY_ID };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_OtherAvatar_h
|
|
@ -1340,25 +1340,7 @@ void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const {
|
||||||
|
|
||||||
void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||||
if (!isMyAvatar()) {
|
if (!isMyAvatar()) {
|
||||||
if (_purpleOrbMeshPlaceholderID == UNKNOWN_OVERLAY_ID ||
|
createOrb();
|
||||||
!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);
|
AvatarData::setSkeletonModelURL(skeletonModelURL);
|
||||||
if (QThread::currentThread() == thread()) {
|
if (QThread::currentThread() == thread()) {
|
||||||
|
@ -1892,9 +1874,7 @@ void Avatar::processMaterials() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::updateOrbPosition() {
|
|
||||||
_purpleOrbMeshPlaceholder->setWorldPosition(getHead()->getPosition());
|
|
||||||
}
|
|
||||||
|
|
||||||
scriptable::ScriptableModelBase Avatar::getScriptableModel() {
|
scriptable::ScriptableModelBase Avatar::getScriptableModel() {
|
||||||
if (!_skeletonModel || !_skeletonModel->isLoaded()) {
|
if (!_skeletonModel || !_skeletonModel->isLoaded()) {
|
||||||
|
|
|
@ -23,29 +23,34 @@
|
||||||
#include <graphics-scripting/Forward.h>
|
#include <graphics-scripting/Forward.h>
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Head.h"
|
#include "Head.h"
|
||||||
#include "SkeletonModel.h"
|
#include "SkeletonModel.h"
|
||||||
#include "Rig.h"
|
#include "Rig.h"
|
||||||
#include "../../interface/src/ui/overlays/Overlays.h"
|
#include "../../interface/src/ui/overlays/Overlays.h"
|
||||||
#include "../../interface/src/ui/overlays/Sphere3DOverlay.h"
|
#include "../../interface/src/ui/overlays/Sphere3DOverlay.h"
|
||||||
|
|
||||||
|
#include "Logging.h"
|
||||||
|
|
||||||
#include <ThreadSafeValueCache.h>
|
#include <ThreadSafeValueCache.h>
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
template <> const ItemKey payloadGetKey(const AvatarSharedPointer& avatar);
|
template <>
|
||||||
template <> const Item::Bound payloadGetBound(const AvatarSharedPointer& avatar);
|
const ItemKey payloadGetKey(const AvatarSharedPointer& avatar);
|
||||||
template <> void payloadRender(const AvatarSharedPointer& avatar, RenderArgs* args);
|
template <>
|
||||||
template <> uint32_t metaFetchMetaSubItems(const AvatarSharedPointer& avatar, ItemIDs& subItems);
|
const Item::Bound payloadGetBound(const AvatarSharedPointer& avatar);
|
||||||
}
|
template <>
|
||||||
|
void payloadRender(const AvatarSharedPointer& avatar, RenderArgs* args);
|
||||||
|
template <>
|
||||||
|
uint32_t metaFetchMetaSubItems(const AvatarSharedPointer& avatar, ItemIDs& subItems);
|
||||||
|
} // namespace render
|
||||||
|
|
||||||
static const float SCALING_RATIO = .05f;
|
static const float SCALING_RATIO = .05f;
|
||||||
|
|
||||||
extern const float CHAT_MESSAGE_SCALE;
|
extern const float CHAT_MESSAGE_SCALE;
|
||||||
extern const float CHAT_MESSAGE_HEIGHT;
|
extern const float CHAT_MESSAGE_HEIGHT;
|
||||||
|
|
||||||
|
enum ScreenTintLayer
|
||||||
enum ScreenTintLayer {
|
{
|
||||||
SCREEN_TINT_BEFORE_LANDSCAPE = 0,
|
SCREEN_TINT_BEFORE_LANDSCAPE = 0,
|
||||||
SCREEN_TINT_BEFORE_AVATARS,
|
SCREEN_TINT_BEFORE_AVATARS,
|
||||||
SCREEN_TINT_BEFORE_MY_AVATAR,
|
SCREEN_TINT_BEFORE_MY_AVATAR,
|
||||||
|
@ -85,11 +90,9 @@ public:
|
||||||
|
|
||||||
virtual void render(RenderArgs* renderArgs);
|
virtual void render(RenderArgs* renderArgs);
|
||||||
|
|
||||||
void addToScene(AvatarSharedPointer self, const render::ScenePointer& scene,
|
void addToScene(AvatarSharedPointer self, const render::ScenePointer& scene, render::Transaction& transaction);
|
||||||
render::Transaction& transaction);
|
|
||||||
|
|
||||||
void removeFromScene(AvatarSharedPointer self, const render::ScenePointer& scene,
|
void removeFromScene(AvatarSharedPointer self, const render::ScenePointer& scene, render::Transaction& transaction);
|
||||||
render::Transaction& transaction);
|
|
||||||
|
|
||||||
void updateRenderItem(render::Transaction& transaction);
|
void updateRenderItem(render::Transaction& transaction);
|
||||||
|
|
||||||
|
@ -112,6 +115,7 @@ public:
|
||||||
float getLODDistance() const;
|
float getLODDistance() const;
|
||||||
|
|
||||||
virtual bool isMyAvatar() const override { return false; }
|
virtual bool isMyAvatar() const override { return false; }
|
||||||
|
virtual void createOrb() { qCDebug(avatars_renderer) << "we are in create orb avatar.h"; }
|
||||||
|
|
||||||
virtual QVector<glm::quat> getJointRotations() const override;
|
virtual QVector<glm::quat> getJointRotations() const override;
|
||||||
using AvatarData::getJointRotation;
|
using AvatarData::getJointRotation;
|
||||||
|
@ -166,14 +170,18 @@ public:
|
||||||
virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData) override;
|
virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData) override;
|
||||||
|
|
||||||
void updateDisplayNameAlpha(bool showDisplayName);
|
void updateDisplayNameAlpha(bool showDisplayName);
|
||||||
virtual void setSessionDisplayName(const QString& sessionDisplayName) override { }; // no-op
|
virtual void setSessionDisplayName(const QString& sessionDisplayName) override{}; // no-op
|
||||||
|
|
||||||
virtual int parseDataFromBuffer(const QByteArray& buffer) override;
|
virtual int parseDataFromBuffer(const QByteArray& buffer) override;
|
||||||
|
|
||||||
static void renderJointConnectingCone( gpu::Batch& batch, glm::vec3 position1, glm::vec3 position2,
|
static void renderJointConnectingCone(gpu::Batch& batch,
|
||||||
float radius1, float radius2, const glm::vec4& color);
|
glm::vec3 position1,
|
||||||
|
glm::vec3 position2,
|
||||||
|
float radius1,
|
||||||
|
float radius2,
|
||||||
|
const glm::vec4& color);
|
||||||
|
|
||||||
virtual void applyCollision(const glm::vec3& contactPoint, const glm::vec3& penetration) { }
|
virtual void applyCollision(const glm::vec3& contactPoint, const glm::vec3& penetration) {}
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Set the offset applied to the current avatar. The offset adjusts the position that the avatar is rendered. For example,
|
* Set the offset applied to the current avatar. The offset adjusts the position that the avatar is rendered. For example,
|
||||||
|
@ -238,7 +246,7 @@ public:
|
||||||
|
|
||||||
/// Scales a world space position vector relative to the avatar position and scale
|
/// Scales a world space position vector relative to the avatar position and scale
|
||||||
/// \param vector position to be scaled. Will store the result
|
/// \param vector position to be scaled. Will store the result
|
||||||
void scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const;
|
void scaleVectorRelativeToPosition(glm::vec3& positionToScale) const;
|
||||||
|
|
||||||
void slamPosition(const glm::vec3& position);
|
void slamPosition(const glm::vec3& position);
|
||||||
virtual void updateAttitude(const glm::quat& orientation) override;
|
virtual void updateAttitude(const glm::quat& orientation) override;
|
||||||
|
@ -257,7 +265,6 @@ public:
|
||||||
void setPositionViaScript(const glm::vec3& position) override;
|
void setPositionViaScript(const glm::vec3& position) override;
|
||||||
void setOrientationViaScript(const glm::quat& orientation) override;
|
void setOrientationViaScript(const glm::quat& orientation) override;
|
||||||
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function MyAvatar.getParentID
|
* @function MyAvatar.getParentID
|
||||||
* @returns {Uuid}
|
* @returns {Uuid}
|
||||||
|
@ -286,7 +293,6 @@ public:
|
||||||
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
|
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
|
||||||
Q_INVOKABLE virtual void setParentJointIndex(quint16 parentJointIndex) override;
|
Q_INVOKABLE virtual void setParentJointIndex(quint16 parentJointIndex) override;
|
||||||
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns an array of joints, where each joint is an object containing name, index, and parentIndex fields.
|
* Returns an array of joints, where each joint is an object containing name, index, and parentIndex fields.
|
||||||
* @function MyAvatar.getSkeleton
|
* @function MyAvatar.getSkeleton
|
||||||
|
@ -324,7 +330,8 @@ public:
|
||||||
bool hasNewJointData() const { return _hasNewJointData; }
|
bool hasNewJointData() const { return _hasNewJointData; }
|
||||||
|
|
||||||
float getBoundingRadius() const;
|
float getBoundingRadius() const;
|
||||||
AABox getRenderBounds() const; // THis call is accessible from rendering thread only to report the bounding box of the avatar during the frame.
|
AABox getRenderBounds()
|
||||||
|
const; // THis call is accessible from rendering thread only to report the bounding box of the avatar during the frame.
|
||||||
|
|
||||||
void addToScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
void addToScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
||||||
void ensureInScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
void ensureInScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
||||||
|
@ -352,7 +359,6 @@ public:
|
||||||
// not all subclasses of AvatarData have access to this data.
|
// not all subclasses of AvatarData have access to this data.
|
||||||
virtual bool canMeasureEyeHeight() const override { return true; }
|
virtual bool canMeasureEyeHeight() const override { return true; }
|
||||||
|
|
||||||
|
|
||||||
virtual float getModelScale() const { return _modelScale; }
|
virtual float getModelScale() const { return _modelScale; }
|
||||||
virtual void setModelScale(float scale) { _modelScale = scale; }
|
virtual void setModelScale(float scale) { _modelScale = scale; }
|
||||||
virtual glm::vec3 scaleForChildren() const override { return glm::vec3(getModelScale()); }
|
virtual glm::vec3 scaleForChildren() const override { return glm::vec3(getModelScale()); }
|
||||||
|
@ -367,10 +373,10 @@ public:
|
||||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
||||||
|
|
||||||
virtual scriptable::ScriptableModelBase getScriptableModel() override;
|
virtual scriptable::ScriptableModelBase getScriptableModel() override;
|
||||||
|
|
||||||
void updateOrbPosition();
|
//void updateOrbPosition();
|
||||||
std::shared_ptr<Sphere3DOverlay> _purpleOrbMeshPlaceholder{ nullptr };
|
//std::shared_ptr<Sphere3DOverlay> _purpleOrbMeshPlaceholder{ nullptr };
|
||||||
OverlayID _purpleOrbMeshPlaceholderID{ UNKNOWN_OVERLAY_ID };
|
//OverlayID _purpleOrbMeshPlaceholderID{ UNKNOWN_OVERLAY_ID };
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
// FIXME - these should be migrated to use Pose data instead
|
// FIXME - these should be migrated to use Pose data instead
|
||||||
|
@ -432,9 +438,13 @@ protected:
|
||||||
float getUnscaledEyeHeightFromSkeleton() const;
|
float getUnscaledEyeHeightFromSkeleton() const;
|
||||||
void buildUnscaledEyeHeightCache();
|
void buildUnscaledEyeHeightCache();
|
||||||
void clearUnscaledEyeHeightCache();
|
void clearUnscaledEyeHeightCache();
|
||||||
virtual const QString& getSessionDisplayNameForTransport() const override { return _empty; } // Save a tiny bit of bandwidth. Mixer won't look at what we send.
|
virtual const QString& getSessionDisplayNameForTransport() const override {
|
||||||
|
return _empty;
|
||||||
|
} // Save a tiny bit of bandwidth. Mixer won't look at what we send.
|
||||||
QString _empty{};
|
QString _empty{};
|
||||||
virtual void maybeUpdateSessionDisplayNameFromTransport(const QString& sessionDisplayName) override { _sessionDisplayName = sessionDisplayName; } // don't use no-op setter!
|
virtual void maybeUpdateSessionDisplayNameFromTransport(const QString& sessionDisplayName) override {
|
||||||
|
_sessionDisplayName = sessionDisplayName;
|
||||||
|
} // don't use no-op setter!
|
||||||
|
|
||||||
SkeletonModelPointer _skeletonModel;
|
SkeletonModelPointer _skeletonModel;
|
||||||
|
|
||||||
|
@ -442,7 +452,7 @@ protected:
|
||||||
void withValidJointIndicesCache(std::function<void()> const& worker) const;
|
void withValidJointIndicesCache(std::function<void()> const& worker) const;
|
||||||
mutable QHash<QString, int> _modelJointIndicesCache;
|
mutable QHash<QString, int> _modelJointIndicesCache;
|
||||||
mutable QReadWriteLock _modelJointIndicesCacheLock;
|
mutable QReadWriteLock _modelJointIndicesCacheLock;
|
||||||
mutable bool _modelJointsCached { false };
|
mutable bool _modelJointsCached{ false };
|
||||||
|
|
||||||
glm::vec3 _skeletonOffset;
|
glm::vec3 _skeletonOffset;
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
||||||
|
@ -450,7 +460,7 @@ protected:
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentsToRemove;
|
std::vector<std::shared_ptr<Model>> _attachmentsToRemove;
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentsToDelete;
|
std::vector<std::shared_ptr<Model>> _attachmentsToDelete;
|
||||||
|
|
||||||
float _bodyYawDelta { 0.0f }; // degrees/sec
|
float _bodyYawDelta{ 0.0f }; // degrees/sec
|
||||||
|
|
||||||
// These position histories and derivatives are in the world-frame.
|
// These position histories and derivatives are in the world-frame.
|
||||||
// The derivatives are the MEASURED results of all external and internal forces
|
// The derivatives are the MEASURED results of all external and internal forces
|
||||||
|
@ -466,8 +476,8 @@ protected:
|
||||||
glm::vec3 _angularAcceleration;
|
glm::vec3 _angularAcceleration;
|
||||||
glm::quat _lastOrientation;
|
glm::quat _lastOrientation;
|
||||||
|
|
||||||
glm::vec3 _worldUpDirection { Vectors::UP };
|
glm::vec3 _worldUpDirection{ Vectors::UP };
|
||||||
bool _moving { false }; ///< set when position is changing
|
bool _moving{ false }; ///< set when position is changing
|
||||||
|
|
||||||
// protected methods...
|
// protected methods...
|
||||||
bool isLookingAtMe(AvatarSharedPointer avatar) const;
|
bool isLookingAtMe(AvatarSharedPointer avatar) const;
|
||||||
|
@ -493,10 +503,10 @@ protected:
|
||||||
|
|
||||||
render::ItemID _renderItemID{ render::Item::INVALID_ITEM_ID };
|
render::ItemID _renderItemID{ render::Item::INVALID_ITEM_ID };
|
||||||
|
|
||||||
ThreadSafeValueCache<glm::vec3> _leftPalmPositionCache { glm::vec3() };
|
ThreadSafeValueCache<glm::vec3> _leftPalmPositionCache{ glm::vec3() };
|
||||||
ThreadSafeValueCache<glm::quat> _leftPalmRotationCache { glm::quat() };
|
ThreadSafeValueCache<glm::quat> _leftPalmRotationCache{ glm::quat() };
|
||||||
ThreadSafeValueCache<glm::vec3> _rightPalmPositionCache { glm::vec3() };
|
ThreadSafeValueCache<glm::vec3> _rightPalmPositionCache{ glm::vec3() };
|
||||||
ThreadSafeValueCache<glm::quat> _rightPalmRotationCache { glm::quat() };
|
ThreadSafeValueCache<glm::quat> _rightPalmRotationCache{ glm::quat() };
|
||||||
|
|
||||||
// Some rate tracking support
|
// Some rate tracking support
|
||||||
RateCounter<> _simulationRate;
|
RateCounter<> _simulationRate;
|
||||||
|
@ -507,36 +517,36 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
class AvatarEntityDataHash {
|
class AvatarEntityDataHash {
|
||||||
public:
|
public:
|
||||||
AvatarEntityDataHash(uint32_t h) : hash(h) {};
|
AvatarEntityDataHash(uint32_t h) : hash(h){};
|
||||||
uint32_t hash { 0 };
|
uint32_t hash{ 0 };
|
||||||
bool success { false };
|
bool success{ false };
|
||||||
};
|
};
|
||||||
|
|
||||||
using MapOfAvatarEntityDataHashes = QMap<QUuid, AvatarEntityDataHash>;
|
using MapOfAvatarEntityDataHashes = QMap<QUuid, AvatarEntityDataHash>;
|
||||||
MapOfAvatarEntityDataHashes _avatarEntityDataHashes;
|
MapOfAvatarEntityDataHashes _avatarEntityDataHashes;
|
||||||
|
|
||||||
uint64_t _lastRenderUpdateTime { 0 };
|
uint64_t _lastRenderUpdateTime{ 0 };
|
||||||
int _leftPointerGeometryID { 0 };
|
int _leftPointerGeometryID{ 0 };
|
||||||
int _rightPointerGeometryID { 0 };
|
int _rightPointerGeometryID{ 0 };
|
||||||
int _nameRectGeometryID { 0 };
|
int _nameRectGeometryID{ 0 };
|
||||||
bool _initialized { false };
|
bool _initialized{ false };
|
||||||
bool _isLookAtTarget { false };
|
bool _isLookAtTarget{ false };
|
||||||
bool _isAnimatingScale { false };
|
bool _isAnimatingScale{ false };
|
||||||
bool _mustFadeIn { false };
|
bool _mustFadeIn{ false };
|
||||||
bool _isFading { false };
|
bool _isFading{ false };
|
||||||
bool _reconstructSoftEntitiesJointMap { false };
|
bool _reconstructSoftEntitiesJointMap{ false };
|
||||||
float _modelScale { 1.0f };
|
float _modelScale{ 1.0f };
|
||||||
|
|
||||||
static int _jointConesID;
|
static int _jointConesID;
|
||||||
|
|
||||||
int _voiceSphereID;
|
int _voiceSphereID;
|
||||||
|
|
||||||
AvatarPhysicsCallback _physicsCallback { nullptr };
|
AvatarPhysicsCallback _physicsCallback{ nullptr };
|
||||||
|
|
||||||
float _displayNameTargetAlpha { 1.0f };
|
float _displayNameTargetAlpha{ 1.0f };
|
||||||
float _displayNameAlpha { 1.0f };
|
float _displayNameAlpha{ 1.0f };
|
||||||
|
|
||||||
ThreadSafeValueCache<float> _unscaledEyeHeightCache { DEFAULT_AVATAR_EYE_HEIGHT };
|
ThreadSafeValueCache<float> _unscaledEyeHeightCache{ DEFAULT_AVATAR_EYE_HEIGHT };
|
||||||
|
|
||||||
std::unordered_map<std::string, graphics::MultiMaterial> _materials;
|
std::unordered_map<std::string, graphics::MultiMaterial> _materials;
|
||||||
std::mutex _materialsLock;
|
std::mutex _materialsLock;
|
||||||
|
@ -552,4 +562,4 @@ protected:
|
||||||
static const float ATTACHMENT_LOADING_PRIORITY;
|
static const float ATTACHMENT_LOADING_PRIORITY;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Avatar_h
|
#endif // hifi_Avatar_h
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Bradley Austin Davis on 2017/04/27
|
|
||||||
// Copyright 2013-2017 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "OtherAvatar.h"
|
|
||||||
#include "../../interface/src/Application.h"
|
|
||||||
|
|
||||||
OtherAvatar::OtherAvatar(QThread* thread) : Avatar(thread) {
|
|
||||||
// give the pointer to our head to inherited _headData variable from AvatarData
|
|
||||||
_headData = new Head(this);
|
|
||||||
_skeletonModel = std::make_shared<SkeletonModel>(this, nullptr);
|
|
||||||
_skeletonModel->setLoadingPriority(OTHERAVATAR_LOADING_PRIORITY);
|
|
||||||
connect(_skeletonModel.get(), &Model::setURLFinished, this, &Avatar::setModelURLFinished);
|
|
||||||
connect(_skeletonModel.get(), &Model::rigReady, this, &Avatar::rigReady);
|
|
||||||
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);
|
|
||||||
_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(glm::vec3(476.0f, 500.0f, 493.0f));
|
|
||||||
_purpleOrbMeshPlaceholder->setDimensions(glm::vec3(0.5f, 0.5f, 0.5f));
|
|
||||||
_purpleOrbMeshPlaceholder->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Bradley Austin Davis on 2017/04/27
|
|
||||||
// Copyright 2013-2017 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_OtherAvatar_h
|
|
||||||
#define hifi_OtherAvatar_h
|
|
||||||
|
|
||||||
#include "Avatar.h"
|
|
||||||
|
|
||||||
class OtherAvatar : public Avatar {
|
|
||||||
public:
|
|
||||||
explicit OtherAvatar(QThread* thread);
|
|
||||||
virtual void instantiableAvatar() override {};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // hifi_OtherAvatar_h
|
|
Loading…
Reference in a new issue