@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/src/index.d.ts CHANGED
@@ -15,11 +15,57 @@ export interface GltfModelMaterial {
15
15
  readonly color: GltfModelColor;
16
16
  readonly roughness: number;
17
17
  readonly metallic: number;
18
+ readonly opacity?: number;
18
19
  readonly emissive: Readonly<{
19
20
  r: number;
20
21
  g: number;
21
22
  b: number;
23
+ a?: number;
22
24
  }>;
25
+ readonly baseColorTexture?: GltfModelTextureInfo | null;
26
+ readonly metallicRoughnessTexture?: GltfModelTextureInfo | null;
27
+ readonly normalTexture?: GltfModelTextureInfo | null;
28
+ readonly occlusionTexture?: GltfModelTextureInfo | null;
29
+ readonly emissiveTexture?: GltfModelTextureInfo | null;
30
+ readonly specular?: number;
31
+ readonly specularColor?: readonly number[];
32
+ readonly specularTexture?: GltfModelTextureInfo | null;
33
+ readonly specularColorTexture?: GltfModelTextureInfo | null;
34
+ readonly transmission?: number;
35
+ readonly transmissionTexture?: GltfModelTextureInfo | null;
36
+ readonly ior?: number;
37
+ readonly attenuationDistance?: number | null;
38
+ readonly attenuationColor?: readonly number[];
39
+ readonly thickness?: number;
40
+ readonly thicknessTexture?: GltfModelTextureInfo | null;
41
+ readonly clearcoat?: number;
42
+ readonly clearcoatTexture?: GltfModelTextureInfo | null;
43
+ readonly clearcoatRoughness?: number;
44
+ readonly clearcoatRoughnessTexture?: GltfModelTextureInfo | null;
45
+ readonly clearcoatNormalTexture?: GltfModelTextureInfo | null;
46
+ readonly sheenColor?: readonly number[];
47
+ readonly sheenColorTexture?: GltfModelTextureInfo | null;
48
+ readonly sheenRoughness?: number;
49
+ readonly sheenRoughnessTexture?: GltfModelTextureInfo | null;
50
+ readonly iridescence?: number;
51
+ readonly iridescenceTexture?: GltfModelTextureInfo | null;
52
+ readonly iridescenceIor?: number;
53
+ readonly iridescenceThicknessMinimum?: number;
54
+ readonly iridescenceThicknessMaximum?: number;
55
+ readonly iridescenceThicknessTexture?: GltfModelTextureInfo | null;
56
+ readonly anisotropy?: number;
57
+ readonly anisotropyRotation?: number;
58
+ readonly anisotropyTexture?: GltfModelTextureInfo | null;
59
+ readonly dispersion?: number;
60
+ }
61
+
62
+ export interface GltfModelTextureInfo {
63
+ readonly width: number;
64
+ readonly height: number;
65
+ readonly data: Uint8ClampedArray;
66
+ readonly texCoord?: number;
67
+ readonly scale?: number;
68
+ readonly strength?: number;
23
69
  }
24
70
 
25
71
  export interface GltfModelPrimitive {
@@ -27,6 +73,7 @@ export interface GltfModelPrimitive {
27
73
  readonly positions: readonly number[];
28
74
  readonly indices: readonly number[];
29
75
  readonly normals: readonly number[] | null;
76
+ readonly uvs?: readonly number[] | null;
30
77
  readonly colors: readonly number[] | null;
31
78
  readonly material: GltfModelMaterial;
32
79
  readonly bounds: GltfModelBounds;
@@ -65,6 +112,7 @@ export interface ProductStudioMesh {
65
112
  readonly indices: readonly number[];
66
113
  readonly normals?: readonly number[] | null;
67
114
  readonly uvs?: readonly number[] | null;
115
+ readonly material?: GltfModelMaterial;
68
116
  readonly color: readonly number[];
69
117
  readonly emission?: readonly number[];
70
118
  readonly materialKind: string | number;
@@ -72,6 +120,41 @@ export interface ProductStudioMesh {
72
120
  readonly roughness?: number;
73
121
  readonly metallic?: number;
74
122
  readonly opacity?: number;
123
+ readonly baseColorTexture?: GltfModelTextureInfo | null;
124
+ readonly metallicRoughnessTexture?: GltfModelTextureInfo | null;
125
+ readonly normalTexture?: GltfModelTextureInfo | null;
126
+ readonly occlusionTexture?: GltfModelTextureInfo | null;
127
+ readonly emissiveTexture?: GltfModelTextureInfo | null;
128
+ readonly specular?: number;
129
+ readonly specularColor?: readonly number[];
130
+ readonly specularTexture?: GltfModelTextureInfo | null;
131
+ readonly specularColorTexture?: GltfModelTextureInfo | null;
132
+ readonly transmission?: number;
133
+ readonly transmissionTexture?: GltfModelTextureInfo | null;
134
+ readonly ior?: number;
135
+ readonly attenuationDistance?: number | null;
136
+ readonly attenuationColor?: readonly number[];
137
+ readonly thickness?: number;
138
+ readonly thicknessTexture?: GltfModelTextureInfo | null;
139
+ readonly clearcoat?: number;
140
+ readonly clearcoatTexture?: GltfModelTextureInfo | null;
141
+ readonly clearcoatRoughness?: number;
142
+ readonly clearcoatRoughnessTexture?: GltfModelTextureInfo | null;
143
+ readonly clearcoatNormalTexture?: GltfModelTextureInfo | null;
144
+ readonly sheenColor?: readonly number[];
145
+ readonly sheenColorTexture?: GltfModelTextureInfo | null;
146
+ readonly sheenRoughness?: number;
147
+ readonly sheenRoughnessTexture?: GltfModelTextureInfo | null;
148
+ readonly iridescence?: number;
149
+ readonly iridescenceTexture?: GltfModelTextureInfo | null;
150
+ readonly iridescenceIor?: number;
151
+ readonly iridescenceThicknessMinimum?: number;
152
+ readonly iridescenceThicknessMaximum?: number;
153
+ readonly iridescenceThicknessTexture?: GltfModelTextureInfo | null;
154
+ readonly anisotropy?: number;
155
+ readonly anisotropyRotation?: number;
156
+ readonly anisotropyTexture?: GltfModelTextureInfo | null;
157
+ readonly dispersion?: number;
75
158
  }
76
159
 
77
160
  export type GpuSharedTranslationValue =
@@ -5,10 +5,9 @@ const DEFAULT_PRODUCT_ASSET_URL =
5
5
  "/data/models/eames-lounge-chair-ottoman/Eames_Lounge_Chair_Ottoman.gltf";
6
6
  const DEFAULT_TARGET_CENTER = Object.freeze([0, 0.74, 0]);
7
7
  const DEFAULT_TARGET_SIZE = 2.25;
8
-
9
- function clamp(value, min, max) {
10
- return Math.max(min, Math.min(max, value));
11
- }
8
+ const DEFAULT_RENDER_WIDTH = 640;
9
+ const DEFAULT_RENDER_HEIGHT = 360;
10
+ const DEFAULT_RENDER_MAX_DEPTH = 2;
12
11
 
13
12
  function isFiniteVector(value) {
14
13
  return (
@@ -223,12 +222,15 @@ function createProductStudioMeshFromPrimitive(primitive, primitiveIndex, transfo
223
222
  : Array.from({ length: positions.length / 3 }, (_, index) => index);
224
223
  const material = primitive.material ?? {};
225
224
  const color = readMaterialColor(material);
225
+ const uvs = Array.isArray(primitive.uvs) ? [...primitive.uvs] : null;
226
226
 
227
227
  return Object.freeze({
228
228
  id: 1000 + primitiveIndex,
229
229
  positions: Object.freeze(positions),
230
230
  indices: Object.freeze(indices),
231
231
  normals: Array.isArray(primitive.normals) ? Object.freeze([...primitive.normals]) : null,
232
+ uvs: uvs ? Object.freeze(uvs) : null,
233
+ material: Object.freeze({ ...material }),
232
234
  color: Object.freeze(color),
233
235
  emission: Object.freeze(readEmission(material)),
234
236
  materialKind: readMaterialKind(material),
@@ -236,6 +238,56 @@ function createProductStudioMeshFromPrimitive(primitive, primitiveIndex, transfo
236
238
  roughness: Number.isFinite(material.roughness) ? material.roughness : 0.72,
237
239
  metallic: Number.isFinite(material.metallic) ? material.metallic : 0,
238
240
  opacity: color[3],
241
+ baseColorTexture: material.baseColorTexture ?? null,
242
+ metallicRoughnessTexture: material.metallicRoughnessTexture ?? null,
243
+ normalTexture: material.normalTexture ?? null,
244
+ occlusionTexture: material.occlusionTexture ?? null,
245
+ emissiveTexture: material.emissiveTexture ?? null,
246
+ specular: Number.isFinite(material.specular) ? material.specular : 1,
247
+ specularColor: Array.isArray(material.specularColor)
248
+ ? Object.freeze([...material.specularColor])
249
+ : undefined,
250
+ specularTexture: material.specularTexture ?? null,
251
+ specularColorTexture: material.specularColorTexture ?? null,
252
+ transmission: Number.isFinite(material.transmission) ? material.transmission : 0,
253
+ transmissionTexture: material.transmissionTexture ?? null,
254
+ ior: Number.isFinite(material.ior) ? material.ior : undefined,
255
+ thickness: Number.isFinite(material.thickness) ? material.thickness : undefined,
256
+ thicknessTexture: material.thicknessTexture ?? null,
257
+ attenuationDistance:
258
+ Number.isFinite(material.attenuationDistance) ? material.attenuationDistance : null,
259
+ attenuationColor: Array.isArray(material.attenuationColor)
260
+ ? Object.freeze([...material.attenuationColor])
261
+ : undefined,
262
+ clearcoat: Number.isFinite(material.clearcoat) ? material.clearcoat : undefined,
263
+ clearcoatTexture: material.clearcoatTexture ?? null,
264
+ clearcoatRoughness: Number.isFinite(material.clearcoatRoughness)
265
+ ? material.clearcoatRoughness
266
+ : undefined,
267
+ clearcoatRoughnessTexture: material.clearcoatRoughnessTexture ?? null,
268
+ clearcoatNormalTexture: material.clearcoatNormalTexture ?? null,
269
+ sheenColor: Array.isArray(material.sheenColor)
270
+ ? Object.freeze([...material.sheenColor])
271
+ : undefined,
272
+ sheenColorTexture: material.sheenColorTexture ?? null,
273
+ sheenRoughness: Number.isFinite(material.sheenRoughness) ? material.sheenRoughness : undefined,
274
+ sheenRoughnessTexture: material.sheenRoughnessTexture ?? null,
275
+ iridescence: Number.isFinite(material.iridescence) ? material.iridescence : undefined,
276
+ iridescenceTexture: material.iridescenceTexture ?? null,
277
+ iridescenceIor: Number.isFinite(material.iridescenceIor) ? material.iridescenceIor : undefined,
278
+ iridescenceThicknessMinimum: Number.isFinite(material.iridescenceThicknessMinimum)
279
+ ? material.iridescenceThicknessMinimum
280
+ : undefined,
281
+ iridescenceThicknessMaximum: Number.isFinite(material.iridescenceThicknessMaximum)
282
+ ? material.iridescenceThicknessMaximum
283
+ : undefined,
284
+ iridescenceThicknessTexture: material.iridescenceThicknessTexture ?? null,
285
+ anisotropy: Number.isFinite(material.anisotropy) ? material.anisotropy : undefined,
286
+ anisotropyRotation: Number.isFinite(material.anisotropyRotation)
287
+ ? material.anisotropyRotation
288
+ : undefined,
289
+ anisotropyTexture: material.anisotropyTexture ?? null,
290
+ dispersion: Number.isFinite(material.dispersion) ? material.dispersion : undefined,
239
291
  });
240
292
  }
241
293
 
@@ -306,27 +358,10 @@ function resolveRoot(options) {
306
358
  return root;
307
359
  }
308
360
 
309
- function resolveRenderSize(root, options) {
310
- const rect = root.getBoundingClientRect?.() ?? { width: 1280, height: 720 };
311
- const devicePixelRatio =
312
- Number.isFinite(options.devicePixelRatio)
313
- ? options.devicePixelRatio
314
- : Number.isFinite(globalThis.window?.devicePixelRatio)
315
- ? globalThis.window.devicePixelRatio
316
- : 1;
317
- const cssWidth = Number.isFinite(rect.width) && rect.width > 0 ? rect.width : 1280;
318
- const cssHeight =
319
- Number.isFinite(rect.height) && rect.height > 0 ? rect.height : cssWidth * (9 / 16);
320
- const width = Number.isFinite(options.width)
321
- ? Math.trunc(options.width)
322
- : clamp(Math.round(cssWidth * devicePixelRatio), 640, 1920);
323
- const height = Number.isFinite(options.height)
324
- ? Math.trunc(options.height)
325
- : clamp(Math.round(cssHeight * devicePixelRatio), 360, 1080);
326
-
361
+ function resolveRenderSize(options) {
327
362
  return {
328
- width,
329
- height,
363
+ width: Number.isFinite(options.width) ? Math.trunc(options.width) : DEFAULT_RENDER_WIDTH,
364
+ height: Number.isFinite(options.height) ? Math.trunc(options.height) : DEFAULT_RENDER_HEIGHT,
330
365
  };
331
366
  }
332
367
 
@@ -415,13 +450,13 @@ export async function mountGpuProductStudio(options = {}, featureFlags = null) {
415
450
  throw new Error("Product Studio renderer loader must provide createWavefrontPathTracingComputeRenderer.");
416
451
  }
417
452
 
418
- const size = resolveRenderSize(root, options);
453
+ const size = resolveRenderSize(options);
419
454
  const lightingOptions = await resolveWavefrontLightingOptions(options);
420
455
  const renderer = await rendererModule.createWavefrontPathTracingComputeRenderer({
421
456
  canvas,
422
457
  width: size.width,
423
458
  height: size.height,
424
- maxDepth: Number.isFinite(options.maxDepth) ? options.maxDepth : 6,
459
+ maxDepth: Number.isFinite(options.maxDepth) ? options.maxDepth : DEFAULT_RENDER_MAX_DEPTH,
425
460
  tileSize: Number.isFinite(options.tileSize) ? options.tileSize : 128,
426
461
  samplesPerPixel: Number.isFinite(options.samplesPerPixel) ? options.samplesPerPixel : 8,
427
462
  denoise: options.denoise !== false,
@@ -1 +0,0 @@
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;\n\nfunction clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}\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\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 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 });\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(root, options) {\n const rect = root.getBoundingClientRect?.() ?? { width: 1280, height: 720 };\n const devicePixelRatio =\n Number.isFinite(options.devicePixelRatio)\n ? options.devicePixelRatio\n : Number.isFinite(globalThis.window?.devicePixelRatio)\n ? globalThis.window.devicePixelRatio\n : 1;\n const cssWidth = Number.isFinite(rect.width) && rect.width > 0 ? rect.width : 1280;\n const cssHeight =\n Number.isFinite(rect.height) && rect.height > 0 ? rect.height : cssWidth * (9 / 16);\n const width = Number.isFinite(options.width)\n ? Math.trunc(options.width)\n : clamp(Math.round(cssWidth * devicePixelRatio), 640, 1920);\n const height = Number.isFinite(options.height)\n ? Math.trunc(options.height)\n : clamp(Math.round(cssHeight * devicePixelRatio), 360, 1080);\n\n return {\n width,\n 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(root, 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 : 6,\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;AAE5B,SAAS,MAAM,OAAO,KAAK,KAAK;AAC9B,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAEA,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,I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