@xeokit/xeokit-sdk 2.6.1 → 2.6.3
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/xeokit-sdk.cjs.js +8 -2
- package/dist/xeokit-sdk.es.js +8 -2
- package/dist/xeokit-sdk.es5.js +3 -3
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +3 -3
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +1 -1
- package/src/plugins/lib/html/Dot.js +1 -0
- package/src/plugins/lib/html/Label.js +4 -0
- package/src/plugins/lib/html/Wire.js +1 -0
- package/src/viewer/scene/model/SceneModelTransform.js +1 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -10865,6 +10865,7 @@ class Wire {
|
|
|
10865
10865
|
wireClickable.addEventListener('contextmenu', (event) => {
|
|
10866
10866
|
cfg.onContextMenu(event, this);
|
|
10867
10867
|
event.preventDefault();
|
|
10868
|
+
event.stopPropagation();
|
|
10868
10869
|
});
|
|
10869
10870
|
}
|
|
10870
10871
|
|
|
@@ -11063,6 +11064,7 @@ class Dot {
|
|
|
11063
11064
|
dotClickable.addEventListener('contextmenu', (event) => {
|
|
11064
11065
|
cfg.onContextMenu(event, this);
|
|
11065
11066
|
event.preventDefault();
|
|
11067
|
+
event.stopPropagation();
|
|
11066
11068
|
});
|
|
11067
11069
|
}
|
|
11068
11070
|
|
|
@@ -11204,12 +11206,14 @@ class Label {
|
|
|
11204
11206
|
if (cfg.onMouseDown) {
|
|
11205
11207
|
label.addEventListener('mousedown', (event) => {
|
|
11206
11208
|
cfg.onMouseDown(event, this);
|
|
11209
|
+
event.stopPropagation();
|
|
11207
11210
|
});
|
|
11208
11211
|
}
|
|
11209
11212
|
|
|
11210
11213
|
if (cfg.onMouseUp) {
|
|
11211
11214
|
label.addEventListener('mouseup', (event) => {
|
|
11212
11215
|
cfg.onMouseUp(event, this);
|
|
11216
|
+
event.stopPropagation();
|
|
11213
11217
|
});
|
|
11214
11218
|
}
|
|
11215
11219
|
|
|
@@ -11223,6 +11227,8 @@ class Label {
|
|
|
11223
11227
|
label.addEventListener('contextmenu', (event) => {
|
|
11224
11228
|
cfg.onContextMenu(event, this);
|
|
11225
11229
|
event.preventDefault();
|
|
11230
|
+
event.stopPropagation();
|
|
11231
|
+
console.log("Label context menu");
|
|
11226
11232
|
});
|
|
11227
11233
|
}
|
|
11228
11234
|
}
|
|
@@ -80391,7 +80397,7 @@ class SceneModelTransform {
|
|
|
80391
80397
|
_addChildTransform(childTransform) {
|
|
80392
80398
|
this._childTransforms.push(childTransform);
|
|
80393
80399
|
childTransform._parentTransform = this;
|
|
80394
|
-
childTransform.
|
|
80400
|
+
childTransform._transformDirty();
|
|
80395
80401
|
childTransform._setAABBDirty();
|
|
80396
80402
|
}
|
|
80397
80403
|
|
|
@@ -115909,7 +115915,7 @@ function loadNode(ctx, node, depth, matrix) {
|
|
|
115909
115915
|
meshCfg.opacity = 1.0;
|
|
115910
115916
|
}
|
|
115911
115917
|
|
|
115912
|
-
const backfaces = ((ctx.backfaces !== false) || (material.doubleSided !== false));
|
|
115918
|
+
const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
|
|
115913
115919
|
|
|
115914
115920
|
switch (primitive.mode) {
|
|
115915
115921
|
case 0: // POINTS
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -10861,6 +10861,7 @@ class Wire {
|
|
|
10861
10861
|
wireClickable.addEventListener('contextmenu', (event) => {
|
|
10862
10862
|
cfg.onContextMenu(event, this);
|
|
10863
10863
|
event.preventDefault();
|
|
10864
|
+
event.stopPropagation();
|
|
10864
10865
|
});
|
|
10865
10866
|
}
|
|
10866
10867
|
|
|
@@ -11059,6 +11060,7 @@ class Dot {
|
|
|
11059
11060
|
dotClickable.addEventListener('contextmenu', (event) => {
|
|
11060
11061
|
cfg.onContextMenu(event, this);
|
|
11061
11062
|
event.preventDefault();
|
|
11063
|
+
event.stopPropagation();
|
|
11062
11064
|
});
|
|
11063
11065
|
}
|
|
11064
11066
|
|
|
@@ -11200,12 +11202,14 @@ class Label {
|
|
|
11200
11202
|
if (cfg.onMouseDown) {
|
|
11201
11203
|
label.addEventListener('mousedown', (event) => {
|
|
11202
11204
|
cfg.onMouseDown(event, this);
|
|
11205
|
+
event.stopPropagation();
|
|
11203
11206
|
});
|
|
11204
11207
|
}
|
|
11205
11208
|
|
|
11206
11209
|
if (cfg.onMouseUp) {
|
|
11207
11210
|
label.addEventListener('mouseup', (event) => {
|
|
11208
11211
|
cfg.onMouseUp(event, this);
|
|
11212
|
+
event.stopPropagation();
|
|
11209
11213
|
});
|
|
11210
11214
|
}
|
|
11211
11215
|
|
|
@@ -11219,6 +11223,8 @@ class Label {
|
|
|
11219
11223
|
label.addEventListener('contextmenu', (event) => {
|
|
11220
11224
|
cfg.onContextMenu(event, this);
|
|
11221
11225
|
event.preventDefault();
|
|
11226
|
+
event.stopPropagation();
|
|
11227
|
+
console.log("Label context menu");
|
|
11222
11228
|
});
|
|
11223
11229
|
}
|
|
11224
11230
|
}
|
|
@@ -80387,7 +80393,7 @@ class SceneModelTransform {
|
|
|
80387
80393
|
_addChildTransform(childTransform) {
|
|
80388
80394
|
this._childTransforms.push(childTransform);
|
|
80389
80395
|
childTransform._parentTransform = this;
|
|
80390
|
-
childTransform.
|
|
80396
|
+
childTransform._transformDirty();
|
|
80391
80397
|
childTransform._setAABBDirty();
|
|
80392
80398
|
}
|
|
80393
80399
|
|
|
@@ -115905,7 +115911,7 @@ function loadNode(ctx, node, depth, matrix) {
|
|
|
115905
115911
|
meshCfg.opacity = 1.0;
|
|
115906
115912
|
}
|
|
115907
115913
|
|
|
115908
|
-
const backfaces = ((ctx.backfaces !== false) || (material.doubleSided !== false));
|
|
115914
|
+
const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
|
|
115909
115915
|
|
|
115910
115916
|
switch (primitive.mode) {
|
|
115911
115917
|
case 0: // POINTS
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -2756,7 +2756,7 @@ _this14._onEntityModelDestroyed=null;});}else{this._onEntityDestroyed=this._enti
|
|
|
2756
2756
|
*/},{key:"visible",get:function get(){return!!this._visible;}/**
|
|
2757
2757
|
* Destroys this Marker.
|
|
2758
2758
|
*/},{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);_get(_getPrototypeOf(Marker.prototype),"destroy",this).call(this);}}]);return Marker;}(Component);/** @private */var Wire=/*#__PURE__*/function(){function Wire(parentElement){var _this15=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";
|
|
2759
|
-
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,_this15);});}if(cfg.onMouseLeave){wireClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this15);});}if(cfg.onMouseWheel){wireClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this15);});}if(cfg.onMouseDown){wireClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this15);});}if(cfg.onMouseUp){wireClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this15);});}if(cfg.onMouseMove){wireClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this15);});}if(cfg.onContextMenu){wireClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this15);event.preventDefault();});}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}_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);}}}]);return Wire;}();/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this16=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._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=!!cfg.visible;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=8+"px";dotStyle.height=8+"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=8+"px";dotClickableStyle.height=8+"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,_this16);parentElement.dispatchEvent(new MouseEvent('mouseover',event));});}if(cfg.onMouseLeave){dotClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this16);});}if(cfg.onMouseWheel){dotClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this16);});}if(cfg.onMouseDown){dotClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this16);});}if(cfg.onMouseUp){dotClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this16);});}if(cfg.onMouseMove){dotClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this16);});}if(cfg.onContextMenu){dotClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this16);event.preventDefault();});}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}_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);}}}]);return Dot;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this17=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.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";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,_this17);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this17);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this17);});}if(cfg.onMouseDown){label.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this17);});}if(cfg.onMouseUp){label.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this17);});}if(cfg.onMouseMove){label.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this17);});}if(cfg.onContextMenu){label.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this17);event.preventDefault();});}}_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||"black";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);}}}]);return Label;}();var originVec=math.vec3();var targetVec=math.vec3();/**
|
|
2759
|
+
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,_this15);});}if(cfg.onMouseLeave){wireClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this15);});}if(cfg.onMouseWheel){wireClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this15);});}if(cfg.onMouseDown){wireClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this15);});}if(cfg.onMouseUp){wireClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this15);});}if(cfg.onMouseMove){wireClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this15);});}if(cfg.onContextMenu){wireClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this15);event.preventDefault();event.stopPropagation();});}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}_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);}}}]);return Wire;}();/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this16=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._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=!!cfg.visible;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=8+"px";dotStyle.height=8+"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=8+"px";dotClickableStyle.height=8+"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,_this16);parentElement.dispatchEvent(new MouseEvent('mouseover',event));});}if(cfg.onMouseLeave){dotClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this16);});}if(cfg.onMouseWheel){dotClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this16);});}if(cfg.onMouseDown){dotClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this16);});}if(cfg.onMouseUp){dotClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this16);});}if(cfg.onMouseMove){dotClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this16);});}if(cfg.onContextMenu){dotClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this16);event.preventDefault();event.stopPropagation();});}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}_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);}}}]);return Dot;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this17=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.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";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,_this17);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this17);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this17);});}if(cfg.onMouseDown){label.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this17);event.stopPropagation();});}if(cfg.onMouseUp){label.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this17);event.stopPropagation();});}if(cfg.onMouseMove){label.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this17);});}if(cfg.onContextMenu){label.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this17);event.preventDefault();event.stopPropagation();console.log("Label context menu");});}}_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||"black";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);}}}]);return Label;}();var originVec=math.vec3();var targetVec=math.vec3();/**
|
|
2760
2760
|
* @desc Measures the angle indicated by three 3D points.
|
|
2761
2761
|
*
|
|
2762
2762
|
* See {@link AngleMeasurementsPlugin} for more info.
|
|
@@ -16791,7 +16791,7 @@ var edgeIndex=void 0;if((edgeIndex=edgeSearch(ii0,ii1))>=0){if(alreadyOutputEdge
|
|
|
16791
16791
|
* Unique ID of this SceneModelTransform.
|
|
16792
16792
|
*
|
|
16793
16793
|
* The SceneModelTransform is registered against this ID in {@link SceneModel#transforms}.
|
|
16794
|
-
*/this.id=cfg.id;this._parentTransform=cfg.parent;this._childTransforms=[];this._meshes=[];this._scale=new Float32Array([1,1,1]);this._quaternion=math.identityQuaternion(new Float32Array(4));this._rotation=new Float32Array(3);this._position=new Float32Array(3);this._localMatrix=math.identityMat4(new Float32Array(16));this._worldMatrix=math.identityMat4(new Float32Array(16));this._localMatrixDirty=true;this._worldMatrixDirty=true;if(cfg.matrix){this.matrix=cfg.matrix;}else{this.scale=cfg.scale;this.position=cfg.position;if(cfg.quaternion);else{this.rotation=cfg.rotation;}}if(cfg.parent){cfg.parent._addChildTransform(this);}}_createClass(SceneModelTransform,[{key:"_addChildTransform",value:function _addChildTransform(childTransform){this._childTransforms.push(childTransform);childTransform._parentTransform=this;childTransform.
|
|
16794
|
+
*/this.id=cfg.id;this._parentTransform=cfg.parent;this._childTransforms=[];this._meshes=[];this._scale=new Float32Array([1,1,1]);this._quaternion=math.identityQuaternion(new Float32Array(4));this._rotation=new Float32Array(3);this._position=new Float32Array(3);this._localMatrix=math.identityMat4(new Float32Array(16));this._worldMatrix=math.identityMat4(new Float32Array(16));this._localMatrixDirty=true;this._worldMatrixDirty=true;if(cfg.matrix){this.matrix=cfg.matrix;}else{this.scale=cfg.scale;this.position=cfg.position;if(cfg.quaternion);else{this.rotation=cfg.rotation;}}if(cfg.parent){cfg.parent._addChildTransform(this);}}_createClass(SceneModelTransform,[{key:"_addChildTransform",value:function _addChildTransform(childTransform){this._childTransforms.push(childTransform);childTransform._parentTransform=this;childTransform._transformDirty();childTransform._setAABBDirty();}},{key:"_addMesh",value:function _addMesh(mesh){this._meshes.push(mesh);mesh.transform=this;// childTransform._setWorldMatrixDirty();
|
|
16795
16795
|
// childTransform._setAABBDirty();
|
|
16796
16796
|
}/**
|
|
16797
16797
|
* The optional parent SceneModelTransform.
|
|
@@ -24476,7 +24476,7 @@ numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadText
|
|
|
24476
24476
|
// materialCfg.alphaCutoff = alphaCutoff;
|
|
24477
24477
|
// }
|
|
24478
24478
|
var metallicPBR=material.pbrMetallicRoughness;if(material.pbrMetallicRoughness){var pbrMetallicRoughness=material.pbrMetallicRoughness;var baseColorTexture=pbrMetallicRoughness.baseColorTexture||pbrMetallicRoughness.colorTexture;if(baseColorTexture){if(baseColorTexture.texture){textureSetCfg.colorTextureId=baseColorTexture.texture._textureId;}else{textureSetCfg.colorTextureId=ctx.gltfData.textures[baseColorTexture.index]._textureId;}}if(metallicPBR.metallicRoughnessTexture){textureSetCfg.metallicRoughnessTextureId=metallicPBR.metallicRoughnessTexture.texture._textureId;}}var extensions=material.extensions;if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){specularPBR.specularTexture;var specularColorTexture=specularPBR.specularColorTexture;if(specularColorTexture!==null&&specularColorTexture!==undefined){textureSetCfg.colorTextureId=ctx.gltfData.textures[specularColorTexture.index]._textureId;}}}if(textureSetCfg.normalTextureId!==undefined||textureSetCfg.occlusionTextureId!==undefined||textureSetCfg.emissiveTextureId!==undefined||textureSetCfg.colorTextureId!==undefined||textureSetCfg.metallicRoughnessTextureId!==undefined){textureSetCfg.id="textureSet-".concat(ctx.nextId++,";");ctx.sceneModel.createTextureSet(textureSetCfg);return textureSetCfg.id;}return null;}function loadMaterialAttributes(ctx,material){// Substitute RGBA for material, to use fast flat shading instead
|
|
24479
|
-
var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}loadScene(ctx,scene);}function loadScene(ctx,scene){var nodes=scene.nodes;if(!nodes){return;}for(var _i512=0,len=nodes.length;_i512<len;_i512++){var _node6=nodes[_i512];countMeshUsage(ctx,_node6);}for(var _i513=0,_len109=nodes.length;_i513<_len109;_i513++){var _node7=nodes[_i513];loadNode(ctx,_node7,0,null);}}function countMeshUsage(ctx,node){var mesh=node.mesh;if(mesh){mesh.instances=mesh.instances?mesh.instances+1:1;}if(node.children){var children=node.children;for(var _i514=0,len=children.length;_i514<len;_i514++){var childNode=children[_i514];if(!childNode){error(ctx,"Node not found: "+_i514);continue;}countMeshUsage(ctx,childNode);}}}var deferredMeshIds=[];function loadNode(ctx,node,depth,matrix){ctx.gltfData;var localMatrix;if(node.matrix){localMatrix=node.matrix;if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.translation){localMatrix=math.translationMat4v(node.translation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.rotation){localMatrix=math.quaternionToMat4(node.rotation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.scale){localMatrix=math.scalingMat4v(node.scale);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}var sceneModel=ctx.sceneModel;if(node.mesh){var _mesh6=node.mesh;if(ctx.handlenode){var actions={};if(!ctx.handlenode(ctx.sceneModel.id,node,actions)){return;}if(actions.createEntity);}var worldMatrix=matrix?matrix.slice():math.identityMat4();var numPrimitives=_mesh6.primitives.length;if(numPrimitives>0){for(var _i515=0;_i515<numPrimitives;_i515++){var _primitive4=_mesh6.primitives[_i515];if(_primitive4.mode<4){continue;}var meshCfg={id:sceneModel.id+"."+ctx.numObjects++};var material=_primitive4.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material.doubleSided!==false;switch(_primitive4.mode){case 0:// POINTS
|
|
24479
|
+
var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}loadScene(ctx,scene);}function loadScene(ctx,scene){var nodes=scene.nodes;if(!nodes){return;}for(var _i512=0,len=nodes.length;_i512<len;_i512++){var _node6=nodes[_i512];countMeshUsage(ctx,_node6);}for(var _i513=0,_len109=nodes.length;_i513<_len109;_i513++){var _node7=nodes[_i513];loadNode(ctx,_node7,0,null);}}function countMeshUsage(ctx,node){var mesh=node.mesh;if(mesh){mesh.instances=mesh.instances?mesh.instances+1:1;}if(node.children){var children=node.children;for(var _i514=0,len=children.length;_i514<len;_i514++){var childNode=children[_i514];if(!childNode){error(ctx,"Node not found: "+_i514);continue;}countMeshUsage(ctx,childNode);}}}var deferredMeshIds=[];function loadNode(ctx,node,depth,matrix){ctx.gltfData;var localMatrix;if(node.matrix){localMatrix=node.matrix;if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.translation){localMatrix=math.translationMat4v(node.translation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.rotation){localMatrix=math.quaternionToMat4(node.rotation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.scale){localMatrix=math.scalingMat4v(node.scale);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}var sceneModel=ctx.sceneModel;if(node.mesh){var _mesh6=node.mesh;if(ctx.handlenode){var actions={};if(!ctx.handlenode(ctx.sceneModel.id,node,actions)){return;}if(actions.createEntity);}var worldMatrix=matrix?matrix.slice():math.identityMat4();var numPrimitives=_mesh6.primitives.length;if(numPrimitives>0){for(var _i515=0;_i515<numPrimitives;_i515++){var _primitive4=_mesh6.primitives[_i515];if(_primitive4.mode<4){continue;}var meshCfg={id:sceneModel.id+"."+ctx.numObjects++};var material=_primitive4.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material&&material.doubleSided!==false;switch(_primitive4.mode){case 0:// POINTS
|
|
24480
24480
|
meshCfg.primitive="points";break;case 1:// LINES
|
|
24481
24481
|
meshCfg.primitive="lines";break;case 2:// LINE_LOOP
|
|
24482
24482
|
meshCfg.primitive="lines";break;case 3:// LINE_STRIP
|