minerender 2.1.0-alpha.55 → 2.1.0-alpha.59
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 +4 -1
- package/dist/browser/index.d.ts +4 -1
- package/dist/browser/index.js +28 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +28 -5
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +28 -5
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +4 -1
- package/dist/node/index.d.ts +4 -1
- package/dist/node/index.js +28 -5
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +28 -5
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -690,7 +690,7 @@ declare function applyElementRotation(rotation: ElementRotation, geometry: Buffe
|
|
|
690
690
|
declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
|
|
691
691
|
declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
|
|
692
692
|
declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
|
|
693
|
-
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): void;
|
|
693
|
+
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): () => void;
|
|
694
694
|
|
|
695
695
|
declare function captureException(e: any, ...extra: any[]): void;
|
|
696
696
|
declare function timingStart(marker: string): void;
|
|
@@ -1179,6 +1179,8 @@ declare class EntityObject extends SceneObject {
|
|
|
1179
1179
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
1180
1180
|
readonly options: EntityObjectOptions;
|
|
1181
1181
|
private meshesCreated;
|
|
1182
|
+
private readonly geometries;
|
|
1183
|
+
private readonly disposeWireframes;
|
|
1182
1184
|
/** Scrolling materials are owned: their texture offset follows this entity's age. */
|
|
1183
1185
|
private readonly scrollMaterials;
|
|
1184
1186
|
private scrollTicker;
|
|
@@ -1190,6 +1192,7 @@ declare class EntityObject extends SceneObject {
|
|
|
1190
1192
|
dispose(): void;
|
|
1191
1193
|
disposeAndRemoveAllChildren(): void;
|
|
1192
1194
|
private clearScrollMaterials;
|
|
1195
|
+
private updateScrollSubscription;
|
|
1193
1196
|
/** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
|
|
1194
1197
|
private updateScroll;
|
|
1195
1198
|
/** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -690,7 +690,7 @@ declare function applyElementRotation(rotation: ElementRotation, geometry: Buffe
|
|
|
690
690
|
declare function applyGenericRotation(axis: Axis, rotation: number, obj: Object3D): void;
|
|
691
691
|
declare function addBox3WireframeToObject(box: Box3, obj: Object3D, color?: number, w?: number): void;
|
|
692
692
|
declare function addWireframeToObject(obj: Object3D, color?: number, w?: number): void;
|
|
693
|
-
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): void;
|
|
693
|
+
declare function addWireframeToMesh(geo: BufferGeometry, mesh: Mesh, color?: number, w?: number): () => void;
|
|
694
694
|
|
|
695
695
|
declare function captureException(e: any, ...extra: any[]): void;
|
|
696
696
|
declare function timingStart(marker: string): void;
|
|
@@ -1179,6 +1179,8 @@ declare class EntityObject extends SceneObject {
|
|
|
1179
1179
|
static readonly DEFAULT_OPTIONS: EntityObjectOptions;
|
|
1180
1180
|
readonly options: EntityObjectOptions;
|
|
1181
1181
|
private meshesCreated;
|
|
1182
|
+
private readonly geometries;
|
|
1183
|
+
private readonly disposeWireframes;
|
|
1182
1184
|
/** Scrolling materials are owned: their texture offset follows this entity's age. */
|
|
1183
1185
|
private readonly scrollMaterials;
|
|
1184
1186
|
private scrollTicker;
|
|
@@ -1190,6 +1192,7 @@ declare class EntityObject extends SceneObject {
|
|
|
1190
1192
|
dispose(): void;
|
|
1191
1193
|
disposeAndRemoveAllChildren(): void;
|
|
1192
1194
|
private clearScrollMaterials;
|
|
1195
|
+
private updateScrollSubscription;
|
|
1193
1196
|
/** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
|
|
1194
1197
|
private updateScroll;
|
|
1195
1198
|
/** The animation started by {@link playAnimation}, until {@link stopAnimation} or disposal. */
|
package/dist/browser/index.js
CHANGED
|
@@ -1729,6 +1729,11 @@ function addWireframeToMesh(geo, mesh, color = 16777215, w = 2) {
|
|
|
1729
1729
|
mesh.add(wireframe);
|
|
1730
1730
|
let axes = new import_three8.AxesHelper(1);
|
|
1731
1731
|
mesh.add(axes);
|
|
1732
|
+
return () => {
|
|
1733
|
+
wireGeo.dispose();
|
|
1734
|
+
wireMat.dispose();
|
|
1735
|
+
axes.dispose();
|
|
1736
|
+
};
|
|
1732
1737
|
}
|
|
1733
1738
|
var import_three8;
|
|
1734
1739
|
var init_model = __esm({
|
|
@@ -5307,12 +5312,16 @@ var _EntityObject = class _EntityObject extends SceneObject {
|
|
|
5307
5312
|
this.entity = entity;
|
|
5308
5313
|
this.isEntityObject = true;
|
|
5309
5314
|
this.meshesCreated = false;
|
|
5315
|
+
this.geometries = /* @__PURE__ */ new Set();
|
|
5316
|
+
this.disposeWireframes = [];
|
|
5310
5317
|
/** Scrolling materials are owned: their texture offset follows this entity's age. */
|
|
5311
5318
|
this.scrollMaterials = [];
|
|
5312
5319
|
/** Entity age in ticks, as vanilla's `ageInTicks`; drives the scrolling render modes. */
|
|
5313
5320
|
this.age = 0;
|
|
5314
5321
|
this.animationPlayer = new EntityAnimationPlayer();
|
|
5315
5322
|
this.options = (0, import_ts_deepmerge4.default)({}, _EntityObject.DEFAULT_OPTIONS, options ?? {});
|
|
5323
|
+
this.addEventListener("added", () => this.updateScrollSubscription());
|
|
5324
|
+
this.addEventListener("removed", () => this.updateScrollSubscription());
|
|
5316
5325
|
}
|
|
5317
5326
|
async init() {
|
|
5318
5327
|
this.createMeshes();
|
|
@@ -5323,6 +5332,9 @@ var _EntityObject = class _EntityObject extends SceneObject {
|
|
|
5323
5332
|
}
|
|
5324
5333
|
disposeAndRemoveAllChildren() {
|
|
5325
5334
|
this.clearScrollMaterials();
|
|
5335
|
+
for (const geometry of this.geometries) geometry.dispose();
|
|
5336
|
+
this.geometries.clear();
|
|
5337
|
+
for (const dispose of this.disposeWireframes.splice(0)) dispose();
|
|
5326
5338
|
this.animationPlayer.clear();
|
|
5327
5339
|
super.disposeAndRemoveAllChildren();
|
|
5328
5340
|
}
|
|
@@ -5334,6 +5346,19 @@ var _EntityObject = class _EntityObject extends SceneObject {
|
|
|
5334
5346
|
material.dispose();
|
|
5335
5347
|
}
|
|
5336
5348
|
}
|
|
5349
|
+
updateScrollSubscription() {
|
|
5350
|
+
if (this.parent && this.scrollMaterials.length) {
|
|
5351
|
+
if (this.scrollTicker === void 0) {
|
|
5352
|
+
this.scrollTicker = Ticker.add(() => {
|
|
5353
|
+
this.age++;
|
|
5354
|
+
this.updateScroll();
|
|
5355
|
+
});
|
|
5356
|
+
}
|
|
5357
|
+
} else {
|
|
5358
|
+
Ticker.remove(this.scrollTicker);
|
|
5359
|
+
this.scrollTicker = void 0;
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5337
5362
|
/** Applies the entity age to the scrolling materials; the ticker calls this 20 times per second. */
|
|
5338
5363
|
updateScroll() {
|
|
5339
5364
|
for (const { offset, speed } of this.scrollMaterials) {
|
|
@@ -5444,6 +5469,7 @@ var _EntityObject = class _EntityObject extends SceneObject {
|
|
|
5444
5469
|
depth + growZ * 2,
|
|
5445
5470
|
uv
|
|
5446
5471
|
).clone();
|
|
5472
|
+
this.geometries.add(geometry);
|
|
5447
5473
|
geometry.translate(cube.origin[0] + width / 2, cube.origin[1] + height / 2, cube.origin[2] + depth / 2);
|
|
5448
5474
|
if (inward && Math.min(width + growX * 2, height + growY * 2, depth + growZ * 2) > 0) {
|
|
5449
5475
|
const index = Array.from(geometry.getIndex().array);
|
|
@@ -5452,7 +5478,7 @@ var _EntityObject = class _EntityObject extends SceneObject {
|
|
|
5452
5478
|
const mesh = this.createMesh(name, geometry, material);
|
|
5453
5479
|
mesh.renderOrder = renderOrder;
|
|
5454
5480
|
anchor.add(mesh);
|
|
5455
|
-
if (this.options.wireframe) addWireframeToMesh(geometry, mesh);
|
|
5481
|
+
if (this.options.wireframe) this.disposeWireframes.push(addWireframeToMesh(geometry, mesh));
|
|
5456
5482
|
}
|
|
5457
5483
|
for (const [childName, child] of Object.entries(part.children)) {
|
|
5458
5484
|
this.createPart(childName, child, anchor, size, material, renderOrder, inward);
|
|
@@ -5486,11 +5512,8 @@ var _EntityObject = class _EntityObject extends SceneObject {
|
|
|
5486
5512
|
this.clearScrollMaterials();
|
|
5487
5513
|
} else if (this.scrollMaterials.length) {
|
|
5488
5514
|
this.updateScroll();
|
|
5489
|
-
this.scrollTicker = Ticker.add(() => {
|
|
5490
|
-
this.age++;
|
|
5491
|
-
this.updateScroll();
|
|
5492
|
-
});
|
|
5493
5515
|
}
|
|
5516
|
+
this.updateScrollSubscription();
|
|
5494
5517
|
this.notifyDirty();
|
|
5495
5518
|
}
|
|
5496
5519
|
};
|