|
@@ -1,12 +1,12 @@
|
|
|
|
+
|
|
|
|
+
|
|
import { ViewerConfiguration } from './../configuration/configuration';
|
|
import { ViewerConfiguration } from './../configuration/configuration';
|
|
import { Template } from './../templateManager';
|
|
import { Template } from './../templateManager';
|
|
import { AbstractViewer } from './viewer';
|
|
import { AbstractViewer } from './viewer';
|
|
-import { Observable, ShadowLight, CubeTexture, BouncingBehavior, FramingBehavior, Behavior, Light, Engine, Scene, AutoRotationBehavior, AbstractMesh, Quaternion, StandardMaterial, ShadowOnlyMaterial, ArcRotateCamera, ImageProcessingConfiguration, Color3, Vector3, SceneLoader, Mesh, HemisphericLight } from 'babylonjs';
|
|
|
|
|
|
+import { ShadowGenerator, Observable, ShadowLight, CubeTexture, BouncingBehavior, FramingBehavior, Behavior, Light, Engine, Scene, AutoRotationBehavior, AbstractMesh, Quaternion, StandardMaterial, ArcRotateCamera, ImageProcessingConfiguration, Color3, Vector3, SceneLoader, Mesh, HemisphericLight } from 'babylonjs';
|
|
import { CameraBehavior } from '../interfaces';
|
|
import { CameraBehavior } from '../interfaces';
|
|
|
|
|
|
-// A small hack for the inspector. to be removed!
|
|
|
|
-import * as BABYLON from 'babylonjs';
|
|
|
|
-window['BABYLON'] = BABYLON;
|
|
|
|
|
|
+import { ShadowOnlyMaterial } from 'babylonjs-materials';
|
|
|
|
|
|
export class DefaultViewer extends AbstractViewer {
|
|
export class DefaultViewer extends AbstractViewer {
|
|
|
|
|
|
@@ -107,7 +107,7 @@ export class DefaultViewer extends AbstractViewer {
|
|
let requestFullScreen = viewerElement.requestFullscreen || viewerElement.webkitRequestFullscreen || (<any>viewerElement).msRequestFullscreen || (<any>viewerElement).mozRequestFullScreen;
|
|
let requestFullScreen = viewerElement.requestFullscreen || viewerElement.webkitRequestFullscreen || (<any>viewerElement).msRequestFullscreen || (<any>viewerElement).mozRequestFullScreen;
|
|
requestFullScreen.call(viewerElement);
|
|
requestFullScreen.call(viewerElement);
|
|
} else {
|
|
} else {
|
|
- let exitFullscreen = document.exitFullscreen || document.webkitExitFullscreen || (<any>document).msExitFullscreen || document.mozCancelFullScreen
|
|
|
|
|
|
+ let exitFullscreen = document.exitFullscreen || document.webkitExitFullscreen || (<any>document).msExitFullscreen || (<any>document).mozCancelFullScreen
|
|
exitFullscreen.call(document);
|
|
exitFullscreen.call(document);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -230,7 +230,8 @@ export class DefaultViewer extends AbstractViewer {
|
|
//default configuration
|
|
//default configuration
|
|
if (this.configuration.ground === true) {
|
|
if (this.configuration.ground === true) {
|
|
ground.receiveShadows = true;
|
|
ground.receiveShadows = true;
|
|
- ground.material.alpha = 0.4;
|
|
|
|
|
|
+ if (ground.material)
|
|
|
|
+ ground.material.alpha = 0.4;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -354,7 +355,7 @@ export class DefaultViewer extends AbstractViewer {
|
|
//position. Some lights don't support shadows
|
|
//position. Some lights don't support shadows
|
|
if (light instanceof ShadowLight) {
|
|
if (light instanceof ShadowLight) {
|
|
if (lightConfig.shadowEnabled) {
|
|
if (lightConfig.shadowEnabled) {
|
|
- var shadowGenerator = new BABYLON.ShadowGenerator(512, light);
|
|
|
|
|
|
+ var shadowGenerator = new ShadowGenerator(512, light);
|
|
this.extendClassWithConfig(shadowGenerator, lightConfig.shadowConfig || {});
|
|
this.extendClassWithConfig(shadowGenerator, lightConfig.shadowConfig || {});
|
|
// add the focues meshes to the shadow list
|
|
// add the focues meshes to the shadow list
|
|
let shadownMap = shadowGenerator.getShadowMap();
|
|
let shadownMap = shadowGenerator.getShadowMap();
|