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