import { DcController } from "../DcController.js"; import { PcmGeometry } from "../pcm/geometry.js"; /** * Overrides to be applied to a geometry. * * Used to alter materials of properties of the geometry. */ export type GeometryOverrides = Array<{ target: string[]; data: Record | Record[]; }>; /** * Options when setting a geometry. */ export type GeometryOptions = { /** * The default scale of the geometry. * * Defaults to `[1, 1, 1]`. */ defaultScale?: [number, number, number]; /** * Whether or not the geometry should automatically scale with the mappings. * * When `true`, the `axes` field of the stages should be set. * * Defaults to `false`. */ scaleWithMapping?: boolean; /** * The stages of the geometry. * * A stage is an area on the geometry that a texture can be drawn on. */ stages?: GeometryStage[]; /** * The overrides applied to the geometry. * * Used to alter materials of properties of the geometry. */ overrides?: GeometryOverrides; }; /** * Options specific for geometries loaded from the */ export type PcmGeometryOptions = GeometryOptions & { /** * The selected preset of the geometry. * * Used to alter the visual appearance of the geometry. */ preset?: string; }; /** * An area on a geometry that a texture can be drawn on. */ export interface GeometryStage { /** * The name of the stage. * * The name can later be used to reference the stage (e.g., for the mappings). */ name: string; /** * The UV color of the stage. * * The UV color marks the area on the texture that the stage is drawn * on. The array are normalized RGB colors (i.e., in the range from 0 to * 1). * * Example: `[0.21586, 1, 0.21586]` */ uvColor: [number, number, number]; /** * Maps the 2 axes of the 2D stage to the axes of the 3D geometry. * * Only relevant when `scaleWithMapping` of the geometry is `true`. * * The number is the number of the axis (i.e., `0` for the x-axis, `1` * for the y-axis, and `2` for the z-axis). * * Example: `[0, 1]` maps the width and height of the stage to the x and * y-axis of the geometry. * */ axes?: [number, number]; } /** * Loads a geometry (i.e., the 3D model, for example a box or a bottle) in the * GLTF format from the given url. * * @param dcController The DcController object obtained from the init function. * @param url The url to the geometry. * @param options Optional options for the geometry. * @returns A promise that resolves when the geometry has been set. */ export declare function setGeometry(dcController: DcController, url: string, options?: GeometryOptions): Promise; /** * Loads a geometry (i.e., the 3D model, for example a box or a bottle) by its * id. * * @param dcController The DcController object obtained from the init function. * @param geometryId The id of the geometry. * @param options Optional options for the geometry. These override the default * settings of the PCM geometry. * @returns A promise that resolves when the geometry has been set. */ export declare function setGeometry(dcController: DcController, geometryId: string, options?: GeometryOptions | PcmGeometryOptions): Promise; /** * Sets a geometry (i.e., the 3D model, for example a box or a bottle) in the * GLTF format. * * @param dcController The DcController object obtained from the init function. * @param data The geometry data in the GLTF format. * @param options Optional options for the geometry. * @returns A promise that resolves when the geometry has been set. */ export declare function setGeometry(dcController: DcController, data: Blob, options?: GeometryOptions): Promise; /** * Sets a geometry (i.e., the 3D model, for example a box or a bottle). * * @param dcController The DcController object obtained from the init function. * @param geometry The geometry. * @param options Optional options for the geometry. These override the default * settings of the PCM geometry. * @returns A promise that resolves when the geometry has been set. */ export declare function setGeometry(dcController: DcController, geometry: PcmGeometry, options?: GeometryOptions | PcmGeometryOptions): Promise;