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