Merge branch 'master' of https://github.com/highfidelity/hifi into asynchronous-commerce-2

This commit is contained in:
howard-stearns 2017-08-18 10:03:33 -07:00
commit 6e34ab45d6
17 changed files with 53 additions and 8 deletions

View file

@ -15,6 +15,11 @@ import "controls" as Controls
Controls.WebView {
// This is for JS/QML communication, which is unused in a Web3DOverlay,
// but not having this here results in spurious warnings about a
// missing signal
signal sendToScript(var message);
function onWebEventReceived(event) {
if (event.slice(0, 17) === "CLARA.IO DOWNLOAD") {
ApplicationInterface.addAssetToWorldFromURL(event.slice(18));

View file

@ -41,6 +41,11 @@ FocusScope {
// when they're opened.
signal showDesktop();
// This is for JS/QML communication, which is unused in the Desktop,
// but not having this here results in spurious warnings about a
// missing signal
signal sendToScript(var message);
// Allows QML/JS to find the desktop through the parent chain
property bool desktopRoot: true

View file

@ -28,6 +28,11 @@ ScrollingWindow {
HifiConstants { id: hifi }
// This is for JS/QML communication, which is unused in the AttachmentsDialog,
// but not having this here results in spurious warnings about a
// missing signal
signal sendToScript(var message);
property var settings: Settings {
category: "AttachmentsDialog"
property alias x: root.x

View file

@ -6911,6 +6911,12 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa
});
}
void Application::takeSecondaryCameraSnapshot() {
postLambdaEvent([this] {
Snapshot::saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot());
});
}
void Application::shareSnapshot(const QString& path, const QUrl& href) {
postLambdaEvent([path, href] {
// not much to do here, everything is done in snapshot code...

View file

@ -274,6 +274,7 @@ public:
float getAverageSimsPerSecond() const { return _simCounter.rate(); }
void takeSnapshot(bool notify, bool includeAnimated = false, float aspectRatio = 0.0f);
void takeSecondaryCameraSnapshot();
void shareSnapshot(const QString& filename, const QUrl& href = QUrl(""));
model::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; }

View file

@ -294,6 +294,10 @@ void WindowScriptingInterface::takeSnapshot(bool notify, bool includeAnimated, f
qApp->takeSnapshot(notify, includeAnimated, aspectRatio);
}
void WindowScriptingInterface::takeSecondaryCameraSnapshot() {
qApp->takeSecondaryCameraSnapshot();
}
void WindowScriptingInterface::shareSnapshot(const QString& path, const QUrl& href) {
qApp->shareSnapshot(path, href);
}

View file

@ -60,6 +60,7 @@ public slots:
void showAssetServer(const QString& upload = "");
void copyToClipboard(const QString& text);
void takeSnapshot(bool notify = true, bool includeAnimated = false, float aspectRatio = 0.0f);
void takeSecondaryCameraSnapshot();
void makeConnection(bool success, const QString& userNameOrError);
void displayAnnouncement(const QString& message);
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));

View file

@ -34,3 +34,7 @@ void NullDisplayPlugin::submitFrame(const gpu::FramePointer& frame) {
QImage NullDisplayPlugin::getScreenshot(float aspectRatio) const {
return QImage();
}
QImage NullDisplayPlugin::getSecondaryCameraScreenshot() const {
return QImage();
}

View file

@ -19,6 +19,7 @@ public:
bool hasFocus() const override;
void submitFrame(const gpu::FramePointer& newFrame) override;
QImage getScreenshot(float aspectRatio = 0.0f) const override;
QImage getSecondaryCameraScreenshot() const override;
void copyTextureToQuickFramebuffer(NetworkTexturePointer source, QOpenGLFramebufferObject* target, GLsync* fenceSync) override {};
private:
static const QString NAME;

View file

@ -775,6 +775,19 @@ QImage OpenGLDisplayPlugin::getScreenshot(float aspectRatio) const {
return screenshot.mirrored(false, true);
}
QImage OpenGLDisplayPlugin::getSecondaryCameraScreenshot() const {
auto textureCache = DependencyManager::get<TextureCache>();
auto secondaryCameraFramebuffer = textureCache->getSpectatorCameraFramebuffer();
gpu::Vec4i region(0, 0, secondaryCameraFramebuffer->getWidth(), secondaryCameraFramebuffer->getHeight());
auto glBackend = const_cast<OpenGLDisplayPlugin&>(*this).getGLBackend();
QImage screenshot(region.z, region.w, QImage::Format_ARGB32);
withMainThreadContext([&] {
glBackend->downloadFramebuffer(secondaryCameraFramebuffer, region, screenshot);
});
return screenshot.mirrored(false, true);
}
glm::uvec2 OpenGLDisplayPlugin::getSurfacePixels() const {
uvec2 result;
auto window = _container->getPrimaryWidget();

View file

@ -60,6 +60,7 @@ public:
virtual bool setDisplayTexture(const QString& name) override;
virtual bool onDisplayTextureReset() { return false; };
QImage getScreenshot(float aspectRatio = 0.0f) const override;
QImage getSecondaryCameraScreenshot() const override;
float presentRate() const override;

View file

@ -183,6 +183,7 @@ public:
// Fetch the most recently displayed image as a QImage
virtual QImage getScreenshot(float aspectRatio = 0.0f) const = 0;
virtual QImage getSecondaryCameraScreenshot() const = 0;
// will query the underlying hmd api to compute the most recent head pose
virtual bool beginFrameRender(uint32_t frameIndex) { return true; }

View file

@ -594,7 +594,7 @@ void FadeJob::run(const render::RenderContextPointer& renderContext, FadeJob::Ou
if (update(*jobConfig, scene, transaction, state, deltaTime)) {
hasTransaction = true;
}
if (isFirstItem) {
if (isFirstItem && jobConfig->manualFade && (state.threshold != jobConfig->threshold)) {
jobConfig->setProperty("threshold", state.threshold);
isFirstItem = false;
}
@ -645,9 +645,6 @@ bool FadeJob::update(const Config& config, const render::ScenePointer& scene, re
{
transition.threshold = computeElementEnterRatio(transition.time, eventDuration, timing);
transition.baseOffset = transition.noiseOffset;
transition.baseInvSize.x = 1.f / dimensions.x;
transition.baseInvSize.y = 1.f / dimensions.y;
transition.baseInvSize.z = 1.f / dimensions.z;
transition.isFinished += (transition.threshold >= 1.f) & 1;
if (transition.eventType == render::Transition::ELEMENT_ENTER_DOMAIN) {
transition.threshold = 1.f - transition.threshold;

View file

@ -50,7 +50,7 @@ class FadeConfig : public render::Job::Config {
Q_PROPERTY(float baseSizeY READ getBaseSizeY WRITE setBaseSizeY NOTIFY dirty)
Q_PROPERTY(float baseSizeZ READ getBaseSizeZ WRITE setBaseSizeZ NOTIFY dirty)
Q_PROPERTY(float baseLevel READ getBaseLevel WRITE setBaseLevel NOTIFY dirty)
Q_PROPERTY(bool _isInverted READ isInverted WRITE setInverted NOTIFY dirty)
Q_PROPERTY(bool isInverted READ isInverted WRITE setInverted NOTIFY dirty)
Q_PROPERTY(float noiseSizeX READ getNoiseSizeX WRITE setNoiseSizeX NOTIFY dirty)
Q_PROPERTY(float noiseSizeY READ getNoiseSizeY WRITE setNoiseSizeY NOTIFY dirty)
Q_PROPERTY(float noiseSizeZ READ getNoiseSizeZ WRITE setNoiseSizeZ NOTIFY dirty)

View file

@ -1228,7 +1228,7 @@ Script.scriptEnding.connect(function () {
Controller.mouseMoveEvent.disconnect(mouseMoveEventBuffered);
Controller.mouseReleaseEvent.disconnect(mouseReleaseEvent);
Messages.messageReceived.disconnect(handleOverlaySelectionToolUpdates);
Messages.messageReceived.disconnect(handleMessagesReceived);
Messages.unsubscribe("entityToolUpdates");
Messages.unsubscribe("Toolbar-DomainChanged");
createButton = null;

View file

@ -61,6 +61,7 @@
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged);
Script.clearInterval(interval);
if (tablet) {
tablet.removeButton(button);

View file

@ -764,8 +764,8 @@ Script.scriptEnding.connect(function () {
}
Window.snapshotShared.disconnect(snapshotUploaded);
Snapshot.snapshotLocationSet.disconnect(snapshotLocationSet);
Entities.canRezChanged.disconnect(processRezPermissionChange);
Entities.canRezTmpChanged.disconnect(processRezPermissionChange);
Entities.canRezChanged.disconnect(updatePrintPermissions);
Entities.canRezTmpChanged.disconnect(updatePrintPermissions);
});
}()); // END LOCAL_SCOPE