瀏覽代碼

small changes in viewer and test execution

Raanan Weber 7 年之前
父節點
當前提交
32901b63f4

+ 1 - 1
Viewer/src/configuration/configuration.ts

@@ -160,7 +160,7 @@ export interface IGroundConfiguration {
 export interface ISceneConfiguration {
     debug?: boolean;
     clearColor?: { r: number, g: number, b: number, a: number };
-    mainColor?: { r: number, g: number, b: number, a: number };
+    mainColor?: { r: number, g: number, b: number };
     imageProcessingConfiguration?: IImageProcessingConfiguration;
     environmentTexture?: string;
     colorGrading?: IColorGradingConfiguration;

+ 3 - 2
Viewer/src/configuration/types/default.ts

@@ -66,7 +66,8 @@ export let defaultConfiguration: ViewerConfiguration = {
                 type: 2,
                 zoomOnBoundingInfo: true,
                 zoomStopsAnimation: false
-            }
+            },
+            bouncing: 1
         }
     },
     skybox: {
@@ -95,7 +96,7 @@ export let defaultConfiguration: ViewerConfiguration = {
             }
         }*/
     },
-    ground: true,
+    ground: {},
     engine: {
         antialiasing: true
     },

+ 14 - 1
Viewer/src/configuration/types/extendedDefault.ts

@@ -3,7 +3,12 @@ import { ViewerConfiguration } from './../configuration';
 export let extendedDefaultConfiguration: ViewerConfiguration = {
     version: "3.2.0-alpha4",
     extends: "default",
-
+    camera: {
+        radius: 2,
+        alpha: -1.5708,
+        beta: Math.PI * 0.5 - 0.2618,
+        pinchPrecision: 1500
+    },
     lights: {
         "light1": {
             type: 0,
@@ -54,6 +59,9 @@ export let extendedDefaultConfiguration: ViewerConfiguration = {
             shadowMaxZ: 10.0
         }
     },
+    ground: {
+        receiveShadows: true
+    },
     scene: {
         imageProcessingConfiguration: {
             colorCurves: {
@@ -71,6 +79,11 @@ export let extendedDefaultConfiguration: ViewerConfiguration = {
                 highlightsSaturation: -15,
 
             }
+        },
+        mainColor: {
+            r: 0.8,
+            g: 0.8,
+            b: 0.8
         }
     },
     model: {

+ 9 - 2
Viewer/src/viewer/sceneManager.ts

@@ -348,7 +348,15 @@ export class SceneManager {
             this.camera = <ArcRotateCamera>this.scene.activeCamera!;
         }
         if (cameraConfig.position) {
-            this.camera.position.copyFromFloats(cameraConfig.position.x || 0, cameraConfig.position.y || 0, cameraConfig.position.z || 0);
+            let newPosition = this.camera.position.clone();
+            extendClassWithConfig(newPosition, cameraConfig.position);
+            this.camera.setPosition(newPosition);
+        }
+
+        if (cameraConfig.target) {
+            let newTarget = this.camera.target.clone();
+            extendClassWithConfig(newTarget, cameraConfig.position);
+            this.camera.setTarget(newTarget);
         }
 
         if (cameraConfig.rotation) {
@@ -439,7 +447,6 @@ export class SceneManager {
                         options.groundMirrorTextureType = this._defaultPipelineTextureType;
                 }
             }
-
         }
 
         let postInitSkyboxMaterial = false;

+ 1 - 1
Viewer/tests/validation/integration.js

@@ -19,7 +19,7 @@ xhr.addEventListener("load", function () {
                 }
 
                 it(test.title, function (done) {
-                    this.timeout(180000);
+                    this.timeout(60000);
 
                     var deferredDone = function (err) {
                         setTimeout(function () {

+ 24 - 10
Viewer/tests/validation/validation.js

@@ -185,6 +185,11 @@ function runTest(index, done) {
     configuration.engine.engineOptions = configuration.engine.engineOptions || {};
     configuration.engine.engineOptions.preserveDrawingBuffer = true;
 
+    //cancel camera behvaviors for the tests
+    if (configuration.camera && configuration.camera.behaviors) {
+        delete configuration.camera.behaviors;
+    }
+
     // create a new viewer
     currentViewer && currentViewer.dispose();
     currentViewer = null;
@@ -193,20 +198,29 @@ function runTest(index, done) {
     currentViewer = new BabylonViewer.DefaultViewer(viewerElement, configuration);
 
     currentViewer.onInitDoneObservable.add(() => {
+
+        var currentFrame = 0;
+        var waitForFrame = test.waitForFrame || 1;
+
         if (test.createMesh) {
             prepareMeshForViewer(currentViewer, configuration, test);
+            currentViewer.sceneManager.scene.executeWhenReady(() => {
+                currentViewer.onFrameRenderedObservable.add(() => {
+                    if (currentFrame === waitForFrame) {
+                        evaluate(test, resultCanvas, result, renderImage, index, waitRing, done);
+                    }
+                    currentFrame++;
+                });
+            });
+        } else {
+            currentViewer.onFrameRenderedObservable.add(() => {
+                if (currentFrame === waitForFrame) {
+                    evaluate(test, resultCanvas, result, renderImage, index, waitRing, done);
+                }
+                currentFrame++;
+            });
         }
-        var currentFrame = 0;
-        var waitForFrame = test.waitForFrame || 80;
-        currentViewer.onFrameRenderedObservable.add(() => {
-            if (currentFrame === waitForFrame) {
-                evaluate(test, resultCanvas, result, renderImage, index, waitRing, done);
-            }
-            currentFrame++;
-        });
     });
-
-
 }
 
 function prepareMeshForViewer(viewer, configuration, test) {