mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Working on plugin rendering model:
This commit is contained in:
parent
ba4ae3762d
commit
a482fa0a6d
4 changed files with 23 additions and 19 deletions
|
@ -1067,6 +1067,8 @@ bool Application::eventFilter(QObject* object, QEvent* event) {
|
|||
}
|
||||
}
|
||||
|
||||
// auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
// return offscreenUi->eventFilter(object, event);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1436,7 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
|||
if (!_lastMouseMoveWasSimulated) {
|
||||
_lastMouseMove = usecTimestampNow();
|
||||
}
|
||||
|
||||
|
||||
if (_aboutToQuit) {
|
||||
return;
|
||||
}
|
||||
|
@ -3001,7 +3003,7 @@ ViewFrustum* Application::getViewFrustum() {
|
|||
#ifdef DEBUG
|
||||
if (QThread::currentThread() == activeRenderingThread) {
|
||||
// FIXME, should this be an assert?
|
||||
qWarning() << "Calling Application::getViewFrustum() from the active rendering thread, did you mean Application::getDisplayViewFrustum()?";
|
||||
//qWarning() << "Calling Application::getViewFrustum() from the active rendering thread, did you mean Application::getDisplayViewFrustum()?";
|
||||
}
|
||||
#endif
|
||||
return &_viewFrustum;
|
||||
|
@ -3011,7 +3013,7 @@ ViewFrustum* Application::getDisplayViewFrustum() {
|
|||
#ifdef DEBUG
|
||||
if (QThread::currentThread() != activeRenderingThread) {
|
||||
// FIXME, should this be an assert?
|
||||
qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";
|
||||
//qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";
|
||||
}
|
||||
#endif
|
||||
return &_displayViewFrustum;
|
||||
|
|
|
@ -67,13 +67,10 @@ void GLCanvas::paintGL() {
|
|||
}
|
||||
#endif
|
||||
Application::getInstance()->paintGL();
|
||||
|
||||
|
||||
#if 0
|
||||
if (!OculusManager::isConnected()) {
|
||||
#endif
|
||||
|
||||
swapBuffers();
|
||||
#if 0
|
||||
} else {
|
||||
if (OculusManager::allowSwap()) {
|
||||
swapBuffers();
|
||||
|
@ -121,13 +118,11 @@ void GLCanvas::throttleRender() {
|
|||
if (OculusManager::isConnected()) {
|
||||
OculusManager::beginFrameTiming();
|
||||
}
|
||||
#endif
|
||||
|
||||
makeCurrent();
|
||||
#endif
|
||||
Application::getInstance()->paintGL();
|
||||
swapBuffers();
|
||||
|
||||
#if 0
|
||||
swapBuffers();
|
||||
if (OculusManager::isConnected()) {
|
||||
OculusManager::endFrameTiming();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <UserActivityLogger.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "plugins/render/RenderPlugin.h"
|
||||
#include "AvatarManager.h"
|
||||
#include "Environment.h"
|
||||
#include "Menu.h"
|
||||
|
@ -230,13 +231,15 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||
glm::vec3 estimatedPosition, estimatedRotation;
|
||||
|
||||
#if 0
|
||||
if (isPlaying() && !OculusManager::isConnected()) {
|
||||
auto renderPlugin = qApp->getActiveRenderPlugin();
|
||||
bool inHmd = renderPlugin->isHmd();
|
||||
|
||||
if (isPlaying() && inHmd) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (OculusManager::isConnected()) {
|
||||
estimatedPosition = OculusManager::getRelativePosition();
|
||||
|
||||
if (inHmd) {
|
||||
estimatedPosition = renderPlugin->headTranslation();
|
||||
estimatedPosition.x *= -1.0f;
|
||||
_trackedHeadPosition = estimatedPosition;
|
||||
|
||||
|
@ -274,7 +277,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
|
||||
|
||||
Head* head = getHead();
|
||||
if (OculusManager::isConnected() || isPlaying()) {
|
||||
if (inHmd || isPlaying()) {
|
||||
head->setDeltaPitch(estimatedRotation.x);
|
||||
head->setDeltaYaw(estimatedRotation.y);
|
||||
} else {
|
||||
|
@ -294,7 +297,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||
// match your body movements.
|
||||
if (OculusManager::isConnected() && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
if (inHmd && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
relativePosition.x = -relativePosition.x;
|
||||
}
|
||||
|
||||
|
@ -302,7 +305,6 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
-MAX_LEAN, MAX_LEAN));
|
||||
head->setLeanForward(glm::clamp(glm::degrees(atanf(relativePosition.z * _leanScale / TORSO_LENGTH)),
|
||||
-MAX_LEAN, MAX_LEAN));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,9 +32,14 @@ void LegacyRenderPlugin::activate() {
|
|||
_window->setFocusPolicy(Qt::StrongFocus);
|
||||
_window->setFocus();
|
||||
_window->setMouseTracking(true);
|
||||
|
||||
_window->installEventFilter(qApp);
|
||||
_window->installEventFilter(DependencyManager::get<OffscreenUi>().data());
|
||||
}
|
||||
|
||||
void LegacyRenderPlugin::deactivate() {
|
||||
_window->removeEventFilter(DependencyManager::get<OffscreenUi>().data());
|
||||
_window->removeEventFilter(qApp);
|
||||
qApp->getWindow()->setCentralWidget(oldWidget);
|
||||
// stop the glWidget frame timer so it doesn't call paintGL
|
||||
_window->stopFrameTimer();
|
||||
|
|
Loading…
Reference in a new issue