mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:24:36 +02:00
Merge pull request #8082 from jherico/explicit_overlay_alpha
Hand Controller UI Tweaks
This commit is contained in:
commit
4f6d65a961
13 changed files with 105 additions and 116 deletions
|
@ -16,6 +16,8 @@ Window {
|
||||||
height: 50
|
height: 50
|
||||||
clip: true
|
clip: true
|
||||||
visible: true
|
visible: true
|
||||||
|
// Disable this window from being able to call 'desktop.raise() and desktop.showDesktop'
|
||||||
|
activator: Item {}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 50
|
width: 50
|
||||||
|
@ -28,7 +30,7 @@ Window {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
readonly property string overlayMenuItem: "Overlays"
|
readonly property string overlayMenuItem: "Overlays"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: MenuInterface.setIsOptionChecked(overlayMenuItem, !MenuInterface.isOptionChecked(overlayMenuItem))
|
onClicked: MenuInterface.setIsOptionChecked(overlayMenuItem, !MenuInterface.isOptionChecked(overlayMenuItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2716,7 +2716,6 @@ void Application::idle(float nsecsElapsed) {
|
||||||
if (firstIdle) {
|
if (firstIdle) {
|
||||||
firstIdle = false;
|
firstIdle = false;
|
||||||
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
|
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
|
||||||
_overlayConductor.setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Overlays));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROFILE_RANGE(__FUNCTION__);
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
|
@ -3217,13 +3216,13 @@ void Application::updateThreads(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::toggleOverlays() {
|
void Application::toggleOverlays() {
|
||||||
auto newOverlaysVisible = !_overlayConductor.getEnabled();
|
auto menu = Menu::getInstance();
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, newOverlaysVisible);
|
menu->setIsOptionChecked(MenuOption::Overlays, menu->isOptionChecked(MenuOption::Overlays));
|
||||||
_overlayConductor.setEnabled(newOverlaysVisible);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setOverlaysVisible(bool visible) {
|
void Application::setOverlaysVisible(bool visible) {
|
||||||
_overlayConductor.setEnabled(visible);
|
auto menu = Menu::getInstance();
|
||||||
|
menu->setIsOptionChecked(MenuOption::Overlays, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::cycleCamera() {
|
void Application::cycleCamera() {
|
||||||
|
@ -5306,9 +5305,7 @@ void Application::readArgumentsFromLocalSocket() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::showDesktop() {
|
void Application::showDesktop() {
|
||||||
if (!_overlayConductor.getEnabled()) {
|
Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, true);
|
||||||
_overlayConductor.setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositorHelper& Application::getApplicationCompositor() const {
|
CompositorHelper& Application::getApplicationCompositor() const {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
#include <display-plugins/CompositorHelper.h>
|
||||||
|
|
||||||
int DesktopScriptingInterface::getWidth() {
|
int DesktopScriptingInterface::getWidth() {
|
||||||
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
||||||
|
@ -25,3 +26,8 @@ int DesktopScriptingInterface::getHeight() {
|
||||||
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
||||||
return size.height();
|
return size.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesktopScriptingInterface::setOverlayAlpha(float alpha) {
|
||||||
|
qApp->getApplicationCompositor().setAlpha(alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ class DesktopScriptingInterface : public QObject, public Dependency {
|
||||||
Q_PROPERTY(int height READ getHeight) // Physical height of screen(s) including task bars and system menus
|
Q_PROPERTY(int height READ getHeight) // Physical height of screen(s) including task bars and system menus
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Q_INVOKABLE void setOverlayAlpha(float alpha);
|
||||||
|
|
||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
};
|
};
|
||||||
|
|
|
@ -99,104 +99,52 @@ void OverlayConductor::centerUI() {
|
||||||
qApp->getApplicationCompositor().setModelTransform(Transform(camMat));
|
qApp->getApplicationCompositor().setModelTransform(Transform(camMat));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayConductor::userWishesToHide() const {
|
|
||||||
// user pressed toggle button.
|
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::Overlays) != _prevOverlayMenuChecked && Menu::getInstance()->isOptionChecked(MenuOption::Overlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OverlayConductor::userWishesToShow() const {
|
|
||||||
// user pressed toggle button.
|
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::Overlays) != _prevOverlayMenuChecked && !Menu::getInstance()->isOptionChecked(MenuOption::Overlays);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OverlayConductor::setState(State state) {
|
|
||||||
#ifdef WANT_DEBUG
|
|
||||||
static QString stateToString[NumStates] = { "Enabled", "DisabledByDrive", "DisabledByHead", "DisabledByToggle" };
|
|
||||||
qDebug() << "OverlayConductor " << stateToString[state] << "<--" << stateToString[_state];
|
|
||||||
#endif
|
|
||||||
_state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
OverlayConductor::State OverlayConductor::getState() const {
|
|
||||||
return _state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OverlayConductor::update(float dt) {
|
void OverlayConductor::update(float dt) {
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
bool currentVisible = !offscreenUi->getDesktop()->property("pinned").toBool();
|
||||||
|
|
||||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
// centerUI when hmd mode is first enabled and mounted
|
||||||
// centerUI when hmd mode is first enabled
|
if (qApp->isHMDMode() && qApp->getActiveDisplayPlugin()->isDisplayVisible()) {
|
||||||
if (qApp->isHMDMode() && !_hmdMode) {
|
if (!_hmdMode) {
|
||||||
centerUI();
|
_hmdMode = true;
|
||||||
|
centerUI();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_hmdMode = false;
|
||||||
}
|
}
|
||||||
_hmdMode = qApp->isHMDMode();
|
|
||||||
|
|
||||||
bool prevDriving = _currentDriving;
|
bool prevDriving = _currentDriving;
|
||||||
bool isDriving = updateAvatarHasDriveInput();
|
bool isDriving = updateAvatarHasDriveInput();
|
||||||
bool drivingChanged = prevDriving != isDriving;
|
bool drivingChanged = prevDriving != isDriving;
|
||||||
|
|
||||||
bool isAtRest = updateAvatarIsAtRest();
|
bool isAtRest = updateAvatarIsAtRest();
|
||||||
|
|
||||||
switch (getState()) {
|
if (_flags & SuppressedByDrive) {
|
||||||
case Enabled:
|
if (!isDriving) {
|
||||||
if (myAvatar->getClearOverlayWhenDriving() && qApp->isHMDMode() && headOutsideOverlay()) {
|
_flags &= ~SuppressedByDrive;
|
||||||
setState(DisabledByHead);
|
}
|
||||||
setEnabled(false);
|
} else {
|
||||||
}
|
if (myAvatar->getClearOverlayWhenDriving() && drivingChanged && isDriving) {
|
||||||
if (userWishesToHide()) {
|
_flags |= SuppressedByDrive;
|
||||||
setState(DisabledByToggle);
|
}
|
||||||
setEnabled(false);
|
|
||||||
}
|
|
||||||
if (myAvatar->getClearOverlayWhenDriving() && drivingChanged && isDriving) {
|
|
||||||
setState(DisabledByDrive);
|
|
||||||
setEnabled(false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DisabledByDrive:
|
|
||||||
if (!isDriving || userWishesToShow()) {
|
|
||||||
setState(Enabled);
|
|
||||||
setEnabled(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DisabledByHead:
|
|
||||||
if (isAtRest || userWishesToShow()) {
|
|
||||||
setState(Enabled);
|
|
||||||
setEnabled(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DisabledByToggle:
|
|
||||||
if (userWishesToShow()) {
|
|
||||||
setState(Enabled);
|
|
||||||
setEnabled(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_prevOverlayMenuChecked = Menu::getInstance()->isOptionChecked(MenuOption::Overlays);
|
if (_flags & SuppressedByHead) {
|
||||||
}
|
if (isAtRest) {
|
||||||
|
_flags &= ~SuppressedByHead;
|
||||||
void OverlayConductor::setEnabled(bool enabled) {
|
}
|
||||||
if (enabled == _enabled) {
|
} else {
|
||||||
return;
|
if (_hmdMode && headOutsideOverlay()) {
|
||||||
|
_flags |= SuppressedByHead;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_enabled = enabled; // set the new value
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
|
||||||
offscreenUi->setPinned(!_enabled);
|
|
||||||
|
|
||||||
// ensure that the the state of the menu item reflects the state of the overlay.
|
bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && (0 == (_flags & SuppressMask));
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, _enabled);
|
if (targetVisible != currentVisible) {
|
||||||
_prevOverlayMenuChecked = _enabled;
|
offscreenUi->setPinned(!targetVisible);
|
||||||
|
if (targetVisible && _hmdMode) {
|
||||||
// if the new state is visible/enabled...
|
centerUI();
|
||||||
if (_enabled && qApp->isHMDMode()) {
|
}
|
||||||
centerUI();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayConductor::getEnabled() const {
|
|
||||||
return _enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -17,33 +17,20 @@ public:
|
||||||
~OverlayConductor();
|
~OverlayConductor();
|
||||||
|
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void setEnabled(bool enable);
|
|
||||||
bool getEnabled() const;
|
|
||||||
|
|
||||||
void centerUI();
|
void centerUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool headOutsideOverlay() const;
|
bool headOutsideOverlay() const;
|
||||||
bool updateAvatarHasDriveInput();
|
bool updateAvatarHasDriveInput();
|
||||||
bool updateAvatarIsAtRest();
|
bool updateAvatarIsAtRest();
|
||||||
bool userWishesToHide() const;
|
|
||||||
bool userWishesToShow() const;
|
|
||||||
|
|
||||||
enum State {
|
enum SupressionFlags {
|
||||||
Enabled = 0,
|
SuppressedByDrive = 0x01,
|
||||||
DisabledByDrive,
|
SuppressedByHead = 0x02,
|
||||||
DisabledByHead,
|
SuppressMask = 0x03,
|
||||||
DisabledByToggle,
|
|
||||||
NumStates
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void setState(State state);
|
uint8_t _flags { SuppressedByDrive };
|
||||||
State getState() const;
|
|
||||||
|
|
||||||
State _state { DisabledByDrive };
|
|
||||||
|
|
||||||
bool _prevOverlayMenuChecked { true };
|
|
||||||
bool _enabled { false };
|
|
||||||
bool _hmdMode { false };
|
bool _hmdMode { false };
|
||||||
|
|
||||||
// used by updateAvatarHasDriveInput
|
// used by updateAvatarHasDriveInput
|
||||||
|
|
|
@ -38,6 +38,7 @@ const float MAGNIFY_MULT = 2.0f;
|
||||||
class CompositorHelper : public QObject, public Dependency {
|
class CompositorHelper : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(float alpha READ getAlpha WRITE setAlpha NOTIFY alphaChanged)
|
||||||
Q_PROPERTY(bool reticleOverDesktop READ getReticleOverDesktop WRITE setReticleOverDesktop)
|
Q_PROPERTY(bool reticleOverDesktop READ getReticleOverDesktop WRITE setReticleOverDesktop)
|
||||||
public:
|
public:
|
||||||
static const uvec2 VIRTUAL_SCREEN_SIZE;
|
static const uvec2 VIRTUAL_SCREEN_SIZE;
|
||||||
|
@ -74,6 +75,9 @@ public:
|
||||||
void setModelTransform(const Transform& transform) { _modelTransform = transform; }
|
void setModelTransform(const Transform& transform) { _modelTransform = transform; }
|
||||||
const Transform& getModelTransform() const { return _modelTransform; }
|
const Transform& getModelTransform() const { return _modelTransform; }
|
||||||
|
|
||||||
|
float getAlpha() const { return _alpha; }
|
||||||
|
void setAlpha(float alpha) { if (alpha != _alpha) { emit alphaChanged(); _alpha = alpha; } }
|
||||||
|
|
||||||
bool getReticleVisible() const { return _reticleVisible; }
|
bool getReticleVisible() const { return _reticleVisible; }
|
||||||
void setReticleVisible(bool visible) { _reticleVisible = visible; }
|
void setReticleVisible(bool visible) { _reticleVisible = visible; }
|
||||||
|
|
||||||
|
@ -109,6 +113,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void allowMouseCaptureChanged();
|
void allowMouseCaptureChanged();
|
||||||
|
void alphaChanged();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void sendFakeMouseEvent();
|
void sendFakeMouseEvent();
|
||||||
|
@ -134,6 +139,7 @@ private:
|
||||||
float _textureFov { VIRTUAL_UI_TARGET_FOV.y };
|
float _textureFov { VIRTUAL_UI_TARGET_FOV.y };
|
||||||
float _textureAspectRatio { VIRTUAL_UI_ASPECT_RATIO };
|
float _textureAspectRatio { VIRTUAL_UI_ASPECT_RATIO };
|
||||||
|
|
||||||
|
float _alpha { 1.0f };
|
||||||
float _hmdUIRadius { 1.0f };
|
float _hmdUIRadius { 1.0f };
|
||||||
|
|
||||||
int _previousBorderWidth { -1 };
|
int _previousBorderWidth { -1 };
|
||||||
|
|
|
@ -273,11 +273,23 @@ bool OpenGLDisplayPlugin::activate() {
|
||||||
_container->makeRenderingContextCurrent();
|
_container->makeRenderingContextCurrent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
|
connect(compositorHelper.data(), &CompositorHelper::alphaChanged, [this] {
|
||||||
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
|
auto animation = new QPropertyAnimation(this, "overlayAlpha");
|
||||||
|
animation->setDuration(200);
|
||||||
|
animation->setEndValue(compositorHelper->getAlpha());
|
||||||
|
animation->start();
|
||||||
|
});
|
||||||
|
|
||||||
return DisplayPlugin::activate();
|
return DisplayPlugin::activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::deactivate() {
|
void OpenGLDisplayPlugin::deactivate() {
|
||||||
|
|
||||||
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
|
disconnect(compositorHelper.data());
|
||||||
|
|
||||||
#if THREADED_PRESENT
|
#if THREADED_PRESENT
|
||||||
auto presentThread = DependencyManager::get<PresentThread>();
|
auto presentThread = DependencyManager::get<PresentThread>();
|
||||||
// Does not return until the GL transition has completeed
|
// Does not return until the GL transition has completeed
|
||||||
|
@ -445,6 +457,8 @@ void OpenGLDisplayPlugin::compositeOverlay() {
|
||||||
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
|
|
||||||
useProgram(_program);
|
useProgram(_program);
|
||||||
|
// set the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(_compositeOverlayAlpha);
|
||||||
// check the alpha
|
// check the alpha
|
||||||
// Overlay draw
|
// Overlay draw
|
||||||
if (isStereo()) {
|
if (isStereo()) {
|
||||||
|
@ -458,6 +472,8 @@ void OpenGLDisplayPlugin::compositeOverlay() {
|
||||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
||||||
drawUnitQuad();
|
drawUnitQuad();
|
||||||
}
|
}
|
||||||
|
// restore the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::compositePointer() {
|
void OpenGLDisplayPlugin::compositePointer() {
|
||||||
|
@ -465,6 +481,8 @@ void OpenGLDisplayPlugin::compositePointer() {
|
||||||
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
|
|
||||||
useProgram(_program);
|
useProgram(_program);
|
||||||
|
// set the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(_compositeOverlayAlpha);
|
||||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(compositorHelper->getReticleTransform(glm::mat4()));
|
Uniform<glm::mat4>(*_program, _mvpUniform).Set(compositorHelper->getReticleTransform(glm::mat4()));
|
||||||
if (isStereo()) {
|
if (isStereo()) {
|
||||||
for_each_eye([&](Eye eye) {
|
for_each_eye([&](Eye eye) {
|
||||||
|
@ -475,6 +493,8 @@ void OpenGLDisplayPlugin::compositePointer() {
|
||||||
drawUnitQuad();
|
drawUnitQuad();
|
||||||
}
|
}
|
||||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
||||||
|
// restore the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::compositeScene() {
|
void OpenGLDisplayPlugin::compositeScene() {
|
||||||
|
@ -682,3 +702,10 @@ void OpenGLDisplayPlugin::assertIsRenderThread() const {
|
||||||
void OpenGLDisplayPlugin::assertIsPresentThread() const {
|
void OpenGLDisplayPlugin::assertIsPresentThread() const {
|
||||||
Q_ASSERT(QThread::currentThread() == _presentThread);
|
Q_ASSERT(QThread::currentThread() == _presentThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenGLDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
|
withRenderThreadLock([&] {
|
||||||
|
_compositeOverlayAlpha = _overlayAlpha;
|
||||||
|
});
|
||||||
|
return Parent::beginFrameRender(frameIndex);
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
#define THREADED_PRESENT 1
|
#define THREADED_PRESENT 1
|
||||||
|
|
||||||
class OpenGLDisplayPlugin : public DisplayPlugin {
|
class OpenGLDisplayPlugin : public DisplayPlugin {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(float overlayAlpha MEMBER _overlayAlpha)
|
||||||
|
using Parent = DisplayPlugin;
|
||||||
protected:
|
protected:
|
||||||
using Mutex = std::mutex;
|
using Mutex = std::mutex;
|
||||||
using Lock = std::unique_lock<Mutex>;
|
using Lock = std::unique_lock<Mutex>;
|
||||||
|
@ -60,6 +63,7 @@ public:
|
||||||
|
|
||||||
float droppedFrameRate() const override;
|
float droppedFrameRate() const override;
|
||||||
|
|
||||||
|
bool beginFrameRender(uint32_t frameIndex) override;
|
||||||
protected:
|
protected:
|
||||||
#if THREADED_PRESENT
|
#if THREADED_PRESENT
|
||||||
friend class PresentThread;
|
friend class PresentThread;
|
||||||
|
@ -115,7 +119,8 @@ protected:
|
||||||
RateCounter<> _presentRate;
|
RateCounter<> _presentRate;
|
||||||
QMap<gpu::TexturePointer, uint32_t> _sceneTextureToFrameIndexMap;
|
QMap<gpu::TexturePointer, uint32_t> _sceneTextureToFrameIndexMap;
|
||||||
uint32_t _currentPresentFrameIndex { 0 };
|
uint32_t _currentPresentFrameIndex { 0 };
|
||||||
|
float _compositeOverlayAlpha{ 1.0f };
|
||||||
|
|
||||||
gpu::TexturePointer _currentSceneTexture;
|
gpu::TexturePointer _currentSceneTexture;
|
||||||
gpu::TexturePointer _currentOverlayTexture;
|
gpu::TexturePointer _currentOverlayTexture;
|
||||||
|
|
||||||
|
@ -157,6 +162,7 @@ private:
|
||||||
// be serialized through this mutex
|
// be serialized through this mutex
|
||||||
mutable Mutex _presentMutex;
|
mutable Mutex _presentMutex;
|
||||||
ProgramPtr _activeProgram;
|
ProgramPtr _activeProgram;
|
||||||
|
float _overlayAlpha{ 1.0f };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -287,6 +287,8 @@ void HmdDisplayPlugin::compositeOverlay() {
|
||||||
glm::mat4 modelMat = compositorHelper->getModelTransform().getMatrix();
|
glm::mat4 modelMat = compositorHelper->getModelTransform().getMatrix();
|
||||||
|
|
||||||
useProgram(_program);
|
useProgram(_program);
|
||||||
|
// set the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(_compositeOverlayAlpha);
|
||||||
_sphereSection->Use();
|
_sphereSection->Use();
|
||||||
for_each_eye([&](Eye eye) {
|
for_each_eye([&](Eye eye) {
|
||||||
eyeViewport(eye);
|
eyeViewport(eye);
|
||||||
|
@ -295,6 +297,8 @@ void HmdDisplayPlugin::compositeOverlay() {
|
||||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mvp);
|
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mvp);
|
||||||
_sphereSection->Draw();
|
_sphereSection->Draw();
|
||||||
});
|
});
|
||||||
|
// restore the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HmdDisplayPlugin::compositePointer() {
|
void HmdDisplayPlugin::compositePointer() {
|
||||||
|
@ -302,8 +306,9 @@ void HmdDisplayPlugin::compositePointer() {
|
||||||
|
|
||||||
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
|
|
||||||
// check the alpha
|
|
||||||
useProgram(_program);
|
useProgram(_program);
|
||||||
|
// set the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(_compositeOverlayAlpha);
|
||||||
|
|
||||||
// Mouse pointer
|
// Mouse pointer
|
||||||
_plane->Use();
|
_plane->Use();
|
||||||
|
@ -317,6 +322,8 @@ void HmdDisplayPlugin::compositePointer() {
|
||||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mvp);
|
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mvp);
|
||||||
_plane->Draw();
|
_plane->Draw();
|
||||||
});
|
});
|
||||||
|
// restore the alpha
|
||||||
|
Uniform<float>(*_program, _alphaUniform).Set(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ bool OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
_handPoses = handPoses;
|
_handPoses = handPoses;
|
||||||
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
||||||
});
|
});
|
||||||
return true;
|
return Parent::beginFrameRender(frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OculusBaseDisplayPlugin::isSupported() const {
|
bool OculusBaseDisplayPlugin::isSupported() const {
|
||||||
|
|
|
@ -41,6 +41,7 @@ void OculusLegacyDisplayPlugin::resetSensors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OculusLegacyDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
bool OculusLegacyDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
|
|
||||||
_currentRenderFrameInfo = FrameInfo();
|
_currentRenderFrameInfo = FrameInfo();
|
||||||
_currentRenderFrameInfo.predictedDisplayTime = _currentRenderFrameInfo.sensorSampleTime = ovr_GetTimeInSeconds();
|
_currentRenderFrameInfo.predictedDisplayTime = _currentRenderFrameInfo.sensorSampleTime = ovr_GetTimeInSeconds();
|
||||||
_trackingState = ovrHmd_GetTrackingState(_hmd, _currentRenderFrameInfo.predictedDisplayTime);
|
_trackingState = ovrHmd_GetTrackingState(_hmd, _currentRenderFrameInfo.predictedDisplayTime);
|
||||||
|
@ -48,7 +49,7 @@ bool OculusLegacyDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
withRenderThreadLock([&]{
|
withRenderThreadLock([&]{
|
||||||
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
||||||
});
|
});
|
||||||
return true;
|
return Parent::beginFrameRender(frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OculusLegacyDisplayPlugin::isSupported() const {
|
bool OculusLegacyDisplayPlugin::isSupported() const {
|
||||||
|
|
|
@ -204,7 +204,7 @@ bool OpenVrDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
_handPoses = handPoses;
|
_handPoses = handPoses;
|
||||||
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
||||||
});
|
});
|
||||||
return true;
|
return Parent::beginFrameRender(frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenVrDisplayPlugin::hmdPresent() {
|
void OpenVrDisplayPlugin::hmdPresent() {
|
||||||
|
|
Loading…
Reference in a new issue