mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 00:43:06 +02:00
merge andrew/thermonuclear into andrew/inertia
Conflicts: interface/src/Application.cpp libraries/entities/src/EntityItem.cpp libraries/entities/src/EntityTypes.cpp
This commit is contained in:
commit
6ea766b48d
104 changed files with 747 additions and 400 deletions
|
@ -28,7 +28,7 @@ void ScriptableAvatar::startAnimation(const QString& url, float fps, float prior
|
|||
Q_ARG(float, lastFrame), Q_ARG(const QStringList&, maskedJoints));
|
||||
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);
|
||||
_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",
|
||||
"label": "Audio Environment",
|
||||
|
|
|
@ -363,7 +363,8 @@ function makeTableInputs(setting) {
|
|||
|
||||
_.each(setting.columns, function(col) {
|
||||
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>"
|
||||
})
|
||||
|
||||
|
@ -389,8 +390,9 @@ function badgeSidebarForDifferences(changedElement) {
|
|||
|
||||
// badge for any settings we have that are not the same or are not present in initialValues
|
||||
for (var setting in panelJSON) {
|
||||
if (!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
||||
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting))) {
|
||||
if ((!_.has(initialPanelJSON, setting) && panelJSON[setting] !== "") ||
|
||||
(!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
||||
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting)))) {
|
||||
badgeValue += 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,6 +233,9 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
|||
parseAssignmentConfigs(parsedTypes);
|
||||
|
||||
populateDefaultStaticAssignmentsExcludingTypes(parsedTypes);
|
||||
|
||||
// check for scripts the user wants to persist from their domain-server config
|
||||
populateStaticScriptedAssignmentsFromSettings();
|
||||
|
||||
LimitedNodeList* nodeList = LimitedNodeList::createInstance(domainServerPort, domainServerDTLSPort);
|
||||
|
||||
|
@ -451,8 +454,6 @@ void DomainServer::parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes)
|
|||
|
||||
if (assignmentType != Assignment::AgentType) {
|
||||
createStaticAssignmentsForType(assignmentType, assignmentList);
|
||||
} else {
|
||||
createScriptedAssignmentsFromList(assignmentList);
|
||||
}
|
||||
|
||||
excludedTypes.insert(assignmentType);
|
||||
|
@ -468,35 +469,37 @@ void DomainServer::addStaticAssignmentToAssignmentHash(Assignment* newAssignment
|
|||
_allAssignments.insert(newAssignment->getUUID(), SharedAssignmentPointer(newAssignment));
|
||||
}
|
||||
|
||||
void DomainServer::createScriptedAssignmentsFromList(const QVariantList &configList) {
|
||||
foreach(const QVariant& configVariant, configList) {
|
||||
if (configVariant.canConvert(QMetaType::QVariantMap)) {
|
||||
QVariantMap configMap = configVariant.toMap();
|
||||
|
||||
// make sure we were passed a URL, otherwise this is an invalid scripted assignment
|
||||
const QString ASSIGNMENT_URL_KEY = "url";
|
||||
QString assignmentURL = configMap[ASSIGNMENT_URL_KEY].toString();
|
||||
|
||||
if (!assignmentURL.isEmpty()) {
|
||||
// check the json for a pool
|
||||
const QString ASSIGNMENT_POOL_KEY = "pool";
|
||||
QString assignmentPool = configMap[ASSIGNMENT_POOL_KEY].toString();
|
||||
|
||||
// check for a number of instances, if not passed then default is 1
|
||||
const QString ASSIGNMENT_INSTANCES_KEY = "instances";
|
||||
int numInstances = configMap[ASSIGNMENT_INSTANCES_KEY].toInt();
|
||||
numInstances = (numInstances == 0 ? 1 : numInstances);
|
||||
|
||||
qDebug() << "Adding a static scripted assignment from" << assignmentURL;
|
||||
|
||||
for (int i = 0; i < numInstances; i++) {
|
||||
void DomainServer::populateStaticScriptedAssignmentsFromSettings() {
|
||||
const QString PERSISTENT_SCRIPTS_KEY_PATH = "scripts.persistent_scripts";
|
||||
const QVariant* persistentScriptsVariant = valueForKeyPath(_settingsManager.getSettingsMap(), PERSISTENT_SCRIPTS_KEY_PATH);
|
||||
|
||||
if (persistentScriptsVariant) {
|
||||
QVariantList persistentScriptsList = persistentScriptsVariant->toList();
|
||||
foreach(const QVariant& persistentScriptVariant, persistentScriptsList) {
|
||||
QVariantMap persistentScript = persistentScriptVariant.toMap();
|
||||
|
||||
const QString PERSISTENT_SCRIPT_URL_KEY = "url";
|
||||
const QString PERSISTENT_SCRIPT_NUM_INSTANCES_KEY = "num_instances";
|
||||
const QString PERSISTENT_SCRIPT_POOL_KEY = "pool";
|
||||
|
||||
if (persistentScript.contains(PERSISTENT_SCRIPT_URL_KEY)) {
|
||||
// check how many instances of this script to add
|
||||
|
||||
int numInstances = persistentScript[PERSISTENT_SCRIPT_NUM_INSTANCES_KEY].toInt();
|
||||
QString scriptURL = persistentScript[PERSISTENT_SCRIPT_URL_KEY].toString();
|
||||
|
||||
QString scriptPool = persistentScript.value(PERSISTENT_SCRIPT_POOL_KEY).toString();
|
||||
|
||||
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
|
||||
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
||||
Assignment::AgentType,
|
||||
assignmentPool);
|
||||
scriptAssignment->setPayload(assignmentURL.toUtf8());
|
||||
|
||||
// scripts passed on CL or via JSON are static - so they are added back to the queue if the node dies
|
||||
scriptPool);
|
||||
scriptAssignment->setPayload(scriptURL.toUtf8());
|
||||
|
||||
// add it to static hash so we know we have to keep giving it back out
|
||||
addStaticAssignmentToAssignmentHash(scriptAssignment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,9 +100,9 @@ private:
|
|||
|
||||
void parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes);
|
||||
void addStaticAssignmentToAssignmentHash(Assignment* newAssignment);
|
||||
void createScriptedAssignmentsFromList(const QVariantList& configList);
|
||||
void createStaticAssignmentsForType(Assignment::Type type, const QVariantList& configList);
|
||||
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
||||
void populateStaticScriptedAssignmentsFromSettings();
|
||||
|
||||
SharedAssignmentPointer matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
||||
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 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 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 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 });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ Grid = function(opts) {
|
|||
Overlays.editOverlay(gridOverlay, {
|
||||
position: { x: origin.y, y: origin.y, z: -origin.y },
|
||||
visible: that.visible && that.enabled,
|
||||
minorGridSpacing: minorGridSpacing,
|
||||
minorGridWidth: minorGridSpacing,
|
||||
majorGridEvery: majorGridEvery,
|
||||
color: gridColor,
|
||||
alpha: gridAlpha,
|
||||
|
|
|
@ -108,7 +108,7 @@ endif()
|
|||
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
|
||||
|
||||
# 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)
|
||||
|
||||
# find any optional and required libraries
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
|
|
@ -54,9 +54,12 @@
|
|||
|
||||
#include <AddressManager.h>
|
||||
#include <AccountManager.h>
|
||||
#include <AmbientOcclusionEffect.h>
|
||||
#include <AudioInjector.h>
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <EntityScriptingInterface.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <HFActionEvent.h>
|
||||
#include <HFBackEvent.h>
|
||||
#include <LocalVoxelsList.h>
|
||||
|
@ -65,8 +68,10 @@
|
|||
#include <OctalCode.h>
|
||||
#include <OctreeSceneStats.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
#include <PhysicsEngine.h>
|
||||
#include <ProgramObject.h>
|
||||
#include <ResourceCache.h>
|
||||
#include <SoundCache.h>
|
||||
#include <UserActivityLogger.h>
|
||||
|
@ -86,10 +91,10 @@
|
|||
#include "devices/TV3DManager.h"
|
||||
#include "devices/Visage.h"
|
||||
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include "gpu/Batch.h"
|
||||
#include "gpu/GLBackend.h"
|
||||
|
||||
|
||||
#include "scripting/AccountScriptingInterface.h"
|
||||
#include "scripting/AudioDeviceScriptingInterface.h"
|
||||
#include "scripting/ClipboardScriptingInterface.h"
|
||||
|
@ -108,6 +113,7 @@
|
|||
#include "ui/TextRenderer.h"
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Starfield information
|
||||
|
@ -134,15 +140,6 @@ 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) :
|
||||
QApplication(argc, argv),
|
||||
_window(new MainWindow(desktop())),
|
||||
|
@ -198,8 +195,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_isVSyncOn(true),
|
||||
_aboutToQuit(false)
|
||||
{
|
||||
Model::setViewStateInterface(this); // The model class will sometimes need to know view state details from us
|
||||
|
||||
// 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
|
||||
applicationInfo.beginGroup("INFO");
|
||||
|
@ -217,7 +216,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
|
||||
_applicationStartupTime = startup_time;
|
||||
|
||||
QFontDatabase::addApplicationFont(Application::resourcesPath() + "styles/Inconsolata.otf");
|
||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
||||
_window->setWindowTitle("Interface");
|
||||
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
@ -714,7 +713,7 @@ void Application::paintGL() {
|
|||
TV3DManager::display(*whichCamera);
|
||||
|
||||
} else {
|
||||
_glowEffect.prepare();
|
||||
DependencyManager::get<GlowEffect>()->prepare();
|
||||
|
||||
// Viewport is assigned to the size of the framebuffer
|
||||
QSize size = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->size();
|
||||
|
@ -733,7 +732,7 @@ void Application::paintGL() {
|
|||
renderRearViewMirror(_mirrorViewRect);
|
||||
}
|
||||
|
||||
_glowEffect.render();
|
||||
DependencyManager::get<GlowEffect>()->render();
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("renderOverlay");
|
||||
|
@ -1924,9 +1923,8 @@ void Application::init() {
|
|||
|
||||
_environment.init();
|
||||
|
||||
_deferredLightingEffect.init();
|
||||
_glowEffect.init();
|
||||
_ambientOcclusionEffect.init();
|
||||
DependencyManager::get<DeferredLightingEffect>()->init(this);
|
||||
DependencyManager::get<AmbientOcclusionEffect>()->init(this);
|
||||
|
||||
// TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager
|
||||
_avatarManager.init();
|
||||
|
@ -2055,6 +2053,9 @@ void Application::init() {
|
|||
|
||||
// make sure our texture cache knows about window size changes
|
||||
DependencyManager::get<TextureCache>()->associateWithWidget(getGLWidget());
|
||||
|
||||
// initialize the GlowEffect with our widget
|
||||
DependencyManager::get<GlowEffect>()->init(getGLWidget(), Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect));
|
||||
}
|
||||
|
||||
void Application::closeMirrorView() {
|
||||
|
@ -2956,6 +2957,10 @@ void Application::setupWorldLight() {
|
|||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||
}
|
||||
|
||||
bool Application::shouldRenderMesh(float largestDimension, float distanceToCamera) {
|
||||
return Menu::getInstance()->shouldRenderMesh(largestDimension, distanceToCamera);
|
||||
}
|
||||
|
||||
QImage Application::renderAvatarBillboard() {
|
||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
||||
|
||||
|
@ -3092,7 +3097,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
|||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
_deferredLightingEffect.prepare();
|
||||
DependencyManager::get<DeferredLightingEffect>()->prepare();
|
||||
|
||||
if (!selfAvatarOnly) {
|
||||
// draw a red sphere
|
||||
|
@ -3135,7 +3140,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
|||
PerformanceTimer perfTimer("ambientOcclusion");
|
||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||
"Application::displaySide() ... AmbientOcclusion...");
|
||||
_ambientOcclusionEffect.render();
|
||||
DependencyManager::get<AmbientOcclusionEffect>()->render();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3152,7 +3157,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
|||
{
|
||||
PROFILE_RANGE("DeferredLighting");
|
||||
PerformanceTimer perfTimer("lighting");
|
||||
_deferredLightingEffect.render();
|
||||
DependencyManager::get<DeferredLightingEffect>()->render();
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -3257,6 +3262,14 @@ 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) {
|
||||
float horizontalScale = _glWidget->getDeviceWidth() / 2.0f;
|
||||
float verticalScale = _glWidget->getDeviceHeight() / 2.0f;
|
||||
|
@ -4025,7 +4038,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("AnimationCache", &_animationCache);
|
||||
scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>());
|
||||
scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance());
|
||||
scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance());
|
||||
scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels);
|
||||
|
@ -4406,7 +4419,7 @@ void Application::skipVersion(QString latestVersion) {
|
|||
|
||||
void Application::takeSnapshot() {
|
||||
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->play();
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <map>
|
||||
#include <time.h>
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QAction>
|
||||
|
@ -32,12 +34,15 @@
|
|||
|
||||
#include <EntityCollisionSystem.h>
|
||||
#include <EntityEditPacketSender.h>
|
||||
#include <GeometryCache.h>
|
||||
#include <NetworkPacket.h>
|
||||
#include <NodeList.h>
|
||||
#include <OctreeQuery.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <ScriptEngine.h>
|
||||
#include <TextureCache.h>
|
||||
#include <ViewFrustum.h>
|
||||
#include <ViewStateInterface.h>
|
||||
#include <VoxelEditPacketSender.h>
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
@ -58,11 +63,6 @@
|
|||
#include "devices/PrioVR.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 "ui/BandwidthDialog.h"
|
||||
#include "ui/BandwidthMeter.h"
|
||||
|
@ -128,7 +128,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_EDIT_ENTITIES_PATH = "html/edit-entities-commands.html";
|
||||
|
||||
class Application : public QApplication {
|
||||
class Application : public QApplication, public ViewStateInterface {
|
||||
Q_OBJECT
|
||||
|
||||
friend class OctreePacketProcessor;
|
||||
|
@ -137,7 +137,6 @@ class Application : public QApplication {
|
|||
|
||||
public:
|
||||
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
||||
static QString& resourcesPath();
|
||||
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
||||
static glm::quat getOrientationForPath() { return getInstance()->_myAvatar->getOrientation(); }
|
||||
|
||||
|
@ -234,7 +233,7 @@ public:
|
|||
const glm::vec3& getViewMatrixTranslation() const { return _viewMatrixTranslation; }
|
||||
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);
|
||||
|
||||
/// if you need to access the application settings, use lockSettings()/unlockSettings()
|
||||
|
@ -250,9 +249,6 @@ public:
|
|||
|
||||
ToolWindow* getToolWindow() { return _toolWindow ; }
|
||||
|
||||
AnimationCache* getAnimationCache() { return &_animationCache; }
|
||||
DeferredLightingEffect* getDeferredLightingEffect() { return &_deferredLightingEffect; }
|
||||
GlowEffect* getGlowEffect() { return &_glowEffect; }
|
||||
ControllerScriptingInterface* getControllerScriptingInterface() { return &_controllerScriptingInterface; }
|
||||
|
||||
AvatarManager& getAvatarManager() { return _avatarManager; }
|
||||
|
@ -260,7 +256,8 @@ public:
|
|||
|
||||
void controlledBroadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes);
|
||||
|
||||
void setupWorldLight();
|
||||
virtual void setupWorldLight();
|
||||
virtual bool shouldRenderMesh(float largestDimension, float distanceToCamera);
|
||||
|
||||
QImage renderAvatarBillboard();
|
||||
|
||||
|
@ -279,12 +276,17 @@ public:
|
|||
void getModelViewMatrix(glm::dmat4* modelViewMatrix);
|
||||
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.
|
||||
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;
|
||||
|
||||
virtual ViewFrustum* getCurrentViewFrustum() { return getDisplayViewFrustum(); }
|
||||
virtual bool getShadowsEnabled();
|
||||
virtual bool getCascadeShadowsEnabled();
|
||||
virtual QThread* getMainThread() { return thread(); }
|
||||
|
||||
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
||||
|
||||
FileLogger* getLogger() { return _logger; }
|
||||
|
@ -572,13 +574,6 @@ private:
|
|||
|
||||
QSet<int> _keysPressed;
|
||||
|
||||
|
||||
AnimationCache _animationCache;
|
||||
|
||||
DeferredLightingEffect _deferredLightingEffect;
|
||||
GlowEffect _glowEffect;
|
||||
AmbientOcclusionEffect _ambientOcclusionEffect;
|
||||
|
||||
Audio _audio;
|
||||
|
||||
bool _enableProcessVoxelsThread;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <AudioInjector.h>
|
||||
#include <NodeList.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PathUtils.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <StDev.h>
|
||||
#include <UUID.h>
|
||||
|
@ -140,9 +141,9 @@ Audio::Audio(QObject* parent) :
|
|||
}
|
||||
|
||||
void Audio::init(QGLWidget *parent) {
|
||||
_micTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic.svg"));
|
||||
_muteTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic-mute.svg"));
|
||||
_boxTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/audio-box.svg"));
|
||||
_micTextureId = parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic.svg"));
|
||||
_muteTextureId = parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic-mute.svg"));
|
||||
_boxTextureId = parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/audio-box.svg"));
|
||||
}
|
||||
|
||||
void Audio::reset() {
|
||||
|
@ -450,7 +451,9 @@ void Audio::start() {
|
|||
qDebug() << "Unable to set up audio output because of a problem with output format.";
|
||||
}
|
||||
|
||||
_inputFrameBuffer.initialize( _inputFormat.channelCount(), _audioInput->bufferSize() * 8 );
|
||||
if (_audioInput) {
|
||||
_inputFrameBuffer.initialize( _inputFormat.channelCount(), _audioInput->bufferSize() * 8 );
|
||||
}
|
||||
_inputGain.initialize();
|
||||
_sourceGain.initialize();
|
||||
_noiseSource.initialize();
|
||||
|
@ -1935,6 +1938,9 @@ int Audio::calculateNumberOfFrameSamples(int numBytes) const {
|
|||
}
|
||||
|
||||
float Audio::getAudioOutputMsecsUnplayed() const {
|
||||
if (!_audioOutput) {
|
||||
return 0.0f;
|
||||
}
|
||||
int bytesAudioOutputUnplayed = _audioOutput->bufferSize() - _audioOutput->bytesFree();
|
||||
float msecsAudioOutputUnplayed = bytesAudioOutputUnplayed / (float)_outputFormat.bytesForDuration(USECS_PER_MSEC);
|
||||
return msecsAudioOutputUnplayed;
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
|
||||
#include <GeometryUtil.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PathUtils.h>
|
||||
#include <ProgramObject.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Camera.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include "world.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* 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::Fragment, prefix + ".frag");
|
||||
program->link();
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <PathUtils.h>
|
||||
#include <UUID.h>
|
||||
#include <UserActivityLogger.h>
|
||||
#include <XmppClient.h>
|
||||
|
@ -54,7 +56,6 @@
|
|||
#include "ui/LoginDialog.h"
|
||||
#include "ui/NodeBounds.h"
|
||||
|
||||
|
||||
Menu* Menu::_instance = NULL;
|
||||
|
||||
Menu* Menu::getInstance() {
|
||||
|
@ -246,7 +247,7 @@ Menu::Menu() :
|
|||
connect(&xmppClient, &QXmppClient::connected, this, &Menu::toggleChat);
|
||||
connect(&xmppClient, &QXmppClient::disconnected, this, &Menu::toggleChat);
|
||||
|
||||
QDir::setCurrent(Application::resourcesPath());
|
||||
QDir::setCurrent(PathUtils::resourcesPath());
|
||||
// init chat window to listen chat
|
||||
_chatWindow = new ChatWindow(Application::getInstance()->getWindow());
|
||||
#endif
|
||||
|
@ -424,7 +425,8 @@ Menu::Menu() :
|
|||
true,
|
||||
appInstance,
|
||||
SLOT(setRenderVoxels(bool)));
|
||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true);
|
||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true,
|
||||
DependencyManager::get<GlowEffect>(), SLOT(toggleGlowEffect(bool)));
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
||||
|
|
|
@ -361,9 +361,6 @@ namespace MenuOption {
|
|||
const QString Collisions = "Collisions";
|
||||
const QString Console = "Console...";
|
||||
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 DontDoPrecisionPicking = "Don't Do Precision Picking";
|
||||
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
||||
|
|
|
@ -21,17 +21,18 @@
|
|||
|
||||
#include <glm/gtx/transform.hpp>
|
||||
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <Model.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include <MetavoxelMessages.h>
|
||||
#include <MetavoxelUtil.h>
|
||||
#include <PathUtils.h>
|
||||
#include <ScriptCache.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "MetavoxelSystem.h"
|
||||
#include "renderer/Model.h"
|
||||
#include "renderer/RenderUtil.h"
|
||||
|
||||
REGISTER_META_OBJECT(DefaultMetavoxelRendererImplementation)
|
||||
REGISTER_META_OBJECT(SphereRenderer)
|
||||
|
@ -63,9 +64,9 @@ void MetavoxelSystem::init() {
|
|||
_voxelBufferAttribute->setLODThresholdMultiplier(
|
||||
AttributeRegistry::getInstance()->getVoxelColorAttribute()->getLODThresholdMultiplier());
|
||||
|
||||
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_heightfield_base.vert");
|
||||
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
||||
_baseHeightfieldProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_heightfield_base.frag");
|
||||
_baseHeightfieldProgram.link();
|
||||
|
||||
|
@ -78,9 +79,9 @@ void MetavoxelSystem::init() {
|
|||
|
||||
loadSplatProgram("heightfield", _splatHeightfieldProgram, _splatHeightfieldLocations);
|
||||
|
||||
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_heightfield_cursor.vert");
|
||||
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
||||
_heightfieldCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_cursor.frag");
|
||||
_heightfieldCursorProgram.link();
|
||||
|
||||
|
@ -88,17 +89,17 @@ void MetavoxelSystem::init() {
|
|||
_heightfieldCursorProgram.setUniformValue("heightMap", 0);
|
||||
_heightfieldCursorProgram.release();
|
||||
|
||||
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_voxel_base.vert");
|
||||
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
||||
_baseVoxelProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_voxel_base.frag");
|
||||
_baseVoxelProgram.link();
|
||||
|
||||
loadSplatProgram("voxel", _splatVoxelProgram, _splatVoxelLocations);
|
||||
|
||||
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_voxel_cursor.vert");
|
||||
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
||||
_voxelCursorProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_cursor.frag");
|
||||
_voxelCursorProgram.link();
|
||||
}
|
||||
|
@ -470,7 +471,7 @@ void MetavoxelSystem::render() {
|
|||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glNormal3f(0.0f, 1.0f, 0.0f);
|
||||
|
||||
Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();
|
||||
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
|
||||
|
||||
foreach (const HermiteBatch& batch, _hermiteBatches) {
|
||||
batch.vertexBuffer->bind();
|
||||
|
@ -482,7 +483,7 @@ void MetavoxelSystem::render() {
|
|||
batch.vertexBuffer->release();
|
||||
}
|
||||
|
||||
Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();
|
||||
DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
|
||||
|
||||
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) {
|
||||
program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||
program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_" + type + "_splat.vert");
|
||||
program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() +
|
||||
program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() +
|
||||
"shaders/metavoxel_" + type + "_splat.frag");
|
||||
program.link();
|
||||
|
||||
|
@ -1981,7 +1982,7 @@ void SphereRenderer::render(const MetavoxelLOD& lod, bool contained, bool cursor
|
|||
glm::vec3 axis = glm::axis(rotation);
|
||||
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();
|
||||
}
|
||||
|
@ -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);
|
||||
glScalef(1.0f, cuboid->getAspectY(), cuboid->getAspectZ());
|
||||
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(cuboid->getScale() * 2.0f);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(cuboid->getScale() * 2.0f);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
#include <glm/glm.hpp>
|
||||
|
||||
#include <MetavoxelClientManager.h>
|
||||
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include "renderer/TextureCache.h"
|
||||
#include <ProgramObject.h>
|
||||
#include <TextureCache.h>
|
||||
|
||||
class HeightfieldBaseLayerBatch;
|
||||
class HeightfieldSplatBatch;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QWindow>
|
||||
|
||||
|
@ -20,11 +22,15 @@
|
|||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/gtx/vector_query.hpp>
|
||||
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <NodeList.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <TextureCache.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Avatar.h"
|
||||
|
@ -36,7 +42,6 @@
|
|||
#include "Recorder.h"
|
||||
#include "world.h"
|
||||
#include "devices/OculusManager.h"
|
||||
#include "renderer/TextureCache.h"
|
||||
#include "ui/TextRenderer.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -360,7 +365,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
|||
glm::quat orientation = getOrientation();
|
||||
foreach (const AvatarManager::LocalLight& light, Application::getInstance()->getAvatarManager().getLocalLights()) {
|
||||
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,
|
||||
LIGHT_EXPONENT, LIGHT_CUTOFF);
|
||||
}
|
||||
|
@ -913,13 +918,13 @@ void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const {
|
|||
|
||||
void Avatar::setFaceModelURL(const QUrl& 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());
|
||||
}
|
||||
|
||||
void Avatar::setSkeletonModelURL(const QUrl& 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());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,16 +15,17 @@
|
|||
|
||||
#include <glm/gtx/string_cast.hpp>
|
||||
|
||||
#include <GlowEffect.h>
|
||||
#include <PerfStat.h>
|
||||
#include <RegisteredMetaTypes.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Avatar.h"
|
||||
#include "AvatarManager.h"
|
||||
#include "Menu.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.
|
||||
const QUuid MY_AVATAR_KEY; // NULL key
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef hifi_FaceModel_h
|
||||
#define hifi_FaceModel_h
|
||||
|
||||
#include "renderer/Model.h"
|
||||
#include <Model.h>
|
||||
|
||||
class Head;
|
||||
|
||||
|
|
|
@ -8,18 +8,20 @@
|
|||
// 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 <NodeList.h>
|
||||
|
||||
#include <GeometryUtil.h>
|
||||
#include <ProgramObject.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Avatar.h"
|
||||
#include "Hand.h"
|
||||
#include "Menu.h"
|
||||
#include "Util.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef hifi_Hand_h
|
||||
#define hifi_Hand_h
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QAction>
|
||||
|
@ -22,9 +24,8 @@
|
|||
#include <AvatarData.h>
|
||||
#include <AudioScriptingInterface.h>
|
||||
#include <HandData.h>
|
||||
#include <Model.h>
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include "renderer/Model.h"
|
||||
#include "world.h"
|
||||
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <devices/Faceshift.h>
|
||||
#include <devices/DdeFaceTracker.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <NodeList.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
@ -21,6 +20,8 @@
|
|||
#include "Head.h"
|
||||
#include "Menu.h"
|
||||
#include "Util.h"
|
||||
#include "devices/DdeFaceTracker.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/OculusManager.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -331,7 +332,7 @@ void Head::addLeanDeltas(float sideways, float forward) {
|
|||
|
||||
void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) {
|
||||
|
||||
Application::getInstance()->getGlowEffect()->begin();
|
||||
DependencyManager::get<GlowEffect>()->begin();
|
||||
|
||||
glLineWidth(2.0);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -345,7 +346,7 @@ void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosi
|
|||
glVertex3f(lookatPosition.x, lookatPosition.y, lookatPosition.z);
|
||||
glEnd();
|
||||
|
||||
Application::getInstance()->getGlowEffect()->end();
|
||||
DependencyManager::get<GlowEffect>()->end();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
//
|
||||
|
||||
#include <AvatarData.h>
|
||||
|
||||
#include <EntityTree.h>
|
||||
#include "../renderer/Model.h"
|
||||
#include <Model.h>
|
||||
|
||||
#include "ModelReferential.h"
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <AnimationHandle.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <NodeList.h>
|
||||
|
@ -40,7 +41,6 @@
|
|||
#include "Recorder.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/OculusManager.h"
|
||||
#include "renderer/AnimationHandle.h"
|
||||
#include "ui/TextRenderer.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
#ifndef hifi_SkeletonModel_h
|
||||
#define hifi_SkeletonModel_h
|
||||
|
||||
#include "renderer/Model.h"
|
||||
|
||||
#include <CapsuleShape.h>
|
||||
#include <Model.h>
|
||||
|
||||
#include "SkeletonRagdoll.h"
|
||||
|
||||
class Avatar;
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
#include <DistanceConstraint.h>
|
||||
#include <FixedConstraint.h>
|
||||
#include <Model.h>
|
||||
|
||||
#include "SkeletonRagdoll.h"
|
||||
#include "MuscleConstraint.h"
|
||||
#include "../renderer/Model.h"
|
||||
|
||||
SkeletonRagdoll::SkeletonRagdoll(Model* model) : Ragdoll(), _model(model) {
|
||||
assert(_model);
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
|
||||
#include <QVector>
|
||||
|
||||
#include <JointState.h>
|
||||
#include <Ragdoll.h>
|
||||
|
||||
#include "../renderer/JointState.h"
|
||||
|
||||
class MuscleConstraint;
|
||||
class Model;
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <GlowEffect.h>
|
||||
#include <PathUtils.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <UserActivityLogger.h>
|
||||
|
||||
|
@ -136,8 +138,8 @@ void OculusManager::connect() {
|
|||
if (!_programInitialized) {
|
||||
// Shader program
|
||||
_programInitialized = true;
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/oculus.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/oculus.frag");
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/oculus.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/oculus.frag");
|
||||
_program.link();
|
||||
|
||||
// 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
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)) {
|
||||
Application::getInstance()->getGlowEffect()->prepare();
|
||||
DependencyManager::get<GlowEffect>()->prepare();
|
||||
} else {
|
||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
||||
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
|
||||
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());
|
||||
} else {
|
||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->release();
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
#include <OVR.h>
|
||||
#endif
|
||||
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include <ProgramObject.h>
|
||||
|
||||
#include "ui/overlays/Text3DOverlay.h"
|
||||
|
||||
const float DEFAULT_OCULUS_UI_ANGULAR_SIZE = 72.0f;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <GlowEffect.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
#include "TV3DManager.h"
|
||||
|
@ -103,7 +105,7 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
applicationOverlay.renderOverlay(true);
|
||||
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);
|
||||
|
||||
|
@ -169,7 +171,7 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
// reset the viewport to how we started
|
||||
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,
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <DependencyManager.h>
|
||||
#include <FBXReader.h>
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
|
@ -45,12 +46,12 @@ Visage::Visage() :
|
|||
|
||||
#ifdef HAVE_VISAGE
|
||||
#ifdef WIN32
|
||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage";
|
||||
QByteArray licensePath = PathUtils::resourcesPath().toLatin1() + "visage";
|
||||
#else
|
||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc";
|
||||
QByteArray licensePath = PathUtils::resourcesPath().toLatin1() + "visage/license.vlc";
|
||||
#endif
|
||||
initializeLicenseManager(licensePath.data());
|
||||
_tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg");
|
||||
_tracker = new VisageTracker2(PathUtils::resourcesPath().toLatin1() + "visage/tracker.cfg");
|
||||
_data = new FaceData();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <BoxEntityItem.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <ModelEntityItem.h>
|
||||
#include <MouseEvent.h>
|
||||
#include <PerfStat.h>
|
||||
|
@ -41,8 +42,6 @@ QThread* EntityTreeRenderer::getMainThread() {
|
|||
return Application::getInstance()->getEntities()->thread();
|
||||
}
|
||||
|
||||
|
||||
|
||||
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts) :
|
||||
OctreeRenderer(),
|
||||
_wantScripts(wantScripts),
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <EntityTree.h>
|
||||
#include <EntityScriptingInterface.h> // for RayToEntityIntersectionResult
|
||||
#include <Model.h>
|
||||
#include <Octree.h>
|
||||
#include <OctreePacketData.h>
|
||||
#include <OctreeRenderer.h>
|
||||
|
@ -25,7 +26,6 @@
|
|||
#include <SharedUtil.h>
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
#include "renderer/Model.h"
|
||||
|
||||
class EntityScriptDetails {
|
||||
public:
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <BoxEntityItem.h>
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <ModelEntityItem.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
|
@ -53,7 +54,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
|||
glm::vec3 positionToCenter = center - position;
|
||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
} else {
|
||||
|
@ -90,7 +91,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
|||
glColor4f(getColor()[RED_INDEX] / MAX_COLOR, getColor()[GREEN_INDEX] / MAX_COLOR,
|
||||
getColor()[BLUE_INDEX] / MAX_COLOR, getLocalRenderAlpha());
|
||||
|
||||
Application::getInstance()->getDeferredLightingEffect()->bindSimpleProgram();
|
||||
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
|
@ -105,7 +106,7 @@ void RenderableBoxEntityItem::render(RenderArgs* args) {
|
|||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
|
||||
Application::getInstance()->getDeferredLightingEffect()->releaseSimpleProgram();
|
||||
DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <PerfStat.h>
|
||||
#include <LightEntityItem.h>
|
||||
|
||||
|
@ -33,7 +34,6 @@ void RenderableLightEntityItem::render(RenderArgs* args) {
|
|||
PerformanceTimer perfTimer("RenderableLightEntityItem::render");
|
||||
assert(getType() == EntityTypes::Light);
|
||||
glm::vec3 position = getPositionInMeters();
|
||||
glm::vec3 center = getCenterInMeters();
|
||||
glm::vec3 dimensions = getDimensions() * (float)TREE_SCALE;
|
||||
glm::quat rotation = getRotation();
|
||||
float largestDiameter = glm::max(dimensions.x, dimensions.y, dimensions.z);
|
||||
|
@ -65,30 +65,30 @@ void RenderableLightEntityItem::render(RenderArgs* args) {
|
|||
|
||||
if (!disableLights) {
|
||||
if (_isSpotlight) {
|
||||
Application::getInstance()->getDeferredLightingEffect()->addSpotLight(position, largestDiameter / 2.0f,
|
||||
DependencyManager::get<DeferredLightingEffect>()->addSpotLight(position, largestDiameter / 2.0f,
|
||||
ambient, diffuse, specular, constantAttenuation, linearAttenuation, quadraticAttenuation,
|
||||
direction, exponent, cutoff);
|
||||
} else {
|
||||
Application::getInstance()->getDeferredLightingEffect()->addPointLight(position, largestDiameter / 2.0f,
|
||||
DependencyManager::get<DeferredLightingEffect>()->addPointLight(position, largestDiameter / 2.0f,
|
||||
ambient, diffuse, specular, constantAttenuation, linearAttenuation, quadraticAttenuation);
|
||||
}
|
||||
}
|
||||
bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
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();
|
||||
glm::vec3 positionToCenter = center - position;
|
||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderWireSphere(0.5f, 15, 15);
|
||||
glPopMatrix();
|
||||
#ifdef WANT_DEBUG
|
||||
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();
|
||||
glm::vec3 positionToCenter = center - position;
|
||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderWireSphere(0.5f, 15, 15);
|
||||
glPopMatrix();
|
||||
}
|
||||
glPopMatrix();
|
||||
#endif
|
||||
};
|
||||
|
||||
bool RenderableLightEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <BoxEntityItem.h>
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <ModelEntityItem.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
|
@ -191,7 +192,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
||||
glPushMatrix();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(size);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(size);
|
||||
glPopMatrix();
|
||||
}
|
||||
} else {
|
||||
|
@ -199,7 +200,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
||||
glPushMatrix();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(size);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(size);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +209,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
glColor3ub(getColor()[RED_INDEX],getColor()[GREEN_INDEX],getColor()[BLUE_INDEX]);
|
||||
glPushMatrix();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(size);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(size);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include <EntityTree.h>
|
||||
#include <Model.h>
|
||||
#include <ModelEntityItem.h>
|
||||
#include <Octree.h>
|
||||
#include <OctreePacketData.h>
|
||||
#include <OctreeRenderer.h>
|
||||
|
@ -23,11 +25,6 @@
|
|||
#include <SharedUtil.h>
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
#include "renderer/Model.h"
|
||||
|
||||
#include <ModelEntityItem.h>
|
||||
#include <BoxEntityItem.h>
|
||||
|
||||
class RenderableModelEntityItem : public ModelEntityItem {
|
||||
public:
|
||||
static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <PerfStat.h>
|
||||
#include <SphereEntityItem.h>
|
||||
|
||||
|
@ -23,7 +25,6 @@
|
|||
#include "EntityTreeRenderer.h"
|
||||
#include "RenderableSphereEntityItem.h"
|
||||
|
||||
|
||||
EntityItem* RenderableSphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return new RenderableSphereEntityItem(entityID, properties);
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ void RenderableSphereEntityItem::render(RenderArgs* args) {
|
|||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidSphere(0.5f, 15, 15);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(0.5f, 15, 15);
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
};
|
||||
|
|
|
@ -200,7 +200,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???
|
||||
if (_editDialog) {
|
||||
if (_nonBlockingFormActive) {
|
||||
qDebug() << "Show Non-Blocking Form called when form already active.";
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#define hifi_Config_h
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cfloat>
|
||||
|
@ -35,6 +34,8 @@
|
|||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
|
||||
#include <ProgramObject.h>
|
||||
|
||||
#include "AngleUtil.h"
|
||||
#include "Radix2InplaceSort.h"
|
||||
#include "Radix2IntegerScanner.h"
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "AddressBarDialog.h"
|
||||
#include "AddressManager.h"
|
||||
#include "Application.h"
|
||||
|
@ -82,7 +84,7 @@ void AddressBarDialog::setupUI() {
|
|||
_goButton->setSizePolicy(sizePolicy);
|
||||
_goButton->setMinimumSize(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->setDefault(true);
|
||||
_goButton->setFlat(true);
|
||||
|
@ -99,7 +101,7 @@ void AddressBarDialog::setupUI() {
|
|||
_closeButton->setSizePolicy(sizePolicy);
|
||||
_closeButton->setMinimumSize(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->setIconSize(QSize(CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
|
||||
_closeButton->setFlat(true);
|
||||
|
@ -112,7 +114,7 @@ void AddressBarDialog::setupUI() {
|
|||
}
|
||||
|
||||
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->setFocus();
|
||||
FramelessDialog::showEvent(event);
|
||||
|
@ -120,7 +122,7 @@ void AddressBarDialog::showEvent(QShowEvent* event) {
|
|||
|
||||
void AddressBarDialog::accept() {
|
||||
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 = AddressManager::getInstance();
|
||||
connect(&addressManager, &AddressManager::lookupResultsFinished, this, &QDialog::hide);
|
||||
addressManager.handleLookupString(_addressLineEdit->text());
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QOpenGLFramebufferObject>
|
||||
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
@ -379,7 +381,7 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
|
|||
glEnd();
|
||||
|
||||
if (_crosshairTexture == 0) {
|
||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png"));
|
||||
}
|
||||
|
||||
//draw the mouse pointer
|
||||
|
@ -513,7 +515,7 @@ void ApplicationOverlay::renderPointers() {
|
|||
|
||||
//lazily load crosshair texture
|
||||
if (_crosshairTexture == 0) {
|
||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png"));
|
||||
}
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <AddressManager.h>
|
||||
#include <AccountManager.h>
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "ChatMessageArea.h"
|
||||
|
@ -92,9 +93,9 @@ ChatWindow::ChatWindow(QWidget* parent) :
|
|||
connect(&_trayIcon, SIGNAL(messageClicked()), this, SLOT(notificationClicked()));
|
||||
#endif // HAVE_QXMPP
|
||||
|
||||
QDir mentionSoundsDir(Application::resourcesPath() + mentionSoundsPath);
|
||||
QDir mentionSoundsDir(PathUtils::resourcesPath() + mentionSoundsPath);
|
||||
_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() {
|
||||
|
@ -385,7 +386,7 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
|
|||
|
||||
if (_effectPlayer.state() != QMediaPlayer::PlayingState) {
|
||||
// get random sound
|
||||
QFileInfo inf = QFileInfo(Application::resourcesPath() +
|
||||
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() +
|
||||
mentionSoundsPath +
|
||||
_mentionSounds.at(rand() % _mentionSounds.size()));
|
||||
_effectPlayer.setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "FramelessDialog.h"
|
||||
#include "Menu.h"
|
||||
|
@ -80,10 +82,10 @@ bool FramelessDialog::eventFilter(QObject* sender, QEvent* event) {
|
|||
}
|
||||
|
||||
void FramelessDialog::setStyleSheetFile(const QString& fileName) {
|
||||
QFile globalStyleSheet(Application::resourcesPath() + "styles/global.qss");
|
||||
QFile styleSheet(Application::resourcesPath() + fileName);
|
||||
QFile globalStyleSheet(PathUtils::resourcesPath() + "styles/global.qss");
|
||||
QFile styleSheet(PathUtils::resourcesPath() + fileName);
|
||||
if (styleSheet.open(QIODevice::ReadOnly) && globalStyleSheet.open(QIODevice::ReadOnly) ) {
|
||||
QDir::setCurrent(Application::resourcesPath());
|
||||
QDir::setCurrent(PathUtils::resourcesPath());
|
||||
setStyleSheet(globalStyleSheet.readAll() + styleSheet.readAll());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,14 +9,17 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "InfoView.h"
|
||||
#include <QApplication>
|
||||
#include "Application.h"
|
||||
|
||||
#include <QtWebKitWidgets/QWebFrame>
|
||||
#include <QtWebKit/QWebElement>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "InfoView.h"
|
||||
|
||||
#define SETTINGS_VERSION_KEY "info-version"
|
||||
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
||||
|
||||
|
@ -25,7 +28,7 @@ InfoView::InfoView(bool forced, QString path) :
|
|||
{
|
||||
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);
|
||||
|
||||
load(url);
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
#include <QLabel>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "Application.h"
|
||||
#include "ScriptHighlighting.h"
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "JSConsole.h"
|
||||
#include "ScriptHighlighting.h"
|
||||
|
||||
const int NO_CURRENT_HISTORY_COMMAND = -1;
|
||||
const int MAX_HISTORY_SIZE = 64;
|
||||
|
@ -41,9 +42,9 @@ JSConsole::JSConsole(QWidget* parent, ScriptEngine* scriptEngine) :
|
|||
_ui->promptTextEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
_ui->promptTextEdit->installEventFilter(this);
|
||||
|
||||
QFile styleSheet(Application::resourcesPath() + "styles/console.qss");
|
||||
QFile styleSheet(PathUtils::resourcesPath() + "styles/console.qss");
|
||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||
QDir::setCurrent(Application::resourcesPath());
|
||||
QDir::setCurrent(PathUtils::resourcesPath());
|
||||
setStyleSheet(styleSheet.readAll());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
#include <QTextBlock>
|
||||
#include <QtGui>
|
||||
|
||||
#include <PathUtils.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
#include "ui/LogDialog.h"
|
||||
|
||||
const int TOP_BAR_HEIGHT = 46;
|
||||
|
@ -44,9 +44,9 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog
|
|||
setWindowTitle("Log");
|
||||
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)) {
|
||||
QDir::setCurrent(Application::resourcesPath());
|
||||
QDir::setCurrent(PathUtils::resourcesPath());
|
||||
setStyleSheet(styleSheet.readAll());
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
#include <QPushButton>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Menu.h"
|
||||
#include "AccountManager.h"
|
||||
#include "ui_loginDialog.h"
|
||||
|
||||
#include "LoginDialog.h"
|
||||
|
||||
const QString FORGOT_PASSWORD_URL = "https://data.highfidelity.io/users/password/new";
|
||||
|
@ -30,8 +31,8 @@ LoginDialog::LoginDialog(QWidget* parent) :
|
|||
_ui->setupUi(this);
|
||||
_ui->errorLabel->hide();
|
||||
_ui->emailLineEdit->setFocus();
|
||||
_ui->logoLabel->setPixmap(QPixmap(Application::resourcesPath() + "images/hifi-logo.svg"));
|
||||
_ui->loginButton->setIcon(QIcon(Application::resourcesPath() + "images/login.svg"));
|
||||
_ui->logoLabel->setPixmap(QPixmap(PathUtils::resourcesPath() + "images/hifi-logo.svg"));
|
||||
_ui->loginButton->setIcon(QIcon(PathUtils::resourcesPath() + "images/login.svg"));
|
||||
_ui->infoLabel->setVisible(false);
|
||||
_ui->errorLabel->setVisible(false);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <AttributeRegistry.h>
|
||||
#include <MetavoxelMessages.h>
|
||||
#include <MetavoxelUtil.h>
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "MetavoxelEditor.h"
|
||||
|
@ -145,7 +146,7 @@ MetavoxelEditor::MetavoxelEditor() :
|
|||
return;
|
||||
}
|
||||
|
||||
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag");
|
||||
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/grid.frag");
|
||||
_gridProgram.link();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
#include <QList>
|
||||
#include <QWidget>
|
||||
|
||||
#include <ProgramObject.h>
|
||||
|
||||
#include "MetavoxelSystem.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
|
||||
class QColorEditor;
|
||||
class QComboBox;
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <PathUtils.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "RearMirrorTools.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include "RearMirrorTools.h"
|
||||
|
||||
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
|
||||
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
|
||||
|
@ -32,13 +33,13 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se
|
|||
_fullScreen(false)
|
||||
{
|
||||
_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
|
||||
// _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"));
|
||||
_zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/minus.svg"));
|
||||
_zoomHeadTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/plus.svg"));
|
||||
_zoomBodyTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/minus.svg"));
|
||||
|
||||
_shrinkIconRect = QRect(ICON_PADDING, 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 <QWindow>
|
||||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Menu.h"
|
||||
#include "ScriptsModel.h"
|
||||
|
@ -109,7 +111,7 @@ void RunningScriptsWidget::setRunningScripts(const QStringList& list) {
|
|||
QPushButton* closeButton = new QPushButton(row);
|
||||
closeButton->setFlat(true);
|
||||
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->setStyleSheet("border: 0;");
|
||||
closeButton->setCursor(Qt::PointingHandCursor);
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "Application.h" // HACK ATTACK WARNING: for windows build to work, we need this ahead of QtGui
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QtGui>
|
||||
#include "ui_updateDialog.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "UpdateDialog.h"
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
#include "VoxelImportDialog.h"
|
||||
|
@ -64,7 +66,7 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
|
|||
break;
|
||||
}
|
||||
|
||||
return QIcon(Application::resourcesPath() + "icons/" + typeString + ".svg");
|
||||
return QIcon(PathUtils::resourcesPath() + "icons/" + typeString + ".svg");
|
||||
}
|
||||
|
||||
QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
|
||||
|
@ -72,21 +74,21 @@ QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
|
|||
|
||||
if (info.isDir()) {
|
||||
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)) {
|
||||
return QIcon(Application::resourcesPath() + "icons/desktop.svg");
|
||||
return QIcon(PathUtils::resourcesPath() + "icons/desktop.svg");
|
||||
} 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()) {
|
||||
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 {
|
||||
|
@ -307,16 +309,16 @@ void VoxelImportDialog::setLayout() {
|
|||
widget = findChild<QWidget*>("treeView");
|
||||
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)) {
|
||||
QDir::setCurrent(Application::resourcesPath());
|
||||
QDir::setCurrent(PathUtils::resourcesPath());
|
||||
setStyleSheet(styleSheet.readAll());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void VoxelImportDialog::setImportTypes() {
|
||||
QFile config(Application::resourcesPath() + "config/config.json");
|
||||
QFile config(PathUtils::resourcesPath() + "config/config.json");
|
||||
config.open(QFile::ReadOnly | QFile::Text);
|
||||
QJsonDocument document = QJsonDocument::fromJson(config.readAll());
|
||||
if (!document.isNull() && !document.isEmpty()) {
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
#include <QScopedPointer>
|
||||
#include <QUrl>
|
||||
|
||||
#include <TextureCache.h>
|
||||
|
||||
#include "Base3DOverlay.h"
|
||||
#include "renderer/TextureCache.h"
|
||||
|
||||
class BillboardOverlay : public Base3DOverlay {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <GlowEffect.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <StreamUtils.h>
|
||||
|
||||
#include "Circle3DOverlay.h"
|
||||
#include "renderer/GlowEffect.h"
|
||||
|
||||
Circle3DOverlay::Circle3DOverlay() :
|
||||
_startAt(0.0f),
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QGLWidget>
|
||||
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <StreamUtils.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Cube3DOverlay.h"
|
||||
#include "renderer/GlowEffect.h"
|
||||
|
||||
Cube3DOverlay::Cube3DOverlay() : _borderSize(0) {
|
||||
}
|
||||
|
@ -74,7 +76,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
glPushMatrix();
|
||||
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
glScalef(dimensions.x * _borderSize, dimensions.y * _borderSize, dimensions.z * _borderSize);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||
glPopMatrix();
|
||||
glDepthMask(GL_TRUE);
|
||||
}
|
||||
|
@ -82,7 +84,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
glPushMatrix();
|
||||
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||
glPopMatrix();
|
||||
} else {
|
||||
glLineWidth(_lineWidth);
|
||||
|
@ -116,7 +118,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
|
||||
} else {
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(1.0f);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f);
|
||||
}
|
||||
}
|
||||
glPopMatrix();
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
// 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 "Grid3DOverlay.h"
|
||||
|
||||
ProgramObject Grid3DOverlay::_gridProgram;
|
||||
|
||||
|
@ -36,7 +37,7 @@ void Grid3DOverlay::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
#include <glm/glm.hpp>
|
||||
|
||||
#include <QGLWidget>
|
||||
|
||||
#include <ProgramObject.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Base3DOverlay.h"
|
||||
|
||||
#include "renderer/ProgramObject.h"
|
||||
|
||||
class Grid3DOverlay : public Base3DOverlay {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
// include this before QGLWidget, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <GlowEffect.h>
|
||||
|
||||
#include "Line3DOverlay.h"
|
||||
#include "renderer/GlowEffect.h"
|
||||
|
||||
|
||||
Line3DOverlay::Line3DOverlay() {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <GlowEffect.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
#include "LocalModelsOverlay.h"
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
#include <QGLWidget>
|
||||
#include <QScriptValue>
|
||||
|
||||
#include <Application.h>
|
||||
#include <GlowEffect.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "LocalVoxelsOverlay.h"
|
||||
#include "voxels/VoxelSystem.h"
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <GlowEffect.h>
|
||||
|
||||
#include "../../Menu.h"
|
||||
|
||||
#include "ModelOverlay.h"
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#ifndef hifi_ModelOverlay_h
|
||||
#define hifi_ModelOverlay_h
|
||||
|
||||
#include "Base3DOverlay.h"
|
||||
#include <Model.h>
|
||||
|
||||
#include "../../renderer/Model.h"
|
||||
#include "Base3DOverlay.h"
|
||||
|
||||
class ModelOverlay : public Base3DOverlay {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QGLWidget>
|
||||
|
||||
#include <GlowEffect.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Rectangle3DOverlay.h"
|
||||
#include "renderer/GlowEffect.h"
|
||||
|
||||
Rectangle3DOverlay::Rectangle3DOverlay() {
|
||||
}
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QGLWidget>
|
||||
|
||||
#include <GlowEffect.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Sphere3DOverlay.h"
|
||||
#include "Application.h"
|
||||
#include "renderer/GlowEffect.h"
|
||||
|
||||
Sphere3DOverlay::Sphere3DOverlay() {
|
||||
}
|
||||
|
@ -61,7 +62,6 @@ void Sphere3DOverlay::render(RenderArgs* args) {
|
|||
glm::vec3 positionToCenter = center - position;
|
||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
//Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||
if (_isSolid) {
|
||||
DependencyManager::get<GeometryCache>()->renderSphere(1.0f, SLICES, SLICES);
|
||||
} else {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <GlowEffect.h>
|
||||
#include <VoxelConstants.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
@ -36,7 +37,7 @@ VoxelFade::VoxelFade(FadeDirection direction, float red, float green, float blue
|
|||
}
|
||||
|
||||
void VoxelFade::render() {
|
||||
Application::getInstance()->getGlowEffect()->begin();
|
||||
DependencyManager::get<GlowEffect>()->begin();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glPushMatrix();
|
||||
|
@ -52,7 +53,7 @@ void VoxelFade::render() {
|
|||
glEnable(GL_LIGHTING);
|
||||
|
||||
|
||||
Application::getInstance()->getGlowEffect()->end();
|
||||
DependencyManager::get<GlowEffect>()->end();
|
||||
|
||||
opacity *= (direction == FADE_OUT) ? FADE_OUT_STEP : FADE_IN_STEP;
|
||||
}
|
||||
|
|
|
@ -14,18 +14,20 @@
|
|||
#include <iostream> // to load voxels from file
|
||||
#include <fstream> // to load voxels from file
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <OctalCode.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
#include <ProgramObject.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NodeList.h>
|
||||
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "Application.h"
|
||||
#include "InterfaceConfig.h"
|
||||
#include "Menu.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include "VoxelConstants.h"
|
||||
#include "VoxelSystem.h"
|
||||
|
||||
|
@ -371,9 +373,9 @@ void VoxelSystem::initVoxelMemory() {
|
|||
// create our simple fragment shader if we're the first system to init
|
||||
if (!_program.isLinked()) {
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/voxel.vert");
|
||||
PathUtils::resourcesPath() + "shaders/voxel.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/voxel.frag");
|
||||
PathUtils::resourcesPath() + "shaders/voxel.frag");
|
||||
_program.link();
|
||||
}
|
||||
_initialized = true;
|
||||
|
@ -1644,9 +1646,9 @@ unsigned long VoxelSystem::getVoxelMemoryUsageGPU() {
|
|||
void VoxelSystem::bindPerlinModulateProgram() {
|
||||
if (!_perlinModulateProgram.isLinked()) {
|
||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/perlin_modulate.vert");
|
||||
PathUtils::resourcesPath() + "shaders/perlin_modulate.vert");
|
||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/perlin_modulate.frag");
|
||||
PathUtils::resourcesPath() + "shaders/perlin_modulate.frag");
|
||||
_perlinModulateProgram.link();
|
||||
|
||||
_perlinModulateProgram.bind();
|
||||
|
|
|
@ -15,30 +15,31 @@
|
|||
#include <QScriptEngine>
|
||||
#include <QScriptValue>
|
||||
|
||||
#include <ResourceCache.h>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <FBXReader.h>
|
||||
#include <ResourceCache.h>
|
||||
|
||||
class Animation;
|
||||
|
||||
typedef QSharedPointer<Animation> AnimationPointer;
|
||||
|
||||
/// Scriptable interface for FBX animation loading.
|
||||
class AnimationCache : public ResourceCache {
|
||||
class AnimationCache : public ResourceCache, public DependencyManager::Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
AnimationCache(QObject* parent = NULL);
|
||||
|
||||
Q_INVOKABLE AnimationPointer getAnimation(const QString& url) { return getAnimation(QUrl(url)); }
|
||||
|
||||
Q_INVOKABLE AnimationPointer getAnimation(const QUrl& url);
|
||||
|
||||
protected:
|
||||
|
||||
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() { }
|
||||
friend class DependencyManager;
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(AnimationPointer)
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
float getNextOutputFrameLoudness() const;
|
||||
|
||||
int samplesAvailable() const;
|
||||
int framesAvailable() const { return samplesAvailable() / _numFrameSamples; }
|
||||
int framesAvailable() const { return (_numFrameSamples == 0) ? 0 : samplesAvailable() / _numFrameSamples; }
|
||||
|
||||
int getNumFrameSamples() const { return _numFrameSamples; }
|
||||
|
||||
|
|
|
@ -103,6 +103,10 @@ EntityItem::EntityItem(const EntityItemID& entityItemID, const EntityItemPropert
|
|||
_created = properties.getCreated() < now ? properties.getCreated() : now;
|
||||
_lastEdited = _lastEditedFromRemote = _lastSimulated = _lastUpdated = _lastEditedFromRemoteInRemoteTime = _created;
|
||||
_physicsInfo = NULL;
|
||||
_lastEditedFromRemote = 0;
|
||||
_lastEditedFromRemoteInRemoteTime = 0;
|
||||
_lastSimulated = 0;
|
||||
_lastUpdated = 0;
|
||||
_dirtyFlags = 0;
|
||||
_changedOnServer = 0;
|
||||
initFromEntityItemID(entityItemID);
|
||||
|
@ -371,6 +375,8 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
createdFromBuffer -= clockSkew;
|
||||
|
||||
if (createdFromBuffer < _created) {
|
||||
// the server claims that this entity has an older creation time
|
||||
// so we accept it and clear _lastEdited
|
||||
_created = createdFromBuffer;
|
||||
_lastEdited = 0;
|
||||
}
|
||||
|
@ -584,7 +590,7 @@ void EntityItem::simulate(const quint64& now) {
|
|||
float timeElapsed = (float)(now - _lastSimulated) / (float)(USECS_PER_SECOND);
|
||||
|
||||
if (wantDebug) {
|
||||
qDebug() << "********** EntityItem::update()";
|
||||
qDebug() << "********** EntityItem::simulate()";
|
||||
qDebug() << " entity ID=" << getEntityItemID();
|
||||
qDebug() << " now=" << now;
|
||||
qDebug() << " _lastSimulated=" << _lastSimulated;
|
||||
|
@ -621,7 +627,7 @@ void EntityItem::simulate(const quint64& now) {
|
|||
}
|
||||
|
||||
if (wantDebug) {
|
||||
qDebug() << " ********** EntityItem::update() .... SETTING _lastSimulated=" << _lastSimulated;
|
||||
qDebug() << " ********** EntityItem::simulate() .... SETTING _lastSimulated=" << _lastSimulated;
|
||||
}
|
||||
|
||||
if (!_physicsInfo) {
|
||||
|
@ -705,14 +711,33 @@ void EntityItem::simulate(const quint64& now) {
|
|||
qDebug() << " newVelocity:" << velocity;
|
||||
}
|
||||
}
|
||||
|
||||
if (wantDebug) {
|
||||
qDebug() << " velocity AFTER dampingResistance:" << velocity;
|
||||
qDebug() << " glm::length(velocity):" << glm::length(velocity);
|
||||
qDebug() << " EPSILON_VELOCITY_LENGTH:" << EPSILON_VELOCITY_LENGTH;
|
||||
}
|
||||
|
||||
// round velocity to zero if it's close enough...
|
||||
}
|
||||
}
|
||||
|
||||
if (hasVelocity()) {
|
||||
glm::vec3 position = getPosition();
|
||||
glm::vec3 velocity = getVelocity();
|
||||
glm::vec3 newPosition = position + (velocity * timeElapsed);
|
||||
|
||||
if (wantDebug) {
|
||||
qDebug() << " EntityItem::simulate()....";
|
||||
qDebug() << " timeElapsed:" << timeElapsed;
|
||||
qDebug() << " old AACube:" << getMaximumAACube();
|
||||
qDebug() << " old position:" << position;
|
||||
qDebug() << " old velocity:" << velocity;
|
||||
qDebug() << " old getAABox:" << getAABox();
|
||||
qDebug() << " getDistanceToBottomOfEntity():" << getDistanceToBottomOfEntity() * (float)TREE_SCALE << " in meters";
|
||||
qDebug() << " newPosition:" << newPosition;
|
||||
qDebug() << " glm::distance(newPosition, position):" << glm::distance(newPosition, position);
|
||||
}
|
||||
|
||||
position = newPosition;
|
||||
|
||||
// handle bounces off the ground... We bounce at the distance to the bottom of our entity
|
||||
if (position.y <= getDistanceToBottomOfEntity()) {
|
||||
velocity = velocity * glm::vec3(1,-1,1);
|
||||
|
||||
// if we've slowed considerably, then just stop moving
|
||||
if (glm::length(velocity) <= EPSILON_VELOCITY_LENGTH) {
|
||||
velocity = NO_VELOCITY;
|
||||
}
|
||||
|
@ -721,6 +746,26 @@ void EntityItem::simulate(const quint64& now) {
|
|||
setPosition(position); // this will automatically recalculate our collision shape
|
||||
setVelocity(velocity);
|
||||
|
||||
position.y = getDistanceToBottomOfEntity();
|
||||
}
|
||||
|
||||
// handle gravity....
|
||||
if (hasGravity()) {
|
||||
// handle resting on surface case, this is definitely a bit of a hack, and it only works on the
|
||||
// "ground" plane of the domain, but for now it what we've got
|
||||
if (isRestingOnSurface()) {
|
||||
velocity.y = 0.0f;
|
||||
position.y = getDistanceToBottomOfEntity();
|
||||
} else {
|
||||
velocity += getGravity() * timeElapsed;
|
||||
}
|
||||
}
|
||||
|
||||
// handle damping for velocity
|
||||
float dampingTimescale = getDamping();
|
||||
if (dampingTimescale > 0.0f) {
|
||||
float dampingFactor = glm::clamp(timeElapsed / dampingTimescale, 0.0f, 1.0f);
|
||||
velocity *= (1.0f - dampingFactor);
|
||||
if (wantDebug) {
|
||||
qDebug() << " new position:" << position;
|
||||
qDebug() << " new velocity:" << velocity;
|
||||
|
@ -734,7 +779,7 @@ void EntityItem::simulate(const quint64& now) {
|
|||
}
|
||||
|
||||
bool EntityItem::isMoving() const {
|
||||
return hasVelocity() || (hasGravity() && !isRestingOnSurface()) || hasAngularVelocity();
|
||||
return hasVelocity() || hasAngularVelocity();
|
||||
}
|
||||
|
||||
bool EntityItem::lifetimeHasExpired() const {
|
||||
|
@ -823,7 +868,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties, bool forc
|
|||
"now=" << now << " getLastEdited()=" << getLastEdited();
|
||||
}
|
||||
// don't allow _lastEdited to be in the future
|
||||
setLastEdited( properties._lastEdited < now ? properties._lastEdited : now);
|
||||
setLastEdited(properties._lastEdited < now ? properties._lastEdited : now);
|
||||
if (getDirtyFlags() & EntityItem::DIRTY_POSITION) {
|
||||
_lastSimulated = usecTimestampNow();
|
||||
}
|
||||
|
|
|
@ -121,9 +121,6 @@ public:
|
|||
|
||||
static int expectedBytes();
|
||||
|
||||
static bool encodeEntityEditMessageDetails(PacketType command, EntityItemID id, const EntityItemProperties& details,
|
||||
unsigned char* bufferOut, int sizeIn, int& sizeOut);
|
||||
|
||||
static void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, size_t length, int clockSkew);
|
||||
|
||||
// perform update
|
||||
|
|
|
@ -129,6 +129,8 @@ EntityItem* EntityTypes::constructEntityItem(const unsigned char* data, int byte
|
|||
EntityItemID tempEntityID(actualID);
|
||||
EntityItemProperties tempProperties;
|
||||
|
||||
// we set the Creation and Edit times to 'now', but if the server submits an earlier Creation time
|
||||
// then it will be accepted
|
||||
quint64 now = usecTimestampNow();
|
||||
tempProperties.setCreated(now);
|
||||
tempProperties.setLastEdited(now);
|
||||
|
|
|
@ -285,7 +285,6 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
|||
|
||||
|
||||
QMap<QString, AnimationPointer> ModelEntityItem::_loadedAnimations; // TODO: improve cleanup by leveraging the AnimationPointer(s)
|
||||
AnimationCache ModelEntityItem::_animationCache;
|
||||
|
||||
// This class/instance will cleanup the animations once unloaded.
|
||||
class EntityAnimationsBookkeeper {
|
||||
|
@ -309,7 +308,7 @@ Animation* ModelEntityItem::getAnimation(const QString& url) {
|
|||
|
||||
// if we don't already have this model then create it and initialize it
|
||||
if (_loadedAnimations.find(url) == _loadedAnimations.end()) {
|
||||
animation = _animationCache.getAnimation(url);
|
||||
animation = DependencyManager::get<AnimationCache>()->getAnimation(url);
|
||||
_loadedAnimations[url] = animation;
|
||||
} else {
|
||||
animation = _loadedAnimations[url];
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <OpenGL/glext.h>
|
||||
|
||||
#elif defined(WIN32)
|
||||
#include <windowshacks.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/wglew.h>
|
||||
|
||||
|
|
|
@ -28,9 +28,13 @@ ResourceCache::ResourceCache(QObject* parent) :
|
|||
}
|
||||
|
||||
ResourceCache::~ResourceCache() {
|
||||
// make sure our unused resources know we're out of commission
|
||||
foreach (const QSharedPointer<Resource>& resource, _unusedResources) {
|
||||
resource->setCache(NULL);
|
||||
// the unused resources may themselves reference resources that will be added to the unused
|
||||
// list on destruction, so keep clearing until there are no references left
|
||||
while (!_unusedResources.isEmpty()) {
|
||||
foreach (const QSharedPointer<Resource>& resource, _unusedResources) {
|
||||
resource->setCache(NULL);
|
||||
}
|
||||
_unusedResources.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,8 @@ void PhysicsEngine::init(EntityEditPacketSender* packetSender) {
|
|||
for (int i = 0; i < 3; ++i) {
|
||||
btVector3 normal(0.0f, 0.0f, 0.0f);
|
||||
normal[i] = 1.0f;
|
||||
btCollisionShape* plane = new btStaticPlaneShape(normal, 0.0f);
|
||||
//btCollisionShape* plane = new btStaticPlaneShape(normal, 0.0f);
|
||||
btCollisionShape* plane = new btStaticPlaneShape(normal, 0.5f);
|
||||
|
||||
btCollisionObject* groundObject = new btCollisionObject();
|
||||
groundObject->setCollisionFlags(btCollisionObject::CF_STATIC_OBJECT);
|
||||
|
|
37
libraries/render-utils/CMakeLists.txt
Normal file
37
libraries/render-utils/CMakeLists.txt
Normal file
|
@ -0,0 +1,37 @@
|
|||
set(TARGET_NAME render-utils)
|
||||
|
||||
# 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()
|
|
@ -10,29 +10,31 @@
|
|||
//
|
||||
|
||||
// include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QOpenGLFramebufferObject>
|
||||
|
||||
#include <glm/gtc/random.hpp>
|
||||
|
||||
#include <PathUtils.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "AmbientOcclusionEffect.h"
|
||||
#include "GlowEffect.h"
|
||||
#include "ProgramObject.h"
|
||||
#include "RenderUtil.h"
|
||||
|
||||
#include "AmbientOcclusionEffect.h"
|
||||
#include "TextureCache.h"
|
||||
|
||||
const int ROTATION_WIDTH = 4;
|
||||
const int ROTATION_HEIGHT = 4;
|
||||
|
||||
void AmbientOcclusionEffect::init() {
|
||||
void AmbientOcclusionEffect::init(ViewStateInterface* viewState) {
|
||||
_viewState = viewState; // we will use this for view state services
|
||||
|
||||
_occlusionProgram = new ProgramObject();
|
||||
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
|
||||
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath()
|
||||
+ "shaders/ambient_occlusion.vert");
|
||||
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
|
||||
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath()
|
||||
+ "shaders/ambient_occlusion.frag");
|
||||
_occlusionProgram->link();
|
||||
|
||||
|
@ -82,8 +84,8 @@ void AmbientOcclusionEffect::init() {
|
|||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
_blurProgram = new ProgramObject();
|
||||
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/ambient_occlusion.vert");
|
||||
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/occlusion_blur.frag");
|
||||
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/ambient_occlusion.vert");
|
||||
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/occlusion_blur.frag");
|
||||
_blurProgram->link();
|
||||
|
||||
_blurProgram->bind();
|
||||
|
@ -104,13 +106,12 @@ void AmbientOcclusionEffect::render() {
|
|||
glBindTexture(GL_TEXTURE_2D, _rotationTextureID);
|
||||
|
||||
// render with the occlusion shader to the secondary/tertiary buffer
|
||||
QOpenGLFramebufferObject* freeFBO = Application::getInstance()->getGlowEffect()->getFreeFramebufferObject();
|
||||
QOpenGLFramebufferObject* freeFBO = DependencyManager::get<GlowEffect>()->getFreeFramebufferObject();
|
||||
freeFBO->bind();
|
||||
|
||||
float left, right, bottom, top, nearVal, farVal;
|
||||
glm::vec4 nearClipPlane, farClipPlane;
|
||||
Application::getInstance()->computeOffAxisFrustum(
|
||||
left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
|
||||
_viewState->computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
|
||||
|
||||
int viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
|
@ -12,18 +12,24 @@
|
|||
#ifndef hifi_AmbientOcclusionEffect_h
|
||||
#define hifi_AmbientOcclusionEffect_h
|
||||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
#include "ViewStateInterface.h"
|
||||
|
||||
class ProgramObject;
|
||||
|
||||
/// A screen space ambient occlusion effect. See John Chapman's tutorial at
|
||||
/// http://john-chapman-graphics.blogspot.co.uk/2013/01/ssao-tutorial.html for reference.
|
||||
class AmbientOcclusionEffect {
|
||||
class AmbientOcclusionEffect: public DependencyManager::Dependency {
|
||||
public:
|
||||
|
||||
void init();
|
||||
|
||||
void init(ViewStateInterface* viewState);
|
||||
void render();
|
||||
|
||||
private:
|
||||
AmbientOcclusionEffect() {}
|
||||
virtual ~AmbientOcclusionEffect() {}
|
||||
friend class DependencyManager;
|
||||
|
||||
ProgramObject* _occlusionProgram;
|
||||
int _nearLocation;
|
||||
|
@ -38,6 +44,7 @@ private:
|
|||
int _blurScaleLocation;
|
||||
|
||||
GLuint _rotationTextureID;
|
||||
ViewStateInterface* _viewState;
|
||||
};
|
||||
|
||||
#endif // hifi_AmbientOcclusionEffect_h
|
|
@ -10,11 +10,11 @@
|
|||
//
|
||||
|
||||
#include "AnimationHandle.h"
|
||||
#include "Application.h"
|
||||
#include "Model.h"
|
||||
|
||||
void AnimationHandle::setURL(const QUrl& url) {
|
||||
if (_url != url) {
|
||||
_animation = Application::getInstance()->getAnimationCache()->getAnimation(_url = url);
|
||||
_animation = DependencyManager::get<AnimationCache>()->getAnimation(_url = url);
|
||||
_jointMappings.clear();
|
||||
}
|
||||
}
|
|
@ -10,17 +10,35 @@
|
|||
//
|
||||
|
||||
// include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
|
||||
// TODO: remove these once we migrate away from GLUT calls
|
||||
#if defined(__APPLE__)
|
||||
#include <GLUT/glut.h>
|
||||
#elif defined(WIN32)
|
||||
#include <GL/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#include <QOpenGLFramebufferObject>
|
||||
|
||||
#include "Application.h"
|
||||
#include "DeferredLightingEffect.h"
|
||||
#include "RenderUtil.h"
|
||||
#include <GLMHelpers.h>
|
||||
#include <PathUtils.h>
|
||||
|
||||
void DeferredLightingEffect::init() {
|
||||
_simpleProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/simple.vert");
|
||||
_simpleProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/simple.frag");
|
||||
|
||||
#include "DeferredLightingEffect.h"
|
||||
#include "GeometryCache.h"
|
||||
#include "GlowEffect.h"
|
||||
#include "RenderUtil.h"
|
||||
#include "TextureCache.h"
|
||||
|
||||
|
||||
void DeferredLightingEffect::init(ViewStateInterface* viewState) {
|
||||
_viewState = viewState;
|
||||
_simpleProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/simple.vert");
|
||||
_simpleProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/simple.frag");
|
||||
_simpleProgram.link();
|
||||
|
||||
_simpleProgram.bind();
|
||||
|
@ -39,7 +57,7 @@ void DeferredLightingEffect::init() {
|
|||
void DeferredLightingEffect::bindSimpleProgram() {
|
||||
DependencyManager::get<TextureCache>()->setPrimaryDrawBuffers(true, true, true);
|
||||
_simpleProgram.bind();
|
||||
_simpleProgram.setUniformValue(_glowIntensityLocation, Application::getInstance()->getGlowEffect()->getIntensity());
|
||||
_simpleProgram.setUniformValue(_glowIntensityLocation, DependencyManager::get<GlowEffect>()->getIntensity());
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
|
@ -144,7 +162,7 @@ void DeferredLightingEffect::render() {
|
|||
QOpenGLFramebufferObject* primaryFBO = textureCache->getPrimaryFramebufferObject();
|
||||
primaryFBO->release();
|
||||
|
||||
QOpenGLFramebufferObject* freeFBO = Application::getInstance()->getGlowEffect()->getFreeFramebufferObject();
|
||||
QOpenGLFramebufferObject* freeFBO = DependencyManager::get<GlowEffect>()->getFreeFramebufferObject();
|
||||
freeFBO->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
@ -173,19 +191,18 @@ void DeferredLightingEffect::render() {
|
|||
|
||||
ProgramObject* program = &_directionalLight;
|
||||
const LightLocations* locations = &_directionalLightLocations;
|
||||
bool shadowsEnabled = Menu::getInstance()->getShadowsEnabled();
|
||||
if (shadowsEnabled) {
|
||||
bool shadowsEnabled = _viewState->getShadowsEnabled();
|
||||
if (shadowsEnabled) {
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
glBindTexture(GL_TEXTURE_2D, textureCache->getShadowDepthTextureID());
|
||||
|
||||
program = &_directionalLightShadowMap;
|
||||
locations = &_directionalLightShadowMapLocations;
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::CascadedShadows)) {
|
||||
if (_viewState->getCascadeShadowsEnabled()) {
|
||||
program = &_directionalLightCascadedShadowMap;
|
||||
locations = &_directionalLightCascadedShadowMapLocations;
|
||||
_directionalLightCascadedShadowMap.bind();
|
||||
_directionalLightCascadedShadowMap.setUniform(locations->shadowDistances,
|
||||
Application::getInstance()->getShadowDistances());
|
||||
_directionalLightCascadedShadowMap.setUniform(locations->shadowDistances, _viewState->getShadowDistances());
|
||||
|
||||
} else {
|
||||
program->bind();
|
||||
|
@ -199,8 +216,7 @@ void DeferredLightingEffect::render() {
|
|||
|
||||
float left, right, bottom, top, nearVal, farVal;
|
||||
glm::vec4 nearClipPlane, farClipPlane;
|
||||
Application::getInstance()->computeOffAxisFrustum(
|
||||
left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
|
||||
_viewState->computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
|
||||
program->setUniformValue(locations->nearLocation, nearVal);
|
||||
float depthScale = (farVal - nearVal) / farVal;
|
||||
program->setUniformValue(locations->depthScale, depthScale);
|
||||
|
@ -235,8 +251,8 @@ void DeferredLightingEffect::render() {
|
|||
// enlarge the scales slightly to account for tesselation
|
||||
const float SCALE_EXPANSION = 0.05f;
|
||||
|
||||
const glm::vec3& eyePoint = Application::getInstance()->getDisplayViewFrustum()->getPosition();
|
||||
float nearRadius = glm::distance(eyePoint, Application::getInstance()->getDisplayViewFrustum()->getNearTopLeft());
|
||||
const glm::vec3& eyePoint = _viewState->getCurrentViewFrustum()->getPosition();
|
||||
float nearRadius = glm::distance(eyePoint, _viewState->getCurrentViewFrustum()->getNearTopLeft());
|
||||
|
||||
GeometryCache* geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
|
@ -394,9 +410,9 @@ void DeferredLightingEffect::render() {
|
|||
}
|
||||
|
||||
void DeferredLightingEffect::loadLightProgram(const char* name, bool limited, ProgramObject& program, LightLocations& locations) {
|
||||
program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() +
|
||||
program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() +
|
||||
(limited ? "shaders/deferred_light_limited.vert" : "shaders/deferred_light.vert"));
|
||||
program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + name);
|
||||
program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + name);
|
||||
program.link();
|
||||
|
||||
program.bind();
|
|
@ -14,17 +14,19 @@
|
|||
|
||||
#include <QVector>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "ProgramObject.h"
|
||||
#include "ViewStateInterface.h"
|
||||
|
||||
class PostLightingRenderable;
|
||||
|
||||
/// Handles deferred lighting for the bits that require it (voxels, metavoxels...)
|
||||
class DeferredLightingEffect {
|
||||
class DeferredLightingEffect: public DependencyManager::Dependency {
|
||||
public:
|
||||
|
||||
void init();
|
||||
void init(ViewStateInterface* viewState);
|
||||
|
||||
/// Returns a reference to a simple program suitable for rendering static
|
||||
/// untextured geometry (such as that generated by glutSolidSphere, etc.)
|
||||
|
@ -69,6 +71,9 @@ public:
|
|||
void render();
|
||||
|
||||
private:
|
||||
DeferredLightingEffect() { }
|
||||
virtual ~DeferredLightingEffect() { }
|
||||
friend class DependencyManager;
|
||||
|
||||
class LightLocations {
|
||||
public:
|
||||
|
@ -119,6 +124,8 @@ private:
|
|||
QVector<PointLight> _pointLights;
|
||||
QVector<SpotLight> _spotLights;
|
||||
QVector<PostLightingRenderable*> _postLightingRenderables;
|
||||
|
||||
ViewStateInterface* _viewState;
|
||||
};
|
||||
|
||||
/// Simple interface for objects that require something to be rendered after deferred lighting.
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "GeometryCache.h"
|
||||
#include "TextureCache.h"
|
||||
#include "GeometryCache.h"
|
||||
|
||||
GeometryCache::GeometryCache() {
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
#define hifi_GeometryCache_h
|
||||
|
||||
// include this before QOpenGLBuffer, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QOpenGLBuffer>
|
|
@ -10,22 +10,28 @@
|
|||
//
|
||||
|
||||
// include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QGLWidget>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QWindow>
|
||||
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "GlowEffect.h"
|
||||
#include "ProgramObject.h"
|
||||
#include "RenderUtil.h"
|
||||
#include "TextureCache.h"
|
||||
|
||||
|
||||
GlowEffect::GlowEffect()
|
||||
: _initialized(false),
|
||||
_isOddFrame(false),
|
||||
_isFirstFrame(true),
|
||||
_intensity(0.0f) {
|
||||
_intensity(0.0f),
|
||||
_widget(NULL),
|
||||
_enabled(false) {
|
||||
}
|
||||
|
||||
GlowEffect::~GlowEffect() {
|
||||
|
@ -47,7 +53,7 @@ QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const {
|
|||
|
||||
static ProgramObject* createProgram(const QString& name) {
|
||||
ProgramObject* program = new ProgramObject();
|
||||
program->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/" + name + ".frag");
|
||||
program->addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/" + name + ".frag");
|
||||
program->link();
|
||||
|
||||
program->bind();
|
||||
|
@ -57,7 +63,7 @@ static ProgramObject* createProgram(const QString& name) {
|
|||
return program;
|
||||
}
|
||||
|
||||
void GlowEffect::init() {
|
||||
void GlowEffect::init(QGLWidget* widget, bool enabled) {
|
||||
if (_initialized) {
|
||||
qDebug("[ERROR] GlowEffeect is already initialized.");
|
||||
return;
|
||||
|
@ -85,8 +91,19 @@ void GlowEffect::init() {
|
|||
_diffusionScaleLocation = _diffuseProgram->uniformLocation("diffusionScale");
|
||||
|
||||
_initialized = true;
|
||||
_widget = widget;
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
int GlowEffect::getDeviceWidth() const {
|
||||
return _widget->width() * (_widget->windowHandle() ? _widget->windowHandle()->devicePixelRatio() : 1.0f);
|
||||
}
|
||||
|
||||
int GlowEffect::getDeviceHeight() const {
|
||||
return _widget->height() * (_widget->windowHandle() ? _widget->windowHandle()->devicePixelRatio() : 1.0f);
|
||||
}
|
||||
|
||||
|
||||
void GlowEffect::prepare() {
|
||||
DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
@ -140,15 +157,14 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
|||
|
||||
QOpenGLFramebufferObject* destFBO = toTexture ?
|
||||
textureCache->getSecondaryFramebufferObject() : NULL;
|
||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect) || _isEmpty) {
|
||||
if (!_enabled || _isEmpty) {
|
||||
// copy the primary to the screen
|
||||
if (destFBO && QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) {
|
||||
QOpenGLFramebufferObject::blitFramebuffer(destFBO, primaryFBO);
|
||||
} else {
|
||||
maybeBind(destFBO);
|
||||
if (!destFBO) {
|
||||
glViewport(0, 0, Application::getInstance()->getGLWidget()->getDeviceWidth(),
|
||||
Application::getInstance()->getGLWidget()->getDeviceHeight());
|
||||
glViewport(0, 0, getDeviceWidth(), getDeviceHeight());
|
||||
}
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
@ -195,9 +211,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
|||
}
|
||||
maybeBind(destFBO);
|
||||
if (!destFBO) {
|
||||
glViewport(0, 0,
|
||||
Application::getInstance()->getGLWidget()->getDeviceWidth(),
|
||||
Application::getInstance()->getGLWidget()->getDeviceHeight());
|
||||
glViewport(0, 0, getDeviceWidth(), getDeviceHeight());
|
||||
}
|
||||
_addSeparateProgram->bind();
|
||||
renderFullscreenQuad();
|
||||
|
@ -224,11 +238,15 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
|
|||
return destFBO;
|
||||
}
|
||||
|
||||
void GlowEffect::toggleGlowEffect(bool enabled) {
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
Glower::Glower(float amount) {
|
||||
Application::getInstance()->getGlowEffect()->begin(amount);
|
||||
DependencyManager::get<GlowEffect>()->begin(amount);
|
||||
}
|
||||
|
||||
Glower::~Glower() {
|
||||
Application::getInstance()->getGlowEffect()->end();
|
||||
DependencyManager::get<GlowEffect>()->end();
|
||||
}
|
||||
|
|
@ -12,26 +12,29 @@
|
|||
#ifndef hifi_GlowEffect_h
|
||||
#define hifi_GlowEffect_h
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QGLWidget>
|
||||
#include <QStack>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
class QOpenGLFramebufferObject;
|
||||
|
||||
class ProgramObject;
|
||||
|
||||
/// A generic full screen glow effect.
|
||||
class GlowEffect : public QObject {
|
||||
class GlowEffect : public QObject, public DependencyManager::Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GlowEffect();
|
||||
~GlowEffect();
|
||||
|
||||
|
||||
/// Returns a pointer to the framebuffer object that the glow effect is *not* using for persistent state
|
||||
/// (either the secondary or the tertiary).
|
||||
QOpenGLFramebufferObject* getFreeFramebufferObject() const;
|
||||
|
||||
void init();
|
||||
void init(QGLWidget* widget, bool enabled);
|
||||
|
||||
/// Prepares the glow effect for rendering the current frame. To be called before rendering the scene.
|
||||
void prepare();
|
||||
|
@ -51,7 +54,16 @@ public:
|
|||
/// \return the framebuffer object to which we rendered, or NULL if to the frame buffer
|
||||
QOpenGLFramebufferObject* render(bool toTexture = false);
|
||||
|
||||
public slots:
|
||||
void toggleGlowEffect(bool enabled);
|
||||
|
||||
private:
|
||||
GlowEffect();
|
||||
virtual ~GlowEffect();
|
||||
friend class DependencyManager;
|
||||
|
||||
int getDeviceWidth() const;
|
||||
int getDeviceHeight() const;
|
||||
|
||||
bool _initialized;
|
||||
|
||||
|
@ -69,6 +81,8 @@ private:
|
|||
|
||||
float _intensity;
|
||||
QStack<float> _intensityStack;
|
||||
QGLWidget* _widget;
|
||||
bool _enabled;
|
||||
};
|
||||
|
||||
/// RAII-style glow handler. Applies glow when in scope.
|
|
@ -9,6 +9,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QRunnable>
|
||||
#include <QThreadPool>
|
||||
|
@ -18,17 +20,20 @@
|
|||
|
||||
#include <CapsuleShape.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <gpu/Batch.h>
|
||||
#include <gpu/GLBackend.h>
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
#include <PhysicsEntity.h>
|
||||
#include <ShapeCollider.h>
|
||||
#include <SphereShape.h>
|
||||
|
||||
#include "AnimationHandle.h"
|
||||
#include "Application.h"
|
||||
#include "DeferredLightingEffect.h"
|
||||
#include "GlowEffect.h"
|
||||
#include "Model.h"
|
||||
|
||||
#include "gpu/Batch.h"
|
||||
#include "gpu/GLBackend.h"
|
||||
|
||||
#define GLBATCH( call ) batch._##call
|
||||
//#define GLBATCH( call ) call
|
||||
|
||||
|
@ -58,7 +63,9 @@ Model::Model(QObject* parent) :
|
|||
_meshGroupsKnown(false) {
|
||||
|
||||
// we may have been created in the network thread, but we live in the main thread
|
||||
moveToThread(Application::getInstance()->thread());
|
||||
if (_viewState) {
|
||||
moveToThread(_viewState->getMainThread());
|
||||
}
|
||||
}
|
||||
|
||||
Model::~Model() {
|
||||
|
@ -104,6 +111,8 @@ Model::SkinLocations Model::_skinNormalSpecularMapLocations;
|
|||
Model::SkinLocations Model::_skinShadowLocations;
|
||||
Model::SkinLocations Model::_skinTranslucentLocations;
|
||||
|
||||
ViewStateInterface* Model::_viewState = NULL;
|
||||
|
||||
void Model::setScale(const glm::vec3& scale) {
|
||||
setScaleInternal(scale);
|
||||
// if anyone sets scale manually, then we are no longer scaled to fit
|
||||
|
@ -222,109 +231,109 @@ void Model::initJointTransforms() {
|
|||
|
||||
void Model::init() {
|
||||
if (!_program.isLinked()) {
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/model.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/model.frag");
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/model.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/model.frag");
|
||||
|
||||
initProgram(_program, _locations);
|
||||
|
||||
_normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model_normal_map.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model_normal_map.vert");
|
||||
_normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_normal_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_normal_map.frag");
|
||||
|
||||
initProgram(_normalMapProgram, _normalMapLocations);
|
||||
|
||||
_specularMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model.vert");
|
||||
_specularMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_specular_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_specular_map.frag");
|
||||
|
||||
initProgram(_specularMapProgram, _specularMapLocations);
|
||||
|
||||
_normalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model_normal_map.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model_normal_map.vert");
|
||||
_normalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_normal_specular_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_normal_specular_map.frag");
|
||||
|
||||
initProgram(_normalSpecularMapProgram, _normalSpecularMapLocations);
|
||||
|
||||
_translucentProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model.vert");
|
||||
_translucentProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_translucent.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_translucent.frag");
|
||||
|
||||
initProgram(_translucentProgram, _translucentLocations);
|
||||
|
||||
// Lightmap
|
||||
_lightmapProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/model_lightmap.vert");
|
||||
_lightmapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/model_lightmap.frag");
|
||||
_lightmapProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/model_lightmap.vert");
|
||||
_lightmapProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/model_lightmap.frag");
|
||||
|
||||
initProgram(_lightmapProgram, _lightmapLocations);
|
||||
|
||||
_lightmapNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model_lightmap_normal_map.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model_lightmap_normal_map.vert");
|
||||
_lightmapNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_lightmap_normal_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_lightmap_normal_map.frag");
|
||||
|
||||
initProgram(_lightmapNormalMapProgram, _lightmapNormalMapLocations);
|
||||
|
||||
_lightmapSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model_lightmap.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model_lightmap.vert");
|
||||
_lightmapSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_lightmap_specular_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_lightmap_specular_map.frag");
|
||||
|
||||
initProgram(_lightmapSpecularMapProgram, _lightmapSpecularMapLocations);
|
||||
|
||||
_lightmapNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/model_lightmap_normal_map.vert");
|
||||
PathUtils::resourcesPath() + "shaders/model_lightmap_normal_map.vert");
|
||||
_lightmapNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_lightmap_normal_specular_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_lightmap_normal_specular_map.frag");
|
||||
|
||||
initProgram(_lightmapNormalSpecularMapProgram, _lightmapNormalSpecularMapLocations);
|
||||
// end lightmap
|
||||
|
||||
|
||||
_shadowProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/model_shadow.vert");
|
||||
_shadowProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/model_shadow.vert");
|
||||
_shadowProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_shadow.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_shadow.frag");
|
||||
|
||||
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/skin_model.vert");
|
||||
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/model.frag");
|
||||
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/skin_model.vert");
|
||||
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/model.frag");
|
||||
|
||||
initSkinProgram(_skinProgram, _skinLocations);
|
||||
|
||||
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/skin_model_normal_map.vert");
|
||||
PathUtils::resourcesPath() + "shaders/skin_model_normal_map.vert");
|
||||
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_normal_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_normal_map.frag");
|
||||
|
||||
initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations);
|
||||
|
||||
_skinSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/skin_model.vert");
|
||||
PathUtils::resourcesPath() + "shaders/skin_model.vert");
|
||||
_skinSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_specular_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_specular_map.frag");
|
||||
|
||||
initSkinProgram(_skinSpecularMapProgram, _skinSpecularMapLocations);
|
||||
|
||||
_skinNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/skin_model_normal_map.vert");
|
||||
PathUtils::resourcesPath() + "shaders/skin_model_normal_map.vert");
|
||||
_skinNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_normal_specular_map.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_normal_specular_map.frag");
|
||||
|
||||
initSkinProgram(_skinNormalSpecularMapProgram, _skinNormalSpecularMapLocations);
|
||||
|
||||
_skinShadowProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/skin_model_shadow.vert");
|
||||
PathUtils::resourcesPath() + "shaders/skin_model_shadow.vert");
|
||||
_skinShadowProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_shadow.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_shadow.frag");
|
||||
|
||||
initSkinProgram(_skinShadowProgram, _skinShadowLocations);
|
||||
|
||||
_skinTranslucentProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/skin_model.vert");
|
||||
PathUtils::resourcesPath() + "shaders/skin_model.vert");
|
||||
_skinTranslucentProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
Application::resourcesPath() + "shaders/model_translucent.frag");
|
||||
PathUtils::resourcesPath() + "shaders/model_translucent.frag");
|
||||
|
||||
initSkinProgram(_skinTranslucentProgram, _skinTranslucentLocations);
|
||||
}
|
||||
|
@ -491,7 +500,7 @@ bool Model::renderTriangleProxies() {
|
|||
glPushMatrix();
|
||||
glTranslatef(center.x, center.y, center.z);
|
||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(1.0f);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderWireCube(1.0f);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -712,6 +721,9 @@ bool Model::render(float alpha, RenderMode mode, RenderArgs* args) {
|
|||
|
||||
bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) {
|
||||
PROFILE_RANGE(__FUNCTION__);
|
||||
if (!_viewState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let's introduce a gpu::Batch to capture all the calls to the graphics api
|
||||
_renderBatch.clear();
|
||||
|
@ -722,7 +734,7 @@ bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) {
|
|||
if (_transforms.empty()) {
|
||||
_transforms.push_back(Transform());
|
||||
}
|
||||
_transforms[0] = Application::getInstance()->getViewTransform();
|
||||
_transforms[0] = _viewState->getViewTransform();
|
||||
// apply entity translation offset to the viewTransform in one go (it's a preTranslate because viewTransform goes from world to eye space)
|
||||
_transforms[0].preTranslate(-_translation);
|
||||
|
||||
|
@ -865,7 +877,7 @@ bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) {
|
|||
}
|
||||
|
||||
// restore all the default material settings
|
||||
Application::getInstance()->setupWorldLight();
|
||||
_viewState->setupWorldLight();
|
||||
|
||||
if (args) {
|
||||
args->_translucentMeshPartsRendered = translucentMeshPartsRendered;
|
||||
|
@ -1665,7 +1677,7 @@ void Model::setupBatchTransform(gpu::Batch& batch) {
|
|||
if (_transforms.empty()) {
|
||||
_transforms.push_back(Transform());
|
||||
}
|
||||
_transforms[0] = Application::getInstance()->getViewTransform();
|
||||
_transforms[0] = _viewState->getViewTransform();
|
||||
_transforms[0].preTranslate(-_translation);
|
||||
batch.setViewTransform(_transforms[0]);
|
||||
}
|
||||
|
@ -1825,7 +1837,7 @@ void Model::endScene(RenderMode mode, RenderArgs* args) {
|
|||
}
|
||||
|
||||
// restore all the default material settings
|
||||
Application::getInstance()->setupWorldLight();
|
||||
_viewState->setupWorldLight();
|
||||
|
||||
}
|
||||
|
||||
|
@ -2321,11 +2333,9 @@ int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, fl
|
|||
int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMode mode, bool translucent, float alphaThreshold, RenderArgs* args,
|
||||
Locations* locations, SkinLocations* skinLocations) {
|
||||
PROFILE_RANGE(__FUNCTION__);
|
||||
bool dontCullOutOfViewMeshParts = Menu::getInstance()->isOptionChecked(MenuOption::DontCullOutOfViewMeshParts);
|
||||
bool cullTooSmallMeshParts = !Menu::getInstance()->isOptionChecked(MenuOption::DontCullTooSmallMeshParts);
|
||||
bool dontReduceMaterialSwitches = Menu::getInstance()->isOptionChecked(MenuOption::DontReduceMaterialSwitches);
|
||||
|
||||
TextureCache* textureCache = DependencyManager::get<TextureCache>();
|
||||
GlowEffect* glowEffect = DependencyManager::get<GlowEffect>();
|
||||
QString lastMaterialID;
|
||||
int meshPartsRendered = 0;
|
||||
updateVisibleJointStates();
|
||||
|
@ -2360,11 +2370,10 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
|||
args->_meshesConsidered++;
|
||||
|
||||
if (args->_viewFrustum) {
|
||||
shouldRender = dontCullOutOfViewMeshParts ||
|
||||
args->_viewFrustum->boxInFrustum(_calculatedMeshBoxes.at(i)) != ViewFrustum::OUTSIDE;
|
||||
if (shouldRender && cullTooSmallMeshParts) {
|
||||
shouldRender = args->_viewFrustum->boxInFrustum(_calculatedMeshBoxes.at(i)) != ViewFrustum::OUTSIDE;
|
||||
if (shouldRender) {
|
||||
float distance = args->_viewFrustum->distanceToCamera(_calculatedMeshBoxes.at(i).calcCenter());
|
||||
shouldRender = Menu::getInstance()->shouldRenderMesh(_calculatedMeshBoxes.at(i).getLargestDimension(),
|
||||
shouldRender = !_viewState ? false : _viewState->shouldRenderMesh(_calculatedMeshBoxes.at(i).getLargestDimension(),
|
||||
distance);
|
||||
if (!shouldRender) {
|
||||
args->_meshesTooSmall++;
|
||||
|
@ -2420,7 +2429,7 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
|||
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
||||
|
||||
} else {
|
||||
if (dontReduceMaterialSwitches || lastMaterialID != part.materialID) {
|
||||
if (lastMaterialID != part.materialID) {
|
||||
const bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
qDebug() << "Material Changed ---------------------------------------------";
|
||||
|
@ -2430,7 +2439,7 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
|||
|
||||
glm::vec4 diffuse = glm::vec4(part.diffuseColor, part.opacity);
|
||||
if (!(translucent && alphaThreshold == 0.0f)) {
|
||||
GLBATCH(glAlphaFunc)(GL_EQUAL, diffuse.a = Application::getInstance()->getGlowEffect()->getIntensity());
|
||||
GLBATCH(glAlphaFunc)(GL_EQUAL, diffuse.a = glowEffect->getIntensity());
|
||||
}
|
||||
glm::vec4 specular = glm::vec4(part.specularColor, 1.0f);
|
||||
GLBATCH(glMaterialfv)(GL_FRONT, GL_AMBIENT, (const float*)&diffuse);
|
|
@ -12,23 +12,27 @@
|
|||
#ifndef hifi_Model_h
|
||||
#define hifi_Model_h
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QBitArray>
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include "Transform.h"
|
||||
#include <AABox.h>
|
||||
#include <AnimationCache.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <gpu/Stream.h>
|
||||
#include <gpu/Batch.h>
|
||||
#include <PhysicsEntity.h>
|
||||
#include <Transform.h>
|
||||
|
||||
#include "AnimationHandle.h"
|
||||
#include "GeometryCache.h"
|
||||
#include "InterfaceConfig.h"
|
||||
#include "JointState.h"
|
||||
#include "ProgramObject.h"
|
||||
#include "TextureCache.h"
|
||||
#include "ViewStateInterface.h"
|
||||
|
||||
class QScriptEngine;
|
||||
|
||||
|
@ -36,8 +40,6 @@ class Shape;
|
|||
#include "RenderArgs.h"
|
||||
class ViewFrustum;
|
||||
|
||||
#include "gpu/Stream.h"
|
||||
#include "gpu/Batch.h"
|
||||
|
||||
/// A generic 3D model displaying geometry loaded from a URL.
|
||||
class Model : public QObject, public PhysicsEntity {
|
||||
|
@ -45,6 +47,8 @@ class Model : public QObject, public PhysicsEntity {
|
|||
|
||||
public:
|
||||
|
||||
static void setViewStateInterface(ViewStateInterface* viewState) { _viewState = viewState; }
|
||||
|
||||
Model(QObject* parent = NULL);
|
||||
virtual ~Model();
|
||||
|
||||
|
@ -454,6 +458,9 @@ private:
|
|||
static int renderMeshesForModelsInScene(gpu::Batch& batch, RenderMode mode, bool translucent, float alphaThreshold,
|
||||
bool hasLightmap, bool hasTangents, bool hasSpecular, bool isSkinned, RenderArgs* args);
|
||||
|
||||
|
||||
static ViewStateInterface* _viewState;
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QPointer<Model>)
|
|
@ -9,9 +9,10 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "ProgramObject.h"
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "ProgramObject.h"
|
||||
|
||||
ProgramObject::ProgramObject(QObject* parent) : QGLShaderProgram(parent) {
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include <gpu/GPUConfig.h>
|
||||
#include "RenderUtil.h"
|
||||
|
||||
void renderFullscreenQuad(float sMin, float sMax, float tMin, float tMax) {
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
|
||||
// include this before QGLWidget, which includes an earlier version of OpenGL
|
||||
#include "InterfaceConfig.h"
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QEvent>
|
||||
#include <QGLWidget>
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef hifi_TextureCache_h
|
||||
#define hifi_TextureCache_h
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
|
||||
#include <QImage>
|
||||
#include <QMap>
|
||||
#include <QGLWidget>
|
||||
|
@ -19,8 +21,6 @@
|
|||
#include <DependencyManager.h>
|
||||
#include <ResourceCache.h>
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
class QOpenGLFramebufferObject;
|
||||
|
||||
class NetworkTexture;
|
44
libraries/render-utils/src/ViewStateInterface.h
Normal file
44
libraries/render-utils/src/ViewStateInterface.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// ViewStateInterface.h
|
||||
// interface/src/renderer
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 12/16/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_ViewStateInterface_h
|
||||
#define hifi_ViewStateInterface_h
|
||||
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
class Transform;
|
||||
class QThread;
|
||||
|
||||
/// Interface provided by Application to other objects that need access to the current view state details
|
||||
class ViewStateInterface {
|
||||
public:
|
||||
|
||||
/// Returns the shadow distances for the current view state
|
||||
virtual const glm::vec3& getShadowDistances() const = 0;
|
||||
|
||||
/// Computes the off-axis frustum parameters for the view frustum, taking mirroring into account.
|
||||
virtual void computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal,
|
||||
float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const = 0;
|
||||
|
||||
/// gets the current view frustum for rendering the view state
|
||||
virtual ViewFrustum* getCurrentViewFrustum() = 0;
|
||||
|
||||
virtual bool getShadowsEnabled() = 0;
|
||||
virtual bool getCascadeShadowsEnabled() = 0;
|
||||
|
||||
virtual QThread* getMainThread() = 0;
|
||||
virtual const Transform& getViewTransform() const = 0;
|
||||
virtual void setupWorldLight() = 0;
|
||||
virtual bool shouldRenderMesh(float largestDimension, float distanceToCamera) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // hifi_ViewStateInterface_h
|
|
@ -94,7 +94,6 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam
|
|||
_quatLibrary(),
|
||||
_vec3Library(),
|
||||
_uuidLibrary(),
|
||||
_animationCache(this),
|
||||
_isUserLoaded(false),
|
||||
_arrayBufferClass(new ArrayBufferClass(this))
|
||||
{
|
||||
|
@ -256,7 +255,7 @@ void ScriptEngine::init() {
|
|||
registerGlobalObject("Quat", &_quatLibrary);
|
||||
registerGlobalObject("Vec3", &_vec3Library);
|
||||
registerGlobalObject("Uuid", &_uuidLibrary);
|
||||
registerGlobalObject("AnimationCache", &_animationCache);
|
||||
registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>());
|
||||
|
||||
registerGlobalObject("Voxels", &_voxelsScriptingInterface);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue