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 edit-lights-overlays
This commit is contained in:
commit
d512a67c8a
23 changed files with 380 additions and 211 deletions
|
@ -267,10 +267,6 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
|||
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
||||
connect(nodeList.data(), &LimitedNodeList::nodeKilled, this, &DomainServer::nodeKilled);
|
||||
|
||||
QTimer* silentNodeTimer = new QTimer(this);
|
||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||
|
||||
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readAvailableDatagrams()));
|
||||
|
||||
// add whatever static assignments that have been parsed to the queue
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//
|
||||
|
||||
Script.load("progress.js");
|
||||
Script.load("editEntities.js");
|
||||
Script.load("edit.js");
|
||||
Script.load("selectAudioDevice.js");
|
||||
Script.load("controllers/hydra/hydraMove.js");
|
||||
Script.load("headMove.js");
|
||||
|
|
|
@ -134,7 +134,7 @@ var toolBar = (function () {
|
|||
|
||||
// Hide active button for now - this may come back, so not deleting yet.
|
||||
activeButton = toolBar.addTool({
|
||||
imageURL: toolIconUrl + "models-tool.svg",
|
||||
imageURL: toolIconUrl + "edit-status.svg",
|
||||
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
||||
width: toolWidth,
|
||||
height: toolHeight,
|
||||
|
@ -143,7 +143,7 @@ var toolBar = (function () {
|
|||
}, true, false);
|
||||
|
||||
newModelButton = toolBar.addTool({
|
||||
imageURL: toolIconUrl + "add-model-tool.svg",
|
||||
imageURL: toolIconUrl + "upload.svg",
|
||||
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
||||
width: toolWidth,
|
||||
height: toolHeight,
|
||||
|
@ -152,7 +152,7 @@ var toolBar = (function () {
|
|||
});
|
||||
|
||||
browseModelsButton = toolBar.addTool({
|
||||
imageURL: toolIconUrl + "list-icon.svg",
|
||||
imageURL: toolIconUrl + "marketplace.svg",
|
||||
width: toolWidth,
|
||||
height: toolHeight,
|
||||
alpha: 0.9,
|
|
@ -94,7 +94,7 @@ Tool = function(properties, selectable, selected) { // selectable and selected a
|
|||
}
|
||||
|
||||
selected = doSelect;
|
||||
properties.subImage.y = (selected ? 2 : 1) * properties.subImage.height;
|
||||
properties.subImage.y = (selected ? 0 : 1) * properties.subImage.height;
|
||||
Overlays.editOverlay(this.overlay(), { subImage: properties.subImage });
|
||||
}
|
||||
this.toggle = function() {
|
||||
|
@ -102,7 +102,7 @@ Tool = function(properties, selectable, selected) { // selectable and selected a
|
|||
return;
|
||||
}
|
||||
selected = !selected;
|
||||
properties.subImage.y = (selected ? 2 : 1) * properties.subImage.height;
|
||||
properties.subImage.y = (selected ? 0 : 1) * properties.subImage.height;
|
||||
Overlays.editOverlay(this.overlay(), { subImage: properties.subImage });
|
||||
|
||||
return selected;
|
||||
|
|
|
@ -13,29 +13,39 @@ var usersWindow = (function () {
|
|||
|
||||
var WINDOW_WIDTH_2D = 150,
|
||||
WINDOW_MARGIN_2D = 12,
|
||||
WINDOW_FONT_2D = { size: 12 },
|
||||
WINDOW_FOREGROUND_COLOR_2D = { red: 240, green: 240, blue: 240 },
|
||||
WINDOW_FOREGROUND_ALPHA_2D = 0.9,
|
||||
WINDOW_HEADING_COLOR_2D = { red: 180, green: 180, blue: 180 },
|
||||
WINDOW_HEADING_ALPHA_2D = 0.9,
|
||||
WINDOW_BACKGROUND_COLOR_2D = { red: 80, green: 80, blue: 80 },
|
||||
WINDOW_BACKGROUND_ALPHA_2D = 0.7,
|
||||
windowHeight = 0,
|
||||
usersPane2D,
|
||||
usersHeading2D,
|
||||
USERS_FONT_2D = { size: 14 },
|
||||
usersLineHeight,
|
||||
usersLineSpacing,
|
||||
windowPane2D,
|
||||
windowHeading2D,
|
||||
VISIBILITY_SPACER_2D = 12, // Space between list of users and visibility controls
|
||||
visibilityHeading2D,
|
||||
VISIBILITY_RADIO_SPACE = 16,
|
||||
visibilityControls2D,
|
||||
windowHeight,
|
||||
windowTextHeight,
|
||||
windowLineSpacing,
|
||||
windowLineHeight, // = windowTextHeight + windowLineSpacing
|
||||
|
||||
usersOnline, // Raw data
|
||||
linesOfUsers, // Array of indexes pointing into usersOnline
|
||||
usersOnline, // Raw users data
|
||||
linesOfUsers = [], // Array of indexes pointing into usersOnline
|
||||
|
||||
API_URL = "https://metaverse.highfidelity.io/api/v1/users?status=online",
|
||||
HTTP_GET_TIMEOUT = 60000, // ms = 1 minute
|
||||
HTTP_GET_TIMEOUT = 60000, // ms = 1 minute
|
||||
usersRequest,
|
||||
processUsers,
|
||||
usersTimedOut,
|
||||
pollUsersTimedOut,
|
||||
usersTimer = null,
|
||||
UPDATE_TIMEOUT = 5000, // ms = 5s
|
||||
USERS_UPDATE_TIMEOUT = 5000, // ms = 5s
|
||||
|
||||
myVisibility,
|
||||
VISIBILITY_VALUES = ["all", "friends", "none"],
|
||||
visibilityInterval,
|
||||
VISIBILITY_POLL_INTERVAL = 5000, // ms = 5s
|
||||
|
||||
MENU_NAME = "Tools",
|
||||
MENU_ITEM = "Users Online",
|
||||
|
@ -43,45 +53,56 @@ var usersWindow = (function () {
|
|||
|
||||
isVisible = true,
|
||||
|
||||
viewportHeight;
|
||||
viewportHeight,
|
||||
|
||||
function onMousePressEvent(event) {
|
||||
var clickedOverlay,
|
||||
numLinesBefore,
|
||||
overlayX,
|
||||
overlayY,
|
||||
minY,
|
||||
maxY,
|
||||
lineClicked;
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/",
|
||||
RADIO_BUTTON_SVG = HIFI_PUBLIC_BUCKET + "images/radio-button.svg",
|
||||
RADIO_BUTTON_SVG_DIAMETER = 14,
|
||||
RADIO_BUTTON_DISPLAY_SCALE = 0.7, // 1.0 = windowTextHeight
|
||||
radioButtonDiameter;
|
||||
|
||||
if (!isVisible) {
|
||||
return;
|
||||
}
|
||||
function calculateWindowHeight() {
|
||||
// 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;
|
||||
}
|
||||
|
||||
clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
||||
if (clickedOverlay === usersPane2D) {
|
||||
function updateOverlayPositions() {
|
||||
var i,
|
||||
y;
|
||||
|
||||
overlayX = event.x - WINDOW_MARGIN_2D;
|
||||
overlayY = event.y - viewportHeight + windowHeight - WINDOW_MARGIN_2D - (usersLineHeight + usersLineSpacing);
|
||||
|
||||
numLinesBefore = Math.floor(overlayY / (usersLineHeight + usersLineSpacing));
|
||||
minY = numLinesBefore * (usersLineHeight + usersLineSpacing);
|
||||
maxY = minY + usersLineHeight;
|
||||
|
||||
lineClicked = -1;
|
||||
if (minY <= overlayY && overlayY <= maxY) {
|
||||
lineClicked = numLinesBefore;
|
||||
}
|
||||
|
||||
if (0 <= lineClicked && lineClicked < linesOfUsers.length
|
||||
&& overlayX <= usersOnline[linesOfUsers[lineClicked]].usernameWidth) {
|
||||
//print("Go to " + usersOnline[linesOfUsers[lineClicked]].username);
|
||||
location.goToUser(usersOnline[linesOfUsers[lineClicked]].username);
|
||||
}
|
||||
Overlays.editOverlay(windowPane2D, {
|
||||
y: viewportHeight - windowHeight
|
||||
});
|
||||
Overlays.editOverlay(windowHeading2D, {
|
||||
y: viewportHeight - windowHeight + WINDOW_MARGIN_2D
|
||||
});
|
||||
Overlays.editOverlay(visibilityHeading2D, {
|
||||
y: viewportHeight - 4 * windowLineHeight + windowLineSpacing - WINDOW_MARGIN_2D
|
||||
});
|
||||
for (i = 0; i < visibilityControls2D.length; i += 1) {
|
||||
y = viewportHeight - (3 - i) * windowLineHeight + windowLineSpacing - WINDOW_MARGIN_2D;
|
||||
Overlays.editOverlay(visibilityControls2D[i].radioOverlay, { y: y });
|
||||
Overlays.editOverlay(visibilityControls2D[i].textOverlay, { y: y });
|
||||
}
|
||||
}
|
||||
|
||||
function updateWindow() {
|
||||
function updateVisibilityControls() {
|
||||
var i,
|
||||
color;
|
||||
|
||||
for (i = 0; i < visibilityControls2D.length; i += 1) {
|
||||
color = visibilityControls2D[i].selected ? WINDOW_FOREGROUND_COLOR_2D : WINDOW_HEADING_COLOR_2D;
|
||||
Overlays.editOverlay(visibilityControls2D[i].radioOverlay, {
|
||||
color: color,
|
||||
subImage: { y: visibilityControls2D[i].selected ? 0 : RADIO_BUTTON_SVG_DIAMETER }
|
||||
});
|
||||
Overlays.editOverlay(visibilityControls2D[i].textOverlay, { color: color });
|
||||
}
|
||||
}
|
||||
|
||||
function updateUsersDisplay() {
|
||||
var displayText = "",
|
||||
myUsername,
|
||||
user,
|
||||
|
@ -92,32 +113,38 @@ var usersWindow = (function () {
|
|||
for (i = 0; i < usersOnline.length; i += 1) {
|
||||
user = usersOnline[i];
|
||||
if (user.username !== myUsername && user.online) {
|
||||
usersOnline[i].usernameWidth = Overlays.textSize(usersPane2D, user.username).width;
|
||||
usersOnline[i].usernameWidth = Overlays.textSize(windowPane2D, user.username).width;
|
||||
linesOfUsers.push(i);
|
||||
displayText += "\n" + user.username;
|
||||
if (user.location.root) {
|
||||
displayText += " @ " + user.location.root.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
windowHeight = (linesOfUsers.length > 0 ? linesOfUsers.length + 1 : 1) * (usersLineHeight + usersLineSpacing)
|
||||
- usersLineSpacing + 2 * WINDOW_MARGIN_2D; // First or only line is for heading
|
||||
displayText = displayText.slice(1); // Remove leading "\n".
|
||||
|
||||
Overlays.editOverlay(usersPane2D, {
|
||||
calculateWindowHeight();
|
||||
|
||||
Overlays.editOverlay(windowPane2D, {
|
||||
y: viewportHeight - windowHeight,
|
||||
height: windowHeight,
|
||||
text: displayText
|
||||
});
|
||||
|
||||
Overlays.editOverlay(usersHeading2D, {
|
||||
Overlays.editOverlay(windowHeading2D, {
|
||||
y: viewportHeight - windowHeight + WINDOW_MARGIN_2D,
|
||||
text: linesOfUsers.length > 0 ? "Online" : "No users online"
|
||||
text: linesOfUsers.length > 0 ? "Users online" : "No users online"
|
||||
});
|
||||
|
||||
updateOverlayPositions();
|
||||
}
|
||||
|
||||
function requestUsers() {
|
||||
function pollUsers() {
|
||||
usersRequest = new XMLHttpRequest();
|
||||
usersRequest.open("GET", API_URL, true);
|
||||
usersRequest.timeout = HTTP_GET_TIMEOUT;
|
||||
usersRequest.ontimeout = usersTimedOut;
|
||||
usersRequest.ontimeout = pollUsersTimedOut;
|
||||
usersRequest.onreadystatechange = processUsers;
|
||||
usersRequest.send();
|
||||
}
|
||||
|
@ -130,46 +157,62 @@ var usersWindow = (function () {
|
|||
response = JSON.parse(usersRequest.responseText);
|
||||
if (response.status !== "success") {
|
||||
print("Error: Request for users status returned status = " + response.status);
|
||||
usersTimer = Script.setTimeout(requestUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
usersTimer = Script.setTimeout(pollUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
return;
|
||||
}
|
||||
if (!response.hasOwnProperty("data") || !response.data.hasOwnProperty("users")) {
|
||||
print("Error: Request for users status returned invalid data");
|
||||
usersTimer = Script.setTimeout(requestUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
usersTimer = Script.setTimeout(pollUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
return;
|
||||
}
|
||||
|
||||
usersOnline = response.data.users;
|
||||
updateWindow();
|
||||
updateUsersDisplay();
|
||||
} else {
|
||||
print("Error: Request for users status returned " + usersRequest.status + " " + usersRequest.statusText);
|
||||
usersTimer = Script.setTimeout(requestUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
usersTimer = Script.setTimeout(pollUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
return;
|
||||
}
|
||||
|
||||
usersTimer = Script.setTimeout(requestUsers, UPDATE_TIMEOUT); // Update after finished processing.
|
||||
usersTimer = Script.setTimeout(pollUsers, USERS_UPDATE_TIMEOUT); // Update after finished processing.
|
||||
}
|
||||
};
|
||||
|
||||
usersTimedOut = function () {
|
||||
pollUsersTimedOut = function () {
|
||||
print("Error: Request for users status timed out");
|
||||
usersTimer = Script.setTimeout(requestUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
usersTimer = Script.setTimeout(pollUsers, HTTP_GET_TIMEOUT); // Try again after a longer delay.
|
||||
};
|
||||
|
||||
function pollVisibility() {
|
||||
var currentVisibility = myVisibility;
|
||||
|
||||
myVisibility = GlobalServices.findableBy;
|
||||
if (myVisibility !== currentVisibility) {
|
||||
updateVisibilityControls();
|
||||
}
|
||||
}
|
||||
|
||||
function setVisible(visible) {
|
||||
var i;
|
||||
|
||||
isVisible = visible;
|
||||
|
||||
if (isVisible) {
|
||||
if (usersTimer === null) {
|
||||
requestUsers();
|
||||
pollUsers();
|
||||
}
|
||||
} else {
|
||||
Script.clearTimeout(usersTimer);
|
||||
usersTimer = null;
|
||||
}
|
||||
|
||||
Overlays.editOverlay(usersPane2D, { visible: isVisible });
|
||||
Overlays.editOverlay(usersHeading2D, { visible: isVisible });
|
||||
Overlays.editOverlay(windowPane2D, { visible: isVisible });
|
||||
Overlays.editOverlay(windowHeading2D, { visible: isVisible });
|
||||
Overlays.editOverlay(visibilityHeading2D, { visible: isVisible });
|
||||
for (i = 0; i < visibilityControls2D.length; i += 1) {
|
||||
Overlays.editOverlay(visibilityControls2D[i].radioOverlay, { visible: isVisible });
|
||||
Overlays.editOverlay(visibilityControls2D[i].textOverlay, { visible: isVisible });
|
||||
}
|
||||
}
|
||||
|
||||
function onMenuItemEvent(event) {
|
||||
|
@ -178,48 +221,182 @@ var usersWindow = (function () {
|
|||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
function onMousePressEvent(event) {
|
||||
var clickedOverlay,
|
||||
numLinesBefore,
|
||||
overlayX,
|
||||
overlayY,
|
||||
minY,
|
||||
maxY,
|
||||
lineClicked,
|
||||
i,
|
||||
visibilityChanged;
|
||||
|
||||
if (!isVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
||||
|
||||
if (clickedOverlay === windowPane2D) {
|
||||
|
||||
overlayX = event.x - WINDOW_MARGIN_2D;
|
||||
overlayY = event.y - viewportHeight + windowHeight - WINDOW_MARGIN_2D - windowLineHeight;
|
||||
|
||||
numLinesBefore = Math.floor(overlayY / windowLineHeight);
|
||||
minY = numLinesBefore * windowLineHeight;
|
||||
maxY = minY + windowTextHeight;
|
||||
|
||||
lineClicked = -1;
|
||||
if (minY <= overlayY && overlayY <= maxY) {
|
||||
lineClicked = numLinesBefore;
|
||||
}
|
||||
|
||||
if (0 <= lineClicked && lineClicked < linesOfUsers.length
|
||||
&& overlayX <= usersOnline[linesOfUsers[lineClicked]].usernameWidth) {
|
||||
//print("Go to " + usersOnline[linesOfUsers[lineClicked]].username);
|
||||
location.goToUser(usersOnline[linesOfUsers[lineClicked]].username);
|
||||
}
|
||||
}
|
||||
|
||||
visibilityChanged = false;
|
||||
for (i = 0; i < visibilityControls2D.length; i += 1) {
|
||||
// Don't need to test radioOverlay if it us under textOverlay.
|
||||
if (clickedOverlay === visibilityControls2D[i].textOverlay) {
|
||||
GlobalServices.findableBy = VISIBILITY_VALUES[i];
|
||||
visibilityChanged = true;
|
||||
}
|
||||
}
|
||||
if (visibilityChanged) {
|
||||
for (i = 0; i < visibilityControls2D.length; i += 1) {
|
||||
// Don't need to handle radioOverlay if it us under textOverlay.
|
||||
visibilityControls2D[i].selected = clickedOverlay === visibilityControls2D[i].textOverlay;
|
||||
}
|
||||
updateVisibilityControls();
|
||||
}
|
||||
}
|
||||
|
||||
function onScriptUpdate() {
|
||||
var oldViewportHeight = viewportHeight;
|
||||
|
||||
viewportHeight = Controller.getViewportDimensions().y;
|
||||
Overlays.editOverlay(usersPane2D, {
|
||||
y: viewportHeight - windowHeight
|
||||
});
|
||||
Overlays.editOverlay(usersHeading2D, {
|
||||
y: viewportHeight - windowHeight + WINDOW_MARGIN_2D
|
||||
});
|
||||
if (viewportHeight !== oldViewportHeight) {
|
||||
updateOverlayPositions();
|
||||
}
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
usersPane2D = Overlays.addOverlay("text", {
|
||||
bounds: { x: 0, y: 0, width: WINDOW_WIDTH_2D, height: 0 },
|
||||
topMargin: WINDOW_MARGIN_2D,
|
||||
var textSizeOverlay;
|
||||
|
||||
textSizeOverlay = Overlays.addOverlay("text", { font: WINDOW_FONT_2D, visible: false });
|
||||
windowTextHeight = Math.floor(Overlays.textSize(textSizeOverlay, "1").height);
|
||||
windowLineSpacing = Math.floor(Overlays.textSize(textSizeOverlay, "1\n2").height - 2 * windowTextHeight);
|
||||
windowLineHeight = windowTextHeight + windowLineSpacing;
|
||||
radioButtonDiameter = RADIO_BUTTON_DISPLAY_SCALE * windowTextHeight;
|
||||
Overlays.deleteOverlay(textSizeOverlay);
|
||||
|
||||
calculateWindowHeight();
|
||||
|
||||
viewportHeight = Controller.getViewportDimensions().y;
|
||||
|
||||
windowPane2D = Overlays.addOverlay("text", {
|
||||
x: 0,
|
||||
y: viewportHeight, // Start up off-screen
|
||||
width: WINDOW_WIDTH_2D,
|
||||
height: windowHeight,
|
||||
topMargin: WINDOW_MARGIN_2D + windowLineHeight,
|
||||
leftMargin: WINDOW_MARGIN_2D,
|
||||
color: WINDOW_FOREGROUND_COLOR_2D,
|
||||
alpha: WINDOW_FOREGROUND_ALPHA_2D,
|
||||
backgroundColor: WINDOW_BACKGROUND_COLOR_2D,
|
||||
backgroundAlpha: WINDOW_BACKGROUND_ALPHA_2D,
|
||||
text: "",
|
||||
font: USERS_FONT_2D,
|
||||
font: WINDOW_FONT_2D,
|
||||
visible: isVisible
|
||||
});
|
||||
|
||||
usersHeading2D = Overlays.addOverlay("text", {
|
||||
windowHeading2D = Overlays.addOverlay("text", {
|
||||
x: WINDOW_MARGIN_2D,
|
||||
y: viewportHeight,
|
||||
width: WINDOW_WIDTH_2D - 2 * WINDOW_MARGIN_2D,
|
||||
height: USERS_FONT_2D.size,
|
||||
height: windowTextHeight,
|
||||
topMargin: 0,
|
||||
leftMargin: 0,
|
||||
color: WINDOW_HEADING_COLOR_2D,
|
||||
alpha: WINDOW_HEADING_ALPHA_2D,
|
||||
backgroundAlpha: 0.0,
|
||||
text: "No users online",
|
||||
font: USERS_FONT_2D,
|
||||
font: WINDOW_FONT_2D,
|
||||
visible: isVisible
|
||||
});
|
||||
|
||||
viewportHeight = Controller.getViewportDimensions().y;
|
||||
visibilityHeading2D = Overlays.addOverlay("text", {
|
||||
x: WINDOW_MARGIN_2D,
|
||||
y: viewportHeight,
|
||||
width: WINDOW_WIDTH_2D - 2 * WINDOW_MARGIN_2D,
|
||||
height: windowTextHeight,
|
||||
topMargin: 0,
|
||||
leftMargin: 0,
|
||||
color: WINDOW_HEADING_COLOR_2D,
|
||||
alpha: WINDOW_HEADING_ALPHA_2D,
|
||||
backgroundAlpha: 0.0,
|
||||
text: "I am visible to:",
|
||||
font: WINDOW_FONT_2D,
|
||||
visible: isVisible
|
||||
});
|
||||
|
||||
usersLineHeight = Math.floor(Overlays.textSize(usersPane2D, "1").height);
|
||||
usersLineSpacing = Math.floor(Overlays.textSize(usersPane2D, "1\n2").height - 2 * usersLineHeight);
|
||||
myVisibility = GlobalServices.findableBy;
|
||||
if (!/^(all|friends|none)$/.test(myVisibility)) {
|
||||
print("Error: Unrecognized findableBy value");
|
||||
myVisibility = "";
|
||||
}
|
||||
|
||||
visibilityControls2D = [{
|
||||
radioOverlay: Overlays.addOverlay("image", { // Create first so that it is under textOverlay.
|
||||
x: WINDOW_MARGIN_2D,
|
||||
y: viewportHeight,
|
||||
width: radioButtonDiameter,
|
||||
height: radioButtonDiameter,
|
||||
imageURL: RADIO_BUTTON_SVG,
|
||||
subImage: {
|
||||
x: 0,
|
||||
y: RADIO_BUTTON_SVG_DIAMETER, // Off
|
||||
width: RADIO_BUTTON_SVG_DIAMETER,
|
||||
height: RADIO_BUTTON_SVG_DIAMETER
|
||||
},
|
||||
color: WINDOW_HEADING_COLOR_2D,
|
||||
alpha: WINDOW_FOREGROUND_ALPHA_2D
|
||||
}),
|
||||
textOverlay: Overlays.addOverlay("text", {
|
||||
x: WINDOW_MARGIN_2D,
|
||||
y: viewportHeight,
|
||||
width: WINDOW_WIDTH_2D - 2 * WINDOW_MARGIN_2D,
|
||||
height: windowTextHeight,
|
||||
topMargin: 0,
|
||||
leftMargin: VISIBILITY_RADIO_SPACE,
|
||||
color: WINDOW_HEADING_COLOR_2D,
|
||||
alpha: WINDOW_FOREGROUND_ALPHA_2D,
|
||||
backgroundAlpha: 0.0,
|
||||
text: "everyone",
|
||||
font: WINDOW_FONT_2D,
|
||||
visible: isVisible
|
||||
}),
|
||||
selected: myVisibility === VISIBILITY_VALUES[0]
|
||||
} ];
|
||||
visibilityControls2D[1] = {
|
||||
radioOverlay: Overlays.cloneOverlay(visibilityControls2D[0].radioOverlay),
|
||||
textOverlay: Overlays.cloneOverlay(visibilityControls2D[0].textOverlay),
|
||||
selected: myVisibility === VISIBILITY_VALUES[1]
|
||||
};
|
||||
Overlays.editOverlay(visibilityControls2D[1].textOverlay, { text: "my friends" });
|
||||
visibilityControls2D[2] = {
|
||||
radioOverlay: Overlays.cloneOverlay(visibilityControls2D[0].radioOverlay),
|
||||
textOverlay: Overlays.cloneOverlay(visibilityControls2D[0].textOverlay),
|
||||
selected: myVisibility === VISIBILITY_VALUES[2]
|
||||
};
|
||||
Overlays.editOverlay(visibilityControls2D[2].textOverlay, { text: "no one" });
|
||||
|
||||
updateVisibilityControls();
|
||||
|
||||
Controller.mousePressEvent.connect(onMousePressEvent);
|
||||
|
||||
|
@ -232,17 +409,28 @@ var usersWindow = (function () {
|
|||
});
|
||||
Menu.menuItemEvent.connect(onMenuItemEvent);
|
||||
|
||||
Script.update.connect(update);
|
||||
Script.update.connect(onScriptUpdate);
|
||||
|
||||
visibilityInterval = Script.setInterval(pollVisibility, VISIBILITY_POLL_INTERVAL);
|
||||
|
||||
pollUsers();
|
||||
|
||||
requestUsers();
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
var i;
|
||||
|
||||
Menu.removeMenuItem(MENU_NAME, MENU_ITEM);
|
||||
|
||||
Script.clearInterval(visibilityInterval);
|
||||
Script.clearTimeout(usersTimer);
|
||||
Overlays.deleteOverlay(usersHeading2D);
|
||||
Overlays.deleteOverlay(usersPane2D);
|
||||
Overlays.deleteOverlay(windowPane2D);
|
||||
Overlays.deleteOverlay(windowHeading2D);
|
||||
Overlays.deleteOverlay(visibilityHeading2D);
|
||||
for (i = 0; i <= visibilityControls2D.length; i += 1) {
|
||||
Overlays.deleteOverlay(visibilityControls2D[i].textOverlay);
|
||||
Overlays.deleteOverlay(visibilityControls2D[i].radioOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
setUp();
|
||||
|
|
|
@ -146,7 +146,6 @@ const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB
|
|||
|
||||
static QTimer* locationUpdateTimer = NULL;
|
||||
static QTimer* balanceUpdateTimer = NULL;
|
||||
static QTimer* silentNodeTimer = NULL;
|
||||
static QTimer* identityPacketTimer = NULL;
|
||||
static QTimer* billboardPacketTimer = NULL;
|
||||
static QTimer* checkFPStimer = NULL;
|
||||
|
@ -258,7 +257,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_dependencyManagerIsSetup(setupEssentials(argc, argv)),
|
||||
_window(new MainWindow(desktop())),
|
||||
_toolWindow(NULL),
|
||||
_nodeThread(new QThread(this)),
|
||||
_datagramProcessor(),
|
||||
_undoStack(),
|
||||
_undoStackScriptingInterface(&_undoStack),
|
||||
|
@ -329,18 +327,25 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_runningScriptsWidget = new RunningScriptsWidget(_window);
|
||||
|
||||
// start the nodeThread so its event loop is running
|
||||
_nodeThread->setObjectName("Datagram Processor Thread");
|
||||
_nodeThread->start();
|
||||
QThread* nodeThread = new QThread(this);
|
||||
nodeThread->setObjectName("Datagram Processor Thread");
|
||||
nodeThread->start();
|
||||
|
||||
// make sure the node thread is given highest priority
|
||||
_nodeThread->setPriority(QThread::TimeCriticalPriority);
|
||||
nodeThread->setPriority(QThread::TimeCriticalPriority);
|
||||
|
||||
_datagramProcessor = new DatagramProcessor(nodeList.data());
|
||||
|
||||
// have the NodeList use deleteLater from DM customDeleter
|
||||
nodeList->setCustomDeleter([](Dependency* dependency) {
|
||||
static_cast<NodeList*>(dependency)->deleteLater();
|
||||
});
|
||||
|
||||
// put the NodeList and datagram processing on the node thread
|
||||
nodeList->moveToThread(_nodeThread);
|
||||
_datagramProcessor.moveToThread(_nodeThread);
|
||||
nodeList->moveToThread(nodeThread);
|
||||
|
||||
// connect the DataProcessor processDatagrams slot to the QUDPSocket readyRead() signal
|
||||
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), &_datagramProcessor, SLOT(processDatagrams()));
|
||||
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, _datagramProcessor, &DatagramProcessor::processDatagrams);
|
||||
|
||||
// put the audio processing on a separate thread
|
||||
QThread* audioThread = new QThread();
|
||||
|
@ -427,12 +432,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
// connect to the packet sent signal of the _entityEditSender
|
||||
connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
|
||||
|
||||
// move the silentNodeTimer to the _nodeThread
|
||||
silentNodeTimer = new QTimer();
|
||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||
silentNodeTimer->moveToThread(_nodeThread);
|
||||
|
||||
// send the identity packet for our avatar each second to our avatar mixer
|
||||
identityPacketTimer = new QTimer();
|
||||
connect(identityPacketTimer, &QTimer::timeout, _myAvatar, &MyAvatar::sendIdentityPacket);
|
||||
|
@ -547,7 +546,7 @@ void Application::aboutToQuit() {
|
|||
}
|
||||
|
||||
void Application::cleanupBeforeQuit() {
|
||||
_datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
|
||||
_datagramProcessor->shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
|
||||
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
|
||||
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
|
||||
|
||||
|
@ -555,7 +554,6 @@ void Application::cleanupBeforeQuit() {
|
|||
// depending on what thread they run in
|
||||
locationUpdateTimer->stop();
|
||||
balanceUpdateTimer->stop();
|
||||
QMetaObject::invokeMethod(silentNodeTimer, "stop", Qt::BlockingQueuedConnection);
|
||||
identityPacketTimer->stop();
|
||||
billboardPacketTimer->stop();
|
||||
checkFPStimer->stop();
|
||||
|
@ -565,7 +563,6 @@ void Application::cleanupBeforeQuit() {
|
|||
// and then delete those that got created by "new"
|
||||
delete locationUpdateTimer;
|
||||
delete balanceUpdateTimer;
|
||||
delete silentNodeTimer;
|
||||
delete identityPacketTimer;
|
||||
delete billboardPacketTimer;
|
||||
delete checkFPStimer;
|
||||
|
@ -576,10 +573,6 @@ void Application::cleanupBeforeQuit() {
|
|||
_settingsThread.quit();
|
||||
saveSettings();
|
||||
_window->saveGeometry();
|
||||
|
||||
// TODO: now that this is in cleanupBeforeQuit do we really need it to stop and force
|
||||
// an event loop to send the packet?
|
||||
UserActivityLogger::getInstance().close();
|
||||
|
||||
// let the avatar mixer know we're out
|
||||
MyAvatar::sendKillAvatar();
|
||||
|
@ -597,10 +590,6 @@ Application::~Application() {
|
|||
tree->lockForWrite();
|
||||
_entities.getTree()->setSimulation(NULL);
|
||||
tree->unlock();
|
||||
|
||||
// ask the datagram processing thread to quit and wait until it is done
|
||||
_nodeThread->quit();
|
||||
_nodeThread->wait();
|
||||
|
||||
_octreeProcessor.terminate();
|
||||
_entityEditSender.terminate();
|
||||
|
@ -620,6 +609,13 @@ Application::~Application() {
|
|||
DependencyManager::destroy<GeometryCache>();
|
||||
//DependencyManager::destroy<ScriptCache>();
|
||||
DependencyManager::destroy<SoundCache>();
|
||||
|
||||
QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
|
||||
DependencyManager::destroy<NodeList>();
|
||||
|
||||
// ask the node thread to quit and wait until it is done
|
||||
nodeThread->quit();
|
||||
nodeThread->wait();
|
||||
|
||||
qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages
|
||||
}
|
||||
|
@ -889,7 +885,7 @@ bool Application::event(QEvent* event) {
|
|||
if (!url.isEmpty()) {
|
||||
if (url.scheme() == HIFI_URL_SCHEME) {
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(fileEvent->url().toString());
|
||||
} else if (url.url().toLower().endsWith(SVO_EXTENSION)) {
|
||||
} else if (url.path().toLower().endsWith(SVO_EXTENSION)) {
|
||||
emit svoImportRequested(url.url());
|
||||
}
|
||||
}
|
||||
|
@ -1455,10 +1451,11 @@ void Application::dropEvent(QDropEvent *event) {
|
|||
QString snapshotPath;
|
||||
const QMimeData *mimeData = event->mimeData();
|
||||
foreach (QUrl url, mimeData->urls()) {
|
||||
if (url.url().toLower().endsWith(SNAPSHOT_EXTENSION)) {
|
||||
auto lower = url.path().toLower();
|
||||
if (lower.endsWith(SNAPSHOT_EXTENSION)) {
|
||||
snapshotPath = url.toLocalFile();
|
||||
break;
|
||||
} else if (url.url().toLower().endsWith(SVO_EXTENSION)) {
|
||||
} else if (lower.endsWith(SVO_EXTENSION)) {
|
||||
emit svoImportRequested(url.url());
|
||||
event->acceptProposedAction();
|
||||
return;
|
||||
|
@ -1498,7 +1495,7 @@ void Application::checkFPS() {
|
|||
|
||||
_fps = (float)_frameCount / diffTime;
|
||||
_frameCount = 0;
|
||||
_datagramProcessor.resetCounters();
|
||||
_datagramProcessor->resetCounters();
|
||||
_timerStart.start();
|
||||
|
||||
// ask the node list to check in with the domain server
|
||||
|
@ -2739,7 +2736,6 @@ const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f };
|
|||
const GLfloat WORLD_SPECULAR_COLOR[] = { 0.94f, 0.94f, 0.737f, 1.0f };
|
||||
|
||||
const glm::vec3 GLOBAL_LIGHT_COLOR = { 0.6f, 0.525f, 0.525f };
|
||||
const float GLOBAL_LIGHT_INTENSITY = 1.0f;
|
||||
|
||||
void Application::setupWorldLight() {
|
||||
|
||||
|
|
|
@ -445,10 +445,8 @@ private:
|
|||
MainWindow* _window;
|
||||
|
||||
ToolWindow* _toolWindow;
|
||||
|
||||
|
||||
QThread* _nodeThread;
|
||||
DatagramProcessor _datagramProcessor;
|
||||
|
||||
DatagramProcessor* _datagramProcessor;
|
||||
|
||||
QUndoStack _undoStack;
|
||||
UndoStackScriptingInterface _undoStackScriptingInterface;
|
||||
|
|
|
@ -170,7 +170,7 @@ void GLCanvas::wheelEvent(QWheelEvent* event) {
|
|||
void GLCanvas::dragEnterEvent(QDragEnterEvent* event) {
|
||||
const QMimeData *mimeData = event->mimeData();
|
||||
foreach (QUrl url, mimeData->urls()) {
|
||||
auto lower = url.url().toLower();
|
||||
auto lower = url.path().toLower();
|
||||
if (lower.endsWith(SNAPSHOT_EXTENSION) || lower.endsWith(SVO_EXTENSION)) {
|
||||
event->acceptProposedAction();
|
||||
break;
|
||||
|
|
|
@ -697,6 +697,12 @@ void Menu::removeAction(QMenu* menu, const QString& actionName) {
|
|||
}
|
||||
|
||||
void Menu::setIsOptionChecked(const QString& menuOption, bool isChecked) {
|
||||
if (thread() != QThread::currentThread()) {
|
||||
QMetaObject::invokeMethod(Menu::getInstance(), "setIsOptionChecked", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(const QString&, menuOption),
|
||||
Q_ARG(bool, isChecked));
|
||||
return;
|
||||
}
|
||||
QAction* menu = _actionHash.value(menuOption);
|
||||
if (menu) {
|
||||
menu->setChecked(isChecked);
|
||||
|
|
|
@ -49,8 +49,6 @@ using namespace std;
|
|||
const glm::vec3 DEFAULT_UP_DIRECTION(0.0f, 1.0f, 0.0f);
|
||||
const float YAW_SPEED = 500.0f; // degrees/sec
|
||||
const float PITCH_SPEED = 100.0f; // degrees/sec
|
||||
const float COLLISION_RADIUS_SCALAR = 1.2f; // pertains to avatar-to-avatar collisions
|
||||
const float COLLISION_RADIUS_SCALE = 0.125f;
|
||||
const float DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES = 30.0f;
|
||||
|
||||
const float MAX_WALKING_SPEED = 2.5f; // human walking speed
|
||||
|
|
|
@ -791,8 +791,6 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) {
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
const int BALL_SUBDIVISIONS = 10;
|
||||
|
||||
bool SkeletonModel::hasSkeleton() {
|
||||
return isActive() ? _geometry->getFBXGeometry().rootJointIndex != -1 : false;
|
||||
}
|
||||
|
|
|
@ -107,13 +107,16 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
const bool displayOverlays = Menu::getInstance()->isOptionChecked(MenuOption::UserInterface);
|
||||
|
||||
DependencyManager::get<GlowEffect>()->prepare();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
// render left side view
|
||||
glViewport(portalX, portalY, portalW, portalH);
|
||||
glScissor(portalX, portalY, portalW, portalH);
|
||||
|
||||
Camera eyeCamera;
|
||||
eyeCamera.setRotation(whichCamera.getRotation());
|
||||
eyeCamera.setPosition(whichCamera.getPosition());
|
||||
|
||||
glPushMatrix();
|
||||
{
|
||||
|
@ -129,7 +132,8 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
Application::getInstance()->displaySide(whichCamera, false, RenderArgs::STEREO_LEFT);
|
||||
eyeCamera.setEyeOffsetPosition(glm::vec3(-_activeEye->modelTranslation,0,0));
|
||||
Application::getInstance()->displaySide(eyeCamera, false, RenderArgs::MONO);
|
||||
|
||||
if (displayOverlays) {
|
||||
applicationOverlay.displayOverlayTexture3DTV(whichCamera, _aspect, fov);
|
||||
|
@ -150,7 +154,7 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
_activeEye = &_rightEye;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity(); // reset projection matrix
|
||||
glFrustum(_rightEye.left, _rightEye.right, _rightEye.bottom, _rightEye.top, nearZ, farZ); // set left view frustum
|
||||
glFrustum(_rightEye.left, _rightEye.right, _rightEye.bottom, _rightEye.top, nearZ, farZ); // set right view frustum
|
||||
GLfloat p[4][4];
|
||||
glGetFloatv(GL_PROJECTION_MATRIX, &(p[0][0]));
|
||||
GLfloat cotangent = p[1][1];
|
||||
|
@ -159,7 +163,8 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
Application::getInstance()->displaySide(whichCamera, false, RenderArgs::STEREO_RIGHT);
|
||||
eyeCamera.setEyeOffsetPosition(glm::vec3(-_activeEye->modelTranslation,0,0));
|
||||
Application::getInstance()->displaySide(eyeCamera, false, RenderArgs::MONO);
|
||||
|
||||
if (displayOverlays) {
|
||||
applicationOverlay.displayOverlayTexture3DTV(whichCamera, _aspect, fov);
|
||||
|
|
|
@ -32,7 +32,6 @@ LightEntityItem::LightEntityItem(const EntityItemID& entityItemID, const EntityI
|
|||
_type = EntityTypes::Light;
|
||||
|
||||
// default property values
|
||||
const quint8 MAX_COLOR = 255;
|
||||
_color[RED_INDEX] = _color[GREEN_INDEX] = _color[BLUE_INDEX] = 0;
|
||||
_intensity = 1.0f;
|
||||
_exponent = 0.0f;
|
||||
|
|
|
@ -134,55 +134,55 @@ void EarthSunModel::setSunLongitude(float lon) {
|
|||
_sunLongitude = validateLongitude(lon);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
Atmosphere::Atmosphere() {
|
||||
// only if created from nothing shall we create the Buffer to store the properties
|
||||
Data data;
|
||||
_dataBuffer = gpu::BufferView(new gpu::Buffer(sizeof(Data), (const gpu::Buffer::Byte*) &data));
|
||||
|
||||
|
||||
Atmosphere::Atmosphere() {
|
||||
// only if created from nothing shall we create the Buffer to store the properties
|
||||
Data data;
|
||||
_dataBuffer = gpu::BufferView(new gpu::Buffer(sizeof(Data), (const gpu::Buffer::Byte*) &data));
|
||||
|
||||
setScatteringWavelength(_scatteringWavelength);
|
||||
setRayleighScattering(_rayleighScattering);
|
||||
setInnerOuterRadiuses(getInnerRadius(), getOuterRadius());
|
||||
}
|
||||
|
||||
void Atmosphere::setScatteringWavelength(Vec3 wavelength) {
|
||||
_scatteringWavelength = wavelength;
|
||||
Data& data = editData();
|
||||
data._invWaveLength = Vec4(1.0f / powf(wavelength.x, 4.0f), 1.0f / powf(wavelength.y, 4.0f), 1.0f / powf(wavelength.z, 4.0f), 0.0f);
|
||||
}
|
||||
|
||||
void Atmosphere::setRayleighScattering(float scattering) {
|
||||
_rayleighScattering = scattering;
|
||||
updateScattering();
|
||||
}
|
||||
|
||||
void Atmosphere::setMieScattering(float scattering) {
|
||||
_mieScattering = scattering;
|
||||
updateScattering();
|
||||
}
|
||||
|
||||
void Atmosphere::setSunBrightness(float brightness) {
|
||||
_sunBrightness = brightness;
|
||||
updateScattering();
|
||||
}
|
||||
void Atmosphere::setScatteringWavelength(Vec3 wavelength) {
|
||||
_scatteringWavelength = wavelength;
|
||||
Data& data = editData();
|
||||
data._invWaveLength = Vec4(1.0f / powf(wavelength.x, 4.0f), 1.0f / powf(wavelength.y, 4.0f), 1.0f / powf(wavelength.z, 4.0f), 0.0f);
|
||||
}
|
||||
|
||||
void Atmosphere::updateScattering() {
|
||||
Data& data = editData();
|
||||
|
||||
data._scatterings.x = getRayleighScattering() * getSunBrightness();
|
||||
data._scatterings.y = getMieScattering() * getSunBrightness();
|
||||
|
||||
data._scatterings.z = getRayleighScattering() * 4.0f * glm::pi<float>();
|
||||
data._scatterings.w = getMieScattering() * 4.0f * glm::pi<float>();
|
||||
}
|
||||
void Atmosphere::setRayleighScattering(float scattering) {
|
||||
_rayleighScattering = scattering;
|
||||
updateScattering();
|
||||
}
|
||||
|
||||
void Atmosphere::setInnerOuterRadiuses(float inner, float outer) {
|
||||
Data& data = editData();
|
||||
data._radiuses.x = inner;
|
||||
data._radiuses.y = outer;
|
||||
data._scales.x = 1.0f / (outer - inner);
|
||||
data._scales.z = data._scales.x / data._scales.y;
|
||||
}
|
||||
void Atmosphere::setMieScattering(float scattering) {
|
||||
_mieScattering = scattering;
|
||||
updateScattering();
|
||||
}
|
||||
|
||||
void Atmosphere::setSunBrightness(float brightness) {
|
||||
_sunBrightness = brightness;
|
||||
updateScattering();
|
||||
}
|
||||
|
||||
void Atmosphere::updateScattering() {
|
||||
Data& data = editData();
|
||||
|
||||
data._scatterings.x = getRayleighScattering() * getSunBrightness();
|
||||
data._scatterings.y = getMieScattering() * getSunBrightness();
|
||||
|
||||
data._scatterings.z = getRayleighScattering() * 4.0f * glm::pi<float>();
|
||||
data._scatterings.w = getMieScattering() * 4.0f * glm::pi<float>();
|
||||
}
|
||||
|
||||
void Atmosphere::setInnerOuterRadiuses(float inner, float outer) {
|
||||
Data& data = editData();
|
||||
data._radiuses.x = inner;
|
||||
data._radiuses.y = outer;
|
||||
data._scales.x = 1.0f / (outer - inner);
|
||||
data._scales.z = data._scales.x / data._scales.y;
|
||||
}
|
||||
|
||||
|
||||
const int NUM_DAYS_PER_YEAR = 365;
|
||||
|
@ -267,7 +267,7 @@ void SunSkyStage::updateGraphicsObject() const {
|
|||
static int firstTime = 0;
|
||||
if (firstTime == 0) {
|
||||
firstTime++;
|
||||
bool result = gpu::Shader::makeProgram(*(_skyPipeline->getProgram()));
|
||||
gpu::Shader::makeProgram(*(_skyPipeline->getProgram()));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <QtCore/QUrlQuery>
|
||||
#include <QtNetwork/QHttpMultiPart>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
#include <QEventLoop>
|
||||
#include <qthread.h>
|
||||
|
||||
#include <SettingHandle.h>
|
||||
|
@ -300,8 +299,6 @@ void AccountManager::processReply() {
|
|||
passErrorToCallback(requestReply);
|
||||
}
|
||||
delete requestReply;
|
||||
|
||||
emit replyFinished();
|
||||
}
|
||||
|
||||
void AccountManager::passSuccessToCallback(QNetworkReply* requestReply) {
|
||||
|
@ -342,15 +339,6 @@ void AccountManager::passErrorToCallback(QNetworkReply* requestReply) {
|
|||
}
|
||||
}
|
||||
|
||||
void AccountManager::waitForAllPendingReplies() {
|
||||
while (_pendingCallbackMap.size() > 0) {
|
||||
QEventLoop loop;
|
||||
QObject::connect(this, &AccountManager::replyFinished, &loop, &QEventLoop::quit);
|
||||
loop.exec();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AccountManager::persistAccountToSettings() {
|
||||
if (_shouldPersistToSettingsFile) {
|
||||
// store this access token into the local settings
|
||||
|
|
|
@ -72,8 +72,6 @@ public:
|
|||
void requestProfile();
|
||||
|
||||
DataServerAccountInfo& getAccountInfo() { return _accountInfo; }
|
||||
|
||||
void waitForAllPendingReplies();
|
||||
|
||||
public slots:
|
||||
void requestAccessToken(const QString& login, const QString& password);
|
||||
|
@ -95,8 +93,6 @@ signals:
|
|||
void loginFailed();
|
||||
void logoutComplete();
|
||||
void balanceChanged(qint64 newBalance);
|
||||
void replyFinished();
|
||||
|
||||
private slots:
|
||||
void processReply();
|
||||
void handleKeypairGenerationError();
|
||||
|
|
|
@ -80,6 +80,10 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
|
|||
connect(localSocketUpdate, &QTimer::timeout, this, &LimitedNodeList::updateLocalSockAddr);
|
||||
localSocketUpdate->start(LOCAL_SOCKET_UPDATE_INTERVAL_MSECS);
|
||||
|
||||
QTimer* silentNodeTimer = new QTimer(this);
|
||||
connect(silentNodeTimer, &QTimer::timeout, this, &LimitedNodeList::removeSilentNodes);
|
||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||
|
||||
// check the local socket right now
|
||||
updateLocalSockAddr();
|
||||
|
||||
|
@ -500,6 +504,7 @@ void LimitedNodeList::resetPacketStats() {
|
|||
}
|
||||
|
||||
void LimitedNodeList::removeSilentNodes() {
|
||||
|
||||
QSet<SharedNodePointer> killedNodes;
|
||||
|
||||
eachNodeHashIterator([&](NodeHash::iterator& it){
|
||||
|
|
|
@ -223,6 +223,8 @@ protected:
|
|||
HifiSockAddr _localSockAddr;
|
||||
HifiSockAddr _publicSockAddr;
|
||||
HifiSockAddr _stunSockAddr;
|
||||
|
||||
QTimer* _silentNodeTimer;
|
||||
|
||||
// XXX can BandwidthRecorder be used for this?
|
||||
int _numCollectedPackets;
|
||||
|
|
|
@ -37,6 +37,7 @@ const quint64 DOMAIN_SERVER_CHECK_IN_MSECS = 1 * 1000;
|
|||
|
||||
const int MAX_SILENT_DOMAIN_SERVER_CHECK_INS = 5;
|
||||
|
||||
class Application;
|
||||
class Assignment;
|
||||
|
||||
class NodeList : public LimitedNodeList {
|
||||
|
@ -95,6 +96,8 @@ private:
|
|||
HifiSockAddr _assignmentServerSocket;
|
||||
bool _hasCompletedInitialSTUNFailure;
|
||||
unsigned int _stunRequestsSinceSuccess;
|
||||
|
||||
friend class Application;
|
||||
};
|
||||
|
||||
#endif // hifi_NodeList_h
|
||||
|
|
|
@ -67,10 +67,6 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy
|
|||
connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
|
||||
domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||
|
||||
QTimer* silentNodeRemovalTimer = new QTimer(this);
|
||||
connect(silentNodeRemovalTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
||||
silentNodeRemovalTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||
|
||||
if (shouldSendStats) {
|
||||
// send a stats packet every 1 second
|
||||
QTimer* statsTimer = new QTimer(this);
|
||||
|
|
|
@ -61,7 +61,7 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
|
|||
params.errorCallbackReceiver = this;
|
||||
params.errorCallbackMethod = "requestError";
|
||||
}
|
||||
|
||||
|
||||
accountManager.authenticatedRequest(USER_ACTIVITY_URL,
|
||||
QNetworkAccessManager::PostOperation,
|
||||
params,
|
||||
|
@ -86,13 +86,6 @@ void UserActivityLogger::launch(QString applicationVersion) {
|
|||
logAction(ACTION_NAME, actionDetails);
|
||||
}
|
||||
|
||||
void UserActivityLogger::close() {
|
||||
const QString ACTION_NAME = "close";
|
||||
logAction(ACTION_NAME, QJsonObject());
|
||||
|
||||
AccountManager::getInstance().waitForAllPendingReplies();
|
||||
}
|
||||
|
||||
void UserActivityLogger::changedDisplayName(QString displayName) {
|
||||
const QString ACTION_NAME = "changed_display_name";
|
||||
QJsonObject actionDetails;
|
||||
|
|
|
@ -30,7 +30,7 @@ public slots:
|
|||
void logAction(QString action, QJsonObject details = QJsonObject(), JSONCallbackParameters params = JSONCallbackParameters());
|
||||
|
||||
void launch(QString applicationVersion);
|
||||
void close();
|
||||
|
||||
void changedDisplayName(QString displayName);
|
||||
void changedModel(QString typeOfModel, QString modelURL);
|
||||
void changedDomain(QString domainURL);
|
||||
|
|
|
@ -17,9 +17,11 @@ using namespace meshinfo;
|
|||
//origin is the default reference point for generating the tetrahedron from each triangle of the mesh.
|
||||
|
||||
MeshInfo::MeshInfo(vector<Vertex> *vertices, vector<int> *triangles) :\
|
||||
_vertices(vertices),
|
||||
_triangles(triangles),
|
||||
_centerOfMass(Vertex(0.0, 0.0, 0.0)){
|
||||
_vertices(vertices),
|
||||
_centerOfMass(Vertex(0.0, 0.0, 0.0)),
|
||||
_triangles(triangles)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MeshInfo::~MeshInfo(){
|
||||
|
|
Loading…
Reference in a new issue