cubing 0.28.1 → 0.29.0
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 +2 -0
- package/dist/esm/alg/index.js +2 -2
- package/dist/esm/bluetooth/index.js +222 -86
- package/dist/esm/bluetooth/index.js.map +3 -3
- package/dist/esm/{chunk-F4WWCPVE.js → chunk-2IZUSAXQ.js} +2 -2
- package/dist/esm/{chunk-F4WWCPVE.js.map → chunk-2IZUSAXQ.js.map} +1 -1
- package/dist/esm/{chunk-YSVFZVG4.js → chunk-DZGFGBKT.js} +183 -76
- package/dist/esm/chunk-DZGFGBKT.js.map +7 -0
- package/dist/esm/{chunk-7D7LW3WQ.js → chunk-GW4FGG42.js} +8 -4
- package/dist/esm/{chunk-7D7LW3WQ.js.map → chunk-GW4FGG42.js.map} +1 -1
- package/dist/esm/{chunk-32FWPPTW.js → chunk-LSCTPPWV.js} +22 -8
- package/dist/esm/{chunk-32FWPPTW.js.map → chunk-LSCTPPWV.js.map} +1 -1
- package/dist/esm/{chunk-LSVR2HCG.js → chunk-LV7IKG36.js} +389 -363
- package/dist/esm/{chunk-LSVR2HCG.js.map → chunk-LV7IKG36.js.map} +1 -1
- package/dist/esm/{chunk-CSBUJ64Q.js → chunk-NI7U4XAZ.js} +373 -238
- package/dist/esm/chunk-NI7U4XAZ.js.map +7 -0
- package/dist/esm/{chunk-GVPTO3OF.js → chunk-OX6O2ZO5.js} +1 -1
- package/dist/esm/{chunk-GVPTO3OF.js.map → chunk-OX6O2ZO5.js.map} +1 -1
- package/dist/esm/{chunk-67VJZGH2.js → chunk-PYWGREIP.js} +44 -13
- package/dist/esm/chunk-PYWGREIP.js.map +7 -0
- package/dist/esm/{chunk-WAL36PO3.js → chunk-Q4W5ZR4U.js} +28 -12
- package/dist/esm/{chunk-WAL36PO3.js.map → chunk-Q4W5ZR4U.js.map} +1 -1
- package/dist/esm/{chunk-MGJA5U5O.js → chunk-SBZRVSPK.js} +1 -12
- package/dist/esm/{chunk-MGJA5U5O.js.map → chunk-SBZRVSPK.js.map} +0 -0
- package/dist/esm/{chunk-MWKALF6W.js → chunk-TGPS3CXW.js} +22 -13
- package/dist/esm/chunk-TGPS3CXW.js.map +7 -0
- package/dist/esm/{chunk-V55YSWJY.js → chunk-WXCNEGW3.js} +10 -4
- package/dist/esm/{chunk-V55YSWJY.js.map → chunk-WXCNEGW3.js.map} +1 -1
- package/dist/esm/{chunk-ZY3RTFFS.js → chunk-XU5ILFX5.js} +137 -66
- package/dist/esm/{chunk-ZY3RTFFS.js.map → chunk-XU5ILFX5.js.map} +3 -3
- package/dist/esm/{chunk-ALBEW4DJ.js → chunk-ZB3P5AZN.js} +1 -1
- package/dist/esm/{chunk-ALBEW4DJ.js.map → chunk-ZB3P5AZN.js.map} +1 -1
- package/dist/esm/{chunk-NPHUBFZ6.js → chunk-ZNAYJGVL.js} +2 -2
- package/dist/esm/{chunk-NPHUBFZ6.js.map → chunk-ZNAYJGVL.js.map} +1 -1
- package/dist/esm/kpuzzle/index.js +3 -3
- package/dist/esm/notation/index.js +3 -3
- package/dist/esm/protocol/index.js +5 -5
- package/dist/esm/puzzle-geometry/index.js +271 -71
- package/dist/esm/puzzle-geometry/index.js.map +2 -2
- package/dist/esm/puzzles/index.js +5 -5
- package/dist/esm/{puzzles-dynamic-3x3x3-NB2PEZTV.js → puzzles-dynamic-3x3x3-KIG5A6QR.js} +2 -2
- package/dist/esm/{puzzles-dynamic-3x3x3-NB2PEZTV.js.map → puzzles-dynamic-3x3x3-KIG5A6QR.js.map} +0 -0
- package/dist/esm/puzzles-dynamic-4x4x4-PEDAPUZK.js +126 -0
- package/dist/esm/puzzles-dynamic-4x4x4-PEDAPUZK.js.map +7 -0
- package/dist/esm/{puzzles-dynamic-side-events-WZI4Y3N6.js → puzzles-dynamic-side-events-5C7LMBWX.js} +2 -2
- package/dist/esm/{puzzles-dynamic-side-events-WZI4Y3N6.js.map → puzzles-dynamic-side-events-5C7LMBWX.js.map} +0 -0
- package/dist/esm/{puzzles-dynamic-unofficial-FUG3JBMH.js → puzzles-dynamic-unofficial-WWJ4NJMX.js} +2 -2
- package/dist/esm/{puzzles-dynamic-unofficial-FUG3JBMH.js.map → puzzles-dynamic-unofficial-WWJ4NJMX.js.map} +0 -0
- package/dist/esm/scramble/index.js +5 -5
- package/dist/esm/search/index.js +10 -10
- package/dist/esm/{search-dynamic-sgs-side-events-R3HDJ5XQ.js → search-dynamic-sgs-side-events-AYX7MZO7.js} +35 -17
- package/dist/esm/{search-dynamic-sgs-side-events-R3HDJ5XQ.js.map → search-dynamic-sgs-side-events-AYX7MZO7.js.map} +2 -2
- package/dist/esm/{search-dynamic-sgs-unofficial-FQNKGHVO.js → search-dynamic-sgs-unofficial-DLJOJFJL.js} +35 -14
- package/dist/esm/{search-dynamic-sgs-unofficial-FQNKGHVO.js.map → search-dynamic-sgs-unofficial-DLJOJFJL.js.map} +2 -2
- package/dist/esm/{search-dynamic-solve-3x3x3-K42IWMQV.js → search-dynamic-solve-3x3x3-7XZTYQMO.js} +795 -142
- package/dist/esm/{search-dynamic-solve-3x3x3-K42IWMQV.js.map → search-dynamic-solve-3x3x3-7XZTYQMO.js.map} +1 -1
- package/dist/esm/{search-dynamic-solve-4x4x4-XRV4NBMQ.js → search-dynamic-solve-4x4x4-CWWTFKMR.js} +135 -29
- package/dist/esm/{search-dynamic-solve-4x4x4-XRV4NBMQ.js.map → search-dynamic-solve-4x4x4-CWWTFKMR.js.map} +1 -1
- package/dist/esm/{search-dynamic-solve-fto-O6UXF7EC.js → search-dynamic-solve-fto-4LI23P6K.js} +253 -69
- package/dist/esm/{search-dynamic-solve-fto-O6UXF7EC.js.map → search-dynamic-solve-fto-4LI23P6K.js.map} +2 -2
- package/dist/esm/{search-dynamic-solve-kilominx-G4MLGWNS.js → search-dynamic-solve-kilominx-3HEVQ4MC.js} +32 -8
- package/dist/esm/{search-dynamic-solve-kilominx-G4MLGWNS.js.map → search-dynamic-solve-kilominx-3HEVQ4MC.js.map} +2 -2
- package/dist/esm/{search-dynamic-solve-master_tetraminx-3RKD3IAN.js → search-dynamic-solve-master_tetraminx-UB32C7MM.js} +111 -42
- package/dist/esm/{search-dynamic-solve-master_tetraminx-3RKD3IAN.js.map → search-dynamic-solve-master_tetraminx-UB32C7MM.js.map} +2 -2
- package/dist/esm/{search-dynamic-solve-sq1-WIJEGVLP.js → search-dynamic-solve-sq1-HA72TYF2.js} +54 -9
- package/dist/esm/{search-dynamic-solve-sq1-WIJEGVLP.js.map → search-dynamic-solve-sq1-HA72TYF2.js.map} +2 -2
- package/dist/esm/{search-worker-inside-generated-string-IZCKWXUA.js → search-worker-inside-generated-string-AMEXYCKK.js} +146 -28
- package/dist/esm/search-worker-inside-generated-string-AMEXYCKK.js.map +7 -0
- package/dist/esm/{search-worker-js-entry-WBEKNBB7.js → search-worker-js-entry-TP2T3NUL.js} +147 -53
- package/dist/esm/{search-worker-js-entry-WBEKNBB7.js.map → search-worker-js-entry-TP2T3NUL.js.map} +2 -2
- package/dist/esm/{search-worker-ts-entry-XQWMEOC4.js → search-worker-ts-entry-NEH77S4I.js} +5 -5
- package/dist/esm/{search-worker-ts-entry-XQWMEOC4.js.map → search-worker-ts-entry-NEH77S4I.js.map} +1 -1
- package/dist/esm/stream/index.js +12 -8
- package/dist/esm/stream/index.js.map +1 -1
- package/dist/esm/twisty/index.js +1154 -762
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/{twisty-dynamic-3d-QOX7IEXC.js → twisty-dynamic-3d-D3ZDBJUH.js} +352 -175
- package/dist/esm/{twisty-dynamic-3d-QOX7IEXC.js.map → twisty-dynamic-3d-D3ZDBJUH.js.map} +2 -2
- package/dist/types/{Alg-e2a80975.d.ts → Alg-137fb0d5.d.ts} +19 -16
- package/dist/types/{KState-a2f0e651.d.ts → KState-a73111d7.d.ts} +1 -9
- package/dist/types/{TwizzleLink-dcf51446.d.ts → TwizzleLink-bef52ecd.d.ts} +46 -10
- package/dist/types/alg/index.d.ts +4 -4
- package/dist/types/bluetooth/index.d.ts +4 -4
- package/dist/types/{bluetooth-puzzle-3670a6a1.d.ts → bluetooth-puzzle-8a678993.d.ts} +9 -9
- package/dist/types/kpuzzle/index.d.ts +2 -2
- package/dist/types/notation/index.d.ts +1 -1
- package/dist/types/{outside-0ce1b145.d.ts → outside-e55f28a0.d.ts} +2 -2
- package/dist/types/{parseAlg-db0dec6c.d.ts → parseAlg-a28f7568.d.ts} +1 -1
- package/dist/types/protocol/index.d.ts +2 -2
- package/dist/types/puzzle-geometry/index.d.ts +3 -3
- package/dist/types/puzzles/index.d.ts +5 -5
- package/dist/types/scramble/index.d.ts +3 -3
- package/dist/types/search/index.d.ts +3 -3
- package/dist/types/stream/index.d.ts +5 -5
- package/dist/types/twisty/index.d.ts +5 -5
- package/package.json +47 -41
- package/dist/esm/chunk-67VJZGH2.js.map +0 -7
- package/dist/esm/chunk-CSBUJ64Q.js.map +0 -7
- package/dist/esm/chunk-MWKALF6W.js.map +0 -7
- package/dist/esm/chunk-YSVFZVG4.js.map +0 -7
- package/dist/esm/search-worker-inside-generated-string-IZCKWXUA.js.map +0 -7
|
@@ -4,26 +4,21 @@ import {
|
|
|
4
4
|
haveStartedSharingRenderers,
|
|
5
5
|
hintFaceletStyles,
|
|
6
6
|
twistyDebugGlobals
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-LV7IKG36.js";
|
|
8
|
+
import "./chunk-OX6O2ZO5.js";
|
|
9
9
|
import {
|
|
10
10
|
cube3x3x3,
|
|
11
11
|
puzzles
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DZGFGBKT.js";
|
|
13
13
|
import {
|
|
14
14
|
experimentalStickerings,
|
|
15
15
|
getFaceletAppearance
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-PYWGREIP.js";
|
|
17
|
+
import "./chunk-XU5ILFX5.js";
|
|
18
18
|
import {
|
|
19
19
|
Move
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import
|
|
22
|
-
__privateAdd,
|
|
23
|
-
__privateGet,
|
|
24
|
-
__privateMethod,
|
|
25
|
-
__privateSet
|
|
26
|
-
} from "./chunk-MGJA5U5O.js";
|
|
20
|
+
} from "./chunk-NI7U4XAZ.js";
|
|
21
|
+
import "./chunk-SBZRVSPK.js";
|
|
27
22
|
|
|
28
23
|
// src/cubing/twisty/views/3D/puzzles/Cube3D.ts
|
|
29
24
|
import {
|
|
@@ -113,12 +108,53 @@ var AxisInfo = class {
|
|
|
113
108
|
}
|
|
114
109
|
};
|
|
115
110
|
var axesInfo = [
|
|
116
|
-
new AxisInfo(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
new AxisInfo(
|
|
112
|
+
new Vector3(0, 1, 0),
|
|
113
|
+
new Euler(-TAU / 4, 0, 0),
|
|
114
|
+
16777215,
|
|
115
|
+
14540253,
|
|
116
|
+
1.25
|
|
117
|
+
),
|
|
118
|
+
new AxisInfo(
|
|
119
|
+
new Vector3(-1, 0, 0),
|
|
120
|
+
new Euler(0, -TAU / 4, 0),
|
|
121
|
+
16746496,
|
|
122
|
+
8930304,
|
|
123
|
+
1,
|
|
124
|
+
{ hintDimColor: 10053120 }
|
|
125
|
+
),
|
|
126
|
+
new AxisInfo(
|
|
127
|
+
new Vector3(0, 0, 1),
|
|
128
|
+
new Euler(0, 0, 0),
|
|
129
|
+
65280,
|
|
130
|
+
34816,
|
|
131
|
+
1,
|
|
132
|
+
{ hintDimColor: 39168 }
|
|
133
|
+
),
|
|
134
|
+
new AxisInfo(
|
|
135
|
+
new Vector3(1, 0, 0),
|
|
136
|
+
new Euler(0, TAU / 4, 0),
|
|
137
|
+
16711680,
|
|
138
|
+
6684672,
|
|
139
|
+
1,
|
|
140
|
+
{ hintDimColor: 10027008 }
|
|
141
|
+
),
|
|
142
|
+
new AxisInfo(
|
|
143
|
+
new Vector3(0, 0, -1),
|
|
144
|
+
new Euler(0, TAU / 2, 0),
|
|
145
|
+
255,
|
|
146
|
+
136,
|
|
147
|
+
0.75,
|
|
148
|
+
{ hintColor: 17663, hintDimColor: 6246 }
|
|
149
|
+
),
|
|
150
|
+
new AxisInfo(
|
|
151
|
+
new Vector3(0, -1, 0),
|
|
152
|
+
new Euler(TAU / 4, 0, 0),
|
|
153
|
+
16776960,
|
|
154
|
+
8947712,
|
|
155
|
+
1.25,
|
|
156
|
+
{ hintDimColor: 12303104 }
|
|
157
|
+
)
|
|
122
158
|
];
|
|
123
159
|
var face = {
|
|
124
160
|
U: 0,
|
|
@@ -213,9 +249,24 @@ var firstPiecePosition = {
|
|
|
213
249
|
CENTERS: new Vector3(0, 1, 0)
|
|
214
250
|
};
|
|
215
251
|
var orientationRotation = {
|
|
216
|
-
EDGES: [0, 1].map(
|
|
217
|
-
|
|
218
|
-
|
|
252
|
+
EDGES: [0, 1].map(
|
|
253
|
+
(i) => new Matrix4().makeRotationAxis(
|
|
254
|
+
firstPiecePosition.EDGES.clone().normalize(),
|
|
255
|
+
-i * TAU / 2
|
|
256
|
+
)
|
|
257
|
+
),
|
|
258
|
+
CORNERS: [0, 1, 2].map(
|
|
259
|
+
(i) => new Matrix4().makeRotationAxis(
|
|
260
|
+
firstPiecePosition.CORNERS.clone().normalize(),
|
|
261
|
+
-i * TAU / 3
|
|
262
|
+
)
|
|
263
|
+
),
|
|
264
|
+
CENTERS: [0, 1, 2, 3].map(
|
|
265
|
+
(i) => new Matrix4().makeRotationAxis(
|
|
266
|
+
firstPiecePosition.CENTERS.clone().normalize(),
|
|
267
|
+
-i * TAU / 4
|
|
268
|
+
)
|
|
269
|
+
)
|
|
219
270
|
};
|
|
220
271
|
var cubieStickerOrder = [face.U, face.F, face.R];
|
|
221
272
|
var pieceDefs = {
|
|
@@ -357,71 +408,84 @@ var pictureStickerCoords = {
|
|
|
357
408
|
};
|
|
358
409
|
var sharedCubieFoundationGeometryCache = null;
|
|
359
410
|
function sharedCubieFoundationGeometry() {
|
|
360
|
-
return sharedCubieFoundationGeometryCache ?? (sharedCubieFoundationGeometryCache = new BoxGeometry(
|
|
411
|
+
return sharedCubieFoundationGeometryCache ?? (sharedCubieFoundationGeometryCache = new BoxGeometry(
|
|
412
|
+
cubieDimensions.foundationWidth,
|
|
413
|
+
cubieDimensions.foundationWidth,
|
|
414
|
+
cubieDimensions.foundationWidth
|
|
415
|
+
));
|
|
361
416
|
}
|
|
362
417
|
function newStickerGeometry() {
|
|
363
418
|
const r2 = new BufferGeometry();
|
|
364
419
|
const half = 0.5 * cubieDimensions.stickerWidth;
|
|
365
|
-
r2.setAttribute(
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
420
|
+
r2.setAttribute(
|
|
421
|
+
"position",
|
|
422
|
+
new BufferAttribute(
|
|
423
|
+
new Float32Array([
|
|
424
|
+
half,
|
|
425
|
+
half,
|
|
426
|
+
0,
|
|
427
|
+
-half,
|
|
428
|
+
half,
|
|
429
|
+
0,
|
|
430
|
+
half,
|
|
431
|
+
-half,
|
|
432
|
+
0,
|
|
433
|
+
-half,
|
|
434
|
+
half,
|
|
435
|
+
0,
|
|
436
|
+
-half,
|
|
437
|
+
-half,
|
|
438
|
+
0,
|
|
439
|
+
half,
|
|
440
|
+
-half,
|
|
441
|
+
0
|
|
442
|
+
]),
|
|
443
|
+
3
|
|
444
|
+
)
|
|
445
|
+
);
|
|
446
|
+
r2.setAttribute(
|
|
447
|
+
"uv",
|
|
448
|
+
new BufferAttribute(
|
|
449
|
+
new Float32Array([
|
|
450
|
+
1,
|
|
451
|
+
1,
|
|
452
|
+
0,
|
|
453
|
+
1,
|
|
454
|
+
1,
|
|
455
|
+
0,
|
|
456
|
+
0,
|
|
457
|
+
1,
|
|
458
|
+
0,
|
|
459
|
+
0,
|
|
460
|
+
1,
|
|
461
|
+
0,
|
|
462
|
+
0,
|
|
463
|
+
1,
|
|
464
|
+
0,
|
|
465
|
+
0,
|
|
466
|
+
1,
|
|
467
|
+
1,
|
|
468
|
+
0,
|
|
469
|
+
0,
|
|
470
|
+
1,
|
|
471
|
+
0,
|
|
472
|
+
1,
|
|
473
|
+
1
|
|
474
|
+
]),
|
|
475
|
+
2
|
|
476
|
+
)
|
|
477
|
+
);
|
|
411
478
|
return r2;
|
|
412
479
|
}
|
|
413
480
|
var sharedStickerGeometryCache = null;
|
|
414
481
|
function sharedStickerGeometry() {
|
|
415
482
|
return sharedStickerGeometryCache ?? (sharedStickerGeometryCache = newStickerGeometry());
|
|
416
483
|
}
|
|
417
|
-
var _sharedHintStickerGeometryCache, _sharedHintStickerGeometry, sharedHintStickerGeometry_fn, _animateRaiseHintFacelets, animateRaiseHintFacelets_fn;
|
|
418
484
|
var Cube3D = class extends Object3D {
|
|
419
485
|
constructor(kpuzzle, scheduleRenderCallback, options = {}) {
|
|
420
486
|
super();
|
|
421
487
|
this.kpuzzle = kpuzzle;
|
|
422
488
|
this.scheduleRenderCallback = scheduleRenderCallback;
|
|
423
|
-
__privateAdd(this, _sharedHintStickerGeometry);
|
|
424
|
-
__privateAdd(this, _animateRaiseHintFacelets);
|
|
425
489
|
this.pieces = {};
|
|
426
490
|
this.experimentalHintStickerMeshes = [];
|
|
427
491
|
this.experimentalFoundationMeshes = [];
|
|
@@ -435,11 +499,13 @@ var Cube3D = class extends Object3D {
|
|
|
435
499
|
svgLoader.load(url, resolve);
|
|
436
500
|
};
|
|
437
501
|
});
|
|
438
|
-
|
|
502
|
+
this.#sharedHintStickerGeometryCache = null;
|
|
439
503
|
this.options = { ...cube3DOptionsDefaults };
|
|
440
504
|
Object.assign(this.options, options);
|
|
441
505
|
if (this.kpuzzle.name() !== "3x3x3") {
|
|
442
|
-
throw new Error(
|
|
506
|
+
throw new Error(
|
|
507
|
+
`Invalid puzzle for this Cube3D implementation: ${this.kpuzzle.name()}`
|
|
508
|
+
);
|
|
443
509
|
}
|
|
444
510
|
if (options.foundationSprite) {
|
|
445
511
|
this.setSprite(options.foundationSprite);
|
|
@@ -451,13 +517,15 @@ var Cube3D = class extends Object3D {
|
|
|
451
517
|
for (const orbit in pieceDefs) {
|
|
452
518
|
const orbitFaceletInfo = [];
|
|
453
519
|
this.kpuzzleFaceletInfo[orbit] = orbitFaceletInfo;
|
|
454
|
-
this.pieces[orbit] = pieceDefs[orbit].map(
|
|
520
|
+
this.pieces[orbit] = pieceDefs[orbit].map(
|
|
521
|
+
this.createCubie.bind(this, orbit, orbitFaceletInfo)
|
|
522
|
+
);
|
|
455
523
|
}
|
|
456
524
|
this.scale.set(CUBE_SCALE, CUBE_SCALE, CUBE_SCALE);
|
|
457
525
|
if (this.options.experimentalStickering) {
|
|
458
526
|
this.setStickering(this.options.experimentalStickering);
|
|
459
527
|
}
|
|
460
|
-
|
|
528
|
+
this.#animateRaiseHintFacelets();
|
|
461
529
|
}
|
|
462
530
|
setSprite(texture) {
|
|
463
531
|
this.sprite = texture;
|
|
@@ -465,6 +533,40 @@ var Cube3D = class extends Object3D {
|
|
|
465
533
|
setHintSprite(texture) {
|
|
466
534
|
this.hintSprite = texture;
|
|
467
535
|
}
|
|
536
|
+
#sharedHintStickerGeometryCache;
|
|
537
|
+
#sharedHintStickerGeometry() {
|
|
538
|
+
return this.#sharedHintStickerGeometryCache ?? (this.#sharedHintStickerGeometryCache = newStickerGeometry());
|
|
539
|
+
}
|
|
540
|
+
#animateRaiseHintFacelets() {
|
|
541
|
+
if (!twistyDebugGlobals.animateRaiseHintFacelets || haveStartedSharingRenderers()) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
const translationRange = cubieDimensions.hintStickerElevation - cubieDimensions.stickerElevation;
|
|
545
|
+
this.#sharedHintStickerGeometry().translate(0, 0, -translationRange);
|
|
546
|
+
setTimeout(() => {
|
|
547
|
+
const hintStartTime = performance.now();
|
|
548
|
+
let lastTranslation = 0;
|
|
549
|
+
const translationDuration = 1e3;
|
|
550
|
+
function ease(x) {
|
|
551
|
+
return x * (2 - x);
|
|
552
|
+
}
|
|
553
|
+
const animateRaiseHintSticker = () => {
|
|
554
|
+
const elapsed = performance.now() - hintStartTime;
|
|
555
|
+
const newTranslation = ease(elapsed / translationDuration) * translationRange;
|
|
556
|
+
this.#sharedHintStickerGeometry().translate(
|
|
557
|
+
0,
|
|
558
|
+
0,
|
|
559
|
+
newTranslation - lastTranslation
|
|
560
|
+
);
|
|
561
|
+
lastTranslation = newTranslation;
|
|
562
|
+
if (elapsed < translationDuration) {
|
|
563
|
+
requestAnimationFrame(animateRaiseHintSticker);
|
|
564
|
+
this.scheduleRenderCallback?.();
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
animateRaiseHintSticker();
|
|
568
|
+
}, 500);
|
|
569
|
+
}
|
|
468
570
|
experimentalSetStickerSpriteURL(stickerSpriteURL) {
|
|
469
571
|
this.setSpriteURL(stickerSpriteURL);
|
|
470
572
|
}
|
|
@@ -473,12 +575,18 @@ var Cube3D = class extends Object3D {
|
|
|
473
575
|
}
|
|
474
576
|
setStickering(stickering) {
|
|
475
577
|
(async () => {
|
|
476
|
-
const appearance = await puzzles["3x3x3"].appearance(
|
|
477
|
-
|
|
578
|
+
const appearance = await puzzles["3x3x3"].appearance(
|
|
579
|
+
stickering ?? "full"
|
|
580
|
+
);
|
|
581
|
+
this.setAppearance(
|
|
582
|
+
appearance ?? await puzzles["3x3x3"].appearance("full")
|
|
583
|
+
);
|
|
478
584
|
})();
|
|
479
585
|
}
|
|
480
586
|
setAppearance(appearance) {
|
|
481
|
-
for (const [orbitName, orbitAppearance] of Object.entries(
|
|
587
|
+
for (const [orbitName, orbitAppearance] of Object.entries(
|
|
588
|
+
appearance.orbits
|
|
589
|
+
)) {
|
|
482
590
|
for (let pieceIdx = 0; pieceIdx < orbitAppearance.pieces.length; pieceIdx++) {
|
|
483
591
|
const pieceAppearance = orbitAppearance.pieces[pieceIdx];
|
|
484
592
|
if (pieceAppearance) {
|
|
@@ -535,12 +643,17 @@ var Cube3D = class extends Object3D {
|
|
|
535
643
|
for (let i = 0; i < pieces.length; i++) {
|
|
536
644
|
const j = reid333.stateData[orbit].pieces[i];
|
|
537
645
|
this.pieces[orbit][j].matrix.copy(pieceDefs[orbit][i].matrix);
|
|
538
|
-
this.pieces[orbit][j].matrix.multiply(
|
|
646
|
+
this.pieces[orbit][j].matrix.multiply(
|
|
647
|
+
orientationRotation[orbit][reid333.stateData[orbit].orientation[i]]
|
|
648
|
+
);
|
|
539
649
|
}
|
|
540
650
|
for (const moveProgress of p.movesInProgress) {
|
|
541
651
|
const move = moveProgress.move;
|
|
542
652
|
const turnNormal = axesInfo[familyToAxis[move.family]].vector;
|
|
543
|
-
const moveMatrix = new Matrix4().makeRotationAxis(
|
|
653
|
+
const moveMatrix = new Matrix4().makeRotationAxis(
|
|
654
|
+
turnNormal,
|
|
655
|
+
-this.ease(moveProgress.fraction) * moveProgress.direction * move.amount * TAU / 4
|
|
656
|
+
);
|
|
544
657
|
for (let i = 0; i < pieces.length; i++) {
|
|
545
658
|
const k = this.kpuzzle.definition.moves[move.family][orbit].permutation[i];
|
|
546
659
|
if (i !== k || this.kpuzzle.definition.moves[move.family][orbit].orientation[i] !== 0) {
|
|
@@ -562,14 +675,22 @@ var Cube3D = class extends Object3D {
|
|
|
562
675
|
this.experimentalFoundationMeshes.push(foundation);
|
|
563
676
|
}
|
|
564
677
|
for (let i = 0; i < piece.stickerFaces.length; i++) {
|
|
565
|
-
const sticker = this.createSticker(
|
|
678
|
+
const sticker = this.createSticker(
|
|
679
|
+
axesInfo[cubieStickerOrder[i]],
|
|
680
|
+
axesInfo[piece.stickerFaces[i]],
|
|
681
|
+
false
|
|
682
|
+
);
|
|
566
683
|
const faceletInfo = {
|
|
567
684
|
faceIdx: piece.stickerFaces[i],
|
|
568
685
|
facelet: sticker
|
|
569
686
|
};
|
|
570
687
|
cubie.add(sticker);
|
|
571
688
|
if (this.options.hintFacelets === "floating") {
|
|
572
|
-
const hintSticker = this.createSticker(
|
|
689
|
+
const hintSticker = this.createSticker(
|
|
690
|
+
axesInfo[cubieStickerOrder[i]],
|
|
691
|
+
axesInfo[piece.stickerFaces[i]],
|
|
692
|
+
true
|
|
693
|
+
);
|
|
573
694
|
cubie.add(hintSticker);
|
|
574
695
|
faceletInfo.hintFacelet = hintSticker;
|
|
575
696
|
this.experimentalHintStickerMeshes.push(hintSticker);
|
|
@@ -579,7 +700,11 @@ var Cube3D = class extends Object3D {
|
|
|
579
700
|
(async () => {
|
|
580
701
|
const addImageSticker = async (hint) => {
|
|
581
702
|
const texture = await (hint ? this.hintSprite : this.sprite);
|
|
582
|
-
const mesh = this.createSticker(
|
|
703
|
+
const mesh = this.createSticker(
|
|
704
|
+
axesInfo[cubieStickerOrder[i]],
|
|
705
|
+
axesInfo[piece.stickerFaces[i]],
|
|
706
|
+
hint
|
|
707
|
+
);
|
|
583
708
|
mesh.material = new MeshBasicMaterial({
|
|
584
709
|
map: texture,
|
|
585
710
|
side: hint ? BackSide : DoubleSide,
|
|
@@ -604,20 +729,26 @@ var Cube3D = class extends Object3D {
|
|
|
604
729
|
[v1, v2, v3, v4] = [v4, v1, v2, v3];
|
|
605
730
|
break;
|
|
606
731
|
}
|
|
607
|
-
mesh.geometry.setAttribute(
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
732
|
+
mesh.geometry.setAttribute(
|
|
733
|
+
"uv",
|
|
734
|
+
new BufferAttribute(
|
|
735
|
+
new Float32Array([
|
|
736
|
+
v3.x,
|
|
737
|
+
v3.y,
|
|
738
|
+
v2.x,
|
|
739
|
+
v2.y,
|
|
740
|
+
v4.x,
|
|
741
|
+
v4.y,
|
|
742
|
+
v2.x,
|
|
743
|
+
v2.y,
|
|
744
|
+
v1.x,
|
|
745
|
+
v1.y,
|
|
746
|
+
v4.x,
|
|
747
|
+
v4.y
|
|
748
|
+
]),
|
|
749
|
+
2
|
|
750
|
+
)
|
|
751
|
+
);
|
|
621
752
|
cubie.add(mesh);
|
|
622
753
|
};
|
|
623
754
|
addImageSticker(true);
|
|
@@ -633,14 +764,22 @@ var Cube3D = class extends Object3D {
|
|
|
633
764
|
}
|
|
634
765
|
createCubieFoundation() {
|
|
635
766
|
const box = sharedCubieFoundationGeometry();
|
|
636
|
-
return new Mesh(
|
|
767
|
+
return new Mesh(
|
|
768
|
+
box,
|
|
769
|
+
this.options.experimentalStickering === "picture" ? blackMesh : blackTranslucentMesh
|
|
770
|
+
);
|
|
637
771
|
}
|
|
638
772
|
createSticker(posAxisInfo, materialAxisInfo, isHint) {
|
|
639
|
-
const geo = this.options.experimentalStickering === "picture" ? newStickerGeometry() : isHint ?
|
|
640
|
-
const stickerMesh = new Mesh(
|
|
773
|
+
const geo = this.options.experimentalStickering === "picture" ? newStickerGeometry() : isHint ? this.#sharedHintStickerGeometry() : sharedStickerGeometry();
|
|
774
|
+
const stickerMesh = new Mesh(
|
|
775
|
+
geo,
|
|
776
|
+
isHint ? materialAxisInfo.hintStickerMaterial.regular : materialAxisInfo.stickerMaterial.regular
|
|
777
|
+
);
|
|
641
778
|
stickerMesh.setRotationFromEuler(posAxisInfo.fromZ);
|
|
642
779
|
stickerMesh.position.copy(posAxisInfo.vector);
|
|
643
|
-
stickerMesh.position.multiplyScalar(
|
|
780
|
+
stickerMesh.position.multiplyScalar(
|
|
781
|
+
isHint ? this.options.experimentalStickering === "picture" ? EXPERIMENTAL_PICTURE_CUBE_HINT_ELEVATION : cubieDimensions.hintStickerElevation : cubieDimensions.stickerElevation
|
|
782
|
+
);
|
|
644
783
|
return stickerMesh;
|
|
645
784
|
}
|
|
646
785
|
experimentalSetFoundationOpacity(opacity) {
|
|
@@ -650,7 +789,9 @@ var Cube3D = class extends Object3D {
|
|
|
650
789
|
for (const orbitInfo of Object.values(this.kpuzzleFaceletInfo)) {
|
|
651
790
|
for (const pieceInfo of orbitInfo) {
|
|
652
791
|
for (const faceletInfo of pieceInfo) {
|
|
653
|
-
faceletInfo.facelet.scale.setScalar(
|
|
792
|
+
faceletInfo.facelet.scale.setScalar(
|
|
793
|
+
width / cubieDimensions.stickerWidth
|
|
794
|
+
);
|
|
654
795
|
}
|
|
655
796
|
}
|
|
656
797
|
}
|
|
@@ -659,7 +800,9 @@ var Cube3D = class extends Object3D {
|
|
|
659
800
|
for (const orbitInfo of [this.kpuzzleFaceletInfo["CENTERS"]]) {
|
|
660
801
|
for (const pieceInfo of orbitInfo) {
|
|
661
802
|
for (const faceletInfo of pieceInfo) {
|
|
662
|
-
faceletInfo.facelet.scale.setScalar(
|
|
803
|
+
faceletInfo.facelet.scale.setScalar(
|
|
804
|
+
width / cubieDimensions.stickerWidth
|
|
805
|
+
);
|
|
663
806
|
}
|
|
664
807
|
}
|
|
665
808
|
}
|
|
@@ -668,38 +811,6 @@ var Cube3D = class extends Object3D {
|
|
|
668
811
|
return smootherStep(fraction);
|
|
669
812
|
}
|
|
670
813
|
};
|
|
671
|
-
_sharedHintStickerGeometryCache = new WeakMap();
|
|
672
|
-
_sharedHintStickerGeometry = new WeakSet();
|
|
673
|
-
sharedHintStickerGeometry_fn = function() {
|
|
674
|
-
return __privateGet(this, _sharedHintStickerGeometryCache) ?? __privateSet(this, _sharedHintStickerGeometryCache, newStickerGeometry());
|
|
675
|
-
};
|
|
676
|
-
_animateRaiseHintFacelets = new WeakSet();
|
|
677
|
-
animateRaiseHintFacelets_fn = function() {
|
|
678
|
-
if (!twistyDebugGlobals.animateRaiseHintFacelets || haveStartedSharingRenderers()) {
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
const translationRange = cubieDimensions.hintStickerElevation - cubieDimensions.stickerElevation;
|
|
682
|
-
__privateMethod(this, _sharedHintStickerGeometry, sharedHintStickerGeometry_fn).call(this).translate(0, 0, -translationRange);
|
|
683
|
-
setTimeout(() => {
|
|
684
|
-
const hintStartTime = performance.now();
|
|
685
|
-
let lastTranslation = 0;
|
|
686
|
-
const translationDuration = 1e3;
|
|
687
|
-
function ease(x) {
|
|
688
|
-
return x * (2 - x);
|
|
689
|
-
}
|
|
690
|
-
const animateRaiseHintSticker = () => {
|
|
691
|
-
const elapsed = performance.now() - hintStartTime;
|
|
692
|
-
const newTranslation = ease(elapsed / translationDuration) * translationRange;
|
|
693
|
-
__privateMethod(this, _sharedHintStickerGeometry, sharedHintStickerGeometry_fn).call(this).translate(0, 0, newTranslation - lastTranslation);
|
|
694
|
-
lastTranslation = newTranslation;
|
|
695
|
-
if (elapsed < translationDuration) {
|
|
696
|
-
requestAnimationFrame(animateRaiseHintSticker);
|
|
697
|
-
this.scheduleRenderCallback?.();
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
animateRaiseHintSticker();
|
|
701
|
-
}, 500);
|
|
702
|
-
};
|
|
703
814
|
|
|
704
815
|
// src/cubing/twisty/views/3D/puzzles/PG3D.ts
|
|
705
816
|
import {
|
|
@@ -726,7 +837,11 @@ var basicStickerMaterial = new MeshBasicMaterial2({
|
|
|
726
837
|
vertexColors: true
|
|
727
838
|
});
|
|
728
839
|
function dist(coords, a, b) {
|
|
729
|
-
return Math.hypot(
|
|
840
|
+
return Math.hypot(
|
|
841
|
+
coords[3 * a] - coords[3 * b],
|
|
842
|
+
coords[3 * a + 1] - coords[3 * b + 1],
|
|
843
|
+
coords[3 * a + 2] - coords[3 * b + 2]
|
|
844
|
+
);
|
|
730
845
|
}
|
|
731
846
|
function triarea(coords, a, b, c) {
|
|
732
847
|
const ab = dist(coords, a, b);
|
|
@@ -909,8 +1024,17 @@ var StickerDef = class {
|
|
|
909
1024
|
}
|
|
910
1025
|
addHint(filler, stickerDat, hintStickers, hintStickerHeightScale, trim, normal2) {
|
|
911
1026
|
this.hintStart = filler.ipos;
|
|
912
|
-
const coords = this.hintCoords(
|
|
913
|
-
|
|
1027
|
+
const coords = this.hintCoords(
|
|
1028
|
+
stickerDat.coords,
|
|
1029
|
+
hintStickerHeightScale,
|
|
1030
|
+
trim,
|
|
1031
|
+
normal2
|
|
1032
|
+
);
|
|
1033
|
+
filler.makePoly(
|
|
1034
|
+
coords,
|
|
1035
|
+
this.faceColor,
|
|
1036
|
+
hintStickers && !this.isDup ? 2 : 4
|
|
1037
|
+
);
|
|
914
1038
|
this.hintEnd = filler.ipos;
|
|
915
1039
|
}
|
|
916
1040
|
addFoundation(filler, stickerDat, black) {
|
|
@@ -958,7 +1082,10 @@ var StickerDef = class {
|
|
|
958
1082
|
filler.colors[filler.pos + i + 1] = c >> 8 & 255;
|
|
959
1083
|
filler.colors[filler.pos + i + 2] = c & 255;
|
|
960
1084
|
}
|
|
961
|
-
this.setHintStickers(
|
|
1085
|
+
this.setHintStickers(
|
|
1086
|
+
filler,
|
|
1087
|
+
faceletMeshAppearance !== "invisible" && !this.isDup
|
|
1088
|
+
);
|
|
962
1089
|
}
|
|
963
1090
|
addUVs(filler) {
|
|
964
1091
|
const uvs = filler.uvs;
|
|
@@ -987,8 +1114,16 @@ var StickerDef = class {
|
|
|
987
1114
|
}
|
|
988
1115
|
this.texturePtr = sd;
|
|
989
1116
|
const sz = 6 * filler.sz;
|
|
990
|
-
filler.uvs.copyWithin(
|
|
991
|
-
|
|
1117
|
+
filler.uvs.copyWithin(
|
|
1118
|
+
6 * this.stickerStart,
|
|
1119
|
+
6 * sd.stickerStart + sz,
|
|
1120
|
+
6 * sd.stickerEnd + sz
|
|
1121
|
+
);
|
|
1122
|
+
filler.uvs.copyWithin(
|
|
1123
|
+
6 * this.hintStart,
|
|
1124
|
+
6 * sd.hintStart + sz,
|
|
1125
|
+
6 * sd.hintEnd + sz
|
|
1126
|
+
);
|
|
992
1127
|
return 1;
|
|
993
1128
|
}
|
|
994
1129
|
setColor(filler, sd) {
|
|
@@ -996,8 +1131,16 @@ var StickerDef = class {
|
|
|
996
1131
|
if (this.faceColor !== c) {
|
|
997
1132
|
this.faceColor = c;
|
|
998
1133
|
const sz = filler.pos;
|
|
999
|
-
filler.colors.copyWithin(
|
|
1000
|
-
|
|
1134
|
+
filler.colors.copyWithin(
|
|
1135
|
+
9 * this.stickerStart,
|
|
1136
|
+
9 * sd.stickerStart + sz,
|
|
1137
|
+
9 * sd.stickerEnd + sz
|
|
1138
|
+
);
|
|
1139
|
+
filler.colors.copyWithin(
|
|
1140
|
+
9 * this.hintStart,
|
|
1141
|
+
9 * sd.hintStart + sz,
|
|
1142
|
+
9 * sd.hintEnd + sz
|
|
1143
|
+
);
|
|
1001
1144
|
return 1;
|
|
1002
1145
|
} else {
|
|
1003
1146
|
return 0;
|
|
@@ -1017,7 +1160,9 @@ var HitPlaneDef = class {
|
|
|
1017
1160
|
this.geo = new BufferGeometry2();
|
|
1018
1161
|
filler.setAttributes(this.geo);
|
|
1019
1162
|
const obj = new Mesh2(this.geo, invisMaterial);
|
|
1020
|
-
obj.userData.quantumMove = stickerDat.notationMapper.notationToExternal(
|
|
1163
|
+
obj.userData.quantumMove = stickerDat.notationMapper.notationToExternal(
|
|
1164
|
+
new Move(hitface.name)
|
|
1165
|
+
);
|
|
1021
1166
|
this.cubie.scale.setScalar(0.99);
|
|
1022
1167
|
this.cubie.add(obj);
|
|
1023
1168
|
}
|
|
@@ -1031,7 +1176,6 @@ var AxisInfo2 = class {
|
|
|
1031
1176
|
};
|
|
1032
1177
|
var DEFAULT_COLOR_FRACTION = 0.71;
|
|
1033
1178
|
var PG_SCALE = 0.5;
|
|
1034
|
-
var _pendingStickeringUpdate, _isValidMove, isValidMove_fn;
|
|
1035
1179
|
var PG3D = class extends Object3D2 {
|
|
1036
1180
|
constructor(scheduleRenderCallback, kpuzzle, stickerDat, enableFoundationOpt = false, enableHintStickersOpt = false, hintStickerHeightScale = 1, params = {}) {
|
|
1037
1181
|
super();
|
|
@@ -1039,13 +1183,12 @@ var PG3D = class extends Object3D2 {
|
|
|
1039
1183
|
this.kpuzzle = kpuzzle;
|
|
1040
1184
|
this.stickerDat = stickerDat;
|
|
1041
1185
|
this.params = params;
|
|
1042
|
-
__privateAdd(this, _isValidMove);
|
|
1043
1186
|
this.stickerTargets = [];
|
|
1044
1187
|
this.controlTargets = [];
|
|
1045
1188
|
this.textured = false;
|
|
1046
1189
|
this.showHintStickers = false;
|
|
1047
1190
|
this.showFoundations = false;
|
|
1048
|
-
|
|
1191
|
+
this.#pendingStickeringUpdate = false;
|
|
1049
1192
|
if (stickerDat.stickers.length === 0) {
|
|
1050
1193
|
throw Error("Reuse of stickerdat from pg; please don't do that.");
|
|
1051
1194
|
}
|
|
@@ -1102,7 +1245,13 @@ var PG3D = class extends Object3D2 {
|
|
|
1102
1245
|
}
|
|
1103
1246
|
const options = {};
|
|
1104
1247
|
if (params.appearance) {
|
|
1105
|
-
options.appearance = getFaceletAppearance(
|
|
1248
|
+
options.appearance = getFaceletAppearance(
|
|
1249
|
+
params.appearance,
|
|
1250
|
+
orbit,
|
|
1251
|
+
ord,
|
|
1252
|
+
ori,
|
|
1253
|
+
false
|
|
1254
|
+
);
|
|
1106
1255
|
}
|
|
1107
1256
|
const stickerdef = new StickerDef(filler, sticker, trim, options);
|
|
1108
1257
|
this.stickers[orbit][ori][ord] = stickerdef;
|
|
@@ -1113,7 +1262,14 @@ var PG3D = class extends Object3D2 {
|
|
|
1113
1262
|
const orbit = sticker.orbit;
|
|
1114
1263
|
const ord = sticker.ord;
|
|
1115
1264
|
const ori = sticker.ori;
|
|
1116
|
-
this.stickers[orbit][ori][ord].addHint(
|
|
1265
|
+
this.stickers[orbit][ori][ord].addHint(
|
|
1266
|
+
filler,
|
|
1267
|
+
sticker,
|
|
1268
|
+
enableHintStickersOpt,
|
|
1269
|
+
hintStickerHeightScale,
|
|
1270
|
+
trim,
|
|
1271
|
+
normals[sticker.face]
|
|
1272
|
+
);
|
|
1117
1273
|
}
|
|
1118
1274
|
this.foundationBound = filler.ipos;
|
|
1119
1275
|
for (const sticker of stickers) {
|
|
@@ -1138,7 +1294,11 @@ var PG3D = class extends Object3D2 {
|
|
|
1138
1294
|
this.fixedGeo = fixedGeo;
|
|
1139
1295
|
this.filler = filler;
|
|
1140
1296
|
for (const hitface of hitfaces) {
|
|
1141
|
-
const facedef = new HitPlaneDef(
|
|
1297
|
+
const facedef = new HitPlaneDef(
|
|
1298
|
+
hitface,
|
|
1299
|
+
stickerDat.textureMapper,
|
|
1300
|
+
this.stickerDat
|
|
1301
|
+
);
|
|
1142
1302
|
facedef.cubie.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);
|
|
1143
1303
|
this.add(facedef.cubie);
|
|
1144
1304
|
this.controlTargets.push(facedef.cubie.children[0]);
|
|
@@ -1147,6 +1307,7 @@ var PG3D = class extends Object3D2 {
|
|
|
1147
1307
|
stickerDat.stickers = [];
|
|
1148
1308
|
this.updateMaterialArrays();
|
|
1149
1309
|
}
|
|
1310
|
+
#pendingStickeringUpdate;
|
|
1150
1311
|
dispose() {
|
|
1151
1312
|
if (this.fixedGeo) {
|
|
1152
1313
|
this.fixedGeo.dispose();
|
|
@@ -1168,6 +1329,14 @@ var PG3D = class extends Object3D2 {
|
|
|
1168
1329
|
experimentalGetControlTargets() {
|
|
1169
1330
|
return this.controlTargets;
|
|
1170
1331
|
}
|
|
1332
|
+
#isValidMove(move) {
|
|
1333
|
+
try {
|
|
1334
|
+
this.kpuzzle.moveToTransformation(move);
|
|
1335
|
+
return true;
|
|
1336
|
+
} catch (_) {
|
|
1337
|
+
return false;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1171
1340
|
getClosestMoveToAxis(point, transformations) {
|
|
1172
1341
|
let closestMove = null;
|
|
1173
1342
|
let closestMoveDotProduct = 0;
|
|
@@ -1183,11 +1352,13 @@ var PG3D = class extends Object3D2 {
|
|
|
1183
1352
|
for (const axis of this.stickerDat.axis) {
|
|
1184
1353
|
const product = point.dot(new Vector32(...axis.coordinates));
|
|
1185
1354
|
if (product > closestMoveDotProduct) {
|
|
1186
|
-
const modified = this.stickerDat.notationMapper.notationToExternal(
|
|
1355
|
+
const modified = this.stickerDat.notationMapper.notationToExternal(
|
|
1356
|
+
modify(axis.quantumMove)
|
|
1357
|
+
);
|
|
1187
1358
|
if (!modified) {
|
|
1188
1359
|
continue;
|
|
1189
1360
|
}
|
|
1190
|
-
if (
|
|
1361
|
+
if (this.#isValidMove(modified)) {
|
|
1191
1362
|
closestMoveDotProduct = product;
|
|
1192
1363
|
closestMove = modified;
|
|
1193
1364
|
}
|
|
@@ -1208,7 +1379,13 @@ var PG3D = class extends Object3D2 {
|
|
|
1208
1379
|
const { numPieces, numOrientations: orientations } = this.kpuzzle.definition.orbits[orbitName];
|
|
1209
1380
|
for (let pieceIdx = 0; pieceIdx < numPieces; pieceIdx++) {
|
|
1210
1381
|
for (let faceletIdx = 0; faceletIdx < orientations; faceletIdx++) {
|
|
1211
|
-
const faceletAppearance = getFaceletAppearance(
|
|
1382
|
+
const faceletAppearance = getFaceletAppearance(
|
|
1383
|
+
appearance,
|
|
1384
|
+
orbitName,
|
|
1385
|
+
pieceIdx,
|
|
1386
|
+
faceletIdx,
|
|
1387
|
+
false
|
|
1388
|
+
);
|
|
1212
1389
|
const stickerDef = this.stickers[orbitName][faceletIdx][pieceIdx];
|
|
1213
1390
|
if (this.textured && this.hintMaterialDisposable && faceletAppearance === "invisible") {
|
|
1214
1391
|
} else {
|
|
@@ -1217,7 +1394,7 @@ var PG3D = class extends Object3D2 {
|
|
|
1217
1394
|
}
|
|
1218
1395
|
}
|
|
1219
1396
|
}
|
|
1220
|
-
|
|
1397
|
+
this.#pendingStickeringUpdate = true;
|
|
1221
1398
|
if (this.lastPos) {
|
|
1222
1399
|
this.onPositionChange(this.lastPos);
|
|
1223
1400
|
}
|
|
@@ -1232,7 +1409,7 @@ var PG3D = class extends Object3D2 {
|
|
|
1232
1409
|
let colormods = 0;
|
|
1233
1410
|
const filler = this.filler;
|
|
1234
1411
|
const ind = filler.ind;
|
|
1235
|
-
if (!this.lastPos ||
|
|
1412
|
+
if (!this.lastPos || this.#pendingStickeringUpdate || !this.lastPos.state.experimentalToTransformation().isIdentical(transformation)) {
|
|
1236
1413
|
for (const orbit in this.stickers) {
|
|
1237
1414
|
const pieces = this.stickers[orbit];
|
|
1238
1415
|
const pos2 = transformation.transformationData[orbit];
|
|
@@ -1274,11 +1451,15 @@ var PG3D = class extends Object3D2 {
|
|
|
1274
1451
|
const move = externalMove;
|
|
1275
1452
|
let quantumTransformation;
|
|
1276
1453
|
try {
|
|
1277
|
-
quantumTransformation = this.kpuzzle.moveToTransformation(
|
|
1454
|
+
quantumTransformation = this.kpuzzle.moveToTransformation(
|
|
1455
|
+
move.modified({ amount: 1 })
|
|
1456
|
+
);
|
|
1278
1457
|
} catch (e) {
|
|
1279
1458
|
const move1 = this.stickerDat.notationMapper.notationToInternal(move);
|
|
1280
1459
|
if (move1) {
|
|
1281
|
-
const move2 = this.stickerDat.notationMapper.notationToExternal(
|
|
1460
|
+
const move2 = this.stickerDat.notationMapper.notationToExternal(
|
|
1461
|
+
move1.modified({ amount: 1 })
|
|
1462
|
+
);
|
|
1282
1463
|
if (move2) {
|
|
1283
1464
|
quantumTransformation = this.kpuzzle.moveToTransformation(move2);
|
|
1284
1465
|
}
|
|
@@ -1337,10 +1518,10 @@ var PG3D = class extends Object3D2 {
|
|
|
1337
1518
|
this.lastMoveTransformation = quantumTransformation;
|
|
1338
1519
|
}
|
|
1339
1520
|
}
|
|
1340
|
-
if (
|
|
1521
|
+
if (this.#pendingStickeringUpdate || vismods) {
|
|
1341
1522
|
this.filler.makeGroups(this.fixedGeo);
|
|
1342
1523
|
}
|
|
1343
|
-
if (
|
|
1524
|
+
if (this.#pendingStickeringUpdate || colormods) {
|
|
1344
1525
|
if (this.textured) {
|
|
1345
1526
|
this.fixedGeo.getAttribute("uv").updateRange = {
|
|
1346
1527
|
offset: 0,
|
|
@@ -1348,7 +1529,7 @@ var PG3D = class extends Object3D2 {
|
|
|
1348
1529
|
};
|
|
1349
1530
|
this.fixedGeo.getAttribute("uv").needsUpdate = true;
|
|
1350
1531
|
}
|
|
1351
|
-
if (
|
|
1532
|
+
if (this.#pendingStickeringUpdate || !this.textured) {
|
|
1352
1533
|
this.fixedGeo.getAttribute("color").updateRange = {
|
|
1353
1534
|
offset: 0,
|
|
1354
1535
|
count: 9 * this.foundationBound
|
|
@@ -1357,7 +1538,7 @@ var PG3D = class extends Object3D2 {
|
|
|
1357
1538
|
}
|
|
1358
1539
|
}
|
|
1359
1540
|
this.scheduleRenderCallback();
|
|
1360
|
-
|
|
1541
|
+
this.#pendingStickeringUpdate = false;
|
|
1361
1542
|
}
|
|
1362
1543
|
ease(fraction) {
|
|
1363
1544
|
return smootherStep(fraction);
|
|
@@ -1418,7 +1599,7 @@ var PG3D = class extends Object3D2 {
|
|
|
1418
1599
|
if (options.hintStickerOpacity !== void 0) {
|
|
1419
1600
|
this.setHintStickerOpacity(options.hintStickerOpacity);
|
|
1420
1601
|
}
|
|
1421
|
-
|
|
1602
|
+
this.#pendingStickeringUpdate = true;
|
|
1422
1603
|
if (this.lastPos) {
|
|
1423
1604
|
this.onPositionChange(this.lastPos);
|
|
1424
1605
|
}
|
|
@@ -1485,23 +1666,13 @@ var PG3D = class extends Object3D2 {
|
|
|
1485
1666
|
this.showHintFacelets(hintTexture !== null);
|
|
1486
1667
|
}
|
|
1487
1668
|
this.updateMaterialArrays();
|
|
1488
|
-
|
|
1669
|
+
this.#pendingStickeringUpdate = true;
|
|
1489
1670
|
if (this.lastPos) {
|
|
1490
1671
|
this.onPositionChange(this.lastPos);
|
|
1491
1672
|
}
|
|
1492
1673
|
this.scheduleRenderCallback();
|
|
1493
1674
|
}
|
|
1494
1675
|
};
|
|
1495
|
-
_pendingStickeringUpdate = new WeakMap();
|
|
1496
|
-
_isValidMove = new WeakSet();
|
|
1497
|
-
isValidMove_fn = function(move) {
|
|
1498
|
-
try {
|
|
1499
|
-
this.kpuzzle.moveToTransformation(move);
|
|
1500
|
-
return true;
|
|
1501
|
-
} catch (_) {
|
|
1502
|
-
return false;
|
|
1503
|
-
}
|
|
1504
|
-
};
|
|
1505
1676
|
|
|
1506
1677
|
// src/cubing/twisty/heavy-code-imports/dynamic-entries/twisty-dynamic-3d.ts
|
|
1507
1678
|
import * as T3I from "three";
|
|
@@ -1542,7 +1713,13 @@ async function cube3DShim(renderCallback, options) {
|
|
|
1542
1713
|
return new Cube3D(await cube3x3x3.kpuzzle(), renderCallback, options);
|
|
1543
1714
|
}
|
|
1544
1715
|
async function pg3dShim(renderCallback, puzzleLoader, hintFacelets) {
|
|
1545
|
-
return new PG3D(
|
|
1716
|
+
return new PG3D(
|
|
1717
|
+
renderCallback,
|
|
1718
|
+
await puzzleLoader.kpuzzle(),
|
|
1719
|
+
(await puzzleLoader.pg()).get3d(),
|
|
1720
|
+
true,
|
|
1721
|
+
hintFacelets === "floating"
|
|
1722
|
+
);
|
|
1546
1723
|
}
|
|
1547
1724
|
export {
|
|
1548
1725
|
Cube3D,
|
|
@@ -1552,4 +1729,4 @@ export {
|
|
|
1552
1729
|
cube3DShim,
|
|
1553
1730
|
pg3dShim
|
|
1554
1731
|
};
|
|
1555
|
-
//# sourceMappingURL=twisty-dynamic-3d-
|
|
1732
|
+
//# sourceMappingURL=twisty-dynamic-3d-D3ZDBJUH.js.map
|