mirror of
https://github.com/lubosz/overte.git
synced 2025-04-17 02:16:42 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into joints
This commit is contained in:
commit
c5ab32235f
49 changed files with 182 additions and 718 deletions
|
@ -5,6 +5,10 @@ project(hifi)
|
|||
IF (WIN32)
|
||||
add_definitions( -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS )
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1 ")
|
||||
ELSEIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
ENDIF(WIN32)
|
||||
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH})
|
||||
|
|
|
@ -86,7 +86,6 @@ qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}")
|
|||
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}")
|
||||
|
||||
if (APPLE)
|
||||
|
||||
# configure CMake to use a custom Info.plist
|
||||
SET_TARGET_PROPERTIES( ${this_target} PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.in )
|
||||
|
||||
|
@ -98,9 +97,7 @@ 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)
|
||||
|
||||
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/interface.icns")
|
||||
|
||||
|
||||
# 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})
|
||||
|
@ -111,7 +108,18 @@ if (APPLE)
|
|||
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${DIR_CONTENTS}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif (APPLE)
|
||||
|
||||
SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/interface.icns")
|
||||
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})
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<title>close</title>
|
||||
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="close" sketch:type="MSLayerGroup" transform="translate(2.000000, 2.000000)">
|
||||
<g id="close-button">
|
||||
<circle d="M14.8148148,29.6296296 C22.9968115,29.6296296 29.6296296,22.9968115 29.6296296,14.8148148 C29.6296296,6.63281812 22.9968115,0 14.8148148,0 C6.63281812,0 0,6.63281812 0,14.8148148 C0,22.9968115 6.63281812,29.6296296 14.8148148,29.6296296 Z M14.8148148,29.6296296" id="background" fill="#FFFFFF" cx="14.8148148" cy="14.8148148" r="14.8148148"></circle>
|
||||
<circle d="M15.7036966,30.8654803 C24.0773189,30.8654803 30.8654803,24.0773189 30.8654803,15.7036966 C30.8654803,7.33007426 24.0773189,0.541912889 15.7036966,0.541912889 C7.33007426,0.541912889 0.541912889,7.33007426 0.541912889,15.7036966 C0.541912889,24.0773189 7.33007426,30.8654803 15.7036966,30.8654803 Z M15.7036966,30.8654803" id="circle" stroke="#000000" stroke-width="4" cx="15.7036966" cy="15.7036966" r="15.1617837"></circle>
|
||||
<path d="M7.5368995,7.83319579 L23.5562405,23.8525368" id="topdown" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
|
||||
<path d="M8.14743772,23.5562661 L23.592926,8.11077784" id="botup" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.7 KiB |
|
@ -1,177 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="124px" height="400px" viewBox="-0.5 0.5 124 400" enable-background="new -0.5 0.5 124 400" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<rect x="-0.5" y="120.382" width="62" height="40"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#999999" d="M13.77,149.864c0.296,0.296,0.665,0.102,0.665,0.102s0.527-0.615,1.101-0.328
|
||||
c0.811,0.405,1.315-0.113,1.315-0.113l10.611-10.611l-1.419-1.419l-1.161-1.161l-10.61,10.61c0,0-0.575,0.449-0.169,1.261
|
||||
c0.287,0.573-0.384,1.045-0.384,1.045S13.474,149.569,13.77,149.864"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#CCCCCC" d="M25.913,135.042l2.173-2.173c0,0,1.898-1.905,3.256-0.547c0.68,0.68,1.083,1.627-0.546,3.257
|
||||
c-1.549,1.548-2.173,2.172-2.173,2.172L25.913,135.042z"/>
|
||||
</g>
|
||||
<g>
|
||||
|
||||
<rect x="22.984" y="135.651" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -52.0828 253.0143)" fill="#CCCCCC" width="6.751" height="3.285"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M46.482,138.915h3.697v4.617c-1.004,0.344-2.107,0.516-3.311,0.516c-1.32,0-2.341-0.383-3.062-1.148
|
||||
s-1.081-1.857-1.081-3.275c0-1.383,0.395-2.459,1.184-3.229s1.895-1.154,3.316-1.154c0.539,0,1.048,0.051,1.526,0.152
|
||||
s0.896,0.23,1.251,0.387l-0.732,1.816c-0.617-0.305-1.295-0.457-2.033-0.457c-0.676,0-1.198,0.22-1.567,0.659
|
||||
s-0.554,1.067-0.554,1.884c0,0.801,0.167,1.411,0.501,1.831s0.815,0.63,1.444,0.63c0.344,0,0.66-0.033,0.949-0.1v-1.342h-1.529
|
||||
L46.482,138.915L46.482,138.915z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="-0.5" y="80.5" width="62" height="40"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M43.84,96.434h2.988c1.164,0,2.028,0.173,2.593,0.519s0.847,0.884,0.847,1.614
|
||||
c0,0.48-0.123,0.891-0.369,1.23s-0.57,0.559-0.973,0.656v0.059c0.531,0.141,0.916,0.375,1.154,0.703s0.357,0.754,0.357,1.277
|
||||
c0,0.777-0.292,1.39-0.876,1.837S48.182,105,47.174,105H43.84V96.434z M46.154,99.721h0.697c0.332,0,0.589-0.068,0.771-0.205
|
||||
s0.272-0.34,0.272-0.609c0-0.48-0.363-0.721-1.09-0.721h-0.65C46.154,98.186,46.154,99.721,46.154,99.721z M46.154,101.414v1.799
|
||||
h0.814c0.723,0,1.084-0.305,1.084-0.914c0-0.285-0.097-0.504-0.29-0.656s-0.474-0.229-0.841-0.229
|
||||
C46.921,101.414,46.154,101.414,46.154,101.414z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M18,106.06c-3,1-3,3-7,3c2,1,8,4,9,0C20.47,107.181,18,106.06,18,106.06z"/>
|
||||
<path fill="#CCCCCC" d="M19,105.06l2,2c0,0,3.952-4.712,7-9c3.048-4.287,7.32-10.785,3-7C28.399,93.338,22.048,100.772,19,105.06z
|
||||
"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="-0.5" y="40.5" width="62" height="40"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<g>
|
||||
<polygon fill="#A5A5A5" points="26,58.63 39,53.893 39,67.213 26,72.394 "/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#333333" d="M38,54.5v12.59l-12,5.032V58.757l12.204-4.468 M39,53.63l-13,4.873v14.162l13-5.33V53.63L39,53.63z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<polygon fill="#BFBFBF" points="13,67.213 13,53.893 25,58.63 25,72.394 "/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#BFBFBF" d="M12.887,54.289L25,58.757v13.365L13,67.09V54.5 M13,53.63v13.705l13,5.33V58.503L13,53.63L13,53.63z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<polygon fill="#FFFFFF" points="13.173,53.63 25.746,48.952 38.318,53.63 25.746,58.309 "/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#333333" d="M25.746,49.146l12.049,4.483l-12.049,4.483L13.697,53.63L25.746,49.146 M25.746,48.758L12.65,53.63
|
||||
l13.096,4.873l13.096-4.873L25.746,48.758L25.746,48.758z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M46.119,62.383V65.5h-2.314v-8.566h2.807c2.328,0,3.492,0.844,3.492,2.531c0,0.992-0.484,1.76-1.453,2.303
|
||||
l2.495,3.732h-2.625l-1.816-3.117H46.119z M46.119,60.643h0.434c0.809,0,1.213-0.357,1.213-1.072c0-0.59-0.396-0.885-1.189-0.885
|
||||
H46.12L46.119,60.643L46.119,60.643z"/>
|
||||
</g>
|
||||
<g>
|
||||
<polygon fill="#333333" points="7,59.5 9,59.5 10,59.5 15,59.5 16,59.5 18,59.5 18,64.5 16,64.5 15,64.5 10,64.5 9,64.5 7,64.5
|
||||
"/>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="8" y="60.5" fill="#FFFFFF" width="9" height="3"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="-0.5" y="0.5" width="62" height="40"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<g>
|
||||
<polygon fill="#A5A5A5" points="26,18.63 39,13.893 39,27.213 26,32.394 "/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#333333" d="M38,14.5v12.59l-12,5.032V18.757l12.204-4.468 M39,13.63l-13,4.873v14.162l13-5.33V13.63L39,13.63z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<polygon fill="#BFBFBF" points="13,27.213 13,13.893 25,18.63 25,32.394 "/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#BFBFBF" d="M12.887,14.289L25,18.757v13.365L13,27.09V14.5 M13,13.63v13.705l13,5.33V18.503L13,13.63L13,13.63z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<polygon fill="#FFFFFF" points="13.173,13.63 25.746,8.952 38.318,13.63 25.746,18.309 "/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#333333" d="M25.746,9.146l12.049,4.483l-12.049,4.483L13.697,13.63L25.746,9.146 M25.746,8.758L12.65,13.63
|
||||
l13.096,4.873l13.096-4.873L25.746,8.758L25.746,8.758z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M48.41,16.934H51L48.193,25.5h-2.725l-2.795-8.566h2.602l1.166,4.342c0.242,0.965,0.375,1.637,0.398,2.016
|
||||
c0.027-0.273,0.082-0.615,0.164-1.025s0.154-0.732,0.217-0.967L48.41,16.934z"/>
|
||||
</g>
|
||||
<g>
|
||||
<polygon fill="#333333" points="7,19.5 10,19.5 10,16.5 15,16.5 15,19.5 18,19.5 18,24.5 15,24.5 15,27.5 10,27.5 10,24.5 7,24.5
|
||||
"/>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="11" y="17.5" fill="#FFFFFF" width="3" height="9"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="8" y="20.5" fill="#FFFFFF" width="9" height="3"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<rect x="-0.5" y="160.5" width="62" height="40"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M50.379,179.205c0,1.441-0.354,2.537-1.061,3.287s-1.742,1.125-3.105,1.125
|
||||
c-1.344,0-2.374-0.377-3.091-1.131s-1.075-1.852-1.075-3.293c0-1.426,0.356-2.515,1.069-3.267s1.749-1.128,3.108-1.128
|
||||
c1.363,0,2.396,0.373,3.1,1.119S50.379,177.76,50.379,179.205z M44.484,179.205c0,1.656,0.576,2.484,1.729,2.484
|
||||
c0.586,0,1.021-0.201,1.304-0.604s0.425-1.029,0.425-1.881c0-0.855-0.144-1.487-0.431-1.896s-0.716-0.612-1.286-0.612
|
||||
C45.064,176.697,44.484,177.533,44.484,179.205z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="19.944,187.389 19.944,188.389 19.031,187.981 "/>
|
||||
|
||||
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="1.9973,1.9973" x1="17.208" y1="187.166" x2="10.825" y2="184.315"/>
|
||||
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="9.913,183.908 9,183.5 9,182.5 "/>
|
||||
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" x1="8.5" y1="180.5" x2="8.5" y2="173.5"/>
|
||||
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="9,172.5 9,171.5 9.927,171.876 "/>
|
||||
|
||||
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="1.9625,1.9625" x1="11.745" y1="172.615" x2="18.109" y2="175.199"/>
|
||||
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="19.018,175.568 19.944,175.944 19.944,176.944 "/>
|
||||
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" x1="19.5" y1="179.5" x2="19.5" y2="186.5"/>
|
||||
</g>
|
||||
</g>
|
||||
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" points="19.944,175.944 30,171.5 20,168.5
|
||||
9,171.5 "/>
|
||||
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" points="20.333,188.611 29.5,183.5
|
||||
29.5,171.5 "/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 7.5 KiB |
|
@ -63,17 +63,17 @@ QPushButton#cancelButton {
|
|||
}
|
||||
|
||||
#backButton {
|
||||
background-image: url(resources/icons/backButton.svg);
|
||||
background-image: url(icons/backButton.svg);
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
#forwardButton {
|
||||
background-image: url(resources/icons/forwardButton.svg);
|
||||
background-image: url(icons/forwardButton.svg);
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
#toParentButton {
|
||||
background-image: url(resources/icons/toParentButton.svg);
|
||||
background-image: url(icons/toParentButton.svg);
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ QLineEdit {
|
|||
}
|
||||
|
||||
QPushButton#searchButton {
|
||||
background: url(resources/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(resources/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(resources/styles/unchecked.svg);
|
||||
image: url(:/styles/unchecked.svg);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked {
|
||||
image: url(resources/styles/checked.svg);
|
||||
}
|
||||
image: url(:/styles/checked.svg);
|
||||
}
|
|
@ -118,6 +118,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())),
|
||||
|
@ -153,10 +162,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
_resetRecentMaxPacketsSoon(true),
|
||||
_logger(new FileLogger(this))
|
||||
{
|
||||
switchToResourcesParentIfRequired();
|
||||
|
||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||
QSettings applicationInfo("resources/info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
|
||||
// set the associated application properties
|
||||
applicationInfo.beginGroup("INFO");
|
||||
|
@ -174,7 +181,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
|
||||
_applicationStartupTime = startup_time;
|
||||
|
||||
QFontDatabase::addApplicationFont("resources/styles/Inconsolata.otf");
|
||||
QFontDatabase::addApplicationFont(Application::resourcesPath() + "styles/Inconsolata.otf");
|
||||
_window->setWindowTitle("Interface");
|
||||
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
@ -284,9 +291,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
|
||||
restoreSizeAndPosition();
|
||||
|
||||
QFontDatabase fontDatabase;
|
||||
fontDatabase.addApplicationFont("resources/styles/Inconsolata.otf");
|
||||
|
||||
_window->setVisible(true);
|
||||
_glWidget->setFocusPolicy(Qt::StrongFocus);
|
||||
_glWidget->setFocus();
|
||||
|
@ -1008,10 +1012,6 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
|||
|
||||
_mouseX = event->x();
|
||||
_mouseY = event->y();
|
||||
|
||||
if (activeWindow() == _window) {
|
||||
_pieMenu.mouseMoveEvent(_mouseX, _mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::mousePressEvent(QMouseEvent* event) {
|
||||
|
@ -1064,8 +1064,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
|
|||
if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
|
||||
checkStatsClick();
|
||||
}
|
||||
|
||||
_pieMenu.mouseReleaseEvent(_mouseX, _mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1570,11 +1568,7 @@ void Application::init() {
|
|||
SIGNAL(particleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&)),
|
||||
ScriptEngine::getParticlesScriptingInterface(),
|
||||
SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&)));
|
||||
|
||||
_pieMenu.init("./resources/images/hifi-interface-tools-v2-pie.svg",
|
||||
_glWidget->width(),
|
||||
_glWidget->height());
|
||||
|
||||
|
||||
_audio.init(_glWidget);
|
||||
|
||||
_rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings);
|
||||
|
@ -2176,7 +2170,7 @@ void Application::updateShadowMap() {
|
|||
rotation * (glm::mix(_viewFrustum.getNearBottomLeft(), _viewFrustum.getFarBottomLeft(), farScale) + translation),
|
||||
rotation * (glm::mix(_viewFrustum.getNearBottomRight(), _viewFrustum.getFarBottomRight(), farScale) + translation) };
|
||||
glm::vec3 minima(FLT_MAX, FLT_MAX, FLT_MAX), maxima(-FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||
for (int i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
|
||||
for (size_t i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
|
||||
minima = glm::min(minima, points[i]);
|
||||
maxima = glm::max(maxima, points[i]);
|
||||
}
|
||||
|
@ -2508,10 +2502,6 @@ void Application::displayOverlay() {
|
|||
drawText(_glWidget->width() - 100, _glWidget->height() - timerBottom, 0.30f, 1.0f, 0, frameTimer, WHITE_TEXT);
|
||||
}
|
||||
|
||||
if (_pieMenu.isDisplayed()) {
|
||||
_pieMenu.render();
|
||||
}
|
||||
|
||||
_overlays.render2D();
|
||||
|
||||
glPopMatrix();
|
||||
|
@ -3652,9 +3642,8 @@ void Application::skipVersion(QString latestVersion) {
|
|||
}
|
||||
|
||||
void Application::takeSnapshot() {
|
||||
switchToResourcesParentIfRequired();
|
||||
QMediaPlayer* player = new QMediaPlayer();
|
||||
QFileInfo inf = QFileInfo("resources/sounds/snap.wav");
|
||||
QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav");
|
||||
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||
player->play();
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <OctreeQuery.h>
|
||||
|
||||
#include "Audio.h"
|
||||
|
||||
#include "BandwidthMeter.h"
|
||||
#include "BuckyBalls.h"
|
||||
#include "Camera.h"
|
||||
|
@ -43,7 +42,6 @@
|
|||
#include "MetavoxelSystem.h"
|
||||
#include "PacketHeaders.h"
|
||||
#include "ParticleTreeRenderer.h"
|
||||
#include "PieMenu.h"
|
||||
#include "Stars.h"
|
||||
#include "ViewFrustum.h"
|
||||
#include "VoxelFade.h"
|
||||
|
@ -108,6 +106,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();
|
||||
|
@ -452,8 +451,6 @@ private:
|
|||
StDev _idleLoopStdev;
|
||||
float _idleLoopMeasuredJitter;
|
||||
|
||||
PieMenu _pieMenu;
|
||||
|
||||
int parseOctreeStats(const QByteArray& packet, const SharedNodePointer& sendingNode);
|
||||
void trackIncomingVoxelPacket(const QByteArray& packet, const SharedNodePointer& sendingNode, bool wasStatsPacket);
|
||||
|
||||
|
|
|
@ -88,9 +88,8 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* p
|
|||
}
|
||||
|
||||
void Audio::init(QGLWidget *parent) {
|
||||
switchToResourcesParentIfRequired();
|
||||
_micTextureId = parent->bindTexture(QImage("./resources/images/mic.svg"));
|
||||
_muteTextureId = parent->bindTexture(QImage("./resources/images/mute.svg"));
|
||||
_micTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic.svg"));
|
||||
_muteTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mute.svg"));
|
||||
}
|
||||
|
||||
void Audio::reset() {
|
||||
|
|
|
@ -131,7 +131,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
|||
|
||||
// Determine total
|
||||
float totalIn = 0.0f, totalOut = 0.0f;
|
||||
for (int i = 0; i < N_CHANNELS; ++i) {
|
||||
for (size_t i = 0; i < N_CHANNELS; ++i) {
|
||||
|
||||
totalIn += inputStream(ChannelIndex(i)).getValue();
|
||||
totalOut += outputStream(ChannelIndex(i)).getValue();
|
||||
|
@ -207,7 +207,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
|||
|
||||
// Render bars
|
||||
int xIn = 0, xOut = 0;
|
||||
for (int i = 0; i < N_CHANNELS; ++i) {
|
||||
for (size_t i = 0; i < N_CHANNELS; ++i) {
|
||||
|
||||
ChannelIndex chIdx = ChannelIndex(i);
|
||||
int wIn = int(barWidth * inputStream(chIdx).getValue() * UNIT_SCALE / scaleMax);
|
||||
|
@ -242,7 +242,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) {
|
|||
|
||||
// After rendering, indicate that no data has been sent/received since the last feed.
|
||||
// This way, the meters fall when not continuously fed.
|
||||
for (int i = 0; i < N_CHANNELS; ++i) {
|
||||
for (size_t i = 0; i < N_CHANNELS; ++i) {
|
||||
inputStream(ChannelIndex(i)).updateValue(0);
|
||||
outputStream(ChannelIndex(i)).updateValue(0);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// Created by Andrzej Kapolka on 5/6/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QMutexLocker>
|
||||
#include <QtDebug>
|
||||
|
@ -13,11 +15,13 @@
|
|||
#include <PacketHeaders.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Camera.h"
|
||||
#include "Environment.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include "world.h"
|
||||
|
||||
#include "Environment.h"
|
||||
|
||||
uint qHash(const HifiSockAddr& sockAddr) {
|
||||
if (sockAddr.getAddress().isNull()) {
|
||||
return 0; // shouldn't happen, but if it does, zero is a perfectly valid hash
|
||||
|
@ -44,7 +48,6 @@ void Environment::init() {
|
|||
return;
|
||||
}
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
_skyFromAtmosphereProgram = createSkyProgram("Atmosphere", _skyFromAtmosphereUniformLocations);
|
||||
_skyFromSpaceProgram = createSkyProgram("Space", _skyFromSpaceUniformLocations);
|
||||
|
||||
|
@ -174,7 +177,7 @@ int Environment::parseData(const HifiSockAddr& senderAddress, const QByteArray&
|
|||
|
||||
ProgramObject* Environment::createSkyProgram(const char* from, int* locations) {
|
||||
ProgramObject* program = new ProgramObject();
|
||||
QByteArray prefix = QByteArray("resources/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();
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <HifiSockAddr.h>
|
||||
|
||||
#include "EnvironmentData.h"
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
class Camera;
|
||||
class ProgramObject;
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
//
|
||||
// Field.cpp
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/23/12.
|
||||
// Copyright (c) 2012 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
// A vector-valued field over an array of elements arranged as a 3D lattice
|
||||
|
||||
#include "Field.h"
|
||||
|
||||
int Field::value(float *value, float *pos) {
|
||||
int index = (int)(pos[0] / _worldSize * 10.0) +
|
||||
(int)(pos[1] / _worldSize * 10.0) * 10 +
|
||||
(int)(pos[2] / _worldSize * 10.0) * 100;
|
||||
|
||||
if ((index >= 0) && (index < FIELD_ELEMENTS)) {
|
||||
value[0] = _field[index].val.x;
|
||||
value[1] = _field[index].val.y;
|
||||
value[2] = _field[index].val.z;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Field::Field(float worldSize, float coupling) {
|
||||
_worldSize = worldSize;
|
||||
_coupling = coupling;
|
||||
//float fx, fy, fz;
|
||||
for (int i = 0; i < FIELD_ELEMENTS; i++) {
|
||||
const float FIELD_INITIAL_MAG = 0.0f;
|
||||
_field[i].val = randVector() * FIELD_INITIAL_MAG * _worldSize;
|
||||
_field[i].center.x = ((float)(i % 10) + 0.5f);
|
||||
_field[i].center.y = ((float)(i % 100 / 10) + 0.5f);
|
||||
_field[i].center.z = ((float)(i / 100) + 0.5f);
|
||||
_field[i].center *= _worldSize / 10.f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Field::add(float* add, float *pos) {
|
||||
int index = (int)(pos[0] / _worldSize * 10.0) +
|
||||
(int)(pos[1] / _worldSize * 10.0) * 10 +
|
||||
(int)(pos[2] / _worldSize * 10.0) * 100;
|
||||
|
||||
if ((index >= 0) && (index < FIELD_ELEMENTS)) {
|
||||
_field[index].val.x += add[0];
|
||||
_field[index].val.y += add[1];
|
||||
_field[index].val.z += add[2];
|
||||
}
|
||||
}
|
||||
|
||||
void Field::interact(float deltaTime, const glm::vec3& pos, glm::vec3& vel) {
|
||||
|
||||
int index = (int)(pos.x / _worldSize * 10.0) +
|
||||
(int)(pos.y / _worldSize*10.0) * 10 +
|
||||
(int)(pos.z / _worldSize*10.0) * 100;
|
||||
if ((index >= 0) && (index < FIELD_ELEMENTS)) {
|
||||
vel += _field[index].val * deltaTime; // Particle influenced by field
|
||||
_field[index].val += vel * deltaTime * _coupling; // Field influenced by particle
|
||||
}
|
||||
}
|
||||
|
||||
void Field::simulate(float deltaTime) {
|
||||
glm::vec3 neighbors, add, diff;
|
||||
|
||||
for (int i = 0; i < FIELD_ELEMENTS; i++) {
|
||||
const float CONSTANT_DAMPING = 0.5f;
|
||||
_field[i].val *= (1.f - CONSTANT_DAMPING * deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
void Field::render() {
|
||||
int i;
|
||||
float scale_view = 0.05f * _worldSize;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glBegin(GL_LINES);
|
||||
for (i = 0; i < FIELD_ELEMENTS; i++) {
|
||||
glColor3f(0, 1, 0);
|
||||
glVertex3fv(&_field[i].center.x);
|
||||
glVertex3f(_field[i].center.x + _field[i].val.x * scale_view,
|
||||
_field[i].center.y + _field[i].val.y * scale_view,
|
||||
_field[i].center.z + _field[i].val.z * scale_view);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glColor3f(0, 1, 0);
|
||||
glPointSize(4.0);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glBegin(GL_POINTS);
|
||||
for (i = 0; i < FIELD_ELEMENTS; i++) {
|
||||
glVertex3fv(&_field[i].center.x);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
//
|
||||
// Field.h
|
||||
// interface
|
||||
//
|
||||
// Created by Philip Rosedale on 8/23/12.
|
||||
// Copyright (c) 2012 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __interface__Field__
|
||||
#define __interface__Field__
|
||||
|
||||
#include <iostream>
|
||||
#include <glm/glm.hpp>
|
||||
#include "InterfaceConfig.h"
|
||||
#include "world.h"
|
||||
#include "Util.h"
|
||||
|
||||
const int FIELD_ELEMENTS = 1000;
|
||||
|
||||
/// Field is a lattice of vectors uniformly distributed in 3D with FIELD_ELEMENTS^(1/3) per side
|
||||
class Field {
|
||||
public:
|
||||
struct FieldElement {
|
||||
glm::vec3 val;
|
||||
glm::vec3 center;
|
||||
glm::vec3 fld;
|
||||
} _field[FIELD_ELEMENTS];
|
||||
|
||||
Field(float worldSize, float coupling);
|
||||
/// The field value at a position in space, given simply as the value of the enclosing cell
|
||||
int value(float *ret, float *pos);
|
||||
/// Visualize the field as vector lines drawn at each center
|
||||
void render();
|
||||
/// Add to the field value cell enclosing a location
|
||||
void add(float* add, float *loc);
|
||||
/// A particle with a position and velocity interacts with the field given the coupling
|
||||
/// constant passed when creating the field.
|
||||
void interact(float deltaTime, const glm::vec3& pos, glm::vec3& vel);
|
||||
/// Field evolves over timestep
|
||||
void simulate(float deltaTime);
|
||||
private:
|
||||
float _worldSize;
|
||||
float _coupling;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -5,7 +5,8 @@
|
|||
// Created by Clement Brisset on 8/12/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
#include "ImportDialog.h"
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include <QGridLayout>
|
||||
|
@ -14,6 +15,10 @@
|
|||
#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 ...");
|
||||
|
@ -27,8 +32,6 @@ const int SECOND_INDEX_LETTER = 1;
|
|||
|
||||
QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
|
||||
// types
|
||||
// Computer, Desktop, Trashcan, Network, Drive, Folder, File
|
||||
QString typeString;
|
||||
|
@ -54,30 +57,29 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
|
|||
break;
|
||||
}
|
||||
|
||||
return QIcon("resources/icons/" + typeString + ".svg");
|
||||
return QIcon(Application::resourcesPath() + "icons/" + typeString + ".svg");
|
||||
}
|
||||
|
||||
QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
|
||||
switchToResourcesParentIfRequired();
|
||||
const QString ext = info.suffix().toLower();
|
||||
|
||||
if (info.isDir()) {
|
||||
if (info.absoluteFilePath() == QDir::homePath()) {
|
||||
return QIcon("resources/icons/home.svg");
|
||||
return QIcon(Application::resourcesPath() + "icons/home.svg");
|
||||
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) {
|
||||
return QIcon("resources/icons/desktop.svg");
|
||||
return QIcon(Application::resourcesPath() + "icons/desktop.svg");
|
||||
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) {
|
||||
return QIcon("resources/icons/documents.svg");
|
||||
return QIcon(Application::resourcesPath() + "icons/documents.svg");
|
||||
}
|
||||
return QIcon("resources/icons/folder.svg");
|
||||
return QIcon(Application::resourcesPath() + "icons/folder.svg");
|
||||
}
|
||||
|
||||
QFileInfo iconFile("resources/icons/" + iconsMap[ext]);
|
||||
QFileInfo iconFile(Application::resourcesPath() + "icons/" + iconsMap[ext]);
|
||||
if (iconFile.exists() && iconFile.isFile()) {
|
||||
return QIcon(iconFile.filePath());
|
||||
}
|
||||
|
||||
return QIcon("resources/icons/file.svg");
|
||||
return QIcon(Application::resourcesPath() + "icons/file.svg");
|
||||
}
|
||||
|
||||
QString HiFiIconProvider::type(const QFileInfo &info) const {
|
||||
|
@ -245,18 +247,16 @@ void ImportDialog::setLayout() {
|
|||
widget = findChild<QWidget*>("treeView");
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
QFile styleSheet("resources/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() {
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
QFile config("resources/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()) {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef __hifi__ImportDialog__
|
||||
#define __hifi__ImportDialog__
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPushButton>
|
||||
#include <QProgressBar>
|
||||
|
|
|
@ -18,12 +18,11 @@
|
|||
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
||||
|
||||
InfoView::InfoView(bool forced) :
|
||||
_forced(forced) {
|
||||
|
||||
_forced(forced)
|
||||
{
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
QString absPath = QFileInfo("resources/html/interface-welcome-allsvg.html").absoluteFilePath();
|
||||
QString absPath = QFileInfo(Application::resourcesPath() + "html/interface-welcome-allsvg.html").absoluteFilePath();
|
||||
QUrl url = QUrl::fromLocalFile(absPath);
|
||||
|
||||
load(url);
|
||||
|
|
|
@ -1320,17 +1320,25 @@ void Menu::addSeparator(const QString& menuName, const QString& separatorName) {
|
|||
|
||||
void Menu::removeSeparator(const QString& menuName, const QString& separatorName) {
|
||||
QMenu* menu = getMenu(menuName);
|
||||
bool separatorRemoved = false;
|
||||
if (menu) {
|
||||
int textAt = findPositionOfMenuItem(menu, separatorName);
|
||||
QList<QAction*> menuActions = menu->actions();
|
||||
QAction* separatorText = menuActions[textAt];
|
||||
QAction* separatorLine = menuActions[textAt - 1];
|
||||
if (separatorLine->isSeparator()) {
|
||||
menu->removeAction(separatorText);
|
||||
menu->removeAction(separatorLine);
|
||||
if (textAt > 0 && textAt < menuActions.size()) {
|
||||
QAction* separatorLine = menuActions[textAt - 1];
|
||||
if (separatorLine) {
|
||||
if (separatorLine->isSeparator()) {
|
||||
menu->removeAction(separatorText);
|
||||
menu->removeAction(separatorLine);
|
||||
separatorRemoved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QMenuBar::repaint();
|
||||
if (separatorRemoved) {
|
||||
QMenuBar::repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::addMenuItem(const MenuItemProperties& properties) {
|
||||
|
|
|
@ -30,8 +30,7 @@ MetavoxelSystem::MetavoxelSystem() :
|
|||
|
||||
void MetavoxelSystem::init() {
|
||||
if (!_program.isLinked()) {
|
||||
switchToResourcesParentIfRequired();
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/metavoxel_point.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/metavoxel_point.vert");
|
||||
_program.link();
|
||||
|
||||
_pointScaleLocation = _program.uniformLocation("pointScale");
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
//
|
||||
// PieMenu.cpp
|
||||
// hifi
|
||||
//
|
||||
// Created by Clement Brisset on 7/18/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "PieMenu.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QAction>
|
||||
#include <QSvgRenderer>
|
||||
#include <QPainter>
|
||||
#include <QGLWidget>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
PieMenu::PieMenu() :
|
||||
_radiusIntern(30),
|
||||
_radiusExtern(70),
|
||||
_magnification(1.2f),
|
||||
_isDisplayed(false) {
|
||||
}
|
||||
|
||||
void PieMenu::init(const char *fileName, int screenWidth, int screenHeight) {
|
||||
// Load SVG
|
||||
switchToResourcesParentIfRequired();
|
||||
QSvgRenderer renderer((QString) QString(fileName));
|
||||
|
||||
// Prepare a QImage with desired characteritisc
|
||||
QImage image(2 * _radiusExtern, 2 * _radiusExtern, QImage::Format_ARGB32);
|
||||
image.fill(0x0);
|
||||
|
||||
// Get QPainter that paints to the image
|
||||
QPainter painter(&image);
|
||||
renderer.render(&painter);
|
||||
|
||||
//get the OpenGL-friendly image
|
||||
_textureImage = QGLWidget::convertToGLFormat(image);
|
||||
|
||||
glGenTextures(1, &_textureID);
|
||||
glBindTexture(GL_TEXTURE_2D, _textureID);
|
||||
|
||||
//generate the texture
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
_textureImage.width(),
|
||||
_textureImage.height(),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
_textureImage.bits());
|
||||
|
||||
//texture parameters
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
void PieMenu::addAction(QAction* action){
|
||||
_actions.push_back(action);
|
||||
}
|
||||
|
||||
void PieMenu::render() {
|
||||
if (_actions.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float start = (float)M_PI / 2.0f;
|
||||
float end = start + 2.0f * (float)M_PI;
|
||||
float step = 2.0f * (float)M_PI / 100.0f;
|
||||
float distance = sqrt((float)(_mouseX - _x) * (_mouseX - _x) + (_mouseY - _y) * (_mouseY - _y));
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, _textureID);
|
||||
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
|
||||
if (_radiusIntern < distance) {
|
||||
float angle = atan2((float)(_mouseY - _y), (float)(_mouseX - _x)) - start;
|
||||
angle = (0.0f < angle) ? angle : angle + 2.0f * M_PI;
|
||||
|
||||
_selectedAction = floor(angle / (2.0f * M_PI / _actions.size()));
|
||||
|
||||
start = start + _selectedAction * 2.0f * M_PI / _actions.size();
|
||||
end = start + 2.0f * M_PI / _actions.size();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glTexCoord2f(0.5f, 0.5f);
|
||||
glVertex2f(_x, _y);
|
||||
for (float i = start; i < end; i += step) {
|
||||
glTexCoord2f(0.5f + 0.5f * cos(i), 0.5f - 0.5f * sin(i));
|
||||
glVertex2f(_x + _magnification * _radiusExtern * cos(i),
|
||||
_y + _magnification * _radiusExtern * sin(i));
|
||||
}
|
||||
glTexCoord2f(0.5f + 0.5f * cos(end), 0.5f + - 0.5f * sin(end));
|
||||
glVertex2f(_x + _magnification * _radiusExtern * cos(end),
|
||||
_y + _magnification * _radiusExtern * sin(end));
|
||||
glEnd();
|
||||
} else {
|
||||
_selectedAction = -1;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2f(_x + _radiusExtern, _y - _radiusExtern);
|
||||
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2f(_x + _radiusExtern, _y + _radiusExtern);
|
||||
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(_x - _radiusExtern, _y + _radiusExtern);
|
||||
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2f(_x - _radiusExtern, _y - _radiusExtern);
|
||||
glEnd();
|
||||
}
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void PieMenu::resize(int screenWidth, int screenHeight) {
|
||||
}
|
||||
|
||||
void PieMenu::mouseMoveEvent(int x, int y) {
|
||||
_mouseX = x;
|
||||
_mouseY = y;
|
||||
}
|
||||
|
||||
void PieMenu::mousePressEvent(int x, int y) {
|
||||
_x = _mouseX = x;
|
||||
_y = _mouseY = y;
|
||||
_selectedAction = -1;
|
||||
_isDisplayed = true;
|
||||
}
|
||||
|
||||
void PieMenu::mouseReleaseEvent(int x, int y) {
|
||||
if (0 <= _selectedAction && _selectedAction < (int)_actions.size() && _actions[_selectedAction]) {
|
||||
_actions[_selectedAction]->trigger();
|
||||
}
|
||||
|
||||
_isDisplayed = false;
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
//
|
||||
// PieMenu.h
|
||||
// hifi
|
||||
//
|
||||
// Created by Clement Brisset on 7/18/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __hifi__PieMenu__
|
||||
#define __hifi__PieMenu__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include <QImage>
|
||||
|
||||
class QAction;
|
||||
|
||||
class PieMenu {
|
||||
public:
|
||||
PieMenu();
|
||||
|
||||
void init(const char* fileName, int screenWidth, int screenHeight);
|
||||
void addAction(QAction* action);
|
||||
void render();
|
||||
void resize(int screenWidth, int screenHeight);
|
||||
|
||||
bool isDisplayed() const {return _isDisplayed;}
|
||||
int getX () const {return _x;}
|
||||
int getY () const {return _y;}
|
||||
|
||||
void mouseMoveEvent (int x, int y);
|
||||
void mousePressEvent (int x, int y);
|
||||
void mouseReleaseEvent(int x, int y);
|
||||
|
||||
private:
|
||||
QImage _textureImage;
|
||||
GLuint _textureID;
|
||||
|
||||
// position of the menu
|
||||
int _x;
|
||||
int _y;
|
||||
int _radiusIntern;
|
||||
int _radiusExtern;
|
||||
float _magnification;
|
||||
|
||||
int _mouseX;
|
||||
int _mouseY;
|
||||
|
||||
int _selectedAction;
|
||||
|
||||
bool _isDisplayed;
|
||||
|
||||
std::vector<QAction*> _actions;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__PieMenu__) */
|
|
@ -496,16 +496,18 @@ void VoxelSystem::initVoxelMemory() {
|
|||
|
||||
// create our simple fragment shader if we're the first system to init
|
||||
if (!_perlinModulateProgram.isLinked()) {
|
||||
switchToResourcesParentIfRequired();
|
||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/perlin_modulate.vert");
|
||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/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, "resources/shaders/shadow_map.frag");
|
||||
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
|
||||
+ "shaders/shadow_map.frag");
|
||||
_shadowMapProgram.link();
|
||||
|
||||
_shadowMapProgram.bind();
|
||||
|
|
|
@ -418,10 +418,10 @@ void Avatar::renderDisplayName() {
|
|||
glGetIntegerv(GL_VIEWPORT, viewportMatrix);
|
||||
GLdouble result0[3], result1[3];
|
||||
|
||||
glm::dvec3 upVector(modelViewMatrix[1]);
|
||||
|
||||
// The up vector must be relative to the rotation current rotation matrix:
|
||||
// we set the identity
|
||||
glm::dvec3 testPoint0 = glm::dvec3(textPosition);
|
||||
glm::dvec3 testPoint1 = glm::dvec3(textPosition) + upVector;
|
||||
glm::dvec3 testPoint1 = glm::dvec3(textPosition) + glm::dvec3(IDENTITY_UP);
|
||||
|
||||
bool success;
|
||||
success = gluProject(testPoint0.x, testPoint0.y, testPoint0.z,
|
||||
|
@ -583,13 +583,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("resources/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("resources/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());
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@ void Hand::simulate(float deltaTime, bool isMine) {
|
|||
}
|
||||
}
|
||||
|
||||
void Hand::playSlaps(PalmData& palm, Avatar* avatar)
|
||||
{
|
||||
void Hand::playSlaps(PalmData& palm, Avatar* avatar) {
|
||||
// Check for palm collisions
|
||||
glm::vec3 myPalmPosition = palm.getPosition();
|
||||
float palmCollisionDistance = 0.1f;
|
||||
|
|
|
@ -103,9 +103,8 @@ void MyAvatar::update(float deltaTime) {
|
|||
// Update head mouse from faceshift if active
|
||||
Faceshift* faceshift = Application::getInstance()->getFaceshift();
|
||||
if (faceshift->isActive()) {
|
||||
glm::vec3 headVelocity = faceshift->getHeadAngularVelocity();
|
||||
|
||||
// TODO? resurrect headMouse stuff?
|
||||
//glm::vec3 headVelocity = faceshift->getHeadAngularVelocity();
|
||||
//// sets how quickly head angular rotation moves the head mouse
|
||||
//const float HEADMOUSE_FACESHIFT_YAW_SCALE = 40.f;
|
||||
//const float HEADMOUSE_FACESHIFT_PITCH_SCALE = 30.f;
|
||||
|
@ -930,10 +929,13 @@ void MyAvatar::updateCollisionWithAvatars(float deltaTime) {
|
|||
|
||||
// HACK: body-body collision uses two coaxial capsules with axes parallel to y-axis
|
||||
// TODO: make the collision work without assuming avatar orientation
|
||||
Extents myStaticExtents = _skeletonModel.getStaticExtents();
|
||||
glm::vec3 staticScale = myStaticExtents.maximum - myStaticExtents.minimum;
|
||||
float myCapsuleRadius = 0.25f * (staticScale.x + staticScale.z);
|
||||
float myCapsuleHeight = staticScale.y;
|
||||
|
||||
// TODO: these local variables are not used in the live code, only in the
|
||||
// commented-outTODO code below.
|
||||
//Extents myStaticExtents = _skeletonModel.getStaticExtents();
|
||||
//glm::vec3 staticScale = myStaticExtents.maximum - myStaticExtents.minimum;
|
||||
//float myCapsuleRadius = 0.25f * (staticScale.x + staticScale.z);
|
||||
//float myCapsuleHeight = staticScale.y;
|
||||
|
||||
CollisionInfo collisionInfo;
|
||||
foreach (const AvatarSharedPointer& avatarPointer, avatars) {
|
||||
|
|
|
@ -57,8 +57,7 @@ void OculusManager::connect() {
|
|||
_hmdDevice->GetDeviceInfo(&info);
|
||||
_stereoConfig.SetHMDInfo(info);
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/oculus.frag");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/oculus.frag");
|
||||
_program.link();
|
||||
|
||||
_textureLocation = _program.uniformLocation("texture");
|
||||
|
|
|
@ -36,10 +36,9 @@ Visage::Visage() :
|
|||
_estimatedEyeYaw(0.0f) {
|
||||
|
||||
#ifdef HAVE_VISAGE
|
||||
switchToResourcesParentIfRequired();
|
||||
QByteArray licensePath = "resources/visage/license.vlc";
|
||||
QByteArray licensePath = Application::resourcesPath() + "visage/license.vlc";
|
||||
initializeLicenseManager(licensePath.data());
|
||||
_tracker = new VisageTracker2("resources/visage/Facial Features Tracker - Asymmetric.cfg");
|
||||
_tracker = new VisageTracker2(Application::resourcesPath() + "visage/Facial Features Tracker - Asymmetric.cfg");
|
||||
if (_tracker->trackFromCam()) {
|
||||
_data = new FaceData();
|
||||
|
||||
|
|
|
@ -15,21 +15,22 @@
|
|||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "AmbientOcclusionEffect.h"
|
||||
#include "Application.h"
|
||||
#include "InterfaceConfig.h"
|
||||
#include "ProgramObject.h"
|
||||
#include "RenderUtil.h"
|
||||
|
||||
#include "AmbientOcclusionEffect.h"
|
||||
|
||||
const int ROTATION_WIDTH = 4;
|
||||
const int ROTATION_HEIGHT = 4;
|
||||
|
||||
void AmbientOcclusionEffect::init() {
|
||||
switchToResourcesParentIfRequired();
|
||||
|
||||
_occlusionProgram = new ProgramObject();
|
||||
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/ambient_occlusion.vert");
|
||||
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, "resources/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
|
||||
|
@ -78,8 +79,8 @@ void AmbientOcclusionEffect::init() {
|
|||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
_blurProgram = new ProgramObject();
|
||||
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/ambient_occlusion.vert");
|
||||
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, "resources/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();
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#ifndef __interface__AmbientOcclusionEffect__
|
||||
#define __interface__AmbientOcclusionEffect__
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
class ProgramObject;
|
||||
|
||||
/// A screen space ambient occlusion effect. See John Chapman's tutorial at
|
||||
|
|
|
@ -42,7 +42,7 @@ QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const {
|
|||
|
||||
static ProgramObject* createProgram(const QString& name) {
|
||||
ProgramObject* program = new ProgramObject();
|
||||
program->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/" + name + ".frag");
|
||||
program->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/" + name + ".frag");
|
||||
program->link();
|
||||
|
||||
program->bind();
|
||||
|
@ -57,8 +57,6 @@ void GlowEffect::init() {
|
|||
qDebug("[ERROR] GlowEffeect is already initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
|
||||
_addProgram = createProgram("glow_add");
|
||||
_horizontalBlurProgram = createProgram("horizontal_blur");
|
||||
|
|
|
@ -64,17 +64,18 @@ QVector<Model::JointState> Model::createJointStates(const FBXGeometry& geometry)
|
|||
|
||||
void Model::init() {
|
||||
if (!_program.isLinked()) {
|
||||
switchToResourcesParentIfRequired();
|
||||
_program.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/model.vert");
|
||||
_program.addShaderFromSourceFile(QGLShader::Fragment, "resources/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, "resources/shaders/model_normal_map.vert");
|
||||
_normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/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();
|
||||
|
@ -83,14 +84,18 @@ void Model::init() {
|
|||
_normalMapTangentLocation = _normalMapProgram.attributeLocation("tangent");
|
||||
_normalMapProgram.release();
|
||||
|
||||
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/skin_model.vert");
|
||||
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/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, "resources/shaders/skin_model_normal_map.vert");
|
||||
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/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);
|
||||
|
|
|
@ -29,7 +29,7 @@ PointShader::~PointShader() {
|
|||
|
||||
ProgramObject* PointShader::createPointShaderProgram(const QString& name) {
|
||||
ProgramObject* program = new ProgramObject();
|
||||
program->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/" + name + ".vert" );
|
||||
program->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/" + name + ".vert" );
|
||||
program->link();
|
||||
return program;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ void PointShader::init() {
|
|||
qDebug("[ERROR] PointShader is already initialized.");
|
||||
return;
|
||||
}
|
||||
switchToResourcesParentIfRequired();
|
||||
_program = createPointShaderProgram("point_size");
|
||||
_initialized = true;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ GLuint TextureCache::getBlueTextureID() {
|
|||
GLuint TextureCache::getFileTextureID(const QString& filename) {
|
||||
GLuint id = _fileTextureIDs.value(filename);
|
||||
if (id == 0) {
|
||||
switchToResourcesParentIfRequired();
|
||||
QImage image = QImage(filename).convertToFormat(QImage::Format_ARGB32);
|
||||
|
||||
glGenTextures(1, &id);
|
||||
|
|
|
@ -29,8 +29,8 @@ VoxelShader::~VoxelShader() {
|
|||
|
||||
ProgramObject* VoxelShader::createGeometryShaderProgram(const QString& name) {
|
||||
ProgramObject* program = new ProgramObject();
|
||||
program->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/passthrough.vert" );
|
||||
program->addShaderFromSourceFile(QGLShader::Geometry, "resources/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;
|
||||
|
@ -46,7 +46,7 @@ void VoxelShader::init() {
|
|||
qDebug("[ERROR] TestProgram is already initialized.");
|
||||
return;
|
||||
}
|
||||
switchToResourcesParentIfRequired();
|
||||
|
||||
_program = createGeometryShaderProgram("voxel");
|
||||
_initialized = true;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,16 @@
|
|||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QTextBlock>
|
||||
#include <QtGui>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
#include "ui/LogDialog.h"
|
||||
|
||||
const int TOP_BAR_HEIGHT = 46;
|
||||
|
@ -36,9 +41,9 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog
|
|||
setWindowTitle("Log");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
QFile styleSheet("resources/styles/log_dialog.qss");
|
||||
QFile styleSheet(Application::resourcesPath() + "styles/log_dialog.qss");
|
||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||
QDir::setCurrent(Application::resourcesPath());
|
||||
setStyleSheet(styleSheet.readAll());
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef __interface__LogDialog__
|
||||
#define __interface__LogDialog__
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMutex>
|
||||
#include <QPlainTextEdit>
|
||||
|
|
|
@ -113,8 +113,8 @@ MetavoxelEditor::MetavoxelEditor() :
|
|||
if (_gridProgram.isLinked()) {
|
||||
return;
|
||||
}
|
||||
switchToResourcesParentIfRequired();
|
||||
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/grid.frag");
|
||||
|
||||
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag");
|
||||
_gridProgram.link();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,16 @@
|
|||
// Created by stojce on 23.10.2013.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
|
||||
#include "RearMirrorTools.h"
|
||||
#include "Util.h"
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <SharedUtil.h>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include "RearMirrorTools.h"
|
||||
|
||||
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
|
||||
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
|
||||
|
@ -23,12 +28,11 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se
|
|||
_windowed(false),
|
||||
_fullScreen(false)
|
||||
{
|
||||
_zoomLevel = HEAD,
|
||||
switchToResourcesParentIfRequired();
|
||||
_closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png"));
|
||||
_resetTextureId = _parent->bindTexture(QImage("./resources/images/reset.png"));
|
||||
_zoomHeadTextureId = _parent->bindTexture(QImage("./resources/images/head.png"));
|
||||
_zoomBodyTextureId = _parent->bindTexture(QImage("./resources/images/body.png"));
|
||||
_zoomLevel = HEAD;
|
||||
_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);
|
||||
|
|
|
@ -178,7 +178,7 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
|||
unsigned int numPalms = *sourceBuffer++;
|
||||
|
||||
for (unsigned int handIndex = 0; handIndex < numPalms; ++handIndex) {
|
||||
if (handIndex >= getNumPalms())
|
||||
if (handIndex >= (unsigned int)getNumPalms())
|
||||
addNewPalm();
|
||||
PalmData& palm = getPalms()[handIndex];
|
||||
|
||||
|
@ -196,7 +196,7 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
|||
palm.setSixenseID(handIndex);
|
||||
|
||||
for (unsigned int fingerIndex = 0; fingerIndex < numFingers; ++fingerIndex) {
|
||||
if (fingerIndex < palm.getNumFingers()) {
|
||||
if (fingerIndex < (unsigned int)palm.getNumFingers()) {
|
||||
FingerData& finger = palm.getFingers()[fingerIndex];
|
||||
|
||||
glm::vec3 tipPosition;
|
||||
|
|
|
@ -335,7 +335,7 @@ glm::vec3 AABox::getClosestPointOnFace(const glm::vec4& origin, const glm::vec4&
|
|||
secondAxisMaxPlane + thirdAxisMaxPlane + offset };
|
||||
|
||||
float minDistance = FLT_MAX;
|
||||
for (int i = 0; i < sizeof(diagonals) / sizeof(diagonals[0]); i++) {
|
||||
for (size_t i = 0; i < sizeof(diagonals) / sizeof(diagonals[0]); i++) {
|
||||
float divisor = glm::dot(direction, diagonals[i]);
|
||||
if (fabs(divisor) < EPSILON) {
|
||||
continue; // segment is parallel to diagonal plane
|
||||
|
|
|
@ -50,7 +50,7 @@ void JurisdictionMap::copyContents(unsigned char* rootCodeIn, const std::vector<
|
|||
unsigned char* rootCode;
|
||||
std::vector<unsigned char*> endNodes;
|
||||
if (rootCodeIn) {
|
||||
int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(rootCodeIn));
|
||||
size_t bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(rootCodeIn));
|
||||
rootCode = new unsigned char[bytes];
|
||||
memcpy(rootCode, rootCodeIn, bytes);
|
||||
} else {
|
||||
|
@ -60,7 +60,7 @@ void JurisdictionMap::copyContents(unsigned char* rootCodeIn, const std::vector<
|
|||
|
||||
for (size_t i = 0; i < endNodesIn.size(); i++) {
|
||||
if (endNodesIn[i]) {
|
||||
int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(endNodesIn[i]));
|
||||
size_t bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(endNodesIn[i]));
|
||||
unsigned char* endNodeCode = new unsigned char[bytes];
|
||||
memcpy(endNodeCode, endNodesIn[i], bytes);
|
||||
endNodes.push_back(endNodeCode);
|
||||
|
@ -133,7 +133,7 @@ void myDebugPrintOctalCode(const unsigned char* octalCode, bool withNewLine) {
|
|||
if (!octalCode) {
|
||||
printf("NULL");
|
||||
} else {
|
||||
for (int i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) {
|
||||
for (size_t i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) {
|
||||
myDebugoutputBits(octalCode[i],false);
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int avail
|
|||
|
||||
// add the root jurisdiction
|
||||
if (_rootOctalCode) {
|
||||
int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(_rootOctalCode));
|
||||
size_t bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(_rootOctalCode));
|
||||
memcpy(destinationBuffer, &bytes, sizeof(bytes));
|
||||
destinationBuffer += sizeof(bytes);
|
||||
memcpy(destinationBuffer, _rootOctalCode, bytes);
|
||||
|
@ -306,7 +306,7 @@ int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int avail
|
|||
|
||||
for (int i=0; i < endNodeCount; i++) {
|
||||
unsigned char* endNodeCode = _endNodes[i];
|
||||
int bytes = 0;
|
||||
size_t bytes = 0;
|
||||
if (endNodeCode) {
|
||||
bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(endNodeCode));
|
||||
}
|
||||
|
|
|
@ -222,10 +222,8 @@ int Octree::readNodeData(OctreeElement* destinationNode, const unsigned char* no
|
|||
}
|
||||
|
||||
OctreeElement* childNodeAt = destinationNode->getChildAtIndex(i);
|
||||
bool nodeWasDirty = false;
|
||||
bool nodeIsDirty = false;
|
||||
if (childNodeAt) {
|
||||
nodeWasDirty = childNodeAt->isDirty();
|
||||
bytesRead += childNodeAt->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args);
|
||||
childNodeAt->setSourceUUID(args.sourceUUID);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void OctreeElement::init(unsigned char * octalCode) {
|
|||
_voxelNodeLeafCount++; // all nodes start as leaf nodes
|
||||
|
||||
|
||||
int octalCodeLength = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode));
|
||||
size_t octalCodeLength = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode));
|
||||
if (octalCodeLength > sizeof(_octalCode)) {
|
||||
_octalCode.pointer = octalCode;
|
||||
_octcodePointer = true;
|
||||
|
|
|
@ -225,6 +225,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
|||
// while ramping it up to 1 when attenuationFactor = 0
|
||||
damping = DAMPING + (1.f - attenuationFactor) * (1.f - DAMPING);
|
||||
}
|
||||
collision->_damping = damping;
|
||||
}
|
||||
// HACK END
|
||||
|
||||
|
|
|
@ -234,7 +234,6 @@ void ParticleTreeElement::getParticles(const glm::vec3& searchPosition, float se
|
|||
uint16_t numberOfParticles = _particles->size();
|
||||
for (uint16_t i = 0; i < numberOfParticles; i++) {
|
||||
const Particle* particle = &(*_particles)[i];
|
||||
glm::vec3 particlePosition = particle->getPosition();
|
||||
float distance = glm::length(particle->getPosition() - searchPosition);
|
||||
if (distance < searchRadius + particle->getRadius()) {
|
||||
foundParticles.push_back(particle);
|
||||
|
@ -294,15 +293,14 @@ int ParticleTreeElement::readElementDataFromBuffer(const unsigned char* data, in
|
|||
uint16_t numberOfParticles = 0;
|
||||
int expectedBytesPerParticle = Particle::expectedBytes();
|
||||
|
||||
if (bytesLeftToRead >= sizeof(numberOfParticles)) {
|
||||
|
||||
if (bytesLeftToRead >= (int)sizeof(numberOfParticles)) {
|
||||
// read our particles in....
|
||||
numberOfParticles = *(uint16_t*)dataAt;
|
||||
dataAt += sizeof(numberOfParticles);
|
||||
bytesLeftToRead -= sizeof(numberOfParticles);
|
||||
bytesLeftToRead -= (int)sizeof(numberOfParticles);
|
||||
bytesRead += sizeof(numberOfParticles);
|
||||
|
||||
if (bytesLeftToRead >= (numberOfParticles * expectedBytesPerParticle)) {
|
||||
if (bytesLeftToRead >= (int)(numberOfParticles * expectedBytesPerParticle)) {
|
||||
for (uint16_t i = 0; i < numberOfParticles; i++) {
|
||||
Particle tempParticle;
|
||||
int bytesForThisParticle = tempParticle.readParticleDataFromBuffer(dataAt, bytesLeftToRead, args);
|
||||
|
|
|
@ -35,7 +35,7 @@ void printOctalCode(const unsigned char* octalCode) {
|
|||
qDebug("NULL");
|
||||
} else {
|
||||
QDebug continuedDebug = qDebug().nospace();
|
||||
for (int i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) {
|
||||
for (size_t i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) {
|
||||
outputBits(octalCode[i], &continuedDebug);
|
||||
}
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ char sectionValue(const unsigned char* startByte, char startIndexInByte) {
|
|||
}
|
||||
}
|
||||
|
||||
int bytesRequiredForCodeLength(unsigned char threeBitCodes) {
|
||||
size_t bytesRequiredForCodeLength(unsigned char threeBitCodes) {
|
||||
if (threeBitCodes == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 1 + (int)ceilf((threeBitCodes * 3) / 8.0f);
|
||||
return 1 + ceilf((threeBitCodes * 3) / 8.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,10 +78,10 @@ unsigned char* childOctalCode(const unsigned char* parentOctalCode, char childNu
|
|||
: 0;
|
||||
|
||||
// get the number of bytes used by the parent octal code
|
||||
int parentCodeBytes = bytesRequiredForCodeLength(parentCodeSections);
|
||||
size_t parentCodeBytes = bytesRequiredForCodeLength(parentCodeSections);
|
||||
|
||||
// child code will have one more section than the parent
|
||||
int childCodeBytes = bytesRequiredForCodeLength(parentCodeSections + 1);
|
||||
size_t childCodeBytes = bytesRequiredForCodeLength(parentCodeSections + 1);
|
||||
|
||||
// create a new buffer to hold the new octal code
|
||||
unsigned char* newCode = new unsigned char[childCodeBytes];
|
||||
|
@ -175,7 +175,7 @@ OctalCodeComparison compareOctalCodes(const unsigned char* codeA, const unsigned
|
|||
|
||||
OctalCodeComparison result = LESS_THAN; // assume it's shallower
|
||||
|
||||
int numberOfBytes = std::min(bytesRequiredForCodeLength(*codeA), bytesRequiredForCodeLength(*codeB));
|
||||
size_t numberOfBytes = std::min(bytesRequiredForCodeLength(*codeA), bytesRequiredForCodeLength(*codeB));
|
||||
int compare = memcmp(codeA, codeB, numberOfBytes);
|
||||
|
||||
if (compare < 0) {
|
||||
|
@ -367,7 +367,7 @@ QString octalCodeToHexString(const unsigned char* octalCode) {
|
|||
if (!octalCode) {
|
||||
output = "00";
|
||||
} else {
|
||||
for (int i = 0; i < bytesRequiredForCodeLength(*octalCode); i++) {
|
||||
for (size_t i = 0; i < bytesRequiredForCodeLength(*octalCode); i++) {
|
||||
output.append(QString("%1").arg(octalCode[i], HEX_BYTE_SIZE, HEX_NUMBER_BASE, QChar('0')).toUpper());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ const int GREEN_INDEX = 1;
|
|||
const int BLUE_INDEX = 2;
|
||||
|
||||
void printOctalCode(const unsigned char* octalCode);
|
||||
int bytesRequiredForCodeLength(unsigned char threeBitCodes);
|
||||
size_t bytesRequiredForCodeLength(unsigned char threeBitCodes);
|
||||
int branchIndexWithDescendant(const unsigned char* ancestorOctalCode, const unsigned char* descendantOctalCode);
|
||||
unsigned char* childOctalCode(const unsigned char* parentOctalCode, char childNumber);
|
||||
|
||||
|
|
|
@ -198,21 +198,6 @@ bool isInEnvironment(const char* environment) {
|
|||
}
|
||||
}
|
||||
|
||||
void switchToResourcesParentIfRequired() {
|
||||
#ifdef __APPLE__
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
char path[PATH_MAX];
|
||||
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {
|
||||
// error!
|
||||
}
|
||||
CFRelease(resourcesURL);
|
||||
|
||||
chdir(path);
|
||||
chdir("..");
|
||||
#endif
|
||||
}
|
||||
|
||||
void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes) {
|
||||
// seed the the random number generator
|
||||
srand(time(NULL));
|
||||
|
|
|
@ -93,8 +93,6 @@ int getNthBit(unsigned char byte, int ordinal); /// determines the bit placement
|
|||
|
||||
bool isInEnvironment(const char* environment);
|
||||
|
||||
void switchToResourcesParentIfRequired();
|
||||
|
||||
void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes);
|
||||
|
||||
const char* getCmdOption(int argc, const char * argv[],const char* option);
|
||||
|
|
Loading…
Reference in a new issue