Do not fit model to window when camera parameters are provided.

This commit is contained in:
kovacsv 2022-06-06 10:17:38 +02:00
parent 41b65010f2
commit 15dcf8b44d
9 changed files with 41 additions and 28 deletions

View File

@ -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 : {

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>Online 3D Viewer</title>
<script type="text/javascript" src="../build/o3dv.min-dev.js"></script>
<script type='text/javascript'>
OV.Init3DViewerElements ();
</script>
<style>
div.online_3d_viewer
{
float: left;
border: 1px solid #eeeeee;
margin: 0px 4px 4px 0px;
}
</style>
</head>
<body>
<div class="online_3d_viewer"
style="width: 640px; height: 480px;"
model="../website/assets/models/solids.obj,../website/assets/models/solids.mtl"
camera="2.18558,4.53834,2.35460,3.62488,2.61927,-0.52401,0.00000,1.00000,0.00000">
</div>
</body>
</html>

View File

@ -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 : {

View File

@ -27,8 +27,7 @@
<body>
<div class="online_3d_viewer"
style="width: 100%; height: 100%;"
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl"
camera="3,1,2,0,0,0,0,0,1">
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
</div>
</body>

View File

@ -41,13 +41,11 @@
</div>
<div class="online_3d_viewer"
style="width: 360px; height: 240px;"
model="../../test/testfiles/3ds/cube_four_instances.3ds,../../test/testfiles/3ds/texture.png"
camera="3.929421317669367,6.153966358575169,2.7076091223424714,1.5,1.5,0.5,0,0,1">
model="../../test/testfiles/3ds/cube_four_instances.3ds,../../test/testfiles/3ds/texture.png">
</div>
<div class="online_3d_viewer"
style="width: 360px; height: 240px;"
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl"
camera="1,1,1,0,0,0,0,0,1">
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
</div>
<div class="online_3d_viewer"
style="width: 360px; height: 240px;"

View File

@ -25,13 +25,7 @@
let parentDiv = document.getElementById ('viewer');
// 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)
)
});
let viewer = new OV.EmbeddedViewer (parentDiv, {});
// load a model providing model urls
let inputFiles = [

View File

@ -17,8 +17,7 @@
<body>
<div class="online_3d_viewer"
style="width: 800px; height: 600px;"
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl"
camera="3,1,2,0,0,0,0,0,1">
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
</div>
</body>

View File

@ -18,8 +18,7 @@
<div style="background:#cccccc;width:800px;height:600px;"></div>
<div class="online_3d_viewer"
style="width: 800px; height: 600px;"
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl"
camera="3,1,2,0,0,0,0,0,1">
model="../../test/testfiles/obj/hundred_cubes.obj,../../test/testfiles/obj/hundred_cubes.mtl">
</div>
<div style="background:#cccccc;width:800px;height:2000px;"></div>
</body>

View File

@ -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) {