mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 07:19:21 +02:00
remove Menu dependency from Avatar class
This commit is contained in:
parent
6393972874
commit
010d1dfa22
3 changed files with 45 additions and 16 deletions
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include "AvatarMotionState.h"
|
#include "AvatarMotionState.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Menu.h"
|
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
#include "SceneScriptingInterface.h"
|
#include "SceneScriptingInterface.h"
|
||||||
#include "SoftAttachmentModel.h"
|
#include "SoftAttachmentModel.h"
|
||||||
|
@ -78,6 +77,26 @@ void Avatar::setShowReceiveStats(bool receiveStats) {
|
||||||
showReceiveStats = receiveStats;
|
showReceiveStats = receiveStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool renderMyLookAtVectors = false;
|
||||||
|
bool renderOtherLookAtVectors = false;
|
||||||
|
void Avatar::setShowLookAtVectors(bool showMine, bool showOthers) {
|
||||||
|
renderMyLookAtVectors = showMine;
|
||||||
|
renderOtherLookAtVectors = showOthers;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool renderCollisionShapes = false;
|
||||||
|
void Avatar::setRenderCollisionShapes(bool render) {
|
||||||
|
renderCollisionShapes = render;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool showNamesAboveHeads = false;
|
||||||
|
void Avatar::setShowNamesAboveHeads(bool show) {
|
||||||
|
showNamesAboveHeads = show;
|
||||||
|
}
|
||||||
|
|
||||||
Avatar::Avatar(QThread* thread, RigPointer rig) :
|
Avatar::Avatar(QThread* thread, RigPointer rig) :
|
||||||
AvatarData(),
|
AvatarData(),
|
||||||
_skeletonOffset(0.0f),
|
_skeletonOffset(0.0f),
|
||||||
|
@ -354,7 +373,7 @@ void Avatar::simulate(float deltaTime, bool inView) {
|
||||||
_smoothPositionTimer += deltaTime;
|
_smoothPositionTimer += deltaTime;
|
||||||
if (_smoothPositionTimer < _smoothPositionTime) {
|
if (_smoothPositionTimer < _smoothPositionTime) {
|
||||||
AvatarData::setPosition(
|
AvatarData::setPosition(
|
||||||
lerp(_smoothPositionInitial,
|
lerp(_smoothPositionInitial,
|
||||||
_smoothPositionTarget,
|
_smoothPositionTarget,
|
||||||
easeInOutQuad(glm::clamp(_smoothPositionTimer / _smoothPositionTime, 0.0f, 1.0f)))
|
easeInOutQuad(glm::clamp(_smoothPositionTimer / _smoothPositionTime, 0.0f, 1.0f)))
|
||||||
);
|
);
|
||||||
|
@ -367,7 +386,7 @@ void Avatar::simulate(float deltaTime, bool inView) {
|
||||||
_smoothOrientationTimer += deltaTime;
|
_smoothOrientationTimer += deltaTime;
|
||||||
if (_smoothOrientationTimer < _smoothOrientationTime) {
|
if (_smoothOrientationTimer < _smoothOrientationTime) {
|
||||||
AvatarData::setOrientation(
|
AvatarData::setOrientation(
|
||||||
slerp(_smoothOrientationInitial,
|
slerp(_smoothOrientationInitial,
|
||||||
_smoothOrientationTarget,
|
_smoothOrientationTarget,
|
||||||
easeInOutQuad(glm::clamp(_smoothOrientationTimer / _smoothOrientationTime, 0.0f, 1.0f)))
|
easeInOutQuad(glm::clamp(_smoothOrientationTimer / _smoothOrientationTime, 0.0f, 1.0f)))
|
||||||
);
|
);
|
||||||
|
@ -541,9 +560,9 @@ void Avatar::postUpdate(float deltaTime) {
|
||||||
|
|
||||||
bool renderLookAtVectors;
|
bool renderLookAtVectors;
|
||||||
if (isMyAvatar()) {
|
if (isMyAvatar()) {
|
||||||
renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::RenderMyLookAtVectors);
|
renderLookAtVectors = renderMyLookAtVectors;
|
||||||
} else {
|
} else {
|
||||||
renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::RenderOtherLookAtVectors);
|
renderLookAtVectors = renderOtherLookAtVectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderLookAtVectors) {
|
if (renderLookAtVectors) {
|
||||||
|
@ -644,8 +663,7 @@ void Avatar::render(RenderArgs* renderArgs) {
|
||||||
|
|
||||||
fixupModelsInScene(renderArgs->_scene);
|
fixupModelsInScene(renderArgs->_scene);
|
||||||
|
|
||||||
bool renderBounding = Menu::getInstance()->isOptionChecked(MenuOption::RenderBoundingCollisionShapes);
|
if (renderCollisionShapes && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) {
|
||||||
if (renderBounding && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) {
|
|
||||||
PROFILE_RANGE_BATCH(batch, __FUNCTION__":skeletonBoundingCollisionShapes");
|
PROFILE_RANGE_BATCH(batch, __FUNCTION__":skeletonBoundingCollisionShapes");
|
||||||
const float BOUNDING_SHAPE_ALPHA = 0.7f;
|
const float BOUNDING_SHAPE_ALPHA = 0.7f;
|
||||||
_skeletonModel->renderBoundingCollisionShapes(*renderArgs->_batch, getUniformScale(), BOUNDING_SHAPE_ALPHA);
|
_skeletonModel->renderBoundingCollisionShapes(*renderArgs->_batch, getUniformScale(), BOUNDING_SHAPE_ALPHA);
|
||||||
|
@ -1269,7 +1287,7 @@ float Avatar::getPelvisFloatingHeight() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setShowDisplayName(bool showDisplayName) {
|
void Avatar::setShowDisplayName(bool showDisplayName) {
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::NamesAboveHeads)) {
|
if (!showNamesAboveHeads) {
|
||||||
_displayNameAlpha = 0.0f;
|
_displayNameAlpha = 0.0f;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,9 @@ class Avatar : public AvatarData {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void setShowReceiveStats(bool receiveStats);
|
static void setShowReceiveStats(bool receiveStats);
|
||||||
|
static void setShowLookAtVectors(bool showMine, bool showOthers);
|
||||||
|
static void setRenderCollisionShapes(bool render);
|
||||||
|
static void setShowNamesAboveHeads(bool show);
|
||||||
|
|
||||||
explicit Avatar(QThread* thread, RigPointer rig = nullptr);
|
explicit Avatar(QThread* thread, RigPointer rig = nullptr);
|
||||||
~Avatar();
|
~Avatar();
|
||||||
|
@ -240,6 +243,13 @@ public:
|
||||||
|
|
||||||
return (lerpValue*(4.0f - 2.0f * lerpValue) - 1.0f);
|
return (lerpValue*(4.0f - 2.0f * lerpValue) - 1.0f);
|
||||||
}
|
}
|
||||||
|
float getBoundingRadius() const;
|
||||||
|
|
||||||
|
void addToScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
||||||
|
void ensureInScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
||||||
|
bool isInScene() const { return render::Item::isValidID(_renderItemID); }
|
||||||
|
|
||||||
|
void setMotionState(AvatarMotionState* motionState);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -261,8 +271,6 @@ protected:
|
||||||
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!
|
||||||
|
|
||||||
void setMotionState(AvatarMotionState* motionState);
|
|
||||||
|
|
||||||
SkeletonModelPointer _skeletonModel;
|
SkeletonModelPointer _skeletonModel;
|
||||||
glm::vec3 _skeletonOffset;
|
glm::vec3 _skeletonOffset;
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
||||||
|
@ -316,16 +324,13 @@ protected:
|
||||||
ThreadSafeValueCache<glm::vec3> _rightPalmPositionCache { glm::vec3() };
|
ThreadSafeValueCache<glm::vec3> _rightPalmPositionCache { glm::vec3() };
|
||||||
ThreadSafeValueCache<glm::quat> _rightPalmRotationCache { glm::quat() };
|
ThreadSafeValueCache<glm::quat> _rightPalmRotationCache { glm::quat() };
|
||||||
|
|
||||||
void addToScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
|
||||||
void ensureInScene(AvatarSharedPointer self, const render::ScenePointer& scene);
|
|
||||||
bool isInScene() const { return render::Item::isValidID(_renderItemID); }
|
|
||||||
|
|
||||||
// Some rate tracking support
|
// Some rate tracking support
|
||||||
RateCounter<> _simulationRate;
|
RateCounter<> _simulationRate;
|
||||||
RateCounter<> _simulationInViewRate;
|
RateCounter<> _simulationInViewRate;
|
||||||
RateCounter<> _skeletonModelSimulationRate;
|
RateCounter<> _skeletonModelSimulationRate;
|
||||||
RateCounter<> _jointDataSimulationRate;
|
RateCounter<> _jointDataSimulationRate;
|
||||||
|
|
||||||
|
<<<<<<< 4318cce04a59543d80a9364c86aab79408dcb50e
|
||||||
// Smoothing data for blending from one position/orientation to another on remote agents.
|
// Smoothing data for blending from one position/orientation to another on remote agents.
|
||||||
float _smoothPositionTime;
|
float _smoothPositionTime;
|
||||||
float _smoothPositionTimer;
|
float _smoothPositionTimer;
|
||||||
|
@ -336,6 +341,8 @@ protected:
|
||||||
glm::quat _smoothOrientationInitial;
|
glm::quat _smoothOrientationInitial;
|
||||||
glm::quat _smoothOrientationTarget;
|
glm::quat _smoothOrientationTarget;
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> remove Menu dependency from Avatar class
|
||||||
private:
|
private:
|
||||||
class AvatarEntityDataHash {
|
class AvatarEntityDataHash {
|
||||||
public:
|
public:
|
||||||
|
@ -355,8 +362,6 @@ private:
|
||||||
bool _isLookAtTarget { false };
|
bool _isLookAtTarget { false };
|
||||||
bool _isAnimatingScale { false };
|
bool _isAnimatingScale { false };
|
||||||
|
|
||||||
float getBoundingRadius() const;
|
|
||||||
|
|
||||||
static int _jointConesID;
|
static int _jointConesID;
|
||||||
|
|
||||||
int _voiceSphereID;
|
int _voiceSphereID;
|
||||||
|
|
|
@ -147,6 +147,12 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
||||||
ViewFrustum cameraView;
|
ViewFrustum cameraView;
|
||||||
qApp->copyDisplayViewFrustum(cameraView);
|
qApp->copyDisplayViewFrustum(cameraView);
|
||||||
|
|
||||||
|
// HACK: update Avatar namespace settings
|
||||||
|
Avatar::setShowLookAtVectors(
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::RenderMyLookAtVectors),
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::RenderOtherLookAtVectors));
|
||||||
|
Avatar::setRenderCollisionShapes(Menu::getInstance()->isOptionChecked(MenuOption::RenderBoundingCollisionShapes));
|
||||||
|
|
||||||
std::priority_queue<AvatarPriority> sortedAvatars;
|
std::priority_queue<AvatarPriority> sortedAvatars;
|
||||||
AvatarData::sortAvatars(avatarList, cameraView, sortedAvatars,
|
AvatarData::sortAvatars(avatarList, cameraView, sortedAvatars,
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue