瀏覽代碼

Extending the configuration

Raanan Weber 8 年之前
父節點
當前提交
d085040502
共有 1 個文件被更改,包括 32 次插入4 次删除
  1. 32 4
      Viewer/src/configuration/configuration.ts

+ 32 - 4
Viewer/src/configuration/configuration.ts

@@ -1,6 +1,9 @@
 import { TemplateConfiguration } from './../templateManager';
 export interface ViewerConfiguration {
 
+    // configuration version
+    version?: string;
+
     defaultViewer?: boolean; // indicates no configuration (except for initial configuration) should be changed. Will load the defaultCOnfiguration variable.
 
     configuration?: string | {
@@ -23,13 +26,36 @@ export interface ViewerConfiguration {
 
     canvasElement?: string; // if there is a need to override the standard implementation - ID of HTMLCanvasElement
 
-    model?: string | {
+    model?: {
         url: string;
         loader: string; // obj, gltf?
-    },
+        position?: { x: number, y: number, z: number };
+        rotation?: { x: number, y: number, z: number, w: number };
+        scaling?: { x: number, y: number, z: number };
+    } | string,
     scene?: {
-
+        autoRotate?: boolean;
+        rotationSpeed?: number;
+        defaultCamera?: boolean;
+        defaultLight?: boolean;
+        clearColor?: { r: number, g: number, b: number, a: number };
     },
+    // at the moment, support only a single camera.
+    camera?: {
+        position?: { x: number, y: number, z: number };
+        rotation?: { x: number, y: number, z: number, w: number };
+        fieldOfView?: number;
+        minZ?: number;
+        maxZ?: number;
+        behavior?: {
+            type?: number;
+            [propName: string]: any;
+        }
+    },
+    lights?: Array<{
+        type?: number;
+        [propName: string]: any;
+    }>
     // engine configuration. optional!
     engine?: {
         antialiasing?: boolean;
@@ -39,6 +65,7 @@ export interface ViewerConfiguration {
 }
 
 export let defaultConfiguration: ViewerConfiguration = {
+    version: "0.1",
     eventPrefix: 'babylonviewer-',
     events: true,
     defaultViewer: true,
@@ -66,6 +93,7 @@ export let defaultConfiguration: ViewerConfiguration = {
         antialiasing: true
     },
     scene: {
-
+        autoRotate: true,
+        rotationSpeed: 0.1
     }
 }