@aura3d/product-studio 1.0.6
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/dist/ProductAsset.d.ts +2 -0
- package/dist/ProductAsset.d.ts.map +1 -0
- package/dist/ProductAsset.js +2 -0
- package/dist/ProductAsset.js.map +1 -0
- package/dist/ProductAssetLoader.d.ts +3 -0
- package/dist/ProductAssetLoader.d.ts.map +1 -0
- package/dist/ProductAssetLoader.js +77 -0
- package/dist/ProductAssetLoader.js.map +1 -0
- package/dist/ProductCamera.d.ts +4 -0
- package/dist/ProductCamera.d.ts.map +1 -0
- package/dist/ProductCamera.js +45 -0
- package/dist/ProductCamera.js.map +1 -0
- package/dist/ProductDiagnostics.d.ts +4 -0
- package/dist/ProductDiagnostics.d.ts.map +1 -0
- package/dist/ProductDiagnostics.js +21 -0
- package/dist/ProductDiagnostics.js.map +1 -0
- package/dist/ProductExport.d.ts +4 -0
- package/dist/ProductExport.d.ts.map +1 -0
- package/dist/ProductExport.js +40 -0
- package/dist/ProductExport.js.map +1 -0
- package/dist/ProductFloor.d.ts +4 -0
- package/dist/ProductFloor.d.ts.map +1 -0
- package/dist/ProductFloor.js +15 -0
- package/dist/ProductFloor.js.map +1 -0
- package/dist/ProductLighting.d.ts +3 -0
- package/dist/ProductLighting.d.ts.map +1 -0
- package/dist/ProductLighting.js +42 -0
- package/dist/ProductLighting.js.map +1 -0
- package/dist/ProductMaterials.d.ts +5 -0
- package/dist/ProductMaterials.d.ts.map +1 -0
- package/dist/ProductMaterials.js +41 -0
- package/dist/ProductMaterials.js.map +1 -0
- package/dist/ProductRenderScene.d.ts +4 -0
- package/dist/ProductRenderScene.d.ts.map +1 -0
- package/dist/ProductRenderScene.js +46 -0
- package/dist/ProductRenderScene.js.map +1 -0
- package/dist/ProductShowcaseLayout.d.ts +32 -0
- package/dist/ProductShowcaseLayout.d.ts.map +1 -0
- package/dist/ProductShowcaseLayout.js +54 -0
- package/dist/ProductShowcaseLayout.js.map +1 -0
- package/dist/ProductStudio.d.ts +3 -0
- package/dist/ProductStudio.d.ts.map +1 -0
- package/dist/ProductStudio.js +51 -0
- package/dist/ProductStudio.js.map +1 -0
- package/dist/ProductTypes.d.ts +133 -0
- package/dist/ProductTypes.d.ts.map +1 -0
- package/dist/ProductTypes.js +2 -0
- package/dist/ProductTypes.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -0
- package/src/ProductAsset.ts +8 -0
- package/src/ProductAssetLoader.ts +83 -0
- package/src/ProductCamera.ts +48 -0
- package/src/ProductDiagnostics.ts +19 -0
- package/src/ProductExport.ts +43 -0
- package/src/ProductFloor.ts +17 -0
- package/src/ProductLighting.ts +52 -0
- package/src/ProductMaterials.ts +45 -0
- package/src/ProductRenderScene.ts +49 -0
- package/src/ProductShowcaseLayout.ts +90 -0
- package/src/ProductStudio.ts +72 -0
- package/src/ProductTypes.ts +158 -0
- package/src/index.ts +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductAsset.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductAsset.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductAsset.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductAsset.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductAssetLoader.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductAssetLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAmB,MAAM,gBAAgB,CAAC;AAE7F,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6B9F"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createGLTFRenderResources, GLTFLoader, LoadContext } from "@aura3d/assets";
|
|
2
|
+
export async function loadProductAsset(options) {
|
|
3
|
+
const loader = new GLTFLoader();
|
|
4
|
+
const context = new LoadContext();
|
|
5
|
+
const gltf = await loader.load({ url: options.url }, context);
|
|
6
|
+
const manifest = await loadManifest(options, gltf);
|
|
7
|
+
const resources = await createGLTFRenderResources(gltf, nativeImageDecodeAvailable() ? {} : { imageDecoder: fallbackImageDecoder });
|
|
8
|
+
const parts = manifest.parts.length > 0
|
|
9
|
+
? manifest.parts
|
|
10
|
+
: gltf.meshes.map((mesh) => ({ name: mesh.name, material: mesh.material, shape: "mesh" }));
|
|
11
|
+
const materials = manifest.materials.length > 0
|
|
12
|
+
? manifest.materials
|
|
13
|
+
: gltf.materials.map((material) => ({
|
|
14
|
+
name: material.name,
|
|
15
|
+
metallic: material.metallicFactor,
|
|
16
|
+
roughness: material.roughnessFactor,
|
|
17
|
+
alphaMode: material.alphaMode
|
|
18
|
+
}));
|
|
19
|
+
return {
|
|
20
|
+
id: manifest.id,
|
|
21
|
+
title: manifest.title,
|
|
22
|
+
category: manifest.category,
|
|
23
|
+
url: options.url,
|
|
24
|
+
manifest,
|
|
25
|
+
gltf,
|
|
26
|
+
resources,
|
|
27
|
+
parts,
|
|
28
|
+
materials
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function nativeImageDecodeAvailable() {
|
|
32
|
+
return typeof createImageBitmap === "function" || typeof globalThis.Image === "function";
|
|
33
|
+
}
|
|
34
|
+
function fallbackImageDecoder() {
|
|
35
|
+
return {
|
|
36
|
+
width: 1,
|
|
37
|
+
height: 1,
|
|
38
|
+
colorSpace: "srgb",
|
|
39
|
+
data: new Uint8Array([220, 220, 220, 255])
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function loadManifest(options, gltf) {
|
|
43
|
+
const manifestUrl = options.manifestUrl ?? options.url.replace(/\/[^/]+\.gltf(?:\?.*)?$/i, "/manifest.json");
|
|
44
|
+
if (typeof fetch === "function") {
|
|
45
|
+
const response = await fetch(manifestUrl);
|
|
46
|
+
if (response.ok) {
|
|
47
|
+
const manifest = await response.json();
|
|
48
|
+
return normalizeManifest(manifest, options);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return normalizeManifest({
|
|
52
|
+
schema: "a3d-product-manifest/fallback",
|
|
53
|
+
id: options.id ?? "product",
|
|
54
|
+
title: options.title ?? gltf.scenes[gltf.defaultScene]?.name ?? "Product",
|
|
55
|
+
category: options.category ?? "product",
|
|
56
|
+
gltf: options.url,
|
|
57
|
+
parts: gltf.meshes.map((mesh) => ({ name: mesh.name, material: mesh.material, shape: "mesh" })),
|
|
58
|
+
materials: gltf.materials.map((material) => ({
|
|
59
|
+
name: material.name,
|
|
60
|
+
metallic: material.metallicFactor,
|
|
61
|
+
roughness: material.roughnessFactor,
|
|
62
|
+
alphaMode: material.alphaMode
|
|
63
|
+
}))
|
|
64
|
+
}, options);
|
|
65
|
+
}
|
|
66
|
+
function normalizeManifest(manifest, options) {
|
|
67
|
+
return {
|
|
68
|
+
...manifest,
|
|
69
|
+
id: options.id ?? manifest.id,
|
|
70
|
+
title: options.title ?? manifest.title,
|
|
71
|
+
category: options.category ?? manifest.category,
|
|
72
|
+
gltf: manifest.gltf ?? options.url,
|
|
73
|
+
parts: manifest.parts ?? [],
|
|
74
|
+
materials: manifest.materials ?? []
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ProductAssetLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductAssetLoader.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductAssetLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,WAAW,EAAyB,MAAM,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,IAAI,SAAS;QACzE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,SAAS;QACvC,IAAI,EAAE,OAAO,CAAC,GAAG;QACjB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/F,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,QAAQ,EAAE,QAAQ,CAAC,cAAc;YACjC,SAAS,EAAE,QAAQ,CAAC,eAAe;YACnC,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC9B,CAAC,CAAC;KACJ,EAAE,OAAO,CAAC,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAyB,EAAE,OAAgC;IACpF,OAAO;QACL,GAAG,QAAQ;QACX,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE;QAC7B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK;QACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ;QAC/C,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG;QAClC,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,EAAE;QAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductAsset, ProductCameraFrame, ProductCameraOptions } from "./ProductTypes";
|
|
2
|
+
export declare function createProductCameraFrame(asset: ProductAsset, options?: ProductCameraOptions): ProductCameraFrame;
|
|
3
|
+
export declare function validateProductCameraFrame(frame: ProductCameraFrame): void;
|
|
4
|
+
//# sourceMappingURL=ProductCamera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductCamera.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductCamera.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAuB,MAAM,gBAAgB,CAAC;AASlH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,oBAAyB,GAAG,kBAAkB,CAoBpH;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAe1E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { computePerspectiveCameraFrame } from "@aura3d/rendering";
|
|
2
|
+
const CAMERA_PRESETS = {
|
|
3
|
+
"front-three-quarter": { yaw: -0.42, pitch: -0.16, padding: 0.22 },
|
|
4
|
+
"side-profile": { yaw: Math.PI / 2, pitch: -0.08, padding: 0.28 },
|
|
5
|
+
"top-detail": { yaw: -0.22, pitch: -0.92, padding: 0.2 },
|
|
6
|
+
"macro-detail": { yaw: -0.5, pitch: -0.12, padding: 0.02 }
|
|
7
|
+
};
|
|
8
|
+
export function createProductCameraFrame(asset, options = {}) {
|
|
9
|
+
const preset = options.preset ?? "front-three-quarter";
|
|
10
|
+
const viewport = options.viewport ?? { width: 1280, height: 900 };
|
|
11
|
+
const config = CAMERA_PRESETS[preset];
|
|
12
|
+
const frame = computePerspectiveCameraFrame(asset.resources.bounds, viewport, {
|
|
13
|
+
paddingRatio: options.paddingRatio ?? config.padding,
|
|
14
|
+
yawRadians: config.yaw,
|
|
15
|
+
pitchRadians: config.pitch,
|
|
16
|
+
nearPadding: preset === "macro-detail" ? 0.04 : 0.16,
|
|
17
|
+
farPadding: 2.4,
|
|
18
|
+
minDistance: preset === "macro-detail" ? 0.35 : 1
|
|
19
|
+
});
|
|
20
|
+
const camera = {
|
|
21
|
+
projectionMatrix: frame.projectionMatrix,
|
|
22
|
+
viewMatrix: frame.viewMatrix,
|
|
23
|
+
viewProjectionMatrix: frame.viewProjectionMatrix,
|
|
24
|
+
cameraPosition: frame.cameraPosition
|
|
25
|
+
};
|
|
26
|
+
validateProductCameraFrame({ preset, frame, camera });
|
|
27
|
+
return { preset, frame, camera };
|
|
28
|
+
}
|
|
29
|
+
export function validateProductCameraFrame(frame) {
|
|
30
|
+
const numbers = [
|
|
31
|
+
...frame.frame.center,
|
|
32
|
+
...frame.frame.cameraPosition,
|
|
33
|
+
frame.frame.near,
|
|
34
|
+
frame.frame.far,
|
|
35
|
+
frame.frame.aspect,
|
|
36
|
+
...Array.from(frame.frame.viewProjectionMatrix)
|
|
37
|
+
];
|
|
38
|
+
if (numbers.some((value) => !Number.isFinite(value))) {
|
|
39
|
+
throw new RangeError(`Product camera frame ${frame.preset} contains a non-finite value.`);
|
|
40
|
+
}
|
|
41
|
+
if (frame.frame.far <= frame.frame.near) {
|
|
42
|
+
throw new RangeError(`Product camera frame ${frame.preset} far plane must exceed near plane.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ProductCamera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductCamera.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAGlE,MAAM,cAAc,GAA4G;IAC9H,qBAAqB,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IAClE,cAAc,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IACjE,YAAY,EAAE,EAAE,GAAG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AAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAyB;IAClE,MAAM,OAAO,GAAG;QACd,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;QACrB,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc;QAC7B,KAAK,CAAC,KAAK,CAAC,IAAI;QAChB,KAAK,CAAC,KAAK,CAAC,GAAG;QACf,KAAK,CAAC,KAAK,CAAC,MAAM;QAClB,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC;KAChD,CAAC;IACF,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,UAAU,CAAC,wBAAwB,KAAK,CAAC,MAAM,+BAA+B,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,UAAU,CAAC,wBAAwB,KAAK,CAAC,MAAM,oCAAoC,CAAC,CAAC;IACjG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RenderDeviceDiagnostics } from "@aura3d/rendering";
|
|
2
|
+
import type { ProductAsset, ProductDiagnostics } from "./ProductTypes";
|
|
3
|
+
export declare function createProductDiagnostics(asset: ProductAsset, renderDiagnostics?: RenderDeviceDiagnostics): ProductDiagnostics;
|
|
4
|
+
//# sourceMappingURL=ProductDiagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductDiagnostics.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAAE,uBAAuB,GAAG,kBAAkB,CAe7H"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function createProductDiagnostics(asset, renderDiagnostics) {
|
|
2
|
+
const warnings = [];
|
|
3
|
+
if (asset.parts.length < 8)
|
|
4
|
+
warnings.push(`Product asset ${asset.id} has too few named parts for Product Studio.`);
|
|
5
|
+
if (asset.materials.length < 3)
|
|
6
|
+
warnings.push(`Product asset ${asset.id} has too few named materials for Product Studio.`);
|
|
7
|
+
if (asset.gltf.images.length === 0 || asset.gltf.textures.length === 0)
|
|
8
|
+
warnings.push(`Product asset ${asset.id} is missing texture-backed materials.`);
|
|
9
|
+
if (asset.gltf.meshes.some((mesh) => !mesh.name))
|
|
10
|
+
warnings.push(`Product asset ${asset.id} contains unnamed meshes.`);
|
|
11
|
+
return {
|
|
12
|
+
assetId: asset.id,
|
|
13
|
+
partCount: asset.parts.length,
|
|
14
|
+
materialCount: asset.materials.length,
|
|
15
|
+
textureCount: asset.gltf.textures.length,
|
|
16
|
+
meshCount: asset.gltf.meshes.length,
|
|
17
|
+
warnings,
|
|
18
|
+
...(renderDiagnostics ? { renderDiagnostics } : {})
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ProductDiagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductDiagnostics.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductDiagnostics.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,wBAAwB,CAAC,KAAmB,EAAE,iBAA2C;IACvG,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE,8CAA8C,CAAC,CAAC;IACnH,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE,kDAAkD,CAAC,CAAC;IAC3H,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE,uCAAuC,CAAC,CAAC;IACxJ,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE,2BAA2B,CAAC,CAAC;IACtH,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;QAC7B,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;QACrC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM;QACxC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;QACnC,QAAQ;QACR,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductExportResult, ProductRenderScene, ProductSceneManifest } from "./ProductTypes";
|
|
2
|
+
export declare function exportProductRender(canvas: HTMLCanvasElement | OffscreenCanvas, scene: ProductRenderScene): Promise<ProductExportResult>;
|
|
3
|
+
export declare function exportProductSceneManifest(scene: ProductRenderScene): ProductSceneManifest;
|
|
4
|
+
//# sourceMappingURL=ProductExport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductExport.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEpG,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAQ9I;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,kBAAkB,GAAG,oBAAoB,CAY1F"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export async function exportProductRender(canvas, scene) {
|
|
2
|
+
const dataUrl = await canvasToDataUrl(canvas);
|
|
3
|
+
return {
|
|
4
|
+
mimeType: "image/png",
|
|
5
|
+
dataUrl,
|
|
6
|
+
byteLength: dataUrl.length,
|
|
7
|
+
manifest: exportProductSceneManifest(scene)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function exportProductSceneManifest(scene) {
|
|
11
|
+
return {
|
|
12
|
+
schema: "a3d-product-studio-scene",
|
|
13
|
+
assetId: scene.asset.id,
|
|
14
|
+
title: scene.asset.title,
|
|
15
|
+
partCount: scene.asset.parts.length,
|
|
16
|
+
materialCount: scene.asset.materials.length,
|
|
17
|
+
materialMode: scene.materialMode.id,
|
|
18
|
+
lightingPreset: scene.lighting.preset,
|
|
19
|
+
cameraPreset: scene.cameraFrame.preset,
|
|
20
|
+
generatedAt: new Date().toISOString()
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function canvasToDataUrl(canvas) {
|
|
24
|
+
if ("toDataURL" in canvas && typeof canvas.toDataURL === "function") {
|
|
25
|
+
return canvas.toDataURL("image/png");
|
|
26
|
+
}
|
|
27
|
+
if ("convertToBlob" in canvas && typeof canvas.convertToBlob === "function") {
|
|
28
|
+
const blob = await canvas.convertToBlob({ type: "image/png" });
|
|
29
|
+
const buffer = await blob.arrayBuffer();
|
|
30
|
+
return `data:image/png;base64,${base64(buffer)}`;
|
|
31
|
+
}
|
|
32
|
+
throw new Error("Product render export requires HTMLCanvasElement.toDataURL or OffscreenCanvas.convertToBlob.");
|
|
33
|
+
}
|
|
34
|
+
function base64(buffer) {
|
|
35
|
+
let binary = "";
|
|
36
|
+
for (const byte of new Uint8Array(buffer))
|
|
37
|
+
binary += String.fromCharCode(byte);
|
|
38
|
+
return btoa(binary);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ProductExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductExport.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductExport.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAA2C,EAAE,KAAyB;IAC9G,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO;QACL,QAAQ,EAAE,WAAW;QACrB,OAAO;QACP,UAAU,EAAE,OAAO,CAAC,MAAM;QAC1B,QAAQ,EAAE,0BAA0B,CAAC,KAAK,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAyB;IAClE,OAAO;QACL,MAAM,EAAE,0BAA0B;QAClC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;QACvB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK;QACxB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM;QACnC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM;QAC3C,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE;QACnC,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM;QACrC,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM;QACtC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACtC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,MAA2C;IACxE,IAAI,WAAW,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QACpE,OAAO,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,eAAe,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU,EAAE,CAAC;QAC5E,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QACxC,OAAO,yBAAyB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACnD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAC;AAClH,CAAC;AAED,SAAS,MAAM,CAAC,MAAmB;IACjC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/E,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductFloor.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductFloor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAWlE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { composeMat4 } from "@aura3d/scene";
|
|
2
|
+
import { Geometry, PBRMaterial } from "@aura3d/rendering";
|
|
3
|
+
export function createProductFloor(asset) {
|
|
4
|
+
const bounds = asset.resources.bounds;
|
|
5
|
+
const width = Math.max(bounds.max[0] - bounds.min[0], bounds.max[2] - bounds.min[2], 1) * 3.2;
|
|
6
|
+
const y = bounds.min[1] - 0.04;
|
|
7
|
+
return {
|
|
8
|
+
label: "product-studio-floor",
|
|
9
|
+
geometry: Geometry.texturedCube(1),
|
|
10
|
+
material: new PBRMaterial({ name: "product-studio-floor-material", baseColor: [0.72, 0.73, 0.72, 1], metallic: 0, roughness: 0.62 }),
|
|
11
|
+
includeInAutoFrame: false,
|
|
12
|
+
modelMatrix: composeMat4([0, y, 0], [0, 0, 0, 1], [width, 0.035, width])
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ProductFloor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductFloor.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductFloor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI1D,MAAM,UAAU,kBAAkB,CAAC,KAAmB;IACpD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;IAC9F,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC/B,OAAO;QACL,KAAK,EAAE,sBAAsB;QAC7B,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;QAClC,QAAQ,EAAE,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QACpI,kBAAkB,EAAE,KAAK;QACzB,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductLighting.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductLighting.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEnF,wBAAgB,2BAA2B,CAAC,MAAM,GAAE,qBAAyC,GAAG,qBAAqB,CAepH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DirectionalLight } from "@aura3d/scene";
|
|
2
|
+
import { createLightingDefault } from "@aura3d/rendering";
|
|
3
|
+
export function createProductLightingPreset(preset = "catalog-softbox") {
|
|
4
|
+
const base = createLightingDefault(preset === "inspection-bay" ? "interiorGallery" : preset === "hero-contrast" ? "gameNight" : "studioProduct");
|
|
5
|
+
const key = makeDirectionalLight("product-key-light", [1, 0.92, 0.82], preset === "hero-contrast" ? 3.6 : 2.8, [0.42, -0.72, -0.55], true);
|
|
6
|
+
const rim = makeDirectionalLight("product-rim-light", [0.58, 0.68, 1], preset === "inspection-bay" ? 0.8 : 1.15, [-0.56, -0.28, 0.78], false);
|
|
7
|
+
return {
|
|
8
|
+
preset,
|
|
9
|
+
environmentLighting: base.environmentLighting,
|
|
10
|
+
postprocess: base.postprocess,
|
|
11
|
+
shadow: {
|
|
12
|
+
...base.shadow,
|
|
13
|
+
light: key.source,
|
|
14
|
+
strength: preset === "inspection-bay" ? 0.32 : preset === "hero-contrast" ? 0.5 : 0.38
|
|
15
|
+
},
|
|
16
|
+
lights: [key, rim]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function makeDirectionalLight(name, color, intensity, direction, castsShadow) {
|
|
20
|
+
const source = new DirectionalLight(name);
|
|
21
|
+
source.color = [...color];
|
|
22
|
+
source.intensity = intensity;
|
|
23
|
+
source.castsShadow = castsShadow;
|
|
24
|
+
return {
|
|
25
|
+
kind: "directional",
|
|
26
|
+
color,
|
|
27
|
+
intensity,
|
|
28
|
+
position: [0, 0, 0],
|
|
29
|
+
direction: normalize(direction),
|
|
30
|
+
range: 0,
|
|
31
|
+
spotAngle: 0,
|
|
32
|
+
penumbra: 0,
|
|
33
|
+
castsShadow,
|
|
34
|
+
layerMask: 0xffffffff,
|
|
35
|
+
source
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function normalize(value) {
|
|
39
|
+
const length = Math.hypot(value[0], value[1], value[2]);
|
|
40
|
+
return length === 0 ? [0, -1, -1] : [value[0] / length, value[1] / length, value[2] / length];
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ProductLighting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductLighting.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductLighting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,MAAM,UAAU,2BAA2B,CAAC,SAAgC,iBAAiB;IAC3F,MAAM,IAAI,GAAG,qBAAqB,CAAC,MAAM,KAAK,gBAAgB,CAAC,CAAC,CAAC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AC;IACtD,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,KAAK;QACL,SAAS;QACT,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnB,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC;QAC/B,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,CAAC;QACX,WAAW;QACX,SAAS,EAAE,UAAU;QACrB,MAAM;KACP,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAwC;IACzD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Material } from "@aura3d/rendering";
|
|
2
|
+
import type { ProductAsset, ProductMaterialMode, ProductMaterialModeId } from "./ProductTypes";
|
|
3
|
+
export declare function createProductMaterialMode(id?: ProductMaterialModeId): ProductMaterialMode;
|
|
4
|
+
export declare function applyProductMaterialMode(asset: ProductAsset, mode: ProductMaterialMode): ReadonlyMap<string, Material>;
|
|
5
|
+
//# sourceMappingURL=ProductMaterials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductMaterials.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductMaterials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE/F,wBAAgB,yBAAyB,CAAC,EAAE,GAAE,qBAA+B,GAAG,mBAAmB,CAalG;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,mBAAmB,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAWtH"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PBRMaterial } from "@aura3d/rendering";
|
|
2
|
+
export function createProductMaterialMode(id = "asset") {
|
|
3
|
+
switch (id) {
|
|
4
|
+
case "asset":
|
|
5
|
+
return { id, label: "Asset", description: "Use product-authored glTF materials." };
|
|
6
|
+
case "clay":
|
|
7
|
+
return { id, label: "Clay", description: "Neutral clay material for shape review." };
|
|
8
|
+
case "matte":
|
|
9
|
+
return { id, label: "Matte", description: "Low-glare product material pass." };
|
|
10
|
+
case "metal-check":
|
|
11
|
+
return { id, label: "Metal", description: "High-metallic inspection material pass." };
|
|
12
|
+
case "contrast":
|
|
13
|
+
return { id, label: "Contrast", description: "High contrast material separation pass." };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function applyProductMaterialMode(asset, mode) {
|
|
17
|
+
if (mode.id === "asset") {
|
|
18
|
+
return asset.resources.materialLibrary;
|
|
19
|
+
}
|
|
20
|
+
const output = new Map();
|
|
21
|
+
let index = 0;
|
|
22
|
+
for (const key of asset.resources.materialLibrary.keys()) {
|
|
23
|
+
output.set(key, materialForMode(mode.id, index));
|
|
24
|
+
index += 1;
|
|
25
|
+
}
|
|
26
|
+
return output;
|
|
27
|
+
}
|
|
28
|
+
function materialForMode(mode, index) {
|
|
29
|
+
if (mode === "metal-check") {
|
|
30
|
+
return new PBRMaterial({ name: `product-metal-check-${index}`, baseColor: [0.72, 0.72, 0.68, 1], metallic: 1, roughness: 0.18 });
|
|
31
|
+
}
|
|
32
|
+
if (mode === "contrast") {
|
|
33
|
+
const palette = [[0.9, 0.16, 0.12, 1], [0.1, 0.42, 0.86, 1], [0.96, 0.76, 0.18, 1], [0.16, 0.72, 0.38, 1]];
|
|
34
|
+
return new PBRMaterial({ name: `product-contrast-${index}`, baseColor: palette[index % palette.length], metallic: 0.15, roughness: 0.42 });
|
|
35
|
+
}
|
|
36
|
+
if (mode === "matte") {
|
|
37
|
+
return new PBRMaterial({ name: `product-matte-${index}`, baseColor: [0.56, 0.6, 0.58, 1], metallic: 0, roughness: 0.86 });
|
|
38
|
+
}
|
|
39
|
+
return new PBRMaterial({ name: `product-clay-${index}`, baseColor: [0.74, 0.7, 0.64, 1], metallic: 0, roughness: 0.74 });
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=ProductMaterials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductMaterials.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductMaterials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,UAAU,yBAAyB,CAAC,KAA4B,OAAO;IAC3E,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,OAAO;YACV,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;QACrF,KAAK,MAAM;YACT,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;QACvF,KAAK,OAAO;YACV,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;QACjF,KAAK,aAAa;YAChB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,yCAAyC,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,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAU,CAAC;QACpH,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,oBAAoB,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7I,CAAC;IACD,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,iBAAiB,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5H,CAAC;IACD,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,gBAAgB,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3H,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductAsset, ProductRenderScene, ProductRenderSceneOptions } from "./ProductTypes";
|
|
2
|
+
export declare function createProductRenderScene(asset: ProductAsset, options?: ProductRenderSceneOptions): ProductRenderScene;
|
|
3
|
+
export declare function updateProductRenderScene(scene: ProductRenderScene, options?: ProductRenderSceneOptions): ProductRenderScene;
|
|
4
|
+
//# sourceMappingURL=ProductRenderScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductRenderScene.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductRenderScene.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAElG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,yBAA8B,GAAG,kBAAkB,CAgCzH;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,GAAE,yBAA8B,GAAG,kBAAkB,CAO/H"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createGLTFRenderSource } from "@aura3d/assets";
|
|
2
|
+
import { createProductCameraFrame } from "./ProductCamera.js";
|
|
3
|
+
import { createProductFloor } from "./ProductFloor.js";
|
|
4
|
+
import { createProductLightingPreset } from "./ProductLighting.js";
|
|
5
|
+
import { applyProductMaterialMode, createProductMaterialMode } from "./ProductMaterials.js";
|
|
6
|
+
export function createProductRenderScene(asset, options = {}) {
|
|
7
|
+
const lighting = options.lighting ?? createProductLightingPreset();
|
|
8
|
+
const camera = options.camera ?? createProductCameraFrame(asset);
|
|
9
|
+
const materialMode = options.materialMode ?? createProductMaterialMode("asset");
|
|
10
|
+
const renderItems = options.floor === false ? [] : [createProductFloor(asset)];
|
|
11
|
+
const baseSource = createGLTFRenderSource({
|
|
12
|
+
scene: asset.resources.scene,
|
|
13
|
+
geometryLibrary: asset.resources.geometryLibrary,
|
|
14
|
+
materialLibrary: applyProductMaterialMode(asset, materialMode),
|
|
15
|
+
morphTargetLibrary: asset.resources.morphTargetLibrary,
|
|
16
|
+
bounds: asset.resources.bounds
|
|
17
|
+
}, {
|
|
18
|
+
qualityPreset: "hdr-studio-preview",
|
|
19
|
+
environmentLighting: lighting.environmentLighting,
|
|
20
|
+
postprocess: lighting.postprocess,
|
|
21
|
+
shadow: lighting.shadow,
|
|
22
|
+
renderItems,
|
|
23
|
+
cameraPolicy: "require",
|
|
24
|
+
cameraPosition: camera.frame.cameraPosition,
|
|
25
|
+
frustumCulling: true
|
|
26
|
+
});
|
|
27
|
+
const source = { ...baseSource, collectedLights: lighting.lights };
|
|
28
|
+
return {
|
|
29
|
+
asset,
|
|
30
|
+
source,
|
|
31
|
+
camera: camera.camera,
|
|
32
|
+
cameraFrame: camera,
|
|
33
|
+
lighting,
|
|
34
|
+
materialMode,
|
|
35
|
+
renderItems
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function updateProductRenderScene(scene, options = {}) {
|
|
39
|
+
return createProductRenderScene(scene.asset, {
|
|
40
|
+
lighting: options.lighting ?? scene.lighting,
|
|
41
|
+
camera: options.camera ?? scene.cameraFrame,
|
|
42
|
+
materialMode: options.materialMode ?? scene.materialMode,
|
|
43
|
+
floor: options.floor
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ProductRenderScene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductRenderScene.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductRenderScene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,MAAM,UAAU,wBAAwB,CAAC,KAAmB,EAAE,UAAqC,EAAE;IACnG,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,2BAA2B,EAAE,CAAC;IACnE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,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
|
|
|
1
|
+
export type ProductShowcaseSlot = "hero" | "left-detail" | "left-transparent" | "right-variant";
|
|
2
|
+
export interface ProductShowcaseSlotInput {
|
|
3
|
+
readonly assetId: string;
|
|
4
|
+
readonly slot: ProductShowcaseSlot;
|
|
5
|
+
readonly materialVariantControl?: string;
|
|
6
|
+
readonly defaultMaterialVariant?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ProductShowcaseLayoutItem {
|
|
9
|
+
readonly assetId: string;
|
|
10
|
+
readonly slot: ProductShowcaseSlot;
|
|
11
|
+
readonly position: readonly [number, number, number];
|
|
12
|
+
readonly scale: readonly [number, number, number];
|
|
13
|
+
readonly targetHeight: number;
|
|
14
|
+
readonly yawRadians: number;
|
|
15
|
+
readonly turntableSpeedRadiansPerSecond: number;
|
|
16
|
+
readonly materialVariantControl?: string;
|
|
17
|
+
readonly defaultMaterialVariant?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ProductShowcaseFrame {
|
|
20
|
+
readonly boundsMin: readonly [number, number, number];
|
|
21
|
+
readonly boundsMax: readonly [number, number, number];
|
|
22
|
+
readonly heroPaddingRatio: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ProductShowcaseLayout {
|
|
25
|
+
readonly schema: "a3d-product-showcase-layout";
|
|
26
|
+
readonly mode: "hero-product-with-secondary-detail";
|
|
27
|
+
readonly items: readonly ProductShowcaseLayoutItem[];
|
|
28
|
+
readonly frame: ProductShowcaseFrame;
|
|
29
|
+
readonly limitations: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export declare function createProductShowcaseLayout(slots: readonly ProductShowcaseSlotInput[]): ProductShowcaseLayout;
|
|
32
|
+
//# sourceMappingURL=ProductShowcaseLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductShowcaseLayout.d.ts","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductShowcaseLayout.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAA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rD,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAuCD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,SAAS,wBAAwB,EAAE,GAAG,qBAAqB,CAiB7G"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const COMPACT_SLOT_LAYOUT = {
|
|
2
|
+
hero: {
|
|
3
|
+
position: [-0.28, -0.88, 0.0],
|
|
4
|
+
scale: [1, 1, 1],
|
|
5
|
+
targetHeight: 0.92,
|
|
6
|
+
yawRadians: -0.38,
|
|
7
|
+
turntableSpeedRadiansPerSecond: 0.001
|
|
8
|
+
},
|
|
9
|
+
"left-detail": {
|
|
10
|
+
position: [-2.28, -0.86, -0.72],
|
|
11
|
+
scale: [1, 1, 1],
|
|
12
|
+
targetHeight: 0.24,
|
|
13
|
+
yawRadians: 0.34,
|
|
14
|
+
turntableSpeedRadiansPerSecond: 0.1
|
|
15
|
+
},
|
|
16
|
+
"left-transparent": {
|
|
17
|
+
position: [-2.36, -0.87, 0.68],
|
|
18
|
+
scale: [1, 1, 1],
|
|
19
|
+
targetHeight: 0.11,
|
|
20
|
+
yawRadians: 0.58,
|
|
21
|
+
turntableSpeedRadiansPerSecond: 0.06
|
|
22
|
+
},
|
|
23
|
+
"right-variant": {
|
|
24
|
+
position: [2.34, -0.86, 0.58],
|
|
25
|
+
scale: [1, 1, 1],
|
|
26
|
+
targetHeight: 0.24,
|
|
27
|
+
yawRadians: -0.82,
|
|
28
|
+
turntableSpeedRadiansPerSecond: 0.08
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const COMPACT_FRAME = {
|
|
32
|
+
boundsMin: [-1.3, -1.0, -0.78],
|
|
33
|
+
boundsMax: [1.3, 0.5, 0.86],
|
|
34
|
+
heroPaddingRatio: 0.02
|
|
35
|
+
};
|
|
36
|
+
export function createProductShowcaseLayout(slots) {
|
|
37
|
+
return {
|
|
38
|
+
schema: "a3d-product-showcase-layout",
|
|
39
|
+
mode: "hero-product-with-secondary-detail",
|
|
40
|
+
items: slots.map((slot) => ({
|
|
41
|
+
assetId: slot.assetId,
|
|
42
|
+
slot: slot.slot,
|
|
43
|
+
...COMPACT_SLOT_LAYOUT[slot.slot],
|
|
44
|
+
...(slot.materialVariantControl ? { materialVariantControl: slot.materialVariantControl } : {}),
|
|
45
|
+
...(slot.defaultMaterialVariant ? { defaultMaterialVariant: slot.defaultMaterialVariant } : {})
|
|
46
|
+
})),
|
|
47
|
+
frame: COMPACT_FRAME,
|
|
48
|
+
limitations: [
|
|
49
|
+
"This layout helper owns deterministic hero-first product staging and camera bounds; secondary products remain loaded but are kept outside the default hero frame so they cannot read as debris attached to the car.",
|
|
50
|
+
"The layout does not infer a semantic part graph from imported GLBs; imported mesh triangle picking, authored exploded timelines, and physical contact shadows remain separate engine/runtime capabilities."
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ProductShowcaseLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductShowcaseLayout.js","sourceRoot":"","sources":["../../../../packages/product-studio/src/ProductShowcaseLayout.ts"],"names":[],"mappings":"AAmCA,MAAM,mBAAmB,GAA2I;IAClK,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;QAC7B,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,CAAC,IAAI;QACjB,8BAA8B,EAAE,KAAK;KACtC;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;QAC/B,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChB,YAAY,EAAE,IAAI;QA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