minerender 2.1.0-alpha.0 → 2.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/browser/index.d.mts +106 -84
- package/dist/browser/index.d.ts +106 -84
- package/dist/browser/index.js +1094 -968
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1107 -981
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +1045 -921
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +106 -84
- package/dist/node/index.d.ts +106 -84
- package/dist/node/index.js +1100 -970
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1112 -982
- package/dist/node/index.mjs.map +1 -1
- package/package.json +5 -5
- package/.worktrees/jobqu-review/LICENSE +0 -21
- package/.worktrees/jobqu-review/README.md +0 -176
- package/.worktrees/v2-asset-sources/LICENSE +0 -21
- package/.worktrees/v2-asset-sources/README.md +0 -30
- package/.worktrees/v2-asset-sources/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-asset-sources/examples/vite/README.md +0 -13
- package/.worktrees/v2-asset-sources/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-asset-sources/packages/minerender/README.md +0 -24
- package/.worktrees/v2-brightness/LICENSE +0 -21
- package/.worktrees/v2-brightness/README.md +0 -30
- package/.worktrees/v2-brightness/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-brightness/examples/vite/README.md +0 -13
- package/.worktrees/v2-brightness/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-brightness/packages/minerender/README.md +0 -24
- package/.worktrees/v2-cache-recovery/LICENSE +0 -21
- package/.worktrees/v2-cache-recovery/README.md +0 -30
- package/.worktrees/v2-cache-recovery/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-cache-recovery/examples/vite/README.md +0 -13
- package/.worktrees/v2-cache-recovery/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-cache-recovery/packages/minerender/README.md +0 -24
- package/.worktrees/v2-ci-stack/LICENSE +0 -21
- package/.worktrees/v2-ci-stack/README.md +0 -109
- package/.worktrees/v2-ci-stack/examples/script-tag/README.md +0 -15
- package/.worktrees/v2-ci-stack/examples/vite/README.md +0 -15
- package/.worktrees/v2-ci-stack/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-ci-stack/packages/minerender/README.md +0 -11
- package/.worktrees/v2-ci-typescript/LICENSE +0 -21
- package/.worktrees/v2-ci-typescript/README.md +0 -11
- package/.worktrees/v2-controls/LICENSE +0 -21
- package/.worktrees/v2-controls/README.md +0 -30
- package/.worktrees/v2-controls/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-controls/examples/vite/README.md +0 -13
- package/.worktrees/v2-controls/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-controls/packages/minerender/README.md +0 -24
- package/.worktrees/v2-dependencies/LICENSE +0 -21
- package/.worktrees/v2-dependencies/README.md +0 -30
- package/.worktrees/v2-dependencies/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-dependencies/examples/vite/README.md +0 -13
- package/.worktrees/v2-dependencies/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-dependencies/packages/minerender/README.md +0 -24
- package/.worktrees/v2-frame-limit/LICENSE +0 -21
- package/.worktrees/v2-frame-limit/README.md +0 -30
- package/.worktrees/v2-frame-limit/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-frame-limit/examples/vite/README.md +0 -13
- package/.worktrees/v2-frame-limit/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-frame-limit/packages/minerender/README.md +0 -24
- package/.worktrees/v2-images/LICENSE +0 -21
- package/.worktrees/v2-images/README.md +0 -30
- package/.worktrees/v2-images/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-images/examples/vite/README.md +0 -13
- package/.worktrees/v2-images/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-images/packages/minerender/README.md +0 -24
- package/.worktrees/v2-lifecycle/LICENSE +0 -21
- package/.worktrees/v2-lifecycle/README.md +0 -30
- package/.worktrees/v2-lifecycle/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-lifecycle/examples/vite/README.md +0 -13
- package/.worktrees/v2-lifecycle/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-lifecycle/packages/minerender/README.md +0 -24
- package/.worktrees/v2-main-conflicts/LICENSE +0 -21
- package/.worktrees/v2-main-conflicts/README.md +0 -11
- package/.worktrees/v2-monorepo/LICENSE +0 -21
- package/.worktrees/v2-monorepo/README.md +0 -30
- package/.worktrees/v2-monorepo/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-monorepo/examples/vite/README.md +0 -13
- package/.worktrees/v2-monorepo/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-monorepo/packages/minerender/README.md +0 -24
- package/.worktrees/v2-requests/LICENSE +0 -21
- package/.worktrees/v2-requests/README.md +0 -30
- package/.worktrees/v2-requests/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-requests/examples/vite/README.md +0 -13
- package/.worktrees/v2-requests/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-requests/packages/minerender/README.md +0 -26
- package/.worktrees/v2-source-errors/LICENSE +0 -21
- package/.worktrees/v2-source-errors/README.md +0 -30
- package/.worktrees/v2-source-errors/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-source-errors/examples/vite/README.md +0 -13
- package/.worktrees/v2-source-errors/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-source-errors/packages/minerender/README.md +0 -26
package/dist/browser/index.mjs
CHANGED
|
@@ -32,9 +32,9 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
// node_modules/ts-deepmerge/dist/index.js
|
|
35
|
+
// ../../node_modules/ts-deepmerge/dist/index.js
|
|
36
36
|
var require_dist = __commonJS({
|
|
37
|
-
"node_modules/ts-deepmerge/dist/index.js"(exports) {
|
|
37
|
+
"../../node_modules/ts-deepmerge/dist/index.js"(exports) {
|
|
38
38
|
"use strict";
|
|
39
39
|
var __assign = exports && exports.__assign || function() {
|
|
40
40
|
__assign = Object.assign || function(t) {
|
|
@@ -1351,7 +1351,7 @@ var DefaultBlockStates = class {
|
|
|
1351
1351
|
};
|
|
1352
1352
|
|
|
1353
1353
|
// src/assets/Assets.ts
|
|
1354
|
-
var DEFAULT_ROOT = "https://
|
|
1354
|
+
var DEFAULT_ROOT = "https://assets.mcasset.cloud/1.17.1";
|
|
1355
1355
|
var DEFAULT_NAMESPACE = "minecraft";
|
|
1356
1356
|
var Assets = class {
|
|
1357
1357
|
/**
|
|
@@ -1704,8 +1704,8 @@ var _AssetLoader = class _AssetLoader {
|
|
|
1704
1704
|
};
|
|
1705
1705
|
_AssetLoader.ROOT = DEFAULT_ROOT;
|
|
1706
1706
|
_AssetLoader._SOURCES = [];
|
|
1707
|
-
_AssetLoader.addSource("mcassets-fallback", new HostedAssetSource("https://raw.githubusercontent.com/InventivetalentDev/minerender-fallback-assets/master"));
|
|
1708
|
-
_AssetLoader.addSource("mcassets", new HostedAssetSource(DEFAULT_ROOT));
|
|
1707
|
+
_AssetLoader.addSource("mcassets-fallback", new HostedAssetSource("https://raw.githubusercontent.com/InventivetalentDev/minerender-fallback-assets/master", { retryDefaults: false }));
|
|
1708
|
+
_AssetLoader.addSource("mcassets", new HostedAssetSource(DEFAULT_ROOT, { retryDefaults: false }));
|
|
1709
1709
|
var AssetLoader = _AssetLoader;
|
|
1710
1710
|
|
|
1711
1711
|
// src/assets/ModelTextures.ts
|
|
@@ -5286,24 +5286,54 @@ var _MineRenderScene = class _MineRenderScene extends Scene2 {
|
|
|
5286
5286
|
this.stats = new SceneStats();
|
|
5287
5287
|
this.instanceManager = new InstanceManager();
|
|
5288
5288
|
this.dirty = true;
|
|
5289
|
+
this.observedObjects = /* @__PURE__ */ new Set();
|
|
5290
|
+
this.onObjectChange = (event) => {
|
|
5291
|
+
if (event.target?.parent === this) {
|
|
5292
|
+
this.dirty = true;
|
|
5293
|
+
}
|
|
5294
|
+
};
|
|
5289
5295
|
this.options = (0, import_ts_deepmerge9.default)({}, _MineRenderScene.DEFAULT_OPTIONS, options ?? {});
|
|
5290
5296
|
}
|
|
5291
|
-
add(...
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
+
add(...objects) {
|
|
5298
|
+
for (const object of objects) {
|
|
5299
|
+
this.dirty = true;
|
|
5300
|
+
try {
|
|
5301
|
+
super.add(object);
|
|
5302
|
+
} finally {
|
|
5303
|
+
if (object?.isObject3D && object !== this) {
|
|
5304
|
+
this.updateObjectRegistration(object, object.parent === this);
|
|
5305
|
+
}
|
|
5297
5306
|
}
|
|
5298
|
-
obj.addEventListener("change", (event) => {
|
|
5299
|
-
this.dirty = true;
|
|
5300
|
-
});
|
|
5301
5307
|
}
|
|
5302
|
-
return
|
|
5308
|
+
return this;
|
|
5303
5309
|
}
|
|
5304
|
-
remove(...
|
|
5305
|
-
|
|
5306
|
-
|
|
5310
|
+
remove(...objects) {
|
|
5311
|
+
for (const object of objects) {
|
|
5312
|
+
if (!this.children.includes(object)) continue;
|
|
5313
|
+
this.dirty = true;
|
|
5314
|
+
this.updateObjectRegistration(object, false);
|
|
5315
|
+
try {
|
|
5316
|
+
super.remove(object);
|
|
5317
|
+
} finally {
|
|
5318
|
+
this.updateObjectRegistration(object, object.parent === this);
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
return this;
|
|
5322
|
+
}
|
|
5323
|
+
updateObjectRegistration(object, attached) {
|
|
5324
|
+
if (this.observedObjects.has(object) === attached) return;
|
|
5325
|
+
if (attached) {
|
|
5326
|
+
this.observedObjects.add(object);
|
|
5327
|
+
object.addEventListener("change", this.onObjectChange);
|
|
5328
|
+
} else {
|
|
5329
|
+
this.observedObjects.delete(object);
|
|
5330
|
+
object.removeEventListener("change", this.onObjectChange);
|
|
5331
|
+
}
|
|
5332
|
+
const change = attached ? 1 : -1;
|
|
5333
|
+
this.stats.objectCount += change;
|
|
5334
|
+
if (isSceneObject(object)) {
|
|
5335
|
+
this.stats.sceneObjectCount += change;
|
|
5336
|
+
}
|
|
5307
5337
|
}
|
|
5308
5338
|
async initAndAdd(...object) {
|
|
5309
5339
|
this.dirty = true;
|
|
@@ -5365,1047 +5395,1143 @@ function isMineRenderScene(obj) {
|
|
|
5365
5395
|
}
|
|
5366
5396
|
|
|
5367
5397
|
// src/renderer/Renderer.ts
|
|
5368
|
-
import { AxesHelper as AxesHelper3, GridHelper, LinearEncoding, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, Vector3 as
|
|
5398
|
+
import { AxesHelper as AxesHelper3, GridHelper, LinearEncoding, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, Vector3 as Vector38, WebGLRenderer } from "three";
|
|
5369
5399
|
var import_ts_deepmerge10 = __toESM(require_dist());
|
|
5370
5400
|
import Stats from "stats.js";
|
|
5371
5401
|
import { EffectComposer, RenderPass } from "postprocessing";
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5402
|
+
|
|
5403
|
+
// src/three/OrbitControls.js
|
|
5404
|
+
import {
|
|
5405
|
+
EventDispatcher,
|
|
5406
|
+
MOUSE,
|
|
5407
|
+
Quaternion as Quaternion3,
|
|
5408
|
+
Spherical,
|
|
5409
|
+
TOUCH,
|
|
5410
|
+
Vector2 as Vector23,
|
|
5411
|
+
Vector3 as Vector37
|
|
5412
|
+
} from "three";
|
|
5413
|
+
var _changeEvent = { type: "change" };
|
|
5414
|
+
var _startEvent = { type: "start" };
|
|
5415
|
+
var _endEvent = { type: "end" };
|
|
5416
|
+
var OrbitControls = class extends EventDispatcher {
|
|
5417
|
+
constructor(object, domElement) {
|
|
5418
|
+
super();
|
|
5419
|
+
if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
|
|
5420
|
+
if (domElement === document) console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
|
|
5421
|
+
this.object = object;
|
|
5422
|
+
this.domElement = domElement;
|
|
5423
|
+
this.domElement.style.touchAction = "none";
|
|
5424
|
+
this.enabled = true;
|
|
5425
|
+
this.target = new Vector37();
|
|
5426
|
+
this.minDistance = 0;
|
|
5427
|
+
this.maxDistance = Infinity;
|
|
5428
|
+
this.minZoom = 0;
|
|
5429
|
+
this.maxZoom = Infinity;
|
|
5430
|
+
this.minPolarAngle = 0;
|
|
5431
|
+
this.maxPolarAngle = Math.PI;
|
|
5432
|
+
this.minAzimuthAngle = -Infinity;
|
|
5433
|
+
this.maxAzimuthAngle = Infinity;
|
|
5434
|
+
this.enableDamping = false;
|
|
5435
|
+
this.dampingFactor = 0.05;
|
|
5436
|
+
this.enableZoom = true;
|
|
5437
|
+
this.zoomSpeed = 1;
|
|
5438
|
+
this.enableRotate = true;
|
|
5439
|
+
this.rotateSpeed = 1;
|
|
5440
|
+
this.enablePan = true;
|
|
5441
|
+
this.panSpeed = 1;
|
|
5442
|
+
this.screenSpacePanning = true;
|
|
5443
|
+
this.keyPanSpeed = 7;
|
|
5444
|
+
this.autoRotate = false;
|
|
5445
|
+
this.autoRotateSpeed = 2;
|
|
5446
|
+
this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" };
|
|
5447
|
+
this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };
|
|
5448
|
+
this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };
|
|
5449
|
+
this.target0 = this.target.clone();
|
|
5450
|
+
this.position0 = this.object.position.clone();
|
|
5451
|
+
this.zoom0 = this.object.zoom;
|
|
5452
|
+
this._domElementKeyEvents = null;
|
|
5453
|
+
this.getPolarAngle = function() {
|
|
5454
|
+
return spherical.phi;
|
|
5455
|
+
};
|
|
5456
|
+
this.getAzimuthalAngle = function() {
|
|
5457
|
+
return spherical.theta;
|
|
5458
|
+
};
|
|
5459
|
+
this.getDistance = function() {
|
|
5460
|
+
return this.object.position.distanceTo(this.target);
|
|
5461
|
+
};
|
|
5462
|
+
this.saveState = function() {
|
|
5463
|
+
scope.target0.copy(scope.target);
|
|
5464
|
+
scope.position0.copy(scope.object.position);
|
|
5465
|
+
scope.zoom0 = scope.object.zoom;
|
|
5466
|
+
};
|
|
5467
|
+
this.reset = function() {
|
|
5468
|
+
scope.target.copy(scope.target0);
|
|
5469
|
+
scope.object.position.copy(scope.position0);
|
|
5470
|
+
scope.object.zoom = scope.zoom0;
|
|
5471
|
+
scope.object.updateProjectionMatrix();
|
|
5472
|
+
scope.dispatchEvent(_changeEvent);
|
|
5473
|
+
scope.update();
|
|
5474
|
+
state = STATE.NONE;
|
|
5475
|
+
};
|
|
5476
|
+
this.update = function() {
|
|
5477
|
+
const offset = new Vector37();
|
|
5478
|
+
const quat = new Quaternion3().setFromUnitVectors(object.up, new Vector37(0, 1, 0));
|
|
5479
|
+
const quatInverse = quat.clone().invert();
|
|
5480
|
+
const lastPosition = new Vector37();
|
|
5481
|
+
const lastQuaternion = new Quaternion3();
|
|
5482
|
+
const twoPI = 2 * Math.PI;
|
|
5483
|
+
return function update() {
|
|
5484
|
+
const position = scope.object.position;
|
|
5485
|
+
offset.copy(position).sub(scope.target);
|
|
5486
|
+
offset.applyQuaternion(quat);
|
|
5487
|
+
spherical.setFromVector3(offset);
|
|
5488
|
+
if (scope.autoRotate && state === STATE.NONE) {
|
|
5489
|
+
rotateLeft(getAutoRotationAngle());
|
|
5490
|
+
}
|
|
5491
|
+
if (scope.enableDamping) {
|
|
5492
|
+
spherical.theta += sphericalDelta.theta * scope.dampingFactor;
|
|
5493
|
+
spherical.phi += sphericalDelta.phi * scope.dampingFactor;
|
|
5494
|
+
} else {
|
|
5495
|
+
spherical.theta += sphericalDelta.theta;
|
|
5496
|
+
spherical.phi += sphericalDelta.phi;
|
|
5497
|
+
}
|
|
5498
|
+
let min = scope.minAzimuthAngle;
|
|
5499
|
+
let max = scope.maxAzimuthAngle;
|
|
5500
|
+
if (isFinite(min) && isFinite(max)) {
|
|
5501
|
+
if (min < -Math.PI) min += twoPI;
|
|
5502
|
+
else if (min > Math.PI) min -= twoPI;
|
|
5503
|
+
if (max < -Math.PI) max += twoPI;
|
|
5504
|
+
else if (max > Math.PI) max -= twoPI;
|
|
5505
|
+
if (min <= max) {
|
|
5506
|
+
spherical.theta = Math.max(min, Math.min(max, spherical.theta));
|
|
5507
|
+
} else {
|
|
5508
|
+
spherical.theta = spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);
|
|
5509
|
+
}
|
|
5510
|
+
}
|
|
5511
|
+
spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));
|
|
5512
|
+
spherical.makeSafe();
|
|
5513
|
+
spherical.radius *= scale;
|
|
5514
|
+
spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));
|
|
5515
|
+
if (scope.enableDamping === true) {
|
|
5516
|
+
scope.target.addScaledVector(panOffset, scope.dampingFactor);
|
|
5517
|
+
} else {
|
|
5518
|
+
scope.target.add(panOffset);
|
|
5519
|
+
}
|
|
5520
|
+
offset.setFromSpherical(spherical);
|
|
5521
|
+
offset.applyQuaternion(quatInverse);
|
|
5522
|
+
position.copy(scope.target).add(offset);
|
|
5523
|
+
scope.object.lookAt(scope.target);
|
|
5524
|
+
if (scope.enableDamping === true) {
|
|
5525
|
+
sphericalDelta.theta *= 1 - scope.dampingFactor;
|
|
5526
|
+
sphericalDelta.phi *= 1 - scope.dampingFactor;
|
|
5527
|
+
panOffset.multiplyScalar(1 - scope.dampingFactor);
|
|
5528
|
+
} else {
|
|
5529
|
+
sphericalDelta.set(0, 0, 0);
|
|
5530
|
+
panOffset.set(0, 0, 0);
|
|
5531
|
+
}
|
|
5532
|
+
scale = 1;
|
|
5533
|
+
if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {
|
|
5534
|
+
scope.dispatchEvent(_changeEvent);
|
|
5535
|
+
lastPosition.copy(scope.object.position);
|
|
5536
|
+
lastQuaternion.copy(scope.object.quaternion);
|
|
5537
|
+
zoomChanged = false;
|
|
5538
|
+
return true;
|
|
5539
|
+
}
|
|
5540
|
+
return false;
|
|
5541
|
+
};
|
|
5542
|
+
}();
|
|
5543
|
+
this.dispose = function() {
|
|
5544
|
+
scope.domElement.removeEventListener("contextmenu", onContextMenu);
|
|
5545
|
+
scope.domElement.removeEventListener("pointerdown", onPointerDown);
|
|
5546
|
+
scope.domElement.removeEventListener("pointercancel", onPointerCancel);
|
|
5547
|
+
scope.domElement.removeEventListener("wheel", onMouseWheel);
|
|
5548
|
+
scope.domElement.removeEventListener("pointermove", onPointerMove);
|
|
5549
|
+
scope.domElement.removeEventListener("pointerup", onPointerUp);
|
|
5550
|
+
if (scope._domElementKeyEvents !== null) {
|
|
5551
|
+
scope._domElementKeyEvents.removeEventListener("keydown", onKeyDown);
|
|
5552
|
+
}
|
|
5553
|
+
};
|
|
5554
|
+
const scope = this;
|
|
5555
|
+
const STATE = {
|
|
5556
|
+
NONE: -1,
|
|
5557
|
+
ROTATE: 0,
|
|
5558
|
+
DOLLY: 1,
|
|
5559
|
+
PAN: 2,
|
|
5560
|
+
TOUCH_ROTATE: 3,
|
|
5561
|
+
TOUCH_PAN: 4,
|
|
5562
|
+
TOUCH_DOLLY_PAN: 5,
|
|
5563
|
+
TOUCH_DOLLY_ROTATE: 6
|
|
5564
|
+
};
|
|
5565
|
+
let state = STATE.NONE;
|
|
5566
|
+
const EPS = 1e-6;
|
|
5567
|
+
const spherical = new Spherical();
|
|
5568
|
+
const sphericalDelta = new Spherical();
|
|
5569
|
+
let scale = 1;
|
|
5570
|
+
const panOffset = new Vector37();
|
|
5571
|
+
let zoomChanged = false;
|
|
5572
|
+
const rotateStart = new Vector23();
|
|
5573
|
+
const rotateEnd = new Vector23();
|
|
5574
|
+
const rotateDelta = new Vector23();
|
|
5575
|
+
const panStart = new Vector23();
|
|
5576
|
+
const panEnd = new Vector23();
|
|
5577
|
+
const panDelta = new Vector23();
|
|
5578
|
+
const dollyStart = new Vector23();
|
|
5579
|
+
const dollyEnd = new Vector23();
|
|
5580
|
+
const dollyDelta = new Vector23();
|
|
5581
|
+
const pointers = [];
|
|
5582
|
+
const pointerPositions = {};
|
|
5583
|
+
function getAutoRotationAngle() {
|
|
5584
|
+
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
|
|
5388
5585
|
}
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
//<editor-fold desc="INIT">
|
|
5392
|
-
createScene() {
|
|
5393
|
-
return new MineRenderScene();
|
|
5394
|
-
}
|
|
5395
|
-
createCamera() {
|
|
5396
|
-
switch (this.options.camera.type) {
|
|
5397
|
-
case "perspective":
|
|
5398
|
-
default:
|
|
5399
|
-
return new PerspectiveCamera(
|
|
5400
|
-
this.options.camera.perspective.fov,
|
|
5401
|
-
this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
|
|
5402
|
-
this.options.camera.near,
|
|
5403
|
-
this.options.camera.far
|
|
5404
|
-
);
|
|
5405
|
-
case "orthographic":
|
|
5406
|
-
return new OrthographicCamera(
|
|
5407
|
-
this.options.camera.orthographic.left ?? this.viewWidth / -2,
|
|
5408
|
-
this.options.camera.orthographic.right ?? this.viewWidth / 2,
|
|
5409
|
-
this.options.camera.orthographic.top ?? this.viewHeight / 2,
|
|
5410
|
-
this.options.camera.orthographic.bottom ?? this.viewHeight / -2,
|
|
5411
|
-
this.options.camera.near,
|
|
5412
|
-
this.options.camera.far
|
|
5413
|
-
);
|
|
5586
|
+
function getZoomScale() {
|
|
5587
|
+
return Math.pow(0.95, scope.zoomSpeed);
|
|
5414
5588
|
}
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
const renderer = new WebGLRenderer({
|
|
5418
|
-
antialias: this.options.render.antialias,
|
|
5419
|
-
alpha: true,
|
|
5420
|
-
powerPreference: "high-performance",
|
|
5421
|
-
depth: true
|
|
5422
|
-
});
|
|
5423
|
-
renderer.setClearColor(0, 0);
|
|
5424
|
-
renderer.shadowMap.enabled = true;
|
|
5425
|
-
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
5426
|
-
renderer.outputEncoding = LinearEncoding;
|
|
5427
|
-
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
5428
|
-
return renderer;
|
|
5429
|
-
}
|
|
5430
|
-
createComposer() {
|
|
5431
|
-
const composer = new EffectComposer(this.renderer);
|
|
5432
|
-
if (!this.options.composer.enabled) return composer;
|
|
5433
|
-
composer.setSize(this.viewWidth, this.viewHeight);
|
|
5434
|
-
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
5435
|
-
return composer;
|
|
5436
|
-
}
|
|
5437
|
-
//</editor-fold>
|
|
5438
|
-
init() {
|
|
5439
|
-
if (typeof window["__THREE_DEVTOOLS__"] !== "undefined") {
|
|
5440
|
-
window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
|
|
5589
|
+
function rotateLeft(angle) {
|
|
5590
|
+
sphericalDelta.theta -= angle;
|
|
5441
5591
|
}
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
this.scene.add(gridHelper);
|
|
5445
|
-
const gridHelper2 = new GridHelper(128, 16);
|
|
5446
|
-
gridHelper2.rotation.x = 90 * (Math.PI / 180);
|
|
5447
|
-
this.scene.add(gridHelper2);
|
|
5448
|
-
const gridHelper3 = new GridHelper(128, 16);
|
|
5449
|
-
gridHelper3.rotation.z = 90 * (Math.PI / 180);
|
|
5450
|
-
this.scene.add(gridHelper3);
|
|
5592
|
+
function rotateUp(angle) {
|
|
5593
|
+
sphericalDelta.phi -= angle;
|
|
5451
5594
|
}
|
|
5452
|
-
|
|
5453
|
-
const
|
|
5454
|
-
|
|
5595
|
+
const panLeft = function() {
|
|
5596
|
+
const v = new Vector37();
|
|
5597
|
+
return function panLeft2(distance, objectMatrix) {
|
|
5598
|
+
v.setFromMatrixColumn(objectMatrix, 0);
|
|
5599
|
+
v.multiplyScalar(-distance);
|
|
5600
|
+
panOffset.add(v);
|
|
5601
|
+
};
|
|
5602
|
+
}();
|
|
5603
|
+
const panUp = function() {
|
|
5604
|
+
const v = new Vector37();
|
|
5605
|
+
return function panUp2(distance, objectMatrix) {
|
|
5606
|
+
if (scope.screenSpacePanning === true) {
|
|
5607
|
+
v.setFromMatrixColumn(objectMatrix, 1);
|
|
5608
|
+
} else {
|
|
5609
|
+
v.setFromMatrixColumn(objectMatrix, 0);
|
|
5610
|
+
v.crossVectors(scope.object.up, v);
|
|
5611
|
+
}
|
|
5612
|
+
v.multiplyScalar(distance);
|
|
5613
|
+
panOffset.add(v);
|
|
5614
|
+
};
|
|
5615
|
+
}();
|
|
5616
|
+
const pan = function() {
|
|
5617
|
+
const offset = new Vector37();
|
|
5618
|
+
return function pan2(deltaX, deltaY) {
|
|
5619
|
+
const element = scope.domElement;
|
|
5620
|
+
if (scope.object.isPerspectiveCamera) {
|
|
5621
|
+
const position = scope.object.position;
|
|
5622
|
+
offset.copy(position).sub(scope.target);
|
|
5623
|
+
let targetDistance = offset.length();
|
|
5624
|
+
targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180);
|
|
5625
|
+
panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);
|
|
5626
|
+
panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);
|
|
5627
|
+
} else if (scope.object.isOrthographicCamera) {
|
|
5628
|
+
panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix);
|
|
5629
|
+
panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix);
|
|
5630
|
+
} else {
|
|
5631
|
+
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.");
|
|
5632
|
+
scope.enablePan = false;
|
|
5633
|
+
}
|
|
5634
|
+
};
|
|
5635
|
+
}();
|
|
5636
|
+
function dollyOut(dollyScale) {
|
|
5637
|
+
if (scope.object.isPerspectiveCamera) {
|
|
5638
|
+
scale /= dollyScale;
|
|
5639
|
+
} else if (scope.object.isOrthographicCamera) {
|
|
5640
|
+
scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));
|
|
5641
|
+
scope.object.updateProjectionMatrix();
|
|
5642
|
+
zoomChanged = true;
|
|
5643
|
+
} else {
|
|
5644
|
+
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.");
|
|
5645
|
+
scope.enableZoom = false;
|
|
5646
|
+
}
|
|
5455
5647
|
}
|
|
5456
|
-
|
|
5457
|
-
if (
|
|
5458
|
-
|
|
5459
|
-
} else if (
|
|
5460
|
-
|
|
5648
|
+
function dollyIn(dollyScale) {
|
|
5649
|
+
if (scope.object.isPerspectiveCamera) {
|
|
5650
|
+
scale *= dollyScale;
|
|
5651
|
+
} else if (scope.object.isOrthographicCamera) {
|
|
5652
|
+
scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));
|
|
5653
|
+
scope.object.updateProjectionMatrix();
|
|
5654
|
+
zoomChanged = true;
|
|
5655
|
+
} else {
|
|
5656
|
+
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.");
|
|
5657
|
+
scope.enableZoom = false;
|
|
5461
5658
|
}
|
|
5462
5659
|
}
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5660
|
+
function handleMouseDownRotate(event) {
|
|
5661
|
+
rotateStart.set(event.clientX, event.clientY);
|
|
5662
|
+
}
|
|
5663
|
+
function handleMouseDownDolly(event) {
|
|
5664
|
+
dollyStart.set(event.clientX, event.clientY);
|
|
5665
|
+
}
|
|
5666
|
+
function handleMouseDownPan(event) {
|
|
5667
|
+
panStart.set(event.clientX, event.clientY);
|
|
5668
|
+
}
|
|
5669
|
+
function handleMouseMoveRotate(event) {
|
|
5670
|
+
rotateEnd.set(event.clientX, event.clientY);
|
|
5671
|
+
rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);
|
|
5672
|
+
const element = scope.domElement;
|
|
5673
|
+
rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight);
|
|
5674
|
+
rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);
|
|
5675
|
+
rotateStart.copy(rotateEnd);
|
|
5676
|
+
scope.update();
|
|
5677
|
+
}
|
|
5678
|
+
function handleMouseMoveDolly(event) {
|
|
5679
|
+
dollyEnd.set(event.clientX, event.clientY);
|
|
5680
|
+
dollyDelta.subVectors(dollyEnd, dollyStart);
|
|
5681
|
+
if (dollyDelta.y > 0) {
|
|
5682
|
+
dollyOut(getZoomScale());
|
|
5683
|
+
} else if (dollyDelta.y < 0) {
|
|
5684
|
+
dollyIn(getZoomScale());
|
|
5468
5685
|
}
|
|
5686
|
+
dollyStart.copy(dollyEnd);
|
|
5687
|
+
scope.update();
|
|
5469
5688
|
}
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5689
|
+
function handleMouseMovePan(event) {
|
|
5690
|
+
panEnd.set(event.clientX, event.clientY);
|
|
5691
|
+
panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);
|
|
5692
|
+
pan(panDelta.x, panDelta.y);
|
|
5693
|
+
panStart.copy(panEnd);
|
|
5694
|
+
scope.update();
|
|
5475
5695
|
}
|
|
5476
|
-
|
|
5477
|
-
get element() {
|
|
5478
|
-
return this._element;
|
|
5479
|
-
}
|
|
5480
|
-
appendTo(element) {
|
|
5481
|
-
this._element = element;
|
|
5482
|
-
this._element.appendChild(this.renderer.domElement);
|
|
5483
|
-
if (this.viewWidth == 0) {
|
|
5484
|
-
console.warn("0 element width");
|
|
5696
|
+
function handleMouseUp() {
|
|
5485
5697
|
}
|
|
5486
|
-
|
|
5487
|
-
|
|
5698
|
+
function handleMouseWheel(event) {
|
|
5699
|
+
if (event.deltaY < 0) {
|
|
5700
|
+
dollyIn(getZoomScale());
|
|
5701
|
+
} else if (event.deltaY > 0) {
|
|
5702
|
+
dollyOut(getZoomScale());
|
|
5703
|
+
}
|
|
5704
|
+
scope.update();
|
|
5488
5705
|
}
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5706
|
+
function handleKeyDown(event) {
|
|
5707
|
+
let needsUpdate = false;
|
|
5708
|
+
switch (event.code) {
|
|
5709
|
+
case scope.keys.UP:
|
|
5710
|
+
pan(0, scope.keyPanSpeed);
|
|
5711
|
+
needsUpdate = true;
|
|
5712
|
+
break;
|
|
5713
|
+
case scope.keys.BOTTOM:
|
|
5714
|
+
pan(0, -scope.keyPanSpeed);
|
|
5715
|
+
needsUpdate = true;
|
|
5716
|
+
break;
|
|
5717
|
+
case scope.keys.LEFT:
|
|
5718
|
+
pan(scope.keyPanSpeed, 0);
|
|
5719
|
+
needsUpdate = true;
|
|
5720
|
+
break;
|
|
5721
|
+
case scope.keys.RIGHT:
|
|
5722
|
+
pan(-scope.keyPanSpeed, 0);
|
|
5723
|
+
needsUpdate = true;
|
|
5724
|
+
break;
|
|
5725
|
+
}
|
|
5726
|
+
if (needsUpdate) {
|
|
5727
|
+
event.preventDefault();
|
|
5728
|
+
scope.update();
|
|
5729
|
+
}
|
|
5509
5730
|
}
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
this._dirty = dirty;
|
|
5519
|
-
this.scene.dirty = dirty;
|
|
5520
|
-
}
|
|
5521
|
-
start() {
|
|
5522
|
-
stop();
|
|
5523
|
-
this.renderer.setAnimationLoop(this._animationLoop);
|
|
5524
|
-
}
|
|
5525
|
-
stop() {
|
|
5526
|
-
this.renderer.setAnimationLoop(null);
|
|
5527
|
-
if (this._animationTimer)
|
|
5528
|
-
clearTimeout(this._animationTimer);
|
|
5529
|
-
this._animationTimer = void 0;
|
|
5530
|
-
if (this._animationFrame)
|
|
5531
|
-
cancelAnimationFrame(this._animationFrame);
|
|
5532
|
-
this._animationFrame = void 0;
|
|
5533
|
-
}
|
|
5534
|
-
animate(t) {
|
|
5535
|
-
if (this._stats) {
|
|
5536
|
-
this._stats.begin();
|
|
5731
|
+
function handleTouchStartRotate() {
|
|
5732
|
+
if (pointers.length === 1) {
|
|
5733
|
+
rotateStart.set(pointers[0].pageX, pointers[0].pageY);
|
|
5734
|
+
} else {
|
|
5735
|
+
const x = 0.5 * (pointers[0].pageX + pointers[1].pageX);
|
|
5736
|
+
const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);
|
|
5737
|
+
rotateStart.set(x, y);
|
|
5738
|
+
}
|
|
5537
5739
|
}
|
|
5538
|
-
|
|
5539
|
-
if (
|
|
5540
|
-
|
|
5740
|
+
function handleTouchStartPan() {
|
|
5741
|
+
if (pointers.length === 1) {
|
|
5742
|
+
panStart.set(pointers[0].pageX, pointers[0].pageY);
|
|
5541
5743
|
} else {
|
|
5542
|
-
|
|
5744
|
+
const x = 0.5 * (pointers[0].pageX + pointers[1].pageX);
|
|
5745
|
+
const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);
|
|
5746
|
+
panStart.set(x, y);
|
|
5543
5747
|
}
|
|
5544
5748
|
}
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5749
|
+
function handleTouchStartDolly() {
|
|
5750
|
+
const dx = pointers[0].pageX - pointers[1].pageX;
|
|
5751
|
+
const dy = pointers[0].pageY - pointers[1].pageY;
|
|
5752
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
5753
|
+
dollyStart.set(0, distance);
|
|
5548
5754
|
}
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
return this.renderer.domElement.toDataURL();
|
|
5553
|
-
}
|
|
5554
|
-
///
|
|
5555
|
-
get attachedToBody() {
|
|
5556
|
-
return this.element === document.body;
|
|
5557
|
-
}
|
|
5558
|
-
get viewWidth() {
|
|
5559
|
-
return this.attachedToBody ? window.innerWidth : this.element?.offsetWidth || 0;
|
|
5560
|
-
}
|
|
5561
|
-
get viewHeight() {
|
|
5562
|
-
return this.attachedToBody ? window.innerHeight : this.element?.offsetHeight || 0;
|
|
5563
|
-
}
|
|
5564
|
-
get scene() {
|
|
5565
|
-
return this._scene;
|
|
5566
|
-
}
|
|
5567
|
-
get camera() {
|
|
5568
|
-
return this._camera;
|
|
5569
|
-
}
|
|
5570
|
-
get renderer() {
|
|
5571
|
-
return this._renderer;
|
|
5572
|
-
}
|
|
5573
|
-
get composer() {
|
|
5574
|
-
return this._composer;
|
|
5575
|
-
}
|
|
5576
|
-
///
|
|
5577
|
-
};
|
|
5578
|
-
_Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge10.default)({}, {
|
|
5579
|
-
camera: {
|
|
5580
|
-
type: "perspective",
|
|
5581
|
-
near: 1,
|
|
5582
|
-
far: 5e3,
|
|
5583
|
-
perspective: {
|
|
5584
|
-
aspect: void 0,
|
|
5585
|
-
fov: 50
|
|
5586
|
-
},
|
|
5587
|
-
orthographic: {
|
|
5588
|
-
left: void 0,
|
|
5589
|
-
right: void 0,
|
|
5590
|
-
top: void 0,
|
|
5591
|
-
bottom: void 0
|
|
5592
|
-
},
|
|
5593
|
-
position: new Vector37(50, 50, 50),
|
|
5594
|
-
lookingAt: new Vector37(0, 0, 0)
|
|
5595
|
-
},
|
|
5596
|
-
render: {
|
|
5597
|
-
fpsLimit: 60,
|
|
5598
|
-
stats: false,
|
|
5599
|
-
antialias: true,
|
|
5600
|
-
shade: true,
|
|
5601
|
-
autoResize: true,
|
|
5602
|
-
renderAlways: false
|
|
5603
|
-
},
|
|
5604
|
-
composer: {
|
|
5605
|
-
enabled: true
|
|
5606
|
-
},
|
|
5607
|
-
debug: {
|
|
5608
|
-
grid: false,
|
|
5609
|
-
axes: false
|
|
5610
|
-
}
|
|
5611
|
-
});
|
|
5612
|
-
var Renderer = _Renderer;
|
|
5613
|
-
|
|
5614
|
-
// src/skin/Skins.ts
|
|
5615
|
-
var Skins = class {
|
|
5616
|
-
//<editor-fold desc="Skins">
|
|
5617
|
-
static async fromUuidOrUsername(uuidOrUsername) {
|
|
5618
|
-
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
5619
|
-
return this.fromUuid(uuidOrUsername);
|
|
5755
|
+
function handleTouchStartDollyPan() {
|
|
5756
|
+
if (scope.enableZoom) handleTouchStartDolly();
|
|
5757
|
+
if (scope.enablePan) handleTouchStartPan();
|
|
5620
5758
|
}
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
return this.getSkinProxySkinUrl(uuid);
|
|
5625
|
-
}
|
|
5626
|
-
static async fromUsername(username) {
|
|
5627
|
-
return this.usernameToUuid(username).then((uuid) => {
|
|
5628
|
-
if (uuid) {
|
|
5629
|
-
return this.fromUuid(uuid);
|
|
5630
|
-
}
|
|
5631
|
-
return void 0;
|
|
5632
|
-
});
|
|
5633
|
-
}
|
|
5634
|
-
static async fromMineSkin(mineskinId) {
|
|
5635
|
-
return this.getMineSkin(mineskinId).then((mineskin) => {
|
|
5636
|
-
if (mineskin) {
|
|
5637
|
-
return mineskin["data"]["texture"]["value"]["urls"]["skins"];
|
|
5638
|
-
}
|
|
5639
|
-
return void 0;
|
|
5640
|
-
});
|
|
5641
|
-
}
|
|
5642
|
-
//</editor-fold>
|
|
5643
|
-
//<editor-fold desc="Capes">
|
|
5644
|
-
static async capeFromUuidOrUsername(uuidOrUsername) {
|
|
5645
|
-
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
5646
|
-
return this.capeFromUuid(uuidOrUsername);
|
|
5759
|
+
function handleTouchStartDollyRotate() {
|
|
5760
|
+
if (scope.enableZoom) handleTouchStartDolly();
|
|
5761
|
+
if (scope.enableRotate) handleTouchStartRotate();
|
|
5647
5762
|
}
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
return this.capeFromUuid(uuid);
|
|
5657
|
-
}
|
|
5658
|
-
return void 0;
|
|
5659
|
-
});
|
|
5660
|
-
}
|
|
5661
|
-
static async capeFromCapesDev(uuid, capeType = "minecraft") {
|
|
5662
|
-
return this.getCapesDev(uuid, capeType).then((cape) => {
|
|
5663
|
-
if (cape) {
|
|
5664
|
-
return cape?.stillImageUrl;
|
|
5665
|
-
}
|
|
5666
|
-
return void 0;
|
|
5667
|
-
});
|
|
5668
|
-
}
|
|
5669
|
-
//</editor-fold>
|
|
5670
|
-
//<editor-fold desc="Helpers">
|
|
5671
|
-
static async usernameToUuid(username) {
|
|
5672
|
-
return this.usernameToUuidSkinProxy(username);
|
|
5673
|
-
}
|
|
5674
|
-
static async usernameToUuidSkinProxy(username) {
|
|
5675
|
-
return Requests.genericRequest({
|
|
5676
|
-
baseURL: "https://minecraft-skin-proxy.inventive.workers.dev",
|
|
5677
|
-
url: "/uuid/" + username
|
|
5678
|
-
}).then((res) => {
|
|
5679
|
-
if (res.status === 200) {
|
|
5680
|
-
return res.data["id"];
|
|
5681
|
-
}
|
|
5682
|
-
return void 0;
|
|
5683
|
-
}).catch((err) => {
|
|
5684
|
-
console.warn(err);
|
|
5685
|
-
return void 0;
|
|
5686
|
-
});
|
|
5687
|
-
}
|
|
5688
|
-
static async usernameToUuidMineTools(username) {
|
|
5689
|
-
return Requests.genericRequest({
|
|
5690
|
-
baseURL: "https://api.minetools.eu",
|
|
5691
|
-
url: "/uuid/" + username
|
|
5692
|
-
}).then((res) => {
|
|
5693
|
-
if (res.status === 200) {
|
|
5694
|
-
return res.data["id"];
|
|
5695
|
-
}
|
|
5696
|
-
return void 0;
|
|
5697
|
-
}).catch((err) => {
|
|
5698
|
-
console.warn(err);
|
|
5699
|
-
return void 0;
|
|
5700
|
-
});
|
|
5701
|
-
}
|
|
5702
|
-
static async getProfileFromMinetools(uuid) {
|
|
5703
|
-
return Requests.genericRequest({
|
|
5704
|
-
baseURL: "https://api.minetools.eu",
|
|
5705
|
-
url: "/profile/" + uuid
|
|
5706
|
-
}).then((res) => {
|
|
5707
|
-
if (res.status === 200) {
|
|
5708
|
-
return res.data;
|
|
5709
|
-
}
|
|
5710
|
-
});
|
|
5711
|
-
}
|
|
5712
|
-
static async getMineSkin(mineskinId) {
|
|
5713
|
-
return Requests.genericRequest({
|
|
5714
|
-
baseURL: "https://api.mineskin.org",
|
|
5715
|
-
url: "/get/uuid/" + mineskinId
|
|
5716
|
-
}).then((res) => {
|
|
5717
|
-
if (res.status === 200) {
|
|
5718
|
-
return res.data;
|
|
5719
|
-
}
|
|
5720
|
-
return void 0;
|
|
5721
|
-
}).catch((err) => {
|
|
5722
|
-
console.warn(err);
|
|
5723
|
-
return void 0;
|
|
5724
|
-
});
|
|
5725
|
-
}
|
|
5726
|
-
static async getCapesDev(uuid, type = "all") {
|
|
5727
|
-
return Requests.genericRequest({
|
|
5728
|
-
baseURL: "https://api.capes.dev",
|
|
5729
|
-
url: "/load/" + uuid + "/" + type
|
|
5730
|
-
}).then((res) => {
|
|
5731
|
-
if (res.status === 200) {
|
|
5732
|
-
return res.data;
|
|
5733
|
-
}
|
|
5734
|
-
return void 0;
|
|
5735
|
-
}).catch((err) => {
|
|
5736
|
-
console.warn(err);
|
|
5737
|
-
return void 0;
|
|
5738
|
-
});
|
|
5739
|
-
}
|
|
5740
|
-
static getCrafatarSkinUrl(uuid) {
|
|
5741
|
-
return "https://crafatar.com/skins/" + uuid;
|
|
5742
|
-
}
|
|
5743
|
-
static getCrafatarCapeUrl(uuid) {
|
|
5744
|
-
return "https://crafatar.com/capes/" + uuid;
|
|
5745
|
-
}
|
|
5746
|
-
static getMcHeadsSkinUrl(uuid) {
|
|
5747
|
-
return "https://mc-heads.net/skin/" + uuid;
|
|
5748
|
-
}
|
|
5749
|
-
static getMineSkinPlayerSkinUrl(uuid) {
|
|
5750
|
-
return "https://mineskin.org/skin/player/" + uuid;
|
|
5751
|
-
}
|
|
5752
|
-
static getSkinProxySkinUrl(uuid) {
|
|
5753
|
-
return "https://minecraft-skin-proxy.inventive.workers.dev/skin/" + uuid;
|
|
5754
|
-
}
|
|
5755
|
-
static getSkinProxyCapeUrl(uuid) {
|
|
5756
|
-
return "https://minecraft-skin-proxy.inventive.workers.dev/cape/" + uuid;
|
|
5757
|
-
}
|
|
5758
|
-
//</editor-fold>
|
|
5759
|
-
};
|
|
5760
|
-
|
|
5761
|
-
// src/three/OrbitControls.js
|
|
5762
|
-
import {
|
|
5763
|
-
EventDispatcher as EventDispatcher2,
|
|
5764
|
-
MOUSE,
|
|
5765
|
-
Quaternion as Quaternion3,
|
|
5766
|
-
Spherical,
|
|
5767
|
-
TOUCH,
|
|
5768
|
-
Vector2 as Vector23,
|
|
5769
|
-
Vector3 as Vector38
|
|
5770
|
-
} from "three";
|
|
5771
|
-
var _changeEvent = { type: "change" };
|
|
5772
|
-
var _startEvent = { type: "start" };
|
|
5773
|
-
var _endEvent = { type: "end" };
|
|
5774
|
-
var OrbitControls = class extends EventDispatcher2 {
|
|
5775
|
-
constructor(object, domElement) {
|
|
5776
|
-
super();
|
|
5777
|
-
if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
|
|
5778
|
-
if (domElement === document) console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
|
|
5779
|
-
this.object = object;
|
|
5780
|
-
this.domElement = domElement;
|
|
5781
|
-
this.domElement.style.touchAction = "none";
|
|
5782
|
-
this.enabled = true;
|
|
5783
|
-
this.target = new Vector38();
|
|
5784
|
-
this.minDistance = 0;
|
|
5785
|
-
this.maxDistance = Infinity;
|
|
5786
|
-
this.minZoom = 0;
|
|
5787
|
-
this.maxZoom = Infinity;
|
|
5788
|
-
this.minPolarAngle = 0;
|
|
5789
|
-
this.maxPolarAngle = Math.PI;
|
|
5790
|
-
this.minAzimuthAngle = -Infinity;
|
|
5791
|
-
this.maxAzimuthAngle = Infinity;
|
|
5792
|
-
this.enableDamping = false;
|
|
5793
|
-
this.dampingFactor = 0.05;
|
|
5794
|
-
this.enableZoom = true;
|
|
5795
|
-
this.zoomSpeed = 1;
|
|
5796
|
-
this.enableRotate = true;
|
|
5797
|
-
this.rotateSpeed = 1;
|
|
5798
|
-
this.enablePan = true;
|
|
5799
|
-
this.panSpeed = 1;
|
|
5800
|
-
this.screenSpacePanning = true;
|
|
5801
|
-
this.keyPanSpeed = 7;
|
|
5802
|
-
this.autoRotate = false;
|
|
5803
|
-
this.autoRotateSpeed = 2;
|
|
5804
|
-
this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" };
|
|
5805
|
-
this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };
|
|
5806
|
-
this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };
|
|
5807
|
-
this.target0 = this.target.clone();
|
|
5808
|
-
this.position0 = this.object.position.clone();
|
|
5809
|
-
this.zoom0 = this.object.zoom;
|
|
5810
|
-
this._domElementKeyEvents = null;
|
|
5811
|
-
this.getPolarAngle = function() {
|
|
5812
|
-
return spherical.phi;
|
|
5813
|
-
};
|
|
5814
|
-
this.getAzimuthalAngle = function() {
|
|
5815
|
-
return spherical.theta;
|
|
5816
|
-
};
|
|
5817
|
-
this.getDistance = function() {
|
|
5818
|
-
return this.object.position.distanceTo(this.target);
|
|
5819
|
-
};
|
|
5820
|
-
this.saveState = function() {
|
|
5821
|
-
scope.target0.copy(scope.target);
|
|
5822
|
-
scope.position0.copy(scope.object.position);
|
|
5823
|
-
scope.zoom0 = scope.object.zoom;
|
|
5824
|
-
};
|
|
5825
|
-
this.reset = function() {
|
|
5826
|
-
scope.target.copy(scope.target0);
|
|
5827
|
-
scope.object.position.copy(scope.position0);
|
|
5828
|
-
scope.object.zoom = scope.zoom0;
|
|
5829
|
-
scope.object.updateProjectionMatrix();
|
|
5830
|
-
scope.dispatchEvent(_changeEvent);
|
|
5831
|
-
scope.update();
|
|
5832
|
-
state = STATE.NONE;
|
|
5833
|
-
};
|
|
5834
|
-
this.update = function() {
|
|
5835
|
-
const offset = new Vector38();
|
|
5836
|
-
const quat = new Quaternion3().setFromUnitVectors(object.up, new Vector38(0, 1, 0));
|
|
5837
|
-
const quatInverse = quat.clone().invert();
|
|
5838
|
-
const lastPosition = new Vector38();
|
|
5839
|
-
const lastQuaternion = new Quaternion3();
|
|
5840
|
-
const twoPI = 2 * Math.PI;
|
|
5841
|
-
return function update() {
|
|
5842
|
-
const position = scope.object.position;
|
|
5843
|
-
offset.copy(position).sub(scope.target);
|
|
5844
|
-
offset.applyQuaternion(quat);
|
|
5845
|
-
spherical.setFromVector3(offset);
|
|
5846
|
-
if (scope.autoRotate && state === STATE.NONE) {
|
|
5847
|
-
rotateLeft(getAutoRotationAngle());
|
|
5848
|
-
}
|
|
5849
|
-
if (scope.enableDamping) {
|
|
5850
|
-
spherical.theta += sphericalDelta.theta * scope.dampingFactor;
|
|
5851
|
-
spherical.phi += sphericalDelta.phi * scope.dampingFactor;
|
|
5852
|
-
} else {
|
|
5853
|
-
spherical.theta += sphericalDelta.theta;
|
|
5854
|
-
spherical.phi += sphericalDelta.phi;
|
|
5855
|
-
}
|
|
5856
|
-
let min = scope.minAzimuthAngle;
|
|
5857
|
-
let max = scope.maxAzimuthAngle;
|
|
5858
|
-
if (isFinite(min) && isFinite(max)) {
|
|
5859
|
-
if (min < -Math.PI) min += twoPI;
|
|
5860
|
-
else if (min > Math.PI) min -= twoPI;
|
|
5861
|
-
if (max < -Math.PI) max += twoPI;
|
|
5862
|
-
else if (max > Math.PI) max -= twoPI;
|
|
5863
|
-
if (min <= max) {
|
|
5864
|
-
spherical.theta = Math.max(min, Math.min(max, spherical.theta));
|
|
5865
|
-
} else {
|
|
5866
|
-
spherical.theta = spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);
|
|
5867
|
-
}
|
|
5868
|
-
}
|
|
5869
|
-
spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));
|
|
5870
|
-
spherical.makeSafe();
|
|
5871
|
-
spherical.radius *= scale;
|
|
5872
|
-
spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));
|
|
5873
|
-
if (scope.enableDamping === true) {
|
|
5874
|
-
scope.target.addScaledVector(panOffset, scope.dampingFactor);
|
|
5875
|
-
} else {
|
|
5876
|
-
scope.target.add(panOffset);
|
|
5877
|
-
}
|
|
5878
|
-
offset.setFromSpherical(spherical);
|
|
5879
|
-
offset.applyQuaternion(quatInverse);
|
|
5880
|
-
position.copy(scope.target).add(offset);
|
|
5881
|
-
scope.object.lookAt(scope.target);
|
|
5882
|
-
if (scope.enableDamping === true) {
|
|
5883
|
-
sphericalDelta.theta *= 1 - scope.dampingFactor;
|
|
5884
|
-
sphericalDelta.phi *= 1 - scope.dampingFactor;
|
|
5885
|
-
panOffset.multiplyScalar(1 - scope.dampingFactor);
|
|
5886
|
-
} else {
|
|
5887
|
-
sphericalDelta.set(0, 0, 0);
|
|
5888
|
-
panOffset.set(0, 0, 0);
|
|
5889
|
-
}
|
|
5890
|
-
scale = 1;
|
|
5891
|
-
if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {
|
|
5892
|
-
scope.dispatchEvent(_changeEvent);
|
|
5893
|
-
lastPosition.copy(scope.object.position);
|
|
5894
|
-
lastQuaternion.copy(scope.object.quaternion);
|
|
5895
|
-
zoomChanged = false;
|
|
5896
|
-
return true;
|
|
5897
|
-
}
|
|
5898
|
-
return false;
|
|
5899
|
-
};
|
|
5900
|
-
}();
|
|
5901
|
-
this.dispose = function() {
|
|
5902
|
-
scope.domElement.removeEventListener("contextmenu", onContextMenu);
|
|
5903
|
-
scope.domElement.removeEventListener("pointerdown", onPointerDown);
|
|
5904
|
-
scope.domElement.removeEventListener("pointercancel", onPointerCancel);
|
|
5905
|
-
scope.domElement.removeEventListener("wheel", onMouseWheel);
|
|
5906
|
-
scope.domElement.removeEventListener("pointermove", onPointerMove);
|
|
5907
|
-
scope.domElement.removeEventListener("pointerup", onPointerUp);
|
|
5908
|
-
if (scope._domElementKeyEvents !== null) {
|
|
5909
|
-
scope._domElementKeyEvents.removeEventListener("keydown", onKeyDown);
|
|
5763
|
+
function handleTouchMoveRotate(event) {
|
|
5764
|
+
if (pointers.length == 1) {
|
|
5765
|
+
rotateEnd.set(event.pageX, event.pageY);
|
|
5766
|
+
} else {
|
|
5767
|
+
const position = getSecondPointerPosition(event);
|
|
5768
|
+
const x = 0.5 * (event.pageX + position.x);
|
|
5769
|
+
const y = 0.5 * (event.pageY + position.y);
|
|
5770
|
+
rotateEnd.set(x, y);
|
|
5910
5771
|
}
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
let zoomChanged = false;
|
|
5930
|
-
const rotateStart = new Vector23();
|
|
5931
|
-
const rotateEnd = new Vector23();
|
|
5932
|
-
const rotateDelta = new Vector23();
|
|
5933
|
-
const panStart = new Vector23();
|
|
5934
|
-
const panEnd = new Vector23();
|
|
5935
|
-
const panDelta = new Vector23();
|
|
5936
|
-
const dollyStart = new Vector23();
|
|
5937
|
-
const dollyEnd = new Vector23();
|
|
5938
|
-
const dollyDelta = new Vector23();
|
|
5939
|
-
const pointers = [];
|
|
5940
|
-
const pointerPositions = {};
|
|
5941
|
-
function getAutoRotationAngle() {
|
|
5942
|
-
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
|
|
5772
|
+
rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);
|
|
5773
|
+
const element = scope.domElement;
|
|
5774
|
+
rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight);
|
|
5775
|
+
rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);
|
|
5776
|
+
rotateStart.copy(rotateEnd);
|
|
5777
|
+
}
|
|
5778
|
+
function handleTouchMovePan(event) {
|
|
5779
|
+
if (pointers.length === 1) {
|
|
5780
|
+
panEnd.set(event.pageX, event.pageY);
|
|
5781
|
+
} else {
|
|
5782
|
+
const position = getSecondPointerPosition(event);
|
|
5783
|
+
const x = 0.5 * (event.pageX + position.x);
|
|
5784
|
+
const y = 0.5 * (event.pageY + position.y);
|
|
5785
|
+
panEnd.set(x, y);
|
|
5786
|
+
}
|
|
5787
|
+
panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);
|
|
5788
|
+
pan(panDelta.x, panDelta.y);
|
|
5789
|
+
panStart.copy(panEnd);
|
|
5943
5790
|
}
|
|
5944
|
-
function
|
|
5945
|
-
|
|
5791
|
+
function handleTouchMoveDolly(event) {
|
|
5792
|
+
const position = getSecondPointerPosition(event);
|
|
5793
|
+
const dx = event.pageX - position.x;
|
|
5794
|
+
const dy = event.pageY - position.y;
|
|
5795
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
5796
|
+
dollyEnd.set(0, distance);
|
|
5797
|
+
dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed));
|
|
5798
|
+
dollyOut(dollyDelta.y);
|
|
5799
|
+
dollyStart.copy(dollyEnd);
|
|
5946
5800
|
}
|
|
5947
|
-
function
|
|
5948
|
-
|
|
5801
|
+
function handleTouchMoveDollyPan(event) {
|
|
5802
|
+
if (scope.enableZoom) handleTouchMoveDolly(event);
|
|
5803
|
+
if (scope.enablePan) handleTouchMovePan(event);
|
|
5949
5804
|
}
|
|
5950
|
-
function
|
|
5951
|
-
|
|
5805
|
+
function handleTouchMoveDollyRotate(event) {
|
|
5806
|
+
if (scope.enableZoom) handleTouchMoveDolly(event);
|
|
5807
|
+
if (scope.enableRotate) handleTouchMoveRotate(event);
|
|
5952
5808
|
}
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
v.setFromMatrixColumn(objectMatrix, 1);
|
|
5966
|
-
} else {
|
|
5967
|
-
v.setFromMatrixColumn(objectMatrix, 0);
|
|
5968
|
-
v.crossVectors(scope.object.up, v);
|
|
5969
|
-
}
|
|
5970
|
-
v.multiplyScalar(distance);
|
|
5971
|
-
panOffset.add(v);
|
|
5972
|
-
};
|
|
5973
|
-
}();
|
|
5974
|
-
const pan = function() {
|
|
5975
|
-
const offset = new Vector38();
|
|
5976
|
-
return function pan2(deltaX, deltaY) {
|
|
5977
|
-
const element = scope.domElement;
|
|
5978
|
-
if (scope.object.isPerspectiveCamera) {
|
|
5979
|
-
const position = scope.object.position;
|
|
5980
|
-
offset.copy(position).sub(scope.target);
|
|
5981
|
-
let targetDistance = offset.length();
|
|
5982
|
-
targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180);
|
|
5983
|
-
panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);
|
|
5984
|
-
panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);
|
|
5985
|
-
} else if (scope.object.isOrthographicCamera) {
|
|
5986
|
-
panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix);
|
|
5987
|
-
panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix);
|
|
5988
|
-
} else {
|
|
5989
|
-
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.");
|
|
5990
|
-
scope.enablePan = false;
|
|
5991
|
-
}
|
|
5992
|
-
};
|
|
5993
|
-
}();
|
|
5994
|
-
function dollyOut(dollyScale) {
|
|
5995
|
-
if (scope.object.isPerspectiveCamera) {
|
|
5996
|
-
scale /= dollyScale;
|
|
5997
|
-
} else if (scope.object.isOrthographicCamera) {
|
|
5998
|
-
scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));
|
|
5999
|
-
scope.object.updateProjectionMatrix();
|
|
6000
|
-
zoomChanged = true;
|
|
5809
|
+
function handleTouchEnd() {
|
|
5810
|
+
}
|
|
5811
|
+
function onPointerDown(event) {
|
|
5812
|
+
if (scope.enabled === false) return;
|
|
5813
|
+
if (pointers.length === 0) {
|
|
5814
|
+
scope.domElement.setPointerCapture(event.pointerId);
|
|
5815
|
+
scope.domElement.addEventListener("pointermove", onPointerMove);
|
|
5816
|
+
scope.domElement.addEventListener("pointerup", onPointerUp);
|
|
5817
|
+
}
|
|
5818
|
+
addPointer(event);
|
|
5819
|
+
if (event.pointerType === "touch") {
|
|
5820
|
+
onTouchStart(event);
|
|
6001
5821
|
} else {
|
|
6002
|
-
|
|
6003
|
-
scope.enableZoom = false;
|
|
5822
|
+
onMouseDown(event);
|
|
6004
5823
|
}
|
|
6005
5824
|
}
|
|
6006
|
-
function
|
|
6007
|
-
if (scope.
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));
|
|
6011
|
-
scope.object.updateProjectionMatrix();
|
|
6012
|
-
zoomChanged = true;
|
|
5825
|
+
function onPointerMove(event) {
|
|
5826
|
+
if (scope.enabled === false) return;
|
|
5827
|
+
if (event.pointerType === "touch") {
|
|
5828
|
+
onTouchMove(event);
|
|
6013
5829
|
} else {
|
|
6014
|
-
|
|
6015
|
-
scope.enableZoom = false;
|
|
5830
|
+
onMouseMove(event);
|
|
6016
5831
|
}
|
|
6017
5832
|
}
|
|
6018
|
-
function
|
|
6019
|
-
|
|
5833
|
+
function onPointerUp(event) {
|
|
5834
|
+
if (scope.enabled === false) return;
|
|
5835
|
+
if (event.pointerType === "touch") {
|
|
5836
|
+
onTouchEnd();
|
|
5837
|
+
} else {
|
|
5838
|
+
onMouseUp(event);
|
|
5839
|
+
}
|
|
5840
|
+
removePointer(event);
|
|
5841
|
+
if (pointers.length === 0) {
|
|
5842
|
+
scope.domElement.releasePointerCapture(event.pointerId);
|
|
5843
|
+
scope.domElement.removeEventListener("pointermove", onPointerMove);
|
|
5844
|
+
scope.domElement.removeEventListener("pointerup", onPointerUp);
|
|
5845
|
+
}
|
|
6020
5846
|
}
|
|
6021
|
-
function
|
|
6022
|
-
|
|
5847
|
+
function onPointerCancel(event) {
|
|
5848
|
+
removePointer(event);
|
|
6023
5849
|
}
|
|
6024
|
-
function
|
|
6025
|
-
|
|
5850
|
+
function onMouseDown(event) {
|
|
5851
|
+
let mouseAction;
|
|
5852
|
+
switch (event.button) {
|
|
5853
|
+
case 0:
|
|
5854
|
+
mouseAction = scope.mouseButtons.LEFT;
|
|
5855
|
+
break;
|
|
5856
|
+
case 1:
|
|
5857
|
+
mouseAction = scope.mouseButtons.MIDDLE;
|
|
5858
|
+
break;
|
|
5859
|
+
case 2:
|
|
5860
|
+
mouseAction = scope.mouseButtons.RIGHT;
|
|
5861
|
+
break;
|
|
5862
|
+
default:
|
|
5863
|
+
mouseAction = -1;
|
|
5864
|
+
}
|
|
5865
|
+
switch (mouseAction) {
|
|
5866
|
+
case MOUSE.DOLLY:
|
|
5867
|
+
if (scope.enableZoom === false) return;
|
|
5868
|
+
handleMouseDownDolly(event);
|
|
5869
|
+
state = STATE.DOLLY;
|
|
5870
|
+
break;
|
|
5871
|
+
case MOUSE.ROTATE:
|
|
5872
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
5873
|
+
if (scope.enablePan === false) return;
|
|
5874
|
+
handleMouseDownPan(event);
|
|
5875
|
+
state = STATE.PAN;
|
|
5876
|
+
} else {
|
|
5877
|
+
if (scope.enableRotate === false) return;
|
|
5878
|
+
handleMouseDownRotate(event);
|
|
5879
|
+
state = STATE.ROTATE;
|
|
5880
|
+
}
|
|
5881
|
+
break;
|
|
5882
|
+
case MOUSE.PAN:
|
|
5883
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
5884
|
+
if (scope.enableRotate === false) return;
|
|
5885
|
+
handleMouseDownRotate(event);
|
|
5886
|
+
state = STATE.ROTATE;
|
|
5887
|
+
} else {
|
|
5888
|
+
if (scope.enablePan === false) return;
|
|
5889
|
+
handleMouseDownPan(event);
|
|
5890
|
+
state = STATE.PAN;
|
|
5891
|
+
}
|
|
5892
|
+
break;
|
|
5893
|
+
default:
|
|
5894
|
+
state = STATE.NONE;
|
|
5895
|
+
}
|
|
5896
|
+
if (state !== STATE.NONE) {
|
|
5897
|
+
scope.dispatchEvent(_startEvent);
|
|
5898
|
+
}
|
|
6026
5899
|
}
|
|
6027
|
-
function
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
5900
|
+
function onMouseMove(event) {
|
|
5901
|
+
if (scope.enabled === false) return;
|
|
5902
|
+
switch (state) {
|
|
5903
|
+
case STATE.ROTATE:
|
|
5904
|
+
if (scope.enableRotate === false) return;
|
|
5905
|
+
handleMouseMoveRotate(event);
|
|
5906
|
+
break;
|
|
5907
|
+
case STATE.DOLLY:
|
|
5908
|
+
if (scope.enableZoom === false) return;
|
|
5909
|
+
handleMouseMoveDolly(event);
|
|
5910
|
+
break;
|
|
5911
|
+
case STATE.PAN:
|
|
5912
|
+
if (scope.enablePan === false) return;
|
|
5913
|
+
handleMouseMovePan(event);
|
|
5914
|
+
break;
|
|
5915
|
+
}
|
|
6035
5916
|
}
|
|
6036
|
-
function
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
5917
|
+
function onMouseUp(event) {
|
|
5918
|
+
handleMouseUp(event);
|
|
5919
|
+
scope.dispatchEvent(_endEvent);
|
|
5920
|
+
state = STATE.NONE;
|
|
5921
|
+
}
|
|
5922
|
+
function onMouseWheel(event) {
|
|
5923
|
+
if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;
|
|
5924
|
+
event.preventDefault();
|
|
5925
|
+
scope.dispatchEvent(_startEvent);
|
|
5926
|
+
handleMouseWheel(event);
|
|
5927
|
+
scope.dispatchEvent(_endEvent);
|
|
5928
|
+
}
|
|
5929
|
+
function onKeyDown(event) {
|
|
5930
|
+
if (scope.enabled === false || scope.enablePan === false) return;
|
|
5931
|
+
handleKeyDown(event);
|
|
5932
|
+
}
|
|
5933
|
+
function onTouchStart(event) {
|
|
5934
|
+
trackPointer(event);
|
|
5935
|
+
switch (pointers.length) {
|
|
5936
|
+
case 1:
|
|
5937
|
+
switch (scope.touches.ONE) {
|
|
5938
|
+
case TOUCH.ROTATE:
|
|
5939
|
+
if (scope.enableRotate === false) return;
|
|
5940
|
+
handleTouchStartRotate();
|
|
5941
|
+
state = STATE.TOUCH_ROTATE;
|
|
5942
|
+
break;
|
|
5943
|
+
case TOUCH.PAN:
|
|
5944
|
+
if (scope.enablePan === false) return;
|
|
5945
|
+
handleTouchStartPan();
|
|
5946
|
+
state = STATE.TOUCH_PAN;
|
|
5947
|
+
break;
|
|
5948
|
+
default:
|
|
5949
|
+
state = STATE.NONE;
|
|
5950
|
+
}
|
|
5951
|
+
break;
|
|
5952
|
+
case 2:
|
|
5953
|
+
switch (scope.touches.TWO) {
|
|
5954
|
+
case TOUCH.DOLLY_PAN:
|
|
5955
|
+
if (scope.enableZoom === false && scope.enablePan === false) return;
|
|
5956
|
+
handleTouchStartDollyPan();
|
|
5957
|
+
state = STATE.TOUCH_DOLLY_PAN;
|
|
5958
|
+
break;
|
|
5959
|
+
case TOUCH.DOLLY_ROTATE:
|
|
5960
|
+
if (scope.enableZoom === false && scope.enableRotate === false) return;
|
|
5961
|
+
handleTouchStartDollyRotate();
|
|
5962
|
+
state = STATE.TOUCH_DOLLY_ROTATE;
|
|
5963
|
+
break;
|
|
5964
|
+
default:
|
|
5965
|
+
state = STATE.NONE;
|
|
5966
|
+
}
|
|
5967
|
+
break;
|
|
5968
|
+
default:
|
|
5969
|
+
state = STATE.NONE;
|
|
6043
5970
|
}
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
}
|
|
6047
|
-
function handleMouseMovePan(event) {
|
|
6048
|
-
panEnd.set(event.clientX, event.clientY);
|
|
6049
|
-
panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);
|
|
6050
|
-
pan(panDelta.x, panDelta.y);
|
|
6051
|
-
panStart.copy(panEnd);
|
|
6052
|
-
scope.update();
|
|
6053
|
-
}
|
|
6054
|
-
function handleMouseUp() {
|
|
6055
|
-
}
|
|
6056
|
-
function handleMouseWheel(event) {
|
|
6057
|
-
if (event.deltaY < 0) {
|
|
6058
|
-
dollyIn(getZoomScale());
|
|
6059
|
-
} else if (event.deltaY > 0) {
|
|
6060
|
-
dollyOut(getZoomScale());
|
|
5971
|
+
if (state !== STATE.NONE) {
|
|
5972
|
+
scope.dispatchEvent(_startEvent);
|
|
6061
5973
|
}
|
|
6062
|
-
scope.update();
|
|
6063
5974
|
}
|
|
6064
|
-
function
|
|
6065
|
-
|
|
6066
|
-
switch (
|
|
6067
|
-
case
|
|
6068
|
-
|
|
6069
|
-
|
|
5975
|
+
function onTouchMove(event) {
|
|
5976
|
+
trackPointer(event);
|
|
5977
|
+
switch (state) {
|
|
5978
|
+
case STATE.TOUCH_ROTATE:
|
|
5979
|
+
if (scope.enableRotate === false) return;
|
|
5980
|
+
handleTouchMoveRotate(event);
|
|
5981
|
+
scope.update();
|
|
6070
5982
|
break;
|
|
6071
|
-
case
|
|
6072
|
-
|
|
6073
|
-
|
|
5983
|
+
case STATE.TOUCH_PAN:
|
|
5984
|
+
if (scope.enablePan === false) return;
|
|
5985
|
+
handleTouchMovePan(event);
|
|
5986
|
+
scope.update();
|
|
6074
5987
|
break;
|
|
6075
|
-
case
|
|
6076
|
-
|
|
6077
|
-
|
|
5988
|
+
case STATE.TOUCH_DOLLY_PAN:
|
|
5989
|
+
if (scope.enableZoom === false && scope.enablePan === false) return;
|
|
5990
|
+
handleTouchMoveDollyPan(event);
|
|
5991
|
+
scope.update();
|
|
6078
5992
|
break;
|
|
6079
|
-
case
|
|
6080
|
-
|
|
6081
|
-
|
|
5993
|
+
case STATE.TOUCH_DOLLY_ROTATE:
|
|
5994
|
+
if (scope.enableZoom === false && scope.enableRotate === false) return;
|
|
5995
|
+
handleTouchMoveDollyRotate(event);
|
|
5996
|
+
scope.update();
|
|
6082
5997
|
break;
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
event.preventDefault();
|
|
6086
|
-
scope.update();
|
|
5998
|
+
default:
|
|
5999
|
+
state = STATE.NONE;
|
|
6087
6000
|
}
|
|
6088
6001
|
}
|
|
6089
|
-
function
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6002
|
+
function onTouchEnd(event) {
|
|
6003
|
+
handleTouchEnd(event);
|
|
6004
|
+
scope.dispatchEvent(_endEvent);
|
|
6005
|
+
state = STATE.NONE;
|
|
6006
|
+
}
|
|
6007
|
+
function onContextMenu(event) {
|
|
6008
|
+
if (scope.enabled === false) return;
|
|
6009
|
+
event.preventDefault();
|
|
6010
|
+
}
|
|
6011
|
+
function addPointer(event) {
|
|
6012
|
+
pointers.push(event);
|
|
6013
|
+
}
|
|
6014
|
+
function removePointer(event) {
|
|
6015
|
+
delete pointerPositions[event.pointerId];
|
|
6016
|
+
for (let i = 0; i < pointers.length; i++) {
|
|
6017
|
+
if (pointers[i].pointerId == event.pointerId) {
|
|
6018
|
+
pointers.splice(i, 1);
|
|
6019
|
+
return;
|
|
6020
|
+
}
|
|
6096
6021
|
}
|
|
6097
6022
|
}
|
|
6098
|
-
function
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);
|
|
6104
|
-
panStart.set(x, y);
|
|
6023
|
+
function trackPointer(event) {
|
|
6024
|
+
let position = pointerPositions[event.pointerId];
|
|
6025
|
+
if (position === void 0) {
|
|
6026
|
+
position = new Vector23();
|
|
6027
|
+
pointerPositions[event.pointerId] = position;
|
|
6105
6028
|
}
|
|
6029
|
+
position.set(event.pageX, event.pageY);
|
|
6106
6030
|
}
|
|
6107
|
-
function
|
|
6108
|
-
const
|
|
6109
|
-
|
|
6110
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
6111
|
-
dollyStart.set(0, distance);
|
|
6031
|
+
function getSecondPointerPosition(event) {
|
|
6032
|
+
const pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0];
|
|
6033
|
+
return pointerPositions[pointer.pointerId];
|
|
6112
6034
|
}
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6035
|
+
scope.domElement.addEventListener("contextmenu", onContextMenu);
|
|
6036
|
+
scope.domElement.addEventListener("pointerdown", onPointerDown);
|
|
6037
|
+
scope.domElement.addEventListener("pointercancel", onPointerCancel);
|
|
6038
|
+
scope.domElement.addEventListener("wheel", onMouseWheel, { passive: false });
|
|
6039
|
+
this.update();
|
|
6040
|
+
}
|
|
6041
|
+
};
|
|
6042
|
+
var MapControls = class extends OrbitControls {
|
|
6043
|
+
constructor(object, domElement) {
|
|
6044
|
+
super(object, domElement);
|
|
6045
|
+
this.screenSpacePanning = false;
|
|
6046
|
+
this.mouseButtons.LEFT = MOUSE.PAN;
|
|
6047
|
+
this.mouseButtons.RIGHT = MOUSE.ROTATE;
|
|
6048
|
+
this.touches.ONE = TOUCH.PAN;
|
|
6049
|
+
this.touches.TWO = TOUCH.DOLLY_ROTATE;
|
|
6050
|
+
}
|
|
6051
|
+
};
|
|
6052
|
+
|
|
6053
|
+
// src/renderer/Renderer.ts
|
|
6054
|
+
var _Renderer = class _Renderer {
|
|
6055
|
+
constructor(options) {
|
|
6056
|
+
this._dirty = true;
|
|
6057
|
+
this._animationTimer = void 0;
|
|
6058
|
+
this._animationFrame = void 0;
|
|
6059
|
+
this._resizeListener = void 0;
|
|
6060
|
+
this._disposed = false;
|
|
6061
|
+
this._debugHelpers = [];
|
|
6062
|
+
this._eventDispatchers = /* @__PURE__ */ new Map();
|
|
6063
|
+
this._changeListener = () => {
|
|
6064
|
+
this._dirty = true;
|
|
6065
|
+
};
|
|
6066
|
+
this.options = (0, import_ts_deepmerge10.default)({}, _Renderer.DEFAULT_OPTIONS, options ?? {});
|
|
6067
|
+
this._animationLoop = this.animate.bind(this);
|
|
6068
|
+
this._fpsTimer = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
6069
|
+
this._scene = this.createScene();
|
|
6070
|
+
this._camera = this.createCamera();
|
|
6071
|
+
this._renderer = this.createRenderer();
|
|
6072
|
+
this._composer = this.createComposer();
|
|
6073
|
+
if (this.options.render.stats) {
|
|
6074
|
+
this._stats = new Stats();
|
|
6075
|
+
document.body.appendChild(this._stats.dom);
|
|
6116
6076
|
}
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6077
|
+
this.init();
|
|
6078
|
+
this._controls = this.createControls();
|
|
6079
|
+
}
|
|
6080
|
+
//<editor-fold desc="INIT">
|
|
6081
|
+
createScene() {
|
|
6082
|
+
return new MineRenderScene();
|
|
6083
|
+
}
|
|
6084
|
+
createCamera() {
|
|
6085
|
+
switch (this.options.camera.type) {
|
|
6086
|
+
case "perspective":
|
|
6087
|
+
default:
|
|
6088
|
+
return new PerspectiveCamera(
|
|
6089
|
+
this.options.camera.perspective.fov,
|
|
6090
|
+
this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
|
|
6091
|
+
this.options.camera.near,
|
|
6092
|
+
this.options.camera.far
|
|
6093
|
+
);
|
|
6094
|
+
case "orthographic":
|
|
6095
|
+
return new OrthographicCamera(
|
|
6096
|
+
this.options.camera.orthographic.left ?? this.viewWidth / -2,
|
|
6097
|
+
this.options.camera.orthographic.right ?? this.viewWidth / 2,
|
|
6098
|
+
this.options.camera.orthographic.top ?? this.viewHeight / 2,
|
|
6099
|
+
this.options.camera.orthographic.bottom ?? this.viewHeight / -2,
|
|
6100
|
+
this.options.camera.near,
|
|
6101
|
+
this.options.camera.far
|
|
6102
|
+
);
|
|
6120
6103
|
}
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6104
|
+
}
|
|
6105
|
+
createRenderer() {
|
|
6106
|
+
const renderer = new WebGLRenderer({
|
|
6107
|
+
antialias: this.options.render.antialias,
|
|
6108
|
+
alpha: true,
|
|
6109
|
+
powerPreference: "high-performance",
|
|
6110
|
+
depth: true
|
|
6111
|
+
});
|
|
6112
|
+
renderer.setClearColor(0, 0);
|
|
6113
|
+
renderer.shadowMap.enabled = true;
|
|
6114
|
+
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
6115
|
+
renderer.outputEncoding = LinearEncoding;
|
|
6116
|
+
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
6117
|
+
return renderer;
|
|
6118
|
+
}
|
|
6119
|
+
createComposer() {
|
|
6120
|
+
const composer = new EffectComposer(this.renderer);
|
|
6121
|
+
if (!this.options.composer.enabled) return composer;
|
|
6122
|
+
composer.setSize(this.viewWidth, this.viewHeight);
|
|
6123
|
+
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
6124
|
+
return composer;
|
|
6125
|
+
}
|
|
6126
|
+
createControls() {
|
|
6127
|
+
if (!this.options.controls?.enabled) return void 0;
|
|
6128
|
+
const position = this.camera.position.clone();
|
|
6129
|
+
const controls = new OrbitControls(this.camera, this.renderer.domElement);
|
|
6130
|
+
this.camera.position.copy(position);
|
|
6131
|
+
const target = this.options.camera.lookingAt;
|
|
6132
|
+
if (isVector3(target)) {
|
|
6133
|
+
controls.target.copy(target);
|
|
6134
|
+
} else if (isTripleArray(target)) {
|
|
6135
|
+
controls.target.set(target[0], target[1], target[2]);
|
|
6136
|
+
}
|
|
6137
|
+
controls.update();
|
|
6138
|
+
controls.saveState();
|
|
6139
|
+
this.registerEventDispatcher(controls);
|
|
6140
|
+
return controls;
|
|
6141
|
+
}
|
|
6142
|
+
//</editor-fold>
|
|
6143
|
+
init() {
|
|
6144
|
+
if (this._disposed) return;
|
|
6145
|
+
if (typeof window["__THREE_DEVTOOLS__"] !== "undefined") {
|
|
6146
|
+
window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
|
|
6135
6147
|
}
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6148
|
+
if (this.options.debug.grid) {
|
|
6149
|
+
const gridHelper = new GridHelper(128, 16);
|
|
6150
|
+
this._debugHelpers.push(gridHelper);
|
|
6151
|
+
this.scene.add(gridHelper);
|
|
6152
|
+
const gridHelper2 = new GridHelper(128, 16);
|
|
6153
|
+
this._debugHelpers.push(gridHelper2);
|
|
6154
|
+
gridHelper2.rotation.x = 90 * (Math.PI / 180);
|
|
6155
|
+
this.scene.add(gridHelper2);
|
|
6156
|
+
const gridHelper3 = new GridHelper(128, 16);
|
|
6157
|
+
this._debugHelpers.push(gridHelper3);
|
|
6158
|
+
gridHelper3.rotation.z = 90 * (Math.PI / 180);
|
|
6159
|
+
this.scene.add(gridHelper3);
|
|
6160
|
+
}
|
|
6161
|
+
if (this.options.debug.axes) {
|
|
6162
|
+
const axesHelper = new AxesHelper3(64);
|
|
6163
|
+
this._debugHelpers.push(axesHelper);
|
|
6164
|
+
this.scene.add(axesHelper);
|
|
6165
|
+
}
|
|
6166
|
+
if (this.options.camera.position) {
|
|
6167
|
+
if (isVector3(this.options.camera.position)) {
|
|
6168
|
+
this.camera.position.set(this.options.camera.position.x, this.options.camera.position.y, this.options.camera.position.z);
|
|
6169
|
+
} else if (isTripleArray(this.options.camera.position)) {
|
|
6170
|
+
this.camera.position.set(this.options.camera.position[0], this.options.camera.position[1], this.options.camera.position[2]);
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
if (this.options.camera.lookingAt) {
|
|
6174
|
+
if (isVector3(this.options.camera.lookingAt)) {
|
|
6175
|
+
this.camera.lookAt(this.options.camera.lookingAt);
|
|
6176
|
+
} else if (isTripleArray(this.options.camera.lookingAt)) {
|
|
6177
|
+
this.camera.lookAt(this.options.camera.lookingAt[0], this.options.camera.lookingAt[1], this.options.camera.lookingAt[2]);
|
|
6144
6178
|
}
|
|
6145
|
-
panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);
|
|
6146
|
-
pan(panDelta.x, panDelta.y);
|
|
6147
|
-
panStart.copy(panEnd);
|
|
6148
6179
|
}
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
dollyEnd.set(0, distance);
|
|
6155
|
-
dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed));
|
|
6156
|
-
dollyOut(dollyDelta.y);
|
|
6157
|
-
dollyStart.copy(dollyEnd);
|
|
6180
|
+
if (this.options.render.autoResize && !this._resizeListener) {
|
|
6181
|
+
this._resizeListener = () => {
|
|
6182
|
+
this.resize(this.viewWidth, this.viewHeight);
|
|
6183
|
+
};
|
|
6184
|
+
window.addEventListener("resize", this._resizeListener);
|
|
6158
6185
|
}
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6186
|
+
}
|
|
6187
|
+
get element() {
|
|
6188
|
+
return this._element;
|
|
6189
|
+
}
|
|
6190
|
+
appendTo(element) {
|
|
6191
|
+
if (this._disposed) return;
|
|
6192
|
+
this._element = element;
|
|
6193
|
+
this._element.appendChild(this.renderer.domElement);
|
|
6194
|
+
if (this.viewWidth == 0) {
|
|
6195
|
+
console.warn("0 element width");
|
|
6162
6196
|
}
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
if (scope.enableRotate) handleTouchMoveRotate(event);
|
|
6197
|
+
if (this.viewHeight == 0) {
|
|
6198
|
+
console.warn("0 element height");
|
|
6166
6199
|
}
|
|
6167
|
-
|
|
6200
|
+
this.resize(this.viewWidth, this.viewHeight);
|
|
6201
|
+
}
|
|
6202
|
+
/**
|
|
6203
|
+
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
6204
|
+
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
6205
|
+
*/
|
|
6206
|
+
registerEventDispatcher(dispatcher, changeEvent2 = "change") {
|
|
6207
|
+
if (this._disposed) return;
|
|
6208
|
+
let events = this._eventDispatchers.get(dispatcher);
|
|
6209
|
+
if (!events) {
|
|
6210
|
+
events = /* @__PURE__ */ new Set();
|
|
6211
|
+
this._eventDispatchers.set(dispatcher, events);
|
|
6168
6212
|
}
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6213
|
+
if (events.has(changeEvent2)) return;
|
|
6214
|
+
events.add(changeEvent2);
|
|
6215
|
+
dispatcher.addEventListener(changeEvent2, this._changeListener);
|
|
6216
|
+
}
|
|
6217
|
+
resize(width, height) {
|
|
6218
|
+
if (this._disposed) return;
|
|
6219
|
+
if (isPerspectiveCamera(this.camera)) {
|
|
6220
|
+
this.camera.aspect = width / height;
|
|
6221
|
+
this.camera.updateProjectionMatrix();
|
|
6222
|
+
} else if (isOrthographicCamera(this.camera)) {
|
|
6223
|
+
this.camera.left = width / -2;
|
|
6224
|
+
this.camera.right = width / 2;
|
|
6225
|
+
this.camera.top = height / 2;
|
|
6226
|
+
this.camera.bottom = height / -2;
|
|
6227
|
+
this.camera.updateProjectionMatrix();
|
|
6182
6228
|
}
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6229
|
+
this.renderer.setSize(width, height);
|
|
6230
|
+
this.composer.setSize(width, height);
|
|
6231
|
+
this._dirty = true;
|
|
6232
|
+
}
|
|
6233
|
+
//<editor-fold desc="RENDER">
|
|
6234
|
+
get dirty() {
|
|
6235
|
+
return this._dirty || this.scene.dirty;
|
|
6236
|
+
}
|
|
6237
|
+
set dirty(dirty) {
|
|
6238
|
+
this._dirty = dirty;
|
|
6239
|
+
this.scene.dirty = dirty;
|
|
6240
|
+
}
|
|
6241
|
+
start() {
|
|
6242
|
+
if (this._disposed) return;
|
|
6243
|
+
this.stop();
|
|
6244
|
+
this.renderer.setAnimationLoop(this._animationLoop);
|
|
6245
|
+
}
|
|
6246
|
+
stop() {
|
|
6247
|
+
if (this._disposed) return;
|
|
6248
|
+
this.renderer.setAnimationLoop(null);
|
|
6249
|
+
if (this._animationTimer)
|
|
6250
|
+
clearTimeout(this._animationTimer);
|
|
6251
|
+
this._animationTimer = void 0;
|
|
6252
|
+
if (this._animationFrame)
|
|
6253
|
+
cancelAnimationFrame(this._animationFrame);
|
|
6254
|
+
this._animationFrame = void 0;
|
|
6255
|
+
}
|
|
6256
|
+
/**
|
|
6257
|
+
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
6258
|
+
* renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
|
|
6259
|
+
* controls must be managed by their owners.
|
|
6260
|
+
*/
|
|
6261
|
+
dispose() {
|
|
6262
|
+
if (this._disposed) return;
|
|
6263
|
+
this.stop();
|
|
6264
|
+
this._disposed = true;
|
|
6265
|
+
if (this._resizeListener) {
|
|
6266
|
+
window.removeEventListener("resize", this._resizeListener);
|
|
6267
|
+
this._resizeListener = void 0;
|
|
6268
|
+
}
|
|
6269
|
+
for (const [dispatcher, events] of this._eventDispatchers) {
|
|
6270
|
+
for (const event of events) {
|
|
6271
|
+
dispatcher.removeEventListener(event, this._changeListener);
|
|
6272
|
+
}
|
|
6273
|
+
}
|
|
6274
|
+
this._eventDispatchers.clear();
|
|
6275
|
+
this._stats?.dom.remove();
|
|
6276
|
+
this._stats = void 0;
|
|
6277
|
+
this.renderer.domElement.remove();
|
|
6278
|
+
this._element = void 0;
|
|
6279
|
+
if (this._controls) {
|
|
6280
|
+
const controls = this._controls;
|
|
6281
|
+
this._controls = void 0;
|
|
6282
|
+
controls.enabled = false;
|
|
6283
|
+
controls.dispose();
|
|
6284
|
+
}
|
|
6285
|
+
this.scene.clear();
|
|
6286
|
+
for (const helper of this._debugHelpers) {
|
|
6287
|
+
helper.geometry.dispose();
|
|
6288
|
+
const materials = Array.isArray(helper.material) ? helper.material : [helper.material];
|
|
6289
|
+
for (const material of materials) {
|
|
6290
|
+
material.dispose();
|
|
6291
|
+
}
|
|
6292
|
+
}
|
|
6293
|
+
this._debugHelpers.length = 0;
|
|
6294
|
+
this.composer.dispose();
|
|
6295
|
+
this.renderer.dispose();
|
|
6296
|
+
this.renderer.forceContextLoss();
|
|
6297
|
+
}
|
|
6298
|
+
animate(t) {
|
|
6299
|
+
if (this._disposed) return;
|
|
6300
|
+
if (this._stats) {
|
|
6301
|
+
this._stats.begin();
|
|
6190
6302
|
}
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6303
|
+
if (this._controls?.enabled) {
|
|
6304
|
+
this._controls.update();
|
|
6305
|
+
}
|
|
6306
|
+
if (this._disposed) return;
|
|
6307
|
+
if (this.dirty || this.options.render.renderAlways) {
|
|
6308
|
+
if (this.options.composer.enabled) {
|
|
6309
|
+
this.composer.render();
|
|
6195
6310
|
} else {
|
|
6196
|
-
|
|
6197
|
-
}
|
|
6198
|
-
removePointer(event);
|
|
6199
|
-
if (pointers.length === 0) {
|
|
6200
|
-
scope.domElement.releasePointerCapture(event.pointerId);
|
|
6201
|
-
scope.domElement.removeEventListener("pointermove", onPointerMove);
|
|
6202
|
-
scope.domElement.removeEventListener("pointerup", onPointerUp);
|
|
6311
|
+
this.renderer.render(this.scene, this.camera);
|
|
6203
6312
|
}
|
|
6204
6313
|
}
|
|
6205
|
-
|
|
6206
|
-
|
|
6314
|
+
this.dirty = false;
|
|
6315
|
+
if (this._stats) {
|
|
6316
|
+
this._stats.end();
|
|
6207
6317
|
}
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6318
|
+
}
|
|
6319
|
+
//</editor-fold>
|
|
6320
|
+
toImage() {
|
|
6321
|
+
return this.renderer.domElement.toDataURL();
|
|
6322
|
+
}
|
|
6323
|
+
///
|
|
6324
|
+
get attachedToBody() {
|
|
6325
|
+
return this.element === document.body;
|
|
6326
|
+
}
|
|
6327
|
+
get viewWidth() {
|
|
6328
|
+
return this.attachedToBody ? window.innerWidth : this.element?.offsetWidth || 0;
|
|
6329
|
+
}
|
|
6330
|
+
get viewHeight() {
|
|
6331
|
+
return this.attachedToBody ? window.innerHeight : this.element?.offsetHeight || 0;
|
|
6332
|
+
}
|
|
6333
|
+
get scene() {
|
|
6334
|
+
return this._scene;
|
|
6335
|
+
}
|
|
6336
|
+
get camera() {
|
|
6337
|
+
return this._camera;
|
|
6338
|
+
}
|
|
6339
|
+
get renderer() {
|
|
6340
|
+
return this._renderer;
|
|
6341
|
+
}
|
|
6342
|
+
get composer() {
|
|
6343
|
+
return this._composer;
|
|
6344
|
+
}
|
|
6345
|
+
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
6346
|
+
get controls() {
|
|
6347
|
+
return this._controls;
|
|
6348
|
+
}
|
|
6349
|
+
///
|
|
6350
|
+
};
|
|
6351
|
+
_Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge10.default)({}, {
|
|
6352
|
+
camera: {
|
|
6353
|
+
type: "perspective",
|
|
6354
|
+
near: 1,
|
|
6355
|
+
far: 5e3,
|
|
6356
|
+
perspective: {
|
|
6357
|
+
aspect: void 0,
|
|
6358
|
+
fov: 50
|
|
6359
|
+
},
|
|
6360
|
+
orthographic: {
|
|
6361
|
+
left: void 0,
|
|
6362
|
+
right: void 0,
|
|
6363
|
+
top: void 0,
|
|
6364
|
+
bottom: void 0
|
|
6365
|
+
},
|
|
6366
|
+
position: new Vector38(50, 50, 50),
|
|
6367
|
+
lookingAt: new Vector38(0, 0, 0)
|
|
6368
|
+
},
|
|
6369
|
+
render: {
|
|
6370
|
+
fpsLimit: 60,
|
|
6371
|
+
stats: false,
|
|
6372
|
+
antialias: true,
|
|
6373
|
+
shade: true,
|
|
6374
|
+
autoResize: true,
|
|
6375
|
+
renderAlways: false
|
|
6376
|
+
},
|
|
6377
|
+
composer: {
|
|
6378
|
+
enabled: true
|
|
6379
|
+
},
|
|
6380
|
+
controls: {
|
|
6381
|
+
enabled: false
|
|
6382
|
+
},
|
|
6383
|
+
debug: {
|
|
6384
|
+
grid: false,
|
|
6385
|
+
axes: false
|
|
6386
|
+
}
|
|
6387
|
+
});
|
|
6388
|
+
var Renderer = _Renderer;
|
|
6389
|
+
|
|
6390
|
+
// src/skin/Skins.ts
|
|
6391
|
+
var Skins = class {
|
|
6392
|
+
//<editor-fold desc="Skins">
|
|
6393
|
+
static async fromUuidOrUsername(uuidOrUsername) {
|
|
6394
|
+
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
6395
|
+
return this.fromUuid(uuidOrUsername);
|
|
6396
|
+
}
|
|
6397
|
+
return this.fromUsername(uuidOrUsername);
|
|
6398
|
+
}
|
|
6399
|
+
static async fromUuid(uuid) {
|
|
6400
|
+
return this.getSkinProxySkinUrl(uuid);
|
|
6401
|
+
}
|
|
6402
|
+
static async fromUsername(username) {
|
|
6403
|
+
return this.usernameToUuid(username).then((uuid) => {
|
|
6404
|
+
if (uuid) {
|
|
6405
|
+
return this.fromUuid(uuid);
|
|
6253
6406
|
}
|
|
6254
|
-
|
|
6255
|
-
|
|
6407
|
+
return void 0;
|
|
6408
|
+
});
|
|
6409
|
+
}
|
|
6410
|
+
static async fromMineSkin(mineskinId) {
|
|
6411
|
+
return this.getMineSkin(mineskinId).then((mineskin) => {
|
|
6412
|
+
if (mineskin) {
|
|
6413
|
+
return mineskin["data"]["texture"]["value"]["urls"]["skins"];
|
|
6256
6414
|
}
|
|
6415
|
+
return void 0;
|
|
6416
|
+
});
|
|
6417
|
+
}
|
|
6418
|
+
//</editor-fold>
|
|
6419
|
+
//<editor-fold desc="Capes">
|
|
6420
|
+
static async capeFromUuidOrUsername(uuidOrUsername) {
|
|
6421
|
+
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
6422
|
+
return this.capeFromUuid(uuidOrUsername);
|
|
6257
6423
|
}
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
handleMouseMoveDolly(event);
|
|
6268
|
-
break;
|
|
6269
|
-
case STATE.PAN:
|
|
6270
|
-
if (scope.enablePan === false) return;
|
|
6271
|
-
handleMouseMovePan(event);
|
|
6272
|
-
break;
|
|
6424
|
+
return this.capeFromUsername(uuidOrUsername);
|
|
6425
|
+
}
|
|
6426
|
+
static async capeFromUuid(uuid) {
|
|
6427
|
+
return this.getSkinProxyCapeUrl(uuid);
|
|
6428
|
+
}
|
|
6429
|
+
static async capeFromUsername(username) {
|
|
6430
|
+
return this.usernameToUuid(username).then((uuid) => {
|
|
6431
|
+
if (uuid) {
|
|
6432
|
+
return this.capeFromUuid(uuid);
|
|
6273
6433
|
}
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;
|
|
6282
|
-
event.preventDefault();
|
|
6283
|
-
scope.dispatchEvent(_startEvent);
|
|
6284
|
-
handleMouseWheel(event);
|
|
6285
|
-
scope.dispatchEvent(_endEvent);
|
|
6286
|
-
}
|
|
6287
|
-
function onKeyDown(event) {
|
|
6288
|
-
if (scope.enabled === false || scope.enablePan === false) return;
|
|
6289
|
-
handleKeyDown(event);
|
|
6290
|
-
}
|
|
6291
|
-
function onTouchStart(event) {
|
|
6292
|
-
trackPointer(event);
|
|
6293
|
-
switch (pointers.length) {
|
|
6294
|
-
case 1:
|
|
6295
|
-
switch (scope.touches.ONE) {
|
|
6296
|
-
case TOUCH.ROTATE:
|
|
6297
|
-
if (scope.enableRotate === false) return;
|
|
6298
|
-
handleTouchStartRotate();
|
|
6299
|
-
state = STATE.TOUCH_ROTATE;
|
|
6300
|
-
break;
|
|
6301
|
-
case TOUCH.PAN:
|
|
6302
|
-
if (scope.enablePan === false) return;
|
|
6303
|
-
handleTouchStartPan();
|
|
6304
|
-
state = STATE.TOUCH_PAN;
|
|
6305
|
-
break;
|
|
6306
|
-
default:
|
|
6307
|
-
state = STATE.NONE;
|
|
6308
|
-
}
|
|
6309
|
-
break;
|
|
6310
|
-
case 2:
|
|
6311
|
-
switch (scope.touches.TWO) {
|
|
6312
|
-
case TOUCH.DOLLY_PAN:
|
|
6313
|
-
if (scope.enableZoom === false && scope.enablePan === false) return;
|
|
6314
|
-
handleTouchStartDollyPan();
|
|
6315
|
-
state = STATE.TOUCH_DOLLY_PAN;
|
|
6316
|
-
break;
|
|
6317
|
-
case TOUCH.DOLLY_ROTATE:
|
|
6318
|
-
if (scope.enableZoom === false && scope.enableRotate === false) return;
|
|
6319
|
-
handleTouchStartDollyRotate();
|
|
6320
|
-
state = STATE.TOUCH_DOLLY_ROTATE;
|
|
6321
|
-
break;
|
|
6322
|
-
default:
|
|
6323
|
-
state = STATE.NONE;
|
|
6324
|
-
}
|
|
6325
|
-
break;
|
|
6326
|
-
default:
|
|
6327
|
-
state = STATE.NONE;
|
|
6434
|
+
return void 0;
|
|
6435
|
+
});
|
|
6436
|
+
}
|
|
6437
|
+
static async capeFromCapesDev(uuid, capeType = "minecraft") {
|
|
6438
|
+
return this.getCapesDev(uuid, capeType).then((cape) => {
|
|
6439
|
+
if (cape) {
|
|
6440
|
+
return cape?.stillImageUrl;
|
|
6328
6441
|
}
|
|
6329
|
-
|
|
6330
|
-
|
|
6442
|
+
return void 0;
|
|
6443
|
+
});
|
|
6444
|
+
}
|
|
6445
|
+
//</editor-fold>
|
|
6446
|
+
//<editor-fold desc="Helpers">
|
|
6447
|
+
static async usernameToUuid(username) {
|
|
6448
|
+
return this.usernameToUuidSkinProxy(username);
|
|
6449
|
+
}
|
|
6450
|
+
static async usernameToUuidSkinProxy(username) {
|
|
6451
|
+
return Requests.genericRequest({
|
|
6452
|
+
baseURL: "https://minecraft-skin-proxy.inventive.workers.dev",
|
|
6453
|
+
url: "/uuid/" + username
|
|
6454
|
+
}).then((res) => {
|
|
6455
|
+
if (res.status === 200) {
|
|
6456
|
+
return res.data["id"];
|
|
6331
6457
|
}
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
break;
|
|
6346
|
-
case STATE.TOUCH_DOLLY_PAN:
|
|
6347
|
-
if (scope.enableZoom === false && scope.enablePan === false) return;
|
|
6348
|
-
handleTouchMoveDollyPan(event);
|
|
6349
|
-
scope.update();
|
|
6350
|
-
break;
|
|
6351
|
-
case STATE.TOUCH_DOLLY_ROTATE:
|
|
6352
|
-
if (scope.enableZoom === false && scope.enableRotate === false) return;
|
|
6353
|
-
handleTouchMoveDollyRotate(event);
|
|
6354
|
-
scope.update();
|
|
6355
|
-
break;
|
|
6356
|
-
default:
|
|
6357
|
-
state = STATE.NONE;
|
|
6458
|
+
return void 0;
|
|
6459
|
+
}).catch((err) => {
|
|
6460
|
+
console.warn(err);
|
|
6461
|
+
return void 0;
|
|
6462
|
+
});
|
|
6463
|
+
}
|
|
6464
|
+
static async usernameToUuidMineTools(username) {
|
|
6465
|
+
return Requests.genericRequest({
|
|
6466
|
+
baseURL: "https://api.minetools.eu",
|
|
6467
|
+
url: "/uuid/" + username
|
|
6468
|
+
}).then((res) => {
|
|
6469
|
+
if (res.status === 200) {
|
|
6470
|
+
return res.data["id"];
|
|
6358
6471
|
}
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
function removePointer(event) {
|
|
6373
|
-
delete pointerPositions[event.pointerId];
|
|
6374
|
-
for (let i = 0; i < pointers.length; i++) {
|
|
6375
|
-
if (pointers[i].pointerId == event.pointerId) {
|
|
6376
|
-
pointers.splice(i, 1);
|
|
6377
|
-
return;
|
|
6378
|
-
}
|
|
6472
|
+
return void 0;
|
|
6473
|
+
}).catch((err) => {
|
|
6474
|
+
console.warn(err);
|
|
6475
|
+
return void 0;
|
|
6476
|
+
});
|
|
6477
|
+
}
|
|
6478
|
+
static async getProfileFromMinetools(uuid) {
|
|
6479
|
+
return Requests.genericRequest({
|
|
6480
|
+
baseURL: "https://api.minetools.eu",
|
|
6481
|
+
url: "/profile/" + uuid
|
|
6482
|
+
}).then((res) => {
|
|
6483
|
+
if (res.status === 200) {
|
|
6484
|
+
return res.data;
|
|
6379
6485
|
}
|
|
6380
|
-
}
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6486
|
+
});
|
|
6487
|
+
}
|
|
6488
|
+
static async getMineSkin(mineskinId) {
|
|
6489
|
+
return Requests.genericRequest({
|
|
6490
|
+
baseURL: "https://api.mineskin.org",
|
|
6491
|
+
url: "/get/uuid/" + mineskinId
|
|
6492
|
+
}).then((res) => {
|
|
6493
|
+
if (res.status === 200) {
|
|
6494
|
+
return res.data;
|
|
6386
6495
|
}
|
|
6387
|
-
|
|
6388
|
-
}
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
}
|
|
6393
|
-
scope.domElement.addEventListener("contextmenu", onContextMenu);
|
|
6394
|
-
scope.domElement.addEventListener("pointerdown", onPointerDown);
|
|
6395
|
-
scope.domElement.addEventListener("pointercancel", onPointerCancel);
|
|
6396
|
-
scope.domElement.addEventListener("wheel", onMouseWheel, { passive: false });
|
|
6397
|
-
this.update();
|
|
6496
|
+
return void 0;
|
|
6497
|
+
}).catch((err) => {
|
|
6498
|
+
console.warn(err);
|
|
6499
|
+
return void 0;
|
|
6500
|
+
});
|
|
6398
6501
|
}
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6502
|
+
static async getCapesDev(uuid, type = "all") {
|
|
6503
|
+
return Requests.genericRequest({
|
|
6504
|
+
baseURL: "https://api.capes.dev",
|
|
6505
|
+
url: "/load/" + uuid + "/" + type
|
|
6506
|
+
}).then((res) => {
|
|
6507
|
+
if (res.status === 200) {
|
|
6508
|
+
return res.data;
|
|
6509
|
+
}
|
|
6510
|
+
return void 0;
|
|
6511
|
+
}).catch((err) => {
|
|
6512
|
+
console.warn(err);
|
|
6513
|
+
return void 0;
|
|
6514
|
+
});
|
|
6515
|
+
}
|
|
6516
|
+
static getCrafatarSkinUrl(uuid) {
|
|
6517
|
+
return "https://crafatar.com/skins/" + uuid;
|
|
6408
6518
|
}
|
|
6519
|
+
static getCrafatarCapeUrl(uuid) {
|
|
6520
|
+
return "https://crafatar.com/capes/" + uuid;
|
|
6521
|
+
}
|
|
6522
|
+
static getMcHeadsSkinUrl(uuid) {
|
|
6523
|
+
return "https://mc-heads.net/skin/" + uuid;
|
|
6524
|
+
}
|
|
6525
|
+
static getMineSkinPlayerSkinUrl(uuid) {
|
|
6526
|
+
return "https://mineskin.org/skin/player/" + uuid;
|
|
6527
|
+
}
|
|
6528
|
+
static getSkinProxySkinUrl(uuid) {
|
|
6529
|
+
return "https://minecraft-skin-proxy.inventive.workers.dev/skin/" + uuid;
|
|
6530
|
+
}
|
|
6531
|
+
static getSkinProxyCapeUrl(uuid) {
|
|
6532
|
+
return "https://minecraft-skin-proxy.inventive.workers.dev/cape/" + uuid;
|
|
6533
|
+
}
|
|
6534
|
+
//</editor-fold>
|
|
6409
6535
|
};
|
|
6410
6536
|
|
|
6411
6537
|
// src/world/Chunk.ts
|