mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into multi-hull-collisions
This commit is contained in:
commit
16875338bf
6 changed files with 261 additions and 62 deletions
27
cmake/externals/tbb/CMakeLists.txt
vendored
27
cmake/externals/tbb/CMakeLists.txt
vendored
|
@ -8,8 +8,8 @@ if (ANDROID)
|
|||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL http://hifi-public.s3.amazonaws.com/dependencies/tbb43_20150209oss_src.tgz
|
||||
URL_MD5 f09c9abe8ec74e6558c1f89cebbe2893
|
||||
URL http://hifi-public.s3.amazonaws.com/dependencies/tbb43_20150316oss_src.tgz
|
||||
URL_MD5 bf090eaa86cf89ea014b7b462786a440
|
||||
BUILD_COMMAND ${NDK_BUILD_COMMAND} --directory=jni target=android tbb tbbmalloc arch=arm
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
|
@ -20,19 +20,20 @@ if (ANDROID)
|
|||
)
|
||||
else ()
|
||||
if (APPLE)
|
||||
set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_osx.tgz)
|
||||
set(DOWNLOAD_MD5 3e683c19792582b61382e0d760ea5db2)
|
||||
set(DOWNLOAD_URL http://hifi-public.s3.amazonaws.com/dependencies/tbb43_20150316oss_osx.tgz)
|
||||
set(DOWNLOAD_MD5 25a36ebff070ff801760ec658079f6aa)
|
||||
elseif (WIN32)
|
||||
set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_win.zip)
|
||||
set(DOWNLOAD_MD5 e19c184f2bb0e944fc5f397f1e34ca84)
|
||||
set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150316oss_win.zip)
|
||||
set(DOWNLOAD_MD5 d250d40bb93b255f75bcbb19e976a440)
|
||||
else ()
|
||||
set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_lin.tgz)
|
||||
set(DOWNLOAD_MD5 d9c2a6f7807df364be44a8c3c05e8457)
|
||||
set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150316oss_lin.tgz)
|
||||
set(DOWNLOAD_MD5 7830ba2bc62438325fba2ec0c95367a5)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL ${DOWNLOAD_URL}
|
||||
URL_MD5 ${DOWNLOAD_MD5}
|
||||
BUILD_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
@ -94,9 +95,15 @@ elseif (UNIX)
|
|||
endif ()
|
||||
|
||||
if (DEFINED _TBB_LIB_DIR)
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbb_debug.${_LIB_EXT} CACHE FILEPATH "TBB debug library location")
|
||||
if (NOT APPLE)
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbb_debug.${_LIB_EXT} CACHE FILEPATH "TBB debug library location")
|
||||
set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbbmalloc_debug.${_LIB_EXT} CACHE FILEPATH "TBB malloc debug library location")
|
||||
else ()
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG "" CACHE FILEPATH "TBB debug library location")
|
||||
set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG "" CACHE FILEPATH "TBB malloc debug library location")
|
||||
endif ()
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbb.${_LIB_EXT} CACHE FILEPATH "TBB release library location")
|
||||
set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbbmalloc_debug.${_LIB_EXT} CACHE FILEPATH "TBB malloc debug library location")
|
||||
set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbbmalloc.${_LIB_EXT} CACHE FILEPATH "TBB malloc release library location")
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -1162,7 +1162,7 @@ PropertiesTool = function(opts) {
|
|||
}
|
||||
pushCommandForSelections();
|
||||
selectionManager._update();
|
||||
} else if (data.type = "showMarketplace") {
|
||||
} else if (data.type == "showMarketplace") {
|
||||
if (marketplaceWindow.url != data.url) {
|
||||
marketplaceWindow.setURL(data.url);
|
||||
}
|
||||
|
|
|
@ -9,15 +9,20 @@
|
|||
|
||||
this.preload = function(entityID) {
|
||||
teleport = SoundCache.getSound("http://s3.amazonaws.com/hifi-public/birarda/teleport.raw");
|
||||
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
portalDestination = properties.userData;
|
||||
animationURL = properties.modelURL;
|
||||
|
||||
print("The portal destination is " + portalDestination);
|
||||
}
|
||||
|
||||
this.enterEntity = function(entityID) {
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID); // in case the userData/portalURL has changed
|
||||
portalDestination = properties.userData;
|
||||
|
||||
print("enterEntity() .... The portal destination is " + portalDestination);
|
||||
|
||||
if (portalDestination.length > 0) {
|
||||
print("Teleporting to hifi://" + portalDestination);
|
||||
Window.location = "hifi://" + portalDestination;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
var usersWindow = (function () {
|
||||
|
||||
var WINDOW_WIDTH_2D = 150,
|
||||
var WINDOW_WIDTH_2D = 160,
|
||||
WINDOW_MARGIN_2D = 12,
|
||||
WINDOW_FONT_2D = { size: 12 },
|
||||
WINDOW_FOREGROUND_COLOR_2D = { red: 240, green: 240, blue: 240 },
|
||||
|
@ -22,6 +22,17 @@ var usersWindow = (function () {
|
|||
WINDOW_BACKGROUND_ALPHA_2D = 0.7,
|
||||
windowPane2D,
|
||||
windowHeading2D,
|
||||
SCROLLBAR_BACKGROUND_WIDTH_2D = 12,
|
||||
SCROLLBAR_BACKGROUND_COLOR_2D = { red: 80, green: 80, blue: 80 },
|
||||
SCROLLBAR_BACKGROUND_ALPHA_2D = 0.8,
|
||||
scrollbarBackground2D,
|
||||
SCROLLBAR_BAR_MIN_HEIGHT = 5,
|
||||
SCROLLBAR_BAR_COLOR_2D = { red: 180, green: 180, blue: 180 },
|
||||
SCROLLBAR_BAR_ALPHA_2D = 0.8,
|
||||
SCROLLBAR_BAR_SELECTED_ALPHA_2D = 0.9,
|
||||
scrollbarBar2D,
|
||||
scrollbarBackgroundHeight,
|
||||
scrollbarBarHeight,
|
||||
VISIBILITY_SPACER_2D = 12, // Space between list of users and visibility controls
|
||||
visibilityHeading2D,
|
||||
VISIBILITY_RADIO_SPACE = 16,
|
||||
|
@ -33,6 +44,8 @@ var usersWindow = (function () {
|
|||
|
||||
usersOnline, // Raw users data
|
||||
linesOfUsers = [], // Array of indexes pointing into usersOnline
|
||||
numUsersToDisplay = 0,
|
||||
firstUserToDisplay = 0,
|
||||
|
||||
API_URL = "https://metaverse.highfidelity.com/api/v1/users?status=online",
|
||||
HTTP_GET_TIMEOUT = 60000, // ms = 1 minute
|
||||
|
@ -54,6 +67,15 @@ var usersWindow = (function () {
|
|||
isVisible = true,
|
||||
|
||||
viewportHeight,
|
||||
isMirrorDisplay = false,
|
||||
isFullscreenMirror = false,
|
||||
|
||||
isUsingScrollbars = false,
|
||||
isMovingScrollbar = false,
|
||||
scrollbarBackgroundPosition = {},
|
||||
scrollbarBarPosition = {},
|
||||
scrollbarBarClickedAt, // 0.0 .. 1.0
|
||||
scrollbarValue = 0.0, // 0.0 .. 1.0
|
||||
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/",
|
||||
RADIO_BUTTON_SVG = HIFI_PUBLIC_BUCKET + "images/radio-button.svg",
|
||||
|
@ -62,10 +84,32 @@ var usersWindow = (function () {
|
|||
radioButtonDiameter;
|
||||
|
||||
function calculateWindowHeight() {
|
||||
var AUDIO_METER_HEIGHT = 52,
|
||||
MIRROR_HEIGHT = 220,
|
||||
nonUsersHeight,
|
||||
maxWindowHeight;
|
||||
|
||||
// Reserve 5 lines for window heading plus visibility heading and controls
|
||||
// Subtract windowLineSpacing for both end of user list and end of controls
|
||||
windowHeight = (linesOfUsers.length > 0 ? linesOfUsers.length + 5 : 5) * windowLineHeight
|
||||
- 2 * windowLineSpacing + VISIBILITY_SPACER_2D + 2 * WINDOW_MARGIN_2D;
|
||||
nonUsersHeight = 5 * windowLineHeight - 2 * windowLineSpacing + VISIBILITY_SPACER_2D + 2 * WINDOW_MARGIN_2D;
|
||||
|
||||
// Limit window to height of viewport minus VU meter and mirror if displayed
|
||||
windowHeight = linesOfUsers.length * windowLineHeight + nonUsersHeight;
|
||||
maxWindowHeight = viewportHeight - AUDIO_METER_HEIGHT;
|
||||
if (isMirrorDisplay && !isFullscreenMirror) {
|
||||
maxWindowHeight -= MIRROR_HEIGHT;
|
||||
}
|
||||
windowHeight = Math.max(Math.min(windowHeight, maxWindowHeight), nonUsersHeight);
|
||||
|
||||
// Corresponding number of users to actually display
|
||||
numUsersToDisplay = Math.max(Math.round((windowHeight - nonUsersHeight) / windowLineHeight), 0);
|
||||
isUsingScrollbars = 0 < numUsersToDisplay && numUsersToDisplay < linesOfUsers.length;
|
||||
if (isUsingScrollbars) {
|
||||
firstUserToDisplay = Math.floor(scrollbarValue * (linesOfUsers.length - numUsersToDisplay));
|
||||
} else {
|
||||
firstUserToDisplay = 0;
|
||||
scrollbarValue = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
function updateOverlayPositions() {
|
||||
|
@ -78,6 +122,16 @@ var usersWindow = (function () {
|
|||
Overlays.editOverlay(windowHeading2D, {
|
||||
y: viewportHeight - windowHeight + WINDOW_MARGIN_2D
|
||||
});
|
||||
|
||||
scrollbarBackgroundPosition.y = viewportHeight - windowHeight + WINDOW_MARGIN_2D + windowTextHeight;
|
||||
Overlays.editOverlay(scrollbarBackground2D, {
|
||||
y: scrollbarBackgroundPosition.y
|
||||
});
|
||||
scrollbarBarPosition.y = scrollbarBackgroundPosition.y + 1
|
||||
+ scrollbarValue * (scrollbarBackgroundHeight - scrollbarBarHeight - 2);
|
||||
Overlays.editOverlay(scrollbarBar2D, {
|
||||
y: scrollbarBarPosition.y
|
||||
});
|
||||
Overlays.editOverlay(visibilityHeading2D, {
|
||||
y: viewportHeight - 4 * windowLineHeight + windowLineSpacing - WINDOW_MARGIN_2D
|
||||
});
|
||||
|
@ -104,57 +158,59 @@ var usersWindow = (function () {
|
|||
|
||||
function updateUsersDisplay() {
|
||||
var displayText = "",
|
||||
myUsername,
|
||||
user,
|
||||
userText,
|
||||
textWidth,
|
||||
maxTextWidth,
|
||||
ellipsisWidth,
|
||||
reducedTextWidth,
|
||||
i;
|
||||
|
||||
myUsername = GlobalServices.username;
|
||||
linesOfUsers = [];
|
||||
for (i = 0; i < usersOnline.length; i += 1) {
|
||||
user = usersOnline[i];
|
||||
if (user.username !== myUsername && user.online) {
|
||||
userText = user.username;
|
||||
if (user.location.root) {
|
||||
userText += " @ " + user.location.root.name;
|
||||
}
|
||||
textWidth = Overlays.textSize(windowPane2D, userText).width;
|
||||
maxTextWidth = WINDOW_WIDTH_2D - (isUsingScrollbars ? SCROLLBAR_BACKGROUND_WIDTH_2D : 0) - 2 * WINDOW_MARGIN_2D;
|
||||
ellipsisWidth = Overlays.textSize(windowPane2D, "...").width;
|
||||
reducedTextWidth = maxTextWidth - ellipsisWidth;
|
||||
|
||||
maxTextWidth = WINDOW_WIDTH_2D - 2 * WINDOW_MARGIN_2D;
|
||||
if (textWidth > maxTextWidth) {
|
||||
// Trim and append "..." to fit window width
|
||||
maxTextWidth = maxTextWidth - Overlays.textSize(windowPane2D, "...").width;
|
||||
while (textWidth > maxTextWidth) {
|
||||
userText = userText.slice(0, -1);
|
||||
textWidth = Overlays.textSize(windowPane2D, userText).width;
|
||||
}
|
||||
userText += "...";
|
||||
for (i = 0; i < numUsersToDisplay; i += 1) {
|
||||
user = usersOnline[linesOfUsers[firstUserToDisplay + i]];
|
||||
userText = user.text;
|
||||
textWidth = user.textWidth;
|
||||
|
||||
if (textWidth > maxTextWidth) {
|
||||
// Trim and append "..." to fit window width
|
||||
maxTextWidth = maxTextWidth - Overlays.textSize(windowPane2D, "...").width;
|
||||
while (textWidth > reducedTextWidth) {
|
||||
userText = userText.slice(0, -1);
|
||||
textWidth = Overlays.textSize(windowPane2D, userText).width;
|
||||
}
|
||||
|
||||
usersOnline[i].textWidth = textWidth;
|
||||
linesOfUsers.push(i);
|
||||
displayText += "\n" + userText;
|
||||
userText += "...";
|
||||
}
|
||||
|
||||
displayText += "\n" + userText;
|
||||
}
|
||||
|
||||
displayText = displayText.slice(1); // Remove leading "\n".
|
||||
|
||||
calculateWindowHeight();
|
||||
|
||||
Overlays.editOverlay(windowPane2D, {
|
||||
y: viewportHeight - windowHeight,
|
||||
height: windowHeight,
|
||||
text: displayText
|
||||
});
|
||||
|
||||
Overlays.editOverlay(windowHeading2D, {
|
||||
y: viewportHeight - windowHeight + WINDOW_MARGIN_2D,
|
||||
text: linesOfUsers.length > 0 ? "Users online" : "No users online"
|
||||
});
|
||||
|
||||
scrollbarBackgroundHeight = numUsersToDisplay * windowLineHeight - windowLineSpacing / 2;
|
||||
Overlays.editOverlay(scrollbarBackground2D, {
|
||||
height: scrollbarBackgroundHeight,
|
||||
visible: isUsingScrollbars
|
||||
});
|
||||
scrollbarBarHeight = Math.max(numUsersToDisplay / linesOfUsers.length * scrollbarBackgroundHeight,
|
||||
SCROLLBAR_BAR_MIN_HEIGHT);
|
||||
Overlays.editOverlay(scrollbarBar2D, {
|
||||
height: scrollbarBarHeight,
|
||||
visible: isUsingScrollbars
|
||||
});
|
||||
|
||||
updateOverlayPositions();
|
||||
}
|
||||
|
||||
|
@ -168,7 +224,11 @@ var usersWindow = (function () {
|
|||
}
|
||||
|
||||
processUsers = function () {
|
||||
var response;
|
||||
var response,
|
||||
myUsername,
|
||||
user,
|
||||
userText,
|
||||
i;
|
||||
|
||||
if (usersRequest.readyState === usersRequest.DONE) {
|
||||
if (usersRequest.status === 200) {
|
||||
|
@ -185,7 +245,26 @@ var usersWindow = (function () {
|
|||
}
|
||||
|
||||
usersOnline = response.data.users;
|
||||
myUsername = GlobalServices.username;
|
||||
linesOfUsers = [];
|
||||
for (i = 0; i < usersOnline.length; i += 1) {
|
||||
user = usersOnline[i];
|
||||
if (user.username !== myUsername && user.online) {
|
||||
userText = user.username;
|
||||
if (user.location.root) {
|
||||
userText += " @ " + user.location.root.name;
|
||||
}
|
||||
|
||||
usersOnline[i].text = userText;
|
||||
usersOnline[i].textWidth = Overlays.textSize(windowPane2D, userText).width;
|
||||
|
||||
linesOfUsers.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
calculateWindowHeight();
|
||||
updateUsersDisplay();
|
||||
|
||||
} else {
|
||||
print("Error: Request for users status returned " + usersRequest.status + " " + usersRequest.statusText);
|
||||
usersTimer = Script.setTimeout(pollUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
|
@ -226,6 +305,8 @@ var usersWindow = (function () {
|
|||
|
||||
Overlays.editOverlay(windowPane2D, { visible: isVisible });
|
||||
Overlays.editOverlay(windowHeading2D, { visible: isVisible });
|
||||
Overlays.editOverlay(scrollbarBackground2D, { visible: isVisible && isUsingScrollbars });
|
||||
Overlays.editOverlay(scrollbarBar2D, { visible: isVisible && isUsingScrollbars });
|
||||
Overlays.editOverlay(visibilityHeading2D, { visible: isVisible });
|
||||
for (i = 0; i < visibilityControls2D.length; i += 1) {
|
||||
Overlays.editOverlay(visibilityControls2D[i].radioOverlay, { visible: isVisible });
|
||||
|
@ -247,8 +328,10 @@ var usersWindow = (function () {
|
|||
minY,
|
||||
maxY,
|
||||
lineClicked,
|
||||
userClicked,
|
||||
i,
|
||||
visibilityChanged;
|
||||
visibilityChanged,
|
||||
delta;
|
||||
|
||||
if (!isVisible) {
|
||||
return;
|
||||
|
@ -261,7 +344,7 @@ var usersWindow = (function () {
|
|||
overlayX = event.x - WINDOW_MARGIN_2D;
|
||||
overlayY = event.y - viewportHeight + windowHeight - WINDOW_MARGIN_2D - windowLineHeight;
|
||||
|
||||
numLinesBefore = Math.floor(overlayY / windowLineHeight);
|
||||
numLinesBefore = Math.round(overlayY / windowLineHeight);
|
||||
minY = numLinesBefore * windowLineHeight;
|
||||
maxY = minY + windowTextHeight;
|
||||
|
||||
|
@ -270,10 +353,12 @@ var usersWindow = (function () {
|
|||
lineClicked = numLinesBefore;
|
||||
}
|
||||
|
||||
if (0 <= lineClicked && lineClicked < linesOfUsers.length
|
||||
&& 0 <= overlayX && overlayX <= usersOnline[linesOfUsers[lineClicked]].textWidth) {
|
||||
//print("Go to " + usersOnline[linesOfUsers[lineClicked]].username);
|
||||
location.goToUser(usersOnline[linesOfUsers[lineClicked]].username);
|
||||
userClicked = firstUserToDisplay + lineClicked;
|
||||
|
||||
if (0 <= userClicked && userClicked < linesOfUsers.length
|
||||
&& 0 <= overlayX && overlayX <= usersOnline[linesOfUsers[userClicked]].textWidth) {
|
||||
//print("Go to " + usersOnline[linesOfUsers[userClicked]].username);
|
||||
location.goToUser(usersOnline[linesOfUsers[userClicked]].username);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,13 +377,74 @@ var usersWindow = (function () {
|
|||
}
|
||||
updateVisibilityControls();
|
||||
}
|
||||
|
||||
if (clickedOverlay === scrollbarBar2D) {
|
||||
scrollbarBarClickedAt = (event.y - scrollbarBarPosition.y) / scrollbarBarHeight;
|
||||
Overlays.editOverlay(scrollbarBar2D, {
|
||||
backgroundAlpha: SCROLLBAR_BAR_SELECTED_ALPHA_2D
|
||||
});
|
||||
isMovingScrollbar = true;
|
||||
}
|
||||
|
||||
if (clickedOverlay === scrollbarBackground2D) {
|
||||
delta = scrollbarBarHeight / (scrollbarBackgroundHeight - scrollbarBarHeight);
|
||||
|
||||
if (event.y < scrollbarBarPosition.y) {
|
||||
scrollbarValue = Math.max(scrollbarValue - delta, 0.0);
|
||||
} else {
|
||||
scrollbarValue = Math.min(scrollbarValue + delta, 1.0);
|
||||
}
|
||||
|
||||
firstUserToDisplay = Math.floor(scrollbarValue * (linesOfUsers.length - numUsersToDisplay));
|
||||
updateOverlayPositions();
|
||||
updateUsersDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseMoveEvent(event) {
|
||||
if (isMovingScrollbar) {
|
||||
if (scrollbarBackgroundPosition.x - WINDOW_MARGIN_2D <= event.x
|
||||
&& event.x <= scrollbarBackgroundPosition.x + SCROLLBAR_BACKGROUND_WIDTH_2D + WINDOW_MARGIN_2D
|
||||
&& scrollbarBackgroundPosition.y - WINDOW_MARGIN_2D <= event.y
|
||||
&& event.y <= scrollbarBackgroundPosition.y + scrollbarBackgroundHeight + WINDOW_MARGIN_2D) {
|
||||
scrollbarValue = (event.y - scrollbarBarClickedAt * scrollbarBarHeight - scrollbarBackgroundPosition.y)
|
||||
/ (scrollbarBackgroundHeight - scrollbarBarHeight - 2);
|
||||
scrollbarValue = Math.min(Math.max(scrollbarValue, 0.0), 1.0);
|
||||
firstUserToDisplay = Math.floor(scrollbarValue * (linesOfUsers.length - numUsersToDisplay));
|
||||
updateOverlayPositions();
|
||||
updateUsersDisplay();
|
||||
} else {
|
||||
Overlays.editOverlay(scrollbarBar2D, {
|
||||
backgroundAlpha: SCROLLBAR_BAR_ALPHA_2D
|
||||
});
|
||||
isMovingScrollbar = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseReleaseEvent() {
|
||||
Overlays.editOverlay(scrollbarBar2D, {
|
||||
backgroundAlpha: SCROLLBAR_BAR_ALPHA_2D
|
||||
});
|
||||
isMovingScrollbar = false;
|
||||
}
|
||||
|
||||
function onScriptUpdate() {
|
||||
var oldViewportHeight = viewportHeight;
|
||||
var oldViewportHeight = viewportHeight,
|
||||
oldIsMirrorDisplay = isMirrorDisplay,
|
||||
oldIsFullscreenMirror = isFullscreenMirror,
|
||||
MIRROR_MENU_ITEM = "Mirror",
|
||||
FULLSCREEN_MIRROR_MENU_ITEM = "Fullscreen Mirror";
|
||||
|
||||
viewportHeight = Controller.getViewportDimensions().y;
|
||||
if (viewportHeight !== oldViewportHeight) {
|
||||
isMirrorDisplay = Menu.isOptionChecked(MIRROR_MENU_ITEM);
|
||||
isFullscreenMirror = Menu.isOptionChecked(FULLSCREEN_MIRROR_MENU_ITEM);
|
||||
|
||||
if (viewportHeight !== oldViewportHeight
|
||||
|| isMirrorDisplay !== oldIsMirrorDisplay
|
||||
|| isFullscreenMirror !== oldIsFullscreenMirror) {
|
||||
calculateWindowHeight();
|
||||
updateUsersDisplay();
|
||||
updateOverlayPositions();
|
||||
}
|
||||
}
|
||||
|
@ -314,10 +460,10 @@ var usersWindow = (function () {
|
|||
radioButtonDiameter = RADIO_BUTTON_DISPLAY_SCALE * windowTextHeight;
|
||||
Overlays.deleteOverlay(textSizeOverlay);
|
||||
|
||||
calculateWindowHeight();
|
||||
|
||||
viewportHeight = Controller.getViewportDimensions().y;
|
||||
|
||||
calculateWindowHeight();
|
||||
|
||||
windowPane2D = Overlays.addOverlay("text", {
|
||||
x: 0,
|
||||
y: viewportHeight, // Start up off-screen
|
||||
|
@ -349,6 +495,36 @@ var usersWindow = (function () {
|
|||
visible: isVisible
|
||||
});
|
||||
|
||||
scrollbarBackgroundPosition = {
|
||||
x: WINDOW_WIDTH_2D - 0.5 * WINDOW_MARGIN_2D - SCROLLBAR_BACKGROUND_WIDTH_2D,
|
||||
y: viewportHeight
|
||||
};
|
||||
scrollbarBackground2D = Overlays.addOverlay("text", {
|
||||
x: scrollbarBackgroundPosition.x,
|
||||
y: scrollbarBackgroundPosition.y,
|
||||
width: SCROLLBAR_BACKGROUND_WIDTH_2D,
|
||||
height: windowTextHeight,
|
||||
backgroundColor: SCROLLBAR_BACKGROUND_COLOR_2D,
|
||||
backgroundAlpha: SCROLLBAR_BACKGROUND_ALPHA_2D,
|
||||
text: "",
|
||||
visible: isVisible && isUsingScrollbars
|
||||
});
|
||||
|
||||
scrollbarBarPosition = {
|
||||
x: WINDOW_WIDTH_2D - 0.5 * WINDOW_MARGIN_2D - SCROLLBAR_BACKGROUND_WIDTH_2D + 1,
|
||||
y: viewportHeight
|
||||
};
|
||||
scrollbarBar2D = Overlays.addOverlay("text", {
|
||||
x: scrollbarBarPosition.x,
|
||||
y: scrollbarBarPosition.y,
|
||||
width: SCROLLBAR_BACKGROUND_WIDTH_2D - 2,
|
||||
height: windowTextHeight,
|
||||
backgroundColor: SCROLLBAR_BAR_COLOR_2D,
|
||||
backgroundAlpha: SCROLLBAR_BAR_ALPHA_2D,
|
||||
text: "",
|
||||
visible: isVisible && isUsingScrollbars
|
||||
});
|
||||
|
||||
visibilityHeading2D = Overlays.addOverlay("text", {
|
||||
x: WINDOW_MARGIN_2D,
|
||||
y: viewportHeight,
|
||||
|
@ -390,7 +566,7 @@ var usersWindow = (function () {
|
|||
textOverlay: Overlays.addOverlay("text", {
|
||||
x: WINDOW_MARGIN_2D,
|
||||
y: viewportHeight,
|
||||
width: WINDOW_WIDTH_2D - 2 * WINDOW_MARGIN_2D,
|
||||
width: WINDOW_WIDTH_2D - SCROLLBAR_BACKGROUND_WIDTH_2D - 2 * WINDOW_MARGIN_2D,
|
||||
height: windowTextHeight,
|
||||
topMargin: 0,
|
||||
leftMargin: VISIBILITY_RADIO_SPACE,
|
||||
|
@ -429,6 +605,8 @@ var usersWindow = (function () {
|
|||
updateVisibilityControls();
|
||||
|
||||
Controller.mousePressEvent.connect(onMousePressEvent);
|
||||
Controller.mouseMoveEvent.connect(onMouseMoveEvent);
|
||||
Controller.mouseReleaseEvent.connect(onMouseReleaseEvent);
|
||||
|
||||
Menu.addMenuItem({
|
||||
menuName: MENU_NAME,
|
||||
|
@ -456,6 +634,8 @@ var usersWindow = (function () {
|
|||
Script.clearTimeout(usersTimer);
|
||||
Overlays.deleteOverlay(windowPane2D);
|
||||
Overlays.deleteOverlay(windowHeading2D);
|
||||
Overlays.deleteOverlay(scrollbarBackground2D);
|
||||
Overlays.deleteOverlay(scrollbarBar2D);
|
||||
Overlays.deleteOverlay(visibilityHeading2D);
|
||||
for (i = 0; i <= visibilityControls2D.length; i += 1) {
|
||||
Overlays.deleteOverlay(visibilityControls2D[i].textOverlay);
|
||||
|
|
|
@ -30,8 +30,9 @@ DiscoverabilityManager::DiscoverabilityManager() :
|
|||
const QString API_USER_LOCATION_PATH = "/api/v1/user/location";
|
||||
|
||||
void DiscoverabilityManager::updateLocation() {
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
|
||||
if (_mode.get() != Discoverability::None) {
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
||||
|
||||
|
@ -70,6 +71,10 @@ void DiscoverabilityManager::updateLocation() {
|
|||
QNetworkAccessManager::PutOperation,
|
||||
JSONCallbackParameters(), QJsonDocument(rootObject).toJson());
|
||||
}
|
||||
} else {
|
||||
// we still send a heartbeat to the metaverse server for stats collection
|
||||
const QString API_USER_HEARTBEAT_PATH = "/api/v1/user/heartbeat";
|
||||
accountManager.sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Required, QNetworkAccessManager::PutOperation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -277,7 +277,6 @@ void EntityTreeRenderer::update() {
|
|||
|
||||
void EntityTreeRenderer::checkEnterLeaveEntities() {
|
||||
if (_tree && !_shuttingDown) {
|
||||
_tree->lockForWrite(); // so that our scripts can do edits if they want
|
||||
glm::vec3 avatarPosition = _viewState->getAvatarPosition();
|
||||
|
||||
if (avatarPosition != _lastAvatarPosition) {
|
||||
|
@ -286,6 +285,7 @@ void EntityTreeRenderer::checkEnterLeaveEntities() {
|
|||
QVector<EntityItemID> entitiesContainingAvatar;
|
||||
|
||||
// find the entities near us
|
||||
_tree->lockForRead(); // don't let someone else change our tree while we search
|
||||
static_cast<EntityTree*>(_tree)->findEntities(avatarPosition, radius, foundEntities);
|
||||
|
||||
// create a list of entities that actually contain the avatar's position
|
||||
|
@ -294,6 +294,11 @@ void EntityTreeRenderer::checkEnterLeaveEntities() {
|
|||
entitiesContainingAvatar << entity->getEntityItemID();
|
||||
}
|
||||
}
|
||||
_tree->unlock();
|
||||
|
||||
// Note: at this point we don't need to worry about the tree being locked, because we only deal with
|
||||
// EntityItemIDs from here. The loadEntityScript() method is robust against attempting to load scripts
|
||||
// for entity IDs that no longer exist.
|
||||
|
||||
// for all of our previous containing entities, if they are no longer containing then send them a leave event
|
||||
foreach(const EntityItemID& entityID, _currentEntitiesInside) {
|
||||
|
@ -322,14 +327,12 @@ void EntityTreeRenderer::checkEnterLeaveEntities() {
|
|||
_currentEntitiesInside = entitiesContainingAvatar;
|
||||
_lastAvatarPosition = avatarPosition;
|
||||
}
|
||||
_tree->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTreeRenderer::leaveAllEntities() {
|
||||
if (_tree && !_shuttingDown) {
|
||||
_tree->lockForWrite(); // so that our scripts can do edits if they want
|
||||
|
||||
|
||||
// for all of our previous containing entities, if they are no longer containing then send them a leave event
|
||||
foreach(const EntityItemID& entityID, _currentEntitiesInside) {
|
||||
emit leaveEntity(entityID);
|
||||
|
@ -344,7 +347,6 @@ void EntityTreeRenderer::leaveAllEntities() {
|
|||
// make sure our "last avatar position" is something other than our current position, so that on our
|
||||
// first chance, we'll check for enter/leave entity events.
|
||||
_lastAvatarPosition = _viewState->getAvatarPosition() + glm::vec3((float)TREE_SCALE);
|
||||
_tree->unlock();
|
||||
}
|
||||
}
|
||||
void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
||||
|
|
Loading…
Reference in a new issue