mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:36:56 +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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1434,7 +1436,7 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
if (!_lastMouseMoveWasSimulated) {
|
if (!_lastMouseMoveWasSimulated) {
|
||||||
_lastMouseMove = usecTimestampNow();
|
_lastMouseMove = usecTimestampNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_aboutToQuit) {
|
if (_aboutToQuit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3001,7 +3003,7 @@ ViewFrustum* Application::getViewFrustum() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (QThread::currentThread() == activeRenderingThread) {
|
if (QThread::currentThread() == activeRenderingThread) {
|
||||||
// FIXME, should this be an assert?
|
// 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
|
#endif
|
||||||
return &_viewFrustum;
|
return &_viewFrustum;
|
||||||
|
@ -3011,7 +3013,7 @@ ViewFrustum* Application::getDisplayViewFrustum() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (QThread::currentThread() != activeRenderingThread) {
|
if (QThread::currentThread() != activeRenderingThread) {
|
||||||
// FIXME, should this be an assert?
|
// 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
|
#endif
|
||||||
return &_displayViewFrustum;
|
return &_displayViewFrustum;
|
||||||
|
|
|
@ -67,13 +67,10 @@ void GLCanvas::paintGL() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Application::getInstance()->paintGL();
|
Application::getInstance()->paintGL();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!OculusManager::isConnected()) {
|
if (!OculusManager::isConnected()) {
|
||||||
#endif
|
|
||||||
|
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
#if 0
|
|
||||||
} else {
|
} else {
|
||||||
if (OculusManager::allowSwap()) {
|
if (OculusManager::allowSwap()) {
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
|
@ -121,13 +118,11 @@ void GLCanvas::throttleRender() {
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
OculusManager::beginFrameTiming();
|
OculusManager::beginFrameTiming();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
|
#endif
|
||||||
Application::getInstance()->paintGL();
|
Application::getInstance()->paintGL();
|
||||||
swapBuffers();
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
swapBuffers();
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
OculusManager::endFrameTiming();
|
OculusManager::endFrameTiming();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <UserActivityLogger.h>
|
#include <UserActivityLogger.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "plugins/render/RenderPlugin.h"
|
||||||
#include "AvatarManager.h"
|
#include "AvatarManager.h"
|
||||||
#include "Environment.h"
|
#include "Environment.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
@ -230,13 +231,15 @@ void MyAvatar::simulate(float deltaTime) {
|
||||||
void MyAvatar::updateFromTrackers(float deltaTime) {
|
void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
glm::vec3 estimatedPosition, estimatedRotation;
|
glm::vec3 estimatedPosition, estimatedRotation;
|
||||||
|
|
||||||
#if 0
|
auto renderPlugin = qApp->getActiveRenderPlugin();
|
||||||
if (isPlaying() && !OculusManager::isConnected()) {
|
bool inHmd = renderPlugin->isHmd();
|
||||||
|
|
||||||
|
if (isPlaying() && inHmd) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OculusManager::isConnected()) {
|
if (inHmd) {
|
||||||
estimatedPosition = OculusManager::getRelativePosition();
|
estimatedPosition = renderPlugin->headTranslation();
|
||||||
estimatedPosition.x *= -1.0f;
|
estimatedPosition.x *= -1.0f;
|
||||||
_trackedHeadPosition = estimatedPosition;
|
_trackedHeadPosition = estimatedPosition;
|
||||||
|
|
||||||
|
@ -274,7 +277,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
|
|
||||||
|
|
||||||
Head* head = getHead();
|
Head* head = getHead();
|
||||||
if (OculusManager::isConnected() || isPlaying()) {
|
if (inHmd || isPlaying()) {
|
||||||
head->setDeltaPitch(estimatedRotation.x);
|
head->setDeltaPitch(estimatedRotation.x);
|
||||||
head->setDeltaYaw(estimatedRotation.y);
|
head->setDeltaYaw(estimatedRotation.y);
|
||||||
} else {
|
} 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
|
// 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
|
// 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.
|
// 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;
|
relativePosition.x = -relativePosition.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +305,6 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
-MAX_LEAN, MAX_LEAN));
|
-MAX_LEAN, MAX_LEAN));
|
||||||
head->setLeanForward(glm::clamp(glm::degrees(atanf(relativePosition.z * _leanScale / TORSO_LENGTH)),
|
head->setLeanForward(glm::clamp(glm::degrees(atanf(relativePosition.z * _leanScale / TORSO_LENGTH)),
|
||||||
-MAX_LEAN, MAX_LEAN));
|
-MAX_LEAN, MAX_LEAN));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,14 @@ void LegacyRenderPlugin::activate() {
|
||||||
_window->setFocusPolicy(Qt::StrongFocus);
|
_window->setFocusPolicy(Qt::StrongFocus);
|
||||||
_window->setFocus();
|
_window->setFocus();
|
||||||
_window->setMouseTracking(true);
|
_window->setMouseTracking(true);
|
||||||
|
|
||||||
|
_window->installEventFilter(qApp);
|
||||||
|
_window->installEventFilter(DependencyManager::get<OffscreenUi>().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegacyRenderPlugin::deactivate() {
|
void LegacyRenderPlugin::deactivate() {
|
||||||
|
_window->removeEventFilter(DependencyManager::get<OffscreenUi>().data());
|
||||||
|
_window->removeEventFilter(qApp);
|
||||||
qApp->getWindow()->setCentralWidget(oldWidget);
|
qApp->getWindow()->setCentralWidget(oldWidget);
|
||||||
// stop the glWidget frame timer so it doesn't call paintGL
|
// stop the glWidget frame timer so it doesn't call paintGL
|
||||||
_window->stopFrameTimer();
|
_window->stopFrameTimer();
|
||||||
|
|
Loading…
Reference in a new issue