浏览代码

Add url hash option to example, better errors

Garrett Johnson 5 年之前
父节点
当前提交
a91e6fa4b8
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 1 1
      example/bundle/index.js
  2. 3 1
      example/index.js

+ 1 - 1
example/bundle/index.js

@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "63925" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "61203" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

+ 3 - 1
example/index.js

@@ -27,13 +27,15 @@ animate();
 
 function reinstantiateTiles() {
 
+	const url = window.location.hash.replace( /^#/, '' ) || './SampleTileset/tileset.json';
+
 	if ( tiles ) {
 
 		scene.remove( tiles.group );
 
 	}
 
-	tiles = new ThreeTilesRenderer( './SampleTileset/tileset.json', camera, renderer );
+	tiles = new ThreeTilesRenderer( url, camera, renderer );
 	scene.add( tiles.group );
 	tiles.group.rotation.x = Math.PI / 2;