@xtctwins/tctwins-core 1.0.42 → 1.0.43
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.es5.js +622 -622
- package/dist/tctwins-core.min.es5.js +1 -1
- package/package.json +8 -12
package/dist/tctwins-core.es5.js
CHANGED
|
@@ -2651,101 +2651,101 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
|
|
|
2651
2651
|
* });
|
|
2652
2652
|
* ````
|
|
2653
2653
|
*/var Marker=/*#__PURE__*/function(_Component3){/**
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2654
|
+
* @constructor
|
|
2655
|
+
* @param {Component} [owner] Owner component. When destroyed, the owner will destroy this Marker as well.
|
|
2656
|
+
* @param {*} [cfg] Marker configuration
|
|
2657
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
2658
|
+
* @param {Entity} [cfg.entity] Entity to associate this Marker with. When the Marker has an Entity, then {@link Marker#visible} will always be ````false```` if {@link Entity#visible} is false.
|
|
2659
|
+
* @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.
|
|
2660
|
+
* @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.
|
|
2661
|
+
*/function Marker(owner,cfg){var _this12;_classCallCheck(this,Marker);_this12=_callSuper(this,Marker,[owner,cfg]);_this12._entity=null;_this12._visible=null;_this12._worldPos=math.vec3();_this12._origin=math.vec3();_this12._rtcPos=math.vec3();_this12._viewPos=math.vec3();_this12._canvasPos=math.vec2();_this12._occludable=false;_this12._onCameraViewMatrix=_this12.scene.camera.on("matrix",function(){_this12._viewPosDirty=true;_this12._needUpdate();});_this12._onCameraProjMatrix=_this12.scene.camera.on("projMatrix",function(){_this12._canvasPosDirty=true;_this12._needUpdate();});_this12._onEntityDestroyed=null;_this12._onEntityModelDestroyed=null;_this12._renderer.addMarker(_this12);_this12.entity=cfg.entity;_this12.worldPos=cfg.worldPos;_this12.occludable=cfg.occludable;return _this12;}_inherits(Marker,_Component3);return _createClass(Marker,[{key:"_update",value:function _update(){// this._needUpdate() schedules this for next tick
|
|
2662
2662
|
if(this._viewPosDirty){math.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos);this._viewPosDirty=false;this._canvasPosDirty=true;this.fire("viewPos",this._viewPos);}if(this._canvasPosDirty){tempVec4a$7.set(this._viewPos);tempVec4a$7[3]=1.0;math.transformPoint4(this.scene.camera.projMatrix,tempVec4a$7,tempVec4b$4);var aabb=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+tempVec4b$4[0]/tempVec4b$4[3])*aabb[2]/2);this._canvasPos[1]=Math.floor((1-tempVec4b$4[1]/tempVec4b$4[3])*aabb[3]/2);this._canvasPosDirty=false;this.fire("canvasPos",this._canvasPos);}}},{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
|
|
2663
2663
|
if(this._visible===visible);this._visible=visible;this.fire("visible",this._visible);}/**
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2664
|
+
* Sets the {@link Entity} this Marker is associated with.
|
|
2665
|
+
*
|
|
2666
|
+
* An Entity is optional. When the Marker has an Entity, then {@link Marker#visible} will always be ````false````
|
|
2667
|
+
* if {@link Entity#visible} is false.
|
|
2668
|
+
*
|
|
2669
|
+
* @type {Entity}
|
|
2670
|
+
*/},{key:"entity",get:/**
|
|
2671
|
+
* Gets the {@link Entity} this Marker is associated with.
|
|
2672
|
+
*
|
|
2673
|
+
* @type {Entity}
|
|
2674
|
+
*/function get(){return this._entity;}/**
|
|
2675
|
+
* Sets whether occlusion testing is performed for this Marker.
|
|
2676
|
+
*
|
|
2677
|
+
* When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.
|
|
2678
|
+
*
|
|
2679
|
+
* The {@link Scene} periodically occlusion-tests all Markers on every 20th "tick" (which represents a rendered frame). We
|
|
2680
|
+
* can adjust that frequency via property {@link Scene#ticksPerOcclusionTest}.
|
|
2681
|
+
*
|
|
2682
|
+
* @type {Boolean}
|
|
2683
|
+
*/,set:function set(entity){var _this13=this;if(this._entity){if(this._entity===entity){return;}if(this._onEntityDestroyed!==null){this._entity.off(this._onEntityDestroyed);this._onEntityDestroyed=null;}if(this._onEntityModelDestroyed!==null){this._entity.model.off(this._onEntityModelDestroyed);this._onEntityModelDestroyed=null;}}this._entity=entity;if(this._entity){if(this._entity instanceof SceneModelEntity){this._onEntityModelDestroyed=this._entity.model.on("destroyed",function(){// SceneModelEntity does not fire events, and cannot exist beyond its VBOSceneModel
|
|
2684
2684
|
_this13._entity=null;// Marker now may become visible, if it was synched to invisible Entity
|
|
2685
2685
|
_this13._onEntityModelDestroyed=null;});}else{this._onEntityDestroyed=this._entity.on("destroyed",function(){_this13._entity=null;_this13._onEntityDestroyed=null;});}}this.fire("entity",this._entity,true/* forget */);}},{key:"occludable",get:/**
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2686
|
+
* Gets whether occlusion testing is performed for this Marker.
|
|
2687
|
+
*
|
|
2688
|
+
* When this is ````true````, then {@link Marker#visible} will be ````false```` whenever the Marker is occluded by an {@link Entity} in the 3D view.
|
|
2689
|
+
*
|
|
2690
|
+
* @type {Boolean}
|
|
2691
|
+
*/function get(){return this._occludable;}/**
|
|
2692
|
+
* Sets the World-space 3D position of this Marker.
|
|
2693
|
+
*
|
|
2694
|
+
* Fires a "worldPos" event with new World position.
|
|
2695
|
+
*
|
|
2696
|
+
* @type {Number[]}
|
|
2697
|
+
*/,set:function set(occludable){occludable=!!occludable;if(occludable===this._occludable){return;}this._occludable=occludable;}},{key:"worldPos",get:/**
|
|
2698
|
+
* Gets the World-space 3D position of this Marker.
|
|
2699
|
+
*
|
|
2700
|
+
* @type {Number[]}
|
|
2701
|
+
*/function get(){return this._worldPos;}/**
|
|
2702
|
+
* Gets the RTC center of this Marker.
|
|
2703
|
+
*
|
|
2704
|
+
* This is automatically calculated from {@link Marker#worldPos}.
|
|
2705
|
+
*
|
|
2706
|
+
* @type {Number[]}
|
|
2707
|
+
*/,set:function set(worldPos){this._worldPos.set(worldPos||[0,0,0]);worldToRTCPos(this._worldPos,this._origin,this._rtcPos);if(this._occludable){this._renderer.markerWorldPosUpdated(this);}this._viewPosDirty=true;this.fire("worldPos",this._worldPos);this._needUpdate();}},{key:"origin",get:function get(){return this._origin;}/**
|
|
2708
|
+
* Gets the RTC position of this Marker.
|
|
2709
|
+
*
|
|
2710
|
+
* This is automatically calculated from {@link Marker#worldPos}.
|
|
2711
|
+
*
|
|
2712
|
+
* @type {Number[]}
|
|
2713
|
+
*/},{key:"rtcPos",get:function get(){return this._rtcPos;}/**
|
|
2714
|
+
* View-space 3D coordinates of this Marker.
|
|
2715
|
+
*
|
|
2716
|
+
* This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position.
|
|
2717
|
+
*
|
|
2718
|
+
* The Marker fires a "viewPos" event whenever this property changes.
|
|
2719
|
+
*
|
|
2720
|
+
* @type {Number[]}
|
|
2721
|
+
* @final
|
|
2722
|
+
*/},{key:"viewPos",get:function get(){this._update();return this._viewPos;}/**
|
|
2723
|
+
* Canvas-space 2D coordinates of this Marker.
|
|
2724
|
+
*
|
|
2725
|
+
* This property is read-only and is automatically calculated from {@link Marker#worldPos} and the current {@link Camera} position and projection.
|
|
2726
|
+
*
|
|
2727
|
+
* The Marker fires a "canvasPos" event whenever this property changes.
|
|
2728
|
+
*
|
|
2729
|
+
* @type {Number[]}
|
|
2730
|
+
* @final
|
|
2731
|
+
*/},{key:"canvasPos",get:function get(){this._update();return this._canvasPos;}/**
|
|
2732
|
+
* Indicates if this Marker is currently visible.
|
|
2733
|
+
*
|
|
2734
|
+
* This is read-only and is automatically calculated.
|
|
2735
|
+
*
|
|
2736
|
+
* The Marker is **invisible** whenever:
|
|
2737
|
+
*
|
|
2738
|
+
* * {@link Marker#canvasPos} is currently outside the canvas,
|
|
2739
|
+
* * {@link Marker#entity} is set to an {@link Entity} that has {@link Entity#visible} ````false````, or
|
|
2740
|
+
* * or {@link Marker#occludable} is ````true```` and the Marker is currently occluded by an Entity in the 3D view.
|
|
2741
|
+
*
|
|
2742
|
+
* The Marker fires a "visible" event whenever this property changes.
|
|
2743
|
+
*
|
|
2744
|
+
* @type {Boolean}
|
|
2745
|
+
* @final
|
|
2746
|
+
*/},{key:"visible",get:function get(){return!!this._visible;}/**
|
|
2747
|
+
* Destroys this Marker.
|
|
2748
|
+
*/},{key:"destroy",value:function destroy(){this.fire("destroyed",true);this.scene.camera.off(this._onCameraViewMatrix);this.scene.camera.off(this._onCameraProjMatrix);if(this._entity){if(this._onEntityDestroyed!==null){this._entity.off(this._onEntityDestroyed);}if(this._onEntityModelDestroyed!==null){this._entity.model.off(this._onEntityModelDestroyed);}}this._renderer.removeMarker(this);_superPropGet(Marker,"destroy",this,3)([]);}}]);}(Component);/** @private */var Wire=/*#__PURE__*/function(){function Wire(parentElement){var _this14=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Wire);this._color=cfg.color||"black";this._highlightClass="viewer-ruler-wire-highlighted";this._wire=document.createElement("div");this._wire.className+=this._wire.className?" viewer-ruler-wire":"viewer-ruler-wire";this._wireClickable=document.createElement("div");this._wireClickable.className+=this._wireClickable.className?" viewer-ruler-wire-clickable":"viewer-ruler-wire-clickable";this._thickness=cfg.thickness||1.0;this._thicknessClickable=cfg.thicknessClickable||6.0;this._visible=true;this._culled=false;var wire=this._wire;var wireStyle=wire.style;wireStyle.border="solid "+this._thickness+"px "+this._color;wireStyle.position="absolute";wireStyle["z-index"]=cfg.zIndex===undefined?"2000001":cfg.zIndex;wireStyle.width=0+"px";wireStyle.height=0+"px";wireStyle.visibility="visible";wireStyle.top=0+"px";wireStyle.left=0+"px";wireStyle["-webkit-transform-origin"]="0 0";wireStyle["-moz-transform-origin"]="0 0";wireStyle["-ms-transform-origin"]="0 0";wireStyle["-o-transform-origin"]="0 0";wireStyle["transform-origin"]="0 0";wireStyle["-webkit-transform"]="rotate(0deg)";wireStyle["-moz-transform"]="rotate(0deg)";wireStyle["-ms-transform"]="rotate(0deg)";wireStyle["-o-transform"]="rotate(0deg)";wireStyle["transform"]="rotate(0deg)";wireStyle["opacity"]=1.0;wireStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wire);var wireClickable=this._wireClickable;var wireClickableStyle=wireClickable.style;wireClickableStyle.border="solid "+this._thicknessClickable+"px "+this._color;wireClickableStyle.position="absolute";wireClickableStyle["z-index"]=cfg.zIndex===undefined?"2000002":cfg.zIndex+1;wireClickableStyle.width=0+"px";wireClickableStyle.height=0+"px";wireClickableStyle.visibility="visible";wireClickableStyle.top=0+"px";wireClickableStyle.left=0+"px";// wireClickableStyle["pointer-events"] = "none";
|
|
2749
2749
|
wireClickableStyle["-webkit-transform-origin"]="0 0";wireClickableStyle["-moz-transform-origin"]="0 0";wireClickableStyle["-ms-transform-origin"]="0 0";wireClickableStyle["-o-transform-origin"]="0 0";wireClickableStyle["transform-origin"]="0 0";wireClickableStyle["-webkit-transform"]="rotate(0deg)";wireClickableStyle["-moz-transform"]="rotate(0deg)";wireClickableStyle["-ms-transform"]="rotate(0deg)";wireClickableStyle["-o-transform"]="rotate(0deg)";wireClickableStyle["transform"]="rotate(0deg)";wireClickableStyle["opacity"]=0.0;wireClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wireClickable);if(cfg.onMouseOver){wireClickable.addEventListener("mouseover",function(event){cfg.onMouseOver(event,_this14);});}if(cfg.onMouseLeave){wireClickable.addEventListener("mouseleave",function(event){cfg.onMouseLeave(event,_this14);});}if(cfg.onMouseWheel){wireClickable.addEventListener("wheel",function(event){cfg.onMouseWheel(event,_this14);});}if(cfg.onMouseDown){wireClickable.addEventListener("mousedown",function(event){cfg.onMouseDown(event,_this14);});}if(cfg.onMouseClick){wireClickable.addEventListener("click",function(event){cfg.onMouseClick(event,_this14);});}if(cfg.onTouchStart){wireClickable.addEventListener("touchstart",function(event){cfg.onTouchStart(event,_this14);});}if(cfg.onMouseUp){wireClickable.addEventListener("mouseup",function(event){cfg.onMouseUp(event,_this14);});}if(cfg.onMouseMove){wireClickable.addEventListener("mousemove",function(event){cfg.onMouseMove(event,_this14);});}if(cfg.onContextMenu){wireClickable.addEventListener("contextmenu",function(event){cfg.onContextMenu(event,_this14);event.preventDefault();});}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}return _createClass(Wire,[{key:"visible",get:function get(){return this._wire.style.visibility==="visible";}},{key:"_update",value:function _update(){var length=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2)));var angle=Math.atan2(this._y2-this._y1,this._x2-this._x1)*180.0/Math.PI;var wireStyle=this._wire.style;wireStyle["width"]=Math.round(length)+"px";wireStyle["left"]=Math.round(this._x1)+"px";wireStyle["top"]=Math.round(this._y1)+"px";wireStyle["-webkit-transform"]="rotate("+angle+"deg)";wireStyle["-moz-transform"]="rotate("+angle+"deg)";wireStyle["-ms-transform"]="rotate("+angle+"deg)";wireStyle["-o-transform"]="rotate("+angle+"deg)";wireStyle["transform"]="rotate("+angle+"deg)";var wireClickableStyle=this._wireClickable.style;wireClickableStyle["width"]=Math.round(length)+"px";wireClickableStyle["left"]=Math.round(this._x1)+"px";wireClickableStyle["top"]=Math.round(this._y1)+"px";wireClickableStyle["-webkit-transform"]="rotate("+angle+"deg)";wireClickableStyle["-moz-transform"]="rotate("+angle+"deg)";wireClickableStyle["-ms-transform"]="rotate("+angle+"deg)";wireClickableStyle["-o-transform"]="rotate("+angle+"deg)";wireClickableStyle["transform"]="rotate("+angle+"deg)";}},{key:"setStartAndEnd",value:function setStartAndEnd(x1,y1,x2,y2){this._x1=x1;this._y1=y1;this._x2=x2;this._y2=y2;this._update();}},{key:"setColor",value:function setColor(color){this._color=color||"black";this._wire.style.border="solid "+this._thickness+"px "+this._color;}},{key:"setOpacity",value:function setOpacity(opacity){this._wire.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._wireClickable.style["pointer-events"]=!!clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._wire.classList.add(this._highlightClass);}else{this._wire.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(visible){if(this._wire.parentElement){this._wire.parentElement.removeChild(this._wire);}if(this._wireClickable.parentElement){this._wireClickable.parentElement.removeChild(this._wireClickable);}}}]);}();/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this15=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Dot);this._highlightClass="viewer-ruler-dot-highlighted";this._x=0;this._y=0;this._visible=true;this._dot=document.createElement("div");this._dot.className+=this._dot.className?" viewer-ruler-dot":"viewer-ruler-dot";this._dotClickable=document.createElement("div");this._dotClickable.className+=this._dotClickable.className?" viewer-ruler-dot-clickable":"viewer-ruler-dot-clickable";this._visible=true;this._culled=false;var dot=this._dot;var dotStyle=dot.style;dotStyle["border-radius"]=25+"px";dotStyle.border="solid 2px white";dotStyle.background="lightgreen";dotStyle.position="absolute";dotStyle["z-index"]=cfg.zIndex===undefined?"40000005":cfg.zIndex;dotStyle.width=10+"px";dotStyle.height=10+"px";dotStyle.visibility=cfg.visible!==false?"visible":"hidden";dotStyle.top=0+"px";dotStyle.left=0+"px";dotStyle["box-shadow"]="0 2px 5px 0 #182A3D;";dotStyle["opacity"]=1.0;dotStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dot);var dotClickable=this._dotClickable;var dotClickableStyle=dotClickable.style;dotClickableStyle["border-radius"]=35+"px";dotClickableStyle.border="solid 10px white";dotClickableStyle.position="absolute";dotClickableStyle["z-index"]=cfg.zIndex===undefined?"40000007":cfg.zIndex+1;dotClickableStyle.width=10+"px";dotClickableStyle.height=10+"px";dotClickableStyle.visibility="visible";dotClickableStyle.top=0+"px";dotClickableStyle.left=0+"px";dotClickableStyle["opacity"]=0.0;dotClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dotClickable);dotClickable.addEventListener("click",function(event){parentElement.dispatchEvent(new MouseEvent("mouseover",event));});if(cfg.onMouseOver){dotClickable.addEventListener("mouseover",function(event){cfg.onMouseOver(event,_this15);parentElement.dispatchEvent(new MouseEvent("mouseover",event));});}if(cfg.onMouseLeave){dotClickable.addEventListener("mouseleave",function(event){cfg.onMouseLeave(event,_this15);});}if(cfg.onMouseWheel){dotClickable.addEventListener("wheel",function(event){cfg.onMouseWheel(event,_this15);});}if(cfg.onMouseDown){dotClickable.addEventListener("mousedown",function(event){cfg.onMouseDown(event,_this15);});}if(cfg.onMouseClick){dotClickable.addEventListener("click",function(event){cfg.onMouseClick(event,_this15);});}if(cfg.onTouchStart){dotClickable.addEventListener("touchstart",function(event){cfg.onTouchStart(event,_this15);});}if(cfg.onMouseUp){dotClickable.addEventListener("mouseup",function(event){cfg.onMouseUp(event,_this15);});}if(cfg.onMouseMove){dotClickable.addEventListener("mousemove",function(event){cfg.onMouseMove(event,_this15);});}if(cfg.onContextMenu){dotClickable.addEventListener("contextmenu",function(event){cfg.onContextMenu(event,_this15);event.preventDefault();});}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}return _createClass(Dot,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var dotStyle=this._dot.style;dotStyle["left"]=Math.round(x)-4+"px";dotStyle["top"]=Math.round(y)-4+"px";var dotClickableStyle=this._dotClickable.style;dotClickableStyle["left"]=Math.round(x)-9+"px";dotClickableStyle["top"]=Math.round(y)-9+"px";}},{key:"setFillColor",value:function setFillColor(color){this._dot.style.background=color||"lightgreen";}},{key:"setBorderColor",value:function setBorderColor(color){this._dot.style.border="solid 2px"+(color||"black");}},{key:"setOpacity",value:function setOpacity(opacity){this._dot.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._dot.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._dotClickable.style["pointer-events"]=!!clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._dot.classList.add(this._highlightClass);}else{this._dot.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(){this.setVisible(false);if(this._dot.parentElement){this._dot.parentElement.removeChild(this._dot);}if(this._dotClickable.parentElement){this._dotClickable.parentElement.removeChild(this._dotClickable);}}}]);}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this16=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Label);this._highlightClass="viewer-ruler-label-highlighted";this._prefix=cfg.prefix||"";this._x=0;this._y=0;this._visible=true;this._culled=false;this._label=document.createElement("div");this._label.className+=this._label.className?" viewer-ruler-label":"viewer-ruler-label";var label=this._label;var style=label.style;style["border-radius"]=5+"px";style.color="white";style.padding="4px";style.border="solid 1px";style.borderRadius="20px";style.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";style.fontSize="14px";style.visibility="visible";style.top=0+"px";style.left=0+"px";style["pointer-events"]="all";style["opacity"]=1.0;if(cfg.onContextMenu);label.innerText="";parentElement.appendChild(label);this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.fillColor);this.setText(cfg.text);if(cfg.onMouseOver){label.addEventListener("mouseover",function(event){cfg.onMouseOver(event,_this16);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener("mouseleave",function(event){cfg.onMouseLeave(event,_this16);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener("wheel",function(event){cfg.onMouseWheel(event,_this16);});}if(cfg.onMouseDown){label.addEventListener("mousedown",function(event){cfg.onMouseDown(event,_this16);});}if(cfg.onMouseClick){label.addEventListener("click",function(event){cfg.onMouseClick(event,_this16);});}if(cfg.onTouchStart){label.addEventListener("touchstart",function(event){cfg.onTouchStart(event,_this16);});}if(cfg.onMouseUp){label.addEventListener("mouseup",function(event){cfg.onMouseUp(event,_this16);});}if(cfg.onMouseMove){label.addEventListener("mousemove",function(event){cfg.onMouseMove(event,_this16);});}if(cfg.onContextMenu){label.addEventListener("contextmenu",function(event){cfg.onContextMenu(event,_this16);event.preventDefault();});}}return _createClass(Label,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var style=this._label.style;style["left"]=Math.round(x)-20+"px";style["top"]=Math.round(y)-12+"px";}},{key:"setPosOnWire",value:function setPosOnWire(x1,y1,x2,y2){var x=x1+(x2-x1)*0.5;var y=y1+(y2-y1)*0.5;var style=this._label.style;style["left"]=Math.round(x)-20+"px";style["top"]=Math.round(y)-12+"px";}},{key:"setPosBetweenWires",value:function setPosBetweenWires(x1,y1,x2,y2,x3,y3){var x=(x1+x2+x3)/3;var y=(y1+y2+y3)/3;var style=this._label.style;style["left"]=Math.round(x)-20+"px";style["top"]=Math.round(y)-12+"px";}},{key:"setText",value:function setText(text){this._label.innerHTML=this._prefix+(text||"");}},{key:"setFillColor",value:function setFillColor(color){this._fillColor=color||"lightgreen";this._label.style.background=this._fillColor;}},{key:"setBorderColor",value:function setBorderColor(color){this._borderColor=color||"white";this._label.style.border="solid 1px "+this._borderColor;}},{key:"setOpacity",value:function setOpacity(opacity){this._label.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._label.classList.add(this._highlightClass);}else{this._label.classList.remove(this._highlightClass);}}},{key:"setClickable",value:function setClickable(clickable){this._label.style["pointer-events"]=!!clickable?"all":"none";}},{key:"destroy",value:function destroy(){if(this._label.parentElement){this._label.parentElement.removeChild(this._label);}}}]);}();var originVec=math.vec3();var targetVec=math.vec3();/**
|
|
2750
2750
|
* @desc Measures the angle indicated by three 3D points.
|
|
2751
2751
|
*
|
|
@@ -11391,545 +11391,545 @@ if(geometryState.indicesBufCombined){geometryState.indicesBufCombined.bind();fra
|
|
|
11391
11391
|
* @implements {Entity}
|
|
11392
11392
|
* @implements {Drawable}
|
|
11393
11393
|
*/var Mesh=/*#__PURE__*/function(_Component24){/**
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11394
|
+
* @constructor
|
|
11395
|
+
* @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.
|
|
11396
|
+
* @param {*} [cfg] Configs
|
|
11397
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent scene, generated automatically when omitted.
|
|
11398
|
+
* @param {String} [cfg.originalSystemId] ID of the corresponding object within the originating system, if any.
|
|
11399
|
+
* @param {Boolean} [cfg.isModel] Specify ````true```` if this Mesh represents a model, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and may also have a corresponding {@link MetaModel} with matching {@link MetaModel#id}, registered by that ID in {@link MetaScene#metaModels}.
|
|
11400
|
+
* @param {Boolean} [cfg.isObject] Specify ````true```` if this Mesh represents an object, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#objects} and may also have a corresponding {@link MetaObject} with matching {@link MetaObject#id}, registered by that ID in {@link MetaScene#metaObjects}.
|
|
11401
|
+
* @param {Node} [cfg.parent] The parent Node.
|
|
11402
|
+
* @param {Number[]} [cfg.origin] World-space origin for this Mesh. When this is given, then ````matrix````, ````position```` and ````geometry```` are all assumed to be relative to this center.
|
|
11403
|
+
* @param {Number[]} [cfg.rtcCenter] Deprecated - renamed to ````origin````.
|
|
11404
|
+
* @param {Number[]} [cfg.position=[0,0,0]] 3D position of this Mesh, relative to ````origin````.
|
|
11405
|
+
* @param {Number[]} [cfg.scale=[1,1,1]] Local scale.
|
|
11406
|
+
* @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
11407
|
+
* @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Local modelling transform matrix. Overrides the position, scale and rotation parameters.
|
|
11408
|
+
* @param {Number[]} [cfg.offset=[0,0,0]] World-space 3D translation offset. Translates the Mesh in World space, after modelling transforms.
|
|
11409
|
+
* @param {Boolean} [cfg.occluder=true] Indicates if the Mesh is able to occlude {@link Marker}s.
|
|
11410
|
+
* @param {Boolean} [cfg.visible=true] Indicates if the Mesh is initially visible.
|
|
11411
|
+
* @param {Boolean} [cfg.culled=false] Indicates if the Mesh is initially culled from view.
|
|
11412
|
+
* @param {Boolean} [cfg.pickable=true] Indicates if the Mesh is initially pickable.
|
|
11413
|
+
* @param {Boolean} [cfg.clippable=true] Indicates if the Mesh is initially clippable.
|
|
11414
|
+
* @param {Boolean} [cfg.collidable=true] Indicates if the Mesh is initially included in boundary calculations.
|
|
11415
|
+
* @param {Boolean} [cfg.castsShadow=true] Indicates if the Mesh initially casts shadows.
|
|
11416
|
+
* @param {Boolean} [cfg.receivesShadow=true] Indicates if the Mesh initially receives shadows.
|
|
11417
|
+
* @param {Boolean} [cfg.xrayed=false] Indicates if the Mesh is initially xrayed.
|
|
11418
|
+
* @param {Boolean} [cfg.highlighted=false] Indicates if the Mesh is initially highlighted.
|
|
11419
|
+
* @param {Boolean} [cfg.selected=false] Indicates if the Mesh is initially selected.
|
|
11420
|
+
* @param {Boolean} [cfg.edges=false] Indicates if the Mesh's edges are initially emphasized.
|
|
11421
|
+
* @param {Boolean} [cfg.background=false] Indicates if the Mesh should act as background, e.g., it can be used for a skybox.
|
|
11422
|
+
* @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] Mesh's initial RGB colorize color, multiplies by the rendered fragment colors.
|
|
11423
|
+
* @param {Number} [cfg.opacity=1.0] Mesh's initial opacity factor, multiplies by the rendered fragment alpha.
|
|
11424
|
+
* @param {String} [cfg.billboard="none"] Mesh's billboarding behaviour. Options are "none" for no billboarding, "spherical" to always directly face {@link Camera.eye}, rotating both vertically and horizontally, or "cylindrical" to face the {@link Camera#eye} while rotating only about its vertically axis (use that mode for things like trees on a landscape).
|
|
11425
|
+
* @param {Geometry} [cfg.geometry] {@link Geometry} to define the shape of this Mesh. Inherits {@link Scene#geometry} by default.
|
|
11426
|
+
* @param {Material} [cfg.material] {@link Material} to define the normal rendered appearance for this Mesh. Inherits {@link Scene#material} by default.
|
|
11427
|
+
* @param {EmphasisMaterial} [cfg.xrayMaterial] {@link EmphasisMaterial} to define the xrayed appearance for this Mesh. Inherits {@link Scene#xrayMaterial} by default.
|
|
11428
|
+
* @param {EmphasisMaterial} [cfg.highlightMaterial] {@link EmphasisMaterial} to define the xrayed appearance for this Mesh. Inherits {@link Scene#highlightMaterial} by default.
|
|
11429
|
+
* @param {EmphasisMaterial} [cfg.selectedMaterial] {@link EmphasisMaterial} to define the selected appearance for this Mesh. Inherits {@link Scene#selectedMaterial} by default.
|
|
11430
|
+
* @param {EmphasisMaterial} [cfg.edgeMaterial] {@link EdgeMaterial} to define the appearance of enhanced edges for this Mesh. Inherits {@link Scene#edgeMaterial} by default.
|
|
11431
|
+
*/function Mesh(owner){var _this65;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Mesh);_this65=_callSuper(this,Mesh,[owner,cfg]);/**
|
|
11432
|
+
* ID of the corresponding object within the originating system, if any.
|
|
11433
|
+
*
|
|
11434
|
+
* @type {String}
|
|
11435
|
+
* @abstract
|
|
11436
|
+
*/_this65.originalSystemId=cfg.originalSystemId||_this65.id;/** @private **/_this65.renderFlags=new RenderFlags();_this65._state=new RenderState({// NOTE: Renderer gets modeling and normal matrices from Mesh#matrix and Mesh.#normalWorldMatrix
|
|
11437
11437
|
visible:true,culled:false,pickable:null,clippable:null,collidable:null,occluder:cfg.occluder!==false,castsShadow:null,receivesShadow:null,xrayed:false,highlighted:false,selected:false,edges:false,stationary:!!cfg.stationary,background:!!cfg.background,billboard:_this65._checkBillboard(cfg.billboard),layer:null,colorize:null,pickID:_this65.scene._renderer.getPickID(_this65),drawHash:"",pickHash:"",offset:math.vec3(),origin:null,originHash:null});_this65._drawRenderer=null;_this65._shadowRenderer=null;_this65._emphasisFillRenderer=null;_this65._emphasisEdgesRenderer=null;_this65._pickMeshRenderer=null;_this65._pickTriangleRenderer=null;_this65._occlusionRenderer=null;_this65._geometry=cfg.geometry?_this65._checkComponent2(["ReadableGeometry","VBOGeometry"],cfg.geometry):_this65.scene.geometry;_this65._material=cfg.material?_this65._checkComponent2(["PhongMaterial","MetallicMaterial","SpecularMaterial","LambertMaterial"],cfg.material):_this65.scene.material;_this65._xrayMaterial=cfg.xrayMaterial?_this65._checkComponent("EmphasisMaterial",cfg.xrayMaterial):_this65.scene.xrayMaterial;_this65._highlightMaterial=cfg.highlightMaterial?_this65._checkComponent("EmphasisMaterial",cfg.highlightMaterial):_this65.scene.highlightMaterial;_this65._selectedMaterial=cfg.selectedMaterial?_this65._checkComponent("EmphasisMaterial",cfg.selectedMaterial):_this65.scene.selectedMaterial;_this65._edgeMaterial=cfg.edgeMaterial?_this65._checkComponent("EdgeMaterial",cfg.edgeMaterial):_this65.scene.edgeMaterial;_this65._parentNode=null;_this65._aabb=null;_this65._aabbDirty=true;_this65._numTriangles=_this65._geometry?_this65._geometry.numTriangles:0;_this65.scene._aabbDirty=true;_this65._scale=math.vec3();_this65._quaternion=math.identityQuaternion();_this65._rotation=math.vec3();_this65._position=math.vec3();_this65._worldMatrix=math.identityMat4();_this65._worldNormalMatrix=math.identityMat4();_this65._localMatrixDirty=true;_this65._worldMatrixDirty=true;_this65._worldNormalMatrixDirty=true;var origin=cfg.origin||cfg.rtcCenter;if(origin){_this65._state.origin=math.vec3(origin);_this65._state.originHash=origin.join();}if(cfg.matrix){_this65.matrix=cfg.matrix;}else{_this65.scale=cfg.scale;_this65.position=cfg.position;if(cfg.quaternion);else{_this65.rotation=cfg.rotation;}}_this65._isObject=cfg.isObject;if(_this65._isObject){_this65.scene._registerObject(_this65);}_this65._isModel=cfg.isModel;if(_this65._isModel){_this65.scene._registerModel(_this65);}_this65.visible=cfg.visible;_this65.culled=cfg.culled;_this65.pickable=cfg.pickable;_this65.clippable=cfg.clippable;_this65.collidable=cfg.collidable;_this65.castsShadow=cfg.castsShadow;_this65.receivesShadow=cfg.receivesShadow;_this65.xrayed=cfg.xrayed;_this65.highlighted=cfg.highlighted;_this65.selected=cfg.selected;_this65.edges=cfg.edges;_this65.layer=cfg.layer;_this65.colorize=cfg.colorize;_this65.opacity=cfg.opacity;_this65.offset=cfg.offset;if(cfg.parentId){var parentNode=_this65.scene.components[cfg.parentId];if(!parentNode){_this65.error("Parent not found: '"+cfg.parentId+"'");}else if(!parentNode.isNode){_this65.error("Parent is not a Node: '"+cfg.parentId+"'");}else{parentNode.addChild(_this65);}_this65._parentNode=parentNode;}else if(cfg.parent){if(!cfg.parent.isNode){_this65.error("Parent is not a Node");}cfg.parent.addChild(_this65);_this65._parentNode=cfg.parent;}_this65.compile();return _this65;}/**
|
|
11438
11438
|
@private
|
|
11439
11439
|
*/_inherits(Mesh,_Component24);return _createClass(Mesh,[{key:"type",get:function get(){return"Mesh";}//------------------------------------------------------------------------------------------------------------------
|
|
11440
11440
|
// Mesh members
|
|
11441
11441
|
//------------------------------------------------------------------------------------------------------------------
|
|
11442
11442
|
/**
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
// Entity members
|
|
11706
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
11707
|
-
/**
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
// state is only used when picking
|
|
11721
|
-
}/**
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
}/**
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
}/**
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11443
|
+
* Returns true to indicate that this Component is a Mesh.
|
|
11444
|
+
* @final
|
|
11445
|
+
* @type {Boolean}
|
|
11446
|
+
*/},{key:"isMesh",get:function get(){return true;}/**
|
|
11447
|
+
* The parent Node.
|
|
11448
|
+
*
|
|
11449
|
+
* The parent Node may also be set by passing the Mesh to the parent's {@link Node#addChild} method.
|
|
11450
|
+
*
|
|
11451
|
+
* @type {Node}
|
|
11452
|
+
*/},{key:"parent",get:function get(){return this._parentNode;}/**
|
|
11453
|
+
* Defines the shape of this Mesh.
|
|
11454
|
+
*
|
|
11455
|
+
* Set to {@link Scene#geometry} by default.
|
|
11456
|
+
*
|
|
11457
|
+
* @type {Geometry}
|
|
11458
|
+
*/},{key:"geometry",get:function get(){return this._geometry;}/**
|
|
11459
|
+
* Defines the appearance of this Mesh when rendering normally, ie. when not xrayed, highlighted or selected.
|
|
11460
|
+
*
|
|
11461
|
+
* Set to {@link Scene#material} by default.
|
|
11462
|
+
*
|
|
11463
|
+
* @type {Material}
|
|
11464
|
+
*/},{key:"material",get:function get(){return this._material;}/**
|
|
11465
|
+
* Gets the Mesh's local translation.
|
|
11466
|
+
*
|
|
11467
|
+
* Default value is ````[0,0,0]````.
|
|
11468
|
+
*
|
|
11469
|
+
* @type {Number[]}
|
|
11470
|
+
*/},{key:"position",get:function get(){return this._position;}/**
|
|
11471
|
+
* Sets the Mesh's local translation.
|
|
11472
|
+
*
|
|
11473
|
+
* Default value is ````[0,0,0]````.
|
|
11474
|
+
*
|
|
11475
|
+
* @type {Number[]}
|
|
11476
|
+
*/,set:function set(value){this._position.set(value||[0,0,0]);this._setLocalMatrixDirty();this._setAABBDirty();this.glRedraw();}/**
|
|
11477
|
+
* Gets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
11478
|
+
*
|
|
11479
|
+
* Default value is ````[0,0,0]````.
|
|
11480
|
+
*
|
|
11481
|
+
* @type {Number[]}
|
|
11482
|
+
*/},{key:"rotation",get:function get(){return this._rotation;}/**
|
|
11483
|
+
* Sets the Mesh's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
11484
|
+
*
|
|
11485
|
+
* Default value is ````[0,0,0]````.
|
|
11486
|
+
*
|
|
11487
|
+
* @type {Number[]}
|
|
11488
|
+
*/,set:function set(value){this._rotation.set(value||[0,0,0]);math.eulerToQuaternion(this._rotation,"XYZ",this._quaternion);this._setLocalMatrixDirty();this._setAABBDirty();this.glRedraw();}/**
|
|
11489
|
+
* Gets the Mesh's local rotation quaternion.
|
|
11490
|
+
*
|
|
11491
|
+
* Default value is ````[0,0,0,1]````.
|
|
11492
|
+
*
|
|
11493
|
+
* @type {Number[]}
|
|
11494
|
+
*/},{key:"quaternion",get:function get(){return this._quaternion;}/**
|
|
11495
|
+
* Sets the Mesh's local rotation quaternion.
|
|
11496
|
+
*
|
|
11497
|
+
* Default value is ````[0,0,0,1]````.
|
|
11498
|
+
*
|
|
11499
|
+
* @type {Number[]}
|
|
11500
|
+
*/,set:function set(value){this._quaternion.set(value||[0,0,0,1]);math.quaternionToEuler(this._quaternion,"XYZ",this._rotation);this._setLocalMatrixDirty();this._setAABBDirty();this.glRedraw();}/**
|
|
11501
|
+
* Gets the Mesh's local scale.
|
|
11502
|
+
*
|
|
11503
|
+
* Default value is ````[1,1,1]````.
|
|
11504
|
+
*
|
|
11505
|
+
* @type {Number[]}
|
|
11506
|
+
*/},{key:"scale",get:function get(){return this._scale;}/**
|
|
11507
|
+
* Sets the Mesh's local scale.
|
|
11508
|
+
*
|
|
11509
|
+
* Default value is ````[1,1,1]````.
|
|
11510
|
+
*
|
|
11511
|
+
* @type {Number[]}
|
|
11512
|
+
*/,set:function set(value){this._scale.set(value||[1,1,1]);this._setLocalMatrixDirty();this._setAABBDirty();this.glRedraw();}/**
|
|
11513
|
+
* Gets the Mesh's local modeling transform matrix.
|
|
11514
|
+
*
|
|
11515
|
+
* Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.
|
|
11516
|
+
*
|
|
11517
|
+
* @type {Number[]}
|
|
11518
|
+
*/},{key:"matrix",get:function get(){if(this._localMatrixDirty){if(!this.__localMatrix){this.__localMatrix=math.identityMat4();}math.composeMat4(this._position,this._quaternion,this._scale,this.__localMatrix);this._localMatrixDirty=false;}return this.__localMatrix;}/**
|
|
11519
|
+
* Sets the Mesh's local modeling transform matrix.
|
|
11520
|
+
*
|
|
11521
|
+
* Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.
|
|
11522
|
+
*
|
|
11523
|
+
* @type {Number[]}
|
|
11524
|
+
*/,set:function set(value){if(!this.__localMatrix){this.__localMatrix=math.identityMat4();}this.__localMatrix.set(value||identityMat$2);math.decomposeMat4(this.__localMatrix,this._position,this._quaternion,this._scale);this._localMatrixDirty=false;this._setWorldMatrixDirty();this._setAABBDirty();this.glRedraw();}/**
|
|
11525
|
+
* Gets the Mesh's World matrix.
|
|
11526
|
+
*
|
|
11527
|
+
* @property worldMatrix
|
|
11528
|
+
* @type {Number[]}
|
|
11529
|
+
*/},{key:"worldMatrix",get:function get(){if(this._worldMatrixDirty){this._buildWorldMatrix();}return this._worldMatrix;}/**
|
|
11530
|
+
* Gets the Mesh's World normal matrix.
|
|
11531
|
+
*
|
|
11532
|
+
* @type {Number[]}
|
|
11533
|
+
*/},{key:"worldNormalMatrix",get:function get(){if(this._worldNormalMatrixDirty){this._buildWorldNormalMatrix();}return this._worldNormalMatrix;}/**
|
|
11534
|
+
* Returns true to indicate that Mesh implements {@link Entity}.
|
|
11535
|
+
*
|
|
11536
|
+
* @returns {Boolean}
|
|
11537
|
+
*/},{key:"isEntity",get:function get(){return true;}/**
|
|
11538
|
+
* Returns ````true```` if this Mesh represents a model.
|
|
11539
|
+
*
|
|
11540
|
+
* When this returns ````true````, the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and
|
|
11541
|
+
* may also have a corresponding {@link MetaModel}.
|
|
11542
|
+
*
|
|
11543
|
+
* @type {Boolean}
|
|
11544
|
+
*/},{key:"isModel",get:function get(){return this._isModel;}/**
|
|
11545
|
+
* Returns ````true```` if this Mesh represents an object.
|
|
11546
|
+
*
|
|
11547
|
+
* When this returns ````true````, the Mesh will be registered by {@link Mesh#id} in {@link Scene#objects} and
|
|
11548
|
+
* may also have a corresponding {@link MetaObject}.
|
|
11549
|
+
*
|
|
11550
|
+
* @type {Boolean}
|
|
11551
|
+
*/},{key:"isObject",get:function get(){return this._isObject;}/**
|
|
11552
|
+
* Gets the Mesh's World-space 3D axis-aligned bounding box.
|
|
11553
|
+
*
|
|
11554
|
+
* Represented by a six-element Float64Array containing the min/max extents of the
|
|
11555
|
+
* axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
|
|
11556
|
+
*
|
|
11557
|
+
* @type {Number[]}
|
|
11558
|
+
*/},{key:"aabb",get:function get(){if(this._aabbDirty){this._updateAABB();}return this._aabb;}/**
|
|
11559
|
+
* Gets the 3D origin of the Mesh's {@link Geometry}'s vertex positions.
|
|
11560
|
+
*
|
|
11561
|
+
* When this is given, then {@link Mesh#matrix}, {@link Mesh#position} and {@link Mesh#geometry} are all assumed to be relative to this center position.
|
|
11562
|
+
*
|
|
11563
|
+
* @type {Float64Array}
|
|
11564
|
+
*/},{key:"origin",get:function get(){return this._state.origin;}/**
|
|
11565
|
+
* Sets the 3D origin of the Mesh's {@link Geometry}'s vertex positions.
|
|
11566
|
+
*
|
|
11567
|
+
* When this is given, then {@link Mesh#matrix}, {@link Mesh#position} and {@link Mesh#geometry} are all assumed to be relative to this center position.
|
|
11568
|
+
*
|
|
11569
|
+
* @type {Float64Array}
|
|
11570
|
+
*/,set:function set(origin){if(origin){if(!this._state.origin){this._state.origin=math.vec3();}this._state.origin.set(origin);this._state.originHash=origin.join();this._setAABBDirty();this.scene._aabbDirty=true;}else{if(this._state.origin){this._state.origin=null;this._state.originHash=null;this._setAABBDirty();this.scene._aabbDirty=true;}}}/**
|
|
11571
|
+
* Gets the World-space origin for this Mesh.
|
|
11572
|
+
*
|
|
11573
|
+
* Deprecated and replaced by {@link Mesh#origin}.
|
|
11574
|
+
*
|
|
11575
|
+
* @deprecated
|
|
11576
|
+
* @type {Float64Array}
|
|
11577
|
+
*/},{key:"rtcCenter",get:function get(){return this.origin;}/**
|
|
11578
|
+
* Sets the World-space origin for this Mesh.
|
|
11579
|
+
*
|
|
11580
|
+
* Deprecated and replaced by {@link Mesh#origin}.
|
|
11581
|
+
*
|
|
11582
|
+
* @deprecated
|
|
11583
|
+
* @type {Float64Array}
|
|
11584
|
+
*/,set:function set(rtcCenter){this.origin=rtcCenter;}/**
|
|
11585
|
+
* The approximate number of triangles in this Mesh.
|
|
11586
|
+
*
|
|
11587
|
+
* @type {Number}
|
|
11588
|
+
*/},{key:"numTriangles",get:function get(){return this._numTriangles;}/**
|
|
11589
|
+
* Gets if this Mesh is visible.
|
|
11590
|
+
*
|
|
11591
|
+
* Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.
|
|
11592
|
+
*
|
|
11593
|
+
* When {@link Mesh#isObject} and {@link Mesh#visible} are both ````true```` the Mesh will be
|
|
11594
|
+
* registered by {@link Mesh#id} in {@link Scene#visibleObjects}.
|
|
11595
|
+
*
|
|
11596
|
+
* @type {Boolean}
|
|
11597
|
+
*/},{key:"visible",get:function get(){return this._state.visible;}/**
|
|
11598
|
+
* Sets if this Mesh is visible.
|
|
11599
|
+
*
|
|
11600
|
+
* Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.
|
|
11601
|
+
*
|
|
11602
|
+
* When {@link Mesh#isObject} and {@link Mesh#visible} are both ````true```` the Mesh will be
|
|
11603
|
+
* registered by {@link Mesh#id} in {@link Scene#visibleObjects}.
|
|
11604
|
+
*
|
|
11605
|
+
* @type {Boolean}
|
|
11606
|
+
*/,set:function set(visible){visible=visible!==false;this._state.visible=visible;if(this._isObject){this.scene._objectVisibilityUpdated(this,visible);}this.glRedraw();}/**
|
|
11607
|
+
* Gets if this Mesh is xrayed.
|
|
11608
|
+
*
|
|
11609
|
+
* XRayed appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#xrayMaterial}.
|
|
11610
|
+
*
|
|
11611
|
+
* When {@link Mesh#isObject} and {@link Mesh#xrayed} are both ````true``` the Mesh will be
|
|
11612
|
+
* registered by {@link Mesh#id} in {@link Scene#xrayedObjects}.
|
|
11613
|
+
*
|
|
11614
|
+
* @type {Boolean}
|
|
11615
|
+
*/},{key:"xrayed",get:function get(){return this._state.xrayed;}/**
|
|
11616
|
+
* Sets if this Mesh is xrayed.
|
|
11617
|
+
*
|
|
11618
|
+
* XRayed appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#xrayMaterial}.
|
|
11619
|
+
*
|
|
11620
|
+
* When {@link Mesh#isObject} and {@link Mesh#xrayed} are both ````true``` the Mesh will be
|
|
11621
|
+
* registered by {@link Mesh#id} in {@link Scene#xrayedObjects}.
|
|
11622
|
+
*
|
|
11623
|
+
* @type {Boolean}
|
|
11624
|
+
*/,set:function set(xrayed){xrayed=!!xrayed;if(this._state.xrayed===xrayed){return;}this._state.xrayed=xrayed;if(this._isObject){this.scene._objectXRayedUpdated(this,xrayed);}this.glRedraw();}/**
|
|
11625
|
+
* Gets if this Mesh is highlighted.
|
|
11626
|
+
*
|
|
11627
|
+
* Highlighted appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#highlightMaterial}.
|
|
11628
|
+
*
|
|
11629
|
+
* When {@link Mesh#isObject} and {@link Mesh#highlighted} are both ````true```` the Mesh will be
|
|
11630
|
+
* registered by {@link Mesh#id} in {@link Scene#highlightedObjects}.
|
|
11631
|
+
*
|
|
11632
|
+
* @type {Boolean}
|
|
11633
|
+
*/},{key:"highlighted",get:function get(){return this._state.highlighted;}/**
|
|
11634
|
+
* Sets if this Mesh is highlighted.
|
|
11635
|
+
*
|
|
11636
|
+
* Highlighted appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#highlightMaterial}.
|
|
11637
|
+
*
|
|
11638
|
+
* When {@link Mesh#isObject} and {@link Mesh#highlighted} are both ````true```` the Mesh will be
|
|
11639
|
+
* registered by {@link Mesh#id} in {@link Scene#highlightedObjects}.
|
|
11640
|
+
*
|
|
11641
|
+
* @type {Boolean}
|
|
11642
|
+
*/,set:function set(highlighted){highlighted=!!highlighted;if(highlighted===this._state.highlighted){return;}this._state.highlighted=highlighted;if(this._isObject){this.scene._objectHighlightedUpdated(this,highlighted);}this.glRedraw();}/**
|
|
11643
|
+
* Gets if this Mesh is selected.
|
|
11644
|
+
*
|
|
11645
|
+
* Selected appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#selectedMaterial}.
|
|
11646
|
+
*
|
|
11647
|
+
* When {@link Mesh#isObject} and {@link Mesh#selected} are both ````true``` the Mesh will be
|
|
11648
|
+
* registered by {@link Mesh#id} in {@link Scene#selectedObjects}.
|
|
11649
|
+
*
|
|
11650
|
+
* @type {Boolean}
|
|
11651
|
+
*/},{key:"selected",get:function get(){return this._state.selected;}/**
|
|
11652
|
+
* Sets if this Mesh is selected.
|
|
11653
|
+
*
|
|
11654
|
+
* Selected appearance is configured by the {@link EmphasisMaterial} referenced by {@link Mesh#selectedMaterial}.
|
|
11655
|
+
*
|
|
11656
|
+
* When {@link Mesh#isObject} and {@link Mesh#selected} are both ````true``` the Mesh will be
|
|
11657
|
+
* registered by {@link Mesh#id} in {@link Scene#selectedObjects}.
|
|
11658
|
+
*
|
|
11659
|
+
* @type {Boolean}
|
|
11660
|
+
*/,set:function set(selected){selected=!!selected;if(selected===this._state.selected){return;}this._state.selected=selected;if(this._isObject){this.scene._objectSelectedUpdated(this,selected);}this.glRedraw();}/**
|
|
11661
|
+
* Gets if this Mesh is edge-enhanced.
|
|
11662
|
+
*
|
|
11663
|
+
* Edge appearance is configured by the {@link EdgeMaterial} referenced by {@link Mesh#edgeMaterial}.
|
|
11664
|
+
*
|
|
11665
|
+
* @type {Boolean}
|
|
11666
|
+
*/},{key:"edges",get:function get(){return this._state.edges;}/**
|
|
11667
|
+
* Sets if this Mesh is edge-enhanced.
|
|
11668
|
+
*
|
|
11669
|
+
* Edge appearance is configured by the {@link EdgeMaterial} referenced by {@link Mesh#edgeMaterial}.
|
|
11670
|
+
*
|
|
11671
|
+
* @type {Boolean}
|
|
11672
|
+
*/,set:function set(edges){edges=!!edges;if(edges===this._state.edges){return;}this._state.edges=edges;this.glRedraw();}/**
|
|
11673
|
+
* Gets if this Mesh is culled.
|
|
11674
|
+
*
|
|
11675
|
+
* Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.
|
|
11676
|
+
*
|
|
11677
|
+
* @type {Boolean}
|
|
11678
|
+
*/},{key:"culled",get:function get(){return this._state.culled;}/**
|
|
11679
|
+
* Sets if this Mesh is culled.
|
|
11680
|
+
*
|
|
11681
|
+
* Only rendered when {@link Mesh#visible} is ````true```` and {@link Mesh#culled} is ````false````.
|
|
11682
|
+
*
|
|
11683
|
+
* @type {Boolean}
|
|
11684
|
+
*/,set:function set(value){this._state.culled=!!value;this.glRedraw();}/**
|
|
11685
|
+
* Gets if this Mesh is clippable.
|
|
11686
|
+
*
|
|
11687
|
+
* Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
|
|
11688
|
+
*
|
|
11689
|
+
* @type {Boolean}
|
|
11690
|
+
*/},{key:"clippable",get:function get(){return this._state.clippable;}/**
|
|
11691
|
+
* Sets if this Mesh is clippable.
|
|
11692
|
+
*
|
|
11693
|
+
* Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
|
|
11694
|
+
*
|
|
11695
|
+
* @type {Boolean}
|
|
11696
|
+
*/,set:function set(value){value=value!==false;if(this._state.clippable===value){return;}this._state.clippable=value;this.glRedraw();}/**
|
|
11697
|
+
* Gets if this Mesh included in boundary calculations.
|
|
11698
|
+
*
|
|
11699
|
+
* @type {Boolean}
|
|
11700
|
+
*/},{key:"collidable",get:function get(){return this._state.collidable;}/**
|
|
11701
|
+
* Sets if this Mesh included in boundary calculations.
|
|
11702
|
+
*
|
|
11703
|
+
* @type {Boolean}
|
|
11704
|
+
*/,set:function set(value){value=value!==false;if(value===this._state.collidable){return;}this._state.collidable=value;this._setAABBDirty();this.scene._aabbDirty=true;}//------------------------------------------------------------------------------------------------------------------
|
|
11705
|
+
// Entity members
|
|
11706
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
11707
|
+
/**
|
|
11708
|
+
* Gets if this Mesh is pickable.
|
|
11709
|
+
*
|
|
11710
|
+
* Picking is done via calls to {@link Scene#pick}.
|
|
11711
|
+
*
|
|
11712
|
+
* @type {Boolean}
|
|
11713
|
+
*/},{key:"pickable",get:function get(){return this._state.pickable;}/**
|
|
11714
|
+
* Sets if this Mesh is pickable.
|
|
11715
|
+
*
|
|
11716
|
+
* Picking is done via calls to {@link Scene#pick}.
|
|
11717
|
+
*
|
|
11718
|
+
* @type {Boolean}
|
|
11719
|
+
*/,set:function set(value){value=value!==false;if(this._state.pickable===value){return;}this._state.pickable=value;// No need to trigger a render;
|
|
11720
|
+
// state is only used when picking
|
|
11721
|
+
}/**
|
|
11722
|
+
* Gets if this Mesh casts shadows.
|
|
11723
|
+
*
|
|
11724
|
+
* @type {Boolean}
|
|
11725
|
+
*/},{key:"castsShadow",get:function get(){return this._state.castsShadow;}/**
|
|
11726
|
+
* Sets if this Mesh casts shadows.
|
|
11727
|
+
*
|
|
11728
|
+
* @type {Boolean}
|
|
11729
|
+
*/,set:function set(value){value=value!==false;if(value===this._state.castsShadow){return;}this._state.castsShadow=value;this.glRedraw();}/**
|
|
11730
|
+
* Gets if this Mesh can have shadows cast upon it.
|
|
11731
|
+
*
|
|
11732
|
+
* @type {Boolean}
|
|
11733
|
+
*/},{key:"receivesShadow",get:function get(){return this._state.receivesShadow;}/**
|
|
11734
|
+
* Sets if this Mesh can have shadows cast upon it.
|
|
11735
|
+
*
|
|
11736
|
+
* @type {Boolean}
|
|
11737
|
+
*/,set:function set(value){value=value!==false;if(value===this._state.receivesShadow){return;}this._state.receivesShadow=value;this._state.hash=value?"/mod/rs;":"/mod;";this.fire("dirty",this);// Now need to (re)compile objectRenderers to include/exclude shadow mapping
|
|
11738
|
+
}/**
|
|
11739
|
+
* Gets if this Mesh can have Scalable Ambient Obscurance (SAO) applied to it.
|
|
11740
|
+
*
|
|
11741
|
+
* SAO is configured by {@link SAO}.
|
|
11742
|
+
*
|
|
11743
|
+
* @type {Boolean}
|
|
11744
|
+
* @abstract
|
|
11745
|
+
*/},{key:"saoEnabled",get:function get(){return false;// TODO: Support SAO on Meshes
|
|
11746
|
+
}/**
|
|
11747
|
+
* Gets the RGB colorize color for this Mesh.
|
|
11748
|
+
*
|
|
11749
|
+
* Multiplies by rendered fragment colors.
|
|
11750
|
+
*
|
|
11751
|
+
* Each element of the color is in range ````[0..1]````.
|
|
11752
|
+
*
|
|
11753
|
+
* @type {Number[]}
|
|
11754
|
+
*/},{key:"colorize",get:function get(){return this._state.colorize;}/**
|
|
11755
|
+
* Sets the RGB colorize color for this Mesh.
|
|
11756
|
+
*
|
|
11757
|
+
* Multiplies by rendered fragment colors.
|
|
11758
|
+
*
|
|
11759
|
+
* Each element of the color is in range ````[0..1]````.
|
|
11760
|
+
*
|
|
11761
|
+
* @type {Number[]}
|
|
11762
|
+
*/,set:function set(value){var colorize=this._state.colorize;if(!colorize){colorize=this._state.colorize=new Float32Array(4);colorize[3]=1;}if(value){colorize[0]=value[0];colorize[1]=value[1];colorize[2]=value[2];}else{colorize[0]=1;colorize[1]=1;colorize[2]=1;}var colorized=!!value;this.scene._objectColorizeUpdated(this,colorized);this.glRedraw();}/**
|
|
11763
|
+
* Gets the opacity factor for this Mesh.
|
|
11764
|
+
*
|
|
11765
|
+
* This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
|
|
11766
|
+
*
|
|
11767
|
+
* @type {Number}
|
|
11768
|
+
*/},{key:"opacity",get:function get(){return this._state.colorize[3];}/**
|
|
11769
|
+
* Sets the opacity factor for this Mesh.
|
|
11770
|
+
*
|
|
11771
|
+
* This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
|
|
11772
|
+
*
|
|
11773
|
+
* @type {Number}
|
|
11774
|
+
*/,set:function set(opacity){var colorize=this._state.colorize;if(!colorize){colorize=this._state.colorize=new Float32Array(4);colorize[0]=1;colorize[1]=1;colorize[2]=1;}var opacityUpdated=opacity!==null&&opacity!==undefined;colorize[3]=opacityUpdated?opacity:1.0;this.scene._objectOpacityUpdated(this,opacityUpdated);this.glRedraw();}/**
|
|
11775
|
+
* Gets if this Mesh is transparent.
|
|
11776
|
+
* @returns {Boolean}
|
|
11777
|
+
*/},{key:"transparent",get:function get(){return this._material.alphaMode===2/* blend */||this._state.colorize[3]<1;}/**
|
|
11778
|
+
* Gets the Mesh's rendering order relative to other Meshes.
|
|
11779
|
+
*
|
|
11780
|
+
* Default value is ````0````.
|
|
11781
|
+
*
|
|
11782
|
+
* This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.
|
|
11783
|
+
*
|
|
11784
|
+
* @type {Number}
|
|
11785
|
+
*/},{key:"layer",get:function get(){return this._state.layer;}/**
|
|
11786
|
+
* Sets the Mesh's rendering order relative to other Meshes.
|
|
11787
|
+
*
|
|
11788
|
+
* Default value is ````0````.
|
|
11789
|
+
*
|
|
11790
|
+
* This can be set on multiple transparent Meshes, to make them render in a specific order for correct alpha blending.
|
|
11791
|
+
*
|
|
11792
|
+
* @type {Number}
|
|
11793
|
+
*/,set:function set(value){// TODO: Only accept rendering layer in range [0...MAX_layer]
|
|
11794
11794
|
value=value||0;value=Math.round(value);if(value===this._state.layer){return;}this._state.layer=value;this._renderer.needStateSort();}/**
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11795
|
+
* Gets if the Node's position is stationary.
|
|
11796
|
+
*
|
|
11797
|
+
* When true, will disable the effect of {@link Camera} translations for this Mesh, while still allowing it to rotate. This is useful for skyboxes.
|
|
11798
|
+
*
|
|
11799
|
+
* @type {Boolean}
|
|
11800
|
+
*/},{key:"stationary",get:function get(){return this._state.stationary;}/**
|
|
11801
|
+
* Gets the Node's billboarding behaviour.
|
|
11802
|
+
*
|
|
11803
|
+
* Options are:
|
|
11804
|
+
* * ````"none"```` - (default) - No billboarding.
|
|
11805
|
+
* * ````"spherical"```` - Mesh is billboarded to face the viewpoint, rotating both vertically and horizontally.
|
|
11806
|
+
* * ````"cylindrical"```` - Mesh is billboarded to face the viewpoint, rotating only about its vertically axis. Use this mode for things like trees on a landscape.
|
|
11807
|
+
* @type {String}
|
|
11808
|
+
*/},{key:"billboard",get:function get(){return this._state.billboard;}/**
|
|
11809
|
+
* Gets the Mesh's 3D World-space offset.
|
|
11810
|
+
*
|
|
11811
|
+
* Default value is ````[0,0,0]````.
|
|
11812
|
+
*
|
|
11813
|
+
* @type {Number[]}
|
|
11814
|
+
*/},{key:"offset",get:function get(){return this._state.offset;}/**
|
|
11815
|
+
* Sets the Mesh's 3D World-space offset.
|
|
11816
|
+
*
|
|
11817
|
+
* The offset dynamically translates the Mesh in World-space.
|
|
11818
|
+
*
|
|
11819
|
+
* Default value is ````[0, 0, 0]````.
|
|
11820
|
+
*
|
|
11821
|
+
* Provide a null or undefined value to reset to the default value.
|
|
11822
|
+
*
|
|
11823
|
+
* @type {Number[]}
|
|
11824
|
+
*/,set:function set(value){this._state.offset.set(value||[0,0,0]);this._setAABBDirty();this.glRedraw();}/**
|
|
11825
|
+
* Returns true to indicate that Mesh implements {@link Drawable}.
|
|
11826
|
+
* @final
|
|
11827
|
+
* @type {Boolean}
|
|
11828
|
+
*/},{key:"isDrawable",get:function get(){return true;}/**
|
|
11829
|
+
* Property with final value ````true```` to indicate that xeokit should render this Mesh in sorted order, relative to other Meshes.
|
|
11830
|
+
*
|
|
11831
|
+
* The sort order is determined by {@link Mesh#stateSortCompare}.
|
|
11832
|
+
*
|
|
11833
|
+
* Sorting is essential for rendering performance, so that xeokit is able to avoid applying runs of the same state changes to the GPU, ie. can collapse them.
|
|
11834
|
+
*
|
|
11835
|
+
* @type {Boolean}
|
|
11836
|
+
*/},{key:"isStateSortable",get:function get(){return true;}/**
|
|
11837
|
+
* Defines the appearance of this Mesh when xrayed.
|
|
11838
|
+
*
|
|
11839
|
+
* Mesh is xrayed when {@link Mesh#xrayed} is ````true````.
|
|
11840
|
+
*
|
|
11841
|
+
* Set to {@link Scene#xrayMaterial} by default.
|
|
11842
|
+
*
|
|
11843
|
+
* @type {EmphasisMaterial}
|
|
11844
|
+
*/},{key:"xrayMaterial",get:function get(){return this._xrayMaterial;}/**
|
|
11845
|
+
* Defines the appearance of this Mesh when highlighted.
|
|
11846
|
+
*
|
|
11847
|
+
* Mesh is xrayed when {@link Mesh#highlighted} is ````true````.
|
|
11848
|
+
*
|
|
11849
|
+
* Set to {@link Scene#highlightMaterial} by default.
|
|
11850
|
+
*
|
|
11851
|
+
* @type {EmphasisMaterial}
|
|
11852
|
+
*/},{key:"highlightMaterial",get:function get(){return this._highlightMaterial;}/**
|
|
11853
|
+
* Defines the appearance of this Mesh when selected.
|
|
11854
|
+
*
|
|
11855
|
+
* Mesh is xrayed when {@link Mesh#selected} is ````true````.
|
|
11856
|
+
*
|
|
11857
|
+
* Set to {@link Scene#selectedMaterial} by default.
|
|
11858
|
+
*
|
|
11859
|
+
* @type {EmphasisMaterial}
|
|
11860
|
+
*/},{key:"selectedMaterial",get:function get(){return this._selectedMaterial;}/**
|
|
11861
|
+
* Defines the appearance of this Mesh when edges are enhanced.
|
|
11862
|
+
*
|
|
11863
|
+
* Mesh is xrayed when {@link Mesh#edges} is ````true````.
|
|
11864
|
+
*
|
|
11865
|
+
* Set to {@link Scene#edgeMaterial} by default.
|
|
11866
|
+
*
|
|
11867
|
+
* @type {EdgeMaterial}
|
|
11868
|
+
*/},{key:"edgeMaterial",get:function get(){return this._edgeMaterial;}},{key:"_checkBillboard",value:function _checkBillboard(value){value=value||"none";if(value!=="spherical"&&value!=="cylindrical"&&value!=="none"){this.error("Unsupported value for 'billboard': "+value+" - accepted values are "+"'spherical', 'cylindrical' and 'none' - defaulting to 'none'.");value="none";}return value;}/**
|
|
11869
|
+
* Called by xeokit to compile shaders for this Mesh.
|
|
11870
|
+
* @private
|
|
11871
|
+
*/},{key:"compile",value:function compile(){var drawHash=this._makeDrawHash();if(this._state.drawHash!==drawHash){this._state.drawHash=drawHash;this._putDrawRenderers();this._drawRenderer=DrawRenderer.get(this);// this._shadowRenderer = ShadowRenderer.get(this);
|
|
11872
11872
|
this._emphasisFillRenderer=EmphasisFillRenderer.get(this);this._emphasisEdgesRenderer=EmphasisEdgesRenderer.get(this);}var pickHash=this._makePickHash();if(this._state.pickHash!==pickHash){this._state.pickHash=pickHash;this._putPickRenderers();this._pickMeshRenderer=PickMeshRenderer.get(this);}if(this._state.occluder){var occlusionHash=this._makeOcclusionHash();if(this._state.occlusionHash!==occlusionHash){this._state.occlusionHash=occlusionHash;this._putOcclusionRenderer();this._occlusionRenderer=OcclusionRenderer.get(this);}}}},{key:"_setLocalMatrixDirty",value:function _setLocalMatrixDirty(){this._localMatrixDirty=true;this._setWorldMatrixDirty();}},{key:"_setWorldMatrixDirty",value:function _setWorldMatrixDirty(){this._worldMatrixDirty=true;this._worldNormalMatrixDirty=true;}},{key:"_buildWorldMatrix",value:function _buildWorldMatrix(){var localMatrix=this.matrix;if(!this._parentNode){for(var _i132=0,len=localMatrix.length;_i132<len;_i132++){this._worldMatrix[_i132]=localMatrix[_i132];}}else{math.mulMat4(this._parentNode.worldMatrix,localMatrix,this._worldMatrix);}this._worldMatrixDirty=false;}},{key:"_buildWorldNormalMatrix",value:function _buildWorldNormalMatrix(){if(this._worldMatrixDirty){this._buildWorldMatrix();}if(!this._worldNormalMatrix){this._worldNormalMatrix=math.mat4();}// Note: order of inverse and transpose doesn't matter
|
|
11873
11873
|
math.transposeMat4(this._worldMatrix,this._worldNormalMatrix);math.inverseMat4(this._worldNormalMatrix);this._worldNormalMatrixDirty=false;}},{key:"_setAABBDirty",value:function _setAABBDirty(){if(this.collidable){for(var node=this;node;node=node._parentNode){node._aabbDirty=true;}}}},{key:"_updateAABB",value:function _updateAABB(){this.scene._aabbDirty=true;if(!this._aabb){this._aabb=math.AABB3();}this._buildAABB(this.worldMatrix,this._aabb);// Mesh or VBOSceneModel
|
|
11874
11874
|
this._aabbDirty=false;}},{key:"_webglContextRestored",value:function _webglContextRestored(){if(this._drawRenderer){this._drawRenderer.webglContextRestored();}if(this._shadowRenderer){this._shadowRenderer.webglContextRestored();}if(this._emphasisFillRenderer){this._emphasisFillRenderer.webglContextRestored();}if(this._emphasisEdgesRenderer){this._emphasisEdgesRenderer.webglContextRestored();}if(this._pickMeshRenderer){this._pickMeshRenderer.webglContextRestored();}if(this._pickTriangleRenderer){this._pickMeshRenderer.webglContextRestored();}if(this._occlusionRenderer){this._occlusionRenderer.webglContextRestored();}}},{key:"_makeDrawHash",value:function _makeDrawHash(){var scene=this.scene;var hash=[scene.canvas.canvas.id,(scene.gammaInput?"gi;":";")+(scene.gammaOutput?"go":""),scene._lightsState.getHash(),scene._sectionPlanesState.getHash()];var state=this._state;if(state.stationary){hash.push("/s");}if(state.billboard==="none"){hash.push("/n");}else if(state.billboard==="spherical"){hash.push("/s");}else if(state.billboard==="cylindrical"){hash.push("/c");}if(state.receivesShadow){hash.push("/rs");}hash.push(";");return hash.join("");}},{key:"_makePickHash",value:function _makePickHash(){var scene=this.scene;var hash=[scene.canvas.canvas.id,scene._sectionPlanesState.getHash()];var state=this._state;if(state.stationary){hash.push("/s");}if(state.billboard==="none"){hash.push("/n");}else if(state.billboard==="spherical"){hash.push("/s");}else if(state.billboard==="cylindrical"){hash.push("/c");}hash.push(";");return hash.join("");}},{key:"_makeOcclusionHash",value:function _makeOcclusionHash(){var scene=this.scene;var hash=[scene.canvas.canvas.id,scene._sectionPlanesState.getHash()];var state=this._state;if(state.stationary){hash.push("/s");}if(state.billboard==="none"){hash.push("/n");}else if(state.billboard==="spherical"){hash.push("/s");}else if(state.billboard==="cylindrical"){hash.push("/c");}hash.push(";");return hash.join("");}},{key:"_buildAABB",value:function _buildAABB(worldMatrix,aabb){math.transformOBB3(worldMatrix,this._geometry.obb,obb);math.OBB3ToAABB3(obb,aabb);var offset=this._state.offset;aabb[0]+=offset[0];aabb[1]+=offset[1];aabb[2]+=offset[2];aabb[3]+=offset[0];aabb[4]+=offset[1];aabb[5]+=offset[2];if(this._state.origin){var origin=this._state.origin;aabb[0]+=origin[0];aabb[1]+=origin[1];aabb[2]+=origin[2];aabb[3]+=origin[0];aabb[4]+=origin[1];aabb[5]+=origin[2];}}/**
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11875
|
+
* Rotates the Mesh about the given local axis by the given increment.
|
|
11876
|
+
*
|
|
11877
|
+
* @param {Number[]} axis Local axis about which to rotate.
|
|
11878
|
+
* @param {Number} angle Angle increment in degrees.
|
|
11879
|
+
*/},{key:"rotate",value:function rotate(axis,angle){angleAxis$2[0]=axis[0];angleAxis$2[1]=axis[1];angleAxis$2[2]=axis[2];angleAxis$2[3]=angle*math.DEGTORAD;math.angleAxisToQuaternion(angleAxis$2,q1$2);math.mulQuaternions(this.quaternion,q1$2,q2$2);this.quaternion=q2$2;this._setLocalMatrixDirty();this._setAABBDirty();this.glRedraw();return this;}/**
|
|
11880
|
+
* Rotates the Mesh about the given World-space axis by the given increment.
|
|
11881
|
+
*
|
|
11882
|
+
* @param {Number[]} axis Local axis about which to rotate.
|
|
11883
|
+
* @param {Number} angle Angle increment in degrees.
|
|
11884
|
+
*/},{key:"rotateOnWorldAxis",value:function rotateOnWorldAxis(axis,angle){angleAxis$2[0]=axis[0];angleAxis$2[1]=axis[1];angleAxis$2[2]=axis[2];angleAxis$2[3]=angle*math.DEGTORAD;math.angleAxisToQuaternion(angleAxis$2,q1$2);math.mulQuaternions(q1$2,this.quaternion,q1$2);//this.quaternion.premultiply(q1);
|
|
11885
11885
|
return this;}/**
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11886
|
+
* Rotates the Mesh about the local X-axis by the given increment.
|
|
11887
|
+
*
|
|
11888
|
+
* @param {Number} angle Angle increment in degrees.
|
|
11889
|
+
*/},{key:"rotateX",value:function rotateX(angle){return this.rotate(xAxis$2,angle);}/**
|
|
11890
|
+
* Rotates the Mesh about the local Y-axis by the given increment.
|
|
11891
|
+
*
|
|
11892
|
+
* @param {Number} angle Angle increment in degrees.
|
|
11893
|
+
*/},{key:"rotateY",value:function rotateY(angle){return this.rotate(yAxis$2,angle);}/**
|
|
11894
|
+
* Rotates the Mesh about the local Z-axis by the given increment.
|
|
11895
|
+
*
|
|
11896
|
+
* @param {Number} angle Angle increment in degrees.
|
|
11897
|
+
*/},{key:"rotateZ",value:function rotateZ(angle){return this.rotate(zAxis$2,angle);}/**
|
|
11898
|
+
* Translates the Mesh along local space vector by the given increment.
|
|
11899
|
+
*
|
|
11900
|
+
* @param {Number[]} axis Normalized local space 3D vector along which to translate.
|
|
11901
|
+
* @param {Number} distance Distance to translate along the vector.
|
|
11902
|
+
*/},{key:"translate",value:function translate(axis,distance){math.vec3ApplyQuaternion(this.quaternion,axis,veca$1);math.mulVec3Scalar(veca$1,distance,vecb$1);math.addVec3(this.position,vecb$1,this.position);this._setLocalMatrixDirty();this._setAABBDirty();this.glRedraw();return this;}//------------------------------------------------------------------------------------------------------------------
|
|
11903
11903
|
// Drawable members
|
|
11904
11904
|
//------------------------------------------------------------------------------------------------------------------
|
|
11905
11905
|
/**
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
mesh1._material._state.id-mesh2._material._state.id
|
|
11929
|
-
mesh1._geometry._state.id-mesh2._geometry._state.id;// Geometry state
|
|
11906
|
+
* Translates the Mesh along the local X-axis by the given increment.
|
|
11907
|
+
*
|
|
11908
|
+
* @param {Number} distance Distance to translate along the X-axis.
|
|
11909
|
+
*/},{key:"translateX",value:function translateX(distance){return this.translate(xAxis$2,distance);}/**
|
|
11910
|
+
* Translates the Mesh along the local Y-axis by the given increment.
|
|
11911
|
+
*
|
|
11912
|
+
* @param {Number} distance Distance to translate along the Y-axis.
|
|
11913
|
+
*/},{key:"translateY",value:function translateY(distance){return this.translate(yAxis$2,distance);}/**
|
|
11914
|
+
* Translates the Mesh along the local Z-axis by the given increment.
|
|
11915
|
+
*
|
|
11916
|
+
* @param {Number} distance Distance to translate along the Z-axis.
|
|
11917
|
+
*/},{key:"translateZ",value:function translateZ(distance){return this.translate(zAxis$2,distance);}},{key:"_putDrawRenderers",value:function _putDrawRenderers(){if(this._drawRenderer){this._drawRenderer.put();this._drawRenderer=null;}if(this._shadowRenderer){this._shadowRenderer.put();this._shadowRenderer=null;}if(this._emphasisFillRenderer){this._emphasisFillRenderer.put();this._emphasisFillRenderer=null;}if(this._emphasisEdgesRenderer){this._emphasisEdgesRenderer.put();this._emphasisEdgesRenderer=null;}}},{key:"_putPickRenderers",value:function _putPickRenderers(){if(this._pickMeshRenderer){this._pickMeshRenderer.put();this._pickMeshRenderer=null;}if(this._pickTriangleRenderer){this._pickTriangleRenderer.put();this._pickTriangleRenderer=null;}}},{key:"_putOcclusionRenderer",value:function _putOcclusionRenderer(){if(this._occlusionRenderer){this._occlusionRenderer.put();this._occlusionRenderer=null;}}/**
|
|
11918
|
+
* Comparison function used by the renderer to determine the order in which xeokit should render the Mesh, relative to to other Meshes.
|
|
11919
|
+
*
|
|
11920
|
+
* xeokit requires this method because Mesh implements {@link Drawable}.
|
|
11921
|
+
*
|
|
11922
|
+
* Sorting is essential for rendering performance, so that xeokit is able to avoid needlessly applying runs of the same rendering state changes to the GPU, ie. can collapse them.
|
|
11923
|
+
*
|
|
11924
|
+
* @param {Mesh} mesh1
|
|
11925
|
+
* @param {Mesh} mesh2
|
|
11926
|
+
* @returns {number}
|
|
11927
|
+
*/},{key:"stateSortCompare",value:function stateSortCompare(mesh1,mesh2){return mesh1._state.layer-mesh2._state.layer||mesh1._drawRenderer.id-mesh2._drawRenderer.id// Program state
|
|
11928
|
+
||mesh1._material._state.id-mesh2._material._state.id// Material state
|
|
11929
|
+
||mesh1._geometry._state.id-mesh2._geometry._state.id;// Geometry state
|
|
11930
11930
|
}/** @private */},{key:"rebuildRenderFlags",value:function rebuildRenderFlags(){this.renderFlags.reset();if(!this._getActiveSectionPlanes()){this.renderFlags.culled=true;return;}this.renderFlags.numLayers=1;this.renderFlags.numVisibleLayers=1;this.renderFlags.visibleLayers[0]=0;this._updateRenderFlags();}/**
|
|
11931
|
-
|
|
11932
|
-
|
|
11931
|
+
* @private
|
|
11932
|
+
*/},{key:"_updateRenderFlags",value:function _updateRenderFlags(){var renderFlags=this.renderFlags;var state=this._state;if(state.xrayed){var xrayMaterial=this._xrayMaterial._state;if(xrayMaterial.fill){if(xrayMaterial.fillAlpha<1.0){renderFlags.xrayedSilhouetteTransparent=true;}else{renderFlags.xrayedSilhouetteOpaque=true;}}if(xrayMaterial.edges){if(xrayMaterial.edgeAlpha<1.0){renderFlags.xrayedEdgesTransparent=true;}else{renderFlags.xrayedEdgesOpaque=true;}}}else{var normalMaterial=this._material._state;if(normalMaterial.alpha<1.0||state.colorize[3]<1.0){renderFlags.colorTransparent=true;}else{renderFlags.colorOpaque=true;}if(state.edges){var edgeMaterial=this._edgeMaterial._state;if(edgeMaterial.alpha<1.0){renderFlags.edgesTransparent=true;}else{renderFlags.edgesOpaque=true;}}if(state.selected){var selectedMaterial=this._selectedMaterial._state;if(selectedMaterial.fill){if(selectedMaterial.fillAlpha<1.0){renderFlags.selectedSilhouetteTransparent=true;}else{renderFlags.selectedSilhouetteOpaque=true;}}if(selectedMaterial.edges){if(selectedMaterial.edgeAlpha<1.0){renderFlags.selectedEdgesTransparent=true;}else{renderFlags.selectedEdgesOpaque=true;}}}else if(state.highlighted){var highlightMaterial=this._highlightMaterial._state;if(highlightMaterial.fill){if(highlightMaterial.fillAlpha<1.0){renderFlags.highlightedSilhouetteTransparent=true;}else{renderFlags.highlightedSilhouetteOpaque=true;}}if(highlightMaterial.edges){if(highlightMaterial.edgeAlpha<1.0){renderFlags.highlightedEdgesTransparent=true;}else{renderFlags.highlightedEdgesOpaque=true;}}}}}},{key:"_getActiveSectionPlanes",value:function _getActiveSectionPlanes(){if(this._state.clippable){var sectionPlanes=this.scene._sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;if(numSectionPlanes>0){for(var _i133=0;_i133<numSectionPlanes;_i133++){var _sectionPlane12=sectionPlanes[_i133];var renderFlags=this.renderFlags;if(!_sectionPlane12.active){renderFlags.sectionPlanesActivePerLayer[_i133]=false;}else{if(this._state.origin){var intersect=math.planeAABB3Intersect(_sectionPlane12.dir,_sectionPlane12.dist,this.aabb);var outside=intersect===-1;if(outside){return false;}var intersecting=intersect===0;renderFlags.sectionPlanesActivePerLayer[_i133]=intersecting;}else{renderFlags.sectionPlanesActivePerLayer[_i133]=true;}}}}}return true;}// ---------------------- NORMAL RENDERING -----------------------------------
|
|
11933
11933
|
/** @private */},{key:"drawColorOpaque",value:function drawColorOpaque(frameCtx){if(this._drawRenderer||(this._drawRenderer=DrawRenderer.get(this))){this._drawRenderer.drawMesh(frameCtx,this);}}/** @private */},{key:"drawColorTransparent",value:function drawColorTransparent(frameCtx){if(this._drawRenderer||(this._drawRenderer=DrawRenderer.get(this))){this._drawRenderer.drawMesh(frameCtx,this);}}// ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
|
|
11934
11934
|
// TODO
|
|
11935
11935
|
// ---------------------- EMPHASIS RENDERING -----------------------------------
|
|
@@ -11946,16 +11946,16 @@ mesh1._geometry._state.id-mesh2._geometry._state.id;// Geometry state
|
|
|
11946
11946
|
/** @private */},{key:"drawOcclusion",value:function drawOcclusion(frameCtx){if(this._state.occluder&&this._occlusionRenderer||(this._occlusionRenderer=OcclusionRenderer.get(this))){this._occlusionRenderer.drawMesh(frameCtx,this);}}// ---------------------- SHADOW BUFFER RENDERING -----------------------------------
|
|
11947
11947
|
/** @private */},{key:"drawShadow",value:function drawShadow(frameCtx){if(this._shadowRenderer||(this._shadowRenderer=ShadowRenderer.get(this))){this._shadowRenderer.drawMesh(frameCtx,this);}}// ---------------------- PICKING RENDERING ----------------------------------
|
|
11948
11948
|
/** @private */},{key:"drawPickMesh",value:function drawPickMesh(frameCtx){if(this._pickMeshRenderer||(this._pickMeshRenderer=PickMeshRenderer.get(this))){this._pickMeshRenderer.drawMesh(frameCtx,this);}}/** @private
|
|
11949
|
-
|
|
11949
|
+
*/},{key:"canPickTriangle",value:function canPickTriangle(){return this._geometry.isReadableGeometry;// VBOGeometry does not support surface picking because it has no geometry data in browser memory
|
|
11950
11950
|
}/** @private */},{key:"drawPickTriangles",value:function drawPickTriangles(frameCtx){if(this._pickTriangleRenderer||(this._pickTriangleRenderer=PickTriangleRenderer.get(this))){this._pickTriangleRenderer.drawMesh(frameCtx,this);}}/** @private */},{key:"pickTriangleSurface",value:function pickTriangleSurface(pickViewMatrix,pickProjMatrix,pickResult){_pickTriangleSurface(this,pickViewMatrix,pickProjMatrix,pickResult);}/** @private */},{key:"drawPickVertices",value:function drawPickVertices(frameCtx){}/**
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11951
|
+
* @private
|
|
11952
|
+
* @returns {PerformanceNode}
|
|
11953
|
+
*/},{key:"delegatePickedEntity",value:function delegatePickedEntity(){return this;}//------------------------------------------------------------------------------------------------------------------
|
|
11954
11954
|
// Component members
|
|
11955
11955
|
//------------------------------------------------------------------------------------------------------------------
|
|
11956
11956
|
/**
|
|
11957
|
-
|
|
11958
|
-
|
|
11957
|
+
* Destroys this Mesh.
|
|
11958
|
+
*/},{key:"destroy",value:function destroy(){_superPropGet(Mesh,"destroy",this,3)([]);// xeokit.Object
|
|
11959
11959
|
this._putDrawRenderers();this._putPickRenderers();this._putOcclusionRenderer();this.scene._renderer.putPickID(this._state.pickID);// TODO: somehow puch this down into xeokit framework?
|
|
11960
11960
|
if(this._isObject){this.scene._deregisterObject(this);if(this._visible){this.scene._objectVisibilityUpdated(this,false,false);}if(this._xrayed){this.scene._objectXRayedUpdated(this,false,false);}if(this._selected){this.scene._objectSelectedUpdated(this,false,false);}if(this._highlighted){this.scene._objectHighlightedUpdated(this,false,false);}this.scene._objectColorizeUpdated(this,false);this.scene._objectOpacityUpdated(this,false);if(this.offset.some(function(v){return v!==0;}))this.scene._objectOffsetUpdated(this,false);}if(this._isModel){this.scene._deregisterModel(this);}this.glRedraw();}}]);}(Component);var _pickTriangleSurface=function(){// Cached vars to avoid garbage collection
|
|
11961
11961
|
var localRayOrigin=math.vec3();var localRayDir=math.vec3();var positionA=math.vec3();var positionB=math.vec3();var positionC=math.vec3();var triangleVertices=math.vec3();var position=math.vec4();var worldPos=math.vec3();var viewPos=math.vec3();var bary=math.vec3();var normalA=math.vec3();var normalB=math.vec3();var normalC=math.vec3();var uva=math.vec3();var uvb=math.vec3();var uvc=math.vec3();var tempVec4a=math.vec4();var tempVec4b=math.vec4();var tempVec4c=math.vec4();var tempVec3=math.vec3();var tempVec3b=math.vec3();var tempVec3c=math.vec3();var tempVec3d=math.vec3();var tempVec3e=math.vec3();var tempVec3f=math.vec3();var tempVec3g=math.vec3();var tempVec3h=math.vec3();var tempVec3i=math.vec3();var tempVec3j=math.vec3();var tempVec3k=math.vec3();return function(mesh,pickViewMatrix,pickProjMatrix,pickResult){var primIndex=pickResult.primIndex;if(primIndex!==undefined&&primIndex!==null&&primIndex>-1){var geometry=mesh.geometry._state;var scene=mesh.scene;var camera=scene.camera;var _canvas2=scene.canvas;if(geometry.primitiveName==="triangles"){// Triangle picked; this only happens when the
|
|
@@ -26754,7 +26754,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
26754
26754
|
* The Viewer's {@link Scene}.
|
|
26755
26755
|
* @property scene
|
|
26756
26756
|
* @type {Scene}
|
|
26757
|
-
*/this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,pbrEnabled:!!cfg.pbrEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled,edgesEnabled:cfg.edgesEnabled,numCachedSectionPlanes:cfg.numCachedSectionPlanes,lodEnabled:!!cfg.lodEnabled,resolutionScale:cfg.resolutionScale,offset:cfg.offset})
|
|
26757
|
+
*/this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,pbrEnabled:!!cfg.pbrEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled,edgesEnabled:cfg.edgesEnabled,numCachedSectionPlanes:cfg.numCachedSectionPlanes,lodEnabled:!!cfg.lodEnabled,resolutionScale:cfg.resolutionScale,offset:cfg.offset});/**
|
|
26758
26758
|
* Metadata about the {@link Scene} and the models and objects within it.
|
|
26759
26759
|
* @property metaScene
|
|
26760
26760
|
* @type {MetaScene}
|