import { Renderer } from "../rendering/index.js";
import { createProductCameraFrame } from "./ProductCamera.js";
import { exportProductRender, exportProductSceneManifest } from "./ProductExport.js";
import { createProductLightingPreset } from "./ProductLighting.js";
import { createProductMaterialMode } from "./ProductMaterials.js";
export async function createProductStudio(options = {}) {
    const renderer = await Renderer.create({
        clearColor: [0.03, 0.035, 0.038, 1],
        width: options.width ?? 1280,
        height: options.height ?? 900,
        ...options
    });
    return new ProductStudioRuntime(renderer, options.canvas);
}
class ProductStudioRuntime {
    renderer;
    canvas;
    constructor(renderer, canvas) {
        this.renderer = renderer;
        this.canvas = canvas;
    }
    render(scene) {
        return this.renderer.render(scene.source, scene.camera);
    }
    resize(width, height) {
        this.renderer.resize(width, height);
    }
    setLighting(preset) {
        return createProductLightingPreset(preset);
    }
    setCamera(asset, preset, viewport = { width: 1280, height: 900 }) {
        return createProductCameraFrame(asset, { preset, viewport });
    }
    setMaterialMode(mode) {
        return createProductMaterialMode(mode);
    }
    async exportPng(scene) {
        if (!this.canvas) {
            throw new Error("ProductStudio exportPng requires a canvas-backed studio.");
        }
        this.render(scene);
        return exportProductRender(this.canvas, scene);
    }
    exportSceneManifest(scene) {
        return exportProductSceneManifest(scene);
    }
    dispose() {
        this.renderer.dispose();
    }
}
//# sourceMappingURL=ProductStudio.js.map