Rename CameraMode to ProjectionMode.
This commit is contained in:
parent
ae2557bb81
commit
d7db1442b2
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -87,8 +87,8 @@
|
||||
<div class="parameter_description">Camera to use. If not specified, the default camera will be used and the model will be fitted to the window.</div>
|
||||
</div>
|
||||
<div class="parameter_header">
|
||||
<span class="parameter_name">cameraMode</span>
|
||||
<span class="type parameter_type"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></span>
|
||||
<span class="parameter_name">projectionMode</span>
|
||||
<span class="type parameter_type"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></span>
|
||||
<span class="parameter_attributes">(optional)</span>
|
||||
</div>
|
||||
<div class="parameter_main">
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="icon" type="image/png" href="static/3dviewer_net_favicon.ico">
|
||||
|
||||
<title>Online 3D Viewer - CameraMode</title>
|
||||
<title>Online 3D Viewer - ProjectionMode</title>
|
||||
|
||||
<link rel="stylesheet" href="static/highlightjs/styles/github.min.css"/>
|
||||
<script src="static/highlightjs/highlight.min.js"></script>
|
||||
@ -53,13 +53,13 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="main" class="main">
|
||||
<h1>CameraMode</h1>
|
||||
<h1>ProjectionMode</h1>
|
||||
<div class="description">Camera projection mode.</div>
|
||||
<h2>Values</h2>
|
||||
<div class="parameter_header">
|
||||
@ -76,7 +76,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">Init ('CameraMode')</script>
|
||||
<script type="text/javascript">Init ('ProjectionMode')</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -64,14 +64,19 @@
|
||||
|
||||
<p>This document lists changes in the engine to help you to migrate your code base.</p>
|
||||
|
||||
<h2>0.11.0</h2>
|
||||
|
||||
<ul>
|
||||
<li>CameraMode is renamed to <a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a>. The corresponding parameter also changed in <a href="Class_EmbeddedViewer.html" target="_self">EmbeddedViewer</a> from <code class="inline">cameraMode</code> to <code class="inline">projectionMode</code>.</li>
|
||||
</ul>
|
||||
|
||||
<h2>0.8.21</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="Function_Init3DViewerElements.html" target="_self">Init3DViewerElements</a> must be called when the document is loaded and returns an array of the created <a href="Class_EmbeddedViewer.html" target="_self">EmbeddedViewer</a> objects. Earlier it registered a load event handler inside, now it's the responsibility of the caller.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>0.8.21</h2>
|
||||
<h2>0.8.20</h2>
|
||||
|
||||
<ul>
|
||||
<li>Init3DViewerElement has been renamed to <a href="Function_Init3DViewerFromUrlList.html" target="_self">Init3DViewerFromUrlList</a>.</li>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
</div>
|
||||
<div class="navigation_section">
|
||||
<div class="navigation_title">Enums</div>
|
||||
<div id="nav-CameraMode" class="navigation_item"><a href="Enum_CameraMode.html" target="_self">CameraMode</a></div>
|
||||
<div id="nav-FileSource" class="navigation_item"><a href="Enum_FileSource.html" target="_self">FileSource</a></div>
|
||||
<div id="nav-ProjectionMode" class="navigation_item"><a href="Enum_ProjectionMode.html" target="_self">ProjectionMode</a></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -2,14 +2,19 @@
|
||||
|
||||
<p>This document lists changes in the engine to help you to migrate your code base.</p>
|
||||
|
||||
<h2>0.11.0</h2>
|
||||
|
||||
<ul>
|
||||
<li>{@link CameraMode} is renamed to {@link ProjectionMode}. The corresponding parameter also changed in {@link EmbeddedViewer} from <code class="inline">cameraMode</code> to <code class="inline">projectionMode</code>.</li>
|
||||
</ul>
|
||||
|
||||
<h2>0.8.21</h2>
|
||||
|
||||
<ul>
|
||||
<li>{@link Init3DViewerElements} must be called when the document is loaded and returns an array of the created {@link EmbeddedViewer} objects. Earlier it registered a load event handler inside, now it's the responsibility of the caller.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>0.8.21</h2>
|
||||
<h2>0.8.20</h2>
|
||||
|
||||
<ul>
|
||||
<li>{@link Init3DViewerElement} has been renamed to {@link Init3DViewerFromUrlList}.</li>
|
||||
|
||||
@ -42,6 +42,11 @@
|
||||
src="../../website/embed.html#model=assets/models/solids.obj,assets/models/solids.mtl$camera=2.18558,4.53834,2.35460,3.62488,2.61927,-0.52401,0.00000,1.00000,0.00000$cameramode=orthographic">
|
||||
</iframe>
|
||||
|
||||
<iframe
|
||||
width="360" height="240" style="border:1px solid #eeeeee;"
|
||||
src="../../website/embed.html#model=assets/models/solids.obj,assets/models/solids.mtl$camera=2.18558,4.53834,2.35460,3.62488,2.61927,-0.52401,0.00000,1.00000,0.00000$projectionmode=orthographic">
|
||||
</iframe>
|
||||
|
||||
<div class="online_3d_viewer"
|
||||
style="width: 360px; height: 240px;"
|
||||
model="../website/assets/models/solids.obj,../website/assets/models/solids.mtl"
|
||||
@ -58,7 +63,7 @@
|
||||
style="width: 360px; height: 240px;"
|
||||
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"
|
||||
cameramode="orthographic">
|
||||
projectionmode="orthographic">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ import { ParameterListBuilder, ParameterListParser, CreateUrlBuilder, CreateUrlP
|
||||
import { ModelToThreeConversionParams, ModelToThreeConversionOutput, ThreeConversionStateHandler, ThreeNodeTree, ConvertModelToThreeObject } from './threejs/threeconverter.js';
|
||||
import { ThreeModelLoader } from './threejs/threemodelloader.js';
|
||||
import { ThreeColorConverter, ThreeLinearToSRGBColorConverter, ThreeSRGBToLinearColorConverter, HasHighpDriverIssue, GetShadingType, ConvertThreeColorToColor, ConvertColorToThreeColor, ConvertThreeGeometryToMesh, DisposeThreeObjects, ShadingType } from './threejs/threeutils.js';
|
||||
import { Camera, CameraIsEqual3D, CameraMode } from './viewer/camera.js';
|
||||
import { Camera, CameraIsEqual3D, ProjectionMode } from './viewer/camera.js';
|
||||
import { GetIntegerFromStyle, GetDomElementExternalWidth, GetDomElementExternalHeight, GetDomElementInnerDimensions, GetDomElementClientCoordinates, CreateDomElement, AddDomElement, AddDiv, ClearDomElement, InsertDomElementBefore, InsertDomElementAfter, ShowDomElement, IsDomElementVisible, SetDomElementWidth, SetDomElementHeight, GetDomElementOuterWidth, GetDomElementOuterHeight, SetDomElementOuterWidth, SetDomElementOuterHeight, CreateDiv } from './viewer/domutils.js';
|
||||
import { EmbeddedViewer, Init3DViewerFromUrlList, Init3DViewerFromFileList, Init3DViewerElements } from './viewer/embeddedviewer.js';
|
||||
import { MouseInteraction, TouchInteraction, ClickDetector, Navigation, NavigationType } from './viewer/navigation.js';
|
||||
@ -296,7 +296,7 @@ export {
|
||||
ShadingType,
|
||||
Camera,
|
||||
CameraIsEqual3D,
|
||||
CameraMode,
|
||||
ProjectionMode,
|
||||
GetIntegerFromStyle,
|
||||
GetDomElementExternalWidth,
|
||||
GetDomElementExternalHeight,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Coord3D } from '../geometry/coord3d.js';
|
||||
import { RGBAColor, RGBColor } from '../model/color.js';
|
||||
import { Camera, CameraMode } from '../viewer/camera.js';
|
||||
import { Camera, ProjectionMode } from '../viewer/camera.js';
|
||||
import { EdgeSettings } from '../viewer/viewermodel.js';
|
||||
|
||||
export let ParameterConverter =
|
||||
@ -56,11 +56,11 @@ export let ParameterConverter =
|
||||
return cameraParameters;
|
||||
},
|
||||
|
||||
CameraModeToString : function (cameraMode)
|
||||
CameraModeToString : function (projectionMode)
|
||||
{
|
||||
if (cameraMode === CameraMode.Perspective) {
|
||||
if (projectionMode === ProjectionMode.Perspective) {
|
||||
return 'perspective';
|
||||
} else if (cameraMode === CameraMode.Orthographic) {
|
||||
} else if (projectionMode === ProjectionMode.Orthographic) {
|
||||
return 'orthographic';
|
||||
}
|
||||
return null;
|
||||
@ -93,9 +93,9 @@ export let ParameterConverter =
|
||||
StringToCameraMode : function (str)
|
||||
{
|
||||
if (str === 'perspective') {
|
||||
return CameraMode.Perspective;
|
||||
return ProjectionMode.Perspective;
|
||||
} else if (str === 'orthographic') {
|
||||
return CameraMode.Orthographic;
|
||||
return ProjectionMode.Orthographic;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@ -245,9 +245,9 @@ export class ParameterListBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
AddCameraMode (cameraMode)
|
||||
AddCameraMode (projectionMode)
|
||||
{
|
||||
this.AddUrlPart ('cameramode', ParameterConverter.CameraModeToString (cameraMode));
|
||||
this.AddUrlPart ('projectionmode', ParameterConverter.CameraModeToString (projectionMode));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -319,7 +319,10 @@ export class ParameterListParser
|
||||
|
||||
GetCameraMode ()
|
||||
{
|
||||
let keywordParams = this.GetKeywordParams ('cameramode');
|
||||
let keywordParams = this.GetKeywordParams ('cameramode'); // for compatibility
|
||||
if (keywordParams === null) {
|
||||
keywordParams = this.GetKeywordParams ('projectionmode');
|
||||
}
|
||||
return ParameterConverter.StringToCameraMode (keywordParams);
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import { IsEqual } from '../geometry/geometry.js';
|
||||
* Camera projection mode.
|
||||
* @enum
|
||||
*/
|
||||
export const CameraMode =
|
||||
export const ProjectionMode =
|
||||
{
|
||||
/** Perspective projection. */
|
||||
Perspective : 1,
|
||||
|
||||
@ -20,7 +20,7 @@ export class EmbeddedViewer
|
||||
* @param {object} parameters Parameters for embedding.
|
||||
* @param {Camera} [parameters.camera] Camera to use. If not specified, the default camera will
|
||||
* be used and the model will be fitted to the window.
|
||||
* @param {CameraMode} [parameters.cameraMode] Camera projection mode.
|
||||
* @param {ProjectionMode} [parameters.projectionMode] Camera projection mode.
|
||||
* @param {RGBAColor} [parameters.backgroundColor] Background color of the canvas.
|
||||
* @param {RGBColor} [parameters.defaultColor] Default color of the model. It has effect only
|
||||
* if the imported model doesn't specify any color.
|
||||
@ -47,8 +47,8 @@ export class EmbeddedViewer
|
||||
let height = this.parentElement.clientHeight;
|
||||
this.viewer.Resize (width, height);
|
||||
|
||||
if (this.parameters.cameraMode) {
|
||||
this.viewer.SetCameraMode (this.parameters.cameraMode);
|
||||
if (this.parameters.projectionMode) {
|
||||
this.viewer.SetCameraMode (this.parameters.projectionMode);
|
||||
}
|
||||
|
||||
if (this.parameters.backgroundColor) {
|
||||
@ -257,10 +257,10 @@ export function Init3DViewerElements (onReady)
|
||||
camera = ParameterConverter.StringToCamera (cameraParams);
|
||||
}
|
||||
|
||||
let cameraMode = null;
|
||||
let cameraModeParams = element.getAttribute ('cameramode');
|
||||
let projectionMode = null;
|
||||
let cameraModeParams = element.getAttribute ('projectionmode');
|
||||
if (cameraModeParams) {
|
||||
cameraMode = ParameterConverter.StringToCameraMode (cameraModeParams);
|
||||
projectionMode = ParameterConverter.StringToCameraMode (cameraModeParams);
|
||||
}
|
||||
|
||||
let backgroundColor = null;
|
||||
@ -303,7 +303,7 @@ export function Init3DViewerElements (onReady)
|
||||
|
||||
return Init3DViewerFromUrlList (element, modelUrls, {
|
||||
camera : camera,
|
||||
cameraMode : cameraMode,
|
||||
projectionMode : projectionMode,
|
||||
backgroundColor : backgroundColor,
|
||||
defaultColor : defaultColor,
|
||||
edgeSettings : edgeSettings,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { SubCoord3D } from '../geometry/coord3d.js';
|
||||
import { CameraMode } from '../viewer/camera.js';
|
||||
import { ProjectionMode } from '../viewer/camera.js';
|
||||
import { ConvertColorToThreeColor, ShadingType } from '../threejs/threeutils.js';
|
||||
|
||||
import * as THREE from 'three';
|
||||
@ -44,7 +44,7 @@ export class ShadingModel
|
||||
this.scene = scene;
|
||||
|
||||
this.type = ShadingType.Phong;
|
||||
this.cameraMode = CameraMode.Perspective;
|
||||
this.projectionMode = ProjectionMode.Perspective;
|
||||
this.ambientLight = new THREE.AmbientLight (0x888888, 1.0 * Math.PI);
|
||||
this.directionalLight = new THREE.DirectionalLight (0x888888, 1.0 * Math.PI);
|
||||
this.environmentSettings = new EnvironmentSettings (null, false);
|
||||
@ -60,9 +60,9 @@ export class ShadingModel
|
||||
this.UpdateShading ();
|
||||
}
|
||||
|
||||
SetCameraMode (cameraMode)
|
||||
SetCameraMode (projectionMode)
|
||||
{
|
||||
this.cameraMode = cameraMode;
|
||||
this.projectionMode = projectionMode;
|
||||
this.UpdateShading ();
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ export class ShadingModel
|
||||
this.directionalLight.color.set (0x555555);
|
||||
this.scene.environment = this.environment;
|
||||
}
|
||||
if (this.environmentSettings.backgroundIsEnvMap && this.cameraMode === CameraMode.Perspective) {
|
||||
if (this.environmentSettings.backgroundIsEnvMap && this.projectionMode === ProjectionMode.Perspective) {
|
||||
this.scene.background = this.environment;
|
||||
} else {
|
||||
this.scene.background = null;
|
||||
|
||||
@ -2,7 +2,7 @@ import { Coord3D, CoordDistance3D, SubCoord3D } from '../geometry/coord3d.js';
|
||||
import { DegRad, Direction, IsEqual } from '../geometry/geometry.js';
|
||||
import { ColorComponentToFloat } from '../model/color.js';
|
||||
import { ShadingType } from '../threejs/threeutils.js';
|
||||
import { Camera, CameraMode } from './camera.js';
|
||||
import { Camera, ProjectionMode } from './camera.js';
|
||||
import { GetDomElementInnerDimensions } from './domutils.js';
|
||||
import { Navigation } from './navigation.js';
|
||||
import { ShadingModel } from './shadingmodel.js';
|
||||
@ -167,7 +167,7 @@ export class Viewer
|
||||
this.mainModel = null;
|
||||
this.extraModel = null;
|
||||
this.camera = null;
|
||||
this.cameraMode = null;
|
||||
this.projectionMode = null;
|
||||
this.cameraValidator = null;
|
||||
this.shadingModel = null;
|
||||
this.navigation = null;
|
||||
@ -262,7 +262,7 @@ export class Viewer
|
||||
|
||||
GetCameraMode ()
|
||||
{
|
||||
return this.cameraMode;
|
||||
return this.projectionMode;
|
||||
}
|
||||
|
||||
SetCamera (camera)
|
||||
@ -272,22 +272,22 @@ export class Viewer
|
||||
this.Render ();
|
||||
}
|
||||
|
||||
SetCameraMode (cameraMode)
|
||||
SetCameraMode (projectionMode)
|
||||
{
|
||||
if (this.cameraMode === cameraMode) {
|
||||
if (this.projectionMode === projectionMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.scene.remove (this.camera);
|
||||
if (cameraMode === CameraMode.Perspective) {
|
||||
if (projectionMode === ProjectionMode.Perspective) {
|
||||
this.camera = new THREE.PerspectiveCamera (45.0, 1.0, 0.1, 1000.0);
|
||||
} else if (cameraMode === CameraMode.Orthographic) {
|
||||
} else if (projectionMode === ProjectionMode.Orthographic) {
|
||||
this.camera = new THREE.OrthographicCamera (-1.0, 1.0, 1.0, -1.0, 0.1, 1000.0);
|
||||
}
|
||||
this.scene.add (this.camera);
|
||||
|
||||
this.cameraMode = cameraMode;
|
||||
this.shadingModel.SetCameraMode (cameraMode);
|
||||
this.projectionMode = projectionMode;
|
||||
this.shadingModel.SetCameraMode (projectionMode);
|
||||
this.cameraValidator.ForceUpdate ();
|
||||
|
||||
this.AdjustClippingPlanes ();
|
||||
@ -394,13 +394,13 @@ export class Viewer
|
||||
this.camera.up.set (navigationCamera.up.x, navigationCamera.up.y, navigationCamera.up.z);
|
||||
this.camera.lookAt (new THREE.Vector3 (navigationCamera.center.x, navigationCamera.center.y, navigationCamera.center.z));
|
||||
|
||||
if (this.cameraMode === CameraMode.Perspective) {
|
||||
if (this.projectionMode === ProjectionMode.Perspective) {
|
||||
if (!this.cameraValidator.ValidatePerspective ()) {
|
||||
this.camera.aspect = this.canvas.width / this.canvas.height;
|
||||
this.camera.fov = navigationCamera.fov;
|
||||
this.camera.updateProjectionMatrix ();
|
||||
}
|
||||
} else if (this.cameraMode === CameraMode.Orthographic) {
|
||||
} else if (this.projectionMode === ProjectionMode.Orthographic) {
|
||||
let eyeCenterDistance = CoordDistance3D (navigationCamera.eye, navigationCamera.center);
|
||||
if (!this.cameraValidator.ValidateOrthographic (eyeCenterDistance)) {
|
||||
let aspect = this.canvas.width / this.canvas.height;
|
||||
@ -539,7 +539,7 @@ export class Viewer
|
||||
{
|
||||
let camera = GetDefaultCamera (Direction.Y);
|
||||
this.camera = new THREE.PerspectiveCamera (45.0, 1.0, 0.1, 1000.0);
|
||||
this.cameraMode = CameraMode.Perspective;
|
||||
this.projectionMode = ProjectionMode.Perspective;
|
||||
this.cameraValidator = new CameraValidator ();
|
||||
this.scene.add (this.camera);
|
||||
|
||||
|
||||
@ -51,9 +51,9 @@ export class Embed
|
||||
let environmentSettings = new EnvironmentSettings (envMapTextures, bgIsEnvMap);
|
||||
this.viewer.SetEnvironmentMapSettings (environmentSettings);
|
||||
|
||||
let cameraMode = this.hashHandler.GetCameraModeFromHash ();
|
||||
if (cameraMode !== null) {
|
||||
this.viewer.SetCameraMode (cameraMode);
|
||||
let projectionMode = this.hashHandler.GetCameraModeFromHash ();
|
||||
if (projectionMode !== null) {
|
||||
this.viewer.SetCameraMode (projectionMode);
|
||||
}
|
||||
let background = this.hashHandler.GetBackgroundFromHash ();
|
||||
if (background !== null) {
|
||||
|
||||
@ -6,7 +6,7 @@ import { PopupDialog } from './dialog.js';
|
||||
import { Settings } from './settings.js';
|
||||
import { SidebarPanel } from './sidebarpanel.js';
|
||||
import { ShadingType } from '../engine/threejs/threeutils.js';
|
||||
import { CameraMode } from '../engine/viewer/camera.js';
|
||||
import { ProjectionMode } from '../engine/viewer/camera.js';
|
||||
|
||||
import * as Pickr from '@simonwep/pickr';
|
||||
import '@simonwep/pickr/dist/themes/monolith.min.css';
|
||||
@ -121,7 +121,7 @@ class EnvironmentMapPopup extends PopupDialog
|
||||
});
|
||||
}
|
||||
} else if (shadingType === ShadingType.Physical) {
|
||||
let isPerspective = (callbacks.getCameraMode () === CameraMode.Perspective);
|
||||
let isPerspective = (callbacks.getCameraMode () === ProjectionMode.Perspective);
|
||||
if (isPerspective) {
|
||||
let checkboxDiv = AddDiv (contentDiv, 'ov_environment_map_checkbox');
|
||||
let backgroundIsEnvMapCheckbox = AddCheckbox (checkboxDiv, 'use_as_background', 'Use as background image', settings.backgroundIsEnvMap, () => {
|
||||
@ -345,7 +345,7 @@ class SettingsModelDisplaySection extends SettingsSection
|
||||
{
|
||||
let isPhysicallyBased = (this.callbacks.getShadingType () === ShadingType.Physical);
|
||||
if (this.environmentMapPhongDiv !== null) {
|
||||
let isPerspective = (this.callbacks.getCameraMode () === CameraMode.Perspective);
|
||||
let isPerspective = (this.callbacks.getCameraMode () === ProjectionMode.Perspective);
|
||||
ShowDomElement (this.environmentMapPhongDiv, !isPhysicallyBased && isPerspective);
|
||||
}
|
||||
if (this.environmentMapPbrDiv !== null) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { GetFileExtension, TransformFileHostUrls } from '../engine/io/fileutils.js';
|
||||
import { InputFilesFromFileObjects, InputFilesFromUrls } from '../engine/import/importerfiles.js';
|
||||
import { ImportErrorCode, ImportSettings } from '../engine/import/importer.js';
|
||||
import { CameraMode } from '../engine/viewer/camera.js';
|
||||
import { ProjectionMode } from '../engine/viewer/camera.js';
|
||||
import { RGBColor } from '../engine/model/color.js';
|
||||
import { Viewer } from '../engine/viewer/viewer.js';
|
||||
import { AddDiv, AddDomElement, ShowDomElement, SetDomElementOuterHeight, CreateDomElement, GetDomElementOuterWidth, GetDomElementOuterHeight } from '../engine/viewer/domutils.js';
|
||||
@ -683,9 +683,9 @@ export class Website
|
||||
AddSeparator (this.toolbar, ['only_full_width', 'only_on_model']);
|
||||
AddRadioButton (this.toolbar, ['camera_perspective', 'camera_orthographic'], ['Perspective camera', 'Orthographic camera'], 0, ['only_full_width', 'only_on_model'], (buttonIndex) => {
|
||||
if (buttonIndex === 0) {
|
||||
this.viewer.SetCameraMode (CameraMode.Perspective);
|
||||
this.viewer.SetCameraMode (ProjectionMode.Perspective);
|
||||
} else if (buttonIndex === 1) {
|
||||
this.viewer.SetCameraMode (CameraMode.Orthographic);
|
||||
this.viewer.SetCameraMode (ProjectionMode.Orthographic);
|
||||
}
|
||||
this.sidebar.UpdateControlsVisibility ();
|
||||
});
|
||||
|
||||
@ -45,12 +45,12 @@ describe ('Parameter List', function () {
|
||||
assert.strictEqual (urlParams, 'edgesettings=on,1,2,3,15');
|
||||
}
|
||||
{
|
||||
let urlParams = OV.CreateUrlBuilder ().AddCameraMode (OV.CameraMode.Perspective).GetParameterList ();
|
||||
assert.strictEqual (urlParams, 'cameramode=perspective');
|
||||
let urlParams = OV.CreateUrlBuilder ().AddCameraMode (OV.ProjectionMode.Perspective).GetParameterList ();
|
||||
assert.strictEqual (urlParams, 'projectionmode=perspective');
|
||||
}
|
||||
{
|
||||
let urlParams = OV.CreateUrlBuilder ().AddCameraMode (OV.CameraMode.Orthographic).GetParameterList ();
|
||||
assert.strictEqual (urlParams, 'cameramode=orthographic');
|
||||
let urlParams = OV.CreateUrlBuilder ().AddCameraMode (OV.ProjectionMode.Orthographic).GetParameterList ();
|
||||
assert.strictEqual (urlParams, 'projectionmode=orthographic');
|
||||
}
|
||||
});
|
||||
|
||||
@ -123,12 +123,12 @@ describe ('Parameter List', function () {
|
||||
));
|
||||
}
|
||||
{
|
||||
let parser = OV.CreateUrlParser ('cameramode=perspective');
|
||||
assert.deepStrictEqual (parser.GetCameraMode (), OV.CameraMode.Perspective);
|
||||
let parser = OV.CreateUrlParser ('projectionmode=perspective');
|
||||
assert.deepStrictEqual (parser.GetCameraMode (), OV.ProjectionMode.Perspective);
|
||||
}
|
||||
{
|
||||
let parser = OV.CreateUrlParser ('cameramode=orthographic');
|
||||
assert.deepStrictEqual (parser.GetCameraMode (), OV.CameraMode.Orthographic);
|
||||
let parser = OV.CreateUrlParser ('projectionmode=orthographic');
|
||||
assert.deepStrictEqual (parser.GetCameraMode (), OV.ProjectionMode.Orthographic);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user