@wardic/three 0.0.0-stage → 1.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/LICENSE +21 -0
- package/README.md +84 -2
- package/THIRD_PARTY_NOTICES.md +145 -0
- package/dist/TestStage.d.ts +45 -0
- package/dist/TestStage.d.ts.map +1 -0
- package/dist/TestStage.js +140 -0
- package/dist/TestStage.js.map +1 -0
- package/dist/ThreeColours.d.ts +52 -0
- package/dist/ThreeColours.d.ts.map +1 -0
- package/dist/ThreeColours.js +237 -0
- package/dist/ThreeColours.js.map +1 -0
- package/dist/ThreeDrag.d.ts +82 -0
- package/dist/ThreeDrag.d.ts.map +1 -0
- package/dist/ThreeDrag.js +243 -0
- package/dist/ThreeDrag.js.map +1 -0
- package/dist/ThreeInput.d.ts +69 -0
- package/dist/ThreeInput.d.ts.map +1 -0
- package/dist/ThreeInput.js +592 -0
- package/dist/ThreeInput.js.map +1 -0
- package/dist/ThreeInstances.d.ts +47 -0
- package/dist/ThreeInstances.d.ts.map +1 -0
- package/dist/ThreeInstances.js +392 -0
- package/dist/ThreeInstances.js.map +1 -0
- package/dist/ThreeRenderer.d.ts +45 -0
- package/dist/ThreeRenderer.d.ts.map +1 -0
- package/dist/ThreeRenderer.js +121 -0
- package/dist/ThreeRenderer.js.map +1 -0
- package/dist/ThreeValues.d.ts +15 -0
- package/dist/ThreeValues.d.ts.map +1 -0
- package/dist/ThreeValues.js +61 -0
- package/dist/ThreeValues.js.map +1 -0
- package/dist/WardicThree.d.ts +194 -0
- package/dist/WardicThree.d.ts.map +1 -0
- package/dist/WardicThree.js +162 -0
- package/dist/WardicThree.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/dev.d.ts +10 -0
- package/dist/internal/dev.d.ts.map +1 -0
- package/dist/internal/dev.js +11 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/dev.production.d.ts +8 -0
- package/dist/internal/dev.production.d.ts.map +1 -0
- package/dist/internal/dev.production.js +8 -0
- package/dist/internal/dev.production.js.map +1 -0
- package/dist/internal/lookup.d.ts +29 -0
- package/dist/internal/lookup.d.ts.map +1 -0
- package/dist/internal/lookup.js +245 -0
- package/dist/internal/lookup.js.map +1 -0
- package/dist/internal/shared-material.d.ts +8 -0
- package/dist/internal/shared-material.d.ts.map +1 -0
- package/dist/internal/shared-material.js +95 -0
- package/dist/internal/shared-material.js.map +1 -0
- package/dist/solid/feature.d.ts +42 -0
- package/dist/solid/feature.d.ts.map +1 -0
- package/dist/solid/feature.js +2 -0
- package/dist/solid/feature.js.map +1 -0
- package/dist/solid/scene-batch.d.ts +10 -0
- package/dist/solid/scene-batch.d.ts.map +1 -0
- package/dist/solid/scene-batch.js +436 -0
- package/dist/solid/scene-batch.js.map +1 -0
- package/dist/solid/scene-object.d.ts +27 -0
- package/dist/solid/scene-object.d.ts.map +1 -0
- package/dist/solid/scene-object.js +111 -0
- package/dist/solid/scene-object.js.map +1 -0
- package/dist/solid/stage-batches.d.ts +10 -0
- package/dist/solid/stage-batches.d.ts.map +1 -0
- package/dist/solid/stage-batches.js +6 -0
- package/dist/solid/stage-batches.js.map +1 -0
- package/dist/solid/stage-drag.d.ts +4 -0
- package/dist/solid/stage-drag.d.ts.map +1 -0
- package/dist/solid/stage-drag.js +19 -0
- package/dist/solid/stage-drag.js.map +1 -0
- package/dist/solid/stage.d.ts +107 -0
- package/dist/solid/stage.d.ts.map +1 -0
- package/dist/solid/stage.js +320 -0
- package/dist/solid/stage.js.map +1 -0
- package/dist/solid/test-stage.d.ts +29 -0
- package/dist/solid/test-stage.d.ts.map +1 -0
- package/dist/solid/test-stage.js +16 -0
- package/dist/solid/test-stage.js.map +1 -0
- package/dist/solid.d.ts +55 -0
- package/dist/solid.d.ts.map +1 -0
- package/dist/solid.js +9 -0
- package/dist/solid.js.map +1 -0
- package/package.json +99 -4
- package/src/TestStage.ts +177 -0
- package/src/ThreeColours.ts +247 -0
- package/src/ThreeDrag.ts +341 -0
- package/src/ThreeInput.ts +744 -0
- package/src/ThreeInstances.ts +481 -0
- package/src/ThreeRenderer.ts +159 -0
- package/src/ThreeValues.ts +69 -0
- package/src/WardicThree.ts +347 -0
- package/src/index.ts +26 -0
- package/src/internal/dev.production.ts +7 -0
- package/src/internal/dev.ts +10 -0
- package/src/internal/lookup.ts +247 -0
- package/src/internal/shared-material.ts +101 -0
- package/src/solid/feature.ts +38 -0
- package/src/solid/scene-batch.ts +490 -0
- package/src/solid/scene-object.ts +145 -0
- package/src/solid/stage-batches.ts +13 -0
- package/src/solid/stage-drag.ts +26 -0
- package/src/solid/stage.ts +409 -0
- package/src/solid/test-stage.ts +40 -0
- package/src/solid.ts +111 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as Renderer from "@wardic/core/Renderer";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as Lookup from "./internal/lookup.js";
|
|
5
|
+
/**
|
|
6
|
+
* What the gate saves of a property before its first write, to put back if the key ever drops out:
|
|
7
|
+
* nothing. A scene's values stay where Wardic leaves them, so a commit skips a key given this.
|
|
8
|
+
*/
|
|
9
|
+
const NOTHING_SAVED = "";
|
|
10
|
+
/** A camera's projection keys: after one, its projection matrix is worked out again. */
|
|
11
|
+
const PROJECTION = new Set(["fov", "zoom", "near", "far", "aspect", "left", "right", "top", "bottom"]);
|
|
12
|
+
/** `value` as an axis's number, `NaN` where it's none: a key the patch doesn't give, or one put back with nothing. */
|
|
13
|
+
const axisOf = (value) => {
|
|
14
|
+
if (Predicate.isNumber(value))
|
|
15
|
+
return value;
|
|
16
|
+
return Number.NaN;
|
|
17
|
+
};
|
|
18
|
+
/** `given` unless it's `NaN`, else `current`. */
|
|
19
|
+
const or = (given, current) => {
|
|
20
|
+
if (Number.isNaN(given))
|
|
21
|
+
return current;
|
|
22
|
+
return given;
|
|
23
|
+
};
|
|
24
|
+
/** An axis's scale: its own key, else `scale`, else as it is. */
|
|
25
|
+
const scaleOr = (axis, all, current) => {
|
|
26
|
+
if (!Number.isNaN(axis))
|
|
27
|
+
return axis;
|
|
28
|
+
if (!Number.isNaN(all))
|
|
29
|
+
return all;
|
|
30
|
+
return current;
|
|
31
|
+
};
|
|
32
|
+
/** Whether any of three axes is given. */
|
|
33
|
+
const anyOf = (a, b, c) => !Number.isNaN(a) || !Number.isNaN(b) || !Number.isNaN(c);
|
|
34
|
+
/**
|
|
35
|
+
* A scene object's transforms written, `NaN` for a key not given: one `position.set`, one `rotation.set`
|
|
36
|
+
* from degrees, one `scale.set`, each only where one of its keys is given, the rest of its axes kept.
|
|
37
|
+
*/
|
|
38
|
+
export const writeTransforms = (object, x, y, z, rx, ry, rz, s, sx, sy, sz) => {
|
|
39
|
+
if (anyOf(x, y, z)) {
|
|
40
|
+
const position = object.position;
|
|
41
|
+
position.set(or(x, position.x), or(y, position.y), or(z, position.z));
|
|
42
|
+
}
|
|
43
|
+
if (anyOf(rx, ry, rz)) {
|
|
44
|
+
const rotation = object.rotation;
|
|
45
|
+
const radians = Lookup.RADIANS;
|
|
46
|
+
rotation.set(or(rx * radians, rotation.x), or(ry * radians, rotation.y), or(rz * radians, rotation.z));
|
|
47
|
+
}
|
|
48
|
+
if (anyOf(sx, sy, sz) || !Number.isNaN(s)) {
|
|
49
|
+
const scale = object.scale;
|
|
50
|
+
scale.set(scaleOr(sx, s, scale.x), scaleOr(sy, s, scale.y), scaleOr(sz, s, scale.z));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/** A scene's patch: its values as they are; the commit groups them. */
|
|
54
|
+
export const project = (values) => values;
|
|
55
|
+
/** `patch` written onto `target`: a scene object's transforms grouped, every other key where the lookup finds it. */
|
|
56
|
+
export const commit = (target, patch) => {
|
|
57
|
+
const object = target;
|
|
58
|
+
const scene = Lookup.isObject3D(object);
|
|
59
|
+
if (scene) {
|
|
60
|
+
writeTransforms(object, axisOf(patch.x), axisOf(patch.y), axisOf(patch.z), axisOf(patch.rotateX), axisOf(patch.rotateY), axisOf(patch.rotateZ), axisOf(patch.scale), axisOf(patch.scaleX), axisOf(patch.scaleY), axisOf(patch.scaleZ));
|
|
61
|
+
}
|
|
62
|
+
let projection = false;
|
|
63
|
+
for (const key in patch) {
|
|
64
|
+
const value = patch[key];
|
|
65
|
+
if (value === NOTHING_SAVED)
|
|
66
|
+
continue;
|
|
67
|
+
if (scene && Lookup.isTransformKey(key))
|
|
68
|
+
continue;
|
|
69
|
+
Lookup.write(object, key, value);
|
|
70
|
+
if (PROJECTION.has(key))
|
|
71
|
+
projection = true;
|
|
72
|
+
}
|
|
73
|
+
if (projection && object.isCamera === true && Predicate.isFunction(object.updateProjectionMatrix))
|
|
74
|
+
object.updateProjectionMatrix();
|
|
75
|
+
};
|
|
76
|
+
/** The Flush gate's reads of an object: nothing saved before a write, and a template key no object has. */
|
|
77
|
+
export const GATE = { valueBeforeOf: () => NOTHING_SAVED, templateKey: "@wardic/three/template" };
|
|
78
|
+
/** The scene writer as the Environment's `Renderer`. */
|
|
79
|
+
export const layer = /*#__PURE__*/ Layer.succeed(Renderer.Renderer, { project, commit });
|
|
80
|
+
/** Where `key` is in a Batch's keys, `-1` where it isn't. */
|
|
81
|
+
const indexIn = (keys, key) => keys.indexOf(key);
|
|
82
|
+
/** A Batch's position for key index `k` of a member, `NaN` for a key it doesn't have. */
|
|
83
|
+
const at = (positions, base, k) => {
|
|
84
|
+
if (k < 0)
|
|
85
|
+
return Number.NaN;
|
|
86
|
+
return positions[base + k];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The scene writer for a Batch of objects: each member's transforms grouped as
|
|
90
|
+
* the commit's are, any other key where the lookup finds it. Its keys' places are found once, by index.
|
|
91
|
+
*/
|
|
92
|
+
// ADR-0069 decision 11.
|
|
93
|
+
export const writer = {
|
|
94
|
+
writes: () => true,
|
|
95
|
+
forKeys: (keys) => {
|
|
96
|
+
const ix = indexIn(keys, "x");
|
|
97
|
+
const iy = indexIn(keys, "y");
|
|
98
|
+
const iz = indexIn(keys, "z");
|
|
99
|
+
const irx = indexIn(keys, "rotateX");
|
|
100
|
+
const iry = indexIn(keys, "rotateY");
|
|
101
|
+
const irz = indexIn(keys, "rotateZ");
|
|
102
|
+
const is = indexIn(keys, "scale");
|
|
103
|
+
const isx = indexIn(keys, "scaleX");
|
|
104
|
+
const isy = indexIn(keys, "scaleY");
|
|
105
|
+
const isz = indexIn(keys, "scaleZ");
|
|
106
|
+
return (subject, positions, base) => {
|
|
107
|
+
const object = subject;
|
|
108
|
+
const scene = Lookup.isObject3D(object);
|
|
109
|
+
if (scene) {
|
|
110
|
+
writeTransforms(object, at(positions, base, ix), at(positions, base, iy), at(positions, base, iz), at(positions, base, irx), at(positions, base, iry), at(positions, base, irz), at(positions, base, is), at(positions, base, isx), at(positions, base, isy), at(positions, base, isz));
|
|
111
|
+
}
|
|
112
|
+
for (let k = 0; k < keys.length; k++) {
|
|
113
|
+
const key = keys[k];
|
|
114
|
+
if (scene && Lookup.isTransformKey(key))
|
|
115
|
+
continue;
|
|
116
|
+
Lookup.write(object, key, positions[base + k]);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=ThreeRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeRenderer.js","sourceRoot":"","sources":["../src/ThreeRenderer.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAa9C;;;GAGG;AACH,MAAM,aAAa,GAAG,EAAE,CAAA;AAExB,wFAAwF;AACxF,MAAM,UAAU,GAAwB,I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gBACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;gBACnB,IAAI,KAAK,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC;oBAAE,SAAQ;gBACjD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;YAChD,CAAC;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ReducedMotion from "@wardic/core/ReducedMotion";
|
|
2
|
+
import type * as Spine from "@wardic/core/unstable/Spine";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
/**
|
|
5
|
+
* `subject`'s value for `key` now, as a Batch reads a member's before it moves it: where the lookup finds
|
|
6
|
+
* it, `undefined` where it's nowhere.
|
|
7
|
+
*/
|
|
8
|
+
export declare const read: (subject: object, key: string) => unknown;
|
|
9
|
+
/** `subject`'s Base-value links: each key starts from its value where the lookup finds it. */
|
|
10
|
+
export declare const startLinksOf: (subject: object) => Spine.StartLinks;
|
|
11
|
+
/** Whether reduced motion snaps `key` in a scene: a transform key on any Subject, and a camera's `fov` and `zoom`. */
|
|
12
|
+
export declare const isPositional: (key: string) => boolean;
|
|
13
|
+
/** A scene's Positional keys: the vestibular case is a camera's move as much as an object's. */
|
|
14
|
+
export declare const positionalKeys: Layer.Layer<ReducedMotion.PositionalKeys>;
|
|
15
|
+
//# sourceMappingURL=ThreeValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeValues.d.ts","sourceRoot":"","sources":["../src/ThreeValues.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,KAAK,KAAK,MAAM,6BAA6B,CAAA;AAEzD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAsBrC;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAqB,CAAA;AAe1E,8FAA8F;AAE9F,eAAO,MAAM,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC,UAAkE,CAAA;AAExH,sHAAsH;AAEtH,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,OAA4E,CAAA;AAEvH,gGAAgG;AAChG,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,CAA+E,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A three.js Subject's values for Wardic: where each key it animates starts, found where the writer
|
|
3
|
+
* writes it (a scene object's transforms, its own number, its material's, a uniform's, a TSL uniform
|
|
4
|
+
* node's, a vector's axis), and the scene's Positional keys. A key found nowhere, or whose value isn't
|
|
5
|
+
* a number or a string, is an error naming it: Wardic adds no property to a scene.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import * as ThreeValues from "@wardic/three/ThreeValues"
|
|
9
|
+
*
|
|
10
|
+
* ThreeValues.read(mesh, "rotateY") // its rotation.y, in degrees
|
|
11
|
+
* ThreeValues.read(mesh, "opacity") // mesh.material.opacity
|
|
12
|
+
*/
|
|
13
|
+
// `@wardic/three/ThreeValues` (#883; ADR-0069 decisions 4, 5 and 9, ADR-0073 *Amendment (#883)*, Q3):
|
|
14
|
+
// `@wardic/object`'s start links on three's lookup.
|
|
15
|
+
import * as ObjectValues from "@wardic/object/ObjectValues";
|
|
16
|
+
import * as ReducedMotion from "@wardic/core/ReducedMotion";
|
|
17
|
+
import * as Arr from "effect/Array";
|
|
18
|
+
import * as Layer from "effect/Layer";
|
|
19
|
+
import * as Option from "effect/Option";
|
|
20
|
+
import * as Predicate from "effect/Predicate";
|
|
21
|
+
import * as Lookup from "./internal/lookup.js";
|
|
22
|
+
/** What `subject` is called in an error: its `name`, else its type's, else "the object". */
|
|
23
|
+
const nameOf = (subject) => {
|
|
24
|
+
const holder = subject;
|
|
25
|
+
if (Predicate.isString(holder.name) && holder.name !== "")
|
|
26
|
+
return `"${holder.name}"`;
|
|
27
|
+
if (Predicate.isString(holder.type))
|
|
28
|
+
return `a ${holder.type}`;
|
|
29
|
+
return "the object";
|
|
30
|
+
};
|
|
31
|
+
/** Whether `holder`'s `key` is a three `Color`. */
|
|
32
|
+
const isColorAt = (holder, key) => Predicate.isObject(holder) && Predicate.isObject(holder[key]) && holder[key].isColor === true;
|
|
33
|
+
/** Whether `key` is a `Color` on `subject` or its material. */
|
|
34
|
+
const isColorKey = (subject, key) => isColorAt(subject, key) || Arr.some(Lookup.materialsOf(subject), (material) => isColorAt(material, key));
|
|
35
|
+
/**
|
|
36
|
+
* `subject`'s value for `key` now, as a Batch reads a member's before it moves it: where the lookup finds
|
|
37
|
+
* it, `undefined` where it's nowhere.
|
|
38
|
+
*/
|
|
39
|
+
export const read = Lookup.read;
|
|
40
|
+
/** `subject`'s own value for `key`, a number or a string, else an error naming the key. */
|
|
41
|
+
const ownValueOf = (subject, key) => {
|
|
42
|
+
const value = Lookup.read(subject, key);
|
|
43
|
+
if (Predicate.isNumber(value) || Predicate.isString(value))
|
|
44
|
+
return Option.some(value);
|
|
45
|
+
if (isColorKey(subject, key)) {
|
|
46
|
+
throw new Error(`wardic.animate: ${nameOf(subject)}'s "${key}" is a Color, which Wardic reads as a colour at the call: give it a colour, animate(mesh, { ${key}: "#ff8800" }), or its channels in linear light, ${key}R, ${key}G and ${key}B.`);
|
|
47
|
+
}
|
|
48
|
+
if (Predicate.isUndefined(value)) {
|
|
49
|
+
throw new Error(`wardic.animate: ${nameOf(subject)} has no "${key}" to animate: not its own, nor its material's, nor a uniform's, nor a vector's axis (positionX). Give a key it has; Wardic adds no property to a scene.`);
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`wardic.animate: ${nameOf(subject)}'s "${key}" is ${typeof value}, which can't be animated: a key's value is a number or a string.`);
|
|
52
|
+
};
|
|
53
|
+
/** `subject`'s Base-value links: each key starts from its value where the lookup finds it. */
|
|
54
|
+
// ADR-0022.
|
|
55
|
+
export const startLinksOf = /*#__PURE__*/ ObjectValues.startLinksWith(ownValueOf);
|
|
56
|
+
/** Whether reduced motion snaps `key` in a scene: a transform key on any Subject, and a camera's `fov` and `zoom`. */
|
|
57
|
+
// ADR-0069 decision 9.
|
|
58
|
+
export const isPositional = (key) => ReducedMotion.isTransform(key) || key === "fov" || key === "zoom";
|
|
59
|
+
/** A scene's Positional keys: the vestibular case is a camera's move as much as an object's. */
|
|
60
|
+
export const positionalKeys = /*#__PURE__*/ Layer.succeed(ReducedMotion.PositionalKeys, { isPositional });
|
|
61
|
+
//# sourceMappingURL=ThreeValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeValues.js","sourceRoot":"","sources":["../src/ThreeValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,sGAAsG;AACtG,oDAAoD;AACpD,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAE3D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAK9C,4FAA4F;AAC5F,MAAM,MAAM,GAAG,CAAC,OAAe,EAAU,EAAE;IACzC,MAAM,MAAM,GAAG,OAAiB,CAAA;IAChC,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,KAAK,EAAE;QAAE,OAAO,IAAI,MAAM,CAAC,IAAI,GAAG,CAAA;IACpF,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,C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AAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,yJAAyJ,CAAC,CAAA;IAC7N,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,QAAQ,OAAO,KAAK,mEAAmE,CAAC,CAAA;AACtJ,CAAC,CAAA;AAED,8FAA8F;AAC9F,YAAY;AACZ,MAAM,CAAC,MAAM,YAAY,GAA0C,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;AAExH,sHAAsH;AACtH,uBAAuB;AACvB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,MAAM,CAAA;AAEvH,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAA8C,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type * as Config from "@wardic/core/unstable/Config";
|
|
2
|
+
import * as Imperative from "@wardic/core/unstable/Imperative";
|
|
3
|
+
import * as ObjectBatch from "@wardic/object/ObjectBatch";
|
|
4
|
+
import * as WardicObject from "@wardic/object/WardicObject";
|
|
5
|
+
import type { Camera, Object3D } from "three";
|
|
6
|
+
import * as ThreeColours from "./ThreeColours.ts";
|
|
7
|
+
import type * as InputSource from "@wardic/core/InputSource";
|
|
8
|
+
import * as ThreeInput from "./ThreeInput.ts";
|
|
9
|
+
import * as ThreeInstances from "./ThreeInstances.ts";
|
|
10
|
+
/** A scene object's transform keys: its position, its rotation in degrees, and its scales. */
|
|
11
|
+
export type TransformKey = "x" | "y" | "z" | "rotateX" | "rotateY" | "rotateZ" | "scale" | "scaleX" | "scaleY" | "scaleZ";
|
|
12
|
+
/** `T`'s keys that hold a number. */
|
|
13
|
+
type NumberKey<T> = {
|
|
14
|
+
readonly [K in keyof T]-?: T[K] extends number ? K : never;
|
|
15
|
+
}[keyof T] & string;
|
|
16
|
+
/** The axes of a three vector, by its flag: `X`, `Y`, and `Z` and `W` where it has them. */
|
|
17
|
+
type AxesOf<V> = V extends {
|
|
18
|
+
readonly isVector4: true;
|
|
19
|
+
} ? "X" | "Y" | "Z" | "W" : V extends {
|
|
20
|
+
readonly isVector3: true;
|
|
21
|
+
} ? "X" | "Y" | "Z" : V extends {
|
|
22
|
+
readonly isVector2: true;
|
|
23
|
+
} ? "X" | "Y" : never;
|
|
24
|
+
/** `T`'s vectors' axes as keys: `positionX`, `uOffsetY`. */
|
|
25
|
+
type VectorKey<T> = {
|
|
26
|
+
readonly [K in keyof T]-?: K extends string ? `${K}${AxesOf<T[K]>}` : never;
|
|
27
|
+
}[keyof T];
|
|
28
|
+
/** A three `Color`, by its flag. */
|
|
29
|
+
type IsColor = {
|
|
30
|
+
readonly isColor: true;
|
|
31
|
+
};
|
|
32
|
+
/** `T`'s keys that hold a three `Color`. */
|
|
33
|
+
type ColourKeyOf<T> = {
|
|
34
|
+
readonly [K in keyof T]-?: T[K] extends IsColor ? K : never;
|
|
35
|
+
}[keyof T] & string;
|
|
36
|
+
/** A colour's channel keys, in linear light: `colorR`, `colorG`, `colorB`. */
|
|
37
|
+
type ChannelKey<K extends string> = `${K}${(typeof ThreeColours.CHANNELS)[number]}`;
|
|
38
|
+
/** The names of `U`'s uniforms that hold a number, a vector's axes, or a colour's channels. */
|
|
39
|
+
type UniformKey<U> = {
|
|
40
|
+
readonly [K in keyof U]-?: U[K] extends {
|
|
41
|
+
value: number;
|
|
42
|
+
} ? K : U[K] extends {
|
|
43
|
+
value: IsColor;
|
|
44
|
+
} ? (K extends string ? ChannelKey<K> : never) : U[K] extends {
|
|
45
|
+
value: infer V;
|
|
46
|
+
} ? (K extends string ? `${K}${AxesOf<V>}` : never) : never;
|
|
47
|
+
}[keyof U] & string;
|
|
48
|
+
/** The names of `U`'s uniforms that hold a `Color`. */
|
|
49
|
+
type UniformColourKey<U> = {
|
|
50
|
+
readonly [K in keyof U]-?: U[K] extends {
|
|
51
|
+
value: IsColor;
|
|
52
|
+
} ? K : never;
|
|
53
|
+
}[keyof U] & string;
|
|
54
|
+
/** The uniforms `M` holds, a `ShaderMaterial`'s. */
|
|
55
|
+
type UniformsOf<M> = M extends {
|
|
56
|
+
readonly uniforms: infer U;
|
|
57
|
+
} ? U : never;
|
|
58
|
+
/** The number keys of `M`, a material: its numbers, its vectors' axes, its colours' channels, and its uniforms'. */
|
|
59
|
+
type MaterialKey<M> = NumberKey<M> | VectorKey<M> | ChannelKey<ColourKeyOf<M>> | UniformKey<UniformsOf<M>>;
|
|
60
|
+
/** The colour keys of `M`, a material: its `Color`s and its uniforms'. */
|
|
61
|
+
type MaterialColourKey<M> = ColourKeyOf<M> | UniformColourKey<UniformsOf<M>>;
|
|
62
|
+
/** The material a mesh's `material` gives it: each of an array of them. */
|
|
63
|
+
type MaterialOf<T> = T extends {
|
|
64
|
+
readonly material: infer M;
|
|
65
|
+
} ? (M extends ReadonlyArray<infer E> ? E : M) : never;
|
|
66
|
+
/** The number keys of a three Subject `T`: a scene object's transforms, numbers and vectors' axes, and its material's; a material's own. */
|
|
67
|
+
export type SceneKey<T> = T extends {
|
|
68
|
+
readonly isObject3D: true;
|
|
69
|
+
} ? TransformKey | NumberKey<T> | VectorKey<T> | MaterialKey<MaterialOf<T>> : T extends {
|
|
70
|
+
readonly isMaterial: unknown;
|
|
71
|
+
} ? MaterialKey<T> : never;
|
|
72
|
+
/** The colour keys of a three Subject `T`: its material's `Color`s for a scene object, a material's own, a uniforms object's. */
|
|
73
|
+
export type ColourKey<T> = T extends {
|
|
74
|
+
readonly isObject3D: true;
|
|
75
|
+
} ? ColourKeyOf<T> | MaterialColourKey<MaterialOf<T>> : T extends {
|
|
76
|
+
readonly isMaterial: unknown;
|
|
77
|
+
} ? MaterialColourKey<T> : UniformColourKey<T>;
|
|
78
|
+
/** A key's value in a scene: a number, or keyframes of them. */
|
|
79
|
+
type SceneValue = number | Config.WardicKeyframes<number>;
|
|
80
|
+
/** A colour key's value: a colour, or keyframes of them. */
|
|
81
|
+
type ColourTargetValue = ThreeColours.ColourValue | Config.WardicKeyframes<ThreeColours.ColourValue>;
|
|
82
|
+
/** A key's value among number keys `K` and colour keys `C`: either, for a key in both (a `ShaderMaterial`'s uniforms, which three types as any name of any value). */
|
|
83
|
+
type ValueOf<Key, K, C, N, Colour> = Key extends C ? (Key extends K ? N | Colour : Colour) : N;
|
|
84
|
+
/** A target for a scene's Subject, by its number keys `K` and its colour keys `C`. */
|
|
85
|
+
type SceneTarget<K extends string, C extends string> = {
|
|
86
|
+
readonly [Key in K | C]?: ValueOf<Key, K, C, SceneValue, ColourTargetValue>;
|
|
87
|
+
} & {
|
|
88
|
+
readonly transition?: Config.WardicTransition | undefined;
|
|
89
|
+
readonly transitionEnd?: {
|
|
90
|
+
readonly [Key in K | C]?: ValueOf<Key, K, C, number, ThreeColours.ColourValue>;
|
|
91
|
+
} | undefined;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* A target for `T`: a scene object's or a material's by its scene keys and colours; a uniforms object's
|
|
95
|
+
* by its uniforms' names; any other object's (a `Vector3`, a plain `{ x }`) by its own keys, as `@wardic/object`'s.
|
|
96
|
+
*/
|
|
97
|
+
export type ThreeTarget<T> = [SceneKey<T>] extends [never] ? WardicObject.ObjectTarget<T> & SceneTarget<UniformKey<T>, UniformColourKey<T>> : SceneTarget<SceneKey<T>, ColourKey<T>>;
|
|
98
|
+
/** An `InstancedMesh`, by its flag. */
|
|
99
|
+
type IsInstancedMesh = {
|
|
100
|
+
readonly isInstancedMesh: true;
|
|
101
|
+
};
|
|
102
|
+
/** The keys a Batch of `T` takes: an `InstancedMesh`'s instance's, a scene object's scene keys, any other object's numbers. */
|
|
103
|
+
export type BatchKey<T> = T extends ThreeInstances.Instance<IsInstancedMesh> ? ThreeInstances.InstanceKey : [SceneKey<T>] extends [never] ? ObjectBatch.NumberKey<T> : SceneKey<T>;
|
|
104
|
+
/** The colour keys a Batch of `T` takes: an instance's `color`, a scene object's colours. */
|
|
105
|
+
export type BatchColourKey<T> = T extends ThreeInstances.Instance<IsInstancedMesh> ? "color" : T extends {
|
|
106
|
+
readonly isObject3D: true;
|
|
107
|
+
} ? ColourKey<T> : never;
|
|
108
|
+
/** A Batch of a scene's objects, or of an `InstancedMesh`'s instances: one run for all of them. `@wardic/object`'s, on scene keys. */
|
|
109
|
+
export type ThreeBatch<T extends object> = ObjectBatch.ObjectBatch<T, BatchKey<T>>;
|
|
110
|
+
/** A Batch's stop of a colour: one for every member, or a function of a member's index and the count. */
|
|
111
|
+
type ColourStop = ThreeColours.ColourValue | ((i: number, n: number) => ThreeColours.ColourValue);
|
|
112
|
+
/** A Batch's value for a number key: a stop, two (its first and its target), or a function giving them. `@wardic/object`'s. */
|
|
113
|
+
type BatchNumberValue = ObjectBatch.Stop | readonly [ObjectBatch.Stop, ObjectBatch.Stop] | ((i: number, n: number) => number | readonly [number, number]);
|
|
114
|
+
/** A Batch's value for a colour key: a stop, two, or a function giving them. */
|
|
115
|
+
type BatchColourValue = ColourStop | readonly [ColourStop, ColourStop] | ((i: number, n: number) => ThreeColours.ColourValue | readonly [ThreeColours.ColourValue, ThreeColours.ColourValue]);
|
|
116
|
+
/** A Batch of `T`'s targets for an `animate` call: each number key and colour key a stop, two, or a function of a member's index giving them. */
|
|
117
|
+
export type ThreeBatchTarget<T> = {
|
|
118
|
+
readonly [Key in BatchKey<T> | BatchColourKey<T>]?: ValueOf<Key, BatchKey<T>, BatchColourKey<T>, BatchNumberValue, BatchColourValue>;
|
|
119
|
+
};
|
|
120
|
+
/** A Batch's colour key in a sequence's Segment of it: a colour, `null` for where it is, stops of them, or a function giving them. */
|
|
121
|
+
type ColourSegmentValue = ThreeColours.ColourValue | null | ReadonlyArray<ThreeColours.ColourValue | null> | ((i: number, n: number) => ThreeColours.ColourValue | null | ReadonlyArray<ThreeColours.ColourValue | null>);
|
|
122
|
+
/** A Segment of a Batch, `[batch, target, options?]`, its colour keys taking colours: every member, or a member's handle, `batch.at(i)`. */
|
|
123
|
+
export type ThreeBatchSegment = readonly [batch: ObjectBatch.ObjectBatch<any, any> | ObjectBatch.Member<any, any>, target: Readonly<Record<string, ObjectBatch.SegmentValue | ColourSegmentValue>>] | readonly [batch: ObjectBatch.ObjectBatch<any, any> | ObjectBatch.Member<any, any>, target: Readonly<Record<string, ObjectBatch.SegmentValue | ColourSegmentValue>>, options: Imperative.WardicSegmentOptions];
|
|
124
|
+
/** A sequence of a scene: `@wardic/object`'s Segments, its Segments of Batches taking colours. Motion's `AnimationSequence`. */
|
|
125
|
+
export type ThreeSequence = ReadonlyArray<WardicObject.ObjectSequence[number] | ThreeBatchSegment>;
|
|
126
|
+
/**
|
|
127
|
+
* `animate(subject, target, options?)` animates a scene's Subject, or each of a list of them, to
|
|
128
|
+
* `target`; `animate(sequence, options?)` plays a sequence. Either returns its Playback controls. Motion's.
|
|
129
|
+
*/
|
|
130
|
+
export interface ThreeAnimate {
|
|
131
|
+
<T extends object>(batch: ThreeBatch<T> | ObjectBatch.Member<T, BatchKey<T>>, target: ThreeBatchTarget<T>, options?: Imperative.WardicAnimateOptions): Imperative.WardicPlaybackControls;
|
|
132
|
+
<T extends object>(subject: T | ReadonlyArray<T>, target: ThreeTarget<T>, options?: Imperative.WardicAnimateOptions): Imperative.WardicPlaybackControls;
|
|
133
|
+
(sequence: ThreeSequence, options?: Imperative.WardicSequenceOptions): Imperative.WardicPlaybackControls;
|
|
134
|
+
}
|
|
135
|
+
/** A runtime's options: `@wardic/object`'s, the scene's unit scale, and its input. */
|
|
136
|
+
export interface Options extends WardicObject.Options {
|
|
137
|
+
/**
|
|
138
|
+
* How many of Motion's units a metre is, for `x`, `y` and `z`'s springs' rest: 100 (a scene in
|
|
139
|
+
* metres), so a 10 m move rests within 5 mm. Give 1 for a scene in pixels.
|
|
140
|
+
*/
|
|
141
|
+
readonly unitScale?: number | undefined;
|
|
142
|
+
/** The canvas the scene is drawn on, whose pointer events `hover` and `press` hear: with `camera` and `scene`. */
|
|
143
|
+
readonly canvas?: ThreeInput.CanvasLike | undefined;
|
|
144
|
+
/** The camera the scene is drawn with, or a function giving the one active now: a pointer's ray is cast from it. */
|
|
145
|
+
readonly camera?: Camera | (() => Camera) | undefined;
|
|
146
|
+
/** The scene a pointer hits. */
|
|
147
|
+
readonly scene?: Object3D | undefined;
|
|
148
|
+
/** What a pointer hits, in the raycast's place: a BVH's, or a GPU pick's. */
|
|
149
|
+
readonly hitTest?: ThreeInput.HitTest | undefined;
|
|
150
|
+
/** Where a held pointer's events are heard once it leaves the canvas: the canvas's window when left out. */
|
|
151
|
+
readonly window?: EventTarget | undefined;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* `batch(objects, options?)` makes a Batch of a list of objects; `batch(instanced, options?)` one of an
|
|
155
|
+
* `InstancedMesh`'s instances, a member each. Either runs on the keys of its first `animate` (or `keys`).
|
|
156
|
+
*/
|
|
157
|
+
export interface ThreeBatchOf {
|
|
158
|
+
<M extends IsInstancedMesh>(instanced: M, options?: ObjectBatch.Options<ThreeInstances.Instance<M>, ThreeInstances.InstanceKey | "color">): ThreeBatch<ThreeInstances.Instance<M>>;
|
|
159
|
+
<T extends object>(objects: ReadonlyArray<T>, options?: ObjectBatch.Options<T, BatchKey<T> | BatchColourKey<T>>): ThreeBatch<T>;
|
|
160
|
+
}
|
|
161
|
+
/** A runtime: what animates a scene on one Host loop. */
|
|
162
|
+
export interface WardicThree extends Omit<WardicObject.WardicObject, "animate" | "batch"> {
|
|
163
|
+
readonly animate: ThreeAnimate;
|
|
164
|
+
/**
|
|
165
|
+
* A Batch of `objects`, or of an `InstancedMesh`'s instances: one run for all of them, on the keys of
|
|
166
|
+
* its first `animate` (or `keys`). `animate(batch, target)` moves every member; `animate(batch.at(i),
|
|
167
|
+
* target)` member `i`. An instance takes its transforms and its colour.
|
|
168
|
+
*/
|
|
169
|
+
readonly batch: ThreeBatchOf;
|
|
170
|
+
/**
|
|
171
|
+
* `hover(subject, onStart)`: `onStart` runs as a pointer comes over `subject` (a scene object, a Batch's
|
|
172
|
+
* member, or each member of a Batch), and what it returns, as the pointer goes off. Returns its cancel.
|
|
173
|
+
* Needs `make`'s `canvas`, `camera` and `scene`.
|
|
174
|
+
*/
|
|
175
|
+
readonly hover: (subject: object, onStart: ThreeInput.HoverStart) => () => void;
|
|
176
|
+
/**
|
|
177
|
+
* `press(subject, onStart)`: `onStart` runs as a press starts on `subject`, and what it returns, as it
|
|
178
|
+
* ends, told whether it ended on it. Returns its cancel. Needs `make`'s `canvas`, `camera` and `scene`.
|
|
179
|
+
*/
|
|
180
|
+
readonly press: (subject: object, onStart: ThreeInput.PressStart) => () => void;
|
|
181
|
+
/**
|
|
182
|
+
* The scene's pointer input, as core's `InputSource`, for a binding's gestures: `undefined` with no
|
|
183
|
+
* canvas. Unstable: what `@wardic/three/solid`'s Stage hands its hooks.
|
|
184
|
+
*/
|
|
185
|
+
readonly input: InputSource.InputSource["Service"] | undefined;
|
|
186
|
+
}
|
|
187
|
+
/** A scene's unit scale when the app gives none: a metre counts as 100 of Motion's units. */
|
|
188
|
+
export declare const UNIT_SCALE = 100;
|
|
189
|
+
/** three's Environment for `@wardic/object`'s runtime, at `unitScale`. */
|
|
190
|
+
export declare const environment: (unitScale?: number) => WardicObject.Environment;
|
|
191
|
+
/** A runtime on frames the Host loop pumps: `frame(time)` once a frame, before it renders. */
|
|
192
|
+
export declare const make: (options?: Options) => WardicThree;
|
|
193
|
+
export {};
|
|
194
|
+
//# sourceMappingURL=WardicThree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WardicThree.d.ts","sourceRoot":"","sources":["../src/WardicThree.ts"],"names":[],"mappings":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AAC,CAAC,CAAC,CAAA;CAChI;AAED,yDAAyD;AACzD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,GAAG,OAAO,CAAC;IACvF,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU,KAAK,MAAM,IAAI,CAAA;IAC/E;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU,KAAK,MAAM,IAAI,CAAA;IAC/E;;;OAGG;IAEH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,SAAS,CAAA;CAC/D;AAED,6FAA6F;AAE7F,eAAO,MAAM,UAAU,MAAM,CAAA;AAE7B,0EAA0E;AAC1E,eAAO,MAAM,WAAW,eAAe,MAAM,KAAgB,YAAY,CAAC,WAUxE,CAAA;AA+DF,8FAA8F;AAC9F,eAAO,MAAM,IAAI,aAAa,OAAO,KAAQ,WAqC5C,CAAA"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wardic for three.js: Motion's `animate` on a scene's meshes, materials, cameras, lights and uniforms,
|
|
3
|
+
* on frames the Host loop pumps. One runtime per Host loop: `make` builds it, the loop calls
|
|
4
|
+
* `frame(time)` once a frame before it renders, and `dispose` ends it.
|
|
5
|
+
*
|
|
6
|
+
* - **Transform keys** are Motion's names: `x`, `y` and `z` move `position`; `rotateX`, `rotateY` and
|
|
7
|
+
* `rotateZ` turn `rotation`, in degrees; `scale` sets all three scales, and `scaleX`, `scaleY` and
|
|
8
|
+
* `scaleZ` one each.
|
|
9
|
+
* - **Any other key** is the object's own number (a camera's `fov`, a light's `intensity`), else its
|
|
10
|
+
* material's (`opacity`, `roughness`: on every mesh that shares the material), a uniform's, or a
|
|
11
|
+
* vector's axis (`emissiveIntensity`, `uProgress`, `positionX`). The types are three's own:
|
|
12
|
+
* `animate(mesh, { rotatY: 90 })` is an error.
|
|
13
|
+
* - **Colours** (`color`, `emissive`, a uniform's `Color`) take a CSS colour, a hex number or a
|
|
14
|
+
* `Color`, and blend in linear light, three's: red to blue passes `#bc00bc`. A spring keeps a
|
|
15
|
+
* colour's speed through a change of target, as it keeps a position's.
|
|
16
|
+
* - **A Batch** (`batch`) moves many objects as one run, or an `InstancedMesh`'s instances: each by
|
|
17
|
+
* its transforms and its instance colour, its matrix written in place.
|
|
18
|
+
* - **Units:** `x`, `y` and `z` are metres, so springs rest within millimetres (`unitScale`).
|
|
19
|
+
* - **three's rules after a write:** a camera's projection keys update its projection matrix, and an
|
|
20
|
+
* `opacity` below 1 draws its material transparent.
|
|
21
|
+
* - **Hover and press** (`hover`, `press`), given `make`'s `canvas`, `camera` and `scene`: a pointer hits
|
|
22
|
+
* the nearest drawn object under it, cast once a frame (`ThreeInput`).
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import * as WardicThree from "@wardic/three/WardicThree"
|
|
26
|
+
*
|
|
27
|
+
* const wardic = WardicThree.make()
|
|
28
|
+
* renderer.setAnimationLoop((time) => {
|
|
29
|
+
* wardic.frame(time)
|
|
30
|
+
* renderer.render(scene, camera)
|
|
31
|
+
* })
|
|
32
|
+
* wardic.animate(cube, { y: 2, rotateY: 180 }, { type: "spring", bounce: 0.3 })
|
|
33
|
+
* await wardic.animate(cube, { opacity: 0 }, { duration: 0.4 })
|
|
34
|
+
*/
|
|
35
|
+
// `@wardic/three/WardicThree` (#883; ADR-0069 decisions 3–9 and 21, ADR-0073 *Amendment (#883)*, Q1–Q3):
|
|
36
|
+
// `@wardic/object`'s runtime through `WardicObject.makeWith`, on three's Environment. The scene's input
|
|
37
|
+
// (`hover`, `press`, the raycast) is #883's PR 5a (`ThreeInput`); colours are PR 3's (`ThreeColours`), split at the call
|
|
38
|
+
// into their channels; an `InstancedMesh`'s instances PR 4's (`ThreeInstances`, its Environment's `batchSource`).
|
|
39
|
+
import * as UnitScale from "@wardic/core/UnitScale";
|
|
40
|
+
import * as Imperative from "@wardic/core/unstable/Imperative";
|
|
41
|
+
import * as ObjectBatch from "@wardic/object/ObjectBatch";
|
|
42
|
+
import * as ObjectValues from "@wardic/object/ObjectValues";
|
|
43
|
+
import * as WardicObject from "@wardic/object/WardicObject";
|
|
44
|
+
import * as Arr from "effect/Array";
|
|
45
|
+
import { constUndefined } from "effect/Function";
|
|
46
|
+
import * as Predicate from "effect/Predicate";
|
|
47
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
48
|
+
import * as ThreeColours from "./ThreeColours.js";
|
|
49
|
+
import * as ThreeInput from "./ThreeInput.js";
|
|
50
|
+
import * as ThreeInstances from "./ThreeInstances.js";
|
|
51
|
+
import * as ThreeRenderer from "./ThreeRenderer.js";
|
|
52
|
+
import * as ThreeValues from "./ThreeValues.js";
|
|
53
|
+
/** A scene's unit scale when the app gives none: a metre counts as 100 of Motion's units. */
|
|
54
|
+
// ADR-0069 decision 8.
|
|
55
|
+
export const UNIT_SCALE = 100;
|
|
56
|
+
/** three's Environment for `@wardic/object`'s runtime, at `unitScale`. */
|
|
57
|
+
export const environment = (unitScale = UNIT_SCALE) => ({
|
|
58
|
+
renderer: ThreeRenderer.layer,
|
|
59
|
+
gate: ThreeRenderer.GATE,
|
|
60
|
+
startLinksOf: ThreeValues.startLinksOf,
|
|
61
|
+
ownValues: ObjectValues.ownValues,
|
|
62
|
+
positionalKeys: ThreeValues.positionalKeys,
|
|
63
|
+
batchWriter: ThreeRenderer.writer,
|
|
64
|
+
batchRead: ThreeValues.read,
|
|
65
|
+
batchSource: ThreeInstances.batchSource(),
|
|
66
|
+
layers: UnitScale.layerWith(ThreeColours.unitScale(unitScale)),
|
|
67
|
+
});
|
|
68
|
+
/** A Segment of a sequence with its colour keys split: a Segment of a Subject or of a Batch, `[subject, target, options?]`; any other as it is. */
|
|
69
|
+
const splitSegment = (segment) => {
|
|
70
|
+
if (!Arr.isArray(segment))
|
|
71
|
+
return segment;
|
|
72
|
+
const [subject, target, options] = segment;
|
|
73
|
+
if (Predicate.isFunction(subject))
|
|
74
|
+
return segment;
|
|
75
|
+
const [split, splitOptions] = ThreeColours.splitCall(subjectOf(subject), target, options);
|
|
76
|
+
if (split === target)
|
|
77
|
+
return segment;
|
|
78
|
+
if (segment.length < 3)
|
|
79
|
+
return [subject, split];
|
|
80
|
+
return [subject, split, splitOptions];
|
|
81
|
+
};
|
|
82
|
+
/** A Batch's member a call's colours are read by: a member handle's own, else the Batch's first. */
|
|
83
|
+
const memberOf = (handle) => {
|
|
84
|
+
if (Predicate.isNumber(handle.i) && Predicate.isNotUndefined(handle.batch))
|
|
85
|
+
return handle.batch.members[handle.i];
|
|
86
|
+
return UndefinedOr.match(handle.members, { onUndefined: constUndefined, onDefined: (members) => members[0] });
|
|
87
|
+
};
|
|
88
|
+
/** The Subject a call's target is read for: a Batch's member, the first of a list, or the Subject itself. */
|
|
89
|
+
const subjectOf = (subject) => {
|
|
90
|
+
if (Predicate.isNotUndefined(ObjectBatch.entryOf(subject)))
|
|
91
|
+
return memberOf(subject);
|
|
92
|
+
if (Arr.isArray(subject))
|
|
93
|
+
return subject[0];
|
|
94
|
+
return subject;
|
|
95
|
+
};
|
|
96
|
+
/** `animate` with each colour key split into its channels at the call, for a Subject, a list of them, a Batch, or a sequence's Segments of them. */
|
|
97
|
+
const withColours = (animate) => (first, second, third) => {
|
|
98
|
+
if (Imperative.isSequence(first))
|
|
99
|
+
return animate(Arr.map(first, splitSegment), second);
|
|
100
|
+
const [split, options] = ThreeColours.splitCall(subjectOf(first), second, third);
|
|
101
|
+
return animate(first, split, options);
|
|
102
|
+
};
|
|
103
|
+
/** `batch` with each colour key in its `keys` given as its channels. */
|
|
104
|
+
const withChannelKeys = (batch) => (given, options) => {
|
|
105
|
+
if (Predicate.isUndefined(options) || Predicate.isUndefined(options.keys))
|
|
106
|
+
return batch(given, options);
|
|
107
|
+
return batch(given, { ...options, keys: ThreeColours.splitBatchKeys(given, options.keys) });
|
|
108
|
+
};
|
|
109
|
+
/** The scene's input `options` give: `undefined` without a canvas, an error naming what's missing with one. */
|
|
110
|
+
const inputOf = (options) => {
|
|
111
|
+
const { canvas, camera, scene } = options;
|
|
112
|
+
if (Predicate.isUndefined(canvas))
|
|
113
|
+
return undefined;
|
|
114
|
+
if (Predicate.isUndefined(camera) || Predicate.isUndefined(scene)) {
|
|
115
|
+
throw new Error("WardicThree.make: a canvas's input needs its camera and its scene too, to cast a pointer's ray: make({ canvas, camera, scene }).");
|
|
116
|
+
}
|
|
117
|
+
return ThreeInput.make({ canvas, camera, scene, hitTest: options.hitTest, window: options.window });
|
|
118
|
+
};
|
|
119
|
+
/** A gesture's call on a runtime with no input: an error naming the options it needs. */
|
|
120
|
+
const noInput = (name) => () => {
|
|
121
|
+
throw new Error(`wardic.${name}: this runtime has no scene input. Give make the canvas the scene is drawn on, its camera and the scene: WardicThree.make({ canvas: renderer.domElement, camera, scene }).`);
|
|
122
|
+
};
|
|
123
|
+
/** A runtime on frames the Host loop pumps: `frame(time)` once a frame, before it renders. */
|
|
124
|
+
export const make = (options = {}) => {
|
|
125
|
+
const unitScale = UndefinedOr.match(options.unitScale, { onUndefined: () => UNIT_SCALE, onDefined: (given) => given });
|
|
126
|
+
const runtime = WardicObject.makeWith(environment(unitScale), options);
|
|
127
|
+
const input = inputOf(options);
|
|
128
|
+
if (Predicate.isUndefined(input)) {
|
|
129
|
+
return {
|
|
130
|
+
animate: withColours(runtime.animate),
|
|
131
|
+
batch: withChannelKeys(runtime.batch),
|
|
132
|
+
afterWrites: runtime.afterWrites,
|
|
133
|
+
frame: runtime.frame,
|
|
134
|
+
wantsFrame: runtime.wantsFrame,
|
|
135
|
+
dispose: runtime.dispose,
|
|
136
|
+
stageEnvironment: runtime.stageEnvironment,
|
|
137
|
+
hover: noInput("hover"),
|
|
138
|
+
press: noInput("press"),
|
|
139
|
+
input: undefined,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
animate: withColours(runtime.animate),
|
|
144
|
+
batch: withChannelKeys(runtime.batch),
|
|
145
|
+
afterWrites: runtime.afterWrites,
|
|
146
|
+
// The raycast first, against what was last drawn, then Wardic's writes.
|
|
147
|
+
frame: (time) => {
|
|
148
|
+
input.frame();
|
|
149
|
+
runtime.frame(time);
|
|
150
|
+
},
|
|
151
|
+
wantsFrame: () => runtime.wantsFrame() || input.wantsFrame(),
|
|
152
|
+
dispose: () => {
|
|
153
|
+
input.dispose();
|
|
154
|
+
runtime.dispose();
|
|
155
|
+
},
|
|
156
|
+
stageEnvironment: runtime.stageEnvironment,
|
|
157
|
+
hover: input.hover,
|
|
158
|
+
press: input.press,
|
|
159
|
+
input: input.source,
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=WardicThree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WardicThree.js","sourceRoot":"","sources":["../src/WardicThree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,yGAAyG;AACzG,wGAAwG;AACxG,yHAAyH;AACzH,kHAAkH;AAClH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,WAAW,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,SAAS,MAAM,kB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