mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 11:52:04 +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 "Camera.h"
|
||||
#include "Menu.h"
|
||||
#include "InterfaceLogging.h"
|
||||
#include "SceneScriptingInterface.h"
|
||||
#include "SoftAttachmentModel.h"
|
||||
|
@ -78,6 +77,26 @@ void Avatar::setShowReceiveStats(bool 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) :
|
||||
AvatarData(),
|
||||
_skeletonOffset(0.0f),
|
||||
|
@ -354,7 +373,7 @@ void Avatar::simulate(float deltaTime, bool inView) {
|
|||
_smoothPositionTimer += deltaTime;
|
||||
if (_smoothPositionTimer < _smoothPositionTime) {
|
||||
AvatarData::setPosition(
|
||||
lerp(_smoothPositionInitial,
|
||||
lerp(_smoothPositionInitial,
|
||||
_smoothPositionTarget,
|
||||
easeInOutQuad(glm::clamp(_smoothPositionTimer / _smoothPositionTime, 0.0f, 1.0f)))
|
||||
);
|
||||
|
@ -367,7 +386,7 @@ void Avatar::simulate(float deltaTime, bool inView) {
|
|||
_smoothOrientationTimer += deltaTime;
|
||||
if (_smoothOrientationTimer < _smoothOrientationTime) {
|
||||
AvatarData::setOrientation(
|
||||
slerp(_smoothOrientationInitial,
|
||||
slerp(_smoothOrientationInitial,
|
||||
_smoothOrientationTarget,
|
||||
easeInOutQuad(glm::clamp(_smoothOrientationTimer / _smoothOrientationTime, 0.0f, 1.0f)))
|
||||
);
|
||||
|
@ -541,9 +560,9 @@ void Avatar::postUpdate(float deltaTime) {
|
|||
|
||||
bool renderLookAtVectors;
|
||||
if (isMyAvatar()) {
|
||||
renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::RenderMyLookAtVectors);
|
||||
renderLookAtVectors = renderMyLookAtVectors;
|
||||
} else {
|
||||
renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::RenderOtherLookAtVectors);
|
||||
renderLookAtVectors = renderOtherLookAtVectors;
|
||||
}
|
||||
|
||||
if (renderLookAtVectors) {
|
||||
|
@ -644,8 +663,7 @@ void Avatar::render(RenderArgs* renderArgs) {
|
|||
|
||||
fixupModelsInScene(renderArgs->_scene);
|
||||
|
||||
bool renderBounding = Menu::getInstance()->isOptionChecked(MenuOption::RenderBoundingCollisionShapes);
|
||||
if (renderBounding && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) {
|
||||
if (renderCollisionShapes && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) {
|
||||
PROFILE_RANGE_BATCH(batch, __FUNCTION__":skeletonBoundingCollisionShapes");
|
||||
const float BOUNDING_SHAPE_ALPHA = 0.7f;
|
||||
_skeletonModel->renderBoundingCollisionShapes(*renderArgs->_batch, getUniformScale(), BOUNDING_SHAPE_ALPHA);
|
||||
|
@ -1269,7 +1287,7 @@ float Avatar::getPelvisFloatingHeight() const {
|
|||
}
|
||||
|
||||
void Avatar::setShowDisplayName(bool showDisplayName) {
|
||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::NamesAboveHeads)) {
|
||||
if (!showNamesAboveHeads) {
|
||||
_displayNameAlpha = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ class Avatar : public AvatarData {
|
|||
|
||||
public:
|
||||
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);
|
||||
~Avatar();
|
||||
|
@ -240,6 +243,13 @@ public:
|
|||
|
||||
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:
|
||||
|
||||
|
@ -261,8 +271,6 @@ protected:
|
|||
QString _empty{};
|
||||
virtual void maybeUpdateSessionDisplayNameFromTransport(const QString& sessionDisplayName) override { _sessionDisplayName = sessionDisplayName; } // don't use no-op setter!
|
||||
|
||||
void setMotionState(AvatarMotionState* motionState);
|
||||
|
||||
SkeletonModelPointer _skeletonModel;
|
||||
glm::vec3 _skeletonOffset;
|
||||
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
||||
|
@ -316,16 +324,13 @@ protected:
|
|||
ThreadSafeValueCache<glm::vec3> _rightPalmPositionCache { glm::vec3() };
|
||||
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
|
||||
RateCounter<> _simulationRate;
|
||||
RateCounter<> _simulationInViewRate;
|
||||
RateCounter<> _skeletonModelSimulationRate;
|
||||
RateCounter<> _jointDataSimulationRate;
|
||||
|
||||
<<<<<<< 4318cce04a59543d80a9364c86aab79408dcb50e
|
||||
// Smoothing data for blending from one position/orientation to another on remote agents.
|
||||
float _smoothPositionTime;
|
||||
float _smoothPositionTimer;
|
||||
|
@ -336,6 +341,8 @@ protected:
|
|||
glm::quat _smoothOrientationInitial;
|
||||
glm::quat _smoothOrientationTarget;
|
||||
|
||||
=======
|
||||
>>>>>>> remove Menu dependency from Avatar class
|
||||
private:
|
||||
class AvatarEntityDataHash {
|
||||
public:
|
||||
|
@ -355,8 +362,6 @@ private:
|
|||
bool _isLookAtTarget { false };
|
||||
bool _isAnimatingScale { false };
|
||||
|
||||
float getBoundingRadius() const;
|
||||
|
||||
static int _jointConesID;
|
||||
|
||||
int _voiceSphereID;
|
||||
|
|
|
@ -147,6 +147,12 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
|||
ViewFrustum 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;
|
||||
AvatarData::sortAvatars(avatarList, cameraView, sortedAvatars,
|
||||
|
||||
|
|
Loading…
Reference in a new issue