@adatechnology/game-shapes-three 0.0.0-stage → 0.1.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.js ADDED
@@ -0,0 +1,302 @@
1
+ // src/geometry.ts
2
+ var UV_BEFORE_NORMAL = /* @__PURE__ */ new Set(["LatheGeometry", "ExtrudeGeometry"]);
3
+ var INDEX_FIRST = /* @__PURE__ */ new Set(["BoxGeometry", "CylinderGeometry", "ConeGeometry", "SphereGeometry", "PlaneGeometry", "CircleGeometry", "RingGeometry", "LatheGeometry", "TorusGeometry"]);
4
+ var isPrimitive = (value) => typeof value.type === "string";
5
+ function threeParameters(THREE, p) {
6
+ if (p.type === "LatheGeometry") {
7
+ const points = p.parameters.points.map(({ x, y }) => new THREE.Vector2(x, y));
8
+ return { ...p.parameters, points };
9
+ }
10
+ return { ...p.parameters };
11
+ }
12
+ function toGeometry(THREE, source, options = {}) {
13
+ const copy = options.copy !== false;
14
+ const primitive = isPrimitive(source) ? source : null;
15
+ const ThreeClass = primitive && primitive.type !== "BufferGeometry" ? THREE[primitive.type] : void 0;
16
+ const geometry = ThreeClass ? Reflect.construct(THREE.BufferGeometry, [], ThreeClass) : new THREE.BufferGeometry();
17
+ if (primitive && ThreeClass) {
18
+ Object.assign(geometry, { type: primitive.type, parameters: threeParameters(THREE, primitive) });
19
+ }
20
+ const attribute = (array, size) => copy ? new THREE.Float32BufferAttribute(array, size) : new THREE.BufferAttribute(array, size);
21
+ const index = source.indices;
22
+ const setIndex = () => {
23
+ if (!index) return;
24
+ geometry.setIndex(copy ? index instanceof Uint32Array ? new THREE.Uint32BufferAttribute(index, 1) : new THREE.Uint16BufferAttribute(index, 1) : new THREE.BufferAttribute(index, 1));
25
+ };
26
+ const type = primitive?.type ?? "BufferGeometry";
27
+ if (INDEX_FIRST.has(type)) setIndex();
28
+ geometry.setAttribute("position", attribute(source.positions, 3));
29
+ if (UV_BEFORE_NORMAL.has(type)) {
30
+ geometry.setAttribute("uv", attribute(source.uvs, 2));
31
+ geometry.setAttribute("normal", attribute(source.normals, 3));
32
+ } else {
33
+ geometry.setAttribute("normal", attribute(source.normals, 3));
34
+ geometry.setAttribute("uv", attribute(source.uvs, 2));
35
+ }
36
+ if (!primitive && source.colors) geometry.setAttribute("color", attribute(source.colors, 3));
37
+ if (!INDEX_FIRST.has(type)) setIndex();
38
+ if (primitive) for (const group of primitive.groups) geometry.addGroup(group.start, group.count, group.materialIndex);
39
+ return geometry;
40
+ }
41
+
42
+ // src/namespace.ts
43
+ import { box, circle, cone, cylinder, extrude, lathe, plane, ring, sphere, torus } from "@adatechnology/game-shapes";
44
+ import { buildPrimitive } from "@adatechnology/game-shapes";
45
+ var SHAPE_GEOMETRY_TYPES = ["BoxGeometry", "CylinderGeometry", "ConeGeometry", "SphereGeometry", "PlaneGeometry", "CircleGeometry", "RingGeometry", "LatheGeometry", "TorusGeometry", "ExtrudeGeometry"];
46
+ function linePoints(path) {
47
+ if (path.autoClose || path.curves.length === 0) return null;
48
+ const points = [];
49
+ for (const [index, curve] of path.curves.entries()) {
50
+ if (!curve.isLineCurve || !curve.v1 || !curve.v2) return null;
51
+ if (index === 0) points.push([curve.v1.x, curve.v1.y]);
52
+ else {
53
+ const last = points[points.length - 1];
54
+ if (last[0] !== curve.v1.x || last[1] !== curve.v1.y) return null;
55
+ }
56
+ points.push([curve.v2.x, curve.v2.y]);
57
+ }
58
+ return points;
59
+ }
60
+ function extrudeOf(shapes, options = {}) {
61
+ if (Array.isArray(shapes) || !shapes || options.extrudePath !== void 0 || options.UVGenerator !== void 0) return null;
62
+ const shape = shapes;
63
+ const outer = linePoints(shape);
64
+ if (!outer) return null;
65
+ const holes = [];
66
+ for (const hole of shape.holes ?? []) {
67
+ const points = linePoints(hole);
68
+ if (!points) return null;
69
+ holes.push(points);
70
+ }
71
+ const outline = holes.length ? { outer, holes } : { outer };
72
+ const bevel = options.bevelEnabled === false ? false : {
73
+ ...options.bevelThickness !== void 0 ? { thickness: options.bevelThickness } : {},
74
+ ...options.bevelSize !== void 0 ? { size: options.bevelSize } : {},
75
+ ...options.bevelOffset !== void 0 ? { offset: options.bevelOffset } : {},
76
+ ...options.bevelSegments !== void 0 ? { segments: options.bevelSegments } : {}
77
+ };
78
+ return extrude(outline, options.depth, options.steps, bevel);
79
+ }
80
+ var namespaces = /* @__PURE__ */ new WeakMap();
81
+ var shims = /* @__PURE__ */ new WeakSet();
82
+ function shapeGeometries(THREE, options = {}) {
83
+ if (shims.has(THREE)) return THREE;
84
+ const cache = options.cache !== false;
85
+ const key = cache ? "cache" : "nocache";
86
+ let byKey = namespaces.get(THREE);
87
+ if (!byKey) {
88
+ byKey = /* @__PURE__ */ new Map();
89
+ namespaces.set(THREE, byKey);
90
+ }
91
+ const existing = byKey.get(key);
92
+ if (existing) return existing;
93
+ const made = (p) => toGeometry(THREE, p);
94
+ const viaCache = (node, direct) => cache ? buildPrimitive(node) : direct();
95
+ const defined = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
96
+ const constructors = {
97
+ BoxGeometry: (width, height, depth, ws = 1, hs = 1, ds = 1) => made(viaCache({ kind: "box", size: [width ?? 1, height ?? 1, depth ?? 1], segments: [ws, hs, ds] }, () => box(width, height, depth, ws, hs, ds))),
98
+ CylinderGeometry: (radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) => made(viaCache({ kind: "cylinder", ...defined({ radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength }) }, () => cylinder(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength))),
99
+ ConeGeometry: (radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) => made(viaCache({ kind: "cone", ...defined({ radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength }) }, () => cone(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength))),
100
+ SphereGeometry: (radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength) => made(viaCache({ kind: "sphere", ...defined({ radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength }) }, () => sphere(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength))),
101
+ PlaneGeometry: (width, height, widthSegments, heightSegments) => made(viaCache({ kind: "plane", ...defined({ width, height, widthSegments, heightSegments }) }, () => plane(width, height, widthSegments, heightSegments))),
102
+ CircleGeometry: (radius, segments, thetaStart, thetaLength) => made(viaCache({ kind: "circle", ...defined({ radius, segments, thetaStart, thetaLength }) }, () => circle(radius, segments, thetaStart, thetaLength))),
103
+ RingGeometry: (innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength) => made(viaCache({ kind: "ring", ...defined({ innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength }) }, () => ring(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength))),
104
+ LatheGeometry: (points, segments, phiStart, phiLength) => {
105
+ if (!points) return new THREE.LatheGeometry(void 0, segments, phiStart, phiLength);
106
+ const profile = points.map((p) => [p.x, p.y]);
107
+ return made(viaCache({ kind: "lathe", points: profile, ...defined({ segments, phiStart, phiLength }) }, () => lathe(profile, segments, phiStart, phiLength)));
108
+ },
109
+ TorusGeometry: (radius, tube, radialSegments, tubularSegments, arc) => made(viaCache({ kind: "torus", ...defined({ radius, tube, radialSegments, tubularSegments, arc }) }, () => torus(radius, tube, radialSegments, tubularSegments, arc))),
110
+ ExtrudeGeometry: (shapes, extrudeOptions) => {
111
+ const buffers = shapes === void 0 ? null : extrudeOf(shapes, extrudeOptions);
112
+ if (!buffers) return new THREE.ExtrudeGeometry(shapes, extrudeOptions);
113
+ const geometry = toGeometry(THREE, buffers);
114
+ geometry.parameters = { shapes, options: extrudeOptions ?? {} };
115
+ return geometry;
116
+ }
117
+ };
118
+ const namespace = { ...THREE };
119
+ for (const type of SHAPE_GEOMETRY_TYPES) {
120
+ const make = constructors[type];
121
+ const Constructor = function(...args) {
122
+ return make(...args);
123
+ };
124
+ Constructor.prototype = THREE[type].prototype;
125
+ Object.defineProperty(Constructor, "name", { value: type });
126
+ namespace[type] = Constructor;
127
+ }
128
+ const result = namespace;
129
+ byKey.set(key, result);
130
+ shims.add(result);
131
+ return result;
132
+ }
133
+
134
+ // src/object.ts
135
+ import { colorHex } from "@adatechnology/game-shapes";
136
+ function createMaterials(THREE, hints = {}, ids = []) {
137
+ const out = {};
138
+ const all = /* @__PURE__ */ new Set([...Object.keys(hints), ...ids]);
139
+ for (const id of all) {
140
+ const hint = hints[id] ?? {};
141
+ const parameters = { vertexColors: hint.vertexColors ?? true };
142
+ if (hint.color !== void 0) parameters.color = colorHex(hint.color);
143
+ if (hint.roughness !== void 0) parameters.roughness = hint.roughness;
144
+ if (hint.metalness !== void 0) parameters.metalness = hint.metalness;
145
+ if (hint.opacity !== void 0) parameters.opacity = hint.opacity;
146
+ if (hint.transparent !== void 0) parameters.transparent = hint.transparent;
147
+ if (hint.emissive !== void 0) parameters.emissive = colorHex(hint.emissive);
148
+ if (hint.emissiveIntensity !== void 0) parameters.emissiveIntensity = hint.emissiveIntensity;
149
+ if (hint.flatShading !== void 0) parameters.flatShading = hint.flatShading;
150
+ if (hint.depthWrite !== void 0) parameters.depthWrite = hint.depthWrite;
151
+ if (hint.side !== void 0) parameters.side = hint.side === "double" ? THREE.DoubleSide : hint.side === "back" ? THREE.BackSide : THREE.FrontSide;
152
+ const material = new THREE.MeshStandardMaterial(parameters);
153
+ material.name = id;
154
+ out[id] = material;
155
+ }
156
+ return out;
157
+ }
158
+ function placePart(THREE, group, part) {
159
+ if (part.matrix && part.position === void 0 && part.rotation === void 0 && part.scale === void 0 && part.heading === void 0) {
160
+ new THREE.Matrix4().fromArray(part.matrix).decompose(group.position, group.quaternion, group.scale);
161
+ return;
162
+ }
163
+ if (part.position) group.position.set(part.position[0], part.position[1], part.position[2]);
164
+ if (part.heading !== void 0) group.rotation.y = part.heading;
165
+ else if (part.rotation) group.rotation.set(part.rotation[0], part.rotation[1], part.rotation[2], part.rotationOrder ?? "XYZ");
166
+ if (part.scale !== void 0) {
167
+ if (typeof part.scale === "number") group.scale.setScalar(part.scale);
168
+ else group.scale.set(part.scale[0], part.scale[1], part.scale[2]);
169
+ }
170
+ group.updateMatrix();
171
+ }
172
+ function toObject3D(THREE, buffers, options = {}) {
173
+ const shadows = options.shadows !== false;
174
+ const ids = /* @__PURE__ */ new Set();
175
+ for (const level of buffers.levels) {
176
+ for (const b of level.batches) ids.add(b.material);
177
+ for (const b of level.instanced) ids.add(b.material);
178
+ }
179
+ const made = createMaterials(THREE, buffers.materials, [...ids].filter((id) => !options.materials?.[id]));
180
+ const materials = { ...made, ...options.materials ?? {} };
181
+ const materialOf = (id, part) => options.materialFor?.(id, part) ?? materials[id];
182
+ const meshes = [];
183
+ const instanced = [];
184
+ const build = (level, withParts) => {
185
+ const group = new THREE.Group();
186
+ group.name = options.name ?? buffers.name ?? "shape";
187
+ const parts = {};
188
+ if (withParts) {
189
+ for (const part of buffers.parts) {
190
+ const g = new THREE.Group();
191
+ g.name = `part:${part.id}`;
192
+ g.userData.part = part.id;
193
+ placePart(THREE, g, part);
194
+ parts[part.id] = g;
195
+ }
196
+ }
197
+ const into = (part) => part !== null && parts[part] || group;
198
+ for (const batch of level.batches) {
199
+ const mesh = new THREE.Mesh(toGeometry(THREE, batch, { copy: options.copy !== false }), materialOf(batch.material, batch.part));
200
+ mesh.geometry.computeBoundingSphere();
201
+ mesh.geometry.computeBoundingBox();
202
+ mesh.name = batch.part === null ? `static:${batch.material}` : `part:${batch.part}`;
203
+ if (batch.part !== null) mesh.userData.part = batch.part;
204
+ mesh.userData.material = batch.material;
205
+ if (batch.ranges.length) mesh.userData.ranges = batch.ranges;
206
+ mesh.castShadow = shadows;
207
+ mesh.receiveShadow = shadows;
208
+ into(batch.part).add(mesh);
209
+ meshes.push(mesh);
210
+ }
211
+ for (const batch of level.instanced) {
212
+ const mesh = new THREE.InstancedMesh(toGeometry(THREE, batch.geometry, { copy: options.copy !== false }), materialOf(batch.material, batch.part), batch.count);
213
+ mesh.instanceMatrix.array.set(batch.matrices);
214
+ mesh.instanceMatrix.needsUpdate = true;
215
+ if (batch.colors) mesh.instanceColor = new THREE.InstancedBufferAttribute(batch.colors.slice(), 3);
216
+ mesh.name = `instanced:${batch.name ?? batch.material}`;
217
+ mesh.userData.material = batch.material;
218
+ if (batch.part !== null) mesh.userData.part = batch.part;
219
+ mesh.castShadow = shadows;
220
+ mesh.receiveShadow = shadows;
221
+ mesh.computeBoundingSphere();
222
+ into(batch.part).add(mesh);
223
+ instanced.push(mesh);
224
+ }
225
+ for (const part of Object.values(parts)) group.add(part);
226
+ return { group, parts };
227
+ };
228
+ const levels = buffers.levels;
229
+ const first = build(levels[0] ?? { distance: 0, detail: 1, batches: [], instanced: [] }, true);
230
+ let object = first.group;
231
+ if (levels.length > 1 || buffers.cullDistance !== void 0) {
232
+ const lod = new THREE.LOD();
233
+ lod.name = first.group.name;
234
+ lod.addLevel(first.group, 0);
235
+ for (const level of levels.slice(1)) lod.addLevel(build(level, false).group, level.distance);
236
+ if (buffers.cullDistance !== void 0) lod.addLevel(new THREE.Group(), buffers.cullDistance);
237
+ object = lod;
238
+ }
239
+ object.userData.points = buffers.points;
240
+ return { object, near: first.group, parts: first.parts, meshes, instanced, points: buffers.points, materials };
241
+ }
242
+
243
+ // src/merge-by-material.ts
244
+ import { mergeTransformed } from "@adatechnology/game-shapes";
245
+ var isVisible = (object) => {
246
+ for (let node = object; node; node = node.parent) if (!node.visible) return false;
247
+ return true;
248
+ };
249
+ var plain = (attribute) => attribute !== void 0 && !attribute.isInterleavedBufferAttribute && attribute.array instanceof Float32Array && !attribute.normalized;
250
+ function piece(geometry, matrix) {
251
+ const position = geometry.getAttribute("position");
252
+ const normal = geometry.getAttribute("normal");
253
+ const uv = geometry.getAttribute("uv");
254
+ const ok = plain(position) && (normal === void 0 || plain(normal)) && (uv === void 0 || plain(uv)) && position.itemSize === 3 && (uv === void 0 || uv.itemSize === 2);
255
+ if (ok) {
256
+ return { positions: position.array, ...normal ? { normals: normal.array } : {}, ...uv ? { uvs: uv.array } : {}, indices: geometry.index ? geometry.index.array : null, matrix: matrix.elements };
257
+ }
258
+ const flat = geometry.index ? geometry.toNonIndexed() : geometry;
259
+ const read = (name, size) => {
260
+ const attribute = flat.getAttribute(name);
261
+ if (!attribute) return void 0;
262
+ const out = new Float32Array(attribute.count * size);
263
+ for (let i = 0; i < attribute.count; i++) for (let c = 0; c < size; c++) out[i * size + c] = c === 0 ? attribute.getX(i) : c === 1 ? attribute.getY(i) : attribute.getZ(i);
264
+ return out;
265
+ };
266
+ const positions = read("position", 3);
267
+ const normals = read("normal", 3);
268
+ const uvs = read("uv", 2);
269
+ if (flat !== geometry) flat.dispose();
270
+ return { positions, ...normals ? { normals } : {}, ...uvs ? { uvs } : {}, indices: null, matrix: matrix.elements };
271
+ }
272
+ function mergeByMaterial(THREE, root, space) {
273
+ const toSpace = space.matrixWorld.clone().invert();
274
+ const byMaterial = /* @__PURE__ */ new Map();
275
+ root.traverse((object) => {
276
+ const mesh = object;
277
+ if (!mesh.isMesh || Array.isArray(mesh.material) || !isVisible(mesh)) return;
278
+ const list = byMaterial.get(mesh.material) ?? [];
279
+ list.push(piece(mesh.geometry, new THREE.Matrix4().multiplyMatrices(toSpace, mesh.matrixWorld)));
280
+ byMaterial.set(mesh.material, list);
281
+ });
282
+ return [...byMaterial].map(([material, pieces]) => {
283
+ const merged = mergeTransformed(pieces);
284
+ const geometry = new THREE.BufferGeometry();
285
+ geometry.setAttribute("position", new THREE.BufferAttribute(merged.positions, 3));
286
+ geometry.setAttribute("normal", new THREE.BufferAttribute(merged.normals, 3));
287
+ geometry.setAttribute("uv", new THREE.BufferAttribute(merged.uvs, 2));
288
+ const mesh = new THREE.Mesh(geometry, material);
289
+ mesh.castShadow = false;
290
+ mesh.receiveShadow = true;
291
+ return mesh;
292
+ });
293
+ }
294
+ export {
295
+ SHAPE_GEOMETRY_TYPES,
296
+ createMaterials,
297
+ mergeByMaterial,
298
+ shapeGeometries,
299
+ toGeometry,
300
+ toObject3D
301
+ };
302
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/geometry.ts","../src/namespace.ts","../src/object.ts","../src/merge-by-material.ts"],"sourcesContent":["import type { PrimitiveBuffers, ShapeBatch } from '@adatechnology/game-shapes'\nimport type * as THREE_NS from 'three'\n\nexport type Three = typeof THREE_NS\n\nexport interface ToGeometryOptions {\n /** Copy the arrays into the attributes (default true). Without a copy the geometry shares the buffers (a cached result is read-only: do not deform it). */\n readonly copy?: boolean\n}\n\n/** The order in which three's generator of each type sets its attributes (toJSON and attribute iteration keep it). */\nconst UV_BEFORE_NORMAL = new Set(['LatheGeometry', 'ExtrudeGeometry'])\n/** Types whose constructor sets the index before the attributes. */\nconst INDEX_FIRST = new Set(['BoxGeometry', 'CylinderGeometry', 'ConeGeometry', 'SphereGeometry', 'PlaneGeometry', 'CircleGeometry', 'RingGeometry', 'LatheGeometry', 'TorusGeometry'])\n\nconst isPrimitive = (value: PrimitiveBuffers | ShapeBatch): value is PrimitiveBuffers => typeof (value as PrimitiveBuffers).type === 'string'\n\n/** Three's own parameters object for a type (lathe points as `Vector2`). */\nfunction threeParameters(THREE: Three, p: PrimitiveBuffers): Record<string, unknown> {\n if (p.type === 'LatheGeometry') {\n const points = (p.parameters.points as Array<{ x: number; y: number }>).map(({ x, y }) => new THREE.Vector2(x, y))\n return { ...p.parameters, points }\n }\n return { ...p.parameters }\n}\n\n/**\n * A `BufferGeometry` from game-shapes buffers. A primitive becomes an instance of the three class it reproduces (`type`, `parameters`, prototype:\n * `instanceof THREE.CylinderGeometry`, `clone()` and `toJSON()` behave as three's), with the same attributes, index and groups. A batch gets\n * `position`, `normal`, `uv`, `color` (when present) and its index.\n */\nexport function toGeometry(THREE: Three, source: PrimitiveBuffers | ShapeBatch, options: ToGeometryOptions = {}): THREE_NS.BufferGeometry {\n const copy = options.copy !== false\n const primitive = isPrimitive(source) ? source : null\n const ThreeClass = primitive && primitive.type !== 'BufferGeometry' ? ((THREE as unknown as Record<string, unknown>)[primitive.type] as (new () => THREE_NS.BufferGeometry) | undefined) : undefined\n // the BufferGeometry constructor only, with the prototype of the class it stands for\n const geometry = (ThreeClass ? Reflect.construct(THREE.BufferGeometry, [], ThreeClass) : new THREE.BufferGeometry()) as THREE_NS.BufferGeometry & { parameters?: Record<string, unknown> }\n if (primitive && ThreeClass) {\n Object.assign(geometry, { type: primitive.type, parameters: threeParameters(THREE, primitive) })\n }\n const attribute = (array: Float32Array, size: number): THREE_NS.BufferAttribute => (copy ? new THREE.Float32BufferAttribute(array, size) : new THREE.BufferAttribute(array, size))\n const index = source.indices\n const setIndex = (): void => {\n if (!index) return\n geometry.setIndex(copy ? (index instanceof Uint32Array ? new THREE.Uint32BufferAttribute(index, 1) : new THREE.Uint16BufferAttribute(index, 1)) : new THREE.BufferAttribute(index, 1))\n }\n const type = primitive?.type ?? 'BufferGeometry'\n if (INDEX_FIRST.has(type)) setIndex()\n geometry.setAttribute('position', attribute(source.positions, 3))\n if (UV_BEFORE_NORMAL.has(type)) {\n geometry.setAttribute('uv', attribute(source.uvs, 2))\n geometry.setAttribute('normal', attribute(source.normals, 3))\n } else {\n geometry.setAttribute('normal', attribute(source.normals, 3))\n geometry.setAttribute('uv', attribute(source.uvs, 2))\n }\n if (!primitive && (source as ShapeBatch).colors) geometry.setAttribute('color', attribute((source as ShapeBatch).colors as Float32Array, 3))\n if (!INDEX_FIRST.has(type)) setIndex()\n if (primitive) for (const group of primitive.groups) geometry.addGroup(group.start, group.count, group.materialIndex)\n return geometry\n}\n","import { box, circle, cone, cylinder, extrude, lathe, plane, ring, sphere, torus } from '@adatechnology/game-shapes'\nimport type { BevelSpec, PrimitiveBuffers, PrimitiveNode, ShapeOutline, Vec2 } from '@adatechnology/game-shapes'\nimport { buildPrimitive } from '@adatechnology/game-shapes'\nimport type * as THREE_NS from 'three'\n\nimport { toGeometry } from './geometry'\nimport type { Three } from './geometry'\n\n/** The geometry constructors `shapeGeometries` replaces. */\nexport const SHAPE_GEOMETRY_TYPES = ['BoxGeometry', 'CylinderGeometry', 'ConeGeometry', 'SphereGeometry', 'PlaneGeometry', 'CircleGeometry', 'RingGeometry', 'LatheGeometry', 'TorusGeometry', 'ExtrudeGeometry'] as const\n\ntype Curve = { isLineCurve?: boolean; v1?: { x: number; y: number }; v2?: { x: number; y: number } }\ntype PathLike = { curves: Curve[]; autoClose?: boolean; holes?: PathLike[] }\n\n/** The point list of a path made only of contiguous `LineCurve`s (what `moveTo` + `lineTo` builds), or null. */\nfunction linePoints(path: PathLike): Vec2[] | null {\n if (path.autoClose || path.curves.length === 0) return null\n const points: Vec2[] = []\n for (const [index, curve] of path.curves.entries()) {\n if (!curve.isLineCurve || !curve.v1 || !curve.v2) return null\n if (index === 0) points.push([curve.v1.x, curve.v1.y])\n else {\n const last = points[points.length - 1] as Vec2\n if (last[0] !== curve.v1.x || last[1] !== curve.v1.y) return null\n }\n points.push([curve.v2.x, curve.v2.y])\n }\n return points\n}\n\ntype ExtrudeOptions = { depth?: number; steps?: number; bevelEnabled?: boolean; bevelThickness?: number; bevelSize?: number; bevelOffset?: number; bevelSegments?: number; extrudePath?: unknown; UVGenerator?: unknown; curveSegments?: number }\n\n/** An extrusion game-shapes can make exactly: one straight-edged shape, no path, the world uvs. */\nfunction extrudeOf(shapes: unknown, options: ExtrudeOptions = {}): PrimitiveBuffers | null {\n if (Array.isArray(shapes) || !shapes || options.extrudePath !== undefined || options.UVGenerator !== undefined) return null\n const shape = shapes as PathLike\n const outer = linePoints(shape)\n if (!outer) return null\n const holes: Vec2[][] = []\n for (const hole of shape.holes ?? []) {\n const points = linePoints(hole)\n if (!points) return null\n holes.push(points)\n }\n const outline: ShapeOutline = holes.length ? { outer, holes } : { outer }\n const bevel: false | BevelSpec =\n options.bevelEnabled === false\n ? false\n : {\n ...(options.bevelThickness !== undefined ? { thickness: options.bevelThickness } : {}),\n ...(options.bevelSize !== undefined ? { size: options.bevelSize } : {}),\n ...(options.bevelOffset !== undefined ? { offset: options.bevelOffset } : {}),\n ...(options.bevelSegments !== undefined ? { segments: options.bevelSegments } : {}),\n }\n return extrude(outline, options.depth, options.steps, bevel)\n}\n\nexport interface ShapeGeometriesOptions {\n /** Go through the template cache of game-shapes (default true): the same primitive is generated once per process. */\n readonly cache?: boolean\n}\n\nconst namespaces = new WeakMap<object, Map<string, Three>>()\n/** The namespaces this module made: wrapping one again gives it back (a package handing its `T` to another). */\nconst shims = new WeakSet<object>()\n\n/**\n * A three namespace whose `BoxGeometry`, `CylinderGeometry`, `ConeGeometry`, `SphereGeometry`, `PlaneGeometry`, `CircleGeometry`, `RingGeometry`,\n * `LatheGeometry`, `TorusGeometry` and (straight-edged) `ExtrudeGeometry` are made by game-shapes, bit-identical to three's and instances of three's\n * classes; everything else is three's own. Hand it to code ported from the teams as `T`, so it keeps reading `new T.CylinderGeometry(...)`.\n * An extrusion with curves, several shapes, a path or a custom uv generator falls back to three.\n */\nexport function shapeGeometries(THREE: Three, options: ShapeGeometriesOptions = {}): Three {\n if (shims.has(THREE)) return THREE\n const cache = options.cache !== false\n const key = cache ? 'cache' : 'nocache'\n let byKey = namespaces.get(THREE)\n if (!byKey) {\n byKey = new Map()\n namespaces.set(THREE, byKey)\n }\n const existing = byKey.get(key)\n if (existing) return existing\n const made = (p: PrimitiveBuffers): THREE_NS.BufferGeometry => toGeometry(THREE, p)\n const viaCache = (node: PrimitiveNode, direct: () => PrimitiveBuffers): PrimitiveBuffers => (cache ? buildPrimitive(node) : direct())\n const defined = <T extends object>(o: T): T => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as T\n const constructors: Record<(typeof SHAPE_GEOMETRY_TYPES)[number], (...args: any[]) => THREE_NS.BufferGeometry> = {\n BoxGeometry: (width?: number, height?: number, depth?: number, ws = 1, hs = 1, ds = 1) =>\n made(viaCache({ kind: 'box', size: [width ?? 1, height ?? 1, depth ?? 1], segments: [ws, hs, ds] }, () => box(width, height, depth, ws, hs, ds))),\n CylinderGeometry: (radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number) =>\n made(viaCache({ kind: 'cylinder', ...defined({ radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength }) }, () => cylinder(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength))),\n ConeGeometry: (radius?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number) =>\n made(viaCache({ kind: 'cone', ...defined({ radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength }) }, () => cone(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength))),\n SphereGeometry: (radius?: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number) =>\n made(viaCache({ kind: 'sphere', ...defined({ radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength }) }, () => sphere(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength))),\n PlaneGeometry: (width?: number, height?: number, widthSegments?: number, heightSegments?: number) =>\n made(viaCache({ kind: 'plane', ...defined({ width, height, widthSegments, heightSegments }) }, () => plane(width, height, widthSegments, heightSegments))),\n CircleGeometry: (radius?: number, segments?: number, thetaStart?: number, thetaLength?: number) =>\n made(viaCache({ kind: 'circle', ...defined({ radius, segments, thetaStart, thetaLength }) }, () => circle(radius, segments, thetaStart, thetaLength))),\n RingGeometry: (innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number) =>\n made(viaCache({ kind: 'ring', ...defined({ innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength }) }, () => ring(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength))),\n LatheGeometry: (points?: Array<{ x: number; y: number }>, segments?: number, phiStart?: number, phiLength?: number) => {\n if (!points) return new THREE.LatheGeometry(undefined, segments, phiStart, phiLength)\n const profile = points.map((p) => [p.x, p.y] as const)\n return made(viaCache({ kind: 'lathe', points: profile, ...defined({ segments, phiStart, phiLength }) }, () => lathe(profile, segments, phiStart, phiLength)))\n },\n TorusGeometry: (radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number) =>\n made(viaCache({ kind: 'torus', ...defined({ radius, tube, radialSegments, tubularSegments, arc }) }, () => torus(radius, tube, radialSegments, tubularSegments, arc))),\n ExtrudeGeometry: (shapes?: unknown, extrudeOptions?: ExtrudeOptions) => {\n const buffers = shapes === undefined ? null : extrudeOf(shapes, extrudeOptions)\n if (!buffers) return new THREE.ExtrudeGeometry(shapes as THREE_NS.Shape, extrudeOptions as THREE_NS.ExtrudeGeometryOptions)\n const geometry = toGeometry(THREE, buffers) as THREE_NS.BufferGeometry & { parameters: unknown }\n geometry.parameters = { shapes, options: extrudeOptions ?? {} }\n return geometry\n },\n }\n const namespace: Record<string, unknown> = { ...(THREE as unknown as Record<string, unknown>) }\n for (const type of SHAPE_GEOMETRY_TYPES) {\n const make = constructors[type]\n // callable with `new` (the returned object wins), and `instanceof` checks three's prototype\n const Constructor = function (this: unknown, ...args: unknown[]) {\n return make(...args)\n } as unknown as { prototype: unknown }\n Constructor.prototype = (THREE as unknown as Record<string, { prototype: unknown }>)[type]!.prototype\n Object.defineProperty(Constructor, 'name', { value: type })\n namespace[type] = Constructor\n }\n const result = namespace as unknown as Three\n byKey.set(key, result)\n shims.add(result)\n return result\n}\n","import { colorHex } from '@adatechnology/game-shapes'\nimport type { MaterialHint, ShapeBuffers, ShapeLevel, ShapePart, ShapePoint } from '@adatechnology/game-shapes'\nimport type * as THREE_NS from 'three'\n\nimport { toGeometry } from './geometry'\nimport type { Three } from './geometry'\n\n/** A `MeshStandardMaterial` per material id from the schema's hints (vertex colours on unless the hint says otherwise). */\nexport function createMaterials(THREE: Three, hints: Readonly<Record<string, MaterialHint>> = {}, ids: Iterable<string> = []): Record<string, THREE_NS.Material> {\n const out: Record<string, THREE_NS.Material> = {}\n const all = new Set([...Object.keys(hints), ...ids])\n for (const id of all) {\n const hint = hints[id] ?? {}\n const parameters: THREE_NS.MeshStandardMaterialParameters = { vertexColors: hint.vertexColors ?? true }\n if (hint.color !== undefined) parameters.color = colorHex(hint.color)\n if (hint.roughness !== undefined) parameters.roughness = hint.roughness\n if (hint.metalness !== undefined) parameters.metalness = hint.metalness\n if (hint.opacity !== undefined) parameters.opacity = hint.opacity\n if (hint.transparent !== undefined) parameters.transparent = hint.transparent\n if (hint.emissive !== undefined) parameters.emissive = colorHex(hint.emissive)\n if (hint.emissiveIntensity !== undefined) parameters.emissiveIntensity = hint.emissiveIntensity\n if (hint.flatShading !== undefined) parameters.flatShading = hint.flatShading\n if (hint.depthWrite !== undefined) parameters.depthWrite = hint.depthWrite\n if (hint.side !== undefined) parameters.side = hint.side === 'double' ? THREE.DoubleSide : hint.side === 'back' ? THREE.BackSide : THREE.FrontSide\n const material = new THREE.MeshStandardMaterial(parameters)\n material.name = id\n out[id] = material\n }\n return out\n}\n\nexport interface ToObjectOptions {\n /** Materials by id; missing ids get one from the schema hints (`createMaterials`). */\n readonly materials?: Readonly<Record<string, THREE_NS.Material>>\n /** The material of one draw (wins over `materials`): per material id and part (`null` for the static body). */\n readonly materialFor?: (material: string, part: string | null) => THREE_NS.Material | undefined\n /** Cast and receive shadows (default true). */\n readonly shadows?: boolean\n /** Copy the arrays into the attributes (default true; false shares them, read-only). */\n readonly copy?: boolean\n /** Name of the root. */\n readonly name?: string\n}\n\nexport interface ShapeObject {\n /** A `Group`, or a `LOD` when the shape has levels or a cull distance. */\n readonly object: THREE_NS.Object3D\n /** The level 0 group (the root itself without LOD). */\n readonly near: THREE_NS.Group\n /** Part groups of level 0 by id, at their pivots; animate these. */\n readonly parts: Record<string, THREE_NS.Group>\n readonly meshes: THREE_NS.Mesh[]\n readonly instanced: THREE_NS.InstancedMesh[]\n readonly points: readonly ShapePoint[]\n readonly materials: Record<string, THREE_NS.Material>\n}\n\nfunction placePart(THREE: Three, group: THREE_NS.Group, part: ShapePart): void {\n if (part.matrix && part.position === undefined && part.rotation === undefined && part.scale === undefined && part.heading === undefined) {\n new THREE.Matrix4().fromArray(part.matrix as number[]).decompose(group.position, group.quaternion, group.scale)\n return\n }\n if (part.position) group.position.set(part.position[0], part.position[1], part.position[2])\n if (part.heading !== undefined) group.rotation.y = part.heading\n else if (part.rotation) group.rotation.set(part.rotation[0], part.rotation[1], part.rotation[2], part.rotationOrder ?? 'XYZ')\n if (part.scale !== undefined) {\n if (typeof part.scale === 'number') group.scale.setScalar(part.scale)\n else group.scale.set(part.scale[0], part.scale[1], part.scale[2])\n }\n group.updateMatrix()\n}\n\n/**\n * The three objects of a shape: one mesh per batch (`static:<material>` or `part:<id>`, `userData.material`, `userData.part`), part groups at their\n * pivots, an `InstancedMesh` per instanced batch, and a `LOD` (levels at their distances, nothing from `cullDistance`) when there are levels.\n */\nexport function toObject3D(THREE: Three, buffers: ShapeBuffers, options: ToObjectOptions = {}): ShapeObject {\n const shadows = options.shadows !== false\n const ids = new Set<string>()\n for (const level of buffers.levels) {\n for (const b of level.batches) ids.add(b.material)\n for (const b of level.instanced) ids.add(b.material)\n }\n const made = createMaterials(THREE, buffers.materials, [...ids].filter((id) => !options.materials?.[id]))\n const materials: Record<string, THREE_NS.Material> = { ...made, ...(options.materials ?? {}) }\n const materialOf = (id: string, part: string | null): THREE_NS.Material => options.materialFor?.(id, part) ?? (materials[id] as THREE_NS.Material)\n const meshes: THREE_NS.Mesh[] = []\n const instanced: THREE_NS.InstancedMesh[] = []\n\n const build = (level: ShapeLevel, withParts: boolean): { group: THREE_NS.Group; parts: Record<string, THREE_NS.Group> } => {\n const group = new THREE.Group()\n group.name = options.name ?? buffers.name ?? 'shape'\n const parts: Record<string, THREE_NS.Group> = {}\n if (withParts) {\n for (const part of buffers.parts) {\n const g = new THREE.Group()\n g.name = `part:${part.id}`\n g.userData.part = part.id\n placePart(THREE, g, part)\n parts[part.id] = g\n }\n }\n const into = (part: string | null): THREE_NS.Object3D => (part !== null && parts[part]) || group\n for (const batch of level.batches) {\n const mesh = new THREE.Mesh(toGeometry(THREE, batch, { copy: options.copy !== false }), materialOf(batch.material, batch.part))\n mesh.geometry.computeBoundingSphere()\n mesh.geometry.computeBoundingBox()\n mesh.name = batch.part === null ? `static:${batch.material}` : `part:${batch.part}`\n if (batch.part !== null) mesh.userData.part = batch.part\n mesh.userData.material = batch.material\n if (batch.ranges.length) mesh.userData.ranges = batch.ranges\n mesh.castShadow = shadows\n mesh.receiveShadow = shadows\n into(batch.part).add(mesh)\n meshes.push(mesh)\n }\n for (const batch of level.instanced) {\n const mesh = new THREE.InstancedMesh(toGeometry(THREE, batch.geometry, { copy: options.copy !== false }), materialOf(batch.material, batch.part), batch.count)\n mesh.instanceMatrix.array.set(batch.matrices)\n mesh.instanceMatrix.needsUpdate = true\n if (batch.colors) mesh.instanceColor = new THREE.InstancedBufferAttribute(batch.colors.slice(), 3)\n mesh.name = `instanced:${batch.name ?? batch.material}`\n mesh.userData.material = batch.material\n if (batch.part !== null) mesh.userData.part = batch.part\n mesh.castShadow = shadows\n mesh.receiveShadow = shadows\n mesh.computeBoundingSphere()\n into(batch.part).add(mesh)\n instanced.push(mesh)\n }\n for (const part of Object.values(parts)) group.add(part)\n return { group, parts }\n }\n\n const levels = buffers.levels\n const first = build(levels[0] ?? { distance: 0, detail: 1, batches: [], instanced: [] }, true)\n let object: THREE_NS.Object3D = first.group\n if (levels.length > 1 || buffers.cullDistance !== undefined) {\n const lod = new THREE.LOD()\n lod.name = first.group.name\n lod.addLevel(first.group, 0)\n for (const level of levels.slice(1)) lod.addLevel(build(level, false).group, level.distance)\n if (buffers.cullDistance !== undefined) lod.addLevel(new THREE.Group(), buffers.cullDistance)\n object = lod\n }\n object.userData.points = buffers.points\n return { object, near: first.group, parts: first.parts, meshes, instanced, points: buffers.points, materials }\n}\n","import { mergeTransformed } from '@adatechnology/game-shapes'\nimport type { TransformedPiece } from '@adatechnology/game-shapes'\nimport type * as THREE_NS from 'three'\n\nimport type { Three } from './geometry'\n\nconst isVisible = (object: THREE_NS.Object3D): boolean => {\n for (let node: THREE_NS.Object3D | null = object; node; node = node.parent) if (!node.visible) return false\n return true\n}\n\n/** A plain, non-interleaved, not normalised Float32 attribute: what the core merge reads directly. */\nconst plain = (attribute: THREE_NS.BufferAttribute | THREE_NS.InterleavedBufferAttribute | undefined): attribute is THREE_NS.BufferAttribute =>\n attribute !== undefined && !(attribute as THREE_NS.InterleavedBufferAttribute).isInterleavedBufferAttribute && attribute.array instanceof Float32Array && !attribute.normalized\n\n/** Arrays of a geometry the core merge can take as they are; for anything else, the arrays three's own `toNonIndexed` makes (then not indexed). */\nfunction piece(geometry: THREE_NS.BufferGeometry, matrix: THREE_NS.Matrix4): TransformedPiece {\n const position = geometry.getAttribute('position')\n const normal = geometry.getAttribute('normal')\n const uv = geometry.getAttribute('uv')\n const ok = plain(position) && (normal === undefined || plain(normal)) && (uv === undefined || plain(uv)) && position.itemSize === 3 && (uv === undefined || uv.itemSize === 2)\n if (ok) {\n return { positions: position.array, ...(normal ? { normals: normal.array } : {}), ...(uv ? { uvs: uv.array } : {}), indices: geometry.index ? geometry.index.array : null, matrix: matrix.elements }\n }\n const flat = geometry.index ? geometry.toNonIndexed() : geometry\n const read = (name: string, size: number): Float32Array | undefined => {\n const attribute = flat.getAttribute(name)\n if (!attribute) return undefined\n const out = new Float32Array(attribute.count * size)\n for (let i = 0; i < attribute.count; i++) for (let c = 0; c < size; c++) out[i * size + c] = c === 0 ? attribute.getX(i) : c === 1 ? attribute.getY(i) : attribute.getZ(i)\n return out\n }\n const positions = read('position', 3) as Float32Array\n const normals = read('normal', 3)\n const uvs = read('uv', 2)\n if (flat !== geometry) flat.dispose()\n return { positions, ...(normals ? { normals } : {}), ...(uvs ? { uvs } : {}), indices: null, matrix: matrix.elements }\n}\n\n/**\n * Every visible mesh under `root` (whose world matrix must be up to date), baked into the space of `space` and joined by material: one non-indexed\n * mesh per material (position, normal, uv), no shadow cast. The bake is game-shapes' `mergeTransformed`, bit-identical to three's\n * `toNonIndexed` + `applyMatrix4` + join, so the result is the one `game-props3d`'s `mergeByMaterial` always gave.\n */\nexport function mergeByMaterial(THREE: Three, root: THREE_NS.Object3D, space: THREE_NS.Object3D): THREE_NS.Mesh[] {\n const toSpace = space.matrixWorld.clone().invert()\n const byMaterial = new Map<THREE_NS.Material, TransformedPiece[]>()\n root.traverse((object) => {\n const mesh = object as THREE_NS.Mesh\n if (!mesh.isMesh || Array.isArray(mesh.material) || !isVisible(mesh)) return\n const list = byMaterial.get(mesh.material) ?? []\n list.push(piece(mesh.geometry, new THREE.Matrix4().multiplyMatrices(toSpace, mesh.matrixWorld)))\n byMaterial.set(mesh.material, list)\n })\n return [...byMaterial].map(([material, pieces]) => {\n const merged = mergeTransformed(pieces)\n const geometry = new THREE.BufferGeometry()\n geometry.setAttribute('position', new THREE.BufferAttribute(merged.positions, 3))\n geometry.setAttribute('normal', new THREE.BufferAttribute(merged.normals, 3))\n geometry.setAttribute('uv', new THREE.BufferAttribute(merged.uvs, 2))\n const mesh = new THREE.Mesh(geometry, material)\n mesh.castShadow = false\n mesh.receiveShadow = true\n return mesh\n })\n}\n"],"mappings":";AAWA,IAAM,mBAAmB,oBAAI,IAAI,CAAC,iBAAiB,iBAAiB,CAAC;AAErE,IAAM,cAAc,oBAAI,IAAI,CAAC,eAAe,oBAAoB,gBAAgB,kBAAkB,iBAAiB,kBAAkB,gBAAgB,iBAAiB,eAAe,CAAC;AAEtL,IAAM,cAAc,CAAC,UAAoE,OAAQ,MAA2B,SAAS;AAGrI,SAAS,gBAAgB,OAAc,GAA8C;AACnF,MAAI,EAAE,SAAS,iBAAiB;AAC9B,UAAM,SAAU,EAAE,WAAW,OAA2C,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,MAAM,QAAQ,GA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,UAAU,IAAI,MAAM,QAAQ,EAAE,iBAAiB,SAAS,KAAK,WAAW,CAAC,CAAC;AAC/F,eAAW,IAAI,KAAK,UAAU,IAAI;AAAA,EACpC,CAAC;AACD,SAAO,CAAC,GAAG,UAAU,EAAE,IAAI,CAAC,CAAC,UAAU,MAAM,MAAM;AACjD,UAAM,SAAS,iBAAiB,MAAM;AACtC,UAAM,WAAW,IAAI,MAAM,eAAe;AAC1C,aAAS,aAAa,YAAY,IAAI,MAAM,gBAAgB,OAAO,WAAW,CAAC,CAAC;AAChF,aAAS,aAAa,UAAU,IAAI,MAAM,gBAAgB,OAAO,SAAS,CAAC,CAAC;AAC5E,aAAS,aAAa,MAAM,IAAI,MAAM,gBAAgB,OAAO,KAAK,CAAC,CAAC;AACpE,UAAM,OAAO,IAAI,MAAM,KAAK,UAAU,QAAQ;AAC9C,SAAK,aAAa;AAClB,SAAK,gBAAgB;AACrB,WAAO;AAAA,EACT,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@adatechnology/game-shapes-three",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "license": "MIT",
5
+ "description": "three.js drawing of @adatechnology/game-shapes buffers: BufferGeometry with three's own type and prototype, meshes per batch, part groups, InstancedMesh and LOD; a geometry namespace whose constructors are made by game-shapes (for ported code that reads new T.BoxGeometry); and mergeByMaterial on the core merge.",
6
+ "keywords": [
7
+ "three",
8
+ "threejs",
9
+ "game",
10
+ "geometry",
11
+ "procedural",
12
+ "lod",
13
+ "instancing"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Andersonfrfilho/adatechnology-game-kit.git",
18
+ "directory": "packages/game-shapes-three"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "type": "module",
24
+ "main": "dist/index.js",
25
+ "module": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
+ "unpkg": "dist/index.global.js",
28
+ "jsdelivr": "dist/index.global.js",
29
+ "sideEffects": false,
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ },
35
+ "./global": "./dist/index.global.js"
36
+ },
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "dependencies": {
41
+ "@adatechnology/game-shapes": "0.1.0"
42
+ },
43
+ "peerDependencies": {
44
+ "three": "^0.160.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^22.10.7",
48
+ "@types/three": "^0.160.0",
49
+ "three": "^0.160.1",
50
+ "tsup": "^8.5.1",
51
+ "typescript": "^5.7.3",
52
+ "vitest": "^3.2.4",
53
+ "@adatechnology/golden-tool": "0.0.0"
54
+ },
55
+ "scripts": {
56
+ "build": "tsup",
57
+ "typecheck": "tsc -p tsconfig.json --noEmit",
58
+ "test": "vitest run"
59
+ }
6
60
  }