|
@@ -3686,7 +3686,21 @@
|
|
}
|
|
}
|
|
|
|
|
|
// Misc.
|
|
// Misc.
|
|
- public createDefaultCameraOrLight(createArcRotateCamera = false) {
|
|
|
|
|
|
+ public createDefaultCameraOrLight(createArcRotateCamera = false, replace = false, attachCameraControls = false) {
|
|
|
|
+ // Dispose existing camera or light in replace mode.
|
|
|
|
+ if (replace) {
|
|
|
|
+ if (this.activeCamera) {
|
|
|
|
+ this.activeCamera.dispose();
|
|
|
|
+ this.activeCamera = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this.lights) {
|
|
|
|
+ for (var i = 0; i < this.lights.length; i++) {
|
|
|
|
+ this.lights[i].dispose();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// Light
|
|
// Light
|
|
if (this.lights.length === 0) {
|
|
if (this.lights.length === 0) {
|
|
new HemisphericLight("default light", Vector3.Up(), this);
|
|
new HemisphericLight("default light", Vector3.Up(), this);
|
|
@@ -3715,10 +3729,14 @@
|
|
camera.maxZ = radius * 100;
|
|
camera.maxZ = radius * 100;
|
|
camera.speed = radius * 0.2;
|
|
camera.speed = radius * 0.2;
|
|
this.activeCamera = camera;
|
|
this.activeCamera = camera;
|
|
|
|
+
|
|
|
|
+ if (attachCameraControls) {
|
|
|
|
+ camera.attachControl(this.getEngine().getRenderingCanvas());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public createDefaultSkybox(environmentTexture?: BaseTexture, pbr = false, scale = 1000): Mesh {
|
|
|
|
|
|
+ public createDefaultSkybox(environmentTexture?: BaseTexture, pbr = false, scale = 1000, blur = 0): Mesh {
|
|
if (environmentTexture) {
|
|
if (environmentTexture) {
|
|
this.environmentTexture = environmentTexture;
|
|
this.environmentTexture = environmentTexture;
|
|
}
|
|
}
|
|
@@ -3735,8 +3753,9 @@
|
|
hdrSkyboxMaterial.backFaceCulling = false;
|
|
hdrSkyboxMaterial.backFaceCulling = false;
|
|
hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();
|
|
hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();
|
|
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
|
|
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
|
|
- hdrSkyboxMaterial.microSurface = 1.0;
|
|
|
|
|
|
+ hdrSkyboxMaterial.microSurface = 1.0 - blur;
|
|
hdrSkyboxMaterial.disableLighting = true;
|
|
hdrSkyboxMaterial.disableLighting = true;
|
|
|
|
+ hdrSkyboxMaterial.twoSidedLighting = true;
|
|
hdrSkybox.infiniteDistance = true;
|
|
hdrSkybox.infiniteDistance = true;
|
|
hdrSkybox.material = hdrSkyboxMaterial;
|
|
hdrSkybox.material = hdrSkyboxMaterial;
|
|
}
|
|
}
|