minerender 2.1.0-alpha.18 → 2.1.0-alpha.19
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/dist/browser/index.d.mts +9 -0
- package/dist/browser/index.d.ts +9 -0
- package/dist/browser/index.js +92 -17
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +141 -66
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +92 -17
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +9 -0
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.js +92 -17
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +141 -66
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -1087,7 +1087,7 @@ var Meshes = class _Meshes {
|
|
|
1087
1087
|
};
|
|
1088
1088
|
|
|
1089
1089
|
// src/UVMapper.ts
|
|
1090
|
-
import { Float32BufferAttribute as Float32BufferAttribute2, Vector2 } from "three";
|
|
1090
|
+
import { Float32BufferAttribute as Float32BufferAttribute2, Vector2, Vector3 as Vector33 } from "three";
|
|
1091
1091
|
|
|
1092
1092
|
// src/model/ModelMerger.ts
|
|
1093
1093
|
var import_ts_deepmerge = __toESM(require_dist());
|
|
@@ -2053,6 +2053,14 @@ var DEFAULT_UV = [0, 0, 16, 16];
|
|
|
2053
2053
|
var X = 0;
|
|
2054
2054
|
var Y = 1;
|
|
2055
2055
|
var Z = 2;
|
|
2056
|
+
var FACE_UV_AXES = {
|
|
2057
|
+
east: [new Vector33(0, 0, -1), new Vector33(0, -1, 0)],
|
|
2058
|
+
west: [new Vector33(0, 0, 1), new Vector33(0, -1, 0)],
|
|
2059
|
+
up: [new Vector33(1, 0, 0), new Vector33(0, 0, 1)],
|
|
2060
|
+
down: [new Vector33(1, 0, 0), new Vector33(0, 0, -1)],
|
|
2061
|
+
south: [new Vector33(1, 0, 0), new Vector33(0, -1, 0)],
|
|
2062
|
+
north: [new Vector33(-1, 0, 0), new Vector33(0, -1, 0)]
|
|
2063
|
+
};
|
|
2056
2064
|
var UVMapper = class {
|
|
2057
2065
|
static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
|
|
2058
2066
|
if (uvCoord === 0) return 0;
|
|
@@ -2150,6 +2158,42 @@ var UVMapper = class {
|
|
|
2150
2158
|
static facesToUv(faces, originalTextureSize, actualTextureSize) {
|
|
2151
2159
|
return new Float32BufferAttribute2(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
|
|
2152
2160
|
}
|
|
2161
|
+
static lockUvs(geometry, faces, atlas, rotation) {
|
|
2162
|
+
const uv = geometry.getAttribute("uv");
|
|
2163
|
+
for (let faceIndex = 0; faceIndex < CUBE_FACES.length; faceIndex++) {
|
|
2164
|
+
const faceName = CUBE_FACES[faceIndex];
|
|
2165
|
+
const texture = faces[faceName]?.texture?.substring(1);
|
|
2166
|
+
const position = texture && atlas.positions[texture];
|
|
2167
|
+
const size = texture && atlas.sizes[texture];
|
|
2168
|
+
if (!position || !size) continue;
|
|
2169
|
+
const [sourceU, sourceV] = FACE_UV_AXES[faceName];
|
|
2170
|
+
const uAxis = sourceU.clone().applyEuler(rotation);
|
|
2171
|
+
const vAxis = sourceV.clone().applyEuler(rotation);
|
|
2172
|
+
const normal = vAxis.clone().cross(uAxis);
|
|
2173
|
+
const targetFace = CUBE_FACES.find((name) => {
|
|
2174
|
+
const [u, v] = FACE_UV_AXES[name];
|
|
2175
|
+
return v.clone().cross(u).dot(normal) > 0.5;
|
|
2176
|
+
});
|
|
2177
|
+
const [targetU, targetV] = FACE_UV_AXES[targetFace];
|
|
2178
|
+
const uu = Math.round(targetU.dot(uAxis));
|
|
2179
|
+
const uvCross = Math.round(targetU.dot(vAxis));
|
|
2180
|
+
const vu = Math.round(targetV.dot(uAxis));
|
|
2181
|
+
const vv = Math.round(targetV.dot(vAxis));
|
|
2182
|
+
for (let corner = 0; corner < 4; corner++) {
|
|
2183
|
+
const index = faceIndex * 4 + corner;
|
|
2184
|
+
const u = (uv.getX(index) * atlas.image.width - position[0]) / size[0] - 0.5;
|
|
2185
|
+
const v = ((1 - uv.getY(index)) * atlas.image.height - position[1]) / size[1] - 0.5;
|
|
2186
|
+
const lockedU = uu * u + uvCross * v + 0.5;
|
|
2187
|
+
const lockedV = vu * u + vv * v + 0.5;
|
|
2188
|
+
uv.setXY(
|
|
2189
|
+
index,
|
|
2190
|
+
(position[0] + lockedU * size[0]) / atlas.image.width,
|
|
2191
|
+
1 - (position[1] + lockedV * size[1]) / atlas.image.height
|
|
2192
|
+
);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
uv.needsUpdate = true;
|
|
2196
|
+
}
|
|
2153
2197
|
static async getAtlas(model) {
|
|
2154
2198
|
const keyStr = model.key.serialize();
|
|
2155
2199
|
return Caching.modelTextureAtlasCache.get(keyStr, (k) => {
|
|
@@ -2596,7 +2640,7 @@ var BlockEntityModels = class {
|
|
|
2596
2640
|
};
|
|
2597
2641
|
|
|
2598
2642
|
// src/renderer/SceneObject.ts
|
|
2599
|
-
import { Euler, InstancedMesh, MathUtils, Matrix4 as Matrix42, Mesh as Mesh3, Object3D as Object3D2, Quaternion as Quaternion2, Vector3 as
|
|
2643
|
+
import { Euler as Euler2, InstancedMesh, MathUtils, Matrix4 as Matrix42, Mesh as Mesh3, Object3D as Object3D2, Quaternion as Quaternion2, Vector3 as Vector34 } from "three";
|
|
2600
2644
|
|
|
2601
2645
|
// src/instance/InstanceReference.ts
|
|
2602
2646
|
var InstanceReference = class {
|
|
@@ -2756,6 +2800,7 @@ var _SceneObject = class _SceneObject extends Object3D2 {
|
|
|
2756
2800
|
}
|
|
2757
2801
|
createInstancedMesh(name, geometry, material, count) {
|
|
2758
2802
|
const mesh = new InstancedMesh(geometry, material, count);
|
|
2803
|
+
mesh.count = 0;
|
|
2759
2804
|
if (name) {
|
|
2760
2805
|
mesh.name = `mesh:${name}`;
|
|
2761
2806
|
}
|
|
@@ -2833,6 +2878,10 @@ var _SceneObject = class _SceneObject extends Object3D2 {
|
|
|
2833
2878
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2834
2879
|
const i = this._instanceCounter++;
|
|
2835
2880
|
this.setMatrixAt(i, new Matrix42());
|
|
2881
|
+
const mesh = this.children[0];
|
|
2882
|
+
if (mesh && isInstancedMesh(mesh)) {
|
|
2883
|
+
mesh.count = Math.min(this._instanceCounter, mesh.instanceMatrix.count);
|
|
2884
|
+
}
|
|
2836
2885
|
console.debug(p6, "nextInstance " + i);
|
|
2837
2886
|
if (i === this.options.maxInstanceCount) {
|
|
2838
2887
|
console.warn(p6, "Max instance count reached for " + this);
|
|
@@ -2864,9 +2913,9 @@ var _SceneObject = class _SceneObject extends Object3D2 {
|
|
|
2864
2913
|
}
|
|
2865
2914
|
setPositionRotationScaleAt(index, position, rotation, scale) {
|
|
2866
2915
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2867
|
-
const oldPosition = new
|
|
2916
|
+
const oldPosition = new Vector34();
|
|
2868
2917
|
const oldRotation = new Quaternion2();
|
|
2869
|
-
const oldScale = new
|
|
2918
|
+
const oldScale = new Vector34();
|
|
2870
2919
|
const matrix = new Matrix42();
|
|
2871
2920
|
if (!scale || !rotation || !position) {
|
|
2872
2921
|
this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
|
|
@@ -2882,7 +2931,7 @@ var _SceneObject = class _SceneObject extends Object3D2 {
|
|
|
2882
2931
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2883
2932
|
this.setPositionRotationScaleAt(index, position);
|
|
2884
2933
|
}
|
|
2885
|
-
getPositionAt(index, vector = new
|
|
2934
|
+
getPositionAt(index, vector = new Vector34()) {
|
|
2886
2935
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2887
2936
|
const matrix = this.getMatrixAt(index);
|
|
2888
2937
|
vector.setFromMatrixPosition(matrix);
|
|
@@ -2892,7 +2941,7 @@ var _SceneObject = class _SceneObject extends Object3D2 {
|
|
|
2892
2941
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2893
2942
|
this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
|
|
2894
2943
|
}
|
|
2895
|
-
getRotationAt(index, euler = new
|
|
2944
|
+
getRotationAt(index, euler = new Euler2()) {
|
|
2896
2945
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2897
2946
|
const matrix = this.getMatrixAt(index);
|
|
2898
2947
|
euler.setFromRotationMatrix(matrix);
|
|
@@ -2902,7 +2951,7 @@ var _SceneObject = class _SceneObject extends Object3D2 {
|
|
|
2902
2951
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2903
2952
|
this.setPositionRotationScaleAt(index, void 0, void 0, scale);
|
|
2904
2953
|
}
|
|
2905
|
-
getScaleAt(index, vector = new
|
|
2954
|
+
getScaleAt(index, vector = new Vector34()) {
|
|
2906
2955
|
if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
|
|
2907
2956
|
const matrix = this.getMatrixAt(index);
|
|
2908
2957
|
vector.setFromMatrixScale(matrix);
|
|
@@ -3565,7 +3614,7 @@ function isQuadArray(obj) {
|
|
|
3565
3614
|
}
|
|
3566
3615
|
|
|
3567
3616
|
// src/model/scene/ModelObject.ts
|
|
3568
|
-
import { BoxGeometry as BoxGeometry5, Matrix4 as Matrix45 } from "three";
|
|
3617
|
+
import { BoxGeometry as BoxGeometry5, Euler as Euler4, Matrix4 as Matrix45 } from "three";
|
|
3569
3618
|
|
|
3570
3619
|
// src/three/BufferGeometryUtils.js
|
|
3571
3620
|
import {
|
|
@@ -3577,7 +3626,7 @@ import {
|
|
|
3577
3626
|
TriangleFanDrawMode,
|
|
3578
3627
|
TriangleStripDrawMode,
|
|
3579
3628
|
TrianglesDrawMode,
|
|
3580
|
-
Vector3 as
|
|
3629
|
+
Vector3 as Vector36
|
|
3581
3630
|
} from "three";
|
|
3582
3631
|
function computeTangents(geometry) {
|
|
3583
3632
|
geometry.computeTangents();
|
|
@@ -3896,15 +3945,15 @@ function computeMorphedAttributes(object) {
|
|
|
3896
3945
|
console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
|
|
3897
3946
|
return null;
|
|
3898
3947
|
}
|
|
3899
|
-
const _vA = new
|
|
3900
|
-
const _vB = new
|
|
3901
|
-
const _vC = new
|
|
3902
|
-
const _tempA = new
|
|
3903
|
-
const _tempB = new
|
|
3904
|
-
const _tempC = new
|
|
3905
|
-
const _morphA = new
|
|
3906
|
-
const _morphB = new
|
|
3907
|
-
const _morphC = new
|
|
3948
|
+
const _vA = new Vector36();
|
|
3949
|
+
const _vB = new Vector36();
|
|
3950
|
+
const _vC = new Vector36();
|
|
3951
|
+
const _tempA = new Vector36();
|
|
3952
|
+
const _tempB = new Vector36();
|
|
3953
|
+
const _tempC = new Vector36();
|
|
3954
|
+
const _morphA = new Vector36();
|
|
3955
|
+
const _morphB = new Vector36();
|
|
3956
|
+
const _morphC = new Vector36();
|
|
3908
3957
|
function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
|
|
3909
3958
|
_vA.fromBufferAttribute(attribute, a2);
|
|
3910
3959
|
_vB.fromBufferAttribute(attribute, b2);
|
|
@@ -4145,6 +4194,9 @@ var _ModelObject = class _ModelObject extends SceneObject {
|
|
|
4145
4194
|
if (this.atlas.model.elements) {
|
|
4146
4195
|
this.atlas.model.elements?.forEach((el) => {
|
|
4147
4196
|
const elGeo = this._getBoxGeometryFromElement(el).clone();
|
|
4197
|
+
if (this.options.uvLockRotation) {
|
|
4198
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler4(...this.options.uvLockRotation));
|
|
4199
|
+
}
|
|
4148
4200
|
elGeo.applyMatrix4(new Matrix45().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
|
|
4149
4201
|
elGeo.applyMatrix4(new Matrix45().makeTranslation(el.from[0], el.from[1], el.from[2]));
|
|
4150
4202
|
if (el.rotation) {
|
|
@@ -4224,7 +4276,7 @@ function isModelObject(obj) {
|
|
|
4224
4276
|
|
|
4225
4277
|
// src/model/block/scene/BlockObject.ts
|
|
4226
4278
|
var import_ts_deepmerge6 = __toESM(require_dist());
|
|
4227
|
-
import { Euler as
|
|
4279
|
+
import { Euler as Euler5, Matrix4 as Matrix46, Vector3 as Vector37 } from "three";
|
|
4228
4280
|
var p10 = prefix("BlockObject");
|
|
4229
4281
|
function matchesCondition(condition, state) {
|
|
4230
4282
|
return Object.entries(condition).every(([key, value]) => {
|
|
@@ -4281,7 +4333,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
4281
4333
|
if (isModelObject(model)) {
|
|
4282
4334
|
model.removeFromScene();
|
|
4283
4335
|
} else if (isInstanceReference(model)) {
|
|
4284
|
-
model.setScale(new
|
|
4336
|
+
model.setScale(new Vector37(0, 0, 0));
|
|
4285
4337
|
}
|
|
4286
4338
|
}
|
|
4287
4339
|
super.removeFromScene();
|
|
@@ -4342,7 +4394,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
4342
4394
|
}
|
|
4343
4395
|
for (let model of this._models) {
|
|
4344
4396
|
if (isInstanceReference(model)) {
|
|
4345
|
-
model.setScale(new
|
|
4397
|
+
model.setScale(new Vector37(0, 0, 0));
|
|
4346
4398
|
} else {
|
|
4347
4399
|
model.dispose();
|
|
4348
4400
|
}
|
|
@@ -4379,25 +4431,24 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
4379
4431
|
await this.createVariant(variant);
|
|
4380
4432
|
}
|
|
4381
4433
|
async createVariant(variant) {
|
|
4382
|
-
const
|
|
4383
|
-
const obj = await this.scene.addModel(model, this.options);
|
|
4384
|
-
if (isInstanceReference(obj) || obj.isInstanced) {
|
|
4385
|
-
this._isInstanced = true;
|
|
4386
|
-
this._instanceCounter = 1;
|
|
4387
|
-
}
|
|
4388
|
-
let rotation = new Euler3(0, 0, 0);
|
|
4434
|
+
const rotation = new Euler5();
|
|
4389
4435
|
if (typeof variant.x !== "undefined") {
|
|
4390
4436
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
4391
4437
|
}
|
|
4392
4438
|
if (typeof variant.y !== "undefined") {
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4439
|
+
rotation.y = toRadians(clampRotationDegrees(typeof variant.x !== "undefined" ? variant.y : 360 - variant.y));
|
|
4440
|
+
}
|
|
4441
|
+
const model = await Models.getMerged(AssetKey.parse("models", variant.model));
|
|
4442
|
+
const options = {
|
|
4443
|
+
...this.options,
|
|
4444
|
+
uvLockRotation: variant.uvlock && (rotation.x !== 0 || rotation.y !== 0) ? [rotation.x, rotation.y, rotation.z] : void 0
|
|
4445
|
+
};
|
|
4446
|
+
const obj = await this.scene.addModel(model, options);
|
|
4447
|
+
if (isInstanceReference(obj) || obj.isInstanced) {
|
|
4448
|
+
this._isInstanced = true;
|
|
4449
|
+
this._instanceCounter = 1;
|
|
4398
4450
|
}
|
|
4399
4451
|
obj.setRotation(rotation);
|
|
4400
|
-
console.log(obj);
|
|
4401
4452
|
return obj;
|
|
4402
4453
|
}
|
|
4403
4454
|
async resetState() {
|
|
@@ -5460,7 +5511,8 @@ var _MineRenderScene = class _MineRenderScene extends Scene2 {
|
|
|
5460
5511
|
const obj = await objectSupplier();
|
|
5461
5512
|
if (obj?.options?.instanceMeshes && asset.key && asset.key?.assetType === "models") {
|
|
5462
5513
|
console.log("instanceMeshes + key");
|
|
5463
|
-
const
|
|
5514
|
+
const uvLockRotation = isModelObject(obj) ? obj.options.uvLockRotation : void 0;
|
|
5515
|
+
const key = asset.key.serialize() + (uvLockRotation ? `|uvlock:${uvLockRotation.join(",")}` : "");
|
|
5464
5516
|
return this.instanceManager.getOrCreate(key, async () => {
|
|
5465
5517
|
obj.scene = this;
|
|
5466
5518
|
await obj.init();
|
|
@@ -5505,7 +5557,7 @@ function isMineRenderScene(obj) {
|
|
|
5505
5557
|
}
|
|
5506
5558
|
|
|
5507
5559
|
// src/renderer/Renderer.ts
|
|
5508
|
-
import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as
|
|
5560
|
+
import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector39, WebGLRenderer } from "three";
|
|
5509
5561
|
var import_ts_deepmerge9 = __toESM(require_dist());
|
|
5510
5562
|
import Stats from "stats.js";
|
|
5511
5563
|
import { EffectComposer, RenderPass } from "postprocessing";
|
|
@@ -5518,7 +5570,7 @@ import {
|
|
|
5518
5570
|
Spherical,
|
|
5519
5571
|
TOUCH,
|
|
5520
5572
|
Vector2 as Vector23,
|
|
5521
|
-
Vector3 as
|
|
5573
|
+
Vector3 as Vector38
|
|
5522
5574
|
} from "three";
|
|
5523
5575
|
var _changeEvent = { type: "change" };
|
|
5524
5576
|
var _startEvent = { type: "start" };
|
|
@@ -5532,7 +5584,7 @@ var OrbitControls = class extends EventDispatcher {
|
|
|
5532
5584
|
this.domElement = domElement;
|
|
5533
5585
|
this.domElement.style.touchAction = "none";
|
|
5534
5586
|
this.enabled = true;
|
|
5535
|
-
this.target = new
|
|
5587
|
+
this.target = new Vector38();
|
|
5536
5588
|
this.minDistance = 0;
|
|
5537
5589
|
this.maxDistance = Infinity;
|
|
5538
5590
|
this.minZoom = 0;
|
|
@@ -5584,10 +5636,10 @@ var OrbitControls = class extends EventDispatcher {
|
|
|
5584
5636
|
state = STATE.NONE;
|
|
5585
5637
|
};
|
|
5586
5638
|
this.update = function() {
|
|
5587
|
-
const offset = new
|
|
5588
|
-
const quat = new Quaternion3().setFromUnitVectors(object.up, new
|
|
5639
|
+
const offset = new Vector38();
|
|
5640
|
+
const quat = new Quaternion3().setFromUnitVectors(object.up, new Vector38(0, 1, 0));
|
|
5589
5641
|
const quatInverse = quat.clone().invert();
|
|
5590
|
-
const lastPosition = new
|
|
5642
|
+
const lastPosition = new Vector38();
|
|
5591
5643
|
const lastQuaternion = new Quaternion3();
|
|
5592
5644
|
const twoPI = 2 * Math.PI;
|
|
5593
5645
|
return function update() {
|
|
@@ -5677,7 +5729,7 @@ var OrbitControls = class extends EventDispatcher {
|
|
|
5677
5729
|
const spherical = new Spherical();
|
|
5678
5730
|
const sphericalDelta = new Spherical();
|
|
5679
5731
|
let scale = 1;
|
|
5680
|
-
const panOffset = new
|
|
5732
|
+
const panOffset = new Vector38();
|
|
5681
5733
|
let zoomChanged = false;
|
|
5682
5734
|
const rotateStart = new Vector23();
|
|
5683
5735
|
const rotateEnd = new Vector23();
|
|
@@ -5703,7 +5755,7 @@ var OrbitControls = class extends EventDispatcher {
|
|
|
5703
5755
|
sphericalDelta.phi -= angle;
|
|
5704
5756
|
}
|
|
5705
5757
|
const panLeft = function() {
|
|
5706
|
-
const v = new
|
|
5758
|
+
const v = new Vector38();
|
|
5707
5759
|
return function panLeft2(distance, objectMatrix) {
|
|
5708
5760
|
v.setFromMatrixColumn(objectMatrix, 0);
|
|
5709
5761
|
v.multiplyScalar(-distance);
|
|
@@ -5711,7 +5763,7 @@ var OrbitControls = class extends EventDispatcher {
|
|
|
5711
5763
|
};
|
|
5712
5764
|
}();
|
|
5713
5765
|
const panUp = function() {
|
|
5714
|
-
const v = new
|
|
5766
|
+
const v = new Vector38();
|
|
5715
5767
|
return function panUp2(distance, objectMatrix) {
|
|
5716
5768
|
if (scope.screenSpacePanning === true) {
|
|
5717
5769
|
v.setFromMatrixColumn(objectMatrix, 1);
|
|
@@ -5724,7 +5776,7 @@ var OrbitControls = class extends EventDispatcher {
|
|
|
5724
5776
|
};
|
|
5725
5777
|
}();
|
|
5726
5778
|
const pan = function() {
|
|
5727
|
-
const offset = new
|
|
5779
|
+
const offset = new Vector38();
|
|
5728
5780
|
return function pan2(deltaX, deltaY) {
|
|
5729
5781
|
const element = scope.domElement;
|
|
5730
5782
|
if (scope.object.isPerspectiveCamera) {
|
|
@@ -6471,8 +6523,8 @@ _Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge9.default)({}, {
|
|
|
6471
6523
|
top: void 0,
|
|
6472
6524
|
bottom: void 0
|
|
6473
6525
|
},
|
|
6474
|
-
position: new
|
|
6475
|
-
lookingAt: new
|
|
6526
|
+
position: new Vector39(50, 50, 50),
|
|
6527
|
+
lookingAt: new Vector39(0, 0, 0)
|
|
6476
6528
|
},
|
|
6477
6529
|
render: {
|
|
6478
6530
|
fpsLimit: 60,
|
|
@@ -6505,7 +6557,7 @@ var Skins = class {
|
|
|
6505
6557
|
return this.fromUsername(uuidOrUsername);
|
|
6506
6558
|
}
|
|
6507
6559
|
static async fromUuid(uuid) {
|
|
6508
|
-
return this.
|
|
6560
|
+
return this.getMcProxySkinUrl(uuid);
|
|
6509
6561
|
}
|
|
6510
6562
|
static async fromUsername(username) {
|
|
6511
6563
|
return this.usernameToUuid(username).then((uuid) => {
|
|
@@ -6532,7 +6584,7 @@ var Skins = class {
|
|
|
6532
6584
|
return this.capeFromUsername(uuidOrUsername);
|
|
6533
6585
|
}
|
|
6534
6586
|
static async capeFromUuid(uuid) {
|
|
6535
|
-
return this.
|
|
6587
|
+
return this.getMcProxyCapeUrl(uuid);
|
|
6536
6588
|
}
|
|
6537
6589
|
static async capeFromUsername(username) {
|
|
6538
6590
|
return this.usernameToUuid(username).then((uuid) => {
|
|
@@ -6553,8 +6605,23 @@ var Skins = class {
|
|
|
6553
6605
|
//</editor-fold>
|
|
6554
6606
|
//<editor-fold desc="Helpers">
|
|
6555
6607
|
static async usernameToUuid(username) {
|
|
6556
|
-
return this.
|
|
6608
|
+
return this.usernameToUuidMcProxy(username);
|
|
6557
6609
|
}
|
|
6610
|
+
static async usernameToUuidMcProxy(username) {
|
|
6611
|
+
return Requests.genericRequest({
|
|
6612
|
+
baseURL: "https://mcproxy.dev",
|
|
6613
|
+
url: "/uuid/" + username
|
|
6614
|
+
}).then((res) => {
|
|
6615
|
+
if (res.status === 200) {
|
|
6616
|
+
return res.data["data"]["id"];
|
|
6617
|
+
}
|
|
6618
|
+
return void 0;
|
|
6619
|
+
}).catch((err) => {
|
|
6620
|
+
console.warn(err);
|
|
6621
|
+
return void 0;
|
|
6622
|
+
});
|
|
6623
|
+
}
|
|
6624
|
+
/** @deprecated **/
|
|
6558
6625
|
static async usernameToUuidSkinProxy(username) {
|
|
6559
6626
|
return Requests.genericRequest({
|
|
6560
6627
|
baseURL: "https://minecraft-skin-proxy.inventive.workers.dev",
|
|
@@ -6633,20 +6700,28 @@ var Skins = class {
|
|
|
6633
6700
|
static getMineSkinPlayerSkinUrl(uuid) {
|
|
6634
6701
|
return "https://mineskin.org/skin/player/" + uuid;
|
|
6635
6702
|
}
|
|
6703
|
+
/** @deprecated **/
|
|
6636
6704
|
static getSkinProxySkinUrl(uuid) {
|
|
6637
6705
|
return "https://minecraft-skin-proxy.inventive.workers.dev/skin/" + uuid;
|
|
6638
6706
|
}
|
|
6707
|
+
/** @deprecated **/
|
|
6639
6708
|
static getSkinProxyCapeUrl(uuid) {
|
|
6640
6709
|
return "https://minecraft-skin-proxy.inventive.workers.dev/cape/" + uuid;
|
|
6641
6710
|
}
|
|
6711
|
+
static getMcProxySkinUrl(uuid) {
|
|
6712
|
+
return "https://mcproxy.dev/skin/" + uuid;
|
|
6713
|
+
}
|
|
6714
|
+
static getMcProxyCapeUrl(uuid) {
|
|
6715
|
+
return "https://mcproxy.dev/cape/" + uuid;
|
|
6716
|
+
}
|
|
6642
6717
|
//</editor-fold>
|
|
6643
6718
|
};
|
|
6644
6719
|
|
|
6645
6720
|
// src/world/Chunk.ts
|
|
6646
|
-
import { Box3 as Box32, Object3D as Object3D6, Vector3 as
|
|
6721
|
+
import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector311 } from "three";
|
|
6647
6722
|
|
|
6648
6723
|
// src/world/MineRenderWorld.ts
|
|
6649
|
-
import { Vector3 as
|
|
6724
|
+
import { Vector3 as Vector310 } from "three";
|
|
6650
6725
|
var MineRenderWorld = class {
|
|
6651
6726
|
constructor(scene) {
|
|
6652
6727
|
this._size = 4;
|
|
@@ -6657,10 +6732,10 @@ var MineRenderWorld = class {
|
|
|
6657
6732
|
}
|
|
6658
6733
|
getBlockAt(posOrX, y, z) {
|
|
6659
6734
|
if (typeof posOrX == "number") {
|
|
6660
|
-
return this.getBlockAt(new
|
|
6735
|
+
return this.getBlockAt(new Vector310(posOrX, y, z));
|
|
6661
6736
|
}
|
|
6662
6737
|
if (isTripleArray(posOrX)) {
|
|
6663
|
-
return this.getBlockAt(new
|
|
6738
|
+
return this.getBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]));
|
|
6664
6739
|
}
|
|
6665
6740
|
const chunk = this.getChunkAt(posOrX);
|
|
6666
6741
|
if (typeof chunk === "undefined") {
|
|
@@ -6671,10 +6746,10 @@ var MineRenderWorld = class {
|
|
|
6671
6746
|
}
|
|
6672
6747
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
6673
6748
|
if (typeof posOrX == "number") {
|
|
6674
|
-
return this.setBlockAt(new
|
|
6749
|
+
return this.setBlockAt(new Vector310(posOrX, yOrBlock, z), block);
|
|
6675
6750
|
}
|
|
6676
6751
|
if (isTripleArray(posOrX)) {
|
|
6677
|
-
return this.setBlockAt(new
|
|
6752
|
+
return this.setBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
6678
6753
|
}
|
|
6679
6754
|
this.validatePosBounds(posOrX);
|
|
6680
6755
|
const chunk = this.getOrCreateChunkAt(posOrX);
|
|
@@ -6720,14 +6795,14 @@ var MineRenderWorld = class {
|
|
|
6720
6795
|
return this._chunks[index];
|
|
6721
6796
|
}
|
|
6722
6797
|
static worldToScenePosition(pos) {
|
|
6723
|
-
return new
|
|
6798
|
+
return new Vector310(
|
|
6724
6799
|
pos.x * 16,
|
|
6725
6800
|
pos.y * 16,
|
|
6726
6801
|
pos.z * 16
|
|
6727
6802
|
);
|
|
6728
6803
|
}
|
|
6729
6804
|
static sceneToWorldPosition(pos) {
|
|
6730
|
-
return new
|
|
6805
|
+
return new Vector310(
|
|
6731
6806
|
pos.x / 16,
|
|
6732
6807
|
pos.y / 16,
|
|
6733
6808
|
pos.z / 16
|
|
@@ -6769,7 +6844,7 @@ var Chunk = class _Chunk {
|
|
|
6769
6844
|
scene.add(anchor);
|
|
6770
6845
|
anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
|
|
6771
6846
|
addBox3WireframeToObject(
|
|
6772
|
-
new Box32(new
|
|
6847
|
+
new Box32(new Vector311(0, 0, 0), new Vector311(256, 256, 256)),
|
|
6773
6848
|
anchor,
|
|
6774
6849
|
16776960,
|
|
6775
6850
|
4
|
|
@@ -6777,10 +6852,10 @@ var Chunk = class _Chunk {
|
|
|
6777
6852
|
}
|
|
6778
6853
|
getBlockAt(posOrX, y, z) {
|
|
6779
6854
|
if (typeof posOrX == "number") {
|
|
6780
|
-
return this.getBlockAt(new
|
|
6855
|
+
return this.getBlockAt(new Vector311(posOrX, y, z));
|
|
6781
6856
|
}
|
|
6782
6857
|
if (isTripleArray(posOrX)) {
|
|
6783
|
-
return this.getBlockAt(new
|
|
6858
|
+
return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
|
|
6784
6859
|
}
|
|
6785
6860
|
const pos = this.worldPosToChunkPos(posOrX);
|
|
6786
6861
|
const index = _Chunk.chunkPosToBlockIndex(pos);
|
|
@@ -6788,10 +6863,10 @@ var Chunk = class _Chunk {
|
|
|
6788
6863
|
}
|
|
6789
6864
|
async setBlockAt(posOrX, yOrBlock, z, block) {
|
|
6790
6865
|
if (typeof posOrX == "number") {
|
|
6791
|
-
return this.setBlockAt(new
|
|
6866
|
+
return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
|
|
6792
6867
|
}
|
|
6793
6868
|
if (isTripleArray(posOrX)) {
|
|
6794
|
-
return this.setBlockAt(new
|
|
6869
|
+
return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
|
|
6795
6870
|
}
|
|
6796
6871
|
const worldPos = posOrX;
|
|
6797
6872
|
const pos = this.worldPosToChunkPos(worldPos);
|
|
@@ -6837,7 +6912,7 @@ var Chunk = class _Chunk {
|
|
|
6837
6912
|
}
|
|
6838
6913
|
async clear() {
|
|
6839
6914
|
let promises = [];
|
|
6840
|
-
let pos = new
|
|
6915
|
+
let pos = new Vector311();
|
|
6841
6916
|
for (let x = 0; x < 16; x++) {
|
|
6842
6917
|
for (let z = 0; z < 16; z++) {
|
|
6843
6918
|
for (let y = 0; y < 16; y++) {
|
|
@@ -6856,14 +6931,14 @@ var Chunk = class _Chunk {
|
|
|
6856
6931
|
return pos.y * 16 * 16 + pos.z * 16 + pos.x;
|
|
6857
6932
|
}
|
|
6858
6933
|
worldPosToChunkPos(pos) {
|
|
6859
|
-
return new
|
|
6934
|
+
return new Vector311(
|
|
6860
6935
|
pos.x - this.x * 16,
|
|
6861
6936
|
pos.y - this.y * 16,
|
|
6862
6937
|
pos.z - this.z * 16
|
|
6863
6938
|
);
|
|
6864
6939
|
}
|
|
6865
6940
|
chunkPosToWorldPos(pos) {
|
|
6866
|
-
return new
|
|
6941
|
+
return new Vector311(
|
|
6867
6942
|
this.x * 16 + pos.x,
|
|
6868
6943
|
this.y * 16 + pos.y,
|
|
6869
6944
|
this.z * 16 + pos.z
|