mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
Merge branch 'protocol' of github.com:birarda/hifi into asset-hash
This commit is contained in:
commit
8eeb808572
140 changed files with 968 additions and 663 deletions
|
@ -19,6 +19,4 @@ endif (UNIX)
|
||||||
|
|
||||||
include_application_version()
|
include_application_version()
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
copy_dlls_beside_windows_executable()
|
copy_dlls_beside_windows_executable()
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
|
|
||||||
|
|
||||||
EntityActionPointer assignmentActionFactory(EntityActionType type, const QUuid& id, EntityItemPointer ownerEntity) {
|
EntityActionPointer assignmentActionFactory(EntityActionType type, const QUuid& id, EntityItemPointer ownerEntity) {
|
||||||
return (EntityActionPointer) new AssignmentAction(type, id, ownerEntity);
|
return EntityActionPointer(new AssignmentAction(type, id, ownerEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityActionPointer AssignmentActionFactory::factory(EntityActionType type,
|
EntityActionPointer AssignmentActionFactory::factory(EntityActionType type,
|
||||||
const QUuid& id,
|
const QUuid& id,
|
||||||
EntityItemPointer ownerEntity,
|
EntityItemPointer ownerEntity,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetServer.cpp
|
// AssetServer.cpp
|
||||||
|
// assignment-client/src/assets
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/21
|
// Created by Ryan Huffman on 2015/07/21
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetServer.h
|
// AssetServer.h
|
||||||
|
// assignment-client/src/assets
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/21
|
// Created by Ryan Huffman on 2015/07/21
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// SendAssetTask.cpp
|
// SendAssetTask.cpp
|
||||||
|
// assignment-client/src/assets
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/08/26
|
// Created by Ryan Huffman on 2015/08/26
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// SendAssetTask.h
|
// SendAssetTask.h
|
||||||
|
// assignment-client/src/assets
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/08/26
|
// Created by Ryan Huffman on 2015/08/26
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -131,9 +131,6 @@ void OctreeInboundPacketProcessor::processPacket(QSharedPointer<NLPacket> packet
|
||||||
qDebug() << " numBytesPacketHeader=" << NLPacket::totalHeaderSize(packetType);
|
qDebug() << " numBytesPacketHeader=" << NLPacket::totalHeaderSize(packetType);
|
||||||
qDebug() << " sizeof(sequence)=" << sizeof(sequence);
|
qDebug() << " sizeof(sequence)=" << sizeof(sequence);
|
||||||
qDebug() << " sizeof(sentAt)=" << sizeof(sentAt);
|
qDebug() << " sizeof(sentAt)=" << sizeof(sentAt);
|
||||||
}
|
|
||||||
|
|
||||||
if (debugProcessPacket) {
|
|
||||||
qDebug() << " atByte (in payload)=" << packet->pos();
|
qDebug() << " atByte (in payload)=" << packet->pos();
|
||||||
qDebug() << " payload size=" << packet->getPayloadSize();
|
qDebug() << " payload size=" << packet->getPayloadSize();
|
||||||
|
|
||||||
|
|
|
@ -643,7 +643,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
quint64 averageLoggingTime = _tree->getAverageLoggingTime();
|
quint64 averageLoggingTime = _tree->getAverageLoggingTime();
|
||||||
|
|
||||||
|
|
||||||
float averageElementsPerPacket = totalPacketsProcessed == 0 ? 0 : totalElementsProcessed / totalPacketsProcessed;
|
float averageElementsPerPacket = totalPacketsProcessed == 0 ? 0 : (float)totalElementsProcessed / totalPacketsProcessed;
|
||||||
|
|
||||||
statsString += QString(" Current Inbound Packets Queue: %1 packets\r\n")
|
statsString += QString(" Current Inbound Packets Queue: %1 packets\r\n")
|
||||||
.arg(locale.toString((uint)currentPacketsInQueue).rightJustified(COLUMN_WIDTH, ' '));
|
.arg(locale.toString((uint)currentPacketsInQueue).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
|
@ -695,7 +695,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
totalElementsProcessed = senderStats.getTotalElementsProcessed();
|
totalElementsProcessed = senderStats.getTotalElementsProcessed();
|
||||||
totalPacketsProcessed = senderStats.getTotalPacketsProcessed();
|
totalPacketsProcessed = senderStats.getTotalPacketsProcessed();
|
||||||
|
|
||||||
averageElementsPerPacket = totalPacketsProcessed == 0 ? 0 : totalElementsProcessed / totalPacketsProcessed;
|
averageElementsPerPacket = totalPacketsProcessed == 0 ? 0 : (float)totalElementsProcessed / totalPacketsProcessed;
|
||||||
|
|
||||||
statsString += QString(" Total Inbound Packets: %1 packets\r\n")
|
statsString += QString(" Total Inbound Packets: %1 packets\r\n")
|
||||||
.arg(locale.toString((uint)totalPacketsProcessed).rightJustified(COLUMN_WIDTH, ' '));
|
.arg(locale.toString((uint)totalPacketsProcessed).rightJustified(COLUMN_WIDTH, ' '));
|
||||||
|
@ -1075,9 +1075,7 @@ void OctreeServer::run() {
|
||||||
// now set up PersistThread
|
// now set up PersistThread
|
||||||
_persistThread = new OctreePersistThread(_tree, _persistFilename, _persistInterval,
|
_persistThread = new OctreePersistThread(_tree, _persistFilename, _persistInterval,
|
||||||
_wantBackup, _settings, _debugTimestampNow, _persistAsFileType);
|
_wantBackup, _settings, _debugTimestampNow, _persistAsFileType);
|
||||||
if (_persistThread) {
|
_persistThread->initialize(true);
|
||||||
_persistThread->initialize(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiSockAddr senderSockAddr;
|
HifiSockAddr senderSockAddr;
|
||||||
|
|
|
@ -33,4 +33,7 @@ macro(LINK_HIFI_LIBRARIES)
|
||||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES ${LINKED_TARGET_DEPENDENCY_INCLUDES})
|
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES ${LINKED_TARGET_DEPENDENCY_INCLUDES})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
setup_memory_debugger()
|
||||||
|
|
||||||
endmacro(LINK_HIFI_LIBRARIES)
|
endmacro(LINK_HIFI_LIBRARIES)
|
|
@ -15,6 +15,8 @@ macro(SETUP_HIFI_LIBRARY)
|
||||||
file(GLOB_RECURSE LIB_SRCS "src/*.h" "src/*.cpp" "src/*.c")
|
file(GLOB_RECURSE LIB_SRCS "src/*.h" "src/*.cpp" "src/*.c")
|
||||||
list(APPEND ${TARGET_NAME}_SRCS ${LIB_SRCS})
|
list(APPEND ${TARGET_NAME}_SRCS ${LIB_SRCS})
|
||||||
|
|
||||||
|
setup_memory_debugger()
|
||||||
|
|
||||||
# create a library and set the property so it can be referenced later
|
# create a library and set the property so it can be referenced later
|
||||||
if (${${TARGET_NAME}_SHARED})
|
if (${${TARGET_NAME}_SHARED})
|
||||||
add_library(${TARGET_NAME} SHARED ${LIB_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC} ${QT_RESOURCES_FILE})
|
add_library(${TARGET_NAME} SHARED ${LIB_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC} ${QT_RESOURCES_FILE})
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME domain-server)
|
set(TARGET_NAME domain-server)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG AND NOT WIN32)
|
if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG AND NOT WIN32)
|
||||||
set(_SHOULD_SYMLINK_RESOURCES TRUE)
|
set(_SHOULD_SYMLINK_RESOURCES TRUE)
|
||||||
else ()
|
else ()
|
||||||
|
|
|
@ -288,11 +288,11 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
packetReceiver.registerListener(PacketType::DomainListRequest, this, "processListRequestPacket");
|
packetReceiver.registerListener(PacketType::DomainListRequest, this, "processListRequestPacket");
|
||||||
packetReceiver.registerListener(PacketType::DomainServerPathQuery, this, "processPathQueryPacket");
|
packetReceiver.registerListener(PacketType::DomainServerPathQuery, this, "processPathQueryPacket");
|
||||||
packetReceiver.registerListener(PacketType::NodeJsonStats, this, "processNodeJSONStatsPacket");
|
packetReceiver.registerListener(PacketType::NodeJsonStats, this, "processNodeJSONStatsPacket");
|
||||||
|
|
||||||
// NodeList won't be available to the settings manager when it is created, so call registerListener here
|
// NodeList won't be available to the settings manager when it is created, so call registerListener here
|
||||||
packetReceiver.registerListener(PacketType::DomainSettingsRequest, &_settingsManager, "processSettingsRequestPacket");
|
packetReceiver.registerListener(PacketType::DomainSettingsRequest, &_settingsManager, "processSettingsRequestPacket");
|
||||||
|
|
||||||
// register the gatekeeper for the packetes it needs to receive
|
// register the gatekeeper for the packets it needs to receive
|
||||||
packetReceiver.registerListener(PacketType::DomainConnectRequest, &_gatekeeper, "processConnectRequestPacket");
|
packetReceiver.registerListener(PacketType::DomainConnectRequest, &_gatekeeper, "processConnectRequestPacket");
|
||||||
packetReceiver.registerListener(PacketType::ICEPing, &_gatekeeper, "processICEPingPacket");
|
packetReceiver.registerListener(PacketType::ICEPing, &_gatekeeper, "processICEPingPacket");
|
||||||
packetReceiver.registerListener(PacketType::ICEPingReply, &_gatekeeper, "processICEPingReplyPacket");
|
packetReceiver.registerListener(PacketType::ICEPingReply, &_gatekeeper, "processICEPingReplyPacket");
|
||||||
|
@ -573,7 +573,6 @@ void DomainServer::populateDefaultStaticAssignmentsExcludingTypes(const QSet<Ass
|
||||||
&& defaultedType != Assignment::UNUSED_1
|
&& defaultedType != Assignment::UNUSED_1
|
||||||
&& defaultedType != Assignment::AgentType) {
|
&& defaultedType != Assignment::AgentType) {
|
||||||
|
|
||||||
|
|
||||||
if (defaultedType == Assignment::AssetServerType) {
|
if (defaultedType == Assignment::AssetServerType) {
|
||||||
// Make sure the asset-server is enabled before adding it here.
|
// Make sure the asset-server is enabled before adding it here.
|
||||||
// Initially we do not assign it by default so we can test it in HF domains first
|
// Initially we do not assign it by default so we can test it in HF domains first
|
||||||
|
|
|
@ -39,10 +39,11 @@
|
||||||
this.entity = Entities.addEntity({ type: "ParticleEffect",
|
this.entity = Entities.addEntity({ type: "ParticleEffect",
|
||||||
animationSettings: animationSettings,
|
animationSettings: animationSettings,
|
||||||
position: spawnPoint,
|
position: spawnPoint,
|
||||||
textures: "http://www.hyperlogic.org/images/particle.png",
|
dimensions: {x: 2, y: 2, z: 2},
|
||||||
emitRate: emitRate,
|
emitVelocity: {x: 0, y: 5, z: 0},
|
||||||
emitStrength: emitStrength,
|
velocitySpread: {x: 2, y: 0, z: 2},
|
||||||
emitDirection: emitDirection,
|
emitAcceleration: {x: 0, y: -9.8, z: 0},
|
||||||
|
textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png",
|
||||||
color: color,
|
color: color,
|
||||||
lifespan: 1.0,
|
lifespan: 1.0,
|
||||||
visible: true,
|
visible: true,
|
||||||
|
|
|
@ -88,6 +88,4 @@ if (ANDROID)
|
||||||
|
|
||||||
endif (ANDROID)
|
endif (ANDROID)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
copy_dlls_beside_windows_executable()
|
copy_dlls_beside_windows_executable()
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME ice-server)
|
set(TARGET_NAME ice-server)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# setup the project and link required Qt modules
|
# setup the project and link required Qt modules
|
||||||
setup_hifi_project(Network)
|
setup_hifi_project(Network)
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,4 @@ else (APPLE)
|
||||||
endif()
|
endif()
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
copy_dlls_beside_windows_executable()
|
copy_dlls_beside_windows_executable()
|
||||||
|
|
Binary file not shown.
|
@ -185,4 +185,26 @@ Hifi.VrMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addMenu(menu, newMenu) {
|
||||||
|
return menu.addMenu(newMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItem(menu, newMenuItem) {
|
||||||
|
return menu.addItem(newMenuItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertItem(menu, beforeItem, newMenuItem) {
|
||||||
|
for (var i = 0; i < menu.items.length; ++i) {
|
||||||
|
console.log(menu.items[i]);
|
||||||
|
if (menu.items[i] === beforeItem) {
|
||||||
|
return menu.insertItem(i, newMenuItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addItem(menu, newMenuItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeItem(menu, menuItem) {
|
||||||
|
menu.removeItem(menuItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
#include <RenderableWebEntityItem.h>
|
#include <RenderableWebEntityItem.h>
|
||||||
|
|
||||||
#include "AudioClient.h"
|
#include "AudioClient.h"
|
||||||
|
#include "CrashHandler.h"
|
||||||
#include "DiscoverabilityManager.h"
|
#include "DiscoverabilityManager.h"
|
||||||
#include "GLCanvas.h"
|
#include "GLCanvas.h"
|
||||||
#include "LODManager.h"
|
#include "LODManager.h"
|
||||||
|
@ -190,6 +191,11 @@ static QTimer* billboardPacketTimer = NULL;
|
||||||
static QTimer* checkFPStimer = NULL;
|
static QTimer* checkFPStimer = NULL;
|
||||||
static QTimer* idleTimer = NULL;
|
static QTimer* idleTimer = NULL;
|
||||||
|
|
||||||
|
static const unsigned int TARGET_SIM_FRAMERATE = 60;
|
||||||
|
static const unsigned int THROTTLED_SIM_FRAMERATE = 15;
|
||||||
|
static const int TARGET_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / TARGET_SIM_FRAMERATE;
|
||||||
|
static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE;
|
||||||
|
|
||||||
const QString CHECK_VERSION_URL = "https://highfidelity.com/latestVersion.xml";
|
const QString CHECK_VERSION_URL = "https://highfidelity.com/latestVersion.xml";
|
||||||
const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion";
|
const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion";
|
||||||
|
|
||||||
|
@ -258,6 +264,12 @@ bool setupEssentials(int& argc, char** argv) {
|
||||||
// Set build version
|
// Set build version
|
||||||
QCoreApplication::setApplicationVersion(BUILD_VERSION);
|
QCoreApplication::setApplicationVersion(BUILD_VERSION);
|
||||||
|
|
||||||
|
Setting::preInit();
|
||||||
|
|
||||||
|
CrashHandler::checkForAndHandleCrash();
|
||||||
|
CrashHandler::writeRunningMarkerFiler();
|
||||||
|
qAddPostRoutine(CrashHandler::deleteRunningMarkerFile);
|
||||||
|
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
|
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
|
||||||
DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
|
DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
|
||||||
|
@ -349,7 +361,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_trayIcon(new QSystemTrayIcon(_window)),
|
_trayIcon(new QSystemTrayIcon(_window)),
|
||||||
_lastNackTime(usecTimestampNow()),
|
_lastNackTime(usecTimestampNow()),
|
||||||
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
||||||
_isVSyncOn(true),
|
|
||||||
_isThrottleFPSEnabled(true),
|
_isThrottleFPSEnabled(true),
|
||||||
_aboutToQuit(false),
|
_aboutToQuit(false),
|
||||||
_notifiedPacketVersionMismatchThisDomain(false),
|
_notifiedPacketVersionMismatchThisDomain(false),
|
||||||
|
@ -757,8 +768,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
|
connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
|
||||||
|
|
||||||
setVSyncEnabled(); // make sure VSync is set properly at startup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::aboutToQuit() {
|
void Application::aboutToQuit() {
|
||||||
|
@ -932,7 +941,7 @@ void Application::initializeGL() {
|
||||||
// call our idle function whenever we can
|
// call our idle function whenever we can
|
||||||
idleTimer = new QTimer(this);
|
idleTimer = new QTimer(this);
|
||||||
connect(idleTimer, SIGNAL(timeout()), SLOT(idle()));
|
connect(idleTimer, SIGNAL(timeout()), SLOT(idle()));
|
||||||
idleTimer->start(0);
|
idleTimer->start(TARGET_SIM_FRAME_PERIOD_MS);
|
||||||
_idleLoopStdev.reset();
|
_idleLoopStdev.reset();
|
||||||
|
|
||||||
if (_justStarted) {
|
if (_justStarted) {
|
||||||
|
@ -1439,7 +1448,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
||||||
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
break;
|
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
if (isOption) {
|
if (isOption) {
|
||||||
|
@ -2047,38 +2055,38 @@ void Application::checkFPS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::idle() {
|
void Application::idle() {
|
||||||
PROFILE_RANGE(__FUNCTION__);
|
|
||||||
static SimpleAverage<float> interIdleDurations;
|
|
||||||
|
|
||||||
static uint64_t lastIdleStart{ 0 };
|
|
||||||
static uint64_t lastIdleEnd{ 0 };
|
|
||||||
uint64_t now = usecTimestampNow();
|
|
||||||
uint64_t idleStartToStartDuration = now - lastIdleStart;
|
|
||||||
|
|
||||||
if (lastIdleStart > 0 && idleStartToStartDuration > 0) {
|
|
||||||
_simsPerSecond.updateAverage((float)USECS_PER_SECOND / (float)idleStartToStartDuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastIdleStart = now;
|
|
||||||
|
|
||||||
if (lastIdleEnd != 0) {
|
|
||||||
interIdleDurations.update(now - lastIdleEnd);
|
|
||||||
static uint64_t lastReportTime = now;
|
|
||||||
if ((now - lastReportTime) >= (USECS_PER_SECOND)) {
|
|
||||||
static QString LOGLINE("Average inter-idle time: %1 us for %2 samples");
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::LogExtraTimings)) {
|
|
||||||
qCDebug(interfaceapp_timing) << LOGLINE.arg((int)interIdleDurations.getAverage()).arg(interIdleDurations.getCount());
|
|
||||||
}
|
|
||||||
interIdleDurations.reset();
|
|
||||||
lastReportTime = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PerformanceTimer perfTimer("idle");
|
|
||||||
if (_aboutToQuit) {
|
if (_aboutToQuit) {
|
||||||
return; // bail early, nothing to do here.
|
return; // bail early, nothing to do here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// depending on whether we're throttling or not.
|
||||||
|
// Once rendering is off on another thread we should be able to have Application::idle run at start(0) in
|
||||||
|
// perpetuity and not expect events to get backed up.
|
||||||
|
bool isThrottled = getActiveDisplayPlugin()->isThrottled();
|
||||||
|
// Only run simulation code if more than the targetFramePeriod have passed since last time we ran
|
||||||
|
// This attempts to lock the simulation at 60 updates per second, regardless of framerate
|
||||||
|
float timeSinceLastUpdateUs = (float)_lastTimeUpdated.nsecsElapsed() / NSECS_PER_USEC;
|
||||||
|
float secondsSinceLastUpdate = timeSinceLastUpdateUs / USECS_PER_SECOND;
|
||||||
|
|
||||||
|
if (isThrottled && (timeSinceLastUpdateUs / USECS_PER_MSEC) < THROTTLED_SIM_FRAME_PERIOD_MS) {
|
||||||
|
return; // bail early, we're throttled and not enough time has elapsed
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastTimeUpdated.start();
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
|
uint64_t now = usecTimestampNow();
|
||||||
|
static uint64_t lastIdleStart{ now };
|
||||||
|
uint64_t idleStartToStartDuration = now - lastIdleStart;
|
||||||
|
if (idleStartToStartDuration != 0) {
|
||||||
|
_simsPerSecond.updateAverage((float)USECS_PER_SECOND / (float)idleStartToStartDuration);
|
||||||
|
}
|
||||||
|
lastIdleStart = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformanceTimer perfTimer("idle");
|
||||||
// Drop focus from _keyboardFocusedItem if no keyboard messages for 30 seconds
|
// Drop focus from _keyboardFocusedItem if no keyboard messages for 30 seconds
|
||||||
if (!_keyboardFocusedItem.isInvalidID()) {
|
if (!_keyboardFocusedItem.isInvalidID()) {
|
||||||
const quint64 LOSE_FOCUS_AFTER_ELAPSED_TIME = 30 * USECS_PER_SECOND; // if idle for 30 seconds, drop focus
|
const quint64 LOSE_FOCUS_AFTER_ELAPSED_TIME = 30 * USECS_PER_SECOND; // if idle for 30 seconds, drop focus
|
||||||
|
@ -2094,69 +2102,42 @@ void Application::idle() {
|
||||||
bool showWarnings = getLogger()->extraDebugging();
|
bool showWarnings = getLogger()->extraDebugging();
|
||||||
PerformanceWarning warn(showWarnings, "idle()");
|
PerformanceWarning warn(showWarnings, "idle()");
|
||||||
|
|
||||||
// Only run simulation code if more than the targetFramePeriod have passed since last time we ran
|
{
|
||||||
double targetFramePeriod = 0.0;
|
PerformanceTimer perfTimer("update");
|
||||||
unsigned int targetFramerate = getRenderTargetFramerate();
|
PerformanceWarning warn(showWarnings, "Application::idle()... update()");
|
||||||
if (targetFramerate > 0) {
|
static const float BIGGEST_DELTA_TIME_SECS = 0.25f;
|
||||||
targetFramePeriod = 1000.0 / targetFramerate;
|
update(glm::clamp(secondsSinceLastUpdate, 0.0f, BIGGEST_DELTA_TIME_SECS));
|
||||||
}
|
}
|
||||||
double timeSinceLastUpdate = (double)_lastTimeUpdated.nsecsElapsed() / 1000000.0;
|
{
|
||||||
if (timeSinceLastUpdate > targetFramePeriod) {
|
PerformanceTimer perfTimer("pluginIdle");
|
||||||
_lastTimeUpdated.start();
|
PerformanceWarning warn(showWarnings, "Application::idle()... pluginIdle()");
|
||||||
{
|
getActiveDisplayPlugin()->idle();
|
||||||
PerformanceTimer perfTimer("update");
|
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
|
||||||
PerformanceWarning warn(showWarnings, "Application::idle()... update()");
|
foreach(auto inputPlugin, inputPlugins) {
|
||||||
const float BIGGEST_DELTA_TIME_SECS = 0.25f;
|
QString name = inputPlugin->getName();
|
||||||
PROFILE_RANGE(__FUNCTION__ "/idleUpdate");
|
QAction* action = Menu::getInstance()->getActionForOption(name);
|
||||||
update(glm::clamp((float)timeSinceLastUpdate / 1000.0f, 0.0f, BIGGEST_DELTA_TIME_SECS));
|
if (action && action->isChecked()) {
|
||||||
}
|
inputPlugin->idle();
|
||||||
{
|
|
||||||
PerformanceTimer perfTimer("updateGL");
|
|
||||||
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
|
|
||||||
getActiveDisplayPlugin()->idle();
|
|
||||||
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
|
|
||||||
foreach(auto inputPlugin, inputPlugins) {
|
|
||||||
QString name = inputPlugin->getName();
|
|
||||||
QAction* action = Menu::getInstance()->getActionForOption(name);
|
|
||||||
if (action && action->isChecked()) {
|
|
||||||
inputPlugin->idle();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
}
|
||||||
PerformanceTimer perfTimer("rest");
|
{
|
||||||
PerformanceWarning warn(showWarnings, "Application::idle()... rest of it");
|
PerformanceTimer perfTimer("rest");
|
||||||
_idleLoopStdev.addValue(timeSinceLastUpdate);
|
PerformanceWarning warn(showWarnings, "Application::idle()... rest of it");
|
||||||
|
_idleLoopStdev.addValue(secondsSinceLastUpdate);
|
||||||
|
|
||||||
// Record standard deviation and reset counter if needed
|
// Record standard deviation and reset counter if needed
|
||||||
const int STDEV_SAMPLES = 500;
|
const int STDEV_SAMPLES = 500;
|
||||||
if (_idleLoopStdev.getSamples() > STDEV_SAMPLES) {
|
if (_idleLoopStdev.getSamples() > STDEV_SAMPLES) {
|
||||||
_idleLoopMeasuredJitter = _idleLoopStdev.getStDev();
|
_idleLoopMeasuredJitter = _idleLoopStdev.getStDev();
|
||||||
_idleLoopStdev.reset();
|
_idleLoopStdev.reset();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float secondsSinceLastUpdate = (float)timeSinceLastUpdate / 1000.0f;
|
|
||||||
_overlayConductor.update(secondsSinceLastUpdate);
|
|
||||||
|
|
||||||
// depending on whether we're throttling or not.
|
|
||||||
// Once rendering is off on another thread we should be able to have Application::idle run at start(0) in
|
|
||||||
// perpetuity and not expect events to get backed up.
|
|
||||||
|
|
||||||
bool isThrottled = getActiveDisplayPlugin()->isThrottled();
|
|
||||||
static const int THROTTLED_IDLE_TIMER_DELAY = MSECS_PER_SECOND / 15;
|
|
||||||
static const int IDLE_TIMER_DELAY_MS = 2;
|
|
||||||
int desiredInterval = isThrottled ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS;
|
|
||||||
//qDebug() << "isThrottled:" << isThrottled << "desiredInterval:" << desiredInterval;
|
|
||||||
|
|
||||||
if (idleTimer->interval() != desiredInterval) {
|
|
||||||
idleTimer->start(desiredInterval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_overlayConductor.update(secondsSinceLastUpdate);
|
||||||
|
|
||||||
// check for any requested background downloads.
|
// check for any requested background downloads.
|
||||||
emit checkBackgroundDownloads();
|
emit checkBackgroundDownloads();
|
||||||
lastIdleEnd = usecTimestampNow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Application::getAverageSimsPerSecond() {
|
float Application::getAverageSimsPerSecond() {
|
||||||
|
@ -4497,90 +4478,10 @@ void Application::takeSnapshot() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setVSyncEnabled() {
|
|
||||||
_glWidget->makeCurrent();
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
bool vsyncOn = Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerateVSyncOn);
|
|
||||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
|
||||||
wglSwapIntervalEXT(vsyncOn);
|
|
||||||
int swapInterval = wglGetSwapIntervalEXT();
|
|
||||||
qCDebug(interfaceapp, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
|
||||||
} else {
|
|
||||||
qCDebug(interfaceapp, "V-Sync is FORCED ON on this system\n");
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_LINUX)
|
|
||||||
// TODO: write the poper code for linux
|
|
||||||
/*
|
|
||||||
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
|
||||||
glxSwapIntervalEXT(vsyncOn);
|
|
||||||
int swapInterval = xglGetSwapIntervalEXT();
|
|
||||||
_isVSyncOn = swapInterval;
|
|
||||||
qCDebug(interfaceapp, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
|
||||||
} else {
|
|
||||||
qCDebug(interfaceapp, "V-Sync is FORCED ON on this system\n");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
qCDebug(interfaceapp, "V-Sync is FORCED ON on this system\n");
|
|
||||||
#endif
|
|
||||||
_offscreenContext->makeCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::setThrottleFPSEnabled() {
|
void Application::setThrottleFPSEnabled() {
|
||||||
_isThrottleFPSEnabled = Menu::getInstance()->isOptionChecked(MenuOption::ThrottleFPSIfNotFocus);
|
_isThrottleFPSEnabled = Menu::getInstance()->isOptionChecked(MenuOption::ThrottleFPSIfNotFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::isVSyncOn() const {
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
|
||||||
int swapInterval = wglGetSwapIntervalEXT();
|
|
||||||
return (swapInterval > 0);
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_LINUX)
|
|
||||||
// TODO: write the poper code for linux
|
|
||||||
/*
|
|
||||||
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
|
||||||
int swapInterval = xglGetSwapIntervalEXT();
|
|
||||||
return (swapInterval > 0);
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Application::isVSyncEditable() const {
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_LINUX)
|
|
||||||
// TODO: write the poper code for linux
|
|
||||||
/*
|
|
||||||
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int Application::getRenderTargetFramerate() const {
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerateUnlimited)) {
|
|
||||||
return 0;
|
|
||||||
} else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerate60)) {
|
|
||||||
return 60;
|
|
||||||
} else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerate50)) {
|
|
||||||
return 50;
|
|
||||||
} else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerate40)) {
|
|
||||||
return 40;
|
|
||||||
} else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerate30)) {
|
|
||||||
return 30;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Application::getRenderResolutionScale() const {
|
float Application::getRenderResolutionScale() const {
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionOne)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::RenderResolutionOne)) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
@ -5162,3 +5063,9 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
||||||
_oldHandLeftClick[index] = false;
|
_oldHandLeftClick[index] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::crashApplication() {
|
||||||
|
QObject* object = nullptr;
|
||||||
|
bool value = object->isWindowType();
|
||||||
|
qCDebug(interfaceapp) << "Intentionally crashed Interface";
|
||||||
|
}
|
||||||
|
|
|
@ -300,9 +300,6 @@ public:
|
||||||
float getRenderResolutionScale() const;
|
float getRenderResolutionScale() const;
|
||||||
int getRenderAmbientLight() const;
|
int getRenderAmbientLight() const;
|
||||||
|
|
||||||
unsigned int getRenderTargetFramerate() const;
|
|
||||||
bool isVSyncOn() const;
|
|
||||||
bool isVSyncEditable() const;
|
|
||||||
bool isAboutToQuit() const { return _aboutToQuit; }
|
bool isAboutToQuit() const { return _aboutToQuit; }
|
||||||
|
|
||||||
// the isHMDmode is true whenever we use the interface from an HMD and not a standard flat display
|
// the isHMDmode is true whenever we use the interface from an HMD and not a standard flat display
|
||||||
|
@ -411,8 +408,6 @@ public slots:
|
||||||
|
|
||||||
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
|
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
|
||||||
|
|
||||||
void setVSyncEnabled();
|
|
||||||
|
|
||||||
void setThrottleFPSEnabled();
|
void setThrottleFPSEnabled();
|
||||||
bool isThrottleFPSEnabled() { return _isThrottleFPSEnabled; }
|
bool isThrottleFPSEnabled() { return _isThrottleFPSEnabled; }
|
||||||
|
|
||||||
|
@ -438,6 +433,8 @@ public slots:
|
||||||
|
|
||||||
void reloadResourceCaches();
|
void reloadResourceCaches();
|
||||||
|
|
||||||
|
void crashApplication();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void clearDomainOctreeDetails();
|
void clearDomainOctreeDetails();
|
||||||
void checkFPS();
|
void checkFPS();
|
||||||
|
@ -626,7 +623,6 @@ private:
|
||||||
quint64 _lastNackTime;
|
quint64 _lastNackTime;
|
||||||
quint64 _lastSendDownstreamAudioStats;
|
quint64 _lastSendDownstreamAudioStats;
|
||||||
|
|
||||||
bool _isVSyncOn;
|
|
||||||
bool _isThrottleFPSEnabled;
|
bool _isThrottleFPSEnabled;
|
||||||
|
|
||||||
bool _aboutToQuit;
|
bool _aboutToQuit;
|
||||||
|
|
183
interface/src/CrashHandler.cpp
Normal file
183
interface/src/CrashHandler.cpp
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
//
|
||||||
|
// CrashHandler.cpp
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by David Rowe on 24 Aug 2015.
|
||||||
|
// 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 "CrashHandler.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <PathUtils.h>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include "DataServerAccountInfo.h"
|
||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(DataServerAccountInfo)
|
||||||
|
|
||||||
|
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
|
||||||
|
|
||||||
|
void CrashHandler::checkForAndHandleCrash() {
|
||||||
|
QFile runningMarkerFile(runningMarkerFilePath());
|
||||||
|
if (runningMarkerFile.exists()) {
|
||||||
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
|
QSettings settings;
|
||||||
|
settings.beginGroup("Developer");
|
||||||
|
QVariant displayCrashOptions = settings.value(MenuOption::DisplayCrashOptions);
|
||||||
|
settings.endGroup();
|
||||||
|
if (!displayCrashOptions.isValid() // Option does not exist in Interface.ini so assume default behavior.
|
||||||
|
|| displayCrashOptions.toBool()) {
|
||||||
|
Action action = promptUserForAction();
|
||||||
|
if (action != DO_NOTHING) {
|
||||||
|
handleCrash(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CrashHandler::Action CrashHandler::promptUserForAction() {
|
||||||
|
QDialog crashDialog;
|
||||||
|
crashDialog.setWindowTitle("Interface Crashed Last Run");
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout;
|
||||||
|
|
||||||
|
QLabel* label = new QLabel("If you are having trouble starting would you like to reset your settings?");
|
||||||
|
layout->addWidget(label);
|
||||||
|
|
||||||
|
QRadioButton* option1 = new QRadioButton("Reset all my settings");
|
||||||
|
QRadioButton* option2 = new QRadioButton("Reset my settings but retain login and avatar info.");
|
||||||
|
QRadioButton* option3 = new QRadioButton("Continue with my current settings");
|
||||||
|
option3->setChecked(true);
|
||||||
|
layout->addWidget(option1);
|
||||||
|
layout->addWidget(option2);
|
||||||
|
layout->addWidget(option3);
|
||||||
|
layout->addSpacing(12);
|
||||||
|
layout->addStretch();
|
||||||
|
|
||||||
|
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||||
|
layout->addWidget(buttons);
|
||||||
|
crashDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept()));
|
||||||
|
|
||||||
|
crashDialog.setLayout(layout);
|
||||||
|
|
||||||
|
int result = crashDialog.exec();
|
||||||
|
|
||||||
|
if (result == QDialog::Accepted) {
|
||||||
|
if (option1->isChecked()) {
|
||||||
|
return CrashHandler::DELETE_INTERFACE_INI;
|
||||||
|
}
|
||||||
|
if (option2->isChecked()) {
|
||||||
|
return CrashHandler::RETAIN_LOGIN_AND_AVATAR_INFO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dialog cancelled or "do nothing" option chosen
|
||||||
|
return CrashHandler::DO_NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CrashHandler::handleCrash(CrashHandler::Action action) {
|
||||||
|
if (action != CrashHandler::DELETE_INTERFACE_INI && action != CrashHandler::RETAIN_LOGIN_AND_AVATAR_INFO) {
|
||||||
|
// CrashHandler::DO_NOTHING or unexpected value
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
|
QSettings settings;
|
||||||
|
const QString ADDRESS_MANAGER_GROUP = "AddressManager";
|
||||||
|
const QString ADDRESS_KEY = "address";
|
||||||
|
const QString AVATAR_GROUP = "Avatar";
|
||||||
|
const QString DISPLAY_NAME_KEY = "displayName";
|
||||||
|
const QString FULL_AVATAR_URL_KEY = "fullAvatarURL";
|
||||||
|
const QString FULL_AVATAR_MODEL_NAME_KEY = "fullAvatarModelName";
|
||||||
|
const QString ACCOUNTS_GROUP = "accounts";
|
||||||
|
QString displayName;
|
||||||
|
QUrl fullAvatarURL;
|
||||||
|
QString fullAvatarModelName;
|
||||||
|
QUrl address;
|
||||||
|
QMap<QString, DataServerAccountInfo> accounts;
|
||||||
|
|
||||||
|
if (action == CrashHandler::RETAIN_LOGIN_AND_AVATAR_INFO) {
|
||||||
|
// Read login and avatar info
|
||||||
|
|
||||||
|
qRegisterMetaType<DataServerAccountInfo>("DataServerAccountInfo");
|
||||||
|
qRegisterMetaTypeStreamOperators<DataServerAccountInfo>("DataServerAccountInfo");
|
||||||
|
|
||||||
|
// Location and orientation
|
||||||
|
settings.beginGroup(ADDRESS_MANAGER_GROUP);
|
||||||
|
address = settings.value(ADDRESS_KEY).toUrl();
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
// Display name and avatar
|
||||||
|
settings.beginGroup(AVATAR_GROUP);
|
||||||
|
displayName = settings.value(DISPLAY_NAME_KEY).toString();
|
||||||
|
fullAvatarURL = settings.value(FULL_AVATAR_URL_KEY).toUrl();
|
||||||
|
fullAvatarModelName = settings.value(FULL_AVATAR_MODEL_NAME_KEY).toString();
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
// Accounts
|
||||||
|
settings.beginGroup(ACCOUNTS_GROUP);
|
||||||
|
foreach(const QString& key, settings.allKeys()) {
|
||||||
|
accounts.insert(key, settings.value(key).value<DataServerAccountInfo>());
|
||||||
|
}
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete Interface.ini
|
||||||
|
QFile settingsFile(settings.fileName());
|
||||||
|
if (settingsFile.exists()) {
|
||||||
|
settingsFile.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action == CrashHandler::RETAIN_LOGIN_AND_AVATAR_INFO) {
|
||||||
|
// Write login and avatar info
|
||||||
|
|
||||||
|
// Location and orientation
|
||||||
|
settings.beginGroup(ADDRESS_MANAGER_GROUP);
|
||||||
|
settings.setValue(ADDRESS_KEY, address);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
// Display name and avatar
|
||||||
|
settings.beginGroup(AVATAR_GROUP);
|
||||||
|
settings.setValue(DISPLAY_NAME_KEY, displayName);
|
||||||
|
settings.setValue(FULL_AVATAR_URL_KEY, fullAvatarURL);
|
||||||
|
settings.setValue(FULL_AVATAR_MODEL_NAME_KEY, fullAvatarModelName);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
// Accounts
|
||||||
|
settings.beginGroup(ACCOUNTS_GROUP);
|
||||||
|
foreach(const QString& key, accounts.keys()) {
|
||||||
|
settings.setValue(key, QVariant::fromValue(accounts.value(key)));
|
||||||
|
}
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CrashHandler::writeRunningMarkerFiler() {
|
||||||
|
QFile runningMarkerFile(runningMarkerFilePath());
|
||||||
|
if (!runningMarkerFile.exists()) {
|
||||||
|
runningMarkerFile.open(QIODevice::WriteOnly);
|
||||||
|
runningMarkerFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CrashHandler::deleteRunningMarkerFile() {
|
||||||
|
QFile runningMarkerFile(runningMarkerFilePath());
|
||||||
|
if (runningMarkerFile.exists()) {
|
||||||
|
runningMarkerFile.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString CrashHandler::runningMarkerFilePath() {
|
||||||
|
return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + RUNNING_MARKER_FILENAME;
|
||||||
|
}
|
38
interface/src/CrashHandler.h
Normal file
38
interface/src/CrashHandler.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
//
|
||||||
|
// CrashHandler.h
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by David Rowe on 24 Aug 2015.
|
||||||
|
// 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_CrashHandler_h
|
||||||
|
#define hifi_CrashHandler_h
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class CrashHandler {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void checkForAndHandleCrash();
|
||||||
|
|
||||||
|
static void writeRunningMarkerFiler();
|
||||||
|
static void deleteRunningMarkerFile();
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum Action {
|
||||||
|
DELETE_INTERFACE_INI,
|
||||||
|
RETAIN_LOGIN_AND_AVATAR_INFO,
|
||||||
|
DO_NOTHING
|
||||||
|
};
|
||||||
|
|
||||||
|
static Action promptUserForAction();
|
||||||
|
static void handleCrash(Action action);
|
||||||
|
|
||||||
|
static const QString runningMarkerFilePath();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_CrashHandler_h
|
|
@ -62,7 +62,7 @@ void GLCanvas::paintGL() {
|
||||||
// FIXME - I'm not sure why this still remains, it appears as if this GLCanvas gets a single paintGL call near
|
// FIXME - I'm not sure why this still remains, it appears as if this GLCanvas gets a single paintGL call near
|
||||||
// the beginning of the application starting up. I'm not sure if we really need to call Application::paintGL()
|
// the beginning of the application starting up. I'm not sure if we really need to call Application::paintGL()
|
||||||
// in this case, since the display plugins eventually handle all the painting
|
// in this case, since the display plugins eventually handle all the painting
|
||||||
if ((!Application::getInstance()->getWindow()->isMinimized() || !Application::getInstance()->isThrottleFPSEnabled())) {
|
if (!Application::getInstance()->getWindow()->isMinimized() || !Application::getInstance()->isThrottleFPSEnabled()) {
|
||||||
Application::getInstance()->paintGL();
|
Application::getInstance()->paintGL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ Menu::Menu() {
|
||||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0,
|
addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0,
|
||||||
qApp, SLOT(packageModel()));
|
qApp, SLOT(packageModel()));
|
||||||
|
|
||||||
MenuWrapper* displayMenu = addMenu(DisplayPlugin::MENU_PATH);
|
MenuWrapper* displayMenu = addMenu(DisplayPlugin::MENU_PATH());
|
||||||
{
|
{
|
||||||
MenuWrapper* displayModeMenu = addMenu(MenuOption::OutputMenu);
|
MenuWrapper* displayModeMenu = addMenu(MenuOption::OutputMenu);
|
||||||
QActionGroup* displayModeGroup = new QActionGroup(displayModeMenu);
|
QActionGroup* displayModeGroup = new QActionGroup(displayModeMenu);
|
||||||
|
@ -334,25 +334,8 @@ Menu::Menu() {
|
||||||
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight8, 0, false));
|
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight8, 0, false));
|
||||||
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight9, 0, false));
|
ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight9, 0, false));
|
||||||
|
|
||||||
{
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ThrottleFPSIfNotFocus, 0, true,
|
||||||
MenuWrapper* framerateMenu = renderOptionsMenu->addMenu(MenuOption::RenderTargetFramerate);
|
|
||||||
QActionGroup* framerateGroup = new QActionGroup(framerateMenu);
|
|
||||||
framerateGroup->setExclusive(true);
|
|
||||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerateUnlimited, 0, true));
|
|
||||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate60, 0, false));
|
|
||||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate50, 0, false));
|
|
||||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate40, 0, false));
|
|
||||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate30, 0, false));
|
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
#else
|
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::RenderTargetFramerateVSyncOn, 0, true,
|
|
||||||
qApp, SLOT(setVSyncEnabled()));
|
|
||||||
#endif
|
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ThrottleFPSIfNotFocus, 0, true,
|
|
||||||
qApp, SLOT(setThrottleFPSEnabled()));
|
qApp, SLOT(setThrottleFPSEnabled()));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MenuWrapper* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution);
|
MenuWrapper* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution);
|
||||||
QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu);
|
QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu);
|
||||||
|
@ -379,8 +362,9 @@ Menu::Menu() {
|
||||||
QAction* assetUpload = addActionToQMenuAndActionHash(assetDeveloperMenu,
|
QAction* assetUpload = addActionToQMenuAndActionHash(assetDeveloperMenu,
|
||||||
MenuOption::UploadAsset,
|
MenuOption::UploadAsset,
|
||||||
0,
|
0,
|
||||||
&AssetUploadDialogFactory::getInstance(),
|
&assetDialogFactory,
|
||||||
SLOT(showDialog()));
|
SLOT(showDialog()));
|
||||||
|
|
||||||
// disable the asset upload action by default - it gets enabled only if asset server becomes present
|
// disable the asset upload action by default - it gets enabled only if asset server becomes present
|
||||||
assetUpload->setEnabled(false);
|
assetUpload->setEnabled(false);
|
||||||
|
|
||||||
|
@ -462,6 +446,8 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderFocusIndicator, 0, false);
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderFocusIndicator, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowWhosLookingAtMe, 0, false);
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowWhosLookingAtMe, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::FixGaze, 0, false);
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::FixGaze, 0, false);
|
||||||
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::EnableRigAnimations, 0, false,
|
||||||
|
avatar, SLOT(setEnableRigAnimations(bool)));
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::DisableEyelidAdjustment, 0, false);
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::DisableEyelidAdjustment, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu,
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu,
|
||||||
MenuOption::Connexion,
|
MenuOption::Connexion,
|
||||||
|
@ -591,6 +577,9 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned);
|
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned);
|
||||||
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls);
|
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls);
|
||||||
|
|
||||||
|
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DisplayCrashOptions, 0, true);
|
||||||
|
addActionToQMenuAndActionHash(developerMenu, MenuOption::CrashInterface, 0, qApp, SLOT(crashApplication()));
|
||||||
|
|
||||||
MenuWrapper* helpMenu = addMenu("Help");
|
MenuWrapper* helpMenu = addMenu("Help");
|
||||||
addActionToQMenuAndActionHash(helpMenu, MenuOption::EditEntitiesHelp, 0, qApp, SLOT(showEditEntitiesHelp()));
|
addActionToQMenuAndActionHash(helpMenu, MenuOption::EditEntitiesHelp, 0, qApp, SLOT(showEditEntitiesHelp()));
|
||||||
|
|
||||||
|
@ -1060,6 +1049,9 @@ QAction* MenuWrapper::addAction(const QString& menuName, const QObject* receiver
|
||||||
|
|
||||||
void MenuWrapper::removeAction(QAction* action) {
|
void MenuWrapper::removeAction(QAction* action) {
|
||||||
_realMenu->removeAction(action);
|
_realMenu->removeAction(action);
|
||||||
|
VrMenu::executeOrQueue([=](VrMenu* vrMenu) {
|
||||||
|
vrMenu->removeAction(action);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuWrapper::insertAction(QAction* before, QAction* action) {
|
void MenuWrapper::insertAction(QAction* before, QAction* action) {
|
||||||
|
|
|
@ -164,6 +164,7 @@ namespace MenuOption {
|
||||||
const QString CopyAddress = "Copy Address to Clipboard";
|
const QString CopyAddress = "Copy Address to Clipboard";
|
||||||
const QString CopyPath = "Copy Path to Clipboard";
|
const QString CopyPath = "Copy Path to Clipboard";
|
||||||
const QString CoupleEyelids = "Couple Eyelids";
|
const QString CoupleEyelids = "Couple Eyelids";
|
||||||
|
const QString CrashInterface = "Crash Interface";
|
||||||
const QString DebugAmbientOcclusion = "Debug Ambient Occlusion";
|
const QString DebugAmbientOcclusion = "Debug Ambient Occlusion";
|
||||||
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
||||||
const QString DeleteBookmark = "Delete Bookmark...";
|
const QString DeleteBookmark = "Delete Bookmark...";
|
||||||
|
@ -172,6 +173,7 @@ namespace MenuOption {
|
||||||
const QString DisableLightEntities = "Disable Light Entities";
|
const QString DisableLightEntities = "Disable Light Entities";
|
||||||
const QString DisableNackPackets = "Disable Entity NACK Packets";
|
const QString DisableNackPackets = "Disable Entity NACK Packets";
|
||||||
const QString DiskCacheEditor = "Disk Cache Editor";
|
const QString DiskCacheEditor = "Disk Cache Editor";
|
||||||
|
const QString DisplayCrashOptions = "Display Crash Options";
|
||||||
const QString DisplayHands = "Show Hand Info";
|
const QString DisplayHands = "Show Hand Info";
|
||||||
const QString DisplayHandTargets = "Show Hand Targets";
|
const QString DisplayHandTargets = "Show Hand Targets";
|
||||||
const QString DisplayModelBounds = "Display Model Bounds";
|
const QString DisplayModelBounds = "Display Model Bounds";
|
||||||
|
@ -186,6 +188,7 @@ namespace MenuOption {
|
||||||
const QString EditEntitiesHelp = "Edit Entities Help...";
|
const QString EditEntitiesHelp = "Edit Entities Help...";
|
||||||
const QString Enable3DTVMode = "Enable 3DTV Mode";
|
const QString Enable3DTVMode = "Enable 3DTV Mode";
|
||||||
const QString EnableCharacterController = "Enable avatar collisions";
|
const QString EnableCharacterController = "Enable avatar collisions";
|
||||||
|
const QString EnableRigAnimations = "Enable Rig Animations";
|
||||||
const QString ExpandMyAvatarSimulateTiming = "Expand /myAvatar/simulation";
|
const QString ExpandMyAvatarSimulateTiming = "Expand /myAvatar/simulation";
|
||||||
const QString ExpandMyAvatarTiming = "Expand /myAvatar";
|
const QString ExpandMyAvatarTiming = "Expand /myAvatar";
|
||||||
const QString ExpandOtherAvatarTiming = "Expand /otherAvatar";
|
const QString ExpandOtherAvatarTiming = "Expand /otherAvatar";
|
||||||
|
@ -238,13 +241,6 @@ namespace MenuOption {
|
||||||
const QString RenderLookAtTargets = "Show Look-at Targets";
|
const QString RenderLookAtTargets = "Show Look-at Targets";
|
||||||
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
||||||
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
||||||
const QString RenderTargetFramerate = "Framerate";
|
|
||||||
const QString RenderTargetFramerateUnlimited = "Unlimited";
|
|
||||||
const QString RenderTargetFramerate60 = "60";
|
|
||||||
const QString RenderTargetFramerate50 = "50";
|
|
||||||
const QString RenderTargetFramerate40 = "40";
|
|
||||||
const QString RenderTargetFramerate30 = "30";
|
|
||||||
const QString RenderTargetFramerateVSyncOn = "V-Sync On";
|
|
||||||
const QString RenderResolution = "Scale Resolution";
|
const QString RenderResolution = "Scale Resolution";
|
||||||
const QString RenderResolutionOne = "1";
|
const QString RenderResolutionOne = "1";
|
||||||
const QString RenderResolutionTwoThird = "2/3";
|
const QString RenderResolutionTwoThird = "2/3";
|
||||||
|
|
|
@ -65,9 +65,8 @@ FSTReader::ModelType ModelSelector::getModelType() const {
|
||||||
return FSTReader::ATTACHMENT_MODEL;
|
return FSTReader::ATTACHMENT_MODEL;
|
||||||
} else if (text == ENTITY_MODEL_STRING) {
|
} else if (text == ENTITY_MODEL_STRING) {
|
||||||
return FSTReader::ENTITY_MODEL;
|
return FSTReader::ENTITY_MODEL;
|
||||||
} else {
|
}
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelSelector::accept() {
|
void ModelSelector::accept() {
|
||||||
|
|
|
@ -705,9 +705,10 @@ float loadSetting(QSettings& settings, const char* name, float defaultValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::setEnableRigAnimations(bool isEnabled) {
|
void MyAvatar::setEnableRigAnimations(bool isEnabled) {
|
||||||
Settings settings;
|
|
||||||
settings.setValue("enableRig", isEnabled);
|
|
||||||
_rig->setEnableRig(isEnabled);
|
_rig->setEnableRig(isEnabled);
|
||||||
|
if (!isEnabled) {
|
||||||
|
_rig->deleteAnimations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::loadData() {
|
void MyAvatar::loadData() {
|
||||||
|
@ -769,7 +770,7 @@ void MyAvatar::loadData() {
|
||||||
setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString());
|
setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString());
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
_rig->setEnableRig(settings.value("enableRig").toBool());
|
_rig->setEnableRig(Menu::getInstance()->isOptionChecked(MenuOption::EnableRigAnimations));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::saveAttachmentData(const AttachmentData& attachment) const {
|
void MyAvatar::saveAttachmentData(const AttachmentData& attachment) const {
|
||||||
|
@ -1307,7 +1308,7 @@ glm::vec3 MyAvatar::applyKeyboardMotor(float deltaTime, const glm::vec3& localVe
|
||||||
bool isThrust = (glm::length2(_thrust) > EPSILON);
|
bool isThrust = (glm::length2(_thrust) > EPSILON);
|
||||||
if (_isPushing || isThrust ||
|
if (_isPushing || isThrust ||
|
||||||
(_scriptedMotorTimescale < MAX_KEYBOARD_MOTOR_TIMESCALE &&
|
(_scriptedMotorTimescale < MAX_KEYBOARD_MOTOR_TIMESCALE &&
|
||||||
_motionBehaviors | AVATAR_MOTION_SCRIPTED_MOTOR_ENABLED)) {
|
(_motionBehaviors & AVATAR_MOTION_SCRIPTED_MOTOR_ENABLED))) {
|
||||||
// we don't want to brake if something is pushing the avatar around
|
// we don't want to brake if something is pushing the avatar around
|
||||||
timescale = _keyboardMotorTimescale;
|
timescale = _keyboardMotorTimescale;
|
||||||
_isBraking = false;
|
_isBraking = false;
|
||||||
|
|
|
@ -87,7 +87,6 @@ public:
|
||||||
Q_INVOKABLE AnimationDetails getAnimationDetailsByRole(const QString& role);
|
Q_INVOKABLE AnimationDetails getAnimationDetailsByRole(const QString& role);
|
||||||
Q_INVOKABLE AnimationDetails getAnimationDetails(const QString& url);
|
Q_INVOKABLE AnimationDetails getAnimationDetails(const QString& url);
|
||||||
void clearJointAnimationPriorities();
|
void clearJointAnimationPriorities();
|
||||||
Q_INVOKABLE void setEnableRigAnimations(bool isEnabled);
|
|
||||||
|
|
||||||
// get/set avatar data
|
// get/set avatar data
|
||||||
void saveData();
|
void saveData();
|
||||||
|
@ -190,6 +189,7 @@ public slots:
|
||||||
void loadLastRecording();
|
void loadLastRecording();
|
||||||
|
|
||||||
virtual void rebuildSkeletonBody();
|
virtual void rebuildSkeletonBody();
|
||||||
|
void setEnableRigAnimations(bool isEnabled);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void transformChanged();
|
void transformChanged();
|
||||||
|
|
|
@ -131,13 +131,20 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
//
|
//
|
||||||
// Thus this should really only be ... else if (_owningAvatar->getHead()->isLookingAtMe()) {...
|
// Thus this should really only be ... else if (_owningAvatar->getHead()->isLookingAtMe()) {...
|
||||||
// However, in the !isLookingAtMe case, the eyes aren't rotating the way they should right now.
|
// However, in the !isLookingAtMe case, the eyes aren't rotating the way they should right now.
|
||||||
// (They latch their looking at me position.) We will revisit that as priorities allow.
|
// We will revisit that as priorities allow, and particularly after the new rig/animation/joints.
|
||||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
Head* head = _owningAvatar->getHead();
|
Head* head = _owningAvatar->getHead();
|
||||||
_rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex,
|
// If the head is not positioned, updateEyeJoints won't get the math right
|
||||||
getTranslation(), getRotation(),
|
glm::quat headOrientation;
|
||||||
head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition());
|
_rig->getJointRotation(geometry.headJointIndex, headOrientation);
|
||||||
}
|
glm::vec3 eulers = safeEulerAngles(headOrientation);
|
||||||
|
head->setBasePitch(glm::degrees(-eulers.x));
|
||||||
|
head->setBaseYaw(glm::degrees(eulers.y));
|
||||||
|
head->setBaseRoll(glm::degrees(-eulers.z));
|
||||||
|
_rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex,
|
||||||
|
getTranslation(), getRotation(),
|
||||||
|
head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed),
|
// Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed),
|
||||||
|
|
|
@ -103,7 +103,7 @@ int main(int argc, const char* argv[]) {
|
||||||
Application app(argc, const_cast<char**>(argv), startupTime);
|
Application app(argc, const_cast<char**>(argv), startupTime);
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
translator.load("interface_en");
|
translator.load("i18n/interface_en");
|
||||||
app.installTranslator(&translator);
|
app.installTranslator(&translator);
|
||||||
|
|
||||||
qCDebug(interfaceapp, "Created QT Application.");
|
qCDebug(interfaceapp, "Created QT Application.");
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <AssetClient.h>
|
#include <AssetClient.h>
|
||||||
#include <AssetUpload.h>
|
#include <AssetUpload.h>
|
||||||
#include <AssetUtils.h>
|
#include <AssetUtils.h>
|
||||||
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtWidgets/QDialogButtonBox>
|
#include <QtWidgets/QDialogButtonBox>
|
||||||
|
@ -32,29 +33,39 @@ AssetUploadDialogFactory::AssetUploadDialogFactory() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const QString PERMISSION_DENIED_ERROR = "You do not have permission to upload content to this asset-server.";
|
||||||
|
|
||||||
void AssetUploadDialogFactory::showDialog() {
|
void AssetUploadDialogFactory::showDialog() {
|
||||||
auto filename = QFileDialog::getOpenFileUrl(_dialogParent, "Select a file to upload");
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
if (!filename.isEmpty()) {
|
if (nodeList->getThisNodeCanRez()) {
|
||||||
qDebug() << "Selected filename for upload to asset-server: " << filename;
|
auto filename = QFileDialog::getOpenFileUrl(_dialogParent, "Select a file to upload");
|
||||||
|
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
if (!filename.isEmpty()) {
|
||||||
auto upload = assetClient->createUpload(filename.path());
|
qDebug() << "Selected filename for upload to asset-server: " << filename;
|
||||||
|
|
||||||
if (upload) {
|
|
||||||
// connect to the finished signal so we know when the AssetUpload is done
|
|
||||||
QObject::connect(upload, &AssetUpload::finished, this, &AssetUploadDialogFactory::handleUploadFinished);
|
|
||||||
|
|
||||||
// start the upload now
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
upload->start();
|
auto upload = assetClient->createUpload(filename.path());
|
||||||
} else {
|
|
||||||
// show a QMessageBox to say that there is no local asset server
|
|
||||||
QString messageBoxText = QString("Could not upload \n\n%1\n\nbecause you are currently not connected" \
|
|
||||||
" to a local asset-server.").arg(QFileInfo(filename.toString()).fileName());
|
|
||||||
|
|
||||||
QMessageBox::information(_dialogParent, "Failed to Upload", messageBoxText);
|
if (upload) {
|
||||||
|
// connect to the finished signal so we know when the AssetUpload is done
|
||||||
|
QObject::connect(upload, &AssetUpload::finished, this, &AssetUploadDialogFactory::handleUploadFinished);
|
||||||
|
|
||||||
|
// start the upload now
|
||||||
|
upload->start();
|
||||||
|
} else {
|
||||||
|
// show a QMessageBox to say that there is no local asset server
|
||||||
|
QString messageBoxText = QString("Could not upload \n\n%1\n\nbecause you are currently not connected" \
|
||||||
|
" to a local asset-server.").arg(QFileInfo(filename.toString()).fileName());
|
||||||
|
|
||||||
|
QMessageBox::information(_dialogParent, "Failed to Upload", messageBoxText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// we don't have permission to upload to asset server in this domain - show the permission denied error
|
||||||
|
showErrorDialog(QString(), PERMISSION_DENIED_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const QString& hash) {
|
void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const QString& hash) {
|
||||||
|
@ -78,7 +89,7 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
|
||||||
// setup the line edit to hold the copiable text
|
// setup the line edit to hold the copiable text
|
||||||
QLineEdit* lineEdit = new QLineEdit;
|
QLineEdit* lineEdit = new QLineEdit;
|
||||||
|
|
||||||
QString atpURL = QString("%1://%2").arg(ATP_SCHEME).arg(hash);
|
QString atpURL = QString("%1://%2.%3").arg(ATP_SCHEME).arg(hash).arg(upload->getExtension());
|
||||||
|
|
||||||
// set the ATP URL as the text value so it's copiable
|
// set the ATP URL as the text value so it's copiable
|
||||||
lineEdit->insert(atpURL);
|
lineEdit->insert(atpURL);
|
||||||
|
@ -111,14 +122,17 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
|
||||||
hashCopyDialog->show();
|
hashCopyDialog->show();
|
||||||
} else {
|
} else {
|
||||||
// figure out the right error message for the message box
|
// figure out the right error message for the message box
|
||||||
QString errorMessage = QString("Failed to upload %1.\n\n").arg(QFileInfo(upload->getFilename()).fileName());
|
QString additionalError;
|
||||||
|
|
||||||
switch (upload->getResult()) {
|
switch (upload->getResult()) {
|
||||||
case AssetUpload::PermissionDenied:
|
case AssetUpload::PermissionDenied:
|
||||||
errorMessage += "You do not have permission to upload content to this asset-server.";
|
additionalError = PERMISSION_DENIED_ERROR;
|
||||||
break;
|
break;
|
||||||
case AssetUpload::TooLarge:
|
case AssetUpload::TooLarge:
|
||||||
errorMessage += "The uploaded content was too large and could not be stored in the asset-server.";
|
additionalError = "The uploaded content was too large and could not be stored in the asset-server.";
|
||||||
|
break;
|
||||||
|
case AssetUpload::ErrorLoadingFile:
|
||||||
|
additionalError = "The file could not be opened. Please check your permissions and try again.";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// not handled, do not show a message box
|
// not handled, do not show a message box
|
||||||
|
@ -126,6 +140,20 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
|
||||||
}
|
}
|
||||||
|
|
||||||
// display a message box with the error
|
// display a message box with the error
|
||||||
QMessageBox::warning(_dialogParent, "Failed Upload", errorMessage);
|
showErrorDialog(QFileInfo(upload->getFilename()).fileName(), additionalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upload->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetUploadDialogFactory::showErrorDialog(const QString& filename, const QString& additionalError) {
|
||||||
|
QString errorMessage;
|
||||||
|
|
||||||
|
if (!filename.isEmpty()) {
|
||||||
|
errorMessage += QString("Failed to upload %1.\n\n").arg(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
errorMessage += additionalError;
|
||||||
|
|
||||||
|
QMessageBox::warning(_dialogParent, "Failed Upload", errorMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ class AssetUpload;
|
||||||
class AssetUploadDialogFactory : public QObject {
|
class AssetUploadDialogFactory : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AssetUploadDialogFactory();
|
|
||||||
AssetUploadDialogFactory(const AssetUploadDialogFactory& other) = delete;
|
AssetUploadDialogFactory(const AssetUploadDialogFactory& other) = delete;
|
||||||
AssetUploadDialogFactory& operator=(const AssetUploadDialogFactory& rhs) = delete;
|
AssetUploadDialogFactory& operator=(const AssetUploadDialogFactory& rhs) = delete;
|
||||||
|
|
||||||
|
@ -33,6 +32,10 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void handleUploadFinished(AssetUpload* upload, const QString& hash);
|
void handleUploadFinished(AssetUpload* upload, const QString& hash);
|
||||||
private:
|
private:
|
||||||
|
AssetUploadDialogFactory();
|
||||||
|
|
||||||
|
void showErrorDialog(const QString& filename, const QString& additionalError);
|
||||||
|
|
||||||
QWidget* _dialogParent { nullptr };
|
QWidget* _dialogParent { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -437,7 +437,6 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser
|
||||||
case MOST: {
|
case MOST: {
|
||||||
extraDetails << "<br/>" ;
|
extraDetails << "<br/>" ;
|
||||||
|
|
||||||
const unsigned long USECS_PER_MSEC = 1000;
|
|
||||||
float lastFullEncode = stats.getLastFullTotalEncodeTime() / USECS_PER_MSEC;
|
float lastFullEncode = stats.getLastFullTotalEncodeTime() / USECS_PER_MSEC;
|
||||||
float lastFullSend = stats.getLastFullElapsedTime() / USECS_PER_MSEC;
|
float lastFullSend = stats.getLastFullElapsedTime() / USECS_PER_MSEC;
|
||||||
float lastFullSendInSeconds = stats.getLastFullElapsedTime() / USECS_PER_SECOND;
|
float lastFullSendInSeconds = stats.getLastFullElapsedTime() / USECS_PER_SECOND;
|
||||||
|
|
|
@ -3,6 +3,4 @@ set(TARGET_NAME animation)
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network Script)
|
setup_hifi_library(Network Script)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
link_hifi_libraries(shared gpu model fbx)
|
link_hifi_libraries(shared gpu model fbx)
|
||||||
|
|
|
@ -27,9 +27,10 @@ class AngularConstraint;
|
||||||
class JointState {
|
class JointState {
|
||||||
public:
|
public:
|
||||||
JointState() {}
|
JointState() {}
|
||||||
JointState(const JointState& other) : _constraint(NULL) { copyState(other); }
|
JointState(const JointState& other) { copyState(other); }
|
||||||
JointState(const FBXJoint& joint);
|
JointState(const FBXJoint& joint);
|
||||||
~JointState();
|
~JointState();
|
||||||
|
JointState& operator=(const JointState& other) { copyState(other); return *this; }
|
||||||
void copyState(const JointState& state);
|
void copyState(const JointState& state);
|
||||||
void buildConstraint();
|
void buildConstraint();
|
||||||
|
|
||||||
|
|
|
@ -100,24 +100,21 @@ AnimationHandlePointer Rig::addAnimationByRole(const QString& role, const QStrin
|
||||||
AnimationHandlePointer handle = createAnimationHandle();
|
AnimationHandlePointer handle = createAnimationHandle();
|
||||||
QString standard = "";
|
QString standard = "";
|
||||||
if (url.isEmpty()) { // Default animations for fight club
|
if (url.isEmpty()) { // Default animations for fight club
|
||||||
const QString& base = "https://hifi-public.s3.amazonaws.com/ozan/";
|
const QString& base = "https://hifi-public.s3.amazonaws.com/ozan/anim/standard_anims/";
|
||||||
if (role == "walk") {
|
if (role == "walk") {
|
||||||
standard = base + "support/FightClubBotTest1/Animations/standard_walk.fbx";
|
standard = base + "walk_fwd.fbx";
|
||||||
lastFrame = 60;
|
} else if (role == "backup") {
|
||||||
|
standard = base + "walk_bwd.fbx";
|
||||||
} else if (role == "leftTurn") {
|
} else if (role == "leftTurn") {
|
||||||
standard = base + "support/FightClubBotTest1/Animations/left_turn_noHipRotation.fbx";
|
standard = base + "turn_left.fbx";
|
||||||
lastFrame = 29;
|
|
||||||
} else if (role == "rightTurn") {
|
} else if (role == "rightTurn") {
|
||||||
standard = base + "support/FightClubBotTest1/Animations/right_turn_noHipRotation.fbx";
|
standard = base + "turn_right.fbx";
|
||||||
lastFrame = 31;
|
|
||||||
} else if (role == "leftStrafe") {
|
} else if (role == "leftStrafe") {
|
||||||
standard = base + "animations/fightclub_bot_anims/side_step_left_inPlace.fbx";
|
standard = base + "strafe_left.fbx";
|
||||||
lastFrame = 31;
|
|
||||||
} else if (role == "rightStrafe") {
|
} else if (role == "rightStrafe") {
|
||||||
standard = base + "animations/fightclub_bot_anims/side_step_right_inPlace.fbx";
|
standard = base + "strafe_right.fbx";
|
||||||
lastFrame = 31;
|
|
||||||
} else if (role == "idle") {
|
} else if (role == "idle") {
|
||||||
standard = base + "support/FightClubBotTest1/Animations/standard_idle.fbx";
|
standard = base + "idle.fbx";
|
||||||
fps = 25.0f;
|
fps = 25.0f;
|
||||||
}
|
}
|
||||||
if (!standard.isEmpty()) {
|
if (!standard.isEmpty()) {
|
||||||
|
@ -438,11 +435,12 @@ void Rig::computeMotionAnimationState(float deltaTime, const glm::vec3& worldPos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
updateRole("walk", std::abs(forwardSpeed) > 0.01f);
|
updateRole("walk", forwardSpeed > 0.01f);
|
||||||
|
updateRole("backup", forwardSpeed < -0.01f);
|
||||||
bool isTurning = std::abs(rightTurningSpeed) > 0.5f;
|
bool isTurning = std::abs(rightTurningSpeed) > 0.5f;
|
||||||
updateRole("rightTurn", isTurning && (rightTurningSpeed > 0));
|
updateRole("rightTurn", isTurning && (rightTurningSpeed > 0));
|
||||||
updateRole("leftTurn", isTurning && (rightTurningSpeed < 0));
|
updateRole("leftTurn", isTurning && (rightTurningSpeed < 0));
|
||||||
bool isStrafing = std::abs(rightLateralSpeed) > 0.01f;
|
bool isStrafing = !isTurning && (std::abs(rightLateralSpeed) > 0.01f);
|
||||||
updateRole("rightStrafe", isStrafing && (rightLateralSpeed > 0.0f));
|
updateRole("rightStrafe", isStrafing && (rightLateralSpeed > 0.0f));
|
||||||
updateRole("leftStrafe", isStrafing && (rightLateralSpeed < 0.0f));
|
updateRole("leftStrafe", isStrafing && (rightLateralSpeed < 0.0f));
|
||||||
updateRole("idle", !isMoving); // Must be last, as it makes isMoving bogus.
|
updateRole("idle", !isMoving); // Must be last, as it makes isMoving bogus.
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME audio-client)
|
set(TARGET_NAME audio-client)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network Multimedia)
|
setup_hifi_library(Network Multimedia)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME audio)
|
set(TARGET_NAME audio)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network)
|
setup_hifi_library(Network)
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,8 @@ AudioFrameBuffer< T >::~AudioFrameBuffer() {
|
||||||
template< typename T >
|
template< typename T >
|
||||||
void AudioFrameBuffer< T >::allocateFrames() {
|
void AudioFrameBuffer< T >::allocateFrames() {
|
||||||
_frameBuffer = new T*[_channelCountMax];
|
_frameBuffer = new T*[_channelCountMax];
|
||||||
if (_frameBuffer) {
|
for (uint32_t i = 0; i < _channelCountMax; ++i) {
|
||||||
for (uint32_t i = 0; i < _channelCountMax; ++i) {
|
_frameBuffer[i] = new T[_frameCountMax];
|
||||||
_frameBuffer[i] = new T[_frameCountMax];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,14 +108,14 @@ public:
|
||||||
|
|
||||||
void setParameters(uint32_t filterStage, uint32_t filterChannel, const float32_t sampleRate, const float32_t frequency,
|
void setParameters(uint32_t filterStage, uint32_t filterChannel, const float32_t sampleRate, const float32_t frequency,
|
||||||
const float32_t gain, const float32_t slope) {
|
const float32_t gain, const float32_t slope) {
|
||||||
if (filterStage >= 0 && filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount) {
|
if (filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount) {
|
||||||
_filters[filterStage][filterChannel].setParameters(sampleRate,frequency,gain,slope);
|
_filters[filterStage][filterChannel].setParameters(sampleRate,frequency,gain,slope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getParameters(uint32_t filterStage, uint32_t filterChannel, float32_t& sampleRate, float32_t& frequency,
|
void getParameters(uint32_t filterStage, uint32_t filterChannel, float32_t& sampleRate, float32_t& frequency,
|
||||||
float32_t& gain, float32_t& slope) {
|
float32_t& gain, float32_t& slope) {
|
||||||
if (filterStage >= 0 && filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount) {
|
if (filterStage < _filterCount && filterChannel >= 0 && filterChannel < _channelCount) {
|
||||||
_filters[filterStage][filterChannel].getParameters(sampleRate,frequency,gain,slope);
|
_filters[filterStage][filterChannel].getParameters(sampleRate,frequency,gain,slope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,12 +85,12 @@ public:
|
||||||
_bufferFirst(NULL),
|
_bufferFirst(NULL),
|
||||||
_bufferLast(NULL),
|
_bufferLast(NULL),
|
||||||
_at(NULL) {}
|
_at(NULL) {}
|
||||||
|
|
||||||
ConstIterator(int16_t* bufferFirst, int capacity, int16_t* at)
|
ConstIterator(int16_t* bufferFirst, int capacity, int16_t* at)
|
||||||
: _bufferLength(capacity),
|
: _bufferLength(capacity),
|
||||||
_bufferFirst(bufferFirst),
|
_bufferFirst(bufferFirst),
|
||||||
_bufferLast(bufferFirst + capacity - 1),
|
_bufferLast(bufferFirst + capacity - 1),
|
||||||
_at(at) {}
|
_at(at) {}
|
||||||
|
ConstIterator(const ConstIterator& rhs) = default;
|
||||||
|
|
||||||
bool isNull() const { return _at == NULL; }
|
bool isNull() const { return _at == NULL; }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
set(TARGET_NAME auto-updater)
|
set(TARGET_NAME auto-updater)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
setup_hifi_library(Network)
|
setup_hifi_library(Network)
|
||||||
link_hifi_libraries(shared networking)
|
link_hifi_libraries(shared networking)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME avatars)
|
set(TARGET_NAME avatars)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network Script)
|
setup_hifi_library(Network Script)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME display-plugins)
|
set(TARGET_NAME display-plugins)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(OpenGL)
|
setup_hifi_library(OpenGL)
|
||||||
|
|
||||||
|
|
|
@ -7,21 +7,35 @@
|
||||||
//
|
//
|
||||||
#include "Basic2DWindowOpenGLDisplayPlugin.h"
|
#include "Basic2DWindowOpenGLDisplayPlugin.h"
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
#include <QtGui/QWindow>
|
||||||
|
#include <QtGui/QGuiApplication>
|
||||||
|
#include <QtWidgets/QAction>
|
||||||
|
|
||||||
#include <plugins/PluginContainer.h>
|
#include <plugins/PluginContainer.h>
|
||||||
#include <QWindow>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
|
|
||||||
const QString Basic2DWindowOpenGLDisplayPlugin::NAME("2D Display");
|
const QString Basic2DWindowOpenGLDisplayPlugin::NAME("2D Display");
|
||||||
|
|
||||||
static const QString FULLSCREEN = "Fullscreen";
|
static const QString FULLSCREEN = "Fullscreen";
|
||||||
|
static const QString FRAMERATE = DisplayPlugin::MENU_PATH() + ">Framerate";
|
||||||
|
static const QString FRAMERATE_UNLIMITED = "Unlimited";
|
||||||
|
static const QString FRAMERATE_60 = "60";
|
||||||
|
static const QString FRAMERATE_50 = "50";
|
||||||
|
static const QString FRAMERATE_40 = "40";
|
||||||
|
static const QString FRAMERATE_30 = "30";
|
||||||
|
static const QString VSYNC_ON = "V-Sync On";
|
||||||
|
|
||||||
const QString& Basic2DWindowOpenGLDisplayPlugin::getName() const {
|
const QString& Basic2DWindowOpenGLDisplayPlugin::getName() const {
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<QAction*> _framerateActions;
|
||||||
|
QAction* _vsyncAction{ nullptr };
|
||||||
|
|
||||||
void Basic2DWindowOpenGLDisplayPlugin::activate() {
|
void Basic2DWindowOpenGLDisplayPlugin::activate() {
|
||||||
CONTAINER->addMenu(MENU_PATH);
|
_framerateActions.clear();
|
||||||
CONTAINER->addMenuItem(MENU_PATH, FULLSCREEN,
|
CONTAINER->addMenuItem(MENU_PATH(), FULLSCREEN,
|
||||||
[this](bool clicked) {
|
[this](bool clicked) {
|
||||||
if (clicked) {
|
if (clicked) {
|
||||||
CONTAINER->setFullscreen(getFullscreenTarget());
|
CONTAINER->setFullscreen(getFullscreenTarget());
|
||||||
|
@ -29,18 +43,65 @@ void Basic2DWindowOpenGLDisplayPlugin::activate() {
|
||||||
CONTAINER->unsetFullscreen();
|
CONTAINER->unsetFullscreen();
|
||||||
}
|
}
|
||||||
}, true, false);
|
}, true, false);
|
||||||
|
CONTAINER->addMenu(FRAMERATE);
|
||||||
|
_framerateActions.push_back(
|
||||||
|
CONTAINER->addMenuItem(FRAMERATE, FRAMERATE_UNLIMITED,
|
||||||
|
[this](bool) { updateFramerate(); }, true, true, FRAMERATE));
|
||||||
|
_framerateActions.push_back(
|
||||||
|
CONTAINER->addMenuItem(FRAMERATE, FRAMERATE_60,
|
||||||
|
[this](bool) { updateFramerate(); }, true, false, FRAMERATE));
|
||||||
|
_framerateActions.push_back(
|
||||||
|
CONTAINER->addMenuItem(FRAMERATE, FRAMERATE_50,
|
||||||
|
[this](bool) { updateFramerate(); }, true, false, FRAMERATE));
|
||||||
|
_framerateActions.push_back(
|
||||||
|
CONTAINER->addMenuItem(FRAMERATE, FRAMERATE_40,
|
||||||
|
[this](bool) { updateFramerate(); }, true, false, FRAMERATE));
|
||||||
|
_framerateActions.push_back(
|
||||||
|
CONTAINER->addMenuItem(FRAMERATE, FRAMERATE_30,
|
||||||
|
[this](bool) { updateFramerate(); }, true, false, FRAMERATE));
|
||||||
|
|
||||||
WindowOpenGLDisplayPlugin::activate();
|
WindowOpenGLDisplayPlugin::activate();
|
||||||
|
|
||||||
|
// Vsync detection happens in the parent class activate, so we need to check after that
|
||||||
|
if (_vsyncSupported) {
|
||||||
|
_vsyncAction = CONTAINER->addMenuItem(MENU_PATH(), VSYNC_ON, [this](bool) {}, true, true);
|
||||||
|
} else {
|
||||||
|
_vsyncAction = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFramerate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Basic2DWindowOpenGLDisplayPlugin::deactivate() {
|
void Basic2DWindowOpenGLDisplayPlugin::deactivate() {
|
||||||
WindowOpenGLDisplayPlugin::deactivate();
|
WindowOpenGLDisplayPlugin::deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Basic2DWindowOpenGLDisplayPlugin::getDesiredInterval(bool isThrottled) const {
|
void Basic2DWindowOpenGLDisplayPlugin::display(GLuint sceneTexture, const glm::uvec2& sceneSize) {
|
||||||
static const int THROTTLED_PAINT_TIMER_DELAY = MSECS_PER_SECOND / 15;
|
if (_vsyncAction) {
|
||||||
static const int PAINT_TIMER_DELAY_MS = 1;
|
bool wantVsync = _vsyncAction->isChecked();
|
||||||
|
bool vsyncEnabed = isVsyncEnabled();
|
||||||
|
if (vsyncEnabed ^ wantVsync) {
|
||||||
|
enableVsync(wantVsync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return isThrottled ? THROTTLED_PAINT_TIMER_DELAY : PAINT_TIMER_DELAY_MS;
|
WindowOpenGLDisplayPlugin::display(sceneTexture, sceneSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Basic2DWindowOpenGLDisplayPlugin::getDesiredInterval() const {
|
||||||
|
static const int THROTTLED_PAINT_TIMER_DELAY_MS = MSECS_PER_SECOND / 15;
|
||||||
|
static const int ULIMIITED_PAINT_TIMER_DELAY_MS = 1;
|
||||||
|
int result = ULIMIITED_PAINT_TIMER_DELAY_MS;
|
||||||
|
if (_isThrottled) {
|
||||||
|
result = THROTTLED_PAINT_TIMER_DELAY_MS;
|
||||||
|
}
|
||||||
|
if (0 != _framerateTarget) {
|
||||||
|
result = MSECS_PER_SECOND / _framerateTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "New interval " << result;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Basic2DWindowOpenGLDisplayPlugin::isThrottled() const {
|
bool Basic2DWindowOpenGLDisplayPlugin::isThrottled() const {
|
||||||
|
@ -49,14 +110,42 @@ bool Basic2DWindowOpenGLDisplayPlugin::isThrottled() const {
|
||||||
bool shouldThrottle = (!CONTAINER->isForeground() && CONTAINER->isOptionChecked(ThrottleFPSIfNotFocus));
|
bool shouldThrottle = (!CONTAINER->isForeground() && CONTAINER->isOptionChecked(ThrottleFPSIfNotFocus));
|
||||||
|
|
||||||
if (_isThrottled != shouldThrottle) {
|
if (_isThrottled != shouldThrottle) {
|
||||||
int desiredInterval = getDesiredInterval(shouldThrottle);
|
|
||||||
_timer.start(desiredInterval);
|
|
||||||
_isThrottled = shouldThrottle;
|
_isThrottled = shouldThrottle;
|
||||||
|
_timer.start(getDesiredInterval());
|
||||||
}
|
}
|
||||||
|
|
||||||
return shouldThrottle;
|
return shouldThrottle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Basic2DWindowOpenGLDisplayPlugin::updateFramerate() {
|
||||||
|
QAction* checkedFramerate{ nullptr };
|
||||||
|
foreach(auto action, _framerateActions) {
|
||||||
|
if (action->isChecked()) {
|
||||||
|
checkedFramerate = action;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_framerateTarget = 0;
|
||||||
|
if (checkedFramerate) {
|
||||||
|
QString actionText = checkedFramerate->text();
|
||||||
|
if (FRAMERATE_60 == actionText) {
|
||||||
|
_framerateTarget = 60;
|
||||||
|
} else if (FRAMERATE_50 == actionText) {
|
||||||
|
_framerateTarget = 50;
|
||||||
|
} else if (FRAMERATE_40 == actionText) {
|
||||||
|
_framerateTarget = 40;
|
||||||
|
} else if (FRAMERATE_30 == actionText) {
|
||||||
|
_framerateTarget = 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int newInterval = getDesiredInterval();
|
||||||
|
qDebug() << newInterval;
|
||||||
|
_timer.start(getDesiredInterval());
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME target the screen the window is currently on
|
// FIXME target the screen the window is currently on
|
||||||
QScreen* Basic2DWindowOpenGLDisplayPlugin::getFullscreenTarget() {
|
QScreen* Basic2DWindowOpenGLDisplayPlugin::getFullscreenTarget() {
|
||||||
return qApp->primaryScreen();
|
return qApp->primaryScreen();
|
||||||
|
|
|
@ -14,19 +14,23 @@ class Basic2DWindowOpenGLDisplayPlugin : public WindowOpenGLDisplayPlugin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual const QString & getName() const override;
|
||||||
|
|
||||||
virtual void activate() override;
|
virtual void activate() override;
|
||||||
virtual void deactivate() override;
|
virtual void deactivate() override;
|
||||||
|
|
||||||
virtual const QString & getName() const override;
|
virtual void display(GLuint sceneTexture, const glm::uvec2& sceneSize) override;
|
||||||
|
|
||||||
virtual bool isThrottled() const override;
|
virtual bool isThrottled() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int getDesiredInterval(bool isThrottled) const;
|
int getDesiredInterval() const;
|
||||||
mutable bool _isThrottled = false;
|
mutable bool _isThrottled = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateFramerate();
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
QScreen* getFullscreenTarget();
|
QScreen* getFullscreenTarget();
|
||||||
|
uint32_t _framerateTarget{ 0 };
|
||||||
int _fullscreenTarget{ -1 };
|
int _fullscreenTarget{ -1 };
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
#include "oculus/OculusDisplayPlugin.h"
|
#include "oculus/OculusDisplayPlugin.h"
|
||||||
#include "oculus/OculusLegacyDisplayPlugin.h"
|
#include "oculus/OculusLegacyDisplayPlugin.h"
|
||||||
|
|
||||||
const QString DisplayPlugin::MENU_PATH{ "Display" };
|
const QString& DisplayPlugin::MENU_PATH() {
|
||||||
|
static const QString value = "Display";
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class
|
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class
|
||||||
DisplayPluginList getDisplayPlugins() {
|
DisplayPluginList getDisplayPlugins() {
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
virtual void resetSensors() {}
|
virtual void resetSensors() {}
|
||||||
virtual float devicePixelRatio() { return 1.0; }
|
virtual float devicePixelRatio() { return 1.0; }
|
||||||
|
|
||||||
static const QString MENU_PATH;
|
static const QString& MENU_PATH();
|
||||||
signals:
|
signals:
|
||||||
void recommendedFramebufferSizeChanged(const QSize & size);
|
void recommendedFramebufferSizeChanged(const QSize & size);
|
||||||
void requestRender();
|
void requestRender();
|
||||||
|
|
|
@ -38,6 +38,11 @@ void OpenGLDisplayPlugin::finishFrame() {
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::customizeContext() {
|
void OpenGLDisplayPlugin::customizeContext() {
|
||||||
using namespace oglplus;
|
using namespace oglplus;
|
||||||
|
// TODO: write the poper code for linux
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
_vsyncSupported = wglewGetExtension("WGL_EXT_swap_control");
|
||||||
|
#endif
|
||||||
|
|
||||||
Context::BlendFunc(BlendFunction::SrcAlpha, BlendFunction::OneMinusSrcAlpha);
|
Context::BlendFunc(BlendFunction::SrcAlpha, BlendFunction::OneMinusSrcAlpha);
|
||||||
Context::Disable(Capability::Blend);
|
Context::Disable(Capability::Blend);
|
||||||
Context::Disable(Capability::DepthTest);
|
Context::Disable(Capability::DepthTest);
|
||||||
|
@ -46,6 +51,8 @@ void OpenGLDisplayPlugin::customizeContext() {
|
||||||
|
|
||||||
_program = loadDefaultShader();
|
_program = loadDefaultShader();
|
||||||
_plane = loadPlane(_program);
|
_plane = loadPlane(_program);
|
||||||
|
|
||||||
|
enableVsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::activate() {
|
void OpenGLDisplayPlugin::activate() {
|
||||||
|
@ -114,4 +121,24 @@ void OpenGLDisplayPlugin::display(
|
||||||
void OpenGLDisplayPlugin::drawUnitQuad() {
|
void OpenGLDisplayPlugin::drawUnitQuad() {
|
||||||
_program->Bind();
|
_program->Bind();
|
||||||
_plane->Draw();
|
_plane->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenGLDisplayPlugin::enableVsync(bool enable) {
|
||||||
|
if (!_vsyncSupported) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
wglSwapIntervalEXT(enable ? 1 : 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OpenGLDisplayPlugin::isVsyncEnabled() {
|
||||||
|
if (!_vsyncSupported) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
return wglGetSwapIntervalEXT() != 0;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -38,9 +38,13 @@ protected:
|
||||||
virtual void doneCurrent() = 0;
|
virtual void doneCurrent() = 0;
|
||||||
virtual void swapBuffers() = 0;
|
virtual void swapBuffers() = 0;
|
||||||
|
|
||||||
|
virtual bool isVsyncEnabled();
|
||||||
|
virtual void enableVsync(bool enable = true);
|
||||||
|
|
||||||
mutable QTimer _timer;
|
mutable QTimer _timer;
|
||||||
ProgramPtr _program;
|
ProgramPtr _program;
|
||||||
ShapeWrapperPtr _plane;
|
ShapeWrapperPtr _plane;
|
||||||
|
bool _vsyncSupported{ false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ void StereoDisplayPlugin::activate() {
|
||||||
if (screen == qApp->primaryScreen()) {
|
if (screen == qApp->primaryScreen()) {
|
||||||
checked = true;
|
checked = true;
|
||||||
}
|
}
|
||||||
auto action = CONTAINER->addMenuItem(MENU_PATH, name,
|
auto action = CONTAINER->addMenuItem(MENU_PATH(), name,
|
||||||
[this](bool clicked) { updateScreen(); }, true, checked, "Screens");
|
[this](bool clicked) { updateScreen(); }, true, checked, "Screens");
|
||||||
_screenActions[i] = action;
|
_screenActions[i] = action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
set(TARGET_NAME embedded-webserver)
|
set(TARGET_NAME embedded-webserver)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network)
|
setup_hifi_library(Network)
|
||||||
|
|
|
@ -30,6 +30,7 @@ void HTTPSManager::incomingConnection(qintptr socketDescriptor) {
|
||||||
|
|
||||||
sslSocket->setLocalCertificate(_certificate);
|
sslSocket->setLocalCertificate(_certificate);
|
||||||
sslSocket->setPrivateKey(_privateKey);
|
sslSocket->setPrivateKey(_privateKey);
|
||||||
|
sslSocket->setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||||
|
|
||||||
if (sslSocket->setSocketDescriptor(socketDescriptor)) {
|
if (sslSocket->setSocketDescriptor(socketDescriptor)) {
|
||||||
new HTTPSConnection(sslSocket, this);
|
new HTTPSConnection(sslSocket, this);
|
||||||
|
@ -48,4 +49,4 @@ bool HTTPSManager::handleHTTPSRequest(HTTPSConnection* connection, const QUrl& u
|
||||||
|
|
||||||
bool HTTPSManager::requestHandledByRequestHandler(HTTPConnection* connection, const QUrl& url) {
|
bool HTTPSManager::requestHandledByRequestHandler(HTTPConnection* connection, const QUrl& url) {
|
||||||
return _sslRequestHandler && _sslRequestHandler->handleHTTPSRequest(reinterpret_cast<HTTPSConnection*>(connection), url);
|
return _sslRequestHandler && _sslRequestHandler->handleHTTPSRequest(reinterpret_cast<HTTPSConnection*>(connection), url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,4 @@ find_package(PolyVox REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS})
|
||||||
target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES})
|
target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES})
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
link_hifi_libraries(shared gpu script-engine render render-utils)
|
link_hifi_libraries(shared gpu script-engine render render-utils)
|
||||||
|
|
|
@ -247,7 +247,6 @@ void RenderableParticleEffectEntityItem::updateRenderItem() {
|
||||||
glm::vec3 pos = _transform.getTranslation();
|
glm::vec3 pos = _transform.getTranslation();
|
||||||
Transform t;
|
Transform t;
|
||||||
t.setRotation(rot);
|
t.setRotation(rot);
|
||||||
t.setTranslation(pos);
|
|
||||||
payload.setModelTransform(t);
|
payload.setModelTransform(t);
|
||||||
|
|
||||||
// transform _particleMinBound and _particleMaxBound corners into world coords
|
// transform _particleMinBound and _particleMaxBound corners into world coords
|
||||||
|
@ -285,7 +284,7 @@ void RenderableParticleEffectEntityItem::updateRenderItem() {
|
||||||
payload.setPipeline(_untexturedPipeline);
|
payload.setPipeline(_untexturedPipeline);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_scene->enqueuePendingChanges(pendingChanges);
|
_scene->enqueuePendingChanges(pendingChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +294,7 @@ void RenderableParticleEffectEntityItem::createPipelines() {
|
||||||
state->setCullMode(gpu::State::CULL_BACK);
|
state->setCullMode(gpu::State::CULL_BACK);
|
||||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD,
|
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD,
|
||||||
gpu::State::INV_SRC_ALPHA, gpu::State::FACTOR_ALPHA,
|
gpu::State::ONE, gpu::State::FACTOR_ALPHA,
|
||||||
gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
auto vertShader = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(untextured_particle_vert)));
|
auto vertShader = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(untextured_particle_vert)));
|
||||||
auto fragShader = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(untextured_particle_frag)));
|
auto fragShader = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(untextured_particle_frag)));
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME entities)
|
set(TARGET_NAME entities)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network Script)
|
setup_hifi_library(Network Script)
|
||||||
|
|
||||||
|
|
|
@ -610,6 +610,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
const QUuid& myNodeID = nodeList->getSessionUUID();
|
const QUuid& myNodeID = nodeList->getSessionUUID();
|
||||||
bool weOwnSimulation = _simulationOwner.matchesValidID(myNodeID);
|
bool weOwnSimulation = _simulationOwner.matchesValidID(myNodeID);
|
||||||
|
|
||||||
|
|
||||||
if (args.bitstreamVersion >= VERSION_ENTITIES_HAVE_SIMULATION_OWNER_AND_ACTIONS_OVER_WIRE) {
|
if (args.bitstreamVersion >= VERSION_ENTITIES_HAVE_SIMULATION_OWNER_AND_ACTIONS_OVER_WIRE) {
|
||||||
// pack SimulationOwner and terse update properties near each other
|
// pack SimulationOwner and terse update properties near each other
|
||||||
|
|
|
@ -84,9 +84,10 @@ CONSTRUCT_PROPERTY(shapeType, SHAPE_TYPE_NONE),
|
||||||
CONSTRUCT_PROPERTY(maxParticles, ParticleEffectEntityItem::DEFAULT_MAX_PARTICLES),
|
CONSTRUCT_PROPERTY(maxParticles, ParticleEffectEntityItem::DEFAULT_MAX_PARTICLES),
|
||||||
CONSTRUCT_PROPERTY(lifespan, ParticleEffectEntityItem::DEFAULT_LIFESPAN),
|
CONSTRUCT_PROPERTY(lifespan, ParticleEffectEntityItem::DEFAULT_LIFESPAN),
|
||||||
CONSTRUCT_PROPERTY(emitRate, ParticleEffectEntityItem::DEFAULT_EMIT_RATE),
|
CONSTRUCT_PROPERTY(emitRate, ParticleEffectEntityItem::DEFAULT_EMIT_RATE),
|
||||||
CONSTRUCT_PROPERTY(emitDirection, ParticleEffectEntityItem::DEFAULT_EMIT_DIRECTION),
|
CONSTRUCT_PROPERTY(emitVelocity, ParticleEffectEntityItem::DEFAULT_EMIT_VELOCITY),
|
||||||
CONSTRUCT_PROPERTY(emitStrength, ParticleEffectEntityItem::DEFAULT_EMIT_STRENGTH),
|
CONSTRUCT_PROPERTY(velocitySpread, ParticleEffectEntityItem::DEFAULT_VELOCITY_SPREAD),
|
||||||
CONSTRUCT_PROPERTY(localGravity, ParticleEffectEntityItem::DEFAULT_LOCAL_GRAVITY),
|
CONSTRUCT_PROPERTY(emitAcceleration, ParticleEffectEntityItem::DEFAULT_EMIT_ACCELERATION),
|
||||||
|
CONSTRUCT_PROPERTY(accelerationSpread, ParticleEffectEntityItem::DEFAULT_ACCELERATION_SPREAD),
|
||||||
CONSTRUCT_PROPERTY(particleRadius, ParticleEffectEntityItem::DEFAULT_PARTICLE_RADIUS),
|
CONSTRUCT_PROPERTY(particleRadius, ParticleEffectEntityItem::DEFAULT_PARTICLE_RADIUS),
|
||||||
CONSTRUCT_PROPERTY(marketplaceID, ENTITY_ITEM_DEFAULT_MARKETPLACE_ID),
|
CONSTRUCT_PROPERTY(marketplaceID, ENTITY_ITEM_DEFAULT_MARKETPLACE_ID),
|
||||||
CONSTRUCT_PROPERTY(keyLightColor, ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR),
|
CONSTRUCT_PROPERTY(keyLightColor, ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR),
|
||||||
|
@ -349,9 +350,10 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_MAX_PARTICLES, maxParticles);
|
CHECK_PROPERTY_CHANGE(PROP_MAX_PARTICLES, maxParticles);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LIFESPAN, lifespan);
|
CHECK_PROPERTY_CHANGE(PROP_LIFESPAN, lifespan);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_EMIT_RATE, emitRate);
|
CHECK_PROPERTY_CHANGE(PROP_EMIT_RATE, emitRate);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_EMIT_DIRECTION, emitDirection);
|
CHECK_PROPERTY_CHANGE(PROP_EMIT_VELOCITY, emitVelocity);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_EMIT_STRENGTH, emitStrength);
|
CHECK_PROPERTY_CHANGE(PROP_VELOCITY_SPREAD, velocitySpread);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LOCAL_GRAVITY, localGravity);
|
CHECK_PROPERTY_CHANGE(PROP_EMIT_ACCELERATION, emitAcceleration);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_ACCELERATION_SPREAD, accelerationSpread);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_PARTICLE_RADIUS, particleRadius);
|
CHECK_PROPERTY_CHANGE(PROP_PARTICLE_RADIUS, particleRadius);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_MARKETPLACE_ID, marketplaceID);
|
CHECK_PROPERTY_CHANGE(PROP_MARKETPLACE_ID, marketplaceID);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_NAME, name);
|
CHECK_PROPERTY_CHANGE(PROP_NAME, name);
|
||||||
|
@ -451,9 +453,10 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(maxParticles);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(maxParticles);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(lifespan);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(lifespan);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(emitRate);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(emitRate);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(emitDirection);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(emitVelocity);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(emitStrength);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(velocitySpread);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(localGravity);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(emitAcceleration);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(accelerationSpread);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(particleRadius);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(particleRadius);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(marketplaceID);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(marketplaceID);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(name);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(name);
|
||||||
|
@ -571,9 +574,10 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(maxParticles, float, setMaxParticles);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(maxParticles, float, setMaxParticles);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(lifespan, float, setLifespan);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(lifespan, float, setLifespan);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(emitRate, float, setEmitRate);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(emitRate, float, setEmitRate);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(emitDirection, glmVec3, setEmitDirection);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(emitVelocity, glmVec3, setEmitVelocity);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(emitStrength, float, setEmitStrength);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(velocitySpread, glmVec3, setVelocitySpread);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(localGravity, float, setLocalGravity);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(emitAcceleration, glmVec3, setEmitAcceleration);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(accelerationSpread, glmVec3, setAccelerationSpread);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(particleRadius, float, setParticleRadius);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(particleRadius, float, setParticleRadius);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(marketplaceID, QString, setMarketplaceID);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(marketplaceID, QString, setMarketplaceID);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName);
|
||||||
|
@ -812,10 +816,12 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
||||||
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, properties.getMaxParticles());
|
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, properties.getMaxParticles());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, properties.getLifespan());
|
APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, properties.getLifespan());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, properties.getEmitRate());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, properties.getEmitRate());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_DIRECTION, properties.getEmitDirection());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_VELOCITY, properties.getEmitVelocity());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_STRENGTH, properties.getEmitStrength());
|
APPEND_ENTITY_PROPERTY(PROP_VELOCITY_SPREAD, properties.getVelocitySpread());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LOCAL_GRAVITY, properties.getLocalGravity());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_ACCELERATION, properties.getEmitAcceleration());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_ACCELERATION_SPREAD, properties.getAccelerationSpread());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, properties.getParticleRadius());
|
APPEND_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, properties.getParticleRadius());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.getType() == EntityTypes::Zone) {
|
if (properties.getType() == EntityTypes::Zone) {
|
||||||
|
@ -1080,9 +1086,10 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MAX_PARTICLES, float, setMaxParticles);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MAX_PARTICLES, float, setMaxParticles);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFESPAN, float, setLifespan);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LIFESPAN, float, setLifespan);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_RATE, float, setEmitRate);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_RATE, float, setEmitRate);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_DIRECTION, glm::vec3, setEmitDirection);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_VELOCITY, glm::vec3, setEmitVelocity);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_STRENGTH, float, setEmitStrength);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VELOCITY_SPREAD, glm::vec3, setVelocitySpread);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCAL_GRAVITY, float, setLocalGravity);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EMIT_ACCELERATION, glm::vec3, setEmitAcceleration);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ACCELERATION_SPREAD, glm::vec3, setAccelerationSpread);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,9 +1218,10 @@ void EntityItemProperties::markAllChanged() {
|
||||||
_maxParticlesChanged = true;
|
_maxParticlesChanged = true;
|
||||||
_lifespanChanged = true;
|
_lifespanChanged = true;
|
||||||
_emitRateChanged = true;
|
_emitRateChanged = true;
|
||||||
_emitDirectionChanged = true;
|
_emitVelocityChanged = true;
|
||||||
_emitStrengthChanged = true;
|
_velocitySpreadChanged = true;
|
||||||
_localGravityChanged = true;
|
_emitAccelerationChanged = true;
|
||||||
|
_accelerationSpreadChanged = true;
|
||||||
_particleRadiusChanged = true;
|
_particleRadiusChanged = true;
|
||||||
|
|
||||||
_marketplaceIDChanged = true;
|
_marketplaceIDChanged = true;
|
||||||
|
|
|
@ -131,9 +131,10 @@ public:
|
||||||
DEFINE_PROPERTY(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32);
|
DEFINE_PROPERTY(PROP_MAX_PARTICLES, MaxParticles, maxParticles, quint32);
|
||||||
DEFINE_PROPERTY(PROP_LIFESPAN, Lifespan, lifespan, float);
|
DEFINE_PROPERTY(PROP_LIFESPAN, Lifespan, lifespan, float);
|
||||||
DEFINE_PROPERTY(PROP_EMIT_RATE, EmitRate, emitRate, float);
|
DEFINE_PROPERTY(PROP_EMIT_RATE, EmitRate, emitRate, float);
|
||||||
DEFINE_PROPERTY_REF(PROP_EMIT_DIRECTION, EmitDirection, emitDirection, glm::vec3);
|
DEFINE_PROPERTY_REF(PROP_EMIT_VELOCITY, EmitVelocity, emitVelocity, glm::vec3);
|
||||||
DEFINE_PROPERTY(PROP_EMIT_STRENGTH, EmitStrength, emitStrength, float);
|
DEFINE_PROPERTY_REF(PROP_VELOCITY_SPREAD, VelocitySpread, velocitySpread, glm::vec3);
|
||||||
DEFINE_PROPERTY(PROP_LOCAL_GRAVITY, LocalGravity, localGravity, float);
|
DEFINE_PROPERTY(PROP_EMIT_ACCELERATION, EmitAcceleration, emitAcceleration, glm::vec3);
|
||||||
|
DEFINE_PROPERTY(PROP_ACCELERATION_SPREAD, AccelerationSpread, accelerationSpread, glm::vec3);
|
||||||
DEFINE_PROPERTY(PROP_PARTICLE_RADIUS, ParticleRadius, particleRadius, float);
|
DEFINE_PROPERTY(PROP_PARTICLE_RADIUS, ParticleRadius, particleRadius, float);
|
||||||
DEFINE_PROPERTY_REF(PROP_MARKETPLACE_ID, MarketplaceID, marketplaceID, QString);
|
DEFINE_PROPERTY_REF(PROP_MARKETPLACE_ID, MarketplaceID, marketplaceID, QString);
|
||||||
DEFINE_PROPERTY_REF(PROP_KEYLIGHT_COLOR, KeyLightColor, keyLightColor, xColor);
|
DEFINE_PROPERTY_REF(PROP_KEYLIGHT_COLOR, KeyLightColor, keyLightColor, xColor);
|
||||||
|
@ -311,9 +312,9 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, MaxParticles, maxParticles, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, MaxParticles, maxParticles, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Lifespan, lifespan, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Lifespan, lifespan, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EmitRate, emitRate, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EmitRate, emitRate, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EmitDirection, emitDirection, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EmitVelocity, emitVelocity, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EmitStrength, emitStrength, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EmitAcceleration, emitAcceleration, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalGravity, localGravity, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AccelerationSpread, accelerationSpread, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ParticleRadius, particleRadius, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ParticleRadius, particleRadius, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, MarketplaceID, marketplaceID, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, MarketplaceID, marketplaceID, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, BackgroundMode, backgroundMode, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, BackgroundMode, backgroundMode, "");
|
||||||
|
|
|
@ -96,9 +96,9 @@ enum EntityPropertyList {
|
||||||
PROP_MAX_PARTICLES,
|
PROP_MAX_PARTICLES,
|
||||||
PROP_LIFESPAN,
|
PROP_LIFESPAN,
|
||||||
PROP_EMIT_RATE,
|
PROP_EMIT_RATE,
|
||||||
PROP_EMIT_DIRECTION,
|
PROP_EMIT_VELOCITY,
|
||||||
PROP_EMIT_STRENGTH,
|
PROP_EMIT_STRENGTH,
|
||||||
PROP_LOCAL_GRAVITY,
|
PROP_EMIT_ACCELERATION,
|
||||||
PROP_PARTICLE_RADIUS,
|
PROP_PARTICLE_RADIUS,
|
||||||
|
|
||||||
PROP_COMPOUND_SHAPE_URL, // used by Model + zones entities
|
PROP_COMPOUND_SHAPE_URL, // used by Model + zones entities
|
||||||
|
@ -134,7 +134,10 @@ enum EntityPropertyList {
|
||||||
// Used by PolyLine entity
|
// Used by PolyLine entity
|
||||||
PROP_NORMALS,
|
PROP_NORMALS,
|
||||||
PROP_STROKE_WIDTHS,
|
PROP_STROKE_WIDTHS,
|
||||||
|
|
||||||
|
// used by particles
|
||||||
|
PROP_VELOCITY_SPREAD,
|
||||||
|
PROP_ACCELERATION_SPREAD,
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// ATTENTION: add new properties to end of list just ABOVE this line
|
// ATTENTION: add new properties to end of list just ABOVE this line
|
||||||
|
@ -168,9 +171,9 @@ enum EntityPropertyList {
|
||||||
PROP_ATMOSPHERE_CENTER = PROP_MAX_PARTICLES,
|
PROP_ATMOSPHERE_CENTER = PROP_MAX_PARTICLES,
|
||||||
PROP_ATMOSPHERE_INNER_RADIUS = PROP_LIFESPAN,
|
PROP_ATMOSPHERE_INNER_RADIUS = PROP_LIFESPAN,
|
||||||
PROP_ATMOSPHERE_OUTER_RADIUS = PROP_EMIT_RATE,
|
PROP_ATMOSPHERE_OUTER_RADIUS = PROP_EMIT_RATE,
|
||||||
PROP_ATMOSPHERE_MIE_SCATTERING = PROP_EMIT_DIRECTION,
|
PROP_ATMOSPHERE_MIE_SCATTERING = PROP_EMIT_VELOCITY,
|
||||||
PROP_ATMOSPHERE_RAYLEIGH_SCATTERING = PROP_EMIT_STRENGTH,
|
PROP_ATMOSPHERE_RAYLEIGH_SCATTERING = PROP_EMIT_STRENGTH,
|
||||||
PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS = PROP_LOCAL_GRAVITY,
|
PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS = PROP_EMIT_ACCELERATION,
|
||||||
PROP_ATMOSPHERE_HAS_STARS = PROP_PARTICLE_RADIUS,
|
PROP_ATMOSPHERE_HAS_STARS = PROP_PARTICLE_RADIUS,
|
||||||
PROP_BACKGROUND_MODE = PROP_MODEL_URL,
|
PROP_BACKGROUND_MODE = PROP_MODEL_URL,
|
||||||
PROP_SKYBOX_COLOR = PROP_ANIMATION_URL,
|
PROP_SKYBOX_COLOR = PROP_ANIMATION_URL,
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// - Just to get this out the door, I just did forward Euler integration. There are better ways.
|
// - Just to get this out the door, I just did forward Euler integration. There are better ways.
|
||||||
// - Gravity always points along the Y axis. Support an actual gravity vector.
|
// - Gravity always points along the Y axis. Support an actual gravity vector.
|
||||||
// - Add the ability to add arbitrary forces to the simulation.
|
// - Add the ability to add arbitrary forces to the simulation.
|
||||||
// - Add controls for spread (which is currently hard-coded) and varying emission strength (not currently implemented).
|
|
||||||
// - Add drag.
|
// - Add drag.
|
||||||
// - Add some kind of support for collisions.
|
// - Add some kind of support for collisions.
|
||||||
// - There's no synchronization of the simulation across clients at all. In fact, it's using rand() under the hood, so
|
// - There's no synchronization of the simulation across clients at all. In fact, it's using rand() under the hood, so
|
||||||
|
@ -50,9 +49,10 @@ const float ParticleEffectEntityItem::DEFAULT_ANIMATION_FPS = 30.0f;
|
||||||
const quint32 ParticleEffectEntityItem::DEFAULT_MAX_PARTICLES = 1000;
|
const quint32 ParticleEffectEntityItem::DEFAULT_MAX_PARTICLES = 1000;
|
||||||
const float ParticleEffectEntityItem::DEFAULT_LIFESPAN = 3.0f;
|
const float ParticleEffectEntityItem::DEFAULT_LIFESPAN = 3.0f;
|
||||||
const float ParticleEffectEntityItem::DEFAULT_EMIT_RATE = 15.0f;
|
const float ParticleEffectEntityItem::DEFAULT_EMIT_RATE = 15.0f;
|
||||||
const glm::vec3 ParticleEffectEntityItem::DEFAULT_EMIT_DIRECTION(0.0f, 1.0f, 0.0f);
|
const glm::vec3 ParticleEffectEntityItem::DEFAULT_EMIT_VELOCITY(0.0f, 5.0f, 0.0f);
|
||||||
const float ParticleEffectEntityItem::DEFAULT_EMIT_STRENGTH = 25.0f;
|
const glm::vec3 ParticleEffectEntityItem::DEFAULT_VELOCITY_SPREAD(3.0f, 0.0f, 3.0f);
|
||||||
const float ParticleEffectEntityItem::DEFAULT_LOCAL_GRAVITY = -9.8f;
|
const glm::vec3 ParticleEffectEntityItem::DEFAULT_EMIT_ACCELERATION(0.0f, -9.8f, 0.0f);
|
||||||
|
const glm::vec3 ParticleEffectEntityItem::DEFAULT_ACCELERATION_SPREAD(0.0f, 0.0f, 0.0f);
|
||||||
const float ParticleEffectEntityItem::DEFAULT_PARTICLE_RADIUS = 0.025f;
|
const float ParticleEffectEntityItem::DEFAULT_PARTICLE_RADIUS = 0.025f;
|
||||||
const QString ParticleEffectEntityItem::DEFAULT_TEXTURES = "";
|
const QString ParticleEffectEntityItem::DEFAULT_TEXTURES = "";
|
||||||
|
|
||||||
|
@ -67,9 +67,10 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
|
||||||
_maxParticles(DEFAULT_MAX_PARTICLES),
|
_maxParticles(DEFAULT_MAX_PARTICLES),
|
||||||
_lifespan(DEFAULT_LIFESPAN),
|
_lifespan(DEFAULT_LIFESPAN),
|
||||||
_emitRate(DEFAULT_EMIT_RATE),
|
_emitRate(DEFAULT_EMIT_RATE),
|
||||||
_emitDirection(DEFAULT_EMIT_DIRECTION),
|
_emitVelocity(DEFAULT_EMIT_VELOCITY),
|
||||||
_emitStrength(DEFAULT_EMIT_STRENGTH),
|
_velocitySpread(DEFAULT_VELOCITY_SPREAD),
|
||||||
_localGravity(DEFAULT_LOCAL_GRAVITY),
|
_emitAcceleration(DEFAULT_EMIT_ACCELERATION),
|
||||||
|
_accelerationSpread(DEFAULT_ACCELERATION_SPREAD),
|
||||||
_particleRadius(DEFAULT_PARTICLE_RADIUS),
|
_particleRadius(DEFAULT_PARTICLE_RADIUS),
|
||||||
_lastAnimated(usecTimestampNow()),
|
_lastAnimated(usecTimestampNow()),
|
||||||
_animationLoop(),
|
_animationLoop(),
|
||||||
|
@ -80,6 +81,7 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
|
||||||
_particleLifetimes(DEFAULT_MAX_PARTICLES, 0.0f),
|
_particleLifetimes(DEFAULT_MAX_PARTICLES, 0.0f),
|
||||||
_particlePositions(DEFAULT_MAX_PARTICLES, glm::vec3(0.0f, 0.0f, 0.0f)),
|
_particlePositions(DEFAULT_MAX_PARTICLES, glm::vec3(0.0f, 0.0f, 0.0f)),
|
||||||
_particleVelocities(DEFAULT_MAX_PARTICLES, glm::vec3(0.0f, 0.0f, 0.0f)),
|
_particleVelocities(DEFAULT_MAX_PARTICLES, glm::vec3(0.0f, 0.0f, 0.0f)),
|
||||||
|
_particleAccelerations(DEFAULT_MAX_PARTICLES, glm::vec3(0.0f, 0.0f, 0.0f)),
|
||||||
_timeUntilNextEmit(0.0f),
|
_timeUntilNextEmit(0.0f),
|
||||||
_particleHeadIndex(0),
|
_particleHeadIndex(0),
|
||||||
_particleTailIndex(0),
|
_particleTailIndex(0),
|
||||||
|
@ -94,75 +96,59 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
|
||||||
ParticleEffectEntityItem::~ParticleEffectEntityItem() {
|
ParticleEffectEntityItem::~ParticleEffectEntityItem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::setDimensions(const glm::vec3& value) {
|
|
||||||
computeAndUpdateDimensions();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ParticleEffectEntityItem::setLifespan(float lifespan) {
|
void ParticleEffectEntityItem::setLifespan(float lifespan) {
|
||||||
_lifespan = lifespan;
|
_lifespan = lifespan;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParticleEffectEntityItem::setEmitVelocity(const glm::vec3& emitVelocity) {
|
||||||
|
_emitVelocity = emitVelocity;
|
||||||
computeAndUpdateDimensions();
|
computeAndUpdateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::setEmitDirection(glm::vec3 emitDirection) {
|
void ParticleEffectEntityItem::setVelocitySpread(const glm::vec3& velocitySpread) {
|
||||||
_emitDirection = glm::normalize(emitDirection);
|
_velocitySpread = velocitySpread;
|
||||||
computeAndUpdateDimensions();
|
computeAndUpdateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::setEmitStrength(float emitStrength) {
|
|
||||||
_emitStrength = emitStrength;
|
void ParticleEffectEntityItem::setEmitAcceleration(const glm::vec3& emitAcceleration) {
|
||||||
|
_emitAcceleration = emitAcceleration;
|
||||||
computeAndUpdateDimensions();
|
computeAndUpdateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::setLocalGravity(float localGravity) {
|
void ParticleEffectEntityItem::setAccelerationSpread(const glm::vec3& accelerationSpread){
|
||||||
_localGravity = localGravity;
|
_accelerationSpread = accelerationSpread;
|
||||||
computeAndUpdateDimensions();
|
computeAndUpdateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::setParticleRadius(float particleRadius) {
|
void ParticleEffectEntityItem::setParticleRadius(float particleRadius) {
|
||||||
_particleRadius = particleRadius;
|
_particleRadius = particleRadius;
|
||||||
computeAndUpdateDimensions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::computeAndUpdateDimensions() {
|
void ParticleEffectEntityItem::computeAndUpdateDimensions() {
|
||||||
|
const float time = _lifespan * 1.1f; // add 10% extra time to account for incremental timer accumulation error
|
||||||
const float t = _lifespan * 1.1f; // add 10% extra time, to account for incremental timer accumulation error.
|
|
||||||
const float MAX_RANDOM_FACTOR = (0.5f * 0.25f);
|
float maxVelocityX = fabsf(_velocity.x) + _velocitySpread.x;
|
||||||
const float maxOffset = (MAX_RANDOM_FACTOR * _emitStrength) + _particleRadius;
|
float maxAccelerationX = fabsf(_acceleration.x) + _accelerationSpread.x;
|
||||||
|
float maxXDistance = (maxVelocityX * time) + (0.5 * maxAccelerationX * time * time);
|
||||||
// bounds for x and z is easy to compute because there is no at^2 term.
|
|
||||||
float xMax = (_emitDirection.x * _emitStrength + maxOffset) * t;
|
float maxVelocityY = fabs(_velocity.y) + _velocitySpread.y;
|
||||||
float xMin = (_emitDirection.x * _emitStrength - maxOffset) * t;
|
float maxAccelerationY = fabsf(_acceleration.y) + _accelerationSpread.y;
|
||||||
|
float maxYDistance = (maxVelocityY * time) + (0.5 * maxAccelerationY * time * time);
|
||||||
float zMax = (_emitDirection.z * _emitStrength + maxOffset) * t;
|
|
||||||
float zMin = (_emitDirection.z * _emitStrength - maxOffset) * t;
|
float maxVelocityZ = fabsf(_velocity.z) + _velocitySpread.z;
|
||||||
|
float maxAccelerationZ = fabsf(_acceleration.z) + _accelerationSpread.z;
|
||||||
// yEnd is where the particle will end.
|
float maxZDistance = (maxVelocityZ * time) + (0.5 * maxAccelerationZ * time * time);
|
||||||
float a = _localGravity;
|
|
||||||
float atSquared = a * t * t;
|
float maxDistance = std::max(maxXDistance, std::max(maxYDistance, maxZDistance));
|
||||||
float v = _emitDirection.y * _emitStrength + maxOffset;
|
|
||||||
float vt = v * t;
|
//times 2 because dimensions are diameters not radii
|
||||||
float yEnd = 0.5f * atSquared + vt;
|
glm::vec3 dims(2.0 * maxDistance);
|
||||||
|
|
||||||
// yApex is where the particle is at it's apex.
|
|
||||||
float yApexT = (-v / a);
|
|
||||||
float yApex = 0.0f;
|
|
||||||
|
|
||||||
// only set apex if it's within the lifespan of the particle.
|
|
||||||
if (yApexT >= 0.0f && yApexT <= t) {
|
|
||||||
yApex = -(v * v) / (2.0f * a);
|
|
||||||
}
|
|
||||||
|
|
||||||
float yMax = std::max(yApex, yEnd);
|
|
||||||
float yMin = std::min(yApex, yEnd);
|
|
||||||
|
|
||||||
// times 2 because dimensions are diameters not radii.
|
|
||||||
glm::vec3 dims(2.0f * std::max(fabsf(xMin), fabsf(xMax)),
|
|
||||||
2.0f * std::max(fabsf(yMin), fabsf(yMax)),
|
|
||||||
2.0f * std::max(fabsf(zMin), fabsf(zMax)));
|
|
||||||
|
|
||||||
EntityItem::setDimensions(dims);
|
EntityItem::setDimensions(dims);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityItemProperties ParticleEffectEntityItem::getProperties() const {
|
EntityItemProperties ParticleEffectEntityItem::getProperties() const {
|
||||||
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
|
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
|
||||||
|
|
||||||
|
@ -176,9 +162,9 @@ EntityItemProperties ParticleEffectEntityItem::getProperties() const {
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(maxParticles, getMaxParticles);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(maxParticles, getMaxParticles);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lifespan, getLifespan);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lifespan, getLifespan);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(emitRate, getEmitRate);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(emitRate, getEmitRate);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(emitDirection, getEmitDirection);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(emitVelocity, getEmitVelocity);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(emitStrength, getEmitStrength);
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(localGravity, getLocalGravity);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(emitAcceleration, getEmitAcceleration);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(particleRadius, getParticleRadius);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(particleRadius, getParticleRadius);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures);
|
||||||
|
|
||||||
|
@ -198,11 +184,12 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(maxParticles, setMaxParticles);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(maxParticles, setMaxParticles);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifespan, setLifespan);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifespan, setLifespan);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(emitRate, setEmitRate);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(emitRate, setEmitRate);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(emitDirection, setEmitDirection);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(emitVelocity, setEmitVelocity);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(emitStrength, setEmitStrength);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(emitAcceleration, setEmitAcceleration);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(localGravity, setLocalGravity);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(accelerationSpread, setAccelerationSpread);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(particleRadius, setParticleRadius);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(particleRadius, setParticleRadius);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(velocitySpread, setVelocitySpread);
|
||||||
|
|
||||||
if (somethingChanged) {
|
if (somethingChanged) {
|
||||||
bool wantDebug = false;
|
bool wantDebug = false;
|
||||||
|
@ -247,17 +234,28 @@ int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned ch
|
||||||
if (propertyFlags.getHasProperty(PROP_ANIMATION_FRAME_INDEX)) {
|
if (propertyFlags.getHasProperty(PROP_ANIMATION_FRAME_INDEX)) {
|
||||||
setAnimationFrameIndex(animationFrameIndex);
|
setAnimationFrameIndex(animationFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
||||||
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType);
|
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType);
|
||||||
READ_ENTITY_PROPERTY(PROP_MAX_PARTICLES, quint32, setMaxParticles);
|
READ_ENTITY_PROPERTY(PROP_MAX_PARTICLES, quint32, setMaxParticles);
|
||||||
READ_ENTITY_PROPERTY(PROP_LIFESPAN, float, setLifespan);
|
READ_ENTITY_PROPERTY(PROP_LIFESPAN, float, setLifespan);
|
||||||
READ_ENTITY_PROPERTY(PROP_EMIT_RATE, float, setEmitRate);
|
READ_ENTITY_PROPERTY(PROP_EMIT_RATE, float, setEmitRate);
|
||||||
READ_ENTITY_PROPERTY(PROP_EMIT_DIRECTION, glm::vec3, setEmitDirection);
|
READ_ENTITY_PROPERTY(PROP_EMIT_VELOCITY, glm::vec3, setEmitVelocity);
|
||||||
READ_ENTITY_PROPERTY(PROP_EMIT_STRENGTH, float, setEmitStrength);
|
|
||||||
READ_ENTITY_PROPERTY(PROP_LOCAL_GRAVITY, float, setLocalGravity);
|
if (args.bitstreamVersion >= VERSION_ENTITIES_PARTICLE_MODIFICATIONS) {
|
||||||
READ_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
READ_ENTITY_PROPERTY(PROP_EMIT_ACCELERATION, glm::vec3, setEmitAcceleration);
|
||||||
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
|
READ_ENTITY_PROPERTY(PROP_ACCELERATION_SPREAD, glm::vec3, setAccelerationSpread);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_VELOCITY_SPREAD, glm::vec3, setVelocitySpread);
|
||||||
|
} else {
|
||||||
|
// EMIT_STRENGTH FAKEOUT
|
||||||
|
READ_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
||||||
|
// LOCAL_GRAVITY FAKEOUT
|
||||||
|
READ_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
||||||
|
// ACTUALLY PARTICLE RADIUS
|
||||||
|
READ_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, float, setParticleRadius);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
|
||||||
|
}
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -276,11 +274,12 @@ EntityPropertyFlags ParticleEffectEntityItem::getEntityProperties(EncodeBitstrea
|
||||||
requestedProperties += PROP_MAX_PARTICLES;
|
requestedProperties += PROP_MAX_PARTICLES;
|
||||||
requestedProperties += PROP_LIFESPAN;
|
requestedProperties += PROP_LIFESPAN;
|
||||||
requestedProperties += PROP_EMIT_RATE;
|
requestedProperties += PROP_EMIT_RATE;
|
||||||
requestedProperties += PROP_EMIT_DIRECTION;
|
requestedProperties += PROP_EMIT_VELOCITY;
|
||||||
requestedProperties += PROP_EMIT_STRENGTH;
|
requestedProperties += PROP_EMIT_ACCELERATION;
|
||||||
requestedProperties += PROP_LOCAL_GRAVITY;
|
requestedProperties += PROP_ACCELERATION_SPREAD;
|
||||||
requestedProperties += PROP_PARTICLE_RADIUS;
|
requestedProperties += PROP_PARTICLE_RADIUS;
|
||||||
requestedProperties += PROP_TEXTURES;
|
requestedProperties += PROP_TEXTURES;
|
||||||
|
requestedProperties += PROP_VELOCITY_SPREAD;
|
||||||
|
|
||||||
return requestedProperties;
|
return requestedProperties;
|
||||||
}
|
}
|
||||||
|
@ -303,11 +302,12 @@ void ParticleEffectEntityItem::appendSubclassData(OctreePacketData* packetData,
|
||||||
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, getMaxParticles());
|
APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, getMaxParticles());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, getLifespan());
|
APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, getLifespan());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, getEmitRate());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, getEmitRate());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_DIRECTION, getEmitDirection());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_VELOCITY, getEmitVelocity());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EMIT_STRENGTH, getEmitStrength());
|
APPEND_ENTITY_PROPERTY(PROP_EMIT_ACCELERATION, getEmitAcceleration());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LOCAL_GRAVITY, getLocalGravity());
|
APPEND_ENTITY_PROPERTY(PROP_ACCELERATION_SPREAD, getAccelerationSpread());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, getParticleRadius());
|
APPEND_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, getParticleRadius());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
|
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_VELOCITY_SPREAD, getVelocitySpread());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleEffectEntityItem::isAnimatingSomething() const {
|
bool ParticleEffectEntityItem::isAnimatingSomething() const {
|
||||||
|
@ -487,8 +487,9 @@ void ParticleEffectEntityItem::extendBounds(const glm::vec3& point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffectEntityItem::integrateParticle(quint32 index, float deltaTime) {
|
void ParticleEffectEntityItem::integrateParticle(quint32 index, float deltaTime) {
|
||||||
glm::vec3 atSquared(0.0f, 0.5f * _localGravity * deltaTime * deltaTime, 0.0f);
|
glm::vec3 accel = _particleAccelerations[index];
|
||||||
glm::vec3 at(0.0f, _localGravity * deltaTime, 0.0f);
|
glm::vec3 atSquared = (0.5f * deltaTime * deltaTime) * accel;
|
||||||
|
glm::vec3 at = accel * deltaTime;
|
||||||
_particlePositions[index] += _particleVelocities[index] * deltaTime + atSquared;
|
_particlePositions[index] += _particleVelocities[index] * deltaTime + atSquared;
|
||||||
_particleVelocities[index] += at;
|
_particleVelocities[index] += at;
|
||||||
}
|
}
|
||||||
|
@ -526,15 +527,22 @@ void ParticleEffectEntityItem::stepSimulation(float deltaTime) {
|
||||||
quint32 i = _particleTailIndex;
|
quint32 i = _particleTailIndex;
|
||||||
_particleLifetimes[i] = _lifespan;
|
_particleLifetimes[i] = _lifespan;
|
||||||
|
|
||||||
// jitter the _emitDirection by a random offset
|
|
||||||
glm::vec3 randOffset;
|
glm::vec3 spreadOffset;
|
||||||
randOffset.x = (randFloat() - 0.5f) * 0.25f * _emitStrength;
|
spreadOffset.x = -_velocitySpread.x + randFloat() * (_velocitySpread.x * 2.0f);
|
||||||
randOffset.y = (randFloat() - 0.5f) * 0.25f * _emitStrength;
|
spreadOffset.y = -_velocitySpread.y + randFloat() * (_velocitySpread.y * 2.0f);
|
||||||
randOffset.z = (randFloat() - 0.5f) * 0.25f * _emitStrength;
|
spreadOffset.z = -_velocitySpread.z + randFloat() * (_velocitySpread.z * 2.0f);
|
||||||
|
|
||||||
|
|
||||||
// set initial conditions
|
// set initial conditions
|
||||||
_particlePositions[i] = glm::vec3(0.0f, 0.0f, 0.0f);
|
_particlePositions[i] = getPosition();
|
||||||
_particleVelocities[i] = _emitDirection * _emitStrength + randOffset;
|
_particleVelocities[i] = _emitVelocity + spreadOffset;
|
||||||
|
|
||||||
|
spreadOffset.x = -_accelerationSpread.x + randFloat() * (_accelerationSpread.x * 2.0f);
|
||||||
|
spreadOffset.y = -_accelerationSpread.y + randFloat() * (_accelerationSpread.y * 2.0f);
|
||||||
|
spreadOffset.z = -_accelerationSpread.z + randFloat() * (_accelerationSpread.z * 2.0f);
|
||||||
|
|
||||||
|
_particleAccelerations[i] = _emitAcceleration + spreadOffset;
|
||||||
|
|
||||||
integrateParticle(i, timeLeftInFrame);
|
integrateParticle(i, timeLeftInFrame);
|
||||||
extendBounds(_particlePositions[i]);
|
extendBounds(_particlePositions[i]);
|
||||||
|
|
|
@ -86,8 +86,6 @@ public:
|
||||||
void setAnimationLastFrame(float lastFrame) { _animationLoop.setLastFrame(lastFrame); }
|
void setAnimationLastFrame(float lastFrame) { _animationLoop.setLastFrame(lastFrame); }
|
||||||
float getAnimationLastFrame() const { return _animationLoop.getLastFrame(); }
|
float getAnimationLastFrame() const { return _animationLoop.getLastFrame(); }
|
||||||
|
|
||||||
virtual void setDimensions(const glm::vec3& value) override;
|
|
||||||
|
|
||||||
static const quint32 DEFAULT_MAX_PARTICLES;
|
static const quint32 DEFAULT_MAX_PARTICLES;
|
||||||
void setMaxParticles(quint32 maxParticles);
|
void setMaxParticles(quint32 maxParticles);
|
||||||
quint32 getMaxParticles() const { return _maxParticles; }
|
quint32 getMaxParticles() const { return _maxParticles; }
|
||||||
|
@ -100,24 +98,31 @@ public:
|
||||||
void setEmitRate(float emitRate) { _emitRate = emitRate; }
|
void setEmitRate(float emitRate) { _emitRate = emitRate; }
|
||||||
float getEmitRate() const { return _emitRate; }
|
float getEmitRate() const { return _emitRate; }
|
||||||
|
|
||||||
static const glm::vec3 DEFAULT_EMIT_DIRECTION;
|
static const glm::vec3 DEFAULT_EMIT_VELOCITY;
|
||||||
void setEmitDirection(glm::vec3 emitDirection);
|
void setEmitVelocity(const glm::vec3& emitVelocity);
|
||||||
const glm::vec3& getEmitDirection() const { return _emitDirection; }
|
const glm::vec3& getEmitVelocity() const { return _emitVelocity; }
|
||||||
|
|
||||||
|
|
||||||
|
static const glm::vec3 DEFAULT_VELOCITY_SPREAD;
|
||||||
|
void setVelocitySpread(const glm::vec3& velocitySpread);
|
||||||
|
const glm::vec3& getVelocitySpread() const { return _velocitySpread; }
|
||||||
|
|
||||||
static const float DEFAULT_EMIT_STRENGTH;
|
|
||||||
void setEmitStrength(float emitStrength);
|
|
||||||
float getEmitStrength() const { return _emitStrength; }
|
|
||||||
|
|
||||||
static const float DEFAULT_LOCAL_GRAVITY;
|
static const glm::vec3 DEFAULT_EMIT_ACCELERATION;
|
||||||
void setLocalGravity(float localGravity);
|
void setEmitAcceleration(const glm::vec3& emitAcceleration);
|
||||||
float getLocalGravity() const { return _localGravity; }
|
const glm::vec3& getEmitAcceleration() const { return _emitAcceleration; }
|
||||||
|
|
||||||
|
static const glm::vec3 DEFAULT_ACCELERATION_SPREAD;
|
||||||
|
void setAccelerationSpread(const glm::vec3& accelerationSpread);
|
||||||
|
const glm::vec3& getAccelerationSpread() const { return _accelerationSpread; }
|
||||||
|
|
||||||
static const float DEFAULT_PARTICLE_RADIUS;
|
static const float DEFAULT_PARTICLE_RADIUS;
|
||||||
void setParticleRadius(float particleRadius);
|
void setParticleRadius(float particleRadius);
|
||||||
float getParticleRadius() const { return _particleRadius; }
|
float getParticleRadius() const { return _particleRadius; }
|
||||||
|
|
||||||
void computeAndUpdateDimensions();
|
void computeAndUpdateDimensions();
|
||||||
|
|
||||||
|
|
||||||
bool getAnimationIsPlaying() const { return _animationLoop.isRunning(); }
|
bool getAnimationIsPlaying() const { return _animationLoop.isRunning(); }
|
||||||
float getAnimationFrameIndex() const { return _animationLoop.getFrameIndex(); }
|
float getAnimationFrameIndex() const { return _animationLoop.getFrameIndex(); }
|
||||||
float getAnimationFPS() const { return _animationLoop.getFPS(); }
|
float getAnimationFPS() const { return _animationLoop.getFPS(); }
|
||||||
|
@ -145,9 +150,10 @@ protected:
|
||||||
quint32 _maxParticles;
|
quint32 _maxParticles;
|
||||||
float _lifespan;
|
float _lifespan;
|
||||||
float _emitRate;
|
float _emitRate;
|
||||||
glm::vec3 _emitDirection;
|
glm::vec3 _emitVelocity;
|
||||||
float _emitStrength;
|
glm::vec3 _velocitySpread;
|
||||||
float _localGravity;
|
glm::vec3 _emitAcceleration;
|
||||||
|
glm::vec3 _accelerationSpread;
|
||||||
float _particleRadius;
|
float _particleRadius;
|
||||||
quint64 _lastAnimated;
|
quint64 _lastAnimated;
|
||||||
AnimationLoop _animationLoop;
|
AnimationLoop _animationLoop;
|
||||||
|
@ -160,6 +166,7 @@ protected:
|
||||||
QVector<float> _particleLifetimes;
|
QVector<float> _particleLifetimes;
|
||||||
QVector<glm::vec3> _particlePositions;
|
QVector<glm::vec3> _particlePositions;
|
||||||
QVector<glm::vec3> _particleVelocities;
|
QVector<glm::vec3> _particleVelocities;
|
||||||
|
QVector<glm::vec3> _particleAccelerations;
|
||||||
float _timeUntilNextEmit;
|
float _timeUntilNextEmit;
|
||||||
|
|
||||||
// particle arrays are a ring buffer, use these indicies
|
// particle arrays are a ring buffer, use these indicies
|
||||||
|
|
|
@ -7,6 +7,4 @@ add_dependency_external_projects(glm)
|
||||||
find_package(GLM REQUIRED)
|
find_package(GLM REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
link_hifi_libraries(shared networking)
|
link_hifi_libraries(shared networking)
|
||||||
|
|
|
@ -7,6 +7,4 @@ add_dependency_external_projects(glm)
|
||||||
find_package(GLM REQUIRED)
|
find_package(GLM REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
link_hifi_libraries(shared gpu model networking octree)
|
link_hifi_libraries(shared gpu model networking octree)
|
||||||
|
|
|
@ -2003,6 +2003,7 @@ FBXGeometry* extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping
|
||||||
|
|
||||||
material._material = make_shared<model::Material>();
|
material._material = make_shared<model::Material>();
|
||||||
material._material->setEmissive(material.emissive);
|
material._material->setEmissive(material.emissive);
|
||||||
|
// FIXME both cases are identical
|
||||||
if (glm::all(glm::equal(material.diffuse, glm::vec3(0.0f)))) {
|
if (glm::all(glm::equal(material.diffuse, glm::vec3(0.0f)))) {
|
||||||
material._material->setDiffuse(material.diffuse);
|
material._material->setDiffuse(material.diffuse);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -211,13 +211,17 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (tokenizer.nextToken()) {
|
switch (tokenizer.nextToken()) {
|
||||||
case OBJTokenizer::COMMENT_TOKEN:
|
case OBJTokenizer::COMMENT_TOKEN:
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader MTLLIB comment:" << tokenizer.getComment();
|
qCDebug(modelformat) << "OBJ Reader MTLLIB comment:" << tokenizer.getComment();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case OBJTokenizer::DATUM_TOKEN:
|
case OBJTokenizer::DATUM_TOKEN:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
materials[matName] = currentMaterial;
|
materials[matName] = currentMaterial;
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader Last material shininess:" << currentMaterial.shininess << " opacity:" << currentMaterial.opacity << " diffuse color:" << currentMaterial.diffuseColor << " specular color:" << currentMaterial.specularColor << " diffuse texture:" << currentMaterial.diffuseTextureFilename << " specular texture:" << currentMaterial.specularTextureFilename;
|
qCDebug(modelformat) << "OBJ Reader Last material shininess:" << currentMaterial.shininess << " opacity:" << currentMaterial.opacity << " diffuse color:" << currentMaterial.diffuseColor << " specular color:" << currentMaterial.specularColor << " diffuse texture:" << currentMaterial.diffuseTextureFilename << " specular texture:" << currentMaterial.specularTextureFilename;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray token = tokenizer.getDatum();
|
QByteArray token = tokenizer.getDatum();
|
||||||
|
@ -229,14 +233,18 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
matName = tokenizer.getDatum();
|
matName = tokenizer.getDatum();
|
||||||
currentMaterial = materials[matName];
|
currentMaterial = materials[matName];
|
||||||
currentMaterial.diffuseTextureFilename = "test";
|
currentMaterial.diffuseTextureFilename = "test";
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader Starting new material definition " << matName;
|
qCDebug(modelformat) << "OBJ Reader Starting new material definition " << matName;
|
||||||
|
#endif
|
||||||
currentMaterial.diffuseTextureFilename = "";
|
currentMaterial.diffuseTextureFilename = "";
|
||||||
} else if (token == "Ns") {
|
} else if (token == "Ns") {
|
||||||
currentMaterial.shininess = tokenizer.getFloat();
|
currentMaterial.shininess = tokenizer.getFloat();
|
||||||
} else if ((token == "d") || (token == "Tr")) {
|
} else if ((token == "d") || (token == "Tr")) {
|
||||||
currentMaterial.opacity = tokenizer.getFloat();
|
currentMaterial.opacity = tokenizer.getFloat();
|
||||||
} else if (token == "Ka") {
|
} else if (token == "Ka") {
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader Ignoring material Ka " << tokenizer.getVec3();
|
qCDebug(modelformat) << "OBJ Reader Ignoring material Ka " << tokenizer.getVec3();
|
||||||
|
#endif
|
||||||
} else if (token == "Kd") {
|
} else if (token == "Kd") {
|
||||||
currentMaterial.diffuseColor = tokenizer.getVec3();
|
currentMaterial.diffuseColor = tokenizer.getVec3();
|
||||||
} else if (token == "Ks") {
|
} else if (token == "Ks") {
|
||||||
|
@ -244,7 +252,9 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
} else if ((token == "map_Kd") || (token == "map_Ks")) {
|
} else if ((token == "map_Kd") || (token == "map_Ks")) {
|
||||||
QByteArray filename = QUrl(tokenizer.getLineAsDatum()).fileName().toUtf8();
|
QByteArray filename = QUrl(tokenizer.getLineAsDatum()).fileName().toUtf8();
|
||||||
if (filename.endsWith(".tga")) {
|
if (filename.endsWith(".tga")) {
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: currently ignoring tga texture " << filename << " in " << _url;
|
qCDebug(modelformat) << "OBJ Reader WARNING: currently ignoring tga texture " << filename << " in " << _url;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isValidTexture(filename)) {
|
if (isValidTexture(filename)) {
|
||||||
|
@ -254,7 +264,9 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
currentMaterial.specularTextureFilename = filename;
|
currentMaterial.specularTextureFilename = filename;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: " << _url << " ignoring missing texture " << filename;
|
qCDebug(modelformat) << "OBJ Reader WARNING: " << _url << " ignoring missing texture " << filename;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,7 +330,6 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
|
||||||
}
|
}
|
||||||
QByteArray groupName = tokenizer.getDatum();
|
QByteArray groupName = tokenizer.getDatum();
|
||||||
currentGroup = groupName;
|
currentGroup = groupName;
|
||||||
//qCDebug(modelformat) << "new group:" << groupName;
|
|
||||||
} else if (token == "mtllib" && _url) {
|
} else if (token == "mtllib" && _url) {
|
||||||
if (tokenizer.nextToken() != OBJTokenizer::DATUM_TOKEN) {
|
if (tokenizer.nextToken() != OBJTokenizer::DATUM_TOKEN) {
|
||||||
break;
|
break;
|
||||||
|
@ -330,13 +341,17 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
|
||||||
librariesSeen[libraryName] = true;
|
librariesSeen[libraryName] = true;
|
||||||
// Throw away any path part of libraryName, and merge against original url.
|
// Throw away any path part of libraryName, and merge against original url.
|
||||||
QUrl libraryUrl = _url->resolved(QUrl(libraryName).fileName());
|
QUrl libraryUrl = _url->resolved(QUrl(libraryName).fileName());
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader new library:" << libraryName << " at:" << libraryUrl;
|
qCDebug(modelformat) << "OBJ Reader new library:" << libraryName << " at:" << libraryUrl;
|
||||||
|
#endif
|
||||||
QNetworkReply* netReply = request(libraryUrl, false);
|
QNetworkReply* netReply = request(libraryUrl, false);
|
||||||
if (netReply->isFinished() && (netReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200)) {
|
if (netReply->isFinished() && (netReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200)) {
|
||||||
parseMaterialLibrary(netReply);
|
parseMaterialLibrary(netReply);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader " << libraryName << " did not answer. Got "
|
qCDebug(modelformat) << "OBJ Reader " << libraryName << " did not answer. Got "
|
||||||
<< netReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
|
<< netReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
netReply->deleteLater();
|
netReply->deleteLater();
|
||||||
} else if (token == "usemtl") {
|
} else if (token == "usemtl") {
|
||||||
|
@ -344,7 +359,9 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentMaterialName = tokenizer.getDatum();
|
currentMaterialName = tokenizer.getDatum();
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader new current material:" << currentMaterialName;
|
qCDebug(modelformat) << "OBJ Reader new current material:" << currentMaterialName;
|
||||||
|
#endif
|
||||||
} else if (token == "v") {
|
} else if (token == "v") {
|
||||||
vertices.append(tokenizer.getVec3());
|
vertices.append(tokenizer.getVec3());
|
||||||
} else if (token == "vn") {
|
} else if (token == "vn") {
|
||||||
|
@ -394,7 +411,6 @@ done:
|
||||||
} else {
|
} else {
|
||||||
faceGroups.append(faces); // We're done with this group. Add the faces.
|
faceGroups.append(faces); // We're done with this group. Add the faces.
|
||||||
}
|
}
|
||||||
//qCDebug(modelformat) << "end group:" << meshPart.materialID << " original faces:" << originalFaceCountForDebugging << " triangles:" << faces.count() << " keep going:" << result;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,13 +491,17 @@ FBXGeometry* OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping,
|
||||||
OBJFace leadFace = faceGroup[0]; // All the faces in the same group will have the same name and material.
|
OBJFace leadFace = faceGroup[0]; // All the faces in the same group will have the same name and material.
|
||||||
QString groupMaterialName = leadFace.materialName;
|
QString groupMaterialName = leadFace.materialName;
|
||||||
if (groupMaterialName.isEmpty() && (leadFace.textureUVIndices.count() > 0)) {
|
if (groupMaterialName.isEmpty() && (leadFace.textureUVIndices.count() > 0)) {
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: " << url
|
qCDebug(modelformat) << "OBJ Reader WARNING: " << url
|
||||||
<< " needs a texture that isn't specified. Using default mechanism.";
|
<< " needs a texture that isn't specified. Using default mechanism.";
|
||||||
|
#endif
|
||||||
groupMaterialName = SMART_DEFAULT_MATERIAL_NAME;
|
groupMaterialName = SMART_DEFAULT_MATERIAL_NAME;
|
||||||
} else if (!groupMaterialName.isEmpty() && !materials.contains(groupMaterialName)) {
|
} else if (!groupMaterialName.isEmpty() && !materials.contains(groupMaterialName)) {
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: " << url
|
qCDebug(modelformat) << "OBJ Reader WARNING: " << url
|
||||||
<< " specifies a material " << groupMaterialName
|
<< " specifies a material " << groupMaterialName
|
||||||
<< " that is not defined. Using default mechanism.";
|
<< " that is not defined. Using default mechanism.";
|
||||||
|
#endif
|
||||||
groupMaterialName = SMART_DEFAULT_MATERIAL_NAME;
|
groupMaterialName = SMART_DEFAULT_MATERIAL_NAME;
|
||||||
}
|
}
|
||||||
if (!groupMaterialName.isEmpty()) {
|
if (!groupMaterialName.isEmpty()) {
|
||||||
|
@ -496,7 +516,6 @@ FBXGeometry* OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping,
|
||||||
meshPart._material->setGloss(material->shininess);
|
meshPart._material->setGloss(material->shininess);
|
||||||
meshPart._material->setOpacity(material->opacity);
|
meshPart._material->setOpacity(material->opacity);
|
||||||
}
|
}
|
||||||
// qCDebug(modelformat) << "OBJ Reader part:" << meshPartCount << "name:" << leadFace.groupName << "material:" << groupMaterialName << "diffuse:" << meshPart._material->getDiffuse() << "faces:" << faceGroup.count() << "triangle indices will start with:" << mesh.vertices.count();
|
|
||||||
foreach(OBJFace face, faceGroup) {
|
foreach(OBJFace face, faceGroup) {
|
||||||
glm::vec3 v0 = vertices[face.vertexIndices[0]];
|
glm::vec3 v0 = vertices[face.vertexIndices[0]];
|
||||||
glm::vec3 v1 = vertices[face.vertexIndices[1]];
|
glm::vec3 v1 = vertices[face.vertexIndices[1]];
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME gpu)
|
set(TARGET_NAME gpu)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
AUTOSCRIBE_SHADER_LIB(gpu)
|
AUTOSCRIBE_SHADER_LIB(gpu)
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
|
|
|
@ -149,7 +149,7 @@ protected:
|
||||||
void updateSize(const TexturePointer& texture);
|
void updateSize(const TexturePointer& texture);
|
||||||
|
|
||||||
// Non exposed
|
// Non exposed
|
||||||
Framebuffer(const Framebuffer& framebuffer) {}
|
Framebuffer(const Framebuffer& framebuffer) = delete;
|
||||||
Framebuffer() {}
|
Framebuffer() {}
|
||||||
|
|
||||||
// This shouldn't be used by anything else than the Backend class with the proper casting.
|
// This shouldn't be used by anything else than the Backend class with the proper casting.
|
||||||
|
|
|
@ -33,8 +33,6 @@ endif()
|
||||||
#target_include_directories(${TARGET_NAME} PRIVATE ${SIXENSE_INCLUDE_DIRS})
|
#target_include_directories(${TARGET_NAME} PRIVATE ${SIXENSE_INCLUDE_DIRS})
|
||||||
#target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES})
|
#target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES})
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# perform standard include and linking for found externals
|
# perform standard include and linking for found externals
|
||||||
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ void ViveControllerManager::activate() {
|
||||||
|
|
||||||
vr::RenderModel_t model;
|
vr::RenderModel_t model;
|
||||||
if (!_hmd->LoadRenderModel(CONTROLLER_MODEL_STRING.toStdString().c_str(), &model)) {
|
if (!_hmd->LoadRenderModel(CONTROLLER_MODEL_STRING.toStdString().c_str(), &model)) {
|
||||||
qDebug("Unable to load render model %s\n", CONTROLLER_MODEL_STRING);
|
qDebug() << QString("Unable to load render model %1\n").arg(CONTROLLER_MODEL_STRING);
|
||||||
} else {
|
} else {
|
||||||
model::Mesh* mesh = new model::Mesh();
|
model::Mesh* mesh = new model::Mesh();
|
||||||
model::MeshPointer meshPtr(mesh);
|
model::MeshPointer meshPtr(mesh);
|
||||||
|
@ -198,7 +198,7 @@ void ViveControllerManager::renderHand(UserInputMapper::PoseValue pose, gpu::Bat
|
||||||
Transform transform(userInputMapper->getSensorToWorldMat());
|
Transform transform(userInputMapper->getSensorToWorldMat());
|
||||||
transform.postTranslate(pose.getTranslation() + pose.getRotation() * glm::vec3(0, 0, CONTROLLER_LENGTH_OFFSET));
|
transform.postTranslate(pose.getTranslation() + pose.getRotation() * glm::vec3(0, 0, CONTROLLER_LENGTH_OFFSET));
|
||||||
|
|
||||||
int sign = index == LEFT_HAND ? 1.0f : -1.0f;
|
int sign = index == LEFT_HAND ? 1 : -1;
|
||||||
glm::quat rotation = pose.getRotation() * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(sign * PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
|
glm::quat rotation = pose.getRotation() * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(sign * PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
transform.postRotate(rotation);
|
transform.postRotate(rotation);
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ void ViveControllerManager::handlePoseEvent(const mat4& mat, int index) {
|
||||||
glm::quat rotation = glm::quat_cast(mat);
|
glm::quat rotation = glm::quat_cast(mat);
|
||||||
|
|
||||||
// Flip the rotation appropriately for each hand
|
// Flip the rotation appropriately for each hand
|
||||||
int sign = index == LEFT_HAND ? 1.0f : -1.0f;
|
int sign = index == LEFT_HAND ? 1 : -1;
|
||||||
rotation = rotation * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(sign * PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
|
rotation = rotation * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(sign * PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
position += rotation * glm::vec3(0, 0, -CONTROLLER_LENGTH_OFFSET);
|
position += rotation * glm::vec3(0, 0, -CONTROLLER_LENGTH_OFFSET);
|
||||||
|
|
|
@ -2,8 +2,6 @@ set(TARGET_NAME model)
|
||||||
|
|
||||||
AUTOSCRIBE_SHADER_LIB(gpu model)
|
AUTOSCRIBE_SHADER_LIB(gpu model)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library()
|
setup_hifi_library()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME networking)
|
set(TARGET_NAME networking)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library(Network)
|
setup_hifi_library(Network)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetClient.cpp
|
// AssetClient.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/21
|
// Created by Ryan Huffman on 2015/07/21
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetClient.h
|
// AssetClient.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/21
|
// Created by Ryan Huffman on 2015/07/21
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetRequest.cpp
|
// AssetRequest.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/24
|
// Created by Ryan Huffman on 2015/07/24
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetRequest.h
|
// AssetRequest.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/24
|
// Created by Ryan Huffman on 2015/07/24
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetResourceRequest.cpp
|
// AssetResourceRequest.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetResourceRequest.h
|
// AssetResourceRequest.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -34,14 +34,14 @@ void AssetUpload::start() {
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
|
|
||||||
// file opened, read the data and grab the extension
|
// file opened, read the data and grab the extension
|
||||||
auto extension = QFileInfo(_filename).suffix();
|
_extension = QFileInfo(_filename).suffix();
|
||||||
|
|
||||||
auto data = file.readAll();
|
auto data = file.readAll();
|
||||||
|
|
||||||
// ask the AssetClient to upload the asset and emit the proper signals from the passed callback
|
// ask the AssetClient to upload the asset and emit the proper signals from the passed callback
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
|
|
||||||
assetClient->uploadAsset(data, extension, [this](bool success, QString hash){
|
assetClient->uploadAsset(data, _extension, [this](bool success, QString hash){
|
||||||
if (success) {
|
if (success) {
|
||||||
// successful upload - emit finished with a point to ourselves and the resulting hash
|
// successful upload - emit finished with a point to ourselves and the resulting hash
|
||||||
_result = Success;
|
_result = Success;
|
||||||
|
@ -57,5 +57,11 @@ void AssetUpload::start() {
|
||||||
emit finished(this, hash);
|
emit finished(this, hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// we couldn't open the file - set the error result
|
||||||
|
_result = ErrorLoadingFile;
|
||||||
|
|
||||||
|
// emit that we are done
|
||||||
|
emit finished(this, QString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ public:
|
||||||
Success = 0,
|
Success = 0,
|
||||||
Timeout,
|
Timeout,
|
||||||
TooLarge,
|
TooLarge,
|
||||||
PermissionDenied
|
PermissionDenied,
|
||||||
|
ErrorLoadingFile
|
||||||
};
|
};
|
||||||
|
|
||||||
AssetUpload(QObject* parent, const QString& filename);
|
AssetUpload(QObject* parent, const QString& filename);
|
||||||
|
@ -36,6 +37,7 @@ public:
|
||||||
Q_INVOKABLE void start();
|
Q_INVOKABLE void start();
|
||||||
|
|
||||||
const QString& getFilename() const { return _filename; }
|
const QString& getFilename() const { return _filename; }
|
||||||
|
const QString& getExtension() const { return _extension; }
|
||||||
const Result& getResult() const { return _result; }
|
const Result& getResult() const { return _result; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -44,6 +46,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _filename;
|
QString _filename;
|
||||||
|
QString _extension;
|
||||||
Result _result;
|
Result _result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// AssetUtils.h
|
// AssetUtils.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/30
|
// Created by Ryan Huffman on 2015/07/30
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// FileResourceRequest.cpp
|
// FileResourceRequest.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// FileResourceRequest.h
|
// FileResourceRequest.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// HTTPResourceRequest.cpp
|
// HTTPResourceRequest.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// HTTPResourceRequest.h
|
// HTTPResourceRequest.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -154,14 +154,18 @@ void ResourceCache::clearUnusedResource() {
|
||||||
|
|
||||||
void ResourceCache::attemptRequest(Resource* resource) {
|
void ResourceCache::attemptRequest(Resource* resource) {
|
||||||
auto sharedItems = DependencyManager::get<ResourceCacheSharedItems>();
|
auto sharedItems = DependencyManager::get<ResourceCacheSharedItems>();
|
||||||
// if (_requestLimit <= 0) {
|
if (_requestLimit <= 0) {
|
||||||
// qDebug() << "REQUEST LIMIT REACHED (" << _requestLimit << "), queueing: " << resource->getURL();
|
qDebug() << "REQUEST LIMIT REACHED (" << _requestLimit << "), queueing: " << resource->getURL();
|
||||||
// // wait until a slot becomes available
|
// wait until a slot becomes available
|
||||||
// sharedItems->_pendingRequests.append(resource);
|
sharedItems->_pendingRequests.append(resource);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
qDebug() << "-- Decreasing limit for : " << resource->getURL();
|
qDebug() << "-- Decreasing limit for : " << resource->getURL();
|
||||||
_requestLimit--;
|
|
||||||
|
// Disable request limiting for ATP
|
||||||
|
if (resource->getURL() != URL_SCHEME_ATP) {
|
||||||
|
_requestLimit--;
|
||||||
|
}
|
||||||
sharedItems->_loadingRequests.append(resource);
|
sharedItems->_loadingRequests.append(resource);
|
||||||
resource->makeRequest();
|
resource->makeRequest();
|
||||||
}
|
}
|
||||||
|
@ -171,7 +175,9 @@ void ResourceCache::requestCompleted(Resource* resource) {
|
||||||
auto sharedItems = DependencyManager::get<ResourceCacheSharedItems>();
|
auto sharedItems = DependencyManager::get<ResourceCacheSharedItems>();
|
||||||
sharedItems->_loadingRequests.removeOne(resource);
|
sharedItems->_loadingRequests.removeOne(resource);
|
||||||
qDebug() << "++ Increasing limit after finished: " << resource->getURL();
|
qDebug() << "++ Increasing limit after finished: " << resource->getURL();
|
||||||
_requestLimit++;
|
if (resource->getURL() != URL_SCHEME_ATP) {
|
||||||
|
_requestLimit++;
|
||||||
|
}
|
||||||
|
|
||||||
// look for the highest priority pending request
|
// look for the highest priority pending request
|
||||||
int highestIndex = -1;
|
int highestIndex = -1;
|
||||||
|
@ -206,7 +212,7 @@ Resource::Resource(const QUrl& url, bool delayLoad) :
|
||||||
|
|
||||||
// start loading immediately unless instructed otherwise
|
// start loading immediately unless instructed otherwise
|
||||||
if (!(_startedLoading || delayLoad)) {
|
if (!(_startedLoading || delayLoad)) {
|
||||||
QTimer::singleShot(1, this, &Resource::attemptRequest);
|
QTimer::singleShot(0, this, &Resource::ensureLoading);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,8 +339,6 @@ void Resource::reinsert() {
|
||||||
void Resource::makeRequest() {
|
void Resource::makeRequest() {
|
||||||
Q_ASSERT(!_request);
|
Q_ASSERT(!_request);
|
||||||
|
|
||||||
static const int REPLY_TIMEOUT_MS = 5000;
|
|
||||||
|
|
||||||
_request = ResourceManager::createResourceRequest(this, _activeUrl);
|
_request = ResourceManager::createResourceRequest(this, _activeUrl);
|
||||||
|
|
||||||
if (!_request) {
|
if (!_request) {
|
||||||
|
@ -360,13 +364,12 @@ void Resource::handleDownloadProgress(uint64_t bytesReceived, uint64_t bytesTota
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::handleReplyFinished() {
|
void Resource::handleReplyFinished() {
|
||||||
QString u = _url.path();
|
|
||||||
Q_ASSERT(_request);
|
Q_ASSERT(_request);
|
||||||
|
|
||||||
auto result = _request->getResult();
|
auto result = _request->getResult();
|
||||||
if (result == ResourceRequest::SUCCESS) {
|
if (result == ResourceRequest::SUCCESS) {
|
||||||
_data = _request->getData();
|
_data = _request->getData();
|
||||||
qDebug() << "Reqeust finsihed for " << _url << ", " << _activeUrl;
|
qDebug() << "Request finished for " << _url << ", " << _activeUrl;
|
||||||
|
|
||||||
_request->disconnect(this);
|
_request->disconnect(this);
|
||||||
_request->deleteLater();
|
_request->deleteLater();
|
||||||
|
@ -383,8 +386,7 @@ void Resource::handleReplyFinished() {
|
||||||
_request = nullptr;
|
_request = nullptr;
|
||||||
|
|
||||||
if (result == ResourceRequest::Result::TIMEOUT) {
|
if (result == ResourceRequest::Result::TIMEOUT) {
|
||||||
qDebug() << "Timed out loading" << _url <<
|
qDebug() << "Timed out loading" << _url << "received" << _bytesReceived << "total" << _bytesTotal;
|
||||||
"received" << _bytesReceived << "total" << _bytesTotal;
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Error loading " << _url;
|
qDebug() << "Error loading " << _url;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +410,8 @@ void Resource::handleReplyFinished() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit failed(QNetworkReply::UnknownNetworkError);
|
auto error = result == ResourceRequest::TIMEOUT ? QNetworkReply::TimeoutError : QNetworkReply::UnknownNetworkError;
|
||||||
|
emit failed(error);
|
||||||
|
|
||||||
if (!retry) {
|
if (!retry) {
|
||||||
ResourceCache::requestCompleted(this);
|
ResourceCache::requestCompleted(this);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// ResourceManager.cpp
|
// ResourceManager.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
@ -16,12 +17,6 @@
|
||||||
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
const QString URL_SCHEME_FILE = "file";
|
|
||||||
const QString URL_SCHEME_HTTP = "http";
|
|
||||||
const QString URL_SCHEME_HTTPS = "https";
|
|
||||||
const QString URL_SCHEME_FTP = "ftp";
|
|
||||||
const QString URL_SCHEME_ATP = "atp";
|
|
||||||
|
|
||||||
ResourceRequest* ResourceManager::createResourceRequest(QObject* parent, const QUrl& url) {
|
ResourceRequest* ResourceManager::createResourceRequest(QObject* parent, const QUrl& url) {
|
||||||
auto scheme = url.scheme();
|
auto scheme = url.scheme();
|
||||||
if (scheme == URL_SCHEME_FILE) {
|
if (scheme == URL_SCHEME_FILE) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// ResourceManager.h
|
// ResourceManager.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
@ -15,6 +16,12 @@
|
||||||
|
|
||||||
#include "ResourceRequest.h"
|
#include "ResourceRequest.h"
|
||||||
|
|
||||||
|
const QString URL_SCHEME_FILE = "file";
|
||||||
|
const QString URL_SCHEME_HTTP = "http";
|
||||||
|
const QString URL_SCHEME_HTTPS = "https";
|
||||||
|
const QString URL_SCHEME_FTP = "ftp";
|
||||||
|
const QString URL_SCHEME_ATP = "atp";
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
public:
|
public:
|
||||||
static ResourceRequest* createResourceRequest(QObject* parent, const QUrl& url);
|
static ResourceRequest* createResourceRequest(QObject* parent, const QUrl& url);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// ResourceRequest.cpp
|
// ResourceRequest.cpp
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//
|
//
|
||||||
// ResourceRequest.h
|
// ResourceRequest.h
|
||||||
|
// libraries/networking/src
|
||||||
//
|
//
|
||||||
// Created by Ryan Huffman on 2015/07/23
|
// Created by Ryan Huffman on 2015/07/23
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
|
|
@ -625,8 +625,12 @@ void Connection::processNAK(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processHandshake(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processHandshake(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
// server sent us a handshake - we need to assume this means state should be reset
|
|
||||||
resetReceiveState();
|
if (!_hasReceivedHandshake || _hasReceivedFirstPacket) {
|
||||||
|
// server sent us a handshake - we need to assume this means state should be reset
|
||||||
|
// as long as we haven't received a handshake yet or we have and we've received some data
|
||||||
|
resetReceiveState();
|
||||||
|
}
|
||||||
|
|
||||||
// immediately respond with a handshake ACK
|
// immediately respond with a handshake ACK
|
||||||
static auto handshakeACK = ControlPacket::create(ControlPacket::HandshakeACK, 0);
|
static auto handshakeACK = ControlPacket::create(ControlPacket::HandshakeACK, 0);
|
||||||
|
|
|
@ -40,7 +40,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
case PacketType::EntityData:
|
case PacketType::EntityData:
|
||||||
return VERSION_ENTITIES_PROTOCOL_HEADER_SWAP;
|
return VERSION_ENTITIES_PROTOCOL_HEADER_SWAP;
|
||||||
default:
|
default:
|
||||||
return 14;
|
return 13;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,7 @@ const PacketVersion VERSION_ENTITIES_NEW_PROTOCOL_LAYER = 35;
|
||||||
const PacketVersion VERSION_POLYVOX_TEXTURES = 36;
|
const PacketVersion VERSION_POLYVOX_TEXTURES = 36;
|
||||||
const PacketVersion VERSION_ENTITIES_POLYLINE = 37;
|
const PacketVersion VERSION_ENTITIES_POLYLINE = 37;
|
||||||
const PacketVersion VERSION_OCTREE_CENTERED_ORIGIN = 38;
|
const PacketVersion VERSION_OCTREE_CENTERED_ORIGIN = 38;
|
||||||
const PacketVersion VERSION_ENTITIES_PROTOCOL_HEADER_SWAP = 39;
|
const PacketVersion VERSION_ENTITIES_PARTICLE_MODIFICATIONS = 39;
|
||||||
|
const PacketVersion VERSION_ENTITIES_PROTOCOL_HEADER_SWAP = 40;
|
||||||
|
|
||||||
#endif // hifi_PacketHeaders_h
|
#endif // hifi_PacketHeaders_h
|
||||||
|
|
|
@ -143,7 +143,7 @@ qint64 PacketList::writeData(const char* data, qint64 maxSize) {
|
||||||
// this is an unsupported case - the segment is bigger than the size of an individual packet
|
// this is an unsupported case - the segment is bigger than the size of an individual packet
|
||||||
// but the PacketList is not going to be sent ordered
|
// but the PacketList is not going to be sent ordered
|
||||||
qDebug() << "Error in PacketList::writeData - attempted to write a segment to an unordered packet that is"
|
qDebug() << "Error in PacketList::writeData - attempted to write a segment to an unordered packet that is"
|
||||||
<< "larger than the payload size.";
|
<< "larger than the payload size.";
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME octree)
|
set(TARGET_NAME octree)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library()
|
setup_hifi_library()
|
||||||
|
|
||||||
|
|
|
@ -338,7 +338,7 @@ void CoverageRegion::erase() {
|
||||||
}
|
}
|
||||||
**/
|
**/
|
||||||
// If we're in charge of managing the polygons, then clean them up first
|
// If we're in charge of managing the polygons, then clean them up first
|
||||||
if (_managePolygons) {
|
if (_polygons && _managePolygons) {
|
||||||
for (int i = 0; i < _polygonCount; i++) {
|
for (int i = 0; i < _polygonCount; i++) {
|
||||||
delete _polygons[i];
|
delete _polygons[i];
|
||||||
_polygons[i] = NULL; // do we need to do this?
|
_polygons[i] = NULL; // do we need to do this?
|
||||||
|
|
|
@ -1318,7 +1318,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
// If the user also asked for occlusion culling, check if this element is occluded
|
// If the user also asked for occlusion culling, check if this element is occluded
|
||||||
if (params.wantOcclusionCulling && childElement->isLeaf()) {
|
if (params.wantOcclusionCulling && childElement->isLeaf()) {
|
||||||
// Don't check occlusion here, just add them to our distance ordered array...
|
// Don't check occlusion here, just add them to our distance ordered array...
|
||||||
|
|
||||||
|
// FIXME params.ViewFrustum is used here, but later it is checked against nullptr.
|
||||||
OctreeProjectedPolygon* voxelPolygon = new OctreeProjectedPolygon(
|
OctreeProjectedPolygon* voxelPolygon = new OctreeProjectedPolygon(
|
||||||
params.viewFrustum->getProjectedPolygon(childElement->getAACube()));
|
params.viewFrustum->getProjectedPolygon(childElement->getAACube()));
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME physics)
|
set(TARGET_NAME physics)
|
||||||
|
|
||||||
setup_memory_debugger()
|
|
||||||
|
|
||||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
setup_hifi_library()
|
setup_hifi_library()
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue