@plasius/gpu-shared 0.1.16 → 0.1.18

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/CHANGELOG.md CHANGED
@@ -16,6 +16,9 @@ All notable changes to this project will be documented in this file.
16
16
  delegation to the `@plasius/gpu-renderer` WebGPU wavefront renderer.
17
17
 
18
18
  - **Changed**
19
+ - Lowered Product Studio wavefront renderer defaults to a host-safe `640x360`
20
+ frame at `maxDepth: 2` so browser demos do not start with a heavy 720p
21
+ depth-6 GPU workload.
19
22
  - Updated the optional `@plasius/gpu-renderer` peer range to the 0.2 line so
20
23
  Product Studio and demo consumers can use the released realtime wavefront
21
24
  camera update API without npm peer conflicts.
@@ -52,6 +55,12 @@ All notable changes to this project will be documented in this file.
52
55
  - Restored the package CD workflow so protected `main` releases are prepared by PR and published without direct branch pushes.
53
56
  - GLTF model aggregation now appends large primitive arrays iteratively so
54
57
  real-world Product Studio meshes do not overflow the JavaScript call stack.
58
+ - Product Studio GLTF loading now preserves UVs, decoded material textures,
59
+ and stride-safe accessor reads so wood, leather, and other textured mesh
60
+ surfaces reach the renderer intact instead of falling back to flat factors.
61
+ - Product Studio GLTF texture-transform baking now resamples with bilinear
62
+ filtering instead of nearest-neighbor lookups, reducing blocky localized
63
+ distortion on transformed leather and wood texture regions.
55
64
  - Product Studio showcase routing now honors the rollout feature flag before
56
65
  loading the renderer or replacing the host DOM.
57
66
  - The shared showcase now propagates the realistic-model feature flag into
package/README.md CHANGED
@@ -35,6 +35,9 @@ npm install @plasius/gpu-shared
35
35
  - Converts Product Studio GLTF primitives into triangle mesh inputs for the
36
36
  renderer-owned mesh-BVH wavefront path instead of customer-visible analytic
37
37
  scene objects.
38
+ - Preserves Product Studio UVs, decoded glTF material textures, and core
39
+ `KHR_materials_*` factors so renderer-owned leather, wood, chrome, and
40
+ transmissive surface response can be driven from the source asset.
38
41
 
39
42
  ## Usage
40
43
 
@@ -211,6 +214,9 @@ surface for these family demos.
211
214
 
212
215
  - `mountGpuShowcase(options)`
213
216
  - Returns `{ state, shipModel, canvas, destroy() }`
217
+ - Product Studio mode defaults to a host-safe `640x360` wavefront render at
218
+ `maxDepth: 2`; callers can raise `width`, `height`, or `maxDepth`
219
+ deliberately for capture or high-end review hardware.
214
220
  - `captureMode: true` enables fullscreen scene-only presentation for local
215
221
  screenshots and video capture.
216
222
  - `renderScale` overrides the canvas backing scale when a capture workflow
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  loadGltfModel
3
- } from "./chunk-QVNRTWHB.js";
3
+ } from "./chunk-UKCJ2AWJ.js";
4
4
 
5
5
  // src/product-studio-runtime.js
6
6
  var STYLE_ID = "plasius-product-studio-wavefront-style";
7
7
  var DEFAULT_PRODUCT_ASSET_URL = "/data/models/eames-lounge-chair-ottoman/Eames_Lounge_Chair_Ottoman.gltf";
8
8
  var DEFAULT_TARGET_CENTER = Object.freeze([0, 0.74, 0]);
9
9
  var DEFAULT_TARGET_SIZE = 2.25;
10
- function clamp(value, min, max) {
11
- return Math.max(min, Math.min(max, value));
12
- }
10
+ var DEFAULT_RENDER_WIDTH = 640;
11
+ var DEFAULT_RENDER_HEIGHT = 360;
12
+ var DEFAULT_RENDER_MAX_DEPTH = 2;
13
13
  function isFiniteVector(value) {
14
14
  return Array.isArray(value) && value.length >= 3 && Number.isFinite(value[0]) && Number.isFinite(value[1]) && Number.isFinite(value[2]);
15
15
  }
@@ -198,18 +198,56 @@ function createProductStudioMeshFromPrimitive(primitive, primitiveIndex, transfo
198
198
  const indices = Array.isArray(primitive.indices) && primitive.indices.length >= 3 ? [...primitive.indices] : Array.from({ length: positions.length / 3 }, (_, index) => index);
199
199
  const material = primitive.material ?? {};
200
200
  const color = readMaterialColor(material);
201
+ const uvs = Array.isArray(primitive.uvs) ? [...primitive.uvs] : null;
201
202
  return Object.freeze({
202
203
  id: 1e3 + primitiveIndex,
203
204
  positions: Object.freeze(positions),
204
205
  indices: Object.freeze(indices),
205
206
  normals: Array.isArray(primitive.normals) ? Object.freeze([...primitive.normals]) : null,
207
+ uvs: uvs ? Object.freeze(uvs) : null,
208
+ material: Object.freeze({ ...material }),
206
209
  color: Object.freeze(color),
207
210
  emission: Object.freeze(readEmission(material)),
208
211
  materialKind: readMaterialKind(material),
209
212
  materialRefId: 1e3 + primitiveIndex,
210
213
  roughness: Number.isFinite(material.roughness) ? material.roughness : 0.72,
211
214
  metallic: Number.isFinite(material.metallic) ? material.metallic : 0,
212
- opacity: color[3]
215
+ opacity: color[3],
216
+ baseColorTexture: material.baseColorTexture ?? null,
217
+ metallicRoughnessTexture: material.metallicRoughnessTexture ?? null,
218
+ normalTexture: material.normalTexture ?? null,
219
+ occlusionTexture: material.occlusionTexture ?? null,
220
+ emissiveTexture: material.emissiveTexture ?? null,
221
+ specular: Number.isFinite(material.specular) ? material.specular : 1,
222
+ specularColor: Array.isArray(material.specularColor) ? Object.freeze([...material.specularColor]) : void 0,
223
+ specularTexture: material.specularTexture ?? null,
224
+ specularColorTexture: material.specularColorTexture ?? null,
225
+ transmission: Number.isFinite(material.transmission) ? material.transmission : 0,
226
+ transmissionTexture: material.transmissionTexture ?? null,
227
+ ior: Number.isFinite(material.ior) ? material.ior : void 0,
228
+ thickness: Number.isFinite(material.thickness) ? material.thickness : void 0,
229
+ thicknessTexture: material.thicknessTexture ?? null,
230
+ attenuationDistance: Number.isFinite(material.attenuationDistance) ? material.attenuationDistance : null,
231
+ attenuationColor: Array.isArray(material.attenuationColor) ? Object.freeze([...material.attenuationColor]) : void 0,
232
+ clearcoat: Number.isFinite(material.clearcoat) ? material.clearcoat : void 0,
233
+ clearcoatTexture: material.clearcoatTexture ?? null,
234
+ clearcoatRoughness: Number.isFinite(material.clearcoatRoughness) ? material.clearcoatRoughness : void 0,
235
+ clearcoatRoughnessTexture: material.clearcoatRoughnessTexture ?? null,
236
+ clearcoatNormalTexture: material.clearcoatNormalTexture ?? null,
237
+ sheenColor: Array.isArray(material.sheenColor) ? Object.freeze([...material.sheenColor]) : void 0,
238
+ sheenColorTexture: material.sheenColorTexture ?? null,
239
+ sheenRoughness: Number.isFinite(material.sheenRoughness) ? material.sheenRoughness : void 0,
240
+ sheenRoughnessTexture: material.sheenRoughnessTexture ?? null,
241
+ iridescence: Number.isFinite(material.iridescence) ? material.iridescence : void 0,
242
+ iridescenceTexture: material.iridescenceTexture ?? null,
243
+ iridescenceIor: Number.isFinite(material.iridescenceIor) ? material.iridescenceIor : void 0,
244
+ iridescenceThicknessMinimum: Number.isFinite(material.iridescenceThicknessMinimum) ? material.iridescenceThicknessMinimum : void 0,
245
+ iridescenceThicknessMaximum: Number.isFinite(material.iridescenceThicknessMaximum) ? material.iridescenceThicknessMaximum : void 0,
246
+ iridescenceThicknessTexture: material.iridescenceThicknessTexture ?? null,
247
+ anisotropy: Number.isFinite(material.anisotropy) ? material.anisotropy : void 0,
248
+ anisotropyRotation: Number.isFinite(material.anisotropyRotation) ? material.anisotropyRotation : void 0,
249
+ anisotropyTexture: material.anisotropyTexture ?? null,
250
+ dispersion: Number.isFinite(material.dispersion) ? material.dispersion : void 0
213
251
  });
214
252
  }
215
253
  function createProductStudioMeshes(model, options = {}) {
@@ -267,16 +305,10 @@ function resolveRoot(options) {
267
305
  }
268
306
  return root;
269
307
  }
270
- function resolveRenderSize(root, options) {
271
- const rect = root.getBoundingClientRect?.() ?? { width: 1280, height: 720 };
272
- const devicePixelRatio = Number.isFinite(options.devicePixelRatio) ? options.devicePixelRatio : Number.isFinite(globalThis.window?.devicePixelRatio) ? globalThis.window.devicePixelRatio : 1;
273
- const cssWidth = Number.isFinite(rect.width) && rect.width > 0 ? rect.width : 1280;
274
- const cssHeight = Number.isFinite(rect.height) && rect.height > 0 ? rect.height : cssWidth * (9 / 16);
275
- const width = Number.isFinite(options.width) ? Math.trunc(options.width) : clamp(Math.round(cssWidth * devicePixelRatio), 640, 1920);
276
- const height = Number.isFinite(options.height) ? Math.trunc(options.height) : clamp(Math.round(cssHeight * devicePixelRatio), 360, 1080);
308
+ function resolveRenderSize(options) {
277
309
  return {
278
- width,
279
- height
310
+ width: Number.isFinite(options.width) ? Math.trunc(options.width) : DEFAULT_RENDER_WIDTH,
311
+ height: Number.isFinite(options.height) ? Math.trunc(options.height) : DEFAULT_RENDER_HEIGHT
280
312
  };
281
313
  }
282
314
  function installSnapshotHook(state) {
@@ -347,13 +379,13 @@ async function mountGpuProductStudio(options = {}, featureFlags = null) {
347
379
  if (typeof rendererModule.createWavefrontPathTracingComputeRenderer !== "function") {
348
380
  throw new Error("Product Studio renderer loader must provide createWavefrontPathTracingComputeRenderer.");
349
381
  }
350
- const size = resolveRenderSize(root, options);
382
+ const size = resolveRenderSize(options);
351
383
  const lightingOptions = await resolveWavefrontLightingOptions(options);
352
384
  const renderer = await rendererModule.createWavefrontPathTracingComputeRenderer({
353
385
  canvas,
354
386
  width: size.width,
355
387
  height: size.height,
356
- maxDepth: Number.isFinite(options.maxDepth) ? options.maxDepth : 6,
388
+ maxDepth: Number.isFinite(options.maxDepth) ? options.maxDepth : DEFAULT_RENDER_MAX_DEPTH,
357
389
  tileSize: Number.isFinite(options.tileSize) ? options.tileSize : 128,
358
390
  samplesPerPixel: Number.isFinite(options.samplesPerPixel) ? options.samplesPerPixel : 8,
359
391
  denoise: options.denoise !== false,
@@ -400,4 +432,4 @@ export {
400
432
  createProductStudioMeshes,
401
433
  mountGpuProductStudio
402
434
  };
403
- //# sourceMappingURL=chunk-6SOHFUOE.js.map
435
+ //# sourceMappingURL=chunk-EZHA3MH7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/product-studio-runtime.js"],"sourcesContent":["import { loadGltfModel } from \"./gltf-loader.js\";\n\nconst STYLE_ID = \"plasius-product-studio-wavefront-style\";\nconst DEFAULT_PRODUCT_ASSET_URL =\n \"/data/models/eames-lounge-chair-ottoman/Eames_Lounge_Chair_Ottoman.gltf\";\nconst DEFAULT_TARGET_CENTER = Object.freeze([0, 0.74, 0]);\nconst DEFAULT_TARGET_SIZE = 2.25;\nconst DEFAULT_RENDER_WIDTH = 640;\nconst DEFAULT_RENDER_HEIGHT = 360;\nconst DEFAULT_RENDER_MAX_DEPTH = 2;\n\nfunction isFiniteVector(value) {\n return (\n Array.isArray(value) &&\n value.length >= 3 &&\n Number.isFinite(value[0]) &&\n Number.isFinite(value[1]) &&\n Number.isFinite(value[2])\n );\n}\n\nfunction createEmptyBounds() {\n return {\n min: [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY],\n max: [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],\n };\n}\n\nfunction expandBounds(bounds, point) {\n bounds.min[0] = Math.min(bounds.min[0], point[0]);\n bounds.min[1] = Math.min(bounds.min[1], point[1]);\n bounds.min[2] = Math.min(bounds.min[2], point[2]);\n bounds.max[0] = Math.max(bounds.max[0], point[0]);\n bounds.max[1] = Math.max(bounds.max[1], point[1]);\n bounds.max[2] = Math.max(bounds.max[2], point[2]);\n}\n\nfunction getBoundsSize(bounds) {\n return [\n bounds.max[0] - bounds.min[0],\n bounds.max[1] - bounds.min[1],\n bounds.max[2] - bounds.min[2],\n ];\n}\n\nfunction getBoundsCenter(bounds) {\n return [\n (bounds.min[0] + bounds.max[0]) * 0.5,\n (bounds.min[1] + bounds.max[1]) * 0.5,\n (bounds.min[2] + bounds.max[2]) * 0.5,\n ];\n}\n\nfunction getModelBounds(model) {\n if (isFiniteVector(model?.bounds?.min) && isFiniteVector(model?.bounds?.max)) {\n return {\n min: [...model.bounds.min],\n max: [...model.bounds.max],\n };\n }\n\n const bounds = createEmptyBounds();\n for (const primitive of model?.primitives ?? []) {\n for (let index = 0; index < primitive.positions.length; index += 3) {\n expandBounds(bounds, [\n primitive.positions[index],\n primitive.positions[index + 1],\n primitive.positions[index + 2],\n ]);\n }\n }\n return bounds;\n}\n\nfunction transformPoint(point, modelCenter, scale, targetCenter) {\n return [\n (point[0] - modelCenter[0]) * scale + targetCenter[0],\n (point[1] - modelCenter[1]) * scale + targetCenter[1],\n (point[2] - modelCenter[2]) * scale + targetCenter[2],\n ];\n}\n\nfunction readMaterialColor(material) {\n const color = material?.color ?? {};\n return [\n Number.isFinite(color.r) ? color.r : 0.62,\n Number.isFinite(color.g) ? color.g : 0.56,\n Number.isFinite(color.b) ? color.b : 0.48,\n Number.isFinite(color.a) ? color.a : 1,\n ];\n}\n\nfunction readMaterialKind(material) {\n const emissive = material?.emissive ?? {};\n if ((emissive.r ?? 0) + (emissive.g ?? 0) + (emissive.b ?? 0) > 0.001) {\n return \"emissive\";\n }\n if ((material?.metallic ?? 0) >= 0.5) {\n return \"metal\";\n }\n const alpha = readMaterialColor(material)[3];\n if (alpha < 0.9) {\n return \"transparent\";\n }\n return \"diffuse\";\n}\n\nfunction readEmission(material) {\n const emissive = material?.emissive ?? {};\n return [\n Number.isFinite(emissive.r) ? emissive.r : 0,\n Number.isFinite(emissive.g) ? emissive.g : 0,\n Number.isFinite(emissive.b) ? emissive.b : 0,\n 1,\n ];\n}\n\nfunction createQuadMesh({\n id,\n corners,\n color,\n emission = [0, 0, 0, 1],\n materialKind = \"diffuse\",\n roughness = 0.72,\n metallic = 0,\n opacity = color[3] ?? 1,\n}) {\n const [a, b, c] = corners;\n const edge1 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];\n const edge2 = [c[0] - a[0], c[1] - a[1], c[2] - a[2]];\n const normal = [\n edge1[1] * edge2[2] - edge1[2] * edge2[1],\n edge1[2] * edge2[0] - edge1[0] * edge2[2],\n edge1[0] * edge2[1] - edge1[1] * edge2[0],\n ];\n const length = Math.hypot(normal[0], normal[1], normal[2]) || 1;\n const unitNormal = normal.map((value) => value / length);\n\n return Object.freeze({\n id,\n positions: Object.freeze(corners.flat()),\n indices: Object.freeze([0, 1, 2, 0, 2, 3]),\n normals: Object.freeze([unitNormal, unitNormal, unitNormal, unitNormal].flat()),\n color: Object.freeze([...color]),\n emission: Object.freeze([...emission]),\n materialKind,\n roughness,\n metallic,\n opacity,\n });\n}\n\nfunction createProductStudioEnvironmentMeshes() {\n return [\n createQuadMesh({\n id: 1,\n corners: [\n [-3.2, -0.08, 2.4],\n [3.2, -0.08, 2.4],\n [3.2, -0.08, -3.1],\n [-3.2, -0.08, -3.1],\n ],\n color: [0.48, 0.55, 0.55, 1],\n roughness: 0.82,\n }),\n createQuadMesh({\n id: 2,\n corners: [\n [-3.2, -0.08, -2.45],\n [3.2, -0.08, -2.45],\n [3.2, 2.65, -2.45],\n [-3.2, 2.65, -2.45],\n ],\n color: [0.43, 0.42, 0.38, 1],\n roughness: 0.86,\n }),\n createQuadMesh({\n id: 3,\n corners: [\n [-2.85, -0.08, -2.45],\n [-2.85, 2.55, -2.45],\n [-2.85, 2.55, 2.15],\n [-2.85, -0.08, 2.15],\n ],\n color: [0.36, 0.42, 0.45, 1],\n roughness: 0.8,\n }),\n createQuadMesh({\n id: 4,\n corners: [\n [0.78, 2.55, -0.82],\n [-0.78, 2.55, -0.82],\n [-0.78, 2.55, -1.78],\n [0.78, 2.55, -1.78],\n ],\n color: [1, 0.94, 0.78, 1],\n emission: [8.5, 7.2, 4.8, 1],\n materialKind: \"emissive\",\n roughness: 0,\n }),\n ];\n}\n\nfunction createProductStudioMeshFromPrimitive(primitive, primitiveIndex, transform) {\n if (!Array.isArray(primitive?.positions) || primitive.positions.length < 9) {\n return null;\n }\n\n const positions = [];\n for (let index = 0; index < primitive.positions.length; index += 3) {\n const point = transform([\n primitive.positions[index],\n primitive.positions[index + 1],\n primitive.positions[index + 2],\n ]);\n positions.push(point[0], point[1], point[2]);\n }\n\n const indices =\n Array.isArray(primitive.indices) && primitive.indices.length >= 3\n ? [...primitive.indices]\n : Array.from({ length: positions.length / 3 }, (_, index) => index);\n const material = primitive.material ?? {};\n const color = readMaterialColor(material);\n const uvs = Array.isArray(primitive.uvs) ? [...primitive.uvs] : null;\n\n return Object.freeze({\n id: 1000 + primitiveIndex,\n positions: Object.freeze(positions),\n indices: Object.freeze(indices),\n normals: Array.isArray(primitive.normals) ? Object.freeze([...primitive.normals]) : null,\n uvs: uvs ? Object.freeze(uvs) : null,\n material: Object.freeze({ ...material }),\n color: Object.freeze(color),\n emission: Object.freeze(readEmission(material)),\n materialKind: readMaterialKind(material),\n materialRefId: 1000 + primitiveIndex,\n roughness: Number.isFinite(material.roughness) ? material.roughness : 0.72,\n metallic: Number.isFinite(material.metallic) ? material.metallic : 0,\n opacity: color[3],\n baseColorTexture: material.baseColorTexture ?? null,\n metallicRoughnessTexture: material.metallicRoughnessTexture ?? null,\n normalTexture: material.normalTexture ?? null,\n occlusionTexture: material.occlusionTexture ?? null,\n emissiveTexture: material.emissiveTexture ?? null,\n specular: Number.isFinite(material.specular) ? material.specular : 1,\n specularColor: Array.isArray(material.specularColor)\n ? Object.freeze([...material.specularColor])\n : undefined,\n specularTexture: material.specularTexture ?? null,\n specularColorTexture: material.specularColorTexture ?? null,\n transmission: Number.isFinite(material.transmission) ? material.transmission : 0,\n transmissionTexture: material.transmissionTexture ?? null,\n ior: Number.isFinite(material.ior) ? material.ior : undefined,\n thickness: Number.isFinite(material.thickness) ? material.thickness : undefined,\n thicknessTexture: material.thicknessTexture ?? null,\n attenuationDistance:\n Number.isFinite(material.attenuationDistance) ? material.attenuationDistance : null,\n attenuationColor: Array.isArray(material.attenuationColor)\n ? Object.freeze([...material.attenuationColor])\n : undefined,\n clearcoat: Number.isFinite(material.clearcoat) ? material.clearcoat : undefined,\n clearcoatTexture: material.clearcoatTexture ?? null,\n clearcoatRoughness: Number.isFinite(material.clearcoatRoughness)\n ? material.clearcoatRoughness\n : undefined,\n clearcoatRoughnessTexture: material.clearcoatRoughnessTexture ?? null,\n clearcoatNormalTexture: material.clearcoatNormalTexture ?? null,\n sheenColor: Array.isArray(material.sheenColor)\n ? Object.freeze([...material.sheenColor])\n : undefined,\n sheenColorTexture: material.sheenColorTexture ?? null,\n sheenRoughness: Number.isFinite(material.sheenRoughness) ? material.sheenRoughness : undefined,\n sheenRoughnessTexture: material.sheenRoughnessTexture ?? null,\n iridescence: Number.isFinite(material.iridescence) ? material.iridescence : undefined,\n iridescenceTexture: material.iridescenceTexture ?? null,\n iridescenceIor: Number.isFinite(material.iridescenceIor) ? material.iridescenceIor : undefined,\n iridescenceThicknessMinimum: Number.isFinite(material.iridescenceThicknessMinimum)\n ? material.iridescenceThicknessMinimum\n : undefined,\n iridescenceThicknessMaximum: Number.isFinite(material.iridescenceThicknessMaximum)\n ? material.iridescenceThicknessMaximum\n : undefined,\n iridescenceThicknessTexture: material.iridescenceThicknessTexture ?? null,\n anisotropy: Number.isFinite(material.anisotropy) ? material.anisotropy : undefined,\n anisotropyRotation: Number.isFinite(material.anisotropyRotation)\n ? material.anisotropyRotation\n : undefined,\n anisotropyTexture: material.anisotropyTexture ?? null,\n dispersion: Number.isFinite(material.dispersion) ? material.dispersion : undefined,\n });\n}\n\nexport function createProductStudioMeshes(model, options = {}) {\n const primitives = Array.isArray(model?.primitives) ? model.primitives : [];\n if (primitives.length === 0) {\n throw new Error(\"Product Studio model must contain at least one renderable primitive.\");\n }\n\n const targetCenter = isFiniteVector(options.targetCenter)\n ? [...options.targetCenter]\n : [...DEFAULT_TARGET_CENTER];\n const targetSize = Number.isFinite(options.targetSize)\n ? Math.max(options.targetSize, 0.25)\n : DEFAULT_TARGET_SIZE;\n const modelBounds = getModelBounds(model);\n const modelSize = getBoundsSize(modelBounds);\n const modelCenter = getBoundsCenter(modelBounds);\n const scale = targetSize / Math.max(modelSize[0], modelSize[1], modelSize[2], 0.000001);\n const transform = (point) => transformPoint(point, modelCenter, scale, targetCenter);\n const modelMeshes = primitives\n .map((primitive, index) => createProductStudioMeshFromPrimitive(primitive, index, transform))\n .filter(Boolean);\n\n return Object.freeze([...createProductStudioEnvironmentMeshes(), ...modelMeshes]);\n}\n\nfunction ensureStyles(documentRef) {\n if (documentRef.getElementById?.(STYLE_ID)) {\n return;\n }\n const style = documentRef.createElement(\"style\");\n style.id = STYLE_ID;\n style.textContent = `\n .plasius-product-studio-wavefront {\n position: relative;\n width: 100%;\n min-height: 420px;\n overflow: hidden;\n background: #0f1418;\n display: grid;\n place-items: center;\n }\n\n .plasius-product-studio-wavefront canvas {\n display: block;\n width: 100%;\n height: auto;\n max-height: 100%;\n aspect-ratio: 16 / 9;\n min-height: 420px;\n object-fit: contain;\n }\n `;\n documentRef.head?.appendChild?.(style);\n}\n\nfunction resolveRoot(options) {\n const documentRef = options.document ?? globalThis.document;\n if (options.root) {\n return options.root;\n }\n const root =\n documentRef?.querySelector?.(\"[data-plasius-gpu-product-studio]\") ?? documentRef?.body;\n if (!root) {\n throw new Error(\"Product Studio requires a DOM root.\");\n }\n return root;\n}\n\nfunction resolveRenderSize(options) {\n return {\n width: Number.isFinite(options.width) ? Math.trunc(options.width) : DEFAULT_RENDER_WIDTH,\n height: Number.isFinite(options.height) ? Math.trunc(options.height) : DEFAULT_RENDER_HEIGHT,\n };\n}\n\nfunction installSnapshotHook(state) {\n if (typeof globalThis.window === \"undefined\") {\n return () => {};\n }\n const previous = globalThis.window.render_game_to_text;\n globalThis.window.render_game_to_text = () =>\n JSON.stringify({\n surface: \"gpu-product-studio-wavefront\",\n model: state.modelName,\n sourceTriangles: state.sourceTriangleCount,\n meshCount: state.meshCount,\n geometryMode: state.geometryMode,\n requiresTriangleMeshRenderer: state.requiresTriangleMeshRenderer,\n displayQuality: state.displayQuality,\n requiresMeshBvhForDisplayQuality: state.requiresMeshBvhForDisplayQuality,\n renderer: state.rendererStats,\n });\n return () => {\n if (previous === undefined) {\n delete globalThis.window.render_game_to_text;\n } else {\n globalThis.window.render_game_to_text = previous;\n }\n };\n}\n\nfunction countSourceTriangles(model) {\n return (model.primitives ?? []).reduce(\n (total, primitive) => total + Math.floor((primitive.indices?.length ?? 0) / 3),\n 0\n );\n}\n\nasync function resolveWavefrontLightingOptions(options) {\n const fallback = {\n environmentColor: [0.35, 0.43, 0.49, 1],\n ambientColor: [0.02, 0.024, 0.028, 1],\n };\n const lightingLoader =\n typeof options.__lightingLoader === \"function\"\n ? options.__lightingLoader\n : () => import(\"@plasius/gpu-lighting\").catch(() => null);\n const lightingModule = await lightingLoader();\n\n if (\n typeof lightingModule?.createWavefrontEnvironmentLightingOptions !== \"function\"\n ) {\n return fallback;\n }\n\n return lightingModule.createWavefrontEnvironmentLightingOptions({\n preset: options.lightingPreset ?? \"product-studio\",\n intensity: options.lightingIntensity,\n });\n}\n\nexport async function mountGpuProductStudio(options = {}, featureFlags = null) {\n const root = resolveRoot(options);\n const documentRef = options.document ?? root.ownerDocument ?? globalThis.document;\n ensureStyles(documentRef);\n const previousMarkup = root.innerHTML;\n root.innerHTML = \"\";\n root.classList?.add?.(\"plasius-product-studio-wavefront\");\n\n const canvas = documentRef.createElement(\"canvas\");\n canvas.dataset.plasiusGpuProductStudio = \"wavefront\";\n root.appendChild(canvas);\n\n const modelLoader =\n typeof options.__modelLoader === \"function\" ? options.__modelLoader : loadGltfModel;\n const rendererLoader =\n typeof options.__rendererLoader === \"function\"\n ? options.__rendererLoader\n : () => import(\"@plasius/gpu-renderer\");\n const assetUrl = options.productAssetUrl ?? options.assetUrl ?? DEFAULT_PRODUCT_ASSET_URL;\n const model = await modelLoader(assetUrl);\n const meshes = createProductStudioMeshes(model, {\n targetCenter: options.targetCenter,\n targetSize: options.targetSize,\n });\n const rendererModule = await rendererLoader();\n if (typeof rendererModule.createWavefrontPathTracingComputeRenderer !== \"function\") {\n throw new Error(\"Product Studio renderer loader must provide createWavefrontPathTracingComputeRenderer.\");\n }\n\n const size = resolveRenderSize(options);\n const lightingOptions = await resolveWavefrontLightingOptions(options);\n const renderer = await rendererModule.createWavefrontPathTracingComputeRenderer({\n canvas,\n width: size.width,\n height: size.height,\n maxDepth: Number.isFinite(options.maxDepth) ? options.maxDepth : DEFAULT_RENDER_MAX_DEPTH,\n tileSize: Number.isFinite(options.tileSize) ? options.tileSize : 128,\n samplesPerPixel: Number.isFinite(options.samplesPerPixel) ? options.samplesPerPixel : 8,\n denoise: options.denoise !== false,\n displayQuality: true,\n meshes,\n camera: {\n position: [0, 1.12, 5.05],\n target: [0, 0.72, 0],\n up: [0, 1, 0],\n fovYDegrees: 43,\n },\n ...lightingOptions,\n });\n const rendererStats = renderer.renderOnce();\n const state = Object.freeze({\n featureFlags,\n modelName: model.name,\n sourceTriangleCount: countSourceTriangles(model),\n meshCount: meshes.length,\n geometryMode: \"mesh-bvh-display-quality\",\n requiresTriangleMeshRenderer: true,\n displayQuality: true,\n requiresMeshBvhForDisplayQuality: true,\n rendererStats,\n });\n const restoreSnapshotHook = installSnapshotHook(state);\n\n return Object.freeze({\n state,\n model,\n productModel: model,\n canvas,\n renderer,\n meshes,\n destroy() {\n restoreSnapshotHook();\n renderer.destroy();\n root.classList?.remove?.(\"plasius-product-studio-wavefront\");\n root.innerHTML = previousMarkup;\n },\n });\n}\n"],"mappings":";;;;;AAEA,IAAM,WAAW;AACjB,IAAM,4BACJ;AACF,IAAM,wBAAwB,OAAO,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;AACxD,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAC7B,IAAM,wBAAwB;AAC9B,IAAM,2BAA2B;AAEjC,SAAS,eAAe,OAAO;AAC7B,SACE,MAAM,QAAQ,KAAK,KACnB,MAAM,UAAU,KAChB,OAAO,SAAS,MAAM,CAAC,CAAC,KACxB,OAAO,SAAS,MAAM,CAAC,CAAC,KACxB,OAAO,SAAS,MAAM,CAAC,CAAC;AAE5B;AAEA,SAAS,oBAAoB;AAC3B,SAAO;AAAA,IACL,KAAK,CAAC,OAAO,mBAAmB,OAAO,mBAAmB,OAAO,iBAAiB;AAAA,IAClF,KAAK,CAAC,OAAO,mBAAmB,OAAO,mBAAmB,OAAO,iBAAiB;AAAA,EACpF;AACF;AAEA,SAAS,aAAa,QAAQ,OAAO;AACnC,SAAO,IAAI,CAAC,IAAI,KAAK,IAAI,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;AAChD,SAAO,IAAI,CAAC,IAAI,KAAK,I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