mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:24:08 +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
|
||||
id: perfText
|
||||
color: root.fontColor
|
||||
font.family: "Lucida Console"
|
||||
text: "-------------------------------------------------------- Function " +
|
||||
font.family: root.monospaceFont
|
||||
font.pixelSize: 10
|
||||
text: "-------------------------------------------------------- Function " +
|
||||
"------------------------------------------------------- --msecs- -calls--\n" +
|
||||
root.timingStats;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@ import "styles"
|
|||
Hifi.Tooltip {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
x: lastMousePosition.x
|
||||
y: lastMousePosition.y
|
||||
// FIXME adjust position based on the edges of the screen
|
||||
x: lastMousePosition.x + 20
|
||||
y: lastMousePosition.y + 5
|
||||
implicitWidth: border.implicitWidth
|
||||
implicitHeight: border.implicitHeight
|
||||
|
||||
|
|
|
@ -95,32 +95,28 @@ ApplicationOverlay::~ApplicationOverlay() {
|
|||
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
||||
CHECK_GL_ERROR();
|
||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||
|
||||
// TODO move to Application::idle()?
|
||||
Stats::getInstance()->updateStats();
|
||||
|
||||
buildFramebufferObject();
|
||||
|
||||
// First render the mirror to the mirror FBO
|
||||
renderRearViewToFbo(renderArgs);
|
||||
// renderRearViewToFbo(renderArgs);
|
||||
|
||||
// Execute the batch into our framebuffer
|
||||
_overlayFramebuffer->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
fboViewport(_overlayFramebuffer);
|
||||
CHECK_GL_ERROR();
|
||||
|
||||
// Now render the overlay components together into a single texture
|
||||
//renderOverlays(renderArgs);
|
||||
renderOverlays(renderArgs);
|
||||
//renderAudioMeter(renderArgs);
|
||||
//renderCameraToggle(renderArgs);
|
||||
renderStatsAndLogs(renderArgs);
|
||||
CHECK_GL_ERROR();
|
||||
renderRearView(renderArgs);
|
||||
CHECK_GL_ERROR();
|
||||
|
||||
// renderRearView(renderArgs);
|
||||
renderDomainConnectionStatusBorder(renderArgs);
|
||||
CHECK_GL_ERROR();
|
||||
renderQmlUi(renderArgs);
|
||||
CHECK_GL_ERROR();
|
||||
|
||||
_overlayFramebuffer->release();
|
||||
CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -162,6 +158,7 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
|||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
fboViewport(_overlayFramebuffer);
|
||||
}
|
||||
|
||||
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);
|
||||
fboViewport(_overlayFramebuffer);
|
||||
}
|
||||
|
||||
void ApplicationOverlay::renderAudioMeter(RenderArgs* renderArgs) {
|
||||
|
@ -296,6 +294,7 @@ void ApplicationOverlay::renderAudioMeter(RenderArgs* renderArgs) {
|
|||
audioLevel, AUDIO_METER_HEIGHT, quadColor,
|
||||
_audioBlueQuad);
|
||||
}
|
||||
fboViewport(_overlayFramebuffer);
|
||||
}
|
||||
|
||||
void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||
|
@ -305,16 +304,9 @@ void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
|||
float fov = MIRROR_FIELD_OF_VIEW;
|
||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
// bool eyeRelativeCamera = false;
|
||||
bool billboard = false;
|
||||
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) {
|
||||
if (RearMirrorTools::rearViewZoomLevel.get() == BODY) {
|
||||
_mirrorCamera.setPosition(myAvatar->getChestPosition() +
|
||||
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale());
|
||||
|
||||
} else { // HEAD zoom level
|
||||
// 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
|
||||
|
@ -339,14 +331,7 @@ void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
|||
_mirrorCamera.setRotation(myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
|
||||
|
||||
// set the bounds of rear mirror view
|
||||
if (billboard) {
|
||||
//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);
|
||||
}
|
||||
fboViewport(_mirrorFramebuffer);
|
||||
|
||||
_mirrorFramebuffer->bind();
|
||||
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())));
|
||||
{
|
||||
renderArgs->_context->syncCache();
|
||||
qApp->displaySide(renderArgs, _mirrorCamera, true, billboard);
|
||||
qApp->displaySide(renderArgs, _mirrorCamera, true, false);
|
||||
}
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
_mirrorFramebuffer->release();
|
||||
|
||||
// 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);
|
||||
//}
|
||||
fboViewport(_overlayFramebuffer);
|
||||
}
|
||||
|
||||
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
||||
|
@ -408,7 +384,7 @@ void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {
|
|||
// Display stats and log text onscreen
|
||||
|
||||
// Determine whether to compute timing details
|
||||
Stats::getInstance()->updateStats();
|
||||
|
||||
|
||||
/*
|
||||
// Show on-screen msec timer
|
||||
|
@ -434,6 +410,7 @@ void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {
|
|||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
|
||||
fboViewport(_overlayFramebuffer);
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "Stats.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <QFontDatabase>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/component_wise.hpp>
|
||||
|
@ -50,6 +51,8 @@ Stats* Stats::getInstance() {
|
|||
|
||||
Stats::Stats(QQuickItem* parent) : QQuickItem(parent) {
|
||||
INSTANCE = this;
|
||||
const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
_monospaceFont = font.family();
|
||||
}
|
||||
|
||||
bool Stats::includeTimingRecord(const QString& name) {
|
||||
|
|
|
@ -32,6 +32,8 @@ class Stats : public QQuickItem {
|
|||
HIFI_QML_DECL
|
||||
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged)
|
||||
Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged)
|
||||
Q_PROPERTY(QString monospaceFont READ monospaceFont)
|
||||
|
||||
STATS_PROPERTY(int, serverCount, 0)
|
||||
STATS_PROPERTY(int, framerate, 0)
|
||||
STATS_PROPERTY(int, avatarCount, 0)
|
||||
|
@ -79,7 +81,9 @@ public:
|
|||
Stats(QQuickItem* parent = nullptr);
|
||||
bool includeTimingRecord(const QString& name);
|
||||
void setRenderDetails(const RenderDetails& details);
|
||||
|
||||
const QString& monospaceFont() {
|
||||
return _monospaceFont;
|
||||
}
|
||||
void updateStats();
|
||||
|
||||
bool isExpanded() { return _expanded; }
|
||||
|
@ -141,6 +145,7 @@ private:
|
|||
bool _resetRecentMaxPacketsSoon{ true };
|
||||
bool _expanded{ false };
|
||||
bool _timingExpanded{ false };
|
||||
QString _monospaceFont;
|
||||
};
|
||||
|
||||
#endif // hifi_Stats_h
|
||||
|
|
Loading…
Reference in a new issue