@adatechnology/game-shapes 0.2.0 → 0.2.2

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 CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ShapeSchema, G as GenerateOptions, a as ShapeBuffers, b as ShapeNode, P as PrimitiveNode, c as PrimitiveBuffers, d as ShapeOutline, B as BevelSpec, V as Vec3, H as HoleSpec, e as ShapeGenerator, C as Color, T as Transform, R as RotationOrder } from './worker-BZ7plgyI.js';
2
- export { f as Bounds, g as BoxNode, h as CircleNode, i as ConeNode, j as CustomNode, k as CylinderNode, D as DifferenceNode, E as ExtrudeNode, l as GeneratorContext, m as GeometryGroup, n as GroupNode, I as InstanceSpec, o as InstancedBatch, L as LatheNode, p as LodLevel, M as Mat4, q as MaterialHint, r as MeshNode, N as NamedRange, s as NodeCommon, t as PlaneNode, u as PointNode, v as RingNode, w as ShapeBatch, x as ShapeJob, y as ShapeKind, z as ShapeLevel, A as ShapePart, F as ShapePoint, J as ShapeReply, K as ShapeStats, O as ShapeWorkerOptions, Q as SphereNode, U as TorusNode, W as UvRect, X as Vec2, Y as WorkerScopeLike, Z as installShapeWorker } from './worker-BZ7plgyI.js';
1
+ import { S as ShapeSchema, G as GenerateOptions, a as ShapeBuffers, b as ShapeNode, P as PrimitiveNode, c as PrimitiveBuffers, d as ShapeOutline, B as BevelSpec, V as Vec3, H as HoleSpec, e as ShapeGenerator, C as Color, T as Transform, R as RotationOrder } from './worker-DUZKXhCw.js';
2
+ export { f as Bounds, g as BoxNode, h as CircleNode, i as ConeNode, j as CustomNode, k as CylinderNode, D as DifferenceNode, E as ExtrudeNode, l as GeneratorContext, m as GeometryGroup, n as GroupNode, I as InstanceSpec, o as InstancedBatch, L as LatheNode, p as LodLevel, M as Mat4, q as MaterialHint, r as MeshNode, N as NamedRange, s as NodeCommon, t as PlaneNode, u as PointNode, v as RingNode, w as ShapeBatch, x as ShapeJob, y as ShapeKind, z as ShapeLevel, A as ShapePart, F as ShapePoint, J as ShapeReply, K as ShapeStats, O as ShapeWorkerOptions, Q as SphereNode, U as TorusNode, W as UvRect, X as Vec2, Y as WorkerScopeLike, Z as installShapeWorker } from './worker-DUZKXhCw.js';
3
3
 
4
4
  declare const isPrimitiveNode: (node: ShapeNode) => node is PrimitiveNode;
5
5
  /** The options that change the output, as they enter the cache key. */
@@ -1509,8 +1509,8 @@ var GameShapes = (() => {
1509
1509
  groups: []
1510
1510
  };
1511
1511
  }
1512
- function make(kind, p) {
1513
- switch (kind) {
1512
+ function make(p) {
1513
+ switch (p.kind) {
1514
1514
  case "box": {
1515
1515
  const size = p.size ?? [1, 1, 1];
1516
1516
  const segments = p.segments ?? [1, 1, 1];
@@ -1539,7 +1539,7 @@ var GameShapes = (() => {
1539
1539
  case "mesh":
1540
1540
  return mesh(p);
1541
1541
  default:
1542
- throw new Error(`game-shapes: unknown primitive kind "${String(kind)}"`);
1542
+ throw new Error(`game-shapes: unknown primitive kind "${String(p.kind)}"`);
1543
1543
  }
1544
1544
  }
1545
1545
  var templates = /* @__PURE__ */ new Map();
@@ -1557,7 +1557,7 @@ var GameShapes = (() => {
1557
1557
  var templateCacheStats = () => ({ size: templates.size, ...stats });
1558
1558
  function buildPrimitive(node, options = {}) {
1559
1559
  const parameters = primitiveParameters(node, options);
1560
- if (node.kind === "mesh" || templateLimit === 0) return make(node.kind, parameters);
1560
+ if (node.kind === "mesh" || templateLimit === 0) return make({ ...node, ...parameters });
1561
1561
  const key = `${node.kind}:${canonicalJson(parameters)}`;
1562
1562
  const cached = templates.get(key);
1563
1563
  if (cached) {
@@ -1567,7 +1567,7 @@ var GameShapes = (() => {
1567
1567
  return cached;
1568
1568
  }
1569
1569
  stats.misses++;
1570
- const built = make(node.kind, parameters);
1570
+ const built = make({ ...node, ...parameters });
1571
1571
  templates.set(key, built);
1572
1572
  if (templates.size > templateLimit) templates.delete(templates.keys().next().value);
1573
1573
  return built;
@@ -2989,6 +2989,7 @@ var GameShapes = (() => {
2989
2989
  }
2990
2990
 
2991
2991
  // ../game-contracts/dist/index.js
2992
+ var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
2992
2993
  var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
2993
2994
  var DEFERRED_QUEUE_ID = {
2994
2995
  DESTRUCTION_EVENTS: "destruction.events",