Skip to content

Commit b47619a

Browse files
slimbuckDonovan Hutchence
andauthored
Small fixes to viewer and engine example (playcanvas#1956)
* small viewer fix and get text-canvas-font working with the visual tester Co-authored-by: Donovan Hutchence <dhutchence@snapchat.com>
1 parent 7cbecc7 commit b47619a

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

examples/user-interface/text-canvas-font.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
});
5858
app.assets.add(fontAsset);
5959
app.assets.load(fontAsset);
60-
app.assets.on('load:' + fontAsset.id, function () {
61-
app.start();
62-
});
6360

6461
// create camera
6562
var c = new pc.Entity();
@@ -168,6 +165,8 @@
168165
var showCanvasAtlasForDebug = false;
169166
renderAtlases();
170167

168+
// start the application
169+
app.start();
171170
</script>
172171
</body>
173172
</html>

tools/glb-viewer/src/controls.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ document.getElementById('graphs').onclick = function (e) {
2121

2222
var animList = document.getElementById('anim-list');
2323

24+
/* eslint-disable no-unused-vars */
25+
2426
// called when animations are loaded
2527
var onAnimationsLoaded = function (animationList) {
2628
// clear previous list
@@ -40,3 +42,5 @@ var onAnimationsLoaded = function (animationList) {
4042
animList.appendChild(li);
4143
}
4244
};
45+
46+
/* eslint-enable no-unused-vars */

tools/glb-viewer/src/viewer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var Viewer = function (canvas) {
3939
app.scene.toneMapping = pc.TONEMAP_ACES;
4040
app.scene.skyboxMip = 1; // Set the skybox to the 128x128 cubemap mipmap level
4141
app.scene.setSkybox(cubemapAsset.resources);
42+
app.renderNextFrame = true; // ensure we render again when the cubemap arrives
4243
});
4344
app.assets.add(cubemapAsset);
4445
app.assets.load(cubemapAsset);
@@ -125,7 +126,7 @@ var Viewer = function (canvas) {
125126

126127
function getUrlVars() {
127128
var vars = {};
128-
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
129+
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
129130
vars[key] = value;
130131
});
131132
return vars;
@@ -308,8 +309,10 @@ Object.assign(Viewer.prototype, {
308309
}
309310
});
310311

311-
var viewer;
312+
/* eslint-disable no-unused-vars */
312313

313314
var main = function () {
314-
viewer = new Viewer(document.getElementById("application-canvas"));
315+
var viewer = new Viewer(document.getElementById("application-canvas"));
315316
};
317+
318+
/* eslint-enable no-unused-vars */

0 commit comments

Comments
 (0)