|
@@ -66,32 +66,32 @@
|
|
|
// Attach camera to canvas inputs
|
|
|
if (!currentScene.activeCamera || currentScene.lights.length === 0) {
|
|
|
currentScene.createDefaultCameraOrLight(true);
|
|
|
- }
|
|
|
- currentScene.activeCamera.attachControl(canvas);
|
|
|
-
|
|
|
- // Enable camera's behaviors
|
|
|
- currentScene.activeCamera.useBouncingBehavior = true;
|
|
|
- currentScene.activeCamera.useAutoRotationBehavior = true;
|
|
|
- currentScene.activeCamera.useFramingBehavior = true;
|
|
|
-
|
|
|
- var framingBehavior = currentScene.activeCamera.getBehaviorByName("Framing");
|
|
|
- framingBehavior.framingTime = 0;
|
|
|
-
|
|
|
- var bouncingBehavior = currentScene.activeCamera.getBehaviorByName("Bouncing");
|
|
|
- bouncingBehavior.autoTransitionRange = true;
|
|
|
-
|
|
|
- if (currentScene.meshes.length) {
|
|
|
- // Let's zoom on the first object with geometry
|
|
|
- for (var index = 0; index < currentScene.meshes.length; index++) {
|
|
|
- var mesh = currentScene.meshes[index];
|
|
|
-
|
|
|
- if (mesh.getTotalVertices()) {
|
|
|
- currentScene.activeCamera.setTarget(mesh);
|
|
|
- break;
|
|
|
+ // Enable camera's behaviors
|
|
|
+ currentScene.activeCamera.useBouncingBehavior = true;
|
|
|
+ currentScene.activeCamera.useAutoRotationBehavior = true;
|
|
|
+ currentScene.activeCamera.useFramingBehavior = true;
|
|
|
+
|
|
|
+ var framingBehavior = currentScene.activeCamera.getBehaviorByName("Framing");
|
|
|
+ framingBehavior.framingTime = 0;
|
|
|
+
|
|
|
+ var bouncingBehavior = currentScene.activeCamera.getBehaviorByName("Bouncing");
|
|
|
+ bouncingBehavior.autoTransitionRange = true;
|
|
|
+
|
|
|
+ if (currentScene.meshes.length) {
|
|
|
+ // Let's zoom on the first object with geometry
|
|
|
+ for (var index = 0; index < currentScene.meshes.length; index++) {
|
|
|
+ var mesh = currentScene.meshes[index];
|
|
|
+
|
|
|
+ if (mesh.getTotalVertices()) {
|
|
|
+ currentScene.activeCamera.setTarget(mesh);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ currentScene.activeCamera.attachControl(canvas);
|
|
|
+
|
|
|
// Environment
|
|
|
if (currentPluginName === "gltf") {
|
|
|
var hdrTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("Assets/environment.dds", currentScene);
|