@adatechnology/game-interactables-three 0.2.17 → 0.2.18
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/README.md +4 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.global.js +19 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -145,6 +145,10 @@ frame. A host that sets `renderer.info.autoReset = false` and resets it itself i
|
|
|
145
145
|
`createCord(THREE, points, radius, material)` builds a tube; `catenary(a, b, sag, n)` returns `n` points of a hanging cord whose lowest
|
|
146
146
|
point is `sag` meters below the chord.
|
|
147
147
|
|
|
148
|
+
`wireMeshes(THREE, spec.wires)` draws the wires an object spec leaves to the host (conduit runs, cables, cords, drops): one tube per wire of two
|
|
149
|
+
points or more, named by its id, in the colour of its kind (`WIRE_COLORS`, the houses' colours), radius `WIRE_RADIUS` when the wire gives none.
|
|
150
|
+
Add them to the object's group; a house folds its wires into its own batches instead.
|
|
151
|
+
|
|
148
152
|
## Notes
|
|
149
153
|
|
|
150
154
|
- `poseOf` converts the pose math of the interactables package (same defaults) to a quaternion, so the rendered part always matches the engine.
|
package/dist/index.d.ts
CHANGED
|
@@ -423,4 +423,12 @@ type MergedGroup = ThreeNS.Group & {
|
|
|
423
423
|
*/
|
|
424
424
|
declare function mergeParts(THREE: ThreeLib, root: ThreeNS.Group, parts: Record<string, ThreeNS.Group>, spec: ObjectSpec, options?: MergeOptions): void;
|
|
425
425
|
|
|
426
|
-
|
|
426
|
+
type Wire = NonNullable<ObjectSpec['wires']>[number];
|
|
427
|
+
/** The colour each kind of wire is drawn in (a grey PVC conduit, a black cable, a dark cord). */
|
|
428
|
+
declare const WIRE_COLORS: Readonly<Record<Wire['kind'], number>>;
|
|
429
|
+
/** Radius a wire is drawn with when its spec gives none, metres. */
|
|
430
|
+
declare const WIRE_RADIUS = 0.006;
|
|
431
|
+
/** One tube per wire with two points or more, named by the wire's id, in the object's own space. */
|
|
432
|
+
declare function wireMeshes(THREE: ThreeLib, wires: ObjectSpec['wires']): ThreeNS.Mesh[];
|
|
433
|
+
|
|
434
|
+
export { type CanvasFactory, type Effects, type EffectsOptions, type EffectsStats, type FinishOptions, type HouseholdApi, MATERIAL_KEYS, type MaterialKey, type MaterialMap, type MergeOptions, type MergedGroup, type MeshApi, type MeshApiOptions, type MeshResult, type MirrorCandidate, type MirrorOptions, type Mirrors, type PerspectiveLike, type PoolKind, type Pose, type PoseBatch, type Quality, type ReflectorConstructor, type Screen, type ScreenOptions, type SwayBatch, type SwayHandle, type SwayOptions, type SwayUniforms, type SyncOptions, type ThreeAdapter, type ThreeAdapterOptions, type ThreeLib, type Vec3, WIRE_COLORS, WIRE_RADIUS, applyPose, attachSway, createDefaultMaterials, createEffects, createMeshApi, createMirrors, createScreen, createThreeAdapter, mergeParts, patchSwayShader, poseOf, rememberRest, standOutCoincidentBoxes, swayMaterial, syncObject, wireMeshes };
|
package/dist/index.global.js
CHANGED
|
@@ -22,6 +22,8 @@ var GameInteractablesThree = (() => {
|
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
24
|
MATERIAL_KEYS: () => MATERIAL_KEYS,
|
|
25
|
+
WIRE_COLORS: () => WIRE_COLORS,
|
|
26
|
+
WIRE_RADIUS: () => WIRE_RADIUS,
|
|
25
27
|
applyPose: () => applyPose,
|
|
26
28
|
attachSway: () => attachSway,
|
|
27
29
|
catenary: () => catenary,
|
|
@@ -38,7 +40,8 @@ var GameInteractablesThree = (() => {
|
|
|
38
40
|
rememberRest: () => rememberRest,
|
|
39
41
|
standOutCoincidentBoxes: () => standOutCoincidentBoxes,
|
|
40
42
|
swayMaterial: () => swayMaterial,
|
|
41
|
-
syncObject: () => syncObject
|
|
43
|
+
syncObject: () => syncObject,
|
|
44
|
+
wireMeshes: () => wireMeshes
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
// ../game-contracts/dist/index.js
|
|
@@ -4264,6 +4267,21 @@ uniform float swayAmplitude;
|
|
|
4264
4267
|
catenary
|
|
4265
4268
|
};
|
|
4266
4269
|
}
|
|
4270
|
+
|
|
4271
|
+
// src/wires.ts
|
|
4272
|
+
var WIRE_COLORS = { conduit: 13618628, cable: 2762532, drop: 1381653, cord: 1776413 };
|
|
4273
|
+
var WIRE_RADIUS = 6e-3;
|
|
4274
|
+
function wireMeshes(THREE, wires) {
|
|
4275
|
+
const meshes = [];
|
|
4276
|
+
for (const wire of wires ?? []) {
|
|
4277
|
+
if (wire.points.length < 2) continue;
|
|
4278
|
+
const material = new THREE.MeshStandardMaterial({ color: WIRE_COLORS[wire.kind], roughness: 0.8 });
|
|
4279
|
+
const mesh2 = createCord(THREE, wire.points, wire.radius ?? WIRE_RADIUS, material);
|
|
4280
|
+
mesh2.name = wire.id;
|
|
4281
|
+
meshes.push(mesh2);
|
|
4282
|
+
}
|
|
4283
|
+
return meshes;
|
|
4284
|
+
}
|
|
4267
4285
|
return __toCommonJS(index_exports);
|
|
4268
4286
|
})();
|
|
4269
4287
|
//# sourceMappingURL=index.global.js.map
|