mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-22 18:03:19 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
ced4061d76
16 changed files with 318 additions and 174 deletions
3
cmake/externals/boostconfig/CMakeLists.txt
vendored
3
cmake/externals/boostconfig/CMakeLists.txt
vendored
|
@ -4,7 +4,8 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL https://github.com/boostorg/config/archive/boost-1.58.0.zip
|
#URL https://github.com/boostorg/config/archive/boost-1.58.0.zip
|
||||||
|
URL http://hifi-public.s3.amazonaws.com/dependencies/config-boost-1.58.0.zip
|
||||||
URL_MD5 42fa673bae2b7645a22736445e80eb8d
|
URL_MD5 42fa673bae2b7645a22736445e80eb8d
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
|
|
6
cmake/externals/bullet/CMakeLists.txt
vendored
6
cmake/externals/bullet/CMakeLists.txt
vendored
|
@ -17,7 +17,8 @@ include(ExternalProject)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip
|
# URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip
|
||||||
|
URL http://hifi-public.s3.amazonaws.com/dependencies/bullet-2.82-r2704.zip
|
||||||
URL_MD5 f5e8914fc9064ad32e0d62d19d33d977
|
URL_MD5 f5e8914fc9064ad32e0d62d19d33d977
|
||||||
CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 -DUSE_DX11=0
|
CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 -DUSE_DX11=0
|
||||||
LOG_DOWNLOAD 1
|
LOG_DOWNLOAD 1
|
||||||
|
@ -28,7 +29,8 @@ if (WIN32)
|
||||||
else ()
|
else ()
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz
|
#URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz
|
||||||
|
URL http://hifi-public.s3.amazonaws.com/dependencies/bullet-2.82-r2704.tgz
|
||||||
URL_MD5 70b3c8d202dee91a0854b4cbc88173e8
|
URL_MD5 70b3c8d202dee91a0854b4cbc88173e8
|
||||||
CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0
|
CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0
|
||||||
LOG_DOWNLOAD 1
|
LOG_DOWNLOAD 1
|
||||||
|
|
3
cmake/externals/openvr/CMakeLists.txt
vendored
3
cmake/externals/openvr/CMakeLists.txt
vendored
|
@ -7,7 +7,8 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL https://github.com/ValveSoftware/openvr/archive/0.9.1.zip
|
#URL https://github.com/ValveSoftware/openvr/archive/0.9.1.zip
|
||||||
|
URL http://hifi-public.s3.amazonaws.com/dependencies/openvr-0.9.1.zip
|
||||||
URL_MD5 f986f5a6815e9454c53c5bf58ce02fdc
|
URL_MD5 f986f5a6815e9454c53c5bf58ce02fdc
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
|
|
4
cmake/externals/sdl2/CMakeLists.txt
vendored
4
cmake/externals/sdl2/CMakeLists.txt
vendored
|
@ -7,7 +7,7 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL http://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip
|
URL http://hifi-public.s3.amazonaws.com/dependencies/SDL2-devel-2.0.3-VC.zip
|
||||||
URL_MD5 30a333bcbe94bc5016e8799c73e86233
|
URL_MD5 30a333bcbe94bc5016e8799c73e86233
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
|
@ -18,7 +18,7 @@ elseif (APPLE)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL https://hifi-public.s3.amazonaws.com/dependencies/SDL2-2.0.3.zip
|
URL http://hifi-public.s3.amazonaws.com/dependencies/SDL2-2.0.3.zip
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DVIDEO_OPENGL=OFF
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DVIDEO_OPENGL=OFF
|
||||||
BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build
|
BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build
|
||||||
LOG_DOWNLOAD 1
|
LOG_DOWNLOAD 1
|
||||||
|
|
8
cmake/externals/sixense/CMakeLists.txt
vendored
8
cmake/externals/sixense/CMakeLists.txt
vendored
|
@ -4,15 +4,15 @@ set(EXTERNAL_NAME sixense)
|
||||||
|
|
||||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||||
|
|
||||||
#set(SIXENSE_URL "https://hifi-public.s3.amazonaws.com/dependencies/SixenseSDK_062612.zip")
|
#set(SIXENSE_URL "http://hifi-public.s3.amazonaws.com/dependencies/SixenseSDK_062612.zip")
|
||||||
#set(SIXENSE_URL_MD5 "10cc8dc470d2ac1244a88cf04bc549cc")
|
#set(SIXENSE_URL_MD5 "10cc8dc470d2ac1244a88cf04bc549cc")
|
||||||
#set(SIXENSE_NEW_LAYOUT 0)
|
#set(SIXENSE_NEW_LAYOUT 0)
|
||||||
|
|
||||||
#set(SIXENSE_URL "https://public.s3.amazonaws.com/dependencies/SixenseSDK_071615.zip")
|
#set(SIXENSE_URL "http://public.s3.amazonaws.com/dependencies/SixenseSDK_071615.zip")
|
||||||
#set(SIXENSE_URL_MD5 "752a3901f334124e9cffc2ba4136ef7d")
|
#set(SIXENSE_URL_MD5 "752a3901f334124e9cffc2ba4136ef7d")
|
||||||
#set(SIXENSE_NEW_LAYOUT 1)
|
#set(SIXENSE_NEW_LAYOUT 1)
|
||||||
|
|
||||||
set(SIXENSE_URL "https://hifi-public.s3.amazonaws.com/dependencies/SixenseSDK_102215.zip")
|
set(SIXENSE_URL "http://hifi-public.s3.amazonaws.com/dependencies/SixenseSDK_102215.zip")
|
||||||
set(SIXENSE_URL_MD5 "93c3a6795cce777a0f472b09532935f1")
|
set(SIXENSE_URL_MD5 "93c3a6795cce777a0f472b09532935f1")
|
||||||
set(SIXENSE_NEW_LAYOUT 1)
|
set(SIXENSE_NEW_LAYOUT 1)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ if (WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${SIXENSE_NEW_LAYOUT})
|
if (${SIXENSE_NEW_LAYOUT})
|
||||||
# for 2015 SDKs (using the 2013 versions may be causing the crash)
|
# for 2015 SDKs (using the VS2013 versions may be causing the crash, so use the VS2010 versions)
|
||||||
set(${EXTERNAL_NAME_UPPER}_DLL_PATH "${SOURCE_DIR}/bin/${ARCH_DIR}/VS2010/release_dll")
|
set(${EXTERNAL_NAME_UPPER}_DLL_PATH "${SOURCE_DIR}/bin/${ARCH_DIR}/VS2010/release_dll")
|
||||||
set(${EXTERNAL_NAME_UPPER}_LIB_PATH "${SOURCE_DIR}/lib/${ARCH_DIR}/VS2010/release_dll")
|
set(${EXTERNAL_NAME_UPPER}_LIB_PATH "${SOURCE_DIR}/lib/${ARCH_DIR}/VS2010/release_dll")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -16,11 +16,11 @@ var NUM_AC = 3; // This is the number of AC. Their ID need to be unique and betw
|
||||||
var NAMES = new Array("Craig", "Clement", "Jeff"); // ACs names ordered by IDs (Default name is "ACx", x = ID + 1))
|
var NAMES = new Array("Craig", "Clement", "Jeff"); // ACs names ordered by IDs (Default name is "ACx", x = ID + 1))
|
||||||
|
|
||||||
// Those variables MUST be common to every scripts
|
// Those variables MUST be common to every scripts
|
||||||
var controlVoxelSize = 0.25;
|
var controlEntitySize = 0.25;
|
||||||
var controlVoxelPosition = { x: 2000 , y: 0, z: 0 };
|
var controlEntityPosition = { x: 2000 , y: 0, z: 0 };
|
||||||
|
|
||||||
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
||||||
Script.include("libraries/toolBars.js");
|
Script.include("../libraries/toolBars.js");
|
||||||
|
|
||||||
var DO_NOTHING = 0;
|
var DO_NOTHING = 0;
|
||||||
var PLAY = 1;
|
var PLAY = 1;
|
||||||
|
@ -138,16 +138,22 @@ function sendCommand(id, action) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id === toolBars.length - 1) {
|
if (id === (toolBars.length - 1)) {
|
||||||
for (i = 0; i < NUM_AC; i++) {
|
for (i = 0; i < NUM_AC; i++) {
|
||||||
sendCommand(i, action);
|
sendCommand(i, action);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Fix this to use some mechanism other than voxels
|
var position = { x: controlEntityPosition.x + id * controlEntitySize,
|
||||||
//Voxels.setVoxel(controlVoxelPosition.x + id * controlVoxelSize, controlVoxelPosition.y, controlVoxelPosition.z,
|
y: controlEntityPosition.y, z: controlEntityPosition.z };
|
||||||
// controlVoxelSize, COLORS[action].red, COLORS[action].green, COLORS[action].blue);
|
Entities.addEntity({
|
||||||
|
type: "Box",
|
||||||
|
position: position,
|
||||||
|
dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize },
|
||||||
|
color: COLORS[action],
|
||||||
|
lifetime: 5
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
|
|
|
@ -12,27 +12,25 @@
|
||||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
|
||||||
// Set the following variables to the values needed
|
// Set the following variables to the values needed
|
||||||
var filename = HIFI_PUBLIC_BUCKET + "ozan/bartender.rec";
|
var filename = "/Users/clement/Desktop/recording.hfr";
|
||||||
var playFromCurrentLocation = true;
|
var playFromCurrentLocation = true;
|
||||||
var useDisplayName = true;
|
var useDisplayName = true;
|
||||||
var useAttachments = true;
|
var useAttachments = true;
|
||||||
var useHeadModel = true;
|
var useAvatarModel = true;
|
||||||
var useSkeletonModel = true;
|
|
||||||
|
|
||||||
// ID of the agent. Two agents can't have the same ID.
|
// ID of the agent. Two agents can't have the same ID.
|
||||||
var id = 0;
|
var id = 0;
|
||||||
|
|
||||||
// Set head and skeleton models
|
// Set avatar model URL
|
||||||
Avatar.faceModelURL = "http://public.highfidelity.io/models/heads/EvilPhilip_v7.fst";
|
Avatar.skeletonModelURL = "https://hifi-public.s3.amazonaws.com/marketplace/contents/e21c0b95-e502-4d15-8c41-ea2fc40f1125/3585ddf674869a67d31d5964f7b52de1.fst?1427169998";
|
||||||
Avatar.skeletonModelURL = "http://public.highfidelity.io/models/skeletons/Philip_Carl_Body_A-Pose.fst";
|
|
||||||
// Set position/orientation/scale here if playFromCurrentLocation is true
|
// Set position/orientation/scale here if playFromCurrentLocation is true
|
||||||
Avatar.position = { x:1, y: 1, z: 1 };
|
Avatar.position = { x:1, y: 1, z: 1 };
|
||||||
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
Avatar.scale = 1.0;
|
Avatar.scale = 1.0;
|
||||||
|
|
||||||
// Those variables MUST be common to every scripts
|
// Those variables MUST be common to every scripts
|
||||||
var controlVoxelSize = 0.25;
|
var controlEntitySize = 0.25;
|
||||||
var controlVoxelPosition = { x: 2000 , y: 0, z: 0 };
|
var controlEntityPosition = { x: 2000, y: 0, z: 0 };
|
||||||
|
|
||||||
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
||||||
var DO_NOTHING = 0;
|
var DO_NOTHING = 0;
|
||||||
|
@ -49,113 +47,111 @@ COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
||||||
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
||||||
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
||||||
|
|
||||||
controlVoxelPosition.x += id * controlVoxelSize;
|
controlEntityPosition.x += id * controlEntitySize;
|
||||||
|
|
||||||
Avatar.loadRecording(filename);
|
Avatar.loadRecording(filename);
|
||||||
|
|
||||||
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||||
Avatar.setPlayerUseDisplayName(useDisplayName);
|
Avatar.setPlayerUseDisplayName(useDisplayName);
|
||||||
Avatar.setPlayerUseAttachments(useAttachments);
|
Avatar.setPlayerUseAttachments(useAttachments);
|
||||||
Avatar.setPlayerUseHeadModel(useHeadModel);
|
Avatar.setPlayerUseHeadModel(false);
|
||||||
Avatar.setPlayerUseSkeletonModel(useSkeletonModel);
|
Avatar.setPlayerUseSkeletonModel(useAvatarModel);
|
||||||
|
|
||||||
function setupVoxelViewer() {
|
function setupEntityViewer() {
|
||||||
var voxelViewerOffset = 10;
|
var entityViewerOffset = 10;
|
||||||
var voxelViewerPosition = JSON.parse(JSON.stringify(controlVoxelPosition));
|
var entityViewerPosition = { x: controlEntityPosition.x - entityViewerOffset,
|
||||||
voxelViewerPosition.x -= voxelViewerOffset;
|
y: controlEntityPosition.y, z: controlEntityPosition.z };
|
||||||
var voxelViewerOrientation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
var entityViewerOrientation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
||||||
|
|
||||||
VoxelViewer.setPosition(voxelViewerPosition);
|
EntityViewer.setPosition(entityViewerPosition);
|
||||||
VoxelViewer.setOrientation(voxelViewerOrientation);
|
EntityViewer.setOrientation(entityViewerOrientation);
|
||||||
VoxelViewer.queryOctree();
|
EntityViewer.queryOctree();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAction(controlVoxel) {
|
function getAction(controlEntity) {
|
||||||
if (controlVoxel.x != controlVoxelPosition.x ||
|
if (controlEntity === null ||
|
||||||
controlVoxel.y != controlVoxelPosition.y ||
|
controlEntity.position.x !== controlEntityPosition.x ||
|
||||||
controlVoxel.z != controlVoxelPosition.z ||
|
controlEntity.position.y !== controlEntityPosition.y ||
|
||||||
controlVoxel.s != controlVoxelSize) {
|
controlEntity.position.z !== controlEntityPosition.z ||
|
||||||
return DO_NOTHING;
|
controlEntity.dimensions.x !== controlEntitySize) {
|
||||||
}
|
return DO_NOTHING;
|
||||||
|
|
||||||
for (i in COLORS) {
|
|
||||||
if (controlVoxel.red === COLORS[i].red &&
|
|
||||||
controlVoxel.green === COLORS[i].green &&
|
|
||||||
controlVoxel.blue === COLORS[i].blue) {
|
|
||||||
|
|
||||||
// TODO: Fix this to use some mechanism other than voxels
|
|
||||||
//Voxels.eraseVoxel(controlVoxelPosition.x, controlVoxelPosition.y, controlVoxelPosition.z, controlVoxelSize);
|
|
||||||
return parseInt(i);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
for (i in COLORS) {
|
||||||
return DO_NOTHING;
|
if (controlEntity.color.red === COLORS[i].red &&
|
||||||
|
controlEntity.color.green === COLORS[i].green &&
|
||||||
|
controlEntity.color.blue === COLORS[i].blue) {
|
||||||
|
Entities.deleteEntity(controlEntity.id);
|
||||||
|
return parseInt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DO_NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 300; // This is necessary to wait for the audio mixer to connect
|
count = 100; // This is necessary to wait for the audio mixer to connect
|
||||||
function update(event) {
|
function update(event) {
|
||||||
VoxelViewer.queryOctree();
|
EntityViewer.queryOctree();
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
count--;
|
count--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Fix this to use some mechanism other than voxels
|
|
||||||
// Voxels.getVoxelAt(controlVoxelPosition.x, controlVoxelPosition.y, controlVoxelPosition.z, controlVoxelSize);
|
var controlEntity = Entities.findClosestEntity(controlEntityPosition, controlEntitySize);
|
||||||
var controlVoxel = false;
|
var action = getAction(Entities.getEntityProperties(controlEntity));
|
||||||
var action = getAction(controlVoxel);
|
|
||||||
|
switch(action) {
|
||||||
switch(action) {
|
case PLAY:
|
||||||
case PLAY:
|
print("Play");
|
||||||
print("Play");
|
if (!Agent.isAvatar) {
|
||||||
if (!Agent.isAvatar) {
|
Agent.isAvatar = true;
|
||||||
Agent.isAvatar = true;
|
}
|
||||||
}
|
if (!Avatar.isPlaying()) {
|
||||||
if (!Avatar.isPlaying()) {
|
Avatar.startPlaying();
|
||||||
Avatar.startPlaying();
|
}
|
||||||
}
|
Avatar.setPlayerLoop(false);
|
||||||
Avatar.setPlayerLoop(false);
|
break;
|
||||||
break;
|
case PLAY_LOOP:
|
||||||
case PLAY_LOOP:
|
print("Play loop");
|
||||||
print("Play loop");
|
if (!Agent.isAvatar) {
|
||||||
if (!Agent.isAvatar) {
|
Agent.isAvatar = true;
|
||||||
Agent.isAvatar = true;
|
}
|
||||||
}
|
if (!Avatar.isPlaying()) {
|
||||||
if (!Avatar.isPlaying()) {
|
Avatar.startPlaying();
|
||||||
Avatar.startPlaying();
|
}
|
||||||
}
|
Avatar.setPlayerLoop(true);
|
||||||
Avatar.setPlayerLoop(true);
|
break;
|
||||||
break;
|
case STOP:
|
||||||
case STOP:
|
print("Stop");
|
||||||
print("Stop");
|
if (Avatar.isPlaying()) {
|
||||||
if (Avatar.isPlaying()) {
|
Avatar.stopPlaying();
|
||||||
Avatar.stopPlaying();
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case SHOW:
|
||||||
case SHOW:
|
print("Show");
|
||||||
print("Show");
|
if (!Agent.isAvatar) {
|
||||||
if (!Agent.isAvatar) {
|
Agent.isAvatar = true;
|
||||||
Agent.isAvatar = true;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case HIDE:
|
||||||
case HIDE:
|
print("Hide");
|
||||||
print("Hide");
|
if (Avatar.isPlaying()) {
|
||||||
if (Avatar.isPlaying()) {
|
Avatar.stopPlaying();
|
||||||
Avatar.stopPlaying();
|
}
|
||||||
}
|
Agent.isAvatar = false;
|
||||||
Agent.isAvatar = false;
|
break;
|
||||||
break;
|
case DO_NOTHING:
|
||||||
case DO_NOTHING:
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
print("Unknown action: " + action);
|
||||||
print("Unknown action: " + action);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
if (Avatar.isPlaying()) {
|
||||||
if (Avatar.isPlaying()) {
|
Avatar.play();
|
||||||
Avatar.play();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
setupVoxelViewer();
|
setupEntityViewer();
|
||||||
|
|
|
@ -14,8 +14,7 @@ var filename = "http://your.recording.url";
|
||||||
var playFromCurrentLocation = true;
|
var playFromCurrentLocation = true;
|
||||||
var loop = true;
|
var loop = true;
|
||||||
|
|
||||||
Avatar.faceModelURL = "http://public.highfidelity.io/models/heads/EvilPhilip_v7.fst";
|
Avatar.skeletonModelURL = "https://hifi-public.s3.amazonaws.com/marketplace/contents/e21c0b95-e502-4d15-8c41-ea2fc40f1125/3585ddf674869a67d31d5964f7b52de1.fst?1427169998";
|
||||||
Avatar.skeletonModelURL = "http://public.highfidelity.io/models/skeletons/Philip_Carl_Body_A-Pose.fst";
|
|
||||||
|
|
||||||
// Set position here if playFromCurrentLocation is true
|
// Set position here if playFromCurrentLocation is true
|
||||||
Avatar.position = { x:1, y: 1, z: 1 };
|
Avatar.position = { x:1, y: 1, z: 1 };
|
||||||
|
@ -23,30 +22,34 @@ Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
Avatar.scale = 1.0;
|
Avatar.scale = 1.0;
|
||||||
|
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
|
|
||||||
Avatar.loadRecording(filename);
|
Avatar.loadRecording(filename);
|
||||||
|
|
||||||
count = 300; // This is necessary to wait for the audio mixer to connect
|
count = 300; // This is necessary to wait for the audio mixer to connect
|
||||||
function update(event) {
|
function update(event) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
count--;
|
count--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||||
Avatar.setPlayerLoop(loop);
|
Avatar.setPlayerLoop(loop);
|
||||||
Avatar.startPlaying();
|
Avatar.setPlayerUseDisplayName(true);
|
||||||
Avatar.play();
|
Avatar.setPlayerUseAttachments(true);
|
||||||
Vec3.print("Playing from ", Avatar.position);
|
Avatar.setPlayerUseHeadModel(false);
|
||||||
|
Avatar.setPlayerUseSkeletonModel(true);
|
||||||
count--;
|
Avatar.startPlaying();
|
||||||
}
|
Avatar.play();
|
||||||
|
Vec3.print("Playing from ", Avatar.position);
|
||||||
if (Avatar.isPlaying()) {
|
|
||||||
Avatar.play();
|
count--;
|
||||||
} else {
|
}
|
||||||
Script.update.disconnect(update);
|
|
||||||
}
|
if (Avatar.isPlaying()) {
|
||||||
|
Avatar.play();
|
||||||
|
} else {
|
||||||
|
Script.update.disconnect(update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
|
|
142
examples/playa/playaSpawner.js
Normal file
142
examples/playa/playaSpawner.js
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
// dustSetSpawner.js
|
||||||
|
// examples
|
||||||
|
//
|
||||||
|
// Created by Eric Levin on 9/2/15
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Spawns a set with blocks and a desert-y ground. When blocks (or anything else is thrown), dust particles will kick up at the point the object hits the ground
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
|
||||||
|
|
||||||
|
|
||||||
|
map = function(value, min1, max1, min2, max2) {
|
||||||
|
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
|
||||||
|
}
|
||||||
|
|
||||||
|
orientationOf = function(vector) {
|
||||||
|
var Y_AXIS = {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var X_AXIS = {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var theta = 0.0;
|
||||||
|
|
||||||
|
var RAD_TO_DEG = 180.0 / Math.PI;
|
||||||
|
var direction, yaw, pitch;
|
||||||
|
direction = Vec3.normalize(vector);
|
||||||
|
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||||
|
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||||
|
return Quat.multiply(yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var ground, wall;
|
||||||
|
var boxes = [];
|
||||||
|
var dustSystems = [];
|
||||||
|
var ZERO_VEC = {x: 0, y: 0, z: 0};
|
||||||
|
|
||||||
|
Script.include("../libraries/utils.js");
|
||||||
|
|
||||||
|
function spawnGround() {
|
||||||
|
var groundModelURL = "https://hifi-public.s3.amazonaws.com/alan/Playa/Ground.fbx";
|
||||||
|
var groundPosition = Vec3.sum(MyAvatar.position, {x: 0, y: -2, z: 0});
|
||||||
|
ground = Entities.addEntity({
|
||||||
|
type: "Model",
|
||||||
|
modelURL: groundModelURL,
|
||||||
|
shapeType: "box",
|
||||||
|
position: groundPosition,
|
||||||
|
dimensions: {x: 900, y: 0.82, z: 900},
|
||||||
|
});
|
||||||
|
// Script.addEventHandler(ground, "collisionWithEntity", entityCollisionWithGround);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*function entityCollisionWithGround(ground, entity, collision) {
|
||||||
|
var dVelocityMagnitude = Vec3.length(collision.velocityChange);
|
||||||
|
var position = Entities.getEntityProperties(entity, "position").position;
|
||||||
|
var particleRadius = map(dVelocityMagnitude, 0.05, 3, 0.5, 2);
|
||||||
|
var speed = map(dVelocityMagnitude, 0.05, 3, 0.02, 0.09);
|
||||||
|
var displayTime = 400;
|
||||||
|
var orientationChange = orientationOf(collision.velocityChange);
|
||||||
|
var dustEffect = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
name: "Dust-Puff",
|
||||||
|
position: position,
|
||||||
|
color: {red: 195, green: 170, blue: 185},
|
||||||
|
lifespan: 3,
|
||||||
|
lifetime: 7,//displayTime/1000 * 2, //So we can fade particle system out gracefully
|
||||||
|
emitRate: 5,
|
||||||
|
emitSpeed: speed,
|
||||||
|
emitAcceleration: ZERO_VEC,
|
||||||
|
accelerationSpread: ZERO_VEC,
|
||||||
|
isEmitting: true,
|
||||||
|
polarStart: Math.PI/2,
|
||||||
|
polarFinish: Math.PI/2,
|
||||||
|
emitOrientation: orientationChange,
|
||||||
|
radiusSpread: 0.1,
|
||||||
|
radiusStart: particleRadius,
|
||||||
|
radiusFinish: particleRadius + particleRadius/2,
|
||||||
|
particleRadius: particleRadius,
|
||||||
|
alpha: 0.45,
|
||||||
|
alphaFinish: 0.001,
|
||||||
|
textures: "https://hifi-public.s3.amazonaws.com/alan/Playa/Particles/Particle-Sprite-Gen.png"
|
||||||
|
});
|
||||||
|
|
||||||
|
dustSystems.push(dustEffect);
|
||||||
|
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
var newRadius = 0.05;
|
||||||
|
Entities.editEntity(dustEffect, {
|
||||||
|
alpha: 0.0
|
||||||
|
});
|
||||||
|
}, displayTime);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
function spawnBoxes() {
|
||||||
|
var boxModelURL = "https://hifi-public.s3.amazonaws.com/alan/Tower-Spawn/Stone-Block.fbx";
|
||||||
|
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
|
||||||
|
var numBoxes = 200;
|
||||||
|
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
|
||||||
|
for (var i = 0; i < numBoxes; i++) {
|
||||||
|
var position = Vec3.sum(center, {x: Math.random() * numBoxes, y: Math.random() * 3, z: Math.random() * numBoxes })
|
||||||
|
var box = Entities.addEntity({
|
||||||
|
type: "Model",
|
||||||
|
modelURL: boxModelURL,
|
||||||
|
collisionSoundURL: collisionSoundURL,
|
||||||
|
shapeType: "box",
|
||||||
|
position: position,
|
||||||
|
collisionsWillMove: true,
|
||||||
|
dimensions: {x: 1, y: 2, z: 3},
|
||||||
|
velocity: {x: 0, y: -.01, z: 0},
|
||||||
|
gravity: {x: 0, y: -2.5 - Math.random() * 6, z: 0}
|
||||||
|
});
|
||||||
|
|
||||||
|
boxes.push(box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnGround();
|
||||||
|
spawnBoxes();
|
||||||
|
|
||||||
|
|
||||||
|
function cleanup() {
|
||||||
|
Entities.deleteEntity(ground);
|
||||||
|
boxes.forEach(function(box){
|
||||||
|
Entities.deleteEntity(box);
|
||||||
|
});
|
||||||
|
dustSystems.forEach(function(dustEffect) {
|
||||||
|
Entities.deleteEntity(dustEffect);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,9 @@ function setupTimer() {
|
||||||
text: (0.00).toFixed(3),
|
text: (0.00).toFixed(3),
|
||||||
backgroundColor: COLOR_OFF,
|
backgroundColor: COLOR_OFF,
|
||||||
x: 0, y: 0,
|
x: 0, y: 0,
|
||||||
width: 0,
|
width: 0, height: 0,
|
||||||
height: 0,
|
leftMargin: 10, topMargin: 10,
|
||||||
alpha: 1.0,
|
alpha: 1.0, backgroundAlpha: 1.0,
|
||||||
backgroundAlpha: 1.0,
|
|
||||||
visible: true
|
visible: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -604,7 +604,7 @@ void MyAvatar::startRecording() {
|
||||||
// connect to AudioClient's signal so we get input audio
|
// connect to AudioClient's signal so we get input audio
|
||||||
auto audioClient = DependencyManager::get<AudioClient>();
|
auto audioClient = DependencyManager::get<AudioClient>();
|
||||||
connect(audioClient.data(), &AudioClient::inputReceived, _recorder.data(),
|
connect(audioClient.data(), &AudioClient::inputReceived, _recorder.data(),
|
||||||
&Recorder::recordAudio, Qt::BlockingQueuedConnection);
|
&Recorder::recordAudio, Qt::QueuedConnection);
|
||||||
|
|
||||||
_recorder->startRecording();
|
_recorder->startRecording();
|
||||||
}
|
}
|
||||||
|
|
|
@ -748,12 +748,13 @@ void AudioClient::handleAudioInput() {
|
||||||
_audioPacket = NLPacket::create(PacketType::MicrophoneAudioNoEcho);
|
_audioPacket = NLPacket::create(PacketType::MicrophoneAudioNoEcho);
|
||||||
}
|
}
|
||||||
|
|
||||||
float inputToNetworkInputRatio = calculateDeviceToNetworkInputRatio();
|
const float inputToNetworkInputRatio = calculateDeviceToNetworkInputRatio();
|
||||||
|
|
||||||
|
const int inputSamplesRequired = (int)((float)AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * inputToNetworkInputRatio);
|
||||||
|
const auto inputAudioSamples = std::unique_ptr<int16_t[]>(new int16_t[inputSamplesRequired]);
|
||||||
|
|
||||||
int inputSamplesRequired = (int)((float)AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * inputToNetworkInputRatio);
|
static const int leadingBytes = sizeof(quint16) + sizeof(glm::vec3) + sizeof(glm::quat) + sizeof(quint8);
|
||||||
|
int16_t* const networkAudioSamples = (int16_t*)(_audioPacket->getPayload() + leadingBytes);
|
||||||
static int leadingBytes = sizeof(quint16) + sizeof(glm::vec3) + sizeof(glm::quat) + sizeof(quint8);
|
|
||||||
int16_t* networkAudioSamples = (int16_t*)(_audioPacket->getPayload() + leadingBytes);
|
|
||||||
|
|
||||||
QByteArray inputByteArray = _inputDevice->readAll();
|
QByteArray inputByteArray = _inputDevice->readAll();
|
||||||
|
|
||||||
|
@ -802,16 +803,12 @@ void AudioClient::handleAudioInput() {
|
||||||
_timeSinceLastClip += (float) numNetworkSamples / (float) AudioConstants::SAMPLE_RATE;
|
_timeSinceLastClip += (float) numNetworkSamples / (float) AudioConstants::SAMPLE_RATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t* inputAudioSamples = new int16_t[inputSamplesRequired];
|
_inputRingBuffer.readSamples(inputAudioSamples.get(), inputSamplesRequired);
|
||||||
_inputRingBuffer.readSamples(inputAudioSamples, inputSamplesRequired);
|
|
||||||
|
|
||||||
possibleResampling(_inputToNetworkResampler,
|
possibleResampling(_inputToNetworkResampler,
|
||||||
inputAudioSamples, networkAudioSamples,
|
inputAudioSamples.get(), networkAudioSamples,
|
||||||
inputSamplesRequired, numNetworkSamples,
|
inputSamplesRequired, numNetworkSamples,
|
||||||
_inputFormat, _desiredInputFormat);
|
_inputFormat, _desiredInputFormat);
|
||||||
|
|
||||||
delete[] inputAudioSamples;
|
|
||||||
|
|
||||||
// Remove DC offset
|
// Remove DC offset
|
||||||
if (!_isStereoInput && !_audioSourceInjectEnabled) {
|
if (!_isStereoInput && !_audioSourceInjectEnabled) {
|
||||||
_inputGate.removeDCOffset(networkAudioSamples, numNetworkSamples);
|
_inputGate.removeDCOffset(networkAudioSamples, numNetworkSamples);
|
||||||
|
@ -842,8 +839,7 @@ void AudioClient::handleAudioInput() {
|
||||||
_lastInputLoudness = fabs(loudness / numNetworkSamples);
|
_lastInputLoudness = fabs(loudness / numNetworkSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit inputReceived(QByteArray(reinterpret_cast<const char*>(networkAudioSamples),
|
emit inputReceived({reinterpret_cast<char*>(networkAudioSamples), numNetworkBytes});
|
||||||
AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * sizeof(AudioConstants::AudioSample)));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// our input loudness is 0, since we're muted
|
// our input loudness is 0, since we're muted
|
||||||
|
|
|
@ -205,7 +205,7 @@ void AudioInjector::injectToMixer() {
|
||||||
|
|
||||||
while (_currentSendOffset < _audioData.size() && !_shouldStop) {
|
while (_currentSendOffset < _audioData.size() && !_shouldStop) {
|
||||||
|
|
||||||
int bytesToCopy = std::min(((_options.stereo) ? 2 : 1) * AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL,
|
int bytesToCopy = std::min((_options.stereo ? 2 : 1) * AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL,
|
||||||
_audioData.size() - _currentSendOffset);
|
_audioData.size() - _currentSendOffset);
|
||||||
|
|
||||||
// Measure the loudness of this frame
|
// Measure the loudness of this frame
|
||||||
|
@ -261,7 +261,7 @@ void AudioInjector::injectToMixer() {
|
||||||
|
|
||||||
// not the first packet and not done
|
// not the first packet and not done
|
||||||
// sleep for the appropriate time
|
// sleep for the appropriate time
|
||||||
int usecToSleep = (++nextFrame * AudioConstants::NETWORK_FRAME_USECS) - timer.nsecsElapsed() / 1000;
|
int usecToSleep = (++nextFrame * (_options.stereo ? 2 : 1) * AudioConstants::NETWORK_FRAME_USECS) - timer.nsecsElapsed() / 1000;
|
||||||
|
|
||||||
if (usecToSleep > 0) {
|
if (usecToSleep > 0) {
|
||||||
usleep(usecToSleep);
|
usleep(usecToSleep);
|
||||||
|
|
|
@ -397,16 +397,15 @@ bool Player::computeCurrentFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 elapsed = glm::clamp(Player::elapsed() - _audioOffset, (qint64)0, (qint64)_recording->getLength());
|
qint64 elapsed = glm::clamp(Player::elapsed() - _audioOffset, (qint64)0, (qint64)_recording->getLength());
|
||||||
while(_currentFrame >= 0 &&
|
|
||||||
_recording->getFrameTimestamp(_currentFrame) > elapsed) {
|
|
||||||
--_currentFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (_currentFrame < _recording->getFrameNumber() &&
|
while (_currentFrame < _recording->getFrameNumber() &&
|
||||||
_recording->getFrameTimestamp(_currentFrame) < elapsed) {
|
_recording->getFrameTimestamp(_currentFrame) < elapsed) {
|
||||||
++_currentFrame;
|
++_currentFrame;
|
||||||
}
|
}
|
||||||
--_currentFrame;
|
|
||||||
|
while(_currentFrame > 0 &&
|
||||||
|
_recording->getFrameTimestamp(_currentFrame) > elapsed) {
|
||||||
|
--_currentFrame;
|
||||||
|
}
|
||||||
|
|
||||||
if (_currentFrame == _recording->getFrameNumber() - 1) {
|
if (_currentFrame == _recording->getFrameNumber() - 1) {
|
||||||
--_currentFrame;
|
--_currentFrame;
|
||||||
|
|
|
@ -43,7 +43,6 @@ public slots:
|
||||||
void record();
|
void record();
|
||||||
void recordAudio(const QByteArray& audioArray);
|
void recordAudio(const QByteArray& audioArray);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QElapsedTimer _timer;
|
QElapsedTimer _timer;
|
||||||
RecordingPointer _recording;
|
RecordingPointer _recording;
|
||||||
|
|
|
@ -69,10 +69,10 @@ const RecordingFrame& Recording::getFrame(int i) const {
|
||||||
|
|
||||||
int Recording::numberAudioChannel() const {
|
int Recording::numberAudioChannel() const {
|
||||||
// Check for stereo audio
|
// Check for stereo audio
|
||||||
int MSEC_PER_SEC = 1000;
|
float MSEC_PER_SEC = 1000.0f;
|
||||||
int channelLength = (getLength() / MSEC_PER_SEC) *
|
float channelLength = ((float)getLength() / MSEC_PER_SEC) * AudioConstants::SAMPLE_RATE *
|
||||||
AudioConstants::SAMPLE_RATE * sizeof(AudioConstants::AudioSample);
|
sizeof(AudioConstants::AudioSample);
|
||||||
return glm::round((float)channelLength / (float)getAudioData().size());
|
return glm::round((float)getAudioData().size() / channelLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Recording::addFrame(int timestamp, RecordingFrame &frame) {
|
void Recording::addFrame(int timestamp, RecordingFrame &frame) {
|
||||||
|
|
Loading…
Reference in a new issue