cleanup resources directory references by copying beside the executable

This commit is contained in:
Stephen Birarda 2014-03-06 11:46:49 -08:00
parent c737283935
commit b705ec560f
26 changed files with 190 additions and 135 deletions

View file

@ -82,11 +82,8 @@ file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
# have qt5 wrap them and generate the appropriate header files
qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}")
# use the Qt Resource System to bundle in our resources
qt5_add_resources(QRC_RESOURCE_FILE resources/interface.qrc)
# add them to the interface source files
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QRC_RESOURCE_FILE}")
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}")
if (APPLE)
# configure CMake to use a custom Info.plist
@ -100,9 +97,29 @@ if (APPLE)
# set where in the bundle to put the resources file
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/interface.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# grab the directories in resources and put them in the right spot in Resources
file(GLOB RESOURCE_SUBDIRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/resources" "${CMAKE_CURRENT_SOURCE_DIR}/resources/*")
foreach(DIR ${RESOURCE_SUBDIRS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/resources/${DIR}")
FILE(GLOB DIR_CONTENTS "resources/${DIR}/*")
SET_SOURCE_FILES_PROPERTIES(${DIR_CONTENTS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${DIR}")
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${DIR_CONTENTS}")
endif()
endforeach()
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/interface.icns")
endif (APPLE)
elseif()
# remove and then copy the resources files beside the executable
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E remove_directory
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/resources"
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources)
endif()
# create the executable, make it a bundle on OS X
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS})

View file

@ -1,67 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>config/config.json</file>
<file>html/interface-welcome-allsvg.html</file>
<file>icons/backButton.svg</file>
<file>icons/computer.svg</file>
<file>icons/desktop.svg</file>
<file>icons/documents.svg</file>
<file>icons/file.svg</file>
<file>icons/folder.svg</file>
<file>icons/forwardButton.svg</file>
<file>icons/home.svg</file>
<file>icons/raster.svg</file>
<file>icons/toParentButton.svg</file>
<file>icons/voxel.svg</file>
<file>images/body.png</file>
<file>images/close.png</file>
<file>images/head.png</file>
<file>images/hifi-interface-tools-v2-pie.svg</file>
<file>images/mic.svg</file>
<file>images/mute.svg</file>
<file>images/reset.png</file>
<file>info/ApplicationInfo.ini</file>
<file>meshes/defaultAvatar_body.fst</file>
<file>meshes/defaultAvatar_head.fst</file>
<file>meshes/defaultAvatar/body.fbx</file>
<file>meshes/defaultAvatar/body.jpg</file>
<file>meshes/defaultAvatar/head.fbx</file>
<file>meshes/defaultAvatar/tail.jpg</file>
<file>meshes/defaultAvatar/visor.png</file>
<file>shaders/ambient_occlusion.frag</file>
<file>shaders/ambient_occlusion.vert</file>
<file>shaders/diffuse.frag</file>
<file>shaders/glow_add_separate.frag</file>
<file>shaders/glow_add.frag</file>
<file>shaders/grid.frag</file>
<file>shaders/horizontal_blur.frag</file>
<file>shaders/metavoxel_point.vert</file>
<file>shaders/model_normal_map.frag</file>
<file>shaders/model_normal_map.vert</file>
<file>shaders/model.frag</file>
<file>shaders/model.vert</file>
<file>shaders/occlusion_blur.frag</file>
<file>shaders/oculus.frag</file>
<file>shaders/passthrough.vert</file>
<file>shaders/perlin_modulate.frag</file>
<file>shaders/perlin_modulate.vert</file>
<file>shaders/point_size.vert</file>
<file>shaders/shadow_map.frag</file>
<file>shaders/skin_model_normal_map.vert</file>
<file>shaders/skin_model.vert</file>
<file>shaders/SkyFromAtmosphere.frag</file>
<file>shaders/SkyFromAtmosphere.vert</file>
<file>shaders/SkyFromSpace.frag</file>
<file>shaders/SkyFromSpace.vert</file>
<file>shaders/vertical_blur_add.frag</file>
<file>shaders/vertical_blur.frag</file>
<file>sounds/snap.wav</file>
<file>styles/checked.svg</file>
<file>styles/import_dialog.qss</file>
<file>styles/Inconsolata.otf</file>
<file>styles/log_dialog.qss</file>
<file>styles/search.svg</file>
<file>styles/txt-file.svg</file>
<file>styles/unchecked.svg</file>
</qresource>
</RCC>

View file

@ -0,0 +1,77 @@
#version 120
#extension GL_ARB_geometry_shader4 : enable
//
// VOXEL GEOMETRY SHADER
//
// Input: gl_VerticesIn/gl_PositionIn
// GL_POINTS
// Assumes vertex shader has not transformed coordinates
// Each gl_PositionIn is the corner of voxel
// varying voxelSize - which is the voxel size
//
// Note: In vertex shader doesn't do any transform. Therefore passing the 3D world coordinates xyz to us
//
// Output: GL_TRIANGLE_STRIP
//
// Issues:
// how do we need to handle lighting of these colors??
// how do we handle normals?
// check for size=0 and don't output the primitive
//
varying in float voxelSize[1];
const int VERTICES_PER_FACE = 4;
const int COORD_PER_VERTEX = 3;
const int COORD_PER_FACE = COORD_PER_VERTEX * VERTICES_PER_FACE;
void faceOfVoxel(vec4 corner, float scale, float[COORD_PER_FACE] facePoints, vec4 color, vec4 normal) {
for (int v = 0; v < VERTICES_PER_FACE; v++ ) {
vec4 vertex = corner;
for (int c = 0; c < COORD_PER_VERTEX; c++ ) {
int cIndex = c + (v * COORD_PER_VERTEX);
vertex[c] += (facePoints[cIndex] * scale);
}
gl_FrontColor = color * (gl_LightModel.ambient + gl_LightSource[0].ambient +
gl_LightSource[0].diffuse * max(0.0, dot(normal, gl_LightSource[0].position)));
gl_Position = gl_ModelViewProjectionMatrix * vertex;
EmitVertex();
}
EndPrimitive();
}
void main() {
//increment variable
int i;
vec4 corner;
float scale;
float bottomFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1 );
float topFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 );
float rightFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1 );
float leftFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1 );
float frontFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 );
float backFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1 );
vec4 bottomNormal = vec4(0.0, -1, 0.0, 0.0);
vec4 topNormal = vec4(0.0, 1, 0.0, 0.0);
vec4 rightNormal = vec4( -1, 0.0, 0.0, 0.0);
vec4 leftNormal = vec4( 1, 0.0, 0.0, 0.0);
vec4 frontNormal = vec4(0.0, 0.0, -1, 0.0);
vec4 backNormal = vec4(0.0, 0.0, 1, 0.0);
for(i = 0; i < gl_VerticesIn; i++) {
corner = gl_PositionIn[i];
scale = voxelSize[i];
faceOfVoxel(corner, scale, bottomFace, gl_FrontColorIn[i], bottomNormal);
faceOfVoxel(corner, scale, topFace, gl_FrontColorIn[i], topNormal );
faceOfVoxel(corner, scale, rightFace, gl_FrontColorIn[i], rightNormal );
faceOfVoxel(corner, scale, leftFace, gl_FrontColorIn[i], leftNormal );
faceOfVoxel(corner, scale, frontFace, gl_FrontColorIn[i], frontNormal );
faceOfVoxel(corner, scale, backFace, gl_FrontColorIn[i], backNormal );
}
}

View file

@ -63,17 +63,17 @@ QPushButton#cancelButton {
}
#backButton {
background-image: url(qrc:/icons/backButton.svg);
background-image: url(icons/backButton.svg);
border-radius: 0px;
}
#forwardButton {
background-image: url(qrc:/icons/forwardButton.svg);
background-image: url(icons/forwardButton.svg);
border-radius: 0px;
}
#toParentButton {
background-image: url(qrc:/icons/toParentButton.svg);
background-image: url(icons/toParentButton.svg);
border-radius: 0px;
}

View file

@ -21,7 +21,7 @@ QLineEdit {
}
QPushButton#searchButton {
background: url(qrc:/styles/search.svg);
background: url(styles/search.svg);
background-repeat: none;
background-position: left center;
background-origin: content;
@ -33,7 +33,7 @@ QPushButton#searchButton {
}
QPushButton#revealLogButton {
background: url(qrc:/styles/txt-file.svg);
background: url(styles/txt-file.svg);
background-repeat: none;
background-position: left center;
background-origin: content;
@ -50,9 +50,9 @@ QCheckBox {
}
QCheckBox::indicator:unchecked {
image: url(qrc:/styles/unchecked.svg);
image: url(:/styles/unchecked.svg);
}
QCheckBox::indicator:checked {
image: url(qrc:/styles/checked.svg);
image: url(:/styles/checked.svg);
}

View file

@ -15,7 +15,6 @@
#include <cmath>
#include <math.h>
#include <glm/gtx/component_wise.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/vector_angle.hpp>
@ -118,6 +117,15 @@ 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, timeval &startup_time) :
QApplication(argc, argv),
_window(new QMainWindow(desktop())),
@ -154,7 +162,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
_logger(new FileLogger(this))
{
// read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(":/info/ApplicationInfo.ini", QSettings::IniFormat);
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
// set the associated application properties
applicationInfo.beginGroup("INFO");
@ -172,7 +180,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
_applicationStartupTime = startup_time;
QFontDatabase::addApplicationFont(":/styles/Inconsolata.otf");
QFontDatabase::addApplicationFont(Application::resourcesPath() + "styles/Inconsolata.otf");
_window->setWindowTitle("Interface");
qInstallMessageHandler(messageHandler);
@ -1566,7 +1574,7 @@ void Application::init() {
ScriptEngine::getParticlesScriptingInterface(),
SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&)));
_pieMenu.init(":/images/hifi-interface-tools-v2-pie.svg",
_pieMenu.init(Application::resourcesPath() + "images/hifi-interface-tools-v2-pie.svg",
_glWidget->width(),
_glWidget->height());
@ -3648,7 +3656,7 @@ void Application::skipVersion(QString latestVersion) {
void Application::takeSnapshot() {
QMediaPlayer* player = new QMediaPlayer();
QFileInfo inf = QFileInfo(":/sounds/snap.wav");
QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav");
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
player->play();

View file

@ -108,6 +108,7 @@ class Application : public QApplication {
public:
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
static QString& resourcesPath();
Application(int& argc, char** argv, timeval &startup_time);
~Application();

View file

@ -88,8 +88,8 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* p
}
void Audio::init(QGLWidget *parent) {
_micTextureId = parent->bindTexture(QImage(":/images/mic.svg"));
_muteTextureId = parent->bindTexture(QImage(":/images/mute.svg"));
_micTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic.svg"));
_muteTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mute.svg"));
}
void Audio::reset() {

View file

@ -13,6 +13,7 @@
#include <PacketHeaders.h>
#include <SharedUtil.h>
#include "Application.h"
#include "Camera.h"
#include "Environment.h"
#include "renderer/ProgramObject.h"
@ -173,7 +174,7 @@ int Environment::parseData(const HifiSockAddr& senderAddress, const QByteArray&
ProgramObject* Environment::createSkyProgram(const char* from, int* locations) {
ProgramObject* program = new ProgramObject();
QByteArray prefix = QByteArray(":/shaders/SkyFrom") + from;
QByteArray prefix = QString(Application::resourcesPath() + "/shaders/SkyFrom" + from).toUtf8();
program->addShaderFromSourceFile(QGLShader::Vertex, prefix + ".vert");
program->addShaderFromSourceFile(QGLShader::Fragment, prefix + ".frag");
program->link();

View file

@ -5,7 +5,6 @@
// Created by Clement Brisset on 8/12/13.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
#include "ImportDialog.h"
#include <QStandardPaths>
#include <QGridLayout>
@ -14,6 +13,9 @@
#include <QJsonArray>
#include <QJsonObject>
#include "Application.h"
#include "ImportDialog.h"
const QString WINDOW_NAME = QObject::tr("Import Voxels");
const QString IMPORT_BUTTON_NAME = QObject::tr("Import Voxels");
const QString LOADING_BUTTON_NAME = QObject::tr("Loading ...");
@ -52,7 +54,7 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
break;
}
return QIcon(":/icons/" + typeString + ".svg");
return QIcon(Application::resourcesPath() + "icons/" + typeString + ".svg");
}
QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
@ -60,21 +62,21 @@ QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
if (info.isDir()) {
if (info.absoluteFilePath() == QDir::homePath()) {
return QIcon(":/icons/home.svg");
return QIcon(Application::resourcesPath() + "icons/home.svg");
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) {
return QIcon(":/icons/desktop.svg");
return QIcon(Application::resourcesPath() + "icons/desktop.svg");
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) {
return QIcon(":/icons/documents.svg");
return QIcon(Application::resourcesPath() + "icons/documents.svg");
}
return QIcon(":/icons/folder.svg");
return QIcon(Application::resourcesPath() + "icons/folder.svg");
}
QFileInfo iconFile(":/icons/" + iconsMap[ext]);
QFileInfo iconFile(Application::resourcesPath() + "icons/" + iconsMap[ext]);
if (iconFile.exists() && iconFile.isFile()) {
return QIcon(iconFile.filePath());
}
return QIcon(":/icons/file.svg");
return QIcon(Application::resourcesPath() + "icons/file.svg");
}
QString HiFiIconProvider::type(const QFileInfo &info) const {
@ -242,15 +244,16 @@ void ImportDialog::setLayout() {
widget = findChild<QWidget*>("treeView");
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
QFile styleSheet(":/styles/import_dialog.qss");
QFile styleSheet(Application::resourcesPath() + "styles/import_dialog.qss");
if (styleSheet.open(QIODevice::ReadOnly)) {
QDir::setCurrent(Application::resourcesPath());
setStyleSheet(styleSheet.readAll());
}
}
void ImportDialog::setImportTypes() {
QFile config(":/config/config.json");
QFile config(Application::resourcesPath() + "config/config.json");
config.open(QFile::ReadOnly | QFile::Text);
QJsonDocument document = QJsonDocument::fromJson(config.readAll());
if (!document.isNull() && !document.isEmpty()) {

View file

@ -22,7 +22,7 @@ InfoView::InfoView(bool forced) :
{
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
QString absPath = QFileInfo(":/html/interface-welcome-allsvg.html").absoluteFilePath();
QString absPath = QFileInfo(Application::resourcesPath() + "html/interface-welcome-allsvg.html").absoluteFilePath();
QUrl url = QUrl::fromLocalFile(absPath);
load(url);

View file

@ -30,7 +30,7 @@ MetavoxelSystem::MetavoxelSystem() :
void MetavoxelSystem::init() {
if (!_program.isLinked()) {
_program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/metavoxel_point.vert");
_program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/metavoxel_point.vert");
_program.link();
_pointScaleLocation = _program.uniformLocation("pointScale");

View file

@ -23,9 +23,9 @@ PieMenu::PieMenu() :
_isDisplayed(false) {
}
void PieMenu::init(const char *fileName, int screenWidth, int screenHeight) {
void PieMenu::init(const QString& fileName, int screenWidth, int screenHeight) {
// Load SVG
QSvgRenderer renderer((QString) QString(fileName));
QSvgRenderer renderer(fileName);
// Prepare a QImage with desired characteritisc
QImage image(2 * _radiusExtern, 2 * _radiusExtern, QImage::Format_ARGB32);

View file

@ -22,7 +22,7 @@ class PieMenu {
public:
PieMenu();
void init(const char* fileName, int screenWidth, int screenHeight);
void init(const QString& fileName, int screenWidth, int screenHeight);
void addAction(QAction* action);
void render();
void resize(int screenWidth, int screenHeight);

View file

@ -496,15 +496,18 @@ void VoxelSystem::initVoxelMemory() {
// create our simple fragment shader if we're the first system to init
if (!_perlinModulateProgram.isLinked()) {
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/perlin_modulate.vert");
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/perlin_modulate.frag");
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
+ "shaders/perlin_modulate.vert");
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
+ "shaders/perlin_modulate.frag");
_perlinModulateProgram.link();
_perlinModulateProgram.bind();
_perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);
_perlinModulateProgram.release();
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/shadow_map.frag");
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
+ "shaders/shadow_map.frag");
_shadowMapProgram.link();
_shadowMapProgram.bind();

View file

@ -577,13 +577,13 @@ bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float parti
void Avatar::setFaceModelURL(const QUrl& faceModelURL) {
AvatarData::setFaceModelURL(faceModelURL);
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_head.fst");
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(Application::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(":/meshes/defaultAvatar_body.fst");
const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(Application::resourcesPath() + "meshes/defaultAvatar_body.fst");
_skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar());
}

View file

@ -57,7 +57,7 @@ void OculusManager::connect() {
_hmdDevice->GetDeviceInfo(&info);
_stereoConfig.SetHMDInfo(info);
_program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/oculus.frag");
_program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/oculus.frag");
_program.link();
_textureLocation = _program.uniformLocation("texture");

View file

@ -36,9 +36,9 @@ Visage::Visage() :
_estimatedEyeYaw(0.0f) {
#ifdef HAVE_VISAGE
QByteArray licensePath = ":/visage/license.vlc";
QByteArray licensePath = Application::resourcesPath() + "visage/license.vlc";
initializeLicenseManager(licensePath.data());
_tracker = new VisageTracker2(":/visage/Facial Features Tracker - Asymmetric.cfg");
_tracker = new VisageTracker2(Application::resourcesPath() + "visage/Facial Features Tracker - Asymmetric.cfg");
if (_tracker->trackFromCam()) {
_data = new FaceData();

View file

@ -27,8 +27,10 @@ const int ROTATION_HEIGHT = 4;
void AmbientOcclusionEffect::init() {
_occlusionProgram = new ProgramObject();
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert");
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/ambient_occlusion.frag");
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
+ "shaders/ambient_occlusion.vert");
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
+ "shaders/ambient_occlusion.frag");
_occlusionProgram->link();
// create the sample kernel: an array of spherically distributed offset vectors
@ -77,8 +79,8 @@ void AmbientOcclusionEffect::init() {
glBindTexture(GL_TEXTURE_2D, 0);
_blurProgram = new ProgramObject();
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert");
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/occlusion_blur.frag");
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/ambient_occlusion.vert");
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/occlusion_blur.frag");
_blurProgram->link();
_blurProgram->bind();

View file

@ -42,7 +42,7 @@ QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const {
static ProgramObject* createProgram(const QString& name) {
ProgramObject* program = new ProgramObject();
program->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/" + name + ".frag");
program->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/" + name + ".frag");
program->link();
program->bind();

View file

@ -64,16 +64,18 @@ QVector<Model::JointState> Model::createJointStates(const FBXGeometry& geometry)
void Model::init() {
if (!_program.isLinked()) {
_program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model.vert");
_program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag");
_program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/model.vert");
_program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/model.frag");
_program.link();
_program.bind();
_program.setUniformValue("texture", 0);
_program.release();
_normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model_normal_map.vert");
_normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag");
_normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
+ "shaders/model_normal_map.vert");
_normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
+ "shaders/model_normal_map.frag");
_normalMapProgram.link();
_normalMapProgram.bind();
@ -82,14 +84,18 @@ void Model::init() {
_normalMapTangentLocation = _normalMapProgram.attributeLocation("tangent");
_normalMapProgram.release();
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model.vert");
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag");
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
+ "shaders/skin_model.vert");
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
+ "shaders/model.frag");
_skinProgram.link();
initSkinProgram(_skinProgram, _skinLocations);
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model_normal_map.vert");
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag");
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
+ "shaders/skin_model_normal_map.vert");
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
+ "shaders/model_normal_map.frag");
_skinNormalMapProgram.link();
initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations);

View file

@ -29,7 +29,7 @@ PointShader::~PointShader() {
ProgramObject* PointShader::createPointShaderProgram(const QString& name) {
ProgramObject* program = new ProgramObject();
program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/" + name + ".vert" );
program->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/" + name + ".vert" );
program->link();
return program;
}

View file

@ -29,8 +29,8 @@ VoxelShader::~VoxelShader() {
ProgramObject* VoxelShader::createGeometryShaderProgram(const QString& name) {
ProgramObject* program = new ProgramObject();
program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/passthrough.vert" );
program->addShaderFromSourceFile(QGLShader::Geometry, ":/shaders/" + name + ".geom" );
program->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/passthrough.vert" );
program->addShaderFromSourceFile(QGLShader::Geometry, Application::resourcesPath() + "shaders/" + name + ".geom" );
program->setGeometryInputType(GL_POINTS);
program->setGeometryOutputType(GL_TRIANGLE_STRIP);
const int VERTICES_PER_FACE = 4;

View file

@ -10,6 +10,7 @@
#include <QTextBlock>
#include <QtGui>
#include "Application.h"
#include "SharedUtil.h"
#include "ui/LogDialog.h"
@ -36,8 +37,9 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog
setWindowTitle("Log");
setAttribute(Qt::WA_DeleteOnClose);
QFile styleSheet(":/styles/log_dialog.qss");
QFile styleSheet(Application::resourcesPath() + "styles/log_dialog.qss");
if (styleSheet.open(QIODevice::ReadOnly)) {
QDir::setCurrent(Application::resourcesPath());
setStyleSheet(styleSheet.readAll());
}

View file

@ -114,7 +114,7 @@ MetavoxelEditor::MetavoxelEditor() :
return;
}
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/grid.frag");
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag");
_gridProgram.link();
}

View file

@ -5,11 +5,13 @@
// Created by stojce on 23.10.2013.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
#include "RearMirrorTools.h"
#include "Util.h"
#include <QMouseEvent>
#include <SharedUtil.h>
#include <QMouseEvent>
#include "Application.h"
#include "RearMirrorTools.h"
#include "Util.h"
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
@ -24,10 +26,10 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se
_fullScreen(false)
{
_zoomLevel = HEAD;
_closeTextureId = _parent->bindTexture(QImage(":/images/close.png"));
_resetTextureId = _parent->bindTexture(QImage(":/images/reset.png"));
_zoomHeadTextureId = _parent->bindTexture(QImage(":/images/head.png"));
_zoomBodyTextureId = _parent->bindTexture(QImage(":/images/body.png"));
_closeTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/close.png"));
_resetTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/reset.png"));
_zoomHeadTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/head.png"));
_zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/body.png"));
_shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE);
_closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);