@edv4h/usketch-css3d-renderer 0.0.0-stage → 0.1.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.
@@ -0,0 +1,461 @@
1
+ // The CSS 3D renderer: draws the board's 3D view (the core `View3dState`) by tilting the
2
+ // canvas's own layer wrappers with CSS 3D transforms. It pairs with the DOM renderer: the
3
+ // shapes stay the 2D DOM, only their layers are turned into a receding ground plane, and
4
+ // shapes with a 3D look stand out of it in a layer of its own (see css3d-shapes).
5
+ //
6
+ // One injected <style> sheet (`!important` rules, scoped to the main canvas container
7
+ // marked with a stage attribute) tilts each layer that shows in 3D:
8
+ // - `tilt` layers get `perspective() rotateX()` about the horizon and the draw-distance
9
+ // `clip-path`;
10
+ // - `depth` layers get the same tilt without the clip (a clip flattens 3D), and keep the
11
+ // 3D context through the canvas's inner wrappers, so what they draw can rise
12
+ // out of the ground;
13
+ // - `hidden` layers aren't shown.
14
+ // A stylesheet (rather than inline styles) survives React re-renders and applies to layers
15
+ // that mount later. The camera height lowers every tilted layer through one CSS variable,
16
+ // so a follower can move it every frame without rewriting the sheet.
17
+ import { boardHeight, defineService, isOccluded, tiltCss, view3dCellOf, view3dOcclusionService, view3dRendererService, } from "@edv4h/usketch-shared";
18
+ import { depthStageRules, drawDistanceClip, drawDistanceOverscanPx, tiltLayerRules, } from "./css3d-css.js";
19
+ import { setupCss3dShapes } from "./css3d-shapes.js";
20
+ /** Attribute the renderer puts on the main canvas container while drawing in 3D. */
21
+ export const STAGE_ATTR = "data-view3d-stage";
22
+ /** The attribute Mode 7 used to set; still set (some plugins look for it) until the next major. */
23
+ export const LEGACY_STAGE_ATTR = "data-mode7-stage";
24
+ /** CSS variable on the stage holding the camera height (px); the tilt lowers every layer by it. */
25
+ export const CAMERA_HEIGHT_VAR = "--usketch-mode7-camera-height";
26
+ /** Extra px added to the grid overscan event so it comfortably covers the clip line. */
27
+ const OVERSCAN_BUFFER = 16;
28
+ const OCCLUSION_MODES = ["fade", "hide", "none"];
29
+ /** The renderer on `ctx.services` (one per board). */
30
+ export const css3dRendererService = defineService("usketch-css3d-renderer");
31
+ /** The camera a tilted layer is drawn with, as the projection functions take it. Pure. */
32
+ export function projectionCamera(state, zoom) {
33
+ const a = Math.min(1, Math.max(0, state.amount));
34
+ const { pitch, fov, horizon } = state.camera;
35
+ return { pitch: pitch * a, yaw: 0, fov, horizon, heightPx: cameraHeightPx(state, zoom) };
36
+ }
37
+ /** The layer ids that declare one of `kinds`, in drawing order. */
38
+ function declared(ctx, kinds) {
39
+ return ctx.layers
40
+ .getLayers()
41
+ .filter((l) => l.view3d !== undefined && kinds.includes(l.view3d))
42
+ .map((l) => l.id);
43
+ }
44
+ /** The camera height in screen px as drawn: height × zoom, faded with the amount. */
45
+ export function cameraHeightPx(state, zoom) {
46
+ const a = Math.min(1, Math.max(0, state.amount));
47
+ const z = Number.isFinite(zoom) && zoom > 0 ? zoom : 1;
48
+ return Math.round(state.camera.height * z * a * 100) / 100;
49
+ }
50
+ /** The transform of a tilted layer: the camera's tilt, lowered by the camera height. */
51
+ export function layerTransform(state) {
52
+ const a = Math.min(1, Math.max(0, state.amount));
53
+ const { pitch, fov, horizon } = state.camera;
54
+ const tilt = tiltCss({ pitch: pitch * a, yaw: 0, fov, horizon });
55
+ return {
56
+ transform: `${tilt.transform} translateZ(calc(var(${CAMERA_HEIGHT_VAR}, 0px) * -1))`,
57
+ transformOrigin: tilt.transformOrigin,
58
+ };
59
+ }
60
+ /**
61
+ * The main canvas container: the element that directly wraps the board's layer divs
62
+ * (found through `[data-layer-id]`, since `data-testid` is stripped from app builds). If
63
+ * several exist (e.g. a minimap that also renders layers), the largest wins.
64
+ */
65
+ function mainContainer() {
66
+ if (typeof document === "undefined")
67
+ return null;
68
+ let best = null;
69
+ let bestArea = 0;
70
+ const seen = new Set();
71
+ for (const el of document.querySelectorAll("[data-layer-id]")) {
72
+ const parent = el.parentElement;
73
+ if (!parent || seen.has(parent))
74
+ continue;
75
+ seen.add(parent);
76
+ const r = parent.getBoundingClientRect();
77
+ const area = r.width * r.height;
78
+ if (area > bestArea) {
79
+ bestArea = area;
80
+ best = parent;
81
+ }
82
+ }
83
+ return best;
84
+ }
85
+ /**
86
+ * Set up the renderer on `ctx`: draws whenever the 3D view's amount is above 0. Returns
87
+ * its API and a teardown that clears every injected rule.
88
+ */
89
+ export function setupCss3dRenderer(ctx, options = {}) {
90
+ const cell = options.view3d ?? view3dCellOf(ctx.store);
91
+ if (!cell)
92
+ return null;
93
+ let tiltOverride = options.tiltLayerIds ?? null;
94
+ let depthStage = options.depthStage === true;
95
+ // Notified when a HUD setting changes.
96
+ const settingsListeners = new Set();
97
+ let occlusionMode = OCCLUSION_MODES.includes(options.occlusion)
98
+ ? options.occlusion
99
+ : "fade";
100
+ // The stage's size as last measured (by `draw`), for the occlusion's projection.
101
+ let stageSize = null;
102
+ // The stage's parent clips while the depth stage leaves the stage unclipped: its own
103
+ // inline `overflow`, to put back.
104
+ let clippedParent = null;
105
+ const clipParent = (container) => {
106
+ const parent = container?.parentElement ?? null;
107
+ if (clippedParent && clippedParent.el !== parent) {
108
+ clippedParent.el.style.overflow = clippedParent.overflow;
109
+ clippedParent = null;
110
+ }
111
+ if (!parent || clippedParent)
112
+ return;
113
+ clippedParent = { el: parent, overflow: parent.style.overflow };
114
+ parent.style.overflow = "clip";
115
+ };
116
+ const unclipParent = () => {
117
+ if (!clippedParent)
118
+ return;
119
+ clippedParent.el.style.overflow = clippedParent.overflow;
120
+ clippedParent = null;
121
+ };
122
+ let depthOverride = options.depthLayerIds ?? null;
123
+ const tiltLayers = () => tiltOverride ?? declared(ctx, ["tilt", "depth"]);
124
+ const depthLayers = () => depthOverride ?? declared(ctx, ["depth"]);
125
+ let styleEl = null;
126
+ // Rewriting a <style> with the same text still restyles the stage: skip identical text.
127
+ let lastCss = "";
128
+ let stage = null;
129
+ let lastLift = "";
130
+ let lastOverscan = -1;
131
+ // Older backgrounds extend under the far ground through this event (newer ones read
132
+ // `LayerRenderContext.view3dOverscan`). Removed at the next major.
133
+ const driveGridOverscan = (px) => {
134
+ if (px === lastOverscan)
135
+ return;
136
+ lastOverscan = px;
137
+ ctx.events.emit("bg-grid:set-overscan", { px });
138
+ };
139
+ const ensureStyleEl = () => {
140
+ if (styleEl || typeof document === "undefined")
141
+ return styleEl;
142
+ styleEl = document.createElement("style");
143
+ styleEl.setAttribute("data-css3d-renderer", "");
144
+ document.head.appendChild(styleEl);
145
+ return styleEl;
146
+ };
147
+ const applyLift = (container = stage) => {
148
+ if (!container)
149
+ return;
150
+ const value = `${cameraHeightPx(cell.get(), ctx.store.getViewport().zoom)}px`;
151
+ if (value === lastLift && container === stage)
152
+ return;
153
+ lastLift = value;
154
+ container.style.setProperty(CAMERA_HEIGHT_VAR, value);
155
+ };
156
+ // A ground layer only covers the layers under it while it draws something: watch what
157
+ // is inside its wrapper (the canvas wraps the layer's drawing in one more element, empty
158
+ // while the layer renders nothing) and redraw when that changes.
159
+ let groundWatch = null;
160
+ const watched = new Set();
161
+ const drawsGround = (container, id) => {
162
+ const el = [...container.children].find((c) => c.getAttribute("data-layer-id") === id);
163
+ if (!el)
164
+ return false;
165
+ if (!watched.has(el) && typeof MutationObserver !== "undefined") {
166
+ groundWatch ??= new MutationObserver(() => {
167
+ if (drawing())
168
+ draw();
169
+ });
170
+ groundWatch.observe(el, { childList: true, subtree: true });
171
+ watched.add(el);
172
+ }
173
+ return el.querySelector(":scope > * > *") !== null;
174
+ };
175
+ const unwatchGround = () => {
176
+ groundWatch?.disconnect();
177
+ groundWatch = null;
178
+ watched.clear();
179
+ };
180
+ const draw = () => {
181
+ const container = mainContainer();
182
+ if (!container)
183
+ return;
184
+ container.setAttribute(STAGE_ATTR, "on");
185
+ container.setAttribute(LEGACY_STAGE_ATTR, "on");
186
+ if (container !== stage) {
187
+ stage?.style.removeProperty(CAMERA_HEIGHT_VAR);
188
+ lastLift = "";
189
+ }
190
+ applyLift(container);
191
+ stage = container;
192
+ const sheet = ensureStyleEl();
193
+ if (!sheet)
194
+ return;
195
+ const state = cell.get();
196
+ const { transform, transformOrigin } = layerTransform(state);
197
+ // The clip is in world units → px through the zoom and the stage height.
198
+ const zoom = ctx.store.getViewport().zoom;
199
+ const rect = container.getBoundingClientRect();
200
+ const heightPx = rect.height;
201
+ stageSize = { width: rect.width, height: rect.height };
202
+ const clip = drawDistanceClip(state.drawDistance, zoom, heightPx, state.amount);
203
+ const overscan = drawDistanceOverscanPx(state.drawDistance, zoom, heightPx);
204
+ driveGridOverscan(overscan > 0 ? overscan + OVERSCAN_BUFFER : 0);
205
+ const rules = tiltLayerRules(tiltLayers(), {
206
+ stageAttr: STAGE_ATTR,
207
+ transform,
208
+ transformOrigin,
209
+ clip,
210
+ depthLayerIds: new Set(depthLayers()),
211
+ });
212
+ let stageRules = "";
213
+ if (depthStage) {
214
+ const tilted = new Set(tiltLayers());
215
+ stageRules = depthStageRules({
216
+ stageAttr: STAGE_ATTR,
217
+ layers: ctx.layers.getLayers().map((l) => ({
218
+ id: l.id,
219
+ tilted: tilted.has(l.id),
220
+ ground: l.view3d === "ground" && drawsGround(container, l.id),
221
+ })),
222
+ background: container.style.background || "transparent",
223
+ tiltTransform: transform,
224
+ });
225
+ clipParent(container);
226
+ }
227
+ else {
228
+ unclipParent();
229
+ unwatchGround();
230
+ }
231
+ const css = `${rules}${stageRules}[${STAGE_ATTR}="on"] [data-view3d="hidden"]{display:none !important;}`;
232
+ if (css === lastCss)
233
+ return;
234
+ lastCss = css;
235
+ sheet.textContent = css;
236
+ };
237
+ const clear = () => {
238
+ unclipParent();
239
+ unwatchGround();
240
+ if (styleEl)
241
+ styleEl.textContent = "";
242
+ lastCss = "";
243
+ stage?.style.removeProperty(CAMERA_HEIGHT_VAR);
244
+ stage = null;
245
+ lastLift = "";
246
+ if (typeof document !== "undefined") {
247
+ for (const el of document.querySelectorAll(`[${STAGE_ATTR}]`)) {
248
+ el.removeAttribute(STAGE_ATTR);
249
+ el.removeAttribute(LEGACY_STAGE_ATTR);
250
+ }
251
+ }
252
+ driveGridOverscan(0);
253
+ };
254
+ const drawing = () => cell.get().amount > 0;
255
+ const sync = () => {
256
+ if (drawing())
257
+ draw();
258
+ else
259
+ clear();
260
+ };
261
+ // A change of the camera height alone (every frame while a follower climbs) only
262
+ // moves the stage's height variable.
263
+ let prev = cell.get();
264
+ const offCell = cell.subscribe(() => {
265
+ const next = cell.get();
266
+ const c = prev.camera;
267
+ const d = next.camera;
268
+ const liftOnly = next.amount === prev.amount &&
269
+ next.drawDistance === prev.drawDistance &&
270
+ c.pitch === d.pitch &&
271
+ c.fov === d.fov &&
272
+ c.horizon === d.horizon;
273
+ prev = next;
274
+ if (liftOnly && drawing() && stage?.isConnected)
275
+ applyLift();
276
+ else
277
+ sync();
278
+ });
279
+ // The clip depends on the zoom and the stage height; a pan changes neither (and
280
+ // re-drawing on it would restyle the stage every frame a camera follows something).
281
+ let lastZoom = ctx.store.getViewport().zoom;
282
+ const offViewport = ctx.store.onMutation((e) => {
283
+ if (e.type !== "viewport:changed")
284
+ return;
285
+ const zoom = ctx.store.getViewport().zoom;
286
+ if (zoom === lastZoom)
287
+ return;
288
+ lastZoom = zoom;
289
+ if (drawing())
290
+ draw();
291
+ });
292
+ const onResize = () => {
293
+ if (drawing())
294
+ draw();
295
+ };
296
+ if (typeof window !== "undefined")
297
+ window.addEventListener("resize", onResize);
298
+ // Layers added later may declare how they show in 3D.
299
+ const offLayers = ctx.events.on("layers:changed", onResize);
300
+ sync();
301
+ // What the ground hides: the terrain mesh is a canvas the browser can't sort against
302
+ // the standing things, so they ask (see `View3dOcclusionApi`).
303
+ const height = () => ctx.height ?? boardHeight(ctx.services);
304
+ const groundAt = (x, y) => height().groundAt(x, y);
305
+ const projection = () => {
306
+ const state = cell.get();
307
+ if (!(state.amount > 0) || !stageSize || !(stageSize.width > 0))
308
+ return null;
309
+ const viewport = ctx.store.getViewport();
310
+ return { viewport, camera: projectionCamera(state, viewport.zoom), stage: stageSize };
311
+ };
312
+ const occlusion = {
313
+ hidden(x, y, h) {
314
+ if (occlusionMode === "none")
315
+ return false;
316
+ const view = projection();
317
+ if (!view || !(view.camera.pitch > 0))
318
+ return false;
319
+ return isOccluded({ x, y, height: h }, view, groundAt);
320
+ },
321
+ look: () => (occlusionMode === "hide" ? "hide" : "fade"),
322
+ subscribe(listener) {
323
+ settingsListeners.add(listener);
324
+ const offState = cell.subscribe(listener);
325
+ const offHeight = height().subscribe(listener);
326
+ return () => {
327
+ settingsListeners.delete(listener);
328
+ offState();
329
+ offHeight();
330
+ };
331
+ },
332
+ };
333
+ const unprovideOcclusion = view3dOcclusionService.get(ctx.services)
334
+ ? null
335
+ : view3dOcclusionService.provide(ctx.services, occlusion);
336
+ const disposeShapes = options.shapes === false ? null : setupCss3dShapes(ctx, { occlusion: () => occlusion });
337
+ const api = {
338
+ isDrawing: drawing,
339
+ setTiltLayers(ids) {
340
+ tiltOverride = ids ? [...ids] : null;
341
+ sync();
342
+ },
343
+ setDepthLayers(ids) {
344
+ depthOverride = ids ? [...ids] : null;
345
+ sync();
346
+ },
347
+ getTiltLayers: () => tiltLayers(),
348
+ getDepthLayers: () => depthLayers(),
349
+ setDepthStage(on) {
350
+ if (on === depthStage)
351
+ return;
352
+ depthStage = on;
353
+ sync();
354
+ for (const fn of [...settingsListeners])
355
+ fn();
356
+ },
357
+ isDepthStage: () => depthStage,
358
+ setOcclusion(mode) {
359
+ if (!OCCLUSION_MODES.includes(mode) || mode === occlusionMode)
360
+ return;
361
+ occlusionMode = mode;
362
+ for (const fn of [...settingsListeners])
363
+ fn();
364
+ },
365
+ getOcclusion: () => occlusionMode,
366
+ };
367
+ const unregisterHud = options.hud === false || !ctx.hud
368
+ ? null
369
+ : registerCss3dRendererHud(ctx, api, settingsListeners);
370
+ return {
371
+ api,
372
+ dispose: () => {
373
+ unregisterHud?.();
374
+ unprovideOcclusion?.();
375
+ settingsListeners.clear();
376
+ disposeShapes?.();
377
+ clear();
378
+ styleEl?.remove();
379
+ styleEl = null;
380
+ offCell();
381
+ offViewport();
382
+ offLayers();
383
+ if (typeof window !== "undefined")
384
+ window.removeEventListener("resize", onResize);
385
+ },
386
+ };
387
+ }
388
+ /** HUD field name of the depth stage toggle. */
389
+ export const DEPTH_STAGE_FIELD = "depthStage";
390
+ /** HUD field name of the occlusion choice. */
391
+ export const OCCLUSION_FIELD = "occlusion";
392
+ /** The renderer's HUD settings. Returns the unregister. */
393
+ function registerCss3dRendererHud(ctx, api, listeners) {
394
+ return ctx.hud.registerSettings({
395
+ id: "usketch-css3d-renderer:settings",
396
+ label: "3D の描き方(CSS 3D)",
397
+ order: 15,
398
+ fields: [
399
+ {
400
+ name: OCCLUSION_FIELD,
401
+ label: "地形の陰",
402
+ type: "enum",
403
+ options: [
404
+ { value: "fade", label: "薄くする" },
405
+ { value: "hide", label: "隠す" },
406
+ { value: "none", label: "そのまま" },
407
+ ],
408
+ },
409
+ { name: DEPTH_STAGE_FIELD, label: "奥行きで重ねる(実験)", type: "boolean" },
410
+ ],
411
+ get: (name) => {
412
+ if (name === DEPTH_STAGE_FIELD)
413
+ return api.isDepthStage();
414
+ if (name === OCCLUSION_FIELD)
415
+ return api.getOcclusion();
416
+ return undefined;
417
+ },
418
+ set: (name, value) => {
419
+ if (name === DEPTH_STAGE_FIELD)
420
+ api.setDepthStage(value === true);
421
+ if (name === OCCLUSION_FIELD)
422
+ api.setOcclusion(value);
423
+ },
424
+ subscribe: (listener) => {
425
+ listeners.add(listener);
426
+ return () => {
427
+ listeners.delete(listener);
428
+ };
429
+ },
430
+ });
431
+ }
432
+ /**
433
+ * The CSS 3D renderer plugin. Add it next to the DOM renderer; a 3D view (Mode 7) then
434
+ * only changes the core's 3D view state. If a renderer is already on the board (Mode 7
435
+ * adds one when the host didn't), this one does nothing.
436
+ */
437
+ export function createCss3dRendererPlugin(options = {}) {
438
+ return {
439
+ id: "usketch-css3d-renderer",
440
+ name: "CSS 3D renderer",
441
+ setup(ctx) {
442
+ // Another 3D renderer (a CSS 3D one, or a GPU one) already draws the board.
443
+ if (css3dRendererService.get(ctx.services) || view3dRendererService.get(ctx.services))
444
+ return;
445
+ const renderer = setupCss3dRenderer(ctx, options);
446
+ if (!renderer)
447
+ return;
448
+ const unprovide = css3dRendererService.provide(ctx.services, renderer.api);
449
+ // The generic 3D renderer slot too, unless a GPU renderer took it.
450
+ const unprovideGeneric = view3dRendererService.get(ctx.services)
451
+ ? null
452
+ : view3dRendererService.provide(ctx.services, renderer.api);
453
+ return () => {
454
+ unprovideGeneric?.();
455
+ unprovide();
456
+ renderer.dispose();
457
+ };
458
+ },
459
+ };
460
+ }
461
+ //# sourceMappingURL=css3d-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css3d-renderer.js","sourceRoot":"","sources":["../src/css3d-renderer.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,0FAA0F;AAC1F,yFAAyF;AACzF,kFAAkF;AAClF,EAAE;AACF,sFAAsF;AACtF,oEAAoE;AACpE,2FAA2F;AAC3F,2BAA2B;AAC3B,2FAA2F;AAC3F,yFAAyF;AACzF,iCAAiC;AACjC,oCAAoC;AACpC,2FAA2F;AAC3F,0FAA0F;AAC1F,qEAAqE;AACrE,OAAO,EACN,WAAW,EACX,aAAa,EACb,UAAU,EAKV,OAAO,EAOP,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC;AAC9C,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AACpD,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAG,+BAA+B,CAAC;AACjE,wFAAwF;AAC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BAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;gBAC/D,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,GAAG,EAAE;gBACX,gBAAgB,EAAE,EAAE,CAAC;gBACrB,SAAS,EAAE,CAAC;gBACZ,QAAQ,CAAC,OAAO,EAAE,CAAC;YACpB,CAAC,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type PluginContext, type View3dOcclusionApi } from "@edv4h/usketch-shared";
2
+ import { type Css3dShapeLimits, type Css3dShapeTypes } from "./shapes-layout.js";
3
+ /** What a plugin hands the renderer to draw 3D shapes by (see the module comment). */
4
+ export interface Css3dShapeSource {
5
+ /** The types' 3D to use instead of what the board's types declare. */
6
+ types?(): Css3dShapeTypes;
7
+ /** Limits over {@link DEFAULT_CSS3D_SHAPE_LIMITS}. */
8
+ limits?(): Partial<Css3dShapeLimits>;
9
+ }
10
+ /** A plugin's source for the renderer's 3D shapes (read on every draw, so set up in any order). */
11
+ export declare const css3dShapeSourceService: import("@edv4h/usketch-shared").ServiceHandle<Css3dShapeSource>;
12
+ /** Limits with every field usable (a bad one falls back to the default). Pure. */
13
+ export declare function sanitizeCss3dShapeLimits(l?: Partial<Css3dShapeLimits>): Css3dShapeLimits;
14
+ export interface Css3dShapesOptions {
15
+ /** What the ground hides (the renderer's), read on every draw. */
16
+ occlusion?: () => View3dOcclusionApi | null;
17
+ }
18
+ /**
19
+ * Register the 3D shape layer on `ctx` (the CSS 3D renderer does it on setup). Returns its
20
+ * teardown.
21
+ */
22
+ export declare function setupCss3dShapes(ctx: PluginContext, options?: Css3dShapesOptions): () => void;
23
+ //# sourceMappingURL=css3d-shapes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css3d-shapes.d.ts","sourceRoot":"","sources":["../src/css3d-shapes.tsx"],"names":[],"mappings":"AAUA,OAAO,EAKN,KAAK,aAAa,EAGlB,KAAK,kBAAkB,EAEvB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAEpB,MAAM,oBAAoB,CAAC;AAE5B,sFAAsF;AACtF,MAAM,WAAW,gBAAgB;IAChC,sEAAsE;IACtE,KAAK,CAAC,IAAI,eAAe,CAAC;IAC1B,sDAAsD;IACtD,MAAM,CAAC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrC;AAED,mGAAmG;AACnG,eAAO,MAAM,uBAAuB,iEAEnC,CAAC;AAIF,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,CAAC,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB,CAW5F;AAED,MAAM,WAAW,kBAAkB;IAClC,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,kBAAkB,GAAG,IAAI,CAAC;CAC5C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,GAAE,kBAAuB,GAAG,MAAM,IAAI,CA4FjG"}
@@ -0,0 +1,110 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // The renderer's 3D shapes: shapes with 3D parameters (`ShapeData.view3d`, or their type's
3
+ // default) stand out of the ground while the board is shown in 3D, and shapes lying on
4
+ // raised terrain are lifted onto it. The flat DOM layer skips the same shapes through the
5
+ // board's shape claims.
6
+ //
7
+ // Which modes a type may use comes from the type itself (`ShapeDefinition.view3d` with the
8
+ // host's `ctx.shapes.configureView3d`). A plugin can hand the renderer its own table and
9
+ // limits instead through `css3dShapeSourceService` (the shape-3d plugin does, for its
10
+ // older options, until the next major).
11
+ import { VIEWPORT_OVERSCAN_EVENT } from "@edv4h/usketch-dom-renderer";
12
+ import { boardHeight, createView3dTracker, defineService, shapeClaims, view3dService, } from "@edv4h/usketch-shared";
13
+ import { Css3dShapesLayer, SHAPE_3D_LAYER_ID, } from "./shapes-layer.js";
14
+ import { DEFAULT_CSS3D_SHAPE_LIMITS, } from "./shapes-layout.js";
15
+ /** A plugin's source for the renderer's 3D shapes (read on every draw, so set up in any order). */
16
+ export const css3dShapeSourceService = defineService("usketch-css3d-renderer:shape-source");
17
+ let nextClaimSource = 0;
18
+ /** Limits with every field usable (a bad one falls back to the default). Pure. */
19
+ export function sanitizeCss3dShapeLimits(l = {}) {
20
+ const d = DEFAULT_CSS3D_SHAPE_LIMITS;
21
+ return {
22
+ minPx: typeof l.minPx === "number" && Number.isFinite(l.minPx) && l.minPx >= 0 ? l.minPx : d.minPx,
23
+ maxCount: typeof l.maxCount === "number" && Number.isFinite(l.maxCount) && l.maxCount >= 0
24
+ ? Math.floor(l.maxCount)
25
+ : d.maxCount,
26
+ groundFlat: typeof l.groundFlat === "boolean" ? l.groundFlat : d.groundFlat,
27
+ };
28
+ }
29
+ /**
30
+ * Register the 3D shape layer on `ctx` (the CSS 3D renderer does it on setup). Returns its
31
+ * teardown.
32
+ */
33
+ export function setupCss3dShapes(ctx, options = {}) {
34
+ const tracker = createView3dTracker(ctx.services, ctx.events);
35
+ const claims = shapeClaims(ctx.services);
36
+ const claimSource = `usketch-css3d-renderer:shapes#${nextClaimSource++}`;
37
+ const height = ctx.height ?? boardHeight(ctx.services);
38
+ const heightAt = (x, y) => height.groundAt(x, y);
39
+ // The types' own 3D, rebuilt when a type registers or the host overrides one.
40
+ let overrideVersion = 0;
41
+ const offOverrides = ctx.shapes.subscribeView3d?.(() => {
42
+ overrideVersion++;
43
+ ctx.events.emit("layers:changed", {});
44
+ });
45
+ let declaredKey = "";
46
+ let declared = {};
47
+ const declaredTypes = () => {
48
+ const all = ctx.shapes.getAll();
49
+ const key = `${all.size}:${overrideVersion}`;
50
+ if (key === declaredKey)
51
+ return declared;
52
+ const out = {};
53
+ for (const [type, def] of all) {
54
+ const view3d = ctx.shapes.getView3d ? ctx.shapes.getView3d(type) : def.view3d;
55
+ if (view3d)
56
+ out[type] = view3d;
57
+ }
58
+ declaredKey = key;
59
+ declared = out;
60
+ return declared;
61
+ };
62
+ let overscanPx = 0;
63
+ const offOverscan = ctx.events.on(VIEWPORT_OVERSCAN_EVENT, ({ px }) => {
64
+ const next = Number.isFinite(px) && px > 0 ? px : 0;
65
+ if (next === overscanPx)
66
+ return;
67
+ overscanPx = next;
68
+ ctx.events.emit("layers:changed", {});
69
+ });
70
+ const onDrawn = (ids) => claims.claim(claimSource, ids);
71
+ const camera = {
72
+ get: () => view3dService.get(ctx.services)?.camera() ?? null,
73
+ subscribe: (listener) => tracker.subscribeCamera(listener),
74
+ };
75
+ // One subscription to the occlusion's changes for every mounted layer.
76
+ let occlusionVersion = 0;
77
+ const occlusionChanges = {
78
+ get: () => occlusionVersion,
79
+ subscribe(listener) {
80
+ const off = options.occlusion?.()?.subscribe(() => {
81
+ occlusionVersion++;
82
+ listener();
83
+ });
84
+ return () => off?.();
85
+ },
86
+ };
87
+ const layer = {
88
+ id: SHAPE_3D_LAYER_ID,
89
+ view3d: "depth",
90
+ // Just above the flat DOM shapes (50); a fixed layer placed in screen px.
91
+ order: 51,
92
+ avoidCollision: true,
93
+ fixed: true,
94
+ render: (rc) => {
95
+ const source = css3dShapeSourceService.get(ctx.services);
96
+ return (_jsx(Css3dShapesLayer, { rc: rc, shapes: ctx.shapes, tracker: tracker, types: source?.types?.() ?? declaredTypes(), limits: sanitizeCss3dShapeLimits(source?.limits?.()), overscanPx: overscanPx, heightAt: heightAt, onDrawn: onDrawn, camera: camera, occlusion: options.occlusion?.() ?? null, occlusionChanges: occlusionChanges }));
97
+ },
98
+ };
99
+ ctx.layers.register(layer);
100
+ return () => {
101
+ // Another registration under the same id (an older shape-3d plugin) stays.
102
+ if (ctx.layers.getLayers().some((l) => l === layer))
103
+ ctx.layers.unregister(SHAPE_3D_LAYER_ID);
104
+ claims.claim(claimSource, []);
105
+ offOverrides?.();
106
+ offOverscan();
107
+ tracker.dispose();
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Q,CAAC,KAAK,CAAC,CAAC;IAE3B,OAAO,GAAG,EAAE;QACX,2EAA2E;QAC3E,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC;YAAE,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAC9F,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC9B,YAAY,EAAE,EAAE,CAAC;QACjB,WAAW,EAAE,CAAC;QACd,OAAO,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { DEPTH_STAGE_FAR_PX, type DepthStageLayer, type DepthStageOptions, depthStageRules, drawDistanceClip, drawDistanceOverscanPx, type TiltRuleOptions, tiltLayerRules, } from "./css3d-css.js";
2
+ export { CAMERA_HEIGHT_VAR, type Css3dOcclusionMode, type Css3dRendererApi, type Css3dRendererOptions, cameraHeightPx, createCss3dRendererPlugin, css3dRendererService, DEPTH_STAGE_FIELD, LEGACY_STAGE_ATTR, layerTransform, OCCLUSION_FIELD, projectionCamera, STAGE_ATTR, setupCss3dRenderer, } from "./css3d-renderer.js";
3
+ export { type Css3dShapeSource, type Css3dShapesOptions, css3dShapeSourceService, sanitizeCss3dShapeLimits, setupCss3dShapes, } from "./css3d-shapes.js";
4
+ export { type Css3dCameraSource, type Css3dChangeSource, Css3dShapesLayer, type Css3dShapesLayerProps, createOcclusionCache, type OcclusionCache, SHAPE_3D_LAYER_ID, shapeTop3d, } from "./shapes-layer.js";
5
+ export { type BoxSide, type BoxWall, boxTopTransform, boxWalls, type Css3dShapeLimits, type Css3dShapeTypes, DEFAULT_CSS3D_SHAPE_LIMITS, GROUND_FLAT_PARAMS, lerpAngle, poseBox, poseOrigin, poseTransform, render3dFrame, SHADOW_LIFT_PX, type Shape3dEntry, type ShapePose, STAND_ORIGIN, selectShapes3d, shadowStyle, shapeAnchor, shapePose, standFoot, wallColor, wallShade, } from "./shapes-layout.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,eAAe,EACpB,cAAc,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,KAAK,cAAc,EACnB,iBAAiB,EACjB,UAAU,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,eAAe,EACf,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,0BAA0B,EAC1B,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,GACT,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { DEPTH_STAGE_FAR_PX, depthStageRules, drawDistanceClip, drawDistanceOverscanPx, tiltLayerRules, } from "./css3d-css.js";
2
+ export { CAMERA_HEIGHT_VAR, cameraHeightPx, createCss3dRendererPlugin, css3dRendererService, DEPTH_STAGE_FIELD, LEGACY_STAGE_ATTR, layerTransform, OCCLUSION_FIELD, projectionCamera, STAGE_ATTR, setupCss3dRenderer, } from "./css3d-renderer.js";
3
+ export { css3dShapeSourceService, sanitizeCss3dShapeLimits, setupCss3dShapes, } from "./css3d-shapes.js";
4
+ export { Css3dShapesLayer, createOcclusionCache, SHAPE_3D_LAYER_ID, shapeTop3d, } from "./shapes-layer.js";
5
+ export { boxTopTransform, boxWalls, DEFAULT_CSS3D_SHAPE_LIMITS, GROUND_FLAT_PARAMS, lerpAngle, poseBox, poseOrigin, poseTransform, render3dFrame, SHADOW_LIFT_PX, STAND_ORIGIN, selectShapes3d, shadowStyle, shapeAnchor, shapePose, standFoot, wallColor, wallShade, } from "./shapes-layout.js";
6
+ //# sourceMappingURL=index.js.map