@adatechnology/game-shapes-three 0.3.0 → 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.global.js +6 -6
- package/dist/index.global.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.global.js
CHANGED
|
@@ -75,7 +75,7 @@ var GameShapesThree = (() => {
|
|
|
75
75
|
return geometry;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
// ../game-shapes/dist/chunk-
|
|
78
|
+
// ../game-shapes/dist/chunk-M5N2SHNL.js
|
|
79
79
|
function colorHex(color2, fallback = 16777215) {
|
|
80
80
|
if (color2 === void 0) return fallback;
|
|
81
81
|
if (typeof color2 === "number") return Math.floor(color2);
|
|
@@ -1365,8 +1365,8 @@ var GameShapesThree = (() => {
|
|
|
1365
1365
|
groups: []
|
|
1366
1366
|
};
|
|
1367
1367
|
}
|
|
1368
|
-
function make(
|
|
1369
|
-
switch (kind) {
|
|
1368
|
+
function make(p) {
|
|
1369
|
+
switch (p.kind) {
|
|
1370
1370
|
case "box": {
|
|
1371
1371
|
const size = p.size ?? [1, 1, 1];
|
|
1372
1372
|
const segments = p.segments ?? [1, 1, 1];
|
|
@@ -1395,7 +1395,7 @@ var GameShapesThree = (() => {
|
|
|
1395
1395
|
case "mesh":
|
|
1396
1396
|
return mesh(p);
|
|
1397
1397
|
default:
|
|
1398
|
-
throw new Error(`game-shapes: unknown primitive kind "${String(kind)}"`);
|
|
1398
|
+
throw new Error(`game-shapes: unknown primitive kind "${String(p.kind)}"`);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
1401
|
var templates = /* @__PURE__ */ new Map();
|
|
@@ -1403,7 +1403,7 @@ var GameShapesThree = (() => {
|
|
|
1403
1403
|
var stats = { hits: 0, misses: 0 };
|
|
1404
1404
|
function buildPrimitive(node, options = {}) {
|
|
1405
1405
|
const parameters = primitiveParameters(node, options);
|
|
1406
|
-
if (node.kind === "mesh" || templateLimit === 0) return make(node
|
|
1406
|
+
if (node.kind === "mesh" || templateLimit === 0) return make({ ...node, ...parameters });
|
|
1407
1407
|
const key = `${node.kind}:${canonicalJson(parameters)}`;
|
|
1408
1408
|
const cached = templates.get(key);
|
|
1409
1409
|
if (cached) {
|
|
@@ -1413,7 +1413,7 @@ var GameShapesThree = (() => {
|
|
|
1413
1413
|
return cached;
|
|
1414
1414
|
}
|
|
1415
1415
|
stats.misses++;
|
|
1416
|
-
const built = make(node
|
|
1416
|
+
const built = make({ ...node, ...parameters });
|
|
1417
1417
|
templates.set(key, built);
|
|
1418
1418
|
if (templates.size > templateLimit) templates.delete(templates.keys().next().value);
|
|
1419
1419
|
return built;
|