@xeokit/xeokit-sdk 2.4.2-beta-9 → 2.4.2-beta-11

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.
@@ -47356,11 +47356,29 @@ class BCFViewpointsPlugin extends Plugin {
47356
47356
  * @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
47357
47357
  * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
47358
47358
  * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
47359
+ * @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
47359
47360
  */
47360
47361
  constructor(viewer, cfg = {}) {
47361
47362
 
47362
47363
  super("BCFViewpoints", viewer, cfg);
47363
47364
 
47365
+ /**
47366
+ * Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
47367
+ *
47368
+ * When `xrayAsZeroAlpha` is `true`:
47369
+ *
47370
+ * * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
47371
+ * * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
47372
+ *
47373
+ * When `xrayAsZeroAlpha` is `false`:
47374
+ *
47375
+ * * don't save any X-ray information in viewpoints, and
47376
+ * * reset all objects as not X-rayed whenever loading a viewpoint.
47377
+ *
47378
+ * @type {boolean}
47379
+ */
47380
+ this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
47381
+
47364
47382
  /**
47365
47383
  * Identifies the originating system to include in BCF viewpoints saved by this plugin.
47366
47384
  * @property originatingSystem
@@ -47549,11 +47567,15 @@ class BCFViewpointsPlugin extends Plugin {
47549
47567
  let alpha;
47550
47568
 
47551
47569
  if (entity.xrayed) {
47552
- if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
47553
- // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
47554
- alpha = 0.1;
47570
+ if (this.xrayAsZeroAlpha) {
47571
+ alpha = 0;
47555
47572
  } else {
47556
- alpha = scene.xrayMaterial.fillAlpha;
47573
+ if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
47574
+ // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
47575
+ alpha = 0.1;
47576
+ } else {
47577
+ alpha = scene.xrayMaterial.fillAlpha;
47578
+ }
47557
47579
  }
47558
47580
  alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
47559
47581
  color = alpha + color;
@@ -47830,7 +47852,16 @@ class BCFViewpointsPlugin extends Plugin {
47830
47852
  this._withBCFComponent(options, component, entity => {
47831
47853
  entity.colorize = colorize;
47832
47854
  if (alphaDefined) {
47833
- entity.opacity = alpha;
47855
+ if (alpha === 0 && this.xrayAsZeroAlpha) {
47856
+ const savedFromXeokit = (component.originating_system === this.originatingSystem);
47857
+ if (savedFromXeokit) {
47858
+ entity.xrayed = true;
47859
+ } else {
47860
+ entity.opacity = alpha;
47861
+ }
47862
+ } else {
47863
+ entity.opacity = alpha;
47864
+ }
47834
47865
  }
47835
47866
  }));
47836
47867
  });
@@ -77391,7 +77422,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77391
77422
  if (clipping) {
77392
77423
  src.push("vFlags2 = flags2.r;");
77393
77424
  }
77394
- src.push("vPickColor = vec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));");
77425
+ src.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));");
77395
77426
  src.push("vec4 clipPos = projMatrix * viewPosition;");
77396
77427
  src.push("float tmp = clipPos.w;");
77397
77428
  src.push("clipPos.xyzw /= tmp;");
@@ -47352,11 +47352,29 @@ class BCFViewpointsPlugin extends Plugin {
47352
47352
  * @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
47353
47353
  * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
47354
47354
  * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
47355
+ * @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
47355
47356
  */
47356
47357
  constructor(viewer, cfg = {}) {
47357
47358
 
47358
47359
  super("BCFViewpoints", viewer, cfg);
47359
47360
 
47361
+ /**
47362
+ * Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
47363
+ *
47364
+ * When `xrayAsZeroAlpha` is `true`:
47365
+ *
47366
+ * * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
47367
+ * * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
47368
+ *
47369
+ * When `xrayAsZeroAlpha` is `false`:
47370
+ *
47371
+ * * don't save any X-ray information in viewpoints, and
47372
+ * * reset all objects as not X-rayed whenever loading a viewpoint.
47373
+ *
47374
+ * @type {boolean}
47375
+ */
47376
+ this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
47377
+
47360
47378
  /**
47361
47379
  * Identifies the originating system to include in BCF viewpoints saved by this plugin.
47362
47380
  * @property originatingSystem
@@ -47545,11 +47563,15 @@ class BCFViewpointsPlugin extends Plugin {
47545
47563
  let alpha;
47546
47564
 
47547
47565
  if (entity.xrayed) {
47548
- if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
47549
- // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
47550
- alpha = 0.1;
47566
+ if (this.xrayAsZeroAlpha) {
47567
+ alpha = 0;
47551
47568
  } else {
47552
- alpha = scene.xrayMaterial.fillAlpha;
47569
+ if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
47570
+ // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
47571
+ alpha = 0.1;
47572
+ } else {
47573
+ alpha = scene.xrayMaterial.fillAlpha;
47574
+ }
47553
47575
  }
47554
47576
  alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
47555
47577
  color = alpha + color;
@@ -47826,7 +47848,16 @@ class BCFViewpointsPlugin extends Plugin {
47826
47848
  this._withBCFComponent(options, component, entity => {
47827
47849
  entity.colorize = colorize;
47828
47850
  if (alphaDefined) {
47829
- entity.opacity = alpha;
47851
+ if (alpha === 0 && this.xrayAsZeroAlpha) {
47852
+ const savedFromXeokit = (component.originating_system === this.originatingSystem);
47853
+ if (savedFromXeokit) {
47854
+ entity.xrayed = true;
47855
+ } else {
47856
+ entity.opacity = alpha;
47857
+ }
47858
+ } else {
47859
+ entity.opacity = alpha;
47860
+ }
47830
47861
  }
47831
47862
  }));
47832
47863
  });
@@ -77387,7 +77418,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77387
77418
  if (clipping) {
77388
77419
  src.push("vFlags2 = flags2.r;");
77389
77420
  }
77390
- src.push("vPickColor = vec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));");
77421
+ src.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));");
77391
77422
  src.push("vec4 clipPos = projMatrix * viewPosition;");
77392
77423
  src.push("float tmp = clipPos.w;");
77393
77424
  src.push("clipPos.xyzw /= tmp;");
@@ -13903,7 +13903,22 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
13903
13903
  * @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
13904
13904
  * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
13905
13905
  * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
13906
+ * @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
13906
13907
  */function BCFViewpointsPlugin(viewer){var _this63;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,BCFViewpointsPlugin);_this63=_super44.call(this,"BCFViewpoints",viewer,cfg);/**
13908
+ * Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
13909
+ *
13910
+ * When `xrayAsZeroAlpha` is `true`:
13911
+ *
13912
+ * * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
13913
+ * * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
13914
+ *
13915
+ * When `xrayAsZeroAlpha` is `false`:
13916
+ *
13917
+ * * don't save any X-ray information in viewpoints, and
13918
+ * * reset all objects as not X-rayed whenever loading a viewpoint.
13919
+ *
13920
+ * @type {boolean}
13921
+ */_this63.xrayAsZeroAlpha=!!cfg.xrayAsZeroAlpha;/**
13907
13922
  * Identifies the originating system to include in BCF viewpoints saved by this plugin.
13908
13923
  * @property originatingSystem
13909
13924
  * @type {string}
@@ -13935,8 +13950,8 @@ location=YToZ(location);_direction=YToZ(_direction);}math.addVec3(location,realW
13935
13950
  var lineSets=scene.lineSets;for(var _id2 in lineSets){if(lineSets.hasOwnProperty(_id2)){var lineSet=lineSets[_id2];if(!bcfViewpoint.lines){bcfViewpoint.lines=[];}var positions=lineSet.positions;var indices=lineSet.indices;for(var _i154=0,len=indices.length/2;_i154<len;_i154++){var _a2=indices[_i154*2];var b=indices[_i154*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a2*3+0],y:positions[_a2*3+1],z:positions[_a2*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
13936
13951
  var bitmaps=scene.bitmaps;for(var _id3 in bitmaps){if(bitmaps.hasOwnProperty(_id3)){var bitmap=bitmaps[_id3];var _location=bitmap.pos;var normal=bitmap.normal;var _up=bitmap.up;if(camera.yUp){// BCF is Z up
13937
13952
  _location=YToZ(_location);normal=YToZ(normal);_up=YToZ(_up);}math.addVec3(_location,realWorldOffset);if(!bcfViewpoint.bitmaps){bcfViewpoint.bitmaps=[];}bcfViewpoint.bitmaps.push({bitmap_type:bitmap.type,bitmap_data:bitmap.imageData,location:xyzArrayToObject(_location),normal:xyzArrayToObject(normal),up:xyzArrayToObject(_up),height:bitmap.height});}}// Entity states
13938
- bcfViewpoint.components={visibility:{view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible}}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
13939
- alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this64.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref6){var _ref7=_slicedToArray(_ref6,2),color=_ref7[0],components=_ref7[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i155=0,len=objectIds.length;_i155<len;_i155++){var objectId=objectIds[_i155];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
13953
+ bcfViewpoint.components={visibility:{view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible}}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(_this64.xrayAsZeroAlpha){alpha=0;}else{if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
13954
+ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this64.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref6){var _ref7=_slicedToArray(_ref6,2),color=_ref7[0],components=_ref7[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i155=0,len=objectIds.length;_i155<len;_i155++){var objectId=objectIds[_i155];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
13940
13955
  * Sets viewer state to the given BCF viewpoint.
13941
13956
  *
13942
13957
  * Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
@@ -13960,7 +13975,7 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
13960
13975
  * then this method will apply the updates to objects within those composites.
13961
13976
  */},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this65=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$5);var dir=xyzObjectToArray(e.direction,tempVec3$5);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i156=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i156++);indices.push(_i156++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
13962
13977
  var bitmap_data=e.bitmap_data;// base64
13963
- var location=xyzObjectToArray(e.location,tempVec3a$u);var normal=xyzObjectToArray(e.normal,tempVec3b$p);var up=xyzObjectToArray(e.up,tempVec3c$m);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),false);}if(view_setup_hints.space_boundaries_visible!==undefined);}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/256;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/256,parseInt(color.substring(2,4),16)/256,parseInt(color.substring(4,6),16)/256];coloring.components.map(function(component){return _this65._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){entity.opacity=alpha;}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var up;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$5);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$5);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);up=ZToY(up);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
13978
+ var location=xyzObjectToArray(e.location,tempVec3a$u);var normal=xyzObjectToArray(e.normal,tempVec3b$p);var up=xyzObjectToArray(e.up,tempVec3c$m);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),false);}if(view_setup_hints.space_boundaries_visible!==undefined);}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/256;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/256,parseInt(color.substring(2,4),16)/256,parseInt(color.substring(4,6),16)/256];coloring.components.map(function(component){return _this65._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){if(alpha===0&&_this65.xrayAsZeroAlpha){var savedFromXeokit=component.originating_system===_this65.originatingSystem;if(savedFromXeokit){entity.xrayed=true;}else{entity.opacity=alpha;}}else{entity.opacity=alpha;}}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var up;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$5);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$5);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);up=ZToY(up);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
13964
13979
  origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3$5);}else{look=math.addVec3(eye,look,tempVec3$5);}if(immediate){camera.eye=eye;camera.look=look;camera.up=up;camera.projection=projection;}else{viewer.cameraFlight.flyTo({eye:eye,look:look,up:up,duration:options.duration,projection:projection});}}}},{key:"_withBCFComponent",value:function _withBCFComponent(options,component,callback){var viewer=this.viewer;var scene=viewer.scene;if(component.authoring_tool_id&&component.originating_system===this.originatingSystem){var id=component.authoring_tool_id;var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var metaObject=viewer.metaScene.metaObjects[id];if(metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);return;}}}if(component.ifc_guid){var originalSystemId=component.ifc_guid;var _entity=scene.objects[originalSystemId];if(_entity){callback(_entity);return;}if(options.updateCompositeObjects){var _metaObject=viewer.metaScene.metaObjects[originalSystemId];if(_metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId),callback);return;}}Object.keys(scene.models).forEach(function(modelId){var id=math.globalizeObjectId(modelId,originalSystemId);var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var _metaObject2=viewer.metaScene.metaObjects[id];if(_metaObject2){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);}}});}}/**
13965
13980
  * Destroys this BCFViewpointsPlugin.
13966
13981
  */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(BCFViewpointsPlugin.prototype),"destroy",this).call(this);}}]);return BCFViewpointsPlugin;}(Plugin);function xyzArrayToObject(arr){return{"x":arr[0],"y":arr[1],"z":arr[2]};}function xyzObjectToArray(xyz,arry){arry=new Float64Array(3);arry[0]=xyz.x;arry[1]=xyz.y;arry[2]=xyz.z;return arry;}function YToZ(vec){return new Float64Array([vec[0],-vec[2],vec[1]]);}function ZToY(vec){return new Float64Array([vec[0],vec[2],-vec[1]]);}function colorizeToRGB(color){var rgb="";rgb+=Math.round(color[0]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[1]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[2]*255).toString(16).padStart(2,"0");return rgb;}var distVec3=math.vec3();var lengthWire=function lengthWire(x1,y1,x2,y2){var a=x1-x2;var b=y1-y2;return Math.sqrt(a*a+b*b);};/**
@@ -18430,7 +18445,7 @@ src.push(" return;");src.push("};");// get vertex base
18430
18445
  src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");src.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;");src.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;");src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");src.push("mat4 objectInstanceMatrix = mat4 (texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));");src.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));");src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");// get position
18431
18446
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");src.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));");src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");// get normal
18432
18447
  src.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));");src.push("vec3 position;");src.push("position = positions[gl_VertexID % 3];");src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");// when the geometry is not solid, if needed, flip the triangle winding
18433
- src.push("if (solid != 1u) {");src.push(" if (isPerspectiveMatrix(projMatrix)) {");src.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");src.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");src.push(" position = positions[2 - (gl_VertexID % 3)];");src.push(" viewNormal = -viewNormal;");src.push(" }");src.push(" } else {");src.push(" if (viewNormal.z < 0.0) {");src.push(" position = positions[2 - (gl_VertexID % 3)];");src.push(" viewNormal = -viewNormal;");src.push(" }");src.push(" }");src.push("}");src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");src.push("relativeToOriginPosition = worldPosition.xyz;");src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vWorldPosition = worldPosition;");if(clipping){src.push("vFlags2 = flags2.r;");}src.push("vPickColor = vec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");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("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");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");{src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int uLayerNumber;");src.push("uniform vec3 uCoordinateScaler;");src.push("in vec4 vWorldPosition;");src.push("flat in vec4 vPickColor;");if(clipping){src.push("flat in uint vFlags2;");for(var _i354=0,len=sectionPlanesState.sectionPlanes.length;_i354<len;_i354++){src.push("uniform bool sectionPlaneActive"+_i354+";");src.push("uniform vec3 sectionPlanePos"+_i354+";");src.push("uniform vec3 sectionPlaneDir"+_i354+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("layout(location = 0) out highp ivec4 outCoords;");src.push("layout(location = 1) out highp ivec4 outNormal;");src.push("layout(location = 2) out lowp uvec4 outPickColor;");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 i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}{src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);");src.push("vec3 xTangent = dFdx( vWorldPosition.xyz );");src.push("vec3 yTangent = dFdy( vWorldPosition.xyz );");src.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );");src.push("outNormal = ivec4(worldNormal * float(".concat(math.MAX_INT,"), 1.0);"));src.push("outPickColor = uvec4(vPickColor);");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 TrianglesDataTextureSnapDepthBufInitRenderer;}();var tempVec3a$c=math.vec3();var tempVec3b$8=math.vec3();var tempVec3c$7=math.vec3();var tempVec3d$4=math.vec3();var tempMat4a$4=math.mat4();/**
18448
+ src.push("if (solid != 1u) {");src.push(" if (isPerspectiveMatrix(projMatrix)) {");src.push(" vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");src.push(" if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");src.push(" position = positions[2 - (gl_VertexID % 3)];");src.push(" viewNormal = -viewNormal;");src.push(" }");src.push(" } else {");src.push(" if (viewNormal.z < 0.0) {");src.push(" position = positions[2 - (gl_VertexID % 3)];");src.push(" viewNormal = -viewNormal;");src.push(" }");src.push(" }");src.push("}");src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");src.push("relativeToOriginPosition = worldPosition.xyz;");src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vWorldPosition = worldPosition;");if(clipping){src.push("vFlags2 = flags2.r;");}src.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0));");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");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("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");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");{src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int uLayerNumber;");src.push("uniform vec3 uCoordinateScaler;");src.push("in vec4 vWorldPosition;");src.push("flat in vec4 vPickColor;");if(clipping){src.push("flat in uint vFlags2;");for(var _i354=0,len=sectionPlanesState.sectionPlanes.length;_i354<len;_i354++){src.push("uniform bool sectionPlaneActive"+_i354+";");src.push("uniform vec3 sectionPlanePos"+_i354+";");src.push("uniform vec3 sectionPlaneDir"+_i354+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("layout(location = 0) out highp ivec4 outCoords;");src.push("layout(location = 1) out highp ivec4 outNormal;");src.push("layout(location = 2) out lowp uvec4 outPickColor;");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 i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}{src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);");src.push("vec3 xTangent = dFdx( vWorldPosition.xyz );");src.push("vec3 yTangent = dFdy( vWorldPosition.xyz );");src.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );");src.push("outNormal = ivec4(worldNormal * float(".concat(math.MAX_INT,"), 1.0);"));src.push("outPickColor = uvec4(vPickColor);");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 TrianglesDataTextureSnapDepthBufInitRenderer;}();var tempVec3a$c=math.vec3();var tempVec3b$8=math.vec3();var tempVec3c$7=math.vec3();var tempVec3d$4=math.vec3();var tempMat4a$4=math.mat4();/**
18434
18449
  * @private
18435
18450
  */var TrianglesDataTextureOcclusionRenderer=/*#__PURE__*/function(){function TrianglesDataTextureOcclusionRenderer(scene){_classCallCheck(this,TrianglesDataTextureOcclusionRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}_createClass(TrianglesDataTextureOcclusionRenderer,[{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=frameCtx.pickViewMatrix||camera.viewMatrix;if(!this._program){this._allocate(dataTextureLayer);if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}textureState.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3a$c;if(origin){var rotatedOrigin=tempVec3b$8;math.transformPoint3(rotationMatrix,origin,rotatedOrigin);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$4);rtcCameraEye=tempVec3c$7;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform1i(this._uRenderPass,renderPass);gl.uniformMatrix4fv(this._uWorldMatrix,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,tempVec3d$4);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,sectionPlane.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,sectionPlane.dir);}}}}if(state.numIndices8Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8// 8 bits indices
18436
18451
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices8Bits);}if(state.numIndices16Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16// 16 bits indices