@adatechnology/game-animals-three 0.2.1 → 0.3.1
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/index.d.ts +5 -1
- package/dist/index.global.js +1600 -72
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { GAIT_PHASES } from "@adatechnology/game-animals";
|
|
3
|
+
import { markKitOrigin } from "@adatechnology/game-contracts";
|
|
3
4
|
import { collectReferencedNodes, createNodeSkin } from "@adatechnology/game-props3d";
|
|
5
|
+
import { shapeGeometries as shapeGeometries2 } from "@adatechnology/game-shapes-three";
|
|
4
6
|
|
|
5
7
|
// src/animate-bird.ts
|
|
6
8
|
var { PI } = Math;
|
|
@@ -419,6 +421,7 @@ var stripesTexture = (THREE, document, base, stripe) => canvasTexture(THREE, doc
|
|
|
419
421
|
var createCoatTexture = (THREE, document, marker) => marker.kind === "stripes" ? stripesTexture(THREE, document, marker.base, marker.stripe) : spotsTexture(THREE, document, marker.base, marker.spot);
|
|
420
422
|
|
|
421
423
|
// src/profile.ts
|
|
424
|
+
import { shapeGeometries } from "@adatechnology/game-shapes-three";
|
|
422
425
|
var profileGeometry = (THREE, length, profile, segments) => {
|
|
423
426
|
const points = profile.map((radius, index) => new THREE.Vector2(index / (profile.length - 1), radius));
|
|
424
427
|
const curve = new THREE.SplineCurve(points);
|
|
@@ -429,7 +432,7 @@ var profileGeometry = (THREE, length, profile, segments) => {
|
|
|
429
432
|
outline.push(new THREE.Vector2(Math.max(1e-3, point.y), -length / 2 + point.x * length));
|
|
430
433
|
}
|
|
431
434
|
outline.push(new THREE.Vector2(1e-3, length / 2));
|
|
432
|
-
return new THREE.LatheGeometry(outline, segments || 22).rotateX(Math.PI / 2);
|
|
435
|
+
return new (shapeGeometries(THREE)).LatheGeometry(outline, segments || 22).rotateX(Math.PI / 2);
|
|
433
436
|
};
|
|
434
437
|
|
|
435
438
|
// src/quadruped.ts
|
|
@@ -1152,7 +1155,7 @@ function createAnimalsTestModule(options = {}) {
|
|
|
1152
1155
|
{ kind: "action", id: "bite_all", name: text.actions.bite_all },
|
|
1153
1156
|
{ kind: "action", id: "recover", name: text.actions.recover },
|
|
1154
1157
|
{ kind: "action", id: "call", name: text.actions.call },
|
|
1155
|
-
{ kind: "action", id: "skin_40", name: text.actions.skin_40 },
|
|
1158
|
+
{ kind: "action", id: "skin_40", name: text.actions.skin_40, slow: true },
|
|
1156
1159
|
{ kind: "action", id: "clear_skins", name: text.actions.clear_skins }
|
|
1157
1160
|
],
|
|
1158
1161
|
layers: () => ["joints", "split", "sound_range", "carcass_lure"].map((id) => ({ id, name: text.layers[id], default: false })),
|
|
@@ -1196,7 +1199,8 @@ var countTriangles = (root) => {
|
|
|
1196
1199
|
});
|
|
1197
1200
|
return Math.round(triangles);
|
|
1198
1201
|
};
|
|
1199
|
-
var createAnimalsThree = (
|
|
1202
|
+
var createAnimalsThree = (host, options = {}) => {
|
|
1203
|
+
const THREE = shapeGeometries2(host);
|
|
1200
1204
|
const random = options.random ?? createStream(options.seed ?? 7);
|
|
1201
1205
|
const documentOf = () => {
|
|
1202
1206
|
const found = options.document ?? globalThis.document;
|
|
@@ -1213,6 +1217,7 @@ var createAnimalsThree = (THREE, options = {}) => {
|
|
|
1213
1217
|
else if (species.body.kind === "bird") buildBird(THREE, rig, { extra: BIRD_EXTRAS[species.id] });
|
|
1214
1218
|
else buildQuadruped(THREE, rig, { document: species.body.texture ? documentOf() : void 0, extra: QUADRUPED_EXTRAS[species.id] });
|
|
1215
1219
|
rig.triangles = countTriangles(rig.root);
|
|
1220
|
+
markKitOrigin(rig.root, { owner: "game-animals-three", kind: "animal", id: species.id });
|
|
1216
1221
|
rig.root.traverse((object) => {
|
|
1217
1222
|
if (object.isMesh) object.userData.speciesId = species.id;
|
|
1218
1223
|
});
|