mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
Merge branch 'temp' into overlay
This commit is contained in:
commit
e75b1a6794
5 changed files with 30 additions and 43 deletions
|
@ -238,8 +238,9 @@ Hifi.Stats {
|
||||||
x: 4; y: 4
|
x: 4; y: 4
|
||||||
id: perfText
|
id: perfText
|
||||||
color: root.fontColor
|
color: root.fontColor
|
||||||
font.family: "Lucida Console"
|
font.family: root.monospaceFont
|
||||||
text: "-------------------------------------------------------- Function " +
|
font.pixelSize: 10
|
||||||
|
text: "-------------------------------------------------------- Function " +
|
||||||
"------------------------------------------------------- --msecs- -calls--\n" +
|
"------------------------------------------------------- --msecs- -calls--\n" +
|
||||||
root.timingStats;
|
root.timingStats;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,9 @@ import "styles"
|
||||||
Hifi.Tooltip {
|
Hifi.Tooltip {
|
||||||
id: root
|
id: root
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
x: lastMousePosition.x
|
// FIXME adjust position based on the edges of the screen
|
||||||
y: lastMousePosition.y
|
x: lastMousePosition.x + 20
|
||||||
|
y: lastMousePosition.y + 5
|
||||||
implicitWidth: border.implicitWidth
|
implicitWidth: border.implicitWidth
|
||||||
implicitHeight: border.implicitHeight
|
implicitHeight: border.implicitHeight
|
||||||
|
|
||||||
|
|
|
@ -95,32 +95,28 @@ ApplicationOverlay::~ApplicationOverlay() {
|
||||||
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
||||||
CHECK_GL_ERROR();
|
CHECK_GL_ERROR();
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||||
|
|
||||||
|
// TODO move to Application::idle()?
|
||||||
|
Stats::getInstance()->updateStats();
|
||||||
|
|
||||||
buildFramebufferObject();
|
buildFramebufferObject();
|
||||||
|
|
||||||
// First render the mirror to the mirror FBO
|
// First render the mirror to the mirror FBO
|
||||||
renderRearViewToFbo(renderArgs);
|
// renderRearViewToFbo(renderArgs);
|
||||||
|
|
||||||
// Execute the batch into our framebuffer
|
// Execute the batch into our framebuffer
|
||||||
_overlayFramebuffer->bind();
|
_overlayFramebuffer->bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
fboViewport(_overlayFramebuffer);
|
fboViewport(_overlayFramebuffer);
|
||||||
CHECK_GL_ERROR();
|
|
||||||
|
|
||||||
// Now render the overlay components together into a single texture
|
// Now render the overlay components together into a single texture
|
||||||
//renderOverlays(renderArgs);
|
renderOverlays(renderArgs);
|
||||||
//renderAudioMeter(renderArgs);
|
//renderAudioMeter(renderArgs);
|
||||||
//renderCameraToggle(renderArgs);
|
//renderCameraToggle(renderArgs);
|
||||||
renderStatsAndLogs(renderArgs);
|
renderStatsAndLogs(renderArgs);
|
||||||
CHECK_GL_ERROR();
|
// renderRearView(renderArgs);
|
||||||
renderRearView(renderArgs);
|
|
||||||
CHECK_GL_ERROR();
|
|
||||||
|
|
||||||
renderDomainConnectionStatusBorder(renderArgs);
|
renderDomainConnectionStatusBorder(renderArgs);
|
||||||
CHECK_GL_ERROR();
|
|
||||||
renderQmlUi(renderArgs);
|
renderQmlUi(renderArgs);
|
||||||
CHECK_GL_ERROR();
|
|
||||||
|
|
||||||
_overlayFramebuffer->release();
|
_overlayFramebuffer->release();
|
||||||
CHECK_GL_ERROR();
|
CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
|
@ -162,6 +158,7 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
fboViewport(_overlayFramebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderCameraToggle(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderCameraToggle(RenderArgs* renderArgs) {
|
||||||
|
@ -180,6 +177,7 @@ void ApplicationOverlay::renderCameraToggle(RenderArgs* renderArgs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DependencyManager::get<CameraToolBox>()->render(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, audioMeterY, boxed);
|
DependencyManager::get<CameraToolBox>()->render(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, audioMeterY, boxed);
|
||||||
|
fboViewport(_overlayFramebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderAudioMeter(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderAudioMeter(RenderArgs* renderArgs) {
|
||||||
|
@ -296,6 +294,7 @@ void ApplicationOverlay::renderAudioMeter(RenderArgs* renderArgs) {
|
||||||
audioLevel, AUDIO_METER_HEIGHT, quadColor,
|
audioLevel, AUDIO_METER_HEIGHT, quadColor,
|
||||||
_audioBlueQuad);
|
_audioBlueQuad);
|
||||||
}
|
}
|
||||||
|
fboViewport(_overlayFramebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||||
|
@ -305,16 +304,9 @@ void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||||
float fov = MIRROR_FIELD_OF_VIEW;
|
float fov = MIRROR_FIELD_OF_VIEW;
|
||||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
// bool eyeRelativeCamera = false;
|
// bool eyeRelativeCamera = false;
|
||||||
bool billboard = false;
|
if (RearMirrorTools::rearViewZoomLevel.get() == BODY) {
|
||||||
if (billboard) {
|
|
||||||
fov = BILLBOARD_FIELD_OF_VIEW; // degees
|
|
||||||
_mirrorCamera.setPosition(myAvatar->getPosition() +
|
|
||||||
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * myAvatar->getScale());
|
|
||||||
|
|
||||||
} else if (RearMirrorTools::rearViewZoomLevel.get() == BODY) {
|
|
||||||
_mirrorCamera.setPosition(myAvatar->getChestPosition() +
|
_mirrorCamera.setPosition(myAvatar->getChestPosition() +
|
||||||
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale());
|
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale());
|
||||||
|
|
||||||
} else { // HEAD zoom level
|
} else { // HEAD zoom level
|
||||||
// FIXME note that the positioing of the camera relative to the avatar can suffer limited
|
// FIXME note that the positioing of the camera relative to the avatar can suffer limited
|
||||||
// precision as the user's position moves further away from the origin. Thus at
|
// precision as the user's position moves further away from the origin. Thus at
|
||||||
|
@ -339,14 +331,7 @@ void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||||
_mirrorCamera.setRotation(myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
|
_mirrorCamera.setRotation(myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
|
||||||
|
|
||||||
// set the bounds of rear mirror view
|
// set the bounds of rear mirror view
|
||||||
if (billboard) {
|
fboViewport(_mirrorFramebuffer);
|
||||||
//QSize size = DependencyManager::get<TextureCache>()->getFrameBufferSize();
|
|
||||||
//glViewport(region.x(), size.height() - region.y() - region.height(), region.width(), region.height());
|
|
||||||
//glScissor(region.x(), size.height() - region.y() - region.height(), region.width(), region.height());
|
|
||||||
} else {
|
|
||||||
auto mirrorSize = _mirrorFramebuffer->size();
|
|
||||||
fboViewport(_mirrorFramebuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
_mirrorFramebuffer->bind();
|
_mirrorFramebuffer->bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
@ -360,23 +345,14 @@ void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||||
glLoadMatrixf(glm::value_ptr(glm::mat4_cast(_mirrorCamera.getOrientation()) * glm::translate(glm::mat4(), _mirrorCamera.getPosition())));
|
glLoadMatrixf(glm::value_ptr(glm::mat4_cast(_mirrorCamera.getOrientation()) * glm::translate(glm::mat4(), _mirrorCamera.getPosition())));
|
||||||
{
|
{
|
||||||
renderArgs->_context->syncCache();
|
renderArgs->_context->syncCache();
|
||||||
qApp->displaySide(renderArgs, _mirrorCamera, true, billboard);
|
qApp->displaySide(renderArgs, _mirrorCamera, true, false);
|
||||||
}
|
}
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
_mirrorFramebuffer->release();
|
_mirrorFramebuffer->release();
|
||||||
|
fboViewport(_overlayFramebuffer);
|
||||||
// if (!billboard) {
|
|
||||||
// _rearMirrorTools->render(renderArgs, false, _glWidget->mapFromGlobal(QCursor::pos()));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // reset Viewport and projection matrix
|
|
||||||
// glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
|
||||||
// glDisable(GL_SCISSOR_TEST);
|
|
||||||
// updateProjectionMatrix(_myCamera, updateViewFrustum);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
||||||
|
@ -408,7 +384,7 @@ void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {
|
||||||
// Display stats and log text onscreen
|
// Display stats and log text onscreen
|
||||||
|
|
||||||
// Determine whether to compute timing details
|
// Determine whether to compute timing details
|
||||||
Stats::getInstance()->updateStats();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Show on-screen msec timer
|
// Show on-screen msec timer
|
||||||
|
@ -434,6 +410,7 @@ void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
|
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
|
||||||
|
fboViewport(_overlayFramebuffer);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/component_wise.hpp>
|
#include <glm/gtx/component_wise.hpp>
|
||||||
|
@ -50,6 +51,8 @@ Stats* Stats::getInstance() {
|
||||||
|
|
||||||
Stats::Stats(QQuickItem* parent) : QQuickItem(parent) {
|
Stats::Stats(QQuickItem* parent) : QQuickItem(parent) {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
|
_monospaceFont = font.family();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stats::includeTimingRecord(const QString& name) {
|
bool Stats::includeTimingRecord(const QString& name) {
|
||||||
|
|
|
@ -32,6 +32,8 @@ class Stats : public QQuickItem {
|
||||||
HIFI_QML_DECL
|
HIFI_QML_DECL
|
||||||
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged)
|
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged)
|
||||||
Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged)
|
Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged)
|
||||||
|
Q_PROPERTY(QString monospaceFont READ monospaceFont)
|
||||||
|
|
||||||
STATS_PROPERTY(int, serverCount, 0)
|
STATS_PROPERTY(int, serverCount, 0)
|
||||||
STATS_PROPERTY(int, framerate, 0)
|
STATS_PROPERTY(int, framerate, 0)
|
||||||
STATS_PROPERTY(int, avatarCount, 0)
|
STATS_PROPERTY(int, avatarCount, 0)
|
||||||
|
@ -79,7 +81,9 @@ public:
|
||||||
Stats(QQuickItem* parent = nullptr);
|
Stats(QQuickItem* parent = nullptr);
|
||||||
bool includeTimingRecord(const QString& name);
|
bool includeTimingRecord(const QString& name);
|
||||||
void setRenderDetails(const RenderDetails& details);
|
void setRenderDetails(const RenderDetails& details);
|
||||||
|
const QString& monospaceFont() {
|
||||||
|
return _monospaceFont;
|
||||||
|
}
|
||||||
void updateStats();
|
void updateStats();
|
||||||
|
|
||||||
bool isExpanded() { return _expanded; }
|
bool isExpanded() { return _expanded; }
|
||||||
|
@ -141,6 +145,7 @@ private:
|
||||||
bool _resetRecentMaxPacketsSoon{ true };
|
bool _resetRecentMaxPacketsSoon{ true };
|
||||||
bool _expanded{ false };
|
bool _expanded{ false };
|
||||||
bool _timingExpanded{ false };
|
bool _timingExpanded{ false };
|
||||||
|
QString _monospaceFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Stats_h
|
#endif // hifi_Stats_h
|
||||||
|
|
Loading…
Reference in a new issue