mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-19 00:48:46 +02:00
Merge pull request #13288 from zfox23/MS15529_secondaryCamNotifications
MS15529: Add secondary camera snapshot notification flag
This commit is contained in:
commit
64cccc55d4
6 changed files with 33 additions and 19 deletions
|
@ -7652,18 +7652,18 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::takeSecondaryCameraSnapshot(const QString& filename) {
|
void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
|
||||||
postLambdaEvent([filename, this] {
|
postLambdaEvent([notify, filename, this] {
|
||||||
QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename,
|
QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename,
|
||||||
TestScriptingInterface::getInstance()->getTestResultsLocation());
|
TestScriptingInterface::getInstance()->getTestResultsLocation());
|
||||||
|
|
||||||
emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, true);
|
emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) {
|
void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {
|
||||||
postLambdaEvent([filename, cubemapOutputFormat, cameraPosition] {
|
postLambdaEvent([notify, filename, cubemapOutputFormat, cameraPosition] {
|
||||||
DependencyManager::get<Snapshot>()->save360Snapshot(cameraPosition, cubemapOutputFormat, filename);
|
DependencyManager::get<Snapshot>()->save360Snapshot(cameraPosition, cubemapOutputFormat, notify, filename);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,8 +281,11 @@ public:
|
||||||
float getGameLoopRate() const { return _gameLoopCounter.rate(); }
|
float getGameLoopRate() const { return _gameLoopCounter.rate(); }
|
||||||
|
|
||||||
void takeSnapshot(bool notify, bool includeAnimated = false, float aspectRatio = 0.0f, const QString& filename = QString());
|
void takeSnapshot(bool notify, bool includeAnimated = false, float aspectRatio = 0.0f, const QString& filename = QString());
|
||||||
void takeSecondaryCameraSnapshot(const QString& filename = QString());
|
void takeSecondaryCameraSnapshot(const bool& notify, const QString& filename = QString());
|
||||||
void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename = QString());
|
void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition,
|
||||||
|
const bool& cubemapOutputFormat,
|
||||||
|
const bool& notify,
|
||||||
|
const QString& filename = QString());
|
||||||
|
|
||||||
void shareSnapshot(const QString& filename, const QUrl& href = QUrl(""));
|
void shareSnapshot(const QString& filename, const QUrl& href = QUrl(""));
|
||||||
|
|
||||||
|
|
|
@ -446,12 +446,12 @@ void WindowScriptingInterface::takeSnapshot(bool notify, bool includeAnimated, f
|
||||||
qApp->takeSnapshot(notify, includeAnimated, aspectRatio, filename);
|
qApp->takeSnapshot(notify, includeAnimated, aspectRatio, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::takeSecondaryCameraSnapshot(const QString& filename) {
|
void WindowScriptingInterface::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
|
||||||
qApp->takeSecondaryCameraSnapshot(filename);
|
qApp->takeSecondaryCameraSnapshot(notify, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) {
|
void WindowScriptingInterface::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {
|
||||||
qApp->takeSecondaryCamera360Snapshot(cameraPosition, cubemapOutputFormat, filename);
|
qApp->takeSecondaryCamera360Snapshot(cameraPosition, cubemapOutputFormat, notify, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::shareSnapshot(const QString& path, const QUrl& href) {
|
void WindowScriptingInterface::shareSnapshot(const QString& path, const QUrl& href) {
|
||||||
|
|
|
@ -362,27 +362,31 @@ public slots:
|
||||||
* Takes a still snapshot of the current view from the secondary camera that can be set up through the {@link Render} API.
|
* Takes a still snapshot of the current view from the secondary camera that can be set up through the {@link Render} API.
|
||||||
* NOTE: to provide a non-default value - all previous parameters must be provided.
|
* NOTE: to provide a non-default value - all previous parameters must be provided.
|
||||||
* @function Window.takeSecondaryCameraSnapshot
|
* @function Window.takeSecondaryCameraSnapshot
|
||||||
|
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
||||||
|
* signal.
|
||||||
* @param {string} [filename=""] - If this parameter is not given, the image will be saved as 'hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS'.
|
* @param {string} [filename=""] - If this parameter is not given, the image will be saved as 'hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS'.
|
||||||
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
||||||
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
||||||
*
|
*
|
||||||
* var filename = QString();
|
* var filename = QString();
|
||||||
*/
|
*/
|
||||||
void takeSecondaryCameraSnapshot(const QString& filename = QString());
|
void takeSecondaryCameraSnapshot(const bool& notify = true, const QString& filename = QString());
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Takes a 360 snapshot given a position of the secondary camera (which does not need to have been previously set up).
|
* Takes a 360 snapshot given a position of the secondary camera (which does not need to have been previously set up).
|
||||||
* @function Window.takeSecondaryCameraSnapshot
|
* @function Window.takeSecondaryCamera360Snapshot
|
||||||
* @param {vec3} [cameraPosition] - The (x, y, z) position of the camera for the 360 snapshot
|
* @param {vec3} [cameraPosition] - The (x, y, z) position of the camera for the 360 snapshot
|
||||||
* @param {boolean} [cubemapOutputFormat=false] - If <code>true</code> then the snapshot is saved as a cube map image,
|
* @param {boolean} [cubemapOutputFormat=false] - If <code>true</code> then the snapshot is saved as a cube map image,
|
||||||
* otherwise is saved as an equirectangular image.
|
* otherwise is saved as an equirectangular image.
|
||||||
|
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
||||||
|
* signal.
|
||||||
* @param {string} [filename=""] - If this parameter is not given, the image will be saved as 'hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS'.
|
* @param {string} [filename=""] - If this parameter is not given, the image will be saved as 'hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS'.
|
||||||
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
||||||
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
||||||
*
|
*
|
||||||
* var filename = QString();
|
* var filename = QString();
|
||||||
*/
|
*/
|
||||||
void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const QString& filename = QString());
|
void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const bool& notify = true, const QString& filename = QString());
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that
|
* Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that
|
||||||
|
|
|
@ -122,8 +122,9 @@ static const glm::quat CAMERA_ORIENTATION_LEFT(glm::quat(glm::radians(glm::vec3(
|
||||||
static const glm::quat CAMERA_ORIENTATION_BACK(glm::quat(glm::radians(glm::vec3(0.0f, 180.0f, 0.0f))));
|
static const glm::quat CAMERA_ORIENTATION_BACK(glm::quat(glm::radians(glm::vec3(0.0f, 180.0f, 0.0f))));
|
||||||
static const glm::quat CAMERA_ORIENTATION_RIGHT(glm::quat(glm::radians(glm::vec3(0.0f, 270.0f, 0.0f))));
|
static const glm::quat CAMERA_ORIENTATION_RIGHT(glm::quat(glm::radians(glm::vec3(0.0f, 270.0f, 0.0f))));
|
||||||
static const glm::quat CAMERA_ORIENTATION_UP(glm::quat(glm::radians(glm::vec3(90.0f, 0.0f, 0.0f))));
|
static const glm::quat CAMERA_ORIENTATION_UP(glm::quat(glm::radians(glm::vec3(90.0f, 0.0f, 0.0f))));
|
||||||
void Snapshot::save360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) {
|
void Snapshot::save360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {
|
||||||
_snapshotFilename = filename;
|
_snapshotFilename = filename;
|
||||||
|
_notify360 = notify;
|
||||||
_cubemapOutputFormat = cubemapOutputFormat;
|
_cubemapOutputFormat = cubemapOutputFormat;
|
||||||
SecondaryCameraJobConfig* secondaryCameraRenderConfig = static_cast<SecondaryCameraJobConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("SecondaryCamera"));
|
SecondaryCameraJobConfig* secondaryCameraRenderConfig = static_cast<SecondaryCameraJobConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("SecondaryCamera"));
|
||||||
|
|
||||||
|
@ -247,7 +248,8 @@ void Snapshot::convertToCubemap() {
|
||||||
|
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), true);
|
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename),
|
||||||
|
_notify360);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Snapshot::convertToEquirectangular() {
|
void Snapshot::convertToEquirectangular() {
|
||||||
|
@ -327,7 +329,8 @@ void Snapshot::convertToEquirectangular() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), true);
|
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename),
|
||||||
|
_notify360);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTemporaryFile* Snapshot::saveTempSnapshot(QImage image) {
|
QTemporaryFile* Snapshot::saveTempSnapshot(QImage image) {
|
||||||
|
|
|
@ -50,7 +50,10 @@ class Snapshot : public QObject, public Dependency {
|
||||||
public:
|
public:
|
||||||
Snapshot();
|
Snapshot();
|
||||||
QString saveSnapshot(QImage image, const QString& filename, const QString& pathname = QString());
|
QString saveSnapshot(QImage image, const QString& filename, const QString& pathname = QString());
|
||||||
void save360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename);
|
void save360Snapshot(const glm::vec3& cameraPosition,
|
||||||
|
const bool& cubemapOutputFormat,
|
||||||
|
const bool& notify,
|
||||||
|
const QString& filename);
|
||||||
QTemporaryFile* saveTempSnapshot(QImage image);
|
QTemporaryFile* saveTempSnapshot(QImage image);
|
||||||
SnapshotMetaData* parseSnapshotData(QString snapshotPath);
|
SnapshotMetaData* parseSnapshotData(QString snapshotPath);
|
||||||
|
|
||||||
|
@ -89,6 +92,7 @@ private:
|
||||||
const QString& userSelectedFilename = QString(),
|
const QString& userSelectedFilename = QString(),
|
||||||
const QString& userSelectedPathname = QString());
|
const QString& userSelectedPathname = QString());
|
||||||
QString _snapshotFilename;
|
QString _snapshotFilename;
|
||||||
|
bool _notify360;
|
||||||
bool _cubemapOutputFormat;
|
bool _cubemapOutputFormat;
|
||||||
QTimer _snapshotTimer;
|
QTimer _snapshotTimer;
|
||||||
qint16 _snapshotIndex;
|
qint16 _snapshotIndex;
|
||||||
|
|
Loading…
Reference in a new issue