@rydr/game-sdk 8.14.0 → 8.16.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/protocol/worlds.d.ts +19 -0
- package/dist/protocol/worlds.d.ts.map +1 -1
- package/dist/protocol/worlds.js.map +1 -1
- package/dist/three/README.md +132 -4
- 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 +301 -17
- 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 +49 -247
- 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 +101 -6
- package/dist/three/rider/three-rider-rig.js.map +1 -1
- package/dist/ui/README.md +133 -7
- 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/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/world-runtime.d.ts +11 -1
- package/dist/world-runtime.d.ts.map +1 -1
- package/dist/world-runtime.js +20 -3
- package/dist/world-runtime.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,25 +46,13 @@
|
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
on: 0x38bdf8,
|
|
49
|
-
done: 0x22c55e,
|
|
50
|
-
};
|
|
51
|
-
/** Emissive strength per state — what makes a lit button read as lit rather than merely repainted. */
|
|
52
|
-
const STATE_EMISSIVE = { off: 0, hint: 0.5, on: 0.85, done: 0.7 };
|
|
53
|
-
/** How far a pressed key sinks, world units. A press is real travel here, not a simulated shadow. */
|
|
54
|
-
const PRESS_TRAVEL = W * 0.06;
|
|
55
|
-
/** Cap tilt at full stick deflection, radians. A stick leans; it doesn't slide. */
|
|
56
|
-
const STICK_TILT = 0.42;
|
|
57
|
-
/** Opacity for a part the rider's device doesn't have. Matches `.unavailable` on the flat pad. */
|
|
58
|
-
const UNAVAILABLE_OPACITY = 0.22;
|
|
50
|
+
import { createJoyconObject } from "./joycon-object.js";
|
|
51
|
+
/**
|
|
52
|
+
* Frames the pad fills of the canvas height. Below 1 leaves the margin the tilt needs — a tilted pad is
|
|
53
|
+
* taller than its flat footprint, and a camera framed on the flat one clips the triggers off the top.
|
|
54
|
+
*/
|
|
55
|
+
const FRAME_FILL = 0.82;
|
|
59
56
|
/**
|
|
60
57
|
* Build a three.js pad renderer. Matches {@link PadRendererFactory}, so it can be handed straight to
|
|
61
58
|
* any controller view's `renderer` option.
|
|
@@ -78,182 +75,27 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
78
75
|
const scene = new THREE.Scene();
|
|
79
76
|
const camera = new THREE.PerspectiveCamera(30, 1, 0.1, 100);
|
|
80
77
|
camera.position.set(0, 0, 9);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
pivot.add(model.group);
|
|
90
|
-
const yawGroup = new THREE.Group();
|
|
91
|
-
yawGroup.rotation.y = opts.yaw ?? 0;
|
|
92
|
-
yawGroup.add(pivot);
|
|
93
|
-
scene.add(yawGroup);
|
|
94
|
-
// Accent is themable on the flat pad through a CSS variable; here it has to reach the materials.
|
|
95
|
-
const accent = opts.accent ? new THREE.Color(opts.accent).getHex() : STATE_COLOR.on;
|
|
96
|
-
/** Every part this model actually draws. */
|
|
97
|
-
const ALL_PARTS = [...model.controls.keys()];
|
|
98
|
-
/**
|
|
99
|
-
* The mesh and material behind a part.
|
|
100
|
-
*
|
|
101
|
-
* `JoyconBuild` keys its controls by name and hands back plain `Object3D`s, so this resolves one to
|
|
102
|
-
* something paintable. A stick's entry is its cap mesh, which is what should light and sink.
|
|
103
|
-
*/
|
|
104
|
-
function visualOf(part) {
|
|
105
|
-
const node = model.controls.get(part);
|
|
106
|
-
if (!node)
|
|
107
|
-
return undefined;
|
|
108
|
-
const mesh = node;
|
|
109
|
-
const mat = mesh.material;
|
|
110
|
-
if (!mat || !("color" in mat))
|
|
111
|
-
return undefined;
|
|
112
|
-
let rest = restZ.get(part);
|
|
113
|
-
if (rest === undefined) {
|
|
114
|
-
rest = node.position.z;
|
|
115
|
-
restZ.set(part, rest);
|
|
116
|
-
}
|
|
117
|
-
return { node, material: mat, restZ: rest };
|
|
118
|
-
}
|
|
119
|
-
/** Resting z per part, captured on first paint so a press is absolute, not cumulative. */
|
|
120
|
-
const restZ = new Map();
|
|
121
|
-
// ── state ───────────────────────────────────────────────────────────────────────────────────────
|
|
122
|
-
/** Dirty-guard, same intent as the flat driver's: an idle pad must do no work per frame. */
|
|
123
|
-
const lastVal = new Map();
|
|
124
|
-
const STATE_CODE = { off: 0, on: 1, hint: 2, done: 3 };
|
|
125
|
-
let unavailable = new Set();
|
|
126
|
-
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);
|
|
127
86
|
/** Set whenever something changed; the loop renders only then. */
|
|
128
87
|
let dirty = true;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return;
|
|
133
|
-
const dim = unavailable.has(part);
|
|
134
|
-
// `referenced` only ever RAISES a faint part back to full, exactly as the flat pad's rule does.
|
|
135
|
-
const faint = FAINT_PARTS.has(part) && !referenced.has(part);
|
|
136
|
-
const o = dim ? UNAVAILABLE_OPACITY : faint ? 0.4 : 1;
|
|
137
|
-
v.material.transparent = o < 1;
|
|
138
|
-
v.material.opacity = o;
|
|
139
|
-
}
|
|
140
|
-
function paint(part, state) {
|
|
141
|
-
const v = visualOf(part);
|
|
142
|
-
if (!v)
|
|
143
|
-
return;
|
|
144
|
-
const color = state === "on" ? accent : STATE_COLOR[state];
|
|
145
|
-
v.material.color.setHex(color);
|
|
146
|
-
v.material.emissive.setHex(state === "off" ? 0x000000 : color);
|
|
147
|
-
v.material.emissiveIntensity = STATE_EMISSIVE[state];
|
|
148
|
-
// A press is real travel here — the flat pad had to fake it with a drop shadow.
|
|
149
|
-
v.node.position.z = v.restZ - (state === "on" || state === "done" ? PRESS_TRAVEL : 0);
|
|
150
|
-
applyOpacity(part);
|
|
151
|
-
dirty = true;
|
|
152
|
-
}
|
|
153
|
-
/** What's printed on a part — read back off the built glyph so it can be re-inked per state. */
|
|
154
|
-
const glyphTexts = new Map();
|
|
155
|
-
for (const [name, spec] of [
|
|
156
|
-
["faceTop", layout.face.top],
|
|
157
|
-
["faceRight", layout.face.right],
|
|
158
|
-
["faceBottom", layout.face.bottom],
|
|
159
|
-
["faceLeft", layout.face.left],
|
|
160
|
-
["select", layout.system?.select],
|
|
161
|
-
["start", layout.system?.start],
|
|
162
|
-
["lb", layout.bumpers?.l],
|
|
163
|
-
["rb", layout.bumpers?.r],
|
|
164
|
-
["lt", layout.triggers?.l],
|
|
165
|
-
["rt", layout.triggers?.r],
|
|
166
|
-
]) {
|
|
167
|
-
if (spec?.glyph)
|
|
168
|
-
glyphTexts.set(name, spec.glyph);
|
|
169
|
-
}
|
|
170
|
-
// ── the driver ──────────────────────────────────────────────────────────────────────────────────
|
|
171
|
-
const setPartState = (part, state) => {
|
|
172
|
-
if (SHELL_OWNED_PARTS.has(part) && !opts.allowShellOwned)
|
|
173
|
-
return;
|
|
174
|
-
if (lastVal.get(part) === STATE_CODE[state])
|
|
175
|
-
return;
|
|
176
|
-
lastVal.set(part, STATE_CODE[state]);
|
|
177
|
-
paint(part, state);
|
|
178
|
-
// A lit trigger rolls the pad forward so it can actually be seen — see `triggerTilt`.
|
|
179
|
-
if (part === "lt" || part === "rt") {
|
|
180
|
-
if (state === "off")
|
|
181
|
-
litTriggers.delete(part);
|
|
182
|
-
else
|
|
183
|
-
litTriggers.add(part);
|
|
184
|
-
aimRoll();
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
const setStick = (side, x, y, lit = "auto") => {
|
|
188
|
-
const pivot = model.sticks[side];
|
|
189
|
-
if (!pivot)
|
|
190
|
-
return;
|
|
191
|
-
const litKey = `${side}lit`;
|
|
192
|
-
const resolved = lit === "auto" ? (Math.hypot(x, y) > STICK_LIT_DEADZONE ? "on" : "off") : lit;
|
|
193
|
-
const code = resolved === "on" ? 1 : resolved === "hint" ? 2 : resolved === "done" ? 3 : 0;
|
|
194
|
-
if (lastVal.get(litKey) !== code) {
|
|
195
|
-
lastVal.set(litKey, code);
|
|
196
|
-
// Colour lives on the CAP, which is registered as the stick-click part.
|
|
197
|
-
const cap = visualOf(side === "l" ? "lstickPress" : "rstickPress");
|
|
198
|
-
if (cap) {
|
|
199
|
-
const state = resolved;
|
|
200
|
-
const color = state === "on" ? accent : STATE_COLOR[state];
|
|
201
|
-
cap.material.color.setHex(color);
|
|
202
|
-
cap.material.emissive.setHex(state === "off" ? 0x000000 : color);
|
|
203
|
-
cap.material.emissiveIntensity = STATE_EMISSIVE[state];
|
|
204
|
-
}
|
|
205
|
-
dirty = true;
|
|
206
|
-
}
|
|
207
|
-
// A real stick LEANS. `y` is up-positive in the SDK's convention, and a push "up" tips the cap away
|
|
208
|
-
// from the viewer — a negative rotation about x — so the sign works out without the flat
|
|
209
|
-
// renderer's y-negation.
|
|
210
|
-
const rx = -y * STICK_TILT;
|
|
211
|
-
const ry = x * STICK_TILT;
|
|
212
|
-
if (Math.abs(rx - (lastVal.get(`${side}rx`) ?? 0)) < 0.002 &&
|
|
213
|
-
Math.abs(ry - (lastVal.get(`${side}ry`) ?? 0)) < 0.002) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
lastVal.set(`${side}rx`, rx);
|
|
217
|
-
lastVal.set(`${side}ry`, ry);
|
|
218
|
-
pivot.rotation.x = rx;
|
|
219
|
-
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(() => {
|
|
220
91
|
dirty = true;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// `protocol/buttons.ts`), so the trigger simply lights, which `setPart` already does.
|
|
229
|
-
void side;
|
|
230
|
-
void v01;
|
|
231
|
-
},
|
|
232
|
-
setAvailable(available) {
|
|
233
|
-
unavailable = available == null
|
|
234
|
-
? new Set()
|
|
235
|
-
: new Set(ALL_PARTS.filter((p) => !available.includes(p) && !SHELL_OWNED_PARTS.has(p)));
|
|
236
|
-
for (const part of ALL_PARTS)
|
|
237
|
-
applyOpacity(part);
|
|
238
|
-
dirty = true;
|
|
239
|
-
},
|
|
240
|
-
clearAll() {
|
|
241
|
-
for (const part of ALL_PARTS) {
|
|
242
|
-
lastVal.set(part, 0);
|
|
243
|
-
paint(part, "off");
|
|
244
|
-
}
|
|
245
|
-
litTriggers.clear();
|
|
246
|
-
aimRoll();
|
|
247
|
-
for (const side of ["l", "r"]) {
|
|
248
|
-
lastVal.delete(`${side}lit`);
|
|
249
|
-
setStick(side, 0, 0, "off");
|
|
250
|
-
this.setMeter(side, 0);
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
// Paint every part once so a part's material starts in a known state rather than its build colour.
|
|
255
|
-
for (const part of ALL_PARTS)
|
|
256
|
-
paint(part, "off");
|
|
92
|
+
start();
|
|
93
|
+
});
|
|
94
|
+
const projectionCbs = new Set();
|
|
95
|
+
pad.onPoseChange(() => {
|
|
96
|
+
for (const cb of projectionCbs)
|
|
97
|
+
cb();
|
|
98
|
+
});
|
|
257
99
|
// ── sizing ──────────────────────────────────────────────────────────────────────────────────────
|
|
258
100
|
function resize() {
|
|
259
101
|
const w = canvas.clientWidth || 1;
|
|
@@ -263,12 +105,12 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
263
105
|
camera.aspect = w / h;
|
|
264
106
|
// Frame from the model's bounding SPHERE, which is invariant under rotation: one number frames
|
|
265
107
|
// every tilt and yaw without the framing pumping as the pad turns.
|
|
266
|
-
|
|
267
|
-
const box = new THREE.Box3().setFromObject(
|
|
108
|
+
pad.group.updateMatrixWorld(true);
|
|
109
|
+
const box = new THREE.Box3().setFromObject(pad.group);
|
|
268
110
|
const sphere = box.getBoundingSphere(new THREE.Sphere());
|
|
269
111
|
const fovV = (camera.fov * Math.PI) / 180;
|
|
270
112
|
const fovH = 2 * Math.atan(Math.tan(fovV / 2) * camera.aspect);
|
|
271
|
-
const fill = opts.fill ??
|
|
113
|
+
const fill = opts.fill ?? FRAME_FILL;
|
|
272
114
|
const dist = Math.max(sphere.radius / Math.sin(fovV / 2), sphere.radius / Math.sin(fovH / 2)) / fill;
|
|
273
115
|
// Offsets are expressed as fractions of the visible frame at the pad's distance, so they mean the
|
|
274
116
|
// same thing whatever the fill or the aspect.
|
|
@@ -281,51 +123,14 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
281
123
|
}
|
|
282
124
|
const ro = new ResizeObserver(() => resize());
|
|
283
125
|
ro.observe(canvas);
|
|
284
|
-
// ── the trigger roll ────────────────────────────────────────────────────────────────────────────
|
|
285
|
-
/** Which triggers are currently lit. The pad rolls while this is non-empty. */
|
|
286
|
-
const litTriggers = new Set();
|
|
287
|
-
const restTilt = opts.tilt ?? VIEW.pitch;
|
|
288
|
-
const extraTilt = opts.triggerTilt ?? 0.38;
|
|
289
|
-
const rollMs = opts.triggerTiltMs ?? 420;
|
|
290
|
-
/** 0 = at rest, 1 = fully rolled forward. */
|
|
291
|
-
let roll = 0;
|
|
292
|
-
let rollFrom = 0;
|
|
293
|
-
let rollTarget = 0;
|
|
294
|
-
let rollStart = 0;
|
|
295
|
-
const projectionCbs = new Set();
|
|
296
|
-
function aimRoll() {
|
|
297
|
-
const want = litTriggers.size > 0 ? 1 : 0;
|
|
298
|
-
if (want === rollTarget)
|
|
299
|
-
return;
|
|
300
|
-
rollFrom = roll;
|
|
301
|
-
rollTarget = want;
|
|
302
|
-
rollStart = performance.now();
|
|
303
|
-
start();
|
|
304
|
-
}
|
|
305
|
-
/** Advance the roll. Returns true while it is still moving. */
|
|
306
|
-
function stepRoll(now) {
|
|
307
|
-
if (roll === rollTarget)
|
|
308
|
-
return false;
|
|
309
|
-
const t = Math.min(1, (now - rollStart) / rollMs);
|
|
310
|
-
// Ease in-out: the pad should settle rather than snap, or the labels riding on it jitter.
|
|
311
|
-
const e = t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
|
312
|
-
roll = rollFrom + (rollTarget - rollFrom) * e;
|
|
313
|
-
if (t >= 1)
|
|
314
|
-
roll = rollTarget;
|
|
315
|
-
pivot.rotation.x = restTilt + extraTilt * roll;
|
|
316
|
-
dirty = true;
|
|
317
|
-
// Anything positioned from partRect has to follow, so tell it every frame of the roll.
|
|
318
|
-
for (const cb of projectionCbs)
|
|
319
|
-
cb();
|
|
320
|
-
return roll !== rollTarget;
|
|
321
|
-
}
|
|
322
126
|
// ── the loop ────────────────────────────────────────────────────────────────────────────────────
|
|
323
127
|
// Renders only on a change. An untouched pad therefore costs one `requestAnimationFrame` callback and
|
|
324
128
|
// no GPU work at all — the 3D equivalent of the flat driver's dirty-guard.
|
|
325
129
|
let raf = 0;
|
|
326
130
|
function frame() {
|
|
327
131
|
raf = requestAnimationFrame(frame);
|
|
328
|
-
|
|
132
|
+
if (pad.step(performance.now()))
|
|
133
|
+
dirty = true;
|
|
329
134
|
if (!dirty)
|
|
330
135
|
return;
|
|
331
136
|
dirty = false;
|
|
@@ -353,13 +158,13 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
353
158
|
// ── projection ──────────────────────────────────────────────────────────────────────────────────
|
|
354
159
|
return {
|
|
355
160
|
node: canvas,
|
|
356
|
-
driver,
|
|
161
|
+
driver: pad.driver,
|
|
357
162
|
layout,
|
|
358
163
|
// A shaded object, not a flat diagram — so a caption sitting ON the pad drops its opaque chip.
|
|
359
164
|
perspective: true,
|
|
360
165
|
partRect(part) {
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
166
|
+
const node = pad.nodeOf(part);
|
|
167
|
+
if (!node)
|
|
363
168
|
return null;
|
|
364
169
|
const box = canvas.getBoundingClientRect();
|
|
365
170
|
if (box.width < 1 || box.height < 1)
|
|
@@ -367,11 +172,11 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
367
172
|
// Corners come from the part's own bounding box, in WORLD space.
|
|
368
173
|
//
|
|
369
174
|
// `setFromObject` already walks the object's `matrixWorld`, so the box it returns is world-space
|
|
370
|
-
// and includes the pad's tilt. Running the corners through
|
|
371
|
-
// this did — applied that rotation a SECOND time, which is why leader lines and captions
|
|
372
|
-
// beside their control instead of on it.
|
|
373
|
-
|
|
374
|
-
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);
|
|
375
180
|
const p3 = new THREE.Vector3();
|
|
376
181
|
let minX = Infinity;
|
|
377
182
|
let minY = Infinity;
|
|
@@ -390,10 +195,7 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
390
195
|
return partRectOf(minX, minY, maxX - minX, maxY - minY);
|
|
391
196
|
},
|
|
392
197
|
setReferenced(parts) {
|
|
393
|
-
|
|
394
|
-
for (const part of ALL_PARTS)
|
|
395
|
-
applyOpacity(part);
|
|
396
|
-
dirty = true;
|
|
198
|
+
pad.setReferenced(parts);
|
|
397
199
|
},
|
|
398
200
|
resize,
|
|
399
201
|
onProjectionChange(cb) {
|
|
@@ -404,8 +206,8 @@ export function createThreePadRenderer(layout, opts = {}) {
|
|
|
404
206
|
stop();
|
|
405
207
|
document.removeEventListener("visibilitychange", onVisibility);
|
|
406
208
|
ro.disconnect();
|
|
407
|
-
|
|
408
|
-
|
|
209
|
+
projectionCbs.clear();
|
|
210
|
+
pad.dispose();
|
|
409
211
|
renderer.dispose();
|
|
410
212
|
// Hand the context back rather than waiting for GC: browsers cap live WebGL contexts, and a page
|
|
411
213
|
// that mounts and unmounts several 3D pads would otherwise run out and start killing old ones.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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IAAI,GAAG,IAAI,CAAC,CAAC;QAC1D,CAAC;QACD,aAAa,CAAC,KAAK;YACjB,UAAU,GAAG,KAAK,CAAC;YACnB,KAAK,MAAM,IAAI,IAAI,SAAS;gBAAE,YAAY,CAAC,IAAI,CAAC,CAAC;YACjD,KAAK,GAAG,IAAI,CAAC;QACf,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,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,WAAW;gBAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YAC/C,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"}
|
|
1
|
+
{"version":3,"file":"three-pad-renderer.js","sourceRoot":"","sources":["../../../src/three/controller/three-pad-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,UAAU,GAIX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAA4B,MAAM,oBAAoB,CAAC;AAElF;;;GAGG;AACH,MAAM,UAAU,GAAG,IAAI,CAAC;AAiBxB;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAiB,EACjB,OAAgC,EAAE;IAElC,IAAI,MAA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|
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"}
|
|
@@ -79,7 +79,9 @@ const PALETTES = {
|
|
|
79
79
|
metal: 0xb9c7de,
|
|
80
80
|
tyre: 0x2b3346,
|
|
81
81
|
housing: 0x44536f,
|
|
82
|
-
|
|
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,
|
|
83
85
|
jersey: 0xff7a45,
|
|
84
86
|
legs: 0xf0b429,
|
|
85
87
|
legsFar: 0xa8791b,
|
|
@@ -137,6 +139,50 @@ const VARIANT = {
|
|
|
137
139
|
blueprint: "cel",
|
|
138
140
|
neon: "cel",
|
|
139
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
|
+
}
|
|
140
186
|
/** A unit-height cylinder, so a segment is placed by scaling Y and pointing it. */
|
|
141
187
|
const SEG_GEOM = new THREE.CylinderGeometry(1, 1, 1, 12);
|
|
142
188
|
/**
|
|
@@ -257,10 +303,33 @@ function buildRenderer(design, opts) {
|
|
|
257
303
|
housing.position.z = -0.15;
|
|
258
304
|
rig.add(housing);
|
|
259
305
|
const discGeom = geom(new THREE.CylinderGeometry(G.FLY.r * S, G.FLY.r * S, 0.085, 28));
|
|
260
|
-
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);
|
|
261
325
|
flywheel.rotation.x = Math.PI / 2;
|
|
262
326
|
flywheel.position.copy(toWorld(G.FLY, 0.17));
|
|
263
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
|
+
}
|
|
264
333
|
// A pair of spokes so the spin is legible on a disc that would otherwise look static.
|
|
265
334
|
const flySpokes = new THREE.Group();
|
|
266
335
|
const vaneMat = mat(p.housing, { rough: 0.5, metal: 0.3 });
|
|
@@ -352,10 +421,13 @@ function buildRenderer(design, opts) {
|
|
|
352
421
|
const riderMount = mountCyclist(rider.object, S);
|
|
353
422
|
rig.add(riderMount);
|
|
354
423
|
/* ── the floor ────────────────────────────────────────────────────────── */
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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);
|
|
359
431
|
let w = 0;
|
|
360
432
|
let h = 0;
|
|
361
433
|
/** Seconds since mount — what a variant's own flourishes (a cape, a glow) advance against. */
|
|
@@ -390,6 +462,29 @@ function buildRenderer(design, opts) {
|
|
|
390
462
|
clock += 1 / 60;
|
|
391
463
|
if (!w)
|
|
392
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
|
+
}
|
|
393
488
|
crank.rotation.z = -pose.crankAngle * (Math.PI / 180);
|
|
394
489
|
cassette.rotation.y = pose.cassetteAngle * (Math.PI / 180);
|
|
395
490
|
flySpokes.rotation.z = -pose.flyAngle * (Math.PI / 180);
|