@miris-inc/core 0.0.8-e755f30 → 0.0.8-e7873f9
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/AquaApi.wasm +0 -0
- package/dist/aqua-parser.wasm +0 -0
- package/dist/core.d.ts +16 -1
- package/dist/core.js +39 -5
- package/dist/core.prod.js +1 -1
- package/dist/core.standalone.js +42 -8
- package/dist/core.standalone.prod.js +1 -1
- package/package.json +1 -1
- package/webshark.d.ts +30 -2
package/dist/AquaApi.wasm
CHANGED
|
Binary file
|
package/dist/aqua-parser.wasm
CHANGED
|
Binary file
|
package/dist/core.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ declare interface AttributeInfo extends EmbindObject {
|
|
|
9
9
|
readonly elementCount: number;
|
|
10
10
|
readonly dataSizeBytes: number;
|
|
11
11
|
readonly clientSideId: bigint;
|
|
12
|
-
|
|
12
|
+
// An embind CompressionType value, compared by identity against MainModule.CompressionType
|
|
13
|
+
readonly compressionType: unknown;
|
|
14
|
+
readonly minValue: { x: number; y: number; z: number; w: number };
|
|
13
15
|
readonly maxValue: { x: number; y: number; z: number };
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -32,6 +34,8 @@ export declare class AttributeNames {
|
|
|
32
34
|
static readonly OCTANT_OFFSETS: string;
|
|
33
35
|
static readonly SURFEL_OCTANT_OFFSETS: string;
|
|
34
36
|
static readonly SURFEL_COUNT: string;
|
|
37
|
+
static readonly SURFEL_OWNER_GROUPS: string;
|
|
38
|
+
static readonly OCTANT_CELL: string;
|
|
35
39
|
static readonly REFLECTANCE_DATA_V1: string;
|
|
36
40
|
static readonly GLASS_MESH_GEOMETRY: string;
|
|
37
41
|
static readonly GLASS_MESH_PANELS: string;
|
|
@@ -196,6 +200,10 @@ declare class Engine {
|
|
|
196
200
|
get module(): MainModule;
|
|
197
201
|
constructor(moduleOptions?: Record<string, unknown>);
|
|
198
202
|
get AttributeInfo(): new () => AttributeInfo;
|
|
203
|
+
get CompressionType(): {
|
|
204
|
+
SHARK_ELLIPSOID_COMPRESSED: unknown;
|
|
205
|
+
SHARK_ELLIPSOID_COMPRESSED_ROOT_RELATIVE: unknown;
|
|
206
|
+
};
|
|
199
207
|
get Handedness(): {
|
|
200
208
|
Right: number;
|
|
201
209
|
Left: number;
|
|
@@ -382,6 +390,8 @@ export declare class Lod {
|
|
|
382
390
|
get _hasOctantOffsets(): boolean;
|
|
383
391
|
get _surfelOctantOffsets(): Uint32Array<ArrayBuffer> | null;
|
|
384
392
|
get _surfelCount(): number;
|
|
393
|
+
get _surfelOwnerGroups(): Uint32Array<ArrayBuffer> | null;
|
|
394
|
+
get _octantCell(): Uint32Array<ArrayBuffer> | null;
|
|
385
395
|
_readOctantOffsets(engine: Engine): void;
|
|
386
396
|
hasAttribute(attributeName: string): boolean;
|
|
387
397
|
getDataFromAttribute(engine: Engine, attributeName: string, attributeInfo: AttributeInfo): CachedAttribute | null;
|
|
@@ -411,6 +421,10 @@ export declare class LodStore {
|
|
|
411
421
|
|
|
412
422
|
declare interface MainModule {
|
|
413
423
|
AttributeInfo: new () => AttributeInfo;
|
|
424
|
+
CompressionType: {
|
|
425
|
+
SHARK_ELLIPSOID_COMPRESSED: unknown;
|
|
426
|
+
SHARK_ELLIPSOID_COMPRESSED_ROOT_RELATIVE: unknown;
|
|
427
|
+
};
|
|
414
428
|
Handedness: { Right: number; Left: number };
|
|
415
429
|
HEAPF32: Float32Array<ArrayBuffer>;
|
|
416
430
|
HEAPU8: Uint8Array<ArrayBuffer>;
|
|
@@ -501,6 +515,7 @@ export declare class Miris {
|
|
|
501
515
|
static readonly _SHARK_SPLAT_BUDGET_CAP_DESKTOP = 2500000;
|
|
502
516
|
/* Excluded from this release type: _isMobileDevice */
|
|
503
517
|
/* Excluded from this release type: _sharkSplatCapacity */
|
|
518
|
+
/* Excluded from this release type: _limitSharkSplatCapacity */
|
|
504
519
|
/* Excluded from this release type: _sharkSplatBudgetCap */
|
|
505
520
|
/* Excluded from this release type: _setTargetFrameRate */
|
|
506
521
|
/* Excluded from this release type: _setXRModeActive */
|
package/dist/core.js
CHANGED
|
@@ -343,6 +343,9 @@ var Engine = class Engine {
|
|
|
343
343
|
get AttributeInfo() {
|
|
344
344
|
return this.module.AttributeInfo;
|
|
345
345
|
}
|
|
346
|
+
get CompressionType() {
|
|
347
|
+
return this.module.CompressionType;
|
|
348
|
+
}
|
|
346
349
|
get Handedness() {
|
|
347
350
|
return this.module.Handedness;
|
|
348
351
|
}
|
|
@@ -768,6 +771,8 @@ var AttributeNames = class {
|
|
|
768
771
|
static OCTANT_OFFSETS = "childOctantOffsets";
|
|
769
772
|
static SURFEL_OCTANT_OFFSETS = "surfelChildOctantOffsets";
|
|
770
773
|
static SURFEL_COUNT = "surfelCount";
|
|
774
|
+
static SURFEL_OWNER_GROUPS = "surfelOwnerGroups";
|
|
775
|
+
static OCTANT_CELL = "octantCell";
|
|
771
776
|
static REFLECTANCE_DATA_V1 = "reflectanceDataV1";
|
|
772
777
|
static GLASS_MESH_GEOMETRY = "glassMeshGeometry";
|
|
773
778
|
static GLASS_MESH_PANELS = "glassMeshPanels";
|
|
@@ -912,6 +917,8 @@ var Lod = class {
|
|
|
912
917
|
#octantOffsets = null;
|
|
913
918
|
#surfelOctantOffsets = null;
|
|
914
919
|
#surfelCount = 0;
|
|
920
|
+
#surfelOwnerGroups = null;
|
|
921
|
+
#octantCell = null;
|
|
915
922
|
#octantOffsetsRead = false;
|
|
916
923
|
get key() {
|
|
917
924
|
return this.#key ?? null;
|
|
@@ -981,6 +988,12 @@ var Lod = class {
|
|
|
981
988
|
get _surfelCount() {
|
|
982
989
|
return this.#surfelCount;
|
|
983
990
|
}
|
|
991
|
+
get _surfelOwnerGroups() {
|
|
992
|
+
return this.#surfelOwnerGroups;
|
|
993
|
+
}
|
|
994
|
+
get _octantCell() {
|
|
995
|
+
return this.#octantCell;
|
|
996
|
+
}
|
|
984
997
|
_readOctantOffsets(engine) {
|
|
985
998
|
if (this.#octantOffsetsRead) return;
|
|
986
999
|
this.#octantOffsetsRead = true;
|
|
@@ -990,6 +1003,9 @@ var Lod = class {
|
|
|
990
1003
|
if (surfelOffsets && surfelOffsets.length === 7) this.#surfelOctantOffsets = surfelOffsets;
|
|
991
1004
|
const surfelCount = getRawUint32Attribute(engine, this.#client, this.id, AttributeNames.SURFEL_COUNT);
|
|
992
1005
|
if (surfelCount && surfelCount.length === 1) this.#surfelCount = surfelCount[0];
|
|
1006
|
+
this.#surfelOwnerGroups = getRawUint32Attribute(engine, this.#client, this.id, AttributeNames.SURFEL_OWNER_GROUPS);
|
|
1007
|
+
const cell = getRawUint32Attribute(engine, this.#client, this.id, AttributeNames.OCTANT_CELL);
|
|
1008
|
+
if (cell && cell.length === 4) this.#octantCell = cell;
|
|
993
1009
|
}
|
|
994
1010
|
hasAttribute(attributeName) {
|
|
995
1011
|
return this.#client.hasAttribute(this.id, attributeName);
|
|
@@ -1401,7 +1417,7 @@ function createRefreshRateDetector() {
|
|
|
1401
1417
|
* or get `miris.pending`.
|
|
1402
1418
|
*/
|
|
1403
1419
|
var Miris = class Miris {
|
|
1404
|
-
static tryUseShark = typeof window
|
|
1420
|
+
static tryUseShark = typeof window === "undefined" || new URLSearchParams(window.location.search).get("shark") !== "0";
|
|
1405
1421
|
static _instance;
|
|
1406
1422
|
static async instance() {
|
|
1407
1423
|
const miris = this._instance ??= new this();
|
|
@@ -1524,7 +1540,7 @@ var Miris = class Miris {
|
|
|
1524
1540
|
static _XR_SPLAT_COUNT_BUDGET = 2e5;
|
|
1525
1541
|
/**
|
|
1526
1542
|
* @internal
|
|
1527
|
-
* Shark's GPU splat capacity. A lower limit on mobile to avoid excessive memory allocations in
|
|
1543
|
+
* Shark's GPU splat capacity. A lower limit on mobile to avoid excessive memory allocations in
|
|
1528
1544
|
* case we occasionally budget over a million prims (most phones can't do this).
|
|
1529
1545
|
*/
|
|
1530
1546
|
static _SHARK_SPLAT_CAPACITY_MOBILE = 1048576;
|
|
@@ -1547,17 +1563,35 @@ var Miris = class Miris {
|
|
|
1547
1563
|
if (navigator.maxTouchPoints > 0) return true;
|
|
1548
1564
|
return /Mobi|Android|iPhone|iPad|iPod|Opera Mini|IEMobile/.test(navigator.userAgent);
|
|
1549
1565
|
}
|
|
1566
|
+
static #sharkSplatCapacityLimit = null;
|
|
1550
1567
|
/**
|
|
1551
1568
|
* @internal
|
|
1552
1569
|
*/
|
|
1553
1570
|
static _sharkSplatCapacity() {
|
|
1554
|
-
|
|
1571
|
+
const capacity = Miris._isMobileDevice() ? Miris._SHARK_SPLAT_CAPACITY_MOBILE : Miris._SHARK_SPLAT_CAPACITY_DESKTOP;
|
|
1572
|
+
const limit = Miris.#sharkSplatCapacityLimit;
|
|
1573
|
+
return limit === null ? capacity : Math.min(capacity, limit);
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* @internal
|
|
1577
|
+
* The shark backend calls this once it has the device, when the device's storage-buffer
|
|
1578
|
+
* binding limit holds shark under _sharkSplatCapacity(). The budget cap follows with the same
|
|
1579
|
+
* margin, and every scene is told.
|
|
1580
|
+
*/
|
|
1581
|
+
static _limitSharkSplatCapacity(capacity) {
|
|
1582
|
+
const limit = Miris.#sharkSplatCapacityLimit;
|
|
1583
|
+
Miris.#sharkSplatCapacityLimit = limit === null ? capacity : Math.min(limit, capacity);
|
|
1584
|
+
const instance = Miris._instance;
|
|
1585
|
+
if (instance) instance.#applyDisplaySettings();
|
|
1555
1586
|
}
|
|
1556
1587
|
/**
|
|
1557
1588
|
* @internal
|
|
1558
1589
|
*/
|
|
1559
1590
|
static _sharkSplatBudgetCap() {
|
|
1560
|
-
|
|
1591
|
+
const mobile = Miris._isMobileDevice();
|
|
1592
|
+
const budgetCap = mobile ? Miris._SHARK_SPLAT_BUDGET_CAP_MOBILE : Miris._SHARK_SPLAT_BUDGET_CAP_DESKTOP;
|
|
1593
|
+
const capacity = mobile ? Miris._SHARK_SPLAT_CAPACITY_MOBILE : Miris._SHARK_SPLAT_CAPACITY_DESKTOP;
|
|
1594
|
+
return Math.floor(budgetCap * (Miris._sharkSplatCapacity() / capacity));
|
|
1561
1595
|
}
|
|
1562
1596
|
#bindRequestAnimationFrame() {
|
|
1563
1597
|
this._requestAnimationFrame = this._xrModeActive ? this._xrSession.requestAnimationFrame.bind(this._xrSession) : window.requestAnimationFrame.bind(window);
|
|
@@ -1818,7 +1852,7 @@ var Miris = class Miris {
|
|
|
1818
1852
|
}
|
|
1819
1853
|
}
|
|
1820
1854
|
/**
|
|
1821
|
-
* @internal
|
|
1855
|
+
* @internal
|
|
1822
1856
|
*
|
|
1823
1857
|
* Drives one host's frame. Returns whether *that host's* canvas needs repainting.
|
|
1824
1858
|
*
|