@particle-academy/fancy-3d 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.
- package/README.md +84 -0
- package/dist/babylon.cjs +773 -0
- package/dist/babylon.cjs.map +1 -0
- package/dist/babylon.d.cts +229 -0
- package/dist/babylon.d.ts +229 -0
- package/dist/babylon.js +754 -0
- package/dist/babylon.js.map +1 -0
- package/dist/dom.cjs +225 -0
- package/dist/dom.cjs.map +1 -0
- package/dist/dom.d.cts +16 -0
- package/dist/dom.d.ts +16 -0
- package/dist/dom.js +223 -0
- package/dist/dom.js.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +188 -0
- package/dist/index.d.ts +188 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +311 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +60 -0
- package/dist/react.d.ts +60 -0
- package/dist/react.js +307 -0
- package/dist/react.js.map +1 -0
- package/docs/babylon-adapter.md +127 -0
- package/docs/dom-adapter.md +97 -0
- package/docs/primitives.md +168 -0
- package/docs/scene.md +122 -0
- package/docs/screen.md +97 -0
- package/package.json +104 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/painters.ts","../src/primitives.ts","../src/babylon.ts"],"names":["StandardMaterial","Color3","DynamicTexture","MeshBuilder","Mesh","box","Vector4","Vector3"],"mappings":";;;;;;;AAEO,IAAM,SAAA,GAAY;AAKzB,SAAS,MAAA,CAAO,IAAY,CAAA,EAAmB;AAC7C,EAAA,OAAO,CAAA,GAAI,GAAA;AACb;AAEA,SAAS,WAAA,CAAY,GAAA,EAA+B,CAAA,EAAW,CAAA,EAAW,QAAA,EAAmB;AAC3F,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,CAAA,EAAG,CAAC,CAAA;AACrB,EAAA,GAAA,CAAI,SAAA,GAAY,SAAA;AAChB,EAAA,S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idgetSpec } from \"./scene\";\r\n\r\nexport const TEX_SCALE = 2; // retina-ish texture sharpness\r\n\r\n/** Scale factor against the painters' design-time canvas (240px tall). All\r\n * widget painters multiply their padding / font sizes by this so the layout\r\n * looks the same at any pixel resolution. */\r\nfunction unitOf(_w: number, h: number): number {\r\n return h / 240;\r\n}\r\n\r\nfunction paintCardBg(ctx: CanvasRenderingContext2D, w: number, h: number, selected: boolean) {\r\n const u = unitOf(w, h);\r\n ctx.fillStyle = \"#0f172a\";\r\n roundRect(ctx, 0, 0, w, h, 14 * u);\r\n ctx.fill();\r\n ctx.strokeStyle = selected ? \"#6366f1\" : \"#1e293b\";\r\n ctx.lineWidth = (selected ? 4 : 2) * u;\r\n ctx.stroke();\r\n}\r\n\r\nfunction roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number) {\r\n ctx.beginPath();\r\n ctx.moveTo(x + r, y);\r\n ctx.arcTo(x + w, y, x + w, y + h, r);\r\n ctx.arcTo(x + w, y + h, x, y + h, r);\r\n ctx.arcTo(x, y + h, x, y, r);\r\n ctx.arcTo(x, y, x + w, y, r);\r\n ctx.closePath();\r\n}\r\n\r\nfunction paintLabel(ctx: CanvasRenderingContext2D, text: string, x: number, y: number) {\r\n ctx.fillStyle = \"#94a3b8\";\r\n ctx.font = \"600 22px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillText(text.toUpperCase(), x, y);\r\n}\r\n\r\nfunction paintSparkline(ctx: CanvasRenderingContext2D, values: number[], x: number, y: number, w: number, h: number, variant: \"line\" | \"bar\" | \"area\", color: string) {\r\n const max = Math.max(...values, 1);\r\n const min = Math.min(...values, 0);\r\n const range = max - min || 1;\r\n const step = w / Math.max(values.length - 1, 1);\r\n\r\n if (variant === \"bar\") {\r\n const bw = w / values.length - 4;\r\n ctx.fillStyle = color;\r\n values.forEach((v, i) => {\r\n const bh = ((v - min) / range) * h;\r\n ctx.fillRect(x + i * (bw + 4), y + h - bh, bw, Math.max(bh, 1));\r\n });\r\n return;\r\n }\r\n\r\n ctx.beginPath();\r\n values.forEach((v, i) => {\r\n const px = x + i * step;\r\n const py = y + h - ((v - min) / range) * h;\r\n if (i === 0) ctx.moveTo(px, py);\r\n else ctx.lineTo(px, py);\r\n });\r\n\r\n if (variant === \"area\") {\r\n ctx.lineTo(x + w, y + h);\r\n ctx.lineTo(x, y + h);\r\n ctx.closePath();\r\n ctx.fillStyle = color + \"44\";\r\n ctx.fill();\r\n ctx.beginPath();\r\n values.forEach((v, i) => {\r\n const px = x + i * step;\r\n const py = y + h - ((v - min) / range) * h;\r\n if (i === 0) ctx.moveTo(px, py);\r\n else ctx.lineTo(px, py);\r\n });\r\n }\r\n\r\n ctx.strokeStyle = color;\r\n ctx.lineWidth = 3;\r\n ctx.stroke();\r\n}\r\nexport function paintWidget(ctx: CanvasRenderingContext2D, spec: WidgetSpec, w: number, h: number, selected: boolean) {\r\n paintCardBg(ctx, w, h, selected);\r\n const pad = 20;\r\n\r\n switch (spec.kind) {\r\n case \"kpi\": {\r\n paintLabel(ctx, spec.label, pad, pad);\r\n ctx.fillStyle = \"#f1f5f9\";\r\n ctx.font = \"700 56px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(spec.value, pad, pad + 32);\r\n if (spec.delta) {\r\n ctx.fillStyle = spec.trend === \"up\" ? \"#10b981\" : spec.trend === \"down\" ? \"#f43f5e\" : \"#94a3b8\";\r\n ctx.font = \"600 22px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(spec.delta, pad, pad + 92);\r\n }\r\n break;\r\n }\r\n case \"chart\": {\r\n paintLabel(ctx, spec.title, pad, pad);\r\n paintSparkline(ctx, spec.series, pad, pad + 36, w - pad * 2, h - pad * 2 - 36, spec.variant, spec.color ?? \"#6366f1\");\r\n break;\r\n }\r\n case \"kanban\": {\r\n const colW = (w - pad * 2 - (spec.columns.length - 1) * 10) / spec.columns.length;\r\n spec.columns.forEach((col, i) => {\r\n const cx = pad + i * (colW + 10);\r\n ctx.fillStyle = \"#1e293b\";\r\n roundRect(ctx, cx, pad, colW, h - pad * 2, 8);\r\n ctx.fill();\r\n paintLabel(ctx, col.title, cx + 8, pad + 10);\r\n col.cards.forEach((c, j) => {\r\n ctx.fillStyle = \"#0f172a\";\r\n roundRect(ctx, cx + 8, pad + 44 + j * 38, colW - 16, 30, 6);\r\n ctx.fill();\r\n ctx.fillStyle = \"#cbd5e1\";\r\n ctx.font = \"500 20px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(c, cx + 16, pad + 50 + j * 38);\r\n });\r\n });\r\n break;\r\n }\r\n case \"table\": {\r\n paintLabel(ctx, spec.title, pad, pad);\r\n ctx.fillStyle = \"#94a3b8\";\r\n ctx.font = \"600 18px ui-sans-serif, system-ui, sans-serif\";\r\n const colW = (w - pad * 2) / spec.columns.length;\r\n spec.columns.forEach((c, i) => ctx.fillText(c, pad + i * colW, pad + 38));\r\n ctx.fillStyle = \"#cbd5e1\";\r\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\r\n spec.rows.forEach((row, ri) => {\r\n row.forEach((cell, ci) => ctx.fillText(String(cell), pad + ci * colW, pad + 70 + ri * 28));\r\n });\r\n break;\r\n }\r\n case \"profile\": {\r\n ctx.fillStyle = \"#6366f1\";\r\n ctx.beginPath();\r\n ctx.arc(pad + 30, pad + 30, 28, 0, Math.PI * 2);\r\n ctx.fill();\r\n ctx.fillStyle = \"#fff\";\r\n ctx.font = \"700 24px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.textAlign = \"center\";\r\n ctx.fillText(spec.initials, pad + 30, pad + 22);\r\n ctx.textAlign = \"left\";\r\n ctx.fillStyle = \"#f1f5f9\";\r\n ctx.font = \"600 24px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(spec.name, pad + 76, pad + 12);\r\n ctx.fillStyle = \"#94a3b8\";\r\n ctx.font = \"400 20px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(spec.role, pad + 76, pad + 40);\r\n if (spec.status) {\r\n ctx.fillStyle = spec.status === \"online\" ? \"#10b981\" : spec.status === \"away\" ? \"#f59e0b\" : \"#64748b\";\r\n ctx.beginPath();\r\n ctx.arc(pad + 50, pad + 50, 6, 0, Math.PI * 2);\r\n ctx.fill();\r\n }\r\n break;\r\n }\r\n case \"callout\": {\r\n const tone = spec.tone === \"danger\" ? \"#f43f5e\" : spec.tone === \"warning\" ? \"#f59e0b\" : spec.tone === \"success\" ? \"#10b981\" : \"#3b82f6\";\r\n ctx.fillStyle = tone + \"22\";\r\n roundRect(ctx, 4, 4, w - 8, h - 8, 12);\r\n ctx.fill();\r\n ctx.fillStyle = tone;\r\n ctx.fillRect(12, 12, 4, h - 24);\r\n ctx.fillStyle = \"#f1f5f9\";\r\n ctx.font = \"600 22px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(spec.title, 28, pad);\r\n ctx.fillStyle = \"#cbd5e1\";\r\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\r\n wrapText(ctx, spec.body, 28, pad + 32, w - 40, 22);\r\n break;\r\n }\r\n case \"form\": {\r\n paintLabel(ctx, spec.title, pad, pad);\r\n spec.fields.forEach((f, i) => {\r\n const y = pad + 40 + i * 44;\r\n ctx.fillStyle = \"#cbd5e1\";\r\n ctx.font = \"500 18px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(f.label, pad, y);\r\n ctx.fillStyle = \"#1e293b\";\r\n roundRect(ctx, w - pad - 100, y - 4, 100, 28, 6);\r\n ctx.fill();\r\n if (f.type === \"switch\") {\r\n ctx.fillStyle = \"#6366f1\";\r\n roundRect(ctx, w - pad - 60, y - 4, 60, 28, 14);\r\n ctx.fill();\r\n ctx.fillStyle = \"#fff\";\r\n ctx.beginPath();\r\n ctx.arc(w - pad - 18, y + 10, 10, 0, Math.PI * 2);\r\n ctx.fill();\r\n }\r\n });\r\n break;\r\n }\r\n case \"action\": {\r\n paintLabel(ctx, spec.title, pad, pad);\r\n let bx = pad;\r\n const by = pad + 40;\r\n spec.buttons.forEach((b) => {\r\n const tw = ctx.measureText(b.label).width + 24;\r\n ctx.fillStyle = b.variant === \"primary\" ? \"#6366f1\" : b.variant === \"ghost\" ? \"transparent\" : \"#1e293b\";\r\n if (b.variant !== \"ghost\") {\r\n roundRect(ctx, bx, by, tw, 36, 8);\r\n ctx.fill();\r\n }\r\n ctx.fillStyle = b.variant === \"primary\" ? \"#fff\" : \"#cbd5e1\";\r\n ctx.font = \"600 18px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(b.label, bx + 12, by + 9);\r\n bx += tw + 8;\r\n });\r\n break;\r\n }\r\n case \"timeline\": {\r\n paintLabel(ctx, spec.title, pad, pad);\r\n spec.events.forEach((e, i) => {\r\n const y = pad + 40 + i * 32;\r\n ctx.fillStyle = \"#6366f1\";\r\n ctx.beginPath();\r\n ctx.arc(pad + 4, y + 10, 4, 0, Math.PI * 2);\r\n ctx.fill();\r\n ctx.strokeStyle = \"#1e293b\";\r\n if (i < spec.events.length - 1) {\r\n ctx.beginPath();\r\n ctx.moveTo(pad + 4, y + 14);\r\n ctx.lineTo(pad + 4, y + 32);\r\n ctx.stroke();\r\n }\r\n ctx.fillStyle = \"#94a3b8\";\r\n ctx.font = \"500 14px ui-monospace, monospace\";\r\n ctx.fillText(e.at, pad + 16, y);\r\n ctx.fillStyle = \"#cbd5e1\";\r\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(e.label, pad + 60, y);\r\n });\r\n break;\r\n }\r\n case \"code\": {\r\n paintLabel(ctx, spec.title, pad, pad);\r\n ctx.fillStyle = \"#020617\";\r\n roundRect(ctx, pad, pad + 36, w - pad * 2, h - pad * 2 - 36, 8);\r\n ctx.fill();\r\n ctx.fillStyle = \"#a5b4fc\";\r\n ctx.font = \"400 16px ui-monospace, monospace\";\r\n const lines = spec.code.split(\"\\n\");\r\n lines.forEach((ln, i) => ctx.fillText(ln, pad + 14, pad + 56 + i * 22));\r\n break;\r\n }\r\n case \"image\": {\r\n ctx.fillStyle = \"#1e293b\";\r\n roundRect(ctx, pad, pad, w - pad * 2, h - pad * 2, 8);\r\n ctx.fill();\r\n ctx.fillStyle = \"#64748b\";\r\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.textAlign = \"center\";\r\n ctx.fillText(spec.alt, w / 2, h / 2);\r\n ctx.textAlign = \"left\";\r\n break;\r\n }\r\n case \"text\": {\r\n ctx.fillStyle = \"#f1f5f9\";\r\n ctx.font = \"700 26px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(spec.heading, pad, pad);\r\n ctx.fillStyle = \"#cbd5e1\";\r\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\r\n wrapText(ctx, spec.body, pad, pad + 38, w - pad * 2, 22);\r\n break;\r\n }\r\n case \"screen\": {\r\n const bezel = spec.bezel ?? \"#0b0f17\";\r\n const t = spec.bezelThickness ?? 14;\r\n const on = spec.on ?? true;\r\n const brightness = spec.brightness ?? (on ? 1 : 0.06);\r\n const bg = spec.background ?? \"#020617\";\r\n\r\n // Outer bezel\r\n ctx.fillStyle = bezel;\r\n roundRect(ctx, 0, 0, w, h, 18);\r\n ctx.fill();\r\n // Inner screen area\r\n const sx = t;\r\n const sy = t;\r\n const sw = w - t * 2;\r\n const sh = h - t * 2;\r\n ctx.save();\r\n ctx.fillStyle = bg;\r\n roundRect(ctx, sx, sy, sw, sh, 8);\r\n ctx.fill();\r\n ctx.beginPath();\r\n roundRect(ctx, sx, sy, sw, sh, 8);\r\n ctx.clip();\r\n ctx.translate(sx, sy);\r\n // Apply brightness as global alpha multiplier\r\n ctx.globalAlpha = brightness;\r\n const c = spec.content;\r\n if (c.type === \"label\") {\r\n ctx.fillStyle = \"#e2e8f0\";\r\n ctx.font = \"700 32px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.textAlign = \"center\";\r\n ctx.textBaseline = \"middle\";\r\n ctx.fillText(c.title, sw / 2, sh / 2 - (c.subtitle ? 16 : 0));\r\n if (c.subtitle) {\r\n ctx.fillStyle = \"#94a3b8\";\r\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.fillText(c.subtitle, sw / 2, sh / 2 + 18);\r\n }\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"alphabetic\";\r\n } else if (c.type === \"paint\") {\r\n c.paint(ctx, sw, sh);\r\n } else if (c.type === \"image\") {\r\n // Image content is best painted by the consumer via \"paint\" — labels\r\n // serve as a fallback so the screen still has identifiable content.\r\n ctx.fillStyle = \"#475569\";\r\n ctx.font = \"500 16px ui-sans-serif, system-ui, sans-serif\";\r\n ctx.textAlign = \"center\";\r\n ctx.fillText(c.alt ?? \"image\", sw / 2, sh / 2);\r\n ctx.textAlign = \"left\";\r\n }\r\n ctx.globalAlpha = 1;\r\n ctx.restore();\r\n // Power LED\r\n ctx.fillStyle = on ? \"#10b981\" : \"#475569\";\r\n ctx.beginPath();\r\n ctx.arc(w - t - 6, h - t - 6, 4, 0, Math.PI * 2);\r\n ctx.fill();\r\n // Subtle glass reflection\r\n const grad = ctx.createLinearGradient(sx, sy, sx, sy + sh);\r\n grad.addColorStop(0, \"rgba(255,255,255,0.08)\");\r\n grad.addColorStop(0.4, \"rgba(255,255,255,0)\");\r\n ctx.fillStyle = grad;\r\n ctx.beginPath();\r\n roundRect(ctx, sx, sy, sw, sh, 8);\r\n ctx.fill();\r\n break;\r\n }\r\n case \"demoPage\": {\r\n const u = unitOf(w, h);\r\n const padX = w * 0.06;\r\n const headerH = h * 0.22;\r\n const titleY = headerH + h * 0.12;\r\n const titleSize = h * 0.16;\r\n const descY = titleY + titleSize * 0.6;\r\n const descSize = h * 0.072;\r\n const descLine = descSize * 1.4;\r\n const chipSize = h * 0.052;\r\n const pathSize = h * 0.052;\r\n const ctaSize = h * 0.075;\r\n const ctaH = ctaSize * 2;\r\n\r\n // Accent header bar — slightly overlaps card top to visually anchor\r\n ctx.fillStyle = spec.accent;\r\n roundRect(ctx, 0, 0, w, headerH, 14 * u);\r\n ctx.fill();\r\n // Squared bottom on the accent bar (cancel rounded bottom corners)\r\n ctx.fillRect(0, headerH - 14 * u, w, 14 * u);\r\n\r\n // Category chip\r\n ctx.fillStyle = \"rgba(255,255,255,0.22)\";\r\n const chipText = spec.category.toUpperCase();\r\n ctx.font = `700 ${chipSize}px ui-sans-serif, system-ui, sans-serif`;\r\n ctx.textBaseline = \"top\";\r\n const chipPad = chipSize * 0.7;\r\n const chipW = ctx.measureText(chipText).width + chipPad * 2;\r\n const chipH = chipSize * 1.85;\r\n const chipY = (headerH - chipH) / 2;\r\n roundRect(ctx, padX, chipY, chipW, chipH, chipH / 2);\r\n ctx.fill();\r\n ctx.fillStyle = \"#fff\";\r\n ctx.fillText(chipText, padX + chipPad, chipY + (chipH - chipSize) / 2);\r\n\r\n // Path on right\r\n ctx.fillStyle = \"rgba(255,255,255,0.9)\";\r\n ctx.font = `500 ${pathSize}px ui-monospace, monospace`;\r\n const pathW = ctx.measureText(spec.path).width;\r\n ctx.fillText(spec.path, w - padX - pathW, chipY + (chipH - chipSize) / 2);\r\n\r\n // Title\r\n ctx.fillStyle = \"#f8fafc\";\r\n ctx.font = `800 ${titleSize}px ui-sans-serif, system-ui, sans-serif`;\r\n ctx.fillText(spec.name, padX, titleY);\r\n\r\n // Description (wrapped, clipped before reaching the CTA)\r\n ctx.fillStyle = \"#94a3b8\";\r\n ctx.font = `400 ${descSize}px ui-sans-serif, system-ui, sans-serif`;\r\n const ctaY = h - padX - ctaH;\r\n wrapText(ctx, spec.description, padX, descY, w - padX * 2, descLine, ctaY - descLine);\r\n\r\n // CTA at bottom\r\n ctx.fillStyle = spec.accent;\r\n const ctaText = \"Open demo →\";\r\n ctx.font = `600 ${ctaSize}px ui-sans-serif, system-ui, sans-serif`;\r\n const ctaTextPad = ctaSize * 0.9;\r\n const ctaW = ctx.measureText(ctaText).width + ctaTextPad * 2;\r\n roundRect(ctx, padX, ctaY, ctaW, ctaH, ctaH * 0.25);\r\n ctx.fill();\r\n ctx.fillStyle = \"#0f172a\";\r\n ctx.fillText(ctaText, padX + ctaTextPad, ctaY + (ctaH - ctaSize) / 2);\r\n ctx.textBaseline = \"alphabetic\";\r\n break;\r\n }\r\n }\r\n}\r\n\r\nfunction wrapText(\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n x: number,\r\n y: number,\r\n maxW: number,\r\n lineH: number,\r\n maxY?: number\r\n) {\r\n const words = text.split(\" \");\r\n let line = \"\";\r\n let yy = y;\r\n for (const word of words) {\r\n const test = line ? `${line} ${word}` : word;\r\n if (ctx.measureText(test).width > maxW && line) {\r\n if (maxY !== undefined && yy > maxY) return;\r\n ctx.fillText(line, x, yy);\r\n line = word;\r\n yy += lineH;\r\n } else {\r\n line = test;\r\n }\r\n }\r\n if (line && (maxY === undefined || yy <= maxY)) ctx.fillText(line, x, yy);\r\n}\r\n","/**\r\n * 3D shape primitives for `@particle-academy/fancy-3d`.\r\n *\r\n * A primitive is a Babylon mesh that can host UI content on its surface —\r\n * either a flat color, a freeform 2D paint callback, or a `WidgetSpec`\r\n * rendered through the same painters as the Babylon adapter.\r\n *\r\n * Every primitive returns a `Mesh`, ready to position in your scene.\r\n */\r\nimport {\r\n Color3,\r\n DynamicTexture,\r\n Mesh,\r\n MeshBuilder,\r\n StandardMaterial,\r\n Vector3,\r\n Vector4,\r\n type Scene,\r\n} from \"@babylonjs/core\";\r\nimport type { WidgetSpec } from \"./scene\";\r\nimport { TEX_SCALE, paintWidget } from \"./painters\";\r\n\r\nexport type PaintFn = (ctx: CanvasRenderingContext2D, width: number, height: number) => void;\r\n\r\nexport type SurfaceContent =\r\n | { type: \"color\"; color: string }\r\n | { type: \"paint\"; paint: PaintFn; pixelWidth?: number; pixelHeight?: number; transparent?: boolean }\r\n | { type: \"widget\"; widget: WidgetSpec; pixelWidth?: number; pixelHeight?: number; selected?: boolean };\r\n\r\n/** Default pixel density when a primitive auto-sizes a widget surface from\r\n * world-space dimensions (1 world unit ≈ 1 meter). Higher values produce\r\n * sharper textures at the cost of GPU memory. */\r\nconst DEFAULT_DENSITY = 120;\r\nconst MAX_TEXTURE_AXIS = 1024;\r\n\r\nfunction autoPixelSize(worldWidth: number, worldHeight: number, density = DEFAULT_DENSITY) {\r\n let w = Math.max(96, Math.round(worldWidth * density));\r\n let h = Math.max(96, Math.round(worldHeight * density));\r\n const scale = Math.min(1, MAX_TEXTURE_AXIS / Math.max(w, h));\r\n if (scale < 1) {\r\n w = Math.round(w * scale);\r\n h = Math.round(h * scale);\r\n }\r\n return { w, h };\r\n}\r\n\r\ninterface SurfaceTexture {\r\n material: StandardMaterial;\r\n texture: DynamicTexture | null;\r\n}\r\n\r\nfunction buildSurface(\r\n scene: Scene,\r\n name: string,\r\n surface: SurfaceContent,\r\n autoSize?: { worldWidth: number; worldHeight: number }\r\n): SurfaceTexture {\r\n const mat = new StandardMaterial(`${name}-mat`, scene);\r\n mat.specularColor = new Color3(0.05, 0.05, 0.05);\r\n\r\n if (surface.type === \"color\") {\r\n mat.diffuseColor = Color3.FromHexString(surface.color);\r\n mat.emissiveColor = Color3.FromHexString(surface.color).scale(0.15);\r\n return { material: mat, texture: null };\r\n }\r\n\r\n let w = surface.pixelWidth;\r\n let h = surface.pixelHeight;\r\n if ((w == null || h == null) && autoSize) {\r\n const auto = autoPixelSize(autoSize.worldWidth, autoSize.worldHeight);\r\n w = w ?? auto.w;\r\n h = h ?? auto.h;\r\n }\r\n w = w ?? 512;\r\n h = h ?? 512;\r\n const tex = new DynamicTexture(`${name}-tex`, { width: w * TEX_SCALE, height: h * TEX_SCALE }, scene, true);\r\n // Babylon plane UVs run V=0 at the bottom; canvas Y runs top-to-bottom.\r\n tex.vScale = -1;\r\n tex.vOffset = 1;\r\n if (surface.type === \"paint\" && surface.transparent) {\r\n tex.hasAlpha = true;\r\n }\r\n if (surface.type === \"widget\") {\r\n tex.hasAlpha = true;\r\n }\r\n const ctx = tex.getContext() as CanvasRenderingContext2D;\r\n ctx.scale(TEX_SCALE, TEX_SCALE);\r\n if (surface.type === \"paint\") {\r\n surface.paint(ctx, w, h);\r\n } else {\r\n paintWidget(ctx, surface.widget, w, h, surface.selected ?? false);\r\n }\r\n tex.update(false);\r\n\r\n mat.diffuseTexture = tex;\r\n mat.emissiveTexture = tex;\r\n mat.emissiveColor = new Color3(0.6, 0.6, 0.6);\r\n if (tex.hasAlpha) mat.useAlphaFromDiffuseTexture = true;\r\n\r\n return { material: mat, texture: tex };\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Panel — flat 2D plane with one surface */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface PanelOpts {\r\n scene: Scene;\r\n name?: string;\r\n width: number;\r\n height: number;\r\n surface: SurfaceContent;\r\n}\r\n\r\nexport function createPanel(opts: PanelOpts): Mesh {\r\n const name = opts.name ?? \"panel\";\r\n const m = MeshBuilder.CreatePlane(name, { width: opts.width, height: opts.height }, opts.scene);\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.width,\r\n worldHeight: opts.height,\r\n });\r\n m.material = material;\r\n return m;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Billboard — panel that can be set to always face the camera */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface BillboardOpts extends PanelOpts {\r\n /** When true, mesh.billboardMode = ALL — always faces the camera. */\r\n faceCamera?: boolean;\r\n}\r\n\r\nexport function createBillboard(opts: BillboardOpts): Mesh {\r\n const m = createPanel({ ...opts, name: opts.name ?? \"billboard\" });\r\n if (opts.faceCamera) {\r\n m.billboardMode = Mesh.BILLBOARDMODE_ALL;\r\n }\r\n return m;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Building — rectangular box with optional facade texture */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface BuildingOpts {\r\n scene: Scene;\r\n name?: string;\r\n width: number;\r\n height: number;\r\n depth: number;\r\n /** Surface applied to all 6 faces (cheap path). */\r\n surface?: SurfaceContent;\r\n /** Per-face surfaces; missing faces use `surface` or a default grey. */\r\n faces?: Partial<Record<BoxFace, SurfaceContent>>;\r\n}\r\n\r\n/** Babylon box face indices (CreateBox): 0=front (-Z), 1=back (+Z), 2=right (+X), 3=left (-X), 4=top (+Y), 5=bottom (-Y). */\r\nexport type BoxFace = \"front\" | \"back\" | \"right\" | \"left\" | \"top\" | \"bottom\";\r\n\r\nconst BOX_FACE_ORDER: BoxFace[] = [\"front\", \"back\", \"right\", \"left\", \"top\", \"bottom\"];\r\n\r\nexport function createBuilding(opts: BuildingOpts): Mesh {\r\n const name = opts.name ?? \"building\";\r\n // If only a single uniform surface is given, take the cheap path.\r\n if (opts.surface && !opts.faces) {\r\n const box = MeshBuilder.CreateBox(name, { width: opts.width, height: opts.height, depth: opts.depth }, opts.scene);\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.width,\r\n worldHeight: opts.height,\r\n });\r\n box.material = material;\r\n return box;\r\n }\r\n\r\n // Per-face surfaces — Babylon's CreateBox supports `faceUV` to map sub-rects\r\n // of a single texture onto each face. We composite 6 sub-textures into one.\r\n const faceW = 256;\r\n const faceH = 256;\r\n const atlasW = faceW * 3;\r\n const atlasH = faceH * 2;\r\n const tex = new DynamicTexture(`${name}-atlas`, { width: atlasW * TEX_SCALE, height: atlasH * TEX_SCALE }, opts.scene, true);\r\n tex.vScale = -1;\r\n tex.vOffset = 1;\r\n const ctx = tex.getContext() as CanvasRenderingContext2D;\r\n ctx.scale(TEX_SCALE, TEX_SCALE);\r\n\r\n const faceUV: Vector4[] = [];\r\n BOX_FACE_ORDER.forEach((face, i) => {\r\n const col = i % 3;\r\n const row = Math.floor(i / 3);\r\n const fx = col * faceW;\r\n const fy = row * faceH;\r\n const surface = opts.faces?.[face] ?? opts.surface ?? { type: \"color\", color: \"#475569\" };\r\n ctx.save();\r\n ctx.translate(fx, fy);\r\n if (surface.type === \"color\") {\r\n ctx.fillStyle = surface.color;\r\n ctx.fillRect(0, 0, faceW, faceH);\r\n } else if (surface.type === \"paint\") {\r\n surface.paint(ctx, faceW, faceH);\r\n } else {\r\n paintWidget(ctx, surface.widget, faceW, faceH, surface.selected ?? false);\r\n }\r\n ctx.restore();\r\n\r\n // UV rect for this face within the atlas.\r\n faceUV.push(new Vector4(fx / atlasW, 1 - (fy + faceH) / atlasH, (fx + faceW) / atlasW, 1 - fy / atlasH));\r\n });\r\n tex.update(false);\r\n\r\n const mat = new StandardMaterial(`${name}-mat`, opts.scene);\r\n mat.diffuseTexture = tex;\r\n mat.emissiveTexture = tex;\r\n mat.emissiveColor = new Color3(0.4, 0.4, 0.4);\r\n mat.specularColor = new Color3(0.05, 0.05, 0.05);\r\n\r\n const box = MeshBuilder.CreateBox(name, {\r\n width: opts.width,\r\n height: opts.height,\r\n depth: opts.depth,\r\n faceUV,\r\n wrap: true,\r\n }, opts.scene);\r\n box.material = mat;\r\n return box;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Pillar — alias for a tall narrow building */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface PillarOpts {\r\n scene: Scene;\r\n name?: string;\r\n thickness: number;\r\n height: number;\r\n surface?: SurfaceContent;\r\n}\r\n\r\nexport function createPillar(opts: PillarOpts): Mesh {\r\n return createBuilding({\r\n scene: opts.scene,\r\n name: opts.name ?? \"pillar\",\r\n width: opts.thickness,\r\n depth: opts.thickness,\r\n height: opts.height,\r\n surface: opts.surface,\r\n });\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Cylinder — tube with content wrapping the side */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface CylinderOpts {\r\n scene: Scene;\r\n name?: string;\r\n radius: number;\r\n height: number;\r\n surface: SurfaceContent;\r\n tessellation?: number;\r\n}\r\n\r\nexport function createCylinder(opts: CylinderOpts): Mesh {\r\n const name = opts.name ?? \"cylinder\";\r\n const m = MeshBuilder.CreateCylinder(name, {\r\n diameter: opts.radius * 2,\r\n height: opts.height,\r\n tessellation: opts.tessellation ?? 48,\r\n }, opts.scene);\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.radius * 2 * Math.PI,\r\n worldHeight: opts.height,\r\n });\r\n m.material = material;\r\n return m;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* CurvedPanel — a partial cylindrical sheet (like a wraparound ad) */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface CurvedPanelOpts {\r\n scene: Scene;\r\n name?: string;\r\n width: number; // arc length\r\n height: number;\r\n arc: number; // radians spanned\r\n surface: SurfaceContent;\r\n tessellation?: number;\r\n}\r\n\r\nexport function createCurvedPanel(opts: CurvedPanelOpts): Mesh {\r\n const name = opts.name ?? \"curved-panel\";\r\n const radius = opts.width / opts.arc;\r\n // Build by creating a partial cylinder (arc fraction) with no caps.\r\n const tess = opts.tessellation ?? 48;\r\n const fullCircleSegments = Math.max(8, Math.ceil((tess * (Math.PI * 2)) / opts.arc));\r\n const m = MeshBuilder.CreateCylinder(name, {\r\n diameter: radius * 2,\r\n height: opts.height,\r\n tessellation: fullCircleSegments,\r\n arc: opts.arc / (Math.PI * 2),\r\n cap: Mesh.NO_CAP,\r\n sideOrientation: Mesh.DOUBLESIDE,\r\n }, opts.scene);\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.width,\r\n worldHeight: opts.height,\r\n });\r\n m.material = material;\r\n return m;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Sphere — full sphere with equirectangular surface */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface SphereOpts {\r\n scene: Scene;\r\n name?: string;\r\n diameter: number;\r\n surface: SurfaceContent;\r\n segments?: number;\r\n}\r\n\r\nexport function createSphere(opts: SphereOpts): Mesh {\r\n const name = opts.name ?? \"sphere\";\r\n const m = MeshBuilder.CreateSphere(name, { diameter: opts.diameter, segments: opts.segments ?? 32 }, opts.scene);\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.diameter * Math.PI,\r\n worldHeight: opts.diameter * Math.PI / 2,\r\n });\r\n m.material = material;\r\n return m;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Disc — flat disc/circle */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface DiscOpts {\r\n scene: Scene;\r\n name?: string;\r\n radius: number;\r\n surface: SurfaceContent;\r\n tessellation?: number;\r\n}\r\n\r\nexport function createDisc(opts: DiscOpts): Mesh {\r\n const name = opts.name ?? \"disc\";\r\n const m = MeshBuilder.CreateDisc(name, { radius: opts.radius, tessellation: opts.tessellation ?? 64 }, opts.scene);\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.radius * 2,\r\n worldHeight: opts.radius * 2,\r\n });\r\n m.material = material;\r\n return m;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Card3D — an extruded panel (gives panels physical depth) */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface Card3DOpts {\r\n scene: Scene;\r\n name?: string;\r\n width: number;\r\n height: number;\r\n /** Extrusion depth. Defaults to a thin 0.06 — like real foam-board signage. */\r\n depth?: number;\r\n /** Surface for the front face (the visible UI). */\r\n front: SurfaceContent;\r\n /** Surface for the side and back faces. Defaults to a dark color. */\r\n edge?: SurfaceContent;\r\n}\r\n\r\nexport function createCard3D(opts: Card3DOpts): Mesh {\r\n const name = opts.name ?? \"card3d\";\r\n const depth = opts.depth ?? 0.06;\r\n const edge = opts.edge ?? { type: \"color\" as const, color: \"#0b0f17\" };\r\n return createBuilding({\r\n scene: opts.scene,\r\n name,\r\n width: opts.width,\r\n height: opts.height,\r\n depth,\r\n faces: {\r\n front: opts.front,\r\n back: edge,\r\n top: edge,\r\n bottom: edge,\r\n left: edge,\r\n right: edge,\r\n },\r\n });\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Sign — a panel mounted on a post */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface SignOpts {\r\n scene: Scene;\r\n name?: string;\r\n /** Panel dimensions. */\r\n width: number;\r\n height: number;\r\n /** How tall the post is (from ground to bottom of panel). */\r\n postHeight?: number;\r\n /** Post thickness (square cross-section). */\r\n postThickness?: number;\r\n /** Panel surface (color, paint, or widget). */\r\n surface: SurfaceContent;\r\n /** Post color. */\r\n postColor?: string;\r\n}\r\n\r\nexport interface SignResult {\r\n /** Group containing the panel + post, parented at ground level. */\r\n root: Mesh;\r\n panel: Mesh;\r\n post: Mesh;\r\n}\r\n\r\nexport function createSign(opts: SignOpts): SignResult {\r\n const name = opts.name ?? \"sign\";\r\n const postHeight = opts.postHeight ?? 1.4;\r\n const postThickness = opts.postThickness ?? 0.12;\r\n const postColor = opts.postColor ?? \"#1f2937\";\r\n\r\n const root = new Mesh(`${name}-root`, opts.scene);\r\n\r\n const panel = createBillboard({\r\n scene: opts.scene,\r\n name: `${name}-panel`,\r\n width: opts.width,\r\n height: opts.height,\r\n surface: opts.surface,\r\n });\r\n panel.position = new Vector3(0, postHeight + opts.height / 2, 0);\r\n panel.parent = root;\r\n\r\n const post = MeshBuilder.CreateBox(`${name}-post`, {\r\n width: postThickness,\r\n height: postHeight,\r\n depth: postThickness,\r\n }, opts.scene);\r\n post.position = new Vector3(0, postHeight / 2, 0);\r\n const postMat = new StandardMaterial(`${name}-post-mat`, opts.scene);\r\n postMat.diffuseColor = Color3.FromHexString(postColor);\r\n post.material = postMat;\r\n post.parent = root;\r\n\r\n return { root, panel, post };\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Monitor — a 3D display: extruded bezel + recessed screen face */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface MonitorOpts {\r\n scene: Scene;\r\n name?: string;\r\n width: number;\r\n height: number;\r\n /** Front-to-back depth of the display chassis. Defaults to 0.18. */\r\n depth?: number;\r\n /** Bezel color. Defaults to near-black. */\r\n bezel?: string;\r\n /** Screen surface — color, paint, or widget. */\r\n screen: SurfaceContent;\r\n /** Optional kickstand height — when set, the monitor sits on a base. */\r\n standHeight?: number;\r\n}\r\n\r\nexport interface MonitorResult {\r\n root: Mesh;\r\n body: Mesh;\r\n screen: Mesh;\r\n stand?: Mesh;\r\n}\r\n\r\nexport function createMonitor(opts: MonitorOpts): MonitorResult {\r\n const name = opts.name ?? \"monitor\";\r\n const depth = opts.depth ?? 0.18;\r\n const bezelColor = opts.bezel ?? \"#0b0f17\";\r\n\r\n const root = new Mesh(`${name}-root`, opts.scene);\r\n\r\n // Body — extruded bezel\r\n const body = MeshBuilder.CreateBox(`${name}-body`, {\r\n width: opts.width,\r\n height: opts.height,\r\n depth,\r\n }, opts.scene);\r\n const bodyMat = new StandardMaterial(`${name}-body-mat`, opts.scene);\r\n bodyMat.diffuseColor = Color3.FromHexString(bezelColor);\r\n bodyMat.specularColor = new Color3(0.08, 0.08, 0.08);\r\n body.material = bodyMat;\r\n body.parent = root;\r\n\r\n // Screen face — sits flush at the front of the bezel\r\n const screenInset = 0.04;\r\n const screenW = opts.width - screenInset * 2;\r\n const screenH = opts.height - screenInset * 2;\r\n const screen = createPanel({\r\n scene: opts.scene,\r\n name: `${name}-screen`,\r\n width: screenW,\r\n height: screenH,\r\n surface: opts.screen,\r\n });\r\n // Front of the body is at z=-depth/2 (Babylon plane front faces -Z)\r\n screen.position = new Vector3(0, 0, -depth / 2 - 0.001);\r\n screen.parent = root;\r\n\r\n let stand: Mesh | undefined;\r\n if (opts.standHeight && opts.standHeight > 0) {\r\n stand = MeshBuilder.CreateBox(`${name}-stand`, {\r\n width: opts.width * 0.3,\r\n height: opts.standHeight,\r\n depth: depth * 1.5,\r\n }, opts.scene);\r\n stand.position = new Vector3(0, -opts.height / 2 - opts.standHeight / 2, 0);\r\n stand.material = bodyMat;\r\n stand.parent = root;\r\n }\r\n\r\n return { root, body, screen, stand };\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Decal — project a 2D pattern onto another mesh's surface */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface DecalOpts {\r\n scene: Scene;\r\n name?: string;\r\n /** The mesh to project the decal onto. */\r\n target: Mesh;\r\n /** World-space position the projector sits at. */\r\n position: Vector3;\r\n /** Direction the projector points. Defaults to -Z. */\r\n normal?: Vector3;\r\n /** Size of the decal box. */\r\n size: { width: number; height: number; depth?: number };\r\n /** Rotation around the projection axis (radians). */\r\n angle?: number;\r\n /** Surface to project. */\r\n surface: SurfaceContent;\r\n}\r\n\r\n/**\r\n * Projects a SurfaceContent onto `target`'s geometry. The decal conforms to\r\n * the underlying surface — useful for signage on curved walls, logos on\r\n * irregular terrain, graffiti on cylindrical surfaces, etc.\r\n */\r\nexport function createDecal(opts: DecalOpts): Mesh {\r\n const name = opts.name ?? \"decal\";\r\n const normal = opts.normal ?? new Vector3(0, 0, -1);\r\n const size = new Vector3(opts.size.width, opts.size.height, opts.size.depth ?? 1);\r\n\r\n const decal = MeshBuilder.CreateDecal(name, opts.target, {\r\n position: opts.position,\r\n normal,\r\n size,\r\n angle: opts.angle,\r\n });\r\n\r\n const { material } = buildSurface(opts.scene, name, opts.surface, {\r\n worldWidth: opts.size.width,\r\n worldHeight: opts.size.height,\r\n });\r\n // Decals need transparency to show the underlying mesh through their borders.\r\n if (\"hasAlpha\" in (material as StandardMaterial)) {\r\n (material as StandardMaterial).useAlphaFromDiffuseTexture = true;\r\n }\r\n decal.material = material;\r\n return decal;\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Helper: paint a widget onto a fresh DynamicTexture (escape hatch) */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport function createWidgetTexture(\r\n scene: Scene,\r\n name: string,\r\n widget: WidgetSpec,\r\n pixelWidth: number,\r\n pixelHeight: number,\r\n selected = false\r\n): DynamicTexture {\r\n const tex = new DynamicTexture(name, { width: pixelWidth * TEX_SCALE, height: pixelHeight * TEX_SCALE }, scene, true);\r\n tex.vScale = -1;\r\n tex.vOffset = 1;\r\n tex.hasAlpha = true;\r\n const ctx = tex.getContext() as CanvasRenderingContext2D;\r\n ctx.scale(TEX_SCALE, TEX_SCALE);\r\n paintWidget(ctx, widget, pixelWidth, pixelHeight, selected);\r\n tex.update(false);\r\n return tex;\r\n}\r\n","/**\r\n * BabylonJS adapter for `@particle-academy/fancy-3d`.\r\n *\r\n * Each widget kind paints onto a 2D HTMLCanvasElement that is uploaded to a\r\n * Babylon `DynamicTexture`, which is then applied to a plane mesh sized to\r\n * the widget's pixel rect. Edges become line meshes between node centers.\r\n *\r\n * `@babylonjs/core` is an OPTIONAL peer dependency — only consumers building\r\n * 3D scenes need to install it.\r\n */\r\nimport {\r\n Color3,\r\n DynamicTexture,\r\n MeshBuilder,\r\n StandardMaterial,\r\n Vector3,\r\n type Mesh,\r\n type Scene as BJScene,\r\n} from \"@babylonjs/core\";\r\nimport type {\r\n AdapterContext,\r\n Scene,\r\n SceneNode,\r\n WidgetAdapter,\r\n WidgetSpec,\r\n} from \"./scene\";\r\n\r\nimport { TEX_SCALE, paintWidget } from \"./painters\";\r\nexport { TEX_SCALE, paintWidget } from \"./painters\";\r\n\r\nconst WORLD_SCALE = 1 / 180; // pixels → world units\r\n\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Adapter */\r\n/* ------------------------------------------------------------------ */\r\n\r\nexport interface BabylonAdapterDeps {\r\n scene3D: BJScene;\r\n /** Pixel size for the widget (the scene node's `size` field). */\r\n sizeFor(spec: WidgetSpec): { w: number; h: number };\r\n}\r\n\r\nexport function createBabylonAdapter(deps: BabylonAdapterDeps): WidgetAdapter<Mesh> {\r\n return {\r\n render(spec: WidgetSpec, ctx: AdapterContext): Mesh {\r\n const { w, h } = deps.sizeFor(spec);\r\n const tex = new DynamicTexture(`tex-${ctx.nodeId}`, { width: w * TEX_SCALE, height: h * TEX_SCALE }, deps.scene3D, true);\r\n tex.hasAlpha = true;\r\n // Babylon plane UVs run V=0 at the bottom; canvas Y runs top-to-bottom.\r\n // Without this flip, painted content appears upside down on the mesh.\r\n tex.vScale = -1;\r\n tex.vOffset = 1;\r\n const c = tex.getContext() as CanvasRenderingContext2D;\r\n c.scale(TEX_SCALE, TEX_SCALE);\r\n paintWidget(c, spec, w, h, ctx.selected);\r\n tex.update(false);\r\n\r\n const mat = new StandardMaterial(`mat-${ctx.nodeId}`, deps.scene3D);\r\n mat.diffuseTexture = tex;\r\n mat.emissiveTexture = tex;\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = false;\r\n mat.useAlphaFromDiffuseTexture = true;\r\n\r\n const plane = MeshBuilder.CreatePlane(`node-${ctx.nodeId}`, { width: w * WORLD_SCALE, height: h * WORLD_SCALE }, deps.scene3D);\r\n plane.material = mat;\r\n plane.metadata = { nodeId: ctx.nodeId, kind: spec.kind };\r\n return plane;\r\n },\r\n };\r\n}\r\n\r\n/* ------------------------------------------------------------------ */\r\n/* Layout helpers */\r\n/* ------------------------------------------------------------------ */\r\n\r\n/**\r\n * \"3D Desktop\" layout — wraps the scene's 2D positions onto a partial\r\n * cylinder facing the camera. DOM `x` becomes angle around the cylinder,\r\n * DOM `y` becomes height.\r\n */\r\nexport function placeOnCylinder(node: SceneNode, mesh: Mesh, bounds: { minX: number; maxX: number; minY: number; maxY: number }, opts: { radius?: number; arc?: number } = {}) {\r\n const radius = opts.radius ?? 6;\r\n const arc = opts.arc ?? Math.PI * 0.9; // ~160°\r\n const rangeX = bounds.maxX - bounds.minX || 1;\r\n const rangeY = bounds.maxY - bounds.minY || 1;\r\n const cx = (node.position.x + (node.size?.w ?? 200) / 2 - bounds.minX) / rangeX;\r\n const cy = (node.position.y + (node.size?.h ?? 120) / 2 - bounds.minY) / rangeY;\r\n const angle = (cx - 0.5) * arc;\r\n const height = (0.5 - cy) * 6;\r\n mesh.position = new Vector3(Math.sin(angle) * radius, height, Math.cos(angle) * radius);\r\n // Rotate the plane around Y so its FRONT face (default plane normal: +Z)\r\n // points outward — toward the orbiting camera. Babylon's `lookAt` aimed\r\n // the back of the plane at the target, which read as mirrored text.\r\n mesh.rotation = new Vector3(0, angle, 0);\r\n}\r\n\r\nexport function sceneBounds(scene: Scene) {\r\n const xs = scene.nodes.map((n) => n.position.x);\r\n const ys = scene.nodes.map((n) => n.position.y);\r\n const xe = scene.nodes.map((n) => n.position.x + (n.size?.w ?? 200));\r\n const ye = scene.nodes.map((n) => n.position.y + (n.size?.h ?? 120));\r\n return {\r\n minX: Math.min(...xs),\r\n maxX: Math.max(...xe),\r\n minY: Math.min(...ys),\r\n maxY: Math.max(...ye),\r\n };\r\n}\r\n\r\n\r\nexport * from \"./primitives\";\r\n"]}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { Scene, Mesh, Vector3, DynamicTexture } from '@babylonjs/core';
|
|
2
|
+
import { WidgetSpec, WidgetAdapter, SceneNode, Scene as Scene$1 } from './index.cjs';
|
|
3
|
+
|
|
4
|
+
declare const TEX_SCALE = 2;
|
|
5
|
+
declare function paintWidget(ctx: CanvasRenderingContext2D, spec: WidgetSpec, w: number, h: number, selected: boolean): void;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 3D shape primitives for `@particle-academy/fancy-3d`.
|
|
9
|
+
*
|
|
10
|
+
* A primitive is a Babylon mesh that can host UI content on its surface —
|
|
11
|
+
* either a flat color, a freeform 2D paint callback, or a `WidgetSpec`
|
|
12
|
+
* rendered through the same painters as the Babylon adapter.
|
|
13
|
+
*
|
|
14
|
+
* Every primitive returns a `Mesh`, ready to position in your scene.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
type PaintFn = (ctx: CanvasRenderingContext2D, width: number, height: number) => void;
|
|
18
|
+
type SurfaceContent = {
|
|
19
|
+
type: "color";
|
|
20
|
+
color: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "paint";
|
|
23
|
+
paint: PaintFn;
|
|
24
|
+
pixelWidth?: number;
|
|
25
|
+
pixelHeight?: number;
|
|
26
|
+
transparent?: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
type: "widget";
|
|
29
|
+
widget: WidgetSpec;
|
|
30
|
+
pixelWidth?: number;
|
|
31
|
+
pixelHeight?: number;
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
};
|
|
34
|
+
interface PanelOpts {
|
|
35
|
+
scene: Scene;
|
|
36
|
+
name?: string;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
surface: SurfaceContent;
|
|
40
|
+
}
|
|
41
|
+
declare function createPanel(opts: PanelOpts): Mesh;
|
|
42
|
+
interface BillboardOpts extends PanelOpts {
|
|
43
|
+
/** When true, mesh.billboardMode = ALL — always faces the camera. */
|
|
44
|
+
faceCamera?: boolean;
|
|
45
|
+
}
|
|
46
|
+
declare function createBillboard(opts: BillboardOpts): Mesh;
|
|
47
|
+
interface BuildingOpts {
|
|
48
|
+
scene: Scene;
|
|
49
|
+
name?: string;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
depth: number;
|
|
53
|
+
/** Surface applied to all 6 faces (cheap path). */
|
|
54
|
+
surface?: SurfaceContent;
|
|
55
|
+
/** Per-face surfaces; missing faces use `surface` or a default grey. */
|
|
56
|
+
faces?: Partial<Record<BoxFace, SurfaceContent>>;
|
|
57
|
+
}
|
|
58
|
+
/** Babylon box face indices (CreateBox): 0=front (-Z), 1=back (+Z), 2=right (+X), 3=left (-X), 4=top (+Y), 5=bottom (-Y). */
|
|
59
|
+
type BoxFace = "front" | "back" | "right" | "left" | "top" | "bottom";
|
|
60
|
+
declare function createBuilding(opts: BuildingOpts): Mesh;
|
|
61
|
+
interface PillarOpts {
|
|
62
|
+
scene: Scene;
|
|
63
|
+
name?: string;
|
|
64
|
+
thickness: number;
|
|
65
|
+
height: number;
|
|
66
|
+
surface?: SurfaceContent;
|
|
67
|
+
}
|
|
68
|
+
declare function createPillar(opts: PillarOpts): Mesh;
|
|
69
|
+
interface CylinderOpts {
|
|
70
|
+
scene: Scene;
|
|
71
|
+
name?: string;
|
|
72
|
+
radius: number;
|
|
73
|
+
height: number;
|
|
74
|
+
surface: SurfaceContent;
|
|
75
|
+
tessellation?: number;
|
|
76
|
+
}
|
|
77
|
+
declare function createCylinder(opts: CylinderOpts): Mesh;
|
|
78
|
+
interface CurvedPanelOpts {
|
|
79
|
+
scene: Scene;
|
|
80
|
+
name?: string;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
arc: number;
|
|
84
|
+
surface: SurfaceContent;
|
|
85
|
+
tessellation?: number;
|
|
86
|
+
}
|
|
87
|
+
declare function createCurvedPanel(opts: CurvedPanelOpts): Mesh;
|
|
88
|
+
interface SphereOpts {
|
|
89
|
+
scene: Scene;
|
|
90
|
+
name?: string;
|
|
91
|
+
diameter: number;
|
|
92
|
+
surface: SurfaceContent;
|
|
93
|
+
segments?: number;
|
|
94
|
+
}
|
|
95
|
+
declare function createSphere(opts: SphereOpts): Mesh;
|
|
96
|
+
interface DiscOpts {
|
|
97
|
+
scene: Scene;
|
|
98
|
+
name?: string;
|
|
99
|
+
radius: number;
|
|
100
|
+
surface: SurfaceContent;
|
|
101
|
+
tessellation?: number;
|
|
102
|
+
}
|
|
103
|
+
declare function createDisc(opts: DiscOpts): Mesh;
|
|
104
|
+
interface Card3DOpts {
|
|
105
|
+
scene: Scene;
|
|
106
|
+
name?: string;
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
/** Extrusion depth. Defaults to a thin 0.06 — like real foam-board signage. */
|
|
110
|
+
depth?: number;
|
|
111
|
+
/** Surface for the front face (the visible UI). */
|
|
112
|
+
front: SurfaceContent;
|
|
113
|
+
/** Surface for the side and back faces. Defaults to a dark color. */
|
|
114
|
+
edge?: SurfaceContent;
|
|
115
|
+
}
|
|
116
|
+
declare function createCard3D(opts: Card3DOpts): Mesh;
|
|
117
|
+
interface SignOpts {
|
|
118
|
+
scene: Scene;
|
|
119
|
+
name?: string;
|
|
120
|
+
/** Panel dimensions. */
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
/** How tall the post is (from ground to bottom of panel). */
|
|
124
|
+
postHeight?: number;
|
|
125
|
+
/** Post thickness (square cross-section). */
|
|
126
|
+
postThickness?: number;
|
|
127
|
+
/** Panel surface (color, paint, or widget). */
|
|
128
|
+
surface: SurfaceContent;
|
|
129
|
+
/** Post color. */
|
|
130
|
+
postColor?: string;
|
|
131
|
+
}
|
|
132
|
+
interface SignResult {
|
|
133
|
+
/** Group containing the panel + post, parented at ground level. */
|
|
134
|
+
root: Mesh;
|
|
135
|
+
panel: Mesh;
|
|
136
|
+
post: Mesh;
|
|
137
|
+
}
|
|
138
|
+
declare function createSign(opts: SignOpts): SignResult;
|
|
139
|
+
interface MonitorOpts {
|
|
140
|
+
scene: Scene;
|
|
141
|
+
name?: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
/** Front-to-back depth of the display chassis. Defaults to 0.18. */
|
|
145
|
+
depth?: number;
|
|
146
|
+
/** Bezel color. Defaults to near-black. */
|
|
147
|
+
bezel?: string;
|
|
148
|
+
/** Screen surface — color, paint, or widget. */
|
|
149
|
+
screen: SurfaceContent;
|
|
150
|
+
/** Optional kickstand height — when set, the monitor sits on a base. */
|
|
151
|
+
standHeight?: number;
|
|
152
|
+
}
|
|
153
|
+
interface MonitorResult {
|
|
154
|
+
root: Mesh;
|
|
155
|
+
body: Mesh;
|
|
156
|
+
screen: Mesh;
|
|
157
|
+
stand?: Mesh;
|
|
158
|
+
}
|
|
159
|
+
declare function createMonitor(opts: MonitorOpts): MonitorResult;
|
|
160
|
+
interface DecalOpts {
|
|
161
|
+
scene: Scene;
|
|
162
|
+
name?: string;
|
|
163
|
+
/** The mesh to project the decal onto. */
|
|
164
|
+
target: Mesh;
|
|
165
|
+
/** World-space position the projector sits at. */
|
|
166
|
+
position: Vector3;
|
|
167
|
+
/** Direction the projector points. Defaults to -Z. */
|
|
168
|
+
normal?: Vector3;
|
|
169
|
+
/** Size of the decal box. */
|
|
170
|
+
size: {
|
|
171
|
+
width: number;
|
|
172
|
+
height: number;
|
|
173
|
+
depth?: number;
|
|
174
|
+
};
|
|
175
|
+
/** Rotation around the projection axis (radians). */
|
|
176
|
+
angle?: number;
|
|
177
|
+
/** Surface to project. */
|
|
178
|
+
surface: SurfaceContent;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Projects a SurfaceContent onto `target`'s geometry. The decal conforms to
|
|
182
|
+
* the underlying surface — useful for signage on curved walls, logos on
|
|
183
|
+
* irregular terrain, graffiti on cylindrical surfaces, etc.
|
|
184
|
+
*/
|
|
185
|
+
declare function createDecal(opts: DecalOpts): Mesh;
|
|
186
|
+
declare function createWidgetTexture(scene: Scene, name: string, widget: WidgetSpec, pixelWidth: number, pixelHeight: number, selected?: boolean): DynamicTexture;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* BabylonJS adapter for `@particle-academy/fancy-3d`.
|
|
190
|
+
*
|
|
191
|
+
* Each widget kind paints onto a 2D HTMLCanvasElement that is uploaded to a
|
|
192
|
+
* Babylon `DynamicTexture`, which is then applied to a plane mesh sized to
|
|
193
|
+
* the widget's pixel rect. Edges become line meshes between node centers.
|
|
194
|
+
*
|
|
195
|
+
* `@babylonjs/core` is an OPTIONAL peer dependency — only consumers building
|
|
196
|
+
* 3D scenes need to install it.
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
interface BabylonAdapterDeps {
|
|
200
|
+
scene3D: Scene;
|
|
201
|
+
/** Pixel size for the widget (the scene node's `size` field). */
|
|
202
|
+
sizeFor(spec: WidgetSpec): {
|
|
203
|
+
w: number;
|
|
204
|
+
h: number;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
declare function createBabylonAdapter(deps: BabylonAdapterDeps): WidgetAdapter<Mesh>;
|
|
208
|
+
/**
|
|
209
|
+
* "3D Desktop" layout — wraps the scene's 2D positions onto a partial
|
|
210
|
+
* cylinder facing the camera. DOM `x` becomes angle around the cylinder,
|
|
211
|
+
* DOM `y` becomes height.
|
|
212
|
+
*/
|
|
213
|
+
declare function placeOnCylinder(node: SceneNode, mesh: Mesh, bounds: {
|
|
214
|
+
minX: number;
|
|
215
|
+
maxX: number;
|
|
216
|
+
minY: number;
|
|
217
|
+
maxY: number;
|
|
218
|
+
}, opts?: {
|
|
219
|
+
radius?: number;
|
|
220
|
+
arc?: number;
|
|
221
|
+
}): void;
|
|
222
|
+
declare function sceneBounds(scene: Scene$1): {
|
|
223
|
+
minX: number;
|
|
224
|
+
maxX: number;
|
|
225
|
+
minY: number;
|
|
226
|
+
maxY: number;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export { type BabylonAdapterDeps, type BillboardOpts, type BoxFace, type BuildingOpts, type Card3DOpts, type CurvedPanelOpts, type CylinderOpts, type DecalOpts, type DiscOpts, type MonitorOpts, type MonitorResult, type PaintFn, type PanelOpts, type PillarOpts, type SignOpts, type SignResult, type SphereOpts, type SurfaceContent, TEX_SCALE, createBabylonAdapter, createBillboard, createBuilding, createCard3D, createCurvedPanel, createCylinder, createDecal, createDisc, createMonitor, createPanel, createPillar, createSign, createSphere, createWidgetTexture, paintWidget, placeOnCylinder, sceneBounds };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { Scene, Mesh, Vector3, DynamicTexture } from '@babylonjs/core';
|
|
2
|
+
import { WidgetSpec, WidgetAdapter, SceneNode, Scene as Scene$1 } from './index.js';
|
|
3
|
+
|
|
4
|
+
declare const TEX_SCALE = 2;
|
|
5
|
+
declare function paintWidget(ctx: CanvasRenderingContext2D, spec: WidgetSpec, w: number, h: number, selected: boolean): void;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 3D shape primitives for `@particle-academy/fancy-3d`.
|
|
9
|
+
*
|
|
10
|
+
* A primitive is a Babylon mesh that can host UI content on its surface —
|
|
11
|
+
* either a flat color, a freeform 2D paint callback, or a `WidgetSpec`
|
|
12
|
+
* rendered through the same painters as the Babylon adapter.
|
|
13
|
+
*
|
|
14
|
+
* Every primitive returns a `Mesh`, ready to position in your scene.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
type PaintFn = (ctx: CanvasRenderingContext2D, width: number, height: number) => void;
|
|
18
|
+
type SurfaceContent = {
|
|
19
|
+
type: "color";
|
|
20
|
+
color: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "paint";
|
|
23
|
+
paint: PaintFn;
|
|
24
|
+
pixelWidth?: number;
|
|
25
|
+
pixelHeight?: number;
|
|
26
|
+
transparent?: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
type: "widget";
|
|
29
|
+
widget: WidgetSpec;
|
|
30
|
+
pixelWidth?: number;
|
|
31
|
+
pixelHeight?: number;
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
};
|
|
34
|
+
interface PanelOpts {
|
|
35
|
+
scene: Scene;
|
|
36
|
+
name?: string;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
surface: SurfaceContent;
|
|
40
|
+
}
|
|
41
|
+
declare function createPanel(opts: PanelOpts): Mesh;
|
|
42
|
+
interface BillboardOpts extends PanelOpts {
|
|
43
|
+
/** When true, mesh.billboardMode = ALL — always faces the camera. */
|
|
44
|
+
faceCamera?: boolean;
|
|
45
|
+
}
|
|
46
|
+
declare function createBillboard(opts: BillboardOpts): Mesh;
|
|
47
|
+
interface BuildingOpts {
|
|
48
|
+
scene: Scene;
|
|
49
|
+
name?: string;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
depth: number;
|
|
53
|
+
/** Surface applied to all 6 faces (cheap path). */
|
|
54
|
+
surface?: SurfaceContent;
|
|
55
|
+
/** Per-face surfaces; missing faces use `surface` or a default grey. */
|
|
56
|
+
faces?: Partial<Record<BoxFace, SurfaceContent>>;
|
|
57
|
+
}
|
|
58
|
+
/** Babylon box face indices (CreateBox): 0=front (-Z), 1=back (+Z), 2=right (+X), 3=left (-X), 4=top (+Y), 5=bottom (-Y). */
|
|
59
|
+
type BoxFace = "front" | "back" | "right" | "left" | "top" | "bottom";
|
|
60
|
+
declare function createBuilding(opts: BuildingOpts): Mesh;
|
|
61
|
+
interface PillarOpts {
|
|
62
|
+
scene: Scene;
|
|
63
|
+
name?: string;
|
|
64
|
+
thickness: number;
|
|
65
|
+
height: number;
|
|
66
|
+
surface?: SurfaceContent;
|
|
67
|
+
}
|
|
68
|
+
declare function createPillar(opts: PillarOpts): Mesh;
|
|
69
|
+
interface CylinderOpts {
|
|
70
|
+
scene: Scene;
|
|
71
|
+
name?: string;
|
|
72
|
+
radius: number;
|
|
73
|
+
height: number;
|
|
74
|
+
surface: SurfaceContent;
|
|
75
|
+
tessellation?: number;
|
|
76
|
+
}
|
|
77
|
+
declare function createCylinder(opts: CylinderOpts): Mesh;
|
|
78
|
+
interface CurvedPanelOpts {
|
|
79
|
+
scene: Scene;
|
|
80
|
+
name?: string;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
arc: number;
|
|
84
|
+
surface: SurfaceContent;
|
|
85
|
+
tessellation?: number;
|
|
86
|
+
}
|
|
87
|
+
declare function createCurvedPanel(opts: CurvedPanelOpts): Mesh;
|
|
88
|
+
interface SphereOpts {
|
|
89
|
+
scene: Scene;
|
|
90
|
+
name?: string;
|
|
91
|
+
diameter: number;
|
|
92
|
+
surface: SurfaceContent;
|
|
93
|
+
segments?: number;
|
|
94
|
+
}
|
|
95
|
+
declare function createSphere(opts: SphereOpts): Mesh;
|
|
96
|
+
interface DiscOpts {
|
|
97
|
+
scene: Scene;
|
|
98
|
+
name?: string;
|
|
99
|
+
radius: number;
|
|
100
|
+
surface: SurfaceContent;
|
|
101
|
+
tessellation?: number;
|
|
102
|
+
}
|
|
103
|
+
declare function createDisc(opts: DiscOpts): Mesh;
|
|
104
|
+
interface Card3DOpts {
|
|
105
|
+
scene: Scene;
|
|
106
|
+
name?: string;
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
/** Extrusion depth. Defaults to a thin 0.06 — like real foam-board signage. */
|
|
110
|
+
depth?: number;
|
|
111
|
+
/** Surface for the front face (the visible UI). */
|
|
112
|
+
front: SurfaceContent;
|
|
113
|
+
/** Surface for the side and back faces. Defaults to a dark color. */
|
|
114
|
+
edge?: SurfaceContent;
|
|
115
|
+
}
|
|
116
|
+
declare function createCard3D(opts: Card3DOpts): Mesh;
|
|
117
|
+
interface SignOpts {
|
|
118
|
+
scene: Scene;
|
|
119
|
+
name?: string;
|
|
120
|
+
/** Panel dimensions. */
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
/** How tall the post is (from ground to bottom of panel). */
|
|
124
|
+
postHeight?: number;
|
|
125
|
+
/** Post thickness (square cross-section). */
|
|
126
|
+
postThickness?: number;
|
|
127
|
+
/** Panel surface (color, paint, or widget). */
|
|
128
|
+
surface: SurfaceContent;
|
|
129
|
+
/** Post color. */
|
|
130
|
+
postColor?: string;
|
|
131
|
+
}
|
|
132
|
+
interface SignResult {
|
|
133
|
+
/** Group containing the panel + post, parented at ground level. */
|
|
134
|
+
root: Mesh;
|
|
135
|
+
panel: Mesh;
|
|
136
|
+
post: Mesh;
|
|
137
|
+
}
|
|
138
|
+
declare function createSign(opts: SignOpts): SignResult;
|
|
139
|
+
interface MonitorOpts {
|
|
140
|
+
scene: Scene;
|
|
141
|
+
name?: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
/** Front-to-back depth of the display chassis. Defaults to 0.18. */
|
|
145
|
+
depth?: number;
|
|
146
|
+
/** Bezel color. Defaults to near-black. */
|
|
147
|
+
bezel?: string;
|
|
148
|
+
/** Screen surface — color, paint, or widget. */
|
|
149
|
+
screen: SurfaceContent;
|
|
150
|
+
/** Optional kickstand height — when set, the monitor sits on a base. */
|
|
151
|
+
standHeight?: number;
|
|
152
|
+
}
|
|
153
|
+
interface MonitorResult {
|
|
154
|
+
root: Mesh;
|
|
155
|
+
body: Mesh;
|
|
156
|
+
screen: Mesh;
|
|
157
|
+
stand?: Mesh;
|
|
158
|
+
}
|
|
159
|
+
declare function createMonitor(opts: MonitorOpts): MonitorResult;
|
|
160
|
+
interface DecalOpts {
|
|
161
|
+
scene: Scene;
|
|
162
|
+
name?: string;
|
|
163
|
+
/** The mesh to project the decal onto. */
|
|
164
|
+
target: Mesh;
|
|
165
|
+
/** World-space position the projector sits at. */
|
|
166
|
+
position: Vector3;
|
|
167
|
+
/** Direction the projector points. Defaults to -Z. */
|
|
168
|
+
normal?: Vector3;
|
|
169
|
+
/** Size of the decal box. */
|
|
170
|
+
size: {
|
|
171
|
+
width: number;
|
|
172
|
+
height: number;
|
|
173
|
+
depth?: number;
|
|
174
|
+
};
|
|
175
|
+
/** Rotation around the projection axis (radians). */
|
|
176
|
+
angle?: number;
|
|
177
|
+
/** Surface to project. */
|
|
178
|
+
surface: SurfaceContent;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Projects a SurfaceContent onto `target`'s geometry. The decal conforms to
|
|
182
|
+
* the underlying surface — useful for signage on curved walls, logos on
|
|
183
|
+
* irregular terrain, graffiti on cylindrical surfaces, etc.
|
|
184
|
+
*/
|
|
185
|
+
declare function createDecal(opts: DecalOpts): Mesh;
|
|
186
|
+
declare function createWidgetTexture(scene: Scene, name: string, widget: WidgetSpec, pixelWidth: number, pixelHeight: number, selected?: boolean): DynamicTexture;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* BabylonJS adapter for `@particle-academy/fancy-3d`.
|
|
190
|
+
*
|
|
191
|
+
* Each widget kind paints onto a 2D HTMLCanvasElement that is uploaded to a
|
|
192
|
+
* Babylon `DynamicTexture`, which is then applied to a plane mesh sized to
|
|
193
|
+
* the widget's pixel rect. Edges become line meshes between node centers.
|
|
194
|
+
*
|
|
195
|
+
* `@babylonjs/core` is an OPTIONAL peer dependency — only consumers building
|
|
196
|
+
* 3D scenes need to install it.
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
interface BabylonAdapterDeps {
|
|
200
|
+
scene3D: Scene;
|
|
201
|
+
/** Pixel size for the widget (the scene node's `size` field). */
|
|
202
|
+
sizeFor(spec: WidgetSpec): {
|
|
203
|
+
w: number;
|
|
204
|
+
h: number;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
declare function createBabylonAdapter(deps: BabylonAdapterDeps): WidgetAdapter<Mesh>;
|
|
208
|
+
/**
|
|
209
|
+
* "3D Desktop" layout — wraps the scene's 2D positions onto a partial
|
|
210
|
+
* cylinder facing the camera. DOM `x` becomes angle around the cylinder,
|
|
211
|
+
* DOM `y` becomes height.
|
|
212
|
+
*/
|
|
213
|
+
declare function placeOnCylinder(node: SceneNode, mesh: Mesh, bounds: {
|
|
214
|
+
minX: number;
|
|
215
|
+
maxX: number;
|
|
216
|
+
minY: number;
|
|
217
|
+
maxY: number;
|
|
218
|
+
}, opts?: {
|
|
219
|
+
radius?: number;
|
|
220
|
+
arc?: number;
|
|
221
|
+
}): void;
|
|
222
|
+
declare function sceneBounds(scene: Scene$1): {
|
|
223
|
+
minX: number;
|
|
224
|
+
maxX: number;
|
|
225
|
+
minY: number;
|
|
226
|
+
maxY: number;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export { type BabylonAdapterDeps, type BillboardOpts, type BoxFace, type BuildingOpts, type Card3DOpts, type CurvedPanelOpts, type CylinderOpts, type DecalOpts, type DiscOpts, type MonitorOpts, type MonitorResult, type PaintFn, type PanelOpts, type PillarOpts, type SignOpts, type SignResult, type SphereOpts, type SurfaceContent, TEX_SCALE, createBabylonAdapter, createBillboard, createBuilding, createCard3D, createCurvedPanel, createCylinder, createDecal, createDisc, createMonitor, createPanel, createPillar, createSign, createSphere, createWidgetTexture, paintWidget, placeOnCylinder, sceneBounds };
|