import { IDisposable } from '../Interfaces/IDisposable'; import { TryOnFineTuningSettings } from '../Interfaces/ITryOn'; import { Nullable } from '../types'; export type WorldExtends = { min: BABYLON.Vector3; max: BABYLON.Vector3; }; export type DelayedMaterials = { [id: string]: { name: string; file: string; }; }; export type OffloadedMaterial = { name: string; data: any; }; export type OffloadedMaterials = { [id: string]: OffloadedMaterial; }; export type UrlTexture = BABYLON.Texture | BABYLON.CubeTexture | BABYLON.HDRCubeTexture | BABYLON.ColorGradingTexture | BABYLON.EquiRectangularCubeTexture; export declare class SceneHelper implements IDisposable { private _scene; private _engine; private _camera; private _canvas; private _hemiLight; private _pointLight; private _onPrePointerObservableObserver; private _isPointerDown; private _radiusScale; private _positionScale; private _limitLowerRadius; private _zoomEnabled; private _minZoomPerc; private _maxZoomPerc; private _cameraPivot; private _resizableCanvas3DGenerator; private readonly _defHemiLightID; private readonly _defPointLightID; private readonly _targetAnimationID; private readonly _radiusAnimationID; private readonly _alphaAnimationID; private readonly _betaAnimationID; private readonly _dummyMaterialID; private _loadingMaterials; get camera(): Nullable; constructor(scene: BABYLON.Scene); private static checkAllMaterialTextureReady; static whenAllMaterialTexturesAreReady(material: BABYLON.Material): Promise; static whenTextureIsReadyAsync(texture: BABYLON.BaseTexture): Promise; static whenMeshMaterialIsReady(mesh: BABYLON.AbstractMesh): Promise; static whenMaterialIsReadyForSubMeshAsync(material: BABYLON.Material, mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh): Promise; private static getMeshGeometry; private static checkMeshIsReady; static checkAllMeshesAreReady(meshes: BABYLON.AbstractMesh[]): boolean; static whenAllMeshesAreReadyAsync(meshes: BABYLON.AbstractMesh[]): Promise; static whenAllVisibleMeshesAreReadyAsync(meshes: BABYLON.AbstractMesh[]): Promise; static whenMeshIsReadyAsync(mesh: BABYLON.AbstractMesh): Promise; static visibleMeshesRequireDelayedLoading(scene: BABYLON.Scene): boolean; static meshRequiresDelayedLoading(mesh: BABYLON.AbstractMesh): boolean; materialRequiresDelayedLoading(materialID: string): boolean; private init; dispose(): void; switchFullScreen(parent: any): void; private quitFullscreen; private launchFullscreen; getMeshHierarchySize(mesh: BABYLON.AbstractMesh): BABYLON.Vector3; getMeshHierarchyCenter(mesh: BABYLON.AbstractMesh): BABYLON.Vector3; getSceneBoundingInfo(): Nullable; userIsMoving(): boolean; cameraIsMoving(): boolean; cameraLimitsReached(): boolean; restoreCameraState(): void; isTextureWithUrl(texture: BABYLON.BaseTexture): texture is UrlTexture; getTextureUrl(texture: Nullable): Nullable; private isEditControl; isRealMesh(mesh: BABYLON.AbstractMesh): boolean; meshFineTuningSettings(mesh: BABYLON.AbstractMesh): Nullable; meshHasParent(meshID: string, parentID: string): boolean; countSceneMeshes(): number; sceneHasRealMeshes(): boolean; getSceneMeshes(): BABYLON.AbstractMesh[]; getSceneMeshesByName(name: string): BABYLON.AbstractMesh[]; isVisibleMesh(mesh: BABYLON.AbstractMesh): boolean; getVisibleMeshes(): BABYLON.AbstractMesh[]; getInvisibleMeshes(): BABYLON.AbstractMesh[]; getSubMesh(mesh: BABYLON.AbstractMesh, submeshIdx: number): Nullable; getMeshHierarchy(parentID: string): BABYLON.AbstractMesh[]; getTryOnMeshHierarchy(parentID: string): BABYLON.AbstractMesh[]; isCanvasMesh(mesh: BABYLON.AbstractMesh): boolean; isAREnabledForMesh(mesh: BABYLON.AbstractMesh): boolean; isTryOnEnabledForMesh(mesh: BABYLON.AbstractMesh): boolean; getMeshesForAR(): BABYLON.AbstractMesh[]; checkMaterialsForAR(): boolean; getMeshesMaterials(meshes: BABYLON.AbstractMesh[]): BABYLON.Material[]; getMeshMaterials(mesh: BABYLON.AbstractMesh): BABYLON.Material[]; getHiddenMeshTotalVertices(): number; getTotalVertices(predicate?: (mesh: any) => boolean): number; getHiddenMeshTotalIndices(): number; getTotalIndices(predicate?: (mesh: any) => boolean): number; getAllMaterials(): BABYLON.Material[]; getMeshesUsingMaterial(materialID: string): BABYLON.AbstractMesh[]; isMeshUsingMaterial(mesh: BABYLON.AbstractMesh, materialID: string): boolean; getAllUnusedMaterials(): BABYLON.Material[]; getSceneScreenshotAsync(width: number, height: number): Promise; containsPBRMaterials(): boolean; getMeshesForTryOn(): BABYLON.AbstractMesh[]; setupLights(): void; getDefaultHemisphericLight(): Nullable; getDefaultPointLight(): Nullable; isDefaultLight(light: BABYLON.Light): boolean; setupCamera(): void; setCameraRadiusParameters(radius: number): void; removeCameraLimits(): void; getWorldExtends(): Nullable; getCameraWorldExtends(): Nullable; setupCameraLimits(worldExtends?: WorldExtends): void; adjustCamera(currentPluginName?: string, keepAlpha?: boolean, keepBeta?: boolean, animate?: boolean): void; normalizeAngleOfView(alpha: number, beta: number): { alpha: number; beta: number; }; computeCameraAngleOfView(target: BABYLON.Vector3, position: BABYLON.Vector3): { alpha: number; beta: number; }; moveCamera(endTarget: BABYLON.Vector3, endPosition: BABYLON.Vector3): void; animateCamera(endTarget: BABYLON.Vector3, endPosition: BABYLON.Vector3, seconds: number, callback?: () => void): void; wrapPi(angle: number): number; wrap2Pi(angle: number): number; zoomIn(): void; zoomOut(): void; zoom(perc: number): void; moveCameraToFinalParameters(alpha: number, beta: number, radius: number, target: BABYLON.Vector3): void; animateCameraToFinalParamters(endAlpha: number, endBeta: number, endRadius: number, endTarget: BABYLON.Vector3, seconds: number, callback?: () => void): void; private getFrustumSlope; calculateCameraRadius(worldExtends?: WorldExtends): number; private calculateLowerRadiusFromModelBoundingSphere; getWorldCenter(worldExtends?: WorldExtends): Nullable; getCameraWorldCenter(worldExtends?: WorldExtends): Nullable; getCameraRadius(worldExtends?: WorldExtends): Nullable; setCameraLimitLowerRadius(limitLowerRadius: boolean, adjustCamera?: boolean): void; setCameraPositionScale(positionScale: number, adjustCamera?: boolean): void; getCameraPivot(): Nullable; setCameraPivot(mesh: Nullable): void; setZoomEnabled(enabled: boolean): void; setMinZoomPerc(minZoomPerc: number | undefined | null): void; setMaxZoomPerc(maxZoomPerc: number | undefined | null): void; setCameraAlphaLimits(lower: number | undefined | null, upper: number | undefined | null): void; setCameraLowerAlphaLimit(angle: number | undefined | null): void; setCameraUpperAlphaLimit(angle: number | undefined | null): void; setCameraLowerBetaLimit(angle: number | undefined | null): void; setCameraUpperBetaLimit(angle: number | undefined | null): void; setCameraBetaLimits(lower: number | undefined | null, upper: number | undefined | null): void; zoomOnMesh(mesh: BABYLON.AbstractMesh): void; takeScreenshotAsync(width: number, height: number): Promise; takeContentScreenshotAsync(width: number, height: number): Promise; takeMaterialScreenshotAsync(materialID: string, width: number, height: number): Promise; getScenePBRMaterials(): BABYLON.PBRBaseMaterial[]; resetPBRMaterialsImageProcessingConfiguration(): void; private adjustPBRMaterialImageProcessingConfiguration; animateMeshToFinalParameters(mesh: BABYLON.AbstractMesh, p: BABYLON.Vector3, rE: BABYLON.Vector3, rQ: BABYLON.Quaternion, s: BABYLON.Vector3, seconds?: number, callback?: () => void): void; getMaterialsUsingTexture(texture: BABYLON.BaseTexture): BABYLON.Material[]; private getTextureMaterialsMap; getTexturesForMaterial(material: BABYLON.Material): BABYLON.BaseTexture[]; getTexturesExclusivelyForMaterial(material: BABYLON.Material): BABYLON.BaseTexture[]; getStandardMaterialTextures(material: BABYLON.StandardMaterial): BABYLON.BaseTexture[]; getPBRBaseSimpleMaterialTextures(material: BABYLON.PBRBaseSimpleMaterial): BABYLON.BaseTexture[]; getPBRMaterialTextures(material: BABYLON.PBRMaterial): BABYLON.BaseTexture[]; getPBRMetallicRoughnessMaterialTextures(material: BABYLON.PBRMetallicRoughnessMaterial): BABYLON.BaseTexture[]; getPBRSpecularGlossinessMaterialTextures(material: BABYLON.PBRSpecularGlossinessMaterial): BABYLON.BaseTexture[]; getNewPBRMaterialTextures(material: Zakeke.PBRMaterial): BABYLON.BaseTexture[]; createMeshesFromSubMeshes(mesh: BABYLON.AbstractMesh): void; private createMeshFromSubMesh; getNextIncrementalName(name: string): string; createBox(parent: Nullable, name?: string): BABYLON.Mesh; createBoundingBox(mesh: Nullable, name?: string): BABYLON.Mesh; createSphere(parent: Nullable, name?: string): BABYLON.Mesh; createPlane(parent: Nullable, name?: string): BABYLON.Mesh; createDisc(parent: Nullable, name?: string): BABYLON.Mesh; createCylinder(parent: Nullable, name?: string): BABYLON.Mesh; createTorus(parent: Nullable, name?: string): BABYLON.Mesh; createKnot(parent: Nullable, name?: string): BABYLON.Mesh; createRibbon(parent: Nullable, name?: string): BABYLON.Mesh; createRoundedCubeAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createRoundedCylinderAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createMatBallAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createMaleHeadAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createFemaleHeadAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createPokemonBallAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createShaderBallAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createBootsAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createSuzanneAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createStepPyramidAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createTeapotAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createAlloyWheelAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createTryonReferenceGlassesFrameAsync(parent: Nullable, name: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; createTryOnReferenceModelsAsync(parent: Nullable, name: string, filename: string, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; private importPrimitiveShapeAsync; private replaceTransformNodeWithMesh; importMeshesFromUrlAsync(url: string, parent: Nullable, onProgress?: (event: BABYLON.ISceneLoaderProgressEvent) => void): Promise; setupShaderMaterialsCameraPosition(): void; private setupShaderMaterialCameraPosition; getSceneCmScalingFactor(): Nullable; exportSceneToUsdzAsync(sceneName: Nullable, sceneRootUrl: Nullable, sceneID?: string, sceneCode?: string, arScale?: boolean): Promise; exportMeshToUsdzAsync(sceneRootUrl: any, mesh: any, arScale?: boolean): Promise; exportSceneToRemoteGlTFAsync(sceneName: Nullable, sceneRootUrl: Nullable, sceneID?: string, sceneCode?: string, arScale?: boolean): Promise; exportMeshToRemoteGlTFAsync(sceneRootUrl: Nullable, mesh: BABYLON.AbstractMesh, arScale?: boolean): Promise; exportSceneToRemoteGLBAsync(sceneName: Nullable, sceneRootUrl: Nullable, sceneID?: string, sceneCode?: string, arScale?: boolean): Promise; exportMeshToRemoteGLBAsync(sceneRootUrl: Nullable, mesh: BABYLON.AbstractMesh, arScale?: boolean): Promise; exportSceneToARMultiformatAsync(sceneName: Nullable, sceneRootUrl: Nullable, formats?: string[], arScale?: boolean): Promise<{ format: string; arFileUrl: string; }[]>; exportMeshToARMultiformatAsync(sceneRootUrl: Nullable, mesh: BABYLON.AbstractMesh, formats?: string[], arScale?: boolean): Promise<{ format: string; arFileUrl: string; }[]>; private getGltfBlobForARExport; exportMeshToGLBBlob(sceneRootUrl: Nullable, meshID: string): Promise; exportMeshesToARAsync(filePrefix: string, sceneRootUrl: Nullable, meshes: BABYLON.AbstractMesh[], sceneID?: string, sceneCode?: string, fileFormat?: 'usdz' | 'glTF' | 'glb', arScale?: boolean): Promise; exportMeshesToARMultiformatAsync(filePrefix: string, sceneRootUrl: Nullable, meshes: BABYLON.AbstractMesh[], formats?: string[], arScale?: boolean): Promise<{ format: string; arFileUrl: string; }[]>; exportSceneToLocalGlTFBlobsAsync(): Promise<(string | Blob)[]>; exportSceneToLocalGlTFUrlsAsync(): Promise; downloadSceneLocalGltfAsync(): Promise; exportSceneToLocalGLBBlobAsync(): Promise; exportSceneToLocalGLBBase64Async(): Promise>; exportSceneToLocalGLBUrlAsync(): Promise>; downloadSceneLocalGLBAsync(): Promise; private getSceneLocalGLBBlobInfoAsync; exportSceneToLocalUSDZBlobAsync(): Promise; exportSceneToLocalUSDZBase64Async(): Promise>; exportSceneToLocalUSDZUrlAsync(): Promise>; downloadSceneLocalUSDZAsync(): Promise; private getSceneLocalUSDZBlobInfoAsync; private getSceneToGltfExportOptions; private getGltfFileUrl; private getUsdzFileUrl; exportSceneToBabylon(): string; exportVisibleMeshesToBabylon(): string; downloadImageFromBase64(base64: string, name: string, mimetype: string): void; private getStandardMaterialTextureType; private getPBRMetallicRoughnessMaterialTextureType; private getPBRSpecularGlossinessMaterialTextureType; private getPBRMaterialTextureType; private getZakekePBRMaterialTextureType; getMaterialTextureType(material: BABYLON.Material, texture: BABYLON.BaseTexture): Nullable; getMaterialTexture(material: BABYLON.Material, type: string): Nullable; applyTexture(texture: Nullable, material: BABYLON.Material, type: string): void; applyTextureOnSerializedMaterial(serializedTexture: any, serializedMaterial: any, textureType: string, materialType: string): void; getSerializedMaterialTexture(serializedMaterial: any, textureType: string, materialType: string): any; private getMaterialTypeName; exportMeshToBabylon(mesh: BABYLON.AbstractMesh): Promise; exportMeshesToBabylon(meshes: BABYLON.AbstractMesh[]): Promise; exportMeshesForTyOnToBabylon(): Promise; private downloadBlob; downloadMeshBabylonAsync(mesh: BABYLON.AbstractMesh): Promise; downloadMeshesBabylonAsync(meshes: BABYLON.AbstractMesh[]): Promise; loadAllDelayedMaterialsAsync(rootUrl: string, progressCallback?: (txt: number, totalTxt: number) => Promise): Promise; loadDelayedMaterialsAsync(rootUrl: string, materialIDs: string[]): Promise; loadDelayedMaterialAsync(rootUrl: string, materialID: string): Promise>; loadMaterialsAsync(rootUrl: string, delayedMaterials: DelayedMaterials, progressCallback?: (txt: number, totalTxt: number) => Promise): Promise; private loadMaterialInternalAsync; showMesh(meshID: string): void; hideMesh(meshID: string): void; showHideMesh(meshID: string, show: boolean): void; changeMaterialColor(material: BABYLON.Material, propertyName: string, nextColor: BABYLON.Color3): void; applyMaterialByName(name: string, mesh: BABYLON.AbstractMesh): void; applyMaterial(material: BABYLON.Material, mesh: BABYLON.AbstractMesh): void; applyMaterialToSubMeshByName(name: string, mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh): void; applyMaterialToSubMesh(material: BABYLON.Material, mesh: Nullable, subMesh: BABYLON.SubMesh): void; getSubMeshMaterial(mesh: Nullable, subMesh: BABYLON.SubMesh): Nullable; prefetchTexturesFormMeshAsync(mesh: BABYLON.AbstractMesh): Promise; prefetchTexturesForMaterialAsync(material: BABYLON.Material): Promise; checkDelayState(mesh: BABYLON.AbstractMesh): void; createEnvelopeMesh(mesh: BABYLON.Mesh): Nullable; expandMesh(mesh: BABYLON.Mesh, delta: number): void; cloneMesh(id: string, duplicateGeometry?: boolean, updatableGeometry?: boolean): Nullable; private duplicateGeometry; getSceneMaterialMetadata(materialID: string): any; getOrCreateSceneMaterialMetadata(materialID: string): any; removeSceneMaterialMetadata(materialID: string): void; offloadAllUnusedMaterials(): void; offloadMaterial(materialID: string): void; getOffloadedMaterialInfo(material: any): OffloadedMaterial; loadAllOffloadedMaterials(rootUrl: string): BABYLON.Material[]; loadOffloadedMaterialsByIDs(rootUrl: string, materialIDs: string[]): BABYLON.Material[]; loadOffloadedMaterial(rootUrl: string, materialID: string): Nullable; loadOffloadedMaterials(rootUrl: string, offloadedMaterials: OffloadedMaterials): BABYLON.Material[]; private loadOffloadedMaterialInternal; loadAllOffloadedMaterialsAsync(rootUrl: string): Promise; loadOffloadedMaterialsByIDsAsync(rootUrl: string, materialIDs: string[]): Promise; loadOffloadedMaterialAsync(rootUrl: string, materialID: string): Promise>; loadOffloadedMaterialsAsync(rootUrl: string, offloadedMaterials: OffloadedMaterials): Promise; private loadOffloadedMaterialInternalAsync; loadTextureFiles(rootUrl: string, textureUrls: string[]): void; private getOrLoadMaterialAsync; getOrCreateDummyMaterial(): BABYLON.Material; isDummyMaterial(material: BABYLON.Material): boolean; meshHasDummyMaterial(mesh: BABYLON.AbstractMesh, recursive: boolean): boolean; getMeshDelayedMaterialIDs(mesh: BABYLON.AbstractMesh): string[]; getMeshOffloadedMaterialIDs(mesh: BABYLON.AbstractMesh): string[]; setDummyMaterialToInvisibleMeshes(): void; setMeshDummyMaterial(mesh: BABYLON.AbstractMesh, recursive: boolean): void; unsetAllDummyMaterials(): void; unsetAllDummyMaterialsAsync(rootUrl: string): Promise; unsetMeshDummyMaterial(mesh: BABYLON.AbstractMesh, recursive: boolean): void; unsetMeshDummyMaterialAsync(mesh: BABYLON.AbstractMesh, rootUrl: string, recursive: boolean): Promise; reloadAllLoadingErrorTexturesAsync(rootUrl: string): Promise; reloadMaterialLoadingErrorTexturesAsync(rootUrl: string, material: BABYLON.Material): Promise; reloadLoadingErrorTextureAsync(rootUrl: string, texture: BABYLON.BaseTexture): Promise; isTextureLoadingError(texture: BABYLON.BaseTexture): boolean; materialHasLoadingErrorTextues(material: BABYLON.Material): boolean; getMaterialDynamicTextures(material: BABYLON.Material): BABYLON.BaseTexture[]; exportTextureToBase64Async(babylonTexture: BABYLON.BaseTexture, mimeType?: string, invertY?: boolean): Promise>; private createBase64FromCanvasAsync; private getPixelsFromTexture; comparePBRMaterials(mat1: BABYLON.PBRMaterial, mat2: BABYLON.PBRMaterial): void; private compareAnisotropy; private compareBRDF; private compareClearCoat; private compareDetailMap; private comparePrePassConfiguration; private compareSheen; private compareSubSurface; private compareCameraCurve; private compareImageProcessingConfiguration; private compareTexture; /** * Clear the scene and generate a canvas mesh * @param meshID The mesh ID to use, must be passed from the scene editor to update correctly the MeshSide * @param width The width of the canvas * @param height The height of the canvas * @param depth The depth of the canvas * @param borderRadius The border radius of the canvas * @returns The id of the generated mesh */ private _loadedMeshes; private _isLoading; showResizableCanvas(width: number, height: number, depth: number, borderRadius: number, type: 'colored' | 'mirrored', borderColor: string, columns: number, rows: number): Promise; /** * Remove all meshes from the scene */ clearResizableMeshes(): void; private _lastVisibilityStates; switchMode(mode: 'upload' | 'resizable'): void; rotate(angle: number, axis: BABYLON.Vector3, animate: boolean): Promise; }