minerender 2.1.0-alpha.123 → 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 +23 -15
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +66 -58
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +24 -16
- 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 +23 -15
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +66 -58
- 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
|
@@ -3869,11 +3869,14 @@ var init_UVMapper = __esm({
|
|
|
3869
3869
|
});
|
|
3870
3870
|
}
|
|
3871
3871
|
static fillMissingTextureKeys(textures, target) {
|
|
3872
|
-
for (
|
|
3873
|
-
let
|
|
3874
|
-
|
|
3875
|
-
|
|
3872
|
+
for (const key in textures) {
|
|
3873
|
+
let name = key;
|
|
3874
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3875
|
+
while (textures[name]?.startsWith("#") && !seen.has(name)) {
|
|
3876
|
+
seen.add(name);
|
|
3877
|
+
name = textures[name].substr(1);
|
|
3876
3878
|
}
|
|
3879
|
+
if (name !== key) target[key] = target[name];
|
|
3877
3880
|
}
|
|
3878
3881
|
return target;
|
|
3879
3882
|
}
|
|
@@ -5254,13 +5257,14 @@ var init_EntityObject = __esm({
|
|
|
5254
5257
|
}
|
|
5255
5258
|
/**
|
|
5256
5259
|
* Plays a clip from {@link Entities.getAnimations}, replacing all active clips.
|
|
5257
|
-
* 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.
|
|
5258
5262
|
* The object owns no clock: call {@link advanceAnimation} per frame, or {@link setAnimationTime}.
|
|
5259
5263
|
*/
|
|
5260
5264
|
playAnimation(animation, options) {
|
|
5261
5265
|
this.playAnimations([animation], options);
|
|
5262
5266
|
}
|
|
5263
|
-
/** Plays
|
|
5267
|
+
/** Plays clips with a shared clock and no blending. Selected layers without their own clip follow `main`. */
|
|
5264
5268
|
playAnimations(animations, options) {
|
|
5265
5269
|
const targets = /* @__PURE__ */ new Set();
|
|
5266
5270
|
const selections = animations.map((animation) => {
|
|
@@ -5271,6 +5275,8 @@ var init_EntityObject = __esm({
|
|
|
5271
5275
|
if (!names.length) throw new Error(`Entity ${this.entity.id} has no selected animation layer "${layer}"`);
|
|
5272
5276
|
return { animation, names };
|
|
5273
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])));
|
|
5274
5280
|
this.createMeshes();
|
|
5275
5281
|
this.stopAnimation();
|
|
5276
5282
|
for (const { animation, names } of selections) {
|
|
@@ -5330,24 +5336,26 @@ var init_EntityObject = __esm({
|
|
|
5330
5336
|
createMeshes(force = false) {
|
|
5331
5337
|
if (this.meshesCreated && !force) return;
|
|
5332
5338
|
const modelRoot = new import_three14.Object3D();
|
|
5339
|
+
let transformNode = modelRoot;
|
|
5333
5340
|
const transform = this.options.flip === void 0 ? this.entity.transform : void 0;
|
|
5334
5341
|
if (transform) {
|
|
5335
|
-
for (const op of transform) {
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
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");
|
|
5341
5351
|
}
|
|
5342
|
-
modelRoot.matrixWorldNeedsUpdate = true;
|
|
5343
|
-
modelRoot.matrixAutoUpdate = false;
|
|
5344
5352
|
} else if (this.options.flip ?? true) {
|
|
5345
5353
|
modelRoot.scale.set(-1, -1, 1);
|
|
5346
5354
|
}
|
|
5347
5355
|
this.add(modelRoot);
|
|
5348
5356
|
Object.entries(this.entityLayers).forEach(([name, layer], index) => {
|
|
5349
5357
|
const group = this.createGroup(`layer:${name}`);
|
|
5350
|
-
|
|
5358
|
+
transformNode.add(group);
|
|
5351
5359
|
const inward = !Materials.entityModeCulls(layer.render ?? layer.layer.render);
|
|
5352
5360
|
this.createPart("root", layer.layer.root, group, layer.layer.texture, Materials.MISSING_TEXTURE, index, inward, this.options.faces?.[name]);
|
|
5353
5361
|
});
|