@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.
Files changed (66) hide show
  1. package/dist/ProductAsset.d.ts +2 -0
  2. package/dist/ProductAsset.d.ts.map +1 -0
  3. package/dist/ProductAsset.js +2 -0
  4. package/dist/ProductAsset.js.map +1 -0
  5. package/dist/ProductAssetLoader.d.ts +3 -0
  6. package/dist/ProductAssetLoader.d.ts.map +1 -0
  7. package/dist/ProductAssetLoader.js +77 -0
  8. package/dist/ProductAssetLoader.js.map +1 -0
  9. package/dist/ProductCamera.d.ts +4 -0
  10. package/dist/ProductCamera.d.ts.map +1 -0
  11. package/dist/ProductCamera.js +45 -0
  12. package/dist/ProductCamera.js.map +1 -0
  13. package/dist/ProductDiagnostics.d.ts +4 -0
  14. package/dist/ProductDiagnostics.d.ts.map +1 -0
  15. package/dist/ProductDiagnostics.js +21 -0
  16. package/dist/ProductDiagnostics.js.map +1 -0
  17. package/dist/ProductExport.d.ts +4 -0
  18. package/dist/ProductExport.d.ts.map +1 -0
  19. package/dist/ProductExport.js +40 -0
  20. package/dist/ProductExport.js.map +1 -0
  21. package/dist/ProductFloor.d.ts +4 -0
  22. package/dist/ProductFloor.d.ts.map +1 -0
  23. package/dist/ProductFloor.js +15 -0
  24. package/dist/ProductFloor.js.map +1 -0
  25. package/dist/ProductLighting.d.ts +3 -0
  26. package/dist/ProductLighting.d.ts.map +1 -0
  27. package/dist/ProductLighting.js +42 -0
  28. package/dist/ProductLighting.js.map +1 -0
  29. package/dist/ProductMaterials.d.ts +5 -0
  30. package/dist/ProductMaterials.d.ts.map +1 -0
  31. package/dist/ProductMaterials.js +41 -0
  32. package/dist/ProductMaterials.js.map +1 -0
  33. package/dist/ProductRenderScene.d.ts +4 -0
  34. package/dist/ProductRenderScene.d.ts.map +1 -0
  35. package/dist/ProductRenderScene.js +46 -0
  36. package/dist/ProductRenderScene.js.map +1 -0
  37. package/dist/ProductShowcaseLayout.d.ts +32 -0
  38. package/dist/ProductShowcaseLayout.d.ts.map +1 -0
  39. package/dist/ProductShowcaseLayout.js +54 -0
  40. package/dist/ProductShowcaseLayout.js.map +1 -0
  41. package/dist/ProductStudio.d.ts +3 -0
  42. package/dist/ProductStudio.d.ts.map +1 -0
  43. package/dist/ProductStudio.js +51 -0
  44. package/dist/ProductStudio.js.map +1 -0
  45. package/dist/ProductTypes.d.ts +133 -0
  46. package/dist/ProductTypes.d.ts.map +1 -0
  47. package/dist/ProductTypes.js +2 -0
  48. package/dist/ProductTypes.js.map +1 -0
  49. package/dist/index.d.ts +13 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +11 -0
  52. package/dist/index.js.map +1 -0
  53. package/package.json +19 -0
  54. package/src/ProductAsset.ts +8 -0
  55. package/src/ProductAssetLoader.ts +83 -0
  56. package/src/ProductCamera.ts +48 -0
  57. package/src/ProductDiagnostics.ts +19 -0
  58. package/src/ProductExport.ts +43 -0
  59. package/src/ProductFloor.ts +17 -0
  60. package/src/ProductLighting.ts +52 -0
  61. package/src/ProductMaterials.ts +45 -0
  62. package/src/ProductRenderScene.ts +49 -0
  63. package/src/ProductShowcaseLayout.ts +90 -0
  64. package/src/ProductStudio.ts +72 -0
  65. package/src/ProductTypes.ts +158 -0
  66. package/src/index.ts +12 -0
@@ -0,0 +1,90 @@
1
+ export type ProductShowcaseSlot = "hero" | "left-detail" | "left-transparent" | "right-variant";
2
+
3
+ export interface ProductShowcaseSlotInput {
4
+ readonly assetId: string;
5
+ readonly slot: ProductShowcaseSlot;
6
+ readonly materialVariantControl?: string;
7
+ readonly defaultMaterialVariant?: string;
8
+ }
9
+
10
+ export interface ProductShowcaseLayoutItem {
11
+ readonly assetId: string;
12
+ readonly slot: ProductShowcaseSlot;
13
+ readonly position: readonly [number, number, number];
14
+ readonly scale: readonly [number, number, number];
15
+ readonly targetHeight: number;
16
+ readonly yawRadians: number;
17
+ readonly turntableSpeedRadiansPerSecond: number;
18
+ readonly materialVariantControl?: string;
19
+ readonly defaultMaterialVariant?: string;
20
+ }
21
+
22
+ export interface ProductShowcaseFrame {
23
+ readonly boundsMin: readonly [number, number, number];
24
+ readonly boundsMax: readonly [number, number, number];
25
+ readonly heroPaddingRatio: number;
26
+ }
27
+
28
+ export interface ProductShowcaseLayout {
29
+ readonly schema: "a3d-product-showcase-layout";
30
+ readonly mode: "hero-product-with-secondary-detail";
31
+ readonly items: readonly ProductShowcaseLayoutItem[];
32
+ readonly frame: ProductShowcaseFrame;
33
+ readonly limitations: readonly string[];
34
+ }
35
+
36
+ const COMPACT_SLOT_LAYOUT: Record<ProductShowcaseSlot, Omit<ProductShowcaseLayoutItem, "assetId" | "slot" | "materialVariantControl" | "defaultMaterialVariant">> = {
37
+ hero: {
38
+ position: [-0.28, -0.88, 0.0],
39
+ scale: [1, 1, 1],
40
+ targetHeight: 0.92,
41
+ yawRadians: -0.38,
42
+ turntableSpeedRadiansPerSecond: 0.001
43
+ },
44
+ "left-detail": {
45
+ position: [-2.28, -0.86, -0.72],
46
+ scale: [1, 1, 1],
47
+ targetHeight: 0.24,
48
+ yawRadians: 0.34,
49
+ turntableSpeedRadiansPerSecond: 0.1
50
+ },
51
+ "left-transparent": {
52
+ position: [-2.36, -0.87, 0.68],
53
+ scale: [1, 1, 1],
54
+ targetHeight: 0.11,
55
+ yawRadians: 0.58,
56
+ turntableSpeedRadiansPerSecond: 0.06
57
+ },
58
+ "right-variant": {
59
+ position: [2.34, -0.86, 0.58],
60
+ scale: [1, 1, 1],
61
+ targetHeight: 0.24,
62
+ yawRadians: -0.82,
63
+ turntableSpeedRadiansPerSecond: 0.08
64
+ }
65
+ };
66
+
67
+ const COMPACT_FRAME: ProductShowcaseFrame = {
68
+ boundsMin: [-1.3, -1.0, -0.78],
69
+ boundsMax: [1.3, 0.5, 0.86],
70
+ heroPaddingRatio: 0.02
71
+ };
72
+
73
+ export function createProductShowcaseLayout(slots: readonly ProductShowcaseSlotInput[]): ProductShowcaseLayout {
74
+ return {
75
+ schema: "a3d-product-showcase-layout",
76
+ mode: "hero-product-with-secondary-detail",
77
+ items: slots.map((slot) => ({
78
+ assetId: slot.assetId,
79
+ slot: slot.slot,
80
+ ...COMPACT_SLOT_LAYOUT[slot.slot],
81
+ ...(slot.materialVariantControl ? { materialVariantControl: slot.materialVariantControl } : {}),
82
+ ...(slot.defaultMaterialVariant ? { defaultMaterialVariant: slot.defaultMaterialVariant } : {})
83
+ })),
84
+ frame: COMPACT_FRAME,
85
+ limitations: [
86
+ "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.",
87
+ "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."
88
+ ]
89
+ };
90
+ }
@@ -0,0 +1,72 @@
1
+ import { Renderer } from "@aura3d/rendering";
2
+ import { createProductCameraFrame } from "./ProductCamera";
3
+ import { exportProductRender, exportProductSceneManifest } from "./ProductExport";
4
+ import { createProductLightingPreset } from "./ProductLighting";
5
+ import { createProductMaterialMode } from "./ProductMaterials";
6
+ import type {
7
+ ProductAsset,
8
+ ProductCameraFrame,
9
+ ProductCameraPreset,
10
+ ProductExportResult,
11
+ ProductLightingConfig,
12
+ ProductLightingPreset,
13
+ ProductMaterialMode,
14
+ ProductMaterialModeId,
15
+ ProductRenderScene,
16
+ ProductSceneManifest,
17
+ ProductStudio,
18
+ ProductStudioOptions
19
+ } from "./ProductTypes";
20
+
21
+ export async function createProductStudio(options: ProductStudioOptions = {}): Promise<ProductStudio> {
22
+ const renderer = await Renderer.create({
23
+ clearColor: [0.03, 0.035, 0.038, 1],
24
+ width: options.width ?? 1280,
25
+ height: options.height ?? 900,
26
+ ...options
27
+ });
28
+ return new ProductStudioRuntime(renderer, options.canvas);
29
+ }
30
+
31
+ class ProductStudioRuntime implements ProductStudio {
32
+ constructor(
33
+ public readonly renderer: Renderer,
34
+ private readonly canvas?: HTMLCanvasElement | OffscreenCanvas
35
+ ) {}
36
+
37
+ render(scene: ProductRenderScene) {
38
+ return this.renderer.render(scene.source, scene.camera);
39
+ }
40
+
41
+ resize(width: number, height: number): void {
42
+ this.renderer.resize(width, height);
43
+ }
44
+
45
+ setLighting(preset: ProductLightingPreset): ProductLightingConfig {
46
+ return createProductLightingPreset(preset);
47
+ }
48
+
49
+ setCamera(asset: ProductAsset, preset: ProductCameraPreset, viewport = { width: 1280, height: 900 }): ProductCameraFrame {
50
+ return createProductCameraFrame(asset, { preset, viewport });
51
+ }
52
+
53
+ setMaterialMode(mode: ProductMaterialModeId): ProductMaterialMode {
54
+ return createProductMaterialMode(mode);
55
+ }
56
+
57
+ async exportPng(scene: ProductRenderScene): Promise<ProductExportResult> {
58
+ if (!this.canvas) {
59
+ throw new Error("ProductStudio exportPng requires a canvas-backed studio.");
60
+ }
61
+ this.render(scene);
62
+ return exportProductRender(this.canvas, scene);
63
+ }
64
+
65
+ exportSceneManifest(scene: ProductRenderScene): ProductSceneManifest {
66
+ return exportProductSceneManifest(scene);
67
+ }
68
+
69
+ dispose(): void {
70
+ this.renderer.dispose();
71
+ }
72
+ }
@@ -0,0 +1,158 @@
1
+ import type { GLTFAsset, GLTFRenderResources } from "@aura3d/assets";
2
+ import type {
3
+ CameraLike,
4
+ CollectedLight,
5
+ EnvironmentLightingOptions,
6
+ PerspectiveCameraFrame,
7
+ RenderDeviceDiagnostics,
8
+ RenderItem,
9
+ Renderer,
10
+ RendererOptions,
11
+ RendererPostProcessOptions,
12
+ RendererShadowOptions,
13
+ RenderSource
14
+ } from "@aura3d/rendering";
15
+
16
+ export type ProductAssetId = "camera-kit" | "speaker" | "watch" | (string & {});
17
+ export type ProductLightingPreset = "catalog-softbox" | "inspection-bay" | "hero-contrast";
18
+ export type ProductCameraPreset = "front-three-quarter" | "side-profile" | "top-detail" | "macro-detail";
19
+ export type ProductMaterialModeId = "asset" | "clay" | "matte" | "metal-check" | "contrast";
20
+
21
+ export interface ProductPartDescriptor {
22
+ readonly name: string;
23
+ readonly material: string;
24
+ readonly shape?: string;
25
+ }
26
+
27
+ export interface ProductMaterialDescriptor {
28
+ readonly name: string;
29
+ readonly metallic: number;
30
+ readonly roughness: number;
31
+ readonly alphaMode: "OPAQUE" | "BLEND" | "MASK";
32
+ readonly textureSet?: string;
33
+ }
34
+
35
+ export interface ProductManifest {
36
+ readonly schema: string;
37
+ readonly id: ProductAssetId;
38
+ readonly title: string;
39
+ readonly category: string;
40
+ readonly gltf: string;
41
+ readonly parts: readonly ProductPartDescriptor[];
42
+ readonly materials: readonly ProductMaterialDescriptor[];
43
+ readonly rejectedInputs?: readonly string[];
44
+ readonly requirements?: Readonly<Record<string, unknown>>;
45
+ }
46
+
47
+ export interface ProductAsset {
48
+ readonly id: ProductAssetId;
49
+ readonly title: string;
50
+ readonly category: string;
51
+ readonly url: string;
52
+ readonly manifest: ProductManifest;
53
+ readonly gltf: GLTFAsset;
54
+ readonly resources: GLTFRenderResources;
55
+ readonly parts: readonly ProductPartDescriptor[];
56
+ readonly materials: readonly ProductMaterialDescriptor[];
57
+ }
58
+
59
+ export interface ProductAssetLoadOptions {
60
+ readonly url: string;
61
+ readonly manifestUrl?: string;
62
+ readonly id?: ProductAssetId;
63
+ readonly title?: string;
64
+ readonly category?: string;
65
+ }
66
+
67
+ export interface ProductLightingConfig {
68
+ readonly preset: ProductLightingPreset;
69
+ readonly environmentLighting: EnvironmentLightingOptions;
70
+ readonly postprocess: RendererPostProcessOptions;
71
+ readonly shadow: RendererShadowOptions;
72
+ readonly lights: readonly CollectedLight[];
73
+ }
74
+
75
+ export interface ProductCameraFrame {
76
+ readonly preset: ProductCameraPreset;
77
+ readonly frame: PerspectiveCameraFrame;
78
+ readonly camera: CameraLike;
79
+ }
80
+
81
+ export interface ProductCameraOptions {
82
+ readonly preset?: ProductCameraPreset;
83
+ readonly viewport?: {
84
+ readonly width: number;
85
+ readonly height: number;
86
+ };
87
+ readonly paddingRatio?: number;
88
+ }
89
+
90
+ export interface ProductMaterialMode {
91
+ readonly id: ProductMaterialModeId;
92
+ readonly label: string;
93
+ readonly description: string;
94
+ }
95
+
96
+ export interface ProductRenderSceneOptions {
97
+ readonly lighting?: ProductLightingConfig;
98
+ readonly camera?: ProductCameraFrame;
99
+ readonly materialMode?: ProductMaterialMode;
100
+ readonly floor?: boolean;
101
+ }
102
+
103
+ export interface ProductRenderScene {
104
+ readonly asset: ProductAsset;
105
+ readonly source: RenderSource;
106
+ readonly camera: CameraLike;
107
+ readonly cameraFrame: ProductCameraFrame;
108
+ readonly lighting: ProductLightingConfig;
109
+ readonly materialMode: ProductMaterialMode;
110
+ readonly renderItems: readonly RenderItem[];
111
+ }
112
+
113
+ export interface ProductDiagnostics {
114
+ readonly assetId: ProductAssetId;
115
+ readonly partCount: number;
116
+ readonly materialCount: number;
117
+ readonly textureCount: number;
118
+ readonly meshCount: number;
119
+ readonly warnings: readonly string[];
120
+ readonly renderDiagnostics?: RenderDeviceDiagnostics;
121
+ }
122
+
123
+ export interface ProductSceneManifest {
124
+ readonly schema: "a3d-product-studio-scene";
125
+ readonly assetId: ProductAssetId;
126
+ readonly title: string;
127
+ readonly partCount: number;
128
+ readonly materialCount: number;
129
+ readonly materialMode: ProductMaterialModeId;
130
+ readonly lightingPreset: ProductLightingPreset;
131
+ readonly cameraPreset: ProductCameraPreset;
132
+ readonly generatedAt: string;
133
+ }
134
+
135
+ export interface ProductExportResult {
136
+ readonly mimeType: "image/png";
137
+ readonly dataUrl: string;
138
+ readonly byteLength: number;
139
+ readonly manifest: ProductSceneManifest;
140
+ }
141
+
142
+ export interface ProductStudioOptions extends RendererOptions {
143
+ readonly canvas?: HTMLCanvasElement | OffscreenCanvas;
144
+ readonly width?: number;
145
+ readonly height?: number;
146
+ }
147
+
148
+ export interface ProductStudio {
149
+ readonly renderer: Renderer;
150
+ render(scene: ProductRenderScene): RenderDeviceDiagnostics;
151
+ resize(width: number, height: number): void;
152
+ setLighting(preset: ProductLightingPreset): ProductLightingConfig;
153
+ setCamera(asset: ProductAsset, preset: ProductCameraPreset, viewport?: { readonly width: number; readonly height: number }): ProductCameraFrame;
154
+ setMaterialMode(mode: ProductMaterialModeId): ProductMaterialMode;
155
+ exportPng(scene: ProductRenderScene): Promise<ProductExportResult>;
156
+ exportSceneManifest(scene: ProductRenderScene): ProductSceneManifest;
157
+ dispose(): void;
158
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ export { loadProductAsset } from "./ProductAssetLoader";
2
+ export { createProductCameraFrame, validateProductCameraFrame } from "./ProductCamera";
3
+ export { createProductDiagnostics } from "./ProductDiagnostics";
4
+ export { exportProductRender, exportProductSceneManifest } from "./ProductExport";
5
+ export { createProductFloor } from "./ProductFloor";
6
+ export { createProductLightingPreset } from "./ProductLighting";
7
+ export { applyProductMaterialMode, createProductMaterialMode } from "./ProductMaterials";
8
+ export { createProductRenderScene, updateProductRenderScene } from "./ProductRenderScene";
9
+ export { createProductShowcaseLayout } from "./ProductShowcaseLayout";
10
+ export { createProductStudio } from "./ProductStudio";
11
+ export type * from "./ProductTypes";
12
+ export type * from "./ProductShowcaseLayout";