Add orthographic camera #293

This commit is contained in:
kovacsv 2022-09-20 20:37:28 +02:00
parent b102ee622d
commit a9a5c65c69
9 changed files with 159 additions and 94 deletions

View File

@ -1,36 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 18 18"
xml:space="preserve"
version="1.1"
id="svg4"
sodipodi:docname="camera_orthographic.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
id="svg6"
x="0px"
y="0px"
viewBox="0 0 18 18"
style="enable-background:new 0 0 18 18;"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs8" /><sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="true"
inkscape:zoom="33.705423"
inkscape:cx="9.5088556"
inkscape:cy="9.2715051"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4"><inkscape:grid
type="xygrid"
id="grid825" /></sodipodi:namedview><path
style="fill:none;stroke:#263238;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 2.5,14.5 v -12 h 12 v 12 h -12"
id="path895"
sodipodi:nodetypes="ccccc" /></svg>
id="defs25" />
<style
type="text/css"
id="style2">
.st0{fill:none;stroke:#263238;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<line
class="st0"
x1="5.5"
y1="5.5"
x2="5.5"
y2="16.5"
id="line4" />
<line
class="st0"
x1="1.5"
y1="2.5"
x2="1.5"
y2="13.5"
id="line6" />
<line
class="st0"
x1="16.5"
y1="5.5"
x2="16.5"
y2="16.5"
id="line8" />
<line
class="st0"
x1="16.5"
y1="16.5"
x2="5.5"
y2="16.5"
id="line10" />
<line
class="st0"
x1="16.5"
y1="5.5"
x2="5.5"
y2="5.5"
id="line12" />
<line
class="st0"
x1="12.5"
y1="2.5"
x2="1.5"
y2="2.5"
id="line14" />
<line
class="st0"
x1="5.5"
y1="16.5"
x2="1.5"
y2="13.5"
id="line16" />
<line
class="st0"
x1="5.5"
y1="5.5"
x2="1.5"
y2="2.5"
id="line18" />
<line
class="st0"
x1="16.5"
y1="5.5"
x2="12.5"
y2="2.5"
id="line20" />
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,35 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 18 18"
xml:space="preserve"
version="1.1"
id="svg4"
sodipodi:docname="camera_perspective.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
id="svg6"
x="0px"
y="0px"
viewBox="0 0 18 18"
style="enable-background:new 0 0 18 18;"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs8" /><sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="true"
inkscape:zoom="33.705423"
inkscape:cx="9.5088556"
inkscape:cy="9.2715051"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4"><inkscape:grid
type="xygrid"
id="grid825" /></sodipodi:namedview><path
style="fill:none;stroke:#263238;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 2.5,14.5 v -12 h 12 v 7 h -12"
id="path895" /></svg>
id="defs21" />
<style
type="text/css"
id="style2">
.st0{fill:none;stroke:#263238;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
</style>
<line
class="st0"
x1="10.5"
y1="1.5"
x2="10.5"
y2="17.5"
id="line4" />
<line
class="st0"
x1="1.5"
y1="5.5"
x2="1.5"
y2="13.5"
id="line6" />
<line
class="st0"
x1="16.5"
y1="6.5"
x2="16.5"
y2="12.5"
id="line8" />
<line
class="st0"
x1="10.5"
y1="1.5"
x2="1.5"
y2="5.5"
id="line10" />
<line
class="st0"
x1="10.5"
y1="17.5"
x2="1.5"
y2="13.5"
id="line12" />
<line
class="st0"
x1="16.5"
y1="6.5"
x2="10.5"
y2="1.5"
id="line14" />
<line
class="st0"
x1="16.5"
y1="12.5"
x2="10.5"
y2="17.5"
id="line16" />
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,4 +1,4 @@
export const FeatureSet =
{
OrthographicView : false
};

View File

@ -23,7 +23,6 @@ import { CookieGetBoolVal, CookieSetBoolVal } from './cookiehandler.js';
import { ShadingType } from '../engine/threejs/threeutils.js';
import { MeasureTool } from './measuretool.js';
import { CloseAllDialogs } from './dialog.js';
import { FeatureSet } from './featureset.js';
import * as THREE from 'three';
@ -557,33 +556,22 @@ export class Website
this.viewer.FlipUpVector ();
});
AddSeparator (this.toolbar, ['only_on_model']);
if (FeatureSet.OrthographicView) {
AddRadioButton (this.toolbar, ['camera_perspective', 'camera_orthographic'], ['Perspective camera', 'Orthographic camera'], 0, ['only_on_model'], (buttonIndex) => {
if (buttonIndex === 0) {
this.viewer.SetCameraMode (CameraMode.Perspective);
} else if (buttonIndex === 1) {
this.viewer.SetCameraMode (CameraMode.Orthographic);
}
});
AddSeparator (this.toolbar, ['only_full_width', 'only_on_model']);
AddRadioButton (this.toolbar, ['fix_up_on', 'fix_up_off'], ['Fixed up vector', 'Free orbit'], 0, ['only_full_width', 'only_on_model'], (buttonIndex) => {
if (buttonIndex === 0) {
this.viewer.SetFixUpVector (true);
} else if (buttonIndex === 1) {
this.viewer.SetFixUpVector (false);
}
});
AddSeparator (this.toolbar, ['only_full_width', 'only_on_model']);
} else {
AddRadioButton (this.toolbar, ['fix_up_on', 'fix_up_off'], ['Fixed up vector', 'Free orbit'], 0, ['only_on_model'], (buttonIndex) => {
if (buttonIndex === 0) {
this.viewer.SetFixUpVector (true);
} else if (buttonIndex === 1) {
this.viewer.SetFixUpVector (false);
}
});
AddSeparator (this.toolbar, ['only_full_width', 'only_on_model']);
}
AddRadioButton (this.toolbar, ['fix_up_on', 'fix_up_off'], ['Fixed up vector', 'Free orbit'], 0, ['only_full_width', 'only_on_model'], (buttonIndex) => {
if (buttonIndex === 0) {
this.viewer.SetFixUpVector (true);
} else if (buttonIndex === 1) {
this.viewer.SetFixUpVector (false);
}
});
AddSeparator (this.toolbar, ['only_full_width', 'only_on_model']);
AddRadioButton (this.toolbar, ['camera_perspective', 'camera_orthographic'], ['Perspective camera', 'Orthographic camera'], 0, ['only_on_model'], (buttonIndex) => {
if (buttonIndex === 0) {
this.viewer.SetCameraMode (CameraMode.Perspective);
} else if (buttonIndex === 1) {
this.viewer.SetCameraMode (CameraMode.Orthographic);
}
});
AddSeparator (this.toolbar, ['only_full_width', 'only_on_model']);
let measureToolButton = AddPushButton (this.toolbar, 'measure', 'Measure', ['only_full_width', 'only_on_model'], (isSelected) => {
HandleEvent ('measure_tool_activated', isSelected ? 'on' : 'off');
this.navigator.SetSelection (null);

Binary file not shown.

View File

@ -1,6 +1,6 @@
@font-face {
font-family: "O3DVIcons";
src: url("O3DVIcons/O3DVIcons.woff?780171e944ff8a7e49a1336268d1461f") format("woff");
src: url("O3DVIcons/O3DVIcons.woff?8f67a1f0a9586b502ca919a45546917d") format("woff");
}
i[class^="icon-"]:before, i[class*=" icon-"]:before {

View File

@ -83,8 +83,6 @@
Drag and drop 3D models here.<br>
<b>obj, 3ds, stl, ply, gltf, 3dm, fbx, <a target="_blank" href="info/index.html">and more</a></b>
</div>
<!-- intro start -->
<!-- intro end -->
<div class="intro_section">
<div>Example models:</div>
<div class="example_models">
@ -95,6 +93,8 @@
<a href="index.html#model=assets/models/DamagedHelmet.glb">helmet</a>
</div>
</div>
<!-- intro start -->
<!-- intro end -->
</div>
</body>

Binary file not shown.

View File

@ -1,6 +1,6 @@
@font-face {
font-family: "O3DVIcons";
src: url("./O3DVIcons.woff?780171e944ff8a7e49a1336268d1461f") format("woff");
src: url("./O3DVIcons.woff?8f67a1f0a9586b502ca919a45546917d") format("woff");
}
i[class^="icon-"]:before, i[class*=" icon-"]:before {