minerender 2.1.0-alpha.124 → 2.1.0-alpha.125
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 -3
- package/dist/browser/index.d.ts +4 -3
- package/dist/browser/index.js +16 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +59 -54
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +17 -12
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +4 -3
- package/dist/node/index.d.ts +4 -3
- package/dist/node/index.js +16 -11
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +59 -54
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -1189,7 +1189,7 @@ interface EntityAnimation {
|
|
|
1189
1189
|
/** Seconds. */
|
|
1190
1190
|
length: number;
|
|
1191
1191
|
loop: boolean;
|
|
1192
|
-
/** Geometry layer targeted by this clip; defaults to `main`. */
|
|
1192
|
+
/** Geometry layer targeted by this clip; defaults to `main`. A `main` clip also poses selected layers without their own clip. */
|
|
1193
1193
|
layer?: string;
|
|
1194
1194
|
/** Part name anywhere in a layer; `root` is the layer's root part. */
|
|
1195
1195
|
bones: Record<string, EntityAnimationBone>;
|
|
@@ -1597,11 +1597,12 @@ declare class EntityObject extends SceneObject {
|
|
|
1597
1597
|
get animationTime(): number;
|
|
1598
1598
|
/**
|
|
1599
1599
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
1600
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
1600
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
1601
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
1601
1602
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
1602
1603
|
*/
|
|
1603
1604
|
playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1604
|
-
/** Plays
|
|
1605
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
1605
1606
|
playAnimations(animations: readonly EntityAnimation[], options?: EntityAnimationOptions): void;
|
|
1606
1607
|
/** Stops all clips and restores the poses from before playback. */
|
|
1607
1608
|
stopAnimation(): void;
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1189,7 +1189,7 @@ interface EntityAnimation {
|
|
|
1189
1189
|
/** Seconds. */
|
|
1190
1190
|
length: number;
|
|
1191
1191
|
loop: boolean;
|
|
1192
|
-
/** Geometry layer targeted by this clip; defaults to `main`. */
|
|
1192
|
+
/** Geometry layer targeted by this clip; defaults to `main`. A `main` clip also poses selected layers without their own clip. */
|
|
1193
1193
|
layer?: string;
|
|
1194
1194
|
/** Part name anywhere in a layer; `root` is the layer's root part. */
|
|
1195
1195
|
bones: Record<string, EntityAnimationBone>;
|
|
@@ -1597,11 +1597,12 @@ declare class EntityObject extends SceneObject {
|
|
|
1597
1597
|
get animationTime(): number;
|
|
1598
1598
|
/**
|
|
1599
1599
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
1600
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
1600
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
1601
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
1601
1602
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
1602
1603
|
*/
|
|
1603
1604
|
playAnimation(animation: EntityAnimation, options?: EntityAnimationOptions): void;
|
|
1604
|
-
/** Plays
|
|
1605
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
1605
1606
|
playAnimations(animations: readonly EntityAnimation[], options?: EntityAnimationOptions): void;
|
|
1606
1607
|
/** Stops all clips and restores the poses from before playback. */
|
|
1607
1608
|
stopAnimation(): void;
|
package/dist/browser/index.js
CHANGED
|
@@ -5257,13 +5257,14 @@ var init_EntityObject = __esm({
|
|
|
5257
5257
|
}
|
|
5258
5258
|
/**
|
|
5259
5259
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
5260
|
-
* Offsets apply to the baked pose in the clip's layer (`main` by default)
|
|
5260
|
+
* Offsets apply to the baked pose in the clip's layer (`main` by default) and its repeated draws.
|
|
5261
|
+
* A `main` clip also poses every selected layer without a clip of its own.
|
|
5261
5262
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
5262
5263
|
*/
|
|
5263
5264
|
playAnimation(animation, options) {
|
|
5264
5265
|
this.playAnimations([animation], options);
|
|
5265
5266
|
}
|
|
5266
|
-
/** Plays
|
|
5267
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
5267
5268
|
playAnimations(animations, options) {
|
|
5268
5269
|
const targets = /* @__PURE__ */ new Set();
|
|
5269
5270
|
const selections = animations.map((animation) => {
|
|
@@ -5274,6 +5275,8 @@ var init_EntityObject = __esm({
|
|
|
5274
5275
|
if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
|
|
5275
5276
|
return { animation, names };
|
|
5276
5277
|
});
|
|
5278
|
+
const main = selections.find(({ animation }) => (animation.layer ?? "main") === "main");
|
|
5279
|
+
if (main) main.names.push(...Object.keys(this.entityLayers).filter((name) => !targets.has(name.split("#")[0])));
|
|
5277
5280
|
this.createMeshes();
|
|
5278
5281
|
this.stopAnimation();
|
|
5279
5282
|
for (const { animation, names } of selections) {
|
|
@@ -5333,24 +5336,26 @@ var init_EntityObject = __esm({
|
|
|
5333
5336
|
createMeshes(force = false) {
|
|
5334
5337
|
if (this.meshesCreated && !force) return;
|
|
5335
5338
|
const modelRoot = new import_three14.Object3D();
|
|
5339
|
+
let transformNode = modelRoot;
|
|
5336
5340
|
const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
|
|
5337
5341
|
if (transform) {
|
|
5338
|
-
for (const op of transform) {
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5342
|
+
for (const [index, op] of transform.entries()) {
|
|
5343
|
+
if (index > 0) {
|
|
5344
|
+
const child = new import_three14.Object3D();
|
|
5345
|
+
transformNode.add(child);
|
|
5346
|
+
transformNode = child;
|
|
5347
|
+
}
|
|
5348
|
+
if ("scale" in op) transformNode.scale.set(...op.scale);
|
|
5349
|
+
else if ("translate" in op) transformNode.position.set(...op.translate);
|
|
5350
|
+
else transformNode.rotation.set(...op.rotate, "ZYX");
|
|
5344
5351
|
}
|
|
5345
|
-
modelRoot.matrixWorldNeedsUpdate = true;
|
|
5346
|
-
modelRoot.matrixAutoUpdate = false;
|
|
5347
5352
|
} else if (this.options.flip ?? true) {
|
|
5348
5353
|
modelRoot.scale.set(-1, -1, 1);
|
|
5349
5354
|
}
|
|
5350
5355
|
this.add(modelRoot);
|
|
5351
5356
|
Object.entries(this.entityLayers).forEach(([name, layer], index) => {
|
|
5352
5357
|
const group = this.createGroup(`layer:${name}`);
|
|
5353
|
-
|
|
5358
|
+
transformNode.add(group);
|
|
5354
5359
|
const inward = !Materials.entityModeCulls(layer.render ?? layer.layer.render);
|
|
5355
5360
|
this.createPart("root", layer.layer.root, group, layer.layer.texture, Materials.MISSING_TEXTURE, index, inward, this.options.faces?.[name]);
|
|
5356
5361
|
});
|