@xtctwins/tctwins-core 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tctwins-core.cjs.js +5509 -5354
- package/dist/tctwins-core.es.js +5509 -5354
- package/dist/tctwins-core.es5.js +1549 -1516
- package/dist/tctwins-core.min.cjs.js +3 -3
- package/dist/tctwins-core.min.es.js +3 -3
- package/dist/tctwins-core.min.es5.js +3 -3
- package/package.json +69 -69
- package/types/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +74 -43
- package/types/viewer/scene/CameraControl/CameraControl.d.ts +674 -672
- package/types/viewer/scene/scene/Scene.d.ts +844 -809
package/dist/tctwins-core.es5.js
CHANGED
|
@@ -2950,57 +2950,57 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
|
|
|
2950
2950
|
* angleMeasurementsMouseControl.activate();
|
|
2951
2951
|
* ````
|
|
2952
2952
|
*/var AngleMeasurementsMouseControl=/*#__PURE__*/function(_AngleMeasurementsCon){_inherits(AngleMeasurementsMouseControl,_AngleMeasurementsCon);var _super7=_createSuper(AngleMeasurementsMouseControl);/**
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
_this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement(
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
2953
|
+
* Creates a AngleMeasurementsMouseControl bound to the given AngleMeasurementsPlugin.
|
|
2954
|
+
*
|
|
2955
|
+
* @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
2956
|
+
* @param {*} [cfg] Configuration
|
|
2957
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
2958
|
+
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
2959
|
+
*/function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this18;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this18=_super7.call(this,angleMeasurementsPlugin.viewer.scene);_this18.pointerLens=cfg.pointerLens;_this18._active=false;_this18._mouseState=MOUSE_FINDING_ORIGIN;_this18._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
|
|
2960
|
+
_this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myAngleMeasureMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){var element=document.getElementById("myAngleMeasureMarker");element.parentNode.removeChild(element);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
2961
|
+
* The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
|
|
2962
|
+
*
|
|
2963
|
+
* @type {AngleMeasurementsPlugin}
|
|
2964
|
+
*/this.angleMeasurementsPlugin=angleMeasurementsPlugin;/**
|
|
2965
|
+
* The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
|
|
2966
|
+
*
|
|
2967
|
+
* @type {AngleMeasurementsPlugin}
|
|
2968
|
+
*/this.plugin=angleMeasurementsPlugin;}/**
|
|
2969
|
+
* Gets if this AngleMeasurementsMouseControl is currently active, where it is responding to input.
|
|
2970
|
+
*
|
|
2971
|
+
* @returns {boolean}
|
|
2972
|
+
*/},{key:"active",get:function get(){return this._active;}/**
|
|
2973
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
2974
|
+
*
|
|
2975
|
+
* This is `true` by default.
|
|
2976
|
+
*
|
|
2977
|
+
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
2978
|
+
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
2979
|
+
* and rebinds various input handlers.
|
|
2980
|
+
*
|
|
2981
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
2982
|
+
*/},{key:"snapping",get:/**
|
|
2983
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
2984
|
+
*
|
|
2985
|
+
* This is `true` by default.
|
|
2986
|
+
*
|
|
2987
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
2988
|
+
*/function get(){return this._snapping;}/**
|
|
2989
|
+
* Activates this AngleMeasurementsMouseControl, ready to respond to input.
|
|
2990
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
|
|
2991
|
+
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this19.markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this19.markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;_this19._currentAngleMeasurement.corner.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;_this19._currentAngleMeasurement.target.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.origin.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.corner.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.entity=hoveredEntity;_this19._currentAngleMeasurement.clickable=true;hoveredEntity=null;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.marginLeft="-100px";_this19.markerDiv.style.marginTop="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
|
|
2992
|
+
* Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
|
|
2993
|
+
*
|
|
2994
|
+
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
2995
|
+
*/},{key:"deactivate",value:function deactivate(){if(!this._active){return;}if(this.pointerLens){this.pointerLens.visible=false;}if(this.markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onMouseHoverSurface);cameraControl.off(this._onPickedSurface);cameraControl.off(this._onHoverNothing);cameraControl.off(this._onPickedNothing);this._currentAngleMeasurement=null;this._active=false;}/**
|
|
2996
|
+
* Resets this AngleMeasurementsMouseControl.
|
|
2997
|
+
*
|
|
2998
|
+
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
2999
|
+
*
|
|
3000
|
+
* Does nothing if the AngleMeasurementsMouseControl is not active.
|
|
3001
|
+
*/},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentAngleMeasurement){this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}this._mouseState=MOUSE_FINDING_ORIGIN;}/**
|
|
3002
|
+
* Destroys this AngleMeasurementsMouseControl.
|
|
3003
|
+
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(AngleMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return AngleMeasurementsMouseControl;}(AngleMeasurementsControl);/**
|
|
3004
3004
|
* {@link Viewer} plugin for measuring angles.
|
|
3005
3005
|
*
|
|
3006
3006
|
* [<img src="https://user-images.githubusercontent.com/83100/63641903-61488180-c6b6-11e9-8e00-895b9d16dc4b.gif">](https://xeokit.github.io/xeokit-sdk/examples/#measurements_angle_createWithMouse)
|
|
@@ -4589,7 +4589,7 @@ return imageDataCache;}},{key:"unbind",value:function unbind(){var gl=this.gl;gl
|
|
|
4589
4589
|
* @type {WebGL2RenderingContext}
|
|
4590
4590
|
*/var gl=scene.canvas.gl;var canvasTransparent=!!options.transparent;var alphaDepthMask=options.alphaDepthMask;var pickIDs=new Map$1({});var drawableTypeInfo={};var drawables={};var drawableListDirty=true;var stateSortDirty=true;var imageDirty=true;var transparentEnabled=true;var edgesEnabled=!!options.edgesEnabled;var saoEnabled=true;var pbrEnabled=true;var colorTextureEnabled=true;var renderBufferManager=new RenderBufferManager(scene);var snapshotBound=false;var saoOcclusionRenderer=new SAOOcclusionRenderer(scene);var saoDepthLimitedBlurRenderer=new SAODepthLimitedBlurRenderer(scene);this.scene=scene;this._occlusionTester=null;// Lazy-created in #addMarker()
|
|
4591
4591
|
this.capabilities={astcSupported:!!getExtension(gl,'WEBGL_compressed_texture_astc'),etc1Supported:true,// WebGL2
|
|
4592
|
-
etc2Supported:!!getExtension(gl,'WEBGL_compressed_texture_etc'),dxtSupported:!!getExtension(gl,'WEBGL_compressed_texture_s3tc'),bptcSupported:!!getExtension(gl,'EXT_texture_compression_bptc'),pvrtcSupported:!!(getExtension(gl,'WEBGL_compressed_texture_pvrtc')||getExtension(gl,'WEBKIT_WEBGL_compressed_texture_pvrtc'))};this.setTransparentEnabled=function(enabled){transparentEnabled=enabled;imageDirty=true;};this.setEdgesEnabled=function(enabled){edgesEnabled=enabled;imageDirty=true;};this.setSAOEnabled=function(enabled){saoEnabled=enabled;imageDirty=true;};this.setPBREnabled=function(enabled){pbrEnabled=enabled;imageDirty=true;};this.setColorTextureEnabled=function(enabled){colorTextureEnabled=enabled;imageDirty=true;};this.needStateSort=function(){stateSortDirty=true;};this.shadowsDirty=function(){};this.imageDirty=function(){imageDirty=true;};this.webglContextLost=function(){};this.webglContextRestored=function(gl){// renderBufferManager.webglContextRestored(gl);
|
|
4592
|
+
etc2Supported:!!getExtension(gl,'WEBGL_compressed_texture_etc'),dxtSupported:!!getExtension(gl,'WEBGL_compressed_texture_s3tc'),bptcSupported:!!getExtension(gl,'EXT_texture_compression_bptc'),pvrtcSupported:!!(getExtension(gl,'WEBGL_compressed_texture_pvrtc')||getExtension(gl,'WEBKIT_WEBGL_compressed_texture_pvrtc'))};this.setTransparentEnabled=function(enabled){transparentEnabled=enabled;canvasTransparent=enabled;imageDirty=true;};this.setEdgesEnabled=function(enabled){edgesEnabled=enabled;imageDirty=true;};this.setSAOEnabled=function(enabled){saoEnabled=enabled;imageDirty=true;};this.setPBREnabled=function(enabled){pbrEnabled=enabled;imageDirty=true;};this.setColorTextureEnabled=function(enabled){colorTextureEnabled=enabled;imageDirty=true;};this.needStateSort=function(){stateSortDirty=true;};this.shadowsDirty=function(){};this.imageDirty=function(){imageDirty=true;};this.webglContextLost=function(){};this.webglContextRestored=function(gl){// renderBufferManager.webglContextRestored(gl);
|
|
4593
4593
|
saoOcclusionRenderer.init();saoDepthLimitedBlurRenderer.init();imageDirty=true;};/**
|
|
4594
4594
|
* Inserts a drawable into this renderer.
|
|
4595
4595
|
* @private
|
|
@@ -4605,7 +4605,7 @@ saoOcclusionRenderer.init();saoDepthLimitedBlurRenderer.init();imageDirty=true;}
|
|
|
4605
4605
|
*/this.putPickID=function(pickID){pickIDs.removeItem(pickID);};/**
|
|
4606
4606
|
* Clears the canvas.
|
|
4607
4607
|
* @private
|
|
4608
|
-
*/this.clear=function(params){gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(1,1,1,
|
|
4608
|
+
*/this.clear=function(params){gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(1,1,1,0);}else{var _backgroundColor=scene.canvas.backgroundColorFromAmbientLight?this.lights.getAmbientColorAndIntensity():scene.canvas.backgroundColor;gl.clearColor(_backgroundColor[0],_backgroundColor[1],_backgroundColor[2],1.0);}gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);};/**
|
|
4609
4609
|
* Returns true if the next call to render() will draw something
|
|
4610
4610
|
* @returns {Boolean}
|
|
4611
4611
|
*/this.needsRender=function(){var needsRender=imageDirty||drawableListDirty||stateSortDirty;return needsRender;};/**
|
|
@@ -8817,28 +8817,28 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
|
|
|
8817
8817
|
*
|
|
8818
8818
|
* @class Scene
|
|
8819
8819
|
*/var Scene=/*#__PURE__*/function(_Component20){_inherits(Scene,_Component20);var _super33=_createSuper(Scene);/**
|
|
8820
|
+
* @private
|
|
8821
|
+
* @constructor
|
|
8822
|
+
* @param {Viewer} viewer The Viewer this Scene belongs to.
|
|
8823
|
+
* @param {Object} cfg Scene configuration.
|
|
8824
|
+
* @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
8825
|
+
* @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
8826
|
+
* @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
|
|
8827
|
+
* @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
|
|
8828
|
+
* of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
|
|
8829
|
+
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
8830
|
+
* responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
8831
|
+
* your expected usage.
|
|
8832
|
+
* @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
|
|
8833
|
+
*/function Scene(viewer){var _this52;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Scene);_this52=_super33.call(this,null,cfg);var canvas=cfg.canvasElement||document.getElementById(cfg.canvasId);if(!(canvas instanceof HTMLCanvasElement)){throw"Mandatory config expected: valid canvasId or canvasElement";}/**
|
|
8834
|
+
* @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
|
|
8835
|
+
*/_this52._tickifiedFunctions={};_this52._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this52._edgesEnabled=!!cfg.edgesEnabled;_this52._aabbDirty=true;/**
|
|
8836
|
+
* The {@link Viewer} this Scene belongs to.
|
|
8837
|
+
* @type {Viewer}
|
|
8838
|
+
*/_this52.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
|
|
8820
8839
|
* @private
|
|
8821
|
-
* @
|
|
8822
|
-
|
|
8823
|
-
* @param {Object} cfg Scene configuration.
|
|
8824
|
-
* @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
8825
|
-
* @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
8826
|
-
* @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
|
|
8827
|
-
* @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
|
|
8828
|
-
* of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
|
|
8829
|
-
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
8830
|
-
* responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
8831
|
-
* your expected usage.
|
|
8832
|
-
* @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
|
|
8833
|
-
*/function Scene(viewer){var _this52;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Scene);_this52=_super33.call(this,null,cfg);var canvas=cfg.canvasElement||document.getElementById(cfg.canvasId);if(!(canvas instanceof HTMLCanvasElement)){throw"Mandatory config expected: valid canvasId or canvasElement";}/**
|
|
8834
|
-
* @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
|
|
8835
|
-
*/_this52._tickifiedFunctions={};var transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;var edgesEnabled=!!cfg.edgesEnabled;_this52._aabbDirty=true;/**
|
|
8836
|
-
* The {@link Viewer} this Scene belongs to.
|
|
8837
|
-
* @type {Viewer}
|
|
8838
|
-
*/_this52.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
|
|
8839
|
-
* @private
|
|
8840
|
-
* @type {number}
|
|
8841
|
-
*/_this52.occlusionTestCountdown=0;/**
|
|
8840
|
+
* @type {number}
|
|
8841
|
+
*/_this52.occlusionTestCountdown=0;/**
|
|
8842
8842
|
The number of models currently loading.
|
|
8843
8843
|
|
|
8844
8844
|
@property loading
|
|
@@ -8851,158 +8851,157 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
|
|
|
8851
8851
|
@final
|
|
8852
8852
|
@type {Number}
|
|
8853
8853
|
*/_this52.startTime=new Date().getTime();/**
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8854
|
+
* Map of {@link Entity}s that represent models.
|
|
8855
|
+
*
|
|
8856
|
+
* Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isModel} is ````true````.
|
|
8857
|
+
*
|
|
8858
|
+
* @property models
|
|
8859
|
+
* @final
|
|
8860
|
+
* @type {{String:Entity}}
|
|
8861
|
+
*/_this52.models={};/**
|
|
8862
|
+
* Map of {@link Entity}s that represents objects.
|
|
8863
|
+
*
|
|
8864
|
+
* Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isObject} is ````true````.
|
|
8865
|
+
*
|
|
8866
|
+
* @property objects
|
|
8867
|
+
* @final
|
|
8868
|
+
* @type {{String:Entity}}
|
|
8869
|
+
*/_this52.objects={};_this52._numObjects=0;/**
|
|
8870
|
+
* Map of currently visible {@link Entity}s that represent objects.
|
|
8871
|
+
*
|
|
8872
|
+
* An Entity represents an object if {@link Entity#isObject} is ````true````, and is visible when {@link Entity#visible} is true.
|
|
8873
|
+
*
|
|
8874
|
+
* @property visibleObjects
|
|
8875
|
+
* @final
|
|
8876
|
+
* @type {{String:Object}}
|
|
8877
|
+
*/_this52.visibleObjects={};_this52._numVisibleObjects=0;/**
|
|
8878
|
+
* Map of currently xrayed {@link Entity}s that represent objects.
|
|
8879
|
+
*
|
|
8880
|
+
* An Entity represents an object if {@link Entity#isObject} is ````true````, and is xrayed when {@link Entity#xrayed} is true.
|
|
8881
|
+
*
|
|
8882
|
+
* Each {@link Entity} is mapped here by {@link Entity#id}.
|
|
8883
|
+
*
|
|
8884
|
+
* @property xrayedObjects
|
|
8885
|
+
* @final
|
|
8886
|
+
* @type {{String:Object}}
|
|
8887
|
+
*/_this52.xrayedObjects={};_this52._numXRayedObjects=0;/**
|
|
8888
|
+
* Map of currently highlighted {@link Entity}s that represent objects.
|
|
8889
|
+
*
|
|
8890
|
+
* An Entity represents an object if {@link Entity#isObject} is ````true```` is true, and is highlighted when {@link Entity#highlighted} is true.
|
|
8891
|
+
*
|
|
8892
|
+
* Each {@link Entity} is mapped here by {@link Entity#id}.
|
|
8893
|
+
*
|
|
8894
|
+
* @property highlightedObjects
|
|
8895
|
+
* @final
|
|
8896
|
+
* @type {{String:Object}}
|
|
8897
|
+
*/_this52.highlightedObjects={};_this52._numHighlightedObjects=0;/**
|
|
8898
|
+
* Map of currently selected {@link Entity}s that represent objects.
|
|
8899
|
+
*
|
|
8900
|
+
* An Entity represents an object if {@link Entity#isObject} is true, and is selected while {@link Entity#selected} is true.
|
|
8901
|
+
*
|
|
8902
|
+
* Each {@link Entity} is mapped here by {@link Entity#id}.
|
|
8903
|
+
*
|
|
8904
|
+
* @property selectedObjects
|
|
8905
|
+
* @final
|
|
8906
|
+
* @type {{String:Object}}
|
|
8907
|
+
*/_this52.selectedObjects={};_this52._numSelectedObjects=0;/**
|
|
8908
|
+
* Map of currently colorized {@link Entity}s that represent objects.
|
|
8909
|
+
*
|
|
8910
|
+
* An Entity represents an object if {@link Entity#isObject} is ````true````.
|
|
8911
|
+
*
|
|
8912
|
+
* Each {@link Entity} is mapped here by {@link Entity#id}.
|
|
8913
|
+
*
|
|
8914
|
+
* @property colorizedObjects
|
|
8915
|
+
* @final
|
|
8916
|
+
* @type {{String:Object}}
|
|
8917
|
+
*/_this52.colorizedObjects={};_this52._numColorizedObjects=0;/**
|
|
8918
|
+
* Map of {@link Entity}s that represent objects whose opacity was updated.
|
|
8919
|
+
*
|
|
8920
|
+
* An Entity represents an object if {@link Entity#isObject} is ````true````.
|
|
8921
|
+
*
|
|
8922
|
+
* Each {@link Entity} is mapped here by {@link Entity#id}.
|
|
8923
|
+
*
|
|
8924
|
+
* @property opacityObjects
|
|
8925
|
+
* @final
|
|
8926
|
+
* @type {{String:Object}}
|
|
8927
|
+
*/_this52.opacityObjects={};_this52._numOpacityObjects=0;/**
|
|
8928
|
+
* Map of {@link Entity}s that represent objects whose {@link Entity#offset}s were updated.
|
|
8929
|
+
*
|
|
8930
|
+
* An Entity represents an object if {@link Entity#isObject} is ````true````.
|
|
8931
|
+
*
|
|
8932
|
+
* Each {@link Entity} is mapped here by {@link Entity#id}.
|
|
8933
|
+
*
|
|
8934
|
+
* @property offsetObjects
|
|
8935
|
+
* @final
|
|
8936
|
+
* @type {{String:Object}}
|
|
8937
|
+
*/_this52.offsetObjects={};_this52._numOffsetObjects=0;// Cached ID arrays, lazy-rebuilt as needed when stale after map updates
|
|
8938
8938
|
/**
|
|
8939
8939
|
Lazy-regenerated ID lists.
|
|
8940
8940
|
*/_this52._modelIds=null;_this52._objectIds=null;_this52._visibleObjectIds=null;_this52._xrayedObjectIds=null;_this52._highlightedObjectIds=null;_this52._selectedObjectIds=null;_this52._colorizedObjectIds=null;_this52._opacityObjectIds=null;_this52._offsetObjectIds=null;_this52._collidables={};// Components that contribute to the Scene AABB
|
|
8941
8941
|
_this52._compilables={};// Components that require shader compilation
|
|
8942
8942
|
_this52._needRecompile=false;/**
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
canvas:canvas,spinnerElementId:cfg.spinnerElementId,transparent:
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
*/_this52.input=new Input(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
|
|
8943
|
+
* For each {@link Component} type, a map of IDs to {@link Component} instances of that type.
|
|
8944
|
+
*
|
|
8945
|
+
* @type {{String:{String:Component}}}
|
|
8946
|
+
*/_this52.types={};/**
|
|
8947
|
+
* The {@link Component}s within this Scene, each mapped to its {@link Component#id}.
|
|
8948
|
+
*
|
|
8949
|
+
* *@type {{String:Component}}
|
|
8950
|
+
*/_this52.components={};/**
|
|
8951
|
+
* The {@link SectionPlane}s in this Scene, each mapped to its {@link SectionPlane#id}.
|
|
8952
|
+
*
|
|
8953
|
+
* @type {{String:SectionPlane}}
|
|
8954
|
+
*/_this52.sectionPlanes={};/**
|
|
8955
|
+
* The {@link Light}s in this Scene, each mapped to its {@link Light#id}.
|
|
8956
|
+
*
|
|
8957
|
+
* @type {{String:Light}}
|
|
8958
|
+
*/_this52.lights={};/**
|
|
8959
|
+
* The {@link LightMap}s in this Scene, each mapped to its {@link LightMap#id}.
|
|
8960
|
+
*
|
|
8961
|
+
* @type {{String:LightMap}}
|
|
8962
|
+
*/_this52.lightMaps={};/**
|
|
8963
|
+
* The {@link ReflectionMap}s in this Scene, each mapped to its {@link ReflectionMap#id}.
|
|
8964
|
+
*
|
|
8965
|
+
* @type {{String:ReflectionMap}}
|
|
8966
|
+
*/_this52.reflectionMaps={};/**
|
|
8967
|
+
* The {@link Bitmap}s in this Scene, each mapped to its {@link Bitmap#id}.
|
|
8968
|
+
*
|
|
8969
|
+
* @type {{String:Bitmap}}
|
|
8970
|
+
*/_this52.bitmaps={};/**
|
|
8971
|
+
* The {@link LineSet}s in this Scene, each mapped to its {@link LineSet#id}.
|
|
8972
|
+
*
|
|
8973
|
+
* @type {{String:LineSet}}
|
|
8974
|
+
*/_this52.lineSets={};/**
|
|
8975
|
+
* The real world offset for this Scene
|
|
8976
|
+
*
|
|
8977
|
+
* @type {Number[]}
|
|
8978
|
+
*/_this52.realWorldOffset=cfg.realWorldOffset||new Float64Array([0,0,0]);/**
|
|
8979
|
+
* Manages the HTML5 canvas for this Scene.
|
|
8980
|
+
*
|
|
8981
|
+
* @type {Canvas}
|
|
8982
|
+
*/_this52.canvas=new Canvas(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
|
|
8983
|
+
canvas:canvas,spinnerElementId:cfg.spinnerElementId,transparent:_this52._transparent,webgl2:cfg.webgl2!==false,contextAttr:cfg.contextAttr||{},backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,premultipliedAlpha:cfg.premultipliedAlpha});_this52.canvas.on("boundary",function(){_this52.glRedraw();});_this52.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this52._renderer=new Renderer$1(_assertThisInitialized(_this52),{transparent:_this52._transparent,alphaDepthMask:alphaDepthMask,edgesEnabled:_this52._edgesEnabled});_this52._sectionPlanesState=new function(){this.sectionPlanes=[];this.clippingCaps=false;this._numCachedSectionPlanes=0;var hash=null;this.getHash=function(){if(hash){return hash;}var numAllocatedSectionPlanes=this.getNumAllocatedSectionPlanes();var sectionPlanes=this.sectionPlanes;if(numAllocatedSectionPlanes===0){return this.hash=";";}var hashParts=[];for(var _i80=0,len=numAllocatedSectionPlanes;_i80<len;_i80++){sectionPlanes[_i80];hashParts.push("cp");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addSectionPlane=function(sectionPlane){this.sectionPlanes.push(sectionPlane);hash=null;};this.removeSectionPlane=function(sectionPlane){for(var _i81=0,len=this.sectionPlanes.length;_i81<len;_i81++){if(this.sectionPlanes[_i81].id===sectionPlane.id){this.sectionPlanes.splice(_i81,1);hash=null;return;}}};this.setNumCachedSectionPlanes=function(numCachedSectionPlanes){this._numCachedSectionPlanes=numCachedSectionPlanes;hash=null;};this.getNumCachedSectionPlanes=function(){return this._numCachedSectionPlanes;};this.getNumAllocatedSectionPlanes=function(){var num=this.sectionPlanes.length;return num>this._numCachedSectionPlanes?num:this._numCachedSectionPlanes;};}();_this52._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this52._lightsState=new function(){var DEFAULT_AMBIENT=math.vec4([0,0,0,0]);var ambientColorIntensity=math.vec4();this.lights=[];this.reflectionMaps=[];this.lightMaps=[];var hash=null;var ambientLight=null;this.getHash=function(){if(hash){return hash;}var hashParts=[];var lights=this.lights;var light;for(var _i82=0,len=lights.length;_i82<len;_i82++){light=lights[_i82];hashParts.push("/");hashParts.push(light.type);hashParts.push(light.space==="world"?"w":"v");if(light.castsShadow){hashParts.push("sh");}}if(this.lightMaps.length>0){hashParts.push("/lm");}if(this.reflectionMaps.length>0){hashParts.push("/rm");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addLight=function(state){this.lights.push(state);ambientLight=null;hash=null;};this.removeLight=function(state){for(var _i83=0,len=this.lights.length;_i83<len;_i83++){var light=this.lights[_i83];if(light.id===state.id){this.lights.splice(_i83,1);if(ambientLight&&ambientLight.id===state.id){ambientLight=null;}hash=null;return;}}};this.addReflectionMap=function(state){this.reflectionMaps.push(state);hash=null;};this.removeReflectionMap=function(state){for(var _i84=0,len=this.reflectionMaps.length;_i84<len;_i84++){if(this.reflectionMaps[_i84].id===state.id){this.reflectionMaps.splice(_i84,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i85=0,len=this.lightMaps.length;_i85<len;_i85++){if(this.lightMaps[_i85].id===state.id){this.lightMaps.splice(_i85,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i86=0,len=this.lights.length;_i86<len;_i86++){var light=this.lights[_i86];if(light.type==="ambient"){ambientLight=light;break;}}}if(ambientLight){var _color2=ambientLight.color;var intensity=ambientLight.intensity;ambientColorIntensity[0]=_color2[0];ambientColorIntensity[1]=_color2[1];ambientColorIntensity[2]=_color2[2];ambientColorIntensity[3]=intensity;return ambientColorIntensity;}else{return DEFAULT_AMBIENT;}};}();/**
|
|
8984
|
+
* Publishes input events that occur on this Scene's canvas.
|
|
8985
|
+
* @property input
|
|
8986
|
+
* @type {Input}
|
|
8987
|
+
* @final
|
|
8988
|
+
*/_this52.input=new Input(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
|
|
8990
8989
|
element:_this52.canvas.canvas,keyboardEventsElement:cfg.keyboardEventsElement});/**
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
8990
|
+
* Configures this Scene's units of measurement and coordinate mapping between Real-space and World-space 3D coordinate systems.
|
|
8991
|
+
*
|
|
8992
|
+
* @property metrics
|
|
8993
|
+
* @type {Metrics}
|
|
8994
|
+
* @final
|
|
8995
|
+
*/_this52.metrics=new Metrics(_assertThisInitialized(_this52),{units:cfg.units,scale:cfg.scale,origin:cfg.origin});/** Configures Scalable Ambient Obscurance (SAO) for this Scene.
|
|
8996
|
+
* @type {SAO}
|
|
8997
|
+
* @final
|
|
8998
|
+
*/_this52.sao=new SAO(_assertThisInitialized(_this52),{enabled:cfg.saoEnabled});_this52.ticksPerRender=cfg.ticksPerRender;_this52.ticksPerOcclusionTest=cfg.ticksPerOcclusionTest;_this52.passes=cfg.passes;_this52.clearEachPass=cfg.clearEachPass;_this52.gammaInput=cfg.gammaInput;_this52.gammaOutput=cfg.gammaOutput;_this52.gammaFactor=cfg.gammaFactor;_this52._entityOffsetsEnabled=!!cfg.entityOffsetsEnabled;_this52._logarithmicDepthBufferEnabled=!!cfg.logarithmicDepthBufferEnabled;_this52._dtxEnabled=cfg.dtxEnabled!==false;_this52._pbrEnabled=!!cfg.pbrEnabled;_this52._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this52._dtxEnabled=!!cfg.dtxEnabled;// Register Scene on xeokit
|
|
9000
8999
|
// Do this BEFORE we add components below
|
|
9001
9000
|
core._addScene(_assertThisInitialized(_this52));_this52._initDefaults();// Global components
|
|
9002
9001
|
_this52._viewport=new Viewport(_assertThisInitialized(_this52),{id:"default.viewport",autoBoundary:true,dontClear:true// Never destroy this component with Scene#clear();
|
|
9003
9002
|
});_this52._camera=new Camera(_assertThisInitialized(_this52),{id:"default.camera",dontClear:true// Never destroy this component with Scene#clear();
|
|
9004
9003
|
});// Default lights
|
|
9005
|
-
new AmbientLight(_assertThisInitialized(_this52),{color:[1.0,1.0,1.0],intensity:0.7});new DirLight(_assertThisInitialized(_this52),{dir:[0.8
|
|
9004
|
+
new AmbientLight(_assertThisInitialized(_this52),{color:[1.0,1.0,1.0],intensity:0.7});new DirLight(_assertThisInitialized(_this52),{dir:[0.8,-0.5,-0.5],color:[0.67,0.67,1.0],intensity:0.7,space:"world"});new DirLight(_assertThisInitialized(_this52),{dir:[-0.8,-1.0,0.5],color:[1,1,0.9],intensity:0.9,space:"world"});_this52._camera.on("dirty",function(){_this52._renderer.imageDirty();});return _this52;}_createClass(Scene,[{key:"type",get:/**
|
|
9006
9005
|
@private
|
|
9007
9006
|
*/function get(){return"Scene";}},{key:"_initDefaults",value:function _initDefaults(){this.geometry;this.material;this.xrayMaterial;this.edgeMaterial;this.selectedMaterial;this.highlightMaterial;}},{key:"_addComponent",value:function _addComponent(component){if(component.id){// Manual ID
|
|
9008
9007
|
if(this.components[component.id]){this.error("Component "+utils.inQuotes(component.id)+" already exists in Scene - ignoring ID, will randomly-generate instead");component.id=null;}}if(!component.id){// Auto ID
|
|
@@ -9033,371 +9032,388 @@ if(notify){this.fire("objectSelected",entity,true);}}},{key:"_deRegisterSelected
|
|
|
9033
9032
|
}},{key:"_webglContextLost",value:function _webglContextLost(){// this.loading++;
|
|
9034
9033
|
this.canvas.spinner.processes++;for(var id in this.components){if(this.components.hasOwnProperty(id)){var component=this.components[id];if(component._webglContextLost){component._webglContextLost();}}}this._renderer.webglContextLost();}},{key:"_webglContextRestored",value:function _webglContextRestored(){var gl=this.canvas.gl;for(var id in this.components){if(this.components.hasOwnProperty(id)){var component=this.components[id];if(component._webglContextRestored){component._webglContextRestored(gl);}}}this._renderer.webglContextRestored(gl);//this.loading--;
|
|
9035
9034
|
this.canvas.spinner.processes--;}/**
|
|
9036
|
-
|
|
9035
|
+
* Returns the capabilities of this Scene.
|
|
9036
|
+
*
|
|
9037
|
+
* @private
|
|
9038
|
+
* @returns {{astcSupported: boolean, etc1Supported: boolean, pvrtcSupported: boolean, etc2Supported: boolean, dxtSupported: boolean, bptcSupported: boolean}}
|
|
9039
|
+
*/},{key:"capabilities",get:function get(){return this._renderer.capabilities;}/**
|
|
9040
|
+
* Whether {@link Entity#offset} is enabled.
|
|
9041
|
+
*
|
|
9042
|
+
* This is set via the {@link Viewer} constructor and is ````false```` by default.
|
|
9043
|
+
*
|
|
9044
|
+
* @returns {Boolean} True if {@link Entity#offset} is enabled.
|
|
9045
|
+
*/},{key:"entityOffsetsEnabled",get:function get(){return this._entityOffsetsEnabled;}/**
|
|
9046
|
+
* Whether precision surface picking is enabled.
|
|
9047
|
+
*
|
|
9048
|
+
* This is set via the {@link Viewer} constructor and is ````false```` by default.
|
|
9049
|
+
*
|
|
9050
|
+
* The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.
|
|
9051
|
+
*
|
|
9052
|
+
* Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer.
|
|
9053
|
+
*
|
|
9054
|
+
* @returns {Boolean} True if precision picking is enabled.
|
|
9055
|
+
*/},{key:"pickSurfacePrecisionEnabled",get:function get(){return false;// Removed
|
|
9056
|
+
}/**
|
|
9057
|
+
* Whether logarithmic depth buffer is enabled.
|
|
9058
|
+
*
|
|
9059
|
+
* This is set via the {@link Viewer} constructor and is ````false```` by default.
|
|
9060
|
+
*
|
|
9061
|
+
* @returns {Boolean} True if logarithmic depth buffer is enabled.
|
|
9062
|
+
*/},{key:"logarithmicDepthBufferEnabled",get:function get(){return this._logarithmicDepthBufferEnabled;}/**
|
|
9063
|
+
* Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
|
|
9064
|
+
*
|
|
9065
|
+
* This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
|
|
9066
|
+
* of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
|
|
9067
|
+
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
9068
|
+
* responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
9069
|
+
* your expected usage.
|
|
9070
|
+
*
|
|
9071
|
+
* Default is ````0````.
|
|
9072
|
+
*/},{key:"numCachedSectionPlanes",get:/**
|
|
9073
|
+
* Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
|
|
9074
|
+
*
|
|
9075
|
+
* This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
|
|
9076
|
+
* of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
|
|
9077
|
+
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
9078
|
+
* responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
9079
|
+
* your expected usage.
|
|
9080
|
+
*
|
|
9081
|
+
* Default is ````0````.
|
|
9082
|
+
*
|
|
9083
|
+
* @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
|
|
9084
|
+
*/function get(){return this._sectionPlanesState.getNumCachedSectionPlanes();}/**
|
|
9085
|
+
* Sets whether physically-based rendering is enabled.
|
|
9086
|
+
*
|
|
9087
|
+
* Default is ````false````.
|
|
9088
|
+
*/,set:function set(numCachedSectionPlanes){numCachedSectionPlanes=numCachedSectionPlanes||0;if(this._sectionPlanesState.getNumCachedSectionPlanes()!==numCachedSectionPlanes){this._sectionPlanesState.setNumCachedSectionPlanes(numCachedSectionPlanes);this._needRecompile=true;this.glRedraw();}}},{key:"pbrEnabled",get:/**
|
|
9089
|
+
* Gets whether physically-based rendering is enabled.
|
|
9090
|
+
*
|
|
9091
|
+
* Default is ````false````.
|
|
9092
|
+
*
|
|
9093
|
+
* @returns {Boolean} True if quality rendering is enabled.
|
|
9094
|
+
*/function get(){return this._pbrEnabled;}/**
|
|
9095
|
+
* Sets whether data texture scene representation (DTX) is enabled for the {@link Scene}.
|
|
9096
|
+
*
|
|
9097
|
+
* Even when enabled, DTX will only work if supported.
|
|
9098
|
+
*
|
|
9099
|
+
* Default value is ````false````.
|
|
9100
|
+
*
|
|
9101
|
+
* @type {Boolean}
|
|
9102
|
+
*/,set:function set(pbrEnabled){this._pbrEnabled=!!pbrEnabled;this.glRedraw();}},{key:"dtxEnabled",get:/**
|
|
9103
|
+
* Gets whether data texture-based scene representation (DTX) is enabled for the {@link Scene}.
|
|
9104
|
+
*
|
|
9105
|
+
* Even when enabled, DTX will only apply if supported.
|
|
9106
|
+
*
|
|
9107
|
+
* Default value is ````false````.
|
|
9108
|
+
*
|
|
9109
|
+
* @type {Boolean}
|
|
9110
|
+
*/function get(){return this._dtxEnabled;}/**
|
|
9111
|
+
* set showedges enable
|
|
9112
|
+
* @param {boolean} edgesEnabled
|
|
9113
|
+
*/,set:function set(value){value=!!value;if(this._dtxEnabled===value){return;}this._dtxEnabled=value;}},{key:"edgesEnabled",get:/**
|
|
9114
|
+
* @param {boolean} trans
|
|
9115
|
+
*/function get(){return this._edgesEnabled;}/**
|
|
9116
|
+
* set whether transparent of canvas background
|
|
9117
|
+
* @param {boolean} trans
|
|
9118
|
+
*/,set:function set(edgesEnabled){edgesEnabled=!!edgesEnabled;if(this._edgesEnabled===edgesEnabled){return;}this._edgesEnabled=edgesEnabled;this._renderer.setEdgesEnabled(edgesEnabled);}},{key:"backgroundTransparent",get:/**
|
|
9119
|
+
* @returns {boolean} backgroundTransparent
|
|
9120
|
+
*/function get(){return this._transparent;}/**
|
|
9121
|
+
* set background color
|
|
9122
|
+
* @param {[]} color
|
|
9123
|
+
*/,set:function set(trans){trans=!!trans;// if (this._transparent == trans) {
|
|
9124
|
+
// return;
|
|
9125
|
+
// }
|
|
9126
|
+
this._transparent=trans;this._renderer.setTransparentEnabled(trans);}},{key:"backgroundColor",get:/**
|
|
9127
|
+
* return backgroundColor
|
|
9128
|
+
* @returns {boolean} backgroundColor
|
|
9129
|
+
*/function get(){return this.canvas.backgroundColor();}/**
|
|
9130
|
+
* Sets whether basic color texture rendering is enabled.
|
|
9131
|
+
*
|
|
9132
|
+
* Default is ````true````.
|
|
9133
|
+
*
|
|
9134
|
+
* @returns {Boolean} True if basic color texture rendering is enabled.
|
|
9135
|
+
*/,set:function set(color){this.canvas.backgroundColor=color;this._renderer.render({force:true});}},{key:"colorTextureEnabled",get:/**
|
|
9136
|
+
* Gets whether basic color texture rendering is enabled.
|
|
9137
|
+
*
|
|
9138
|
+
* Default is ````true````.
|
|
9139
|
+
*
|
|
9140
|
+
* @returns {Boolean} True if basic color texture rendering is enabled.
|
|
9141
|
+
*/function get(){return this._colorTextureEnabled;}/**
|
|
9142
|
+
* Performs an occlusion test on all {@link Marker}s in this {@link Scene}.
|
|
9143
|
+
*
|
|
9144
|
+
* Sets each {@link Marker#visible} ````true```` if the Marker is currently not occluded by any opaque {@link Entity}s
|
|
9145
|
+
* in the Scene, or ````false```` if an Entity is occluding it.
|
|
9146
|
+
*/,set:function set(colorTextureEnabled){this._colorTextureEnabled=!!colorTextureEnabled;this.glRedraw();}},{key:"doOcclusionTest",value:function doOcclusionTest(){if(this._needRecompile){this._recompile();this._needRecompile=false;}this._renderer.doOcclusionTest();}/**
|
|
9147
|
+
* Renders a single frame of this Scene.
|
|
9148
|
+
*
|
|
9149
|
+
* The Scene will periodically render itself after any updates, but you can call this method to force a render
|
|
9150
|
+
* if required.
|
|
9151
|
+
*
|
|
9152
|
+
* @param {Boolean} [forceRender=false] Forces a render when true, otherwise only renders if something has changed in this Scene
|
|
9153
|
+
* since the last render.
|
|
9154
|
+
*/},{key:"render",value:function render(forceRender){if(forceRender){core.runTasks();}var renderEvent={sceneId:null,pass:0};if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}if(!forceRender&&!this._renderer.needsRender()){return;}renderEvent.sceneId=this.id;var passes=this._passes;var clearEachPass=this._clearEachPass;var pass;var clear;for(pass=0;pass<passes;pass++){renderEvent.pass=pass;/**
|
|
9155
|
+
* Fired when about to render a frame for a Scene.
|
|
9156
|
+
*
|
|
9157
|
+
* @event rendering
|
|
9158
|
+
* @param {String} sceneID The ID of this Scene.
|
|
9159
|
+
* @param {Number} pass Index of the pass we are about to render (see {@link Scene#passes}).
|
|
9160
|
+
*/this.fire("rendering",renderEvent,true);clear=clearEachPass||pass===0;this._renderer.render({pass:pass,clear:clear,force:forceRender});/**
|
|
9161
|
+
* Fired when we have just rendered a frame for a Scene.
|
|
9162
|
+
*
|
|
9163
|
+
* @event rendering
|
|
9164
|
+
* @param {String} sceneID The ID of this Scene.
|
|
9165
|
+
* @param {Number} pass Index of the pass we rendered (see {@link Scene#passes}).
|
|
9166
|
+
*/this.fire("rendered",renderEvent,true);}this._saveAmbientColor();}/**
|
|
9167
|
+
* @private
|
|
9168
|
+
*/},{key:"compile",value:function compile(){if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}}},{key:"_recompile",value:function _recompile(){for(var id in this._compilables){if(this._compilables.hasOwnProperty(id)){this._compilables[id].compile();}}this._renderer.shadowsDirty();this.fire("compile",this,true);}},{key:"_saveAmbientColor",value:function _saveAmbientColor(){var canvas=this.canvas;if(!canvas.transparent&&!canvas.backgroundImage&&!canvas.backgroundColor){var ambientColorIntensity=this._lightsState.getAmbientColorAndIntensity();if(!this._lastAmbientColor||this._lastAmbientColor[0]!==ambientColorIntensity[0]||this._lastAmbientColor[1]!==ambientColorIntensity[1]||this._lastAmbientColor[2]!==ambientColorIntensity[2]||this._lastAmbientColor[3]!==ambientColorIntensity[3]){canvas.backgroundColor=ambientColorIntensity;if(!this._lastAmbientColor){this._lastAmbientColor=math.vec4([0,0,0,1]);}this._lastAmbientColor.set(ambientColorIntensity);}}else{this._lastAmbientColor=null;}}/**
|
|
9169
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#models}.
|
|
9170
|
+
*
|
|
9171
|
+
* @type {String[]}
|
|
9172
|
+
*/},{key:"modelIds",get:function get(){if(!this._modelIds){this._modelIds=Object.keys(this.models);}return this._modelIds;}/**
|
|
9173
|
+
* Gets the number of {@link Entity}s in {@link Scene#objects}.
|
|
9174
|
+
*
|
|
9175
|
+
* @type {Number}
|
|
9176
|
+
*/},{key:"numObjects",get:function get(){return this._numObjects;}/**
|
|
9177
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#objects}.
|
|
9178
|
+
*
|
|
9179
|
+
* @type {String[]}
|
|
9180
|
+
*/},{key:"objectIds",get:function get(){if(!this._objectIds){this._objectIds=Object.keys(this.objects);}return this._objectIds;}/**
|
|
9181
|
+
* Gets the number of {@link Entity}s in {@link Scene#visibleObjects}.
|
|
9182
|
+
*
|
|
9183
|
+
* @type {Number}
|
|
9184
|
+
*/},{key:"numVisibleObjects",get:function get(){return this._numVisibleObjects;}/**
|
|
9185
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#visibleObjects}.
|
|
9186
|
+
*
|
|
9187
|
+
* @type {String[]}
|
|
9188
|
+
*/},{key:"visibleObjectIds",get:function get(){if(!this._visibleObjectIds){this._visibleObjectIds=Object.keys(this.visibleObjects);}return this._visibleObjectIds;}/**
|
|
9189
|
+
* Gets the number of {@link Entity}s in {@link Scene#xrayedObjects}.
|
|
9190
|
+
*
|
|
9191
|
+
* @type {Number}
|
|
9192
|
+
*/},{key:"numXRayedObjects",get:function get(){return this._numXRayedObjects;}/**
|
|
9193
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#xrayedObjects}.
|
|
9194
|
+
*
|
|
9195
|
+
* @type {String[]}
|
|
9196
|
+
*/},{key:"xrayedObjectIds",get:function get(){if(!this._xrayedObjectIds){this._xrayedObjectIds=Object.keys(this.xrayedObjects);}return this._xrayedObjectIds;}/**
|
|
9197
|
+
* Gets the number of {@link Entity}s in {@link Scene#highlightedObjects}.
|
|
9198
|
+
*
|
|
9199
|
+
* @type {Number}
|
|
9200
|
+
*/},{key:"numHighlightedObjects",get:function get(){return this._numHighlightedObjects;}/**
|
|
9201
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#highlightedObjects}.
|
|
9202
|
+
*
|
|
9203
|
+
* @type {String[]}
|
|
9204
|
+
*/},{key:"highlightedObjectIds",get:function get(){if(!this._highlightedObjectIds){this._highlightedObjectIds=Object.keys(this.highlightedObjects);}return this._highlightedObjectIds;}/**
|
|
9205
|
+
* Gets the number of {@link Entity}s in {@link Scene#selectedObjects}.
|
|
9206
|
+
*
|
|
9207
|
+
* @type {Number}
|
|
9208
|
+
*/},{key:"numSelectedObjects",get:function get(){return this._numSelectedObjects;}/**
|
|
9209
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#selectedObjects}.
|
|
9210
|
+
*
|
|
9211
|
+
* @type {String[]}
|
|
9212
|
+
*/},{key:"selectedObjectIds",get:function get(){if(!this._selectedObjectIds){this._selectedObjectIds=Object.keys(this.selectedObjects);}return this._selectedObjectIds;}/**
|
|
9213
|
+
* Gets the number of {@link Entity}s in {@link Scene#colorizedObjects}.
|
|
9214
|
+
*
|
|
9215
|
+
* @type {Number}
|
|
9216
|
+
*/},{key:"numColorizedObjects",get:function get(){return this._numColorizedObjects;}/**
|
|
9217
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#colorizedObjects}.
|
|
9218
|
+
*
|
|
9219
|
+
* @type {String[]}
|
|
9220
|
+
*/},{key:"colorizedObjectIds",get:function get(){if(!this._colorizedObjectIds){this._colorizedObjectIds=Object.keys(this.colorizedObjects);}return this._colorizedObjectIds;}/**
|
|
9221
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#opacityObjects}.
|
|
9222
|
+
*
|
|
9223
|
+
* @type {String[]}
|
|
9224
|
+
*/},{key:"opacityObjectIds",get:function get(){if(!this._opacityObjectIds){this._opacityObjectIds=Object.keys(this.opacityObjects);}return this._opacityObjectIds;}/**
|
|
9225
|
+
* Gets the IDs of the {@link Entity}s in {@link Scene#offsetObjects}.
|
|
9226
|
+
*
|
|
9227
|
+
* @type {String[]}
|
|
9228
|
+
*/},{key:"offsetObjectIds",get:function get(){if(!this._offsetObjectIds){this._offsetObjectIds=Object.keys(this.offsetObjects);}return this._offsetObjectIds;}/**
|
|
9229
|
+
* Sets the number of "ticks" that happen between each render or this Scene.
|
|
9230
|
+
*
|
|
9231
|
+
* Default value is ````1````.
|
|
9232
|
+
*
|
|
9233
|
+
* @type {Number}
|
|
9234
|
+
*/},{key:"ticksPerRender",get:/**
|
|
9235
|
+
* Gets the number of "ticks" that happen between each render or this Scene.
|
|
9236
|
+
*
|
|
9237
|
+
* Default value is ````1````.
|
|
9238
|
+
*
|
|
9239
|
+
* @type {Number}
|
|
9240
|
+
*/function get(){return this._ticksPerRender;}/**
|
|
9241
|
+
* Sets the number of "ticks" that happen between occlusion testing for {@link Marker}s.
|
|
9242
|
+
*
|
|
9243
|
+
* Default value is ````20````.
|
|
9244
|
+
*
|
|
9245
|
+
* @type {Number}
|
|
9246
|
+
*/,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerRender': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._ticksPerRender){return;}this._ticksPerRender=value;}},{key:"ticksPerOcclusionTest",get:/**
|
|
9247
|
+
* Gets the number of "ticks" that happen between each render of this Scene.
|
|
9248
|
+
*
|
|
9249
|
+
* Default value is ````1````.
|
|
9250
|
+
*
|
|
9251
|
+
* @type {Number}
|
|
9252
|
+
*/function get(){return this._ticksPerOcclusionTest;}/**
|
|
9253
|
+
* Sets the number of times this Scene renders per frame.
|
|
9254
|
+
*
|
|
9255
|
+
* Default value is ````1````.
|
|
9256
|
+
*
|
|
9257
|
+
* @type {Number}
|
|
9258
|
+
*/,set:function set(value){if(value===undefined||value===null){value=20;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerOcclusionTest': '"+value+"' - should be an integer greater than zero.");value=20;}if(value===this._ticksPerOcclusionTest){return;}this._ticksPerOcclusionTest=value;}},{key:"passes",get:/**
|
|
9259
|
+
* Gets the number of times this Scene renders per frame.
|
|
9260
|
+
*
|
|
9261
|
+
* Default value is ````1````.
|
|
9262
|
+
*
|
|
9263
|
+
* @type {Number}
|
|
9264
|
+
*/function get(){return this._passes;}/**
|
|
9265
|
+
* When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
|
|
9266
|
+
*
|
|
9267
|
+
* Default value is ````false````.
|
|
9268
|
+
*
|
|
9269
|
+
* @type {Boolean}
|
|
9270
|
+
*/,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'passes': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._passes){return;}this._passes=value;this.glRedraw();}},{key:"clearEachPass",get:/**
|
|
9271
|
+
* When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
|
|
9272
|
+
*
|
|
9273
|
+
* Default value is ````false````.
|
|
9274
|
+
*
|
|
9275
|
+
* @type {Boolean}
|
|
9276
|
+
*/function get(){return this._clearEachPass;}/**
|
|
9277
|
+
* Sets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
|
|
9278
|
+
*
|
|
9279
|
+
* Default value is ````false````.
|
|
9280
|
+
*
|
|
9281
|
+
* @type {Boolean}
|
|
9282
|
+
*/,set:function set(value){value=!!value;if(value===this._clearEachPass){return;}this._clearEachPass=value;this.glRedraw();}},{key:"gammaInput",get:/**
|
|
9283
|
+
* Gets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
|
|
9284
|
+
*
|
|
9285
|
+
* Default value is ````false````.
|
|
9286
|
+
*
|
|
9287
|
+
* @type {Boolean}
|
|
9288
|
+
*/function get(){return this._renderer.gammaInput;}/**
|
|
9289
|
+
* Sets whether or not to render pixels with pre-multiplied gama.
|
|
9290
|
+
*
|
|
9291
|
+
* Default value is ````false````.
|
|
9292
|
+
*
|
|
9293
|
+
* @type {Boolean}
|
|
9294
|
+
*/,set:function set(value){value=value!==false;if(value===this._renderer.gammaInput){return;}this._renderer.gammaInput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaOutput",get:/**
|
|
9295
|
+
* Gets whether or not to render pixels with pre-multiplied gama.
|
|
9296
|
+
*
|
|
9297
|
+
* Default value is ````true````.
|
|
9298
|
+
*
|
|
9299
|
+
* @type {Boolean}
|
|
9300
|
+
*/function get(){return this._renderer.gammaOutput;}/**
|
|
9301
|
+
* Sets the gamma factor to use when {@link Scene#gammaOutput} is set true.
|
|
9302
|
+
*
|
|
9303
|
+
* Default value is ````2.2````.
|
|
9304
|
+
*
|
|
9305
|
+
* @type {Number}
|
|
9306
|
+
*/,set:function set(value){value=!!value;if(value===this._renderer.gammaOutput){return;}this._renderer.gammaOutput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaFactor",get:/**
|
|
9307
|
+
* Gets the gamma factor to use when {@link Scene#gammaOutput} is set true.
|
|
9308
|
+
*
|
|
9309
|
+
* Default value is ````2.2````.
|
|
9310
|
+
*
|
|
9311
|
+
* @type {Number}
|
|
9312
|
+
*/function get(){return this._renderer.gammaFactor;}/**
|
|
9313
|
+
* Gets the default {@link Geometry} for this Scene, which is a {@link ReadableGeometry} with a unit-sized box shape.
|
|
9314
|
+
*
|
|
9315
|
+
* Has {@link ReadableGeometry#id} set to "default.geometry".
|
|
9316
|
+
*
|
|
9317
|
+
* {@link Mesh}s in this Scene have {@link Mesh#geometry} set to this {@link ReadableGeometry} by default.
|
|
9318
|
+
*
|
|
9319
|
+
* @type {ReadableGeometry}
|
|
9320
|
+
*/,set:function set(value){value=value===undefined||value===null?2.2:value;if(value===this._renderer.gammaFactor){return;}this._renderer.gammaFactor=value;this.glRedraw();}},{key:"geometry",get:function get(){return this.components["default.geometry"]||buildBoxGeometry(ReadableGeometry);}/**
|
|
9321
|
+
* Gets the default {@link Material} for this Scene, which is a {@link PhongMaterial}.
|
|
9322
|
+
*
|
|
9323
|
+
* Has {@link PhongMaterial#id} set to "default.material".
|
|
9324
|
+
*
|
|
9325
|
+
* {@link Mesh}s in this Scene have {@link Mesh#material} set to this {@link PhongMaterial} by default.
|
|
9326
|
+
*
|
|
9327
|
+
* @type {PhongMaterial}
|
|
9328
|
+
*/},{key:"material",get:function get(){return this.components["default.material"]||new PhongMaterial(this,{id:"default.material",emissive:[0.4,0.4,0.4],// Visible by default on geometry without normals
|
|
9329
|
+
dontClear:true});}/**
|
|
9330
|
+
* Gets the default xraying {@link EmphasisMaterial} for this Scene.
|
|
9331
|
+
*
|
|
9332
|
+
* Has {@link EmphasisMaterial#id} set to "default.xrayMaterial".
|
|
9333
|
+
*
|
|
9334
|
+
* {@link Mesh}s in this Scene have {@link Mesh#xrayMaterial} set to this {@link EmphasisMaterial} by default.
|
|
9335
|
+
*
|
|
9336
|
+
* {@link Mesh}s are xrayed while {@link Mesh#xrayed} is ````true````.
|
|
9337
|
+
*
|
|
9338
|
+
* @type {EmphasisMaterial}
|
|
9339
|
+
*/},{key:"xrayMaterial",get:function get(){return this.components["default.xrayMaterial"]||new EmphasisMaterial(this,{id:"default.xrayMaterial",preset:"sepia",dontClear:true});}/**
|
|
9340
|
+
* Gets the default highlight {@link EmphasisMaterial} for this Scene.
|
|
9341
|
+
*
|
|
9342
|
+
* Has {@link EmphasisMaterial#id} set to "default.highlightMaterial".
|
|
9343
|
+
*
|
|
9344
|
+
* {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
|
|
9345
|
+
*
|
|
9346
|
+
* {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
|
|
9347
|
+
*
|
|
9348
|
+
* @type {EmphasisMaterial}
|
|
9349
|
+
*/},{key:"highlightMaterial",get:function get(){return this.components["default.highlightMaterial"]||new EmphasisMaterial(this,{id:"default.highlightMaterial",preset:"yellowHighlight",dontClear:true});}/**
|
|
9350
|
+
* Gets the default selection {@link EmphasisMaterial} for this Scene.
|
|
9351
|
+
*
|
|
9352
|
+
* Has {@link EmphasisMaterial#id} set to "default.selectedMaterial".
|
|
9353
|
+
*
|
|
9354
|
+
* {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
|
|
9355
|
+
*
|
|
9356
|
+
* {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
|
|
9357
|
+
*
|
|
9358
|
+
* @type {EmphasisMaterial}
|
|
9359
|
+
*/},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
|
|
9360
|
+
* Gets the default {@link EdgeMaterial} for this Scene.
|
|
9361
|
+
*
|
|
9362
|
+
* Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
|
|
9363
|
+
*
|
|
9364
|
+
* {@link Mesh}s in this Scene have {@link Mesh#edgeMaterial} set to this {@link EdgeMaterial} by default.
|
|
9365
|
+
*
|
|
9366
|
+
* {@link Mesh}s have their edges emphasized while {@link Mesh#edges} is ````true````.
|
|
9367
|
+
*
|
|
9368
|
+
* @type {EdgeMaterial}
|
|
9369
|
+
*/},{key:"edgeMaterial",get:function get(){return this.components["default.edgeMaterial"]||new EdgeMaterial(this,{id:"default.edgeMaterial",preset:"default",edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1,dontClear:true});}/**
|
|
9370
|
+
* Gets the {@link PointsMaterial} for this Scene.
|
|
9371
|
+
*
|
|
9372
|
+
* @type {PointsMaterial}
|
|
9373
|
+
*/},{key:"pointsMaterial",get:function get(){return this.components["default.pointsMaterial"]||new PointsMaterial(this,{id:"default.pointsMaterial",preset:"default",dontClear:true});}/**
|
|
9374
|
+
* Gets the {@link LinesMaterial} for this Scene.
|
|
9375
|
+
*
|
|
9376
|
+
* @type {LinesMaterial}
|
|
9377
|
+
*/},{key:"linesMaterial",get:function get(){return this.components["default.linesMaterial"]||new LinesMaterial(this,{id:"default.linesMaterial",preset:"default",dontClear:true});}/**
|
|
9378
|
+
* Gets the {@link Viewport} for this Scene.
|
|
9379
|
+
*
|
|
9380
|
+
* @type Viewport
|
|
9381
|
+
*/},{key:"viewport",get:function get(){return this._viewport;}/**
|
|
9382
|
+
* Gets the {@link Camera} for this Scene.
|
|
9383
|
+
*
|
|
9384
|
+
* @type {Camera}
|
|
9385
|
+
*/},{key:"camera",get:function get(){return this._camera;}/**
|
|
9386
|
+
* Gets the World-space 3D center of this Scene.
|
|
9387
|
+
*
|
|
9388
|
+
*@type {Number[]}
|
|
9389
|
+
*/},{key:"center",get:function get(){if(this._aabbDirty||!this._center){if(!this._center||!this._center){this._center=math.vec3();}var aabb=this.aabb;this._center[0]=(aabb[0]+aabb[3])/2;this._center[1]=(aabb[1]+aabb[4])/2;this._center[2]=(aabb[2]+aabb[5])/2;}return this._center;}/**
|
|
9390
|
+
* Gets the World-space axis-aligned 3D boundary (AABB) of this Scene.
|
|
9391
|
+
*
|
|
9392
|
+
* The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
|
|
9393
|
+
*
|
|
9394
|
+
* When the Scene has no content, will be ````[-100,-100,-100,100,100,100]````.
|
|
9395
|
+
*
|
|
9396
|
+
* @type {Number[]}
|
|
9397
|
+
*/},{key:"aabb",get:function get(){if(this._aabbDirty){if(!this._aabb){this._aabb=math.AABB3();}var xmin=math.MAX_DOUBLE;var ymin=math.MAX_DOUBLE;var zmin=math.MAX_DOUBLE;var xmax=math.MIN_DOUBLE;var ymax=math.MIN_DOUBLE;var zmax=math.MIN_DOUBLE;var aabb;var collidables=this._collidables;var collidable;var valid=false;for(var collidableId in collidables){if(collidables.hasOwnProperty(collidableId)){collidable=collidables[collidableId];if(collidable.collidable===false){continue;}aabb=collidable.aabb;if(aabb[0]<xmin){xmin=aabb[0];}if(aabb[1]<ymin){ymin=aabb[1];}if(aabb[2]<zmin){zmin=aabb[2];}if(aabb[3]>xmax){xmax=aabb[3];}if(aabb[4]>ymax){ymax=aabb[4];}if(aabb[5]>zmax){zmax=aabb[5];}valid=true;}}if(!valid){xmin=-100;ymin=-100;zmin=-100;xmax=100;ymax=100;zmax=100;}this._aabb[0]=xmin;this._aabb[1]=ymin;this._aabb[2]=zmin;this._aabb[3]=xmax;this._aabb[4]=ymax;this._aabb[5]=zmax;this._aabbDirty=false;}return this._aabb;}},{key:"_setAABBDirty",value:function _setAABBDirty(){//if (!this._aabbDirty) {
|
|
9398
|
+
this._aabbDirty=true;this.fire("boundary");// }
|
|
9399
|
+
}/**
|
|
9400
|
+
* Attempts to pick an {@link Entity} in this Scene.
|
|
9037
9401
|
*
|
|
9038
|
-
* @
|
|
9039
|
-
* @returns {{astcSupported: boolean, etc1Supported: boolean, pvrtcSupported: boolean, etc2Supported: boolean, dxtSupported: boolean, bptcSupported: boolean}}
|
|
9040
|
-
*/},{key:"capabilities",get:function get(){return this._renderer.capabilities;}/**
|
|
9041
|
-
* Whether {@link Entity#offset} is enabled.
|
|
9402
|
+
* Ignores {@link Entity}s with {@link Entity#pickable} set ````false````.
|
|
9042
9403
|
*
|
|
9043
|
-
*
|
|
9404
|
+
* When an {@link Entity} is picked, fires a "pick" event on the {@link Entity} with the pick result as parameters.
|
|
9044
9405
|
*
|
|
9045
|
-
*
|
|
9046
|
-
|
|
9047
|
-
*
|
|
9406
|
+
* Picking the {@link Entity} at the given canvas coordinates:
|
|
9407
|
+
|
|
9408
|
+
* ````javascript
|
|
9409
|
+
* var pickResult = scene.pick({
|
|
9410
|
+
* canvasPos: [23, 131]
|
|
9411
|
+
* });
|
|
9048
9412
|
*
|
|
9049
|
-
*
|
|
9050
|
-
*
|
|
9051
|
-
*
|
|
9052
|
-
*
|
|
9053
|
-
* Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer.
|
|
9054
|
-
*
|
|
9055
|
-
* @returns {Boolean} True if precision picking is enabled.
|
|
9056
|
-
*/},{key:"pickSurfacePrecisionEnabled",get:function get(){return false;// Removed
|
|
9057
|
-
}/**
|
|
9058
|
-
* Whether logarithmic depth buffer is enabled.
|
|
9059
|
-
*
|
|
9060
|
-
* This is set via the {@link Viewer} constructor and is ````false```` by default.
|
|
9061
|
-
*
|
|
9062
|
-
* @returns {Boolean} True if logarithmic depth buffer is enabled.
|
|
9063
|
-
*/},{key:"logarithmicDepthBufferEnabled",get:function get(){return this._logarithmicDepthBufferEnabled;}/**
|
|
9064
|
-
* Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
|
|
9065
|
-
*
|
|
9066
|
-
* This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
|
|
9067
|
-
* of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
|
|
9068
|
-
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
9069
|
-
* responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
9070
|
-
* your expected usage.
|
|
9071
|
-
*
|
|
9072
|
-
* Default is ````0````.
|
|
9073
|
-
*/},{key:"numCachedSectionPlanes",get:/**
|
|
9074
|
-
* Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
|
|
9075
|
-
*
|
|
9076
|
-
* This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
|
|
9077
|
-
* of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
|
|
9078
|
-
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
9079
|
-
* responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
9080
|
-
* your expected usage.
|
|
9081
|
-
*
|
|
9082
|
-
* Default is ````0````.
|
|
9083
|
-
*
|
|
9084
|
-
* @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
|
|
9085
|
-
*/function get(){return this._sectionPlanesState.getNumCachedSectionPlanes();}/**
|
|
9086
|
-
* Sets whether physically-based rendering is enabled.
|
|
9087
|
-
*
|
|
9088
|
-
* Default is ````false````.
|
|
9089
|
-
*/,set:function set(numCachedSectionPlanes){numCachedSectionPlanes=numCachedSectionPlanes||0;if(this._sectionPlanesState.getNumCachedSectionPlanes()!==numCachedSectionPlanes){this._sectionPlanesState.setNumCachedSectionPlanes(numCachedSectionPlanes);this._needRecompile=true;this.glRedraw();}}},{key:"pbrEnabled",get:/**
|
|
9090
|
-
* Gets whether physically-based rendering is enabled.
|
|
9091
|
-
*
|
|
9092
|
-
* Default is ````false````.
|
|
9093
|
-
*
|
|
9094
|
-
* @returns {Boolean} True if quality rendering is enabled.
|
|
9095
|
-
*/function get(){return this._pbrEnabled;}/**
|
|
9096
|
-
* Sets whether data texture scene representation (DTX) is enabled for the {@link Scene}.
|
|
9097
|
-
*
|
|
9098
|
-
* Even when enabled, DTX will only work if supported.
|
|
9099
|
-
*
|
|
9100
|
-
* Default value is ````false````.
|
|
9101
|
-
*
|
|
9102
|
-
* @type {Boolean}
|
|
9103
|
-
*/,set:function set(pbrEnabled){this._pbrEnabled=!!pbrEnabled;this.glRedraw();}},{key:"dtxEnabled",get:/**
|
|
9104
|
-
* Gets whether data texture-based scene representation (DTX) is enabled for the {@link Scene}.
|
|
9105
|
-
*
|
|
9106
|
-
* Even when enabled, DTX will only apply if supported.
|
|
9107
|
-
*
|
|
9108
|
-
* Default value is ````false````.
|
|
9109
|
-
*
|
|
9110
|
-
* @type {Boolean}
|
|
9111
|
-
*/function get(){return this._dtxEnabled;}/**
|
|
9112
|
-
* set showedges enable
|
|
9113
|
-
*/,set:function set(value){value=!!value;if(this._dtxEnabled===value){return;}this._dtxEnabled=value;}},{key:"setEdgesEnabled",value:function setEdgesEnabled(edgesEnabled){this._renderer.setEdgesEnabled(edgesEnabled);}/**
|
|
9114
|
-
* Sets whether basic color texture rendering is enabled.
|
|
9115
|
-
*
|
|
9116
|
-
* Default is ````true````.
|
|
9117
|
-
*
|
|
9118
|
-
* @returns {Boolean} True if basic color texture rendering is enabled.
|
|
9119
|
-
*/},{key:"colorTextureEnabled",get:/**
|
|
9120
|
-
* Gets whether basic color texture rendering is enabled.
|
|
9121
|
-
*
|
|
9122
|
-
* Default is ````true````.
|
|
9123
|
-
*
|
|
9124
|
-
* @returns {Boolean} True if basic color texture rendering is enabled.
|
|
9125
|
-
*/function get(){return this._colorTextureEnabled;}/**
|
|
9126
|
-
* Performs an occlusion test on all {@link Marker}s in this {@link Scene}.
|
|
9127
|
-
*
|
|
9128
|
-
* Sets each {@link Marker#visible} ````true```` if the Marker is currently not occluded by any opaque {@link Entity}s
|
|
9129
|
-
* in the Scene, or ````false```` if an Entity is occluding it.
|
|
9130
|
-
*/,set:function set(colorTextureEnabled){this._colorTextureEnabled=!!colorTextureEnabled;this.glRedraw();}},{key:"doOcclusionTest",value:function doOcclusionTest(){if(this._needRecompile){this._recompile();this._needRecompile=false;}this._renderer.doOcclusionTest();}/**
|
|
9131
|
-
* Renders a single frame of this Scene.
|
|
9132
|
-
*
|
|
9133
|
-
* The Scene will periodically render itself after any updates, but you can call this method to force a render
|
|
9134
|
-
* if required.
|
|
9135
|
-
*
|
|
9136
|
-
* @param {Boolean} [forceRender=false] Forces a render when true, otherwise only renders if something has changed in this Scene
|
|
9137
|
-
* since the last render.
|
|
9138
|
-
*/},{key:"render",value:function render(forceRender){if(forceRender){core.runTasks();}var renderEvent={sceneId:null,pass:0};if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}if(!forceRender&&!this._renderer.needsRender()){return;}renderEvent.sceneId=this.id;var passes=this._passes;var clearEachPass=this._clearEachPass;var pass;var clear;for(pass=0;pass<passes;pass++){renderEvent.pass=pass;/**
|
|
9139
|
-
* Fired when about to render a frame for a Scene.
|
|
9140
|
-
*
|
|
9141
|
-
* @event rendering
|
|
9142
|
-
* @param {String} sceneID The ID of this Scene.
|
|
9143
|
-
* @param {Number} pass Index of the pass we are about to render (see {@link Scene#passes}).
|
|
9144
|
-
*/this.fire("rendering",renderEvent,true);clear=clearEachPass||pass===0;this._renderer.render({pass:pass,clear:clear,force:forceRender});/**
|
|
9145
|
-
* Fired when we have just rendered a frame for a Scene.
|
|
9146
|
-
*
|
|
9147
|
-
* @event rendering
|
|
9148
|
-
* @param {String} sceneID The ID of this Scene.
|
|
9149
|
-
* @param {Number} pass Index of the pass we rendered (see {@link Scene#passes}).
|
|
9150
|
-
*/this.fire("rendered",renderEvent,true);}this._saveAmbientColor();}/**
|
|
9151
|
-
* @private
|
|
9152
|
-
*/},{key:"compile",value:function compile(){if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}}},{key:"_recompile",value:function _recompile(){for(var id in this._compilables){if(this._compilables.hasOwnProperty(id)){this._compilables[id].compile();}}this._renderer.shadowsDirty();this.fire("compile",this,true);}},{key:"_saveAmbientColor",value:function _saveAmbientColor(){var canvas=this.canvas;if(!canvas.transparent&&!canvas.backgroundImage&&!canvas.backgroundColor){var ambientColorIntensity=this._lightsState.getAmbientColorAndIntensity();if(!this._lastAmbientColor||this._lastAmbientColor[0]!==ambientColorIntensity[0]||this._lastAmbientColor[1]!==ambientColorIntensity[1]||this._lastAmbientColor[2]!==ambientColorIntensity[2]||this._lastAmbientColor[3]!==ambientColorIntensity[3]){canvas.backgroundColor=ambientColorIntensity;if(!this._lastAmbientColor){this._lastAmbientColor=math.vec4([0,0,0,1]);}this._lastAmbientColor.set(ambientColorIntensity);}}else{this._lastAmbientColor=null;}}/**
|
|
9153
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#models}.
|
|
9154
|
-
*
|
|
9155
|
-
* @type {String[]}
|
|
9156
|
-
*/},{key:"modelIds",get:function get(){if(!this._modelIds){this._modelIds=Object.keys(this.models);}return this._modelIds;}/**
|
|
9157
|
-
* Gets the number of {@link Entity}s in {@link Scene#objects}.
|
|
9158
|
-
*
|
|
9159
|
-
* @type {Number}
|
|
9160
|
-
*/},{key:"numObjects",get:function get(){return this._numObjects;}/**
|
|
9161
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#objects}.
|
|
9162
|
-
*
|
|
9163
|
-
* @type {String[]}
|
|
9164
|
-
*/},{key:"objectIds",get:function get(){if(!this._objectIds){this._objectIds=Object.keys(this.objects);}return this._objectIds;}/**
|
|
9165
|
-
* Gets the number of {@link Entity}s in {@link Scene#visibleObjects}.
|
|
9166
|
-
*
|
|
9167
|
-
* @type {Number}
|
|
9168
|
-
*/},{key:"numVisibleObjects",get:function get(){return this._numVisibleObjects;}/**
|
|
9169
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#visibleObjects}.
|
|
9170
|
-
*
|
|
9171
|
-
* @type {String[]}
|
|
9172
|
-
*/},{key:"visibleObjectIds",get:function get(){if(!this._visibleObjectIds){this._visibleObjectIds=Object.keys(this.visibleObjects);}return this._visibleObjectIds;}/**
|
|
9173
|
-
* Gets the number of {@link Entity}s in {@link Scene#xrayedObjects}.
|
|
9174
|
-
*
|
|
9175
|
-
* @type {Number}
|
|
9176
|
-
*/},{key:"numXRayedObjects",get:function get(){return this._numXRayedObjects;}/**
|
|
9177
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#xrayedObjects}.
|
|
9178
|
-
*
|
|
9179
|
-
* @type {String[]}
|
|
9180
|
-
*/},{key:"xrayedObjectIds",get:function get(){if(!this._xrayedObjectIds){this._xrayedObjectIds=Object.keys(this.xrayedObjects);}return this._xrayedObjectIds;}/**
|
|
9181
|
-
* Gets the number of {@link Entity}s in {@link Scene#highlightedObjects}.
|
|
9182
|
-
*
|
|
9183
|
-
* @type {Number}
|
|
9184
|
-
*/},{key:"numHighlightedObjects",get:function get(){return this._numHighlightedObjects;}/**
|
|
9185
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#highlightedObjects}.
|
|
9186
|
-
*
|
|
9187
|
-
* @type {String[]}
|
|
9188
|
-
*/},{key:"highlightedObjectIds",get:function get(){if(!this._highlightedObjectIds){this._highlightedObjectIds=Object.keys(this.highlightedObjects);}return this._highlightedObjectIds;}/**
|
|
9189
|
-
* Gets the number of {@link Entity}s in {@link Scene#selectedObjects}.
|
|
9190
|
-
*
|
|
9191
|
-
* @type {Number}
|
|
9192
|
-
*/},{key:"numSelectedObjects",get:function get(){return this._numSelectedObjects;}/**
|
|
9193
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#selectedObjects}.
|
|
9194
|
-
*
|
|
9195
|
-
* @type {String[]}
|
|
9196
|
-
*/},{key:"selectedObjectIds",get:function get(){if(!this._selectedObjectIds){this._selectedObjectIds=Object.keys(this.selectedObjects);}return this._selectedObjectIds;}/**
|
|
9197
|
-
* Gets the number of {@link Entity}s in {@link Scene#colorizedObjects}.
|
|
9198
|
-
*
|
|
9199
|
-
* @type {Number}
|
|
9200
|
-
*/},{key:"numColorizedObjects",get:function get(){return this._numColorizedObjects;}/**
|
|
9201
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#colorizedObjects}.
|
|
9202
|
-
*
|
|
9203
|
-
* @type {String[]}
|
|
9204
|
-
*/},{key:"colorizedObjectIds",get:function get(){if(!this._colorizedObjectIds){this._colorizedObjectIds=Object.keys(this.colorizedObjects);}return this._colorizedObjectIds;}/**
|
|
9205
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#opacityObjects}.
|
|
9206
|
-
*
|
|
9207
|
-
* @type {String[]}
|
|
9208
|
-
*/},{key:"opacityObjectIds",get:function get(){if(!this._opacityObjectIds){this._opacityObjectIds=Object.keys(this.opacityObjects);}return this._opacityObjectIds;}/**
|
|
9209
|
-
* Gets the IDs of the {@link Entity}s in {@link Scene#offsetObjects}.
|
|
9210
|
-
*
|
|
9211
|
-
* @type {String[]}
|
|
9212
|
-
*/},{key:"offsetObjectIds",get:function get(){if(!this._offsetObjectIds){this._offsetObjectIds=Object.keys(this.offsetObjects);}return this._offsetObjectIds;}/**
|
|
9213
|
-
* Sets the number of "ticks" that happen between each render or this Scene.
|
|
9214
|
-
*
|
|
9215
|
-
* Default value is ````1````.
|
|
9216
|
-
*
|
|
9217
|
-
* @type {Number}
|
|
9218
|
-
*/},{key:"ticksPerRender",get:/**
|
|
9219
|
-
* Gets the number of "ticks" that happen between each render or this Scene.
|
|
9220
|
-
*
|
|
9221
|
-
* Default value is ````1````.
|
|
9222
|
-
*
|
|
9223
|
-
* @type {Number}
|
|
9224
|
-
*/function get(){return this._ticksPerRender;}/**
|
|
9225
|
-
* Sets the number of "ticks" that happen between occlusion testing for {@link Marker}s.
|
|
9226
|
-
*
|
|
9227
|
-
* Default value is ````20````.
|
|
9228
|
-
*
|
|
9229
|
-
* @type {Number}
|
|
9230
|
-
*/,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerRender': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._ticksPerRender){return;}this._ticksPerRender=value;}},{key:"ticksPerOcclusionTest",get:/**
|
|
9231
|
-
* Gets the number of "ticks" that happen between each render of this Scene.
|
|
9232
|
-
*
|
|
9233
|
-
* Default value is ````1````.
|
|
9234
|
-
*
|
|
9235
|
-
* @type {Number}
|
|
9236
|
-
*/function get(){return this._ticksPerOcclusionTest;}/**
|
|
9237
|
-
* Sets the number of times this Scene renders per frame.
|
|
9238
|
-
*
|
|
9239
|
-
* Default value is ````1````.
|
|
9240
|
-
*
|
|
9241
|
-
* @type {Number}
|
|
9242
|
-
*/,set:function set(value){if(value===undefined||value===null){value=20;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerOcclusionTest': '"+value+"' - should be an integer greater than zero.");value=20;}if(value===this._ticksPerOcclusionTest){return;}this._ticksPerOcclusionTest=value;}},{key:"passes",get:/**
|
|
9243
|
-
* Gets the number of times this Scene renders per frame.
|
|
9244
|
-
*
|
|
9245
|
-
* Default value is ````1````.
|
|
9246
|
-
*
|
|
9247
|
-
* @type {Number}
|
|
9248
|
-
*/function get(){return this._passes;}/**
|
|
9249
|
-
* When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
|
|
9250
|
-
*
|
|
9251
|
-
* Default value is ````false````.
|
|
9252
|
-
*
|
|
9253
|
-
* @type {Boolean}
|
|
9254
|
-
*/,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'passes': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._passes){return;}this._passes=value;this.glRedraw();}},{key:"clearEachPass",get:/**
|
|
9255
|
-
* When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
|
|
9256
|
-
*
|
|
9257
|
-
* Default value is ````false````.
|
|
9258
|
-
*
|
|
9259
|
-
* @type {Boolean}
|
|
9260
|
-
*/function get(){return this._clearEachPass;}/**
|
|
9261
|
-
* Sets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
|
|
9262
|
-
*
|
|
9263
|
-
* Default value is ````false````.
|
|
9264
|
-
*
|
|
9265
|
-
* @type {Boolean}
|
|
9266
|
-
*/,set:function set(value){value=!!value;if(value===this._clearEachPass){return;}this._clearEachPass=value;this.glRedraw();}},{key:"gammaInput",get:/**
|
|
9267
|
-
* Gets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
|
|
9268
|
-
*
|
|
9269
|
-
* Default value is ````false````.
|
|
9270
|
-
*
|
|
9271
|
-
* @type {Boolean}
|
|
9272
|
-
*/function get(){return this._renderer.gammaInput;}/**
|
|
9273
|
-
* Sets whether or not to render pixels with pre-multiplied gama.
|
|
9274
|
-
*
|
|
9275
|
-
* Default value is ````false````.
|
|
9276
|
-
*
|
|
9277
|
-
* @type {Boolean}
|
|
9278
|
-
*/,set:function set(value){value=value!==false;if(value===this._renderer.gammaInput){return;}this._renderer.gammaInput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaOutput",get:/**
|
|
9279
|
-
* Gets whether or not to render pixels with pre-multiplied gama.
|
|
9280
|
-
*
|
|
9281
|
-
* Default value is ````true````.
|
|
9282
|
-
*
|
|
9283
|
-
* @type {Boolean}
|
|
9284
|
-
*/function get(){return this._renderer.gammaOutput;}/**
|
|
9285
|
-
* Sets the gamma factor to use when {@link Scene#gammaOutput} is set true.
|
|
9286
|
-
*
|
|
9287
|
-
* Default value is ````2.2````.
|
|
9288
|
-
*
|
|
9289
|
-
* @type {Number}
|
|
9290
|
-
*/,set:function set(value){value=!!value;if(value===this._renderer.gammaOutput){return;}this._renderer.gammaOutput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaFactor",get:/**
|
|
9291
|
-
* Gets the gamma factor to use when {@link Scene#gammaOutput} is set true.
|
|
9292
|
-
*
|
|
9293
|
-
* Default value is ````2.2````.
|
|
9294
|
-
*
|
|
9295
|
-
* @type {Number}
|
|
9296
|
-
*/function get(){return this._renderer.gammaFactor;}/**
|
|
9297
|
-
* Gets the default {@link Geometry} for this Scene, which is a {@link ReadableGeometry} with a unit-sized box shape.
|
|
9298
|
-
*
|
|
9299
|
-
* Has {@link ReadableGeometry#id} set to "default.geometry".
|
|
9300
|
-
*
|
|
9301
|
-
* {@link Mesh}s in this Scene have {@link Mesh#geometry} set to this {@link ReadableGeometry} by default.
|
|
9302
|
-
*
|
|
9303
|
-
* @type {ReadableGeometry}
|
|
9304
|
-
*/,set:function set(value){value=value===undefined||value===null?2.2:value;if(value===this._renderer.gammaFactor){return;}this._renderer.gammaFactor=value;this.glRedraw();}},{key:"geometry",get:function get(){return this.components["default.geometry"]||buildBoxGeometry(ReadableGeometry);}/**
|
|
9305
|
-
* Gets the default {@link Material} for this Scene, which is a {@link PhongMaterial}.
|
|
9306
|
-
*
|
|
9307
|
-
* Has {@link PhongMaterial#id} set to "default.material".
|
|
9308
|
-
*
|
|
9309
|
-
* {@link Mesh}s in this Scene have {@link Mesh#material} set to this {@link PhongMaterial} by default.
|
|
9310
|
-
*
|
|
9311
|
-
* @type {PhongMaterial}
|
|
9312
|
-
*/},{key:"material",get:function get(){return this.components["default.material"]||new PhongMaterial(this,{id:"default.material",emissive:[0.4,0.4,0.4],// Visible by default on geometry without normals
|
|
9313
|
-
dontClear:true});}/**
|
|
9314
|
-
* Gets the default xraying {@link EmphasisMaterial} for this Scene.
|
|
9315
|
-
*
|
|
9316
|
-
* Has {@link EmphasisMaterial#id} set to "default.xrayMaterial".
|
|
9317
|
-
*
|
|
9318
|
-
* {@link Mesh}s in this Scene have {@link Mesh#xrayMaterial} set to this {@link EmphasisMaterial} by default.
|
|
9319
|
-
*
|
|
9320
|
-
* {@link Mesh}s are xrayed while {@link Mesh#xrayed} is ````true````.
|
|
9321
|
-
*
|
|
9322
|
-
* @type {EmphasisMaterial}
|
|
9323
|
-
*/},{key:"xrayMaterial",get:function get(){return this.components["default.xrayMaterial"]||new EmphasisMaterial(this,{id:"default.xrayMaterial",preset:"sepia",dontClear:true});}/**
|
|
9324
|
-
* Gets the default highlight {@link EmphasisMaterial} for this Scene.
|
|
9325
|
-
*
|
|
9326
|
-
* Has {@link EmphasisMaterial#id} set to "default.highlightMaterial".
|
|
9327
|
-
*
|
|
9328
|
-
* {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
|
|
9329
|
-
*
|
|
9330
|
-
* {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
|
|
9331
|
-
*
|
|
9332
|
-
* @type {EmphasisMaterial}
|
|
9333
|
-
*/},{key:"highlightMaterial",get:function get(){return this.components["default.highlightMaterial"]||new EmphasisMaterial(this,{id:"default.highlightMaterial",preset:"yellowHighlight",dontClear:true});}/**
|
|
9334
|
-
* Gets the default selection {@link EmphasisMaterial} for this Scene.
|
|
9335
|
-
*
|
|
9336
|
-
* Has {@link EmphasisMaterial#id} set to "default.selectedMaterial".
|
|
9337
|
-
*
|
|
9338
|
-
* {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
|
|
9339
|
-
*
|
|
9340
|
-
* {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
|
|
9341
|
-
*
|
|
9342
|
-
* @type {EmphasisMaterial}
|
|
9343
|
-
*/},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
|
|
9344
|
-
* Gets the default {@link EdgeMaterial} for this Scene.
|
|
9345
|
-
*
|
|
9346
|
-
* Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
|
|
9347
|
-
*
|
|
9348
|
-
* {@link Mesh}s in this Scene have {@link Mesh#edgeMaterial} set to this {@link EdgeMaterial} by default.
|
|
9349
|
-
*
|
|
9350
|
-
* {@link Mesh}s have their edges emphasized while {@link Mesh#edges} is ````true````.
|
|
9351
|
-
*
|
|
9352
|
-
* @type {EdgeMaterial}
|
|
9353
|
-
*/},{key:"edgeMaterial",get:function get(){return this.components["default.edgeMaterial"]||new EdgeMaterial(this,{id:"default.edgeMaterial",preset:"default",edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1,dontClear:true});}/**
|
|
9354
|
-
* Gets the {@link PointsMaterial} for this Scene.
|
|
9355
|
-
*
|
|
9356
|
-
* @type {PointsMaterial}
|
|
9357
|
-
*/},{key:"pointsMaterial",get:function get(){return this.components["default.pointsMaterial"]||new PointsMaterial(this,{id:"default.pointsMaterial",preset:"default",dontClear:true});}/**
|
|
9358
|
-
* Gets the {@link LinesMaterial} for this Scene.
|
|
9359
|
-
*
|
|
9360
|
-
* @type {LinesMaterial}
|
|
9361
|
-
*/},{key:"linesMaterial",get:function get(){return this.components["default.linesMaterial"]||new LinesMaterial(this,{id:"default.linesMaterial",preset:"default",dontClear:true});}/**
|
|
9362
|
-
* Gets the {@link Viewport} for this Scene.
|
|
9363
|
-
*
|
|
9364
|
-
* @type Viewport
|
|
9365
|
-
*/},{key:"viewport",get:function get(){return this._viewport;}/**
|
|
9366
|
-
* Gets the {@link Camera} for this Scene.
|
|
9367
|
-
*
|
|
9368
|
-
* @type {Camera}
|
|
9369
|
-
*/},{key:"camera",get:function get(){return this._camera;}/**
|
|
9370
|
-
* Gets the World-space 3D center of this Scene.
|
|
9371
|
-
*
|
|
9372
|
-
*@type {Number[]}
|
|
9373
|
-
*/},{key:"center",get:function get(){if(this._aabbDirty||!this._center){if(!this._center||!this._center){this._center=math.vec3();}var aabb=this.aabb;this._center[0]=(aabb[0]+aabb[3])/2;this._center[1]=(aabb[1]+aabb[4])/2;this._center[2]=(aabb[2]+aabb[5])/2;}return this._center;}/**
|
|
9374
|
-
* Gets the World-space axis-aligned 3D boundary (AABB) of this Scene.
|
|
9375
|
-
*
|
|
9376
|
-
* The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
|
|
9377
|
-
*
|
|
9378
|
-
* When the Scene has no content, will be ````[-100,-100,-100,100,100,100]````.
|
|
9379
|
-
*
|
|
9380
|
-
* @type {Number[]}
|
|
9381
|
-
*/},{key:"aabb",get:function get(){if(this._aabbDirty){if(!this._aabb){this._aabb=math.AABB3();}var xmin=math.MAX_DOUBLE;var ymin=math.MAX_DOUBLE;var zmin=math.MAX_DOUBLE;var xmax=math.MIN_DOUBLE;var ymax=math.MIN_DOUBLE;var zmax=math.MIN_DOUBLE;var aabb;var collidables=this._collidables;var collidable;var valid=false;for(var collidableId in collidables){if(collidables.hasOwnProperty(collidableId)){collidable=collidables[collidableId];if(collidable.collidable===false){continue;}aabb=collidable.aabb;if(aabb[0]<xmin){xmin=aabb[0];}if(aabb[1]<ymin){ymin=aabb[1];}if(aabb[2]<zmin){zmin=aabb[2];}if(aabb[3]>xmax){xmax=aabb[3];}if(aabb[4]>ymax){ymax=aabb[4];}if(aabb[5]>zmax){zmax=aabb[5];}valid=true;}}if(!valid){xmin=-100;ymin=-100;zmin=-100;xmax=100;ymax=100;zmax=100;}this._aabb[0]=xmin;this._aabb[1]=ymin;this._aabb[2]=zmin;this._aabb[3]=xmax;this._aabb[4]=ymax;this._aabb[5]=zmax;this._aabbDirty=false;}return this._aabb;}},{key:"_setAABBDirty",value:function _setAABBDirty(){//if (!this._aabbDirty) {
|
|
9382
|
-
this._aabbDirty=true;this.fire("boundary");// }
|
|
9383
|
-
}/**
|
|
9384
|
-
* Attempts to pick an {@link Entity} in this Scene.
|
|
9385
|
-
*
|
|
9386
|
-
* Ignores {@link Entity}s with {@link Entity#pickable} set ````false````.
|
|
9387
|
-
*
|
|
9388
|
-
* When an {@link Entity} is picked, fires a "pick" event on the {@link Entity} with the pick result as parameters.
|
|
9389
|
-
*
|
|
9390
|
-
* Picking the {@link Entity} at the given canvas coordinates:
|
|
9391
|
-
|
|
9392
|
-
* ````javascript
|
|
9393
|
-
* var pickResult = scene.pick({
|
|
9394
|
-
* canvasPos: [23, 131]
|
|
9395
|
-
* });
|
|
9396
|
-
*
|
|
9397
|
-
* if (pickResult) { // Picked an Entity
|
|
9398
|
-
* var entity = pickResult.entity;
|
|
9399
|
-
* }
|
|
9400
|
-
* ````
|
|
9413
|
+
* if (pickResult) { // Picked an Entity
|
|
9414
|
+
* var entity = pickResult.entity;
|
|
9415
|
+
* }
|
|
9416
|
+
* ````
|
|
9401
9417
|
*
|
|
9402
9418
|
* Picking, with a ray cast through the canvas, hits an {@link Entity}:
|
|
9403
9419
|
*
|
|
@@ -9493,166 +9509,166 @@ if(!params.canvasPos&&!params.matrix&&(!params.origin||!params.direction)){this.
|
|
|
9493
9509
|
if(includeEntities){params.includeEntityIds=getEntityIDMap(this,includeEntities);}var excludeEntities=params.excludeEntities||params.exclude;// Backwards compat
|
|
9494
9510
|
if(excludeEntities){params.excludeEntityIds=getEntityIDMap(this,excludeEntities);}if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}if(params.snapToEdge||params.snapToVertex){pickResult=this._renderer.snapPick(params.canvasPos,params.snapRadius||30,params.snapToVertex,params.snapToEdge,pickResult);}else{pickResult=this._renderer.pick(params,pickResult);}if(pickResult){if(pickResult.entity&&pickResult.entity.fire){pickResult.entity.fire("picked",pickResult);// TODO: SceneModelEntity doesn't fire events
|
|
9495
9511
|
}}return pickResult;}/**
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9512
|
+
* @param {Object} params Picking parameters.
|
|
9513
|
+
* @param {Number[]} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the **origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position, directly along the negative View-space Z-axis.
|
|
9514
|
+
* @param {Number} [params.snapRadius=30] The snap radius, in canvas pixels
|
|
9515
|
+
* @param {boolean} [params.snapToVertex=true] Whether to snap to vertex.
|
|
9516
|
+
* @param {boolean} [params.snapToEdge=true] Whether to snap to edge.
|
|
9517
|
+
* @deprecated
|
|
9518
|
+
*/},{key:"snapPick",value:function snapPick(params){if(undefined===this._warnSnapPickDeprecated){this._warnSnapPickDeprecated=true;this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead");}return this._renderer.snapPick(params.canvasPos,params.snapRadius||30,params.snapToVertex,params.snapToEdge);}/**
|
|
9519
|
+
* Destroys all non-default {@link Component}s in this Scene.
|
|
9520
|
+
*/},{key:"clear",value:function clear(){var component;for(var id in this.components){if(this.components.hasOwnProperty(id)){component=this.components[id];if(!component._dontClear){// Don't destroy components like Camera, Input, Viewport etc.
|
|
9505
9521
|
component.destroy();}}}}/**
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9522
|
+
* Destroys all {@link Light}s in this Scene..
|
|
9523
|
+
*/},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i87=0,len=ids.length;_i87<len;_i87++){this.lights[ids[_i87]].destroy();}}/**
|
|
9524
|
+
* Destroys all {@link SectionPlane}s in this Scene.
|
|
9525
|
+
*/},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i88=0,len=ids.length;_i88<len;_i88++){this.sectionPlanes[ids[_i88]].destroy();}}/**
|
|
9526
|
+
* Destroys all {@link Line}s in this Scene.
|
|
9527
|
+
*/},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i89=0,len=ids.length;_i89<len;_i89++){this.bitmaps[ids[_i89]].destroy();}}/**
|
|
9528
|
+
* Destroys all {@link Line}s in this Scene.
|
|
9529
|
+
*/},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i90=0,len=ids.length;_i90<len;_i90++){this.lineSets[ids[_i90]].destroy();}}/**
|
|
9530
|
+
* Gets the collective axis-aligned boundary (AABB) of a batch of {@link Entity}s that represent objects.
|
|
9531
|
+
*
|
|
9532
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9533
|
+
*
|
|
9534
|
+
* Each {@link Entity} on which {@link Entity#isObject} is registered by {@link Entity#id} in {@link Scene#visibleObjects}.
|
|
9535
|
+
*
|
|
9536
|
+
* Each {@link Entity} is only included in the AABB when {@link Entity#collidable} is ````true````.
|
|
9537
|
+
*
|
|
9538
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9539
|
+
* @returns {[Number, Number, Number, Number, Number, Number]} An axis-aligned World-space bounding box, given as elements ````[xmin, ymin, zmin, xmax, ymax, zmax]````.
|
|
9540
|
+
*/},{key:"getAABB",value:function getAABB(ids){if(ids===undefined){return this.aabb;}if(utils.isString(ids)){var entity=this.objects[ids];if(entity&&entity.aabb){// A Component subclass with an AABB
|
|
9525
9541
|
return entity.aabb;}ids=[ids];// Must be an entity type
|
|
9526
9542
|
}if(ids.length===0){return this.aabb;}var xmin=math.MAX_DOUBLE;var ymin=math.MAX_DOUBLE;var zmin=math.MAX_DOUBLE;var xmax=math.MIN_DOUBLE;var ymax=math.MIN_DOUBLE;var zmax=math.MIN_DOUBLE;var valid;this.withObjects(ids,function(entity){if(entity.collidable){var aabb=entity.aabb;if(aabb[0]<xmin){xmin=aabb[0];}if(aabb[1]<ymin){ymin=aabb[1];}if(aabb[2]<zmin){zmin=aabb[2];}if(aabb[3]>xmax){xmax=aabb[3];}if(aabb[4]>ymax){ymax=aabb[4];}if(aabb[5]>zmax){zmax=aabb[5];}valid=true;}});if(valid){var aabb2=math.AABB3();aabb2[0]=xmin;aabb2[1]=ymin;aabb2[2]=zmin;aabb2[3]=xmax;aabb2[4]=ymax;aabb2[5]=zmax;return aabb2;}else{return this.aabb;// Scene AABB
|
|
9527
9543
|
}}/**
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9544
|
+
* Batch-updates {@link Entity#visible} on {@link Entity}s that represent objects.
|
|
9545
|
+
*
|
|
9546
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9547
|
+
*
|
|
9548
|
+
* Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#visible} are ````true```` is
|
|
9549
|
+
* registered by {@link Entity#id} in {@link Scene#visibleObjects}.
|
|
9550
|
+
*
|
|
9551
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9552
|
+
* @param {Boolean} visible Whether or not to set visible.
|
|
9553
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9554
|
+
*/},{key:"setObjectsVisible",value:function setObjectsVisible(ids,visible){return this.withObjects(ids,function(entity){var changed=entity.visible!==visible;entity.visible=visible;return changed;});}/**
|
|
9555
|
+
* Batch-updates {@link Entity#collidable} on {@link Entity}s that represent objects.
|
|
9556
|
+
*
|
|
9557
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9558
|
+
*
|
|
9559
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9560
|
+
* @param {Boolean} collidable Whether or not to set collidable.
|
|
9561
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9562
|
+
*/},{key:"setObjectsCollidable",value:function setObjectsCollidable(ids,collidable){return this.withObjects(ids,function(entity){var changed=entity.collidable!==collidable;entity.collidable=collidable;return changed;});}/**
|
|
9563
|
+
* Batch-updates {@link Entity#culled} on {@link Entity}s that represent objects.
|
|
9564
|
+
*
|
|
9565
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9566
|
+
*
|
|
9567
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9568
|
+
* @param {Boolean} culled Whether or not to cull.
|
|
9569
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9570
|
+
*/},{key:"setObjectsCulled",value:function setObjectsCulled(ids,culled){return this.withObjects(ids,function(entity){var changed=entity.culled!==culled;entity.culled=culled;return changed;});}/**
|
|
9571
|
+
* Batch-updates {@link Entity#selected} on {@link Entity}s that represent objects.
|
|
9572
|
+
*
|
|
9573
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9574
|
+
*
|
|
9575
|
+
* Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#selected} are ````true```` is
|
|
9576
|
+
* registered by {@link Entity#id} in {@link Scene#selectedObjects}.
|
|
9577
|
+
*
|
|
9578
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9579
|
+
* @param {Boolean} selected Whether or not to select.
|
|
9580
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9581
|
+
*/},{key:"setObjectsSelected",value:function setObjectsSelected(ids,selected){return this.withObjects(ids,function(entity){var changed=entity.selected!==selected;entity.selected=selected;return changed;});}/**
|
|
9582
|
+
* Batch-updates {@link Entity#highlighted} on {@link Entity}s that represent objects.
|
|
9583
|
+
*
|
|
9584
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9585
|
+
*
|
|
9586
|
+
* Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#highlighted} are ````true```` is
|
|
9587
|
+
* registered by {@link Entity#id} in {@link Scene#highlightedObjects}.
|
|
9588
|
+
*
|
|
9589
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9590
|
+
* @param {Boolean} highlighted Whether or not to highlight.
|
|
9591
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9592
|
+
*/},{key:"setObjectsHighlighted",value:function setObjectsHighlighted(ids,highlighted){return this.withObjects(ids,function(entity){var changed=entity.highlighted!==highlighted;entity.highlighted=highlighted;return changed;});}/**
|
|
9593
|
+
* Batch-updates {@link Entity#xrayed} on {@link Entity}s that represent objects.
|
|
9594
|
+
*
|
|
9595
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9596
|
+
*
|
|
9597
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9598
|
+
* @param {Boolean} xrayed Whether or not to xray.
|
|
9599
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9600
|
+
*/},{key:"setObjectsXRayed",value:function setObjectsXRayed(ids,xrayed){return this.withObjects(ids,function(entity){var changed=entity.xrayed!==xrayed;entity.xrayed=xrayed;return changed;});}/**
|
|
9601
|
+
* Batch-updates {@link Entity#edges} on {@link Entity}s that represent objects.
|
|
9602
|
+
*
|
|
9603
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9604
|
+
*
|
|
9605
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9606
|
+
* @param {Boolean} edges Whether or not to show edges.
|
|
9607
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9608
|
+
*/},{key:"setObjectsEdges",value:function setObjectsEdges(ids,edges){return this.withObjects(ids,function(entity){var changed=entity.edges!==edges;entity.edges=edges;return changed;});}/**
|
|
9609
|
+
* Batch-updates {@link Entity#colorize} on {@link Entity}s that represent objects.
|
|
9610
|
+
*
|
|
9611
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9612
|
+
*
|
|
9613
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9614
|
+
* @param {Number[]} [colorize=(1,1,1)] RGB colorize factors, multiplied by the rendered pixel colors.
|
|
9615
|
+
* @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
|
|
9616
|
+
*/},{key:"setObjectsColorized",value:function setObjectsColorized(ids,colorize){return this.withObjects(ids,function(entity){entity.colorize=colorize;});}/**
|
|
9617
|
+
* Batch-updates {@link Entity#opacity} on {@link Entity}s that represent objects.
|
|
9618
|
+
*
|
|
9619
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9620
|
+
*
|
|
9621
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9622
|
+
* @param {Number} [opacity=1.0] Opacity factor, multiplied by the rendered pixel alphas.
|
|
9623
|
+
* @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
|
|
9624
|
+
*/},{key:"setObjectsOpacity",value:function setObjectsOpacity(ids,opacity){return this.withObjects(ids,function(entity){var changed=entity.opacity!==opacity;entity.opacity=opacity;return changed;});}/**
|
|
9625
|
+
* Batch-updates {@link Entity#pickable} on {@link Entity}s that represent objects.
|
|
9626
|
+
*
|
|
9627
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9628
|
+
*
|
|
9629
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9630
|
+
* @param {Boolean} pickable Whether or not to set pickable.
|
|
9631
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9632
|
+
*/},{key:"setObjectsPickable",value:function setObjectsPickable(ids,pickable){return this.withObjects(ids,function(entity){var changed=entity.pickable!==pickable;entity.pickable=pickable;return changed;});}/**
|
|
9633
|
+
* Batch-updates {@link Entity#offset} on {@link Entity}s that represent objects.
|
|
9634
|
+
*
|
|
9635
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9636
|
+
*
|
|
9637
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9638
|
+
* @param {Number[]} [offset] 3D offset vector.
|
|
9639
|
+
*/},{key:"setObjectsOffset",value:function setObjectsOffset(ids,offset){this.withObjects(ids,function(entity){entity.offset=offset;});}/**
|
|
9640
|
+
* Iterates with a callback over {@link Entity}s that represent objects.
|
|
9641
|
+
*
|
|
9642
|
+
* An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
|
|
9643
|
+
*
|
|
9644
|
+
* @param {String[]} ids Array of {@link Entity#id} values.
|
|
9645
|
+
* @param {Function} callback Callback to execute on eacn {@link Entity}.
|
|
9646
|
+
* @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
|
|
9647
|
+
*/},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i91=0,len=ids.length;_i91<len;_i91++){var id=ids[_i91];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i92=0,_len9=modelIds.length;_i92<_len9;_i92++){var modelId=modelIds[_i92];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
|
|
9648
|
+
* This method will "tickify" the provided `cb` function.
|
|
9649
|
+
*
|
|
9650
|
+
* This means, the function will be wrapped so:
|
|
9651
|
+
*
|
|
9652
|
+
* - it runs time-aligned to scene ticks
|
|
9653
|
+
* - it runs maximum once per scene-tick
|
|
9654
|
+
*
|
|
9655
|
+
* @param {Function} cb The function to tickify
|
|
9656
|
+
* @returns {Function}
|
|
9657
|
+
*/},{key:"tickify",value:function tickify(cb){var cbString=cb.toString();/**
|
|
9658
|
+
* Check if the function is already tickified, and if so return the cached one.
|
|
9659
|
+
*/if(cbString in this._tickifiedFunctions){return this._tickifiedFunctions[cbString].wrapperFunc;}var alreadyRun=0;var needToRun=0;var lastArgs;/**
|
|
9660
|
+
* The provided `cb` function is replaced with a "set-dirty" function
|
|
9661
|
+
*
|
|
9662
|
+
* @type {Function}
|
|
9663
|
+
*/var wrapperFunc=function wrapperFunc(){for(var _len10=arguments.length,args=new Array(_len10),_key7=0;_key7<_len10;_key7++){args[_key7]=arguments[_key7];}lastArgs=args;needToRun++;};/**
|
|
9664
|
+
* An each scene tick, if the "dirty-flag" is set, run the `cb` function.
|
|
9665
|
+
*
|
|
9666
|
+
* This will make it run time-aligned to the scene tick.
|
|
9667
|
+
*/var tickSubId=this.on("tick",function(){var tmp=needToRun;if(tmp>alreadyRun){alreadyRun=tmp;cb.apply(void 0,_toConsumableArray(lastArgs));}});/**
|
|
9668
|
+
* And, store the list of subscribers.
|
|
9669
|
+
*/this._tickifiedFunctions[cbString]={tickSubId:tickSubId,wrapperFunc:wrapperFunc};return wrapperFunc;}/**
|
|
9670
|
+
* Destroys this Scene.
|
|
9671
|
+
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Scene.prototype),"destroy",this).call(this);for(var id in this.components){if(this.components.hasOwnProperty(id)){this.components[id].destroy();}}this.canvas.gl=null;// Memory leak prevention
|
|
9656
9672
|
this.components=null;this.models=null;this.objects=null;this.visibleObjects=null;this.xrayedObjects=null;this.highlightedObjects=null;this.selectedObjects=null;this.colorizedObjects=null;this.opacityObjects=null;this.sectionPlanes=null;this.lights=null;this.lightMaps=null;this.reflectionMaps=null;this._objectIds=null;this._visibleObjectIds=null;this._xrayedObjectIds=null;this._highlightedObjectIds=null;this._selectedObjectIds=null;this._colorizedObjectIds=null;this.types=null;this.components=null;this.canvas=null;this._renderer=null;this.input=null;this._viewport=null;this._camera=null;}}]);return Scene;}(Component);/**
|
|
9657
9673
|
* Texture wrapping mode in which the texture repeats to infinity.
|
|
9658
9674
|
*/var RepeatWrapping=1000;/**
|
|
@@ -18693,11 +18709,11 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
|
|
|
18693
18709
|
*/function DistanceMeasurement(plugin){var _this80;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurement);_this80=_super115.call(this,plugin.viewer.scene,cfg);/**
|
|
18694
18710
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurement.
|
|
18695
18711
|
* @type {DistanceMeasurementsPlugin}
|
|
18696
|
-
*/_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;_this80._color=cfg.color||_this80.plugin.defaultColor;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown',event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup',event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove',event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this80));}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:2,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color,prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
18712
|
+
*/_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;_this80._color=cfg.color||_this80.plugin.defaultColor;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown',event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup',event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove',event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this80));}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:2,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color,prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._labelsOnWires=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
18697
18713
|
});_this80._targetMarker.on("worldPos",function(value){_this80._targetWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
18698
18714
|
});_this80._onViewMatrix=scene.camera.on("viewMatrix",function(){_this80._vpDirty=true;_this80._needUpdate(0);// No lag
|
|
18699
18715
|
});_this80._onProjMatrix=scene.camera.on("projMatrix",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onCanvasBoundary=scene.canvas.on("boundary",function(){_this80._cpDirty=true;_this80._needUpdate(0);// No lag
|
|
18700
|
-
});_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.approximate=cfg.approximate;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;return _this80;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this.
|
|
18716
|
+
});_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.approximate=cfg.approximate;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;_this80.labelsOnWires=cfg.labelsOnWires;return _this80;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
|
|
18701
18717
|
// this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);
|
|
18702
18718
|
// this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);
|
|
18703
18719
|
// this._lengthLabel.setVisible(false);
|
|
@@ -18826,9 +18842,17 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
18826
18842
|
*
|
|
18827
18843
|
* @type {Boolean}
|
|
18828
18844
|
*/function get(){return this._labelsVisible;}/**
|
|
18845
|
+
* Sets if labels should be positioned on the wires.
|
|
18846
|
+
*
|
|
18847
|
+
* @type {Boolean}
|
|
18848
|
+
*/,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsVisible;this._labelsVisible=value;var labelsVisible=this._visible&&this._labelsVisible;this._xAxisLabel.setVisible(labelsVisible&&!this._xAxisLabelCulled&&this._clickable&&this._axisEnabled);this._yAxisLabel.setVisible(labelsVisible&&!this._yAxisLabelCulled&&this._clickable&&this._axisEnabled);this._zAxisLabel.setVisible(labelsVisible&&!this._zAxisLabelCulled&&this._clickable&&this._axisEnabled);this._lengthLabel.setVisible(labelsVisible);this._cpDirty=true;this._needUpdate();}},{key:"labelsOnWires",get:/**
|
|
18849
|
+
* Gets if labels should be positioned on the wires.
|
|
18850
|
+
*
|
|
18851
|
+
* @type {Boolean}
|
|
18852
|
+
*/function get(){return this._labelsOnWires;}/**
|
|
18829
18853
|
* Sets if this DistanceMeasurement appears highlighted.
|
|
18830
18854
|
* @param highlighted
|
|
18831
|
-
*/,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.
|
|
18855
|
+
*/,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsOnWires;this._labelsOnWires=value;}},{key:"setHighlighted",value:function setHighlighted(highlighted){this._originDot.setHighlighted(highlighted);this._targetDot.setHighlighted(highlighted);this._xAxisWire.setHighlighted(highlighted);this._yAxisWire.setHighlighted(highlighted);this._zAxisWire.setHighlighted(highlighted);this._xAxisLabel.setHighlighted(highlighted);this._yAxisLabel.setHighlighted(highlighted);this._zAxisLabel.setHighlighted(highlighted);this._lengthWire.setHighlighted(highlighted);this._lengthLabel.setHighlighted(highlighted);}/**
|
|
18832
18856
|
* Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events, or ignore mouse events altogether.
|
|
18833
18857
|
*
|
|
18834
18858
|
* @type {Boolean}
|
|
@@ -18924,55 +18948,55 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
18924
18948
|
* distanceMeasurementsControl.activate();
|
|
18925
18949
|
* ````
|
|
18926
18950
|
*/var DistanceMeasurementsMouseControl=/*#__PURE__*/function(_DistanceMeasurements){_inherits(DistanceMeasurementsMouseControl,_DistanceMeasurements);var _super117=_createSuper(DistanceMeasurementsMouseControl);/**
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18951
|
+
* Creates a DistanceMeasurementsMouseControl bound to the given DistanceMeasurementsPlugin.
|
|
18952
|
+
*
|
|
18953
|
+
* @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
18954
|
+
* @param [cfg] Configuration
|
|
18955
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
18956
|
+
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
18957
|
+
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this81;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this81=_super117.call(this,distanceMeasurementsPlugin.viewer.scene);_this81.pointerLens=cfg.pointerLens;_this81._active=false;_this81._currentDistanceMeasurement=null;_this81._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this81._initMarkerDiv();_this81._onCameraControlHoverSnapOrSurface=null;_this81._onCameraControlHoverSnapOrSurfaceOff=null;_this81._onMouseDown=null;_this81._onMouseUp=null;_this81._onCanvasTouchStart=null;_this81._onCanvasTouchEnd=null;_this81._snapping=cfg.snapping!==false;_this81._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this81._attachPlugin(distanceMeasurementsPlugin,cfg);return _this81;}_createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistanceMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this._markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){var element=document.getElementById("myDistanceMarker");element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
18958
|
+
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
|
|
18959
|
+
* @type {DistanceMeasurementsPlugin}
|
|
18960
|
+
*/this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
|
|
18961
|
+
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
|
|
18962
|
+
* @type {DistanceMeasurementsPlugin}
|
|
18963
|
+
*/this.plugin=distanceMeasurementsPlugin;}/**
|
|
18964
|
+
* Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.
|
|
18965
|
+
*
|
|
18966
|
+
* @returns {boolean} True if this DistanceMeasurementsMouseControl is active.
|
|
18967
|
+
*/},{key:"active",get:function get(){return this._active;}/**
|
|
18968
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
18969
|
+
*
|
|
18970
|
+
* This is `true` by default.
|
|
18971
|
+
*
|
|
18972
|
+
* Internally, this deactivates then activates the DistanceMeasurementsMouseControl when changed, which means that
|
|
18973
|
+
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
18974
|
+
* and rebinds various input handlers.
|
|
18975
|
+
*
|
|
18976
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsMouseControl.
|
|
18977
|
+
*/},{key:"snapping",get:/**
|
|
18978
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
18979
|
+
*
|
|
18980
|
+
* This is `true` by default.
|
|
18981
|
+
*
|
|
18982
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
18983
|
+
*/function get(){return this._snapping;}/**
|
|
18984
|
+
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
18985
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this82._markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
18986
|
+
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
18987
|
+
*
|
|
18988
|
+
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
18989
|
+
*/},{key:"deactivate",value:function deactivate(){if(!this._active){return;}this.fire("activated",false);if(this.pointerLens){this.pointerLens.visible=false;}if(this._markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.distanceMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onCameraControlHoverSnapOrSurface);cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._active=false;}/**
|
|
18990
|
+
* Resets this DistanceMeasurementsMouseControl.
|
|
18991
|
+
*
|
|
18992
|
+
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
18993
|
+
*
|
|
18994
|
+
* Does nothing if the DistanceMeasurementsMouseControl is not active.
|
|
18995
|
+
*/},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/**
|
|
18996
|
+
* Destroys this DistanceMeasurementsMouseControl.
|
|
18997
|
+
*
|
|
18998
|
+
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
18999
|
+
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(DistanceMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return DistanceMeasurementsMouseControl;}(DistanceMeasurementsControl);/**
|
|
18976
19000
|
* {@link Viewer} plugin for measuring point-to-point distances.
|
|
18977
19001
|
*
|
|
18978
19002
|
* [<img src="https://user-images.githubusercontent.com/83100/63047331-867a0a80-bed4-11e9-892f-398740013c5f.gif">](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_createWithMouse)
|
|
@@ -21689,62 +21713,64 @@ var eyeTargetVec=math.subVec3(optionalTargetWorldPos,camera.eye,tempVec3a$7);var
|
|
|
21689
21713
|
// - add both vectors to camera eye and look.
|
|
21690
21714
|
var worldPos1=this._unproject(targetCanvasPos,tempVec4a$4);camera.ortho.scale=camera.ortho.scale-dollyDelta;camera.ortho._update();// HACK
|
|
21691
21715
|
var worldPos2=this._unproject(targetCanvasPos,tempVec4b$4);var _offset=math.subVec3(worldPos2,worldPos1,tempVec4c$1);var eyeLookMoveVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look,camera.eye,tempVec3a$7)),-dollyDelta,tempVec3b$4);var _moveVec=math.addVec3(_offset,eyeLookMoveVec,tempVec3c$3);camera.eye=[camera.eye[0]-_moveVec[0],camera.eye[1]-_moveVec[1],camera.eye[2]-_moveVec[2]];camera.look=[camera.look[0]-_moveVec[0],camera.look[1]-_moveVec[1],camera.look[2]-_moveVec[2]];}return dolliedThroughSurface;}},{key:"_unproject",value:function _unproject(canvasPos,worldPos){var camera=this._scene.camera;var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);camera.project.unproject(canvasPos,screenZ,screenPos,viewPos,worldPos);return worldPos;}},{key:"destroy",value:function destroy(){}}]);return PanController;}();var tempVec3a$6=math.vec3();var tempVec3b$3=math.vec3();var tempVec3c$2=math.vec3();var tempVec4a$3=math.vec4();var tempVec4b$3=math.vec4();var tempVec4c=math.vec4();/** @private */var PivotController=/*#__PURE__*/function(){/**
|
|
21692
|
-
|
|
21693
|
-
|
|
21716
|
+
* @private
|
|
21717
|
+
*/function PivotController(scene,configs){var _this103=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
|
|
21694
21718
|
this._scene=scene;this._configs=configs;this._pivotWorldPos=math.vec3();this._cameraOffset=math.vec3();this._azimuth=0;this._polar=0;this._radius=0;this._pivotPosSet=false;// Initially false, true as soon as _pivotWorldPos has been set to some value
|
|
21695
21719
|
this._pivoting=false;// True while pivoting
|
|
21696
|
-
this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this103._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this103._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this103.updatePivotElement();_this103.updatePivotSphere();});}_createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
|
|
21697
|
-
var canvasBoundingRect=canvas._lastBoundingClientRect
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
21711
|
-
|
|
21712
|
-
|
|
21720
|
+
this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this103._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this103._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this103.updatePivotElement();_this103.updatePivotSphere();});}_createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
|
|
21721
|
+
var canvasBoundingRect=canvas._lastBoundingClientRect;// if (!canvasBoundingRect || canvas._canvasSizeChanged) {
|
|
21722
|
+
var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();// }
|
|
21723
|
+
if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px";this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px";}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
|
|
21724
|
+
* Sets the HTML DOM element that will represent the pivot position.
|
|
21725
|
+
*
|
|
21726
|
+
* @param pivotElement
|
|
21727
|
+
*/},{key:"setPivotElement",value:function setPivotElement(pivotElement){this._pivotElement=pivotElement;}/**
|
|
21728
|
+
* Sets a sphere as the representation of the pivot position.
|
|
21729
|
+
*
|
|
21730
|
+
* @param {Object} [cfg] Sphere configuration.
|
|
21731
|
+
* @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
|
|
21732
|
+
* @param {String} [cfg.color=Array] Optional maretial color. Defaults to a red.
|
|
21733
|
+
*/},{key:"enablePivotSphere",value:function enablePivotSphere(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.destroyPivotSphere();this._pivotSphereEnabled=true;if(cfg.size){this._pivotSphereSize=cfg.size;}var color=cfg.color||[1,0,0];this._pivotSphereMaterial=new PhongMaterial(this._scene,{emissive:color,ambient:color,specular:[0,0,0],diffuse:[0,0,0]});}/**
|
|
21734
|
+
* Remove the sphere as the representation of the pivot position.
|
|
21735
|
+
*
|
|
21736
|
+
*/},{key:"disablePivotSphere",value:function disablePivotSphere(){this.destroyPivotSphere();this._pivotSphereEnabled=false;}/**
|
|
21737
|
+
* Begins pivoting.
|
|
21738
|
+
*/},{key:"startPivot",value:function startPivot(){if(this._cameraLookingDownwards()){this._pivoting=false;return false;}var camera=this._scene.camera;var lookat=math.lookAtMat4v(camera.eye,camera.look,camera.worldUp);math.transformPoint3(lookat,this.getPivotPos(),this._cameraOffset);var pivotPos=this.getPivotPos();this._cameraOffset[2]+=math.distVec3(camera.eye,pivotPos);lookat=math.inverseMat4(lookat);var offset=math.transformVec3(lookat,this._cameraOffset);var diff=math.vec3();math.subVec3(camera.eye,pivotPos,diff);math.addVec3(diff,offset);if(camera.zUp){var t=diff[1];diff[1]=diff[2];diff[2]=t;}this._radius=math.lenVec3(diff);this._polar=Math.acos(diff[1]/this._radius);this._azimuth=Math.atan2(diff[0],diff[2]);this._pivoting=true;}},{key:"_cameraLookingDownwards",value:function _cameraLookingDownwards(){// Returns true if angle between camera viewing direction and World-space "up" axis is too small
|
|
21713
21739
|
var camera=this._scene.camera;var forwardAxis=math.normalizeVec3(math.subVec3(camera.look,camera.eye,tempVec3a$6));var rightAxis=math.cross3Vec3(forwardAxis,camera.worldUp,tempVec3b$3);var rightAxisLen=math.sqLenVec3(rightAxis);return rightAxisLen<=0.0001;}/**
|
|
21714
|
-
|
|
21715
|
-
|
|
21716
|
-
|
|
21717
|
-
|
|
21718
|
-
|
|
21719
|
-
|
|
21720
|
-
|
|
21721
|
-
|
|
21722
|
-
|
|
21723
|
-
|
|
21724
|
-
|
|
21725
|
-
|
|
21726
|
-
|
|
21727
|
-
|
|
21728
|
-
|
|
21729
|
-
|
|
21730
|
-
|
|
21740
|
+
* Returns true if we are currently pivoting.
|
|
21741
|
+
*
|
|
21742
|
+
* @returns {Boolean}
|
|
21743
|
+
*/},{key:"getPivoting",value:function getPivoting(){return this._pivoting;}/**
|
|
21744
|
+
* Sets a 3D World-space position to pivot about.
|
|
21745
|
+
*
|
|
21746
|
+
* @param {Number[]} worldPos The new World-space pivot position.
|
|
21747
|
+
*/},{key:"setPivotPos",value:function setPivotPos(worldPos){this._pivotWorldPos.set(worldPos);this._pivotPosSet=true;}/**
|
|
21748
|
+
* Sets the pivot position to the 3D projection of the given 2D canvas coordinates on a sphere centered
|
|
21749
|
+
* at the viewpoint. The radius of the sphere is configured via {@link CameraControl#smartPivot}.
|
|
21750
|
+
*
|
|
21751
|
+
*
|
|
21752
|
+
* @param canvasPos
|
|
21753
|
+
*/},{key:"setCanvasPivotPos",value:function setCanvasPivotPos(canvasPos){var camera=this._scene.camera;var pivotShereRadius=Math.abs(math.distVec3(this._scene.center,camera.eye));var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);var worldPos=tempVec4a$3;camera.project.unproject(canvasPos,screenZ,tempVec4b$3,tempVec4c,worldPos);var eyeWorldPosVec=math.normalizeVec3(math.subVec3(worldPos,camera.eye,tempVec3a$6));var posOnSphere=math.addVec3(camera.eye,math.mulVec3Scalar(eyeWorldPosVec,pivotShereRadius,tempVec3b$3),tempVec3c$2);this.setPivotPos(posOnSphere);}/**
|
|
21754
|
+
* Gets the current position we're pivoting about.
|
|
21755
|
+
* @returns {Number[]} The current World-space pivot position.
|
|
21756
|
+
*/},{key:"getPivotPos",value:function getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look;// Avoid pivoting about [0,0,0] by default
|
|
21731
21757
|
}/**
|
|
21732
|
-
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21736
|
-
|
|
21758
|
+
* Continues to pivot.
|
|
21759
|
+
*
|
|
21760
|
+
* @param {Number} yawInc Yaw rotation increment.
|
|
21761
|
+
* @param {Number} pitchInc Pitch rotation increment.
|
|
21762
|
+
*/},{key:"continuePivot",value:function continuePivot(yawInc,pitchInc){if(!this._pivoting){return;}if(yawInc===0&&pitchInc===0){return;}var camera=this._scene.camera;var dx=-yawInc;var dy=-pitchInc;if(camera.worldUp[2]===1){dx=-dx;}this._azimuth+=-dx*0.01;this._polar+=dy*0.01;this._polar=math.clamp(this._polar,0.001,Math.PI-0.001);var pos=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(camera.worldUp[2]===1){var t=pos[1];pos[1]=pos[2];pos[2]=t;}// Preserve the eye->look distance, since in xeokit "look" is the point-of-interest, not the direction vector.
|
|
21737
21763
|
var eyeLookLen=math.lenVec3(math.subVec3(camera.look,camera.eye,math.vec3()));var pivotPos=this.getPivotPos();math.addVec3(pos,pivotPos);var lookat=math.lookAtMat4v(pos,pivotPos,camera.worldUp);lookat=math.inverseMat4(lookat);var offset=math.transformVec3(lookat,this._cameraOffset);lookat[12]-=offset[0];lookat[13]-=offset[1];lookat[14]-=offset[2];var zAxis=[lookat[8],lookat[9],lookat[10]];camera.eye=[lookat[12],lookat[13],lookat[14]];math.subVec3(camera.eye,math.mulVec3Scalar(zAxis,eyeLookLen),camera.look);camera.up=[lookat[4],lookat[5],lookat[6]];this.showPivot();}/**
|
|
21738
|
-
|
|
21739
|
-
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21747
|
-
|
|
21764
|
+
* Shows the pivot position.
|
|
21765
|
+
*
|
|
21766
|
+
* Only works if we set an HTML DOM element to represent the pivot position.
|
|
21767
|
+
*/},{key:"showPivot",value:function showPivot(){if(this._shown){return;}if(this._pivotElement){this.updatePivotElement();this._pivotElement.style.visibility="visible";}if(this._pivotSphereEnabled){this.destroyPivotSphere();this.createPivotSphere();}this._shown=true;}/**
|
|
21768
|
+
* Hides the pivot position.
|
|
21769
|
+
*
|
|
21770
|
+
* Only works if we set an HTML DOM element to represent the pivot position.
|
|
21771
|
+
*/},{key:"hidePivot",value:function hidePivot(){if(!this._shown){return;}if(this._pivotElement){this._pivotElement.style.visibility="hidden";}if(this._pivotSphereEnabled){this.destroyPivotSphere();}this._shown=false;}/**
|
|
21772
|
+
* Finishes pivoting.
|
|
21773
|
+
*/},{key:"endPivot",value:function endPivot(){this._pivoting=false;}},{key:"destroy",value:function destroy(){this.destroyPivotSphere();this._scene.camera.off(this._onViewMatrix);this._scene.camera.off(this._onProjMatrix);this._scene.off(this._onTick);}}]);return PivotController;}();/**
|
|
21748
21774
|
*
|
|
21749
21775
|
* @private
|
|
21750
21776
|
*/var PickController=/*#__PURE__*/function(){function PickController(cameraControl,configs){_classCallCheck(this,PickController);/**
|
|
@@ -22352,81 +22378,81 @@ getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickContro
|
|
|
22352
22378
|
* * ````"qwerty"````
|
|
22353
22379
|
* * ````"azerty"````
|
|
22354
22380
|
*/var CameraControl=/*#__PURE__*/function(_Component38){_inherits(CameraControl,_Component38);var _super136=_createSuper(CameraControl);/**
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22381
|
+
* @private
|
|
22382
|
+
* @constructor
|
|
22383
|
+
*/function CameraControl(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this105=_super136.call(this,owner,cfg);/**
|
|
22384
|
+
* Identifies the XX action.
|
|
22385
|
+
* @final
|
|
22386
|
+
* @type {Number}
|
|
22387
|
+
*/_this105.PAN_LEFT=0;/**
|
|
22388
|
+
* Identifies the XX action.
|
|
22389
|
+
* @final
|
|
22390
|
+
* @type {Number}
|
|
22391
|
+
*/_this105.PAN_RIGHT=1;/**
|
|
22392
|
+
* Identifies the XX action.
|
|
22393
|
+
* @final
|
|
22394
|
+
* @type {Number}
|
|
22395
|
+
*/_this105.PAN_UP=2;/**
|
|
22396
|
+
* Identifies the XX action.
|
|
22397
|
+
* @final
|
|
22398
|
+
* @type {Number}
|
|
22399
|
+
*/_this105.PAN_DOWN=3;/**
|
|
22400
|
+
* Identifies the XX action.
|
|
22401
|
+
* @final
|
|
22402
|
+
* @type {Number}
|
|
22403
|
+
*/_this105.PAN_FORWARDS=4;/**
|
|
22404
|
+
* Identifies the XX action.
|
|
22405
|
+
* @final
|
|
22406
|
+
* @type {Number}
|
|
22407
|
+
*/_this105.PAN_BACKWARDS=5;/**
|
|
22408
|
+
* Identifies the XX action.
|
|
22409
|
+
* @final
|
|
22410
|
+
* @type {Number}
|
|
22411
|
+
*/_this105.ROTATE_X_POS=6;/**
|
|
22412
|
+
* Identifies the XX action.
|
|
22413
|
+
* @final
|
|
22414
|
+
* @type {Number}
|
|
22415
|
+
*/_this105.ROTATE_X_NEG=7;/**
|
|
22416
|
+
* Identifies the XX action.
|
|
22417
|
+
* @final
|
|
22418
|
+
* @type {Number}
|
|
22419
|
+
*/_this105.ROTATE_Y_POS=8;/**
|
|
22420
|
+
* Identifies the XX action.
|
|
22421
|
+
* @final
|
|
22422
|
+
* @type {Number}
|
|
22423
|
+
*/_this105.ROTATE_Y_NEG=9;/**
|
|
22424
|
+
* Identifies the XX action.
|
|
22425
|
+
* @final
|
|
22426
|
+
* @type {Number}
|
|
22427
|
+
*/_this105.DOLLY_FORWARDS=10;/**
|
|
22428
|
+
* Identifies the XX action.
|
|
22429
|
+
* @final
|
|
22430
|
+
* @type {Number}
|
|
22431
|
+
*/_this105.DOLLY_BACKWARDS=11;/**
|
|
22432
|
+
* Identifies the XX action.
|
|
22433
|
+
* @final
|
|
22434
|
+
* @type {Number}
|
|
22435
|
+
*/_this105.AXIS_VIEW_RIGHT=12;/**
|
|
22436
|
+
* Identifies the XX action.
|
|
22437
|
+
* @final
|
|
22438
|
+
* @type {Number}
|
|
22439
|
+
*/_this105.AXIS_VIEW_BACK=13;/**
|
|
22440
|
+
* Identifies the XX action.
|
|
22441
|
+
* @final
|
|
22442
|
+
* @type {Number}
|
|
22443
|
+
*/_this105.AXIS_VIEW_LEFT=14;/**
|
|
22444
|
+
* Identifies the XX action.
|
|
22445
|
+
* @final
|
|
22446
|
+
* @type {Number}
|
|
22447
|
+
*/_this105.AXIS_VIEW_FRONT=15;/**
|
|
22448
|
+
* Identifies the XX action.
|
|
22449
|
+
* @final
|
|
22450
|
+
* @type {Number}
|
|
22451
|
+
*/_this105.AXIS_VIEW_TOP=16;/**
|
|
22452
|
+
* Identifies the XX action.
|
|
22453
|
+
* @final
|
|
22454
|
+
* @type {Number}
|
|
22455
|
+
*/_this105.AXIS_VIEW_BOTTOM=17;_this105._keyMap={};// Maps key codes to the above actions
|
|
22430
22456
|
_this105.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
|
|
22431
22457
|
_this105._configs={// Private
|
|
22432
22458
|
longTapTimeout:600,// Millisecs
|
|
@@ -22443,509 +22469,509 @@ _this105._handlers=[new MouseMiscHandler(_this105.scene,_this105._controllers,_t
|
|
|
22443
22469
|
_this105._cameraUpdater=new CameraUpdater(_this105.scene,_this105._controllers,_this105._configs,_this105._states,_this105._updates);// Set initial user configurations
|
|
22444
22470
|
_this105.navMode=cfg.navMode;if(cfg.planView){_this105.planView=cfg.planView;}_this105.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this105.keyboardLayout=cfg.keyboardLayout;// Deprecated
|
|
22445
22471
|
}else{_this105.keyMap=cfg.keyMap;}_this105.doublePickFlyTo=cfg.doublePickFlyTo;_this105.panRightClick=cfg.panRightClick;_this105.active=cfg.active;_this105.followPointer=cfg.followPointer;_this105.rotationInertia=cfg.rotationInertia;_this105.keyboardPanRate=cfg.keyboardPanRate;_this105.touchPanRate=cfg.touchPanRate;_this105.keyboardRotationRate=cfg.keyboardRotationRate;_this105.dragRotationRate=cfg.dragRotationRate;_this105.touchDollyRate=cfg.touchDollyRate;_this105.dollyInertia=cfg.dollyInertia;_this105.dollyProximityThreshold=cfg.dollyProximityThreshold;_this105.dollyMinSpeed=cfg.dollyMinSpeed;_this105.panInertia=cfg.panInertia;_this105.pointerEnabled=true;_this105.keyboardDollyRate=cfg.keyboardDollyRate;_this105.mouseWheelDollyRate=cfg.mouseWheelDollyRate;return _this105;}/**
|
|
22446
|
-
|
|
22447
|
-
|
|
22448
|
-
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
|
|
22457
|
-
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
|
|
22461
|
-
|
|
22472
|
+
* Sets custom mappings of keys to ````CameraControl```` actions.
|
|
22473
|
+
*
|
|
22474
|
+
* See class docs for usage.
|
|
22475
|
+
*
|
|
22476
|
+
* @param {{Number:Number}|String} value Either a set of new key mappings, or a string to select a keyboard layout,
|
|
22477
|
+
* which causes ````CameraControl```` to use the default key mappings for that layout.
|
|
22478
|
+
*/_createClass(CameraControl,[{key:"keyMap",get:/**
|
|
22479
|
+
* Gets custom mappings of keys to {@link CameraControl} actions.
|
|
22480
|
+
*
|
|
22481
|
+
* @returns {{Number:Number}} Current key mappings.
|
|
22482
|
+
*/function get(){return this._keyMap;}/**
|
|
22483
|
+
* Returns true if any keys configured for the given action are down.
|
|
22484
|
+
* @param action
|
|
22485
|
+
* @param keyDownMap
|
|
22486
|
+
* @private
|
|
22487
|
+
*/,set:function set(value){value=value||"qwerty";if(utils.isString(value)){var input=this.scene.input;var keyMap={};switch(value){default:this.error("Unsupported value for 'keyMap': "+value+" defaulting to 'qwerty'");// Intentional fall-through to "qwerty"
|
|
22462
22488
|
case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i466=0,len=keys.length;_i466<len;_i466++){var key=keys[_i466];if(keyDownMap[key]){return true;}}return false;}/**
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22478
|
-
|
|
22479
|
-
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22494
|
-
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
|
|
22498
|
-
|
|
22499
|
-
|
|
22500
|
-
|
|
22501
|
-
|
|
22502
|
-
|
|
22503
|
-
|
|
22504
|
-
|
|
22505
|
-
|
|
22506
|
-
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
-
|
|
22514
|
-
|
|
22515
|
-
|
|
22516
|
-
|
|
22517
|
-
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22525
|
-
|
|
22526
|
-
|
|
22527
|
-
|
|
22528
|
-
|
|
22529
|
-
|
|
22530
|
-
|
|
22531
|
-
|
|
22532
|
-
|
|
22533
|
-
|
|
22534
|
-
|
|
22535
|
-
|
|
22536
|
-
|
|
22537
|
-
|
|
22538
|
-
|
|
22539
|
-
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
|
|
22579
|
-
|
|
22580
|
-
|
|
22581
|
-
|
|
22582
|
-
|
|
22583
|
-
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
|
|
22587
|
-
|
|
22588
|
-
|
|
22589
|
-
|
|
22590
|
-
|
|
22591
|
-
|
|
22592
|
-
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
22645
|
-
|
|
22646
|
-
|
|
22647
|
-
|
|
22648
|
-
|
|
22649
|
-
|
|
22650
|
-
|
|
22651
|
-
|
|
22652
|
-
|
|
22653
|
-
|
|
22654
|
-
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
|
|
22666
|
-
|
|
22667
|
-
|
|
22668
|
-
|
|
22669
|
-
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22721
|
-
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
|
|
22726
|
-
|
|
22727
|
-
|
|
22728
|
-
|
|
22729
|
-
|
|
22730
|
-
|
|
22731
|
-
|
|
22732
|
-
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22744
|
-
|
|
22745
|
-
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
|
|
22762
|
-
|
|
22763
|
-
|
|
22764
|
-
|
|
22765
|
-
|
|
22766
|
-
|
|
22767
|
-
|
|
22768
|
-
|
|
22769
|
-
|
|
22770
|
-
|
|
22771
|
-
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
|
|
22776
|
-
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
|
|
22790
|
-
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
|
|
22818
|
-
|
|
22819
|
-
|
|
22820
|
-
|
|
22821
|
-
|
|
22822
|
-
|
|
22823
|
-
|
|
22824
|
-
|
|
22825
|
-
|
|
22826
|
-
|
|
22827
|
-
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
|
|
22850
|
-
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
|
|
22871
|
-
|
|
22872
|
-
|
|
22873
|
-
|
|
22874
|
-
|
|
22875
|
-
|
|
22876
|
-
|
|
22877
|
-
|
|
22878
|
-
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22489
|
+
* Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
|
|
22490
|
+
*
|
|
22491
|
+
* See class comments for an example.
|
|
22492
|
+
*
|
|
22493
|
+
* @param {HTMLElement} element HTML element representing the pivot point.
|
|
22494
|
+
*/},{key:"pivotElement",set:function set(element){this._controllers.pivotController.setPivotElement(element);}/**
|
|
22495
|
+
* Sets if this ````CameraControl```` is active or not.
|
|
22496
|
+
*
|
|
22497
|
+
* When inactive, the ````CameraControl```` will not react to input.
|
|
22498
|
+
*
|
|
22499
|
+
* Default is ````true````.
|
|
22500
|
+
*
|
|
22501
|
+
* @param {Boolean} value Set ````true```` to activate this ````CameraControl````.
|
|
22502
|
+
*/},{key:"active",get:/**
|
|
22503
|
+
* Gets if this ````CameraControl```` is active or not.
|
|
22504
|
+
*
|
|
22505
|
+
* When inactive, the ````CameraControl```` will not react to input.
|
|
22506
|
+
*
|
|
22507
|
+
* Default is ````true````.
|
|
22508
|
+
*
|
|
22509
|
+
* @returns {Boolean} Returns ````true```` if this ````CameraControl```` is active.
|
|
22510
|
+
*/function get(){return this._configs.active;}/**
|
|
22511
|
+
* Sets whether the pointer snap to vertex.
|
|
22512
|
+
*
|
|
22513
|
+
* @param {boolean} snapToVertex
|
|
22514
|
+
*/,set:function set(value){value=value!==false;this._configs.active=value;this._handlers[1]._active=value;this._handlers[5]._active=value;}},{key:"snapToVertex",get:/**
|
|
22515
|
+
* Gets whether the pointer snap to vertex.
|
|
22516
|
+
*
|
|
22517
|
+
* @returns {boolean}
|
|
22518
|
+
*/function get(){return this._configs.snapToVertex;}/**
|
|
22519
|
+
* Sets whether the pointer snap to edge.
|
|
22520
|
+
*
|
|
22521
|
+
* @param {boolean} snapToEdge
|
|
22522
|
+
*/,set:function set(snapToVertex){this._configs.snapToVertex=!!snapToVertex;}},{key:"snapToEdge",get:/**
|
|
22523
|
+
* Gets whether the pointer snap to edge.
|
|
22524
|
+
*
|
|
22525
|
+
* @returns {boolean}
|
|
22526
|
+
*/function get(){return this._configs.snapToEdge;}/**
|
|
22527
|
+
* Sets the current snap radius for "hoverSnapOrSurface" events, to specify whether the radius
|
|
22528
|
+
* within which the pointer snaps to the nearest vertex or the nearest edge.
|
|
22529
|
+
*
|
|
22530
|
+
* Default value is 30 pixels.
|
|
22531
|
+
*
|
|
22532
|
+
* @param {Number} snapRadius The snap radius.
|
|
22533
|
+
*/,set:function set(snapToEdge){this._configs.snapToEdge=!!snapToEdge;}},{key:"snapRadius",get:/**
|
|
22534
|
+
* Gets the current snap radius.
|
|
22535
|
+
*
|
|
22536
|
+
* @returns {Number} The snap radius.
|
|
22537
|
+
*/function get(){return this._configs.snapRadius;}/**
|
|
22538
|
+
* Sets the current navigation mode.
|
|
22539
|
+
*
|
|
22540
|
+
* Accepted values are:
|
|
22541
|
+
*
|
|
22542
|
+
* * "orbit" - rotation orbits about the current target or pivot point,
|
|
22543
|
+
* * "firstPerson" - rotation is about the current eye position,
|
|
22544
|
+
* * "planView" - rotation is disabled.
|
|
22545
|
+
*
|
|
22546
|
+
* See class comments for more info.
|
|
22547
|
+
*
|
|
22548
|
+
* @param {String} navMode The navigation mode: "orbit", "firstPerson" or "planView".
|
|
22549
|
+
*/,set:function set(snapRadius){snapRadius=snapRadius||DEFAULT_SNAP_PICK_RADIUS;this._configs.snapRadius=snapRadius;}},{key:"navMode",get:/**
|
|
22550
|
+
* Gets the current navigation mode.
|
|
22551
|
+
*
|
|
22552
|
+
* @returns {String} The navigation mode: "orbit", "firstPerson" or "planView".
|
|
22553
|
+
*/function get(){return this._configs.navMode;}/**
|
|
22554
|
+
* Sets whether mouse and touch input is enabled.
|
|
22555
|
+
*
|
|
22556
|
+
* Default is ````true````.
|
|
22557
|
+
*
|
|
22558
|
+
* Disabling mouse and touch input on ````CameraControl```` is useful when we want to temporarily use mouse or
|
|
22559
|
+
* touch input to interact with some other 3D control, without disturbing the {@link Camera}.
|
|
22560
|
+
*
|
|
22561
|
+
* @param {Boolean} value Set ````true```` to enable mouse and touch input.
|
|
22562
|
+
*/,set:function set(navMode){navMode=navMode||"orbit";if(navMode!=="firstPerson"&&navMode!=="orbit"&&navMode!=="planView"){this.error("Unsupported value for navMode: "+navMode+" - supported values are 'orbit', 'firstPerson' and 'planView' - defaulting to 'orbit'");navMode="orbit";}this._configs.firstPerson=navMode==="firstPerson";this._configs.planView=navMode==="planView";if(this._configs.firstPerson||this._configs.planView){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}this._configs.navMode=navMode;}},{key:"pointerEnabled",get:/**
|
|
22563
|
+
* Gets whether mouse and touch input is enabled.
|
|
22564
|
+
*
|
|
22565
|
+
* Default is ````true````.
|
|
22566
|
+
*
|
|
22567
|
+
* Disabling mouse and touch input on ````CameraControl```` is desirable when we want to temporarily use mouse or
|
|
22568
|
+
* touch input to interact with some other 3D control, without interfering with the {@link Camera}.
|
|
22569
|
+
*
|
|
22570
|
+
* @returns {Boolean} Returns ````true```` if mouse and touch input is enabled.
|
|
22571
|
+
*/function get(){return this._configs.pointerEnabled;}/**
|
|
22572
|
+
* Sets whether the {@link Camera} follows the mouse/touch pointer.
|
|
22573
|
+
*
|
|
22574
|
+
* In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
|
|
22575
|
+
*
|
|
22576
|
+
* In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
|
|
22577
|
+
*
|
|
22578
|
+
* In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
|
|
22579
|
+
*
|
|
22580
|
+
* Default is ````true````.
|
|
22581
|
+
*
|
|
22582
|
+
* See class comments for more info.
|
|
22583
|
+
*
|
|
22584
|
+
* @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
|
|
22585
|
+
*/,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var _i467=0,len=this._handlers.length;_i467<len;_i467++){var handler=this._handlers[_i467];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
|
|
22586
|
+
* Sets whether the {@link Camera} follows the mouse/touch pointer.
|
|
22587
|
+
*
|
|
22588
|
+
* In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
|
|
22589
|
+
*
|
|
22590
|
+
* In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
|
|
22591
|
+
*
|
|
22592
|
+
* In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
|
|
22593
|
+
*
|
|
22594
|
+
* Default is ````true````.
|
|
22595
|
+
*
|
|
22596
|
+
* See class comments for more info.
|
|
22597
|
+
*
|
|
22598
|
+
* @returns {Boolean} Returns ````true```` if the Camera follows the pointer.
|
|
22599
|
+
*/function get(){return this._configs.followPointer;}/**
|
|
22600
|
+
* Sets the current World-space 3D target position.
|
|
22601
|
+
*
|
|
22602
|
+
* Only applies when {@link CameraControl#followPointer} is ````true````.
|
|
22603
|
+
*
|
|
22604
|
+
* @param {Number[]} worldPos The new World-space 3D target position.
|
|
22605
|
+
*/,set:function set(value){this._configs.followPointer=value!==false;}},{key:"pivotPos",get:/**
|
|
22606
|
+
* Gets the current World-space 3D pivot position.
|
|
22607
|
+
*
|
|
22608
|
+
* Only applies when {@link CameraControl#followPointer} is ````true````.
|
|
22609
|
+
*
|
|
22610
|
+
* @return {Number[]} worldPos The current World-space 3D pivot position.
|
|
22611
|
+
*/function get(){return this._controllers.pivotController.getPivotPos();}/**
|
|
22612
|
+
* @deprecated
|
|
22613
|
+
* @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
|
|
22614
|
+
*/,set:function set(worldPos){this._controllers.pivotController.setPivotPos(worldPos);}},{key:"dollyToPointer",get:/**
|
|
22615
|
+
* @deprecated
|
|
22616
|
+
* @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
|
|
22617
|
+
*/function get(){this.warn("dollyToPointer property is deprecated - replaced with followPointer");return this.followPointer;}/**
|
|
22618
|
+
* @deprecated
|
|
22619
|
+
* @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
|
|
22620
|
+
*/,set:function set(value){this.warn("dollyToPointer property is deprecated - replaced with followPointer");this.followPointer=value;}},{key:"panToPointer",get:/**
|
|
22621
|
+
* @deprecated
|
|
22622
|
+
* @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
|
|
22623
|
+
*/function get(){this.warn("panToPointer property is deprecated - replaced with followPointer");return false;}/**
|
|
22624
|
+
* Sets whether this ````CameraControl```` is in plan-view mode.
|
|
22625
|
+
*
|
|
22626
|
+
* When in plan-view mode, rotation is disabled.
|
|
22627
|
+
*
|
|
22628
|
+
* Default is ````false````.
|
|
22629
|
+
*
|
|
22630
|
+
* Deprecated - use {@link CameraControl#navMode} instead.
|
|
22631
|
+
*
|
|
22632
|
+
* @param {Boolean} value Set ````true```` to enable plan-view mode.
|
|
22633
|
+
* @deprecated
|
|
22634
|
+
*/,set:function set(value){this.warn("panToPointer property is deprecated - replaced with followPointer");}},{key:"planView",get:/**
|
|
22635
|
+
* Gets whether this ````CameraControl```` is in plan-view mode.
|
|
22636
|
+
*
|
|
22637
|
+
* When in plan-view mode, rotation is disabled.
|
|
22638
|
+
*
|
|
22639
|
+
* Default is ````false````.
|
|
22640
|
+
*
|
|
22641
|
+
* Deprecated - use {@link CameraControl#navMode} instead.
|
|
22642
|
+
*
|
|
22643
|
+
* @returns {Boolean} Returns ````true```` if plan-view mode is enabled.
|
|
22644
|
+
* @deprecated
|
|
22645
|
+
*/function get(){this.warn("planView property is deprecated - replaced with navMode");return this._configs.planView;}/**
|
|
22646
|
+
* Sets whether this ````CameraControl```` is in first-person mode.
|
|
22647
|
+
*
|
|
22648
|
+
* In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
|
|
22649
|
+
*
|
|
22650
|
+
* Default is ````false````.
|
|
22651
|
+
*
|
|
22652
|
+
* Deprecated - use {@link CameraControl#navMode} instead.
|
|
22653
|
+
*
|
|
22654
|
+
* @param {Boolean} value Set ````true```` to enable first-person mode.
|
|
22655
|
+
* @deprecated
|
|
22656
|
+
*/,set:function set(value){this._configs.planView=!!value;this._configs.firstPerson=false;if(this._configs.planView){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}this.warn("planView property is deprecated - replaced with navMode");}},{key:"firstPerson",get:/**
|
|
22657
|
+
* Gets whether this ````CameraControl```` is in first-person mode.
|
|
22658
|
+
*
|
|
22659
|
+
* In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
|
|
22660
|
+
*
|
|
22661
|
+
* Default is ````false````.
|
|
22662
|
+
*
|
|
22663
|
+
* Deprecated - use {@link CameraControl#navMode} instead.
|
|
22664
|
+
*
|
|
22665
|
+
* @returns {Boolean} Returns ````true```` if first-person mode is enabled.
|
|
22666
|
+
* @deprecated
|
|
22667
|
+
*/function get(){this.warn("firstPerson property is deprecated - replaced with navMode");return this._configs.firstPerson;}/**
|
|
22668
|
+
* Sets whether to vertically constrain the {@link Camera} position for first-person navigation.
|
|
22669
|
+
*
|
|
22670
|
+
* When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
|
|
22671
|
+
*
|
|
22672
|
+
* Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
|
|
22673
|
+
*
|
|
22674
|
+
* Default is ````false````.
|
|
22675
|
+
*
|
|
22676
|
+
* @param {Boolean} value Set ````true```` to vertically constrain the Camera.
|
|
22677
|
+
*/,set:function set(value){this.warn("firstPerson property is deprecated - replaced with navMode");this._configs.firstPerson=!!value;this._configs.planView=false;if(this._configs.firstPerson){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}}},{key:"constrainVertical",get:/**
|
|
22678
|
+
* Gets whether to vertically constrain the {@link Camera} position for first-person navigation.
|
|
22679
|
+
*
|
|
22680
|
+
* When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
|
|
22681
|
+
*
|
|
22682
|
+
* Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
|
|
22683
|
+
*
|
|
22684
|
+
* Default is ````false````.
|
|
22685
|
+
*
|
|
22686
|
+
* @returns {Boolean} ````true```` when Camera is vertically constrained.
|
|
22687
|
+
*/function get(){return this._configs.constrainVertical;}/**
|
|
22688
|
+
* Sets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
|
|
22689
|
+
*
|
|
22690
|
+
* Default is ````false````.
|
|
22691
|
+
*
|
|
22692
|
+
* @param {Boolean} value Set ````true```` to enable double-pick-fly-to mode.
|
|
22693
|
+
*/,set:function set(value){this._configs.constrainVertical=!!value;}},{key:"doublePickFlyTo",get:/**
|
|
22694
|
+
* Gets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
|
|
22695
|
+
*
|
|
22696
|
+
* Default is ````false````.
|
|
22697
|
+
*
|
|
22698
|
+
* @returns {Boolean} Returns ````true```` when double-pick-fly-to mode is enabled.
|
|
22699
|
+
*/function get(){return this._configs.doublePickFlyTo;}/**
|
|
22700
|
+
* Sets whether either right-clicking (true) or middle-clicking (false) pans the {@link Camera}.
|
|
22701
|
+
*
|
|
22702
|
+
* Default is ````true````.
|
|
22703
|
+
*
|
|
22704
|
+
* @param {Boolean} value Set ````false```` to disable pan on right-click.
|
|
22705
|
+
*/,set:function set(value){this._configs.doublePickFlyTo=value!==false;}},{key:"panRightClick",get:/**
|
|
22706
|
+
* Gets whether right-clicking pans the {@link Camera}.
|
|
22707
|
+
*
|
|
22708
|
+
* Default is ````true````.
|
|
22709
|
+
*
|
|
22710
|
+
* @returns {Boolean} Returns ````false```` when pan on right-click is disabled.
|
|
22711
|
+
*/function get(){return this._configs.panRightClick;}/**
|
|
22712
|
+
* Sets a factor in range ````[0..1]```` indicating how much the {@link Camera} keeps moving after you finish rotating it.
|
|
22713
|
+
*
|
|
22714
|
+
* A value of ````0.0```` causes it to immediately stop, ````0.5```` causes its movement to decay 50% on each tick,
|
|
22715
|
+
* while ````1.0```` causes no decay, allowing it continue moving, by the current rate of rotation.
|
|
22716
|
+
*
|
|
22717
|
+
* You may choose an inertia of zero when you want be able to precisely rotate the Camera,
|
|
22718
|
+
* without interference from inertia. Zero inertia can also mean that less frames are rendered while
|
|
22719
|
+
* you are rotating the Camera.
|
|
22720
|
+
*
|
|
22721
|
+
* Default is ````0.0````.
|
|
22722
|
+
*
|
|
22723
|
+
* Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
|
|
22724
|
+
*
|
|
22725
|
+
* @param {Number} rotationInertia New inertial factor.
|
|
22726
|
+
*/,set:function set(value){this._configs.panRightClick=value!==false;}},{key:"rotationInertia",get:/**
|
|
22727
|
+
* Gets the rotation inertia factor.
|
|
22728
|
+
*
|
|
22729
|
+
* Default is ````0.0````.
|
|
22730
|
+
*
|
|
22731
|
+
* Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
|
|
22732
|
+
*
|
|
22733
|
+
* @returns {Number} The inertia factor.
|
|
22734
|
+
*/function get(){return this._configs.rotationInertia;}/**
|
|
22735
|
+
* Sets how much the {@link Camera} pans each second with keyboard input.
|
|
22736
|
+
*
|
|
22737
|
+
* Default is ````5.0````, to pan the Camera ````5.0```` World-space units every second that
|
|
22738
|
+
* a panning key is depressed. See the ````CameraControl```` class documentation for which keys control
|
|
22739
|
+
* panning.
|
|
22740
|
+
*
|
|
22741
|
+
* Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan
|
|
22742
|
+
* to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards
|
|
22743
|
+
* and backwards, we pan along the direction the Camera is pointing.
|
|
22744
|
+
*
|
|
22745
|
+
* Unlike dollying when {@link followPointer} is ````true````, panning does not follow the pointer.
|
|
22746
|
+
*
|
|
22747
|
+
* @param {Number} keyboardPanRate The new keyboard pan rate.
|
|
22748
|
+
*/,set:function set(rotationInertia){this._configs.rotationInertia=rotationInertia!==undefined&&rotationInertia!==null?rotationInertia:0.0;}},{key:"keyboardPanRate",get:/**
|
|
22749
|
+
* Gets how much the {@link Camera} pans each second with keyboard input.
|
|
22750
|
+
*
|
|
22751
|
+
* Default is ````5.0````.
|
|
22752
|
+
*
|
|
22753
|
+
* @returns {Number} The current keyboard pan rate.
|
|
22754
|
+
*/function get(){return this._configs.keyboardPanRate;}/**
|
|
22755
|
+
* Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
|
|
22756
|
+
*
|
|
22757
|
+
* Default is ````90.0````, to rotate/orbit the Camera ````90.0```` degrees every second that
|
|
22758
|
+
* a rotation key is depressed. See the ````CameraControl```` class documentation for which keys control
|
|
22759
|
+
* rotation/orbit.
|
|
22760
|
+
*
|
|
22761
|
+
* @param {Number} keyboardRotationRate The new keyboard rotation rate.
|
|
22762
|
+
*/,set:function set(keyboardPanRate){this._configs.keyboardPanRate=keyboardPanRate!==null&&keyboardPanRate!==undefined?keyboardPanRate:5.0;}/**
|
|
22763
|
+
* Sets how fast the camera pans on touch panning
|
|
22764
|
+
*
|
|
22765
|
+
* @param {Number} touchPanRate The new touch pan rate.
|
|
22766
|
+
*/},{key:"touchPanRate",get:/**
|
|
22767
|
+
* Gets how fast the {@link Camera} pans on touch panning
|
|
22768
|
+
*
|
|
22769
|
+
* Default is ````1.0````.
|
|
22770
|
+
*
|
|
22771
|
+
* @returns {Number} The current touch pan rate.
|
|
22772
|
+
*/function get(){return this._configs.touchPanRate;},set:function set(touchPanRate){this._configs.touchPanRate=touchPanRate!==null&&touchPanRate!==undefined?touchPanRate:1.0;}},{key:"keyboardRotationRate",get:/**
|
|
22773
|
+
* Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
|
|
22774
|
+
*
|
|
22775
|
+
* Default is ````90.0````.
|
|
22776
|
+
*
|
|
22777
|
+
* @returns {Number} The current keyboard rotation rate.
|
|
22778
|
+
*/function get(){return this._configs.keyboardRotationRate;}/**
|
|
22779
|
+
* Sets the current drag rotation rate.
|
|
22780
|
+
*
|
|
22781
|
+
* This configures how many degrees the {@link Camera} rotates/orbits for a full sweep of the canvas by mouse or touch dragging.
|
|
22782
|
+
*
|
|
22783
|
+
* For example, a value of ````360.0```` indicates that the ````Camera```` rotates/orbits ````360.0```` degrees horizontally
|
|
22784
|
+
* when we sweep the entire width of the canvas.
|
|
22785
|
+
*
|
|
22786
|
+
* ````CameraControl```` makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to
|
|
22787
|
+
* flip upside-down. Therefore, a value of ````360.0```` rotates/orbits the ````Camera```` through ````180.0```` degrees
|
|
22788
|
+
* vertically when we sweep the entire height of the canvas.
|
|
22789
|
+
*
|
|
22790
|
+
* Default is ````360.0````.
|
|
22791
|
+
*
|
|
22792
|
+
* @param {Number} dragRotationRate The new drag rotation rate.
|
|
22793
|
+
*/,set:function set(keyboardRotationRate){this._configs.keyboardRotationRate=keyboardRotationRate!==null&&keyboardRotationRate!==undefined?keyboardRotationRate:90.0;}},{key:"dragRotationRate",get:/**
|
|
22794
|
+
* Gets the current drag rotation rate.
|
|
22795
|
+
*
|
|
22796
|
+
* Default is ````360.0````.
|
|
22797
|
+
*
|
|
22798
|
+
* @returns {Number} The current drag rotation rate.
|
|
22799
|
+
*/function get(){return this._configs.dragRotationRate;}/**
|
|
22800
|
+
* Sets how much the {@link Camera} dollys each second with keyboard input.
|
|
22801
|
+
*
|
|
22802
|
+
* Default is ````15.0````, to dolly the {@link Camera} ````15.0```` World-space units per second while we hold down
|
|
22803
|
+
* the ````+```` and ````-```` keys.
|
|
22804
|
+
*
|
|
22805
|
+
* @param {Number} keyboardDollyRate The new keyboard dolly rate.
|
|
22806
|
+
*/,set:function set(dragRotationRate){this._configs.dragRotationRate=dragRotationRate!==null&&dragRotationRate!==undefined?dragRotationRate:360.0;}},{key:"keyboardDollyRate",get:/**
|
|
22807
|
+
* Gets how much the {@link Camera} dollys each second with keyboard input.
|
|
22808
|
+
*
|
|
22809
|
+
* Default is ````15.0````.
|
|
22810
|
+
*
|
|
22811
|
+
* @returns {Number} The current keyboard dolly rate.
|
|
22812
|
+
*/function get(){return this._configs.keyboardDollyRate;}/**
|
|
22813
|
+
* Sets how much the {@link Camera} dollys with touch input.
|
|
22814
|
+
*
|
|
22815
|
+
* Default is ````0.2````
|
|
22816
|
+
*
|
|
22817
|
+
* @param {Number} touchDollyRate The new touch dolly rate.
|
|
22818
|
+
*/,set:function set(keyboardDollyRate){this._configs.keyboardDollyRate=keyboardDollyRate!==null&&keyboardDollyRate!==undefined?keyboardDollyRate:15.0;}},{key:"touchDollyRate",get:/**
|
|
22819
|
+
* Gets how much the {@link Camera} dollys each second with touch input.
|
|
22820
|
+
*
|
|
22821
|
+
* Default is ````0.2````.
|
|
22822
|
+
*
|
|
22823
|
+
* @returns {Number} The current touch dolly rate.
|
|
22824
|
+
*/function get(){return this._configs.touchDollyRate;}/**
|
|
22825
|
+
* Sets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
|
|
22826
|
+
*
|
|
22827
|
+
* Default is ````100.0````, to dolly the {@link Camera} ````10.0```` World-space units per second as we spin
|
|
22828
|
+
* the mouse wheel.
|
|
22829
|
+
*
|
|
22830
|
+
* @param {Number} mouseWheelDollyRate The new mouse wheel dolly rate.
|
|
22831
|
+
*/,set:function set(touchDollyRate){this._configs.touchDollyRate=touchDollyRate!==null&&touchDollyRate!==undefined?touchDollyRate:0.2;}},{key:"mouseWheelDollyRate",get:/**
|
|
22832
|
+
* Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
|
|
22833
|
+
*
|
|
22834
|
+
* Default is ````100.0````.
|
|
22835
|
+
*
|
|
22836
|
+
* @returns {Number} The current mouseWheel dolly rate.
|
|
22837
|
+
*/function get(){return this._configs.mouseWheelDollyRate;}/**
|
|
22838
|
+
* Sets the dolly inertia factor.
|
|
22839
|
+
*
|
|
22840
|
+
* This factor configures how much the {@link Camera} keeps moving after you finish dollying it.
|
|
22841
|
+
*
|
|
22842
|
+
* This factor is a value in range ````[0..1]````. A value of ````0.0```` causes dollying to immediately stop,
|
|
22843
|
+
* ````0.5```` causes dollying to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows dollying
|
|
22844
|
+
* to continue until further input stops it.
|
|
22845
|
+
*
|
|
22846
|
+
* You might set ````dollyInertia```` to zero when you want be able to precisely position or rotate the Camera,
|
|
22847
|
+
* without interference from inertia. This also means that xeokit renders less frames while dollying the Camera,
|
|
22848
|
+
* which can improve rendering performance.
|
|
22849
|
+
*
|
|
22850
|
+
* Default is ````0````.
|
|
22851
|
+
*
|
|
22852
|
+
* @param {Number} dollyInertia New dolly inertia factor.
|
|
22853
|
+
*/,set:function set(mouseWheelDollyRate){this._configs.mouseWheelDollyRate=mouseWheelDollyRate!==null&&mouseWheelDollyRate!==undefined?mouseWheelDollyRate:100.0;}},{key:"dollyInertia",get:/**
|
|
22854
|
+
* Gets the dolly inertia factor.
|
|
22855
|
+
*
|
|
22856
|
+
* Default is ````0````.
|
|
22857
|
+
*
|
|
22858
|
+
* @returns {Number} The current dolly inertia factor.
|
|
22859
|
+
*/function get(){return this._configs.dollyInertia;}/**
|
|
22860
|
+
* Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
|
|
22861
|
+
*
|
|
22862
|
+
* Default is ````35.0````.
|
|
22863
|
+
*
|
|
22864
|
+
* @param {Number} dollyProximityThreshold New dolly proximity threshold.
|
|
22865
|
+
*/,set:function set(dollyInertia){this._configs.dollyInertia=dollyInertia!==undefined&&dollyInertia!==null?dollyInertia:0;}},{key:"dollyProximityThreshold",get:/**
|
|
22866
|
+
* Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
|
|
22867
|
+
*
|
|
22868
|
+
* Default is ````35.0````.
|
|
22869
|
+
*
|
|
22870
|
+
* @returns {Number} The current dolly proximity threshold.
|
|
22871
|
+
*/function get(){return this._configs.dollyProximityThreshold;}/**
|
|
22872
|
+
* Sets the minimum dolly speed.
|
|
22873
|
+
*
|
|
22874
|
+
* Default is ````0.04````.
|
|
22875
|
+
*
|
|
22876
|
+
* @param {Number} dollyMinSpeed New dolly minimum speed.
|
|
22877
|
+
*/,set:function set(dollyProximityThreshold){this._configs.dollyProximityThreshold=dollyProximityThreshold!==undefined&&dollyProximityThreshold!==null?dollyProximityThreshold:35.0;}},{key:"dollyMinSpeed",get:/**
|
|
22878
|
+
* Gets the minimum dolly speed.
|
|
22879
|
+
*
|
|
22880
|
+
* Default is ````0.04````.
|
|
22881
|
+
*
|
|
22882
|
+
* @returns {Number} The current minimum dolly speed.
|
|
22883
|
+
*/function get(){return this._configs.dollyMinSpeed;}/**
|
|
22884
|
+
* Sets the pan inertia factor.
|
|
22885
|
+
*
|
|
22886
|
+
* This factor configures how much the {@link Camera} keeps moving after you finish panning it.
|
|
22887
|
+
*
|
|
22888
|
+
* This factor is a value in range ````[0..1]````. A value of ````0.0```` causes panning to immediately stop,
|
|
22889
|
+
* ````0.5```` causes panning to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows panning
|
|
22890
|
+
* to continue until further input stops it.
|
|
22891
|
+
*
|
|
22892
|
+
* You might set ````panInertia```` to zero when you want be able to precisely position or rotate the Camera,
|
|
22893
|
+
* without interference from inertia. This also means that xeokit renders less frames while panning the Camera,
|
|
22894
|
+
* wich can improve rendering performance.
|
|
22895
|
+
*
|
|
22896
|
+
* Default is ````0.5````.
|
|
22897
|
+
*
|
|
22898
|
+
* @param {Number} panInertia New pan inertia factor.
|
|
22899
|
+
*/,set:function set(dollyMinSpeed){this._configs.dollyMinSpeed=dollyMinSpeed!==undefined&&dollyMinSpeed!==null?dollyMinSpeed:0.04;}},{key:"panInertia",get:/**
|
|
22900
|
+
* Gets the pan inertia factor.
|
|
22901
|
+
*
|
|
22902
|
+
* Default is ````0.5````.
|
|
22903
|
+
*
|
|
22904
|
+
* @returns {Number} The current pan inertia factor.
|
|
22905
|
+
*/function get(){return this._configs.panInertia;}/**
|
|
22906
|
+
* Sets the keyboard layout.
|
|
22907
|
+
*
|
|
22908
|
+
* Supported layouts are:
|
|
22909
|
+
*
|
|
22910
|
+
* * ````"qwerty"```` (default)
|
|
22911
|
+
* * ````"azerty"````
|
|
22912
|
+
*
|
|
22913
|
+
* @deprecated
|
|
22914
|
+
* @param {String} value Selects the keyboard layout.
|
|
22915
|
+
*/,set:function set(panInertia){this._configs.panInertia=panInertia!==undefined&&panInertia!==null?panInertia:0.5;}},{key:"keyboardLayout",get:/**
|
|
22916
|
+
* Gets the keyboard layout.
|
|
22917
|
+
*
|
|
22918
|
+
* Supported layouts are:
|
|
22919
|
+
*
|
|
22920
|
+
* * ````"qwerty"```` (default)
|
|
22921
|
+
* * ````"azerty"````
|
|
22922
|
+
*
|
|
22923
|
+
* @deprecated
|
|
22924
|
+
* @returns {String} The current keyboard layout.
|
|
22925
|
+
*/function get(){return this._configs.keyboardLayout;}/**
|
|
22926
|
+
* Sets a sphere as the representation of the pivot position.
|
|
22927
|
+
*
|
|
22928
|
+
* @param {Object} [cfg] Sphere configuration.
|
|
22929
|
+
* @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
|
|
22930
|
+
* @param {String} [cfg.material=PhongMaterial] Optional size factor of the sphere. Defaults to a red opaque material.
|
|
22931
|
+
*/,set:function set(value){// this.warn("keyboardLayout property is deprecated - use keyMap property instead");
|
|
22906
22932
|
value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsupported value for keyboardLayout - defaulting to 'qwerty'");value="qwerty";}this._configs.keyboardLayout=value;this.keyMap=this._configs.keyboardLayout;}},{key:"enablePivotSphere",value:function enablePivotSphere(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._controllers.pivotController.enablePivotSphere(cfg);}/**
|
|
22907
|
-
|
|
22908
|
-
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22922
|
-
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
|
-
|
|
22939
|
-
|
|
22940
|
-
|
|
22941
|
-
|
|
22942
|
-
|
|
22943
|
-
|
|
22944
|
-
|
|
22945
|
-
|
|
22946
|
-
|
|
22947
|
-
|
|
22948
|
-
|
|
22933
|
+
* Remove the sphere as the representation of the pivot position.
|
|
22934
|
+
*
|
|
22935
|
+
*/},{key:"disablePivotSphere",value:function disablePivotSphere(){this._controllers.pivotController.disablePivotSphere();}/**
|
|
22936
|
+
* Sets whether smart default pivoting is enabled.
|
|
22937
|
+
*
|
|
22938
|
+
* When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
|
|
22939
|
+
* imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
|
|
22940
|
+
*
|
|
22941
|
+
* When ````false````, we'll pivot by default about {@link Camera#look}.
|
|
22942
|
+
*
|
|
22943
|
+
* Default is ````false````.
|
|
22944
|
+
*
|
|
22945
|
+
* @param {Boolean} enabled Set ````true```` to pivot by default about the selected point on the virtual sphere, or ````false```` to pivot by default about {@link Camera#look}.
|
|
22946
|
+
*/},{key:"smartPivot",get:/**
|
|
22947
|
+
* Gets whether smart default pivoting is enabled.
|
|
22948
|
+
*
|
|
22949
|
+
* When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
|
|
22950
|
+
* imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
|
|
22951
|
+
*
|
|
22952
|
+
* When ````false````, we'll pivot by default about {@link Camera#look}.
|
|
22953
|
+
*
|
|
22954
|
+
* Default is ````false````.
|
|
22955
|
+
*
|
|
22956
|
+
* @returns {Boolean} Returns ````true```` when pivoting by default about the selected point on the virtual sphere, or ````false```` when pivoting by default about {@link Camera#look}.
|
|
22957
|
+
*/function get(){return this._configs.smartPivot;}/**
|
|
22958
|
+
* Sets the double click time frame length in milliseconds.
|
|
22959
|
+
*
|
|
22960
|
+
* If two mouse click events occur within this time frame, it is considered a double click.
|
|
22961
|
+
*
|
|
22962
|
+
* Default is ````250````
|
|
22963
|
+
*
|
|
22964
|
+
* @param {Number} value New double click time frame.
|
|
22965
|
+
*/,set:function set(enabled){this._configs.smartPivot=enabled!==false;}},{key:"doubleClickTimeFrame",get:/**
|
|
22966
|
+
* Gets the double click time frame length in milliseconds.
|
|
22967
|
+
*
|
|
22968
|
+
* Default is ````250````
|
|
22969
|
+
*
|
|
22970
|
+
* @param {Number} value Current double click time frame.
|
|
22971
|
+
*/function get(){return this._configs.doubleClickTimeFrame;}/**
|
|
22972
|
+
* Destroys this ````CameraControl````.
|
|
22973
|
+
* @private
|
|
22974
|
+
*/,set:function set(value){this._configs.doubleClickTimeFrame=value!==undefined&&value!==null?value:250;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_get(_getPrototypeOf(CameraControl.prototype),"destroy",this).call(this);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i468=0,len=this._handlers.length;_i468<len;_i468++){var handler=this._handlers[_i468];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i469=0,len=this._controllers.length;_i469<len;_i469++){var controller=this._controllers[_i469];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
|
|
22949
22975
|
* @desc A property within a {@link PropertySet}.
|
|
22950
22976
|
*
|
|
22951
22977
|
* @class Property
|
|
@@ -26401,27 +26427,27 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
26401
26427
|
*
|
|
26402
26428
|
* @class TreeViewPlugin
|
|
26403
26429
|
*/var TreeViewPlugin=/*#__PURE__*/function(_Plugin15){_inherits(TreeViewPlugin,_Plugin15);var _super161=_createSuper(TreeViewPlugin);/**
|
|
26404
|
-
|
|
26405
|
-
|
|
26406
|
-
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
|
|
26410
|
-
|
|
26411
|
-
|
|
26412
|
-
|
|
26413
|
-
|
|
26414
|
-
|
|
26415
|
-
|
|
26416
|
-
|
|
26417
|
-
|
|
26418
|
-
|
|
26419
|
-
|
|
26420
|
-
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26430
|
+
* @constructor
|
|
26431
|
+
*
|
|
26432
|
+
* @param {Viewer} viewer The Viewer.
|
|
26433
|
+
* @param {*} cfg Plugin configuration.
|
|
26434
|
+
* @param {String} [cfg.containerElementId] ID of an existing HTML element to contain the TreeViewPlugin - either this or containerElement is mandatory. When both values are given, the element reference is always preferred to the ID.
|
|
26435
|
+
* @param {HTMLElement} cfg.containerElement DOM element to contain the TreeViewPlugin.
|
|
26436
|
+
* @param {Boolean} [cfg.autoAddModels=true] When ````true```` (default), will automatically add each model as it's created. Set this ````false```` if you want to manually add models using {@link TreeViewPlugin#addModel} instead.
|
|
26437
|
+
* @param {Number} [cfg.autoExpandDepth] Optional depth to which to initially expand the tree.
|
|
26438
|
+
* @param {String} [cfg.hierarchy="containment"] How to organize the tree nodes: "containment", "storeys" or "types". See the class documentation for details.
|
|
26439
|
+
* @param {Boolean} [cfg.sortNodes=true] When true, will sort the children of each node. For a "storeys" hierarchy, the
|
|
26440
|
+
* ````IfcBuildingStorey```` nodes will be ordered spatially, from the highest storey down to the lowest, on the
|
|
26441
|
+
* vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
|
|
26442
|
+
* @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
|
|
26443
|
+
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
|
|
26444
|
+
*/function TreeViewPlugin(viewer){var _this145;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this145=_super161.call(this,"TreeViewPlugin",viewer);/**
|
|
26445
|
+
* Contains messages for any errors found while last rebuilding this TreeView.
|
|
26446
|
+
* @type {String[]}
|
|
26447
|
+
*/_this145.errors=[];/**
|
|
26448
|
+
* True if errors were found generating this TreeView.
|
|
26449
|
+
* @type {boolean}
|
|
26450
|
+
*/_this145.valid=true;// const containerElement =
|
|
26425
26451
|
// cfg.containerElement || document.getElementById(cfg.containerElementId);
|
|
26426
26452
|
// if (!(containerElement instanceof HTMLElement)) {
|
|
26427
26453
|
// this.error(
|
|
@@ -26465,26 +26491,33 @@ var visible=checkbox.checked;//获取勾选状态
|
|
|
26465
26491
|
var nodeId=checkbox.id.replace("checkbox-","");//获取勾选框对应节点id
|
|
26466
26492
|
var checkedNode=this._nodeNodes[nodeId];var objects=this._viewer.scene.objects;var numUpdated=0;this._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}// this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
|
|
26467
26493
|
setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}this._muteSceneEvents=false;function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}}/**
|
|
26468
|
-
|
|
26469
|
-
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
|
|
26473
|
-
|
|
26474
|
-
|
|
26475
|
-
|
|
26476
|
-
|
|
26477
|
-
|
|
26478
|
-
|
|
26479
|
-
|
|
26480
|
-
|
|
26481
|
-
|
|
26482
|
-
|
|
26483
|
-
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26494
|
+
* Sets how the nodes are organized within this tree view.
|
|
26495
|
+
*
|
|
26496
|
+
* Accepted values are:
|
|
26497
|
+
*
|
|
26498
|
+
* * "containment" - organizes the nodes to indicate the containment hierarchy of the IFC objects.
|
|
26499
|
+
* * "types" - groups the nodes within their IFC types.
|
|
26500
|
+
* * "storeys" - groups the nodes within ````IfcBuildingStoreys```` and sub-groups them by their IFC types.
|
|
26501
|
+
*
|
|
26502
|
+
* <br>
|
|
26503
|
+
* This can be updated dynamically.
|
|
26504
|
+
*
|
|
26505
|
+
* Default value is "containment".
|
|
26506
|
+
*
|
|
26507
|
+
* @type {String}
|
|
26508
|
+
*/},{key:"hierarchy",get:/**
|
|
26509
|
+
* Gets how the nodes are organized within this tree view.
|
|
26510
|
+
*
|
|
26511
|
+
* @type {String}
|
|
26512
|
+
*/function get(){return this._hierarchy;}/**
|
|
26513
|
+
* get _muteTreeEvents
|
|
26514
|
+
* @type {boolean}
|
|
26515
|
+
*/,set:function set(hierarchy){hierarchy=hierarchy||"containment";if(hierarchy!=="containment"&&hierarchy!=="storeys"&&hierarchy!=="types"){this.error("Unsupported value for `hierarchy' - defaulting to 'containment'");hierarchy="containment";}if(this._hierarchy===hierarchy){return;}this._hierarchy=hierarchy;this._createNodes();}},{key:"muteTreeEvents",get:function get(){return this._muteTreeEvents;}/**
|
|
26516
|
+
* set _muteTreeEvents
|
|
26517
|
+
*/,set:function set(mute){this._muteTreeEvents=mute;}/**
|
|
26518
|
+
* 获取nodeNodes
|
|
26519
|
+
*/},{key:"nodeNodes",get:function get(){return this._nodeNodes;}//创建根节点tree---------11111111111111111
|
|
26520
|
+
},{key:"_createNodes",value:function _createNodes(){if(this._rootElement){this._rootElement.parentNode.removeChild(this._rootElement);this._rootElement=null;}this._rootNodes=[];this._objectNodes={};this._nodeNodes={};this._validate();if(this.valid||this._hierarchy!=="storeys"){this._createEnabledNodes();}}//创建节点tree----------222222222222222222
|
|
26488
26521
|
},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();//同步scene和metaScene中的内容
|
|
26489
26522
|
this.fire("nodeNodes_Created",this._nodeNodes);this.fire("rootNodes_Created",this._rootNodes);this.fire("objectNodes_Created",this._objectNodes);// this._createTrees(); //创建html tree
|
|
26490
26523
|
// this.expandToDepth(this._autoExpandDepth); //展开几层与否
|
|
@@ -26546,46 +26579,46 @@ while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;paren
|
|
|
26546
26579
|
// }
|
|
26547
26580
|
// }
|
|
26548
26581
|
return true;}/**
|
|
26549
|
-
|
|
26550
|
-
|
|
26551
|
-
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
|
|
26555
|
-
|
|
26556
|
-
|
|
26557
|
-
|
|
26558
|
-
|
|
26559
|
-
|
|
26560
|
-
|
|
26561
|
-
|
|
26582
|
+
* Adds a model to this tree view.
|
|
26583
|
+
*
|
|
26584
|
+
* The model will be automatically removed when destroyed.
|
|
26585
|
+
*
|
|
26586
|
+
* To automatically add each model as it's created, instead of manually calling this method each time,
|
|
26587
|
+
* provide a ````autoAddModels: true```` to the TreeViewPlugin constructor.
|
|
26588
|
+
*
|
|
26589
|
+
* @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.
|
|
26590
|
+
* @param {Object} [options] Options for model in the tree view.
|
|
26591
|
+
* @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
|
|
26592
|
+
* and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
|
|
26593
|
+
* name. This option allows to override that name when it is not suitable as a display name.
|
|
26594
|
+
*/},{key:"addModel",value:function addModel(modelId){var _this146=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
|
|
26562
26595
|
// return;
|
|
26563
26596
|
// }
|
|
26564
26597
|
var model=this.viewer.scene.models[modelId];if(!model){throw"Model not found: "+modelId;}var metaModel=this.viewer.metaScene.metaModels[modelId];if(!metaModel){this.error("MetaModel not found: "+modelId);return;}if(this._metaModels[modelId]){this.warn("Model already added: "+modelId);return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this146.removeModel(model.id);});this._createNodes();}/**
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26598
|
+
* Removes a model from this tree view.
|
|
26599
|
+
*
|
|
26600
|
+
* Does nothing if model not currently in tree view.
|
|
26601
|
+
*
|
|
26602
|
+
* @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.
|
|
26603
|
+
*/},{key:"removeModel",value:function removeModel(modelId){// if (!this._containerElement) {
|
|
26571
26604
|
// return;
|
|
26572
26605
|
// }
|
|
26573
26606
|
var metaModel=this._metaModels[modelId];if(!metaModel){return;}if(this._rootNames[modelId]){delete this._rootNames[modelId];}delete this._metaModels[modelId];this._createNodes();}/**
|
|
26574
|
-
|
|
26575
|
-
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26584
|
-
|
|
26585
|
-
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
|
|
26607
|
+
* Highlights the tree view node that represents the given object {@link Entity}.
|
|
26608
|
+
*
|
|
26609
|
+
* This causes the tree view to collapse, then expand to reveal the node, then highlight the node.
|
|
26610
|
+
*
|
|
26611
|
+
* If a node is previously highlighted, de-highlights that node and collapses the tree first.
|
|
26612
|
+
*
|
|
26613
|
+
* Note that if the TreeViewPlugin was configured with ````pruneEmptyNodes: true```` (default configuration), then the
|
|
26614
|
+
* node won't exist in the tree if it has no Entitys in the {@link Scene}. in that case, nothing will happen.
|
|
26615
|
+
*
|
|
26616
|
+
* Within the DOM, the node is represented by an ````<li>```` element. This method will add a ````.highlighted-node```` class to
|
|
26617
|
+
* the element to make it appear highlighted, removing that class when de-highlighting it again. See the CSS rules
|
|
26618
|
+
* in the TreeViewPlugin examples for an example of that class.
|
|
26619
|
+
*
|
|
26620
|
+
* @param {String} objectId ID of the {@link Entity}.
|
|
26621
|
+
*/},{key:"showNode",value:function showNode(objectId){this.unShowNode();var node=this._objectNodes[objectId];if(!node){return;// Node may not exist for the given object if (this._pruneEmptyNodes == true)
|
|
26589
26622
|
}var nodeId=node.nodeId;var parent=node.parent;while(parent){parent=parent.parent;}// for (let i = 0, len = path.length; i < len; i++) {
|
|
26590
26623
|
// const switchElement = this._renderService.getSwitchElement(
|
|
26591
26624
|
// path[i].nodeId
|
|
@@ -26596,19 +26629,19 @@ var metaModel=this._metaModels[modelId];if(!metaModel){return;}if(this._rootName
|
|
|
26596
26629
|
// }
|
|
26597
26630
|
// this._renderService.setHighlighted(nodeId, true);
|
|
26598
26631
|
this._showListItemElementId=nodeId;}/**
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26632
|
+
* De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.
|
|
26633
|
+
*
|
|
26634
|
+
* Does nothing if no node is currently shown.
|
|
26635
|
+
*
|
|
26636
|
+
* If the node is currently scrolled into view, keeps the node in view.
|
|
26637
|
+
*/},{key:"unShowNode",value:function unShowNode(){if(!this._showListItemElementId){return;}// this._renderService.setHighlighted(this._showListItemElementId, false);
|
|
26605
26638
|
this._showListItemElementId=null;}/**
|
|
26606
|
-
|
|
26607
|
-
|
|
26608
|
-
|
|
26609
|
-
|
|
26610
|
-
|
|
26611
|
-
|
|
26639
|
+
* Expands the tree to the given depth.
|
|
26640
|
+
*
|
|
26641
|
+
* Collapses the tree first.
|
|
26642
|
+
*
|
|
26643
|
+
* @param {Number} depth Depth to expand to.
|
|
26644
|
+
*/ // expandToDepth(depth) {
|
|
26612
26645
|
// this.collapse();
|
|
26613
26646
|
// const expand = (node, countDepth) => {
|
|
26614
26647
|
// if (countDepth === depth) {
|
|
@@ -26630,8 +26663,8 @@ this._showListItemElementId=null;}/**
|
|
|
26630
26663
|
// }
|
|
26631
26664
|
// }
|
|
26632
26665
|
/**
|
|
26633
|
-
|
|
26634
|
-
|
|
26666
|
+
* Closes all the nodes in the tree.
|
|
26667
|
+
*/ // collapse() {
|
|
26635
26668
|
// for (let i = 0, len = this._rootNodes.length; i < len; i++) {
|
|
26636
26669
|
// const rootNode = this._rootNodes[i];
|
|
26637
26670
|
// const objectId = rootNode.objectId;
|
|
@@ -26639,23 +26672,23 @@ this._showListItemElementId=null;}/**
|
|
|
26639
26672
|
// }
|
|
26640
26673
|
// }
|
|
26641
26674
|
/**
|
|
26642
|
-
|
|
26643
|
-
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26675
|
+
* Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
|
|
26676
|
+
* node in depth-first pre-order.
|
|
26677
|
+
*
|
|
26678
|
+
* @param {TreeViewNode} node Root of the subtree.
|
|
26679
|
+
* @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.
|
|
26680
|
+
*/},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i570=0,len=children.length;_i570<len;_i570++){this.withNodeTree(children[_i570],callback);}}//遍历树指定节点下的子节点
|
|
26648
26681
|
},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i571=0,len=children.length;_i571<len;_i571++){this._withNodeTree(children[_i571],callback);}}/**
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26682
|
+
* 获取指定id节点的children
|
|
26683
|
+
* @param {*} nodeId
|
|
26684
|
+
* @returns node Children[]
|
|
26685
|
+
*/},{key:"getChildrenById",value:function getChildrenById(nodeId){return this._nodeNodes[nodeId].children;}/**
|
|
26686
|
+
* 获取指定id的节点
|
|
26687
|
+
* @param {*} nodeId
|
|
26688
|
+
* @returns
|
|
26689
|
+
*/},{key:"getNodeById",value:function getNodeById(nodeId){return this._nodeNodes[nodeId];}/**
|
|
26690
|
+
* Destroys this TreeViewPlugin.
|
|
26691
|
+
*/},{key:"destroy",value:function destroy(){// if (!this._containerElement) {
|
|
26659
26692
|
// return;
|
|
26660
26693
|
// }
|
|
26661
26694
|
this._metaModels={};if(this._rootElement&&!this._destroyed){this._rootElement.parentNode.removeChild(this._rootElement);this._viewer.scene.off(this._onObjectVisibility);this._destroyed=true;}delete treeViews[this._index];_get(_getPrototypeOf(TreeViewPlugin.prototype),"destroy",this).call(this);}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i572=0,len=children.length;_i572<len;_i572++){var childMetaObject=children[_i572];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i573=0,len=this._rootNodes.length;_i573<len;_i573++){var rootNode=this._rootNodes[_i573];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}if(this._hierarchy==="storeys"&&node.type==="IfcBuilding"){// Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
|