@plasius/gpu-shared 0.1.11 → 0.1.14

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +58 -3
  2. package/README.md +110 -4
  3. package/assets/brigantine.gltf +549 -24
  4. package/assets/cutter.gltf +538 -0
  5. package/assets/harbor-dock.gltf +680 -0
  6. package/assets/lighthouse.gltf +604 -0
  7. package/dist/chunk-2GM64LB6.js +9 -0
  8. package/dist/chunk-2GM64LB6.js.map +1 -0
  9. package/dist/chunk-3ARPGHCQ.js +119 -0
  10. package/dist/chunk-3ARPGHCQ.js.map +1 -0
  11. package/dist/chunk-4ZJ24VRS.js +402 -0
  12. package/dist/chunk-4ZJ24VRS.js.map +1 -0
  13. package/dist/chunk-W5GA3VA6.js +442 -0
  14. package/dist/chunk-W5GA3VA6.js.map +1 -0
  15. package/dist/gltf-loader-YDPLZS5Q.js +8 -0
  16. package/dist/index.cjs +2432 -6424
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +45 -6
  19. package/dist/index.js.map +1 -1
  20. package/dist/product-studio-runtime-HDAUDWYO.js +11 -0
  21. package/dist/showcase-inline-assets-WT4PSNKI.js +7 -0
  22. package/dist/showcase-inline-assets-WT4PSNKI.js.map +1 -0
  23. package/dist/showcase-runtime-SNCUFSSC.js +3785 -0
  24. package/dist/showcase-runtime-SNCUFSSC.js.map +1 -0
  25. package/package.json +20 -8
  26. package/src/asset-url.js +62 -11
  27. package/src/feature-flags.js +2 -0
  28. package/src/gltf-loader.js +330 -32
  29. package/src/i18n.js +71 -0
  30. package/src/index.d.ts +187 -2
  31. package/src/index.js +42 -1
  32. package/src/product-studio-runtime.js +465 -0
  33. package/src/showcase-inline-assets.js +3 -0
  34. package/src/showcase-runtime.js +1779 -252
  35. package/src/translations/en-GB.js +55 -0
  36. package/dist/chunk-DGUM43GV.js +0 -11
  37. package/dist/chunk-OTCJ3VOK.js +0 -35
  38. package/dist/chunk-OTCJ3VOK.js.map +0 -1
  39. package/dist/chunk-QBMXJ3V2.js +0 -142
  40. package/dist/chunk-QBMXJ3V2.js.map +0 -1
  41. package/dist/gltf-loader-LKALCZAV.js +0 -8
  42. package/dist/showcase-runtime-2ZNPKD7D.js +0 -8593
  43. package/dist/showcase-runtime-2ZNPKD7D.js.map +0 -1
  44. /package/dist/{chunk-DGUM43GV.js.map → gltf-loader-YDPLZS5Q.js.map} +0 -0
  45. /package/dist/{gltf-loader-LKALCZAV.js.map → product-studio-runtime-HDAUDWYO.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,13 +5,68 @@ All notable changes to this project will be documented in this file.
5
5
  ## [Unreleased]
6
6
 
7
7
  - **Added**
8
- - (placeholder)
8
+ - Deterministic showcase asset generation for a richer shared brigantine,
9
+ cutter, lighthouse, and harbor-dock catalog.
10
+ - Fullscreen capture mode for slide-deck screenshots and video recording,
11
+ including scene-only layout and bounded 1080p canvas scaling.
12
+ - Bundled `en-GB` translation keys and dictionaries for shared showcase labels
13
+ that can be consumed through `@plasius/translations`.
14
+ - Added Product Studio mode routing for `mountGpuShowcase(...)`, including
15
+ Eames GLTF loading, source triangle mesh submission, and
16
+ delegation to the `@plasius/gpu-renderer` WebGPU wavefront renderer.
9
17
 
10
18
  - **Changed**
11
- - (placeholder)
19
+ - Documented that project-wide display-quality path tracing requires renderer
20
+ mesh BVH intersections and triangle normals; bounded model proxies are now
21
+ disabled rather than exposed as a debug bridge.
22
+ - Product Studio now submits GLTF primitive mesh inputs to the renderer with
23
+ `displayQuality: true` instead of submitting analytic scene objects.
24
+ - Product Studio wavefront rendering now consumes
25
+ `@plasius/gpu-lighting` environment presets when available instead of
26
+ relying only on local hardcoded environment colours.
27
+ - Product Studio now defaults to 8 wavefront samples per pixel for the Eames
28
+ quality benchmark and uses a rough studio floor to avoid unresolved
29
+ low-sample reflection noise dominating the preview.
30
+ - Product Studio now preserves a 16:9 canvas presentation ratio inside
31
+ flexible host layouts so benchmark renders are not stretched by non-16:9
32
+ containers.
33
+ - Refactored feature loading so `@plasius/gpu-shared` uses injectable
34
+ `__showcaseFeatureLoaders` for cloth/fluid/lighting/performance/debug/
35
+ physics contracts and no longer imports sibling feature packages directly.
36
+ - Routed showcase chrome and debug allocation labels through package-owned
37
+ translation keys with an optional consumer translator override.
38
+ - Expanded the shared GLTF loader contract to preserve the legacy flattened
39
+ mesh fields while exposing transformed multi-primitive/material data for the
40
+ realistic showcase scene.
41
+ - The shared harbor runtime now renders distinct ship models and modeled
42
+ harbor structures instead of one tiny hull mesh plus placeholder boxes.
43
+ - Showcase lighting now adds local lantern response, a lighthouse beam pass,
44
+ and a subtle atmospheric grade for more realistic recorded frames.
45
+ - Declared `@plasius/gpu-renderer` as an optional Product Studio peer instead
46
+ of a harbor/showcase hard dependency.
12
47
 
13
48
  - **Fixed**
14
- - (placeholder)
49
+ - Restored the package CD workflow so protected `main` releases are prepared by PR and published without direct branch pushes.
50
+ - The shared showcase now propagates the realistic-model feature flag into
51
+ scene state and initializes its DOM scaffold before canvas setup, allowing
52
+ the local realistic asset catalog to mount in browser demos.
53
+ - Generated cylindrical showcase geometry now emits outward-facing side
54
+ winding, so towers, posts, masts, and lanterns no longer carry inverted side
55
+ normals.
56
+ - Generated cylindrical showcase geometry now carries smooth radial side
57
+ normals, reducing the faceted placeholder look on lighthouse bands, masts,
58
+ posts, and lantern glass.
59
+ - The showcase renderer now culls with geometric face normals while shading
60
+ with smoothed asset normals, keeping curved surfaces stable at glancing
61
+ camera angles.
62
+ - The generated lighthouse, mast, lantern, and dock-post assets now use denser
63
+ radial geometry for cleaner silhouettes in recording shots.
64
+ - Showcase shading now applies subtle deterministic material grain and
65
+ lower-surface wear so wood, stone, painted hulls, and plaster read less like
66
+ flat placeholder fills.
67
+ - Low-lying ship triangles no longer pick up the water reflection term just
68
+ because they are near the shoreline plane, so hulls stop reading like
69
+ reflective water surfaces.
15
70
 
16
71
  - **Security**
17
72
  - (placeholder)
package/README.md CHANGED
@@ -23,16 +23,22 @@ npm install @plasius/gpu-shared
23
23
 
24
24
  - Moves shared 3D showcase/demo runtime ownership out of `gpu-demo-viewer`.
25
25
  - Provides one package home for GLTF loading and harbor/showcase mounting.
26
- - Reuses `@plasius/gpu-cloth`, `@plasius/gpu-fluid`, `@plasius/gpu-lighting`,
27
- `@plasius/gpu-performance`, `@plasius/gpu-debug`, and browser-safe physics
28
- planning from `@plasius/gpu-physics/browser`.
26
+ - Coordinates cloth, fluid, lighting, performance, debug, and physics integration
27
+ through explicit feature adapters supplied by family packages at mount time.
29
28
  - Keeps package demos aligned on the same family-owned scene contract instead of
30
29
  carrying duplicated runtime copies.
31
30
  - Preserves one shared fix point for cloth motion, visible water continuity, and
32
31
  occluded harbor-light reflections across GPU demo consumers.
32
+ - Ships a package-owned showcase asset catalog with distinct brigantine,
33
+ cutter, lighthouse, and harbor-dock models instead of relying on one tiny
34
+ hull mesh plus placeholder box geometry.
33
35
 
34
36
  ## Usage
35
37
 
38
+ The package remains feature-contract neutral at install time; family packages
39
+ inject domain contracts through `__showcaseFeatureLoaders` so `gpu-shared` does
40
+ not hard-reference package-private imports.
41
+
36
42
  ```js
37
43
  import { mountGpuShowcase } from "@plasius/gpu-shared";
38
44
 
@@ -47,6 +53,84 @@ const showcase = await mountGpuShowcase({
47
53
  showcase.destroy();
48
54
  ```
49
55
 
56
+ ```js
57
+ await mountGpuShowcase({
58
+ packageName: "@plasius/gpu-cloth",
59
+ __showcaseFeatureLoaders: {
60
+ cloth: () => import("@plasius/gpu-cloth/dist/index.js"),
61
+ },
62
+ });
63
+ ```
64
+
65
+ ### Showcase Translations
66
+
67
+ The shared showcase owns its display keys and bundled `en-GB` defaults without
68
+ making the browser runtime React-bound. Consumers that already use
69
+ `@plasius/translations` can register the package dictionary and pass a
70
+ translator into `mountGpuShowcase`:
71
+
72
+ ```js
73
+ import { createI18n } from "@plasius/translations";
74
+ import {
75
+ gpuSharedTranslationKeys,
76
+ gpuSharedTranslations,
77
+ mountGpuShowcase,
78
+ } from "@plasius/gpu-shared";
79
+
80
+ const i18n = createI18n({
81
+ language: "en-GB",
82
+ fallback: "en-GB",
83
+ translations: gpuSharedTranslations,
84
+ });
85
+
86
+ await mountGpuShowcase({
87
+ root: document.getElementById("app"),
88
+ translate: (key, args) => i18n.t(key, args),
89
+ });
90
+
91
+ console.log(i18n.t(gpuSharedTranslationKeys.debugMainColorBuffer));
92
+ ```
93
+
94
+ ### Product Studio Mode
95
+
96
+ Consumers can route the shared showcase entrypoint to Product Studio by passing
97
+ `demoMode: "product-studio"` and a Product Studio GLTF URL. This mode loads the
98
+ model with the shared GLTF loader and delegates GPU execution to
99
+ `@plasius/gpu-renderer`.
100
+ Product Studio submits source triangle mesh data to the renderer. Display-quality
101
+ path tracing anywhere in the project requires the renderer mesh BVH path so ray
102
+ hits use source triangles, barycentric data, geometric normals, and interpolated
103
+ vertex normals for bounce decisions.
104
+ When `@plasius/gpu-lighting` exposes `createWavefrontEnvironmentLightingOptions`,
105
+ Product Studio uses the lighting-owned `product-studio` environment preset;
106
+ older installed lighting packages fall back to the previous local colours.
107
+ The shared Product Studio adapter defaults to 8 samples per pixel for the
108
+ Eames-quality benchmark render and uses a rough studio floor so the current
109
+ single-frame preview is not dominated by unresolved low-sample reflection
110
+ noise. The Product Studio canvas preserves a 16:9 presentation ratio inside
111
+ flexible host layouts so the rendered product is not stretched by non-16:9
112
+ containers.
113
+
114
+ ```js
115
+ import { mountGpuShowcase } from "@plasius/gpu-shared";
116
+
117
+ await mountGpuShowcase({
118
+ root: document.getElementById("app"),
119
+ demoMode: "product-studio",
120
+ productAssetUrl:
121
+ "/data/models/eames-lounge-chair-ottoman/Eames_Lounge_Chair_Ottoman.gltf",
122
+ samplesPerPixel: 8,
123
+ });
124
+ ```
125
+
126
+ The legacy analytic proxy scene-object path is disabled and is not a customer
127
+ visible fallback. Stale callers must move to `createProductStudioMeshes(...)`
128
+ or `mountGpuShowcase({ demoMode: "product-studio" })`, both of which use mesh
129
+ inputs for renderer-owned BVH construction.
130
+
131
+ Install `@plasius/gpu-renderer` alongside `@plasius/gpu-shared` when Product
132
+ Studio mode is used. Harbor-only consumers do not need the renderer peer.
133
+
50
134
  For browser-only demos served without a bundler, keep the import surface on the
51
135
  published package name and resolve it with an import map rather than importing a
52
136
  viewer-private or workspace-private source file:
@@ -71,10 +155,13 @@ import {
71
155
  } from "@plasius/gpu-shared";
72
156
 
73
157
  const shipUrl = resolveShowcaseAssetUrl();
158
+ const lighthouseUrl = resolveShowcaseAssetUrl("lighthouse");
74
159
  const shipModel = await loadGltfModel(shipUrl);
160
+ const lighthouseModel = await loadGltfModel(lighthouseUrl);
75
161
 
76
162
  console.log(showcaseFocusModes);
77
163
  console.log(shipModel.physics);
164
+ console.log(shipModel.primitives.length, lighthouseModel.primitives.length);
78
165
  ```
79
166
 
80
167
  ## Demo
@@ -95,6 +182,16 @@ the banded `@plasius/gpu-fluid` continuity envelope directly, so the default
95
182
  camera keeps finite, visibly animated near-band water motion instead of
96
183
  flattening or dropping the shared water mesh.
97
184
 
185
+ The default showcase asset set now uses a multi-primitive brigantine, a
186
+ distinct cutter profile, a modeled lighthouse, and a modeled dock/warehouse
187
+ scene so the harbor reads closer to a believable coastal night view on high-end
188
+ machines.
189
+
190
+ For slide-deck screenshots or video capture, open the route with
191
+ `?capture=1&renderScale=1`. Capture mode hides the validation chrome, fills the
192
+ viewport with the scene canvas, and caps the backing buffer at 1080p by default
193
+ so recording stays smooth on local machines.
194
+
98
195
  ## Current Boundary
99
196
 
100
197
  `@plasius/gpu-shared` owns the shared browser/demo orchestration surface. It
@@ -107,10 +204,19 @@ surface for these family demos.
107
204
 
108
205
  - `mountGpuShowcase(options)`
109
206
  - Returns `{ state, shipModel, canvas, destroy() }`
207
+ - `captureMode: true` enables fullscreen scene-only presentation for local
208
+ screenshots and video capture.
209
+ - `renderScale` overrides the canvas backing scale when a capture workflow
210
+ needs a specific quality/performance balance.
110
211
  - `loadGltfModel(url)`
111
- - `resolveShowcaseAssetUrl(baseUrl?)`
212
+ - `resolveShowcaseAssetUrl(baseUrlOrAssetName?, assetName?)`
112
213
  - `showcaseFocusModes`
113
214
 
215
+ `resolveShowcaseAssetUrl()` keeps consumers on the package-owned brigantine
216
+ asset URL. If a host cannot actually serve that asset, `loadGltfModel()`
217
+ lazily activates the built-in inline fallback instead of eagerly parsing that
218
+ payload in the top-level package entrypoint.
219
+
114
220
  ## Development
115
221
 
116
222
  ```bash