mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-19 10:00:15 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into detect-ballistic
This commit is contained in:
commit
26511575c2
15 changed files with 140 additions and 37 deletions
|
@ -31,7 +31,9 @@ var yawFromTouch = 0;
|
||||||
var pitchFromTouch = 0;
|
var pitchFromTouch = 0;
|
||||||
|
|
||||||
// Touch Data
|
// Touch Data
|
||||||
|
var TIME_BEFORE_GENERATED_END_TOUCH_EVENT = 50; // ms
|
||||||
var startedTouching = false;
|
var startedTouching = false;
|
||||||
|
var lastTouchEvent = 0;
|
||||||
var lastMouseX = 0;
|
var lastMouseX = 0;
|
||||||
var lastMouseY = 0;
|
var lastMouseY = 0;
|
||||||
var yawFromMouse = 0;
|
var yawFromMouse = 0;
|
||||||
|
@ -80,11 +82,17 @@ function touchBeginEvent(event) {
|
||||||
yawFromTouch = 0;
|
yawFromTouch = 0;
|
||||||
pitchFromTouch = 0;
|
pitchFromTouch = 0;
|
||||||
startedTouching = true;
|
startedTouching = true;
|
||||||
|
var d = new Date();
|
||||||
|
lastTouchEvent = d.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function touchEndEvent(event) {
|
function touchEndEvent(event) {
|
||||||
if (wantDebugging) {
|
if (wantDebugging) {
|
||||||
|
if (event) {
|
||||||
print("touchEndEvent event.x,y=" + event.x + ", " + event.y);
|
print("touchEndEvent event.x,y=" + event.x + ", " + event.y);
|
||||||
|
} else {
|
||||||
|
print("touchEndEvent generated");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
startedTouching = false;
|
startedTouching = false;
|
||||||
}
|
}
|
||||||
|
@ -97,15 +105,16 @@ function touchUpdateEvent(event) {
|
||||||
|
|
||||||
if (!startedTouching) {
|
if (!startedTouching) {
|
||||||
// handle Qt 5.4.x bug where we get touch update without a touch begin event
|
// handle Qt 5.4.x bug where we get touch update without a touch begin event
|
||||||
startedTouching = true;
|
touchBeginEvent(event);
|
||||||
lastTouchX = event.x;
|
return;
|
||||||
lastTouchY = event.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yawFromTouch += ((event.x - lastTouchX) * TOUCH_YAW_SCALE * FIXED_TOUCH_TIMESTEP);
|
yawFromTouch += ((event.x - lastTouchX) * TOUCH_YAW_SCALE * FIXED_TOUCH_TIMESTEP);
|
||||||
pitchFromTouch += ((event.y - lastTouchY) * TOUCH_PITCH_SCALE * FIXED_TOUCH_TIMESTEP);
|
pitchFromTouch += ((event.y - lastTouchY) * TOUCH_PITCH_SCALE * FIXED_TOUCH_TIMESTEP);
|
||||||
lastTouchX = event.x;
|
lastTouchX = event.x;
|
||||||
lastTouchY = event.y;
|
lastTouchY = event.y;
|
||||||
|
var d = new Date();
|
||||||
|
lastTouchEvent = d.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +123,14 @@ function update(deltaTime) {
|
||||||
print("update()...");
|
print("update()...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (startedTouching) {
|
||||||
|
var d = new Date();
|
||||||
|
var sinceLastTouch = d.getTime() - lastTouchEvent;
|
||||||
|
if (sinceLastTouch > TIME_BEFORE_GENERATED_END_TOUCH_EVENT) {
|
||||||
|
touchEndEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (yawFromTouch != 0 || yawFromMouse != 0) {
|
if (yawFromTouch != 0 || yawFromMouse != 0) {
|
||||||
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollRadians(0, yawFromTouch + yawFromMouse, 0));
|
var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollRadians(0, yawFromTouch + yawFromMouse, 0));
|
||||||
|
|
||||||
|
|
|
@ -1028,6 +1028,11 @@ bool Application::event(QEvent* event) {
|
||||||
bool Application::eventFilter(QObject* object, QEvent* event) {
|
bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
|
||||||
if (event->type() == QEvent::ShortcutOverride) {
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
|
if (DependencyManager::get<OffscreenUi>()->shouldSwallowShortcut(event)) {
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out captured keys before they're used for shortcut actions.
|
// Filter out captured keys before they're used for shortcut actions.
|
||||||
if (_controllerScriptingInterface.isKeyCaptured(static_cast<QKeyEvent*>(event))) {
|
if (_controllerScriptingInterface.isKeyCaptured(static_cast<QKeyEvent*>(event))) {
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -1053,7 +1058,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
||||||
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
||||||
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
||||||
bool isKeypad = event->modifiers().testFlag(Qt::KeypadModifier);
|
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
break;
|
break;
|
||||||
case Qt::Key_L:
|
case Qt::Key_L:
|
||||||
|
@ -1492,9 +1496,11 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::touchUpdateEvent(QTouchEvent* event) {
|
void Application::touchUpdateEvent(QTouchEvent* event) {
|
||||||
|
if (event->type() == QEvent::TouchUpdate) {
|
||||||
TouchEvent thisEvent(*event, _lastTouchEvent);
|
TouchEvent thisEvent(*event, _lastTouchEvent);
|
||||||
_controllerScriptingInterface.emitTouchUpdateEvent(thisEvent); // send events to any registered scripts
|
_controllerScriptingInterface.emitTouchUpdateEvent(thisEvent); // send events to any registered scripts
|
||||||
_lastTouchEvent = thisEvent;
|
_lastTouchEvent = thisEvent;
|
||||||
|
}
|
||||||
|
|
||||||
// if one of our scripts have asked to capture this event, then stop processing it
|
// if one of our scripts have asked to capture this event, then stop processing it
|
||||||
if (_controllerScriptingInterface.isTouchCaptured()) {
|
if (_controllerScriptingInterface.isTouchCaptured()) {
|
||||||
|
|
|
@ -683,11 +683,11 @@ void MyAvatar::loadData() {
|
||||||
|
|
||||||
_useFullAvatar = settings.value("useFullAvatar").toBool();
|
_useFullAvatar = settings.value("useFullAvatar").toBool();
|
||||||
_headURLFromPreferences = settings.value("faceModelURL", DEFAULT_HEAD_MODEL_URL).toUrl();
|
_headURLFromPreferences = settings.value("faceModelURL", DEFAULT_HEAD_MODEL_URL).toUrl();
|
||||||
_fullAvatarURLFromPreferences = settings.value("fullAvatarURL").toUrl();
|
_fullAvatarURLFromPreferences = settings.value("fullAvatarURL", DEFAULT_FULL_AVATAR_MODEL_URL).toUrl();
|
||||||
_skeletonURLFromPreferences = settings.value("skeletonModelURL").toUrl();
|
_skeletonURLFromPreferences = settings.value("skeletonModelURL", DEFAULT_BODY_MODEL_URL).toUrl();
|
||||||
_headModelName = settings.value("headModelName").toString();
|
_headModelName = settings.value("headModelName", DEFAULT_HEAD_MODEL_NAME).toString();
|
||||||
_bodyModelName = settings.value("bodyModelName").toString();
|
_bodyModelName = settings.value("bodyModelName", DEFAULT_BODY_MODEL_NAME).toString();
|
||||||
_fullAvatarModelName = settings.value("fullAvatarModelName").toString();;
|
_fullAvatarModelName = settings.value("fullAvatarModelName", DEFAULT_FULL_AVATAR_MODEL_NAME).toString();
|
||||||
|
|
||||||
if (isOldSettings) {
|
if (isOldSettings) {
|
||||||
bool assumeFullAvatar = _headURLFromPreferences.isEmpty();
|
bool assumeFullAvatar = _headURLFromPreferences.isEmpty();
|
||||||
|
@ -706,13 +706,22 @@ void MyAvatar::loadData() {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_fullAvatarURLFromPreferences = DEFAULT_FULL_AVATAR_MODEL_URL;
|
_fullAvatarURLFromPreferences = DEFAULT_FULL_AVATAR_MODEL_URL;
|
||||||
_skeletonURLFromPreferences = settings.value("skeletonModelURL").toUrl();
|
_skeletonURLFromPreferences = settings.value("skeletonModelURL", DEFAULT_BODY_MODEL_URL).toUrl();
|
||||||
|
|
||||||
QVariantHash headFST = FSTReader::downloadMapping(_headURLFromPreferences.toString());
|
if (_skeletonURLFromPreferences == DEFAULT_BODY_MODEL_URL) {
|
||||||
|
_bodyModelName = DEFAULT_BODY_MODEL_NAME;
|
||||||
|
} else {
|
||||||
QVariantHash bodyFST = FSTReader::downloadMapping(_skeletonURLFromPreferences.toString());
|
QVariantHash bodyFST = FSTReader::downloadMapping(_skeletonURLFromPreferences.toString());
|
||||||
|
|
||||||
_headModelName = headFST["name"].toString();
|
|
||||||
_bodyModelName = bodyFST["name"].toString();
|
_bodyModelName = bodyFST["name"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_headURLFromPreferences == DEFAULT_HEAD_MODEL_URL) {
|
||||||
|
_headModelName = DEFAULT_HEAD_MODEL_NAME;
|
||||||
|
} else {
|
||||||
|
QVariantHash headFST = FSTReader::downloadMapping(_headURLFromPreferences.toString());
|
||||||
|
_headModelName = headFST["name"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
_fullAvatarModelName = "Default";
|
_fullAvatarModelName = "Default";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,14 @@ const QString DEFAULT_FACESHIFT_HOSTNAME = "localhost";
|
||||||
const quint16 FACESHIFT_PORT = 33433;
|
const quint16 FACESHIFT_PORT = 33433;
|
||||||
const float DEFAULT_FACESHIFT_EYE_DEFLECTION = 0.25f;
|
const float DEFAULT_FACESHIFT_EYE_DEFLECTION = 0.25f;
|
||||||
|
|
||||||
|
const int FPS_TIMER_DELAY = 2000; // ms
|
||||||
|
const int FPS_TIMER_DURATION = 2000; // ms
|
||||||
|
|
||||||
Faceshift::Faceshift() :
|
Faceshift::Faceshift() :
|
||||||
_eyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION),
|
_eyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION),
|
||||||
_hostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME)
|
_hostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME),
|
||||||
|
_isCalculatingFPS(false),
|
||||||
|
_frameCount(0)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FACESHIFT
|
#ifdef HAVE_FACESHIFT
|
||||||
connect(&_tcpSocket, SIGNAL(connected()), SLOT(noteConnected()));
|
connect(&_tcpSocket, SIGNAL(connected()), SLOT(noteConnected()));
|
||||||
|
@ -81,6 +86,12 @@ void Faceshift::reset() {
|
||||||
string message;
|
string message;
|
||||||
fsBinaryStream::encode_message(message, fsMsgCalibrateNeutral());
|
fsBinaryStream::encode_message(message, fsMsgCalibrateNeutral());
|
||||||
send(message);
|
send(message);
|
||||||
|
|
||||||
|
// Log camera FPS after a reset
|
||||||
|
if (!_isCalculatingFPS) {
|
||||||
|
QTimer::singleShot(FPS_TIMER_DELAY, this, SLOT(startFPSTimer()));
|
||||||
|
_isCalculatingFPS = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_longTermAverageInitialized = false;
|
_longTermAverageInitialized = false;
|
||||||
}
|
}
|
||||||
|
@ -283,6 +294,10 @@ void Faceshift::receive(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// Count frames if timing
|
||||||
|
if (_isCalculatingFPS) {
|
||||||
|
_frameCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
||||||
|
@ -292,3 +307,13 @@ void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
||||||
void Faceshift::setHostname(const QString& hostname) {
|
void Faceshift::setHostname(const QString& hostname) {
|
||||||
_hostname.set(hostname);
|
_hostname.set(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Faceshift::startFPSTimer() {
|
||||||
|
_frameCount = 0;
|
||||||
|
QTimer::singleShot(FPS_TIMER_DURATION, this, SLOT(finishFPSTimer()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Faceshift::finishFPSTimer() {
|
||||||
|
qCDebug(interfaceapp) << "Faceshift: FPS =" << (float)_frameCount / ((float)FPS_TIMER_DURATION / 1000.0f);
|
||||||
|
_isCalculatingFPS = false;
|
||||||
|
}
|
||||||
|
|
|
@ -95,6 +95,8 @@ private slots:
|
||||||
void noteError(QAbstractSocket::SocketError error);
|
void noteError(QAbstractSocket::SocketError error);
|
||||||
void readPendingDatagrams();
|
void readPendingDatagrams();
|
||||||
void readFromSocket();
|
void readFromSocket();
|
||||||
|
void startFPSTimer();
|
||||||
|
void finishFPSTimer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Faceshift();
|
Faceshift();
|
||||||
|
@ -152,6 +154,9 @@ private:
|
||||||
int _mouthSmileRightIndex = 29;
|
int _mouthSmileRightIndex = 29;
|
||||||
|
|
||||||
int _jawOpenIndex = 21;
|
int _jawOpenIndex = 21;
|
||||||
|
|
||||||
|
bool _isCalculatingFPS;
|
||||||
|
int _frameCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Faceshift_h
|
#endif // hifi_Faceshift_h
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QWebFrame>
|
#include <QWebFrame>
|
||||||
#include <QWebView>
|
#include <QWebView>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "ui/DataWebPage.h"
|
#include "ui/DataWebPage.h"
|
||||||
|
@ -72,6 +73,11 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
||||||
_windowWidget = dialogWidget;
|
_windowWidget = dialogWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto style = QStyleFactory::create("fusion");
|
||||||
|
if (style) {
|
||||||
|
_webView->setStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
_webView->setPage(new DataWebPage());
|
_webView->setPage(new DataWebPage());
|
||||||
_webView->setUrl(url);
|
_webView->setUrl(url);
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,6 @@ void ApplicationOverlay::displayOverlayTexture() {
|
||||||
if (_alpha == 0.0f) {
|
if (_alpha == 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto glCanvas = Application::getInstance()->getGLWidget();
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix(); {
|
glPushMatrix(); {
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
|
@ -105,6 +105,10 @@ const QUrl DEFAULT_HEAD_MODEL_URL = QUrl("http://public.highfidelity.io/models/h
|
||||||
const QUrl DEFAULT_BODY_MODEL_URL = QUrl("http://public.highfidelity.io/models/skeletons/defaultAvatar_body.fst");
|
const QUrl DEFAULT_BODY_MODEL_URL = QUrl("http://public.highfidelity.io/models/skeletons/defaultAvatar_body.fst");
|
||||||
const QUrl DEFAULT_FULL_AVATAR_MODEL_URL = QUrl("http://public.highfidelity.io/marketplace/contents/029db3d4-da2c-4cb2-9c08-b9612ba576f5/02949063e7c4aed42ad9d1a58461f56d.fst");
|
const QUrl DEFAULT_FULL_AVATAR_MODEL_URL = QUrl("http://public.highfidelity.io/marketplace/contents/029db3d4-da2c-4cb2-9c08-b9612ba576f5/02949063e7c4aed42ad9d1a58461f56d.fst");
|
||||||
|
|
||||||
|
const QString DEFAULT_HEAD_MODEL_NAME = QString("Robot");
|
||||||
|
const QString DEFAULT_BODY_MODEL_NAME = QString("Robot");
|
||||||
|
const QString DEFAULT_FULL_AVATAR_MODEL_NAME = QString("Default");
|
||||||
|
|
||||||
|
|
||||||
// Where one's own Avatar begins in the world (will be overwritten if avatar data file is found).
|
// Where one's own Avatar begins in the world (will be overwritten if avatar data file is found).
|
||||||
// This is the start location in the Sandbox (xyz: 6270, 211, 6000).
|
// This is the start location in the Sandbox (xyz: 6270, 211, 6000).
|
||||||
|
|
|
@ -643,7 +643,7 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
|
||||||
// NOTE: Zone Entities are a special case we handle here... Zones don't render
|
// NOTE: Zone Entities are a special case we handle here... Zones don't render
|
||||||
// like other entity types. So we will skip the normal rendering tests
|
// like other entity types. So we will skip the normal rendering tests
|
||||||
if (entityItem->getType() == EntityTypes::Zone) {
|
if (entityItem->getType() == EntityTypes::Zone) {
|
||||||
if (entityItem->contains(args->_viewFrustum->getPosition())) {
|
if (entityItem->contains(_viewState->getAvatarPosition())) {
|
||||||
float entityVolumeEstimate = entityItem->getVolumeEstimate();
|
float entityVolumeEstimate = entityItem->getVolumeEstimate();
|
||||||
if (entityVolumeEstimate < _bestZoneVolume) {
|
if (entityVolumeEstimate < _bestZoneVolume) {
|
||||||
_bestZoneVolume = entityVolumeEstimate;
|
_bestZoneVolume = entityVolumeEstimate;
|
||||||
|
|
|
@ -1085,7 +1085,6 @@ const float MIN_ALIGNMENT_DOT = 0.999999f;
|
||||||
const float MIN_VELOCITY_DELTA = 0.01f;
|
const float MIN_VELOCITY_DELTA = 0.01f;
|
||||||
const float MIN_DAMPING_DELTA = 0.001f;
|
const float MIN_DAMPING_DELTA = 0.001f;
|
||||||
const float MIN_GRAVITY_DELTA = 0.001f;
|
const float MIN_GRAVITY_DELTA = 0.001f;
|
||||||
const float MIN_ACCELERATION_DELTA = 0.001f;
|
|
||||||
const float MIN_SPIN_DELTA = 0.0003f;
|
const float MIN_SPIN_DELTA = 0.0003f;
|
||||||
|
|
||||||
void EntityItem::updatePositionInDomainUnits(const glm::vec3& value) {
|
void EntityItem::updatePositionInDomainUnits(const glm::vec3& value) {
|
||||||
|
|
|
@ -16,8 +16,8 @@ GLBackend::GLTexture::GLTexture() :
|
||||||
_storageStamp(0),
|
_storageStamp(0),
|
||||||
_contentStamp(0),
|
_contentStamp(0),
|
||||||
_texture(0),
|
_texture(0),
|
||||||
_size(0),
|
_target(GL_TEXTURE_2D),
|
||||||
_target(GL_TEXTURE_2D)
|
_size(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
GLBackend::GLTexture::~GLTexture() {
|
GLBackend::GLTexture::~GLTexture() {
|
||||||
|
@ -176,6 +176,8 @@ public:
|
||||||
texel.internalFormat = GL_DEPTH_COMPONENT24;
|
texel.internalFormat = GL_DEPTH_COMPONENT24;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case gpu::NUM_TYPES:
|
||||||
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
|
|
||||||
const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f);
|
const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f);
|
||||||
const float DEFAULT_GRAVITY = -5.0f;
|
const float DEFAULT_GRAVITY = -5.0f;
|
||||||
const float TERMINAL_VELOCITY = 55.0f;
|
|
||||||
const float JUMP_SPEED = 3.5f;
|
const float JUMP_SPEED = 3.5f;
|
||||||
|
|
||||||
const float MAX_FALL_HEIGHT = 20.0f;
|
const float MAX_FALL_HEIGHT = 20.0f;
|
||||||
const float MIN_HOVER_HEIGHT = 3.0f;
|
|
||||||
|
|
||||||
const uint32_t PENDING_FLAG_ADD_TO_SIMULATION = 1U << 0;
|
const uint32_t PENDING_FLAG_ADD_TO_SIMULATION = 1U << 0;
|
||||||
const uint32_t PENDING_FLAG_REMOVE_FROM_SIMULATION = 1U << 1;
|
const uint32_t PENDING_FLAG_REMOVE_FROM_SIMULATION = 1U << 1;
|
||||||
|
|
|
@ -111,7 +111,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));
|
slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));
|
||||||
|
|
||||||
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));
|
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));
|
||||||
bool makeResult = gpu::Shader::makeProgram(*program, slotBindings);
|
gpu::Shader::makeProgram(*program, slotBindings);
|
||||||
|
|
||||||
|
|
||||||
auto locations = std::shared_ptr<Locations>(new Locations());
|
auto locations = std::shared_ptr<Locations>(new Locations());
|
||||||
|
@ -139,7 +139,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
||||||
|
|
||||||
// Good to go add the brand new pipeline
|
// Good to go add the brand new pipeline
|
||||||
auto pipeline = gpu::PipelinePointer(gpu::Pipeline::create(program, state));
|
auto pipeline = gpu::PipelinePointer(gpu::Pipeline::create(program, state));
|
||||||
auto it = insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations)));
|
insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations)));
|
||||||
|
|
||||||
// If not a shadow pass, create the mirror version from the same state, just change the FrontFace
|
// If not a shadow pass, create the mirror version from the same state, just change the FrontFace
|
||||||
if (!key.isShadow()) {
|
if (!key.isShadow()) {
|
||||||
|
|
|
@ -89,7 +89,15 @@ void OffscreenUi::create(QOpenGLContext* shareContext) {
|
||||||
// is needed too).
|
// is needed too).
|
||||||
connect(_renderControl, &QQuickRenderControl::renderRequested, this, &OffscreenUi::requestRender);
|
connect(_renderControl, &QQuickRenderControl::renderRequested, this, &OffscreenUi::requestRender);
|
||||||
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, &OffscreenUi::requestUpdate);
|
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, &OffscreenUi::requestUpdate);
|
||||||
_quickWindow->focusObject();
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
connect(_quickWindow, &QQuickWindow::focusObjectChanged, [this]{
|
||||||
|
qDebug() << "New focus item " << _quickWindow->focusObject();
|
||||||
|
});
|
||||||
|
connect(_quickWindow, &QQuickWindow::activeFocusItemChanged, [this] {
|
||||||
|
qDebug() << "New active focus item " << _quickWindow->activeFocusItem();
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
_qmlComponent = new QQmlComponent(_qmlEngine);
|
_qmlComponent = new QQmlComponent(_qmlEngine);
|
||||||
// Initialize the render control and our OpenGL resources.
|
// Initialize the render control and our OpenGL resources.
|
||||||
|
@ -257,6 +265,24 @@ QPointF OffscreenUi::mapWindowToUi(const QPointF& sourcePosition, QObject* sourc
|
||||||
return QPointF(offscreenPosition.x, offscreenPosition.y);
|
return QPointF(offscreenPosition.x, offscreenPosition.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This hack allows the QML UI to work with keys that are also bound as
|
||||||
|
// shortcuts at the application level. However, it seems as though the
|
||||||
|
// bound actions are still getting triggered. At least for backspace.
|
||||||
|
// Not sure why.
|
||||||
|
//
|
||||||
|
// However, the problem may go away once we switch to the new menu system,
|
||||||
|
// so I think it's OK for the time being.
|
||||||
|
bool OffscreenUi::shouldSwallowShortcut(QEvent * event) {
|
||||||
|
Q_ASSERT(event->type() == QEvent::ShortcutOverride);
|
||||||
|
QObject * focusObject = _quickWindow->focusObject();
|
||||||
|
if (focusObject != _quickWindow && focusObject != _rootItem) {
|
||||||
|
//qDebug() << "Swallowed shortcut " << static_cast<QKeyEvent*>(event)->key();
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Event handling customization
|
// Event handling customization
|
||||||
|
@ -268,10 +294,16 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
// Don't intercept our own events, or we enter an infinite recursion
|
// Don't intercept our own events, or we enter an infinite recursion
|
||||||
if (originalDestination == _quickWindow) {
|
QObject * recurseTest = originalDestination;
|
||||||
return false;
|
while (recurseTest) {
|
||||||
|
Q_ASSERT(recurseTest != _rootItem && recurseTest != _quickWindow);
|
||||||
|
recurseTest = recurseTest->parent();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::Resize: {
|
case QEvent::Resize: {
|
||||||
|
@ -280,7 +312,7 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
if (widget) {
|
if (widget) {
|
||||||
this->resize(resizeEvent->size());
|
this->resize(resizeEvent->size());
|
||||||
}
|
}
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
void resume();
|
void resume();
|
||||||
bool isPaused() const;
|
bool isPaused() const;
|
||||||
void setProxyWindow(QWindow* window);
|
void setProxyWindow(QWindow* window);
|
||||||
|
bool shouldSwallowShortcut(QEvent* event);
|
||||||
QPointF mapWindowToUi(const QPointF& sourcePosition, QObject* sourceObject);
|
QPointF mapWindowToUi(const QPointF& sourcePosition, QObject* sourceObject);
|
||||||
virtual bool eventFilter(QObject* originalDestination, QEvent* event);
|
virtual bool eventFilter(QObject* originalDestination, QEvent* event);
|
||||||
void setMouseTranslator(MouseTranslator mouseTranslator) {
|
void setMouseTranslator(MouseTranslator mouseTranslator) {
|
||||||
|
|
Loading…
Reference in a new issue