mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 02:03:36 +02:00
resolve conflicts on merge with upstream master
This commit is contained in:
commit
7beb3a7b62
145 changed files with 1206 additions and 906 deletions
|
@ -28,7 +28,7 @@ void ScriptableAvatar::startAnimation(const QString& url, float fps, float prior
|
||||||
Q_ARG(float, lastFrame), Q_ARG(const QStringList&, maskedJoints));
|
Q_ARG(float, lastFrame), Q_ARG(const QStringList&, maskedJoints));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_animation = _scriptEngine->getAnimationCache()->getAnimation(url);
|
_animation = DependencyManager::get<AnimationCache>()->getAnimation(url);
|
||||||
_animationDetails = AnimationDetails("", QUrl(url), fps, 0, loop, hold, false, firstFrame, lastFrame, true, firstFrame);
|
_animationDetails = AnimationDetails("", QUrl(url), fps, 0, loop, hold, false, firstFrame, lastFrame, true, firstFrame);
|
||||||
_maskedJoints = maskedJoints;
|
_maskedJoints = maskedJoints;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,33 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "scripts",
|
||||||
|
"label": "Scripts",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"name": "persistent_scripts",
|
||||||
|
"type": "table",
|
||||||
|
"label": "Persistent Scripts",
|
||||||
|
"help": "Add the URLs for scripts that you would like to ensure are always running in your domain.",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "url",
|
||||||
|
"label": "Script URL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "num_instances",
|
||||||
|
"label": "# instances",
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pool",
|
||||||
|
"label": "Pool"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "audio_env",
|
"name": "audio_env",
|
||||||
"label": "Audio Environment",
|
"label": "Audio Environment",
|
||||||
|
|
|
@ -363,7 +363,8 @@ function makeTableInputs(setting) {
|
||||||
|
|
||||||
_.each(setting.columns, function(col) {
|
_.each(setting.columns, function(col) {
|
||||||
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>\
|
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>\
|
||||||
<input type='text' class='form-control' placeholder='" + (col.placeholder ? col.placeholder : "") + "' value=''>\
|
<input type='text' class='form-control' placeholder='" + (col.placeholder ? col.placeholder : "") + "'\
|
||||||
|
value='" + (col.default ? col.default : "") + "'>\
|
||||||
</td>"
|
</td>"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -389,8 +390,9 @@ function badgeSidebarForDifferences(changedElement) {
|
||||||
|
|
||||||
// badge for any settings we have that are not the same or are not present in initialValues
|
// badge for any settings we have that are not the same or are not present in initialValues
|
||||||
for (var setting in panelJSON) {
|
for (var setting in panelJSON) {
|
||||||
if (!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
if ((!_.has(initialPanelJSON, setting) && panelJSON[setting] !== "") ||
|
||||||
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting))) {
|
(!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
||||||
|
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting)))) {
|
||||||
badgeValue += 1
|
badgeValue += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,6 +233,9 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
parseAssignmentConfigs(parsedTypes);
|
parseAssignmentConfigs(parsedTypes);
|
||||||
|
|
||||||
populateDefaultStaticAssignmentsExcludingTypes(parsedTypes);
|
populateDefaultStaticAssignmentsExcludingTypes(parsedTypes);
|
||||||
|
|
||||||
|
// check for scripts the user wants to persist from their domain-server config
|
||||||
|
populateStaticScriptedAssignmentsFromSettings();
|
||||||
|
|
||||||
LimitedNodeList* nodeList = LimitedNodeList::createInstance(domainServerPort, domainServerDTLSPort);
|
LimitedNodeList* nodeList = LimitedNodeList::createInstance(domainServerPort, domainServerDTLSPort);
|
||||||
|
|
||||||
|
@ -451,8 +454,6 @@ void DomainServer::parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes)
|
||||||
|
|
||||||
if (assignmentType != Assignment::AgentType) {
|
if (assignmentType != Assignment::AgentType) {
|
||||||
createStaticAssignmentsForType(assignmentType, assignmentList);
|
createStaticAssignmentsForType(assignmentType, assignmentList);
|
||||||
} else {
|
|
||||||
createScriptedAssignmentsFromList(assignmentList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
excludedTypes.insert(assignmentType);
|
excludedTypes.insert(assignmentType);
|
||||||
|
@ -468,35 +469,37 @@ void DomainServer::addStaticAssignmentToAssignmentHash(Assignment* newAssignment
|
||||||
_allAssignments.insert(newAssignment->getUUID(), SharedAssignmentPointer(newAssignment));
|
_allAssignments.insert(newAssignment->getUUID(), SharedAssignmentPointer(newAssignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::createScriptedAssignmentsFromList(const QVariantList &configList) {
|
void DomainServer::populateStaticScriptedAssignmentsFromSettings() {
|
||||||
foreach(const QVariant& configVariant, configList) {
|
const QString PERSISTENT_SCRIPTS_KEY_PATH = "scripts.persistent_scripts";
|
||||||
if (configVariant.canConvert(QMetaType::QVariantMap)) {
|
const QVariant* persistentScriptsVariant = valueForKeyPath(_settingsManager.getSettingsMap(), PERSISTENT_SCRIPTS_KEY_PATH);
|
||||||
QVariantMap configMap = configVariant.toMap();
|
|
||||||
|
if (persistentScriptsVariant) {
|
||||||
// make sure we were passed a URL, otherwise this is an invalid scripted assignment
|
QVariantList persistentScriptsList = persistentScriptsVariant->toList();
|
||||||
const QString ASSIGNMENT_URL_KEY = "url";
|
foreach(const QVariant& persistentScriptVariant, persistentScriptsList) {
|
||||||
QString assignmentURL = configMap[ASSIGNMENT_URL_KEY].toString();
|
QVariantMap persistentScript = persistentScriptVariant.toMap();
|
||||||
|
|
||||||
if (!assignmentURL.isEmpty()) {
|
const QString PERSISTENT_SCRIPT_URL_KEY = "url";
|
||||||
// check the json for a pool
|
const QString PERSISTENT_SCRIPT_NUM_INSTANCES_KEY = "num_instances";
|
||||||
const QString ASSIGNMENT_POOL_KEY = "pool";
|
const QString PERSISTENT_SCRIPT_POOL_KEY = "pool";
|
||||||
QString assignmentPool = configMap[ASSIGNMENT_POOL_KEY].toString();
|
|
||||||
|
if (persistentScript.contains(PERSISTENT_SCRIPT_URL_KEY)) {
|
||||||
// check for a number of instances, if not passed then default is 1
|
// check how many instances of this script to add
|
||||||
const QString ASSIGNMENT_INSTANCES_KEY = "instances";
|
|
||||||
int numInstances = configMap[ASSIGNMENT_INSTANCES_KEY].toInt();
|
int numInstances = persistentScript[PERSISTENT_SCRIPT_NUM_INSTANCES_KEY].toInt();
|
||||||
numInstances = (numInstances == 0 ? 1 : numInstances);
|
QString scriptURL = persistentScript[PERSISTENT_SCRIPT_URL_KEY].toString();
|
||||||
|
|
||||||
qDebug() << "Adding a static scripted assignment from" << assignmentURL;
|
QString scriptPool = persistentScript.value(PERSISTENT_SCRIPT_POOL_KEY).toString();
|
||||||
|
|
||||||
for (int i = 0; i < numInstances; i++) {
|
qDebug() << "Adding" << numInstances << "of persistent script at URL" << scriptURL << "- pool" << scriptPool;
|
||||||
|
|
||||||
|
for (int i = 0; i < numInstances; ++i) {
|
||||||
// add a scripted assignment to the queue for this instance
|
// add a scripted assignment to the queue for this instance
|
||||||
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
||||||
Assignment::AgentType,
|
Assignment::AgentType,
|
||||||
assignmentPool);
|
scriptPool);
|
||||||
scriptAssignment->setPayload(assignmentURL.toUtf8());
|
scriptAssignment->setPayload(scriptURL.toUtf8());
|
||||||
|
|
||||||
// scripts passed on CL or via JSON are static - so they are added back to the queue if the node dies
|
// add it to static hash so we know we have to keep giving it back out
|
||||||
addStaticAssignmentToAssignmentHash(scriptAssignment);
|
addStaticAssignmentToAssignmentHash(scriptAssignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,9 @@ private:
|
||||||
|
|
||||||
void parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes);
|
void parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes);
|
||||||
void addStaticAssignmentToAssignmentHash(Assignment* newAssignment);
|
void addStaticAssignmentToAssignmentHash(Assignment* newAssignment);
|
||||||
void createScriptedAssignmentsFromList(const QVariantList& configList);
|
|
||||||
void createStaticAssignmentsForType(Assignment::Type type, const QVariantList& configList);
|
void createStaticAssignmentsForType(Assignment::Type type, const QVariantList& configList);
|
||||||
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
||||||
|
void populateStaticScriptedAssignmentsFromSettings();
|
||||||
|
|
||||||
SharedAssignmentPointer matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
SharedAssignmentPointer matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
||||||
SharedAssignmentPointer deployableAssignmentForRequest(const Assignment& requestAssignment);
|
SharedAssignmentPointer deployableAssignmentForRequest(const Assignment& requestAssignment);
|
||||||
|
|
|
@ -23,12 +23,8 @@ function setupMenus() {
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Element Bounds", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Element Bounds", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Element Children", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Element Children", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Attempt to Reduce Material Switches", isCheckable: true, isChecked: false });
|
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Attempt Render Entities as Scene", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Attempt Render Entities as Scene", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenu("Developer > Entities > Culling");
|
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities > Culling", menuItemName: "Don't Cull Out Of View Mesh Parts", isCheckable: true, isChecked: false });
|
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities > Culling", menuItemName: "Don't Cull Too Small Mesh Parts", isCheckable: true, isChecked: false });
|
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Disable Light Entities", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Disable Light Entities", isCheckable: true, isChecked: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ Grid = function(opts) {
|
||||||
Overlays.editOverlay(gridOverlay, {
|
Overlays.editOverlay(gridOverlay, {
|
||||||
position: { x: origin.y, y: origin.y, z: -origin.y },
|
position: { x: origin.y, y: origin.y, z: -origin.y },
|
||||||
visible: that.visible && that.enabled,
|
visible: that.visible && that.enabled,
|
||||||
minorGridSpacing: minorGridSpacing,
|
minorGridWidth: minorGridSpacing,
|
||||||
majorGridEvery: majorGridEvery,
|
majorGridEvery: majorGridEvery,
|
||||||
color: gridColor,
|
color: gridColor,
|
||||||
alpha: gridAlpha,
|
alpha: gridAlpha,
|
||||||
|
|
|
@ -107,7 +107,8 @@ endif()
|
||||||
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
|
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
|
||||||
|
|
||||||
# link required hifi libraries
|
# link required hifi libraries
|
||||||
link_hifi_libraries(shared octree voxels gpu fbx metavoxels networking entities avatars audio animation script-engine physics)
|
link_hifi_libraries(shared octree voxels gpu fbx metavoxels networking entities avatars audio animation script-engine physics
|
||||||
|
render-utils entities-renderer)
|
||||||
|
|
||||||
# find any optional and required libraries
|
# find any optional and required libraries
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
|
@ -54,20 +54,27 @@
|
||||||
|
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
|
#include <AmbientOcclusionEffect.h>
|
||||||
#include <AudioInjector.h>
|
#include <AudioInjector.h>
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <EntityScriptingInterface.h>
|
#include <EntityScriptingInterface.h>
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <HFActionEvent.h>
|
#include <HFActionEvent.h>
|
||||||
#include <HFBackEvent.h>
|
#include <HFBackEvent.h>
|
||||||
#include <LocalVoxelsList.h>
|
#include <LocalVoxelsList.h>
|
||||||
#include <LogHandler.h>
|
#include <LogHandler.h>
|
||||||
|
#include <MainWindow.h>
|
||||||
#include <NetworkAccessManager.h>
|
#include <NetworkAccessManager.h>
|
||||||
#include <OctalCode.h>
|
#include <OctalCode.h>
|
||||||
#include <OctreeSceneStats.h>
|
#include <OctreeSceneStats.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
#include <ProgramObject.h>
|
||||||
#include <ResourceCache.h>
|
#include <ResourceCache.h>
|
||||||
#include <SoundCache.h>
|
#include <SoundCache.h>
|
||||||
|
#include <TextRenderer.h>
|
||||||
#include <UserActivityLogger.h>
|
#include <UserActivityLogger.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
|
@ -87,10 +94,10 @@
|
||||||
#include "devices/TV3DManager.h"
|
#include "devices/TV3DManager.h"
|
||||||
#include "devices/Visage.h"
|
#include "devices/Visage.h"
|
||||||
|
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
#include "gpu/Batch.h"
|
#include "gpu/Batch.h"
|
||||||
#include "gpu/GLBackend.h"
|
#include "gpu/GLBackend.h"
|
||||||
|
|
||||||
|
|
||||||
#include "scripting/AccountScriptingInterface.h"
|
#include "scripting/AccountScriptingInterface.h"
|
||||||
#include "scripting/AudioDeviceScriptingInterface.h"
|
#include "scripting/AudioDeviceScriptingInterface.h"
|
||||||
#include "scripting/ClipboardScriptingInterface.h"
|
#include "scripting/ClipboardScriptingInterface.h"
|
||||||
|
@ -106,7 +113,7 @@
|
||||||
#include "ui/InfoView.h"
|
#include "ui/InfoView.h"
|
||||||
#include "ui/Snapshot.h"
|
#include "ui/Snapshot.h"
|
||||||
#include "ui/Stats.h"
|
#include "ui/Stats.h"
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -135,19 +142,9 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString& Application::resourcesPath() {
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
|
|
||||||
#else
|
|
||||||
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
|
|
||||||
#endif
|
|
||||||
return staticResourcePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new MainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
_glWidget(new GLCanvas()),
|
|
||||||
_toolWindow(NULL),
|
_toolWindow(NULL),
|
||||||
_nodeThread(new QThread(this)),
|
_nodeThread(new QThread(this)),
|
||||||
_datagramProcessor(),
|
_datagramProcessor(),
|
||||||
|
@ -160,9 +157,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_voxelImporter(),
|
_voxelImporter(),
|
||||||
_importSucceded(false),
|
_importSucceded(false),
|
||||||
_sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard),
|
_sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard),
|
||||||
_entities(true),
|
_entities(true, this, this),
|
||||||
_entityCollisionSystem(),
|
_entityCollisionSystem(),
|
||||||
_entityClipboardRenderer(false),
|
_entityClipboardRenderer(false, this, this),
|
||||||
_entityClipboard(),
|
_entityClipboard(),
|
||||||
_wantToKillLocalVoxels(false),
|
_wantToKillLocalVoxels(false),
|
||||||
_viewFrustum(),
|
_viewFrustum(),
|
||||||
|
@ -195,8 +192,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_isVSyncOn(true),
|
_isVSyncOn(true),
|
||||||
_aboutToQuit(false)
|
_aboutToQuit(false)
|
||||||
{
|
{
|
||||||
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
|
||||||
|
|
||||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||||
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
// set the associated application properties
|
// set the associated application properties
|
||||||
applicationInfo.beginGroup("INFO");
|
applicationInfo.beginGroup("INFO");
|
||||||
|
@ -214,7 +214,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
_applicationStartupTime = startup_time;
|
_applicationStartupTime = startup_time;
|
||||||
|
|
||||||
QFontDatabase::addApplicationFont(Application::resourcesPath() + "styles/Inconsolata.otf");
|
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
||||||
_window->setWindowTitle("Interface");
|
_window->setWindowTitle("Interface");
|
||||||
|
|
||||||
qInstallMessageHandler(messageHandler);
|
qInstallMessageHandler(messageHandler);
|
||||||
|
@ -251,7 +251,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
// put the audio processing on a separate thread
|
// put the audio processing on a separate thread
|
||||||
QThread* audioThread = new QThread(this);
|
QThread* audioThread = new QThread(this);
|
||||||
|
|
||||||
Audio* audioIO = DependencyManager::get<Audio>();
|
Audio::Pointer audioIO = DependencyManager::get<Audio>();
|
||||||
audioIO->moveToThread(audioThread);
|
audioIO->moveToThread(audioThread);
|
||||||
connect(audioThread, &QThread::started, audioIO, &Audio::start);
|
connect(audioThread, &QThread::started, audioIO, &Audio::start);
|
||||||
|
|
||||||
|
@ -365,16 +365,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
ResourceCache::setRequestLimit(3);
|
ResourceCache::setRequestLimit(3);
|
||||||
|
|
||||||
_window->setCentralWidget(_glWidget);
|
_window->setCentralWidget(glCanvas.data());
|
||||||
|
|
||||||
restoreSizeAndPosition();
|
restoreSizeAndPosition();
|
||||||
|
|
||||||
_window->setVisible(true);
|
_window->setVisible(true);
|
||||||
_glWidget->setFocusPolicy(Qt::StrongFocus);
|
glCanvas->setFocusPolicy(Qt::StrongFocus);
|
||||||
_glWidget->setFocus();
|
glCanvas->setFocus();
|
||||||
|
|
||||||
// enable mouse tracking; otherwise, we only get drag events
|
// enable mouse tracking; otherwise, we only get drag events
|
||||||
_glWidget->setMouseTracking(true);
|
glCanvas->setMouseTracking(true);
|
||||||
|
|
||||||
_toolWindow = new ToolWindow();
|
_toolWindow = new ToolWindow();
|
||||||
_toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
|
_toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
|
@ -393,7 +393,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
checkVersion();
|
checkVersion();
|
||||||
|
|
||||||
_overlays.init(_glWidget); // do this before scripts load
|
_overlays.init(glCanvas.data()); // do this before scripts load
|
||||||
|
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
||||||
|
@ -442,6 +442,7 @@ void Application::aboutToQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
|
||||||
_entities.getTree()->setSimulation(NULL);
|
_entities.getTree()->setSimulation(NULL);
|
||||||
qInstallMessageHandler(NULL);
|
qInstallMessageHandler(NULL);
|
||||||
|
|
||||||
|
@ -485,8 +486,6 @@ Application::~Application() {
|
||||||
Menu::getInstance()->deleteLater();
|
Menu::getInstance()->deleteLater();
|
||||||
|
|
||||||
_myAvatar = NULL;
|
_myAvatar = NULL;
|
||||||
|
|
||||||
delete _glWidget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettings() {
|
void Application::saveSettings() {
|
||||||
|
@ -626,7 +625,7 @@ void Application::paintGL() {
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize());
|
DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize());
|
||||||
} else {
|
} else {
|
||||||
QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
|
QSize fbSize = DependencyManager::get<GLCanvas>()->getDeviceSize() * getRenderResolutionScale();
|
||||||
DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize);
|
DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,7 +713,7 @@ void Application::paintGL() {
|
||||||
TV3DManager::display(*whichCamera);
|
TV3DManager::display(*whichCamera);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_glowEffect.prepare();
|
DependencyManager::get<GlowEffect>()->prepare();
|
||||||
|
|
||||||
// Viewport is assigned to the size of the framebuffer
|
// Viewport is assigned to the size of the framebuffer
|
||||||
QSize size = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->size();
|
QSize size = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->size();
|
||||||
|
@ -733,7 +732,7 @@ void Application::paintGL() {
|
||||||
renderRearViewMirror(_mirrorViewRect);
|
renderRearViewMirror(_mirrorViewRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glowEffect.render();
|
DependencyManager::get<GlowEffect>()->render();
|
||||||
|
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
|
@ -1050,7 +1049,8 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
if (isShifted) {
|
if (isShifted) {
|
||||||
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
|
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
|
||||||
if (TV3DManager::isConnected()) {
|
if (TV3DManager::isConnected()) {
|
||||||
TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0));
|
_myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0));
|
||||||
|
@ -1062,7 +1062,8 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
if (isShifted) {
|
if (isShifted) {
|
||||||
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
|
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
|
||||||
if (TV3DManager::isConnected()) {
|
if (TV3DManager::isConnected()) {
|
||||||
TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1508,7 +1509,7 @@ void Application::idle() {
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("updateGL");
|
PerformanceTimer perfTimer("updateGL");
|
||||||
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
|
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
|
||||||
_glWidget->updateGL();
|
DependencyManager::get<GLCanvas>()->updateGL();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("rest");
|
PerformanceTimer perfTimer("rest");
|
||||||
|
@ -1534,13 +1535,14 @@ void Application::idle() {
|
||||||
|
|
||||||
void Application::checkBandwidthMeterClick() {
|
void Application::checkBandwidthMeterClick() {
|
||||||
// ... to be called upon button release
|
// ... to be called upon button release
|
||||||
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
|
Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
|
||||||
glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(),
|
glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(),
|
||||||
getMouseY() - getMouseDragStartedY())))
|
getMouseY() - getMouseDragStartedY())))
|
||||||
<= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH
|
<= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH
|
||||||
&& _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), _glWidget->width(), _glWidget->height())) {
|
&& _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), glCanvas->width(), glCanvas->height())) {
|
||||||
|
|
||||||
// The bandwidth meter is visible, the click didn't get dragged too far and
|
// The bandwidth meter is visible, the click didn't get dragged too far and
|
||||||
// we actually hit the bandwidth meter
|
// we actually hit the bandwidth meter
|
||||||
|
@ -1569,7 +1571,8 @@ void Application::setFullscreen(bool fullscreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setEnable3DTVMode(bool enable3DTVMode) {
|
void Application::setEnable3DTVMode(bool enable3DTVMode) {
|
||||||
resizeGL(_glWidget->getDeviceWidth(),_glWidget->getDeviceHeight());
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setEnableVRMode(bool enableVRMode) {
|
void Application::setEnableVRMode(bool enableVRMode) {
|
||||||
|
@ -1594,7 +1597,8 @@ void Application::setEnableVRMode(bool enableVRMode) {
|
||||||
_myCamera.setHmdRotation(glm::quat());
|
_myCamera.setHmdRotation(glm::quat());
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setRenderVoxels(bool voxelRender) {
|
void Application::setRenderVoxels(bool voxelRender) {
|
||||||
|
@ -1656,8 +1660,9 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox
|
||||||
|
|
||||||
bool Application::mouseOnScreen() const {
|
bool Application::mouseOnScreen() const {
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() &&
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight();
|
return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() &&
|
||||||
|
getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1697,13 +1702,13 @@ int Application::getMouseDragStartedY() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
FaceTracker* Application::getActiveFaceTracker() {
|
FaceTracker* Application::getActiveFaceTracker() {
|
||||||
Faceshift* faceshift = DependencyManager::get<Faceshift>();
|
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||||
Visage* visage = DependencyManager::get<Visage>();
|
Visage::SharedPointer visage = DependencyManager::get<Visage>();
|
||||||
DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>();
|
DdeFaceTracker::SharedPointer dde = DependencyManager::get<DdeFaceTracker>();
|
||||||
|
|
||||||
return (dde->isActive() ? static_cast<FaceTracker*>(dde) :
|
return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) :
|
||||||
(faceshift->isActive() ? static_cast<FaceTracker*>(faceshift) :
|
(faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) :
|
||||||
(visage->isActive() ? static_cast<FaceTracker*>(visage) : NULL)));
|
(visage->isActive() ? static_cast<FaceTracker*>(visage.data()) : NULL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SendVoxelsOperationArgs {
|
struct SendVoxelsOperationArgs {
|
||||||
|
@ -1776,7 +1781,8 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) {
|
||||||
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QString suggestedName = desktopLocation.append("/voxels.svo");
|
QString suggestedName = desktopLocation.append("/voxels.svo");
|
||||||
|
|
||||||
QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName,
|
QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>().data(),
|
||||||
|
tr("Export Voxels"), suggestedName,
|
||||||
tr("Sparse Voxel Octree Files (*.svo)"));
|
tr("Sparse Voxel Octree Files (*.svo)"));
|
||||||
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||||
const char* fileName = fileNameAscii.data();
|
const char* fileName = fileNameAscii.data();
|
||||||
|
@ -1924,9 +1930,8 @@ void Application::init() {
|
||||||
|
|
||||||
_environment.init();
|
_environment.init();
|
||||||
|
|
||||||
_deferredLightingEffect.init();
|
DependencyManager::get<DeferredLightingEffect>()->init(this);
|
||||||
_glowEffect.init();
|
DependencyManager::get<AmbientOcclusionEffect>()->init(this);
|
||||||
_ambientOcclusionEffect.init();
|
|
||||||
|
|
||||||
// TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager
|
// TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager
|
||||||
_avatarManager.init();
|
_avatarManager.init();
|
||||||
|
@ -2020,8 +2025,9 @@ void Application::init() {
|
||||||
_entityClipboardRenderer.setTree(&_entityClipboard);
|
_entityClipboardRenderer.setTree(&_entityClipboard);
|
||||||
|
|
||||||
_metavoxels.init();
|
_metavoxels.init();
|
||||||
|
|
||||||
_rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings);
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
_rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings);
|
||||||
|
|
||||||
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
|
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
|
||||||
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
|
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
|
||||||
|
@ -2031,8 +2037,12 @@ void Application::init() {
|
||||||
// save settings when avatar changes
|
// save settings when avatar changes
|
||||||
connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
|
connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
|
||||||
|
|
||||||
// make sure our texture cache knows about window size changes
|
// make sure our texture cache knows about window size changes
|
||||||
DependencyManager::get<TextureCache>()->associateWithWidget(getGLWidget());
|
DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());
|
||||||
|
|
||||||
|
// initialize the GlowEffect with our widget
|
||||||
|
DependencyManager::get<GlowEffect>()->init(glCanvas.data(),
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::closeMirrorView() {
|
void Application::closeMirrorView() {
|
||||||
|
@ -2100,7 +2110,7 @@ void Application::updateMouseRay() {
|
||||||
void Application::updateFaceshift() {
|
void Application::updateFaceshift() {
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showWarnings, "Application::updateFaceshift()");
|
PerformanceWarning warn(showWarnings, "Application::updateFaceshift()");
|
||||||
Faceshift* faceshift = DependencyManager::get<Faceshift>();
|
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||||
// Update faceshift
|
// Update faceshift
|
||||||
faceshift->update();
|
faceshift->update();
|
||||||
|
|
||||||
|
@ -2903,8 +2913,9 @@ void Application::updateShadowMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fbo->release();
|
fbo->release();
|
||||||
|
|
||||||
glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f };
|
const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f };
|
||||||
|
@ -2927,6 +2938,22 @@ void Application::setupWorldLight() {
|
||||||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::shouldRenderMesh(float largestDimension, float distanceToCamera) {
|
||||||
|
return Menu::getInstance()->shouldRenderMesh(largestDimension, distanceToCamera);
|
||||||
|
}
|
||||||
|
|
||||||
|
float Application::getSizeScale() const {
|
||||||
|
return Menu::getInstance()->getVoxelSizeScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Application::getBoundaryLevelAdjust() const {
|
||||||
|
return Menu::getInstance()->getBoundaryLevelAdjust();
|
||||||
|
}
|
||||||
|
|
||||||
|
PickRay Application::computePickRay(float x, float y) {
|
||||||
|
return getCamera()->computePickRay(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
QImage Application::renderAvatarBillboard() {
|
QImage Application::renderAvatarBillboard() {
|
||||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
||||||
|
|
||||||
|
@ -2934,7 +2961,9 @@ QImage Application::renderAvatarBillboard() {
|
||||||
Glower glower;
|
Glower glower;
|
||||||
|
|
||||||
const int BILLBOARD_SIZE = 64;
|
const int BILLBOARD_SIZE = 64;
|
||||||
renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true);
|
renderRearViewMirror(QRect(0, DependencyManager::get<GLCanvas>()->getDeviceHeight() - BILLBOARD_SIZE,
|
||||||
|
BILLBOARD_SIZE, BILLBOARD_SIZE),
|
||||||
|
true);
|
||||||
|
|
||||||
QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
|
QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
|
||||||
glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
|
glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
|
||||||
|
@ -3063,7 +3092,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
_deferredLightingEffect.prepare();
|
DependencyManager::get<DeferredLightingEffect>()->prepare();
|
||||||
|
|
||||||
if (!selfAvatarOnly) {
|
if (!selfAvatarOnly) {
|
||||||
// draw a red sphere
|
// draw a red sphere
|
||||||
|
@ -3106,7 +3135,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
||||||
PerformanceTimer perfTimer("ambientOcclusion");
|
PerformanceTimer perfTimer("ambientOcclusion");
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||||
"Application::displaySide() ... AmbientOcclusion...");
|
"Application::displaySide() ... AmbientOcclusion...");
|
||||||
_ambientOcclusionEffect.render();
|
DependencyManager::get<AmbientOcclusionEffect>()->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3123,7 +3152,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
||||||
{
|
{
|
||||||
PROFILE_RANGE("DeferredLighting");
|
PROFILE_RANGE("DeferredLighting");
|
||||||
PerformanceTimer perfTimer("lighting");
|
PerformanceTimer perfTimer("lighting");
|
||||||
_deferredLightingEffect.render();
|
DependencyManager::get<DeferredLightingEffect>()->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -3228,9 +3257,18 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::getShadowsEnabled() {
|
||||||
|
return Menu::getInstance()->getShadowsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::getCascadeShadowsEnabled() {
|
||||||
|
return Menu::getInstance()->isOptionChecked(MenuOption::CascadedShadows);
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
||||||
float horizontalScale = _glWidget->getDeviceWidth() / 2.0f;
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
float verticalScale = _glWidget->getDeviceHeight() / 2.0f;
|
float horizontalScale = glCanvas->getDeviceWidth() / 2.0f;
|
||||||
|
float verticalScale = glCanvas->getDeviceHeight() / 2.0f;
|
||||||
|
|
||||||
// -1,-1 is 0,windowHeight
|
// -1,-1 is 0,windowHeight
|
||||||
// 1,1 is windowWidth,0
|
// 1,1 is windowWidth,0
|
||||||
|
@ -3249,7 +3287,7 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
||||||
// -1,-1 1,-1
|
// -1,-1 1,-1
|
||||||
|
|
||||||
glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale,
|
glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale,
|
||||||
((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->getDeviceHeight());
|
((projectedPoint.y + 1.0) * -verticalScale) + glCanvas->getDeviceHeight());
|
||||||
|
|
||||||
return screenPoint;
|
return screenPoint;
|
||||||
}
|
}
|
||||||
|
@ -3560,7 +3598,7 @@ void Application::resetSensors() {
|
||||||
QScreen* currentScreen = _window->windowHandle()->screen();
|
QScreen* currentScreen = _window->windowHandle()->screen();
|
||||||
QWindow* mainWindow = _window->windowHandle();
|
QWindow* mainWindow = _window->windowHandle();
|
||||||
QPoint windowCenter = mainWindow->geometry().center();
|
QPoint windowCenter = mainWindow->geometry().center();
|
||||||
_glWidget->cursor().setPos(currentScreen, windowCenter);
|
DependencyManager::get<GLCanvas>()->cursor().setPos(currentScreen, windowCenter);
|
||||||
|
|
||||||
_myAvatar->reset();
|
_myAvatar->reset();
|
||||||
|
|
||||||
|
@ -3996,7 +4034,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
||||||
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
|
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("AnimationCache", &_animationCache);
|
scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());
|
||||||
scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance());
|
scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance());
|
||||||
scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance());
|
scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels);
|
scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels);
|
||||||
|
@ -4241,7 +4279,8 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio
|
||||||
|
|
||||||
void Application::loadDialog() {
|
void Application::loadDialog() {
|
||||||
|
|
||||||
QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"),
|
QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>().data(),
|
||||||
|
tr("Open Script"),
|
||||||
getPreviousScriptLocation(),
|
getPreviousScriptLocation(),
|
||||||
tr("JavaScript Files (*.js)"));
|
tr("JavaScript Files (*.js)"));
|
||||||
if (!fileNameString.isEmpty()) {
|
if (!fileNameString.isEmpty()) {
|
||||||
|
@ -4277,7 +4316,7 @@ void Application::loadScriptURLDialog() {
|
||||||
|
|
||||||
void Application::toggleLogDialog() {
|
void Application::toggleLogDialog() {
|
||||||
if (! _logDialog) {
|
if (! _logDialog) {
|
||||||
_logDialog = new LogDialog(_glWidget, getLogger());
|
_logDialog = new LogDialog(DependencyManager::get<GLCanvas>().data(), getLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_logDialog->isVisible()) {
|
if (_logDialog->isVisible()) {
|
||||||
|
@ -4337,7 +4376,7 @@ void Application::parseVersionXml() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
|
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
|
||||||
new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
|
new UpdateDialog(DependencyManager::get<GLCanvas>().data(), releaseNotes, latestVersion, downloadUrl);
|
||||||
}
|
}
|
||||||
sender->deleteLater();
|
sender->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -4358,7 +4397,7 @@ void Application::skipVersion(QString latestVersion) {
|
||||||
|
|
||||||
void Application::takeSnapshot() {
|
void Application::takeSnapshot() {
|
||||||
QMediaPlayer* player = new QMediaPlayer();
|
QMediaPlayer* player = new QMediaPlayer();
|
||||||
QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav");
|
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
|
||||||
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||||
player->play();
|
player->play();
|
||||||
|
|
||||||
|
@ -4370,7 +4409,7 @@ void Application::takeSnapshot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_snapshotShareDialog) {
|
if (!_snapshotShareDialog) {
|
||||||
_snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget);
|
_snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>().data());
|
||||||
}
|
}
|
||||||
_snapshotShareDialog->show();
|
_snapshotShareDialog->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,35 +12,32 @@
|
||||||
#ifndef hifi_Application_h
|
#ifndef hifi_Application_h
|
||||||
#define hifi_Application_h
|
#define hifi_Application_h
|
||||||
|
|
||||||
#include <map>
|
#include <gpu/GPUConfig.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QAction>
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QList>
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QHash>
|
|
||||||
#include <QTouchEvent>
|
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
#include <QSystemTrayIcon>
|
|
||||||
|
|
||||||
|
#include <AbstractScriptingServicesInterface.h>
|
||||||
|
#include <AbstractViewStateInterface.h>
|
||||||
#include <EntityCollisionSystem.h>
|
#include <EntityCollisionSystem.h>
|
||||||
#include <EntityEditPacketSender.h>
|
#include <EntityEditPacketSender.h>
|
||||||
|
#include <EntityTreeRenderer.h>
|
||||||
|
#include <GeometryCache.h>
|
||||||
#include <NetworkPacket.h>
|
#include <NetworkPacket.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <OctreeQuery.h>
|
#include <OctreeQuery.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
#include <ScriptEngine.h>
|
#include <ScriptEngine.h>
|
||||||
|
#include <TextureCache.h>
|
||||||
#include <ViewFrustum.h>
|
#include <ViewFrustum.h>
|
||||||
#include <VoxelEditPacketSender.h>
|
#include <VoxelEditPacketSender.h>
|
||||||
|
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "Audio.h"
|
#include "Audio.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "DatagramProcessor.h"
|
#include "DatagramProcessor.h"
|
||||||
|
@ -56,12 +53,6 @@
|
||||||
#include "avatar/MyAvatar.h"
|
#include "avatar/MyAvatar.h"
|
||||||
#include "devices/PrioVR.h"
|
#include "devices/PrioVR.h"
|
||||||
#include "devices/SixenseManager.h"
|
#include "devices/SixenseManager.h"
|
||||||
#include "entities/EntityTreeRenderer.h"
|
|
||||||
#include "renderer/AmbientOcclusionEffect.h"
|
|
||||||
#include "renderer/DeferredLightingEffect.h"
|
|
||||||
#include "renderer/GeometryCache.h"
|
|
||||||
#include "renderer/GlowEffect.h"
|
|
||||||
#include "renderer/TextureCache.h"
|
|
||||||
#include "scripting/ControllerScriptingInterface.h"
|
#include "scripting/ControllerScriptingInterface.h"
|
||||||
#include "ui/BandwidthDialog.h"
|
#include "ui/BandwidthDialog.h"
|
||||||
#include "ui/BandwidthMeter.h"
|
#include "ui/BandwidthMeter.h"
|
||||||
|
@ -89,17 +80,19 @@
|
||||||
#include "UndoStackScriptingInterface.h"
|
#include "UndoStackScriptingInterface.h"
|
||||||
|
|
||||||
|
|
||||||
class QAction;
|
|
||||||
class QActionGroup;
|
|
||||||
class QGLWidget;
|
class QGLWidget;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
class QSystemTrayIcon;
|
||||||
|
class QTouchEvent;
|
||||||
class QWheelEvent;
|
class QWheelEvent;
|
||||||
|
|
||||||
class FaceTracker;
|
class FaceTracker;
|
||||||
|
class MainWindow;
|
||||||
class Node;
|
class Node;
|
||||||
class ProgramObject;
|
class ProgramObject;
|
||||||
|
class ScriptEngine;
|
||||||
|
|
||||||
static const float NODE_ADDED_RED = 0.0f;
|
static const float NODE_ADDED_RED = 0.0f;
|
||||||
static const float NODE_ADDED_GREEN = 1.0f;
|
static const float NODE_ADDED_GREEN = 1.0f;
|
||||||
|
@ -127,7 +120,7 @@ static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS
|
||||||
static const QString INFO_HELP_PATH = "html/interface-welcome-allsvg.html";
|
static const QString INFO_HELP_PATH = "html/interface-welcome-allsvg.html";
|
||||||
static const QString INFO_EDIT_ENTITIES_PATH = "html/edit-entities-commands.html";
|
static const QString INFO_EDIT_ENTITIES_PATH = "html/edit-entities-commands.html";
|
||||||
|
|
||||||
class Application : public QApplication {
|
class Application : public QApplication, public AbstractViewStateInterface, AbstractScriptingServicesInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class OctreePacketProcessor;
|
friend class OctreePacketProcessor;
|
||||||
|
@ -136,7 +129,6 @@ class Application : public QApplication {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
||||||
static QString& resourcesPath();
|
|
||||||
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
||||||
static glm::quat getOrientationForPath() { return getInstance()->_myAvatar->getOrientation(); }
|
static glm::quat getOrientationForPath() { return getInstance()->_myAvatar->getOrientation(); }
|
||||||
|
|
||||||
|
@ -183,45 +175,49 @@ public:
|
||||||
void removeVoxel(glm::vec3 position, float scale);
|
void removeVoxel(glm::vec3 position, float scale);
|
||||||
|
|
||||||
glm::vec3 getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel);
|
glm::vec3 getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel);
|
||||||
|
bool isThrottleRendering() const { return DependencyManager::get<GLCanvas>()->isThrottleRendering(); }
|
||||||
|
|
||||||
GLCanvas* getGLWidget() { return _glWidget; }
|
|
||||||
bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); }
|
|
||||||
MyAvatar* getAvatar() { return _myAvatar; }
|
MyAvatar* getAvatar() { return _myAvatar; }
|
||||||
|
const MyAvatar* getAvatar() const { return _myAvatar; }
|
||||||
Camera* getCamera() { return &_myCamera; }
|
Camera* getCamera() { return &_myCamera; }
|
||||||
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
||||||
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
||||||
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
||||||
VoxelImporter* getVoxelImporter() { return &_voxelImporter; }
|
|
||||||
VoxelSystem* getVoxels() { return &_voxels; }
|
VoxelSystem* getVoxels() { return &_voxels; }
|
||||||
VoxelTree* getVoxelTree() { return _voxels.getTree(); }
|
|
||||||
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
||||||
MetavoxelSystem* getMetavoxels() { return &_metavoxels; }
|
MetavoxelSystem* getMetavoxels() { return &_metavoxels; }
|
||||||
EntityTreeRenderer* getEntities() { return &_entities; }
|
EntityTreeRenderer* getEntities() { return &_entities; }
|
||||||
bool getImportSucceded() { return _importSucceded; }
|
|
||||||
VoxelSystem* getSharedVoxelSystem() { return &_sharedVoxelSystem; }
|
VoxelSystem* getSharedVoxelSystem() { return &_sharedVoxelSystem; }
|
||||||
|
Environment* getEnvironment() { return &_environment; }
|
||||||
|
PrioVR* getPrioVR() { return &_prioVR; }
|
||||||
|
QUndoStack* getUndoStack() { return &_undoStack; }
|
||||||
|
MainWindow* getWindow() { return _window; }
|
||||||
|
|
||||||
|
VoxelImporter* getVoxelImporter() { return &_voxelImporter; }
|
||||||
VoxelTree* getClipboard() { return &_clipboard; }
|
VoxelTree* getClipboard() { return &_clipboard; }
|
||||||
EntityTree* getEntityClipboard() { return &_entityClipboard; }
|
EntityTree* getEntityClipboard() { return &_entityClipboard; }
|
||||||
EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; }
|
EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; }
|
||||||
Environment* getEnvironment() { return &_environment; }
|
VoxelTree* getVoxelTree() { return _voxels.getTree(); }
|
||||||
|
bool getImportSucceded() { return _importSucceded; }
|
||||||
|
|
||||||
bool isMousePressed() const { return _mousePressed; }
|
bool isMousePressed() const { return _mousePressed; }
|
||||||
bool isMouseHidden() const { return _glWidget->cursor().shape() == Qt::BlankCursor; }
|
bool isMouseHidden() const { return DependencyManager::get<GLCanvas>()->cursor().shape() == Qt::BlankCursor; }
|
||||||
void setCursorVisible(bool visible);
|
void setCursorVisible(bool visible);
|
||||||
const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; }
|
const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; }
|
||||||
const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; }
|
const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; }
|
||||||
bool mouseOnScreen() const;
|
bool mouseOnScreen() const;
|
||||||
int getMouseX() const;
|
int getMouseX() const;
|
||||||
int getMouseY() const;
|
int getMouseY() const;
|
||||||
int getTrueMouseX() const { return _glWidget->mapFromGlobal(QCursor::pos()).x(); }
|
int getTrueMouseX() const { return DependencyManager::get<GLCanvas>()->mapFromGlobal(QCursor::pos()).x(); }
|
||||||
int getTrueMouseY() const { return _glWidget->mapFromGlobal(QCursor::pos()).y(); }
|
int getTrueMouseY() const { return DependencyManager::get<GLCanvas>()->mapFromGlobal(QCursor::pos()).y(); }
|
||||||
int getMouseDragStartedX() const;
|
int getMouseDragStartedX() const;
|
||||||
int getMouseDragStartedY() const;
|
int getMouseDragStartedY() const;
|
||||||
int getTrueMouseDragStartedX() const { return _mouseDragStartedX; }
|
int getTrueMouseDragStartedX() const { return _mouseDragStartedX; }
|
||||||
int getTrueMouseDragStartedY() const { return _mouseDragStartedY; }
|
int getTrueMouseDragStartedY() const { return _mouseDragStartedY; }
|
||||||
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
||||||
|
|
||||||
FaceTracker* getActiveFaceTracker();
|
FaceTracker* getActiveFaceTracker();
|
||||||
PrioVR* getPrioVR() { return &_prioVR; }
|
|
||||||
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
||||||
QUndoStack* getUndoStack() { return &_undoStack; }
|
|
||||||
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
|
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
|
||||||
ApplicationOverlay& getApplicationOverlay() { return _applicationOverlay; }
|
ApplicationOverlay& getApplicationOverlay() { return _applicationOverlay; }
|
||||||
Overlays& getOverlays() { return _overlays; }
|
Overlays& getOverlays() { return _overlays; }
|
||||||
|
@ -232,7 +228,7 @@ public:
|
||||||
const glm::vec3& getViewMatrixTranslation() const { return _viewMatrixTranslation; }
|
const glm::vec3& getViewMatrixTranslation() const { return _viewMatrixTranslation; }
|
||||||
void setViewMatrixTranslation(const glm::vec3& translation) { _viewMatrixTranslation = translation; }
|
void setViewMatrixTranslation(const glm::vec3& translation) { _viewMatrixTranslation = translation; }
|
||||||
|
|
||||||
const Transform& getViewTransform() const { return _viewTransform; }
|
virtual const Transform& getViewTransform() const { return _viewTransform; }
|
||||||
void setViewTransform(const Transform& view);
|
void setViewTransform(const Transform& view);
|
||||||
|
|
||||||
/// if you need to access the application settings, use lockSettings()/unlockSettings()
|
/// if you need to access the application settings, use lockSettings()/unlockSettings()
|
||||||
|
@ -241,24 +237,23 @@ public:
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
MainWindow* getWindow() { return _window; }
|
|
||||||
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
||||||
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
||||||
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
||||||
|
|
||||||
ToolWindow* getToolWindow() { return _toolWindow ; }
|
ToolWindow* getToolWindow() { return _toolWindow ; }
|
||||||
|
|
||||||
AnimationCache* getAnimationCache() { return &_animationCache; }
|
virtual AbstractControllerScriptingInterface* getControllerScriptingInterface() { return &_controllerScriptingInterface; }
|
||||||
DeferredLightingEffect* getDeferredLightingEffect() { return &_deferredLightingEffect; }
|
virtual void registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine);
|
||||||
GlowEffect* getGlowEffect() { return &_glowEffect; }
|
|
||||||
ControllerScriptingInterface* getControllerScriptingInterface() { return &_controllerScriptingInterface; }
|
|
||||||
|
|
||||||
AvatarManager& getAvatarManager() { return _avatarManager; }
|
AvatarManager& getAvatarManager() { return _avatarManager; }
|
||||||
void resetProfile(const QString& username);
|
void resetProfile(const QString& username);
|
||||||
|
|
||||||
void controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes);
|
void controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes);
|
||||||
|
|
||||||
void setupWorldLight();
|
virtual void setupWorldLight();
|
||||||
|
virtual bool shouldRenderMesh(float largestDimension, float distanceToCamera);
|
||||||
|
|
||||||
QImage renderAvatarBillboard();
|
QImage renderAvatarBillboard();
|
||||||
|
|
||||||
|
@ -277,17 +272,27 @@ public:
|
||||||
void getModelViewMatrix(glm::dmat4* modelViewMatrix);
|
void getModelViewMatrix(glm::dmat4* modelViewMatrix);
|
||||||
void getProjectionMatrix(glm::dmat4* projectionMatrix);
|
void getProjectionMatrix(glm::dmat4* projectionMatrix);
|
||||||
|
|
||||||
const glm::vec3& getShadowDistances() const { return _shadowDistances; }
|
virtual const glm::vec3& getShadowDistances() const { return _shadowDistances; }
|
||||||
|
|
||||||
/// Computes the off-axis frustum parameters for the view frustum, taking mirroring into account.
|
/// Computes the off-axis frustum parameters for the view frustum, taking mirroring into account.
|
||||||
void computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal,
|
virtual void computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal,
|
||||||
float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const;
|
float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const;
|
||||||
|
|
||||||
|
virtual ViewFrustum* getCurrentViewFrustum() { return getDisplayViewFrustum(); }
|
||||||
|
virtual bool getShadowsEnabled();
|
||||||
|
virtual bool getCascadeShadowsEnabled();
|
||||||
|
virtual QThread* getMainThread() { return thread(); }
|
||||||
|
virtual float getSizeScale() const;
|
||||||
|
virtual int getBoundaryLevelAdjust() const;
|
||||||
|
virtual PickRay computePickRay(float x, float y);
|
||||||
|
virtual const glm::vec3& getAvatarPosition() const { return getAvatar()->getPosition(); }
|
||||||
|
|
||||||
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
||||||
|
|
||||||
FileLogger* getLogger() { return _logger; }
|
FileLogger* getLogger() { return _logger; }
|
||||||
|
|
||||||
glm::vec2 getViewportDimensions() const { return glm::vec2(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); }
|
glm::vec2 getViewportDimensions() const { return glm::vec2(DependencyManager::get<GLCanvas>()->getDeviceWidth(),
|
||||||
|
DependencyManager::get<GLCanvas>()->getDeviceHeight()); }
|
||||||
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
||||||
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
|
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
|
||||||
void pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination);
|
void pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination);
|
||||||
|
@ -306,9 +311,6 @@ public:
|
||||||
bool isVSyncEditable() const;
|
bool isVSyncEditable() const;
|
||||||
bool isAboutToQuit() const { return _aboutToQuit; }
|
bool isAboutToQuit() const { return _aboutToQuit; }
|
||||||
|
|
||||||
|
|
||||||
void registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine);
|
|
||||||
|
|
||||||
// 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
|
||||||
// rendering of several elements depend on that
|
// rendering of several elements depend on that
|
||||||
// TODO: carry that information on the Camera as a setting
|
// TODO: carry that information on the Camera as a setting
|
||||||
|
@ -465,7 +467,6 @@ private:
|
||||||
int sendNackPackets();
|
int sendNackPackets();
|
||||||
|
|
||||||
MainWindow* _window;
|
MainWindow* _window;
|
||||||
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
|
||||||
|
|
||||||
ToolWindow* _toolWindow;
|
ToolWindow* _toolWindow;
|
||||||
|
|
||||||
|
@ -565,13 +566,6 @@ private:
|
||||||
|
|
||||||
QSet<int> _keysPressed;
|
QSet<int> _keysPressed;
|
||||||
|
|
||||||
|
|
||||||
AnimationCache _animationCache;
|
|
||||||
|
|
||||||
DeferredLightingEffect _deferredLightingEffect;
|
|
||||||
GlowEffect _glowEffect;
|
|
||||||
AmbientOcclusionEffect _ambientOcclusionEffect;
|
|
||||||
|
|
||||||
bool _enableProcessVoxelsThread;
|
bool _enableProcessVoxelsThread;
|
||||||
OctreePacketProcessor _octreeProcessor;
|
OctreePacketProcessor _octreeProcessor;
|
||||||
VoxelHideShowThread _voxelHideShowThread;
|
VoxelHideShowThread _voxelHideShowThread;
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
#include <AudioInjector.h>
|
#include <AudioInjector.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
|
||||||
#include <PositionalAudioStream.h>
|
#include <PositionalAudioStream.h>
|
||||||
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
|
@ -691,7 +693,7 @@ void Audio::handleAudioInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audioMixer && audioMixer->getActiveSocket()) {
|
if (audioMixer && audioMixer->getActiveSocket()) {
|
||||||
MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
const MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
||||||
glm::vec3 headPosition = interfaceAvatar->getHead()->getPosition();
|
glm::vec3 headPosition = interfaceAvatar->getHead()->getPosition();
|
||||||
glm::quat headOrientation = interfaceAvatar->getHead()->getFinalOrientationInWorldFrame();
|
glm::quat headOrientation = interfaceAvatar->getHead()->getFinalOrientationInWorldFrame();
|
||||||
quint8 isStereo = _isStereoInput ? 1 : 0;
|
quint8 isStereo = _isStereoInput ? 1 : 0;
|
||||||
|
|
|
@ -65,8 +65,9 @@ class QAudioInput;
|
||||||
class QAudioOutput;
|
class QAudioOutput;
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
class Audio : public AbstractAudioInterface, public DependencyManager::Dependency {
|
class Audio : public AbstractAudioInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(Audio)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
class AudioOutputIODevice : public QIODevice {
|
class AudioOutputIODevice : public QIODevice {
|
||||||
|
|
|
@ -95,10 +95,8 @@ void Camera::setFarClip(float f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PickRay Camera::computePickRay(float x, float y) {
|
PickRay Camera::computePickRay(float x, float y) {
|
||||||
float screenWidth = Application::getInstance()->getGLWidget()->width();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
float screenHeight = Application::getInstance()->getGLWidget()->height();
|
return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height());
|
||||||
|
|
||||||
return computeViewPickRay(x / screenWidth, y / screenHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PickRay Camera::computeViewPickRay(float xRatio, float yRatio) {
|
PickRay Camera::computeViewPickRay(float xRatio, float yRatio) {
|
||||||
|
|
|
@ -54,14 +54,16 @@ void DatagramProcessor::processDatagrams() {
|
||||||
case PacketTypeMixedAudio:
|
case PacketTypeMixedAudio:
|
||||||
case PacketTypeSilentAudioFrame: {
|
case PacketTypeSilentAudioFrame: {
|
||||||
if (incomingType == PacketTypeAudioStreamStats) {
|
if (incomingType == PacketTypeAudioStreamStats) {
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>(), "parseAudioStreamStatsPacket",
|
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "parseAudioStreamStatsPacket",
|
||||||
Qt::QueuedConnection,
|
Qt::QueuedConnection,
|
||||||
Q_ARG(QByteArray, incomingPacket));
|
Q_ARG(QByteArray, incomingPacket));
|
||||||
} else if (incomingType == PacketTypeAudioEnvironment) {
|
} else if (incomingType == PacketTypeAudioEnvironment) {
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>(), "parseAudioEnvironmentData", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "parseAudioEnvironmentData",
|
||||||
|
Qt::QueuedConnection,
|
||||||
Q_ARG(QByteArray, incomingPacket));
|
Q_ARG(QByteArray, incomingPacket));
|
||||||
} else {
|
} else {
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>(), "addReceivedAudioToStream", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "addReceivedAudioToStream",
|
||||||
|
Qt::QueuedConnection,
|
||||||
Q_ARG(QByteArray, incomingPacket));
|
Q_ARG(QByteArray, incomingPacket));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,12 @@
|
||||||
|
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
|
#include <ProgramObject.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
|
||||||
#include "Environment.h"
|
#include "Environment.h"
|
||||||
|
@ -188,7 +189,7 @@ int Environment::parseData(const HifiSockAddr& senderAddress, const QByteArray&
|
||||||
|
|
||||||
ProgramObject* Environment::createSkyProgram(const char* from, int* locations) {
|
ProgramObject* Environment::createSkyProgram(const char* from, int* locations) {
|
||||||
ProgramObject* program = new ProgramObject();
|
ProgramObject* program = new ProgramObject();
|
||||||
QByteArray prefix = QString(Application::resourcesPath() + "/shaders/SkyFrom" + from).toUtf8();
|
QByteArray prefix = QString(PathUtils::resourcesPath() + "/shaders/SkyFrom" + from).toUtf8();
|
||||||
program->addShaderFromSourceFile(QGLShader::Vertex, prefix + ".vert");
|
program->addShaderFromSourceFile(QGLShader::Vertex, prefix + ".vert");
|
||||||
program->addShaderFromSourceFile(QGLShader::Fragment, prefix + ".frag");
|
program->addShaderFromSourceFile(QGLShader::Fragment, prefix + ".frag");
|
||||||
program->link();
|
program->link();
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "GLCanvas.h"
|
#include "GLCanvas.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
|
|
||||||
const int MSECS_PER_FRAME_WHEN_THROTTLED = 66;
|
const int MSECS_PER_FRAME_WHEN_THROTTLED = 66;
|
||||||
|
|
|
@ -15,11 +15,14 @@
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
/// customized canvas that simply forwards requests/events to the singleton application
|
/// customized canvas that simply forwards requests/events to the singleton application
|
||||||
class GLCanvas : public QGLWidget {
|
class GLCanvas : public QGLWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(GLCanvas)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLCanvas();
|
|
||||||
bool isThrottleRendering() const;
|
bool isThrottleRendering() const;
|
||||||
|
|
||||||
int getDeviceWidth() const;
|
int getDeviceWidth() const;
|
||||||
|
@ -56,6 +59,12 @@ private slots:
|
||||||
void activeChanged(Qt::ApplicationState state);
|
void activeChanged(Qt::ApplicationState state);
|
||||||
void throttleRender();
|
void throttleRender();
|
||||||
bool eventFilter(QObject*, QEvent* event);
|
bool eventFilter(QObject*, QEvent* event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
GLCanvas();
|
||||||
|
~GLCanvas() {
|
||||||
|
qDebug() << "Deleting GLCanvas";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_GLCanvas_h
|
#endif // hifi_GLCanvas_h
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include <MainWindow.h>
|
||||||
|
#include <GlowEffect.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
#include <UserActivityLogger.h>
|
#include <UserActivityLogger.h>
|
||||||
#include <XmppClient.h>
|
#include <XmppClient.h>
|
||||||
|
@ -56,7 +59,6 @@
|
||||||
#include "ui/LoginDialog.h"
|
#include "ui/LoginDialog.h"
|
||||||
#include "ui/NodeBounds.h"
|
#include "ui/NodeBounds.h"
|
||||||
|
|
||||||
|
|
||||||
Menu* Menu::_instance = NULL;
|
Menu* Menu::_instance = NULL;
|
||||||
|
|
||||||
Menu* Menu::getInstance() {
|
Menu* Menu::getInstance() {
|
||||||
|
@ -242,7 +244,7 @@ Menu::Menu() :
|
||||||
connect(&xmppClient, &QXmppClient::connected, this, &Menu::toggleChat);
|
connect(&xmppClient, &QXmppClient::connected, this, &Menu::toggleChat);
|
||||||
connect(&xmppClient, &QXmppClient::disconnected, this, &Menu::toggleChat);
|
connect(&xmppClient, &QXmppClient::disconnected, this, &Menu::toggleChat);
|
||||||
|
|
||||||
QDir::setCurrent(Application::resourcesPath());
|
QDir::setCurrent(PathUtils::resourcesPath());
|
||||||
// init chat window to listen chat
|
// init chat window to listen chat
|
||||||
_chatWindow = new ChatWindow(Application::getInstance()->getWindow());
|
_chatWindow = new ChatWindow(Application::getInstance()->getWindow());
|
||||||
#endif
|
#endif
|
||||||
|
@ -420,7 +422,8 @@ Menu::Menu() :
|
||||||
true,
|
true,
|
||||||
appInstance,
|
appInstance,
|
||||||
SLOT(setRenderVoxels(bool)));
|
SLOT(setRenderVoxels(bool)));
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true,
|
||||||
|
DependencyManager::get<GlowEffect>().data(), SLOT(toggleGlowEffect(bool)));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
||||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
||||||
|
@ -431,12 +434,12 @@ Menu::Menu() :
|
||||||
MenuOption::Faceshift,
|
MenuOption::Faceshift,
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
DependencyManager::get<Faceshift>(),
|
DependencyManager::get<Faceshift>().data(),
|
||||||
SLOT(setTCPEnabled(bool)));
|
SLOT(setTCPEnabled(bool)));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_VISAGE
|
#ifdef HAVE_VISAGE
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, 0, false,
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, 0, false,
|
||||||
DependencyManager::get<Visage>(), SLOT(updateEnabled()));
|
DependencyManager::get<Visage>().data(), SLOT(updateEnabled()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes);
|
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes);
|
||||||
|
@ -527,7 +530,7 @@ Menu::Menu() :
|
||||||
SLOT(cycleFrustumRenderMode()));
|
SLOT(cycleFrustumRenderMode()));
|
||||||
updateFrustumRenderModeAction();
|
updateFrustumRenderModeAction();
|
||||||
|
|
||||||
Audio* audioIO = DependencyManager::get<Audio>();
|
Audio::Pointer audioIO = DependencyManager::get<Audio>();
|
||||||
QMenu* audioDebugMenu = developerMenu->addMenu("Audio");
|
QMenu* audioDebugMenu = developerMenu->addMenu("Audio");
|
||||||
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNoiseReduction,
|
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNoiseReduction,
|
||||||
0,
|
0,
|
||||||
|
@ -576,17 +579,17 @@ Menu::Menu() :
|
||||||
audioSourceGroup->addAction(sine440);
|
audioSourceGroup->addAction(sine440);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioScope* scope = DependencyManager::get<AudioScope>();
|
AudioScope::Pointer scope = DependencyManager::get<AudioScope>();
|
||||||
|
|
||||||
QMenu* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope");
|
QMenu* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope");
|
||||||
addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScope,
|
addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScope,
|
||||||
Qt::CTRL | Qt::Key_P, false,
|
Qt::CTRL | Qt::Key_P, false,
|
||||||
scope,
|
scope.data(),
|
||||||
SLOT(toggle()));
|
SLOT(toggle()));
|
||||||
addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopePause,
|
addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopePause,
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_P ,
|
Qt::CTRL | Qt::SHIFT | Qt::Key_P ,
|
||||||
false,
|
false,
|
||||||
scope,
|
scope.data(),
|
||||||
SLOT(togglePause()));
|
SLOT(togglePause()));
|
||||||
addDisabledActionAndSeparator(audioScopeMenu, "Display Frames");
|
addDisabledActionAndSeparator(audioScopeMenu, "Display Frames");
|
||||||
{
|
{
|
||||||
|
@ -1048,11 +1051,11 @@ void Menu::bumpSettings() {
|
||||||
|
|
||||||
void sendFakeEnterEvent() {
|
void sendFakeEnterEvent() {
|
||||||
QPoint lastCursorPosition = QCursor::pos();
|
QPoint lastCursorPosition = QCursor::pos();
|
||||||
QGLWidget* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
QPoint windowPosition = glWidget->mapFromGlobal(lastCursorPosition);
|
QPoint windowPosition = glCanvas->mapFromGlobal(lastCursorPosition);
|
||||||
QEnterEvent enterEvent = QEnterEvent(windowPosition, windowPosition, lastCursorPosition);
|
QEnterEvent enterEvent = QEnterEvent(windowPosition, windowPosition, lastCursorPosition);
|
||||||
QCoreApplication::sendEvent(glWidget, &enterEvent);
|
QCoreApplication::sendEvent(glCanvas.data(), &enterEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
||||||
|
@ -1266,7 +1269,7 @@ void Menu::toggleLoginMenuItem() {
|
||||||
|
|
||||||
void Menu::bandwidthDetails() {
|
void Menu::bandwidthDetails() {
|
||||||
if (! _bandwidthDialog) {
|
if (! _bandwidthDialog) {
|
||||||
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
|
_bandwidthDialog = new BandwidthDialog(DependencyManager::get<GLCanvas>().data(),
|
||||||
Application::getInstance()->getBandwidthMeter());
|
Application::getInstance()->getBandwidthMeter());
|
||||||
connect(_bandwidthDialog, SIGNAL(closed()), SLOT(bandwidthDetailsClosed()));
|
connect(_bandwidthDialog, SIGNAL(closed()), SLOT(bandwidthDetailsClosed()));
|
||||||
|
|
||||||
|
@ -1377,7 +1380,7 @@ void Menu::bandwidthDetailsClosed() {
|
||||||
|
|
||||||
void Menu::octreeStatsDetails() {
|
void Menu::octreeStatsDetails() {
|
||||||
if (!_octreeStatsDialog) {
|
if (!_octreeStatsDialog) {
|
||||||
_octreeStatsDialog = new OctreeStatsDialog(Application::getInstance()->getGLWidget(),
|
_octreeStatsDialog = new OctreeStatsDialog(DependencyManager::get<GLCanvas>().data(),
|
||||||
Application::getInstance()->getOcteeSceneStats());
|
Application::getInstance()->getOcteeSceneStats());
|
||||||
connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed()));
|
connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed()));
|
||||||
_octreeStatsDialog->show();
|
_octreeStatsDialog->show();
|
||||||
|
@ -1561,7 +1564,7 @@ bool Menu::shouldRenderMesh(float largestDimension, float distanceToCamera) {
|
||||||
|
|
||||||
void Menu::lodTools() {
|
void Menu::lodTools() {
|
||||||
if (!_lodToolsDialog) {
|
if (!_lodToolsDialog) {
|
||||||
_lodToolsDialog = new LodToolsDialog(Application::getInstance()->getGLWidget());
|
_lodToolsDialog = new LodToolsDialog(DependencyManager::get<GLCanvas>().data());
|
||||||
connect(_lodToolsDialog, SIGNAL(closed()), SLOT(lodToolsClosed()));
|
connect(_lodToolsDialog, SIGNAL(closed()), SLOT(lodToolsClosed()));
|
||||||
_lodToolsDialog->show();
|
_lodToolsDialog->show();
|
||||||
if (_hmdToolsDialog) {
|
if (_hmdToolsDialog) {
|
||||||
|
@ -1581,7 +1584,7 @@ void Menu::lodToolsClosed() {
|
||||||
void Menu::hmdTools(bool showTools) {
|
void Menu::hmdTools(bool showTools) {
|
||||||
if (showTools) {
|
if (showTools) {
|
||||||
if (!_hmdToolsDialog) {
|
if (!_hmdToolsDialog) {
|
||||||
_hmdToolsDialog = new HMDToolsDialog(Application::getInstance()->getGLWidget());
|
_hmdToolsDialog = new HMDToolsDialog(DependencyManager::get<GLCanvas>().data());
|
||||||
connect(_hmdToolsDialog, SIGNAL(closed()), SLOT(hmdToolsClosed()));
|
connect(_hmdToolsDialog, SIGNAL(closed()), SLOT(hmdToolsClosed()));
|
||||||
}
|
}
|
||||||
_hmdToolsDialog->show();
|
_hmdToolsDialog->show();
|
||||||
|
|
|
@ -356,9 +356,6 @@ namespace MenuOption {
|
||||||
const QString Collisions = "Collisions";
|
const QString Collisions = "Collisions";
|
||||||
const QString Console = "Console...";
|
const QString Console = "Console...";
|
||||||
const QString ControlWithSpeech = "Control With Speech";
|
const QString ControlWithSpeech = "Control With Speech";
|
||||||
const QString DontCullOutOfViewMeshParts = "Don't Cull Out Of View Mesh Parts";
|
|
||||||
const QString DontCullTooSmallMeshParts = "Don't Cull Too Small Mesh Parts";
|
|
||||||
const QString DontReduceMaterialSwitches = "Don't Attempt to Reduce Material Switches";
|
|
||||||
const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene";
|
const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene";
|
||||||
const QString DontDoPrecisionPicking = "Don't Do Precision Picking";
|
const QString DontDoPrecisionPicking = "Don't Do Precision Picking";
|
||||||
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
||||||
|
|
|
@ -21,17 +21,18 @@
|
||||||
|
|
||||||
#include <glm/gtx/transform.hpp>
|
#include <glm/gtx/transform.hpp>
|
||||||
|
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
|
#include <Model.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include <MetavoxelMessages.h>
|
#include <MetavoxelMessages.h>
|
||||||
#include <MetavoxelUtil.h>
|
#include <MetavoxelUtil.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <ScriptCache.h>
|
#include <ScriptCache.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "MetavoxelSystem.h"
|
#include "MetavoxelSystem.h"
|
||||||
#include "renderer/Model.h"
|
|
||||||
#include "renderer/RenderUtil.h"
|
|
||||||
|
|
||||||
REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation)
|
REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation)
|
||||||
REGISTER_META_OBJECT(SphereRenderer)
|
REGISTER_META_OBJECT(SphereRenderer)
|
||||||
|
@ -63,9 +64,9 @@ void MetavoxelSystem::init() {
|
||||||
_voxelBufferAttribute->setLODThresholdMultiplier(
|
_voxelBufferAttribute->setLODThresholdMultiplier(
|
||||||
AttributeRegistry::getInstance()->getVoxelColorAttribute()->getLODThresholdMultiplier());
|
AttributeRegistry::getInstance()->getVoxelColorAttribute()->getLODThresholdMultiplier());
|
||||||
|
|
||||||
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_heightfield_base.vert");
|
"shaders/metavoxel_heightfield_base.vert");
|
||||||
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_heightfield_base.frag");
|
"shaders/metavoxel_heightfield_base.frag");
|
||||||
_baseHeightfieldProgram.link();
|
_baseHeightfieldProgram.link();
|
||||||
|
|
||||||
|
@ -78,9 +79,9 @@ void MetavoxelSystem::init() {
|
||||||
|
|
||||||
loadSplatProgram("heightfield", _splatHeightfieldProgram, _splatHeightfieldLocations);
|
loadSplatProgram("heightfield", _splatHeightfieldProgram, _splatHeightfieldLocations);
|
||||||
|
|
||||||
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_heightfield_cursor.vert");
|
"shaders/metavoxel_heightfield_cursor.vert");
|
||||||
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_cursor.frag");
|
"shaders/metavoxel_cursor.frag");
|
||||||
_heightfieldCursorProgram.link();
|
_heightfieldCursorProgram.link();
|
||||||
|
|
||||||
|
@ -88,17 +89,17 @@ void MetavoxelSystem::init() {
|
||||||
_heightfieldCursorProgram.setUniformValue("heightMap", 0);
|
_heightfieldCursorProgram.setUniformValue("heightMap", 0);
|
||||||
_heightfieldCursorProgram.release();
|
_heightfieldCursorProgram.release();
|
||||||
|
|
||||||
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_voxel_base.vert");
|
"shaders/metavoxel_voxel_base.vert");
|
||||||
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_voxel_base.frag");
|
"shaders/metavoxel_voxel_base.frag");
|
||||||
_baseVoxelProgram.link();
|
_baseVoxelProgram.link();
|
||||||
|
|
||||||
loadSplatProgram("voxel", _splatVoxelProgram, _splatVoxelLocations);
|
loadSplatProgram("voxel", _splatVoxelProgram, _splatVoxelLocations);
|
||||||
|
|
||||||
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_voxel_cursor.vert");
|
"shaders/metavoxel_voxel_cursor.vert");
|
||||||
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_cursor.frag");
|
"shaders/metavoxel_cursor.frag");
|
||||||
_voxelCursorProgram.link();
|
_voxelCursorProgram.link();
|
||||||
}
|
}
|
||||||
|
@ -470,7 +471,7 @@ void MetavoxelSystem::render() {
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
glNormal3f(0.0f, 1.0f, 0.0f);
|
glNormal3f(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();
|
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
|
||||||
|
|
||||||
foreach (const HermiteBatch& batch, _hermiteBatches) {
|
foreach (const HermiteBatch& batch, _hermiteBatches) {
|
||||||
batch.vertexBuffer->bind();
|
batch.vertexBuffer->bind();
|
||||||
|
@ -482,7 +483,7 @@ void MetavoxelSystem::render() {
|
||||||
batch.vertexBuffer->release();
|
batch.vertexBuffer->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();
|
DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
|
@ -836,9 +837,9 @@ void MetavoxelSystem::guideToAugmented(MetavoxelVisitor& visitor, bool render) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetavoxelSystem::loadSplatProgram(const char* type, ProgramObject& program, SplatLocations& locations) {
|
void MetavoxelSystem::loadSplatProgram(const char* type, ProgramObject& program, SplatLocations& locations) {
|
||||||
program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_" + type + "_splat.vert");
|
"shaders/metavoxel_" + type + "_splat.vert");
|
||||||
program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||||
"shaders/metavoxel_" + type + "_splat.frag");
|
"shaders/metavoxel_" + type + "_splat.frag");
|
||||||
program.link();
|
program.link();
|
||||||
|
|
||||||
|
@ -1177,7 +1178,7 @@ void VoxelBuffer::render(bool cursor) {
|
||||||
|
|
||||||
if (!_materials.isEmpty()) {
|
if (!_materials.isEmpty()) {
|
||||||
_networkTextures.resize(_materials.size());
|
_networkTextures.resize(_materials.size());
|
||||||
TextureCache* textureCache = DependencyManager::get<TextureCache>();
|
TextureCache::SharedPointer textureCache = DependencyManager::get<TextureCache>();
|
||||||
for (int i = 0; i < _materials.size(); i++) {
|
for (int i = 0; i < _materials.size(); i++) {
|
||||||
const SharedObjectPointer material = _materials.at(i);
|
const SharedObjectPointer material = _materials.at(i);
|
||||||
if (material) {
|
if (material) {
|
||||||
|
@ -1981,7 +1982,7 @@ void SphereRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor
|
||||||
glm::vec3 axis = glm::axis(rotation);
|
glm::vec3 axis = glm::axis(rotation);
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidSphere(sphere->getScale(), 32, 32);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(sphere->getScale(), 32, 32);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
@ -2002,7 +2003,7 @@ void CuboidRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||||
glScalef(1.0f, cuboid->getAspectY(), cuboid->getAspectZ());
|
glScalef(1.0f, cuboid->getAspectY(), cuboid->getAspectZ());
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(cuboid->getScale() * 2.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(cuboid->getScale() * 2.0f);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
@ -2232,7 +2233,7 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g
|
||||||
|
|
||||||
const QVector<SharedObjectPointer>& materials = node->getMaterial()->getMaterials();
|
const QVector<SharedObjectPointer>& materials = node->getMaterial()->getMaterials();
|
||||||
_networkTextures.resize(materials.size());
|
_networkTextures.resize(materials.size());
|
||||||
TextureCache* textureCache = DependencyManager::get<TextureCache>();
|
TextureCache::SharedPointer textureCache = DependencyManager::get<TextureCache>();
|
||||||
for (int i = 0; i < materials.size(); i++) {
|
for (int i = 0; i < materials.size(); i++) {
|
||||||
const SharedObjectPointer& material = materials.at(i);
|
const SharedObjectPointer& material = materials.at(i);
|
||||||
if (material) {
|
if (material) {
|
||||||
|
|
|
@ -20,9 +20,8 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <MetavoxelClientManager.h>
|
#include <MetavoxelClientManager.h>
|
||||||
|
#include <ProgramObject.h>
|
||||||
#include "renderer/ProgramObject.h"
|
#include <TextureCache.h>
|
||||||
#include "renderer/TextureCache.h"
|
|
||||||
|
|
||||||
class HeightfieldBaseLayerBatch;
|
class HeightfieldBaseLayerBatch;
|
||||||
class HeightfieldSplatBatch;
|
class HeightfieldSplatBatch;
|
||||||
|
|
|
@ -472,7 +472,7 @@ void ModelUploader::processCheck() {
|
||||||
QString("Your model is now available in the browser."),
|
QString("Your model is now available in the browser."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
DependencyManager::get<GeometryCache>()->refresh(_url);
|
DependencyManager::get<GeometryCache>()->refresh(_url);
|
||||||
TextureCache* textureCache = DependencyManager::get<TextureCache>();
|
TextureCache::SharedPointer textureCache = DependencyManager::get<TextureCache>();
|
||||||
foreach (const QByteArray& filename, _textureFilenames) {
|
foreach (const QByteArray& filename, _textureFilenames) {
|
||||||
textureCache->refresh(_textureBase + filename);
|
textureCache->refresh(_textureBase + filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
#include <glm/detail/func_common.hpp>
|
#include <glm/detail/func_common.hpp>
|
||||||
|
|
||||||
#include <SharedUtil.h>
|
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
#include <SharedUtil.h>
|
||||||
|
#include <TextRenderer.h>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
#include "VoxelConstants.h"
|
#include "VoxelConstants.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -71,7 +71,7 @@ void renderWorldBox() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(MARKER_DISTANCE, 0, 0);
|
glTranslatef(MARKER_DISTANCE, 0, 0);
|
||||||
glColor3fv(red);
|
glColor3fv(red);
|
||||||
GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
|
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
geometryCache->renderSphere(MARKER_RADIUS, 10, 10);
|
geometryCache->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
|
@ -97,7 +97,7 @@ void AudioIOStats::parseAudioStreamStatsPacket(const QByteArray& packet) {
|
||||||
|
|
||||||
void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
||||||
|
|
||||||
Audio* audioIO = DependencyManager::get<Audio>();
|
Audio::Pointer audioIO = DependencyManager::get<Audio>();
|
||||||
|
|
||||||
// since this function is called every second, we'll sample for some of our stats here
|
// since this function is called every second, we'll sample for some of our stats here
|
||||||
_inputRingBufferMsecsAvailableStats.update(audioIO->getInputRingBufferMsecsAvailable());
|
_inputRingBufferMsecsAvailableStats.update(audioIO->getInputRingBufferMsecsAvailable());
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
class AudioIOStats;
|
class AudioIOStats;
|
||||||
class AudioStreamStats;
|
class AudioStreamStats;
|
||||||
|
|
||||||
class AudioIOStatsRenderer : public QObject, public DependencyManager::Dependency {
|
class AudioIOStatsRenderer : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(AudioIOStatsRenderer)
|
||||||
public:
|
public:
|
||||||
void render(const float* color, int width, int height);
|
void render(const float* color, int width, int height);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class AudioScope : public QObject, public DependencyManager::Dependency {
|
class AudioScope : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(AudioScope)
|
||||||
public:
|
public:
|
||||||
// Audio scope methods for rendering
|
// Audio scope methods for rendering
|
||||||
static void renderBackground(const float* color, int x, int y, int width, int height);
|
static void renderBackground(const float* color, int x, int y, int width, int height);
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
|
@ -20,11 +22,16 @@
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
#include <glm/gtx/vector_query.hpp>
|
#include <glm/gtx/vector_query.hpp>
|
||||||
|
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
#include <TextRenderer.h>
|
||||||
|
#include <TextureCache.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
|
@ -36,8 +43,6 @@
|
||||||
#include "Recorder.h"
|
#include "Recorder.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
#include "renderer/TextureCache.h"
|
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -360,7 +365,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
glm::quat orientation = getOrientation();
|
glm::quat orientation = getOrientation();
|
||||||
foreach (const AvatarManager::LocalLight& light, Application::getInstance()->getAvatarManager().getLocalLights()) {
|
foreach (const AvatarManager::LocalLight& light, Application::getInstance()->getAvatarManager().getLocalLights()) {
|
||||||
glm::vec3 direction = orientation * light.direction;
|
glm::vec3 direction = orientation * light.direction;
|
||||||
Application::getInstance()->getDeferredLightingEffect()->addSpotLight(position - direction * distance,
|
DependencyManager::get<DeferredLightingEffect>()->addSpotLight(position - direction * distance,
|
||||||
distance * 2.0f, glm::vec3(), light.color, light.color, 1.0f, 0.5f, 0.0f, direction,
|
distance * 2.0f, glm::vec3(), light.color, light.color, 1.0f, 0.5f, 0.0f, direction,
|
||||||
LIGHT_EXPONENT, LIGHT_CUTOFF);
|
LIGHT_EXPONENT, LIGHT_CUTOFF);
|
||||||
}
|
}
|
||||||
|
@ -913,13 +918,13 @@ void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const {
|
||||||
|
|
||||||
void Avatar::setFaceModelURL(const QUrl& faceModelURL) {
|
void Avatar::setFaceModelURL(const QUrl& faceModelURL) {
|
||||||
AvatarData::setFaceModelURL(faceModelURL);
|
AvatarData::setFaceModelURL(faceModelURL);
|
||||||
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(Application::resourcesPath() + "meshes/defaultAvatar_head.fst");
|
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_head.fst");
|
||||||
getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FACE_MODEL_URL, true, !isMyAvatar());
|
getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FACE_MODEL_URL, true, !isMyAvatar());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||||
AvatarData::setSkeletonModelURL(skeletonModelURL);
|
AvatarData::setSkeletonModelURL(skeletonModelURL);
|
||||||
const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(Application::resourcesPath() + "meshes/defaultAvatar_body.fst");
|
const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_body.fst");
|
||||||
_skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar());
|
_skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,17 @@
|
||||||
|
|
||||||
#include <glm/gtx/string_cast.hpp>
|
#include <glm/gtx/string_cast.hpp>
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <RegisteredMetaTypes.h>
|
#include <RegisteredMetaTypes.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
|
#include "AvatarManager.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
|
|
||||||
#include "AvatarManager.h"
|
|
||||||
|
|
||||||
// We add _myAvatar into the hash with all the other AvatarData, and we use the default NULL QUid as the key.
|
// We add _myAvatar into the hash with all the other AvatarData, and we use the default NULL QUid as the key.
|
||||||
const QUuid MY_AVATAR_KEY; // NULL key
|
const QUuid MY_AVATAR_KEY; // NULL key
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef hifi_FaceModel_h
|
#ifndef hifi_FaceModel_h
|
||||||
#define hifi_FaceModel_h
|
#define hifi_FaceModel_h
|
||||||
|
|
||||||
#include "renderer/Model.h"
|
#include <Model.h>
|
||||||
|
|
||||||
class Head;
|
class Head;
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,20 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <gpu/GPUConfig.h> // hack to get windows to build
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
|
#include <ProgramObject.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
#include "Hand.h"
|
#include "Hand.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#ifndef hifi_Hand_h
|
#ifndef hifi_Hand_h
|
||||||
#define hifi_Hand_h
|
#define hifi_Hand_h
|
||||||
|
|
||||||
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
@ -22,9 +24,8 @@
|
||||||
#include <AvatarData.h>
|
#include <AvatarData.h>
|
||||||
#include <AudioScriptingInterface.h>
|
#include <AudioScriptingInterface.h>
|
||||||
#include <HandData.h>
|
#include <HandData.h>
|
||||||
|
#include <Model.h>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
|
||||||
#include "renderer/Model.h"
|
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <devices/Faceshift.h>
|
#include <GlowEffect.h>
|
||||||
#include <devices/DdeFaceTracker.h>
|
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -21,6 +20,8 @@
|
||||||
#include "Head.h"
|
#include "Head.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
#include "devices/DdeFaceTracker.h"
|
||||||
|
#include "devices/Faceshift.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -71,20 +72,19 @@ void Head::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
||||||
|
|
||||||
if (isMine) {
|
if (isMine) {
|
||||||
MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
|
MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
|
||||||
|
|
||||||
// Only use face trackers when not playing back a recording.
|
// Only use face trackers when not playing back a recording.
|
||||||
if (!myAvatar->isPlaying()) {
|
if (!myAvatar->isPlaying()) {
|
||||||
FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();
|
FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();
|
||||||
DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>();
|
DdeFaceTracker::SharedPointer dde = DependencyManager::get<DdeFaceTracker>();
|
||||||
Faceshift* faceshift = DependencyManager::get<Faceshift>();
|
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||||
|
|
||||||
if ((_isFaceshiftConnected = (faceshift == faceTracker))) {
|
if ((_isFaceshiftConnected = (faceshift == faceTracker))) {
|
||||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||||
} else if (dde->isActive()) {
|
} else if (dde->isActive()) {
|
||||||
faceTracker = dde;
|
faceTracker = dde.data();
|
||||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ void Head::addLeanDeltas(float sideways, float forward) {
|
||||||
|
|
||||||
void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) {
|
void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) {
|
||||||
|
|
||||||
Application::getInstance()->getGlowEffect()->begin();
|
DependencyManager::get<GlowEffect>()->begin();
|
||||||
|
|
||||||
glLineWidth(2.0);
|
glLineWidth(2.0);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
@ -345,7 +345,7 @@ void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosi
|
||||||
glVertex3f(lookatPosition.x, lookatPosition.y, lookatPosition.z);
|
glVertex3f(lookatPosition.x, lookatPosition.y, lookatPosition.z);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
Application::getInstance()->getGlowEffect()->end();
|
DependencyManager::get<GlowEffect>()->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <AvatarData.h>
|
#include <AvatarData.h>
|
||||||
|
|
||||||
#include <EntityTree.h>
|
#include <EntityTree.h>
|
||||||
#include "../renderer/Model.h"
|
#include <Model.h>
|
||||||
|
|
||||||
#include "ModelReferential.h"
|
#include "ModelReferential.h"
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
|
#include <AnimationHandle.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <ShapeCollider.h>
|
#include <ShapeCollider.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
#include <TextRenderer.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Audio.h"
|
#include "Audio.h"
|
||||||
|
@ -40,8 +42,6 @@
|
||||||
#include "Recorder.h"
|
#include "Recorder.h"
|
||||||
#include "devices/Faceshift.h"
|
#include "devices/Faceshift.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
#include "renderer/AnimationHandle.h"
|
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ void MyAvatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bo
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::renderHeadMouse(int screenWidth, int screenHeight) const {
|
void MyAvatar::renderHeadMouse(int screenWidth, int screenHeight) const {
|
||||||
Faceshift* faceshift = DependencyManager::get<Faceshift>();
|
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||||
|
|
||||||
float pixelsPerDegree = screenHeight / Menu::getInstance()->getFieldOfView();
|
float pixelsPerDegree = screenHeight / Menu::getInstance()->getFieldOfView();
|
||||||
|
|
||||||
|
|
|
@ -554,7 +554,7 @@ void SkeletonModel::renderRagdoll() {
|
||||||
float radius1 = 0.008f;
|
float radius1 = 0.008f;
|
||||||
float radius2 = 0.01f;
|
float radius2 = 0.01f;
|
||||||
glm::vec3 simulationTranslation = _ragdoll->getTranslationInSimulationFrame();
|
glm::vec3 simulationTranslation = _ragdoll->getTranslationInSimulationFrame();
|
||||||
GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
|
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
for (int i = 0; i < numPoints; ++i) {
|
for (int i = 0; i < numPoints; ++i) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
// NOTE: ragdollPoints are in simulation-frame but we want them to be model-relative
|
// NOTE: ragdollPoints are in simulation-frame but we want them to be model-relative
|
||||||
|
@ -914,7 +914,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) {
|
||||||
endPoint = endPoint - _translation;
|
endPoint = endPoint - _translation;
|
||||||
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
||||||
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
||||||
GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
|
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
geometryCache->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
geometryCache->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
|
|
||||||
// draw a yellow sphere at the capsule startpoint
|
// draw a yellow sphere at the capsule startpoint
|
||||||
|
@ -950,7 +950,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
|
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
// shapes are stored in simulation-frame but we want position to be model-relative
|
// shapes are stored in simulation-frame but we want position to be model-relative
|
||||||
|
|
|
@ -12,9 +12,10 @@
|
||||||
#ifndef hifi_SkeletonModel_h
|
#ifndef hifi_SkeletonModel_h
|
||||||
#define hifi_SkeletonModel_h
|
#define hifi_SkeletonModel_h
|
||||||
|
|
||||||
#include "renderer/Model.h"
|
|
||||||
|
|
||||||
#include <CapsuleShape.h>
|
#include <CapsuleShape.h>
|
||||||
|
#include <Model.h>
|
||||||
|
|
||||||
#include "SkeletonRagdoll.h"
|
#include "SkeletonRagdoll.h"
|
||||||
|
|
||||||
class Avatar;
|
class Avatar;
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
#include <DistanceConstraint.h>
|
#include <DistanceConstraint.h>
|
||||||
#include <FixedConstraint.h>
|
#include <FixedConstraint.h>
|
||||||
|
#include <Model.h>
|
||||||
|
|
||||||
#include "SkeletonRagdoll.h"
|
#include "SkeletonRagdoll.h"
|
||||||
#include "MuscleConstraint.h"
|
#include "MuscleConstraint.h"
|
||||||
#include "../renderer/Model.h"
|
|
||||||
|
|
||||||
SkeletonRagdoll::SkeletonRagdoll(Model* model) : Ragdoll(), _model(model) {
|
SkeletonRagdoll::SkeletonRagdoll(Model* model) : Ragdoll(), _model(model) {
|
||||||
assert(_model);
|
assert(_model);
|
||||||
|
|
|
@ -14,10 +14,9 @@
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
#include <JointState.h>
|
||||||
#include <Ragdoll.h>
|
#include <Ragdoll.h>
|
||||||
|
|
||||||
#include "../renderer/JointState.h"
|
|
||||||
|
|
||||||
class MuscleConstraint;
|
class MuscleConstraint;
|
||||||
class Model;
|
class Model;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
|
|
||||||
#include "FaceTracker.h"
|
#include "FaceTracker.h"
|
||||||
|
|
||||||
class DdeFaceTracker : public FaceTracker, public DependencyManager::Dependency {
|
class DdeFaceTracker : public FaceTracker {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(DdeFaceTracker)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//initialization
|
//initialization
|
||||||
|
@ -58,7 +59,6 @@ private:
|
||||||
DdeFaceTracker();
|
DdeFaceTracker();
|
||||||
DdeFaceTracker(const QHostAddress& host, quint16 port);
|
DdeFaceTracker(const QHostAddress& host, quint16 port);
|
||||||
~DdeFaceTracker();
|
~DdeFaceTracker();
|
||||||
friend DependencyManager;
|
|
||||||
|
|
||||||
float getBlendshapeCoefficient(int index) const;
|
float getBlendshapeCoefficient(int index) const;
|
||||||
void decodePacket(const QByteArray& buffer);
|
void decodePacket(const QByteArray& buffer);
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
#include "FaceTracker.h"
|
#include "FaceTracker.h"
|
||||||
|
|
||||||
/// Handles interaction with the Faceshift software, which provides head position/orientation and facial features.
|
/// Handles interaction with the Faceshift software, which provides head position/orientation and facial features.
|
||||||
class Faceshift : public FaceTracker, public DependencyManager::Dependency {
|
class Faceshift : public FaceTracker {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(Faceshift)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
@ -89,7 +90,6 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Faceshift();
|
Faceshift();
|
||||||
virtual ~Faceshift() {}
|
virtual ~Faceshift() {}
|
||||||
friend DependencyManager;
|
|
||||||
|
|
||||||
float getBlendshapeCoefficient(int index) const;
|
float getBlendshapeCoefficient(int index) const;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <UserActivityLogger.h>
|
#include <UserActivityLogger.h>
|
||||||
|
|
||||||
|
@ -136,8 +138,8 @@ void OculusManager::connect() {
|
||||||
if (!_programInitialized) {
|
if (!_programInitialized) {
|
||||||
// Shader program
|
// Shader program
|
||||||
_programInitialized = true;
|
_programInitialized = true;
|
||||||
_program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/oculus.vert");
|
_program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/oculus.vert");
|
||||||
_program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/oculus.frag");
|
_program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/oculus.frag");
|
||||||
_program.link();
|
_program.link();
|
||||||
|
|
||||||
// Uniforms
|
// Uniforms
|
||||||
|
@ -447,7 +449,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
||||||
|
|
||||||
//Bind our framebuffer object. If we are rendering the glow effect, we let the glow effect shader take care of it
|
//Bind our framebuffer object. If we are rendering the glow effect, we let the glow effect shader take care of it
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)) {
|
||||||
Application::getInstance()->getGlowEffect()->prepare();
|
DependencyManager::get<GlowEffect>()->prepare();
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
@ -552,7 +554,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
||||||
|
|
||||||
//Bind the output texture from the glow shader. If glow effect is disabled, we just grab the texture
|
//Bind the output texture from the glow shader. If glow effect is disabled, we just grab the texture
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)) {
|
||||||
QOpenGLFramebufferObject* fbo = Application::getInstance()->getGlowEffect()->render(true);
|
QOpenGLFramebufferObject* fbo = DependencyManager::get<GlowEffect>()->render(true);
|
||||||
glBindTexture(GL_TEXTURE_2D, fbo->texture());
|
glBindTexture(GL_TEXTURE_2D, fbo->texture());
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->release();
|
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->release();
|
||||||
|
@ -560,8 +562,8 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore our normal viewport
|
// restore our normal viewport
|
||||||
glViewport(0, 0, Application::getInstance()->getGLWidget()->getDeviceWidth(),
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
Application::getInstance()->getGLWidget()->getDeviceHeight());
|
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
@ -579,8 +581,8 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
||||||
void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) {
|
void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) {
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluOrtho2D(0, Application::getInstance()->getGLWidget()->getDeviceWidth(), 0,
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
Application::getInstance()->getGLWidget()->getDeviceHeight());
|
gluOrtho2D(0, glCanvas->getDeviceWidth(), 0, glCanvas->getDeviceHeight());
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
#include <OVR.h>
|
#include <OVR.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "renderer/ProgramObject.h"
|
#include <ProgramObject.h>
|
||||||
|
|
||||||
#include "ui/overlays/Text3DOverlay.h"
|
#include "ui/overlays/Text3DOverlay.h"
|
||||||
|
|
||||||
const float DEFAULT_OCULUS_UI_ANGULAR_SIZE = 72.0f;
|
const float DEFAULT_OCULUS_UI_ANGULAR_SIZE = 72.0f;
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
#include <FBXReader.h>
|
#include <FBXReader.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
#include <TextRenderer.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "PrioVR.h"
|
#include "PrioVR.h"
|
||||||
#include "scripting/JoystickScriptingInterface.h"
|
#include "scripting/JoystickScriptingInterface.h"
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_PRIOVR
|
#ifdef HAVE_PRIOVR
|
||||||
const unsigned int SERIAL_LIST[] = { 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x0000000A,
|
const unsigned int SERIAL_LIST[] = { 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x0000000A,
|
||||||
|
@ -215,8 +215,9 @@ void PrioVR::renderCalibrationCountdown() {
|
||||||
static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold,
|
static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold,
|
||||||
false, TextRenderer::OUTLINE_EFFECT, 2);
|
false, TextRenderer::OUTLINE_EFFECT, 2);
|
||||||
QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "...";
|
QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "...";
|
||||||
textRenderer->draw((Application::getInstance()->getGLWidget()->width() -
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
textRenderer->computeWidth(text.constData())) / 2, Application::getInstance()->getGLWidget()->height() / 2,
|
textRenderer->draw((glCanvas->width() - textRenderer->computeWidth(text.constData())) / 2,
|
||||||
text);
|
glCanvas->height() / 2,
|
||||||
|
text);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,7 +461,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
|
||||||
void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
MyAvatar* avatar = application->getAvatar();
|
MyAvatar* avatar = application->getAvatar();
|
||||||
GLCanvas* widget = application->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
QPoint pos;
|
QPoint pos;
|
||||||
|
|
||||||
Qt::MouseButton bumperButton;
|
Qt::MouseButton bumperButton;
|
||||||
|
@ -489,10 +489,10 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
// Get the pixel range over which the xAngle and yAngle are scaled
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
float cursorRange = widget->width() * getCursorPixelRangeMult();
|
float cursorRange = glCanvas->width() * getCursorPixelRangeMult();
|
||||||
|
|
||||||
pos.setX(widget->width() / 2.0f + cursorRange * xAngle);
|
pos.setX(glCanvas->width() / 2.0f + cursorRange * xAngle);
|
||||||
pos.setY(widget->height() / 2.0f + cursorRange * yAngle);
|
pos.setY(glCanvas->height() / 2.0f + cursorRange * yAngle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include "TV3DManager.h"
|
#include "TV3DManager.h"
|
||||||
|
@ -33,10 +35,10 @@ bool TV3DManager::isConnected() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TV3DManager::connect() {
|
void TV3DManager::connect() {
|
||||||
Application* app = Application::getInstance();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
int width = app->getGLWidget()->getDeviceWidth();
|
int width = glCanvas->getDeviceWidth();
|
||||||
int height = app->getGLWidget()->getDeviceHeight();
|
int height = glCanvas->getDeviceHeight();
|
||||||
Camera& camera = *app->getCamera();
|
Camera& camera = *Application::getInstance()->getCamera();
|
||||||
|
|
||||||
configureCamera(camera, width, height);
|
configureCamera(camera, width, height);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,8 @@ void TV3DManager::display(Camera& whichCamera) {
|
||||||
// left eye portal
|
// left eye portal
|
||||||
int portalX = 0;
|
int portalX = 0;
|
||||||
int portalY = 0;
|
int portalY = 0;
|
||||||
QSize deviceSize = Application::getInstance()->getGLWidget()->getDeviceSize() *
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
QSize deviceSize = glCanvas->getDeviceSize() *
|
||||||
Application::getInstance()->getRenderResolutionScale();
|
Application::getInstance()->getRenderResolutionScale();
|
||||||
int portalW = deviceSize.width() / 2;
|
int portalW = deviceSize.width() / 2;
|
||||||
int portalH = deviceSize.height();
|
int portalH = deviceSize.height();
|
||||||
|
@ -103,7 +106,7 @@ void TV3DManager::display(Camera& whichCamera) {
|
||||||
applicationOverlay.renderOverlay(true);
|
applicationOverlay.renderOverlay(true);
|
||||||
const bool displayOverlays = Menu::getInstance()->isOptionChecked(MenuOption::UserInterface);
|
const bool displayOverlays = Menu::getInstance()->isOptionChecked(MenuOption::UserInterface);
|
||||||
|
|
||||||
Application::getInstance()->getGlowEffect()->prepare();
|
DependencyManager::get<GlowEffect>()->prepare();
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -169,7 +172,7 @@ void TV3DManager::display(Camera& whichCamera) {
|
||||||
// reset the viewport to how we started
|
// reset the viewport to how we started
|
||||||
glViewport(0, 0, deviceSize.width(), deviceSize.height());
|
glViewport(0, 0, deviceSize.width(), deviceSize.height());
|
||||||
|
|
||||||
Application::getInstance()->getGlowEffect()->render();
|
DependencyManager::get<GlowEffect>()->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TV3DManager::overrideOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal,
|
void TV3DManager::overrideOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <FBXReader.h>
|
#include <FBXReader.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
|
@ -45,12 +46,12 @@ Visage::Visage() :
|
||||||
|
|
||||||
#ifdef HAVE_VISAGE
|
#ifdef HAVE_VISAGE
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage";
|
QByteArray licensePath = PathUtils::resourcesPath().toLatin1() + "visage";
|
||||||
#else
|
#else
|
||||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc";
|
QByteArray licensePath = PathUtils::resourcesPath().toLatin1() + "visage/license.vlc";
|
||||||
#endif
|
#endif
|
||||||
initializeLicenseManager(licensePath.data());
|
initializeLicenseManager(licensePath.data());
|
||||||
_tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg");
|
_tracker = new VisageTracker2(PathUtils::resourcesPath().toLatin1() + "visage/tracker.cfg");
|
||||||
_data = new FaceData();
|
_data = new FaceData();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -121,7 +122,7 @@ static const QMultiHash<QByteArray, QPair<int, float> >& getActionUnitNameMap()
|
||||||
const float TRANSLATION_SCALE = 20.0f;
|
const float TRANSLATION_SCALE = 20.0f;
|
||||||
|
|
||||||
void Visage::init() {
|
void Visage::init() {
|
||||||
connect(DependencyManager::get<Faceshift>(), SIGNAL(connectionStateChanged()), SLOT(updateEnabled()));
|
connect(DependencyManager::get<Faceshift>().data(), SIGNAL(connectionStateChanged()), SLOT(updateEnabled()));
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,9 @@ namespace VisageSDK {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles input from the Visage webcam feature tracking software.
|
/// Handles input from the Visage webcam feature tracking software.
|
||||||
class Visage : public FaceTracker, public DependencyManager::Dependency {
|
class Visage : public FaceTracker {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(Visage)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
@ -44,7 +45,6 @@ public slots:
|
||||||
private:
|
private:
|
||||||
Visage();
|
Visage();
|
||||||
virtual ~Visage();
|
virtual ~Visage();
|
||||||
friend DependencyManager;
|
|
||||||
|
|
||||||
#ifdef HAVE_VISAGE
|
#ifdef HAVE_VISAGE
|
||||||
VisageSDK::VisageTracker2* _tracker;
|
VisageSDK::VisageTracker2* _tracker;
|
||||||
|
|
|
@ -267,9 +267,9 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
|
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
|
||||||
GLCanvas* widget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
return glm::vec2(widget->width(), widget->height());
|
return glm::vec2(glCanvas->width(), glCanvas->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QScriptValue>
|
#include <QScriptValue>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "ui/ModelsBrowser.h"
|
#include "ui/ModelsBrowser.h"
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue WindowScriptingInterface::hasFocus() {
|
QScriptValue WindowScriptingInterface::hasFocus() {
|
||||||
return Application::getInstance()->getGLWidget()->hasFocus();
|
return DependencyManager::get<GLCanvas>()->hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::setCursorVisible(bool visible) {
|
void WindowScriptingInterface::setCursorVisible(bool visible) {
|
||||||
|
@ -200,7 +201,7 @@ void WindowScriptingInterface::showNonBlockingForm(const QString& title, QScript
|
||||||
}
|
}
|
||||||
|
|
||||||
// what should we do if someone calls us while we still think we have a dialog showing???
|
// what should we do if someone calls us while we still think we have a dialog showing???
|
||||||
if (_editDialog) {
|
if (_nonBlockingFormActive) {
|
||||||
qDebug() << "Show Non-Blocking Form called when form already active.";
|
qDebug() << "Show Non-Blocking Form called when form already active.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#define hifi_Config_h
|
#define hifi_Config_h
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
|
@ -35,6 +34,8 @@
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/matrix_access.hpp>
|
#include <glm/gtc/matrix_access.hpp>
|
||||||
|
|
||||||
|
#include <ProgramObject.h>
|
||||||
|
|
||||||
#include "AngleUtil.h"
|
#include "AngleUtil.h"
|
||||||
#include "Radix2InplaceSort.h"
|
#include "Radix2InplaceSort.h"
|
||||||
#include "Radix2IntegerScanner.h"
|
#include "Radix2IntegerScanner.h"
|
||||||
|
|
|
@ -11,9 +11,12 @@
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "AddressBarDialog.h"
|
#include "AddressBarDialog.h"
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
const QString ADDRESSBAR_GO_BUTTON_ICON = "images/address-bar-submit.svg";
|
const QString ADDRESSBAR_GO_BUTTON_ICON = "images/address-bar-submit.svg";
|
||||||
const QString ADDRESSBAR_GO_BUTTON_ACTIVE_ICON = "images/address-bar-submit-active.svg";
|
const QString ADDRESSBAR_GO_BUTTON_ACTIVE_ICON = "images/address-bar-submit-active.svg";
|
||||||
|
@ -89,7 +92,7 @@ void AddressBarDialog::setupUI() {
|
||||||
_goButton->setSizePolicy(sizePolicy);
|
_goButton->setSizePolicy(sizePolicy);
|
||||||
_goButton->setMinimumSize(QSize(GO_BUTTON_SIZE, GO_BUTTON_SIZE));
|
_goButton->setMinimumSize(QSize(GO_BUTTON_SIZE, GO_BUTTON_SIZE));
|
||||||
_goButton->setMaximumSize(QSize(GO_BUTTON_SIZE, GO_BUTTON_SIZE));
|
_goButton->setMaximumSize(QSize(GO_BUTTON_SIZE, GO_BUTTON_SIZE));
|
||||||
_goButton->setIcon(QIcon(Application::resourcesPath() + ADDRESSBAR_GO_BUTTON_ICON));
|
_goButton->setIcon(QIcon(PathUtils::resourcesPath() + ADDRESSBAR_GO_BUTTON_ICON));
|
||||||
_goButton->setIconSize(QSize(GO_BUTTON_SIZE, GO_BUTTON_SIZE));
|
_goButton->setIconSize(QSize(GO_BUTTON_SIZE, GO_BUTTON_SIZE));
|
||||||
_goButton->setDefault(true);
|
_goButton->setDefault(true);
|
||||||
_goButton->setFlat(true);
|
_goButton->setFlat(true);
|
||||||
|
@ -106,7 +109,7 @@ void AddressBarDialog::setupUI() {
|
||||||
_closeButton->setSizePolicy(sizePolicy);
|
_closeButton->setSizePolicy(sizePolicy);
|
||||||
_closeButton->setMinimumSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
_closeButton->setMinimumSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
||||||
_closeButton->setMaximumSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
_closeButton->setMaximumSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
||||||
QIcon icon(Application::resourcesPath() + CLOSE_BUTTON_ICON);
|
QIcon icon(PathUtils::resourcesPath() + CLOSE_BUTTON_ICON);
|
||||||
_closeButton->setIcon(icon);
|
_closeButton->setIcon(icon);
|
||||||
_closeButton->setIconSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
_closeButton->setIconSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
||||||
_closeButton->setFlat(true);
|
_closeButton->setFlat(true);
|
||||||
|
@ -119,7 +122,7 @@ void AddressBarDialog::setupUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBarDialog::showEvent(QShowEvent* event) {
|
void AddressBarDialog::showEvent(QShowEvent* event) {
|
||||||
_goButton->setIcon(QIcon(Application::resourcesPath() + ADDRESSBAR_GO_BUTTON_ICON));
|
_goButton->setIcon(QIcon(PathUtils::resourcesPath() + ADDRESSBAR_GO_BUTTON_ICON));
|
||||||
_addressLineEdit->setText(QString());
|
_addressLineEdit->setText(QString());
|
||||||
_addressLineEdit->setFocus();
|
_addressLineEdit->setFocus();
|
||||||
FramelessDialog::showEvent(event);
|
FramelessDialog::showEvent(event);
|
||||||
|
@ -127,7 +130,7 @@ void AddressBarDialog::showEvent(QShowEvent* event) {
|
||||||
|
|
||||||
void AddressBarDialog::accept() {
|
void AddressBarDialog::accept() {
|
||||||
if (!_addressLineEdit->text().isEmpty()) {
|
if (!_addressLineEdit->text().isEmpty()) {
|
||||||
_goButton->setIcon(QIcon(Application::resourcesPath() + ADDRESSBAR_GO_BUTTON_ACTIVE_ICON));
|
_goButton->setIcon(QIcon(PathUtils::resourcesPath() + ADDRESSBAR_GO_BUTTON_ACTIVE_ICON));
|
||||||
AddressManager* addressManager = DependencyManager::get<AddressManager>();
|
AddressManager* addressManager = DependencyManager::get<AddressManager>();
|
||||||
connect(addressManager, &AddressManager::lookupResultsFinished, this, &QDialog::hide);
|
connect(addressManager, &AddressManager::lookupResultsFinished, this, &QDialog::hide);
|
||||||
addressManager->handleLookupString(_addressLineEdit->text());
|
addressManager->handleLookupString(_addressLineEdit->text());
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "AnimationsDialog.h"
|
#include "AnimationsDialog.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
AnimationsDialog::AnimationsDialog() :
|
AnimationsDialog::AnimationsDialog() :
|
||||||
QDialog(Application::getInstance()->getWindow()) {
|
QDialog(Application::getInstance()->getWindow()) {
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <QOpenGLFramebufferObject>
|
#include <QOpenGLFramebufferObject>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
#include "audio/AudioIOStatsRenderer.h"
|
#include "audio/AudioIOStatsRenderer.h"
|
||||||
|
@ -148,11 +150,11 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
Overlays& overlays = application->getOverlays();
|
Overlays& overlays = application->getOverlays();
|
||||||
GLCanvas* glWidget = application->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = application->getAvatar();
|
||||||
|
|
||||||
_textureFov = glm::radians(Menu::getInstance()->getOculusUIAngularSize());
|
_textureFov = glm::radians(Menu::getInstance()->getOculusUIAngularSize());
|
||||||
_textureAspectRatio = (float)application->getGLWidget()->getDeviceWidth() / (float)application->getGLWidget()->getDeviceHeight();
|
_textureAspectRatio = (float)glCanvas->getDeviceWidth() / (float)glCanvas->getDeviceHeight();
|
||||||
|
|
||||||
//Handle fading and deactivation/activation of UI
|
//Handle fading and deactivation/activation of UI
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) {
|
||||||
|
@ -181,12 +183,12 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
||||||
|
|
||||||
glPushMatrix(); {
|
glPushMatrix(); {
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluOrtho2D(0, glWidget->width(), glWidget->height(), 0);
|
gluOrtho2D(0, glCanvas->width(), glCanvas->height(), 0);
|
||||||
|
|
||||||
renderAudioMeter();
|
renderAudioMeter();
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) {
|
||||||
myAvatar->renderHeadMouse(glWidget->width(), glWidget->height());
|
myAvatar->renderHeadMouse(glCanvas->width(), glCanvas->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
renderStatsAndLogs();
|
renderStatsAndLogs();
|
||||||
|
@ -216,7 +218,7 @@ void ApplicationOverlay::displayOverlayTexture() {
|
||||||
if (_alpha == 0.0f) {
|
if (_alpha == 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -225,16 +227,16 @@ void ApplicationOverlay::displayOverlayTexture() {
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix(); {
|
glPushMatrix(); {
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluOrtho2D(0, glWidget->getDeviceWidth(), glWidget->getDeviceHeight(), 0);
|
gluOrtho2D(0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight(), 0);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
glBegin(GL_QUADS); {
|
glBegin(GL_QUADS); {
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, _alpha);
|
glColor4f(1.0f, 1.0f, 1.0f, _alpha);
|
||||||
glTexCoord2f(0, 0); glVertex2i(0, glWidget->getDeviceHeight());
|
glTexCoord2f(0, 0); glVertex2i(0, glCanvas->getDeviceHeight());
|
||||||
glTexCoord2f(1, 0); glVertex2i(glWidget->getDeviceWidth(), glWidget->getDeviceHeight());
|
glTexCoord2f(1, 0); glVertex2i(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
glTexCoord2f(1, 1); glVertex2i(glWidget->getDeviceWidth(), 0);
|
glTexCoord2f(1, 1); glVertex2i(glCanvas->getDeviceWidth(), 0);
|
||||||
glTexCoord2f(0, 1); glVertex2i(0, 0);
|
glTexCoord2f(0, 1); glVertex2i(0, 0);
|
||||||
} glEnd();
|
} glEnd();
|
||||||
} glPopMatrix();
|
} glPopMatrix();
|
||||||
|
@ -381,18 +383,19 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
if (_crosshairTexture == 0) {
|
if (_crosshairTexture == 0) {
|
||||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
_crosshairTexture = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw the mouse pointer
|
//draw the mouse pointer
|
||||||
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
|
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
|
||||||
|
|
||||||
const float reticleSize = 40.0f / application->getGLWidget()->width() * quadWidth;
|
const float reticleSize = 40.0f / glCanvas->width() * quadWidth;
|
||||||
x -= reticleSize / 2.0f;
|
x -= reticleSize / 2.0f;
|
||||||
y += reticleSize / 2.0f;
|
y += reticleSize / 2.0f;
|
||||||
const float mouseX = (application->getMouseX() / (float)application->getGLWidget()->width()) * quadWidth;
|
const float mouseX = (application->getMouseX() / (float)glCanvas->width()) * quadWidth;
|
||||||
const float mouseY = (1.0 - (application->getMouseY() / (float)application->getGLWidget()->height())) * quadHeight;
|
const float mouseY = (1.0 - (application->getMouseY() / (float)glCanvas->height())) * quadHeight;
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
|
@ -434,7 +437,7 @@ void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origi
|
||||||
//Caculate the click location using one of the sixense controllers. Scale is not applied
|
//Caculate the click location using one of the sixense controllers. Scale is not applied
|
||||||
QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
GLCanvas* glWidget = application->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = application->getAvatar();
|
||||||
|
|
||||||
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
|
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
|
||||||
|
@ -465,8 +468,8 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
||||||
float u = asin(collisionPos.x) / (_textureFov)+0.5f;
|
float u = asin(collisionPos.x) / (_textureFov)+0.5f;
|
||||||
float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f);
|
float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f);
|
||||||
|
|
||||||
rv.setX(u * glWidget->width());
|
rv.setX(u * glCanvas->width());
|
||||||
rv.setY(v * glWidget->height());
|
rv.setY(v * glCanvas->height());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//if they did not click on the overlay, just set the coords to INT_MAX
|
//if they did not click on the overlay, just set the coords to INT_MAX
|
||||||
|
@ -483,8 +486,8 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
||||||
ndcSpacePos = glm::vec3(clipSpacePos) / clipSpacePos.w;
|
ndcSpacePos = glm::vec3(clipSpacePos) / clipSpacePos.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv.setX(((ndcSpacePos.x + 1.0) / 2.0) * glWidget->width());
|
rv.setX(((ndcSpacePos.x + 1.0) / 2.0) * glCanvas->width());
|
||||||
rv.setY((1.0 - ((ndcSpacePos.y + 1.0) / 2.0)) * glWidget->height());
|
rv.setY((1.0 - ((ndcSpacePos.y + 1.0) / 2.0)) * glCanvas->height());
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -513,10 +516,11 @@ bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position,
|
||||||
//Renders optional pointers
|
//Renders optional pointers
|
||||||
void ApplicationOverlay::renderPointers() {
|
void ApplicationOverlay::renderPointers() {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
//lazily load crosshair texture
|
//lazily load crosshair texture
|
||||||
if (_crosshairTexture == 0) {
|
if (_crosshairTexture == 0) {
|
||||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
_crosshairTexture = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png"));
|
||||||
}
|
}
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
@ -539,7 +543,7 @@ void ApplicationOverlay::renderPointers() {
|
||||||
glm::vec2 screenPos = sphericalToScreen(glm::vec2(yaw, -pitch));
|
glm::vec2 screenPos = sphericalToScreen(glm::vec2(yaw, -pitch));
|
||||||
|
|
||||||
position = QPoint(screenPos.x, screenPos.y);
|
position = QPoint(screenPos.x, screenPos.y);
|
||||||
application->getGLWidget()->cursor().setPos(application->getGLWidget()->mapToGlobal(position));
|
glCanvas->cursor().setPos(glCanvas->mapToGlobal(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
_reticlePosition[MOUSE] = position;
|
_reticlePosition[MOUSE] = position;
|
||||||
|
@ -560,7 +564,7 @@ void ApplicationOverlay::renderPointers() {
|
||||||
|
|
||||||
void ApplicationOverlay::renderControllerPointers() {
|
void ApplicationOverlay::renderControllerPointers() {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
GLCanvas* glWidget = application->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = application->getAvatar();
|
||||||
|
|
||||||
//Static variables used for storing controller state
|
//Static variables used for storing controller state
|
||||||
|
@ -638,14 +642,14 @@ void ApplicationOverlay::renderControllerPointers() {
|
||||||
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
// Get the pixel range over which the xAngle and yAngle are scaled
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
float cursorRange = glWidget->width() * SixenseManager::getInstance().getCursorPixelRangeMult();
|
float cursorRange = glCanvas->width() * SixenseManager::getInstance().getCursorPixelRangeMult();
|
||||||
|
|
||||||
mouseX = (glWidget->width() / 2.0f + cursorRange * xAngle);
|
mouseX = (glCanvas->width() / 2.0f + cursorRange * xAngle);
|
||||||
mouseY = (glWidget->height() / 2.0f + cursorRange * yAngle);
|
mouseY = (glCanvas->height() / 2.0f + cursorRange * yAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the cursor is out of the screen then don't render it
|
//If the cursor is out of the screen then don't render it
|
||||||
if (mouseX < 0 || mouseX >= glWidget->width() || mouseY < 0 || mouseY >= glWidget->height()) {
|
if (mouseX < 0 || mouseX >= glCanvas->width() || mouseY < 0 || mouseY >= glCanvas->height()) {
|
||||||
_reticleActive[index] = false;
|
_reticleActive[index] = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -705,11 +709,10 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) {
|
||||||
|
|
||||||
//Renders a small magnification of the currently bound texture at the coordinates
|
//Renders a small magnification of the currently bound texture at the coordinates
|
||||||
void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool showBorder) const {
|
void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool showBorder) const {
|
||||||
Application* application = Application::getInstance();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
GLCanvas* glWidget = application->getGLWidget();
|
|
||||||
|
|
||||||
const int widgetWidth = glWidget->width();
|
const int widgetWidth = glCanvas->width();
|
||||||
const int widgetHeight = glWidget->height();
|
const int widgetHeight = glCanvas->height();
|
||||||
|
|
||||||
const float halfWidth = (MAGNIFY_WIDTH / _textureAspectRatio) * sizeMult / 2.0f;
|
const float halfWidth = (MAGNIFY_WIDTH / _textureAspectRatio) * sizeMult / 2.0f;
|
||||||
const float halfHeight = MAGNIFY_HEIGHT * sizeMult / 2.0f;
|
const float halfHeight = MAGNIFY_HEIGHT * sizeMult / 2.0f;
|
||||||
|
@ -763,9 +766,9 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
|
||||||
void ApplicationOverlay::renderAudioMeter() {
|
void ApplicationOverlay::renderAudioMeter() {
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
|
|
||||||
GLCanvas* glWidget = application->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
Audio* audio = DependencyManager::get<Audio>();
|
Audio::SharedPointer audio = DependencyManager::get<Audio>();
|
||||||
|
|
||||||
// Audio VU Meter and Mute Icon
|
// Audio VU Meter and Mute Icon
|
||||||
const int MUTE_ICON_SIZE = 24;
|
const int MUTE_ICON_SIZE = 24;
|
||||||
|
@ -816,13 +819,13 @@ void ApplicationOverlay::renderAudioMeter() {
|
||||||
if ((audio->getTimeSinceLastClip() > 0.0f) && (audio->getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
|
if ((audio->getTimeSinceLastClip() > 0.0f) && (audio->getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
|
||||||
const float MAX_MAGNITUDE = 0.7f;
|
const float MAX_MAGNITUDE = 0.7f;
|
||||||
float magnitude = MAX_MAGNITUDE * (1 - audio->getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME);
|
float magnitude = MAX_MAGNITUDE * (1 - audio->getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME);
|
||||||
renderCollisionOverlay(glWidget->width(), glWidget->height(), magnitude, 1.0f);
|
renderCollisionOverlay(glCanvas->width(), glCanvas->height(), magnitude, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
DependencyManager::get<AudioToolBox>()->render(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, audioMeterY, boxed);
|
DependencyManager::get<AudioToolBox>()->render(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, audioMeterY, boxed);
|
||||||
|
|
||||||
DependencyManager::get<AudioScope>()->render(glWidget->width(), glWidget->height());
|
DependencyManager::get<AudioScope>()->render(glCanvas->width(), glCanvas->height());
|
||||||
DependencyManager::get<AudioIOStatsRenderer>()->render(WHITE_TEXT, glWidget->width(), glWidget->height());
|
DependencyManager::get<AudioIOStatsRenderer>()->render(WHITE_TEXT, glCanvas->width(), glCanvas->height());
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
if (isClipping) {
|
if (isClipping) {
|
||||||
|
@ -883,8 +886,8 @@ void ApplicationOverlay::renderAudioMeter() {
|
||||||
void ApplicationOverlay::renderStatsAndLogs() {
|
void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
|
|
||||||
GLCanvas* glWidget = application->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
|
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
|
||||||
BandwidthMeter* bandwidthMeter = application->getBandwidthMeter();
|
BandwidthMeter* bandwidthMeter = application->getBandwidthMeter();
|
||||||
NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay();
|
NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay();
|
||||||
|
@ -902,8 +905,8 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
application->getPacketsPerSecond(), application->getBytesPerSecond(), voxelPacketsToProcess);
|
application->getPacketsPerSecond(), application->getBytesPerSecond(), voxelPacketsToProcess);
|
||||||
// Bandwidth meter
|
// Bandwidth meter
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth)) {
|
||||||
Stats::drawBackground(0x33333399, glWidget->width() - 296, glWidget->height() - 68, 296, 68);
|
Stats::drawBackground(0x33333399, glCanvas->width() - 296, glCanvas->height() - 68, 296, 68);
|
||||||
bandwidthMeter->render(glWidget->width(), glWidget->height());
|
bandwidthMeter->render(glCanvas->width(), glCanvas->height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,7 +919,7 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
(Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
(Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth))
|
Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth))
|
||||||
? 80 : 20;
|
? 80 : 20;
|
||||||
drawText(glWidget->width() - 100, glWidget->height() - timerBottom,
|
drawText(glCanvas->width() - 100, glCanvas->height() - timerBottom,
|
||||||
0.30f, 0.0f, 0, frameTimer, WHITE_TEXT);
|
0.30f, 0.0f, 0, frameTimer, WHITE_TEXT);
|
||||||
}
|
}
|
||||||
nodeBoundsDisplay.drawOverlay();
|
nodeBoundsDisplay.drawOverlay();
|
||||||
|
@ -926,9 +929,9 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder() {
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
|
||||||
if (nodeList && !nodeList->getDomainHandler().isConnected()) {
|
if (nodeList && !nodeList->getDomainHandler().isConnected()) {
|
||||||
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
int right = glWidget->width();
|
int right = glCanvas->width();
|
||||||
int bottom = glWidget->height();
|
int bottom = glCanvas->height();
|
||||||
|
|
||||||
glColor3f(CONNECTION_STATUS_BORDER_COLOR[0],
|
glColor3f(CONNECTION_STATUS_BORDER_COLOR[0],
|
||||||
CONNECTION_STATUS_BORDER_COLOR[1],
|
CONNECTION_STATUS_BORDER_COLOR[1],
|
||||||
|
@ -1063,7 +1066,7 @@ void ApplicationOverlay::TexturedHemisphere::cleanupVBO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::TexturedHemisphere::buildFramebufferObject() {
|
void ApplicationOverlay::TexturedHemisphere::buildFramebufferObject() {
|
||||||
QSize size = Application::getInstance()->getGLWidget()->getDeviceSize();
|
QSize size = DependencyManager::get<GLCanvas>()->getDeviceSize();
|
||||||
if (_framebufferObject != NULL && size == _framebufferObject->size()) {
|
if (_framebufferObject != NULL && size == _framebufferObject->size()) {
|
||||||
// Already build
|
// Already build
|
||||||
return;
|
return;
|
||||||
|
@ -1114,7 +1117,7 @@ void ApplicationOverlay::TexturedHemisphere::render() {
|
||||||
|
|
||||||
|
|
||||||
glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
|
glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
|
||||||
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
|
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
|
||||||
float yaw = -(screenPos.x / screenSize.width() - 0.5f) * MOUSE_YAW_RANGE;
|
float yaw = -(screenPos.x / screenSize.width() - 0.5f) * MOUSE_YAW_RANGE;
|
||||||
float pitch = (screenPos.y / screenSize.height() - 0.5f) * MOUSE_PITCH_RANGE;
|
float pitch = (screenPos.y / screenSize.height() - 0.5f) * MOUSE_PITCH_RANGE;
|
||||||
|
|
||||||
|
@ -1122,7 +1125,7 @@ glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
|
glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
|
||||||
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
|
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
|
||||||
float x = (-sphericalPos.x / MOUSE_YAW_RANGE + 0.5f) * screenSize.width();
|
float x = (-sphericalPos.x / MOUSE_YAW_RANGE + 0.5f) * screenSize.width();
|
||||||
float y = (sphericalPos.y / MOUSE_PITCH_RANGE + 0.5f) * screenSize.height();
|
float y = (sphericalPos.y / MOUSE_PITCH_RANGE + 0.5f) * screenSize.height();
|
||||||
|
|
||||||
|
@ -1130,7 +1133,7 @@ glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
|
glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
|
||||||
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
|
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
|
||||||
float x = (-sphericalPos.x / (_textureFov * _textureAspectRatio) + 0.5f) * screenSize.width();
|
float x = (-sphericalPos.x / (_textureFov * _textureAspectRatio) + 0.5f) * screenSize.width();
|
||||||
float y = (sphericalPos.y / _textureFov + 0.5f) * screenSize.height();
|
float y = (sphericalPos.y / _textureFov + 0.5f) * screenSize.height();
|
||||||
|
|
||||||
|
@ -1138,7 +1141,7 @@ glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 ApplicationOverlay::overlayToSpherical(glm::vec2 overlayPos) const {
|
glm::vec2 ApplicationOverlay::overlayToSpherical(glm::vec2 overlayPos) const {
|
||||||
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
|
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
|
||||||
float yaw = -(overlayPos.x / screenSize.width() - 0.5f) * _textureFov * _textureAspectRatio;
|
float yaw = -(overlayPos.x / screenSize.width() - 0.5f) * _textureFov * _textureAspectRatio;
|
||||||
float pitch = (overlayPos.y / screenSize.height() - 0.5f) * _textureFov;
|
float pitch = (overlayPos.y / screenSize.height() - 0.5f) * _textureFov;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "AttachmentsDialog.h"
|
#include "AttachmentsDialog.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
AttachmentsDialog::AttachmentsDialog() :
|
AttachmentsDialog::AttachmentsDialog() :
|
||||||
QDialog(Application::getInstance()->getWindow()) {
|
QDialog(Application::getInstance()->getWindow()) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "ui/TextRenderer.h"
|
#include <TextRenderer.h>
|
||||||
|
|
||||||
|
|
||||||
class BandwidthMeter {
|
class BandwidthMeter {
|
||||||
|
|
|
@ -16,14 +16,17 @@
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include "qtimespan.h"
|
||||||
|
|
||||||
|
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "ChatMessageArea.h"
|
#include "ChatMessageArea.h"
|
||||||
#include "FlowLayout.h"
|
#include "FlowLayout.h"
|
||||||
#include "qtimespan.h"
|
#include "MainWindow.h"
|
||||||
#include "UIUtil.h"
|
#include "UIUtil.h"
|
||||||
#include "XmppClient.h"
|
#include "XmppClient.h"
|
||||||
|
|
||||||
|
@ -92,9 +95,9 @@ ChatWindow::ChatWindow(QWidget* parent) :
|
||||||
connect(&_trayIcon, SIGNAL(messageClicked()), this, SLOT(notificationClicked()));
|
connect(&_trayIcon, SIGNAL(messageClicked()), this, SLOT(notificationClicked()));
|
||||||
#endif // HAVE_QXMPP
|
#endif // HAVE_QXMPP
|
||||||
|
|
||||||
QDir mentionSoundsDir(Application::resourcesPath() + mentionSoundsPath);
|
QDir mentionSoundsDir(PathUtils::resourcesPath() + mentionSoundsPath);
|
||||||
_mentionSounds = mentionSoundsDir.entryList(QDir::Files);
|
_mentionSounds = mentionSoundsDir.entryList(QDir::Files);
|
||||||
_trayIcon.setIcon(QIcon( Application::resourcesPath() + "/images/hifi-logo.svg"));
|
_trayIcon.setIcon(QIcon( PathUtils::resourcesPath() + "/images/hifi-logo.svg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWindow::~ChatWindow() {
|
ChatWindow::~ChatWindow() {
|
||||||
|
@ -385,7 +388,7 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
|
||||||
|
|
||||||
if (_effectPlayer.state() != QMediaPlayer::PlayingState) {
|
if (_effectPlayer.state() != QMediaPlayer::PlayingState) {
|
||||||
// get random sound
|
// get random sound
|
||||||
QFileInfo inf = QFileInfo(Application::resourcesPath() +
|
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() +
|
||||||
mentionSoundsPath +
|
mentionSoundsPath +
|
||||||
_mentionSounds.at(rand() % _mentionSounds.size()));
|
_mentionSounds.at(rand() % _mentionSounds.size()));
|
||||||
_effectPlayer.setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
_effectPlayer.setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "FramelessDialog.h"
|
#include "FramelessDialog.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
@ -80,10 +82,10 @@ bool FramelessDialog::eventFilter(QObject* sender, QEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramelessDialog::setStyleSheetFile(const QString& fileName) {
|
void FramelessDialog::setStyleSheetFile(const QString& fileName) {
|
||||||
QFile globalStyleSheet(Application::resourcesPath() + "styles/global.qss");
|
QFile globalStyleSheet(PathUtils::resourcesPath() + "styles/global.qss");
|
||||||
QFile styleSheet(Application::resourcesPath() + fileName);
|
QFile styleSheet(PathUtils::resourcesPath() + fileName);
|
||||||
if (styleSheet.open(QIODevice::ReadOnly) && globalStyleSheet.open(QIODevice::ReadOnly) ) {
|
if (styleSheet.open(QIODevice::ReadOnly) && globalStyleSheet.open(QIODevice::ReadOnly) ) {
|
||||||
QDir::setCurrent(Application::resourcesPath());
|
QDir::setCurrent(PathUtils::resourcesPath());
|
||||||
setStyleSheet(globalStyleSheet.readAll() + styleSheet.readAll());
|
setStyleSheet(globalStyleSheet.readAll() + styleSheet.readAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <VoxelConstants.h>
|
#include <VoxelConstants.h>
|
||||||
|
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
#include "ui/HMDToolsDialog.h"
|
#include "ui/HMDToolsDialog.h"
|
||||||
|
|
|
@ -9,14 +9,17 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "InfoView.h"
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "Application.h"
|
|
||||||
|
|
||||||
#include <QtWebKitWidgets/QWebFrame>
|
#include <QtWebKitWidgets/QWebFrame>
|
||||||
#include <QtWebKit/QWebElement>
|
#include <QtWebKit/QWebElement>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
|
#include "InfoView.h"
|
||||||
|
|
||||||
#define SETTINGS_VERSION_KEY "info-version"
|
#define SETTINGS_VERSION_KEY "info-version"
|
||||||
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
||||||
|
|
||||||
|
@ -25,7 +28,7 @@ InfoView::InfoView(bool forced, QString path) :
|
||||||
{
|
{
|
||||||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
||||||
|
|
||||||
QString absPath = QFileInfo(Application::resourcesPath() + path).absoluteFilePath();
|
QString absPath = QFileInfo(PathUtils::resourcesPath() + path).absoluteFilePath();
|
||||||
QUrl url = QUrl::fromLocalFile(absPath);
|
QUrl url = QUrl::fromLocalFile(absPath);
|
||||||
|
|
||||||
load(url);
|
load(url);
|
||||||
|
|
|
@ -13,10 +13,11 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
#include "Application.h"
|
#include <PathUtils.h>
|
||||||
#include "ScriptHighlighting.h"
|
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "JSConsole.h"
|
#include "JSConsole.h"
|
||||||
|
#include "ScriptHighlighting.h"
|
||||||
|
|
||||||
const int NO_CURRENT_HISTORY_COMMAND = -1;
|
const int NO_CURRENT_HISTORY_COMMAND = -1;
|
||||||
const int MAX_HISTORY_SIZE = 64;
|
const int MAX_HISTORY_SIZE = 64;
|
||||||
|
@ -41,9 +42,9 @@ JSConsole::JSConsole(QWidget* parent, ScriptEngine* scriptEngine) :
|
||||||
_ui->promptTextEdit->setWordWrapMode(QTextOption::NoWrap);
|
_ui->promptTextEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||||
_ui->promptTextEdit->installEventFilter(this);
|
_ui->promptTextEdit->installEventFilter(this);
|
||||||
|
|
||||||
QFile styleSheet(Application::resourcesPath() + "styles/console.qss");
|
QFile styleSheet(PathUtils::resourcesPath() + "styles/console.qss");
|
||||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||||
QDir::setCurrent(Application::resourcesPath());
|
QDir::setCurrent(PathUtils::resourcesPath());
|
||||||
setStyleSheet(styleSheet.readAll());
|
setStyleSheet(styleSheet.readAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include "ui/LogDialog.h"
|
#include "ui/LogDialog.h"
|
||||||
|
|
||||||
const int TOP_BAR_HEIGHT = 46;
|
const int TOP_BAR_HEIGHT = 46;
|
||||||
|
@ -44,9 +44,9 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog
|
||||||
setWindowTitle("Log");
|
setWindowTitle("Log");
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
QFile styleSheet(Application::resourcesPath() + "styles/log_dialog.qss");
|
QFile styleSheet(PathUtils::resourcesPath() + "styles/log_dialog.qss");
|
||||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||||
QDir::setCurrent(Application::resourcesPath());
|
QDir::setCurrent(PathUtils::resourcesPath());
|
||||||
setStyleSheet(styleSheet.readAll());
|
setStyleSheet(styleSheet.readAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,12 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "AccountManager.h"
|
#include "AccountManager.h"
|
||||||
#include "ui_loginDialog.h"
|
#include "ui_loginDialog.h"
|
||||||
|
|
||||||
#include "LoginDialog.h"
|
#include "LoginDialog.h"
|
||||||
|
|
||||||
const QString FORGOT_PASSWORD_URL = "https://data.highfidelity.io/users/password/new";
|
const QString FORGOT_PASSWORD_URL = "https://data.highfidelity.io/users/password/new";
|
||||||
|
@ -30,8 +31,8 @@ LoginDialog::LoginDialog(QWidget* parent) :
|
||||||
_ui->setupUi(this);
|
_ui->setupUi(this);
|
||||||
_ui->errorLabel->hide();
|
_ui->errorLabel->hide();
|
||||||
_ui->emailLineEdit->setFocus();
|
_ui->emailLineEdit->setFocus();
|
||||||
_ui->logoLabel->setPixmap(QPixmap(Application::resourcesPath() + "images/hifi-logo.svg"));
|
_ui->logoLabel->setPixmap(QPixmap(PathUtils::resourcesPath() + "images/hifi-logo.svg"));
|
||||||
_ui->loginButton->setIcon(QIcon(Application::resourcesPath() + "images/login.svg"));
|
_ui->loginButton->setIcon(QIcon(PathUtils::resourcesPath() + "images/login.svg"));
|
||||||
_ui->infoLabel->setVisible(false);
|
_ui->infoLabel->setVisible(false);
|
||||||
_ui->errorLabel->setVisible(false);
|
_ui->errorLabel->setVisible(false);
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,10 @@
|
||||||
#include <AttributeRegistry.h>
|
#include <AttributeRegistry.h>
|
||||||
#include <MetavoxelMessages.h>
|
#include <MetavoxelMessages.h>
|
||||||
#include <MetavoxelUtil.h>
|
#include <MetavoxelUtil.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "MetavoxelEditor.h"
|
#include "MetavoxelEditor.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -137,7 +139,7 @@ MetavoxelEditor::MetavoxelEditor() :
|
||||||
connect(Application::getInstance()->getMetavoxels(), &MetavoxelSystem::rendering,
|
connect(Application::getInstance()->getMetavoxels(), &MetavoxelSystem::rendering,
|
||||||
this, &MetavoxelEditor::renderPreview);
|
this, &MetavoxelEditor::renderPreview);
|
||||||
|
|
||||||
Application::getInstance()->getGLWidget()->installEventFilter(this);
|
DependencyManager::get<GLCanvas>()->installEventFilter(this);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
|
@ -145,7 +147,7 @@ MetavoxelEditor::MetavoxelEditor() :
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag");
|
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/grid.frag");
|
||||||
_gridProgram.link();
|
_gridProgram.link();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <ProgramObject.h>
|
||||||
|
|
||||||
#include "MetavoxelSystem.h"
|
#include "MetavoxelSystem.h"
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
|
|
||||||
class QColorEditor;
|
class QColorEditor;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
const int BYTES_PER_KILOBYTE = 1024;
|
const int BYTES_PER_KILOBYTE = 1024;
|
||||||
|
|
||||||
MetavoxelNetworkSimulator::MetavoxelNetworkSimulator() :
|
MetavoxelNetworkSimulator::MetavoxelNetworkSimulator() :
|
||||||
QWidget(Application::getInstance()->getGLWidget(), Qt::Dialog) {
|
QWidget(DependencyManager::get<GLCanvas>().data(), Qt::Dialog) {
|
||||||
|
|
||||||
setWindowTitle("Metavoxel Network Simulator");
|
setWindowTitle("Metavoxel Network Simulator");
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "ModelsBrowser.h"
|
#include "ModelsBrowser.h"
|
||||||
#include "PreferencesDialog.h"
|
#include "PreferencesDialog.h"
|
||||||
|
@ -214,8 +215,8 @@ void PreferencesDialog::savePreferences() {
|
||||||
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
|
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
|
||||||
|
|
||||||
Application::getInstance()->getVoxels()->setMaxVoxels(ui.maxVoxelsSpin->value());
|
Application::getInstance()->getVoxels()->setMaxVoxels(ui.maxVoxelsSpin->value());
|
||||||
Application::getInstance()->resizeGL(Application::getInstance()->getGLWidget()->width(),
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
Application::getInstance()->getGLWidget()->height());
|
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
|
||||||
|
|
||||||
Menu::getInstance()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());
|
Menu::getInstance()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());
|
||||||
|
|
||||||
|
@ -247,8 +248,7 @@ void PreferencesDialog::savePreferences() {
|
||||||
Menu::getInstance()->setReceivedAudioStreamSettings(streamSettings);
|
Menu::getInstance()->setReceivedAudioStreamSettings(streamSettings);
|
||||||
DependencyManager::get<Audio>()->setReceivedAudioStreamSettings(streamSettings);
|
DependencyManager::get<Audio>()->setReceivedAudioStreamSettings(streamSettings);
|
||||||
|
|
||||||
Application::getInstance()->resizeGL(Application::getInstance()->getGLWidget()->width(),
|
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
|
||||||
Application::getInstance()->getGLWidget()->height());
|
|
||||||
|
|
||||||
Application::getInstance()->bumpSettings();
|
Application::getInstance()->bumpSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "RearMirrorTools.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
#include "RearMirrorTools.h"
|
|
||||||
|
|
||||||
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
|
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
|
||||||
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
|
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
|
||||||
|
@ -32,13 +33,13 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se
|
||||||
_fullScreen(false)
|
_fullScreen(false)
|
||||||
{
|
{
|
||||||
_zoomLevel = HEAD;
|
_zoomLevel = HEAD;
|
||||||
_closeTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/close.svg"));
|
_closeTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/close.svg"));
|
||||||
|
|
||||||
// Disabled for now https://worklist.net/19548
|
// Disabled for now https://worklist.net/19548
|
||||||
// _resetTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/reset.png"));
|
// _resetTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/reset.png"));
|
||||||
|
|
||||||
_zoomHeadTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/plus.svg"));
|
_zoomHeadTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/plus.svg"));
|
||||||
_zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/minus.svg"));
|
_zoomBodyTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/minus.svg"));
|
||||||
|
|
||||||
_shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE);
|
_shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE);
|
||||||
_closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);
|
_closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "ScriptsModel.h"
|
#include "ScriptsModel.h"
|
||||||
|
@ -109,7 +111,7 @@ void RunningScriptsWidget::setRunningScripts(const QStringList& list) {
|
||||||
QPushButton* closeButton = new QPushButton(row);
|
QPushButton* closeButton = new QPushButton(row);
|
||||||
closeButton->setFlat(true);
|
closeButton->setFlat(true);
|
||||||
closeButton->setIcon(
|
closeButton->setIcon(
|
||||||
QIcon(QPixmap(Application::resourcesPath() + "images/kill-script.svg").scaledToHeight(CLOSE_ICON_HEIGHT)));
|
QIcon(QPixmap(PathUtils::resourcesPath() + "images/kill-script.svg").scaledToHeight(CLOSE_ICON_HEIGHT)));
|
||||||
closeButton->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred));
|
closeButton->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred));
|
||||||
closeButton->setStyleSheet("border: 0;");
|
closeButton->setStyleSheet("border: 0;");
|
||||||
closeButton->setCursor(Qt::PointingHandCursor);
|
closeButton->setCursor(Qt::PointingHandCursor);
|
||||||
|
|
|
@ -83,9 +83,8 @@ QTemporaryFile* Snapshot::saveTempSnapshot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
|
QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
|
||||||
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
QGLWidget* widget = Application::getInstance()->getGLWidget();
|
QImage shot = glCanvas->grabFrameBuffer();
|
||||||
QImage shot = widget->grabFrameBuffer();
|
|
||||||
|
|
||||||
Avatar* avatar = Application::getInstance()->getAvatar();
|
Avatar* avatar = Application::getInstance()->getAvatar();
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ Stats::Stats():
|
||||||
_metavoxelReceiveProgress(0),
|
_metavoxelReceiveProgress(0),
|
||||||
_metavoxelReceiveTotal(0)
|
_metavoxelReceiveTotal(0)
|
||||||
{
|
{
|
||||||
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
resetWidth(glWidget->width(), 0);
|
resetWidth(glCanvas->width(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stats::toggleExpanded() {
|
void Stats::toggleExpanded() {
|
||||||
|
@ -67,7 +67,7 @@ void Stats::toggleExpanded() {
|
||||||
// called on mouse click release
|
// called on mouse click release
|
||||||
// check for clicks over stats in order to expand or contract them
|
// check for clicks over stats in order to expand or contract them
|
||||||
void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) {
|
void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) {
|
||||||
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) {
|
if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) {
|
||||||
// not worried about dragging on stats
|
// not worried about dragging on stats
|
||||||
|
@ -114,7 +114,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
|
||||||
// top-right stats click
|
// top-right stats click
|
||||||
lines = _expanded ? 11 : 3;
|
lines = _expanded ? 11 : 3;
|
||||||
statsHeight = lines * STATS_PELS_PER_LINE + 10;
|
statsHeight = lines * STATS_PELS_PER_LINE + 10;
|
||||||
statsWidth = glWidget->width() - statsX;
|
statsWidth = glCanvas->width() - statsX;
|
||||||
if (mouseX > statsX && mouseX < statsX + statsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
|
if (mouseX > statsX && mouseX < statsX + statsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
|
||||||
toggleExpanded();
|
toggleExpanded();
|
||||||
return;
|
return;
|
||||||
|
@ -122,8 +122,8 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stats::resetWidth(int width, int horizontalOffset) {
|
void Stats::resetWidth(int width, int horizontalOffset) {
|
||||||
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
int extraSpace = glWidget->width() - horizontalOffset -2
|
int extraSpace = glCanvas->width() - horizontalOffset -2
|
||||||
- STATS_GENERAL_MIN_WIDTH
|
- STATS_GENERAL_MIN_WIDTH
|
||||||
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
|
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
|
||||||
- STATS_GEO_MIN_WIDTH
|
- STATS_GEO_MIN_WIDTH
|
||||||
|
@ -147,7 +147,7 @@ void Stats::resetWidth(int width, int horizontalOffset) {
|
||||||
_pingStatsWidth += (int) extraSpace / panels;
|
_pingStatsWidth += (int) extraSpace / panels;
|
||||||
}
|
}
|
||||||
_geoStatsWidth += (int) extraSpace / panels;
|
_geoStatsWidth += (int) extraSpace / panels;
|
||||||
_voxelStatsWidth += glWidget->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
|
_voxelStatsWidth += glCanvas->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ void Stats::display(
|
||||||
int bytesPerSecond,
|
int bytesPerSecond,
|
||||||
int voxelPacketsToProcess)
|
int voxelPacketsToProcess)
|
||||||
{
|
{
|
||||||
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
|
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
unsigned int backgroundColor = 0x33333399;
|
unsigned int backgroundColor = 0x33333399;
|
||||||
int verticalOffset = 0, lines = 0;
|
int verticalOffset = 0, lines = 0;
|
||||||
|
@ -210,7 +210,7 @@ void Stats::display(
|
||||||
std::stringstream voxelStats;
|
std::stringstream voxelStats;
|
||||||
|
|
||||||
if (_lastHorizontalOffset != horizontalOffset) {
|
if (_lastHorizontalOffset != horizontalOffset) {
|
||||||
resetWidth(glWidget->width(), horizontalOffset);
|
resetWidth(glCanvas->width(), horizontalOffset);
|
||||||
_lastHorizontalOffset = horizontalOffset;
|
_lastHorizontalOffset = horizontalOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ void Stats::display(
|
||||||
|
|
||||||
lines = _expanded ? 14 : 3;
|
lines = _expanded ? 14 : 3;
|
||||||
|
|
||||||
drawBackground(backgroundColor, horizontalOffset, 0, glWidget->width() - horizontalOffset,
|
drawBackground(backgroundColor, horizontalOffset, 0, glCanvas->width() - horizontalOffset,
|
||||||
lines * STATS_PELS_PER_LINE + 10);
|
lines * STATS_PELS_PER_LINE + 10);
|
||||||
horizontalOffset += 5;
|
horizontalOffset += 5;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
#include "ToolWindow.h"
|
#include "ToolWindow.h"
|
||||||
#include "UIUtil.h"
|
#include "UIUtil.h"
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,10 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <InterfaceConfig.h>
|
|
||||||
|
|
||||||
#include "Application.h" // HACK ATTACK WARNING: for windows build to work, we need this ahead of QtGui
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "ui_updateDialog.h"
|
#include "ui_updateDialog.h"
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "UpdateDialog.h"
|
#include "UpdateDialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include "VoxelImportDialog.h"
|
#include "VoxelImportDialog.h"
|
||||||
|
@ -64,7 +66,7 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QIcon(Application::resourcesPath() + "icons/" + typeString + ".svg");
|
return QIcon(PathUtils::resourcesPath() + "icons/" + typeString + ".svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
|
QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
|
||||||
|
@ -72,21 +74,21 @@ QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
|
||||||
|
|
||||||
if (info.isDir()) {
|
if (info.isDir()) {
|
||||||
if (info.absoluteFilePath() == QDir::homePath()) {
|
if (info.absoluteFilePath() == QDir::homePath()) {
|
||||||
return QIcon(Application::resourcesPath() + "icons/home.svg");
|
return QIcon(PathUtils::resourcesPath() + "icons/home.svg");
|
||||||
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) {
|
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) {
|
||||||
return QIcon(Application::resourcesPath() + "icons/desktop.svg");
|
return QIcon(PathUtils::resourcesPath() + "icons/desktop.svg");
|
||||||
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) {
|
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) {
|
||||||
return QIcon(Application::resourcesPath() + "icons/documents.svg");
|
return QIcon(PathUtils::resourcesPath() + "icons/documents.svg");
|
||||||
}
|
}
|
||||||
return QIcon(Application::resourcesPath() + "icons/folder.svg");
|
return QIcon(PathUtils::resourcesPath() + "icons/folder.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo iconFile(Application::resourcesPath() + "icons/" + iconsMap[ext]);
|
QFileInfo iconFile(PathUtils::resourcesPath() + "icons/" + iconsMap[ext]);
|
||||||
if (iconFile.exists() && iconFile.isFile()) {
|
if (iconFile.exists() && iconFile.isFile()) {
|
||||||
return QIcon(iconFile.filePath());
|
return QIcon(iconFile.filePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
return QIcon(Application::resourcesPath() + "icons/file.svg");
|
return QIcon(PathUtils::resourcesPath() + "icons/file.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HiFiIconProvider::type(const QFileInfo &info) const {
|
QString HiFiIconProvider::type(const QFileInfo &info) const {
|
||||||
|
@ -307,16 +309,16 @@ void VoxelImportDialog::setLayout() {
|
||||||
widget = findChild<QWidget*>("treeView");
|
widget = findChild<QWidget*>("treeView");
|
||||||
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
|
||||||
QFile styleSheet(Application::resourcesPath() + "styles/import_dialog.qss");
|
QFile styleSheet(PathUtils::resourcesPath() + "styles/import_dialog.qss");
|
||||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||||
QDir::setCurrent(Application::resourcesPath());
|
QDir::setCurrent(PathUtils::resourcesPath());
|
||||||
setStyleSheet(styleSheet.readAll());
|
setStyleSheet(styleSheet.readAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelImportDialog::setImportTypes() {
|
void VoxelImportDialog::setImportTypes() {
|
||||||
QFile config(Application::resourcesPath() + "config/config.json");
|
QFile config(PathUtils::resourcesPath() + "config/config.json");
|
||||||
config.open(QFile::ReadOnly | QFile::Text);
|
config.open(QFile::ReadOnly | QFile::Text);
|
||||||
QJsonDocument document = QJsonDocument::fromJson(config.readAll());
|
QJsonDocument document = QJsonDocument::fromJson(config.readAll());
|
||||||
if (!document.isNull() && !document.isEmpty()) {
|
if (!document.isNull() && !document.isEmpty()) {
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include <TextureCache.h>
|
||||||
|
|
||||||
#include "Base3DOverlay.h"
|
#include "Base3DOverlay.h"
|
||||||
#include "renderer/TextureCache.h"
|
|
||||||
|
|
||||||
class BillboardOverlay : public Base3DOverlay {
|
class BillboardOverlay : public Base3DOverlay {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <StreamUtils.h>
|
#include <StreamUtils.h>
|
||||||
|
|
||||||
#include "Circle3DOverlay.h"
|
#include "Circle3DOverlay.h"
|
||||||
#include "renderer/GlowEffect.h"
|
|
||||||
|
|
||||||
Circle3DOverlay::Circle3DOverlay() :
|
Circle3DOverlay::Circle3DOverlay() :
|
||||||
_startAt(0.0f),
|
_startAt(0.0f),
|
||||||
|
|
|
@ -12,12 +12,14 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <StreamUtils.h>
|
#include <StreamUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Cube3DOverlay.h"
|
#include "Cube3DOverlay.h"
|
||||||
#include "renderer/GlowEffect.h"
|
|
||||||
|
|
||||||
Cube3DOverlay::Cube3DOverlay() : _borderSize(0) {
|
Cube3DOverlay::Cube3DOverlay() : _borderSize(0) {
|
||||||
}
|
}
|
||||||
|
@ -74,7 +76,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||||
glScalef(dimensions.x * _borderSize, dimensions.y * _borderSize, dimensions.z * _borderSize);
|
glScalef(dimensions.x * _borderSize, dimensions.y * _borderSize, dimensions.z * _borderSize);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +84,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
} else {
|
} else {
|
||||||
glLineWidth(_lineWidth);
|
glLineWidth(_lineWidth);
|
||||||
|
@ -116,7 +118,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Grid3DOverlay.h"
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "Grid3DOverlay.h"
|
||||||
|
|
||||||
ProgramObject Grid3DOverlay::_gridProgram;
|
ProgramObject Grid3DOverlay::_gridProgram;
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ void Grid3DOverlay::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_gridProgram.isLinked()) {
|
if (!_gridProgram.isLinked()) {
|
||||||
if (!_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag")) {
|
if (!_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/grid.frag")) {
|
||||||
qDebug() << "Failed to compile: " + _gridProgram.log();
|
qDebug() << "Failed to compile: " + _gridProgram.log();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
#include <ProgramObject.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Base3DOverlay.h"
|
#include "Base3DOverlay.h"
|
||||||
|
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
|
|
||||||
class Grid3DOverlay : public Base3DOverlay {
|
class Grid3DOverlay : public Base3DOverlay {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
// include this before QGLWidget, which includes an earlier version of OpenGL
|
// include this before QGLWidget, which includes an earlier version of OpenGL
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
|
|
||||||
#include "Line3DOverlay.h"
|
#include "Line3DOverlay.h"
|
||||||
#include "renderer/GlowEffect.h"
|
|
||||||
|
|
||||||
|
|
||||||
Line3DOverlay::Line3DOverlay() {
|
Line3DOverlay::Line3DOverlay() {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include "LocalModelsOverlay.h"
|
#include "LocalModelsOverlay.h"
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#ifndef hifi_LocalModelsOverlay_h
|
#ifndef hifi_LocalModelsOverlay_h
|
||||||
#define hifi_LocalModelsOverlay_h
|
#define hifi_LocalModelsOverlay_h
|
||||||
|
|
||||||
#include "entities/EntityTreeRenderer.h"
|
|
||||||
|
|
||||||
#include "Volume3DOverlay.h"
|
#include "Volume3DOverlay.h"
|
||||||
|
|
||||||
|
class EntityTreeRenderer;
|
||||||
|
|
||||||
class LocalModelsOverlay : public Volume3DOverlay {
|
class LocalModelsOverlay : public Volume3DOverlay {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QScriptValue>
|
#include <QScriptValue>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <GlowEffect.h>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "LocalVoxelsOverlay.h"
|
#include "LocalVoxelsOverlay.h"
|
||||||
#include "voxels/VoxelSystem.h"
|
#include "voxels/VoxelSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
|
|
||||||
#include "../../Menu.h"
|
#include "../../Menu.h"
|
||||||
|
|
||||||
#include "ModelOverlay.h"
|
#include "ModelOverlay.h"
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
#ifndef hifi_ModelOverlay_h
|
#ifndef hifi_ModelOverlay_h
|
||||||
#define hifi_ModelOverlay_h
|
#define hifi_ModelOverlay_h
|
||||||
|
|
||||||
#include "Base3DOverlay.h"
|
#include <Model.h>
|
||||||
|
|
||||||
#include "../../renderer/Model.h"
|
#include "Base3DOverlay.h"
|
||||||
|
|
||||||
class ModelOverlay : public Base3DOverlay {
|
class ModelOverlay : public Base3DOverlay {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Rectangle3DOverlay.h"
|
#include "Rectangle3DOverlay.h"
|
||||||
#include "renderer/GlowEffect.h"
|
|
||||||
|
|
||||||
Rectangle3DOverlay::Rectangle3DOverlay() {
|
Rectangle3DOverlay::Rectangle3DOverlay() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,12 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Sphere3DOverlay.h"
|
#include "Sphere3DOverlay.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "renderer/GlowEffect.h"
|
|
||||||
|
|
||||||
Sphere3DOverlay::Sphere3DOverlay() {
|
Sphere3DOverlay::Sphere3DOverlay() {
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,6 @@ void Sphere3DOverlay::render(RenderArgs* args) {
|
||||||
glm::vec3 positionToCenter = center - position;
|
glm::vec3 positionToCenter = center - position;
|
||||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
//Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
|
||||||
if (_isSolid) {
|
if (_isSolid) {
|
||||||
DependencyManager::get<GeometryCache>()->renderSphere(1.0f, SLICES, SLICES);
|
DependencyManager::get<GeometryCache>()->renderSphere(1.0f, SLICES, SLICES);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
// include this before QGLWidget, which includes an earlier version of OpenGL
|
// include this before QGLWidget, which includes an earlier version of OpenGL
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
|
#include <TextRenderer.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Text3DOverlay.h"
|
#include "Text3DOverlay.h"
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
|
|
||||||
const xColor DEFAULT_BACKGROUND_COLOR = { 0, 0, 0 };
|
const xColor DEFAULT_BACKGROUND_COLOR = { 0, 0, 0 };
|
||||||
const float DEFAULT_BACKGROUND_ALPHA = 0.7f;
|
const float DEFAULT_BACKGROUND_ALPHA = 0.7f;
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
#include <TextRenderer.h>
|
||||||
|
|
||||||
#include "TextOverlay.h"
|
#include "TextOverlay.h"
|
||||||
#include "ui/TextRenderer.h"
|
|
||||||
|
|
||||||
TextOverlay::TextOverlay() :
|
TextOverlay::TextOverlay() :
|
||||||
_backgroundColor(DEFAULT_BACKGROUND_COLOR),
|
_backgroundColor(DEFAULT_BACKGROUND_COLOR),
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
|
#include <GlowEffect.h>
|
||||||
#include <VoxelConstants.h>
|
#include <VoxelConstants.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -36,7 +37,7 @@ VoxelFade::VoxelFade(FadeDirection direction, float red, float green, float blue
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelFade::render() {
|
void VoxelFade::render() {
|
||||||
Application::getInstance()->getGlowEffect()->begin();
|
DependencyManager::get<GlowEffect>()->begin();
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -52,7 +53,7 @@ void VoxelFade::render() {
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
|
|
||||||
Application::getInstance()->getGlowEffect()->end();
|
DependencyManager::get<GlowEffect>()->end();
|
||||||
|
|
||||||
opacity *= (direction == FADE_OUT) ? FADE_OUT_STEP : FADE_IN_STEP;
|
opacity *= (direction == FADE_OUT) ? FADE_OUT_STEP : FADE_IN_STEP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,18 +14,20 @@
|
||||||
#include <iostream> // to load voxels from file
|
#include <iostream> // to load voxels from file
|
||||||
#include <fstream> // to load voxels from file
|
#include <fstream> // to load voxels from file
|
||||||
|
|
||||||
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
#include <OctalCode.h>
|
#include <OctalCode.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
#include <ProgramObject.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "InterfaceConfig.h"
|
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "renderer/ProgramObject.h"
|
|
||||||
#include "VoxelConstants.h"
|
#include "VoxelConstants.h"
|
||||||
#include "VoxelSystem.h"
|
#include "VoxelSystem.h"
|
||||||
|
|
||||||
|
@ -371,9 +373,9 @@ void VoxelSystem::initVoxelMemory() {
|
||||||
// create our simple fragment shader if we're the first system to init
|
// create our simple fragment shader if we're the first system to init
|
||||||
if (!_program.isLinked()) {
|
if (!_program.isLinked()) {
|
||||||
_program.addShaderFromSourceFile(QGLShader::Vertex,
|
_program.addShaderFromSourceFile(QGLShader::Vertex,
|
||||||
Application::resourcesPath() + "shaders/voxel.vert");
|
PathUtils::resourcesPath() + "shaders/voxel.vert");
|
||||||
_program.addShaderFromSourceFile(QGLShader::Fragment,
|
_program.addShaderFromSourceFile(QGLShader::Fragment,
|
||||||
Application::resourcesPath() + "shaders/voxel.frag");
|
PathUtils::resourcesPath() + "shaders/voxel.frag");
|
||||||
_program.link();
|
_program.link();
|
||||||
}
|
}
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
@ -1644,9 +1646,9 @@ unsigned long VoxelSystem::getVoxelMemoryUsageGPU() {
|
||||||
void VoxelSystem::bindPerlinModulateProgram() {
|
void VoxelSystem::bindPerlinModulateProgram() {
|
||||||
if (!_perlinModulateProgram.isLinked()) {
|
if (!_perlinModulateProgram.isLinked()) {
|
||||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||||
Application::resourcesPath() + "shaders/perlin_modulate.vert");
|
PathUtils::resourcesPath() + "shaders/perlin_modulate.vert");
|
||||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||||
Application::resourcesPath() + "shaders/perlin_modulate.frag");
|
PathUtils::resourcesPath() + "shaders/perlin_modulate.frag");
|
||||||
_perlinModulateProgram.link();
|
_perlinModulateProgram.link();
|
||||||
|
|
||||||
_perlinModulateProgram.bind();
|
_perlinModulateProgram.bind();
|
||||||
|
|
|
@ -15,30 +15,31 @@
|
||||||
#include <QScriptEngine>
|
#include <QScriptEngine>
|
||||||
#include <QScriptValue>
|
#include <QScriptValue>
|
||||||
|
|
||||||
#include <ResourceCache.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
#include <FBXReader.h>
|
#include <FBXReader.h>
|
||||||
|
#include <ResourceCache.h>
|
||||||
|
|
||||||
class Animation;
|
class Animation;
|
||||||
|
|
||||||
typedef QSharedPointer<Animation> AnimationPointer;
|
typedef QSharedPointer<Animation> AnimationPointer;
|
||||||
|
|
||||||
/// Scriptable interface for FBX animation loading.
|
/// Scriptable interface for FBX animation loading.
|
||||||
class AnimationCache : public ResourceCache {
|
class AnimationCache : public ResourceCache {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
SINGLETON_DEPENDENCY(AnimationCache)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AnimationCache(QObject* parent = NULL);
|
|
||||||
|
|
||||||
Q_INVOKABLE AnimationPointer getAnimation(const QString& url) { return getAnimation(QUrl(url)); }
|
Q_INVOKABLE AnimationPointer getAnimation(const QString& url) { return getAnimation(QUrl(url)); }
|
||||||
|
|
||||||
Q_INVOKABLE AnimationPointer getAnimation(const QUrl& url);
|
Q_INVOKABLE AnimationPointer getAnimation(const QUrl& url);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual QSharedPointer<Resource> createResource(const QUrl& url,
|
virtual QSharedPointer<Resource> createResource(const QUrl& url,
|
||||||
const QSharedPointer<Resource>& fallback, bool delayLoad, const void* extra);
|
const QSharedPointer<Resource>& fallback, bool delayLoad, const void* extra);
|
||||||
|
private:
|
||||||
|
AnimationCache(QObject* parent = NULL);
|
||||||
|
virtual ~AnimationCache() { }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(AnimationPointer)
|
Q_DECLARE_METATYPE(AnimationPointer)
|
||||||
|
|
37
libraries/entities-renderer/CMakeLists.txt
Normal file
37
libraries/entities-renderer/CMakeLists.txt
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
set(TARGET_NAME entities-renderer)
|
||||||
|
|
||||||
|
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||||
|
setup_hifi_library(Widgets OpenGL Network Script)
|
||||||
|
|
||||||
|
include_glm()
|
||||||
|
|
||||||
|
link_hifi_libraries(shared gpu)
|
||||||
|
if (APPLE)
|
||||||
|
# link in required OS X frameworks and include the right GL headers
|
||||||
|
find_library(OpenGL OpenGL)
|
||||||
|
|
||||||
|
#target_link_libraries(${TARGET_NAME} ${OpenGL})
|
||||||
|
|
||||||
|
else (APPLE)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
if (${OPENGL_INCLUDE_DIR})
|
||||||
|
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# link target to external libraries
|
||||||
|
if (WIN32)
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
include_directories(${GLEW_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
find_package(GLUT REQUIRED)
|
||||||
|
include_directories(SYSTEM "${GLUT_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
# we're using static GLEW, so define GLEW_STATIC
|
||||||
|
add_definitions(-DGLEW_STATIC)
|
||||||
|
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
endif (APPLE)
|
||||||
|
|
||||||
|
# call macro to link our dependencies and bubble them up via a property on our target
|
||||||
|
link_shared_dependencies()
|
|
@ -9,27 +9,24 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
|
#include <QEventLoop>
|
||||||
#include <QScriptSyntaxCheckResult>
|
#include <QScriptSyntaxCheckResult>
|
||||||
|
|
||||||
#include <FBXReader.h>
|
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include <AbstractScriptingServicesInterface.h>
|
||||||
|
#include <AbstractViewStateInterface.h>
|
||||||
#include <BoxEntityItem.h>
|
#include <DeferredLightingEffect.h>
|
||||||
#include <ModelEntityItem.h>
|
#include <GlowEffect.h>
|
||||||
#include <MouseEvent.h>
|
#include <Model.h>
|
||||||
|
#include <NetworkAccessManager.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <RenderArgs.h>
|
#include <ScriptEngine.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Menu.h"
|
|
||||||
#include "NetworkAccessManager.h"
|
|
||||||
#include "EntityTreeRenderer.h"
|
#include "EntityTreeRenderer.h"
|
||||||
|
|
||||||
#include "devices/OculusManager.h"
|
|
||||||
|
|
||||||
#include "RenderableBoxEntityItem.h"
|
#include "RenderableBoxEntityItem.h"
|
||||||
#include "RenderableLightEntityItem.h"
|
#include "RenderableLightEntityItem.h"
|
||||||
#include "RenderableModelEntityItem.h"
|
#include "RenderableModelEntityItem.h"
|
||||||
|
@ -37,17 +34,18 @@
|
||||||
#include "RenderableTextEntityItem.h"
|
#include "RenderableTextEntityItem.h"
|
||||||
|
|
||||||
|
|
||||||
QThread* EntityTreeRenderer::getMainThread() {
|
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState,
|
||||||
return Application::getInstance()->getEntities()->thread();
|
AbstractScriptingServicesInterface* scriptingServices) :
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts) :
|
|
||||||
OctreeRenderer(),
|
OctreeRenderer(),
|
||||||
_wantScripts(wantScripts),
|
_wantScripts(wantScripts),
|
||||||
_entitiesScriptEngine(NULL),
|
_entitiesScriptEngine(NULL),
|
||||||
_lastMouseEventValid(false)
|
_lastMouseEventValid(false),
|
||||||
|
_viewState(viewState),
|
||||||
|
_scriptingServices(scriptingServices),
|
||||||
|
_displayElementChildProxies(false),
|
||||||
|
_displayModelBounds(false),
|
||||||
|
_displayModelElementProxy(false),
|
||||||
|
_dontDoPrecisionPicking(false)
|
||||||
{
|
{
|
||||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Model, RenderableModelEntityItem::factory)
|
REGISTER_ENTITY_TYPE_WITH_FACTORY(Model, RenderableModelEntityItem::factory)
|
||||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Box, RenderableBoxEntityItem::factory)
|
REGISTER_ENTITY_TYPE_WITH_FACTORY(Box, RenderableBoxEntityItem::factory)
|
||||||
|
@ -77,14 +75,14 @@ void EntityTreeRenderer::init() {
|
||||||
entityTree->setFBXService(this);
|
entityTree->setFBXService(this);
|
||||||
|
|
||||||
if (_wantScripts) {
|
if (_wantScripts) {
|
||||||
_entitiesScriptEngine = new ScriptEngine(NO_SCRIPT, "Entities",
|
_entitiesScriptEngine = new ScriptEngine(NO_SCRIPT, "Entities",
|
||||||
Application::getInstance()->getControllerScriptingInterface());
|
_scriptingServices->getControllerScriptingInterface());
|
||||||
Application::getInstance()->registerScriptEngineWithApplicationServices(_entitiesScriptEngine);
|
_scriptingServices->registerScriptEngineWithApplicationServices(_entitiesScriptEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure our "last avatar position" is something other than our current position, so that on our
|
// make sure our "last avatar position" is something other than our current position, so that on our
|
||||||
// first chance, we'll check for enter/leave entity events.
|
// first chance, we'll check for enter/leave entity events.
|
||||||
glm::vec3 avatarPosition = Application::getInstance()->getAvatar()->getPosition();
|
glm::vec3 avatarPosition = _viewState->getAvatarPosition();
|
||||||
_lastAvatarPosition = avatarPosition + glm::vec3(1.0f, 1.0f, 1.0f);
|
_lastAvatarPosition = avatarPosition + glm::vec3(1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
connect(entityTree, &EntityTree::deletingEntity, this, &EntityTreeRenderer::deletingEntity);
|
connect(entityTree, &EntityTree::deletingEntity, this, &EntityTreeRenderer::deletingEntity);
|
||||||
|
@ -241,7 +239,7 @@ void EntityTreeRenderer::update() {
|
||||||
void EntityTreeRenderer::checkEnterLeaveEntities() {
|
void EntityTreeRenderer::checkEnterLeaveEntities() {
|
||||||
if (_tree) {
|
if (_tree) {
|
||||||
_tree->lockForWrite(); // so that our scripts can do edits if they want
|
_tree->lockForWrite(); // so that our scripts can do edits if they want
|
||||||
glm::vec3 avatarPosition = Application::getInstance()->getAvatar()->getPosition() / (float) TREE_SCALE;
|
glm::vec3 avatarPosition = _viewState->getAvatarPosition() / (float) TREE_SCALE;
|
||||||
|
|
||||||
if (avatarPosition != _lastAvatarPosition) {
|
if (avatarPosition != _lastAvatarPosition) {
|
||||||
float radius = 1.0f / (float) TREE_SCALE; // for now, assume 1 meter radius
|
float radius = 1.0f / (float) TREE_SCALE; // for now, assume 1 meter radius
|
||||||
|
@ -290,44 +288,38 @@ void EntityTreeRenderer::checkEnterLeaveEntities() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
||||||
bool dontRenderAsScene = Menu::getInstance()->isOptionChecked(MenuOption::DontRenderEntitiesAsScene);
|
if (_tree) {
|
||||||
|
Model::startScene(renderSide);
|
||||||
|
RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
_tree->lockForRead();
|
||||||
|
_tree->recurseTreeWithOperation(renderOperation, &args);
|
||||||
|
|
||||||
|
Model::RenderMode modelRenderMode = renderMode == RenderArgs::SHADOW_RENDER_MODE
|
||||||
|
? Model::SHADOW_RENDER_MODE : Model::DEFAULT_RENDER_MODE;
|
||||||
|
|
||||||
|
// we must call endScene while we still have the tree locked so that no one deletes a model
|
||||||
|
// on us while rendering the scene
|
||||||
|
Model::endScene(modelRenderMode, &args);
|
||||||
|
_tree->unlock();
|
||||||
|
|
||||||
if (dontRenderAsScene) {
|
// stats...
|
||||||
OctreeRenderer::render(renderMode, renderSide);
|
_meshesConsidered = args._meshesConsidered;
|
||||||
} else {
|
_meshesRendered = args._meshesRendered;
|
||||||
if (_tree) {
|
_meshesOutOfView = args._meshesOutOfView;
|
||||||
Model::startScene(renderSide);
|
_meshesTooSmall = args._meshesTooSmall;
|
||||||
RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
_tree->lockForRead();
|
|
||||||
_tree->recurseTreeWithOperation(renderOperation, &args);
|
|
||||||
|
|
||||||
Model::RenderMode modelRenderMode = renderMode == RenderArgs::SHADOW_RENDER_MODE
|
_elementsTouched = args._elementsTouched;
|
||||||
? Model::SHADOW_RENDER_MODE : Model::DEFAULT_RENDER_MODE;
|
_itemsRendered = args._itemsRendered;
|
||||||
|
_itemsOutOfView = args._itemsOutOfView;
|
||||||
|
_itemsTooSmall = args._itemsTooSmall;
|
||||||
|
|
||||||
// we must call endScene while we still have the tree locked so that no one deletes a model
|
_materialSwitches = args._materialSwitches;
|
||||||
// on us while rendering the scene
|
_trianglesRendered = args._trianglesRendered;
|
||||||
Model::endScene(modelRenderMode, &args);
|
_quadsRendered = args._quadsRendered;
|
||||||
_tree->unlock();
|
|
||||||
|
|
||||||
// stats...
|
|
||||||
_meshesConsidered = args._meshesConsidered;
|
|
||||||
_meshesRendered = args._meshesRendered;
|
|
||||||
_meshesOutOfView = args._meshesOutOfView;
|
|
||||||
_meshesTooSmall = args._meshesTooSmall;
|
|
||||||
|
|
||||||
_elementsTouched = args._elementsTouched;
|
_translucentMeshPartsRendered = args._translucentMeshPartsRendered;
|
||||||
_itemsRendered = args._itemsRendered;
|
_opaqueMeshPartsRendered = args._opaqueMeshPartsRendered;
|
||||||
_itemsOutOfView = args._itemsOutOfView;
|
|
||||||
_itemsTooSmall = args._itemsTooSmall;
|
|
||||||
|
|
||||||
_materialSwitches = args._materialSwitches;
|
|
||||||
_trianglesRendered = args._trianglesRendered;
|
|
||||||
_quadsRendered = args._quadsRendered;
|
|
||||||
|
|
||||||
_translucentMeshPartsRendered = args._translucentMeshPartsRendered;
|
|
||||||
_opaqueMeshPartsRendered = args._opaqueMeshPartsRendered;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
deleteReleasedModels(); // seems like as good as any other place to do some memory cleanup
|
deleteReleasedModels(); // seems like as good as any other place to do some memory cleanup
|
||||||
}
|
}
|
||||||
|
@ -359,75 +351,72 @@ const Model* EntityTreeRenderer::getModelForEntityItem(const EntityItem* entityI
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderElementProxy(EntityTreeElement* entityTreeElement) {
|
void EntityTreeRenderer::renderElementProxy(EntityTreeElement* entityTreeElement) {
|
||||||
glm::vec3 elementCenter = entityTreeElement->getAACube().calcCenter() * (float) TREE_SCALE;
|
glm::vec3 elementCenter = entityTreeElement->getAACube().calcCenter() * (float) TREE_SCALE;
|
||||||
float elementSize = entityTreeElement->getScale() * (float) TREE_SCALE;
|
float elementSize = entityTreeElement->getScale() * (float) TREE_SCALE;
|
||||||
glColor3f(1.0f, 0.0f, 0.0f);
|
glColor3f(1.0f, 0.0f, 0.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x, elementCenter.y, elementCenter.z);
|
glTranslatef(elementCenter.x, elementCenter.y, elementCenter.z);
|
||||||
glutWireCube(elementSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(elementSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
bool displayElementChildProxies = Menu::getInstance()->isOptionChecked(MenuOption::DisplayModelElementChildProxies);
|
if (_displayElementChildProxies) {
|
||||||
|
|
||||||
if (displayElementChildProxies) {
|
|
||||||
// draw the children
|
// draw the children
|
||||||
float halfSize = elementSize / 2.0f;
|
float halfSize = elementSize / 2.0f;
|
||||||
float quarterSize = elementSize / 4.0f;
|
float quarterSize = elementSize / 4.0f;
|
||||||
glColor3f(1.0f, 1.0f, 0.0f);
|
glColor3f(1.0f, 1.0f, 0.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x - quarterSize, elementCenter.y - quarterSize, elementCenter.z - quarterSize);
|
glTranslatef(elementCenter.x - quarterSize, elementCenter.y - quarterSize, elementCenter.z - quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(1.0f, 0.0f, 1.0f);
|
glColor3f(1.0f, 0.0f, 1.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x + quarterSize, elementCenter.y - quarterSize, elementCenter.z - quarterSize);
|
glTranslatef(elementCenter.x + quarterSize, elementCenter.y - quarterSize, elementCenter.z - quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(0.0f, 1.0f, 0.0f);
|
glColor3f(0.0f, 1.0f, 0.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x - quarterSize, elementCenter.y + quarterSize, elementCenter.z - quarterSize);
|
glTranslatef(elementCenter.x - quarterSize, elementCenter.y + quarterSize, elementCenter.z - quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(0.0f, 0.0f, 1.0f);
|
glColor3f(0.0f, 0.0f, 1.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x - quarterSize, elementCenter.y - quarterSize, elementCenter.z + quarterSize);
|
glTranslatef(elementCenter.x - quarterSize, elementCenter.y - quarterSize, elementCenter.z + quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x + quarterSize, elementCenter.y + quarterSize, elementCenter.z + quarterSize);
|
glTranslatef(elementCenter.x + quarterSize, elementCenter.y + quarterSize, elementCenter.z + quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(0.0f, 0.5f, 0.5f);
|
glColor3f(0.0f, 0.5f, 0.5f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x - quarterSize, elementCenter.y + quarterSize, elementCenter.z + quarterSize);
|
glTranslatef(elementCenter.x - quarterSize, elementCenter.y + quarterSize, elementCenter.z + quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(0.5f, 0.0f, 0.0f);
|
glColor3f(0.5f, 0.0f, 0.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x + quarterSize, elementCenter.y - quarterSize, elementCenter.z + quarterSize);
|
glTranslatef(elementCenter.x + quarterSize, elementCenter.y - quarterSize, elementCenter.z + quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glColor3f(0.0f, 0.5f, 0.0f);
|
glColor3f(0.0f, 0.5f, 0.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(elementCenter.x + quarterSize, elementCenter.y + quarterSize, elementCenter.z - quarterSize);
|
glTranslatef(elementCenter.x + quarterSize, elementCenter.y + quarterSize, elementCenter.z - quarterSize);
|
||||||
glutWireCube(halfSize);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(halfSize);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::renderProxies(const EntityItem* entity, RenderArgs* args) {
|
void EntityTreeRenderer::renderProxies(const EntityItem* entity, RenderArgs* args) {
|
||||||
bool isShadowMode = args->_renderMode == RenderArgs::SHADOW_RENDER_MODE;
|
bool isShadowMode = args->_renderMode == RenderArgs::SHADOW_RENDER_MODE;
|
||||||
bool displayModelBounds = Menu::getInstance()->isOptionChecked(MenuOption::DisplayModelBounds);
|
if (!isShadowMode && _displayModelBounds) {
|
||||||
if (!isShadowMode && displayModelBounds) {
|
|
||||||
PerformanceTimer perfTimer("renderProxies");
|
PerformanceTimer perfTimer("renderProxies");
|
||||||
|
|
||||||
AACube maxCube = entity->getMaximumAACube();
|
AACube maxCube = entity->getMaximumAACube();
|
||||||
|
@ -447,14 +436,14 @@ void EntityTreeRenderer::renderProxies(const EntityItem* entity, RenderArgs* arg
|
||||||
glColor4f(1.0f, 1.0f, 0.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 0.0f, 1.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(maxCenter.x, maxCenter.y, maxCenter.z);
|
glTranslatef(maxCenter.x, maxCenter.y, maxCenter.z);
|
||||||
glutWireCube(maxCube.getScale());
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(maxCube.getScale());
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// draw the min bounding cube
|
// draw the min bounding cube
|
||||||
glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
|
glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(minCenter.x, minCenter.y, minCenter.z);
|
glTranslatef(minCenter.x, minCenter.y, minCenter.z);
|
||||||
glutWireCube(minCube.getScale());
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(minCube.getScale());
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// draw the entityBox bounding box
|
// draw the entityBox bounding box
|
||||||
|
@ -462,7 +451,7 @@ void EntityTreeRenderer::renderProxies(const EntityItem* entity, RenderArgs* arg
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(entityBoxCenter.x, entityBoxCenter.y, entityBoxCenter.z);
|
glTranslatef(entityBoxCenter.x, entityBoxCenter.y, entityBoxCenter.z);
|
||||||
glScalef(entityBoxScale.x, entityBoxScale.y, entityBoxScale.z);
|
glScalef(entityBoxScale.x, entityBoxScale.y, entityBoxScale.z);
|
||||||
glutWireCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
|
||||||
|
@ -480,15 +469,13 @@ void EntityTreeRenderer::renderProxies(const EntityItem* entity, RenderArgs* arg
|
||||||
glm::vec3 positionToCenter = center - position;
|
glm::vec3 positionToCenter = center - position;
|
||||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
glutWireCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args) {
|
void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args) {
|
||||||
bool wantDebug = false;
|
|
||||||
|
|
||||||
args->_elementsTouched++;
|
args->_elementsTouched++;
|
||||||
// actually render it here...
|
// actually render it here...
|
||||||
// we need to iterate the actual entityItems of the element
|
// we need to iterate the actual entityItems of the element
|
||||||
|
@ -500,11 +487,8 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
|
||||||
uint16_t numberOfEntities = entityItems.size();
|
uint16_t numberOfEntities = entityItems.size();
|
||||||
|
|
||||||
bool isShadowMode = args->_renderMode == RenderArgs::SHADOW_RENDER_MODE;
|
bool isShadowMode = args->_renderMode == RenderArgs::SHADOW_RENDER_MODE;
|
||||||
bool displayElementProxy = Menu::getInstance()->isOptionChecked(MenuOption::DisplayModelElementProxy);
|
|
||||||
|
|
||||||
|
if (!isShadowMode && _displayModelElementProxy && numberOfEntities > 0) {
|
||||||
|
|
||||||
if (!isShadowMode && displayElementProxy && numberOfEntities > 0) {
|
|
||||||
renderElementProxy(entityTreeElement);
|
renderElementProxy(entityTreeElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,23 +505,9 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
|
||||||
// when they are outside of the view frustum...
|
// when they are outside of the view frustum...
|
||||||
float distance = args->_viewFrustum->distanceToCamera(entityBox.calcCenter());
|
float distance = args->_viewFrustum->distanceToCamera(entityBox.calcCenter());
|
||||||
|
|
||||||
if (wantDebug) {
|
|
||||||
qDebug() << "------- renderElement() ----------";
|
|
||||||
qDebug() << " type:" << EntityTypes::getEntityTypeName(entityItem->getType());
|
|
||||||
if (entityItem->getType() == EntityTypes::Model) {
|
|
||||||
ModelEntityItem* modelEntity = static_cast<ModelEntityItem*>(entityItem);
|
|
||||||
qDebug() << " url:" << modelEntity->getModelURL();
|
|
||||||
}
|
|
||||||
qDebug() << " entityBox:" << entityItem->getAABox();
|
|
||||||
qDebug() << " dimensions:" << entityItem->getDimensionsInMeters() << "in meters";
|
|
||||||
qDebug() << " largestDimension:" << entityBox.getLargestDimension() << "in meters";
|
|
||||||
qDebug() << " shouldRender:" << Menu::getInstance()->shouldRenderMesh(entityBox.getLargestDimension(), distance);
|
|
||||||
qDebug() << " in frustum:" << (args->_viewFrustum->boxInFrustum(entityBox) != ViewFrustum::OUTSIDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool outOfView = args->_viewFrustum->boxInFrustum(entityBox) == ViewFrustum::OUTSIDE;
|
bool outOfView = args->_viewFrustum->boxInFrustum(entityBox) == ViewFrustum::OUTSIDE;
|
||||||
if (!outOfView) {
|
if (!outOfView) {
|
||||||
bool bigEnoughToRender = Menu::getInstance()->shouldRenderMesh(entityBox.getLargestDimension(), distance);
|
bool bigEnoughToRender = _viewState->shouldRenderMesh(entityBox.getLargestDimension(), distance);
|
||||||
|
|
||||||
if (bigEnoughToRender) {
|
if (bigEnoughToRender) {
|
||||||
renderProxies(entityItem, args);
|
renderProxies(entityItem, args);
|
||||||
|
@ -562,11 +532,11 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
float EntityTreeRenderer::getSizeScale() const {
|
float EntityTreeRenderer::getSizeScale() const {
|
||||||
return Menu::getInstance()->getVoxelSizeScale();
|
return _viewState->getSizeScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EntityTreeRenderer::getBoundaryLevelAdjust() const {
|
int EntityTreeRenderer::getBoundaryLevelAdjust() const {
|
||||||
return Menu::getInstance()->getBoundaryLevelAdjust();
|
return _viewState->getBoundaryLevelAdjust();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -641,11 +611,6 @@ void EntityTreeRenderer::deleteReleasedModels() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PickRay EntityTreeRenderer::computePickRay(float x, float y) {
|
|
||||||
return Application::getInstance()->getCamera()->computePickRay(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RayToEntityIntersectionResult EntityTreeRenderer::findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType,
|
RayToEntityIntersectionResult EntityTreeRenderer::findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType,
|
||||||
bool precisionPicking) {
|
bool precisionPicking) {
|
||||||
RayToEntityIntersectionResult result;
|
RayToEntityIntersectionResult result;
|
||||||
|
@ -707,9 +672,9 @@ QScriptValueList EntityTreeRenderer::createEntityArgs(const EntityItemID& entity
|
||||||
|
|
||||||
void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
|
void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent");
|
PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent");
|
||||||
PickRay ray = computePickRay(event->x(), event->y());
|
PickRay ray = _viewState->computePickRay(event->x(), event->y());
|
||||||
|
|
||||||
bool precisionPicking = !Menu::getInstance()->isOptionChecked(MenuOption::DontDoPrecisionPicking);
|
bool precisionPicking = !_dontDoPrecisionPicking;
|
||||||
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking);
|
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking);
|
||||||
if (rayPickResult.intersects) {
|
if (rayPickResult.intersects) {
|
||||||
//qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID;
|
//qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID;
|
||||||
|
@ -733,8 +698,8 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int device
|
||||||
|
|
||||||
void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
|
void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent");
|
PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent");
|
||||||
PickRay ray = computePickRay(event->x(), event->y());
|
PickRay ray = _viewState->computePickRay(event->x(), event->y());
|
||||||
bool precisionPicking = !Menu::getInstance()->isOptionChecked(MenuOption::DontDoPrecisionPicking);
|
bool precisionPicking = !_dontDoPrecisionPicking;
|
||||||
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking);
|
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking);
|
||||||
if (rayPickResult.intersects) {
|
if (rayPickResult.intersects) {
|
||||||
//qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID;
|
//qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID;
|
||||||
|
@ -768,7 +733,7 @@ void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int devi
|
||||||
void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
|
||||||
PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent");
|
PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent");
|
||||||
|
|
||||||
PickRay ray = computePickRay(event->x(), event->y());
|
PickRay ray = _viewState->computePickRay(event->x(), event->y());
|
||||||
|
|
||||||
bool precisionPicking = false; // for mouse moves we do not do precision picking
|
bool precisionPicking = false; // for mouse moves we do not do precision picking
|
||||||
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking);
|
RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking);
|
|
@ -12,20 +12,17 @@
|
||||||
#ifndef hifi_EntityTreeRenderer_h
|
#ifndef hifi_EntityTreeRenderer_h
|
||||||
#define hifi_EntityTreeRenderer_h
|
#define hifi_EntityTreeRenderer_h
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <EntityTree.h>
|
#include <EntityTree.h>
|
||||||
#include <EntityScriptingInterface.h> // for RayToEntityIntersectionResult
|
#include <EntityScriptingInterface.h> // for RayToEntityIntersectionResult
|
||||||
#include <Octree.h>
|
#include <MouseEvent.h>
|
||||||
#include <OctreePacketData.h>
|
|
||||||
#include <OctreeRenderer.h>
|
#include <OctreeRenderer.h>
|
||||||
#include <PacketHeaders.h>
|
|
||||||
#include <RenderArgs.h>
|
|
||||||
#include <SharedUtil.h>
|
|
||||||
#include <ViewFrustum.h>
|
|
||||||
|
|
||||||
#include "renderer/Model.h"
|
class Model;
|
||||||
|
class ScriptEngine;
|
||||||
|
class AbstractViewStateInterface;
|
||||||
|
class AbstractScriptingServicesInterface;
|
||||||
|
|
||||||
|
class ScriptEngine;
|
||||||
|
|
||||||
class EntityScriptDetails {
|
class EntityScriptDetails {
|
||||||
public:
|
public:
|
||||||
|
@ -37,7 +34,8 @@ public:
|
||||||
class EntityTreeRenderer : public OctreeRenderer, public EntityItemFBXService {
|
class EntityTreeRenderer : public OctreeRenderer, public EntityItemFBXService {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
EntityTreeRenderer(bool wantScripts);
|
EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState,
|
||||||
|
AbstractScriptingServicesInterface* scriptingServices);
|
||||||
virtual ~EntityTreeRenderer();
|
virtual ~EntityTreeRenderer();
|
||||||
|
|
||||||
virtual char getMyNodeType() const { return NodeType::EntityServer; }
|
virtual char getMyNodeType() const { return NodeType::EntityServer; }
|
||||||
|
@ -64,8 +62,6 @@ public:
|
||||||
/// clears the tree
|
/// clears the tree
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
static QThread* getMainThread();
|
|
||||||
|
|
||||||
/// if a renderable entity item needs a model, we will allocate it for them
|
/// if a renderable entity item needs a model, we will allocate it for them
|
||||||
Q_INVOKABLE Model* allocateModel(const QString& url);
|
Q_INVOKABLE Model* allocateModel(const QString& url);
|
||||||
|
|
||||||
|
@ -109,17 +105,22 @@ public slots:
|
||||||
void entityCollisionWithVoxel(const EntityItemID& entityID, const VoxelDetail& voxel, const Collision& collision);
|
void entityCollisionWithVoxel(const EntityItemID& entityID, const VoxelDetail& voxel, const Collision& collision);
|
||||||
void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
||||||
|
|
||||||
|
// optional slots that can be wired to menu items
|
||||||
|
void setDisplayElementChildProxies(bool value) { _displayElementChildProxies = value; }
|
||||||
|
void setDisplayModelBounds(bool value) { _displayModelBounds = value; }
|
||||||
|
void setDisplayModelElementProxy(bool value) { _displayModelElementProxy = value; }
|
||||||
|
void setDontDoPrecisionPicking(bool value) { _dontDoPrecisionPicking = value; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Octree* createTree() { return new EntityTree(true); }
|
virtual Octree* createTree() { return new EntityTree(true); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void renderElementProxy(EntityTreeElement* entityTreeElement);
|
||||||
void checkAndCallPreload(const EntityItemID& entityID);
|
void checkAndCallPreload(const EntityItemID& entityID);
|
||||||
void checkAndCallUnload(const EntityItemID& entityID);
|
void checkAndCallUnload(const EntityItemID& entityID);
|
||||||
|
|
||||||
QList<Model*> _releasedModels;
|
QList<Model*> _releasedModels;
|
||||||
void renderProxies(const EntityItem* entity, RenderArgs* args);
|
void renderProxies(const EntityItem* entity, RenderArgs* args);
|
||||||
PickRay computePickRay(float x, float y);
|
|
||||||
RayToEntityIntersectionResult findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType,
|
RayToEntityIntersectionResult findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType,
|
||||||
bool precisionPicking);
|
bool precisionPicking);
|
||||||
|
|
||||||
|
@ -145,6 +146,13 @@ private:
|
||||||
|
|
||||||
bool _lastMouseEventValid;
|
bool _lastMouseEventValid;
|
||||||
MouseEvent _lastMouseEvent;
|
MouseEvent _lastMouseEvent;
|
||||||
|
AbstractViewStateInterface* _viewState;
|
||||||
|
AbstractScriptingServicesInterface* _scriptingServices;
|
||||||
|
bool _displayElementChildProxies;
|
||||||
|
bool _displayModelBounds;
|
||||||
|
bool _displayModelElementProxy;
|
||||||
|
bool _dontDoPrecisionPicking;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_EntityTreeRenderer_h
|
#endif // hifi_EntityTreeRenderer_h
|
|
@ -11,20 +11,13 @@
|
||||||
|
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
#include <FBXReader.h>
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include <DeferredLightingEffect.h>
|
||||||
|
|
||||||
#include <BoxEntityItem.h>
|
|
||||||
#include <ModelEntityItem.h>
|
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Menu.h"
|
|
||||||
#include "EntityTreeRenderer.h"
|
|
||||||
#include "RenderableBoxEntityItem.h"
|
#include "RenderableBoxEntityItem.h"
|
||||||
|
|
||||||
|
|
||||||
EntityItem* RenderableBoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItem* RenderableBoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
return new RenderableBoxEntityItem(entityID, properties);
|
return new RenderableBoxEntityItem(entityID, properties);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +46,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
||||||
glm::vec3 positionToCenter = center - position;
|
glm::vec3 positionToCenter = center - position;
|
||||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
} else {
|
} else {
|
||||||
|
@ -90,7 +83,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
||||||
glColor4f(getColor()[RED_INDEX] / MAX_COLOR, getColor()[GREEN_INDEX] / MAX_COLOR,
|
glColor4f(getColor()[RED_INDEX] / MAX_COLOR, getColor()[GREEN_INDEX] / MAX_COLOR,
|
||||||
getColor()[BLUE_INDEX] / MAX_COLOR, getLocalRenderAlpha());
|
getColor()[BLUE_INDEX] / MAX_COLOR, getLocalRenderAlpha());
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();
|
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
|
@ -105,7 +98,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();
|
DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays
|
glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays
|
||||||
glDisableClientState(GL_NORMAL_ARRAY);
|
glDisableClientState(GL_NORMAL_ARRAY);
|
|
@ -12,17 +12,6 @@
|
||||||
#ifndef hifi_RenderableBoxEntityItem_h
|
#ifndef hifi_RenderableBoxEntityItem_h
|
||||||
#define hifi_RenderableBoxEntityItem_h
|
#define hifi_RenderableBoxEntityItem_h
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <EntityTree.h>
|
|
||||||
#include <Octree.h>
|
|
||||||
#include <OctreePacketData.h>
|
|
||||||
#include <OctreeRenderer.h>
|
|
||||||
#include <PacketHeaders.h>
|
|
||||||
#include <SharedUtil.h>
|
|
||||||
#include <ViewFrustum.h>
|
|
||||||
|
|
||||||
#include <BoxEntityItem.h>
|
#include <BoxEntityItem.h>
|
||||||
|
|
||||||
class RenderableBoxEntityItem : public BoxEntityItem {
|
class RenderableBoxEntityItem : public BoxEntityItem {
|
|
@ -11,20 +11,13 @@
|
||||||
|
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
#include <FBXReader.h>
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
|
||||||
|
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <LightEntityItem.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "Application.h"
|
|
||||||
#include "Menu.h"
|
|
||||||
#include "EntityTreeRenderer.h"
|
|
||||||
#include "RenderableLightEntityItem.h"
|
#include "RenderableLightEntityItem.h"
|
||||||
|
|
||||||
|
|
||||||
EntityItem* RenderableLightEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItem* RenderableLightEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
return new RenderableLightEntityItem(entityID, properties);
|
return new RenderableLightEntityItem(entityID, properties);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +26,6 @@ void RenderableLightEntityItem::render(RenderArgs* args) {
|
||||||
PerformanceTimer perfTimer("RenderableLightEntityItem::render");
|
PerformanceTimer perfTimer("RenderableLightEntityItem::render");
|
||||||
assert(getType() == EntityTypes::Light);
|
assert(getType() == EntityTypes::Light);
|
||||||
glm::vec3 position = getPositionInMeters();
|
glm::vec3 position = getPositionInMeters();
|
||||||
glm::vec3 center = getCenterInMeters();
|
|
||||||
glm::vec3 dimensions = getDimensions() * (float)TREE_SCALE;
|
glm::vec3 dimensions = getDimensions() * (float)TREE_SCALE;
|
||||||
glm::quat rotation = getRotation();
|
glm::quat rotation = getRotation();
|
||||||
float largestDiameter = glm::max(dimensions.x, dimensions.y, dimensions.z);
|
float largestDiameter = glm::max(dimensions.x, dimensions.y, dimensions.z);
|
||||||
|
@ -61,43 +53,40 @@ void RenderableLightEntityItem::render(RenderArgs* args) {
|
||||||
float exponent = getExponent();
|
float exponent = getExponent();
|
||||||
float cutoff = glm::radians(getCutoff());
|
float cutoff = glm::radians(getCutoff());
|
||||||
|
|
||||||
bool disableLights = Menu::getInstance()->isOptionChecked(MenuOption::DisableLightEntities);
|
if (_isSpotlight) {
|
||||||
|
DependencyManager::get<DeferredLightingEffect>()->addSpotLight(position, largestDiameter / 2.0f,
|
||||||
if (!disableLights) {
|
ambient, diffuse, specular, constantAttenuation, linearAttenuation, quadraticAttenuation,
|
||||||
if (_isSpotlight) {
|
direction, exponent, cutoff);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->addSpotLight(position, largestDiameter / 2.0f,
|
} else {
|
||||||
ambient, diffuse, specular, constantAttenuation, linearAttenuation, quadraticAttenuation,
|
DependencyManager::get<DeferredLightingEffect>()->addPointLight(position, largestDiameter / 2.0f,
|
||||||
direction, exponent, cutoff);
|
ambient, diffuse, specular, constantAttenuation, linearAttenuation, quadraticAttenuation);
|
||||||
} else {
|
|
||||||
Application::getInstance()->getDeferredLightingEffect()->addPointLight(position, largestDiameter / 2.0f,
|
|
||||||
ambient, diffuse, specular, constantAttenuation, linearAttenuation, quadraticAttenuation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bool wantDebug = false;
|
|
||||||
if (wantDebug) {
|
#ifdef WANT_DEBUG
|
||||||
glColor4f(diffuseR, diffuseG, diffuseB, 1.0f);
|
glColor4f(diffuseR, diffuseG, diffuseB, 1.0f);
|
||||||
|
glPushMatrix();
|
||||||
|
glTranslatef(position.x, position.y, position.z);
|
||||||
|
glm::vec3 axis = glm::axis(rotation);
|
||||||
|
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glm::vec3 positionToCenter = center - position;
|
||||||
glm::vec3 axis = glm::axis(rotation);
|
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
|
||||||
glPushMatrix();
|
|
||||||
glm::vec3 positionToCenter = center - position;
|
|
||||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
|
||||||
|
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderWireSphere(0.5f, 15, 15);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireSphere(0.5f, 15, 15);
|
||||||
glPopMatrix();
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
glPopMatrix();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
bool RenderableLightEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
bool RenderableLightEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||||
bool& keepSearching, OctreeElement*& element, float& distance, BoxFace& face,
|
bool& keepSearching, OctreeElement*& element, float& distance, BoxFace& face,
|
||||||
void** intersectedObject, bool precisionPicking) const {
|
void** intersectedObject, bool precisionPicking) const {
|
||||||
|
|
||||||
// TODO: this isn't really correct because we don't know if we actually live in the main tree of the applications's
|
// TODO: consider if this is really what we want to do. We've made it so that "lights are pickable" is a global state
|
||||||
// EntityTreeRenderer. But we probably do. Technically we could be on the clipboard and someone might be trying to
|
// this is probably reasonable since there's typically only one tree you'd be picking on at a time. Technically we could
|
||||||
// use the ray intersection API there. Anyway... if you ever try to do ray intersection testing off of trees other
|
// be on the clipboard and someone might be trying to use the ray intersection API there. Anyway... if you ever try to
|
||||||
// than the main tree of the main entity renderer, then you'll need to fix this mechanism.
|
// do ray intersection testing off of trees other than the main tree of the main entity renderer, then we'll need to
|
||||||
return Application::getInstance()->getEntities()->getTree()->getLightsArePickable();
|
// fix this mechanism.
|
||||||
|
return _lightsArePickable;
|
||||||
}
|
}
|
|
@ -12,17 +12,6 @@
|
||||||
#ifndef hifi_RenderableLightEntityItem_h
|
#ifndef hifi_RenderableLightEntityItem_h
|
||||||
#define hifi_RenderableLightEntityItem_h
|
#define hifi_RenderableLightEntityItem_h
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <EntityTree.h>
|
|
||||||
#include <Octree.h>
|
|
||||||
#include <OctreePacketData.h>
|
|
||||||
#include <OctreeRenderer.h>
|
|
||||||
#include <PacketHeaders.h>
|
|
||||||
#include <SharedUtil.h>
|
|
||||||
#include <ViewFrustum.h>
|
|
||||||
|
|
||||||
#include <LightEntityItem.h>
|
#include <LightEntityItem.h>
|
||||||
|
|
||||||
class RenderableLightEntityItem : public LightEntityItem {
|
class RenderableLightEntityItem : public LightEntityItem {
|
|
@ -11,16 +11,14 @@
|
||||||
|
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
#include <FBXReader.h>
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include <QJsonDocument>
|
||||||
|
|
||||||
#include <BoxEntityItem.h>
|
#include <DeferredLightingEffect.h>
|
||||||
#include <ModelEntityItem.h>
|
#include <Model.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Menu.h"
|
|
||||||
#include "EntityTreeRenderer.h"
|
#include "EntityTreeRenderer.h"
|
||||||
#include "RenderableModelEntityItem.h"
|
#include "RenderableModelEntityItem.h"
|
||||||
|
|
||||||
|
@ -164,34 +162,17 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
_needsInitialSimulation = false;
|
_needsInitialSimulation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should we allow entityItems to have alpha on their models?
|
|
||||||
Model::RenderMode modelRenderMode = args->_renderMode == RenderArgs::SHADOW_RENDER_MODE
|
|
||||||
? Model::SHADOW_RENDER_MODE : Model::DEFAULT_RENDER_MODE;
|
|
||||||
|
|
||||||
if (_model->isActive()) {
|
if (_model->isActive()) {
|
||||||
// TODO: this is the majority of model render time. And rendering of a cube model vs the basic Box render
|
// TODO: this is the majority of model render time. And rendering of a cube model vs the basic Box render
|
||||||
// is significantly more expensive. Is there a way to call this that doesn't cost us as much?
|
// is significantly more expensive. Is there a way to call this that doesn't cost us as much?
|
||||||
PerformanceTimer perfTimer("model->render");
|
PerformanceTimer perfTimer("model->render");
|
||||||
bool dontRenderAsScene = Menu::getInstance()->isOptionChecked(MenuOption::DontRenderEntitiesAsScene);
|
_model->renderInScene(alpha, args);
|
||||||
bool displayModelTriangles = Menu::getInstance()->isOptionChecked(MenuOption::DisplayModelTriangles);
|
|
||||||
bool rendered = false;
|
|
||||||
if (displayModelTriangles) {
|
|
||||||
rendered = _model->renderTriangleProxies();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rendered) {
|
|
||||||
if (dontRenderAsScene) {
|
|
||||||
_model->render(alpha, modelRenderMode, args);
|
|
||||||
} else {
|
|
||||||
_model->renderInScene(alpha, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// if we couldn't get a model, then just draw a cube
|
// if we couldn't get a model, then just draw a cube
|
||||||
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(size);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(size);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -199,7 +180,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(size);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(size);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +189,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(size);
|
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(size);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,21 +12,13 @@
|
||||||
#ifndef hifi_RenderableModelEntityItem_h
|
#ifndef hifi_RenderableModelEntityItem_h
|
||||||
#define hifi_RenderableModelEntityItem_h
|
#define hifi_RenderableModelEntityItem_h
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <QString>
|
||||||
#include <stdint.h>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <EntityTree.h>
|
|
||||||
#include <Octree.h>
|
|
||||||
#include <OctreePacketData.h>
|
|
||||||
#include <OctreeRenderer.h>
|
|
||||||
#include <PacketHeaders.h>
|
|
||||||
#include <SharedUtil.h>
|
|
||||||
#include <ViewFrustum.h>
|
|
||||||
|
|
||||||
#include "renderer/Model.h"
|
|
||||||
|
|
||||||
#include <ModelEntityItem.h>
|
#include <ModelEntityItem.h>
|
||||||
#include <BoxEntityItem.h>
|
|
||||||
|
class Model;
|
||||||
|
class EntityTreeRenderer;
|
||||||
|
|
||||||
class RenderableModelEntityItem : public ModelEntityItem {
|
class RenderableModelEntityItem : public ModelEntityItem {
|
||||||
public:
|
public:
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue