From 15dcf8b44d6ed1d7424dc2c7e7b962b39d523e77 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Mon, 6 Jun 2022 10:17:38 +0200 Subject: [PATCH] Do not fit model to window when camera parameters are provided. --- sandbox/embed_selfhost_calculate.html | 5 ---- sandbox/embed_selfhost_camera.html | 34 +++++++++++++++++++++++ sandbox/embed_selfhost_code_file.html | 5 ---- sandbox/embed_selfhost_fullscreen.html | 3 +- sandbox/embed_selfhost_multiple.html | 6 ++-- sandbox/embed_selfhost_noextension.html | 8 +----- sandbox/embed_selfhost_single.html | 3 +- sandbox/embed_selfhost_single_scroll.html | 3 +- source/engine/viewer/embeddedviewer.js | 2 +- 9 files changed, 41 insertions(+), 28 deletions(-) create mode 100644 sandbox/embed_selfhost_camera.html diff --git a/sandbox/embed_selfhost_calculate.html b/sandbox/embed_selfhost_calculate.html index 4873c7b..cfe410f 100644 --- a/sandbox/embed_selfhost_calculate.html +++ b/sandbox/embed_selfhost_calculate.html @@ -34,11 +34,6 @@ // initialize the viewer with the parent element and some parameters let viewer = new OV.EmbeddedViewer (parentDiv, { - camera : new OV.Camera ( - new OV.Coord3D (-1.5, 2.0, 3.0), - new OV.Coord3D (0.0, 0.0, 0.0), - new OV.Coord3D (0.0, 1.0, 0.0) - ), backgroundColor : new OV.Color (255, 255, 255), defaultColor : new OV.Color (200, 200, 200), edgeSettings : { diff --git a/sandbox/embed_selfhost_camera.html b/sandbox/embed_selfhost_camera.html new file mode 100644 index 0000000..8ef4c3d --- /dev/null +++ b/sandbox/embed_selfhost_camera.html @@ -0,0 +1,34 @@ + + + + + + + + Online 3D Viewer + + + + + + + + + +
+
+ + + diff --git a/sandbox/embed_selfhost_code_file.html b/sandbox/embed_selfhost_code_file.html index 0bb5176..dd0dab7 100644 --- a/sandbox/embed_selfhost_code_file.html +++ b/sandbox/embed_selfhost_code_file.html @@ -26,11 +26,6 @@ // initialize the viewer with the parent element and some parameters let viewer = new OV.EmbeddedViewer (parentDiv, { - camera : new OV.Camera ( - new OV.Coord3D (-1.5, 2.0, 3.0), - new OV.Coord3D (0.0, 0.0, 0.0), - new OV.Coord3D (0.0, 1.0, 0.0) - ), backgroundColor : new OV.Color (255, 255, 255), defaultColor : new OV.Color (200, 200, 200), edgeSettings : { diff --git a/sandbox/embed_selfhost_fullscreen.html b/sandbox/embed_selfhost_fullscreen.html index 64650ab..a3bd7bf 100644 --- a/sandbox/embed_selfhost_fullscreen.html +++ b/sandbox/embed_selfhost_fullscreen.html @@ -27,8 +27,7 @@
+ model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
diff --git a/sandbox/embed_selfhost_multiple.html b/sandbox/embed_selfhost_multiple.html index 0edd532..c7b4b18 100644 --- a/sandbox/embed_selfhost_multiple.html +++ b/sandbox/embed_selfhost_multiple.html @@ -41,13 +41,11 @@
+ model="../../test/testfiles/3ds/cube_four_instances.3ds,../../test/testfiles/3ds/texture.png">
+ model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
+ model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
diff --git a/sandbox/embed_selfhost_single_scroll.html b/sandbox/embed_selfhost_single_scroll.html index 821a756..b2398c1 100644 --- a/sandbox/embed_selfhost_single_scroll.html +++ b/sandbox/embed_selfhost_single_scroll.html @@ -18,8 +18,7 @@
+ model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
diff --git a/source/engine/viewer/embeddedviewer.js b/source/engine/viewer/embeddedviewer.js index 552d7b2..355e6e1 100644 --- a/source/engine/viewer/embeddedviewer.js +++ b/source/engine/viewer/embeddedviewer.js @@ -105,8 +105,8 @@ export class EmbeddedViewer this.viewer.SetCamera (this.parameters.camera); } else { this.viewer.SetUpVector (Direction.Y, false); + this.viewer.FitSphereToWindow (boundingSphere, false); } - this.viewer.FitSphereToWindow (boundingSphere, false); this.model = importResult.model; if (this.parameters.onModelLoaded) {