mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-17 07:48:45 +02:00
connect menu options to avatar render features
This commit is contained in:
parent
823f3a73c6
commit
00b05ed137
6 changed files with 36 additions and 46 deletions
|
@ -504,11 +504,14 @@ Menu::Menu() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AvatarReceiveStats, 0, false,
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AvatarReceiveStats, 0, false,
|
||||||
avatarManager.data(), SLOT(setShouldShowReceiveStats(bool)));
|
avatar.get(), SLOT(setShowReceiveStats(bool)));
|
||||||
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowBoundingCollisionShapes, 0, false,
|
||||||
|
avatar.get(), SLOT(setShowCollisionShapes(bool)));
|
||||||
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowMyLookAtVectors, 0, false,
|
||||||
|
avatar.get(), SLOT(setShowMyLookAtVectors(bool)));
|
||||||
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowOtherLookAtVectors, 0, false,
|
||||||
|
avatar.get(), SLOT(setShowOtherLookAtVectors(bool)));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderBoundingCollisionShapes);
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderMyLookAtVectors, 0, false);
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderOtherLookAtVectors, 0, false);
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::FixGaze, 0, false);
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::FixGaze, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AnimDebugDrawDefaultPose, 0, false,
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AnimDebugDrawDefaultPose, 0, false,
|
||||||
avatar.get(), SLOT(setEnableDebugDrawDefaultPose(bool)));
|
avatar.get(), SLOT(setEnableDebugDrawDefaultPose(bool)));
|
||||||
|
|
|
@ -146,9 +146,6 @@ namespace MenuOption {
|
||||||
const QString Quit = "Quit";
|
const QString Quit = "Quit";
|
||||||
const QString ReloadAllScripts = "Reload All Scripts";
|
const QString ReloadAllScripts = "Reload All Scripts";
|
||||||
const QString ReloadContent = "Reload Content (Clears all caches)";
|
const QString ReloadContent = "Reload Content (Clears all caches)";
|
||||||
const QString RenderBoundingCollisionShapes = "Show Bounding Collision Shapes";
|
|
||||||
const QString RenderMyLookAtVectors = "Show My Eye Vectors";
|
|
||||||
const QString RenderOtherLookAtVectors = "Show Other Eye Vectors";
|
|
||||||
const QString RenderMaxTextureMemory = "Maximum Texture Memory";
|
const QString RenderMaxTextureMemory = "Maximum Texture Memory";
|
||||||
const QString RenderMaxTextureAutomatic = "Automatic Texture Memory";
|
const QString RenderMaxTextureAutomatic = "Automatic Texture Memory";
|
||||||
const QString RenderMaxTexture4MB = "4 MB";
|
const QString RenderMaxTexture4MB = "4 MB";
|
||||||
|
@ -174,8 +171,11 @@ namespace MenuOption {
|
||||||
const QString SendWrongDSConnectVersion = "Send wrong DS connect version";
|
const QString SendWrongDSConnectVersion = "Send wrong DS connect version";
|
||||||
const QString SendWrongProtocolVersion = "Send wrong protocol version";
|
const QString SendWrongProtocolVersion = "Send wrong protocol version";
|
||||||
const QString SetHomeLocation = "Set Home Location";
|
const QString SetHomeLocation = "Set Home Location";
|
||||||
const QString ShowDSConnectTable = "Show Domain Connection Timing";
|
|
||||||
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
||||||
|
const QString ShowBoundingCollisionShapes = "Show Bounding Collision Shapes";
|
||||||
|
const QString ShowDSConnectTable = "Show Domain Connection Timing";
|
||||||
|
const QString ShowMyLookAtVectors = "Show My Eye Vectors";
|
||||||
|
const QString ShowOtherLookAtVectors = "Show Other Eye Vectors";
|
||||||
const QString ShowRealtimeEntityStats = "Show Realtime Entity Stats";
|
const QString ShowRealtimeEntityStats = "Show Realtime Entity Stats";
|
||||||
const QString StandingHMDSensorMode = "Standing HMD Sensor Mode";
|
const QString StandingHMDSensorMode = "Standing HMD Sensor Mode";
|
||||||
const QString SimulateEyeTracking = "Simulate";
|
const QString SimulateEyeTracking = "Simulate";
|
||||||
|
|
|
@ -71,28 +71,27 @@ namespace render {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
static bool showReceiveStats = false;
|
||||||
bool showReceiveStats = false;
|
|
||||||
void Avatar::setShowReceiveStats(bool receiveStats) {
|
void Avatar::setShowReceiveStats(bool receiveStats) {
|
||||||
showReceiveStats = receiveStats;
|
showReceiveStats = receiveStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
static bool showMyLookAtVectors = false;
|
||||||
bool renderMyLookAtVectors = false;
|
void Avatar::setShowMyLookAtVectors(bool showMine) {
|
||||||
bool renderOtherLookAtVectors = false;
|
showMyLookAtVectors = showMine;
|
||||||
void Avatar::setShowLookAtVectors(bool showMine, bool showOthers) {
|
|
||||||
renderMyLookAtVectors = showMine;
|
|
||||||
renderOtherLookAtVectors = showOthers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
static bool showOtherLookAtVectors = false;
|
||||||
bool renderCollisionShapes = false;
|
void Avatar::setShowOtherLookAtVectors(bool showOthers) {
|
||||||
void Avatar::setRenderCollisionShapes(bool render) {
|
showOtherLookAtVectors = showOthers;
|
||||||
renderCollisionShapes = render;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
static bool showCollisionShapes = false;
|
||||||
bool showNamesAboveHeads = false;
|
void Avatar::setShowCollisionShapes(bool render) {
|
||||||
|
showCollisionShapes = render;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool showNamesAboveHeads = false;
|
||||||
void Avatar::setShowNamesAboveHeads(bool show) {
|
void Avatar::setShowNamesAboveHeads(bool show) {
|
||||||
showNamesAboveHeads = show;
|
showNamesAboveHeads = show;
|
||||||
}
|
}
|
||||||
|
@ -553,14 +552,7 @@ void Avatar::updateRenderItem(render::Transaction& transaction) {
|
||||||
|
|
||||||
void Avatar::postUpdate(float deltaTime) {
|
void Avatar::postUpdate(float deltaTime) {
|
||||||
|
|
||||||
bool renderLookAtVectors;
|
if (isMyAvatar() ? showMyLookAtVectors : showOtherLookAtVectors) {
|
||||||
if (isMyAvatar()) {
|
|
||||||
renderLookAtVectors = renderMyLookAtVectors;
|
|
||||||
} else {
|
|
||||||
renderLookAtVectors = renderOtherLookAtVectors;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (renderLookAtVectors) {
|
|
||||||
const float EYE_RAY_LENGTH = 10.0;
|
const float EYE_RAY_LENGTH = 10.0;
|
||||||
const glm::vec4 BLUE(0.0f, 0.0f, 1.0f, 1.0f);
|
const glm::vec4 BLUE(0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
const glm::vec4 RED(1.0f, 0.0f, 0.0f, 1.0f);
|
const glm::vec4 RED(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
@ -653,17 +645,18 @@ void Avatar::render(RenderArgs* renderArgs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 toTarget = frustum.getPosition() - getPosition();
|
|
||||||
float distanceToTarget = glm::length(toTarget);
|
|
||||||
|
|
||||||
fixupModelsInScene(renderArgs->_scene);
|
fixupModelsInScene(renderArgs->_scene);
|
||||||
|
|
||||||
if (renderCollisionShapes && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) {
|
if (showCollisionShapes && 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /// -------------- REMOVED FOR NOW --------------
|
||||||
|
// removed CPU calculations as per removal of menu option
|
||||||
|
glm::vec3 toTarget = frustum.getPosition() - getPosition();
|
||||||
|
float distanceToTarget = glm::length(toTarget);
|
||||||
const float DISPLAYNAME_DISTANCE = 20.0f;
|
const float DISPLAYNAME_DISTANCE = 20.0f;
|
||||||
setShowDisplayName(distanceToTarget < DISPLAYNAME_DISTANCE);
|
setShowDisplayName(distanceToTarget < DISPLAYNAME_DISTANCE);
|
||||||
if (!isMyAvatar() || renderArgs->_cameraMode != (int8_t)CAMERA_MODE_FIRST_PERSON) {
|
if (!isMyAvatar() || renderArgs->_cameraMode != (int8_t)CAMERA_MODE_FIRST_PERSON) {
|
||||||
|
@ -673,6 +666,7 @@ void Avatar::render(RenderArgs* renderArgs) {
|
||||||
renderDisplayName(batch, frustum, textPosition);
|
renderDisplayName(batch, frustum, textPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat Avatar::computeRotationFromBodyToWorldUp(float proportion) const {
|
glm::quat Avatar::computeRotationFromBodyToWorldUp(float proportion) const {
|
||||||
|
|
|
@ -68,11 +68,6 @@ 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);
|
|
||||||
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();
|
||||||
|
|
||||||
|
@ -256,6 +251,11 @@ public:
|
||||||
bool isInPhysicsSimulation() const { return _physicsCallback != nullptr; }
|
bool isInPhysicsSimulation() const { return _physicsCallback != nullptr; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void setShowReceiveStats(bool receiveStats);
|
||||||
|
void setShowMyLookAtVectors(bool showMine);
|
||||||
|
void setShowOtherLookAtVectors(bool showOthers);
|
||||||
|
void setShowCollisionShapes(bool render);
|
||||||
|
void setShowNamesAboveHeads(bool show);
|
||||||
|
|
||||||
// FIXME - these should be migrated to use Pose data instead
|
// FIXME - these should be migrated to use Pose data instead
|
||||||
// thread safe, will return last valid palm from cache
|
// thread safe, will return last valid palm from cache
|
||||||
|
|
|
@ -147,12 +147,6 @@ 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,
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,6 @@ public:
|
||||||
float getMyAvatarSendRate() const { return _myAvatarSendRate.rate(); }
|
float getMyAvatarSendRate() const { return _myAvatarSendRate.rate(); }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShouldShowReceiveStats(bool shouldShowReceiveStats) const { Avatar::setShowReceiveStats(shouldShowReceiveStats); }
|
|
||||||
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue