|
@@ -400,57 +400,125 @@ declare module BabylonViewer {
|
|
}
|
|
}
|
|
/////>configuration
|
|
/////>configuration
|
|
|
|
|
|
|
|
+ export enum AnimationPlayMode {
|
|
|
|
+ ONCE = 0,
|
|
|
|
+ LOOP = 1,
|
|
|
|
+ }
|
|
|
|
+ export enum AnimationState {
|
|
|
|
+ INIT = 0,
|
|
|
|
+ PLAYING = 1,
|
|
|
|
+ PAUSED = 2,
|
|
|
|
+ STOPPED = 3,
|
|
|
|
+ ENDED = 4,
|
|
|
|
+ }
|
|
|
|
+ interface IModelAnimation extends BABYLON.IDisposable {
|
|
|
|
+ readonly state: AnimationState;
|
|
|
|
+ readonly name: string;
|
|
|
|
+ readonly frames: number;
|
|
|
|
+ readonly currentFrame: number;
|
|
|
|
+ readonly fps: number;
|
|
|
|
+ speedRatio: number;
|
|
|
|
+ playMode: AnimationPlayMode;
|
|
|
|
+ start(): any;
|
|
|
|
+ stop(): any;
|
|
|
|
+ pause(): any;
|
|
|
|
+ reset(): any;
|
|
|
|
+ restart(): any;
|
|
|
|
+ goToFrame(frameNumber: number): any;
|
|
|
|
+ }
|
|
|
|
+ export class GroupModelAnimation implements IModelAnimation {
|
|
|
|
+ constructor(_animationGroup: BABYLON.AnimationGroup);
|
|
|
|
+ readonly name: string;
|
|
|
|
+ readonly state: AnimationState;
|
|
|
|
+ speedRatio: number;
|
|
|
|
+ readonly frames: number;
|
|
|
|
+ readonly currentFrame: number;
|
|
|
|
+ readonly fps: number;
|
|
|
|
+ playMode: AnimationPlayMode;
|
|
|
|
+ reset(): void;
|
|
|
|
+ restart(): void;
|
|
|
|
+ goToFrame(frameNumber: number): void;
|
|
|
|
+ start(): void;
|
|
|
|
+ pause(): void;
|
|
|
|
+ stop(): void;
|
|
|
|
+ dispose(): void;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ class ViewerModel implements BABYLON.IDisposable {
|
|
|
|
+ loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
|
|
|
|
+ meshes: Array<BABYLON.AbstractMesh>;
|
|
|
|
+ particleSystems: Array<BABYLON.ParticleSystem>;
|
|
|
|
+ skeletons: Array<BABYLON.Skeleton>;
|
|
|
|
+ currentAnimation: IModelAnimation;
|
|
|
|
+ onLoadedObservable: BABYLON.Observable<ViewerModel>;
|
|
|
|
+ onLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
|
|
|
|
+ onLoadErrorObservable: BABYLON.Observable<{
|
|
|
|
+ message: string;
|
|
|
|
+ exception: any;
|
|
|
|
+ }>;
|
|
|
|
+ constructor(_modelConfiguration: IModelConfiguration, _scene: BABYLON.Scene, disableAutoLoad?: boolean);
|
|
|
|
+ load(): void;
|
|
|
|
+ getAnimationNames(): string[];
|
|
|
|
+ protected _getAnimationByName(name: string): BABYLON.Nullable<IModelAnimation>;
|
|
|
|
+ playAnimation(name: string): IModelAnimation;
|
|
|
|
+ dispose(): void;
|
|
|
|
+ }
|
|
|
|
+
|
|
/////<viewer
|
|
/////<viewer
|
|
export abstract class AbstractViewer {
|
|
export abstract class AbstractViewer {
|
|
containerElement: HTMLElement;
|
|
containerElement: HTMLElement;
|
|
templateManager: TemplateManager;
|
|
templateManager: TemplateManager;
|
|
- camera: BABYLON.ArcRotateCamera;
|
|
|
|
engine: BABYLON.Engine;
|
|
engine: BABYLON.Engine;
|
|
scene: BABYLON.Scene;
|
|
scene: BABYLON.Scene;
|
|
|
|
+ camera: BABYLON.ArcRotateCamera;
|
|
|
|
+ sceneOptimizer: BABYLON.SceneOptimizer;
|
|
baseId: string;
|
|
baseId: string;
|
|
- canvas: HTMLCanvasElement;
|
|
|
|
|
|
+ models: Array<ViewerModel>;
|
|
|
|
+ lastUsedLoader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
|
|
protected configuration: ViewerConfiguration;
|
|
protected configuration: ViewerConfiguration;
|
|
environmentHelper: BABYLON.EnvironmentHelper;
|
|
environmentHelper: BABYLON.EnvironmentHelper;
|
|
protected defaultHighpTextureType: number;
|
|
protected defaultHighpTextureType: number;
|
|
protected shadowGeneratorBias: number;
|
|
protected shadowGeneratorBias: number;
|
|
protected defaultPipelineTextureType: number;
|
|
protected defaultPipelineTextureType: number;
|
|
protected maxShadows: number;
|
|
protected maxShadows: number;
|
|
|
|
+ readonly isHdrSupported: boolean;
|
|
onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
|
|
onSceneInitObservable: BABYLON.Observable<BABYLON.Scene>;
|
|
onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
|
|
onEngineInitObservable: BABYLON.Observable<BABYLON.Engine>;
|
|
- onModelLoadedObservable: BABYLON.Observable<BABYLON.AbstractMesh[]>;
|
|
|
|
|
|
+ onModelLoadedObservable: BABYLON.Observable<ViewerModel>;
|
|
onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
|
|
onModelLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
|
|
- onModelLoadErrorObservable: BABYLON.Observable<{ message: string; exception: any }>;
|
|
|
|
|
|
+ onModelLoadErrorObservable: BABYLON.Observable<{
|
|
|
|
+ message: string;
|
|
|
|
+ exception: any;
|
|
|
|
+ }>;
|
|
onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
|
|
onLoaderInitObservable: BABYLON.Observable<BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync>;
|
|
onInitDoneObservable: BABYLON.Observable<AbstractViewer>;
|
|
onInitDoneObservable: BABYLON.Observable<AbstractViewer>;
|
|
|
|
+ canvas: HTMLCanvasElement;
|
|
|
|
+ protected registeredOnBeforerenderFunctions: Array<() => void>;
|
|
constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
|
|
constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
|
|
getBaseId(): string;
|
|
getBaseId(): string;
|
|
- protected abstract prepareContainerElement(): any;
|
|
|
|
- protected onTemplatesLoaded(): Promise<AbstractViewer>;
|
|
|
|
- protected initEngine(): Promise<BABYLON.Engine>;
|
|
|
|
- protected initScene(): Promise<BABYLON.Scene>;
|
|
|
|
- dispose(): void;
|
|
|
|
- loadModel(model?: any, clearScene?: boolean): Promise<BABYLON.Scene>;
|
|
|
|
- lastUsedLoader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
|
|
|
|
- sceneOptimizer: BABYLON.SceneOptimizer;
|
|
|
|
- protected registeredOnBeforerenderFunctions: Array<() => void>;
|
|
|
|
isCanvasInDOM(): boolean;
|
|
isCanvasInDOM(): boolean;
|
|
protected resize: () => void;
|
|
protected resize: () => void;
|
|
protected render: () => void;
|
|
protected render: () => void;
|
|
- updateConfiguration(newConfiguration: Partial<ViewerConfiguration>): void;
|
|
|
|
- protected configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void;
|
|
|
|
|
|
+ updateConfiguration(newConfiguration?: Partial<ViewerConfiguration>): void;
|
|
|
|
+ protected configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): Promise<Scene> | undefined;
|
|
protected configureScene(sceneConfig: ISceneConfiguration, optimizerConfig?: ISceneOptimizerConfiguration): void;
|
|
protected configureScene(sceneConfig: ISceneConfiguration, optimizerConfig?: ISceneOptimizerConfiguration): void;
|
|
protected configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
|
|
protected configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
|
|
protected configureObservers(observersConfiguration: IObserversConfiguration): void;
|
|
protected configureObservers(observersConfiguration: IObserversConfiguration): void;
|
|
- protected configureCamera(cameraConfig: ICameraConfiguration, focusMeshes: Array<BABYLON.AbstractMesh>): void;
|
|
|
|
- protected configureLights(lightsConfiguration: { [name: string]: ILightConfiguration | boolean }, focusMeshes: Array<BABYLON.AbstractMesh>): void;
|
|
|
|
- protected configureModel(modelConfiguration: Partial<IModelConfiguration>, focusMeshes: Array<BABYLON.AbstractMesh>): void;
|
|
|
|
|
|
+ protected configureCamera(cameraConfig: ICameraConfiguration, model?: ViewerModel): void;
|
|
|
|
+ protected configureLights(lightsConfiguration?: {
|
|
|
|
+ [name: string]: ILightConfiguration | boolean;
|
|
|
|
+ }, model?: ViewerModel): void;
|
|
|
|
+ protected configureModel(modelConfiguration: Partial<IModelConfiguration>, model?: ViewerModel): void;
|
|
dispose(): void;
|
|
dispose(): void;
|
|
- protected initEnvironment(focusMeshes: Array<BABYLON.AbstractMesh>): Promise<BABYLON.Scene>;
|
|
|
|
|
|
+ protected abstract prepareContainerElement(): any;
|
|
|
|
+ protected onTemplatesLoaded(): Promise<AbstractViewer>;
|
|
|
|
+ protected initEngine(): Promise<BABYLON.Engine>;
|
|
|
|
+ protected initScene(): Promise<BABYLON.Scene>;
|
|
|
|
+ loadModel(modelConfig?: any, clearScene?: boolean): Promise<BABYLON.Scene>;
|
|
|
|
+ protected initEnvironment(focusMeshes?: Array<BABYLON.AbstractMesh>): Promise<BABYLON.Scene>;
|
|
|
|
+ protected handleHardwareLimitations(): void;
|
|
protected injectCustomShaders(): void;
|
|
protected injectCustomShaders(): void;
|
|
protected extendClassWithConfig(object: any, config: any): void;
|
|
protected extendClassWithConfig(object: any, config: any): void;
|
|
- protected handleHardwareLimitations(): void;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
export class DefaultViewer extends AbstractViewer {
|
|
export class DefaultViewer extends AbstractViewer {
|