@arcgis/core 4.28.0-next.20230920 → 4.28.0-next.20230921
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
- package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
- package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
- package/assets/esri/core/workers/chunks/{b558a402e2ce2616cf37.js → 3ca759f72d3bb29e9ea9.js} +22 -22
- package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
- package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
- package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
- package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
- package/assets/esri/core/workers/chunks/{7c72d5368bb2d7484b9b.js → 580039dd491854ca325c.js} +1 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
- package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
- package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
- package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
- package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
- package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
- package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
- package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
- package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
- package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
- package/assets/esri/core/workers/chunks/{aa021bc97b4a18a749dd.js → cad260881653567bc8f9.js} +1 -1
- package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
- package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
- package/assets/esri/core/workers/chunks/{9c40e7ed387071544f8c.js → ed1fbc1bc8d50453e2f5.js} +1 -1
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
- package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
- package/chunks/LaserlinePath.glsl.js +5 -1
- package/core/sql.js +1 -1
- package/interfaces.d.ts +1 -17
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/save/utils.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/rest/geometryService/cut.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/versionManagement/deleteVersion.js +1 -1
- package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
- package/rest/versionManagement/gdbVersion/post.js +1 -1
- package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
- package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/overlayImageUtils.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/support/dito.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Attribute.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/interactive/keybindings.js +1 -1
- package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +5 -0
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/webdoc/saveAPIKeyUtils.js +5 -0
- package/webdoc/webdocSaveUtils.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/support/globalCss.js +1 -1
- package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
- package/assets/esri/core/workers/chunks/084a85e2e31b4d5fa924.js +0 -1
- package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
- package/assets/esri/core/workers/chunks/21f0fafafcd754f5fb88.js +0 -1
- package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
- package/assets/esri/core/workers/chunks/2bf58296a6ea4eee960b.js +0 -1
- package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
- package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
- package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
- package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
- package/assets/esri/core/workers/chunks/74ddc14e4b576ddbb582.js +0 -1
- package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
- package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
- package/assets/esri/core/workers/chunks/a838dc6653ec29503053.js +0 -1
- package/assets/esri/core/workers/chunks/b10a91cae610aba62bf8.js +0 -1
- package/assets/esri/core/workers/chunks/b8eb842ea98a9734e161.js +0 -1
- package/assets/esri/core/workers/chunks/bbb63392485ed57703e0.js +0 -1
- package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
- package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
- package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
- package/assets/esri/core/workers/chunks/e5fcfd41f0ec12dcb7f2.js +0 -1
- package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,o as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,o as n,i as c,g as u,h as l,m as d}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import f from"../../../../geometry/Point.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{debugFlags as S}from"../debugFlags.js";import{PropertiesPool as y}from"../PropertiesPool.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{Task as A}from"../../../support/Scheduler.js";const j=Array;let L=class extends g{constructor(t){super(t),this._propertiesPool=new y({location:f,renderLocation:j},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=p(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=r(this._frameWorker),this._propertiesPool=s(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t,this.state.spatialReference),t}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get running(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,A.YIELD}_updateRenderLocation(){const t=v;let e=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,t);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!e&&r&&(e=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,t),e&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const s=C;e&&this._latestSurfaceAltitudeChangesDistanceSignificantly(t,s)&&(a(t,s),this._currentSurfaceAltitude=this._latestSurfaceAltitude),e?this.distance=n(this._camera.eye,t):(c(t,this._camera.viewForward,this._get("distance")),u(t,t,this._camera.eye)),l(this._get("renderLocation"),t)||this._set("renderLocation",a(this._propertiesPool.get("renderLocation"),t))}_calculateSurfaceIntersection(t,r){const s=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(s.ray,t,r))return!1;if(this.state.isGlobal){const e=h(this.renderCoordsHelper.spatialReference).radius,i=e+t,o=d(s.eye),a=o<i*i,l=n(s.eye,r);if(a&&l>e/4){const t=i-Math.sqrt(o);return c(r,s.viewForward,t),u(r,r,s.eye),!0}}else{const t=this.surface?.ready?this.surface.extent:null;null!=t&&m(t,this.surface?.spatialReference,I,this.renderCoordsHelper.spatialReference)&&(r[0]=e(r[0],I[0],I[2]),r[1]=e(r[1],I[1],I[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(t,e){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||null==t)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e)){if(S.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,s=n(r,t),i=n(r,e);if(Math.abs(i-s)/s>k)return!0}return!1}};t([i({constructOnly:!0})],L.prototype,"scheduler",void 0),t([i({constructOnly:!0})],L.prototype,"task",void 0),t([i()],L.prototype,"distance",void 0),t([i({constructOnly:!0})],L.prototype,"estimateSurfaceAltitudeAtCenter",void 0),t([i({readOnly:!0})],L.prototype,"location",null),t([i({readOnly:!0})],L.prototype,"renderLocation",void 0),t([i()],L.prototype,"updating",void 0),L=t([o("esri.views.3d.support.CenterOnSurface")],L);const k=.05,v=p(),C=p(),I=_();export{L as CenterOnSurface};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as a,G as c,c as p,p as d,f as l,n as u}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as f}from"../../../../geometry/support/ray.js";import{PropertiesPool as y}from"../PropertiesPool.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PaddingSide as _}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as j,Task as O}from"../../../support/Scheduler.js";const L=Array;let P=class extends g{constructor(e){super(e),this._propertiesPool=new y({location:m,renderLocation:L},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o((()=>this.centerOnSurface.renderLocation),(()=>this.updateRenderLocation())),o((()=>this.state.contentCamera),(()=>this.updateRenderLocation()))]),this.scheduler&&this.addHandles(this.scheduler.registerTask(j.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,s=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,S);const i=Math.max(0,(Math.acos(a(S,s.viewForward))-.5*Math.PI)*(s.aboveGround?1:-1));if(Number.isNaN(i)){if(!e||!c(e,r)){const e=this._propertiesPool.get("renderLocation");p(e,r),this._set("renderLocation",e)}return O.YIELD}const n=1-t(i/(.5*Math.PI),0,1),l=n*n*n;this._calculateScreenHorizontalEdgeOnSurface(C);const u=this._propertiesPool.get("renderLocation");return d(u,r,C,l),e&&c(e,u)||this._set("renderLocation",u),O.YIELD}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(s());if(r[1]=t.aboveGround?t.padding[_.BOTTOM]:t.fullHeight-t.padding[_.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,v)){l(v,v,t.eye);const r=u(v,v);if(this.renderCoordsHelper.
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as a,G as c,c as p,p as d,f as l,n as u}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as f}from"../../../../geometry/support/ray.js";import{PropertiesPool as y}from"../PropertiesPool.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PaddingSide as _}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as j,Task as O}from"../../../support/Scheduler.js";const L=Array;let P=class extends g{constructor(e){super(e),this._propertiesPool=new y({location:m,renderLocation:L},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o((()=>this.centerOnSurface.renderLocation),(()=>this.updateRenderLocation())),o((()=>this.state.contentCamera),(()=>this.updateRenderLocation()))]),this.scheduler&&this.addHandles(this.scheduler.registerTask(j.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,s=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,S);const i=Math.max(0,(Math.acos(a(S,s.viewForward))-.5*Math.PI)*(s.aboveGround?1:-1));if(Number.isNaN(i)){if(!e||!c(e,r)){const e=this._propertiesPool.get("renderLocation");p(e,r),this._set("renderLocation",e)}return O.YIELD}const n=1-t(i/(.5*Math.PI),0,1),l=n*n*n;this._calculateScreenHorizontalEdgeOnSurface(C);const u=this._propertiesPool.get("renderLocation");return d(u,r,C,l),e&&c(e,u)||this._set("renderLocation",u),O.YIELD}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(s());if(r[1]=t.aboveGround?t.padding[_.BOTTOM]:t.fullHeight-t.padding[_.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,v)){l(v,v,t.eye);const r=u(v,v);if(this.renderCoordsHelper.intersectInfiniteManifold(f(t.eye,r),o,e))return e}return this.renderCoordsHelper.setAltitude(e,o,t.eye)}updateRenderLocation(){this._dirty=!0}};e([i()],P.prototype,"_dirty",void 0),e([i({constructOnly:!0})],P.prototype,"scheduler",void 0),e([i({constructOnly:!0})],P.prototype,"centerOnSurface",void 0),e([i({constructOnly:!0})],P.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([i({readOnly:!0})],P.prototype,"updating",null),e([i({readOnly:!0})],P.prototype,"location",null),e([i({readOnly:!0})],P.prototype,"renderLocation",void 0),P=e([n("esri.views.3d.support.pointsOfInterest.Focus")],P);const S=h(),v=h(),C=h();export{P as Focus};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{I as o}from"../../../chunks/mat4f64.js";import{f as l,s as h,j as c}from"../../../chunks/vec3.js";import{Z as u,f as d,c as p}from"../../../chunks/vec3f64.js";import{Z as _}from"../../../chunks/vec4f64.js";import{create as f,set as g}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as m}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{OverlayContent as O}from"./OverlayContent.js";import{overlayRenderOccludedFlag as C}from"./OverlayRenderer.js";import{PatchRenderData as R}from"./PatchRenderData.js";import{RenderOrder as x}from"./RenderOrder.js";import{TerrainAttributesCache as P}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as v}from"./terrainUtils.js";import{TileRenderer as D}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as q,sortTiles as w,compareTiles as E}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as A,ComponentIntersectionData as N}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as I}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as U,ConsumesDepth as F,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{Attribute as k}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as G}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as M}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as z}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as V,StoreResults as H}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{RenderSlot as Y}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as Q}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as X}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as Z,getVerticalOffsetTerrain as K}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as J}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as $,intersectTriangles as ee}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as te}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ie}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as re}from"../../webgl/enums.js";const se=7,ne=10,ae=f();var oe;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(oe||(oe={}));let le=class extends U{get _isGlobal(){return this._stage.viewingMode===b.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=V.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new ie,this._passParameters=new B,this._renderDataPool=new s(R),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new q,this._transparencyState=oe.Opaque,this._castShadows=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=W.Occlude,this.produces=new Map([[Y.OPAQUE_TERRAIN,()=>this._produces()],[Y.TRANSPARENT_TERRAIN,()=>this._produces()],[Y.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new P(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?F:L}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===oe.TransparentWithDraped||e===oe.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Z}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?C:W.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,S.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[T.ELEVATION])i.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ne-se,i=Math.max(0,Math.floor((e.level-t)/se)*se);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=G.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=G.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=G.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new D(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=M(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==oe.Opaque)return;const s=he,n=ce;l(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,u=e.results.max,d=e.results.ground,p=e.options.store===H.MIN,_=!!e.results.ground.target,f=K(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=a.dist?a.dist:1/0;const O=h=>{const _=h.renderData;if(!_?.vao)return;const O=_.geometry;g(ae,O.boundingBox);const C=_.localOrigin;null!=f&&(f.localOrigin=C,f.applyToAabb(ae));const R=ae;if(ue[0]=i[0]-C[0],ue[1]=i[1]-C[1],ue[2]=i[2]-C[2],!$(R,ue,n,b,T))return;const x=(e,t,i)=>{e.set(this.type,h,t,i,o),T=p&&null!=a.dist?a.dist:1/0},P=(n,o)=>{if(null!=o&&n>=0&&(e.options.backfacesTerrain||c(o,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==d.dist||n<d.dist)&&x(d,n,o),e.options.isFiltered)return;e.options.store===H.ALL&&(null==y?(y=z(e.ray),x(y,n,o),e.results.all.push(y)):n<y.dist&&x(y,n,o)),(null==a.dist||n<a.dist)&&x(a,n,o),e.options.store!==H.MIN&&(null==u.dist||n>u.dist)&&x(u,n,o)}},v=de;l(v,r,C);const D=O.indices,S=O.vertexAttributes,q=S.getField(X.POSITION,m),w=new k(q.typedBuffer,3,!1,S.stride/4),E=O.indexCount/3;if(!f&&E>A){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new N(D,0,E,w)),e.intersectionData.intersectRay({r0:ue,r1:v},P)}else ee(ue,v,0,E,D,w,null,f,P)},C=this._rootTiles;if(null!=C){(()=>{const t=this._tileIterator;t.reset(C);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():O(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0),e.bindParameters.slot===Y.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&C))return null}else{const t=this.transparency===oe.Opaque?Y.OPAQUE_TERRAIN:Y.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===oe.Empty)return null;switch(e.output){case j.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(j.Color,e.bindParameters.slot===Y.OCCLUDED_TERRAIN);case j.Shadow:case j.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case j.Depth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1);case j.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1);case j.ObjectAndLayerIdColor:return this._updateTechnique(j.ObjectAndLayerIdColor,!1);case j.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case j.Color:{const i=e.bindParameters.slot===Y.OCCLUDED_TERRAIN?O.Occluded:O.Color;this._renderMaterialPass(e,t,i);break}case j.Depth:case j.Normal:this._renderAuxiliaryPass(e,t,O.Color,this._visiblePatchesByOrigin);break;case j.Highlight:this._renderAuxiliaryPass(e,t,O.Highlight,this._visiblePatchesByOrigin);break;case j.Shadow:case j.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case j.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,O.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=d(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,y.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?I.GridComposite:null!=i.backgroundColor?I.ColorComposite:I.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==x.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(this.renderOrder,i,t);e.sort(((e,t)=>E(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows){let t=this._allPatchesByOrigin.get(r);t||(t=new Array,this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=new Array,this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,this._passParameters,e.bindParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{const s=r[0].renderData.localOrigin;t.program.bindDraw(new J(s),e.bindParameters,this._passParameters);for(let a=0;a<r.length;a++)this._renderPatch(e,t,r[a],re.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=Q(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===O.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",_));const l=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:u;this._techniqueConfiguration.tileBlendInput===I.ColorComposite&&n.setUniform3fv("backgroundColor",l);const h=this.wireframe?re.LINES:re.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const c=this._visiblePatchesByOrigin;for(const u of c.values()){const r=u[0].renderData.localOrigin;t.program.bindDraw(new J(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of u){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,h,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(null==l)return void(v&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const h=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const c=a.geometry.indexCount;e.rctx.bindVAO(o),h.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(te,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([n({readOnly:!0})],le.prototype,"_isGlobal",null),e([n({value:!1})],le.prototype,"renderingDisabled",null),e([n({value:!0})],le.prototype,"visible",null),e([n()],le.prototype,"renderPatchBorders",null),e([n()],le.prototype,"visualizeNormals",null),e([n()],le.prototype,"cullBackFaces",null),e([n({value:x.FRONT_TO_BACK})],le.prototype,"renderOrder",null),e([n()],le.prototype,"wireframe",null),le=e([a("esri.views.3d.terrain.TerrainRenderer")],le);const he=p(),ce=p(),ue=p(),de=p();export{le as TerrainRenderer,oe as TransparencyMode};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{I as o}from"../../../chunks/mat4f64.js";import{f as l,s as h,j as c}from"../../../chunks/vec3.js";import{Z as u,f as d,c as p}from"../../../chunks/vec3f64.js";import{Z as _}from"../../../chunks/vec4f64.js";import{create as f,set as g}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as m}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{OverlayContent as O}from"./OverlayContent.js";import{overlayRenderOccludedFlag as C}from"./OverlayRenderer.js";import{PatchRenderData as R}from"./PatchRenderData.js";import{RenderOrder as x}from"./RenderOrder.js";import{TerrainAttributesCache as P}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as v}from"./terrainUtils.js";import{TileRenderer as D}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as q,sortTiles as w,compareTiles as E}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as A,ComponentIntersectionData as N}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as I}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as U,ConsumesDepth as F,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as k}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as G}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as M}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as z}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as V,StoreResults as H}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{RenderSlot as Y}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as Q}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as X}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as Z,getVerticalOffsetTerrain as K}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as J}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as $,intersectTriangles as ee}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as te}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ie}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as re}from"../../webgl/enums.js";const se=7,ne=10,ae=f();var oe;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(oe||(oe={}));let le=class extends U{get _isGlobal(){return this._stage.viewingMode===b.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=V.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new ie,this._passParameters=new B,this._renderDataPool=new s(R),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new q,this._transparencyState=oe.Opaque,this._castShadows=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=W.Occlude,this.produces=new Map([[Y.OPAQUE_TERRAIN,()=>this._produces()],[Y.TRANSPARENT_TERRAIN,()=>this._produces()],[Y.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new P(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?F:L}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===oe.TransparentWithDraped||e===oe.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Z}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?C:W.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,S.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[T.ELEVATION])i.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ne-se,i=Math.max(0,Math.floor((e.level-t)/se)*se);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=G.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=G.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=G.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new D(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=M(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==oe.Opaque)return;const s=he,n=ce;l(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,u=e.results.max,d=e.results.ground,p=e.options.store===H.MIN,_=!!e.results.ground.target,f=K(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=a.dist?a.dist:1/0;const O=h=>{const _=h.renderData;if(!_?.vao)return;const O=_.geometry;g(ae,O.boundingBox);const C=_.localOrigin;null!=f&&(f.localOrigin=C,f.applyToAabb(ae));const R=ae;if(ue[0]=i[0]-C[0],ue[1]=i[1]-C[1],ue[2]=i[2]-C[2],!$(R,ue,n,b,T))return;const x=(e,t,i)=>{e.set(this.type,h,t,i,o),T=p&&null!=a.dist?a.dist:1/0},P=(n,o)=>{if(null!=o&&n>=0&&(e.options.backfacesTerrain||c(o,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==d.dist||n<d.dist)&&x(d,n,o),e.options.isFiltered)return;e.options.store===H.ALL&&(null==y?(y=z(e.ray),x(y,n,o),e.results.all.push(y)):n<y.dist&&x(y,n,o)),(null==a.dist||n<a.dist)&&x(a,n,o),e.options.store!==H.MIN&&(null==u.dist||n>u.dist)&&x(u,n,o)}},v=de;l(v,r,C);const D=O.indices,S=O.vertexAttributes,q=S.getField(X.POSITION,m),w=new k(q.typedBuffer,3,S.stride/4),E=O.indexCount/3;if(!f&&E>A){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new N(D,0,E,w)),e.intersectionData.intersectRay({r0:ue,r1:v},P)}else ee(ue,v,0,E,D,w,null,f,P)},C=this._rootTiles;if(null!=C){(()=>{const t=this._tileIterator;t.reset(C);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():O(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0),e.bindParameters.slot===Y.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&C))return null}else{const t=this.transparency===oe.Opaque?Y.OPAQUE_TERRAIN:Y.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===oe.Empty)return null;switch(e.output){case j.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(j.Color,e.bindParameters.slot===Y.OCCLUDED_TERRAIN);case j.Shadow:case j.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case j.Depth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1);case j.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1);case j.ObjectAndLayerIdColor:return this._updateTechnique(j.ObjectAndLayerIdColor,!1);case j.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case j.Color:{const i=e.bindParameters.slot===Y.OCCLUDED_TERRAIN?O.Occluded:O.Color;this._renderMaterialPass(e,t,i);break}case j.Depth:case j.Normal:this._renderAuxiliaryPass(e,t,O.Color,this._visiblePatchesByOrigin);break;case j.Highlight:this._renderAuxiliaryPass(e,t,O.Highlight,this._visiblePatchesByOrigin);break;case j.Shadow:case j.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case j.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,O.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=d(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,y.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?I.GridComposite:null!=i.backgroundColor?I.ColorComposite:I.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==x.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(this.renderOrder,i,t);e.sort(((e,t)=>E(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows){let t=this._allPatchesByOrigin.get(r);t||(t=new Array,this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=new Array,this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,this._passParameters,e.bindParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{const s=r[0].renderData.localOrigin;t.program.bindDraw(new J(s),e.bindParameters,this._passParameters);for(let a=0;a<r.length;a++)this._renderPatch(e,t,r[a],re.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=Q(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===O.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",_));const l=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:u;this._techniqueConfiguration.tileBlendInput===I.ColorComposite&&n.setUniform3fv("backgroundColor",l);const h=this.wireframe?re.LINES:re.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const c=this._visiblePatchesByOrigin;for(const u of c.values()){const r=u[0].renderData.localOrigin;t.program.bindDraw(new J(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of u){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,h,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(null==l)return void(v&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const h=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const c=a.geometry.indexCount;e.rctx.bindVAO(o),h.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(te,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([n({readOnly:!0})],le.prototype,"_isGlobal",null),e([n({value:!1})],le.prototype,"renderingDisabled",null),e([n({value:!0})],le.prototype,"visible",null),e([n()],le.prototype,"renderPatchBorders",null),e([n()],le.prototype,"visualizeNormals",null),e([n()],le.prototype,"cullBackFaces",null),e([n({value:x.FRONT_TO_BACK})],le.prototype,"renderOrder",null),e([n()],le.prototype,"wireframe",null),le=e([a("esri.views.3d.terrain.TerrainRenderer")],le);const he=p(),ce=p(),ue=p(),de=p();export{le as TerrainRenderer,oe as TransparencyMode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as t}from"../../../../../core/mathUtils.js";import{c as e,f as i}from"../../../../../chunks/vec3f64.js";import{fromValues as n}from"../../../../../geometry/support/aaBoundingBox.js";import{computeNormal as
|
|
5
|
+
import{clamp as t}from"../../../../../core/mathUtils.js";import{c as e,f as i}from"../../../../../chunks/vec3f64.js";import{fromValues as n}from"../../../../../geometry/support/aaBoundingBox.js";import{computeNormal as s}from"../../materials/internal/MaterialUtil.js";const r=200,o=40,a=.8,c=10,h=1e-6;function f(t,e,i){const n=e,s=i;let r=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(n[a]<e){if(s[a]<=h)return!1;const t=(e-n[a])/s[a];r=Math.max(r,t)}else if(s[a]<=-h){const t=(e-n[a])/s[a];o=Math.min(o,t)}if(r>o)return!1}{const e=t[a+3];if(n[a]>e){if(s[a]>=-h)return!1;const t=(e-n[a])/s[a];r=Math.max(r,t)}else if(s[a]>=h){const t=(e-n[a])/s[a];o=Math.min(o,t)}if(r>o)return!1}}return!0}class l{constructor(t,e,i,n,s){this.aabb=t,this.axis=e,this.d=i,this.midStartIndex=n,this.rightStartIndex=s}}class d{constructor(i,n,s,r){this.globalTriangleVertexIndices=i,this.firstTriangleIndex=n,this.positions=r,this._rayDirection=e(),this.bspNodeTree=new Array;const h=s-n,f=h<=I?new Uint16Array(h):new Uint32Array(h);this.indices=f;for(let t=0;t<h;++t)f[t]=t;{const e=p(i,n,s,r.data,r.stride),d=t(Math.log2(h/o),2,c),u=(t,i,n)=>{const s=y(f,e,t,i),r=i-t;if(r<=o){const e=new l(s,void 0,0,t,i);return this.bspNodeTree.push(e),e}const{axis:c,midValue:h}=N(s),m=x(f,e,t,i,c,h),g=(t,e)=>{if(n>d)return;const i=e-t;return i<o||i>=a*r?void 0:u(t,e,n+1)},p=new l(s,c,h,m.next,m.mid);return this.bspNodeTree.push(p),p.leftNode=g(t,m.next),p.rightNode=g(m.mid,i),p};u(0,h,0),this.triangleVertexIndices=b(f,i,n,s)}}intersectRayTriangleRange(t,e){{if(t>=e)return;const i=this.triangleVertexIndices,n=this.positions.data,r=this.positions.stride,o=this._rayOrigin,a=o[0],c=o[1],h=o[2],f=this._rayDirection,l=f[0],d=f[1],m=f[2];for(let g=t,x=3*t;g<e;++g){let t=i[x++]*r;const e=n[t++],o=n[t++],f=n[t];t=i[x++]*r;const y=n[t++],N=n[t++],p=n[t];t=i[x++]*r;const b=y-e,I=N-o,T=p-f,M=n[t++]-e,R=n[t++]-o,S=n[t]-f,_=d*S-R*m,w=m*M-S*l,V=l*R-M*d,U=b*_+I*w+T*V;if(Math.abs(U)<=Number.EPSILON)continue;const A=a-e,B=c-o,v=h-f,P=A*_+B*w+v*V;if(U>0){if(P<0||P>U)continue}else if(P>0||P<U)continue;const j=B*T-I*v,D=v*b-T*A,F=A*I-b*B,O=l*j+d*D+m*F;if(U>0){if(O<0||P+O>U)continue}else if(O>0||P+O<U)continue;const k=(M*j+R*D+S*F)/U;if(k>=0){const t=this.indices[g]+this.firstTriangleIndex,e=s(b,I,T,M,R,S,u);this._callback(k,e,t,!1)}}}d.numFacesTested+=e-t}intersectRay(t,e){d.numFacesTested=0;const n=i(t.r0[0],t.r0[1],t.r0[2]),s=i(t.r1[0],t.r1[1],t.r1[2]),r=s[0]-n[0],o=s[1]-n[1],a=s[2]-n[2];if(r*r+o*o+a*a<h)return;this._rayOrigin=n;const c=this._rayDirection;c[0]=r,c[1]=o,c[2]=a;const f=this.triangleVertexIndices.length/3;this._callback=e;const l=this.bspNodeTree[0];this.intersectRayBSP(l,0,f)}intersectRayBSP(t,e,i){const n=this._rayOrigin,s=this._rayDirection;if(!f(t.aabb,n,s))return;const r=t.axis,o=t.d;if(n[r]<o||s[r]<0){const i=e,n=t.midStartIndex;if(i<n){const e=t.leftNode;void 0!==e?this.intersectRayBSP(e,i,n):this.intersectRayTriangleRange(i,n)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),n[r]>o||s[r]>0){const e=t.rightStartIndex,n=i;if(e<n){const i=t.rightNode;void 0!==i?this.intersectRayBSP(i,e,n):this.intersectRayTriangleRange(e,n)}}}get estimatedMemoryUsage(){return this.triangleVertexIndices.byteLength+this.indices.byteLength}}d.numFacesTested=0;const u=e(),m=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];function x(t,e,i,n,s,r){let o=i,a=n;for(;o<a;){const i=t[o];e[6*i+s+3]<=r?++o:(--a,t[o]=t[a],t[a]=i)}let c=o;for(a=n;c<a;){const i=t[a-1];e[6*i+s]>=r?--a:(t[a-1]=t[c],t[c]=i,++c)}return{next:o,mid:c}}function y(t,e,i,s){if(s<=i)return n(NaN,NaN,NaN,NaN,NaN,NaN);{const n=6*t[i];for(let t=0;t<3;++t)m[t]=e[n+0+t],g[t]=e[n+3+t]}for(let n=i+1;n<s;++n){const i=6*t[n];for(let t=0;t<3;++t)m[t]=Math.min(m[t],e[i+0+t]),g[t]=Math.max(g[t],e[i+3+t])}return n(m[0],m[1],m[2],g[0],g[1],g[2])}function N(t){const e=t[3]-t[0],i=t[4]-t[1],n=t[5]-t[2],s=e>i?e>n?0:i>n?1:2:i>n?1:n>e?2:0;return{axis:s,midValue:(t[s]+t[s+3])/2}}function p(t,e,i,n,s){const r=i-e,o=new Float32Array(6*r);for(let a=0;a<r;++a){const i=3*(a+e),r=t[i]*s,c=t[i+1]*s,h=t[i+2]*s;for(let t=0;t<3;++t){const e=n[r+t],i=n[c+t],s=n[h+t];o[6*a+t]=Math.min(e,i,s),o[6*a+3+t]=Math.max(e,i,s)}}return o}function b(t,e,i,n){const s=n-i;let r=0;for(let a=i;a<n;++a)for(let t=0;t<3;++t)r=Math.max(e[3*a+t],r);const o=r<=I?new Uint16Array(3*s):new Uint32Array(3*s);for(let a=0;a<s;++a){const n=3*(t[a]+i);for(let t=0;t<3;++t){const i=e[n+t];o[3*a+t]=i}}return o}const I=65535;export{d as ComponentIntersectionData,r as componentMinimalSizeForIntersectionData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{t}from"../../../../../chunks/vec3.js";import{c as n}from"../../../../../chunks/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as s}from"../../../../../geometry/support/FloatArray.js";import{compactIndices as i,getContinuousIndexArray as e}from"../../../../../geometry/support/Indices.js";import{componentMinimalSizeForIntersectionData as r,ComponentIntersectionData as p}from"./ComponentIntersectionData.js";import{
|
|
5
|
+
import{t}from"../../../../../chunks/vec3.js";import{c as n}from"../../../../../chunks/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as s}from"../../../../../geometry/support/FloatArray.js";import{compactIndices as i,getContinuousIndexArray as e}from"../../../../../geometry/support/Indices.js";import{componentMinimalSizeForIntersectionData as r,ComponentIntersectionData as p}from"./ComponentIntersectionData.js";import{Vertices as c}from"../../lib/Attribute.js";import{getVisibility as m}from"../../lib/ComponentUtils.js";import{computeInvDir as a,intersectAabbInvDir as h,intersectTriangles as l}from"../../materials/internal/MaterialUtil.js";class _{constructor(t,n){this._components=n,this._indices=t.indices?i(t.indices):e(t.positions.length/3),this._positions=t.positions,this._componentIntersectionData=new Array(n.count)}destroy(){this._positions=null,this._indices=null,this._componentIntersectionData.length=0,this._perComponentAabbs=null}getComponentAabb(t,n){this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs());for(let o=0;o<6;o++)n[o]=this._perComponentAabbs[6*t+o];return n}getComponentPositions(t,n){n.indices=this._indices,n.data=this._positions,n.stride=3,n.startIndex=this._components.offsets[t],n.endIndex=this._components.offsets[t+1]}intersect(n,o,s,i,e,_,b){const d=new c(this._positions,3),A=this._indices,C=this._components.offsets,g=a(n,o,f),y=n[2],j=o[2];this._components.visibility.forEachComponent((c=>{if(!m(this._components.pickability,c))return!0;const a=this.getComponentAabb(c,u);if(null!=_){const t=_[c];null!=e?e.componentOffset=t:(n[2]=y-t,o[2]=j-t)}if(null!=e&&e.applyToAabb(a),!h(a,n,g,s))return!0;const f=C[c]/3,I=C[c+1]/3,x=(n,o,s)=>b(c,n,t(o,o,i),s);return null==e&&I-f>r?(null==this._componentIntersectionData[c]&&(this._componentIntersectionData[c]=new p(this._indices,f,I,d)),this._componentIntersectionData[c].intersectRay({r0:n,r1:o},x)):l(n,o,f,I,A,d,void 0,e,x),!0}))}_computePerComponentAabbs(){const t=this._components.count,n=s(6*t),o=this._indices,i=this._positions,e=this._components.offsets;let r=0;for(let s=0;s<t;s++){const t=e[s],p=e[s+1];let c=1/0,m=1/0,a=1/0,h=-1/0,l=-1/0,_=-1/0;for(let n=t;n<p;n++){const t=3*o[n],s=i[t],e=i[t+1],r=i[t+2];c=Math.min(c,s),m=Math.min(m,e),a=Math.min(a,r),h=Math.max(h,s),l=Math.max(l,e),_=Math.max(_,r)}n[r++]=c,n[r++]=m,n[r++]=a,n[r++]=h,n[r++]=l,n[r++]=_}return n}get positions(){return this._positions}get indices(){return this._indices}}const f=n(),u=o();export{_ as default};
|
package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{n as r}from"../../../../../../chunks/mat3.js";import{a as o}from"../../../../../../chunks/mat3f64.js";import{I as n}from"../../../../../../chunks/mat4f64.js";import{s as a}from"../../../../../../chunks/vec3.js";import{c as i}from"../../../../../../chunks/vec3f64.js";import{ShaderOutput as
|
|
5
|
+
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{n as r}from"../../../../../../chunks/mat3.js";import{a as o}from"../../../../../../chunks/mat3f64.js";import{I as n}from"../../../../../../chunks/mat4f64.js";import{s as a}from"../../../../../../chunks/vec3.js";import{c as i}from"../../../../../../chunks/vec3f64.js";import{ShaderOutput as t}from"../ShaderOutput.js";import{DoublePrecision as s}from"../util/DoublePrecision.glsl.js";import{addViewNormal as l}from"../util/View.glsl.js";import{Float3DrawUniform as m}from"../../shaderModules/Float3DrawUniform.js";import{NoParameters as c,glsl as d}from"../../shaderModules/interfaces.js";import{Matrix3PassUniform as u}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4PassUniform as v}from"../../shaderModules/Matrix4PassUniform.js";import{ShaderTechniqueConfiguration as p,parameter as M}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{VertexAttribute as f}from"../../../lib/VertexAttribute.js";import{encodeDoubleHi as x,encodeDoubleLo as g}from"../../../../../webgl/doublePrecisionUtils.js";class O extends p{constructor(){super(...arguments),this.instancedDoublePrecision=!1,this.hasModelTransformation=!1}}e([M()],O.prototype,"instancedDoublePrecision",void 0),e([M()],O.prototype,"hasModelTransformation",void 0);class h extends c{constructor(){super(...arguments),this.modelTransformation=null}}const w=o();function N(e,o){const i=o.hasModelTransformation,c=o.instancedDoublePrecision;i&&(e.vertex.uniforms.add(new v("model",(e=>e.modelTransformation??n))),e.vertex.uniforms.add(new u("normalLocalOriginFromModel",(e=>(r(w,e.modelTransformation??n),w))))),o.instanced&&c&&(e.attributes.add(f.INSTANCEMODELORIGINHI,"vec3"),e.attributes.add(f.INSTANCEMODELORIGINLO,"vec3"),e.attributes.add(f.INSTANCEMODEL,"mat3"),e.attributes.add(f.INSTANCEMODELNORMAL,"mat3"));const p=e.vertex;c&&(p.include(s,o),p.uniforms.add(new m("viewOriginHi",((e,r)=>x(a(T,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]),T))),new m("viewOriginLo",((e,r)=>g(a(T,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]),T))))),p.code.add(d`
|
|
6
6
|
vec3 getVertexInLocalOriginSpace() {
|
|
7
7
|
return ${i?c?"(model * vec4(instanceModel * localPosition().xyz, 1.0)).xyz":"(model * localPosition()).xyz":c?"instanceModel * localPosition().xyz":"localPosition().xyz"};
|
|
8
8
|
}
|
|
@@ -14,13 +14,13 @@ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{n as r}from"../
|
|
|
14
14
|
}
|
|
15
15
|
`),p.code.add(d`
|
|
16
16
|
vec3 dpNormal(vec4 _normal) {
|
|
17
|
-
return normalize(${i?c?"normalLocalOriginFromModel *
|
|
17
|
+
return normalize(${i?c?"normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz)":"normalLocalOriginFromModel * _normal.xyz":c?"instanceModelNormal * _normal.xyz":"_normal.xyz"});
|
|
18
18
|
}
|
|
19
|
-
`),o.output===
|
|
19
|
+
`),o.output===t.Normal&&(l(p),p.code.add(d`
|
|
20
20
|
vec3 dpNormalView(vec4 _normal) {
|
|
21
|
-
|
|
21
|
+
return normalize((viewNormal * ${i?c?"vec4(normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz), 1.0)":"vec4(normalLocalOriginFromModel * _normal.xyz, 1.0)":c?"vec4(instanceModelNormal * _normal.xyz, 1.0)":"_normal"}).xyz);
|
|
22
22
|
}
|
|
23
23
|
`)),o.hasVertexTangents&&p.code.add(d`
|
|
24
24
|
vec4 dpTransformVertexTangent(vec4 _tangent) {
|
|
25
|
-
${c?"return vec4(instanceModelNormal * _tangent.xyz, _tangent.w);":"return _tangent;"}
|
|
26
|
-
}`)}const
|
|
25
|
+
${i?c?"return vec4(normalLocalOriginFromModel * (instanceModelNormal * _tangent.xyz), _tangent.w);":"return vec4(normalLocalOriginFromModel * _tangent.xyz, _tangent.w);":c?"return vec4(instanceModelNormal * _tangent.xyz, _tangent.w);":"return _tangent;"}
|
|
26
|
+
}`)}const T=i();export{O as InstancedDoubleConfiguration,h as InstancedDoublePassParameters,N as InstancedDoublePrecision};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as n}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as m,ConsumesDepthNormal as l,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as w}from"../../lib/RenderSlot.js";import{g as x}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as f,PixelFormat as P,ClearBufferBit as S}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let y=class extends m{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[w.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?l:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(T.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=f.CLAMP_TO_EDGE,t.pixelFormat=P.RGB,t.wrapMode=f.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!r?.normalTexture)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const o=e.rctx,a=s.camera,m=this.view.qualitySettings.fadeDuration,l=m>0?Math.min(m,e.time-this._enableTime)/m:1;this._passParameters.normalTexture=r.normalTexture,this._passParameters.depthTexture=i,this._passParameters.projScale=1/a.
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as n}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as m,ConsumesDepthNormal as l,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as w}from"../../lib/RenderSlot.js";import{g as x}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as f,PixelFormat as P,ClearBufferBit as S}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let y=class extends m{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[w.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?l:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(T.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=f.CLAMP_TO_EDGE,t.pixelFormat=P.RGB,t.wrapMode=f.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!r?.normalTexture)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const o=e.rctx,a=s.camera,m=this.view.qualitySettings.fadeDuration,l=m>0?Math.min(m,e.time-this._enableTime)/m:1;this._passParameters.normalTexture=r.normalTexture,this._passParameters.depthTexture=i,this._passParameters.projScale=1/a.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/x(a)**6*l;const u=a.fullViewport[2],h=a.fullViewport[3],p=u/R,_=h/R,d=this._context.fbos,b=d.acquire(c.RED,u,h);o.bindFramebuffer(b.fbo),o.setViewport(0,0,u,h);o.bindTechnique(this._ssaoTechnique,this._passParameters,s).bindDraw(this._drawParameters,s,this._passParameters),o.screen.draw();const T=o.bindTechnique(this._blurTechnique,this._passParameters,s);o.setViewport(0,0,p,_);const w=d.acquire(c.RED,p,_);o.bindFramebuffer(w.fbo),this._drawParameters.colorTexture=b.colorTexture,n(this._drawParameters.blurSize,0,R/h),T.bindDraw(this._drawParameters,s,this._passParameters),o.setViewport(0,0,p,_),o.screen.draw(),b.release();const f=d.acquire(c.RED,p,_);return o.bindFramebuffer(f.fbo),o.setViewport(0,0,u,h),o.setClearColor(1,1,1,0),o.clear(S.COLOR_BUFFER_BIT),o.setViewport(0,0,p,_),this._drawParameters.colorTexture=w.colorTexture,n(this._drawParameters.blurSize,R/u,0),T.bindDraw(this._drawParameters,s,this._passParameters),o.screen.draw(),o.setViewport4fv(a.fullViewport),w.release(),l<1&&this._context.requestRender(),f}};e([o({constructOnly:!0})],y.prototype,"view",void 0),e([o()],y.prototype,"_context",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SSAO")],y);const O=.5;export{y as SSAO,R as blurSizePixels};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class s{constructor(s,t,i
|
|
5
|
+
class s{constructor(s,t,i=t){this.data=s,this.size=t,this.stride=i}}class t extends s{constructor(s,t,i,e=!1,c=i){super(s,i,c),this.indices=t,this.exclusive=e}}export{t as Attribute,s as Vertices};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import i from"../../../../core/PooledArray.js";import{p as t,a as
|
|
5
|
+
import i from"../../../../core/PooledArray.js";import{p as t,a as e}from"../../../../chunks/vec3.js";import{f as s,g as r,c as n}from"../../../../chunks/vec3f64.js";import{assert as h}from"./Util.js";class o{constructor(i,e,o){this.primitiveIndices=i,this._numIndexPerPrimitive=e,this.position=o,this._children=void 0,h(i.length>=1),h(3===o.size||4===o.size);const{data:c,size:l,indices:m}=o;h(m.length%this._numIndexPerPrimitive==0),h(m.length>=i.length*this._numIndexPerPrimitive);const d=i.length;let u=l*m[this._numIndexPerPrimitive*i[0]];a.clear(),a.push(u);const f=s(c[u],c[u+1],c[u+2]),x=r(f);for(let t=0;t<d;++t){const e=this._numIndexPerPrimitive*i[t];for(let i=0;i<this._numIndexPerPrimitive;++i){u=l*m[e+i],a.push(u);let t=c[u];f[0]=Math.min(t,f[0]),x[0]=Math.max(t,x[0]),t=c[u+1],f[1]=Math.min(t,f[1]),x[1]=Math.max(t,x[1]),t=c[u+2],f[2]=Math.min(t,f[2]),x[2]=Math.max(t,x[2])}}this.bbMin=f,this.bbMax=x;const P=t(n(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(x[0]-f[0],x[1]-f[1]),x[2]-f[2]);let p=this.radius*this.radius;for(let t=0;t<a.length;++t){u=a.at(t);const i=c[u]-P[0],e=c[u+1]-P[1],s=c[u+2]-P[2],r=i*i+e*e+s*s;if(r<=p)continue;const n=Math.sqrt(r),h=.5*(n-this.radius);this.radius=this.radius+h,p=this.radius*this.radius;const o=h/n;P[0]+=i*o,P[1]+=e*o,P[2]+=s*o}this.center=P,a.clear()}getChildren(){if(this._children||e(this.bbMin,this.bbMax)<=1)return this._children;const i=t(n(),this.bbMin,this.bbMax,.5),s=this.primitiveIndices.length,r=new Uint8Array(s),h=new Array(8);for(let t=0;t<8;++t)h[t]=0;const{data:a,size:c,indices:l}=this.position;for(let t=0;t<s;++t){let e=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[t];let n=c*l[s],o=a[n],m=a[n+1],d=a[n+2];for(let i=1;i<this._numIndexPerPrimitive;++i){n=c*l[s+i];const t=a[n],e=a[n+1],r=a[n+2];t<o&&(o=t),e<m&&(m=e),r<d&&(d=r)}o<i[0]&&(e|=1),m<i[1]&&(e|=2),d<i[2]&&(e|=4),r[t]=e,++h[e]}let m=0;for(let t=0;t<8;++t)h[t]>0&&++m;if(m<2)return;const d=new Array(8);for(let t=0;t<8;++t)d[t]=h[t]>0?new Uint32Array(h[t]):void 0;for(let t=0;t<8;++t)h[t]=0;for(let t=0;t<s;++t){const i=r[t];d[i][h[i]++]=this.primitiveIndices[t]}this._children=new Array;for(let t=0;t<8;++t)void 0!==d[t]&&this._children.push(new o(d[t],this._numIndexPerPrimitive,this.position));return this._children}static prune(){a.prune()}}const a=new i({deallocator:null});export{o as BoundingInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import e from"../../../../core/Logger.js";import{lerp as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as h}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as a,m as p,q as u,a as _,i as v,t as l,u as c}from"../../../../chunks/mat4.js";import{a as w}from"../../../../chunks/mat4f64.js";import{j as d,m as y}from"../../../../chunks/vec2.js";import{f as g}from"../../../../chunks/vec2f64.js";import{f,o as m,c as x,h as M,u as T,j as D,F as j,y as R,i as P,l as F,s as O,b as V,n as S,C}from"../../../../chunks/vec3.js";import{c as I}from"../../../../chunks/vec3f64.js";import{b,e as E,h as L,c as H,i as k,t as U}from"../../../../chunks/vec4.js";import{f as B,c as G}from"../../../../chunks/vec4f64.js";import{create as A,copy as z,fromMatrix as W}from"../../../../geometry/support/frustum.js";import{create as X}from"../../../../geometry/support/ray.js";import{projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{fovd2fovx as N,fovx2fovd as J,fovd2fovy as K,fovy2fovd as Q}from"./fov.js";var Z;let $=Z=class extends i{constructor(t={}){super(t),this._center=I(),this._up=I(),this._viewUp=I(),this._viewForward=I(),this._viewRight=I(),this._ray=X(),this._viewport=B(0,0,1,1),this._padding=B(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=A(),this._fullViewport=G(),this._pixelRatio=1,this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),this._viewForward}get viewUp(){return this._ensureViewClean(),this._viewUp}get viewRight(){return this._ensureViewClean(),this._viewRight}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=b(G(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&E(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=b(G(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&E(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[ht.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[ht.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[ht.RIGHT]+this._padding[ht.LEFT]}set fullWidth(t){this.width=t-(this._padding[ht.RIGHT]+this._padding[ht.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[ht.TOP]+this._padding[ht.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[ht.TOP]+this._padding[ht.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[ht.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[ht.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){L(this._padding,t)||(this._viewport[0]+=t[ht.LEFT]-this._padding[ht.LEFT],this._viewport[1]+=t[ht.BOTTOM]-this._padding[ht.BOTTOM],this._viewport[2]-=t[ht.RIGHT]+t[ht.LEFT]-(this._padding[ht.RIGHT]+this._padding[ht.LEFT]),this._viewport[3]-=t[ht.TOP]+t[ht.BOTTOM]-(this._padding[ht.TOP]+this._padding[ht.BOTTOM]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2),r=e*this._aspect,s=u(w(),-r*(1+2*this._padding[ht.LEFT]/t),r*(1+2*this._padding[ht.RIGHT]/t),-e*(1+2*this._padding[ht.BOTTOM]/i),e*(1+2*this._padding[ht.TOP]/i),this.near,this.far),h=this._get("projectionMatrix");return h&&_(h,s)?h:s}get inverseProjectionMatrix(){return v(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return N(this._fov,this.width,this.height)}set fovX(t){this._fov=J(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return K(this._fov,this.width,this.height)}set fovY(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return m(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(v(this._viewInverseTransposeMatrix,this.viewMatrix),l(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const i=2*t-1;return 2*this.near*this.far/(this.far+this.near-i*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}copyFrom(t){x(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),x(this._viewRight,t.viewRight),x(this._viewUp,t.viewUp),x(this._viewForward,t.viewForward)),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(z(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return(new Z).copyFrom(this)}equals(t){return M(this.eye,t.eye)&&M(this.center,t.center)&&M(this.up,t.up)&&L(this._viewport,t.viewport)&&L(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||k(t.screenPadding,this.screenPadding)>=i||k(this.screenViewport,t.screenViewport)>=i)return!1;T(et,t.eye,t.center),T(rt,this.eye,this.center);const e=D(et,rt),r=j(et),s=j(rt),h=5e-4;return e*e>=(1-1e-10)*r*s&&R(t.eye,this.eye)<Math.max(r,s)*h*h}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(Y(this.viewForward,f(et,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[ht.LEFT]+this.width/2)/this.pixelRatio,t[1]=(this.padding[ht.TOP]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[ht.LEFT]+this.width*i,t[1]=this.padding[ht.BOTTOM]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==tt&&x(tt,t),tt[3]=1,U(tt,tt,this.projectionMatrix);const e=Math.abs(tt[3]);P(tt,tt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*tt[0]),i[1]=r(0,s[1]+s[3],.5+.5*tt[1]),i[2]=.5*(tt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;tt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],tt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],tt[2]=(2*t[2]-1)*t[3],tt[3]=t[3],null!=this.inverseProjectionMatrix&&(U(tt,tt,this.inverseProjectionMatrix),i[0]=tt[0],i[1]=tt[1],i[2]=tt[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,st),this.renderToScreen(st,i),i}projectToRenderScreen(t,i){if(tt[0]=t[0],tt[1]=t[1],tt[2]=t[2],tt[3]=1,U(tt,tt,this.viewProjectionMatrix),0===tt[3])return null;P(tt,tt,1/Math.abs(tt[3]));const e=this.fullViewport;return"x"in i?(i.x=r(0,e[0]+e[2],.5+.5*tt[0]),i.y=r(0,e[1]+e[3],.5+.5*tt[1])):(i[0]=r(0,e[0]+e[2],.5+.5*tt[0]),i[1]=r(0,e[1]+e[3],.5+.5*tt[1]),i.length>2&&(i[2]=.5*(tt[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,st),i)}unprojectFromRenderScreen(t,i){if(p(it,this.projectionMatrix,this.viewMatrix),!v(it,it))return null;const e=this.fullViewport;return tt[0]=2*(t[0]-e[0])/e[2]-1,tt[1]=2*(t[1]-e[1])/e[3]-1,tt[2]=2*t[2]-1,tt[3]=1,U(tt,tt,it),0===tt[3]?null:(i[0]=tt[0]/tt[3],i[1]=tt[1]/tt[3],i[2]=tt[2]/tt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,h=i*this.pixelRatio,o=Math.max(s-e/2,0),n=Math.max(this.fullHeight-h-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-h-r/2,0);return[o,n,e-a- -Math.min(this.fullWidth-s-e/2,0),r-p- -Math.min(h-r/2,0)]}computeUp(t){t===q.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}_computeUpGlobal(){f(et,this.center,this.eye);const t=F(this.center);t<1?(O(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(D(et,this.center))>.9999*F(et)*t||(V(this._up,et,this.center),V(this._up,this._up,et),S(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){C(et,this.eye,this.center),Math.abs(et[2])<=.9999&&(P(et,et,et[2]),O(this._up,-et[0],-et[1],1-et[2]),S(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?M(t,i)||(x(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(W(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(c(this._viewMatrix,this.eye,this.center,this.up),O(this._viewForward,-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10]),O(this._viewUp,this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9]),O(this._viewRight,this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8]),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([o()],$.prototype,"_center",void 0),t([o()],$.prototype,"_up",void 0),t([o()],$.prototype,"_viewport",void 0),t([o()],$.prototype,"_padding",void 0),t([o()],$.prototype,"_fov",void 0),t([o()],$.prototype,"_nearFar",void 0),t([o()],$.prototype,"_pixelRatio",void 0),t([o()],$.prototype,"pixelRatio",null),t([o()],$.prototype,"eye",null),t([o()],$.prototype,"center",null),t([o()],$.prototype,"up",null),t([o({readOnly:!0})],$.prototype,"nearFar",null),t([o()],$.prototype,"near",null),t([o()],$.prototype,"far",null),t([o()],$.prototype,"viewport",null),t([o({readOnly:!0})],$.prototype,"screenViewport",null),t([o({readOnly:!0})],$.prototype,"screenPadding",null),t([o()],$.prototype,"x",null),t([o()],$.prototype,"y",null),t([o()],$.prototype,"width",null),t([o()],$.prototype,"height",null),t([o()],$.prototype,"fullWidth",null),t([o()],$.prototype,"fullHeight",null),t([o({readOnly:!0})],$.prototype,"_aspect",null),t([o()],$.prototype,"padding",null),t([o({readOnly:!0})],$.prototype,"projectionMatrix",null),t([o({readOnly:!0})],$.prototype,"inverseProjectionMatrix",null),t([o()],$.prototype,"fov",null),t([o()],$.prototype,"fovX",null),t([o()],$.prototype,"fovY",null),$=Z=t([n("esri.views.3d.webgl-engine.lib.Camera")],$);const tt=G(),it=w(),et=I(),rt=I(),st=h();var ht;!function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"}(ht||(ht={}));export{$ as Camera,ht as PaddingSide};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import e from"../../../../core/Logger.js";import{lerp as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as h}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as a,m as p,q as u,a as _,i as v,t as l,u as c}from"../../../../chunks/mat4.js";import{a as w}from"../../../../chunks/mat4f64.js";import{j as d,m as y}from"../../../../chunks/vec2.js";import{f as g}from"../../../../chunks/vec2f64.js";import{f,o as m,c as x,h as M,u as T,j as D,F as j,y as R,i as P,l as F,s as O,b as V,n as S,C}from"../../../../chunks/vec3.js";import{c as I}from"../../../../chunks/vec3f64.js";import{b,e as E,h as L,c as H,i as k,t as U}from"../../../../chunks/vec4.js";import{f as B,c as G}from"../../../../chunks/vec4f64.js";import{create as A,copy as z,fromMatrix as W}from"../../../../geometry/support/frustum.js";import{create as X}from"../../../../geometry/support/ray.js";import{projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{fovd2fovx as N,fovx2fovd as J,fovd2fovy as K,fovy2fovd as Q}from"./fov.js";var Z;let $=Z=class extends i{constructor(t={}){super(t),this._center=I(),this._up=I(),this._viewUp=I(),this._viewForward=I(),this._viewRight=I(),this._ray=X(),this._viewport=B(0,0,1,1),this._padding=B(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=A(),this._fullViewport=G(),this._pixelRatio=1,this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),this._viewForward}get viewUp(){return this._ensureViewClean(),this._viewUp}get viewRight(){return this._ensureViewClean(),this._viewRight}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=b(G(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&E(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=b(G(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&E(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[ht.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[ht.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[ht.RIGHT]+this._padding[ht.LEFT]}set fullWidth(t){this.width=t-(this._padding[ht.RIGHT]+this._padding[ht.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[ht.TOP]+this._padding[ht.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[ht.TOP]+this._padding[ht.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[ht.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[ht.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){L(this._padding,t)||(this._viewport[0]+=t[ht.LEFT]-this._padding[ht.LEFT],this._viewport[1]+=t[ht.BOTTOM]-this._padding[ht.BOTTOM],this._viewport[2]-=t[ht.RIGHT]+t[ht.LEFT]-(this._padding[ht.RIGHT]+this._padding[ht.LEFT]),this._viewport[3]-=t[ht.TOP]+t[ht.BOTTOM]-(this._padding[ht.TOP]+this._padding[ht.BOTTOM]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2),r=e*this._aspect,s=u(w(),-r*(1+2*this._padding[ht.LEFT]/t),r*(1+2*this._padding[ht.RIGHT]/t),-e*(1+2*this._padding[ht.BOTTOM]/i),e*(1+2*this._padding[ht.TOP]/i),this.near,this.far),h=this._get("projectionMatrix");return h&&_(h,s)?h:s}get inverseProjectionMatrix(){return v(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return N(this._fov,this.width,this.height)}set fovX(t){this._fov=J(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return K(this._fov,this.width,this.height)}set fovY(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return m(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(v(this._viewInverseTransposeMatrix,this.viewMatrix),l(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const i=2*t-1;return 2*this.near*this.far/(this.far+this.near-i*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}copyFrom(t){x(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),x(this._viewRight,t.viewRight),x(this._viewUp,t.viewUp),x(this._viewForward,t.viewForward)),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(z(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return(new Z).copyFrom(this)}equals(t){return M(this.eye,t.eye)&&M(this.center,t.center)&&M(this.up,t.up)&&L(this._viewport,t.viewport)&&L(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||k(t.screenPadding,this.screenPadding)>=i||k(this.screenViewport,t.screenViewport)>=i)return!1;T(et,t.eye,t.center),T(rt,this.eye,this.center);const e=D(et,rt),r=j(et),s=j(rt),h=5e-4;return e*e>=(1-1e-10)*r*s&&R(t.eye,this.eye)<Math.max(r,s)*h*h}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(Y(this.viewForward,f(et,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[ht.LEFT]+this.width/2)/this.pixelRatio,t[1]=(this.padding[ht.TOP]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[ht.LEFT]+this.width*i,t[1]=this.padding[ht.BOTTOM]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==tt&&x(tt,t),tt[3]=1,U(tt,tt,this.projectionMatrix);const e=Math.abs(tt[3]);P(tt,tt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*tt[0]),i[1]=r(0,s[1]+s[3],.5+.5*tt[1]),i[2]=.5*(tt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;tt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],tt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],tt[2]=(2*t[2]-1)*t[3],tt[3]=t[3],null!=this.inverseProjectionMatrix&&(U(tt,tt,this.inverseProjectionMatrix),i[0]=tt[0],i[1]=tt[1],i[2]=tt[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,st),this.renderToScreen(st,i),i}projectToRenderScreen(t,i){if(tt[0]=t[0],tt[1]=t[1],tt[2]=t[2],tt[3]=1,U(tt,tt,this.viewProjectionMatrix),0===tt[3])return null;P(tt,tt,1/Math.abs(tt[3]));const e=this.fullViewport;return"x"in i?(i.x=r(0,e[0]+e[2],.5+.5*tt[0]),i.y=r(0,e[1]+e[3],.5+.5*tt[1])):(i[0]=r(0,e[0]+e[2],.5+.5*tt[0]),i[1]=r(0,e[1]+e[3],.5+.5*tt[1]),i.length>2&&(i[2]=.5*(tt[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,st),i)}unprojectFromRenderScreen(t,i){if(p(it,this.projectionMatrix,this.viewMatrix),!v(it,it))return null;const e=this.fullViewport;return tt[0]=2*(t[0]-e[0])/e[2]-1,tt[1]=2*(t[1]-e[1])/e[3]-1,tt[2]=2*t[2]-1,tt[3]=1,U(tt,tt,it),0===tt[3]?null:(i[0]=tt[0]/tt[3],i[1]=tt[1]/tt[3],i[2]=tt[2]/tt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,h=i*this.pixelRatio,o=Math.max(s-e/2,0),n=Math.max(this.fullHeight-h-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-h-r/2,0);return[o,n,e-a- -Math.min(this.fullWidth-s-e/2,0),r-p- -Math.min(h-r/2,0)]}computeUp(t){t===q.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}_computeUpGlobal(){f(et,this.center,this.eye);const t=F(this.center);t<1?(O(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(D(et,this.center))>.9999*F(et)*t||(V(this._up,et,this.center),V(this._up,this._up,et),S(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){C(et,this.eye,this.center),Math.abs(et[2])<=.9999&&(P(et,et,et[2]),O(this._up,-et[0],-et[1],1-et[2]),S(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?M(t,i)||(x(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(W(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(c(this._viewMatrix,this.eye,this.center,this.up),O(this._viewForward,-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10]),O(this._viewUp,this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9]),O(this._viewRight,this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8]),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([o()],$.prototype,"_center",void 0),t([o()],$.prototype,"_up",void 0),t([o()],$.prototype,"_viewport",void 0),t([o()],$.prototype,"_padding",void 0),t([o()],$.prototype,"_fov",void 0),t([o()],$.prototype,"_nearFar",void 0),t([o()],$.prototype,"_pixelRatio",void 0),t([o()],$.prototype,"pixelRatio",null),t([o()],$.prototype,"eye",null),t([o()],$.prototype,"center",null),t([o()],$.prototype,"up",null),t([o({readOnly:!0})],$.prototype,"nearFar",null),t([o()],$.prototype,"near",null),t([o()],$.prototype,"far",null),t([o()],$.prototype,"viewport",null),t([o({readOnly:!0})],$.prototype,"screenViewport",null),t([o({readOnly:!0})],$.prototype,"screenPadding",null),t([o()],$.prototype,"x",null),t([o()],$.prototype,"y",null),t([o()],$.prototype,"width",null),t([o()],$.prototype,"height",null),t([o()],$.prototype,"fullWidth",null),t([o()],$.prototype,"fullHeight",null),t([o({readOnly:!0})],$.prototype,"_aspect",null),t([o()],$.prototype,"padding",null),t([o({readOnly:!0})],$.prototype,"projectionMatrix",null),t([o({readOnly:!0})],$.prototype,"inverseProjectionMatrix",null),t([o()],$.prototype,"fov",null),t([o()],$.prototype,"fovX",null),t([o()],$.prototype,"fovY",null),$=Z=t([n("esri.views.3d.webgl-engine.lib.Camera")],$);const tt=G(),it=w(),et=I(),rt=I(),st=h();var ht;!function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"}(ht||(ht={}));export{$ as Camera,ht as PaddingSide};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{I as t,b as i}from"../../../../chunks/mat4f64.js";import{e}from"../../../../chunks/vec3.js";import{
|
|
5
|
+
import{I as t,b as i}from"../../../../chunks/mat4f64.js";import{e}from"../../../../chunks/vec3.js";import{getContinuousIndexArray as n,compactIndices as s}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as r}from"./AttributeArray.js";import{Object3DState as o}from"./basicInterfaces.js";import{BoundingInfo as h}from"./BoundingInfo.js";import{ContentObject as a}from"./ContentObject.js";import{ContentObjectType as u}from"./ContentObjectType.js";import{computeAttachmentOriginTriangles as g,computeAttachmentOriginLines as c,computeAttachmentOriginPoints as l}from"./geometryDataUtils.js";import{Object3DStateID as m}from"./Object3DStateID.js";import{assert as d}from"./Util.js";import{VertexAttribute as f}from"./VertexAttribute.js";import{addObject3DStateID as b,removeObject3DStateID as p}from"../materials/renderers/utils.js";class I extends a{constructor(t,i,e=null,r=u.Mesh,o=null,h=-1){super(),this.material=t,this.mapPositions=e,this.type=r,this.objectAndLayerIdColor=o,this.edgeIndicesLength=h,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[a,u]of i)0===u.indices.length&&(u.indices=n(i[0][1].data.length/3)),this._attributes.set(a,{...u,indices:s(u.indices)}),a===f.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(a).indices.length:this.edgeIndicesLength)}instantiate(t={}){const i=new I(t.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)})),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:r(i.data)},this._attributes.set(t,i)),i}setAttributeData(t,i){const e=this._attributes.get(t);e&&this._attributes.set(t,{...e,exclusive:!0,data:i})}get indexCount(){const t=this._attributes.values().next().value.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return null==this._boundingInfo&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(t){return!!(this.type===u.Mesh?this._computeAttachmentOriginTriangles(t):this.type===u.Line?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t))&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_computeAttachmentOriginTriangles(t){const i=this.attributes.get(f.POSITION);return g(i,t)}_computeAttachmentOriginLines(t){const i=this.attributes.get(f.POSITION);return c(i,_(this.material.parameters,i),t)}_computeAttachmentOriginPoints(t){const i=this.attributes.get(f.POSITION);return l(i,t)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const t=this.attributes.get(f.POSITION);if(!t)return null;const i=this.type===u.Mesh?3:1;d(t.indices.length%i==0,"Indexing error: "+t.indices.length+" not divisible by "+i);const e=n(t.indices.length/i);return new h(e,i,t)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}addHighlight(){const t=new m(o.Highlight);return this.highlights=b(this.highlights,t),t}removeHighlight(t){this.highlights=p(this.highlights,t)}}function _(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i.indices.length>2}export{I as Geometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{f as t,b as n,n as e,i as s,g as o,j as r,s as l,c as h,e as u}from"../../../../chunks/vec3.js";import{f as c,c as a,a as f}from"../../../../chunks/vec3f32.js";import{c as p}from"../../../../chunks/vec3f64.js";import{newDoubleArray as i}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as w,floatArrayFrom as g}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as O,getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{create as M,fromPositionAndNormal as A,intersectRay as I}from"../../../../geometry/support/plane.js";import{wrap as y}from"../../../../geometry/support/ray.js";import{Attribute as P}from"./Attribute.js";import{Vec3Compact as N}from"./BufferVectorMath.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{Geometry as S}from"./Geometry.js";import{assert as R}from"./Util.js";import{VertexAttribute as L}from"./VertexAttribute.js";const b=N,j=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],d=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],U=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],V=new Array(36);for(let At=0;At<6;At++)for(let t=0;t<6;t++)V[6*At+t]=At;const x=new Array(36);for(let At=0;At<6;At++)x[6*At]=0,x[6*At+1]=1,x[6*At+2]=2,x[6*At+3]=2,x[6*At+4]=3,x[6*At+5]=0;function E(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let s=0;s<8;s++)e[3*s]=j[s][0]*n[0],e[3*s+1]=j[s][1]*n[1],e[3*s+2]=j[s][2]*n[2];return new S(t,[[L.POSITION,new P(e,3,!0),v],[L.NORMAL,new P(d,3),V],[L.UV0,new P(U,2),x]])}const F=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],G=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],C=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],k=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function q(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let s=0;s<6;s++)e[3*s]=F[s][0]*n[0],e[3*s+1]=F[s][1]*n[1],e[3*s+2]=F[s][2]*n[2];return new S(t,[[L.POSITION,new P(e,3,!0),C],[L.NORMAL,new P(G,3),k]])}const B=c(-.5,0,-.5),z=c(.5,0,-.5),D=c(0,0,.5),X=c(0,.5,0),Z=a(),H=a(),J=a(),K=a(),Q=a();t(Z,B,X),t(H,B,z),n(J,Z,H),e(J,J),t(Z,z,X),t(H,z,D),n(K,Z,H),e(K,K),t(Z,D,X),t(H,D,B),n(Q,Z,H),e(Q,Q);const W=[B,z,D,X],Y=[0,-1,0,J[0],J[1],J[2],K[0],K[1],K[2],Q[0],Q[1],Q[2]],$=[0,1,2,3,1,0,3,2,1,3,0,2],_=[0,0,0,1,1,1,2,2,2,3,3,3];function tt(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let s=0;s<4;s++)e[3*s]=W[s][0]*n[0],e[3*s+1]=W[s][1]*n[1],e[3*s+2]=W[s][2]*n[2];return new S(t,[[L.POSITION,new P(e,3,!0),$],[L.NORMAL,new P(Y,3),_]])}function nt(t,n,e,s,o={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(s)),f=(c+1)*(a+1),p=w(3*f),i=w(3*f),g=w(2*f),m=[];let M=0;for(let w=0;w<=a;w++){const t=[],e=w/a,s=h+e*u,o=Math.cos(s);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*o,w=Math.sin(s),O=-Math.sin(a)*o;p[3*M]=f*n,p[3*M+1]=w*n,p[3*M+2]=O*n,i[3*M]=f,i[3*M+1]=w,i[3*M+2]=O,g[2*M]=u,g[2*M+1]=e,t.push(M),++M}m.push(t)}const A=new Array;for(let w=0;w<a;w++)for(let t=0;t<c;t++){const n=m[w][t],e=m[w][t+1],s=m[w+1][t+1],o=m[w+1][t];0===w?(A.push(n),A.push(s),A.push(o)):w===a-1?(A.push(n),A.push(e),A.push(s)):(A.push(n),A.push(e),A.push(s),A.push(s),A.push(o),A.push(n))}const I=[[L.POSITION,new P(p,3,!0),A],[L.NORMAL,new P(i,3,!0),A]];return o.uv&&I.push([L.UV0,new P(g,2,!0),A]),o.offset&&(I[0][0]=L.OFFSET,I.push([L.POSITION,new P(Float64Array.from(o.offset),3,!0),O(A.length)])),new S(t,I)}function et(t,n,e,s){const o=st(n,e,s);return new S(t,o)}function st(t,n,e){const s=t;let o,r;if(e)o=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=s*(1+Math.sqrt(5))/2;o=[-s,t,0,s,t,0,-s,-t,0,s,-t,0,0,-s,t,0,s,t,0,-s,-t,0,s,-t,t,0,-s,t,0,s,-t,0,-s,-t,0,s],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<o.length;c+=3)b.scale(o,c,t/b.length(o,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const s=n.toString()+"."+e.toString();if(l[s])return l[s];let r=o.length;return o.length+=3,b.add(o,3*n,o,3*e,o,r),b.scale(o,r,t/b.length(o,r)),r/=3,l[s]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],s=r[e+1],o=r[e+2],l=h(t,s),u=h(s,o),c=h(o,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=s,n[a+4]=u,n[a+5]=l,n[a+6]=o,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=g(o);for(let c=0;c<u.length;c+=3)b.normalize(u,c);return[[L.POSITION,new P(g(o),3,!0),r],[L.NORMAL,new P(u,3,!0),r]]}function ot(t,n,e,s,o,r,l,h,u=null){const c=e?[e[0],e[1],e[2]]:[0,0,0],a=n?[n[0],n[1],n[2]]:[0,0,1];l=l||[0,0];const f=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],p=null!=o&&2===o.length?o:[1,1],i=[[L.POSITION,new P(c,3,!0),null],[L.NORMAL,new P(a,3,!0),null],[L.UV0,new P(l,l.length),null],[L.COLOR,new P(f,4,!0),null],[L.SIZE,new P(p,2),null]];if(null!=r){const t=[r[0],r[1],r[2],r[3]];i.push([L.AUXPOS1,new P(t,4),null])}if(null!=h){const t=[h[0],h[1],h[2],h[3]];i.push([L.FEATUREATTRIBUTE,new P(t,4),null])}return new S(t,i,null,T.Point,u)}const rt=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function lt(t,n=rt){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const s=[0,1,2,2,3,0],o=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[L.POSITION,new P(e,3,!0),s],[L.NORMAL,new P(o,3,!0),r],[L.UV0,new P(l,2,!0),s],[L.COLOR,new P(h,4,!0),r]];return new S(t,u)}function ht(t,n,e,s,o,r=!0,l=!0){let h=0;const u=e,a=n;let f=c(0,h,0),p=c(0,h+a,0),i=c(0,-1,0),g=c(0,1,0);o&&(h=a,p=c(0,0,0),f=c(0,h,0),i=c(0,1,0),g=c(0,-1,0));const O=[p,f],m=[i,g],M=s+2,A=Math.sqrt(a*a+u*u);if(o)for(let w=s-1;w>=0;w--){const t=w*(2*Math.PI/s),n=c(Math.cos(t)*u,h,Math.sin(t)*u);O.push(n);const e=c(a*Math.cos(t)/A,-u/A,a*Math.sin(t)/A);m.push(e)}else for(let w=0;w<s;w++){const t=w*(2*Math.PI/s),n=c(Math.cos(t)*u,h,Math.sin(t)*u);O.push(n);const e=c(a*Math.cos(t)/A,u/A,a*Math.sin(t)/A);m.push(e)}const I=new Array,y=new Array;if(r){for(let t=3;t<O.length;t++)I.push(1),I.push(t-1),I.push(t),y.push(0),y.push(0),y.push(0);I.push(O.length-1),I.push(2),I.push(1),y.push(0),y.push(0),y.push(0)}if(l){for(let t=3;t<O.length;t++)I.push(t),I.push(t-1),I.push(0),y.push(t),y.push(t-1),y.push(1);I.push(0),I.push(2),I.push(O.length-1),y.push(1),y.push(2),y.push(m.length-1)}const N=w(3*M);for(let c=0;c<M;c++)N[3*c]=O[c][0],N[3*c+1]=O[c][1],N[3*c+2]=O[c][2];const T=w(3*M);for(let c=0;c<M;c++)T[3*c]=m[c][0],T[3*c+1]=m[c][1],T[3*c+2]=m[c][2];const R=[[L.POSITION,new P(N,3,!0),I],[L.NORMAL,new P(T,3,!0),y]];return new S(t,R)}function ut(t,h,u,p,i,g,O){const m=i?f(i):c(1,0,0),M=g?f(g):c(0,0,0);O??=!0;const A=a();e(A,m);const I=a();s(I,A,Math.abs(h));const y=a();s(y,I,-.5),o(y,y,M);const N=c(0,1,0);Math.abs(1-r(A,N))<.2&&l(N,0,0,1);const T=a();n(T,A,N),e(T,T),n(N,T,A);const R=2*p+(O?2:0),b=p+(O?2:0),j=w(3*R),d=w(3*b),U=w(2*R),v=new Array(3*p*(O?4:2)),V=new Array(3*p*(O?4:2));O&&(j[3*(R-2)]=y[0],j[3*(R-2)+1]=y[1],j[3*(R-2)+2]=y[2],U[2*(R-2)]=0,U[2*(R-2)+1]=0,j[3*(R-1)]=j[3*(R-2)]+I[0],j[3*(R-1)+1]=j[3*(R-2)+1]+I[1],j[3*(R-1)+2]=j[3*(R-2)+2]+I[2],U[2*(R-1)]=1,U[2*(R-1)+1]=1,d[3*(b-2)]=-A[0],d[3*(b-2)+1]=-A[1],d[3*(b-2)+2]=-A[2],d[3*(b-1)]=A[0],d[3*(b-1)+1]=A[1],d[3*(b-1)+2]=A[2]);const x=(t,n,e)=>{v[t]=n,V[t]=e};let E=0;const F=a(),G=a();for(let n=0;n<p;n++){const t=n*(2*Math.PI/p);s(F,N,Math.sin(t)),s(G,T,Math.cos(t)),o(F,F,G),d[3*n]=F[0],d[3*n+1]=F[1],d[3*n+2]=F[2],s(F,F,u),o(F,F,y),j[3*n]=F[0],j[3*n+1]=F[1],j[3*n+2]=F[2],U[2*n]=n/p,U[2*n+1]=0,j[3*(n+p)]=j[3*n]+I[0],j[3*(n+p)+1]=j[3*n+1]+I[1],j[3*(n+p)+2]=j[3*n+2]+I[2],U[2*(n+p)]=n/p,U[2*n+1]=1;const e=(n+1)%p;x(E++,n,n),x(E++,n+p,n),x(E++,e,e),x(E++,e,e),x(E++,n+p,n),x(E++,e+p,e)}if(O){for(let t=0;t<p;t++){const n=(t+1)%p;x(E++,R-2,b-2),x(E++,t,b-2),x(E++,n,b-2)}for(let t=0;t<p;t++){const n=(t+1)%p;x(E++,t+p,b-1),x(E++,R-1,b-1),x(E++,n+p,b-1)}}const C=[[L.POSITION,new P(j,3,!0),v],[L.NORMAL,new P(d,3,!0),V],[L.UV0,new P(U,2,!0),v]];return new S(t,C)}function ct(t,n,e,s,o,r){s=s||10,o=null==o||o,R(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<s;c++){h.push([0,-c-1,-(c+1)%s-1]);const t=c/s*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return at(t,u,n,l,h,o,r)}function at(r,u,f,i,g,O,m=c(0,0,0)){const N=u.length,T=w(f.length*N*3+(6*i.length||0)),R=w(f.length*N*3+(i?6:0)),b=new Array,j=new Array;let d=0,U=0;const v=a(),V=a(),x=a(),E=a(),F=a(),G=a(),C=a(),k=p(),q=a(),B=a(),z=a(),D=a(),X=a(),Z=M();l(q,0,1,0),t(V,f[1],f[0]),e(V,V),O?(o(k,f[0],m),e(x,k)):l(x,0,0,1),Ot(V,x,q,q,F,x,mt),h(E,x),h(D,F);for(let t=0;t<i.length;t++)s(G,F,i[t][0]),s(k,x,i[t][2]),o(G,G,k),o(G,G,f[0]),T[d++]=G[0],T[d++]=G[1],T[d++]=G[2];R[U++]=-V[0],R[U++]=-V[1],R[U++]=-V[2];for(let t=0;t<g.length;t++)b.push(g[t][0]>0?g[t][0]:-g[t][0]-1+i.length),b.push(g[t][1]>0?g[t][1]:-g[t][1]-1+i.length),b.push(g[t][2]>0?g[t][2]:-g[t][2]-1+i.length),j.push(0),j.push(0),j.push(0);let H=i.length;const J=i.length-1;for(let l=0;l<f.length;l++){let r=!1;if(l>0){h(v,V),l<f.length-1?(t(V,f[l+1],f[l]),e(V,V)):r=!0,o(B,v,V),e(B,B),o(z,f[l-1],E),A(f[l],B,Z);I(Z,y(z,v),k)?(t(k,k,f[l]),e(x,k),n(F,B,x),e(F,F)):Ot(B,E,D,q,F,x,mt),h(E,x),h(D,F)}O&&(o(k,f[l],m),e(X,k));for(let t=0;t<N;t++)if(s(G,F,u[t][0]),s(k,x,u[t][1]),o(G,G,k),e(C,G),R[U++]=C[0],R[U++]=C[1],R[U++]=C[2],o(G,G,f[l]),T[d++]=G[0],T[d++]=G[1],T[d++]=G[2],!r){const n=(t+1)%N;b.push(H+t),b.push(H+N+t),b.push(H+n),b.push(H+n),b.push(H+N+t),b.push(H+N+n);for(let t=0;t<6;t++){const n=b.length-6;j.push(b[n+t]-J)}}H+=N}const K=f[f.length-1];for(let t=0;t<i.length;t++)s(G,F,i[t][0]),s(k,x,i[t][1]),o(G,G,k),o(G,G,K),T[d++]=G[0],T[d++]=G[1],T[d++]=G[2];const Q=U/3;R[U++]=V[0],R[U++]=V[1],R[U++]=V[2];const W=H-N;for(let t=0;t<g.length;t++)b.push(g[t][0]>=0?H+g[t][0]:-g[t][0]-1+W),b.push(g[t][2]>=0?H+g[t][2]:-g[t][2]-1+W),b.push(g[t][1]>=0?H+g[t][1]:-g[t][1]-1+W),j.push(Q),j.push(Q),j.push(Q);const Y=[[L.POSITION,new P(T,3,!0),b],[L.NORMAL,new P(R,3,!0),j]];return new S(r,Y)}function ft(t,n,e,s){R(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),R(3===n[0].length,"createPolylineGeometry(): malformed vertex"),R(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),R(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const o=i(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)o[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[L.POSITION,new P(o,3,!0),r]];if(e){const t=w(3*e.length);let s=0;for(let o=0;o<n.length;o++)for(let n=0;n<3;n++)t[s++]=e[o][n];u.push([L.NORMAL,new P(t,3,!0),r])}return s&&u.push([L.COLOR,new P(s,4),m(s.length/4)]),new S(t,u,null,T.Line)}function pt(t,n,e,s,o,r=0){const l=new Array(18),h=[[-e,r,o/2],[s,r,o/2],[0,n+r,o/2],[-e,r,-o/2],[s,r,-o/2],[0,n+r,-o/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new S(t,[[L.POSITION,new P(l,3,!0),u]])}function it(t,n){const e=t.getMutableAttribute(L.POSITION).data;for(let s=0;s<e.length;s+=3){const t=e[s],o=e[s+1],r=e[s+2];l(Mt,t,o,r),u(Mt,Mt,n),e[s]=Mt[0],e[s+1]=Mt[1],e[s+2]=Mt[2]}}function wt(t,n=t){const e=t.vertexAttributes,s=e.get(L.POSITION).data,o=e.get(L.NORMAL).data;if(o){const t=n.getMutableAttribute(L.NORMAL).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}if(s){const t=n.getMutableAttribute(L.POSITION).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}}function gt(t,s,o,l,h){return!(Math.abs(r(s,t))>h)&&(n(o,t,s),e(o,o),n(l,o,t),e(l,l),!0)}function Ot(t,n,e,s,o,r,l){return gt(t,n,o,r,l)||gt(t,e,o,r,l)||gt(t,s,o,r,l)}const mt=.99619469809,Mt=a();export{wt as cgToGIS,E as createBoxGeometry,ht as createConeGeometry,ut as createCylinderGeometry,q as createDiamondGeometry,pt as createExtrudedTriangle,at as createPathExtrusionGeometry,ot as createPointGeometry,st as createPolySphereData,et as createPolySphereGeometry,ft as createPolylineGeometry,nt as createSphereGeometry,lt as createSquareGeometry,tt as createTetrahedronGeometry,ct as createTubeGeometry,Ot as makeOrthoBasisDirUpFallback,it as transformInPlace};
|
|
5
|
+
import{f as t,b as n,n as e,i as s,g as o,j as r,s as h,c as l,e as u}from"../../../../chunks/vec3.js";import{f as c,c as a,a as f}from"../../../../chunks/vec3f32.js";import{c as p}from"../../../../chunks/vec3f64.js";import{newDoubleArray as i}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as w,floatArrayFrom as g}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as O,getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{create as M,fromPositionAndNormal as A,intersectRay as I}from"../../../../geometry/support/plane.js";import{wrap as y}from"../../../../geometry/support/ray.js";import{Attribute as P}from"./Attribute.js";import{Vec3Compact as N}from"./BufferVectorMath.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{Geometry as S}from"./Geometry.js";import{assert as R}from"./Util.js";import{VertexAttribute as L}from"./VertexAttribute.js";const b=N,j=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],d=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],U=[0,0,1,0,1,1,0,1],V=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],v=new Array(36);for(let At=0;At<6;At++)for(let t=0;t<6;t++)v[6*At+t]=At;const x=new Array(36);for(let At=0;At<6;At++)x[6*At]=0,x[6*At+1]=1,x[6*At+2]=2,x[6*At+3]=2,x[6*At+4]=3,x[6*At+5]=0;function E(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let s=0;s<8;s++)e[3*s]=j[s][0]*n[0],e[3*s+1]=j[s][1]*n[1],e[3*s+2]=j[s][2]*n[2];return new S(t,[[L.POSITION,new P(e,V,3,!0)],[L.NORMAL,new P(d,v,3)],[L.UV0,new P(U,x,2)]])}const F=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],G=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],C=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],k=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function q(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let s=0;s<6;s++)e[3*s]=F[s][0]*n[0],e[3*s+1]=F[s][1]*n[1],e[3*s+2]=F[s][2]*n[2];return new S(t,[[L.POSITION,new P(e,C,3,!0)],[L.NORMAL,new P(G,k,3)]])}const B=c(-.5,0,-.5),z=c(.5,0,-.5),D=c(0,0,.5),X=c(0,.5,0),Z=a(),H=a(),J=a(),K=a(),Q=a();t(Z,B,X),t(H,B,z),n(J,Z,H),e(J,J),t(Z,z,X),t(H,z,D),n(K,Z,H),e(K,K),t(Z,D,X),t(H,D,B),n(Q,Z,H),e(Q,Q);const W=[B,z,D,X],Y=[0,-1,0,J[0],J[1],J[2],K[0],K[1],K[2],Q[0],Q[1],Q[2]],$=[0,1,2,3,1,0,3,2,1,3,0,2],_=[0,0,0,1,1,1,2,2,2,3,3,3];function tt(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let s=0;s<4;s++)e[3*s]=W[s][0]*n[0],e[3*s+1]=W[s][1]*n[1],e[3*s+2]=W[s][2]*n[2];return new S(t,[[L.POSITION,new P(e,$,3,!0)],[L.NORMAL,new P(Y,_,3)]])}function nt(t,n,e,s,o={uv:!0}){const r=-Math.PI,h=2*Math.PI,l=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(s)),f=(c+1)*(a+1),p=w(3*f),i=w(3*f),g=w(2*f),m=[];let M=0;for(let w=0;w<=a;w++){const t=[],e=w/a,s=l+e*u,o=Math.cos(s);for(let l=0;l<=c;l++){const u=l/c,a=r+u*h,f=Math.cos(a)*o,w=Math.sin(s),O=-Math.sin(a)*o;p[3*M]=f*n,p[3*M+1]=w*n,p[3*M+2]=O*n,i[3*M]=f,i[3*M+1]=w,i[3*M+2]=O,g[2*M]=u,g[2*M+1]=e,t.push(M),++M}m.push(t)}const A=new Array;for(let w=0;w<a;w++)for(let t=0;t<c;t++){const n=m[w][t],e=m[w][t+1],s=m[w+1][t+1],o=m[w+1][t];0===w?(A.push(n),A.push(s),A.push(o)):w===a-1?(A.push(n),A.push(e),A.push(s)):(A.push(n),A.push(e),A.push(s),A.push(s),A.push(o),A.push(n))}const I=[[L.POSITION,new P(p,A,3,!0)],[L.NORMAL,new P(i,A,3,!0)]];return o.uv&&I.push([L.UV0,new P(g,A,2,!0)]),o.offset&&(I[0][0]=L.OFFSET,I.push([L.POSITION,new P(Float64Array.from(o.offset),O(A.length),3,!0)])),new S(t,I)}function et(t,n,e,s){const o=st(n,e,s);return new S(t,o)}function st(t,n,e){const s=t;let o,r;if(e)o=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=s*(1+Math.sqrt(5))/2;o=[-s,t,0,s,t,0,-s,-t,0,s,-t,0,0,-s,t,0,s,t,0,-s,-t,0,s,-t,t,0,-s,t,0,s,-t,0,-s,-t,0,s],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<o.length;c+=3)b.scale(o,c,t/b.length(o,c));let h={};function l(n,e){n>e&&([n,e]=[e,n]);const s=n.toString()+"."+e.toString();if(h[s])return h[s];let r=o.length;return o.length+=3,b.add(o,3*n,o,3*e,o,r),b.scale(o,r,t/b.length(o,r)),r/=3,h[s]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],s=r[e+1],o=r[e+2],h=l(t,s),u=l(s,o),c=l(o,t),a=4*e;n[a]=t,n[a+1]=h,n[a+2]=c,n[a+3]=s,n[a+4]=u,n[a+5]=h,n[a+6]=o,n[a+7]=c,n[a+8]=u,n[a+9]=h,n[a+10]=u,n[a+11]=c}r=n,h={}}const u=g(o);for(let c=0;c<u.length;c+=3)b.normalize(u,c);return[[L.POSITION,new P(g(o),r,3,!0)],[L.NORMAL,new P(u,r,3,!0)]]}function ot(t,n,e,s,o,r,h,l,u=null){const c=e?[e[0],e[1],e[2]]:[0,0,0],a=n?[n[0],n[1],n[2]]:[0,0,1];h=h||[0,0];const f=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],p=null!=o&&2===o.length?o:[1,1],i=O(1),w=[[L.POSITION,new P(c,i,3,!0)],[L.NORMAL,new P(a,i,3,!0)],[L.UV0,new P(h,i,h.length)],[L.COLOR,new P(f,i,4,!0)],[L.SIZE,new P(p,i,2)]];if(null!=r){const t=[r[0],r[1],r[2],r[3]];w.push([L.AUXPOS1,new P(t,i,4)])}if(null!=l){const t=[l[0],l[1],l[2],l[3]];w.push([L.FEATUREATTRIBUTE,new P(t,i,4)])}return new S(t,w,null,T.Point,u)}const rt=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ht(t,n=rt){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const s=[0,1,2,2,3,0],o=[0,0,1],r=[0,0,0,0,0,0],h=[0,0,1,0,1,1,0,1],l=[255,255,255,255],u=[[L.POSITION,new P(e,s,3,!0)],[L.NORMAL,new P(o,r,3,!0)],[L.UV0,new P(h,s,2,!0)],[L.COLOR,new P(l,r,4,!0)]];return new S(t,u)}function lt(t,n,e,s,o,r=!0,h=!0){let l=0;const u=e,a=n;let f=c(0,l,0),p=c(0,l+a,0),i=c(0,-1,0),g=c(0,1,0);o&&(l=a,p=c(0,0,0),f=c(0,l,0),i=c(0,1,0),g=c(0,-1,0));const O=[p,f],m=[i,g],M=s+2,A=Math.sqrt(a*a+u*u);if(o)for(let w=s-1;w>=0;w--){const t=w*(2*Math.PI/s),n=c(Math.cos(t)*u,l,Math.sin(t)*u);O.push(n);const e=c(a*Math.cos(t)/A,-u/A,a*Math.sin(t)/A);m.push(e)}else for(let w=0;w<s;w++){const t=w*(2*Math.PI/s),n=c(Math.cos(t)*u,l,Math.sin(t)*u);O.push(n);const e=c(a*Math.cos(t)/A,u/A,a*Math.sin(t)/A);m.push(e)}const I=new Array,y=new Array;if(r){for(let t=3;t<O.length;t++)I.push(1),I.push(t-1),I.push(t),y.push(0),y.push(0),y.push(0);I.push(O.length-1),I.push(2),I.push(1),y.push(0),y.push(0),y.push(0)}if(h){for(let t=3;t<O.length;t++)I.push(t),I.push(t-1),I.push(0),y.push(t),y.push(t-1),y.push(1);I.push(0),I.push(2),I.push(O.length-1),y.push(1),y.push(2),y.push(m.length-1)}const N=w(3*M);for(let c=0;c<M;c++)N[3*c]=O[c][0],N[3*c+1]=O[c][1],N[3*c+2]=O[c][2];const T=w(3*M);for(let c=0;c<M;c++)T[3*c]=m[c][0],T[3*c+1]=m[c][1],T[3*c+2]=m[c][2];const R=[[L.POSITION,new P(N,I,3,!0)],[L.NORMAL,new P(T,y,3,!0)]];return new S(t,R)}function ut(t,l,u,p,i,g,O){const m=i?f(i):c(1,0,0),M=g?f(g):c(0,0,0);O??=!0;const A=a();e(A,m);const I=a();s(I,A,Math.abs(l));const y=a();s(y,I,-.5),o(y,y,M);const N=c(0,1,0);Math.abs(1-r(A,N))<.2&&h(N,0,0,1);const T=a();n(T,A,N),e(T,T),n(N,T,A);const R=2*p+(O?2:0),b=p+(O?2:0),j=w(3*R),d=w(3*b),U=w(2*R),V=new Array(3*p*(O?4:2)),v=new Array(3*p*(O?4:2));O&&(j[3*(R-2)]=y[0],j[3*(R-2)+1]=y[1],j[3*(R-2)+2]=y[2],U[2*(R-2)]=0,U[2*(R-2)+1]=0,j[3*(R-1)]=j[3*(R-2)]+I[0],j[3*(R-1)+1]=j[3*(R-2)+1]+I[1],j[3*(R-1)+2]=j[3*(R-2)+2]+I[2],U[2*(R-1)]=1,U[2*(R-1)+1]=1,d[3*(b-2)]=-A[0],d[3*(b-2)+1]=-A[1],d[3*(b-2)+2]=-A[2],d[3*(b-1)]=A[0],d[3*(b-1)+1]=A[1],d[3*(b-1)+2]=A[2]);const x=(t,n,e)=>{V[t]=n,v[t]=e};let E=0;const F=a(),G=a();for(let n=0;n<p;n++){const t=n*(2*Math.PI/p);s(F,N,Math.sin(t)),s(G,T,Math.cos(t)),o(F,F,G),d[3*n]=F[0],d[3*n+1]=F[1],d[3*n+2]=F[2],s(F,F,u),o(F,F,y),j[3*n]=F[0],j[3*n+1]=F[1],j[3*n+2]=F[2],U[2*n]=n/p,U[2*n+1]=0,j[3*(n+p)]=j[3*n]+I[0],j[3*(n+p)+1]=j[3*n+1]+I[1],j[3*(n+p)+2]=j[3*n+2]+I[2],U[2*(n+p)]=n/p,U[2*n+1]=1;const e=(n+1)%p;x(E++,n,n),x(E++,n+p,n),x(E++,e,e),x(E++,e,e),x(E++,n+p,n),x(E++,e+p,e)}if(O){for(let t=0;t<p;t++){const n=(t+1)%p;x(E++,R-2,b-2),x(E++,t,b-2),x(E++,n,b-2)}for(let t=0;t<p;t++){const n=(t+1)%p;x(E++,t+p,b-1),x(E++,R-1,b-1),x(E++,n+p,b-1)}}const C=[[L.POSITION,new P(j,V,3,!0)],[L.NORMAL,new P(d,v,3,!0)],[L.UV0,new P(U,V,2,!0)]];return new S(t,C)}function ct(t,n,e,s,o,r){s=s||10,o=null==o||o,R(n.length>1);const h=[[0,0,0]],l=[],u=[];for(let c=0;c<s;c++){l.push([0,-c-1,-(c+1)%s-1]);const t=c/s*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return at(t,u,n,h,l,o,r)}function at(r,u,f,i,g,O,m=c(0,0,0)){const N=u.length,T=w(f.length*N*3+(6*i.length||0)),R=w(f.length*N*3+(i?6:0)),b=new Array,j=new Array;let d=0,U=0;const V=a(),v=a(),x=a(),E=a(),F=a(),G=a(),C=a(),k=p(),q=a(),B=a(),z=a(),D=a(),X=a(),Z=M();h(q,0,1,0),t(v,f[1],f[0]),e(v,v),O?(o(k,f[0],m),e(x,k)):h(x,0,0,1),Ot(v,x,q,q,F,x,mt),l(E,x),l(D,F);for(let t=0;t<i.length;t++)s(G,F,i[t][0]),s(k,x,i[t][2]),o(G,G,k),o(G,G,f[0]),T[d++]=G[0],T[d++]=G[1],T[d++]=G[2];R[U++]=-v[0],R[U++]=-v[1],R[U++]=-v[2];for(let t=0;t<g.length;t++)b.push(g[t][0]>0?g[t][0]:-g[t][0]-1+i.length),b.push(g[t][1]>0?g[t][1]:-g[t][1]-1+i.length),b.push(g[t][2]>0?g[t][2]:-g[t][2]-1+i.length),j.push(0),j.push(0),j.push(0);let H=i.length;const J=i.length-1;for(let h=0;h<f.length;h++){let r=!1;if(h>0){l(V,v),h<f.length-1?(t(v,f[h+1],f[h]),e(v,v)):r=!0,o(B,V,v),e(B,B),o(z,f[h-1],E),A(f[h],B,Z);I(Z,y(z,V),k)?(t(k,k,f[h]),e(x,k),n(F,B,x),e(F,F)):Ot(B,E,D,q,F,x,mt),l(E,x),l(D,F)}O&&(o(k,f[h],m),e(X,k));for(let t=0;t<N;t++)if(s(G,F,u[t][0]),s(k,x,u[t][1]),o(G,G,k),e(C,G),R[U++]=C[0],R[U++]=C[1],R[U++]=C[2],o(G,G,f[h]),T[d++]=G[0],T[d++]=G[1],T[d++]=G[2],!r){const n=(t+1)%N;b.push(H+t),b.push(H+N+t),b.push(H+n),b.push(H+n),b.push(H+N+t),b.push(H+N+n);for(let t=0;t<6;t++){const n=b.length-6;j.push(b[n+t]-J)}}H+=N}const K=f[f.length-1];for(let t=0;t<i.length;t++)s(G,F,i[t][0]),s(k,x,i[t][1]),o(G,G,k),o(G,G,K),T[d++]=G[0],T[d++]=G[1],T[d++]=G[2];const Q=U/3;R[U++]=v[0],R[U++]=v[1],R[U++]=v[2];const W=H-N;for(let t=0;t<g.length;t++)b.push(g[t][0]>=0?H+g[t][0]:-g[t][0]-1+W),b.push(g[t][2]>=0?H+g[t][2]:-g[t][2]-1+W),b.push(g[t][1]>=0?H+g[t][1]:-g[t][1]-1+W),j.push(Q),j.push(Q),j.push(Q);const Y=[[L.POSITION,new P(T,b,3,!0)],[L.NORMAL,new P(R,j,3,!0)]];return new S(r,Y)}function ft(t,n,e,s){R(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),R(3===n[0].length,"createPolylineGeometry(): malformed vertex"),R(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),R(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const o=i(3*n.length),r=new Array(2*(n.length-1));let h=0,l=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)o[h++]=n[c][t];c>0&&(r[l++]=c-1,r[l++]=c)}const u=[[L.POSITION,new P(o,r,3,!0)]];if(e){const t=w(3*e.length);let s=0;for(let o=0;o<n.length;o++)for(let n=0;n<3;n++)t[s++]=e[o][n];u.push([L.NORMAL,new P(t,r,3,!0)])}return s&&u.push([L.COLOR,new P(s,m(s.length/4),4)]),new S(t,u,null,T.Line)}function pt(t,n,e,s,o,r=0){const h=new Array(18),l=[[-e,r,o/2],[s,r,o/2],[0,n+r,o/2],[-e,r,-o/2],[s,r,-o/2],[0,n+r,-o/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)h[3*c]=l[c][0],h[3*c+1]=l[c][1],h[3*c+2]=l[c][2];return new S(t,[[L.POSITION,new P(h,u,3,!0)]])}function it(t,n){const e=t.getMutableAttribute(L.POSITION).data;for(let s=0;s<e.length;s+=3){const t=e[s],o=e[s+1],r=e[s+2];h(Mt,t,o,r),u(Mt,Mt,n),e[s]=Mt[0],e[s+1]=Mt[1],e[s+2]=Mt[2]}}function wt(t,n=t){const e=t.attributes,s=e.get(L.POSITION).data,o=e.get(L.NORMAL).data;if(o){const t=n.getMutableAttribute(L.NORMAL).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}if(s){const t=n.getMutableAttribute(L.POSITION).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}}function gt(t,s,o,h,l){return!(Math.abs(r(s,t))>l)&&(n(o,t,s),e(o,o),n(h,o,t),e(h,h),!0)}function Ot(t,n,e,s,o,r,h){return gt(t,n,o,r,h)||gt(t,e,o,r,h)||gt(t,s,o,r,h)}const mt=.99619469809,Mt=a();export{wt as cgToGIS,E as createBoxGeometry,lt as createConeGeometry,ut as createCylinderGeometry,q as createDiamondGeometry,pt as createExtrudedTriangle,at as createPathExtrusionGeometry,ot as createPointGeometry,st as createPolySphereData,et as createPolySphereGeometry,ft as createPolylineGeometry,nt as createSphereGeometry,ht as createSquareGeometry,tt as createTetrahedronGeometry,ct as createTubeGeometry,Ot as makeOrthoBasisDirUpFallback,it as transformInPlace};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{generateUID as t}from"../../../../core/uid.js";import{f as i}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{f as o}from"../../../../chunks/vec4f64.js";import{projectBuffer as s}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as e}from"./Attribute.js";import{ContentObjectType as n}from"./ContentObjectType.js";import{Geometry as a}from"./Geometry.js";import{fromValues as h}from"./LocalOriginFactory.js";import{Object3D as m}from"./Object3D.js";import{gridLocalOriginFactory as c}from"./testUtils.js";import{VertexAttribute as g}from"./VertexAttribute.js";import{WebGLLayer as d}from"./WebGLLayer.js";import{RibbonLineMaterial as f}from"../materials/RibbonLineMaterial.js";class _{constructor(i){this._originSR=i,this._rootOriginId="root/"+t(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5}getOrigin(t){const r=this._origins.get(this._rootOriginId);if(null==r){const i=c.rootOrigin;if(null!=i)return this._origins.set(this._rootOriginId,h(i[0],i[1],i[2],this._rootOriginId)),this.getOrigin(t);const r=h(t[0]+Math.random()-.5,t[1]+Math.random()-.5,t[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,r),r}const o=this._gridSize,s=Math.round(t[0]/o),e=Math.round(t[1]/o),n=Math.round(t[2]/o),a=`${s}/${e}/${n}`;let m=this._origins.get(a);const g=.5*o;if(i(p,t,r.vec3),p[0]=Math.abs(p[0]),p[1]=Math.abs(p[1]),p[2]=Math.abs(p[2]),p[0]<g&&p[1]<g&&p[2]<g){if(m){const r=Math.max(...p);i(p,t,m.vec3),p[0]=Math.abs(p[0]),p[1]=Math.abs(p[1]),p[2]=Math.abs(p[2]);if(Math.max(...p)<r)return m}return r}return m||(m=h(s*o,e*o,n*o,a),this._origins.set(a,m)),m}_drawOriginBox(t,i=o(1,1,0,1)){const r=window.view,h=r._stage,c=i.toString();if(!this._objects.has(c)){this._material=new f({width:2,color:i}),h.add(this._material);const t=new d(h,{pickable:!1}),r=new m({castShadow:!1});h.add(r),t.add(r),this._objects.set(c,r)}const _=this._objects.get(c),p=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],j=p.length,u=new Array(3*j),l=new Array,b=.5*this._gridSize;for(let o=0;o<j;o++)u[3*o]=t[0]+(1&p[o]?b:-b),u[3*o+1]=t[1]+(2&p[o]?b:-b),u[3*o+2]=t[2]+(4&p[o]?b:-b),o>0&&l.push(o-1,o);s(u,this._originSR,0,u,r.renderSpatialReference,0,j);const M=new a(this._material,[[g.POSITION,new e(u,3,!0)
|
|
5
|
+
import{generateUID as t}from"../../../../core/uid.js";import{f as i}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{f as o}from"../../../../chunks/vec4f64.js";import{projectBuffer as s}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as e}from"./Attribute.js";import{ContentObjectType as n}from"./ContentObjectType.js";import{Geometry as a}from"./Geometry.js";import{fromValues as h}from"./LocalOriginFactory.js";import{Object3D as m}from"./Object3D.js";import{gridLocalOriginFactory as c}from"./testUtils.js";import{VertexAttribute as g}from"./VertexAttribute.js";import{WebGLLayer as d}from"./WebGLLayer.js";import{RibbonLineMaterial as f}from"../materials/RibbonLineMaterial.js";class _{constructor(i){this._originSR=i,this._rootOriginId="root/"+t(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5}getOrigin(t){const r=this._origins.get(this._rootOriginId);if(null==r){const i=c.rootOrigin;if(null!=i)return this._origins.set(this._rootOriginId,h(i[0],i[1],i[2],this._rootOriginId)),this.getOrigin(t);const r=h(t[0]+Math.random()-.5,t[1]+Math.random()-.5,t[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,r),r}const o=this._gridSize,s=Math.round(t[0]/o),e=Math.round(t[1]/o),n=Math.round(t[2]/o),a=`${s}/${e}/${n}`;let m=this._origins.get(a);const g=.5*o;if(i(p,t,r.vec3),p[0]=Math.abs(p[0]),p[1]=Math.abs(p[1]),p[2]=Math.abs(p[2]),p[0]<g&&p[1]<g&&p[2]<g){if(m){const r=Math.max(...p);i(p,t,m.vec3),p[0]=Math.abs(p[0]),p[1]=Math.abs(p[1]),p[2]=Math.abs(p[2]);if(Math.max(...p)<r)return m}return r}return m||(m=h(s*o,e*o,n*o,a),this._origins.set(a,m)),m}_drawOriginBox(t,i=o(1,1,0,1)){const r=window.view,h=r._stage,c=i.toString();if(!this._objects.has(c)){this._material=new f({width:2,color:i}),h.add(this._material);const t=new d(h,{pickable:!1}),r=new m({castShadow:!1});h.add(r),t.add(r),this._objects.set(c,r)}const _=this._objects.get(c),p=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],j=p.length,u=new Array(3*j),l=new Array,b=.5*this._gridSize;for(let o=0;o<j;o++)u[3*o]=t[0]+(1&p[o]?b:-b),u[3*o+1]=t[1]+(2&p[o]?b:-b),u[3*o+2]=t[2]+(4&p[o]?b:-b),o>0&&l.push(o-1,o);s(u,this._originSR,0,u,r.renderSpatialReference,0,j);const M=new a(this._material,[[g.POSITION,new e(u,l,3,!0)]],null,n.Line);h.add(M),_.addGeometry(M)}get test(){const t=this;return{set gridSize(i){t._gridSize=i}}}}const p=r();export{_ as GridLocalOriginFactory};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{s as t,h as e,e as s,g as i,a as r,i as o}from"../../../../chunks/vec2.js";import{a}from"../../../../chunks/vec2f64.js";import{s as n,b as h}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import{f as u}from"../../../../chunks/vec4f64.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as v}from"../../../../geometry/support/Indices.js";import{Attribute as b}from"./Attribute.js";import{compressNormal as
|
|
5
|
+
import{s as t,h as e,e as s,g as i,a as r,i as o}from"../../../../chunks/vec2.js";import{a}from"../../../../chunks/vec2f64.js";import{s as n,b as h}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import{f as u}from"../../../../chunks/vec4f64.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as v}from"../../../../geometry/support/Indices.js";import{Attribute as b,Vertices as p}from"./Attribute.js";import{compressNormal as m}from"./Normals.js";import{VertexAttribute as A}from"./VertexAttribute.js";import{intersectTriangles as d}from"../materials/internal/MaterialUtil.js";class x{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class f extends x{constructor(t){super(t),this.vertexAttributeColor=u(255,255,255,255),this.size=new Array,this.vertexAttributePosition=c(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(a){this.size=a;const{numVerticesTotal:l,pathVertexData:u,path:c,positions:v,profileRightAxes:b,profileUpAxes:p,profileVertexAndNormals:A}=this.builder;for(let d=0;d<l;++d){let l=u[d];const x=0===l||l===c.vertices.length-1;l*=3;const f=V;let g=0,N=0;const R=4*d,j=n(w,b[R],b[R+1],b[R+2]),E=n(D,p[R],p[R+1],p[R+2]),k=t(P,A[R]*a[0],A[R+1]*a[1]);if(x)h(f,E,j),g=b[R+3]*a[0],N=p[R+3];else{const a=I,h=C;t(a,b[R+3],p[R+3]);const l=e(a);s(a,a);const u=i(k,a);if(Math.abs(u)>l){t(h,-a[1],a[0]);const e=i(k,h);r(a,a,l*Math.sign(u)),r(h,h,e),o(k,a,h)}n(f,0,0,0)}const T=n(O,j[0]*k[0]+E[0]*k[1],j[1]*k[0]+E[1]*k[1],j[2]*k[0]+E[2]*k[1]),y=3*d;this.vertexAttributePosition[y]=v[l]+T[0]+f[0]*g,this.vertexAttributePosition[y+1]=v[l+1]+T[1]+f[1]*g,this.vertexAttributePosition[y+2]=v[l+2]+T[2]+f[2]*g;const L=t(P,A[R+2],A[R+3]);m(this.vertexAttributeNormal,d,j[0]*L[0]+E[0]*L[1]+f[0]*N,j[1]*L[0]+E[1]*L[1]+f[1]*N,j[2]*L[0]+E[2]*L[1]+f[2]*N)}}createGeometryData(){const t=this.builder.vertexIndices.length,{normalIndices:e,vertexIndices:s}=this.builder;return[[A.POSITION,new b(this.vertexAttributePosition,s,3,!0)],[A.NORMALCOMPRESSED,new b(this.vertexAttributeNormal,e,2,!0)],[A.COLOR,new b(this.vertexAttributeColor,v(t),4)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,s){const i=this.builder.vertexIndices,r=new p(this.vertexAttributePosition,3),o=i.length/3;d(t,e,0,o,i,r,void 0,void 0,s)}}class g extends x{constructor(t,e,s,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=s,this.opacityAttributeValue=i,this.vvData=null,this.baked=new f(t),this.vvData=c(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r]=e,this.vvData[4*r+1]=s,this.vvData[4*r+2]=i;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){const{positions:t,profileRightAxes:e,profileUpAxes:s,profileVertexAndNormals:i,pathVertexIndices:r,vertexIndices:o}=this.builder;return[[A.POSITION,new b(t,r,3,!0)],[A.PROFILERIGHT,new b(e,o,4,!0)],[A.PROFILEUP,new b(s,o,4,!0)],[A.PROFILEVERTEXANDNORMAL,new b(i,o,4,!0)],[A.FEATUREVALUE,new b(this.vvData,r,4,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(A.POSITION);e&&(e.data=this.builder.positions)}}const P=a(),I=a(),C=a(),O=l(),V=l(),w=l(),D=l();export{g as FastUpdatePathGeometry,x as PathGeometryData,f as StaticPathGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{generateUID as t}from"../../../../core/uid.js";import{h as r,m as
|
|
5
|
+
import{generateUID as t}from"../../../../core/uid.js";import{h as r,m as s}from"../../../../chunks/mat4.js";import{a as e}from"../../../../chunks/mat4f64.js";import{e as i}from"../../../../chunks/vec3.js";import{N as n,c as o}from"../../../../chunks/sphere.js";import{maxScale as a}from"../../support/mathUtils.js";class h{constructor(r,s={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=e(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerUid=s.layerUid,this.graphicUid=s.graphicUid,this.castShadow=s.castShadow??!1,null!=s.objectShaderTransformation&&this.objectShaderTransformationChanged(s.objectShaderTransformation)}get transformation(){return this._transformation}set transformation(t){r(this._transformation,t),this._boundingSphere=null}get boundingInfo(){return this.geometry.boundingInfo}objectShaderTransformationChanged(t){null==t?this._shaderTransformation=null:(this._shaderTransformation??=e(),s(this._shaderTransformation,t,this.geometry.transformation)),this._boundingSphere=null}get boundingSphere(){return this.boundingInfo?(null==this._boundingSphere&&(this._boundingSphere??=o(),i(this._boundingSphere,this.boundingInfo.center,this.shaderTransformation),this._boundingSphere[3]=this.boundingInfo.radius*a(this.shaderTransformation)),this._boundingSphere):n}get material(){return this.geometry.material}get type(){return this.geometry.type}get shaderTransformation(){return null==this._shaderTransformation?this.transformation:this._shaderTransformation}get attributes(){return this.geometry.attributes}get highlights(){return this.geometry.highlights}get occludees(){return this.geometry.occludees}get visible(){return this.geometry.visible}set visible(t){this.geometry.visible=t}}class m extends h{}export{h as RenderGeometry,m as ValidatedRenderGeometry};
|