mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 22:42:17 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into metavoxels
This commit is contained in:
commit
d1747ed8d1
21 changed files with 142 additions and 113 deletions
|
@ -8,15 +8,11 @@ set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
|
|||
# setup for find modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/")
|
||||
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Script REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Network Script Widgets)
|
||||
|
||||
include("${MACRO_DIR}/SetupHifiProject.cmake")
|
||||
setup_hifi_project(${TARGET_NAME} TRUE)
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Network Script Widgets)
|
||||
|
||||
# include glm
|
||||
include("${MACRO_DIR}/IncludeGLM.cmake")
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
@ -40,3 +36,5 @@ endif (UNIX)
|
|||
IF (WIN32)
|
||||
target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Script)
|
||||
|
|
|
@ -18,8 +18,6 @@ include(${MACRO_DIR}/SetupHifiProject.cmake)
|
|||
|
||||
setup_hifi_project(${TARGET_NAME} TRUE)
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Network)
|
||||
|
||||
# remove and then copy the files for the webserver
|
||||
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove_directory
|
||||
|
@ -36,4 +34,6 @@ link_hifi_library(embedded-webserver ${TARGET_NAME} "${ROOT_DIR}")
|
|||
|
||||
IF (WIN32)
|
||||
target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Network)
|
|
@ -18,6 +18,10 @@ function getRandomInt (min, max) {
|
|||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
function printVector(string, vector) {
|
||||
print(string + " " + vector.x + ", " + vector.y + ", " + vector.z);
|
||||
}
|
||||
|
||||
var CHANCE_OF_MOVING = 0.005;
|
||||
var CHANCE_OF_SOUND = 0.005;
|
||||
var CHANCE_OF_HEAD_TURNING = 0.05;
|
||||
|
@ -31,6 +35,7 @@ var X_MIN = 0.0;
|
|||
var X_MAX = 5.0;
|
||||
var Z_MIN = 0.0;
|
||||
var Z_MAX = 5.0;
|
||||
var Y_PELVIS = 2.5;
|
||||
|
||||
var MOVE_RANGE_SMALL = 0.5;
|
||||
var MOVE_RANGE_BIG = Math.max(X_MAX - X_MIN, Z_MAX - Z_MIN) / 2.0;
|
||||
|
@ -41,7 +46,7 @@ var TURN_RATE = 0.15;
|
|||
var PITCH_RATE = 0.20;
|
||||
var PITCH_RANGE = 30.0;
|
||||
|
||||
var firstPosition = { x: getRandomFloat(X_MIN, X_MAX), y: 0, z: getRandomFloat(Z_MIN, Z_MAX) };
|
||||
var firstPosition = { x: getRandomFloat(X_MIN, X_MAX), y: Y_PELVIS, z: getRandomFloat(Z_MIN, Z_MAX) };
|
||||
var targetPosition = { x: 0, y: 0, z: 0 };
|
||||
var targetDirection = { x: 0, y: 0, z: 0, w: 0 };
|
||||
var currentDirection = { x: 0, y: 0, z: 0, w: 0 };
|
||||
|
@ -72,9 +77,6 @@ function playRandomSound(position) {
|
|||
}
|
||||
}
|
||||
|
||||
// change the avatar's position to the random one
|
||||
Avatar.position = firstPosition;
|
||||
|
||||
// pick an integer between 1 and 20 for the face model for this bot
|
||||
botNumber = getRandomInt(1, 100);
|
||||
|
||||
|
@ -103,6 +105,10 @@ Avatar.billboardURL = "https://s3-us-west-1.amazonaws.com/highfidelity-public/me
|
|||
|
||||
Agent.isAvatar = true;
|
||||
|
||||
// change the avatar's position to the random one
|
||||
Avatar.position = firstPosition;
|
||||
printVector("New bot, position = ", Avatar.position);
|
||||
|
||||
function updateBehavior() {
|
||||
if (Math.random() < CHANCE_OF_SOUND) {
|
||||
playRandomSound(Avatar.position);
|
||||
|
@ -132,6 +138,7 @@ function updateBehavior() {
|
|||
}
|
||||
targetPosition.x = clamp(targetPosition.x, X_MIN, X_MAX);
|
||||
targetPosition.z = clamp(targetPosition.z, Z_MIN, Z_MAX);
|
||||
targetPosition.y = Y_PELVIS;
|
||||
|
||||
isMoving = true;
|
||||
} else {
|
||||
|
|
|
@ -920,7 +920,7 @@ function keyPressEvent(event) {
|
|||
red: colors[color].red,
|
||||
green: colors[color].green,
|
||||
blue: colors[color].blue };
|
||||
Voxels.eraseVoxel(voxelDetails.x, voxelDetails.y, voxelDetails.z, voxelDetails.s);
|
||||
Voxels.eraseVoxel(newVoxel.x, newVoxel.y, newVoxel.z, newVoxel.s);
|
||||
Voxels.setVoxel(newVoxel.x, newVoxel.y, newVoxel.z, newVoxel.s, newVoxel.red, newVoxel.green, newVoxel.blue);
|
||||
setAudioPosition();
|
||||
playRandomAddSound(audioOptions);
|
||||
|
|
|
@ -57,12 +57,12 @@ function shootBullet(position, velocity) {
|
|||
damping: 0 });
|
||||
|
||||
// Play firing sounds
|
||||
audioOptions.position = position;
|
||||
audioOptions.position = position;
|
||||
Audio.playSound(fireSound, audioOptions);
|
||||
}
|
||||
|
||||
function particleCollisionWithVoxel(particle, voxel) {
|
||||
var HOLE_SIZE = 0.25;
|
||||
var HOLE_SIZE = 0.125;
|
||||
var particleProperties = Particles.getParticleProperties(particle);
|
||||
var position = particleProperties.position;
|
||||
Particles.deleteParticle(particle);
|
||||
|
|
|
@ -75,15 +75,7 @@ foreach(EXTERNAL_SOURCE_SUBDIR ${EXTERNAL_SOURCE_SUBDIRS})
|
|||
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${SUBDIR_SRCS}")
|
||||
endforeach(EXTERNAL_SOURCE_SUBDIR)
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
find_package(Qt5Multimedia REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5OpenGL REQUIRED)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
find_package(Qt5WebKit REQUIRED)
|
||||
find_package(Qt5WebKitWidgets REQUIRED)
|
||||
find_package(Qt5Xml REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools)
|
||||
|
||||
# grab the ui files in resources/ui
|
||||
file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
|
||||
|
@ -180,8 +172,6 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
|||
target_link_libraries(${TARGET_NAME} "${LIBOVR_LIBRARIES}")
|
||||
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools)
|
||||
|
||||
# include headers for interface and InterfaceConfig.
|
||||
include_directories(
|
||||
"${PROJECT_SOURCE_DIR}/src"
|
||||
|
@ -200,6 +190,8 @@ target_link_libraries(
|
|||
${TARGET_NAME}
|
||||
"${FACESHIFT_LIBRARIES}"
|
||||
"${ZLIB_LIBRARIES}"
|
||||
Qt5::Core Qt5::Gui Qt5::Multimedia Qt5::Network Qt5::OpenGL
|
||||
Qt5::Script Qt5::Svg Qt5::WebKit Qt5::WebKitWidgets Qt5::Xml Qt5::UiTools
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
|
|
|
@ -110,9 +110,11 @@ const QString CUSTOM_URL_SCHEME = "hifi:";
|
|||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
|
||||
if (message.size() > 0) {
|
||||
QString messageWithNewLine = message + "\n";
|
||||
fprintf(stdout, "%s", messageWithNewLine.toLocal8Bit().constData());
|
||||
Application::getInstance()->getLogger()->addMessage(messageWithNewLine.toLocal8Bit().constData());
|
||||
QString dateString = QDateTime::currentDateTime().toTimeSpec(Qt::LocalTime).toString(Qt::ISODate);
|
||||
QString formattedMessage = QString("[%1] %2\n").arg(dateString).arg(message);
|
||||
|
||||
fprintf(stdout, "%s", qPrintable(formattedMessage));
|
||||
Application::getInstance()->getLogger()->addMessage(qPrintable(formattedMessage));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,17 +404,17 @@ void Application::initializeGL() {
|
|||
|
||||
// initialize glut for shape drawing; Qt apparently initializes it on OS X
|
||||
#ifndef __APPLE__
|
||||
int argc = 0;
|
||||
glutInit(&argc, 0);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
static bool isInitialized = false;
|
||||
if (isInitialized) {
|
||||
return;
|
||||
} else {
|
||||
isInitialized = true;
|
||||
}
|
||||
int argc = 0;
|
||||
glutInit(&argc, 0);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err) {
|
||||
/* Problem: glewInit failed, something is seriously wrong. */
|
||||
|
@ -3479,7 +3481,6 @@ void Application::cleanupScriptMenuItem(const QString& scriptMenuName) {
|
|||
}
|
||||
|
||||
void Application::loadScript(const QString& fileNameString) {
|
||||
_activeScripts.append(fileNameString);
|
||||
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||
const char* fileName = fileNameAscii.data();
|
||||
|
||||
|
@ -3489,6 +3490,7 @@ void Application::loadScript(const QString& fileNameString) {
|
|||
return;
|
||||
}
|
||||
qDebug("Loading file %s...", fileName);
|
||||
_activeScripts.append(fileNameString);
|
||||
|
||||
// get file length....
|
||||
unsigned long fileLength = file.tellg();
|
||||
|
|
|
@ -13,8 +13,6 @@ find_package(Qt5Script REQUIRED)
|
|||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Script)
|
||||
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
|
@ -24,3 +22,5 @@ link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
|
|||
# link in the hifi voxels library
|
||||
link_hifi_library(octree ${TARGET_NAME} "${ROOT_DIR}")
|
||||
link_hifi_library(voxels ${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Script)
|
|
@ -13,4 +13,4 @@ find_package(Qt5Network REQUIRED)
|
|||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Network)
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Network)
|
|
@ -8,8 +8,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm
|
|||
|
||||
set(TARGET_NAME metavoxels)
|
||||
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Network Script Widgets)
|
||||
|
||||
include(${MACRO_DIR}/AutoMTC.cmake)
|
||||
auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
@ -17,8 +16,8 @@ auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
|
|||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME} "${AUTOMTC_SRC}")
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Network Script Widgets)
|
||||
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Script)
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ find_package(Qt5Widgets REQUIRED)
|
|||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Widgets)
|
||||
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
|
@ -24,4 +22,5 @@ link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
|
|||
# link ZLIB
|
||||
find_package(ZLIB)
|
||||
include_directories("${ZLIB_INCLUDE_DIRS}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets)
|
||||
|
|
|
@ -590,16 +590,26 @@ bool findRayIntersectionOp(OctreeElement* node, void* extraData) {
|
|||
}
|
||||
|
||||
bool Octree::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
OctreeElement*& node, float& distance, BoxFace& face, bool tryLock) {
|
||||
OctreeElement*& node, float& distance, BoxFace& face, Octree::lockType lockType) {
|
||||
RayArgs args = { origin / (float)(TREE_SCALE), direction, node, distance, face };
|
||||
|
||||
if (!tryLock) {
|
||||
bool gotLock = false;
|
||||
if (lockType == Octree::Lock) {
|
||||
lockForRead();
|
||||
gotLock = true;
|
||||
} else if (lockType == Octree::TryLock) {
|
||||
gotLock = tryLockForRead();
|
||||
if (!gotLock) {
|
||||
return args.found; // if we wanted to tryLock, and we couldn't then just bail...
|
||||
}
|
||||
}
|
||||
if (tryLock && tryLockForRead()) {
|
||||
recurseTreeWithOperation(findRayIntersectionOp, &args);
|
||||
|
||||
recurseTreeWithOperation(findRayIntersectionOp, &args);
|
||||
|
||||
if (gotLock) {
|
||||
unlock();
|
||||
}
|
||||
|
||||
return args.found;
|
||||
}
|
||||
|
||||
|
@ -635,7 +645,7 @@ bool findSpherePenetrationOp(OctreeElement* element, void* extraData) {
|
|||
}
|
||||
|
||||
bool Octree::findSpherePenetration(const glm::vec3& center, float radius, glm::vec3& penetration,
|
||||
void** penetratedObject, bool tryLock) {
|
||||
void** penetratedObject, Octree::lockType lockType) {
|
||||
|
||||
SphereArgs args = {
|
||||
center / (float)(TREE_SCALE),
|
||||
|
@ -644,17 +654,27 @@ bool Octree::findSpherePenetration(const glm::vec3& center, float radius, glm::v
|
|||
false,
|
||||
NULL };
|
||||
penetration = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (!tryLock) {
|
||||
|
||||
bool gotLock = false;
|
||||
if (lockType == Octree::Lock) {
|
||||
lockForRead();
|
||||
}
|
||||
if (tryLock && tryLockForRead()) {
|
||||
recurseTreeWithOperation(findSpherePenetrationOp, &args);
|
||||
if (penetratedObject) {
|
||||
*penetratedObject = args.penetratedObject;
|
||||
gotLock = true;
|
||||
} else if (lockType == Octree::TryLock) {
|
||||
gotLock = tryLockForRead();
|
||||
if (!gotLock) {
|
||||
return args.found; // if we wanted to tryLock, and we couldn't then just bail...
|
||||
}
|
||||
}
|
||||
|
||||
recurseTreeWithOperation(findSpherePenetrationOp, &args);
|
||||
if (penetratedObject) {
|
||||
*penetratedObject = args.penetratedObject;
|
||||
}
|
||||
|
||||
if (gotLock) {
|
||||
unlock();
|
||||
}
|
||||
|
||||
return args.found;
|
||||
}
|
||||
|
||||
|
@ -689,7 +709,7 @@ bool findCapsulePenetrationOp(OctreeElement* node, void* extraData) {
|
|||
}
|
||||
|
||||
bool Octree::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius,
|
||||
glm::vec3& penetration, bool tryLock) {
|
||||
glm::vec3& penetration, Octree::lockType lockType) {
|
||||
|
||||
CapsuleArgs args = {
|
||||
start / (float)(TREE_SCALE),
|
||||
|
@ -699,11 +719,20 @@ bool Octree::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end
|
|||
false };
|
||||
penetration = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (!tryLock) {
|
||||
bool gotLock = false;
|
||||
if (lockType == Octree::Lock) {
|
||||
lockForRead();
|
||||
gotLock = true;
|
||||
} else if (lockType == Octree::TryLock) {
|
||||
gotLock = tryLockForRead();
|
||||
if (!gotLock) {
|
||||
return args.found; // if we wanted to tryLock, and we couldn't then just bail...
|
||||
}
|
||||
}
|
||||
if (tryLock && tryLockForRead()) {
|
||||
recurseTreeWithOperation(findCapsulePenetrationOp, &args);
|
||||
|
||||
recurseTreeWithOperation(findCapsulePenetrationOp, &args);
|
||||
|
||||
if (gotLock) {
|
||||
unlock();
|
||||
}
|
||||
return args.found;
|
||||
|
@ -732,18 +761,28 @@ bool getElementEnclosingOperation(OctreeElement* element, void* extraData) {
|
|||
return true; // keep looking
|
||||
}
|
||||
|
||||
OctreeElement* Octree::getElementEnclosingPoint(const glm::vec3& point, bool tryLock) {
|
||||
OctreeElement* Octree::getElementEnclosingPoint(const glm::vec3& point, Octree::lockType lockType) {
|
||||
GetElementEnclosingArgs args;
|
||||
args.point = point;
|
||||
args.element = NULL;
|
||||
|
||||
if (!tryLock) {
|
||||
bool gotLock = false;
|
||||
if (lockType == Octree::Lock) {
|
||||
lockForRead();
|
||||
gotLock = true;
|
||||
} else if (lockType == Octree::TryLock) {
|
||||
gotLock = tryLockForRead();
|
||||
if (!gotLock) {
|
||||
return args.element; // if we wanted to tryLock, and we couldn't then just bail...
|
||||
}
|
||||
}
|
||||
if (tryLock && tryLockForRead()) {
|
||||
recurseTreeWithOperation(getElementEnclosingOperation, (void*)&args);
|
||||
|
||||
recurseTreeWithOperation(getElementEnclosingOperation, (void*)&args);
|
||||
|
||||
if (gotLock) {
|
||||
unlock();
|
||||
}
|
||||
|
||||
return args.element;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,16 +221,29 @@ public:
|
|||
void clearDirtyBit() { _isDirty = false; }
|
||||
void setDirtyBit() { _isDirty = true; }
|
||||
|
||||
// Octree does not currently handle its own locking, caller must use these to lock/unlock
|
||||
void lockForRead() { _lock.lockForRead(); }
|
||||
bool tryLockForRead() { return _lock.tryLockForRead(); }
|
||||
void lockForWrite() { _lock.lockForWrite(); }
|
||||
bool tryLockForWrite() { return _lock.tryLockForWrite(); }
|
||||
void unlock() { _lock.unlock(); }
|
||||
// output hints from the encode process
|
||||
typedef enum {
|
||||
Lock,
|
||||
TryLock,
|
||||
NoLock
|
||||
} lockType;
|
||||
|
||||
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
OctreeElement*& node, float& distance, BoxFace& face, bool tryLock = true);
|
||||
OctreeElement*& node, float& distance, BoxFace& face, Octree::lockType lockType = Octree::TryLock);
|
||||
|
||||
bool findSpherePenetration(const glm::vec3& center, float radius, glm::vec3& penetration,
|
||||
void** penetratedObject = NULL, bool tryLock = true);
|
||||
void** penetratedObject = NULL, Octree::lockType lockType = Octree::TryLock);
|
||||
|
||||
bool findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius,
|
||||
glm::vec3& penetration, bool tryLock = true);
|
||||
glm::vec3& penetration, Octree::lockType lockType = Octree::TryLock);
|
||||
|
||||
OctreeElement* getElementEnclosingPoint(const glm::vec3& point, bool tryLock = true);
|
||||
OctreeElement* getElementEnclosingPoint(const glm::vec3& point, Octree::lockType lockType = Octree::TryLock);
|
||||
|
||||
// Note: this assumes the fileFormat is the HIO individual voxels code files
|
||||
void loadOctreeFile(const char* fileName, bool wantColorRandomizer);
|
||||
|
@ -238,13 +251,7 @@ public:
|
|||
// these will read/write files that match the wireformat, excluding the 'V' leading
|
||||
void writeToSVOFile(const char* filename, OctreeElement* node = NULL);
|
||||
bool readFromSVOFile(const char* filename);
|
||||
|
||||
// Octree does not currently handle its own locking, caller must use these to lock/unlock
|
||||
void lockForRead() { _lock.lockForRead(); }
|
||||
bool tryLockForRead() { return _lock.tryLockForRead(); }
|
||||
void lockForWrite() { _lock.lockForWrite(); }
|
||||
bool tryLockForWrite() { return _lock.tryLockForWrite(); }
|
||||
void unlock() { _lock.unlock(); }
|
||||
|
||||
|
||||
unsigned long getOctreeElementsCount();
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ find_package(Qt5Widgets REQUIRED)
|
|||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Widgets)
|
||||
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
|
@ -25,4 +23,5 @@ link_hifi_library(octree ${TARGET_NAME} "${ROOT_DIR}")
|
|||
# link ZLIB
|
||||
find_package(ZLIB)
|
||||
include_directories("${ZLIB_INCLUDE_DIRS}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets)
|
||||
|
|
|
@ -58,7 +58,7 @@ bool ParticleCollisionSystem::updateOperation(OctreeElement* element, void* extr
|
|||
|
||||
void ParticleCollisionSystem::update() {
|
||||
// update all particles
|
||||
if (_particles->tryLockForWrite()) {
|
||||
if (_particles->tryLockForRead()) {
|
||||
_particles->recurseTreeWithOperation(updateOperation, this);
|
||||
_particles->unlock();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void ParticleCollisionSystem::updateCollisionWithParticles(Particle* particleA)
|
|||
const float COLLISION_FREQUENCY = 0.5f;
|
||||
glm::vec3 penetration;
|
||||
Particle* particleB;
|
||||
if (_particles->findSpherePenetration(center, radius, penetration, (void**)&particleB)) {
|
||||
if (_particles->findSpherePenetration(center, radius, penetration, (void**)&particleB, Octree::NoLock)) {
|
||||
// NOTE: 'penetration' is the depth that 'particleA' overlaps 'particleB'.
|
||||
// That is, it points from A into B.
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ find_package(Qt5Widgets REQUIRED)
|
|||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Widgets)
|
||||
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
|
@ -27,4 +25,5 @@ link_hifi_library(particles ${TARGET_NAME} "${ROOT_DIR}")
|
|||
# link ZLIB
|
||||
find_package(ZLIB)
|
||||
include_directories("${ZLIB_INCLUDE_DIRS}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets)
|
||||
|
|
|
@ -6,14 +6,11 @@ set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
|
|||
set(TARGET_NAME shared)
|
||||
project(${TARGET_NAME})
|
||||
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Network Widgets)
|
||||
|
||||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Network Widgets)
|
||||
|
||||
# include GLM
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
@ -31,3 +28,5 @@ if (UNIX AND NOT APPLE)
|
|||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(${TARGET_NAME} "${CMAKE_THREAD_LIBS_INIT}")
|
||||
endif (UNIX AND NOT APPLE)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets)
|
|
@ -8,14 +8,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm
|
|||
|
||||
set(TARGET_NAME voxels)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5Script REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Widgets Script)
|
||||
|
||||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||
setup_hifi_library(${TARGET_NAME})
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Widgets Script)
|
||||
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
|
@ -26,4 +23,5 @@ link_hifi_library(octree ${TARGET_NAME} "${ROOT_DIR}")
|
|||
# link ZLIB
|
||||
find_package(ZLIB)
|
||||
include_directories("${ZLIB_INCLUDE_DIRS}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets Qt5::Script)
|
||||
|
|
|
@ -61,15 +61,7 @@ foreach(EXTERNAL_SOURCE_SUBDIR ${EXTERNAL_SOURCE_SUBDIRS})
|
|||
set(APPLICATION_SRCS ${APPLICATION_SRCS} "${SUBDIR_SRCS}")
|
||||
endforeach(EXTERNAL_SOURCE_SUBDIR)
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
find_package(Qt5Multimedia REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5OpenGL REQUIRED)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
find_package(Qt5WebKit REQUIRED)
|
||||
find_package(Qt5WebKitWidgets REQUIRED)
|
||||
find_package(Qt5Xml REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools)
|
||||
|
||||
# grab the ui files in resources/ui
|
||||
file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
|
||||
|
@ -122,8 +114,6 @@ link_hifi_library(voxels ${TARGET_NAME} "${ROOT_DIR}")
|
|||
find_package(GLM REQUIRED)
|
||||
find_package(ZLIB)
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools)
|
||||
|
||||
# include headers for interface
|
||||
include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes")
|
||||
|
||||
|
@ -131,7 +121,9 @@ include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes"
|
|||
# use system flag so warnings are supressed
|
||||
include_directories(SYSTEM "${GLM_INCLUDE_DIRS}")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}"
|
||||
Qt5::Core Qt5::Gui Qt5::Multimedia Qt5::Network Qt5::OpenGL
|
||||
Qt5::Script Qt5::Svg Qt5::WebKit Qt5::WebKitWidgets Qt5::Xml Qt5::UiTools)
|
||||
|
||||
if (APPLE)
|
||||
# link in required OS X frameworks and include the right GL headers
|
||||
|
|
|
@ -8,9 +8,7 @@ set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
|
|||
# setup for find modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
|
||||
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Script REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Network Script Widgets)
|
||||
|
||||
include(${MACRO_DIR}/AutoMTC.cmake)
|
||||
auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
@ -18,8 +16,6 @@ auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
|
|||
include(${MACRO_DIR}/SetupHifiProject.cmake)
|
||||
setup_hifi_project(${TARGET_NAME} TRUE "${AUTOMTC_SRC}")
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Network Script Widgets)
|
||||
|
||||
#include glm
|
||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
@ -33,3 +29,5 @@ IF (WIN32)
|
|||
target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Script)
|
||||
|
||||
|
|
|
@ -12,12 +12,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake
|
|||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||
include_glm(${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
||||
find_package(Qt5Script REQUIRED)
|
||||
|
||||
include(${MACRO_DIR}/SetupHifiProject.cmake)
|
||||
setup_hifi_project(${TARGET_NAME} TRUE)
|
||||
|
||||
find_package(Qt5Script REQUIRED)
|
||||
qt5_use_modules(${TARGET_NAME} Script)
|
||||
|
||||
# link in the shared library
|
||||
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
|
||||
link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
|
||||
|
@ -31,3 +30,5 @@ link_hifi_library(voxels ${TARGET_NAME} "${ROOT_DIR}")
|
|||
IF (WIN32)
|
||||
target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Qt5::Script)
|
Loading…
Reference in a new issue