From d61e4c5c115169ced7266def3383d76a0f74ebe3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 13 Sep 2016 10:52:19 +1200 Subject: [PATCH] Display textures size in MB --- scripts/system/html/entityList.html | 2 +- scripts/system/html/js/entityList.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/entityList.html b/scripts/system/html/entityList.html index 13b00fa505..58dca4567f 100644 --- a/scripts/system/html/entityList.html +++ b/scripts/system/html/entityList.html @@ -59,7 +59,7 @@ Verts Texts - T Size + Text MB Draws k diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 1b5d82fd96..750352e6c4 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -132,6 +132,16 @@ function loaded() { })); } + const BYTES_PER_MEGABYTE = 1024 * 1024; + + function decimalMegabytes(number) { + if (number) { + return (number / BYTES_PER_MEGABYTE).toFixed(1); + } else { + return ""; + } + } + function addEntity(id, name, type, url, locked, visible, verticesCount, texturesCount, texturesSize, hasTransparent, drawCalls, hasScript) { @@ -141,7 +151,7 @@ function loaded() { if (entities[id] === undefined) { entityList.add([{ id: id, name: name, type: type, url: filename, locked: locked, visible: visible, verticesCount: verticesCount, - texturesCount: texturesCount, texturesSize: texturesSize, hasTransparent: hasTransparent, + texturesCount: texturesCount, texturesSize: decimalMegabytes(texturesSize), hasTransparent: hasTransparent, drawCalls: drawCalls, hasScript: hasScript }], function (items) {