mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 07:52:55 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into lockers-can-change-metavoxels
This commit is contained in:
commit
6506d87eb6
4 changed files with 26 additions and 105 deletions
|
@ -105,15 +105,7 @@ var toolBar = (function () {
|
||||||
newSphereButton,
|
newSphereButton,
|
||||||
newLightButton,
|
newLightButton,
|
||||||
newTextButton,
|
newTextButton,
|
||||||
browseModelsButton,
|
browseModelsButton;
|
||||||
loadURLMenuItem,
|
|
||||||
loadFileMenuItem,
|
|
||||||
menuItemWidth,
|
|
||||||
menuItemOffset,
|
|
||||||
menuItemHeight,
|
|
||||||
menuItemMargin = 5,
|
|
||||||
menuTextColor = { red: 255, green: 255, blue: 255 },
|
|
||||||
menuBackgroundColor = { red: 18, green: 66, blue: 66 };
|
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
|
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
|
||||||
|
@ -145,34 +137,6 @@ var toolBar = (function () {
|
||||||
visible: true
|
visible: true
|
||||||
});
|
});
|
||||||
|
|
||||||
menuItemOffset = toolBar.height / 3 + 2;
|
|
||||||
menuItemHeight = Tool.IMAGE_HEIGHT / 2 - 2;
|
|
||||||
|
|
||||||
loadURLMenuItem = Overlays.addOverlay("text", {
|
|
||||||
height: menuItemHeight,
|
|
||||||
backgroundColor: menuBackgroundColor,
|
|
||||||
topMargin: menuItemMargin,
|
|
||||||
text: "Model URL",
|
|
||||||
alpha: 0.9,
|
|
||||||
backgroundAlpha: 0.9,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
loadFileMenuItem = Overlays.addOverlay("text", {
|
|
||||||
height: menuItemHeight,
|
|
||||||
backgroundColor: menuBackgroundColor,
|
|
||||||
topMargin: menuItemMargin,
|
|
||||||
text: "Model File",
|
|
||||||
alpha: 0.9,
|
|
||||||
backgroundAlpha: 0.9,
|
|
||||||
visible: false
|
|
||||||
});
|
|
||||||
|
|
||||||
menuItemWidth = Math.max(Overlays.textSize(loadURLMenuItem, "Model URL").width,
|
|
||||||
Overlays.textSize(loadFileMenuItem, "Model File").width) + 20;
|
|
||||||
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
|
|
||||||
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
|
|
||||||
|
|
||||||
newCubeButton = toolBar.addTool({
|
newCubeButton = toolBar.addTool({
|
||||||
imageURL: toolIconUrl + "add-cube.svg",
|
imageURL: toolIconUrl + "add-cube.svg",
|
||||||
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
||||||
|
@ -211,17 +175,6 @@ var toolBar = (function () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNewModelButton(active) {
|
|
||||||
if (active === undefined) {
|
|
||||||
active = !toolBar.toolSelected(newModelButton);
|
|
||||||
}
|
|
||||||
toolBar.selectTool(newModelButton, active);
|
|
||||||
|
|
||||||
Overlays.editOverlay(loadURLMenuItem, { visible: active });
|
|
||||||
Overlays.editOverlay(loadFileMenuItem, { visible: active });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
that.setActive = function(active) {
|
that.setActive = function(active) {
|
||||||
if (active != isActive) {
|
if (active != isActive) {
|
||||||
isActive = active;
|
isActive = active;
|
||||||
|
@ -306,9 +259,6 @@ var toolBar = (function () {
|
||||||
toolsY = (windowDimensions.y - toolBar.height) / 2;
|
toolsY = (windowDimensions.y - toolBar.height) / 2;
|
||||||
|
|
||||||
toolBar.move(toolsX, toolsY);
|
toolBar.move(toolsX, toolsY);
|
||||||
|
|
||||||
Overlays.editOverlay(loadURLMenuItem, { x: toolsX - menuItemWidth, y: toolsY + menuItemOffset });
|
|
||||||
Overlays.editOverlay(loadFileMenuItem, { x: toolsX - menuItemWidth, y: toolsY + menuItemOffset + menuItemHeight });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
that.mousePressEvent = function (event) {
|
that.mousePressEvent = function (event) {
|
||||||
|
@ -324,12 +274,6 @@ var toolBar = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newModelButton === toolBar.clicked(clickedOverlay)) {
|
if (newModelButton === toolBar.clicked(clickedOverlay)) {
|
||||||
toggleNewModelButton();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clickedOverlay === loadURLMenuItem) {
|
|
||||||
toggleNewModelButton(false);
|
|
||||||
url = Window.prompt("Model URL", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
|
url = Window.prompt("Model URL", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
|
||||||
if (url !== null && url !== "") {
|
if (url !== null && url !== "") {
|
||||||
addModel(url);
|
addModel(url);
|
||||||
|
@ -337,22 +281,7 @@ var toolBar = (function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clickedOverlay === loadFileMenuItem) {
|
|
||||||
toggleNewModelButton(false);
|
|
||||||
|
|
||||||
file = Window.browse("Select your model file ...",
|
|
||||||
Settings.getValue("LastModelUploadLocation").path(),
|
|
||||||
"Model files (*.fst *.fbx)");
|
|
||||||
//"Model files (*.fst *.fbx *.svo)");
|
|
||||||
if (file !== null) {
|
|
||||||
Settings.setValue("LastModelUploadLocation", file);
|
|
||||||
modelUploader.upload(file, addModel);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
||||||
toggleNewModelButton(false);
|
|
||||||
url = Window.s3Browse(".*(fbx|FBX)");
|
url = Window.s3Browse(".*(fbx|FBX)");
|
||||||
if (url !== null && url !== "") {
|
if (url !== null && url !== "") {
|
||||||
addModel(url);
|
addModel(url);
|
||||||
|
@ -443,8 +372,6 @@ var toolBar = (function () {
|
||||||
|
|
||||||
that.cleanup = function () {
|
that.cleanup = function () {
|
||||||
toolBar.cleanup();
|
toolBar.cleanup();
|
||||||
Overlays.deleteOverlay(loadURLMenuItem);
|
|
||||||
Overlays.deleteOverlay(loadFileMenuItem);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
|
@ -37,7 +37,6 @@ using namespace std;
|
||||||
const int STATS_PELS_PER_LINE = 20;
|
const int STATS_PELS_PER_LINE = 20;
|
||||||
|
|
||||||
const int STATS_GENERAL_MIN_WIDTH = 165;
|
const int STATS_GENERAL_MIN_WIDTH = 165;
|
||||||
const int STATS_BANDWIDTH_MIN_WIDTH = 250;
|
|
||||||
const int STATS_PING_MIN_WIDTH = 190;
|
const int STATS_PING_MIN_WIDTH = 190;
|
||||||
const int STATS_GEO_MIN_WIDTH = 240;
|
const int STATS_GEO_MIN_WIDTH = 240;
|
||||||
const int STATS_OCTREE_MIN_WIDTH = 410;
|
const int STATS_OCTREE_MIN_WIDTH = 410;
|
||||||
|
@ -52,7 +51,6 @@ Stats::Stats():
|
||||||
_recentMaxPackets(0),
|
_recentMaxPackets(0),
|
||||||
_resetRecentMaxPacketsSoon(true),
|
_resetRecentMaxPacketsSoon(true),
|
||||||
_generalStatsWidth(STATS_GENERAL_MIN_WIDTH),
|
_generalStatsWidth(STATS_GENERAL_MIN_WIDTH),
|
||||||
_bandwidthStatsWidth(STATS_BANDWIDTH_MIN_WIDTH),
|
|
||||||
_pingStatsWidth(STATS_PING_MIN_WIDTH),
|
_pingStatsWidth(STATS_PING_MIN_WIDTH),
|
||||||
_geoStatsWidth(STATS_GEO_MIN_WIDTH),
|
_geoStatsWidth(STATS_GEO_MIN_WIDTH),
|
||||||
_octreeStatsWidth(STATS_OCTREE_MIN_WIDTH),
|
_octreeStatsWidth(STATS_OCTREE_MIN_WIDTH),
|
||||||
|
@ -133,7 +131,6 @@ void Stats::resetWidth(int width, int horizontalOffset) {
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
int extraSpace = glCanvas->width() - horizontalOffset -2
|
int extraSpace = glCanvas->width() - horizontalOffset -2
|
||||||
- STATS_GENERAL_MIN_WIDTH
|
- STATS_GENERAL_MIN_WIDTH
|
||||||
- STATS_BANDWIDTH_MIN_WIDTH
|
|
||||||
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
|
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
|
||||||
- STATS_GEO_MIN_WIDTH
|
- STATS_GEO_MIN_WIDTH
|
||||||
- STATS_OCTREE_MIN_WIDTH;
|
- STATS_OCTREE_MIN_WIDTH;
|
||||||
|
@ -141,7 +138,6 @@ void Stats::resetWidth(int width, int horizontalOffset) {
|
||||||
int panels = 4;
|
int panels = 4;
|
||||||
|
|
||||||
_generalStatsWidth = STATS_GENERAL_MIN_WIDTH;
|
_generalStatsWidth = STATS_GENERAL_MIN_WIDTH;
|
||||||
_bandwidthStatsWidth = STATS_BANDWIDTH_MIN_WIDTH;
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||||
_pingStatsWidth = STATS_PING_MIN_WIDTH;
|
_pingStatsWidth = STATS_PING_MIN_WIDTH;
|
||||||
} else {
|
} else {
|
||||||
|
@ -153,13 +149,12 @@ void Stats::resetWidth(int width, int horizontalOffset) {
|
||||||
|
|
||||||
if (extraSpace > panels) {
|
if (extraSpace > panels) {
|
||||||
_generalStatsWidth += (int) extraSpace / panels;
|
_generalStatsWidth += (int) extraSpace / panels;
|
||||||
_bandwidthStatsWidth += (int) extraSpace / panels;
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||||
_pingStatsWidth += (int) extraSpace / panels;
|
_pingStatsWidth += (int) extraSpace / panels;
|
||||||
}
|
}
|
||||||
_geoStatsWidth += (int) extraSpace / panels;
|
_geoStatsWidth += (int) extraSpace / panels;
|
||||||
_octreeStatsWidth += glCanvas->width() -
|
_octreeStatsWidth += glCanvas->width() -
|
||||||
(_generalStatsWidth + _bandwidthStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
|
(_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,14 +226,14 @@ void Stats::display(
|
||||||
int totalAvatars = DependencyManager::get<AvatarManager>()->size() - 1;
|
int totalAvatars = DependencyManager::get<AvatarManager>()->size() - 1;
|
||||||
int totalServers = DependencyManager::get<NodeList>()->size();
|
int totalServers = DependencyManager::get<NodeList>()->size();
|
||||||
|
|
||||||
lines = _expanded ? 5 : 3;
|
lines = 5;
|
||||||
int columnOneWidth = _generalStatsWidth;
|
int columnOneWidth = _generalStatsWidth;
|
||||||
|
|
||||||
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
|
PerformanceTimer::tallyAllTimerRecords(); // do this even if we're not displaying them, so they don't stack up
|
||||||
|
|
||||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayTimingDetails)) {
|
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayTimingDetails)) {
|
||||||
|
|
||||||
columnOneWidth = _generalStatsWidth + _bandwidthStatsWidth + _pingStatsWidth + _geoStatsWidth; // 4 columns wide...
|
columnOneWidth = _generalStatsWidth + _pingStatsWidth + _geoStatsWidth; // 3 columns wide...
|
||||||
// we will also include room for 1 line per timing record and a header of 4 lines
|
// we will also include room for 1 line per timing record and a header of 4 lines
|
||||||
lines += 4;
|
lines += 4;
|
||||||
|
|
||||||
|
@ -267,6 +262,17 @@ void Stats::display(
|
||||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, avatarNodes.toUtf8().constData(), color);
|
drawText(horizontalOffset, verticalOffset, scale, rotation, font, avatarNodes.toUtf8().constData(), color);
|
||||||
verticalOffset += STATS_PELS_PER_LINE;
|
verticalOffset += STATS_PELS_PER_LINE;
|
||||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, framesPerSecond.toUtf8().constData(), color);
|
drawText(horizontalOffset, verticalOffset, scale, rotation, font, framesPerSecond.toUtf8().constData(), color);
|
||||||
|
|
||||||
|
QString packetsPerSecondString = QString("Packets In/Out: %1/%2").arg(inPacketsPerSecond).arg(outPacketsPerSecond);
|
||||||
|
QString averageMegabitsPerSecond = QString("Mbps In/Out: %1/%2").
|
||||||
|
arg((float)inKbitsPerSecond * 1.0f / 1000.0f).
|
||||||
|
arg((float)outKbitsPerSecond * 1.0f / 1000.0f);
|
||||||
|
|
||||||
|
verticalOffset += STATS_PELS_PER_LINE;
|
||||||
|
drawText(horizontalOffset, verticalOffset, scale, rotation, font, packetsPerSecondString.toUtf8().constData(), color);
|
||||||
|
verticalOffset += STATS_PELS_PER_LINE;
|
||||||
|
drawText(horizontalOffset, verticalOffset, scale, rotation, font, averageMegabitsPerSecond.toUtf8().constData(), color);
|
||||||
|
|
||||||
|
|
||||||
// TODO: the display of these timing details should all be moved to JavaScript
|
// TODO: the display of these timing details should all be moved to JavaScript
|
||||||
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayTimingDetails)) {
|
if (_expanded && Menu::getInstance()->isOptionChecked(MenuOption::DisplayTimingDetails)) {
|
||||||
|
@ -309,30 +315,9 @@ void Stats::display(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
verticalOffset = 0;
|
verticalOffset = 0;
|
||||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + 1;
|
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + 1;
|
||||||
|
|
||||||
if (columnOneWidth == _generalStatsWidth) {
|
|
||||||
drawBackground(backgroundColor, horizontalOffset, 0, _bandwidthStatsWidth, lines * STATS_PELS_PER_LINE + 10);
|
|
||||||
}
|
|
||||||
horizontalOffset += 5;
|
|
||||||
|
|
||||||
QString packetsPerSecondString = QString("Packets In/Out: %1/%2").arg(inPacketsPerSecond).arg(outPacketsPerSecond);
|
|
||||||
QString averageMegabitsPerSecond = QString("Mbps In/Out: %1/%2").
|
|
||||||
arg((float)inKbitsPerSecond * 1.0f / 1000.0f).
|
|
||||||
arg((float)outKbitsPerSecond * 1.0f / 1000.0f);
|
|
||||||
|
|
||||||
verticalOffset += STATS_PELS_PER_LINE;
|
|
||||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, packetsPerSecondString.toUtf8().constData(), color);
|
|
||||||
verticalOffset += STATS_PELS_PER_LINE;
|
|
||||||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, averageMegabitsPerSecond.toUtf8().constData(), color);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
verticalOffset = 0;
|
|
||||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _bandwidthStatsWidth +1;
|
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||||
int pingAudio = -1, pingAvatar = -1, pingVoxel = -1, pingOctreeMax = -1;
|
int pingAudio = -1, pingAvatar = -1, pingVoxel = -1, pingOctreeMax = -1;
|
||||||
|
|
||||||
|
@ -412,7 +397,7 @@ void Stats::display(
|
||||||
}
|
}
|
||||||
|
|
||||||
verticalOffset = 0;
|
verticalOffset = 0;
|
||||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _bandwidthStatsWidth + _pingStatsWidth + 2;
|
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _pingStatsWidth + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
@ -492,7 +477,7 @@ void Stats::display(
|
||||||
}
|
}
|
||||||
|
|
||||||
verticalOffset = 0;
|
verticalOffset = 0;
|
||||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _bandwidthStatsWidth + _pingStatsWidth + _geoStatsWidth + 3;
|
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3;
|
||||||
|
|
||||||
lines = _expanded ? 14 : 3;
|
lines = _expanded ? 14 : 3;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <gpu/GPUConfig.h>
|
#include <gpu/GPUConfig.h>
|
||||||
|
|
||||||
|
#include <DeferredLightingEffect.h>
|
||||||
#include <GeometryCache.h>
|
#include <GeometryCache.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <TextRenderer.h>
|
#include <TextRenderer.h>
|
||||||
|
@ -49,7 +50,12 @@ void RenderableTextEntityItem::render(RenderArgs* args) {
|
||||||
|
|
||||||
glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND);
|
glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND);
|
||||||
glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND);
|
glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND);
|
||||||
|
|
||||||
|
// TODO: Determine if we want these entities to have the deferred lighting effect? I think we do, so that the color
|
||||||
|
// used for a sphere, or box have the same look as those used on a text entity.
|
||||||
|
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram();
|
||||||
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, glm::vec4(toGlm(getBackgroundColorX()), alpha));
|
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, glm::vec4(toGlm(getBackgroundColorX()), alpha));
|
||||||
|
DependencyManager::get<DeferredLightingEffect>()->releaseSimpleProgram();
|
||||||
|
|
||||||
TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE / 2.0f);
|
TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE / 2.0f);
|
||||||
|
|
||||||
|
|
|
@ -481,9 +481,12 @@ glm::vec2 Font::drawString(float x, float y, const QString & str,
|
||||||
}
|
}
|
||||||
|
|
||||||
_vao->release();
|
_vao->release();
|
||||||
|
_texture->release(); // TODO: Brad & Sam, let's discuss this. Without this non-textured quads get their colors borked.
|
||||||
_program->release();
|
_program->release();
|
||||||
// FIXME, needed?
|
// FIXME, needed?
|
||||||
// glDisable(GL_TEXTURE_2D);
|
// glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
|
||||||
return advance;
|
return advance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue