@xeokit/xeokit-sdk 2.4.0-alpha-104 → 2.4.0-alpha-106

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.
@@ -11030,6 +11030,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
11030
11030
  if (mouseHovering) {
11031
11031
  this._currentAngleMeasurement.targetVisible = true;
11032
11032
  this._currentAngleMeasurement.angleVisible = true;
11033
+ this._currentAngleMeasurement.clickable = true;
11033
11034
  this.angleMeasurementsPlugin.fire("measurementEnd", this._currentAngleMeasurement);
11034
11035
  this._currentAngleMeasurement = null;
11035
11036
  this._mouseState = MOUSE_FINDING_ORIGIN;
@@ -74379,7 +74380,7 @@ class TrianglesDataTextureEdgesRenderer {
74379
74380
  // get XYZ offset
74380
74381
  src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
74381
74382
 
74382
- src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz + vec3(110.0,50.0, 10.0);");
74383
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74383
74384
 
74384
74385
  src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
74385
74386
 
@@ -11026,6 +11026,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
11026
11026
  if (mouseHovering) {
11027
11027
  this._currentAngleMeasurement.targetVisible = true;
11028
11028
  this._currentAngleMeasurement.angleVisible = true;
11029
+ this._currentAngleMeasurement.clickable = true;
11029
11030
  this.angleMeasurementsPlugin.fire("measurementEnd", this._currentAngleMeasurement);
11030
11031
  this._currentAngleMeasurement = null;
11031
11032
  this._mouseState = MOUSE_FINDING_ORIGIN;
@@ -74375,7 +74376,7 @@ class TrianglesDataTextureEdgesRenderer {
74375
74376
  // get XYZ offset
74376
74377
  src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
74377
74378
 
74378
- src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz + vec3(110.0,50.0, 10.0);");
74379
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74379
74380
 
74380
74381
  src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
74381
74382
 
@@ -2550,7 +2550,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
2550
2550
  * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2551
2551
  */function get(){return this._snapping;}/**
2552
2552
  * Activates this AngleMeasurementsMouseControl, ready to respond to input.
2553
- */,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this15=this;if(this._active){return;}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var mouseHoverEntity=false;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.centerPos=event.cursorPos||event.canvasPos;pointerLens.cursorPos=event.canvasPos;pointerLens.snapped=true;}_this15.markerDiv.style.background="greenyellow";_this15.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.centerPos=event.cursorPos||event.canvasPos;pointerLens.cursorPos=event.canvasPos;pointerLens.snapped=false;}_this15.markerDiv.style.background="pink";_this15.markerDiv.style.border="2px solid red";}mouseHovering=true;mouseHoverEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(event.canvasPos);switch(_this15._mouseState){case MOUSE_FINDING_ORIGIN:_this15.markerDiv.style.marginLeft="".concat(event.canvasPos[0]-5,"px");_this15.markerDiv.style.marginTop="".concat(event.canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.originWireVisible=true;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.cornerVisible=true;_this15._currentAngleMeasurement.angleVisible=false;_this15._currentAngleMeasurement.corner.worldPos=event.worldPos;}_this15.markerDiv.style.marginLeft="-10000px";_this15.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.targetWireVisible=true;_this15._currentAngleMeasurement.targetVisible=true;_this15._currentAngleMeasurement.angleVisible=true;_this15._currentAngleMeasurement.target.worldPos=event.worldPos;}_this15.markerDiv.style.marginLeft="-10000px";_this15.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this15._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this15._currentAngleMeasurement=_this15.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{entity:mouseHoverEntity,worldPos:mouseWorldPos},corner:{entity:mouseHoverEntity,worldPos:mouseWorldPos},target:{entity:mouseHoverEntity,worldPos:mouseWorldPos},approximate:true});_this15._currentAngleMeasurement.clickable=false;_this15._currentAngleMeasurement.originVisible=true;_this15._currentAngleMeasurement.originWireVisible=true;_this15._currentAngleMeasurement.cornerVisible=false;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.targetVisible=false;_this15._currentAngleMeasurement.angleVisible=false;_this15._mouseState=MOUSE_FINDING_CORNER;_this15.angleMeasurementsPlugin.fire("measurementStart",_this15._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.targetVisible=true;_this15._currentAngleMeasurement.angleVisible=true;_this15._mouseState=MOUSE_FINDING_TARGET;}else{if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.destroy();_this15._currentAngleMeasurement=null;_this15._mouseState=MOUSE_FINDING_ORIGIN;_this15.angleMeasurementsPlugin.fire("measurementCancel",_this15._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this15._currentAngleMeasurement.targetVisible=true;_this15._currentAngleMeasurement.angleVisible=true;_this15.angleMeasurementsPlugin.fire("measurementEnd",_this15._currentAngleMeasurement);_this15._currentAngleMeasurement=null;_this15._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.destroy();_this15._currentAngleMeasurement=null;_this15._mouseState=MOUSE_FINDING_ORIGIN;_this15.angleMeasurementsPlugin.fire("measurementCancel",_this15._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.centerPos=event.cursorPos;pointerLens.cursorPos=event.cursorPos;pointerLens.snapped=false;}_this15.markerDiv.style.marginLeft="-100px";_this15.markerDiv.style.marginTop="-100px";if(_this15._currentAngleMeasurement){switch(_this15._mouseState){case MOUSE_FINDING_ORIGIN:_this15._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this15._currentAngleMeasurement.cornerVisible=false;_this15._currentAngleMeasurement.originWireVisible=false;_this15._currentAngleMeasurement.targetVisible=false;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this15._currentAngleMeasurement.targetVisible=false;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
2553
+ */,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this15=this;if(this._active){return;}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var mouseHoverEntity=false;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.centerPos=event.cursorPos||event.canvasPos;pointerLens.cursorPos=event.canvasPos;pointerLens.snapped=true;}_this15.markerDiv.style.background="greenyellow";_this15.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.centerPos=event.cursorPos||event.canvasPos;pointerLens.cursorPos=event.canvasPos;pointerLens.snapped=false;}_this15.markerDiv.style.background="pink";_this15.markerDiv.style.border="2px solid red";}mouseHovering=true;mouseHoverEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(event.canvasPos);switch(_this15._mouseState){case MOUSE_FINDING_ORIGIN:_this15.markerDiv.style.marginLeft="".concat(event.canvasPos[0]-5,"px");_this15.markerDiv.style.marginTop="".concat(event.canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.originWireVisible=true;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.cornerVisible=true;_this15._currentAngleMeasurement.angleVisible=false;_this15._currentAngleMeasurement.corner.worldPos=event.worldPos;}_this15.markerDiv.style.marginLeft="-10000px";_this15.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.targetWireVisible=true;_this15._currentAngleMeasurement.targetVisible=true;_this15._currentAngleMeasurement.angleVisible=true;_this15._currentAngleMeasurement.target.worldPos=event.worldPos;}_this15.markerDiv.style.marginLeft="-10000px";_this15.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this15._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this15._currentAngleMeasurement=_this15.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{entity:mouseHoverEntity,worldPos:mouseWorldPos},corner:{entity:mouseHoverEntity,worldPos:mouseWorldPos},target:{entity:mouseHoverEntity,worldPos:mouseWorldPos},approximate:true});_this15._currentAngleMeasurement.clickable=false;_this15._currentAngleMeasurement.originVisible=true;_this15._currentAngleMeasurement.originWireVisible=true;_this15._currentAngleMeasurement.cornerVisible=false;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.targetVisible=false;_this15._currentAngleMeasurement.angleVisible=false;_this15._mouseState=MOUSE_FINDING_CORNER;_this15.angleMeasurementsPlugin.fire("measurementStart",_this15._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.targetVisible=true;_this15._currentAngleMeasurement.angleVisible=true;_this15._mouseState=MOUSE_FINDING_TARGET;}else{if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.destroy();_this15._currentAngleMeasurement=null;_this15._mouseState=MOUSE_FINDING_ORIGIN;_this15.angleMeasurementsPlugin.fire("measurementCancel",_this15._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this15._currentAngleMeasurement.targetVisible=true;_this15._currentAngleMeasurement.angleVisible=true;_this15._currentAngleMeasurement.clickable=true;_this15.angleMeasurementsPlugin.fire("measurementEnd",_this15._currentAngleMeasurement);_this15._currentAngleMeasurement=null;_this15._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this15._currentAngleMeasurement){_this15._currentAngleMeasurement.destroy();_this15._currentAngleMeasurement=null;_this15._mouseState=MOUSE_FINDING_ORIGIN;_this15.angleMeasurementsPlugin.fire("measurementCancel",_this15._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.centerPos=event.cursorPos;pointerLens.cursorPos=event.cursorPos;pointerLens.snapped=false;}_this15.markerDiv.style.marginLeft="-100px";_this15.markerDiv.style.marginTop="-100px";if(_this15._currentAngleMeasurement){switch(_this15._mouseState){case MOUSE_FINDING_ORIGIN:_this15._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this15._currentAngleMeasurement.cornerVisible=false;_this15._currentAngleMeasurement.originWireVisible=false;_this15._currentAngleMeasurement.targetVisible=false;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this15._currentAngleMeasurement.targetVisible=false;_this15._currentAngleMeasurement.targetWireVisible=false;_this15._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
2554
2554
  * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
2555
2555
  *
2556
2556
  * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
@@ -17974,7 +17974,7 @@ src.push("} else {");// get vertex base
17974
17974
  src.push("ivec4 packedVertexBase = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");src.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));");src.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;");src.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;");src.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;");src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));");src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");src.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;");src.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;");src.push("mat4 positionsDecodeMatrix = mat4 (texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));");// get flags & flags2
17975
17975
  src.push("uvec4 flags = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");src.push("uvec4 flags2 = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");// get position
17976
17976
  src.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));");src.push("vec4 worldPosition = sceneModelWorldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");// get XYZ offset
17977
- src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz + vec3(110.0,50.0, 10.0);");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2.r;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("vColor = vec4(color.r, color.g, color.b, color.a);");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Batched geometry edges drawing fragment shader");if(scene.logarithmicDepthBufferEnabled){src.push("#extension GL_EXT_frag_depth : enable");}src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i339=0,len=sectionPlanesState.sectionPlanes.length;_i339<len;_i339++){src.push("uniform bool sectionPlaneActive"+_i339+";");src.push("uniform vec3 sectionPlanePos"+_i339+";");src.push("uniform vec3 sectionPlaneDir"+_i339+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = vFlags2 > 0u;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i340=0,_len85=sectionPlanesState.sectionPlanes.length;_i340<_len85;_i340++){src.push("if (sectionPlaneActive"+_i340+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i340+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i340+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vColor;");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return TrianglesDataTextureEdgesRenderer;}();var tempVec3a$h=math.vec3();var tempVec3b$d=math.vec3();var tempVec3c$c=math.vec3();var tempMat4a$8=math.mat4();/**
17977
+ src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2.r;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("vColor = vec4(color.r, color.g, color.b, color.a);");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Batched geometry edges drawing fragment shader");if(scene.logarithmicDepthBufferEnabled){src.push("#extension GL_EXT_frag_depth : enable");}src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i339=0,len=sectionPlanesState.sectionPlanes.length;_i339<len;_i339++){src.push("uniform bool sectionPlaneActive"+_i339+";");src.push("uniform vec3 sectionPlanePos"+_i339+";");src.push("uniform vec3 sectionPlaneDir"+_i339+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = vFlags2 > 0u;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i340=0,_len85=sectionPlanesState.sectionPlanes.length;_i340<_len85;_i340++){src.push("if (sectionPlaneActive"+_i340+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i340+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i340+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vColor;");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return TrianglesDataTextureEdgesRenderer;}();var tempVec3a$h=math.vec3();var tempVec3b$d=math.vec3();var tempVec3c$c=math.vec3();var tempMat4a$8=math.mat4();/**
17978
17978
  * @private
17979
17979
  */var TrianglesDataTextureEdgesColorRenderer=/*#__PURE__*/function(){function TrianglesDataTextureEdgesColorRenderer(scene){_classCallCheck(this,TrianglesDataTextureEdgesColorRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}_createClass(TrianglesDataTextureEdgesColorRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){return this._scene._sectionPlanesState.getHash();}},{key:"drawLayer",value:function drawLayer(frameCtx,dataTextureLayer,renderPass){var model=dataTextureLayer.model;var scene=model.scene;var camera=scene.camera;var gl=scene.canvas.gl;var state=dataTextureLayer._state;var textureState=state.textureState;var origin=dataTextureLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;var viewMatrix=camera.viewMatrix;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}textureState.bindCommonTextures(this._program,this._uTexturePerObjectIdPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this._uTexturePerObjectIdColorsAndFlags,this._uTextureModelMatrices,this._uTexturePerObjectIdOffsets);var rtcViewMatrix;var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$h;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3b$d);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$8);}else{rtcViewMatrix=viewMatrix;}gl.uniform1i(this._uRenderPass,renderPass);gl.uniformMatrix4fv(this._uSceneModelWorldMatrix,false,rotationMatrixConjugate);gl.uniformMatrix4fv(this._uViewMatrix,false,rtcViewMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=dataTextureLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var sectionPlane=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos(sectionPlane.dist,sectionPlane.dir,origin,tempVec3c$c);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,sectionPlane.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,sectionPlane.dir);}}}}if(state.numEdgeIndices8Bits>0){textureState.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,8// 8 bits edge indices
17980
17980
  );gl.drawArrays(gl.LINES,0,state.numEdgeIndices8Bits);}if(state.numEdgeIndices16Bits>0){textureState.bindEdgeIndicesTextures(this._program,this._uTexturePerEdgeIdPortionIds,this._uTexturePerPolygonIdEdgeIndices,16// 16 bits edge indices