mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:47:41 +02:00
remove AvatarManager dependency from Avatar
This commit is contained in:
parent
65682a914d
commit
6393972874
3 changed files with 13 additions and 12 deletions
|
@ -28,7 +28,6 @@
|
||||||
#include <VariantMapToScriptValue.h>
|
#include <VariantMapToScriptValue.h>
|
||||||
#include <DebugDraw.h>
|
#include <DebugDraw.h>
|
||||||
|
|
||||||
#include "AvatarManager.h"
|
|
||||||
#include "AvatarMotionState.h"
|
#include "AvatarMotionState.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
@ -73,6 +72,12 @@ namespace render {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool showReceiveStats = false;
|
||||||
|
void Avatar::setShowReceiveStats(bool receiveStats) {
|
||||||
|
showReceiveStats = receiveStats;
|
||||||
|
}
|
||||||
|
|
||||||
Avatar::Avatar(QThread* thread, RigPointer rig) :
|
Avatar::Avatar(QThread* thread, RigPointer rig) :
|
||||||
AvatarData(),
|
AvatarData(),
|
||||||
_skeletonOffset(0.0f),
|
_skeletonOffset(0.0f),
|
||||||
|
@ -582,7 +587,6 @@ void Avatar::render(RenderArgs* renderArgs) {
|
||||||
bool havePosition, haveRotation;
|
bool havePosition, haveRotation;
|
||||||
|
|
||||||
if (_handState & LEFT_HAND_POINTING_FLAG) {
|
if (_handState & LEFT_HAND_POINTING_FLAG) {
|
||||||
|
|
||||||
if (_handState & IS_FINGER_POINTING_FLAG) {
|
if (_handState & IS_FINGER_POINTING_FLAG) {
|
||||||
int leftIndexTip = getJointIndex("LeftHandIndex4");
|
int leftIndexTip = getJointIndex("LeftHandIndex4");
|
||||||
int leftIndexTipJoint = getJointIndex("LeftHandIndex3");
|
int leftIndexTipJoint = getJointIndex("LeftHandIndex3");
|
||||||
|
@ -809,7 +813,7 @@ Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& view, const g
|
||||||
void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& view, const glm::vec3& textPosition) const {
|
void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& view, const glm::vec3& textPosition) const {
|
||||||
PROFILE_RANGE_BATCH(batch, __FUNCTION__);
|
PROFILE_RANGE_BATCH(batch, __FUNCTION__);
|
||||||
|
|
||||||
bool shouldShowReceiveStats = DependencyManager::get<AvatarManager>()->shouldShowReceiveStats() && !isMyAvatar();
|
bool shouldShowReceiveStats = showReceiveStats && !isMyAvatar();
|
||||||
|
|
||||||
// If we have nothing to draw, or it's totally transparent, or it's too close or behind the camera, return
|
// If we have nothing to draw, or it's totally transparent, or it's too close or behind the camera, return
|
||||||
static const float CLIP_DISTANCE = 0.2f;
|
static const float CLIP_DISTANCE = 0.2f;
|
||||||
|
@ -1473,16 +1477,16 @@ QList<QVariant> Avatar::getSkeleton() {
|
||||||
|
|
||||||
void Avatar::addToScene(AvatarSharedPointer myHandle, const render::ScenePointer& scene) {
|
void Avatar::addToScene(AvatarSharedPointer myHandle, const render::ScenePointer& scene) {
|
||||||
if (scene) {
|
if (scene) {
|
||||||
render::Transaction transaction;
|
|
||||||
auto nodelist = DependencyManager::get<NodeList>();
|
auto nodelist = DependencyManager::get<NodeList>();
|
||||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()
|
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()
|
||||||
&& !nodelist->isIgnoringNode(getSessionUUID())
|
&& !nodelist->isIgnoringNode(getSessionUUID())
|
||||||
&& !nodelist->isRadiusIgnoringNode(getSessionUUID())) {
|
&& !nodelist->isRadiusIgnoringNode(getSessionUUID())) {
|
||||||
|
render::Transaction transaction;
|
||||||
addToScene(myHandle, scene, transaction);
|
addToScene(myHandle, scene, transaction);
|
||||||
|
scene->enqueueTransaction(transaction);
|
||||||
}
|
}
|
||||||
scene->enqueueTransaction(transaction);
|
|
||||||
} else {
|
} else {
|
||||||
qCWarning(interfaceapp) << "AvatarManager::addAvatar() : Unexpected null scene, possibly during application shutdown";
|
qCWarning(interfaceapp) << "Avatar::addAvatar() : Unexpected null scene, possibly during application shutdown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ class Avatar : public AvatarData {
|
||||||
Q_PROPERTY(glm::vec3 skeletonOffset READ getSkeletonOffset WRITE setSkeletonOffset)
|
Q_PROPERTY(glm::vec3 skeletonOffset READ getSkeletonOffset WRITE setSkeletonOffset)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static void setShowReceiveStats(bool receiveStats);
|
||||||
|
|
||||||
explicit Avatar(QThread* thread, RigPointer rig = nullptr);
|
explicit Avatar(QThread* thread, RigPointer rig = nullptr);
|
||||||
~Avatar();
|
~Avatar();
|
||||||
|
|
||||||
|
@ -251,7 +253,6 @@ public slots:
|
||||||
void setModelURLFinished(bool success);
|
void setModelURLFinished(bool success);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class AvatarManager;
|
|
||||||
|
|
||||||
const float SMOOTH_TIME_POSITION = 0.125f;
|
const float SMOOTH_TIME_POSITION = 0.125f;
|
||||||
const float SMOOTH_TIME_ORIENTATION = 0.075f;
|
const float SMOOTH_TIME_ORIENTATION = 0.075f;
|
||||||
|
|
|
@ -62,8 +62,6 @@ public:
|
||||||
void clearOtherAvatars();
|
void clearOtherAvatars();
|
||||||
void deleteAllAvatars();
|
void deleteAllAvatars();
|
||||||
|
|
||||||
bool shouldShowReceiveStats() const { return _shouldShowReceiveStats; }
|
|
||||||
|
|
||||||
void getObjectsToRemoveFromPhysics(VectorOfMotionStates& motionStates);
|
void getObjectsToRemoveFromPhysics(VectorOfMotionStates& motionStates);
|
||||||
void getObjectsToAddToPhysics(VectorOfMotionStates& motionStates);
|
void getObjectsToAddToPhysics(VectorOfMotionStates& motionStates);
|
||||||
void getObjectsToChange(VectorOfMotionStates& motionStates);
|
void getObjectsToChange(VectorOfMotionStates& motionStates);
|
||||||
|
@ -85,7 +83,7 @@ public:
|
||||||
float getMyAvatarSendRate() const { return _myAvatarSendRate.rate(); }
|
float getMyAvatarSendRate() const { return _myAvatarSendRate.rate(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShouldShowReceiveStats(bool shouldShowReceiveStats) { _shouldShowReceiveStats = shouldShowReceiveStats; }
|
void setShouldShowReceiveStats(bool shouldShowReceiveStats) const { Avatar::setShowReceiveStats(shouldShowReceiveStats); }
|
||||||
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -106,8 +104,6 @@ private:
|
||||||
std::shared_ptr<MyAvatar> _myAvatar;
|
std::shared_ptr<MyAvatar> _myAvatar;
|
||||||
quint64 _lastSendAvatarDataTime = 0; // Controls MyAvatar send data rate.
|
quint64 _lastSendAvatarDataTime = 0; // Controls MyAvatar send data rate.
|
||||||
|
|
||||||
bool _shouldShowReceiveStats = false;
|
|
||||||
|
|
||||||
std::list<QPointer<AudioInjector>> _collisionInjectors;
|
std::list<QPointer<AudioInjector>> _collisionInjectors;
|
||||||
|
|
||||||
RateCounter<> _myAvatarSendRate;
|
RateCounter<> _myAvatarSendRate;
|
||||||
|
|
Loading…
Reference in a new issue