@rydr/game-sdk 8.13.0 → 8.15.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/dist/protocol/identity.d.ts +39 -0
- package/dist/protocol/identity.d.ts.map +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/protocol/version.js +1 -1
- package/dist/three/README.md +132 -4
- package/dist/three/character/riders.d.ts.map +1 -1
- package/dist/three/character/riders.js.map +1 -1
- package/dist/three/controller/index.d.ts +2 -0
- package/dist/three/controller/index.d.ts.map +1 -1
- package/dist/three/controller/index.js +2 -0
- package/dist/three/controller/index.js.map +1 -1
- package/dist/three/controller/joycon-designs.d.ts +15 -1
- package/dist/three/controller/joycon-designs.d.ts.map +1 -1
- package/dist/three/controller/joycon-designs.js +302 -60
- package/dist/three/controller/joycon-designs.js.map +1 -1
- package/dist/three/controller/joycon-object.d.ts +216 -0
- package/dist/three/controller/joycon-object.d.ts.map +1 -0
- package/dist/three/controller/joycon-object.js +578 -0
- package/dist/three/controller/joycon-object.js.map +1 -0
- package/dist/three/controller/joycon-spec.d.ts +116 -4
- package/dist/three/controller/joycon-spec.d.ts.map +1 -1
- package/dist/three/controller/joycon-spec.js +128 -22
- package/dist/three/controller/joycon-spec.js.map +1 -1
- package/dist/three/controller/press-pulse.d.ts +89 -0
- package/dist/three/controller/press-pulse.d.ts.map +1 -0
- package/dist/three/controller/press-pulse.js +309 -0
- package/dist/three/controller/press-pulse.js.map +1 -0
- package/dist/three/controller/three-pad-renderer.d.ts +11 -22
- package/dist/three/controller/three-pad-renderer.d.ts.map +1 -1
- package/dist/three/controller/three-pad-renderer.js +44 -258
- package/dist/three/controller/three-pad-renderer.js.map +1 -1
- package/dist/three/rider/three-rider-rig.d.ts +12 -0
- package/dist/three/rider/three-rider-rig.d.ts.map +1 -1
- package/dist/three/rider/three-rider-rig.js +102 -9
- package/dist/three/rider/three-rider-rig.js.map +1 -1
- package/dist/ui/README.md +133 -7
- package/dist/ui/choice-card.d.ts +8 -0
- package/dist/ui/choice-card.d.ts.map +1 -1
- package/dist/ui/choice-card.js +1 -1
- package/dist/ui/choice-card.js.map +1 -1
- package/dist/ui/controller/controller-pad.d.ts +105 -2
- package/dist/ui/controller/controller-pad.d.ts.map +1 -1
- package/dist/ui/controller/controller-pad.js +347 -16
- package/dist/ui/controller/controller-pad.js.map +1 -1
- package/dist/ui/controller/renderer.d.ts +13 -0
- package/dist/ui/controller/renderer.d.ts.map +1 -1
- package/dist/ui/controller/renderer.js.map +1 -1
- package/dist/ui/controller/styles.js +50 -1
- package/dist/ui/controller/styles.js.map +1 -1
- package/dist/ui/dialogue-card.d.ts +8 -0
- package/dist/ui/dialogue-card.d.ts.map +1 -1
- package/dist/ui/dialogue-card.js +1 -1
- package/dist/ui/dialogue-card.js.map +1 -1
- package/dist/ui/hud-placement.d.ts +81 -0
- package/dist/ui/hud-placement.d.ts.map +1 -0
- package/dist/ui/hud-placement.js +74 -0
- package/dist/ui/hud-placement.js.map +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/rider-rig.d.ts +108 -10
- package/dist/ui/rider-rig.d.ts.map +1 -1
- package/dist/ui/rider-rig.js +299 -48
- package/dist/ui/rider-rig.js.map +1 -1
- package/dist/ui/solo-labeled-diamond.d.ts +13 -0
- package/dist/ui/solo-labeled-diamond.d.ts.map +1 -1
- package/dist/ui/solo-labeled-diamond.js +1 -1
- package/dist/ui/solo-labeled-diamond.js.map +1 -1
- package/package.json +4 -2
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
* captions and the guided lesson's gating all work against it **unchanged** — none of them knows or
|
|
14
14
|
* cares that there is a WebGL canvas where an `<svg>` used to be.
|
|
15
15
|
*
|
|
16
|
+
* ## What this file is, and what it is not
|
|
17
|
+
*
|
|
18
|
+
* It is the FRAMING half: a canvas, a camera, a rule for fitting the pad into it, a dirty-guarded
|
|
19
|
+
* render loop, and the projection that answers "where is this key on screen". Everything the pad
|
|
20
|
+
* actually *does* — lighting a key, sinking it, pulsing, leaning a stick, rolling to show a trigger —
|
|
21
|
+
* lives in {@link createJoyconObject}, which a game can also use on its own to put the pad in its own
|
|
22
|
+
* scene. Both paths animate through that one implementation on purpose: a press must not look one way
|
|
23
|
+
* in a HUD and another way in a world.
|
|
24
|
+
*
|
|
16
25
|
* ## What the third dimension actually buys
|
|
17
26
|
*
|
|
18
27
|
* Two things the flat pad could not say:
|
|
@@ -37,33 +46,8 @@
|
|
|
37
46
|
* hidden tab: a pad nobody is touching costs nothing per frame, exactly like the flat one's dirty-guard.
|
|
38
47
|
*/
|
|
39
48
|
import * as THREE from "three";
|
|
40
|
-
import { FAINT_PARTS, SHELL_OWNED_PARTS, STICK_LIT_DEADZONE } from "../../ui/controller/pad-svg.js";
|
|
41
49
|
import { partRectOf, } from "../../ui/controller/renderer.js";
|
|
42
|
-
import {
|
|
43
|
-
import { VIEW, W } from "./joycon-spec.js";
|
|
44
|
-
import { glyphTexture } from "./glyph-texture.js";
|
|
45
|
-
/** The four things a part can say, as colours. Same grammar and same hues as the flat pad's CSS. */
|
|
46
|
-
const STATE_COLOR = {
|
|
47
|
-
off: 0x8ea3bd,
|
|
48
|
-
hint: 0xf2f6ff,
|
|
49
|
-
on: 0x38bdf8,
|
|
50
|
-
done: 0x22c55e,
|
|
51
|
-
};
|
|
52
|
-
/** Emissive strength per state — what makes a lit button read as lit rather than merely repainted. */
|
|
53
|
-
const STATE_EMISSIVE = { off: 0, hint: 0.5, on: 0.85, done: 0.7 };
|
|
54
|
-
/** Glyph ink. A lit face goes bright, so its letter has to go dark to stay readable. */
|
|
55
|
-
const GLYPH_INK = {
|
|
56
|
-
off: "#eaf2ff",
|
|
57
|
-
hint: "#0b0f17",
|
|
58
|
-
on: "#06121a",
|
|
59
|
-
done: "#05210f",
|
|
60
|
-
};
|
|
61
|
-
/** How far a pressed key sinks, world units. A press is real travel here, not a simulated shadow. */
|
|
62
|
-
const PRESS_TRAVEL = W * 0.06;
|
|
63
|
-
/** Cap tilt at full stick deflection, radians. A stick leans; it doesn't slide. */
|
|
64
|
-
const STICK_TILT = 0.42;
|
|
65
|
-
/** Opacity for a part the rider's device doesn't have. Matches `.unavailable` on the flat pad. */
|
|
66
|
-
const UNAVAILABLE_OPACITY = 0.22;
|
|
50
|
+
import { createJoyconObject } from "./joycon-object.js";
|
|
67
51
|
/**
|
|
68
52
|
* Frames the pad fills of the canvas height. Below 1 leaves the margin the tilt needs — a tilted pad is
|
|
69
53
|
* taller than its flat footprint, and a camera framed on the flat one clips the triggers off the top.
|
|
@@ -91,185 +75,27 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
91
75
|
const scene = new THREE.Scene();
|
|
92
76
|
const camera = new THREE.PerspectiveCamera(30, 1, 0.1, 100);
|
|
93
77
|
camera.position.set(0, 0, 9);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
pivot.add(model.group);
|
|
103
|
-
const yawGroup = new THREE.Group();
|
|
104
|
-
yawGroup.rotation.y = opts.yaw ?? 0;
|
|
105
|
-
yawGroup.add(pivot);
|
|
106
|
-
scene.add(yawGroup);
|
|
107
|
-
// Accent is themable on the flat pad through a CSS variable; here it has to reach the materials.
|
|
108
|
-
const accent = opts.accent ? new THREE.Color(opts.accent).getHex() : STATE_COLOR.on;
|
|
109
|
-
/** Every part this model actually draws. */
|
|
110
|
-
const ALL_PARTS = [...model.controls.keys()];
|
|
111
|
-
/**
|
|
112
|
-
* The mesh and material behind a part.
|
|
113
|
-
*
|
|
114
|
-
* `JoyconBuild` keys its controls by name and hands back plain `Object3D`s, so this resolves one to
|
|
115
|
-
* something paintable. A stick's entry is its cap mesh, which is what should light and sink.
|
|
116
|
-
*/
|
|
117
|
-
function visualOf(part) {
|
|
118
|
-
const node = model.controls.get(part);
|
|
119
|
-
if (!node)
|
|
120
|
-
return undefined;
|
|
121
|
-
const mesh = node;
|
|
122
|
-
const mat = mesh.material;
|
|
123
|
-
if (!mat || !("color" in mat))
|
|
124
|
-
return undefined;
|
|
125
|
-
let rest = restZ.get(part);
|
|
126
|
-
if (rest === undefined) {
|
|
127
|
-
rest = node.position.z;
|
|
128
|
-
restZ.set(part, rest);
|
|
129
|
-
}
|
|
130
|
-
return { node, material: mat, restZ: rest };
|
|
131
|
-
}
|
|
132
|
-
/** Resting z per part, captured on first paint so a press is absolute, not cumulative. */
|
|
133
|
-
const restZ = new Map();
|
|
134
|
-
// ── state ───────────────────────────────────────────────────────────────────────────────────────
|
|
135
|
-
/** Dirty-guard, same intent as the flat driver's: an idle pad must do no work per frame. */
|
|
136
|
-
const lastVal = new Map();
|
|
137
|
-
const STATE_CODE = { off: 0, on: 1, hint: 2, done: 3 };
|
|
138
|
-
let unavailable = new Set();
|
|
139
|
-
let referenced = new Set();
|
|
78
|
+
// The pad itself: the model, its lighting, and every animation it can play. The renderer below only
|
|
79
|
+
// frames it — see the file header.
|
|
80
|
+
//
|
|
81
|
+
// The layout is passed through so the keys carry the RIDER's lettering: a view drawing a Nintendo pad
|
|
82
|
+
// and a renderer printing Xbox letters on it would disagree about the same button.
|
|
83
|
+
const pad = createJoyconObject({ ...opts, layout });
|
|
84
|
+
pad.addLights(scene);
|
|
85
|
+
scene.add(pad.group);
|
|
140
86
|
/** Set whenever something changed; the loop renders only then. */
|
|
141
87
|
let dirty = true;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return;
|
|
146
|
-
const dim = unavailable.has(part);
|
|
147
|
-
// `referenced` only ever RAISES a faint part back to full, exactly as the flat pad's rule does.
|
|
148
|
-
const faint = FAINT_PARTS.has(part) && !referenced.has(part);
|
|
149
|
-
const o = dim ? UNAVAILABLE_OPACITY : faint ? 0.4 : 1;
|
|
150
|
-
v.material.transparent = o < 1;
|
|
151
|
-
v.material.opacity = o;
|
|
152
|
-
}
|
|
153
|
-
function paint(part, state) {
|
|
154
|
-
const v = visualOf(part);
|
|
155
|
-
if (!v)
|
|
156
|
-
return;
|
|
157
|
-
const color = state === "on" ? accent : STATE_COLOR[state];
|
|
158
|
-
v.material.color.setHex(color);
|
|
159
|
-
v.material.emissive.setHex(state === "off" ? 0x000000 : color);
|
|
160
|
-
v.material.emissiveIntensity = STATE_EMISSIVE[state];
|
|
161
|
-
// A press is real travel here — the flat pad had to fake it with a drop shadow.
|
|
162
|
-
v.node.position.z = v.restZ - (state === "on" || state === "done" ? PRESS_TRAVEL : 0);
|
|
163
|
-
applyOpacity(part);
|
|
164
|
-
dirty = true;
|
|
165
|
-
}
|
|
166
|
-
/** What's printed on a part — read back off the built glyph so it can be re-inked per state. */
|
|
167
|
-
const glyphTexts = new Map();
|
|
168
|
-
function glyphTextOf(part) {
|
|
169
|
-
return glyphTexts.get(part) ?? "";
|
|
170
|
-
}
|
|
171
|
-
for (const [name, spec] of [
|
|
172
|
-
["faceTop", layout.face.top],
|
|
173
|
-
["faceRight", layout.face.right],
|
|
174
|
-
["faceBottom", layout.face.bottom],
|
|
175
|
-
["faceLeft", layout.face.left],
|
|
176
|
-
["select", layout.system?.select],
|
|
177
|
-
["start", layout.system?.start],
|
|
178
|
-
["lb", layout.bumpers?.l],
|
|
179
|
-
["rb", layout.bumpers?.r],
|
|
180
|
-
["lt", layout.triggers?.l],
|
|
181
|
-
["rt", layout.triggers?.r],
|
|
182
|
-
]) {
|
|
183
|
-
if (spec?.glyph)
|
|
184
|
-
glyphTexts.set(name, spec.glyph);
|
|
185
|
-
}
|
|
186
|
-
// ── the driver ──────────────────────────────────────────────────────────────────────────────────
|
|
187
|
-
const setPartState = (part, state) => {
|
|
188
|
-
if (SHELL_OWNED_PARTS.has(part) && !opts.allowShellOwned)
|
|
189
|
-
return;
|
|
190
|
-
if (lastVal.get(part) === STATE_CODE[state])
|
|
191
|
-
return;
|
|
192
|
-
lastVal.set(part, STATE_CODE[state]);
|
|
193
|
-
paint(part, state);
|
|
194
|
-
// A lit trigger rolls the pad forward so it can actually be seen — see `triggerTilt`.
|
|
195
|
-
if (part === "lt" || part === "rt") {
|
|
196
|
-
if (state === "off")
|
|
197
|
-
litTriggers.delete(part);
|
|
198
|
-
else
|
|
199
|
-
litTriggers.add(part);
|
|
200
|
-
aimRoll();
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
const setStick = (side, x, y, lit = "auto") => {
|
|
204
|
-
const pivot = model.sticks[side];
|
|
205
|
-
if (!pivot)
|
|
206
|
-
return;
|
|
207
|
-
const litKey = `${side}lit`;
|
|
208
|
-
const resolved = lit === "auto" ? (Math.hypot(x, y) > STICK_LIT_DEADZONE ? "on" : "off") : lit;
|
|
209
|
-
const code = resolved === "on" ? 1 : resolved === "hint" ? 2 : resolved === "done" ? 3 : 0;
|
|
210
|
-
if (lastVal.get(litKey) !== code) {
|
|
211
|
-
lastVal.set(litKey, code);
|
|
212
|
-
// Colour lives on the CAP, which is registered as the stick-click part.
|
|
213
|
-
const cap = visualOf(side === "l" ? "lstickPress" : "rstickPress");
|
|
214
|
-
if (cap) {
|
|
215
|
-
const state = resolved;
|
|
216
|
-
const color = state === "on" ? accent : STATE_COLOR[state];
|
|
217
|
-
cap.material.color.setHex(color);
|
|
218
|
-
cap.material.emissive.setHex(state === "off" ? 0x000000 : color);
|
|
219
|
-
cap.material.emissiveIntensity = STATE_EMISSIVE[state];
|
|
220
|
-
}
|
|
221
|
-
dirty = true;
|
|
222
|
-
}
|
|
223
|
-
// A real stick LEANS. `y` is up-positive in the SDK's convention, and a push "up" tips the cap away
|
|
224
|
-
// from the viewer — a negative rotation about x — so the sign works out without the flat
|
|
225
|
-
// renderer's y-negation.
|
|
226
|
-
const rx = -y * STICK_TILT;
|
|
227
|
-
const ry = x * STICK_TILT;
|
|
228
|
-
if (Math.abs(rx - (lastVal.get(`${side}rx`) ?? 0)) < 0.002 &&
|
|
229
|
-
Math.abs(ry - (lastVal.get(`${side}ry`) ?? 0)) < 0.002) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
lastVal.set(`${side}rx`, rx);
|
|
233
|
-
lastVal.set(`${side}ry`, ry);
|
|
234
|
-
pivot.rotation.x = rx;
|
|
235
|
-
pivot.rotation.y = ry;
|
|
88
|
+
// The object signals a repaint the moment a key changes, so a press that arrives between frames is
|
|
89
|
+
// not sat on until something else happens to dirty the scene.
|
|
90
|
+
pad.onChange(() => {
|
|
236
91
|
dirty = true;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
// `protocol/buttons.ts`), so the trigger simply lights, which `setPart` already does.
|
|
245
|
-
void side;
|
|
246
|
-
void v01;
|
|
247
|
-
},
|
|
248
|
-
setAvailable(available) {
|
|
249
|
-
unavailable = available == null
|
|
250
|
-
? new Set()
|
|
251
|
-
: new Set(ALL_PARTS.filter((p) => !available.includes(p) && !SHELL_OWNED_PARTS.has(p)));
|
|
252
|
-
for (const part of ALL_PARTS)
|
|
253
|
-
applyOpacity(part);
|
|
254
|
-
dirty = true;
|
|
255
|
-
},
|
|
256
|
-
clearAll() {
|
|
257
|
-
for (const part of ALL_PARTS) {
|
|
258
|
-
lastVal.set(part, 0);
|
|
259
|
-
paint(part, "off");
|
|
260
|
-
}
|
|
261
|
-
litTriggers.clear();
|
|
262
|
-
aimRoll();
|
|
263
|
-
for (const side of ["l", "r"]) {
|
|
264
|
-
lastVal.delete(`${side}lit`);
|
|
265
|
-
setStick(side, 0, 0, "off");
|
|
266
|
-
this.setMeter(side, 0);
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
};
|
|
270
|
-
// Paint every part once so a part's material starts in a known state rather than its build colour.
|
|
271
|
-
for (const part of ALL_PARTS)
|
|
272
|
-
paint(part, "off");
|
|
92
|
+
start();
|
|
93
|
+
});
|
|
94
|
+
const projectionCbs = new Set();
|
|
95
|
+
pad.onPoseChange(() => {
|
|
96
|
+
for (const cb of projectionCbs)
|
|
97
|
+
cb();
|
|
98
|
+
});
|
|
273
99
|
// ── sizing ──────────────────────────────────────────────────────────────────────────────────────
|
|
274
100
|
function resize() {
|
|
275
101
|
const w = canvas.clientWidth || 1;
|
|
@@ -279,12 +105,12 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
279
105
|
camera.aspect = w / h;
|
|
280
106
|
// Frame from the model's bounding SPHERE, which is invariant under rotation: one number frames
|
|
281
107
|
// every tilt and yaw without the framing pumping as the pad turns.
|
|
282
|
-
|
|
283
|
-
const box = new THREE.Box3().setFromObject(
|
|
108
|
+
pad.group.updateMatrixWorld(true);
|
|
109
|
+
const box = new THREE.Box3().setFromObject(pad.group);
|
|
284
110
|
const sphere = box.getBoundingSphere(new THREE.Sphere());
|
|
285
111
|
const fovV = (camera.fov * Math.PI) / 180;
|
|
286
112
|
const fovH = 2 * Math.atan(Math.tan(fovV / 2) * camera.aspect);
|
|
287
|
-
const fill = opts.fill ??
|
|
113
|
+
const fill = opts.fill ?? FRAME_FILL;
|
|
288
114
|
const dist = Math.max(sphere.radius / Math.sin(fovV / 2), sphere.radius / Math.sin(fovH / 2)) / fill;
|
|
289
115
|
// Offsets are expressed as fractions of the visible frame at the pad's distance, so they mean the
|
|
290
116
|
// same thing whatever the fill or the aspect.
|
|
@@ -297,51 +123,14 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
297
123
|
}
|
|
298
124
|
const ro = new ResizeObserver(() => resize());
|
|
299
125
|
ro.observe(canvas);
|
|
300
|
-
// ── the trigger roll ────────────────────────────────────────────────────────────────────────────
|
|
301
|
-
/** Which triggers are currently lit. The pad rolls while this is non-empty. */
|
|
302
|
-
const litTriggers = new Set();
|
|
303
|
-
const restTilt = opts.tilt ?? VIEW.pitch;
|
|
304
|
-
const extraTilt = opts.triggerTilt ?? 0.38;
|
|
305
|
-
const rollMs = opts.triggerTiltMs ?? 420;
|
|
306
|
-
/** 0 = at rest, 1 = fully rolled forward. */
|
|
307
|
-
let roll = 0;
|
|
308
|
-
let rollFrom = 0;
|
|
309
|
-
let rollTarget = 0;
|
|
310
|
-
let rollStart = 0;
|
|
311
|
-
const projectionCbs = new Set();
|
|
312
|
-
function aimRoll() {
|
|
313
|
-
const want = litTriggers.size > 0 ? 1 : 0;
|
|
314
|
-
if (want === rollTarget)
|
|
315
|
-
return;
|
|
316
|
-
rollFrom = roll;
|
|
317
|
-
rollTarget = want;
|
|
318
|
-
rollStart = performance.now();
|
|
319
|
-
start();
|
|
320
|
-
}
|
|
321
|
-
/** Advance the roll. Returns true while it is still moving. */
|
|
322
|
-
function stepRoll(now) {
|
|
323
|
-
if (roll === rollTarget)
|
|
324
|
-
return false;
|
|
325
|
-
const t = Math.min(1, (now - rollStart) / rollMs);
|
|
326
|
-
// Ease in-out: the pad should settle rather than snap, or the labels riding on it jitter.
|
|
327
|
-
const e = t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
|
328
|
-
roll = rollFrom + (rollTarget - rollFrom) * e;
|
|
329
|
-
if (t >= 1)
|
|
330
|
-
roll = rollTarget;
|
|
331
|
-
pivot.rotation.x = restTilt + extraTilt * roll;
|
|
332
|
-
dirty = true;
|
|
333
|
-
// Anything positioned from partRect has to follow, so tell it every frame of the roll.
|
|
334
|
-
for (const cb of projectionCbs)
|
|
335
|
-
cb();
|
|
336
|
-
return roll !== rollTarget;
|
|
337
|
-
}
|
|
338
126
|
// ── the loop ────────────────────────────────────────────────────────────────────────────────────
|
|
339
127
|
// Renders only on a change. An untouched pad therefore costs one `requestAnimationFrame` callback and
|
|
340
128
|
// no GPU work at all — the 3D equivalent of the flat driver's dirty-guard.
|
|
341
129
|
let raf = 0;
|
|
342
130
|
function frame() {
|
|
343
131
|
raf = requestAnimationFrame(frame);
|
|
344
|
-
|
|
132
|
+
if (pad.step(performance.now()))
|
|
133
|
+
dirty = true;
|
|
345
134
|
if (!dirty)
|
|
346
135
|
return;
|
|
347
136
|
dirty = false;
|
|
@@ -369,13 +158,13 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
369
158
|
// ── projection ──────────────────────────────────────────────────────────────────────────────────
|
|
370
159
|
return {
|
|
371
160
|
node: canvas,
|
|
372
|
-
driver,
|
|
161
|
+
driver: pad.driver,
|
|
373
162
|
layout,
|
|
374
163
|
// A shaded object, not a flat diagram — so a caption sitting ON the pad drops its opaque chip.
|
|
375
164
|
perspective: true,
|
|
376
165
|
partRect(part) {
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
166
|
+
const node = pad.nodeOf(part);
|
|
167
|
+
if (!node)
|
|
379
168
|
return null;
|
|
380
169
|
const box = canvas.getBoundingClientRect();
|
|
381
170
|
if (box.width < 1 || box.height < 1)
|
|
@@ -383,11 +172,11 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
383
172
|
// Corners come from the part's own bounding box, in WORLD space.
|
|
384
173
|
//
|
|
385
174
|
// `setFromObject` already walks the object's `matrixWorld`, so the box it returns is world-space
|
|
386
|
-
// and includes the pad's tilt. Running the corners through
|
|
387
|
-
// this did — applied that rotation a SECOND time, which is why leader lines and captions
|
|
388
|
-
// beside their control instead of on it.
|
|
389
|
-
|
|
390
|
-
const world = new THREE.Box3().setFromObject(
|
|
175
|
+
// and includes the pad's tilt. Running the corners through a local-to-world transform afterwards
|
|
176
|
+
// — as this did — applied that rotation a SECOND time, which is why leader lines and captions
|
|
177
|
+
// landed beside their control instead of on it.
|
|
178
|
+
pad.group.updateMatrixWorld(true);
|
|
179
|
+
const world = new THREE.Box3().setFromObject(node);
|
|
391
180
|
const p3 = new THREE.Vector3();
|
|
392
181
|
let minX = Infinity;
|
|
393
182
|
let minY = Infinity;
|
|
@@ -406,10 +195,7 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
406
195
|
return partRectOf(minX, minY, maxX - minX, maxY - minY);
|
|
407
196
|
},
|
|
408
197
|
setReferenced(parts) {
|
|
409
|
-
|
|
410
|
-
for (const part of ALL_PARTS)
|
|
411
|
-
applyOpacity(part);
|
|
412
|
-
dirty = true;
|
|
198
|
+
pad.setReferenced(parts);
|
|
413
199
|
},
|
|
414
200
|
resize,
|
|
415
201
|
onProjectionChange(cb) {
|
|
@@ -420,8 +206,8 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
420
206
|
stop();
|
|
421
207
|
document.removeEventListener("visibilitychange", onVisibility);
|
|
422
208
|
ro.disconnect();
|
|
423
|
-
|
|
424
|
-
|
|
209
|
+
projectionCbs.clear();
|
|
210
|
+
pad.dispose();
|
|
425
211
|
renderer.dispose();
|
|
426
212
|
// Hand the context back rather than waiting for GC: browsers cap live WebGL contexts, and a page
|
|
427
213
|
// that mounts and unmounts several 3D pads would otherwise run out and start killing old ones.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"three-pad-renderer.js","sourceRoot":"","sources":["../../../src/three/controller/three-pad-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,EACL,UAAU,GAIX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAyC,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,oGAAoG;AACpG,MAAM,WAAW,GAA2C;IAC1D,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,QAAQ;IACd,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;CACf,CAAC;AACF,sGAAsG;AACtG,MAAM,cAAc,GAA2C,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,E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AI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5B,CAAC;YACD,OAAO,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;QAC1D,CAAC;QACD,aAAa,CAAC,KAAK;YACjB,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM;QACN,kBAAkB,CAAC,EAAE;YACnB,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACtB,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,OAAO;YACL,IAAI,EAAE,CAAC;YACP,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;YAC/D,EAAE,CAAC,UAAU,EAAE,CAAC;YAChB,aAAa,CAAC,KAAK,EAAE,CAAC;YACtB,GAAG,CAAC,OAAO,EAAE,CAAC;YACd,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,iGAAiG;YACjG,+FAA+F;YAC/F,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -66,6 +66,18 @@ export interface ThreeRiderRigOptions {
|
|
|
66
66
|
* Any id from `CHARACTERS` — `clay` and `knight` are there too and nothing stops a game using them.
|
|
67
67
|
*/
|
|
68
68
|
character?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Draw the ground the trainer stands on. Default `true`.
|
|
71
|
+
*
|
|
72
|
+
* The floor is painted in the design's own background colour, so on a page that uses that colour it
|
|
73
|
+
* is invisible and all it does is give the machine something to stand on. **Over a game it is a dark
|
|
74
|
+
* rectangle** — the canvas is transparent, the floor is not, so a HUD rig drags a slab of the
|
|
75
|
+
* palette across whatever it is pinned over.
|
|
76
|
+
*
|
|
77
|
+
* So: leave it on for a panel on a page, turn it off for a HUD piece. The rest of the rig is
|
|
78
|
+
* unchanged either way — nothing else in the scene is opaque.
|
|
79
|
+
*/
|
|
80
|
+
floor?: boolean;
|
|
69
81
|
}
|
|
70
82
|
/**
|
|
71
83
|
* Build a renderer factory with options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"three-rider-rig.d.ts","sourceRoot":"","sources":["../../../src/three/rider/three-rider-rig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,KAAK,EAIV,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"three-rider-rig.d.ts","sourceRoot":"","sources":["../../../src/three/rider/three-rider-rig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,KAAK,EAIV,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;AAkM/B;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,eAAe,CAAC;AAQvD,MAAM,WAAW,oBAAoB;IACnC,2FAA2F;IAC3F,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE,oBAAyB,GAAG,kBAAkB,CAEjF;AAED,mGAAmG;AACnG,eAAO,MAAM,mBAAmB,EAAE,kBAA8D,CAAC"}
|
|
@@ -56,10 +56,8 @@ import { cyclistOverrides, mountCyclist, poseCyclist, tickPose } from "./cyclist
|
|
|
56
56
|
* proportioned off that wheel, so this one number makes the whole rig life-sized.
|
|
57
57
|
*/
|
|
58
58
|
const S = 0.68 / (G.WHEEL_R * 2);
|
|
59
|
-
/** Where the
|
|
60
|
-
const Z_NEAR = 0.1;
|
|
59
|
+
/** Where the frame sits across the bike's centre line. */
|
|
61
60
|
const Z_FRAME = 0;
|
|
62
|
-
const Z_FAR = -0.1;
|
|
63
61
|
const UP = new THREE.Vector3(0, 1, 0);
|
|
64
62
|
/** Vertical field of view. Narrow enough that the perspective reads as a lens, not a fisheye. */
|
|
65
63
|
const FOV = 32;
|
|
@@ -81,7 +79,9 @@ const PALETTES = {
|
|
|
81
79
|
metal: 0xb9c7de,
|
|
82
80
|
tyre: 0x2b3346,
|
|
83
81
|
housing: 0x44536f,
|
|
84
|
-
|
|
82
|
+
// White, and lit from within per frame — see WHEEL_GLOW_DESIGNS. On `solid` the flywheel is the
|
|
83
|
+
// effort reading: it is the disc the rider's legs actually drive.
|
|
84
|
+
fly: 0xffffff,
|
|
85
85
|
jersey: 0xff7a45,
|
|
86
86
|
legs: 0xf0b429,
|
|
87
87
|
legsFar: 0xa8791b,
|
|
@@ -139,6 +139,50 @@ const VARIANT = {
|
|
|
139
139
|
blueprint: "cel",
|
|
140
140
|
neon: "cel",
|
|
141
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* Which designs light their FLYWHEEL from the watts.
|
|
144
|
+
*
|
|
145
|
+
* The flywheel and not the front wheel, because it is the part the legs actually drive — the machine's
|
|
146
|
+
* resistance, made visible, already spinning with the cadence. The front wheel is parked on the floor
|
|
147
|
+
* driven by nothing, so lighting it would say the opposite of the truth.
|
|
148
|
+
*
|
|
149
|
+
* `solid` only, and that is a decision: the other two already spend their flywheel on their art
|
|
150
|
+
* direction — `neon`'s is magenta and glows on its own, `blueprint`'s is a thin technical line — so
|
|
151
|
+
* lighting them would be a second glow fighting the first rather than a reading.
|
|
152
|
+
*/
|
|
153
|
+
const WHEEL_GLOW_DESIGNS = new Set(["solid"]);
|
|
154
|
+
/** Emissive strength at rest, and how much of it the effort adds on top. */
|
|
155
|
+
const WHEEL_GLOW_REST = 0.12;
|
|
156
|
+
const WHEEL_GLOW_GAIN = 0.95;
|
|
157
|
+
/** The bloom card's opacity, same shape: never fully off, never fully opaque. */
|
|
158
|
+
const BLOOM_REST = 0.1;
|
|
159
|
+
const BLOOM_GAIN = 0.5;
|
|
160
|
+
/**
|
|
161
|
+
* The neon bloom's texture: a radial fade painted into a canvas, white so a material colour can tint
|
|
162
|
+
* it to whatever the zone is.
|
|
163
|
+
*
|
|
164
|
+
* A canvas rather than a PNG because the SDK ships no binary assets, and a gradient rather than a
|
|
165
|
+
* point light because a light would spill onto the rider, the frame and the housing — this has to look
|
|
166
|
+
* like the disc glowing, not like a lamp inside the machine.
|
|
167
|
+
*/
|
|
168
|
+
function bloomTexture() {
|
|
169
|
+
const size = 128;
|
|
170
|
+
const c = document.createElement("canvas");
|
|
171
|
+
c.width = c.height = size;
|
|
172
|
+
const g = c.getContext("2d");
|
|
173
|
+
// Peaks at the disc's own edge (0.38 of the card's half-width) and falls away outward — see the note
|
|
174
|
+
// on the flat renderer's gradient for why the peak is not at the centre.
|
|
175
|
+
const grad = g.createRadialGradient(size / 2, size / 2, 0, size / 2, size / 2, size / 2);
|
|
176
|
+
grad.addColorStop(0, "rgba(255,255,255,0.45)");
|
|
177
|
+
grad.addColorStop(0.38, "rgba(255,255,255,0.95)");
|
|
178
|
+
grad.addColorStop(0.62, "rgba(255,255,255,0.4)");
|
|
179
|
+
grad.addColorStop(1, "rgba(255,255,255,0)");
|
|
180
|
+
g.fillStyle = grad;
|
|
181
|
+
g.fillRect(0, 0, size, size);
|
|
182
|
+
const tex = new THREE.CanvasTexture(c);
|
|
183
|
+
tex.colorSpace = THREE.SRGBColorSpace;
|
|
184
|
+
return tex;
|
|
185
|
+
}
|
|
142
186
|
/** A unit-height cylinder, so a segment is placed by scaling Y and pointing it. */
|
|
143
187
|
const SEG_GEOM = new THREE.CylinderGeometry(1, 1, 1, 12);
|
|
144
188
|
/**
|
|
@@ -259,10 +303,33 @@ function buildRenderer(design, opts) {
|
|
|
259
303
|
housing.position.z = -0.15;
|
|
260
304
|
rig.add(housing);
|
|
261
305
|
const discGeom = geom(new THREE.CylinderGeometry(G.FLY.r * S, G.FLY.r * S, 0.085, 28));
|
|
262
|
-
const
|
|
306
|
+
const flyMat = mat(p.fly, { rough: 0.35, metal: 0.6 });
|
|
307
|
+
const flywheel = new THREE.Mesh(discGeom, flyMat);
|
|
308
|
+
/**
|
|
309
|
+
* The bloom, as a camera-facing card sitting just outside the disc.
|
|
310
|
+
*
|
|
311
|
+
* Additive and depth-write-free so it reads as light rather than as a painted disc, and placed
|
|
312
|
+
* slightly toward the viewer so the housing behind never occludes it. Its colour and opacity are
|
|
313
|
+
* driven per frame from the pose's zone, exactly as the flat renderer's gradient is.
|
|
314
|
+
*/
|
|
315
|
+
const bloomMat = new THREE.MeshBasicMaterial({
|
|
316
|
+
map: bloomTexture(),
|
|
317
|
+
transparent: true,
|
|
318
|
+
blending: THREE.AdditiveBlending,
|
|
319
|
+
depthWrite: false,
|
|
320
|
+
opacity: 0,
|
|
321
|
+
});
|
|
322
|
+
const bloomGeom = geom(new THREE.PlaneGeometry(G.FLY.r * S * 5.2, G.FLY.r * S * 5.2));
|
|
323
|
+
const bloom = new THREE.Mesh(bloomGeom, bloomMat);
|
|
324
|
+
materials.push(bloomMat);
|
|
263
325
|
flywheel.rotation.x = Math.PI / 2;
|
|
264
326
|
flywheel.position.copy(toWorld(G.FLY, 0.17));
|
|
265
327
|
rig.add(flywheel);
|
|
328
|
+
// Only the design that makes the disc a reading gets a bloom; the others keep their own look.
|
|
329
|
+
if (WHEEL_GLOW_DESIGNS.has(design)) {
|
|
330
|
+
bloom.position.copy(toWorld(G.FLY, 0.26));
|
|
331
|
+
rig.add(bloom);
|
|
332
|
+
}
|
|
266
333
|
// A pair of spokes so the spin is legible on a disc that would otherwise look static.
|
|
267
334
|
const flySpokes = new THREE.Group();
|
|
268
335
|
const vaneMat = mat(p.housing, { rough: 0.5, metal: 0.3 });
|
|
@@ -354,10 +421,13 @@ function buildRenderer(design, opts) {
|
|
|
354
421
|
const riderMount = mountCyclist(rider.object, S);
|
|
355
422
|
rig.add(riderMount);
|
|
356
423
|
/* ── the floor ────────────────────────────────────────────────────────── */
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
424
|
+
if (opts.floor !== false) {
|
|
425
|
+
const floor = new THREE.Mesh(geom(new THREE.PlaneGeometry(6, 6)), new THREE.MeshStandardMaterial({ color: p.bg, roughness: 1, metalness: 0 }));
|
|
426
|
+
floor.rotation.x = -Math.PI / 2;
|
|
427
|
+
scene.add(floor);
|
|
428
|
+
materials.push(floor.material);
|
|
429
|
+
}
|
|
430
|
+
const glowFly = WHEEL_GLOW_DESIGNS.has(design);
|
|
361
431
|
let w = 0;
|
|
362
432
|
let h = 0;
|
|
363
433
|
/** Seconds since mount — what a variant's own flourishes (a cape, a glow) advance against. */
|
|
@@ -392,6 +462,29 @@ function buildRenderer(design, opts) {
|
|
|
392
462
|
clock += 1 / 60;
|
|
393
463
|
if (!w)
|
|
394
464
|
return; // not laid out yet; the next tick will size and draw
|
|
465
|
+
// The wheel glows in the GAUGE's colour, at a strength the effort sets — the 3D half of the same
|
|
466
|
+
// reading the flat renderer draws with a CSS drop-shadow. The colour comes off the pose, so it
|
|
467
|
+
// cannot disagree with the bar; only the strength is computed here, because an emissive is a
|
|
468
|
+
// material property with no CSS to do it for us.
|
|
469
|
+
if (glowFly) {
|
|
470
|
+
// The SATURATED half of the zone pair, not the light one the CSS glow uses: an emissive is
|
|
471
|
+
// added to the surface, so a pale tint on an already-white tyre washes out to white exactly
|
|
472
|
+
// where the reading matters most — a sprint looked identical to a recovery spin. The deep
|
|
473
|
+
// colour survives being multiplied up and still reads as red at the top of the scale.
|
|
474
|
+
//
|
|
475
|
+
// Guarded, because this package and `@rydr/game-sdk/ui` are one npm package but not one file:
|
|
476
|
+
// a half-built `dist/` (or a hand-rolled RigRenderer driver) can hand over a pose from before
|
|
477
|
+
// `zone` existed. Reading it blind threw inside three's colour parser, and since this is the
|
|
478
|
+
// per-frame call, ONE throw stops the rig dead — the rider freezes mid-stroke and the gauge
|
|
479
|
+
// stops with him, which looks like the component broke rather than like a version skew.
|
|
480
|
+
const effort = Math.min(1.5, Math.max(0, pose.effort));
|
|
481
|
+
flyMat.emissive.set(pose.zone?.color ?? p.fly);
|
|
482
|
+
flyMat.emissiveIntensity = WHEEL_GLOW_REST + effort * WHEEL_GLOW_GAIN;
|
|
483
|
+
// The saturated colour, like the emissive: additive blending on a light tint washes to white,
|
|
484
|
+
// which is exactly what made a sprint look like a recovery spin.
|
|
485
|
+
bloomMat.color.set(pose.zone?.color ?? p.fly);
|
|
486
|
+
bloomMat.opacity = BLOOM_REST + effort * BLOOM_GAIN;
|
|
487
|
+
}
|
|
395
488
|
crank.rotation.z = -pose.crankAngle * (Math.PI / 180);
|
|
396
489
|
cassette.rotation.y = pose.cassetteAngle * (Math.PI / 180);
|
|
397
490
|
flySpokes.rotation.z = -pose.flyAngle * (Math.PI / 180);
|