From b7cdca75b7ed403c212b2f05b3b937718c2738f9 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Tue, 24 Nov 2015 16:12:04 -0600 Subject: [PATCH 01/34] Checkpoint towards integrated delivery --- assignment-client/CMakeLists.txt | 1 + cmake/macros/ConsolidateStackComponents.cmake | 9 +++++++++ ...e.cmake => PackageLibrariesForDeployment.cmake} | 2 +- domain-server/CMakeLists.txt | 1 + stack-manager/CMakeLists.txt | 14 +++++++++----- 5 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 cmake/macros/ConsolidateStackComponents.cmake rename cmake/macros/{CopyDllsBesideWindowsExecutable.cmake => PackageLibrariesForDeployment.cmake} (98%) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 58f200b0fe..3064e97d70 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -11,3 +11,4 @@ link_hifi_libraries( include_application_version() package_libraries_for_deployment() +consolidate_stack_components() \ No newline at end of file diff --git a/cmake/macros/ConsolidateStackComponents.cmake b/cmake/macros/ConsolidateStackComponents.cmake new file mode 100644 index 0000000000..2b2fe9a691 --- /dev/null +++ b/cmake/macros/ConsolidateStackComponents.cmake @@ -0,0 +1,9 @@ +macro(CONSOLIDATE_STACK_COMPONENTS) + + # Copy all the output for this target into the common deployment location + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/full-stack-deployment + ) + +endmacro() \ No newline at end of file diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/PackageLibrariesForDeployment.cmake similarity index 98% rename from cmake/macros/CopyDllsBesideWindowsExecutable.cmake rename to cmake/macros/PackageLibrariesForDeployment.cmake index 9330515a62..bb0b268dd4 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/PackageLibrariesForDeployment.cmake @@ -1,5 +1,5 @@ # -# CopyDllsBesideWindowsExecutable.cmake +# PackageLibrariesForDeployment.cmake # cmake/macros # # Copyright 2015 High Fidelity, Inc. diff --git a/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt index 1f9280a899..2200916765 100644 --- a/domain-server/CMakeLists.txt +++ b/domain-server/CMakeLists.txt @@ -38,3 +38,4 @@ endif (UNIX) include_application_version() package_libraries_for_deployment() +consolidate_stack_components() \ No newline at end of file diff --git a/stack-manager/CMakeLists.txt b/stack-manager/CMakeLists.txt index e70fefc6e0..35b4f091a7 100644 --- a/stack-manager/CMakeLists.txt +++ b/stack-manager/CMakeLists.txt @@ -1,16 +1,19 @@ set(TARGET_NAME "stack-manager") set(BUILD_BUNDLE YES) setup_hifi_project(Widgets Gui Svg Core Network WebKitWidgets) +add_dependencies(${TARGET_NAME} assignment-client domain-server) if (WIN32) target_zlib() endif () target_quazip() -set_target_properties( - ${TARGET_NAME} PROPERTIES - EXCLUDE_FROM_ALL TRUE -) +if (UNIX) + set_target_properties( + ${TARGET_NAME} PROPERTIES + EXCLUDE_FROM_ALL TRUE + ) +endif (UNIX) if (DEFINED ENV{JOB_ID}) set(PR_BUILD "false") @@ -45,4 +48,5 @@ if (APPLE) set(SM_SRCS ${SM_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/assets/icon.icns") endif () -package_libraries_for_deployment() \ No newline at end of file +package_libraries_for_deployment() +consolidate_stack_components() \ No newline at end of file From 766f0dbd32561a791a2d7a43365d2364e1f8af30 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Fri, 27 Nov 2015 14:04:33 -0600 Subject: [PATCH 02/34] Have stack manager use bundled stack --- CMakeLists.txt | 15 ++ cmake/templates/FixupBundlePostBuild.cmake.in | 2 +- interface/CMakeLists.txt | 2 +- stack-manager/CMakeLists.txt | 1 + stack-manager/src/AppDelegate.cpp | 232 +----------------- stack-manager/src/AppDelegate.h | 7 - stack-manager/src/GlobalData.cpp | 19 +- stack-manager/src/GlobalData.h | 1 + 8 files changed, 25 insertions(+), 254 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e95974383..d5f615949c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,3 +221,18 @@ if (HIFI_MEMORY_DEBUGGING) MESSAGE("-- Memory debugging is enabled") endif (UNIX) endif () + +set(CPACK_PACKAGE_NAME "High Fidelity") +set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High Fidelity Interface and Stack") +set(CPACK_PACKAGE_VERSION "${BUILD_SEQ}") +set(CPACK_PACKAGE_VERSION_MAJOR "${BUILD_SEQ}") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity") + +if (WIN32) + install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") +endif (WIN32) + +include(CPack) \ No newline at end of file diff --git a/cmake/templates/FixupBundlePostBuild.cmake.in b/cmake/templates/FixupBundlePostBuild.cmake.in index ee686a6967..6e3ad9723b 100644 --- a/cmake/templates/FixupBundlePostBuild.cmake.in +++ b/cmake/templates/FixupBundlePostBuild.cmake.in @@ -53,4 +53,4 @@ else() endif() file(GLOB RUNTIME_PLUGINS "${BUNDLE_PLUGIN_DIR}/*.${PLUGIN_EXTENSION}") -fixup_bundle("${BUNDLE_EXECUTABLE}" "${RUNTIME_PLUGINS}" "@FIXUP_LIBS@") \ No newline at end of file +fixup_bundle("${BUNDLE_EXECUTABLE}" "${RUNTIME_PLUGINS}" "@FIXUP_LIBS@") diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 3357b57858..091cad56ab 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -194,7 +194,6 @@ else (APPLE) # link target to external libraries if (WIN32) - # target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib) target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib) else (WIN32) # Nothing else required on linux apparently @@ -202,3 +201,4 @@ else (APPLE) endif (APPLE) package_libraries_for_deployment() +consolidate_stack_components() diff --git a/stack-manager/CMakeLists.txt b/stack-manager/CMakeLists.txt index 35b4f091a7..520beb6893 100644 --- a/stack-manager/CMakeLists.txt +++ b/stack-manager/CMakeLists.txt @@ -2,6 +2,7 @@ set(TARGET_NAME "stack-manager") set(BUILD_BUNDLE YES) setup_hifi_project(Widgets Gui Svg Core Network WebKitWidgets) add_dependencies(${TARGET_NAME} assignment-client domain-server) +include_application_version() if (WIN32) target_zlib() diff --git a/stack-manager/src/AppDelegate.cpp b/stack-manager/src/AppDelegate.cpp index ea9310a2d8..6b350af117 100644 --- a/stack-manager/src/AppDelegate.cpp +++ b/stack-manager/src/AppDelegate.cpp @@ -81,10 +81,6 @@ void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const Q AppDelegate::AppDelegate(int argc, char* argv[]) : QApplication(argc, argv), - _qtReady(false), - _dsReady(false), - _dsResourcesReady(false), - _acReady(false), _domainServerProcess(NULL), _acMonitorProcess(NULL), _domainServerName("localhost") @@ -115,14 +111,15 @@ AppDelegate::AppDelegate(int argc, char* argv[]) : _window = new MainWindow(); - createExecutablePath(); - downloadLatestExecutablesAndRequirements(); - _checkVersionTimer.setInterval(0); connect(&_checkVersionTimer, SIGNAL(timeout()), this, SLOT(checkVersion())); _checkVersionTimer.start(); connect(this, &QApplication::aboutToQuit, this, &AppDelegate::stopStack); + + _window->setRequirementsLastChecked(QDateTime::currentDateTime().toString()); + _window->show(); + toggleStack(true); } AppDelegate::~AppDelegate() { @@ -427,227 +424,6 @@ void AppDelegate::handleContentSetDownloadFinished() { emit domainAddressChanged(); } -void AppDelegate::onFileSuccessfullyInstalled(const QUrl& url) { - if (url == GlobalData::getInstance().getRequirementsURL()) { - _qtReady = true; - } else if (url == GlobalData::getInstance().getAssignmentClientURL()) { - _acReady = true; - } else if (url == GlobalData::getInstance().getDomainServerURL()) { - _dsReady = true; - } else if (url == GlobalData::getInstance().getDomainServerResourcesURL()) { - _dsResourcesReady = true; - } - - if (_qtReady && _acReady && _dsReady && _dsResourcesReady) { - _window->setRequirementsLastChecked(QDateTime::currentDateTime().toString()); - _window->show(); - toggleStack(true); - } -} - -void AppDelegate::createExecutablePath() { - QDir launchDir(GlobalData::getInstance().getClientsLaunchPath()); - QDir resourcesDir(GlobalData::getInstance().getClientsResourcesPath()); - QDir logsDir(GlobalData::getInstance().getLogsPath()); - if (!launchDir.exists()) { - if (QDir().mkpath(launchDir.absolutePath())) { - qDebug() << "Successfully created directory: " - << launchDir.absolutePath(); - } else { - qCritical() << "Failed to create directory: " - << launchDir.absolutePath(); - } - } - if (!resourcesDir.exists()) { - if (QDir().mkpath(resourcesDir.absolutePath())) { - qDebug() << "Successfully created directory: " - << resourcesDir.absolutePath(); - } else { - qCritical() << "Failed to create directory: " - << resourcesDir.absolutePath(); - } - } - if (!logsDir.exists()) { - if (QDir().mkpath(logsDir.absolutePath())) { - qDebug() << "Successfully created directory: " - << logsDir.absolutePath(); - } else { - qCritical() << "Failed to create directory: " - << logsDir.absolutePath(); - } - } -} - -void AppDelegate::downloadLatestExecutablesAndRequirements() { - // Check if Qt is already installed - if (GlobalData::getInstance().getPlatform() == "mac") { - if (QDir(GlobalData::getInstance().getClientsLaunchPath() + "QtCore.framework").exists()) { - _qtReady = true; - } - } else if (GlobalData::getInstance().getPlatform() == "win") { - if (QFileInfo(GlobalData::getInstance().getClientsLaunchPath() + "Qt5Core.dll").exists()) { - _qtReady = true; - } - } else { // linux - if (QFileInfo(GlobalData::getInstance().getClientsLaunchPath() + "libQt5Core.so.5").exists()) { - _qtReady = true; - } - } - - - QFile reqZipFile(GlobalData::getInstance().getRequirementsZipPath()); - QByteArray reqZipData; - if (reqZipFile.open(QIODevice::ReadOnly)) { - reqZipData = reqZipFile.readAll(); - reqZipFile.close(); - } - QFile resZipFile(GlobalData::getInstance().getDomainServerResourcesZipPath()); - QByteArray resZipData; - if (resZipFile.open(QIODevice::ReadOnly)) { - resZipData = resZipFile.readAll(); - resZipFile.close(); - } - - QDir resourcesDir(GlobalData::getInstance().getClientsResourcesPath()); - if (!(resourcesDir.entryInfoList(QDir::AllEntries).size() < 3)) { - _dsResourcesReady = true; - } - - // if the user has set hifiBuildDirectory, don't attempt to download the domain-server or assignement-client - if (GlobalData::getInstance().isGetHifiBuildDirectorySet()) { - _dsReady = true; - _acReady = true; - } else { - QByteArray dsData; - QFile dsFile(GlobalData::getInstance().getDomainServerExecutablePath()); - if (dsFile.open(QIODevice::ReadOnly)) { - dsData = dsFile.readAll(); - dsFile.close(); - } - QByteArray acData; - QFile acFile(GlobalData::getInstance().getAssignmentClientExecutablePath()); - if (acFile.open(QIODevice::ReadOnly)) { - acData = acFile.readAll(); - acFile.close(); - } - - QNetworkRequest acReq(QUrl(GlobalData::getInstance().getAssignmentClientMD5URL())); - QNetworkReply* acReply = _manager->get(acReq); - QEventLoop acLoop; - connect(acReply, SIGNAL(finished()), &acLoop, SLOT(quit())); - acLoop.exec(); - QByteArray acMd5Data = acReply->readAll().trimmed(); - if (GlobalData::getInstance().getPlatform() == "win") { - // fix for reading the MD5 hash from Windows-generated - // binary data of the MD5 hash - QTextStream stream(acMd5Data); - stream >> acMd5Data; - } - - // fix for Mac and Linux network accessibility - if (acMd5Data.size() == 0) { - // network is not accessible - qDebug() << "Could not connect to the internet."; - _window->show(); - return; - } - - qDebug() << "AC MD5: " << acMd5Data; - if (acMd5Data.toLower() == QCryptographicHash::hash(acData, QCryptographicHash::Md5).toHex()) { - _acReady = true; - } - - - QNetworkRequest dsReq(QUrl(GlobalData::getInstance().getDomainServerMD5URL())); - QNetworkReply* dsReply = _manager->get(dsReq); - QEventLoop dsLoop; - connect(dsReply, SIGNAL(finished()), &dsLoop, SLOT(quit())); - dsLoop.exec(); - QByteArray dsMd5Data = dsReply->readAll().trimmed(); - if (GlobalData::getInstance().getPlatform() == "win") { - // fix for reading the MD5 hash from Windows generated - // binary data of the MD5 hash - QTextStream stream(dsMd5Data); - stream >> dsMd5Data; - } - qDebug() << "DS MD5: " << dsMd5Data; - if (dsMd5Data.toLower() == QCryptographicHash::hash(dsData, QCryptographicHash::Md5).toHex()) { - _dsReady = true; - } - } - - if (_qtReady) { - // check MD5 of requirements.zip only if Qt is found - QNetworkRequest reqZipReq(QUrl(GlobalData::getInstance().getRequirementsMD5URL())); - QNetworkReply* reqZipReply = _manager->get(reqZipReq); - QEventLoop reqZipLoop; - connect(reqZipReply, SIGNAL(finished()), &reqZipLoop, SLOT(quit())); - reqZipLoop.exec(); - QByteArray reqZipMd5Data = reqZipReply->readAll().trimmed(); - if (GlobalData::getInstance().getPlatform() == "win") { - // fix for reading the MD5 hash from Windows generated - // binary data of the MD5 hash - QTextStream stream(reqZipMd5Data); - stream >> reqZipMd5Data; - } - qDebug() << "Requirements ZIP MD5: " << reqZipMd5Data; - if (reqZipMd5Data.toLower() != QCryptographicHash::hash(reqZipData, QCryptographicHash::Md5).toHex()) { - _qtReady = false; - } - } - - if (_dsResourcesReady) { - // check MD5 of resources.zip only if Domain Server - // resources are installed - QNetworkRequest resZipReq(QUrl(GlobalData::getInstance().getDomainServerResourcesMD5URL())); - QNetworkReply* resZipReply = _manager->get(resZipReq); - QEventLoop resZipLoop; - connect(resZipReply, SIGNAL(finished()), &resZipLoop, SLOT(quit())); - resZipLoop.exec(); - QByteArray resZipMd5Data = resZipReply->readAll().trimmed(); - if (GlobalData::getInstance().getPlatform() == "win") { - // fix for reading the MD5 hash from Windows generated - // binary data of the MD5 hash - QTextStream stream(resZipMd5Data); - stream >> resZipMd5Data; - } - qDebug() << "Domain Server Resources ZIP MD5: " << resZipMd5Data; - if (resZipMd5Data.toLower() != QCryptographicHash::hash(resZipData, QCryptographicHash::Md5).toHex()) { - _dsResourcesReady = false; - } - } - - DownloadManager* downloadManager = 0; - if (!_qtReady || !_acReady || !_dsReady || !_dsResourcesReady) { - // initialise DownloadManager - downloadManager = new DownloadManager(_manager); - downloadManager->setWindowModality(Qt::ApplicationModal); - connect(downloadManager, SIGNAL(fileSuccessfullyInstalled(QUrl)), - SLOT(onFileSuccessfullyInstalled(QUrl))); - downloadManager->show(); - } else { - _window->setRequirementsLastChecked(QDateTime::currentDateTime().toString()); - _window->show(); - toggleStack(true); - } - - if (!_qtReady) { - downloadManager->downloadFile(GlobalData::getInstance().getRequirementsURL()); - } - - if (!_acReady) { - downloadManager->downloadFile(GlobalData::getInstance().getAssignmentClientURL()); - } - - if (!_dsReady) { - downloadManager->downloadFile(GlobalData::getInstance().getDomainServerURL()); - } - - if (!_dsResourcesReady) { - downloadManager->downloadFile(GlobalData::getInstance().getDomainServerResourcesURL()); - } -} - void AppDelegate::checkVersion() { QNetworkRequest latestVersionRequest((QUrl(CHECK_BUILDS_URL))); latestVersionRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); diff --git a/stack-manager/src/AppDelegate.h b/stack-manager/src/AppDelegate.h index 1d4728b7ce..ebcb8ce904 100644 --- a/stack-manager/src/AppDelegate.h +++ b/stack-manager/src/AppDelegate.h @@ -53,7 +53,6 @@ signals: void indexPathChangeResponse(bool wasSuccessful); void stackStateChanged(bool isOn); private slots: - void onFileSuccessfullyInstalled(const QUrl& url); void requestDomainServerID(); void handleDomainIDReply(); void handleDomainGetReply(); @@ -64,16 +63,10 @@ private slots: private: void parseCommandLine(); - void createExecutablePath(); - void downloadLatestExecutablesAndRequirements(); void changeDomainServerIndexPath(const QString& newPath); QNetworkAccessManager* _manager; - bool _qtReady; - bool _dsReady; - bool _dsResourcesReady; - bool _acReady; BackgroundProcess* _domainServerProcess; BackgroundProcess* _acMonitorProcess; QHash _scriptProcesses; diff --git a/stack-manager/src/GlobalData.cpp b/stack-manager/src/GlobalData.cpp index ecc5ed520d..3078b3b24a 100644 --- a/stack-manager/src/GlobalData.cpp +++ b/stack-manager/src/GlobalData.cpp @@ -32,11 +32,8 @@ GlobalData::GlobalData() { _resourcePath = "resources/"; _assignmentClientExecutable = "assignment-client"; _domainServerExecutable = "domain-server"; - QString applicationSupportDirectory = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - if (PR_BUILD) { - applicationSupportDirectory += "/pr-binaries"; - } - + QString applicationSupportDirectory = QCoreApplication::applicationDirPath(); + _clientsLaunchPath = QDir::toNativeSeparators(applicationSupportDirectory + "/"); _clientsResourcePath = QDir::toNativeSeparators(applicationSupportDirectory + "/" + _resourcePath); @@ -49,18 +46,6 @@ GlobalData::GlobalData() { _domainServerExecutablePath.append(".exe"); } - _requirementsURL = urlBase + "/binaries/" + _platform + "/requirements/requirements.zip"; - _requirementsZipPath = _clientsLaunchPath + "requirements.zip"; - _requirementsMD5URL = urlBase + "/binaries/" + _platform + "/requirements/requirements.md5"; - _assignmentClientURL = urlBase + "/binaries/" + _platform + "/assignment-client" + (_platform == "win" ? "/assignment-client.exe" : "/assignment-client"); - _domainServerResourcesURL = urlBase + "/binaries/" + _platform + "/domain-server/resources.zip"; - _domainServerResourcesZipPath = _clientsLaunchPath + "resources.zip"; - _domainServerResourcesMD5URL = urlBase + "/binaries/" + _platform + "/domain-server/resources.md5"; - _domainServerURL = urlBase + "/binaries/" + _platform + "/domain-server" + (_platform == "win" ? "/domain-server.exe" : "/domain-server"); - - _assignmentClientMD5URL = urlBase + "/binaries/" + _platform + "/assignment-client/assignment-client.md5"; - _domainServerMD5URL = urlBase + "/binaries/" + _platform + "/domain-server/domain-server.md5"; - _defaultDomain = "localhost"; _logsPath = QDir::toNativeSeparators(_clientsLaunchPath + "logs/"); _availableAssignmentTypes.insert("audio-mixer", 0); diff --git a/stack-manager/src/GlobalData.h b/stack-manager/src/GlobalData.h index 58c9a93526..a8687f31d2 100644 --- a/stack-manager/src/GlobalData.h +++ b/stack-manager/src/GlobalData.h @@ -9,6 +9,7 @@ #ifndef hifi_GlobalData_h #define hifi_GlobalData_h +#include #include #include From a37262465f60bc932bb63311ff9d26b17db1c157 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Fri, 27 Nov 2015 14:23:38 -0600 Subject: [PATCH 03/34] Creating icons --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5f615949c..dc11d28a2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,6 +230,8 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${BUILD_SEQ}") set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity") +set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe'") +set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\StacK Manager.lnk' '$INSTDIR\\\\stack-manager.exe'") if (WIN32) install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") From 5822386702d04ee5e048417c91c3e6d95d22af11 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Mon, 30 Nov 2015 08:56:30 -0600 Subject: [PATCH 04/34] Checkpoint --- CMakeLists.txt | 32 +++++++++++-------- cmake/macros/ConsolidateStackComponents.cmake | 2 ++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc11d28a2e..500c27791b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,19 +222,23 @@ if (HIFI_MEMORY_DEBUGGING) endif (UNIX) endif () -set(CPACK_PACKAGE_NAME "High Fidelity") -set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High Fidelity Interface and Stack") -set(CPACK_PACKAGE_VERSION "${BUILD_SEQ}") -set(CPACK_PACKAGE_VERSION_MAJOR "${BUILD_SEQ}") -set(CPACK_PACKAGE_VERSION_MINOR "0") -set(CPACK_PACKAGE_VERSION_PATCH "0") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity") -set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe'") -set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\StacK Manager.lnk' '$INSTDIR\\\\stack-manager.exe'") +include_application_version() -if (WIN32) - install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") -endif (WIN32) +if (DEFINED ENV{ghprbPullId}) + set(CPACK_PACKAGE_NAME "High Fidelity - Test Build") + set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High Fidelity Interface and Stack") + set(CPACK_PACKAGE_VERSION "${BUILD_SEQ}") + set(CPACK_PACKAGE_VERSION_MAJOR "${BUILD_SEQ}") + set(CPACK_PACKAGE_VERSION_MINOR "0") + set(CPACK_PACKAGE_VERSION_PATCH "0") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity - Test Build") + set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe'") + set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\StacK Manager.lnk' '$INSTDIR\\\\stack-manager.exe'") -include(CPack) \ No newline at end of file + if (WIN32) + install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") + endif (WIN32) + + include(CPack) +endif () \ No newline at end of file diff --git a/cmake/macros/ConsolidateStackComponents.cmake b/cmake/macros/ConsolidateStackComponents.cmake index 2b2fe9a691..50a1f5e48a 100644 --- a/cmake/macros/ConsolidateStackComponents.cmake +++ b/cmake/macros/ConsolidateStackComponents.cmake @@ -1,9 +1,11 @@ macro(CONSOLIDATE_STACK_COMPONENTS) + if (DEFINED ENV{ghprbPullId}) # Copy all the output for this target into the common deployment location add_custom_command( TARGET ${TARGET_NAME} POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/full-stack-deployment ) + endif () endmacro() \ No newline at end of file From 4e186409221b2adbc9ace33c1b7101796ca63a71 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Mon, 30 Nov 2015 10:07:11 -0600 Subject: [PATCH 05/34] Some fixes --- CMakeLists.txt | 6 +++--- cmake/macros/IncludeApplicationVersion.cmake | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 500c27791b..47368a0f4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,16 +225,16 @@ endif () include_application_version() if (DEFINED ENV{ghprbPullId}) - set(CPACK_PACKAGE_NAME "High Fidelity - Test Build") + set(CPACK_PACKAGE_NAME "High Fidelity") set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High Fidelity Interface and Stack") set(CPACK_PACKAGE_VERSION "${BUILD_SEQ}") set(CPACK_PACKAGE_VERSION_MAJOR "${BUILD_SEQ}") set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity - Test Build") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity-${BUILD_SEQ}") set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe'") - set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\StacK Manager.lnk' '$INSTDIR\\\\stack-manager.exe'") + set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Stack Manager.lnk' '$INSTDIR\\\\stack-manager.exe'") if (WIN32) install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") diff --git a/cmake/macros/IncludeApplicationVersion.cmake b/cmake/macros/IncludeApplicationVersion.cmake index 96137294a7..a2993efbd2 100644 --- a/cmake/macros/IncludeApplicationVersion.cmake +++ b/cmake/macros/IncludeApplicationVersion.cmake @@ -13,7 +13,7 @@ macro(INCLUDE_APPLICATION_VERSION) if (DEFINED ENV{JOB_ID}) set (BUILD_SEQ $ENV{JOB_ID}) elseif (DEFINED ENV{ghprbPullId}) - set (BUILD_SEQ "PR: $ENV{ghprbPullId} - Commit: $ENV{ghprbActualCommit}") + set (BUILD_SEQ "PR.$ENV{ghprbPullId}") else () set(BUILD_SEQ "dev") endif () From ca8cd13c4876775843ee941d2b057e5f4fd9c084 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Tue, 1 Dec 2015 12:32:31 -0600 Subject: [PATCH 06/34] Checkpoint --- cmake/macros/ConsolidateStackComponents.cmake | 2 +- cmake/modules/FindOpenSSL.cmake | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/macros/ConsolidateStackComponents.cmake b/cmake/macros/ConsolidateStackComponents.cmake index 50a1f5e48a..2a991e5d03 100644 --- a/cmake/macros/ConsolidateStackComponents.cmake +++ b/cmake/macros/ConsolidateStackComponents.cmake @@ -1,6 +1,6 @@ macro(CONSOLIDATE_STACK_COMPONENTS) - if (DEFINED ENV{ghprbPullId}) + if (DEFINED ENV{ghprbPullId} AND WIN32) # Copy all the output for this target into the common deployment location add_custom_command( TARGET ${TARGET_NAME} POST_BUILD diff --git a/cmake/modules/FindOpenSSL.cmake b/cmake/modules/FindOpenSSL.cmake index 2142322687..2a15cf7929 100644 --- a/cmake/modules/FindOpenSSL.cmake +++ b/cmake/modules/FindOpenSSL.cmake @@ -107,7 +107,7 @@ if (WIN32 AND NOT CYGWIN) select_library_configurations(SSL_EAY) set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY}) - + find_path(OPENSSL_DLL_PATH NAMES ssleay32.dll PATH_SUFFIXES "bin" ${_OPENSSL_ROOT_HINTS_AND_PATHS}) elseif (MINGW) @@ -250,8 +250,18 @@ else () ) endif () + + message(STATUS "++++++++++++++++++++++++++++") + message(STATUS "${OPENSSL_LIBRARIES}") + message(STATUS "${OPENSSL_DLL_PATH}") if (WIN32) add_paths_to_fixup_libs(${OPENSSL_DLL_PATH}) + if (DEFINED ENV{ghprbPullId}) + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy ${OPENSSL_DLL_PATH}/ssleay32.dll ${CMAKE_BINARY_DIR}/full-stack-deployment + ) + endif () endif () mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES OPENSSL_SEARCH_DIRS) From c786789c4cd11996b63bd4cea2ead9eabaf05597 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Wed, 2 Dec 2015 12:43:25 -0600 Subject: [PATCH 07/34] Changes for SSL and icons --- CMakeLists.txt | 15 ++++++++-- cmake/macros/ConsolidateStackComponents.cmake | 28 +++++++++++++++---- cmake/macros/IncludeApplicationVersion.cmake | 7 ++++- cmake/modules/FindOpenSSL.cmake | 11 ++++---- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47368a0f4e..4b44f81d2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,7 +224,16 @@ endif () include_application_version() -if (DEFINED ENV{ghprbPullId}) +if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) + message(STATUS "+++++ Package for deployment will be generated on this build +++++") + + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment) + + set (ICONPATH_INTERFACE "$INSTDIR/${PATH_INSTALL_DATA}/interface.ico") + set (ICONPATH_STACK_MANAGER "$INSTDIR/${PATH_INSTALL_DATA}/stack-manager.ico") + string (REPLACE "/" "\\\\" ICONPATH_INTERFACE ${ICONPATH_INTERFACE}) + string (REPLACE "/" "\\\\" ICONPATH_STACK_MANAGER ${ICONPATH_STACK_MANAGER}) + set(CPACK_PACKAGE_NAME "High Fidelity") set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High Fidelity Interface and Stack") @@ -233,8 +242,8 @@ if (DEFINED ENV{ghprbPullId}) set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity-${BUILD_SEQ}") - set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe'") - set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Stack Manager.lnk' '$INSTDIR\\\\stack-manager.exe'") + set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe' '${ICONPATH_INTERFACE}'") + set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Stack Manager.lnk' '$INSTDIR\\\\stack-manager.exe' '${ICONPATH_STACK_MANAGER}'") if (WIN32) install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") diff --git a/cmake/macros/ConsolidateStackComponents.cmake b/cmake/macros/ConsolidateStackComponents.cmake index 2a991e5d03..4bcc777751 100644 --- a/cmake/macros/ConsolidateStackComponents.cmake +++ b/cmake/macros/ConsolidateStackComponents.cmake @@ -1,11 +1,27 @@ macro(CONSOLIDATE_STACK_COMPONENTS) - if (DEFINED ENV{ghprbPullId} AND WIN32) - # Copy all the output for this target into the common deployment location - add_custom_command( - TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/full-stack-deployment - ) + if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE AND WIN32) + + # Copy all the output for this target into the common deployment location + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory $ ${CMAKE_BINARY_DIR}/full-stack-deployment + ) + + # Copy icon files for interface and stack manager + if (TARGET_NAME STREQUAL "interface" OR TARGET_NAME STREQUAL "stack-manager") + if (TARGET_NAME STREQUAL "interface") + set (ICON_FILE_PATH "${PROJECT_SOURCE_DIR}/icon/interface.ico") + set (ICON_DESTINATION_NAME "interface.ico") + elseif (TARGET_NAME STREQUAL "stack-manager") + set (ICON_FILE_PATH "${PROJECT_SOURCE_DIR}/assets/icon.ico") + set (ICON_DESTINATION_NAME "stack-manager.ico") + endif () + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy ${ICON_FILE_PATH} ${CMAKE_BINARY_DIR}/full-stack-deployment/${ICON_DESTINATION_NAME} + ) + endif () endif () endmacro() \ No newline at end of file diff --git a/cmake/macros/IncludeApplicationVersion.cmake b/cmake/macros/IncludeApplicationVersion.cmake index a2993efbd2..a91aad6acc 100644 --- a/cmake/macros/IncludeApplicationVersion.cmake +++ b/cmake/macros/IncludeApplicationVersion.cmake @@ -10,10 +10,15 @@ # macro(INCLUDE_APPLICATION_VERSION) + # + # We are relying on Jenkins defined environment variables to determine the origin of this build + # and will only package if this is a PR or Release build if (DEFINED ENV{JOB_ID}) + set (DEPLOY_PACKAGE 1) set (BUILD_SEQ $ENV{JOB_ID}) elseif (DEFINED ENV{ghprbPullId}) - set (BUILD_SEQ "PR.$ENV{ghprbPullId}") + set (DEPLOY_PACKAGE 1) + set (BUILD_SEQ "PR-$ENV{ghprbPullId}") else () set(BUILD_SEQ "dev") endif () diff --git a/cmake/modules/FindOpenSSL.cmake b/cmake/modules/FindOpenSSL.cmake index 2a15cf7929..9d9557ad9e 100644 --- a/cmake/modules/FindOpenSSL.cmake +++ b/cmake/modules/FindOpenSSL.cmake @@ -250,16 +250,15 @@ else () ) endif () - - message(STATUS "++++++++++++++++++++++++++++") - message(STATUS "${OPENSSL_LIBRARIES}") - message(STATUS "${OPENSSL_DLL_PATH}") if (WIN32) add_paths_to_fixup_libs(${OPENSSL_DLL_PATH}) - if (DEFINED ENV{ghprbPullId}) + # + # For some reason fixup misses the following DLL and only copies libeay32. There's gotta be a better way to handle this + # but for now resorting to the following interm solution + if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) add_custom_command( TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy ${OPENSSL_DLL_PATH}/ssleay32.dll ${CMAKE_BINARY_DIR}/full-stack-deployment + COMMAND "${CMAKE_COMMAND}" -E copy ${OPENSSL_DLL_PATH}/ssleay32.dll ${CMAKE_BINARY_DIR}/full-stack-deployment/ ) endif () endif () From 252086ea483f32f5097170c9fe11ec3abe2e975c Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Wed, 2 Dec 2015 12:48:58 -0600 Subject: [PATCH 08/34] indentation fixes --- stack-manager/src/AppDelegate.cpp | 6 +++--- stack-manager/src/GlobalData.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stack-manager/src/AppDelegate.cpp b/stack-manager/src/AppDelegate.cpp index 6b350af117..3e65406bc5 100644 --- a/stack-manager/src/AppDelegate.cpp +++ b/stack-manager/src/AppDelegate.cpp @@ -117,9 +117,9 @@ AppDelegate::AppDelegate(int argc, char* argv[]) : connect(this, &QApplication::aboutToQuit, this, &AppDelegate::stopStack); - _window->setRequirementsLastChecked(QDateTime::currentDateTime().toString()); - _window->show(); - toggleStack(true); + _window->setRequirementsLastChecked(QDateTime::currentDateTime().toString()); + _window->show(); + toggleStack(true); } AppDelegate::~AppDelegate() { diff --git a/stack-manager/src/GlobalData.cpp b/stack-manager/src/GlobalData.cpp index 3078b3b24a..bc2f3e3482 100644 --- a/stack-manager/src/GlobalData.cpp +++ b/stack-manager/src/GlobalData.cpp @@ -32,7 +32,7 @@ GlobalData::GlobalData() { _resourcePath = "resources/"; _assignmentClientExecutable = "assignment-client"; _domainServerExecutable = "domain-server"; - QString applicationSupportDirectory = QCoreApplication::applicationDirPath(); + QString applicationSupportDirectory = QCoreApplication::applicationDirPath(); _clientsLaunchPath = QDir::toNativeSeparators(applicationSupportDirectory + "/"); _clientsResourcePath = QDir::toNativeSeparators(applicationSupportDirectory + "/" + _resourcePath); From 1f0150f65f4635d00d33d531be46108884ff920f Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 5 Dec 2015 15:12:44 -0800 Subject: [PATCH 09/34] add parentID and parentJointIndex to terse logging --- libraries/entities/src/EntityItemProperties.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 52f98be208..9ff5d73616 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -1780,6 +1780,12 @@ QList EntityItemProperties::listChangedProperties() { if (zPNeighborIDChanged()) { out += "zPNeighborID"; } + if (parentIDChanged()) { + out += "parentID"; + } + if (parentJointIndexChanged()) { + out += "parentJointIndex"; + } getAnimation().listChangedProperties(out); getKeyLight().listChangedProperties(out); From d518a4573e7965e7693fa0abbd683ff92878bca1 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 5 Dec 2015 15:15:33 -0800 Subject: [PATCH 10/34] if script sets parent or jointIndex, don't pop entity off to someplace --- .../entities/src/EntityScriptingInterface.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 2551b2727b..23fbac13cf 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -202,7 +202,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties script bool updatedEntity = false; _entityTree->withWriteLock([&] { if (scriptSideProperties.parentDependentPropertyChanged()) { - // if the script sets a location property but didn't include parent information, grab the needed + // if the script set a location property but didn't include parent information, grab the needed // properties from the entity. if (!scriptSideProperties.parentIDChanged() || !scriptSideProperties.parentJointIndexChanged()) { EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); @@ -214,6 +214,18 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties script } } } + if (scriptSideProperties.parentIDChanged() || scriptSideProperties.parentJointIndexChanged()) { + // if the script set parentID or parentJointIndex but didn't include position and rotation, grab + // the missing properties from the entity + if (!scriptSideProperties.localPositionChanged() && !scriptSideProperties.positionChanged()) { + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); + properties.setPosition(entity->getPosition()); + } + if (!scriptSideProperties.localRotationChanged() && !scriptSideProperties.rotationChanged()) { + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); + properties.setRotation(entity->getOrientation()); + } + } properties = convertLocationFromScriptSemantics(properties); updatedEntity = _entityTree->updateEntity(entityID, properties); }); From 138125faab4ea4a43ad960243702edc12f6ff61a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 05:42:51 -0800 Subject: [PATCH 11/34] fix-up parentJointIndex in terse logging --- libraries/entities/src/EntityTree.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 2752473b07..892b186a25 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -740,6 +740,14 @@ void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList= 0) { + quint16 value = properties.getParentJointIndex(); + changedProperties[index] = QString("parentJointIndex:") + QString::number((int)value); + } + } } int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength, From 9a80c4d681005bfb805410ff0d95de35b67ea196 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 05:43:23 -0800 Subject: [PATCH 12/34] call locationChanged on children of joints when joints change --- interface/src/avatar/Avatar.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 2c8d970336..7d407046d6 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -201,6 +201,7 @@ void Avatar::simulate(float deltaTime) { _skeletonModel.getRig()->copyJointsFromJointData(_jointData); _skeletonModel.simulate(deltaTime, _hasNewJointRotations || _hasNewJointTranslations); simulateAttachments(deltaTime); + locationChanged(); // joints changed, so if there are any children, update them. _hasNewJointRotations = false; _hasNewJointTranslations = false; } From edc312199ddaac0efea77f3912e94d0111b7bffc Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 06:16:47 -0800 Subject: [PATCH 13/34] rename a method to match convention in https://docs.google.com/document/d/1LFCmkK26JMVs8Ci33L4Yrle6lL7UU7oxthsWfddzZXQ/edit# --- libraries/shared/src/SpatiallyNestable.cpp | 4 ++-- libraries/shared/src/SpatiallyNestable.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 0d7d2a7652..0a2310e43e 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -232,7 +232,7 @@ const Transform SpatiallyNestable::getTransform(int jointIndex) const { // this returns the world-space transform for this object. It finds its parent's transform (which may // cause this object's parent to query its parent, etc) and multiplies this object's local transform onto it. Transform worldTransform = getTransform(); - Transform jointInObjectFrame = getJointTransformInObjectFrame(jointIndex); + Transform jointInObjectFrame = getJointTransformInModelFrame(jointIndex); Transform jointInWorldFrame; Transform::mult(jointInWorldFrame, worldTransform, jointInObjectFrame); return jointInWorldFrame; @@ -339,7 +339,7 @@ QList SpatiallyNestable::getChildren() const { return children; } -const Transform SpatiallyNestable::getJointTransformInObjectFrame(int jointIndex) const { +const Transform SpatiallyNestable::getJointTransformInModelFrame(int jointIndex) const { Transform jointInObjectFrame; glm::vec3 position = getJointTranslation(jointIndex); glm::quat orientation = getJointRotation(jointIndex); diff --git a/libraries/shared/src/SpatiallyNestable.h b/libraries/shared/src/SpatiallyNestable.h index f3056d9a4f..da7aff6b52 100644 --- a/libraries/shared/src/SpatiallyNestable.h +++ b/libraries/shared/src/SpatiallyNestable.h @@ -91,7 +91,7 @@ public: NestableTypes::NestableType getNestableType() const { return _nestableType; } // this object's frame - virtual const Transform getJointTransformInObjectFrame(int jointIndex) const; + virtual const Transform getJointTransformInModelFrame(int jointIndex) const; virtual glm::quat getJointRotation(int index) const { assert(false); return glm::quat(); } virtual glm::vec3 getJointTranslation(int index) const { assert(false); return glm::vec3(); } From a948ae5f1943f7a4e8d51244f80a6ef7348f0e26 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 10:48:00 -0800 Subject: [PATCH 14/34] children of avatar joints might be right, now --- interface/src/avatar/Avatar.cpp | 11 ++++++++++ interface/src/avatar/Avatar.h | 3 +++ libraries/animation/src/Rig.cpp | 20 +++++++++++++++++++ libraries/animation/src/Rig.h | 6 ++++-- .../src/RenderableModelEntityItem.cpp | 8 ++++---- .../src/RenderableModelEntityItem.h | 6 +++--- libraries/entities/src/EntityItem.h | 6 +++--- libraries/render-utils/src/Model.cpp | 8 ++++++++ libraries/render-utils/src/Model.h | 4 ++++ libraries/shared/src/SpatiallyNestable.cpp | 12 +++++------ libraries/shared/src/SpatiallyNestable.h | 4 ++-- 11 files changed, 68 insertions(+), 20 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 7d407046d6..29423f4d79 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -869,6 +869,17 @@ glm::vec3 Avatar::getJointTranslation(int index) const { return translation; } +glm::quat Avatar::getJointRotationInModelFrame(int index) const { + glm::quat rotation; + _skeletonModel.getJointRotationInModelFrame(index, rotation); + return Quaternions::Y_180 * rotation; +} + +glm::vec3 Avatar::getJointTranslationInModelFrame(int index) const { + glm::vec3 translation; + _skeletonModel.getJointTranslationInModelFrame(index, translation); + return Quaternions::Y_180 * translation; +} int Avatar::getJointIndex(const QString& name) const { if (QThread::currentThread() != thread()) { diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index dc5014a7ea..3f8b955b6c 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -108,6 +108,9 @@ public: virtual int getJointIndex(const QString& name) const; virtual QStringList getJointNames() const; + virtual glm::quat getJointRotationInModelFrame(int index) const; + virtual glm::vec3 getJointTranslationInModelFrame(int index) const; + virtual void setFaceModelURL(const QUrl& faceModelURL); virtual void setSkeletonModelURL(const QUrl& skeletonModelURL); virtual void setAttachmentData(const QVector& attachmentData); diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 8fb56ed699..04c9ba173f 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -373,6 +373,16 @@ bool Rig::getJointRotation(int jointIndex, glm::quat& rotation) const { } } +bool Rig::getJointRotationInModelFrame(int jointIndex, glm::quat& rotation) const { + QReadLocker readLock(&_externalPoseSetLock); + if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._absolutePoses.size()) { + rotation = _externalPoseSet._absolutePoses[jointIndex].rot; + return true; + } else { + return false; + } +} + bool Rig::getJointTranslation(int jointIndex, glm::vec3& translation) const { QReadLocker readLock(&_externalPoseSetLock); if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._relativePoses.size()) { @@ -383,6 +393,16 @@ bool Rig::getJointTranslation(int jointIndex, glm::vec3& translation) const { } } +bool Rig::getJointTranslationInModelFrame(int jointIndex, glm::vec3& translation) const { + QReadLocker readLock(&_externalPoseSetLock); + if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._absolutePoses.size()) { + translation = _externalPoseSet._absolutePoses[jointIndex].trans; + return true; + } else { + return false; + } +} + bool Rig::getJointCombinedRotation(int jointIndex, glm::quat& result, const glm::quat& rotation) const { // AJT: TODO: used by attachments ASSERT(false); diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 64ce8c52ef..956a07c543 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -129,10 +129,12 @@ public: // geometry space (thread-safe) bool getJointRotation(int jointIndex, glm::quat& rotation) const; - - // geometry space (thread-safe) bool getJointTranslation(int jointIndex, glm::vec3& translation) const; + // model space (thread-safe) + bool getJointRotationInModelFrame(int jointIndex, glm::quat& rotation) const; + bool getJointTranslationInModelFrame(int jointIndex, glm::vec3& translation) const; + // legacy bool getJointCombinedRotation(int jointIndex, glm::quat& result, const glm::quat& rotation) const; diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 393c0dc0dc..8f2b54b35a 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -565,20 +565,20 @@ bool RenderableModelEntityItem::contains(const glm::vec3& point) const { return false; } -glm::quat RenderableModelEntityItem::getJointRotation(int index) const { +glm::quat RenderableModelEntityItem::getJointRotationInModelFrame(int index) const { if (_model) { glm::quat result; - if (_model->getJointRotation(index, result)) { + if (_model->getJointRotationInModelFrame(index, result)) { return result; } } return glm::quat(); } -glm::vec3 RenderableModelEntityItem::getJointTranslation(int index) const { +glm::vec3 RenderableModelEntityItem::getJointTranslationInModelFrame(int index) const { if (_model) { glm::vec3 result; - if (_model->getJointTranslation(index, result)) { + if (_model->getJointTranslationInModelFrame(index, result)) { return result; } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 2ee4aeb73e..e73289174c 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -67,9 +67,9 @@ public: virtual bool contains(const glm::vec3& point) const override; - // these are in the frame of this object - virtual glm::quat getJointRotation(int index) const; - virtual glm::vec3 getJointTranslation(int index) const; + // these are in the frame of this object (model space) + virtual glm::quat getJointRotationInModelFrame(int index) const; + virtual glm::vec3 getJointTranslationInModelFrame(int index) const; private: void remapTextures(); diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index 761208cb06..bfc178f2c3 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -378,9 +378,9 @@ public: QList getActionsOfType(EntityActionType typeToGet); - // these are in the frame of this object - virtual glm::quat getJointRotation(int index) const { return glm::quat(); } - virtual glm::vec3 getJointTranslation(int index) const { return glm::vec3(0.0f); } + // these are in the frame of this object (model space) + virtual glm::quat getJointRotationInModelFrame(int index) const { return glm::quat(); } + virtual glm::vec3 getJointTranslationInModelFrame(int index) const { return glm::vec3(0.0f); } protected: diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index f566d0879d..82b3228f0b 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -765,6 +765,14 @@ bool Model::getJointTranslation(int jointIndex, glm::vec3& translation) const { return _rig->getJointTranslation(jointIndex, translation); } +bool Model::getJointRotationInModelFrame(int jointIndex, glm::quat& rotation) const { + return _rig->getJointRotationInModelFrame(jointIndex, rotation); +} + +bool Model::getJointTranslationInModelFrame(int jointIndex, glm::vec3& translation) const { + return _rig->getJointTranslationInModelFrame(jointIndex, translation); +} + bool Model::getJointCombinedRotation(int jointIndex, glm::quat& rotation) const { return _rig->getJointCombinedRotation(jointIndex, rotation, _rotation); } diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index e8e9f93986..287e0046f0 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -166,6 +166,10 @@ public: bool getJointRotation(int jointIndex, glm::quat& rotation) const; bool getJointTranslation(int jointIndex, glm::vec3& translation) const; + // model frame + bool getJointRotationInModelFrame(int jointIndex, glm::quat& rotation) const; + bool getJointTranslationInModelFrame(int jointIndex, glm::vec3& translation) const; + /// Returns the index of the parent of the indexed joint, or -1 if not found. int getParentJointIndex(int jointIndex) const; diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 0a2310e43e..7d61442ad1 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -340,12 +340,12 @@ QList SpatiallyNestable::getChildren() const { } const Transform SpatiallyNestable::getJointTransformInModelFrame(int jointIndex) const { - Transform jointInObjectFrame; - glm::vec3 position = getJointTranslation(jointIndex); - glm::quat orientation = getJointRotation(jointIndex); - jointInObjectFrame.setRotation(orientation); - jointInObjectFrame.setTranslation(position); - return jointInObjectFrame; + Transform jointTransformInObjectFrame; + glm::vec3 position = getJointTranslationInModelFrame(jointIndex); + glm::quat orientation = getJointRotationInModelFrame(jointIndex); + jointTransformInObjectFrame.setRotation(orientation); + jointTransformInObjectFrame.setTranslation(position); + return jointTransformInObjectFrame; } SpatiallyNestablePointer SpatiallyNestable::getThisPointer() const { diff --git a/libraries/shared/src/SpatiallyNestable.h b/libraries/shared/src/SpatiallyNestable.h index da7aff6b52..0d3b00e0eb 100644 --- a/libraries/shared/src/SpatiallyNestable.h +++ b/libraries/shared/src/SpatiallyNestable.h @@ -92,8 +92,8 @@ public: // this object's frame virtual const Transform getJointTransformInModelFrame(int jointIndex) const; - virtual glm::quat getJointRotation(int index) const { assert(false); return glm::quat(); } - virtual glm::vec3 getJointTranslation(int index) const { assert(false); return glm::vec3(); } + virtual glm::quat getJointRotationInModelFrame(int index) const { assert(false); return glm::quat(); } + virtual glm::vec3 getJointTranslationInModelFrame(int index) const { assert(false); return glm::vec3(); } SpatiallyNestablePointer getThisPointer() const; From fff4e3e831ef29114a97b62a3c38c55e4e5b3001 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 12:01:30 -0800 Subject: [PATCH 15/34] make SpatiallyNestable setters take values by reference --- interface/src/avatar/Avatar.cpp | 4 ++-- interface/src/avatar/Avatar.h | 4 ++-- libraries/avatars/src/AvatarData.cpp | 4 ++-- libraries/avatars/src/AvatarData.h | 4 ++-- libraries/shared/src/SpatiallyNestable.cpp | 18 +++++++++--------- libraries/shared/src/SpatiallyNestable.h | 18 +++++++++--------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 29423f4d79..62ec4de1b2 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -1157,12 +1157,12 @@ glm::quat Avatar::getRightPalmRotation() { return rightRotation; } -void Avatar::setPosition(const glm::vec3 position) { +void Avatar::setPosition(const glm::vec3& position) { AvatarData::setPosition(position); updateAttitude(); } -void Avatar::setOrientation(const glm::quat orientation) { +void Avatar::setOrientation(const glm::quat& orientation) { AvatarData::setOrientation(orientation); updateAttitude(); } diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index 3f8b955b6c..e2eeab2c3d 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -158,8 +158,8 @@ public: void setMotionState(AvatarMotionState* motionState) { _motionState = motionState; } AvatarMotionState* getMotionState() { return _motionState; } - virtual void setPosition(glm::vec3 position); - virtual void setOrientation(glm::quat orientation); + virtual void setPosition(const glm::vec3& position); + virtual void setOrientation(const glm::quat& orientation); public slots: diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 76575909aa..fe03fb09cd 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -1626,10 +1626,10 @@ void AvatarData::setBodyRoll(float bodyRoll) { setOrientation(glm::quat(glm::radians(eulerAngles))); } -void AvatarData::setPosition(const glm::vec3 position) { +void AvatarData::setPosition(const glm::vec3& position) { SpatiallyNestable::setPosition(position); } -void AvatarData::setOrientation(const glm::quat orientation) { +void AvatarData::setOrientation(const glm::quat& orientation) { SpatiallyNestable::setOrientation(orientation); } diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 8419ce2154..0db259ceda 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -201,8 +201,8 @@ public: float getBodyRoll() const; void setBodyRoll(float bodyRoll); - virtual void setPosition(glm::vec3 position); - virtual void setOrientation(glm::quat orientation); + virtual void setPosition(const glm::vec3& position); + virtual void setOrientation(const glm::quat& orientation); void nextAttitude(glm::vec3 position, glm::quat orientation); // Can be safely called at any time. void startCapture(); // start/end of the period in which the latest values are about to be captured for camera, etc. diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 7d61442ad1..77b5f57bfb 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -91,7 +91,7 @@ void SpatiallyNestable::forgetChild(SpatiallyNestablePointer newChild) const { }); } -void SpatiallyNestable::setParentID(const QUuid parentID) { +void SpatiallyNestable::setParentID(const QUuid& parentID) { if (_parentID != parentID) { _parentID = parentID; _parentKnowsMe = false; @@ -188,7 +188,7 @@ glm::vec3 SpatiallyNestable::getPosition(int jointIndex) const { return getTransform(jointIndex).getTranslation(); } -void SpatiallyNestable::setPosition(glm::vec3 position) { +void SpatiallyNestable::setPosition(const glm::vec3& position) { Transform parentTransform = getParentTransform(); Transform myWorldTransform; _transformLock.withWriteLock([&] { @@ -207,7 +207,7 @@ glm::quat SpatiallyNestable::getOrientation(int jointIndex) const { return getTransform(jointIndex).getRotation(); } -void SpatiallyNestable::setOrientation(glm::quat orientation) { +void SpatiallyNestable::setOrientation(const glm::quat& orientation) { Transform parentTransform = getParentTransform(); Transform myWorldTransform; _transformLock.withWriteLock([&] { @@ -238,7 +238,7 @@ const Transform SpatiallyNestable::getTransform(int jointIndex) const { return jointInWorldFrame; } -void SpatiallyNestable::setTransform(const Transform transform) { +void SpatiallyNestable::setTransform(const Transform& transform) { Transform parentTransform = getParentTransform(); _transformLock.withWriteLock([&] { Transform::inverseMult(_transform, parentTransform, transform); @@ -259,7 +259,7 @@ glm::vec3 SpatiallyNestable::getScale(int jointIndex) const { return getScale(); } -void SpatiallyNestable::setScale(glm::vec3 scale) { +void SpatiallyNestable::setScale(const glm::vec3& scale) { _transformLock.withWriteLock([&] { _transform.setScale(scale); }); @@ -274,7 +274,7 @@ const Transform SpatiallyNestable::getLocalTransform() const { return result; } -void SpatiallyNestable::setLocalTransform(const Transform transform) { +void SpatiallyNestable::setLocalTransform(const Transform& transform) { _transformLock.withWriteLock([&] { _transform = transform; }); @@ -289,7 +289,7 @@ glm::vec3 SpatiallyNestable::getLocalPosition() const { return result; } -void SpatiallyNestable::setLocalPosition(glm::vec3 position) { +void SpatiallyNestable::setLocalPosition(const glm::vec3& position) { _transformLock.withWriteLock([&] { _transform.setTranslation(position); }); @@ -304,7 +304,7 @@ glm::quat SpatiallyNestable::getLocalOrientation() const { return result; } -void SpatiallyNestable::setLocalOrientation(glm::quat orientation) { +void SpatiallyNestable::setLocalOrientation(const glm::quat& orientation) { _transformLock.withWriteLock([&] { _transform.setRotation(orientation); }); @@ -319,7 +319,7 @@ glm::vec3 SpatiallyNestable::getLocalScale() const { return result; } -void SpatiallyNestable::setLocalScale(glm::vec3 scale) { +void SpatiallyNestable::setLocalScale(const glm::vec3& scale) { _transformLock.withWriteLock([&] { _transform.setScale(scale); }); diff --git a/libraries/shared/src/SpatiallyNestable.h b/libraries/shared/src/SpatiallyNestable.h index 0d3b00e0eb..dc1be54219 100644 --- a/libraries/shared/src/SpatiallyNestable.h +++ b/libraries/shared/src/SpatiallyNestable.h @@ -42,7 +42,7 @@ public: virtual void setID(const QUuid& id) { _id = id; } virtual const QUuid getParentID() const { return _parentID; } - virtual void setParentID(const QUuid parentID); + virtual void setParentID(const QUuid& parentID); virtual quint16 getParentJointIndex() const { return _parentJointIndex; } virtual void setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; } @@ -55,19 +55,19 @@ public: // world frame virtual const Transform getTransform() const; - virtual void setTransform(const Transform transform); + virtual void setTransform(const Transform& transform); virtual Transform getParentTransform() const; virtual glm::vec3 getPosition() const; - virtual void setPosition(glm::vec3 position); + virtual void setPosition(const glm::vec3& position); virtual glm::quat getOrientation() const; virtual glm::quat getOrientation(int jointIndex) const; - virtual void setOrientation(glm::quat orientation); + virtual void setOrientation(const glm::quat& orientation); virtual glm::vec3 getScale() const; - virtual void setScale(glm::vec3 scale); + virtual void setScale(const glm::vec3& scale); // get world-frame values for a specific joint virtual const Transform getTransform(int jointIndex) const; @@ -76,16 +76,16 @@ public: // object's parent's frame virtual const Transform getLocalTransform() const; - virtual void setLocalTransform(const Transform transform); + virtual void setLocalTransform(const Transform& transform); virtual glm::vec3 getLocalPosition() const; - virtual void setLocalPosition(glm::vec3 position); + virtual void setLocalPosition(const glm::vec3& position); virtual glm::quat getLocalOrientation() const; - virtual void setLocalOrientation(glm::quat orientation); + virtual void setLocalOrientation(const glm::quat& orientation); virtual glm::vec3 getLocalScale() const; - virtual void setLocalScale(glm::vec3 scale); + virtual void setLocalScale(const glm::vec3& scale); QList getChildren() const; NestableTypes::NestableType getNestableType() const { return _nestableType; } From f0fb9966ada9f89ec58ba5612cfae35adb1e9156 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 12:34:41 -0800 Subject: [PATCH 16/34] expose parent-joint-index to edit.js --- examples/html/entityProperties.html | 9 +++++++ .../entities/src/EntityScriptingInterface.cpp | 27 +++++++------------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index bef5c825c2..186b2ee828 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -226,6 +226,7 @@ var elRescaleDimensionsButton = document.getElementById("dimension-rescale-button"); var elParentID = document.getElementById("property-parent-id"); + var elParentJointIndex = document.getElementById("property-parent-joint-index"); var elRegistrationX = document.getElementById("property-reg-x"); var elRegistrationY = document.getElementById("property-reg-y"); @@ -456,6 +457,7 @@ elDimensionsZ.value = properties.dimensions.z.toFixed(2); elParentID.value = properties.parentID; + elParentJointIndex.value = properties.parentJointIndex; elRegistrationX.value = properties.registrationPoint.x.toFixed(2); elRegistrationY.value = properties.registrationPoint.y.toFixed(2); @@ -671,6 +673,7 @@ elDimensionsZ.addEventListener('change', dimensionsChangeFunction); elParentID.addEventListener('change', createEmitTextPropertyUpdateFunction('parentID')); + elParentJointIndex.addEventListener('change', createEmitNumberPropertyUpdateFunction('parentJointIndex')); var registrationChangeFunction = createEmitVec3PropertyUpdateFunction( 'registrationPoint', elRegistrationX, elRegistrationY, elRegistrationZ); @@ -1067,6 +1070,12 @@ +
+ ParentJointIndex +
+ +
+
Registration
diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 23fbac13cf..2488470bfa 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -201,28 +201,21 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties script bool updatedEntity = false; _entityTree->withWriteLock([&] { - if (scriptSideProperties.parentDependentPropertyChanged()) { - // if the script set a location property but didn't include parent information, grab the needed - // properties from the entity. - if (!scriptSideProperties.parentIDChanged() || !scriptSideProperties.parentJointIndexChanged()) { - EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); - if (entity && !scriptSideProperties.parentIDChanged()) { - properties.setParentID(entity->getParentID()); - } - if (entity && !scriptSideProperties.parentJointIndexChanged()) { - properties.setParentJointIndex(entity->getParentJointIndex()); - } + if (scriptSideProperties.parentDependentPropertyChanged() || + scriptSideProperties.parentIDChanged() || scriptSideProperties.parentJointIndexChanged()) { + // All of parentID, parentJointIndex, position, rotation are needed to make sense of any of them. + // If any of these changed, pull any missing properties from the entity. + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); + if (entity && !scriptSideProperties.parentIDChanged()) { + properties.setParentID(entity->getParentID()); + } + if (entity && !scriptSideProperties.parentJointIndexChanged()) { + properties.setParentJointIndex(entity->getParentJointIndex()); } - } - if (scriptSideProperties.parentIDChanged() || scriptSideProperties.parentJointIndexChanged()) { - // if the script set parentID or parentJointIndex but didn't include position and rotation, grab - // the missing properties from the entity if (!scriptSideProperties.localPositionChanged() && !scriptSideProperties.positionChanged()) { - EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); properties.setPosition(entity->getPosition()); } if (!scriptSideProperties.localRotationChanged() && !scriptSideProperties.rotationChanged()) { - EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); properties.setRotation(entity->getOrientation()); } } From 3cc423ca03800da8c3317de05f186f474cfeb632 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 6 Dec 2015 17:55:48 -0800 Subject: [PATCH 17/34] remap IDs when importing entities --- interface/src/Application.cpp | 1 + libraries/entities/src/EntityTree.cpp | 6 ++++ libraries/entities/src/EntityTree.h | 2 ++ libraries/entities/src/RemapIDOperator.cpp | 33 ++++++++++++++++++++++ libraries/entities/src/RemapIDOperator.h | 30 ++++++++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 libraries/entities/src/RemapIDOperator.cpp create mode 100644 libraries/entities/src/RemapIDOperator.h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9e98b51442..6ef440843f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2480,6 +2480,7 @@ bool Application::importEntities(const QString& urlOrFilename) { bool success = _entityClipboard->readFromURL(url.toString()); if (success) { + _entityClipboard->remapIDs(); _entityClipboard->reaverageOctreeElements(); } return success; diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 892b186a25..c0ef3e0fe3 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -24,6 +24,7 @@ #include "EntitiesLogging.h" #include "RecurseOctreeToMapOperator.h" #include "LogHandler.h" +#include "RemapIDOperator.h" static const quint64 DELETED_ENTITIES_EXTRA_USECS_TO_CONSIDER = USECS_PER_MSEC * 50; @@ -1194,6 +1195,11 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra return true; } +void EntityTree::remapIDs() { + RemapIDOperator theOperator; + recurseTreeWithOperator(&theOperator); +} + bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues) { if (! entityDescription.contains("Entities")) { entityDescription["Entities"] = QVariantList(); diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index d1e0462f64..97a23124bb 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -196,6 +196,8 @@ public: bool wantTerseEditLogging() const { return _wantTerseEditLogging; } void setWantTerseEditLogging(bool value) { _wantTerseEditLogging = value; } + void remapIDs(); + bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues); bool readFromMap(QVariantMap& entityDescription); diff --git a/libraries/entities/src/RemapIDOperator.cpp b/libraries/entities/src/RemapIDOperator.cpp new file mode 100644 index 0000000000..eee6e49a1c --- /dev/null +++ b/libraries/entities/src/RemapIDOperator.cpp @@ -0,0 +1,33 @@ +// +// RemapIDOperator.cpp +// libraries/entities/src +// +// Created by Seth Alves on 2015-12-6. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + + +#include "EntityTree.h" +#include "RemapIDOperator.h" + +QUuid RemapIDOperator::remap(const QUuid& oldID) { + if (oldID.isNull()) { + return oldID; + } + if (!_oldToNew.contains(oldID)) { + _oldToNew[oldID] = QUuid::createUuid(); + } + return _oldToNew[oldID]; +} + +bool RemapIDOperator::postRecursion(OctreeElementPointer element) { + EntityTreeElementPointer entityTreeElement = std::static_pointer_cast(element); + entityTreeElement->forEachEntity([&](EntityItemPointer entityItem) { + entityItem->setID(remap(entityItem->getID())); + entityItem->setParentID(remap(entityItem->getParentID())); + }); + return true; +} diff --git a/libraries/entities/src/RemapIDOperator.h b/libraries/entities/src/RemapIDOperator.h new file mode 100644 index 0000000000..439aec28fc --- /dev/null +++ b/libraries/entities/src/RemapIDOperator.h @@ -0,0 +1,30 @@ +// +// RemapIDOperator.h +// libraries/entities/src +// +// Created by Seth Alves on 2015-12-6. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_RemapIDOperator_h +#define hifi_RemapIDOperator_h + +#include "Octree.h" + +// this will change all the IDs in an EntityTree. Parent/Child relationships are maintained. + +class RemapIDOperator : public RecurseOctreeOperator { +public: + RemapIDOperator() : RecurseOctreeOperator() {} + ~RemapIDOperator() {} + virtual bool preRecursion(OctreeElementPointer element) { return true; } + virtual bool postRecursion(OctreeElementPointer element); +private: + QUuid remap(const QUuid& oldID); + QHash _oldToNew; +}; + +#endif // hifi_RemapIDOperator_h From 96e9580473b597f6bb83c3d684d121a6265bf785 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 7 Dec 2015 05:30:19 -0800 Subject: [PATCH 18/34] change some more parameters back to being pass-by-reference, where it's safe --- .../entities-renderer/src/RenderableModelEntityItem.cpp | 5 +++-- .../entities-renderer/src/RenderableModelEntityItem.h | 2 +- libraries/entities/src/EntityItem.cpp | 2 +- libraries/entities/src/EntityItem.h | 2 +- libraries/entities/src/EntityItemProperties.cpp | 2 +- libraries/entities/src/EntityItemProperties.h | 2 +- libraries/entities/src/EntityScriptingInterface.cpp | 6 +++--- libraries/entities/src/EntityScriptingInterface.h | 2 +- libraries/entities/src/LightEntityItem.cpp | 2 +- libraries/entities/src/LightEntityItem.h | 2 +- libraries/entities/src/TextEntityItem.cpp | 2 +- libraries/entities/src/TextEntityItem.h | 2 +- libraries/entities/src/WebEntityItem.cpp | 2 +- libraries/entities/src/WebEntityItem.h | 2 +- libraries/shared/src/SpatiallyNestable.cpp | 8 ++++---- libraries/shared/src/SpatiallyNestable.h | 8 ++++---- 16 files changed, 26 insertions(+), 25 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 8f2b54b35a..95ce59b6a3 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -33,7 +33,8 @@ EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityI RenderableModelEntityItem::RenderableModelEntityItem(const EntityItemID& entityItemID, bool dimensionsInitialized) : ModelEntityItem(entityItemID), - _dimensionsInitialized(dimensionsInitialized) { + _dimensionsInitialized(dimensionsInitialized) +{ } RenderableModelEntityItem::~RenderableModelEntityItem() { @@ -44,7 +45,7 @@ RenderableModelEntityItem::~RenderableModelEntityItem() { } } -void RenderableModelEntityItem::setDimensions(const glm::vec3 value) { +void RenderableModelEntityItem::setDimensions(const glm::vec3& value) { _dimensionsInitialized = true; ModelEntityItem::setDimensions(value); } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index e73289174c..7dba6ac5f0 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -28,7 +28,7 @@ public: virtual ~RenderableModelEntityItem(); - virtual void setDimensions(const glm::vec3 value) override; + virtual void setDimensions(const glm::vec3& value) override; virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const override; virtual bool setProperties(const EntityItemProperties& properties) override; diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 51ade5b46e..9b31c2aa59 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1192,7 +1192,7 @@ const Transform EntityItem::getTransformToCenter() const { return result; } -void EntityItem::setDimensions(const glm::vec3 value) { +void EntityItem::setDimensions(const glm::vec3& value) { if (value.x <= 0.0f || value.y <= 0.0f || value.z <= 0.0f) { return; } diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index bfc178f2c3..4fc4ee2afb 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -178,7 +178,7 @@ public: /// Dimensions in meters (0.0 - TREE_SCALE) inline const glm::vec3 getDimensions() const { return getScale(); } - virtual void setDimensions(const glm::vec3 value); + virtual void setDimensions(const glm::vec3& value); float getGlowLevel() const { return _glowLevel; } void setGlowLevel(float glowLevel) { _glowLevel = glowLevel; } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 9ff5d73616..d040f785da 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -1796,6 +1796,6 @@ QList EntityItemProperties::listChangedProperties() { return out; } -bool EntityItemProperties::parentDependentPropertyChanged() { +bool EntityItemProperties::parentDependentPropertyChanged() const { return localPositionChanged() || positionChanged() || localRotationChanged() || rotationChanged(); } diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 11d29c5d57..c13519996a 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -83,7 +83,7 @@ public: { return (float)(usecTimestampNow() - getLastEdited()) / (float)USECS_PER_SECOND; } EntityPropertyFlags getChangedProperties() const; - bool parentDependentPropertyChanged(); // was there a changed in a property that requires parent info to interpret? + bool parentDependentPropertyChanged() const; // was there a changed in a property that requires parent info to interpret? AACube getMaximumAACube() const; AABox getAABox() const; diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 2488470bfa..4cb815f365 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -64,7 +64,7 @@ void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) { } } -EntityItemProperties convertLocationToScriptSemantics(EntityItemProperties entitySideProperties) { +EntityItemProperties convertLocationToScriptSemantics(const EntityItemProperties& entitySideProperties) { // In EntityTree code, properties.position and properties.rotation are relative to the parent. In javascript, // they are in world-space. The local versions are put into localPosition and localRotation and position and // rotation are converted from local to world space. @@ -85,7 +85,7 @@ EntityItemProperties convertLocationToScriptSemantics(EntityItemProperties entit } -EntityItemProperties convertLocationFromScriptSemantics(EntityItemProperties scriptSideProperties) { +EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperties& scriptSideProperties) { // convert position and rotation properties from world-space to local, unless localPosition and localRotation // are set. If they are set, they overwrite position and rotation. EntityItemProperties entitySideProperties = scriptSideProperties; @@ -190,7 +190,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit return convertLocationToScriptSemantics(results); } -QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties scriptSideProperties) { +QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) { EntityItemProperties properties = scriptSideProperties; EntityItemID entityID(id); // If we have a local entity tree set, then also update it. diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 84688ab24a..591dee6a85 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -86,7 +86,7 @@ public slots: /// edits a model updating only the included properties, will return the identified EntityItemID in case of /// successful edit, if the input entityID is for an unknown model this function will have no effect - Q_INVOKABLE QUuid editEntity(QUuid entityID, EntityItemProperties properties); + Q_INVOKABLE QUuid editEntity(QUuid entityID, const EntityItemProperties& properties); /// deletes a model Q_INVOKABLE void deleteEntity(QUuid entityID); diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index af3110c000..ac56fc9c1f 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -40,7 +40,7 @@ LightEntityItem::LightEntityItem(const EntityItemID& entityItemID) : EntityItem( _cutoff = PI; } -void LightEntityItem::setDimensions(const glm::vec3 value) { +void LightEntityItem::setDimensions(const glm::vec3& value) { if (_isSpotlight) { // If we are a spotlight, treat the z value as our radius or length, and // recalculate the x/y dimensions to properly encapsulate the spotlight. diff --git a/libraries/entities/src/LightEntityItem.h b/libraries/entities/src/LightEntityItem.h index edb2ca7b3c..103c462809 100644 --- a/libraries/entities/src/LightEntityItem.h +++ b/libraries/entities/src/LightEntityItem.h @@ -23,7 +23,7 @@ public: ALLOW_INSTANTIATION // This class can be instantiated /// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately - virtual void setDimensions(const glm::vec3 value); + virtual void setDimensions(const glm::vec3& value); // methods for getting/setting all properties of an entity virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const; diff --git a/libraries/entities/src/TextEntityItem.cpp b/libraries/entities/src/TextEntityItem.cpp index 7d1cfb5c6b..893329d1ce 100644 --- a/libraries/entities/src/TextEntityItem.cpp +++ b/libraries/entities/src/TextEntityItem.cpp @@ -41,7 +41,7 @@ TextEntityItem::TextEntityItem(const EntityItemID& entityItemID) : EntityItem(en const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f; -void TextEntityItem::setDimensions(const glm::vec3 value) { +void TextEntityItem::setDimensions(const glm::vec3& value) { // NOTE: Text Entities always have a "depth" of 1cm. EntityItem::setDimensions(glm::vec3(value.x, value.y, TEXT_ENTITY_ITEM_FIXED_DEPTH)); } diff --git a/libraries/entities/src/TextEntityItem.h b/libraries/entities/src/TextEntityItem.h index 2080912d92..1caceee085 100644 --- a/libraries/entities/src/TextEntityItem.h +++ b/libraries/entities/src/TextEntityItem.h @@ -23,7 +23,7 @@ public: ALLOW_INSTANTIATION // This class can be instantiated /// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately - virtual void setDimensions(const glm::vec3 value); + virtual void setDimensions(const glm::vec3& value); virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; } // methods for getting/setting all properties of an entity diff --git a/libraries/entities/src/WebEntityItem.cpp b/libraries/entities/src/WebEntityItem.cpp index 35189074bb..5f113f1de4 100644 --- a/libraries/entities/src/WebEntityItem.cpp +++ b/libraries/entities/src/WebEntityItem.cpp @@ -34,7 +34,7 @@ WebEntityItem::WebEntityItem(const EntityItemID& entityItemID) : EntityItem(enti const float WEB_ENTITY_ITEM_FIXED_DEPTH = 0.01f; -void WebEntityItem::setDimensions(const glm::vec3 value) { +void WebEntityItem::setDimensions(const glm::vec3& value) { // NOTE: Web Entities always have a "depth" of 1cm. EntityItem::setDimensions(glm::vec3(value.x, value.y, WEB_ENTITY_ITEM_FIXED_DEPTH)); } diff --git a/libraries/entities/src/WebEntityItem.h b/libraries/entities/src/WebEntityItem.h index 49ab009bb2..8e9d924cde 100644 --- a/libraries/entities/src/WebEntityItem.h +++ b/libraries/entities/src/WebEntityItem.h @@ -22,7 +22,7 @@ public: ALLOW_INSTANTIATION // This class can be instantiated /// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately - virtual void setDimensions(const glm::vec3 value); + virtual void setDimensions(const glm::vec3& value); virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; } // methods for getting/setting all properties of an entity diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 77b5f57bfb..3d697edd92 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -99,7 +99,7 @@ void SpatiallyNestable::setParentID(const QUuid& parentID) { parentChanged(); } -glm::vec3 SpatiallyNestable::worldToLocal(glm::vec3 position, QUuid parentID, int parentJointIndex) { +glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex) { QSharedPointer parentFinder = DependencyManager::get(); Transform parentTransform; if (parentFinder) { @@ -122,7 +122,7 @@ glm::vec3 SpatiallyNestable::worldToLocal(glm::vec3 position, QUuid parentID, in return result.getTranslation(); } -glm::quat SpatiallyNestable::worldToLocal(glm::quat orientation, QUuid parentID, int parentJointIndex) { +glm::quat SpatiallyNestable::worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex) { QSharedPointer parentFinder = DependencyManager::get(); Transform parentTransform; if (parentFinder) { @@ -144,7 +144,7 @@ glm::quat SpatiallyNestable::worldToLocal(glm::quat orientation, QUuid parentID, return result.getRotation(); } -glm::vec3 SpatiallyNestable::localToWorld(glm::vec3 position, QUuid parentID, int parentJointIndex) { +glm::vec3 SpatiallyNestable::localToWorld(const glm::vec3& position, const QUuid& parentID, int parentJointIndex) { QSharedPointer parentFinder = DependencyManager::get(); Transform parentTransform; if (parentFinder) { @@ -162,7 +162,7 @@ glm::vec3 SpatiallyNestable::localToWorld(glm::vec3 position, QUuid parentID, in return result.getTranslation(); } -glm::quat SpatiallyNestable::localToWorld(glm::quat orientation, QUuid parentID, int parentJointIndex) { +glm::quat SpatiallyNestable::localToWorld(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex) { QSharedPointer parentFinder = DependencyManager::get(); Transform parentTransform; if (parentFinder) { diff --git a/libraries/shared/src/SpatiallyNestable.h b/libraries/shared/src/SpatiallyNestable.h index dc1be54219..4fdb051e84 100644 --- a/libraries/shared/src/SpatiallyNestable.h +++ b/libraries/shared/src/SpatiallyNestable.h @@ -47,11 +47,11 @@ public: virtual quint16 getParentJointIndex() const { return _parentJointIndex; } virtual void setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; } - static glm::vec3 worldToLocal(glm::vec3 position, QUuid parentID, int parentJointIndex); - static glm::quat worldToLocal(glm::quat orientation, QUuid parentID, int parentJointIndex); + static glm::vec3 worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex); + static glm::quat worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex); - static glm::vec3 localToWorld(glm::vec3 position, QUuid parentID, int parentJointIndex); - static glm::quat localToWorld(glm::quat orientation, QUuid parentID, int parentJointIndex); + static glm::vec3 localToWorld(const glm::vec3& position, const QUuid& parentID, int parentJointIndex); + static glm::quat localToWorld(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex); // world frame virtual const Transform getTransform() const; From f53571ac81c50a92f43d32868bd9beb6e576cbc9 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 7 Dec 2015 05:41:34 -0800 Subject: [PATCH 19/34] remap IDs on export, also --- interface/src/Application.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6ef440843f..094f04df29 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2414,6 +2414,9 @@ bool Application::exportEntities(const QString& filename, const QVectoraddEntity(entityItem->getEntityItemID(), properties); } + // remap IDs on export so that we aren't publishing the IDs of entities in our domain + exportTree->remapIDs(); + exportTree->writeToJSONFile(filename.toLocal8Bit().constData()); // restore the main window's active state From f6b1ef85b30f06ca82eaeed2a1e1c378d20a128a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 7 Dec 2015 06:03:47 -0800 Subject: [PATCH 20/34] remap entity IDs on export also --- interface/src/Application.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 094f04df29..4a5811826b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2439,6 +2439,10 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa properties.setPosition(properties.getPosition() - root); exportTree->addEntity(id, properties); } + + // remap IDs on export so that we aren't publishing the IDs of entities in our domain + exportTree->remapIDs(); + exportTree->writeToSVOFile(filename.toLocal8Bit().constData()); } else { qCDebug(interfaceapp) << "No models were selected"; From 60b8e65520cc93c70d1e040fa700b341578d6555 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 7 Dec 2015 06:03:58 -0800 Subject: [PATCH 21/34] get file dialog working on Linux --- interface/src/scripting/WindowScriptingInterface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index a2886c8b77..0bf94f02a9 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -622,7 +622,8 @@ QScriptValue WindowScriptingInterface::showBrowse(const QString& title, const QS fileDialog.setAcceptMode(acceptMode); QUrl fileUrl(directory); if (acceptMode == QFileDialog::AcceptSave) { - fileDialog.setFileMode(QFileDialog::Directory); + // TODO -- Setting this breaks the dialog on Linux. Does it help something on other platforms? + // fileDialog.setFileMode(QFileDialog::Directory); fileDialog.selectFile(fileUrl.fileName()); } if (fileDialog.exec()) { From 8683bb5002915c05645b9dacbebe6fc24dd19307 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Mon, 7 Dec 2015 13:05:30 -0800 Subject: [PATCH 22/34] New reverb parameters --- examples/utilities/tools/reverbTest.js | 60 +++++--- libraries/audio-client/src/AudioClient.cpp | 74 ++++++---- libraries/audio/src/AudioEffectOptions.cpp | 149 ++++++++++++-------- libraries/audio/src/AudioEffectOptions.h | 154 +++++++++++++-------- 4 files changed, 277 insertions(+), 160 deletions(-) diff --git a/examples/utilities/tools/reverbTest.js b/examples/utilities/tools/reverbTest.js index 32c28a993f..2b08073ae0 100644 --- a/examples/utilities/tools/reverbTest.js +++ b/examples/utilities/tools/reverbTest.js @@ -12,31 +12,57 @@ Script.include("cookies.js"); var audioOptions = new AudioEffectOptions({ - maxRoomSize: 50, + bandwidth: 10000, + preDelay: 20, + lateDelay: 0, + reverbTime: 2, + earlyDiffusion: 100, + lateDiffusion: 100, roomSize: 50, - reverbTime: 4, - damping: 0.50, - inputBandwidth: 0.8, - earlyLevel: 0, - tailLevel: 0, - dryLevel: -6, - wetLevel: -6 + density: 100, + bassMult: 1.5, + bassFreq: 250, + highGain: -6, + highFreq: 3000, + modRate: 2.3, + modDepth: 50, + earlyGain: 0, + lateGain: 0, + earlyMixLeft: 20, + earlyMixRight: 20, + lateMixLeft: 90, + lateMixRight: 90, + wetDryMix: 50, }); AudioDevice.setReverbOptions(audioOptions); AudioDevice.setReverb(true); print("Reverb is ON."); -var panel = new Panel(10, 200); +var panel = new Panel(10, 150); var parameters = [ - { name: "roomSize", min: 0, max: 100, units: " feet" }, - { name: "reverbTime", min: 0, max: 10, units: " sec" }, - { name: "damping", min: 0, max: 1, units: " " }, - { name: "inputBandwidth", min: 0, max: 1, units: " " }, - { name: "earlyLevel", min: -48, max: 0, units: " dB" }, - { name: "tailLevel", min: -48, max: 0, units: " dB" }, - { name: "wetLevel", min: -48, max: 0, units: " dB" }, + { name: "bandwidth", min: 1000, max: 12000, units: " Hz" }, + { name: "preDelay", min: 0, max: 333, units: " ms" }, + { name: "lateDelay", min: 0, max: 166, units: " ms" }, + { name: "reverbTime", min: 0.1, max: 10, units: " seconds" }, + { name: "earlyDiffusion", min: 0, max: 100, units: " percent" }, + { name: "lateDiffusion", min: 0, max: 100, units: " percent" }, + { name: "roomSize", min: 0, max: 100, units: " percent" }, + { name: "density", min: 0, max: 100, units: " percent" }, + { name: "bassMult", min: 0.1, max: 4, units: " ratio" }, + { name: "bassFreq", min: 10, max: 500, units: " Hz" }, + { name: "highGain", min: -24, max: 0, units: " dB" }, + { name: "highFreq", min: 1000, max: 12000, units: " Hz" }, + { name: "modRate", min: 0.1, max: 10, units: " Hz" }, + { name: "modDepth", min: 0, max: 100, units: " percent" }, + { name: "earlyGain", min: -96, max: 24, units: " dB" }, + { name: "lateGain", min: -96, max: 24, units: " dB" }, + { name: "earlyMixLeft", min: 0, max: 100, units: " percent" }, + { name: "earlyMixRight", min: 0, max: 100, units: " percent" }, + { name: "lateMixLeft", min: 0, max: 100, units: " percent" }, + { name: "lateMixRight", min: 0, max: 100, units: " percent" }, + { name: "wetDryMix", min: 0, max: 100, units: " percent" }, ] function setter(name) { @@ -48,7 +74,7 @@ function getter(name) { } function displayer(units) { - return function(value) { return (value).toFixed(1) + units; }; + return function(value) { return (value).toFixed(1) + units; } } // create a slider for each parameter diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index b141c70272..23e00c85cd 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -541,26 +541,40 @@ bool AudioClient::switchOutputToAudioDevice(const QString& outputDeviceName) { void AudioClient::configureReverb() { ReverbParameters p; - _listenerReverb.getParameters(&p); - - // for now, reuse the gverb parameters p.sampleRate = _outputFormat.sampleRate(); - p.roomSize = _reverbOptions->getRoomSize(); + + p.bandwidth = _reverbOptions->getBandwidth(); + p.preDelay = _reverbOptions->getPreDelay(); + p.lateDelay = _reverbOptions->getLateDelay(); p.reverbTime = _reverbOptions->getReverbTime(); - p.highGain = -24.0f * (1.0f - _reverbOptions->getDamping()); - p.bandwidth = 10000.0f * _reverbOptions->getInputBandwidth(); - p.earlyGain = _reverbOptions->getEarlyLevel(); - p.lateGain = _reverbOptions->getTailLevel(); - p.wetDryMix = 100.0f * powf(10.0f, _reverbOptions->getWetLevel() * (1/20.0f)); + p.earlyDiffusion = _reverbOptions->getEarlyDiffusion(); + p.lateDiffusion = _reverbOptions->getLateDiffusion(); + p.roomSize = _reverbOptions->getRoomSize(); + p.density = _reverbOptions->getDensity(); + p.bassMult = _reverbOptions->getBassMult(); + p.bassFreq = _reverbOptions->getBassFreq(); + p.highGain = _reverbOptions->getHighGain(); + p.highFreq = _reverbOptions->getHighFreq(); + p.modRate = _reverbOptions->getModRate(); + p.modDepth = _reverbOptions->getModDepth(); + p.earlyGain = _reverbOptions->getEarlyGain(); + p.lateGain = _reverbOptions->getLateGain(); + p.earlyMixLeft = _reverbOptions->getEarlyMixLeft(); + p.earlyMixRight = _reverbOptions->getEarlyMixRight(); + p.lateMixLeft = _reverbOptions->getLateMixLeft(); + p.lateMixRight = _reverbOptions->getLateMixRight(); + p.wetDryMix = _reverbOptions->getWetDryMix(); + _listenerReverb.setParameters(&p); - // used for adding self-reverb to loopback audio + // used only for adding self-reverb to loopback audio p.wetDryMix = 100.0f; p.preDelay = 0.0f; p.earlyGain = -96.0f; // disable ER - p.lateGain -= 12.0f; // quieter than listener reverb + p.lateGain -= 12.0f; // quieter than listener reverb p.lateMixLeft = 0.0f; p.lateMixRight = 0.0f; + _sourceReverb.setParameters(&p); } @@ -572,10 +586,10 @@ void AudioClient::updateReverbOptions() { _zoneReverbOptions.setReverbTime(_receivedAudioStream.getRevebTime()); reverbChanged = true; } - if (_zoneReverbOptions.getWetLevel() != _receivedAudioStream.getWetLevel()) { - _zoneReverbOptions.setWetLevel(_receivedAudioStream.getWetLevel()); - reverbChanged = true; - } + //if (_zoneReverbOptions.getWetLevel() != _receivedAudioStream.getWetLevel()) { + // _zoneReverbOptions.setWetLevel(_receivedAudioStream.getWetLevel()); + // reverbChanged = true; + //} if (_reverbOptions != &_zoneReverbOptions) { _reverbOptions = &_zoneReverbOptions; @@ -602,17 +616,27 @@ void AudioClient::setReverb(bool reverb) { void AudioClient::setReverbOptions(const AudioEffectOptions* options) { // Save the new options - _scriptReverbOptions.setMaxRoomSize(options->getMaxRoomSize()); - _scriptReverbOptions.setRoomSize(options->getRoomSize()); + _scriptReverbOptions.setBandwidth(options->getBandwidth()); + _scriptReverbOptions.setPreDelay(options->getPreDelay()); + _scriptReverbOptions.setLateDelay(options->getLateDelay()); _scriptReverbOptions.setReverbTime(options->getReverbTime()); - _scriptReverbOptions.setDamping(options->getDamping()); - _scriptReverbOptions.setSpread(options->getSpread()); - _scriptReverbOptions.setInputBandwidth(options->getInputBandwidth()); - _scriptReverbOptions.setEarlyLevel(options->getEarlyLevel()); - _scriptReverbOptions.setTailLevel(options->getTailLevel()); - - _scriptReverbOptions.setDryLevel(options->getDryLevel()); - _scriptReverbOptions.setWetLevel(options->getWetLevel()); + _scriptReverbOptions.setEarlyDiffusion(options->getEarlyDiffusion()); + _scriptReverbOptions.setLateDiffusion(options->getLateDiffusion()); + _scriptReverbOptions.setRoomSize(options->getRoomSize()); + _scriptReverbOptions.setDensity(options->getDensity()); + _scriptReverbOptions.setBassMult(options->getBassMult()); + _scriptReverbOptions.setBassFreq(options->getBassFreq()); + _scriptReverbOptions.setHighGain(options->getHighGain()); + _scriptReverbOptions.setHighFreq(options->getHighFreq()); + _scriptReverbOptions.setModRate(options->getModRate()); + _scriptReverbOptions.setModDepth(options->getModDepth()); + _scriptReverbOptions.setEarlyGain(options->getEarlyGain()); + _scriptReverbOptions.setLateGain(options->getLateGain()); + _scriptReverbOptions.setEarlyMixLeft(options->getEarlyMixLeft()); + _scriptReverbOptions.setEarlyMixRight(options->getEarlyMixRight()); + _scriptReverbOptions.setLateMixLeft(options->getLateMixLeft()); + _scriptReverbOptions.setLateMixRight(options->getLateMixRight()); + _scriptReverbOptions.setWetDryMix(options->getWetDryMix()); if (_reverbOptions == &_scriptReverbOptions) { // Apply them to the reverb instances diff --git a/libraries/audio/src/AudioEffectOptions.cpp b/libraries/audio/src/AudioEffectOptions.cpp index a61213d9c4..792799b776 100644 --- a/libraries/audio/src/AudioEffectOptions.cpp +++ b/libraries/audio/src/AudioEffectOptions.cpp @@ -10,58 +10,76 @@ #include "AudioEffectOptions.h" -static const QString MAX_ROOM_SIZE_HANDLE = "maxRoomSize"; -static const QString ROOM_SIZE_HANDLE = "roomSize"; +static const QString BANDWIDTH_HANDLE = "bandwidth"; +static const QString PRE_DELAY_HANDLE = "preDelay"; +static const QString LATE_DELAY_HANDLE = "lateDelay"; static const QString REVERB_TIME_HANDLE = "reverbTime"; -static const QString DAMPIMG_HANDLE = "damping"; -static const QString SPREAD_HANDLE = "spread"; -static const QString INPUT_BANDWIDTH_HANDLE = "inputBandwidth"; -static const QString EARLY_LEVEL_HANDLE = "earlyLevel"; -static const QString TAIL_LEVEL_HANDLE = "tailLevel"; -static const QString DRY_LEVEL_HANDLE = "dryLevel"; -static const QString WET_LEVEL_HANDLE = "wetLevel"; +static const QString EARLY_DIFFUSION_HANDLE = "earlyDiffusion"; +static const QString LATE_DIFFUSION_HANDLE = "lateDiffusion"; +static const QString ROOM_SIZE_HANDLE = "roomSize"; +static const QString DENSITY_HANDLE = "density"; +static const QString BASS_MULT_HANDLE = "bassMult"; +static const QString BASS_FREQ_HANDLE = "bassFreq"; +static const QString HIGH_GAIN_HANDLE = "highGain"; +static const QString HIGH_FREQ_HANDLE = "highFreq"; +static const QString MOD_RATE_HANDLE = "modRate"; +static const QString MOD_DEPTH_HANDLE = "modDepth"; +static const QString EARLY_GAIN_HANDLE = "earlyGain"; +static const QString LATE_GAIN_HANDLE = "lateGain"; +static const QString EARLY_MIX_LEFT_HANDLE = "earlyMixLeft"; +static const QString EARLY_MIX_RIGHT_HANDLE = "earlyMixRight"; +static const QString LATE_MIX_LEFT_HANDLE = "lateMixLeft"; +static const QString LATE_MIX_RIGHT_HANDLE = "lateMixRight"; +static const QString WET_DRY_MIX_HANDLE = "wetDryMix"; -AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) : - _maxRoomSize(50.0f), - _roomSize(50.0f), - _reverbTime(4.0f), - _damping(0.5f), - _spread(15.0f), - _inputBandwidth(0.75f), - _earlyLevel(-12.0f), - _tailLevel(-18.0f), - _dryLevel(0.0f), - _wetLevel(0.0f) { - if (arguments.property(MAX_ROOM_SIZE_HANDLE).isNumber()) { - _maxRoomSize = arguments.property(MAX_ROOM_SIZE_HANDLE).toNumber(); - } - if (arguments.property(ROOM_SIZE_HANDLE).isNumber()) { - _roomSize = arguments.property(ROOM_SIZE_HANDLE).toNumber(); - } - if (arguments.property(REVERB_TIME_HANDLE).isNumber()) { - _reverbTime = arguments.property(REVERB_TIME_HANDLE).toNumber(); - } - if (arguments.property(DAMPIMG_HANDLE).isNumber()) { - _damping = arguments.property(DAMPIMG_HANDLE).toNumber(); - } - if (arguments.property(SPREAD_HANDLE).isNumber()) { - _spread = arguments.property(SPREAD_HANDLE).toNumber(); - } - if (arguments.property(INPUT_BANDWIDTH_HANDLE).isNumber()) { - _inputBandwidth = arguments.property(INPUT_BANDWIDTH_HANDLE).toNumber(); - } - if (arguments.property(EARLY_LEVEL_HANDLE).isNumber()) { - _earlyLevel = arguments.property(EARLY_LEVEL_HANDLE).toNumber(); - } - if (arguments.property(TAIL_LEVEL_HANDLE).isNumber()) { - _tailLevel = arguments.property(TAIL_LEVEL_HANDLE).toNumber(); - } - if (arguments.property(DRY_LEVEL_HANDLE).isNumber()) { - _dryLevel = arguments.property(DRY_LEVEL_HANDLE).toNumber(); - } - if (arguments.property(WET_LEVEL_HANDLE).isNumber()) { - _wetLevel = arguments.property(WET_LEVEL_HANDLE).toNumber(); - } +static const float BANDWIDTH_DEFAULT = 10000.0f; +static const float PRE_DELAY_DEFAULT = 20.0f; +static const float LATE_DELAY_DEFAULT = 0.0f; +static const float REVERB_TIME_DEFAULT = 2.0f; +static const float EARLY_DIFFUSION_DEFAULT = 100.0f; +static const float LATE_DIFFUSION_DEFAULT = 100.0f; +static const float ROOM_SIZE_DEFAULT = 50.0f; +static const float DENSITY_DEFAULT = 100.0f; +static const float BASS_MULT_DEFAULT = 1.5f; +static const float BASS_FREQ_DEFAULT = 250.0f; +static const float HIGH_GAIN_DEFAULT = -6.0f; +static const float HIGH_FREQ_DEFAULT = 3000.0f; +static const float MOD_RATE_DEFAULT = 2.3f; +static const float MOD_DEPTH_DEFAULT = 50.0f; +static const float EARLY_GAIN_DEFAULT = 0.0f; +static const float LATE_GAIN_DEFAULT = 0.0f; +static const float EARLY_MIX_LEFT_DEFAULT = 20.0f; +static const float EARLY_MIX_RIGHT_DEFAULT = 20.0f; +static const float LATE_MIX_LEFT_DEFAULT = 90.0f; +static const float LATE_MIX_RIGHT_DEFAULT = 90.0f; +static const float WET_DRY_MIX_DEFAULT = 50.0f; + +static void setOption(QScriptValue arguments, const QString name, float default, float& var) { + var = arguments.property(name).isNumber() ? arguments.property(name).toNumber() : default; +} + +AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) { + setOption(arguments, BANDWIDTH_HANDLE, BANDWIDTH_DEFAULT, _bandwidth); + setOption(arguments, PRE_DELAY_HANDLE, PRE_DELAY_DEFAULT, _preDelay); + setOption(arguments, LATE_DELAY_HANDLE, LATE_DELAY_DEFAULT, _lateDelay); + setOption(arguments, REVERB_TIME_HANDLE, REVERB_TIME_DEFAULT, _reverbTime); + setOption(arguments, EARLY_DIFFUSION_HANDLE, EARLY_DIFFUSION_DEFAULT, _earlyDiffusion); + setOption(arguments, LATE_DIFFUSION_HANDLE, LATE_DIFFUSION_DEFAULT, _lateDiffusion); + setOption(arguments, ROOM_SIZE_HANDLE, ROOM_SIZE_DEFAULT, _roomSize); + setOption(arguments, DENSITY_HANDLE, DENSITY_DEFAULT, _density); + setOption(arguments, BASS_MULT_HANDLE, BASS_MULT_DEFAULT, _bassMult); + setOption(arguments, BASS_FREQ_HANDLE, BASS_FREQ_DEFAULT, _bassFreq); + setOption(arguments, HIGH_GAIN_HANDLE, HIGH_GAIN_DEFAULT, _highGain); + setOption(arguments, HIGH_FREQ_HANDLE, HIGH_FREQ_DEFAULT, _highFreq); + setOption(arguments, MOD_RATE_HANDLE, MOD_RATE_DEFAULT, _modRate); + setOption(arguments, MOD_DEPTH_HANDLE, MOD_DEPTH_DEFAULT, _modDepth); + setOption(arguments, EARLY_GAIN_HANDLE, EARLY_GAIN_DEFAULT, _earlyGain); + setOption(arguments, LATE_GAIN_HANDLE, LATE_GAIN_DEFAULT, _lateGain); + setOption(arguments, EARLY_MIX_LEFT_HANDLE, EARLY_MIX_LEFT_DEFAULT, _earlyMixLeft); + setOption(arguments, EARLY_MIX_RIGHT_HANDLE, EARLY_MIX_RIGHT_DEFAULT, _earlyMixRight); + setOption(arguments, LATE_MIX_LEFT_HANDLE, LATE_MIX_LEFT_DEFAULT, _lateMixLeft); + setOption(arguments, LATE_MIX_RIGHT_HANDLE, LATE_MIX_RIGHT_DEFAULT, _lateMixRight); + setOption(arguments, WET_DRY_MIX_HANDLE, WET_DRY_MIX_DEFAULT, _wetDryMix); } AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) : QObject() { @@ -69,17 +87,28 @@ AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) : QObjec } AudioEffectOptions& AudioEffectOptions::operator=(const AudioEffectOptions &other) { - _maxRoomSize = other._maxRoomSize; - _roomSize = other._roomSize; + _bandwidth = other._bandwidth; + _preDelay = other._preDelay; + _lateDelay = other._lateDelay; _reverbTime = other._reverbTime; - _damping = other._damping; - _spread = other._spread; - _inputBandwidth = other._inputBandwidth; - _earlyLevel = other._earlyLevel; - _tailLevel = other._tailLevel; - _dryLevel = other._dryLevel; - _wetLevel = other._wetLevel; - + _earlyDiffusion = other._earlyDiffusion; + _lateDiffusion = other._lateDiffusion; + _roomSize = other._roomSize; + _density = other._density; + _bassMult = other._bassMult; + _bassFreq = other._bassFreq; + _highGain = other._highGain; + _highFreq = other._highFreq; + _modRate = other._modRate; + _modDepth = other._modDepth; + _earlyGain = other._earlyGain; + _lateGain = other._lateGain; + _earlyMixLeft = other._earlyMixLeft; + _earlyMixRight = other._earlyMixRight; + _lateMixLeft = other._lateMixLeft; + _lateMixRight = other._lateMixRight; + _wetDryMix = other._wetDryMix; + return *this; } diff --git a/libraries/audio/src/AudioEffectOptions.h b/libraries/audio/src/AudioEffectOptions.h index be5e1cca5e..9a65301473 100644 --- a/libraries/audio/src/AudioEffectOptions.h +++ b/libraries/audio/src/AudioEffectOptions.h @@ -15,32 +15,30 @@ #include #include -#include "AudioReverb.h" - class AudioEffectOptions : public QObject { Q_OBJECT - // Meters Square - Q_PROPERTY(float maxRoomSize READ getMaxRoomSize WRITE setMaxRoomSize) - Q_PROPERTY(float roomSize READ getRoomSize WRITE setRoomSize) - - // Seconds + Q_PROPERTY(float bandwidth READ getBandwidth WRITE setBandwidth) + Q_PROPERTY(float preDelay READ getPreDelay WRITE setPreDelay) + Q_PROPERTY(float lateDelay READ getLateDelay WRITE setLateDelay) Q_PROPERTY(float reverbTime READ getReverbTime WRITE setReverbTime) - - // Ratio between 0 and 1 - Q_PROPERTY(float damping READ getDamping WRITE setDamping) - - // (?) Does not appear to be set externally very often - Q_PROPERTY(float spread READ getSpread WRITE setSpread) - - // Ratio between 0 and 1 - Q_PROPERTY(float inputBandwidth READ getInputBandwidth WRITE setInputBandwidth) - - // in dB - Q_PROPERTY(float earlyLevel READ getEarlyLevel WRITE setEarlyLevel) - Q_PROPERTY(float tailLevel READ getTailLevel WRITE setTailLevel) - Q_PROPERTY(float dryLevel READ getDryLevel WRITE setDryLevel) - Q_PROPERTY(float wetLevel READ getWetLevel WRITE setWetLevel) + Q_PROPERTY(float earlyDiffusion READ getEarlyDiffusion WRITE setEarlyDiffusion) + Q_PROPERTY(float lateDiffusion READ getLateDiffusion WRITE setLateDiffusion) + Q_PROPERTY(float roomSize READ getRoomSize WRITE setRoomSize) + Q_PROPERTY(float density READ getDensity WRITE setDensity) + Q_PROPERTY(float bassMult READ getBassMult WRITE setBassMult) + Q_PROPERTY(float bassFreq READ getBassFreq WRITE setBassFreq) + Q_PROPERTY(float highGain READ getHighGain WRITE setHighGain) + Q_PROPERTY(float highFreq READ getHighFreq WRITE setHighFreq) + Q_PROPERTY(float modRate READ getModRate WRITE setModRate) + Q_PROPERTY(float modDepth READ getModDepth WRITE setModDepth) + Q_PROPERTY(float earlyGain READ getEarlyGain WRITE setEarlyGain) + Q_PROPERTY(float lateGain READ getLateGain WRITE setLateGain) + Q_PROPERTY(float earlyMixLeft READ getEarlyMixLeft WRITE setEarlyMixLeft) + Q_PROPERTY(float earlyMixRight READ getEarlyMixRight WRITE setEarlyMixRight) + Q_PROPERTY(float lateMixLeft READ getLateMixLeft WRITE setLateMixLeft) + Q_PROPERTY(float lateMixRight READ getLateMixRight WRITE setLateMixRight) + Q_PROPERTY(float wetDryMix READ getWetDryMix WRITE setWetDryMix) public: AudioEffectOptions(QScriptValue arguments = QScriptValue()); @@ -49,60 +47,100 @@ public: static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine); - float getRoomSize() const { return _roomSize; } - void setRoomSize(float roomSize ) { _roomSize = roomSize; } + float getBandwidth() const { return _bandwidth; } + void setBandwidth(float bandwidth) { _bandwidth = bandwidth; } - float getMaxRoomSize() const { return _maxRoomSize; } - void setMaxRoomSize(float maxRoomSize ) { _maxRoomSize = maxRoomSize; } + float getPreDelay() const { return _preDelay; } + void setPreDelay(float preDelay) { _preDelay = preDelay; } + + float getLateDelay() const { return _lateDelay; } + void setLateDelay(float lateDelay) { _lateDelay = lateDelay; } float getReverbTime() const { return _reverbTime; } - void setReverbTime(float reverbTime ) { _reverbTime = reverbTime; } + void setReverbTime(float reverbTime) { _reverbTime = reverbTime; } - float getDamping() const { return _damping; } - void setDamping(float damping ) { _damping = damping; } + float getEarlyDiffusion() const { return _earlyDiffusion; } + void setEarlyDiffusion(float earlyDiffusion) { _earlyDiffusion = earlyDiffusion; } - float getSpread() const { return _spread; } - void setSpread(float spread ) { _spread = spread; } + float getLateDiffusion() const { return _lateDiffusion; } + void setLateDiffusion(float lateDiffusion) { _lateDiffusion = lateDiffusion; } - float getInputBandwidth() const { return _inputBandwidth; } - void setInputBandwidth(float inputBandwidth ) { _inputBandwidth = inputBandwidth; } + float getRoomSize() const { return _roomSize; } + void setRoomSize(float roomSize) { _roomSize = roomSize; } - float getEarlyLevel() const { return _earlyLevel; } - void setEarlyLevel(float earlyLevel ) { _earlyLevel = earlyLevel; } + float getDensity() const { return _density; } + void setDensity(float density) { _density = density; } - float getTailLevel() const { return _tailLevel; } - void setTailLevel(float tailLevel ) { _tailLevel = tailLevel; } + float getBassMult() const { return _bassMult; } + void setBassMult(float bassMult) { _bassMult = bassMult; } - float getDryLevel() const { return _dryLevel; } - void setDryLevel(float dryLevel) { _dryLevel = dryLevel; } + float getBassFreq() const { return _bassFreq; } + void setBassFreq(float bassFreq) { _bassFreq = bassFreq; } - float getWetLevel() const { return _wetLevel; } - void setWetLevel(float wetLevel) { _wetLevel = wetLevel; } + float getHighGain() const { return _highGain; } + void setHighGain(float highGain) { _highGain = highGain; } + + float getHighFreq() const { return _highFreq; } + void setHighFreq(float highFreq) { _highFreq = highFreq; } + + float getModRate() const { return _modRate; } + void setModRate(float modRate) { _modRate = modRate; } + + float getModDepth() const { return _modDepth; } + void setModDepth(float modDepth) { _modDepth = modDepth; } + + float getEarlyGain() const { return _earlyGain; } + void setEarlyGain(float earlyGain) { _earlyGain = earlyGain; } + + float getLateGain() const { return _lateGain; } + void setLateGain(float lateGain) { _lateGain = lateGain; } + + float getEarlyMixLeft() const { return _earlyMixLeft; } + void setEarlyMixLeft(float earlyMixLeft) { _earlyMixLeft = earlyMixLeft; } + + float getEarlyMixRight() const { return _earlyMixRight; } + void setEarlyMixRight(float earlyMixRight) { _earlyMixRight = earlyMixRight; } + + float getLateMixLeft() const { return _lateMixLeft; } + void setLateMixLeft(float lateMixLeft) { _lateMixLeft = lateMixLeft; } + + float getLateMixRight() const { return _lateMixRight; } + void setLateMixRight(float lateMixRight) { _lateMixRight = lateMixRight; } + + float getWetDryMix() const { return _wetDryMix; } + void setWetDryMix(float wetDryMix) { _wetDryMix = wetDryMix; } private: - // http://wiki.audacityteam.org/wiki/GVerb#Instant_Reverberb_settings + float _bandwidth; // [20, 24000] Hz - // Meters Square - float _maxRoomSize; - float _roomSize; + float _preDelay; // [0, 333] ms + float _lateDelay; // [0, 166] ms - // Seconds - float _reverbTime; + float _reverbTime; // [0.1, 100] seconds - // Ratio between 0 and 1 - float _damping; + float _earlyDiffusion; // [0, 100] percent + float _lateDiffusion; // [0, 100] percent - // ? (Does not appear to be set externally very often) - float _spread; + float _roomSize; // [0, 100] percent + float _density; // [0, 100] percent - // Ratio between 0 and 1 - float _inputBandwidth; + float _bassMult; // [0.1, 10] ratio + float _bassFreq; // [10, 500] Hz + float _highGain; // [-24, 0] dB + float _highFreq; // [1000, 12000] Hz - // dB - float _earlyLevel; - float _tailLevel; - float _dryLevel; - float _wetLevel; + float _modRate; // [0.1, 10] Hz + float _modDepth; // [0, 100] percent + + float _earlyGain; // [-96, +24] dB + float _lateGain; // [-96, +24] dB + + float _earlyMixLeft; // [0, 100] percent + float _earlyMixRight; // [0, 100] percent + float _lateMixLeft; // [0, 100] percent + float _lateMixRight; // [0, 100] percent + + float _wetDryMix; // [0, 100] percent }; #endif // hifi_AudioEffectOptions_h From 90ef92c79b95285db630c10c0edabc15a1f6ae42 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Mon, 7 Dec 2015 13:34:55 -0800 Subject: [PATCH 23/34] Fix slider layout --- examples/utilities/tools/reverbTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/utilities/tools/reverbTest.js b/examples/utilities/tools/reverbTest.js index 2b08073ae0..a7a6bad9d7 100644 --- a/examples/utilities/tools/reverbTest.js +++ b/examples/utilities/tools/reverbTest.js @@ -39,7 +39,7 @@ AudioDevice.setReverbOptions(audioOptions); AudioDevice.setReverb(true); print("Reverb is ON."); -var panel = new Panel(10, 150); +var panel = new Panel(10, 160); var parameters = [ { name: "bandwidth", min: 1000, max: 12000, units: " Hz" }, From 86db12acae1c8eaf93674dbe1d76c6d75a2becfe Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Mon, 7 Dec 2015 14:03:11 -0800 Subject: [PATCH 24/34] Fix naming clash with reserved word --- libraries/audio/src/AudioEffectOptions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/audio/src/AudioEffectOptions.cpp b/libraries/audio/src/AudioEffectOptions.cpp index 792799b776..758875e896 100644 --- a/libraries/audio/src/AudioEffectOptions.cpp +++ b/libraries/audio/src/AudioEffectOptions.cpp @@ -54,8 +54,8 @@ static const float LATE_MIX_LEFT_DEFAULT = 90.0f; static const float LATE_MIX_RIGHT_DEFAULT = 90.0f; static const float WET_DRY_MIX_DEFAULT = 50.0f; -static void setOption(QScriptValue arguments, const QString name, float default, float& var) { - var = arguments.property(name).isNumber() ? arguments.property(name).toNumber() : default; +static void setOption(QScriptValue arguments, const QString name, float defaultValue, float& variable) { + variable = arguments.property(name).isNumber() ? arguments.property(name).toNumber() : defaultValue; } AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) { From 0bf276efa59fcae851979aa3e1295f546fe2964a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 7 Dec 2015 14:37:35 -0800 Subject: [PATCH 25/34] adjust method names to fit convention --- interface/src/avatar/Avatar.h | 4 ++-- libraries/avatars/src/AvatarData.h | 4 ++-- libraries/entities/src/EntityScriptingInterface.cpp | 8 ++++---- libraries/entities/src/EntityScriptingInterface.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index d26a02d815..99a4fc52a9 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -158,8 +158,8 @@ public: void setMotionState(AvatarMotionState* motionState) { _motionState = motionState; } AvatarMotionState* getMotionState() { return _motionState; } - virtual void setPosition(const glm::vec3& position); - virtual void setOrientation(const glm::quat& orientation); + virtual void setPosition(const glm::vec3& position) override; + virtual void setOrientation(const glm::quat& orientation) override; public slots: diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 67cf6624d4..1fa33ff606 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -201,8 +201,8 @@ public: float getBodyRoll() const; void setBodyRoll(float bodyRoll); - virtual void setPosition(const glm::vec3& position); - virtual void setOrientation(const glm::quat& orientation); + virtual void setPosition(const glm::vec3& position) override; + virtual void setOrientation(const glm::quat& orientation) override; void nextAttitude(glm::vec3 position, glm::quat orientation); // Can be safely called at any time. void startCapture(); // start/end of the period in which the latest values are about to be captured for camera, etc. diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index a417e094a0..f97e904423 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -806,19 +806,19 @@ glm::vec3 EntityScriptingInterface::localCoordsToVoxelCoords(const QUuid& entity } } -glm::vec3 EntityScriptingInterface::getJointTranslation(const QUuid& entityID, int jointIndex) { +glm::vec3 EntityScriptingInterface::getAbsoluteJointTranslationInObjectFrame(const QUuid& entityID, int jointIndex) { if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { auto modelEntity = std::dynamic_pointer_cast(entity); - return modelEntity->getJointTranslation(jointIndex); + return modelEntity->getAbsoluteJointTranslationInObjectFrame(jointIndex); } else { return glm::vec3(0.0f); } } -glm::quat EntityScriptingInterface::getJointRotation(const QUuid& entityID, int jointIndex) { +glm::quat EntityScriptingInterface::getAbsoluteJointRotationInObjectFrame(const QUuid& entityID, int jointIndex) { if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { auto modelEntity = std::dynamic_pointer_cast(entity); - return modelEntity->getJointRotation(jointIndex); + return modelEntity->getAbsoluteJointRotationInObjectFrame(jointIndex); } else { return glm::quat(); } diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 5e1d81583e..f745b6b644 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -148,9 +148,9 @@ public slots: Q_INVOKABLE glm::vec3 worldCoordsToVoxelCoords(const QUuid& entityID, glm::vec3 worldCoords); Q_INVOKABLE glm::vec3 voxelCoordsToLocalCoords(const QUuid& entityID, glm::vec3 voxelCoords); Q_INVOKABLE glm::vec3 localCoordsToVoxelCoords(const QUuid& entityID, glm::vec3 localCoords); - - Q_INVOKABLE glm::vec3 getJointTranslation(const QUuid& entityID, int jointIndex); - Q_INVOKABLE glm::quat getJointRotation(const QUuid& entityID, int jointIndex); + + Q_INVOKABLE glm::vec3 getAbsoluteJointTranslationInObjectFrame(const QUuid& entityID, int jointIndex); + Q_INVOKABLE glm::quat getAbsoluteJointRotationInObjectFrame(const QUuid& entityID, int jointIndex); signals: void collisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision); From 44d740ef571148912ce233c63bb1e8d7c76d5f73 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 8 Dec 2015 09:22:02 -0800 Subject: [PATCH 26/34] Remove unused variable 'addr' --- libraries/networking/src/PacketReceiver.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/networking/src/PacketReceiver.cpp b/libraries/networking/src/PacketReceiver.cpp index 7e91a42a64..a162ba72c8 100644 --- a/libraries/networking/src/PacketReceiver.cpp +++ b/libraries/networking/src/PacketReceiver.cpp @@ -297,7 +297,6 @@ void PacketReceiver::handleVerifiedMessage(QSharedPointer recei emit dataReceived(matchingNode->getType(), receivedMessage->getSize()); matchingNode->recordBytesReceived(receivedMessage->getSize()); Node* n = matchingNode.data(); - auto addr = n->getActiveSocket(); QMetaMethod metaMethod = listener.method; From 71c266bc00e6e997eae0eba898efd65d99abc222 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 8 Dec 2015 09:22:17 -0800 Subject: [PATCH 27/34] Fix order of initializion in ReceivedMessage --- libraries/networking/src/ReceivedMessage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/ReceivedMessage.cpp b/libraries/networking/src/ReceivedMessage.cpp index f383257520..651b856923 100644 --- a/libraries/networking/src/ReceivedMessage.cpp +++ b/libraries/networking/src/ReceivedMessage.cpp @@ -22,8 +22,8 @@ static const int HEAD_DATA_SIZE = 512; ReceivedMessage::ReceivedMessage(const NLPacketList& packetList) : _data(packetList.getMessage()), _headData(_data.mid(0, HEAD_DATA_SIZE)), - _sourceID(packetList.getSourceID()), _numPackets(packetList.getNumPackets()), + _sourceID(packetList.getSourceID()), _packetType(packetList.getType()), _packetVersion(packetList.getVersion()), _senderSockAddr(packetList.getSenderSockAddr()), @@ -34,8 +34,8 @@ ReceivedMessage::ReceivedMessage(const NLPacketList& packetList) ReceivedMessage::ReceivedMessage(NLPacket& packet) : _data(packet.readAll()), _headData(_data.mid(0, HEAD_DATA_SIZE)), - _sourceID(packet.getSourceID()), _numPackets(1), + _sourceID(packet.getSourceID()), _packetType(packet.getType()), _packetVersion(packet.getVersion()), _senderSockAddr(packet.getSenderSockAddr()), From 0759462df714c865e897da07a42e99b9c65c008e Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 8 Dec 2015 09:38:23 -0800 Subject: [PATCH 28/34] Remove unused variable in PacketReceiver --- libraries/networking/src/PacketReceiver.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/networking/src/PacketReceiver.cpp b/libraries/networking/src/PacketReceiver.cpp index a162ba72c8..530efc5fb3 100644 --- a/libraries/networking/src/PacketReceiver.cpp +++ b/libraries/networking/src/PacketReceiver.cpp @@ -296,7 +296,6 @@ void PacketReceiver::handleVerifiedMessage(QSharedPointer recei if (matchingNode) { emit dataReceived(matchingNode->getType(), receivedMessage->getSize()); matchingNode->recordBytesReceived(receivedMessage->getSize()); - Node* n = matchingNode.data(); QMetaMethod metaMethod = listener.method; From ec9f1e0754c165bcc06d375b88b12e09c330856c Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 8 Dec 2015 09:44:43 -0800 Subject: [PATCH 29/34] possible fix for crash when grabbing bubblewand --- libraries/entities/src/EntityScriptingInterface.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index f97e904423..a0a6719521 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -206,10 +206,13 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& // All of parentID, parentJointIndex, position, rotation are needed to make sense of any of them. // If any of these changed, pull any missing properties from the entity. EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); - if (entity && !scriptSideProperties.parentIDChanged()) { + if (!entity) { + return; + } + if (!scriptSideProperties.parentIDChanged()) { properties.setParentID(entity->getParentID()); } - if (entity && !scriptSideProperties.parentJointIndexChanged()) { + if (!scriptSideProperties.parentJointIndexChanged()) { properties.setParentJointIndex(entity->getParentJointIndex()); } if (!scriptSideProperties.localPositionChanged() && !scriptSideProperties.positionChanged()) { From eeebe0622851ee5e6090143e66b728838524527c Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Tue, 8 Dec 2015 10:54:42 -0800 Subject: [PATCH 30/34] Using CPACK_PACKAGE_EXECUTABLES instead of CPACK_NSIS_CREATE_ICONS_EXTRE --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b44f81d2f..9e47d38067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,10 +229,10 @@ if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment) - set (ICONPATH_INTERFACE "$INSTDIR/${PATH_INSTALL_DATA}/interface.ico") - set (ICONPATH_STACK_MANAGER "$INSTDIR/${PATH_INSTALL_DATA}/stack-manager.ico") - string (REPLACE "/" "\\\\" ICONPATH_INTERFACE ${ICONPATH_INTERFACE}) - string (REPLACE "/" "\\\\" ICONPATH_STACK_MANAGER ${ICONPATH_STACK_MANAGER}) + set(ICONPATH_INTERFACE "$INSTDIR/${PATH_INSTALL_DATA}/interface.ico") + set(ICONPATH_STACK_MANAGER "$INSTDIR/${PATH_INSTALL_DATA}/stack-manager.ico") + string(REPLACE "/" "\\\\" ICONPATH_INTERFACE ${ICONPATH_INTERFACE}) + string(REPLACE "/" "\\\\" ICONPATH_STACK_MANAGER ${ICONPATH_STACK_MANAGER}) set(CPACK_PACKAGE_NAME "High Fidelity") set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc") @@ -242,8 +242,10 @@ if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity-${BUILD_SEQ}") - set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Interface.lnk' '$INSTDIR\\\\interface.exe' '${ICONPATH_INTERFACE}'") - set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Stack Manager.lnk' '$INSTDIR\\\\stack-manager.exe' '${ICONPATH_STACK_MANAGER}'") + set(CPACK_PACKAGE_EXECUTABLES + stack-manager "Stack Manager" + interface "Interface" + ) if (WIN32) install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./") From 011a43d5f214243e00b3feee613d6028299f977e Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Tue, 8 Dec 2015 11:08:22 -0800 Subject: [PATCH 31/34] Add sphere and cube triangle counts to displayed stats --- .../src/RenderableBoxEntityItem.cpp | 5 ++++- .../src/RenderableSphereEntityItem.cpp | 4 +++- libraries/render-utils/src/GeometryCache.cpp | 14 ++++++++++++++ libraries/render-utils/src/GeometryCache.h | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp b/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp index 588f17d959..54fe491c46 100644 --- a/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp @@ -41,6 +41,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) { Q_ASSERT(getType() == EntityTypes::Box); Q_ASSERT(args->_batch); + if (!_procedural) { _procedural.reset(new Procedural(this->getUserData())); _procedural->_vertexSource = simple_vert; @@ -64,4 +65,6 @@ void RenderableBoxEntityItem::render(RenderArgs* args) { } else { DependencyManager::get()->renderSolidCubeInstance(batch, getTransformToCenter(), cubeColor); } -}; + static const auto triCount = DependencyManager::get()->getCubeTriangleCount(); + args->_details._trianglesRendered += triCount; +} diff --git a/libraries/entities-renderer/src/RenderableSphereEntityItem.cpp b/libraries/entities-renderer/src/RenderableSphereEntityItem.cpp index 2bdcfc19ad..8768e41a07 100644 --- a/libraries/entities-renderer/src/RenderableSphereEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableSphereEntityItem.cpp @@ -71,4 +71,6 @@ void RenderableSphereEntityItem::render(RenderArgs* args) { batch.setModelTransform(Transform()); DependencyManager::get()->renderSolidSphereInstance(batch, modelTransform, sphereColor); } -}; + static const auto triCount = DependencyManager::get()->getSphereTriangleCount(); + args->_details._trianglesRendered += triCount; +} diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 75b3b91c10..b9fdcd95a4 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -214,6 +214,19 @@ VertexVector tesselate(const VertexVector& startingTriangles, int count) { return triangles; } +size_t GeometryCache::getShapeTriangleCount(Shape shape) { + return _shapes[shape]._indexCount / VERTICES_PER_TRIANGLE; +} + +size_t GeometryCache::getSphereTriangleCount() { + return getShapeTriangleCount(Sphere); +} + +size_t GeometryCache::getCubeTriangleCount() { + return getShapeTriangleCount(Cube); +} + + // FIXME solids need per-face vertices, but smooth shaded // components do not. Find a way to support using draw elements // or draw arrays as appropriate @@ -1727,3 +1740,4 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { batch.setPipeline(_standardDrawPipeline); } } + diff --git a/libraries/render-utils/src/GeometryCache.h b/libraries/render-utils/src/GeometryCache.h index aa1593db78..c408115011 100644 --- a/libraries/render-utils/src/GeometryCache.h +++ b/libraries/render-utils/src/GeometryCache.h @@ -151,16 +151,19 @@ public: void renderWireShapeInstances(gpu::Batch& batch, Shape shape, size_t count, gpu::BufferPointer& transformBuffer, gpu::BufferPointer& colorBuffer); void renderShape(gpu::Batch& batch, Shape shape); void renderWireShape(gpu::Batch& batch, Shape shape); + size_t getShapeTriangleCount(Shape shape); void renderCubeInstances(gpu::Batch& batch, size_t count, gpu::BufferPointer transformBuffer, gpu::BufferPointer colorBuffer); void renderWireCubeInstances(gpu::Batch& batch, size_t count, gpu::BufferPointer transformBuffer, gpu::BufferPointer colorBuffer); void renderCube(gpu::Batch& batch); void renderWireCube(gpu::Batch& batch); + size_t getCubeTriangleCount(); void renderSphereInstances(gpu::Batch& batch, size_t count, gpu::BufferPointer transformBuffer, gpu::BufferPointer colorBuffer); void renderWireSphereInstances(gpu::Batch& batch, size_t count, gpu::BufferPointer transformBuffer, gpu::BufferPointer colorBuffer); void renderSphere(gpu::Batch& batch); void renderWireSphere(gpu::Batch& batch); + size_t getSphereTriangleCount(); void renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions, const glm::vec4& color); void renderGrid(gpu::Batch& batch, int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id = UNKNOWN_ID); From cc6d30fe6f867080e61901588a023add803fecb7 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Tue, 8 Dec 2015 13:06:10 -0800 Subject: [PATCH 32/34] Fix to path setting in shortcuts --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e47d38067..ab88e9e46a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,6 +242,7 @@ if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity-${BUILD_SEQ}") + set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") set(CPACK_PACKAGE_EXECUTABLES stack-manager "Stack Manager" interface "Interface" @@ -252,4 +253,4 @@ if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE) endif (WIN32) include(CPack) -endif () \ No newline at end of file +endif () From 9062cca8c474d83f33bc6fecfcd0a5c2e7e583ff Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Tue, 8 Dec 2015 13:33:15 -0800 Subject: [PATCH 33/34] Restoring --- interface/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 1adb00fe5f..3db23e4d36 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -201,7 +201,7 @@ else (APPLE) # link target to external libraries if (WIN32) - target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib) + #target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib) else (WIN32) # Nothing else required on linux apparently endif() From 9ba5670c7611f8c09ff44bf47658778c735018e8 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Tue, 8 Dec 2015 14:20:19 -0800 Subject: [PATCH 34/34] Fix --- interface/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 4332ae24be..0baf709082 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -194,7 +194,7 @@ else (APPLE) # link target to external libraries if (WIN32) - #target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib) + target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib) else (WIN32) # Nothing else required on linux apparently endif()