@arcgis/core 5.1.0-next.58 → 5.1.0-next.59
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/applications/Components/SelectionOperation.d.ts +2 -2
- package/applications/Components/SelectionOperation.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/04ea806b933d4dd41609.js +1 -0
- package/assets/esri/core/workers/chunks/{45b7266580f9ce4fab6c.js → 0622e238693c257abacb.js} +1 -1
- package/assets/esri/core/workers/chunks/{05bc675c029ed311427f.js → 155c741a9839d24f04a2.js} +1 -1
- package/assets/esri/core/workers/chunks/1ae4e43a399e1974f106.js +1 -0
- package/assets/esri/core/workers/chunks/1f8e22df08c2f5fbb8c8.js +1 -0
- package/assets/esri/core/workers/chunks/{2327b368673a974dee8b.js → 2339465190c9d5ede25f.js} +1 -1
- package/assets/esri/core/workers/chunks/23f6d24bf850bc3280ec.js +1 -0
- package/assets/esri/core/workers/chunks/2541ac6e0ed1184edc9b.js +1 -0
- package/assets/esri/core/workers/chunks/34207774bc371e95ba3c.js +1 -0
- package/assets/esri/core/workers/chunks/{01777e91cd4e0bf04fd0.js → 35217befc8f9882d139e.js} +1 -1
- package/assets/esri/core/workers/chunks/{40bcfc4f8efe7de7ec9d.js → 3de17e89973160b42923.js} +1 -1
- package/assets/esri/core/workers/chunks/{666e1e79fcb309b0b9b1.js → 48d289db3145ce6c02bb.js} +1 -1
- package/assets/esri/core/workers/chunks/4c73c2f4331351e2a50c.js +1 -0
- package/assets/esri/core/workers/chunks/{2757cf54656b5d318b11.js → 55a0b69cf034ac32fc25.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d54beab8ae5ff31e7b0.js → 5a9f5a49dc68b42762bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{7cec3252e3ee56424b9e.js → 5c6e5f22450dd0583074.js} +1 -1
- package/assets/esri/core/workers/chunks/{b39b4db86a1049f0b901.js → 6be9d00839002f24fafd.js} +1 -1
- package/assets/esri/core/workers/chunks/6c886f19875291d02407.js +1 -0
- package/assets/esri/core/workers/chunks/75e28458e08b0738b35a.js +2 -0
- package/assets/esri/core/workers/chunks/{c460ca93ed8e20d8b53a.js → 86a6dd19903fa5023cc7.js} +1 -1
- package/assets/esri/core/workers/chunks/{6c571008bee8376ea50a.js → 8ccf2f65d8ed3c48ffff.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcfaaced184f8da3e28d.js → 9b53aa2429573f1b977f.js} +1 -1
- package/assets/esri/core/workers/chunks/9d580b5bcd59857a5702.js +1405 -0
- package/assets/esri/core/workers/chunks/a37697ef360e2425768a.js +1 -0
- package/assets/esri/core/workers/chunks/{a787fe09d3df9d4254ba.js → ab3183f2327ff26e2b45.js} +1 -1
- package/assets/esri/core/workers/chunks/b0f2ce61d3cad413898e.js +1 -0
- package/assets/esri/core/workers/chunks/{53c149bca42595b7dd1e.js → bbdf27bc34fadbe8e6fe.js} +1 -1
- package/assets/esri/core/workers/chunks/be42fe0b7ba0e27030b2.js +1 -0
- package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +1 -0
- package/assets/esri/core/workers/chunks/{5a573fa1012092328b88.js → d816d1a4220d827faf63.js} +1 -1
- package/assets/esri/core/workers/chunks/e26894655823849947f4.js +1 -0
- package/assets/esri/core/workers/chunks/e59f5dc8c85bcea66e98.js +1 -0
- package/assets/esri/core/workers/chunks/{ccf845ac0ac354507a25.js → ec1b2eb05410848081c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{851dd71d28681d4eccfd.js → f7af90c5f9d371eb7009.js} +1 -1
- package/assets/esri/core/workers/chunks/fa6e1ad099b43a6f5501.js +1 -0
- package/assets/esri/core/workers/chunks/{4a6186001323b47c23a4.js → fee1d873127dca02459f.js} +1 -1
- package/chunks/GlobalIllumination.glsl.js +101 -0
- package/chunks/GlobalIlluminationBlur.glsl.js +68 -0
- package/config.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/support/polygonUtils.js +1 -1
- package/geometry/support/{triangulationUtils.js → triangulationUtilsDeprecated.js} +1 -1
- package/kernel.js +1 -1
- package/layers/support/SceneModification.js +1 -1
- package/package.json +2 -2
- package/renderers/ClassBreaksRenderer.js +1 -1
- package/renderers/DictionaryRenderer.js +1 -1
- package/renderers/DotDensityRenderer.js +1 -1
- package/renderers/HeatmapRenderer.js +1 -1
- package/renderers/PieChartRenderer.js +1 -1
- package/renderers/Renderer.js +1 -1
- package/renderers/SimpleRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/AttributeColorInfo.js +1 -1
- package/renderers/support/ClassBreakInfo.d.ts +6 -0
- package/renderers/support/ClassBreakInfo.js +1 -1
- package/renderers/support/UniqueValueClass.d.ts +12 -0
- package/renderers/support/UniqueValueClass.js +1 -1
- package/renderers/support/UniqueValueInfo.d.ts +12 -0
- package/renderers/support/UniqueValueInfo.js +1 -1
- package/renderers/visualVariables/ColorVariable.js +1 -1
- package/renderers/visualVariables/OpacityVariable.js +1 -1
- package/renderers/visualVariables/SizeVariable.js +1 -1
- package/renderers/visualVariables/VisualVariable.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
- package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
- package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWorker.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/extrudeUtils.js +1 -1
- package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +2 -0
- package/views/3d/layers/graphics/tessellationUtils.js +2 -0
- package/views/3d/layers/i3s/PointCloudHighlights.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/i3s/PointCloudRendererNode.js +1 -1
- package/views/3d/layers/support/Tiles3DBVH.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
- package/views/3d/support/renderInfoUtils/line.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/support/renderInfoUtils/polygonDeprecated.js +2 -0
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +6 -5
- package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js +4 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +7 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +93 -50
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +20 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +23 -9
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/emissive/emissions.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/BlueNoise.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ReprojectionUniforms.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.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/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/{widgets/support/Selector2D → views/selection}/SelectionOperation.d.ts +10 -11
- package/views/selection/SelectionOperation.js +2 -0
- package/views/selection/types.d.ts +138 -2
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/009db7b459b18f6a668b.js +0 -1
- package/assets/esri/core/workers/chunks/0fc60b4c44c4e865b699.js +0 -2
- package/assets/esri/core/workers/chunks/34484afe767d60f85982.js +0 -1
- package/assets/esri/core/workers/chunks/55bb5b7817c2963c8bfa.js +0 -1
- package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +0 -1
- package/assets/esri/core/workers/chunks/66a4d764937918a2779f.js +0 -1
- package/assets/esri/core/workers/chunks/6b56c8ba978ec6edd6b8.js +0 -1
- package/assets/esri/core/workers/chunks/92fb6519b01d110ee947.js +0 -1041
- package/assets/esri/core/workers/chunks/9806cc96414065ae0afe.js +0 -1
- package/assets/esri/core/workers/chunks/9b365a6242b0287f8727.js +0 -1
- package/assets/esri/core/workers/chunks/a029db48079af4b5cccd.js +0 -1
- package/assets/esri/core/workers/chunks/ec91d5081f423755cb07.js +0 -1
- package/assets/esri/core/workers/chunks/f9fe89ced41b49608667.js +0 -1
- package/assets/esri/core/workers/chunks/fce30184f354fb7d11af.js +0 -1
- package/widgets/support/Selector2D/SelectionOperation.js +0 -2
- package/widgets/support/Selector2D/types.d.ts +0 -139
- /package/assets/esri/core/workers/chunks/{0fc60b4c44c4e865b699.js.LICENSE.txt → 75e28458e08b0738b35a.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as m}from"../../../../../geometry/support/Indices.js";import{c as h}from"../../../../../chunks/vec3.js";import{c as p}from"../../../../../chunks/vec32.js";import{ComponentData as d}from"./ComponentData.js";import{defaultComponentParameters as g,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as v,Renderable as _}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as j}from"./RenderSubmitSystem.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as M}from"../../lib/verticalOffsetUtils.js";import{BufferManager as R}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as O,IndexGlLayout as x}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as D}from"../../../../webgl/enums.js";import{SamplerRepository as E}from"../../../../webgl/Sampler.js";import{VertexBuffer as B}from"../../../../webgl/VertexBuffer.js";const H=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let V=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new j(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new R(r,O());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new E(r.gl),this.addHandles(o(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new d(this._componentBufferManager,m(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t}=e;this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=M(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,c=2===this._viewingMode,m=l.getComponentAabbs(),h=I;let p=1/0,d=-1/0;for(let g=0;g<r;g++){const e=6*g,s=a?.[g]??0;let r=1/0,l=-1/0;if(c)r=m[e+2]+s+t,l=m[e+5]+s+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==s){const e=M(s);e.localOrigin=o.transform.position,e.applyToAabb(h)}const r=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),l=t+h[5]+i;n.expandElevationRangeValues(t+h[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),p=Math.min(p,r),d=Math.max(d,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=d}intersect(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:c}=r;return null!=n&&(n.localOrigin=a.position),c.intersect(t,i,n,l.verticalOffsets,a,o,s)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:c}=await import("../../lib/edgeRendering/bufferLayouts.js"),m=c.createBuffer(r.length/3);p(m.position.typedBuffer,r,m.position.typedBufferStride,3),h(m.position,m.position,n.transform.rotationScale),this._setComponentIndices(m.componentIndex,s,a);const d=m.count,g=this._computeVisibilityIndices(s,o,a,d);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:g,indicesLength:g.length,skipDeduplicate:!0,data:m,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)H().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&H().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,c=new B(n,s,r),m=a?A.createIndex(n,35044,a):null;let h=0;const p=[["geometry",c]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new B(n,x,e.buffer);h+=t.usedMemory,p.push(["componentIndices",t])}const d=new w(n,new Map(p),m),u=new y(d,D.TRIANGLES,o.parameters,null!=m),b=this.materials.acquire(t,u.parameters,g),j=new v(c.usedMemory+h+(m?.usedMemory??0)),C=this.samplers.addFromTexture(t.baseColorTexture?.texture),M=new f(e,t,C);return new _(b,M,u,j)}_requestRender(){this._renderPassManager.requestRender()}};V=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],V);const I=c();export{V as ComponentObjectCollection};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as s,sync as o}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{c as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialRepository as j}from"./Material/ComponentMaterialRepository.js";import{VertexArrayObject as C}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as M}from"../../lib/verticalOffsetUtils.js";import{BufferManager as w}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as R,IndexGlLayout as x}from"../../materials/DefaultLayouts.js";import{BufferObject as H}from"../../../../webgl/BufferObject.js";import{PrimitiveType as D}from"../../../../webgl/enums.js";import{SamplerRepository as A}from"../../../../webgl/Sampler.js";import{VertexBuffer as I}from"../../../../webgl/VertexBuffer.js";const E=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let B=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new w(r,R());const l=2===this._viewingMode?0:i?1:2;this.materials=new j(a,l),this.samplers=new A(r.gl),this.addHandles(s(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},o))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),s=this._createRenderable(e,t,n),o=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,s,o);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const s=e,o=s.componentData.verticalOffsets;if(n||null==o)return i;const r=o[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=M(r);return a.localOrigin=s.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let s=0;s<i;++s)if(t[s]!==e[s].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const s=e,{componentData:o}=s,r=o.count,{verticalOffsets:a}=o,{intersectionGeometry:l}=s,h=2===this._viewingMode,c=l.getComponentAabbs(),m=V;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,o=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+o+t,l=c[e+5]+o+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==o){const e=M(o);e.localOrigin=s.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersect(e,t,i,n,s,o){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;return null!=n&&(n.localOrigin=a.position),h.intersect(t,i,n,l.verticalOffsets,a,s,o)}addEdges(e,t,i,n,s){const o=e,{indices:r,positions:a}=o.intersectionGeometry,l=o.componentData.offsets;return t.addComponentObject(o,a,r,l,i,n,s)}async extractEdgeInformation(e,t,i){const n=e,s=n.componentData.visibility;if(s.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:o,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,o,a);const p=c.count,d=this._computeVisibilityIndices(o,s,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let s=0;s<i.length-1;s++){const o=i[s],r=i[s+1];for(let i=o;i<r;i++){const s=t?t[i]:i;e.set(s,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let s=0;t.forEachComponentRange((e,t)=>(s+=i[t]-i[e],!0));const o=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(s):new Uint32Array(s):new Array(s);let a=0;return t.forEachComponentRange((t,n)=>{const s=i[t],r=i[n];for(let i=s;i<r;i++)o[a++]=e?e[i]:i;return!0}),o}addHighlight(e,t,i){const n=e,s=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,s+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)E().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&E().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,s=e.geometry,o=s.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=s.renderGeometryData,h=new I(n,o,r),c=a?H.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],s=i.offsets[n+1],o=i.materialDataIndices[n];if(null!=a)for(let i=t;i<s;i++){e[a[i]]=o}else for(let i=t;i<s;i++)e[i]=o}const t=new I(n,x,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new C(n,new Map(g),c),u=a?.length??l,b=new y(p,D.TRIANGLES,s.parameters,null!=c,u),O=this.materials.acquire(t,b.parameters,d),j=new _(h.usedMemory+m+(c?.usedMemory??0)),M=this.samplers.addFromTexture(t.baseColorTexture?.texture),w=new f(e,t,M);return new v(O,w,b,j)}_requestRender(){this._renderPassManager.requestRender()}};B=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],B);const V=h();export{B as ComponentObjectCollection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{exactEquals as e}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ComponentTechnique as r}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as s}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as i}from"../../../core/material/MaterialBase.js";import{isColor as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";class n extends i{constructor(e,t,r,i,o){super(),this.parameters=e,this.key=o,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=c(e,r,i),this.materialPass=l(e,r),this._configuration=new s(i),this._initializeMaterialConfiguration(e,t,r,i)}destroy(){}acquireTechnique(e,t,s,i){const o=this._updateConfiguration(t,s);return e.get(r,o,i.layout)}_initializeMaterialConfiguration(e,t,r,s){const i=this._configuration;i.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,i.hasOcclusionTexture=null!=e.occlusionTexture,i.hasNormalTexture=null!=e.normalTexture,i.sphereDepthInterpolate=e.sphereDepthInterpolate&&i.spherical,i.ellipsoidMode=e.ellipsoidMode,i.doubleSidedMode=e.doubleSided?1:0,i.hasColorTexture=null!=e.baseColorTexture,i.cullFace=e.cullFace,i.alphaDiscardMode=e.alphaDiscardMode,i.hasVertexColors=t.hasVertexColors,i.textureCoordinateType=t.textureCoordinateType,i.shadeNormals=t.shadeNormals,i.normalType=t.hasNormals?1:2,i.polygonOffset=e.polygonOffset,i.vertexPositionRotationType=t.vertexPositionRotationType,i.vertexNormalRotationType=t.vertexNormalRotationType,i.componentDataType=r.componentDataType,i.emissionSource=h(e,r,s)}_updateConfiguration(e,t){const r=this._configuration,{identifier:s}=e,i=0===s;r.output=t.output,r.enableOITOffset=t.enableOITOffset,r.hasEmission=t.hasEmission&&i,r.renderOccluded=10===t.slot,r.terrainDepthTest=i&&t.terrainDepthTest,r.cullAboveTerrain=!!i&&t.cullAboveTerrain;const n=this.isIntegratedMesh?p(t)?d(t)?3:2:1:0;r.integratedMeshMode=n,r.pbrMode=3===n?4:this.usePBR?this.hasParametersFromSource?0!==r.shadeNormals&&this.isIntegratedMesh?0:2:1:0,r.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,r.isGroundSlice=r.hasSlicePlane&&this.isGround;const{materialPass:l}=this;r.transparent=i&&(1===l||2===l&&e.transparent||4===l)||r.isGroundSlice,r.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,r.snowCover=i&&t.snowCover>0,r.vertexDiscardMode=i&&2===l?e.transparent?2:1:0;const u=o(t.output);return r.receiveAmbientOcclusion=u&&this.applySSAO&&!r.renderOccluded&&null!=t.ssao?.getTexture(),r.hasOccludees=u&&t.hasOccludees,r.receiveShadows=u&&t.shadowMap.ready,r.hasShadowHighlights=a(r,t),r.screenSpaceReflections=t.hasScreenSpaceReflections,r.cloudReflections=u&&null!=t.clouds.data?.cubeMap?.colorTexture,r}}function l(e,t){const{alphaDiscardMode:r,isIntegratedMesh:s,slicePlaneEnabled:i}=e,{transparent:o,opaqueOverride:a}=t,n=e.opacity<1,l=e.baseColor[3]<1;if(s)return n||i?4:3;if(n)return 1;if(0===a)return 0;if(l||0===r||3===r)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function u(r){return null!=r.emissionTexture||!e(r.emissiveBaseColor,t)}function c(e,t,r){const s=u(e);return r.hasEmissionSupport&&2!==t.emissiveOverride&&(s||2!==t.emissiveSourceOverride)}function h(e,t,r){const s=null!=e.emissionTexture,{emissiveSourceOverride:i}=t,o=1===i,a=2===i,n=c(e,t,r),l=u(e);return n?l?a?s?4:2:o?s?5:7:6:o?7:6:0}function d(e){return null!=e.overlay?.getTexture(3)}function p(e){return null!=e.overlay?.getTexture(1)}export{n as ComponentMaterial,h as calculateEmissionSource,c as calculateHasEmissions,u as calculateHasEmissiveBase,l as computeMaterialPass};
|
|
2
|
+
import{exactEquals as e}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ComponentTechnique as r}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as s}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as i}from"../../../core/material/MaterialBase.js";import{isColor as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";class n extends i{constructor(e,t,r,i,o){super(),this.parameters=e,this.key=o,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=c(e,r,i)?3:0,this.materialPass=l(e,r),this._configuration=new s(i),this._initializeMaterialConfiguration(e,t,r,i)}destroy(){}acquireTechnique(e,t,s,i){const o=this._updateConfiguration(t,s);return e.get(r,o,i.layout)}_initializeMaterialConfiguration(e,t,r,s){const i=this._configuration;i.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,i.hasOcclusionTexture=null!=e.occlusionTexture,i.hasNormalTexture=null!=e.normalTexture,i.sphereDepthInterpolate=e.sphereDepthInterpolate&&i.spherical,i.ellipsoidMode=e.ellipsoidMode,i.doubleSidedMode=e.doubleSided?1:0,i.hasColorTexture=null!=e.baseColorTexture,i.cullFace=e.cullFace,i.alphaDiscardMode=e.alphaDiscardMode,i.hasVertexColors=t.hasVertexColors,i.textureCoordinateType=t.textureCoordinateType,i.shadeNormals=t.shadeNormals,i.normalType=t.hasNormals?1:2,i.polygonOffset=e.polygonOffset,i.vertexPositionRotationType=t.vertexPositionRotationType,i.vertexNormalRotationType=t.vertexNormalRotationType,i.componentDataType=r.componentDataType,i.emissionSource=h(e,r,s)}_updateConfiguration(e,t){const r=this._configuration,{identifier:s}=e,i=0===s;r.output=t.output,r.enableOITOffset=t.enableOITOffset,r.hasEmission=t.hasEmission&&i,r.renderOccluded=10===t.slot,r.terrainDepthTest=i&&t.terrainDepthTest,r.cullAboveTerrain=!!i&&t.cullAboveTerrain;const n=this.isIntegratedMesh?p(t)?d(t)?3:2:1:0;r.integratedMeshMode=n,r.pbrMode=3===n?4:this.usePBR?this.hasParametersFromSource?0!==r.shadeNormals&&this.isIntegratedMesh?0:2:1:0,r.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,r.isGroundSlice=r.hasSlicePlane&&this.isGround;const{materialPass:l}=this;r.transparent=i&&(1===l||2===l&&e.transparent||4===l)||r.isGroundSlice,r.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,r.snowCover=i&&t.snowCover>0,r.vertexDiscardMode=i&&2===l?e.transparent?2:1:0;const u=o(t.output);return r.receiveAmbientOcclusion=u&&this.applySSAO&&!r.renderOccluded&&null!=t.ssao?.getTexture(),r.receiveGlobalIllumination=u&&this.applySSAO&&!r.renderOccluded&&null!=t.globalIllumination,r.hasOccludees=u&&t.hasOccludees,r.receiveShadows=u&&t.shadowMap.ready,r.hasShadowHighlights=a(r,t),r.screenSpaceReflections=t.hasScreenSpaceReflections,r.cloudReflections=u&&null!=t.clouds.data?.cubeMap?.colorTexture,r}}function l(e,t){const{alphaDiscardMode:r,isIntegratedMesh:s,slicePlaneEnabled:i}=e,{transparent:o,opaqueOverride:a}=t,n=e.opacity<1,l=e.baseColor[3]<1;if(s)return n||i?4:3;if(n)return 1;if(0===a)return 0;if(l||0===r||3===r)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function u(r){return null!=r.emissionTexture||!e(r.emissiveBaseColor,t)}function c(e,t,r){const s=u(e);return r.hasEmissionSupport&&2!==t.emissiveOverride&&(s||2!==t.emissiveSourceOverride)}function h(e,t,r){const s=null!=e.emissionTexture,{emissiveSourceOverride:i}=t,o=1===i,a=2===i,n=c(e,t,r),l=u(e);return n?l?a?s?4:2:o?s?5:7:6:o?7:6:0}function d(e){return null!=e.overlay?.getTexture(3)}function p(e){return null!=e.overlay?.getTexture(1)}export{n as ComponentMaterial,h as calculateEmissionSource,c as calculateHasEmissions,u as calculateHasEmissiveBase,l as computeMaterialPass};
|
package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{isColorHighlightOrOLID as e}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as o}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class s extends i{constructor(t){super(),this.output=0,this.textureCoordinateType=0,this.componentDataType=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.shadeNormals=1,this.polygonOffset=0,this.vertexPositionRotationType=1,this.vertexNormalRotationType=0,this.hasEmission=!1,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.hasShadowHighlights=!1,this.transparent=!0,this.screenSpaceReflections=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.renderOccluded=!1,this.enableOITOffset=!1,this.sphereDepthInterpolate=!1,this.writeDepth=!0,this.discardInvisibleFragments=!1,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.hasSliceTranslatedView=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1,this.useTransformationTexture=!0,this.sphericalSR=t.sphericalSR,this.useFloatBlend=t.useFloatBlend}get spherical(){return 0!==this.sphericalSR}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&e(this.output)}get hasWater(){return 3===this.pbrMode||4===this.pbrMode||6===this.pbrMode}}t([o()],s.prototype,"useFloatBlend",void 0),t([o({count:12})],s.prototype,"output",void 0),t([o({count:3})],s.prototype,"textureCoordinateType",void 0),t([o({count:2})],s.prototype,"componentDataType",void 0),t([o({count:3})],s.prototype,"cullFace",void 0),t([o({count:3})],s.prototype,"vertexDiscardMode",void 0),t([o({count:3})],s.prototype,"doubleSidedMode",void 0),t([o({count:4})],s.prototype,"alphaDiscardMode",void 0),t([o({count:4})],s.prototype,"integratedMeshMode",void 0),t([o({count:7})],s.prototype,"pbrMode",void 0),t([o({count:3})],s.prototype,"normalType",void 0),t([o({count:8})],s.prototype,"emissionSource",void 0),t([o({count:3})],s.prototype,"shadeNormals",void 0),t([o({count:5})],s.prototype,"polygonOffset",void 0),t([o({count:2})],s.prototype,"vertexPositionRotationType",void 0),t([o({count:2})],s.prototype,"vertexNormalRotationType",void 0),t([o()],s.prototype,"hasEmission",void 0),t([o()],s.prototype,"hasVertexColors",void 0),t([o()],s.prototype,"hasSlicePlane",void 0),t([o()],s.prototype,"isGroundSlice",void 0),t([o()],s.prototype,"hasColorTexture",void 0),t([o()],s.prototype,"hasHighlightMixTexture",void 0),t([o()],s.prototype,"receiveAmbientOcclusion",void 0),t([o()],s.prototype,"receiveShadows",void 0),t([o()],s.prototype,"hasShadowHighlights",void 0),t([o()],s.prototype,"transparent",void 0),t([o()],s.prototype,"screenSpaceReflections",void 0),t([o()],s.prototype,"hasMetallicRoughnessTexture",void 0),t([o()],s.prototype,"hasOcclusionTexture",void 0),t([o()],s.prototype,"hasNormalTexture",void 0),t([o()],s.prototype,"hasOccludees",void 0),t([o()],s.prototype,"terrainDepthTest",void 0),t([o()],s.prototype,"cullAboveTerrain",void 0),t([o()],s.prototype,"hasNormalTextureTransform",void 0),t([o()],s.prototype,"cloudReflections",void 0),t([o()],s.prototype,"snowCover",void 0),t([o()],s.prototype,"renderOccluded",void 0),t([o()],s.prototype,"enableOITOffset",void 0),t([o()],s.prototype,"sphereDepthInterpolate",void 0);export{s as ComponentTechniqueConfiguration};
|
|
2
|
+
import{__decorate as t}from"tslib";import{isColorHighlightOrOLID as e}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as o}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class s extends i{constructor(t){super(),this.output=0,this.textureCoordinateType=0,this.componentDataType=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.shadeNormals=1,this.polygonOffset=0,this.vertexPositionRotationType=1,this.vertexNormalRotationType=0,this.hasEmission=!1,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveGlobalIllumination=!1,this.receiveShadows=!0,this.hasShadowHighlights=!1,this.transparent=!0,this.screenSpaceReflections=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.renderOccluded=!1,this.enableOITOffset=!1,this.sphereDepthInterpolate=!1,this.writeDepth=!0,this.discardInvisibleFragments=!1,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.hasSliceTranslatedView=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1,this.useTransformationTexture=!0,this.sphericalSR=t.sphericalSR,this.useFloatBlend=t.useFloatBlend}get spherical(){return 0!==this.sphericalSR}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&e(this.output)}get hasWater(){return 3===this.pbrMode||4===this.pbrMode||6===this.pbrMode}}t([o()],s.prototype,"useFloatBlend",void 0),t([o({count:12})],s.prototype,"output",void 0),t([o({count:3})],s.prototype,"textureCoordinateType",void 0),t([o({count:2})],s.prototype,"componentDataType",void 0),t([o({count:3})],s.prototype,"cullFace",void 0),t([o({count:3})],s.prototype,"vertexDiscardMode",void 0),t([o({count:3})],s.prototype,"doubleSidedMode",void 0),t([o({count:4})],s.prototype,"alphaDiscardMode",void 0),t([o({count:4})],s.prototype,"integratedMeshMode",void 0),t([o({count:7})],s.prototype,"pbrMode",void 0),t([o({count:3})],s.prototype,"normalType",void 0),t([o({count:8})],s.prototype,"emissionSource",void 0),t([o({count:3})],s.prototype,"shadeNormals",void 0),t([o({count:5})],s.prototype,"polygonOffset",void 0),t([o({count:2})],s.prototype,"vertexPositionRotationType",void 0),t([o({count:2})],s.prototype,"vertexNormalRotationType",void 0),t([o()],s.prototype,"hasEmission",void 0),t([o()],s.prototype,"hasVertexColors",void 0),t([o()],s.prototype,"hasSlicePlane",void 0),t([o()],s.prototype,"isGroundSlice",void 0),t([o()],s.prototype,"hasColorTexture",void 0),t([o()],s.prototype,"hasHighlightMixTexture",void 0),t([o()],s.prototype,"receiveAmbientOcclusion",void 0),t([o()],s.prototype,"receiveGlobalIllumination",void 0),t([o()],s.prototype,"receiveShadows",void 0),t([o()],s.prototype,"hasShadowHighlights",void 0),t([o()],s.prototype,"transparent",void 0),t([o()],s.prototype,"screenSpaceReflections",void 0),t([o()],s.prototype,"hasMetallicRoughnessTexture",void 0),t([o()],s.prototype,"hasOcclusionTexture",void 0),t([o()],s.prototype,"hasNormalTexture",void 0),t([o()],s.prototype,"hasOccludees",void 0),t([o()],s.prototype,"terrainDepthTest",void 0),t([o()],s.prototype,"cullAboveTerrain",void 0),t([o()],s.prototype,"hasNormalTextureTransform",void 0),t([o()],s.prototype,"cloudReflections",void 0),t([o()],s.prototype,"snowCover",void 0),t([o()],s.prototype,"renderOccluded",void 0),t([o()],s.prototype,"enableOITOffset",void 0),t([o()],s.prototype,"sphereDepthInterpolate",void 0);export{s as ComponentTechniqueConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
class
|
|
2
|
+
class t{constructor(t,i,s,e,o){this.vao=t,this.primitiveType=i,this.parameters=s,this.indexed=e,this.geometrySizeHint=o}destroy(){this.vao.dispose()}}export{t as RenderGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{computeDepthRange as
|
|
2
|
+
import{computeDepthRange as e}from"./DepthRange.js";class t{constructor(e){this._objects=e}destroy(){this._objects=null}submit(e,t){this._objects.preSubmit(t);const{visibleObjects:r}=this._objects;r.length<2||r.sort(s),r.forAll(s=>s.submit(e,t))}queryDepthRange(t){return this._objects.visibleObjects.length?e(t,this._objects.visibleObjects):null}get hasEmissions(){return this._objects.visibleObjects.some(e=>0!==e.renderable.material.hasEmissions)?3:0}hasHighlight(e){return this._objects.hasHighlight(e)}}function s(e,t){const s=e.renderable.meta.cameraDepthSquared-t.renderable.meta.cameraDepthSquared;if(0!==s)return s;const r=e.renderable.geometry.geometrySizeHint-t.renderable.geometry.geometrySizeHint;return 0!==r?r:0}export{t as RenderSubmitSystem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getOrCreateMapValue as
|
|
2
|
+
import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import{DataType as e}from"../../../../webgl/enums.js";class s{constructor(t,e,s,i=0){this._owner=t,this._rctx=e,this._techniques=s,this._sorting=i,this._draws=new Array,this._previouslyBoundDraw=new Map}destroy(){this._draws.length=0,this._previouslyBoundDraw.clear()}submitDraw(t,e,s,r,n,a){const o=(s.indexed?s.vao.indexBuffer.indexType:null)??0;this._owner.registerDrawParameters(e);const h=new i(t,e,s,r,n,s.geometrySizeHint,o,a);this._draws.push(h)}acquire(e,s){const i=new Map;return this._draws.map(r=>t(i,r.material,()=>r.material.acquireTechnique(this._techniques,e,s,r.geometry.parameters)))}dispatch(t,e,s){const i=this._rctx;this._previouslyBoundDraw.clear();let n=null;const a=this._draws.length,o=e.highlight?.name;if(0===a)return;const h=1===this._sorting?-1:1,c=1===h?a:-1;for(let l=1===h?0:a-1;l!==c;l+=h){const a=this._draws[l];if(2===t.identifier){const t=a.highlightName;if(t){if(t!==o)continue}else if(!o||!e.overlay?.hasHighlight(o))continue}const h=s[l];h!==n&&(i.bindTechnique(h,e,t),n=h);const{geometryRanges:c,indexType:u,geometry:d,drawParameters:g}=a;i.bindVAO(d.vao),this._previouslyBoundDraw.get(h)!==g&&(h.program.bindDraw(e,t,g),this._previouslyBoundDraw.set(h,g));const m=c.length,{primitiveType:w}=d;for(let t=0;t<m;t+=2){const e=c[t],s=c[t+1];if(0!==u){const t=r.get(u);i.drawElements(w,s,u,e*t)}else i.drawArrays(w,e,s)}}}prepareSubmit(){this._draws.length=0}finishSubmit(){}get count(){return this._draws.length}}class i{constructor(t,e,s,i,r,n,a,o){this.material=t,this.drawParameters=e,this.geometry=s,this.geometryRanges=i,this.depthSquaredHint=r,this.geometrySizeHint=n,this.indexType=a,this.highlightName=o}}const r=new Map;r.set(e.UNSIGNED_BYTE,1),r.set(e.UNSIGNED_SHORT,2),r.set(e.UNSIGNED_INT,4);export{s as RenderPass};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as s}from"tslib";import{disposeMaybe as e}from"../../../../../core/maybe.js";import{
|
|
2
|
+
import{__decorate as s}from"tslib";import{disposeMaybe as e}from"../../../../../core/maybe.js";import{someSet as t}from"../../../../../core/SetUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as a,transpose as i,invert as o}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as n,copy as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as d,ShadowMapPassParameters as u,HighlightPassParameters as p,ViewshedShadowMapPassParameters as l,AllRenderPasses as _}from"./AllRenderPasses.js";import{TwoVectorPosition as w}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as f}from"../../effects/RenderPlugin.js";import{DepthRange as P}from"../../lib/DepthRange.js";import{SizedPixelFormat as g,DataType as x}from"../../../../webgl/enums.js";import y from"../../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../../webgl/TextureDescriptor.js";let T=class extends f{constructor(){super(...arguments),this.produces=new Map([[2,s=>this._produces(s,2)],[4,s=>this._produces(s,4)],[0,s=>this._produces(s,0)],[7,s=>this._produces(s,7)],[10,s=>this._produces(s,10)]]),this._drawParametersArray=new Array,this._drawParametersSet=new Set,this._transformationTexture=null,this._materialPassParameters=new d,this._shadowPassParameters=new u,this._highlightPassParameters=new p,this._viewshedPassParameters=new l,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new _(s,this)}get rctx(){return this._context.renderContext.rctx}get bind(){return this._context.renderContext.bind}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear(),this._transformationTexture=e(this._transformationTexture),this._passes?.opaque.destroy(),this._passes?.transparent.destroy(),this._passes?.integratedMesh.destroy(),this._passes?.transparentIntegratedMesh.destroy(),this._passes?.occludedGround.destroy(),this._passes?.shadowMap.destroy(),this._passes?.highlight.destroy(),this._passes?.highlightIntegratedMesh.destroy(),this._passes?.highlightShadowMap.destroy(),this._passes?.viewshedShadowMap.destroy(),this._passes?.defaultShadowMap.destroy(),this._passes=null}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,s=>s.count>0)}prepareRender(s){const{_systems:t,_passes:r}=this;if(0!==t.size&&null!=r){this._drawParametersSet.clear(),this._drawParametersArray.length=0,this._transformationTexture=e(this._transformationTexture);for(const s of Object.values(r))s.prepareSubmit();t.forEach(e=>e.submit(r,s.bind)),this._updateTransformationTexture();for(const s of Object.values(r))s.finishSubmit();this._context.techniques.frameUpdate()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=5===s.output||6===s.output||7===s.output?this._shadowPassParameters:8===s.output?this._viewshedPassParameters:10===s.output?this._highlightPassParameters:this._materialPassParameters,{bind:t}=s;return this._updateParameters(t.camera,e,t.slot),this._invoke(s.output,s.bind.slot,(e,t)=>(t.transformationTexture=this._transformationTexture,e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,(t,r)=>t.dispatch(r,s.bind,e))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case 2:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.opaque,this._materialPassParameters);case 10:return t(this._passes.highlight,this._highlightPassParameters);case 5:return t(this._passes.shadowMap,this._shadowPassParameters);case 6:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case 7:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case 8:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case 4:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.transparent,this._materialPassParameters)}break;case 0:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:case 9:return t(this._passes.integratedMesh,this._materialPassParameters);case 10:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case 7:switch(s){case 0:case 1:case 2:return t(this._passes.transparentIntegratedMesh,this._materialPassParameters)}break;case 10:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}requestRender(){this._context.requestRender()}queryDepthRange(s){const e=new P;return this._systems.forEach(t=>e.union(t.queryDepthRange(s))),e}get hasEmissions(){return t(this._systems,s=>0!==s.hasEmissions)?3:0}_updateParameters(s,e,t){const r=s.viewInverseTransposeMatrix,h=4===t,c=10===t;n(M,r[3],r[7],r[11]),S.set(M),m(e.transformWorldFromViewTH,S.high),m(e.transformWorldFromViewTL,S.low),m(e.slicePlaneLocalOrigin,M),a(e.transformViewFromCameraRelativeRS,s.viewMatrix),0===e.identifier&&(this._materialPassParameters.transparent=h,this._materialPassParameters.occludedGround=c,i(v,e.transformViewFromCameraRelativeRS),o(e.transformNormalViewFromGlobal,v))}hasHighlight(s){return t(this._systems,e=>e.hasHighlight(s))}registerDrawParameters(s){if(!this._drawParametersSet.has(s)){this._drawParametersSet.add(s);const e=this._drawParametersArray.length;this._drawParametersArray.push(s),s.setTransformationDrawId(e)}}_updateTransformationTexture(){const s=this._drawParametersArray.length;if(0===s)return;const e=5,t=3*e,r=2**Math.ceil(Math.log2(s)),a=new Float32Array(r*t);for(let i=0;i<s;i++){const s=this._drawParametersArray[i];s.setTransformationDrawId(i);const e=i*t;a.set(s.transformationFloats,e)}if(this._transformationTexture&&this._transformationTexture.descriptor.height>=s)this._transformationTexture.updateData(0,0,0,e,s,a);else{this._transformationTexture?.dispose();const s=new b(e,r);s.internalFormat=g.RGB32F,s.dataType=x.FLOAT,s.hasMipmap=!1,s.isImmutable=!0,s.pixelFormat=6407,s.samplingMode=9728,this._transformationTexture=new y(this.rctx,s,a)}}};T=s([r("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],T);const M=c(),v=h(),S=new w;export{T as RenderPassManager};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as r}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function a(e){e.uniforms.add(new r("zProjectionMap",e=>
|
|
2
|
+
import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as r}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function a(e){e.uniforms.add(new r("zProjectionMap",e=>i(e.camera))),e.code.add(o`float linearizeDepth(float depth, vec2 zProjectionConstants) {
|
|
3
3
|
float depthNdc = depth * 2.0 - 1.0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
return -(zProjectionConstants[0] / (depthNdc + zProjectionConstants[1] + 1e-7));
|
|
5
|
+
}
|
|
6
|
+
float linearizeDepth(float depth) {
|
|
7
|
+
return linearizeDepth(depth, zProjectionMap);
|
|
7
8
|
}`),e.code.add(o`float delinearizeDepth(float linearDepth) {
|
|
8
9
|
float c1 = zProjectionMap[0];
|
|
9
10
|
float c2 = zProjectionMap[1];
|
|
@@ -15,4 +16,4 @@ ivec2 iuv = ivec2(uv * vec2(textureSize(depthTexture, 0)));
|
|
|
15
16
|
return texelFetch(depthTexture, iuv, 0).r;
|
|
16
17
|
}`),e.code.add(o`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
|
|
17
18
|
return linearizeDepth(depthFromTexture(depthTexture, uv));
|
|
18
|
-
}`)}function
|
|
19
|
+
}`)}function i(t){const r=t.projectionMatrix;return e(n,r[14],r[10])}const n=t();export{a as ReadDepth,i as getZProjectionMap};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{ReadDepth as e,getZProjectionMap as r}from"./ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function a(a){a.include(e),a.uniforms.add(new t("zProjectionMapLastFrame",e=>r(e.reprojection.lastFrameCamera))),a.code.add(o`float linearDepthFromTextureLastFrame(sampler2D depthTexture, vec2 uv) {
|
|
3
|
+
return linearizeDepth(depthFromTexture(depthTexture, uv), zProjectionMapLastFrame);
|
|
4
|
+
}`)}export{a as ReadDepthLastFrame};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{glsl as e}from"../../shaderModules/glsl.js";function o(o){o.code.add(e`vec2 encodeRGBtoVec2(vec3 color) {
|
|
3
|
+
return vec2(color.r, color.b);
|
|
4
|
+
}
|
|
5
|
+
vec3 decodeVec2ToRGB(vec2 encoded) {
|
|
6
|
+
return vec3(encoded.x, (encoded.x + encoded.y)/2.0, encoded.y);
|
|
7
|
+
}`)}export{o as EncodeEmissionColors};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{FloatsBindUniform as n}from"../../shaderModules/FloatsBindUniform.js";import{glsl as
|
|
2
|
+
import{FloatsBindUniform as n}from"../../shaderModules/FloatsBindUniform.js";import{glsl as e}from"../../shaderModules/glsl.js";function h(h,i){h.uniforms.add(new n("shR",9,({lighting:n})=>n.sh.r),new n("shG",9,({lighting:n})=>n.sh.g),new n("shB",9,({lighting:n})=>n.sh.b)),h.code.add(e`vec3 calculateAmbientIrradiance(vec3 normal) {
|
|
3
3
|
vec3 ambientLight = 0.282095 * vec3(shR[0], shG[0], shB[0]);
|
|
4
4
|
vec4 sh1 = vec4(
|
|
5
5
|
0.488603 * normal.x,
|
|
@@ -29,10 +29,10 @@ dot(lightingAmbientSH_R2, sh2),
|
|
|
29
29
|
dot(lightingAmbientSH_G2, sh2),
|
|
30
30
|
dot(lightingAmbientSH_B2, sh2)
|
|
31
31
|
);
|
|
32
|
-
return ambientLight
|
|
33
|
-
}`),1!==
|
|
34
|
-
vec3 calculateAmbientRadiance(
|
|
32
|
+
return ambientLight;
|
|
33
|
+
}`),1!==i.pbrMode&&2!==i.pbrMode||h.code.add(e`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0);
|
|
34
|
+
vec3 calculateAmbientRadiance()
|
|
35
35
|
{
|
|
36
36
|
vec3 ambientLight = 1.2 * (0.282095 * vec3(shR[0], shG[0], shB[0])) - 0.2;
|
|
37
|
-
return ambientLight *=
|
|
38
|
-
}`)}export{
|
|
37
|
+
return ambientLight *= skyTransmittance;
|
|
38
|
+
}`)}export{h as EvaluateAmbientLighting};
|
|
@@ -1,70 +1,113 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as n}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as
|
|
3
|
-
${s(0!==v,"const float GROUND_REFLECTANCE = 0.2;")}
|
|
4
|
-
`),p(g),L(g),e(g),g.code.add(m`
|
|
2
|
+
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as n}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as e}from"./Gamma.glsl.js";import{addMainLightDirection as t,addMainLightIntensity as a,applyShading as o}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as l}from"./PhysicallyBasedRendering.glsl.js";import{PiUtils as r}from"./PiUtils.glsl.js";import{ReadGlobalIllumination as c}from"./ReadGlobalIllumination.glsl.js";import{BooleanBindUniform as s}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as d}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as u}from"../../shaderModules/glsl.js";import{ambientBoost as g}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as h}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";import{ToneMapping as p}from"../../../shaders/ToneMapping.glsl.js";function f(i){i.constants.add("ambientBoostFactor","float",g)}function b(i){i.uniforms.add(new d("lightingGlobalFactor",i=>i.lighting.globalFactor))}function v(g,v){const{pbrMode:L,spherical:C,hasColorTexture:I,receiveGlobalIllumination:D}=v;g.include(e),g.include(c,v),g.include(n,v),0!==L&&g.include(l,v),g.include(i,v),g.include(r),g.include(p,v);const R=!(2===L&&!I);R&&g.include(h),f(g),b(g),t(g),g.code.add(m`
|
|
5
3
|
float additionalDirectedAmbientLight(float lightAlignment) {
|
|
6
4
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
float additionalDirectedAmbientLight(vec3 vPosWorld) {
|
|
10
|
-
float lightAlignment = dot(${
|
|
8
|
+
float lightAlignment = dot(${C?m`normalize(vPosWorld)`:m`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
|
|
11
9
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
12
10
|
}
|
|
13
|
-
`),
|
|
11
|
+
`),a(g),g.code.add(m`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
|
|
14
12
|
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
|
|
15
13
|
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
|
|
16
|
-
}`),
|
|
14
|
+
}`);const y=D?"globalIlluminationOcclusion":"ssao",A=D?.75:1,S=D?1.5:1;switch(L){case 0:case 4:case 3:g.include(o),g.code.add(m`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) {
|
|
17
15
|
vec3 mainLighting = applyShading(normalWorld, shadow);
|
|
18
|
-
vec3 ambientLighting = calculateAmbientIrradiance(normalWorld
|
|
16
|
+
vec3 ambientLighting = calculateAmbientIrradiance(normalWorld) * (1.0 - ssao);
|
|
19
17
|
vec3 albedoLinear = linearizeGamma(albedo);
|
|
20
18
|
vec3 totalLight = mainLighting + ambientLighting + additionalLight;
|
|
21
19
|
totalLight = min(totalLight, vec3(PI));
|
|
22
20
|
vec3 outColor = vec3((albedoLinear / PI) * totalLight);
|
|
23
21
|
return delinearizeGamma(outColor);
|
|
24
|
-
}`);break;case 1:case 2:g.code.add(m`
|
|
25
|
-
const float
|
|
26
|
-
const float
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
inputs
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
vec3
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
vec3
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
22
|
+
}`);break;case 1:case 2:{const i=D?.35:.2;g.code.add(m`
|
|
23
|
+
const float fillLightIntensity = 0.25;
|
|
24
|
+
const float horizonLightDiffusion = 0.4;
|
|
25
|
+
const float additionalAmbientIrradianceFactor = 0.02;
|
|
26
|
+
const float groundReflectance = ${m.float(i)};
|
|
27
|
+
|
|
28
|
+
vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
|
|
29
|
+
vec3 viewDirection, vec3 upDirection, vec3 mrr, float additionalAmbientIrradiance) {
|
|
30
|
+
PBRShadingInfo inputs;
|
|
31
|
+
calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo, mrr);
|
|
32
|
+
|
|
33
|
+
${u(D,m`vec3 globalIlluminationOcclusion = min(1.2 * readGlobalIlluminationOcclusion(), 1.0);`)}
|
|
34
|
+
`),v.useFillLights?g.uniforms.add(new s("hasFillLights",i=>i.enableFillLights)):g.constants.add("hasFillLights","bool",!1),g.code.add(m`
|
|
35
|
+
vec3 ambientDir = vec3(5.0 * upDirection[1] - upDirection[0] * upDirection[2], - 5.0 * upDirection[0] - upDirection[2] * upDirection[1], upDirection[1] * upDirection[1] + upDirection[0] * upDirection[0]);
|
|
36
|
+
ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
|
|
37
|
+
|
|
38
|
+
inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
|
|
39
|
+
|
|
40
|
+
// Calculate the irradiance components: sun, fill lights and the sky.
|
|
41
|
+
vec3 mainLightIrradianceComponent = ${m.float(A)} * inputs.NdotL * (1.0 - shadow) * mainLightIntensity;
|
|
42
|
+
vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
|
|
43
|
+
// calculate ambient irradiance for localView and additionalLight for globalView
|
|
44
|
+
vec3 ambientLightIrradianceComponent = ${m.float(S)} * calculateAmbientIrradiance(normal) * (1.0 - ${y}) + additionalLight;
|
|
45
|
+
|
|
46
|
+
// Assemble the overall irradiance of the sky that illuminates the surface
|
|
47
|
+
inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
|
|
48
|
+
// Assemble the overall irradiance of the ground that illuminates the surface. for this we use the simple model that changes only the sky irradiance by the groundReflectance
|
|
49
|
+
inputs.groundIrradianceToSurface = groundReflectance * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
|
|
50
|
+
`),g.uniforms.add(new d("lightingSpecularStrength",i=>i.lighting.mainLight.specularStrength),new d("lightingEnvironmentStrength",i=>i.lighting.mainLight.environmentStrength)).code.add(m`
|
|
51
|
+
vec3 horizonRingDir = inputs.RdotUP * upDirection - inputs.reflectedView;
|
|
52
|
+
vec3 horizonRingH = normalize(horizonRingDir - viewDirection);
|
|
53
|
+
inputs.NdotH_Horizon = dot(normal, horizonRingH);
|
|
54
|
+
|
|
55
|
+
vec3 mainLightRadianceComponent = lightingSpecularStrength * normalDistribution(inputs.NdotH, inputs.roughness) * mainLightIntensity * (1.0 - shadow);
|
|
56
|
+
vec3 horizonLightRadianceComponent = lightingEnvironmentStrength * normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * mainLightIntensity * fillLightIntensity;
|
|
57
|
+
|
|
58
|
+
// calculateAmbientRadiance for localView and additionalLight for global view
|
|
59
|
+
vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance() * (1.0 - ${y}) + additionalLight;
|
|
60
|
+
float normalDirectionModifier = mix(1., min(mix(0.1, 2.0, (inputs.NdotUP + 1.) * 0.5), 1.0), clamp(inputs.roughness * 5.0, 0.0 , 1.0));
|
|
61
|
+
|
|
62
|
+
// Assemble the overall radiance of the sky that illuminates the surface
|
|
63
|
+
inputs.skyRadianceToSurface = (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
|
|
64
|
+
|
|
65
|
+
// Assemble the overall radiance of the ground that illuminates the surface. for this we use the simple model that changes only the sky radiance by the groundReflectance
|
|
66
|
+
inputs.groundRadianceToSurface = 0.5 * groundReflectance * (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
|
|
67
|
+
|
|
68
|
+
// Calculate average ambient radiance - This is used in the gamut mapping process to determine the black level for compression
|
|
69
|
+
inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + groundReflectance);
|
|
70
|
+
`),g.code.add(m`
|
|
47
71
|
vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
|
|
48
72
|
vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
|
|
49
73
|
vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent;
|
|
50
|
-
|
|
51
|
-
|
|
74
|
+
|
|
75
|
+
${u(D,m`
|
|
76
|
+
vec3 globalIlluminationEmission = 2.25 * (0.75 * inputs.albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
|
|
77
|
+
outColorLinear += globalIlluminationEmission;`)}
|
|
78
|
+
|
|
79
|
+
${R?m`vec3 adjustedOutColorLinear = blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance);`:m`vec3 adjustedOutColorLinear = max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance);`}
|
|
80
|
+
|
|
81
|
+
return delinearizeGamma(adjustedOutColorLinear);
|
|
82
|
+
}
|
|
83
|
+
`);break}case 5:case 6:{const i=D?.35:.5,n=D?.75:1,e=D?1.5:1;t(g),a(g),g.code.add(m`
|
|
84
|
+
const float roughnessTerrain = 0.5;
|
|
85
|
+
const float specularityTerrain = ${m.float(i)};
|
|
86
|
+
|
|
87
|
+
vec3 evaluatePBRSimplifiedLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDirection, vec3 upDirection) {
|
|
88
|
+
PBRShadingInfo inputs;
|
|
89
|
+
calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
|
|
90
|
+
|
|
91
|
+
${u(D,m`vec3 globalIlluminationOcclusion = min(1.2 * readGlobalIlluminationOcclusion(), 1.0);`)}
|
|
92
|
+
|
|
93
|
+
vec3 mainLightIrradianceComponent = ${m.float(n)} * (1.0 - shadow) * inputs.NdotL * mainLightIntensity;
|
|
94
|
+
vec3 ambientLightIrradianceComponent = ${m.float(e)} * calculateAmbientIrradiance(normal) * (1.0 - ${y}) + additionalLight;
|
|
95
|
+
vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
|
|
96
|
+
|
|
97
|
+
vec3 indirectDiffuse = ((1.0 - inputs.NdotUP) * mainLightIrradianceComponent + (1.0 + inputs.NdotUP ) * ambientSky) * 0.5;
|
|
98
|
+
vec3 outDiffColor = inputs.albedoLinear * (1.0 - inputs.f0) * indirectDiffuse / PI;
|
|
99
|
+
|
|
100
|
+
vec3 mainLightRadianceComponent = normalDistribution(inputs.NdotH, roughnessTerrain) * mainLightIntensity;
|
|
101
|
+
vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, inputs.NdotV);
|
|
102
|
+
vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
|
|
103
|
+
vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceComponent;
|
|
104
|
+
|
|
105
|
+
vec3 outColorLinear = outDiffColor + specularComponent;
|
|
106
|
+
|
|
107
|
+
${u(D,m`
|
|
108
|
+
vec3 globalIlluminationEmission = 2.25 * (0.75 * inputs.albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
|
|
109
|
+
outColorLinear += globalIlluminationEmission;`)}
|
|
110
|
+
|
|
111
|
+
return delinearizeGamma(outColorLinear);
|
|
52
112
|
}
|
|
53
|
-
|
|
54
|
-
const float specularityTerrain = 0.5;
|
|
55
|
-
vec3 evaluatePBRSimplifiedLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDirection, vec3 upDirection) {
|
|
56
|
-
PBRShadingInfo inputs;
|
|
57
|
-
calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
|
|
58
|
-
vec3 mainLightIrradianceComponent = (1. - shadow) * inputs.NdotL * mainLightIntensity;
|
|
59
|
-
vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
|
|
60
|
-
vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
|
|
61
|
-
vec3 indirectDiffuse = ((1.0 - inputs.NdotUP) * mainLightIrradianceComponent + (1.0 + inputs.NdotUP ) * ambientSky) * 0.5;
|
|
62
|
-
vec3 outDiffColor = inputs.albedoLinear * (1.0 - inputs.f0) * indirectDiffuse / PI;
|
|
63
|
-
vec3 mainLightRadianceComponent = normalDistribution(inputs.NdotH, roughnessTerrain) * mainLightIntensity;
|
|
64
|
-
vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, inputs.NdotV);
|
|
65
|
-
vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
|
|
66
|
-
vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceComponent;
|
|
67
|
-
vec3 outColorLinear = outDiffColor + specularComponent;
|
|
68
|
-
vec3 outColor = delinearizeGamma(outColorLinear);
|
|
69
|
-
return outColor;
|
|
70
|
-
}`)}}export{f as EvaluateSceneLighting,p as addAmbientBoostFactor,L as addLightingGlobalFactor};
|
|
113
|
+
`);break}}}export{v as EvaluateSceneLighting,f as addAmbientBoostFactor,b as addLightingGlobalFactor};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{EncodeEmissionColors as e}from"./EncodingColor.glsl.js";import{glsl as l}from"../../shaderModules/glsl.js";import{Texture2DBindUniform as n}from"../../shaderModules/Texture2DBindUniform.js";import{blurSizePixels as o}from"../../../effects/globalIllumination/GlobalIllumination.js";function i(i,r){r.receiveGlobalIllumination?(i.include(e),i.uniforms.add(new n("globalIlluminationTexture",e=>e.globalIllumination?.getTexture())),i.constants.add("blurSizePixelsInverse","float",1/o),i.code.add(l`vec3 readGlobalIlluminationOcclusionInverse() {
|
|
3
|
+
ivec2 texel = ivec2(gl_FragCoord.xy * blurSizePixelsInverse);
|
|
4
|
+
return vec3(texelFetch(globalIlluminationTexture, texel, 0).a);
|
|
5
|
+
}
|
|
6
|
+
vec3 readGlobalIlluminationOcclusion() {
|
|
7
|
+
return 1.0 - readGlobalIlluminationOcclusionInverse();
|
|
8
|
+
}
|
|
9
|
+
vec4 readGlobalIlluminationEmissionInverse() {
|
|
10
|
+
ivec2 texel = ivec2(gl_FragCoord.xy * blurSizePixelsInverse);
|
|
11
|
+
vec3 encodedEmission = texelFetch(globalIlluminationTexture, texel, 0).rgb;
|
|
12
|
+
vec3 rgb = decodeVec2ToRGB(encodedEmission.rg);
|
|
13
|
+
return 1.0 - vec4(rgb, 0.0);
|
|
14
|
+
}
|
|
15
|
+
vec4 readGlobalIlluminationEmission() {
|
|
16
|
+
return max((1.0 - readGlobalIlluminationEmissionInverse() - 0.01) / 0.99, 0.);
|
|
17
|
+
}`)):i.code.add(l`vec3 readGlobalIlluminationOcclusionInverse() { return vec3(1.0); }
|
|
18
|
+
vec3 readGlobalIlluminationOcclusion() { return vec3(0.0); }
|
|
19
|
+
vec4 readGlobalIlluminationEmissionInverse() { return vec4(1.0); }
|
|
20
|
+
vec4 readGlobalIlluminationEmission() { return vec4(0.0); }`)}export{i as ReadGlobalIllumination};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{FloatBindUniform as o}from"../../shaderModules/FloatBindUniform.js";import{glsl as r}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as
|
|
2
|
+
import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{FloatBindUniform as o}from"../../shaderModules/FloatBindUniform.js";import{glsl as r}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as a}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as i}from"../../shaderModules/Texture2DBindUniform.js";function d(d,n){if(!n.screenSpaceReflections)return;const c=d.fragment;c.include(e),c.uniforms.add(new t("nearFar",e=>e.camera.nearFar),new i("depthMap",e=>e.depth?.attachment),new a("proj",e=>e.camera.projectionMatrix),new o("invResolutionHeight",e=>1/e.camera.height),new a("reprojectionMatrix",e=>e.reprojection.matrix)).code.add(r`
|
|
3
3
|
vec2 reprojectionCoordinate(vec3 projectionCoordinate)
|
|
4
4
|
{
|
|
5
5
|
vec4 zw = proj * vec4(0.0, 0.0, -projectionCoordinate.z, 1.0);
|
|
@@ -8,8 +8,6 @@ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform
|
|
|
8
8
|
return reprojectedCoord.xy * 0.5 + 0.5;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const int maxSteps = ${n.highStepCount?"150":"75"};
|
|
12
|
-
|
|
13
11
|
vec4 applyProjectionMat(mat4 projectionMat, vec3 x)
|
|
14
12
|
{
|
|
15
13
|
vec4 projectedCoord = projectionMat * vec4(x, 1.0);
|
|
@@ -18,7 +16,7 @@ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform
|
|
|
18
16
|
return projectedCoord;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
vec3 screenSpaceIntersection(vec3 dir, vec3 startPosition, vec3 viewDir, vec3 normal)
|
|
19
|
+
vec3 screenSpaceIntersection(vec3 dir, vec3 startPosition, vec3 viewDir, vec3 normal, float offset, bool globalIllumination)
|
|
22
20
|
{
|
|
23
21
|
vec3 viewPos = startPosition;
|
|
24
22
|
vec3 viewPosEnd = startPosition;
|
|
@@ -42,18 +40,20 @@ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform
|
|
|
42
40
|
vec2 projectedCoordDir = (projectedCoordEnd.xy - projectedCoordStart.xy);
|
|
43
41
|
vec2 projectedCoordDistVanishingPoint = (projectedCoordVanishingPoint.xy - projectedCoordStart.xy);
|
|
44
42
|
|
|
45
|
-
float
|
|
43
|
+
float maxReach = globalIllumination ? 0.15 : 1.0;
|
|
44
|
+
float distMod = min(globalIllumination ? length(projectedCoordDistVanishingPoint.xy) : abs(projectedCoordDistVanishingPoint.y), maxReach);
|
|
46
45
|
|
|
47
46
|
float projectedCoordDirLength = length(projectedCoordDir);
|
|
47
|
+
int maxSteps = globalIllumination ? 16 : ${n.highStepCount?"150":"75"};
|
|
48
48
|
float maxSt = float(maxSteps);
|
|
49
49
|
|
|
50
50
|
// normalize the projection direction depending on maximum steps
|
|
51
51
|
// this determines how blocky the reflection looks
|
|
52
|
-
vec2 dP =
|
|
52
|
+
vec2 dP = distMod * (projectedCoordDir)/(maxSt * projectedCoordDirLength);
|
|
53
53
|
|
|
54
54
|
// Normalize the homogeneous camera space coordinates
|
|
55
|
-
vec3 dQ =
|
|
56
|
-
float dk =
|
|
55
|
+
vec3 dQ = distMod * (Q1 - Q0)/(maxSt * projectedCoordDirLength);
|
|
56
|
+
float dk = distMod * (k1 - k0)/(maxSt * projectedCoordDirLength);
|
|
57
57
|
|
|
58
58
|
// initialize the variables for ray marching
|
|
59
59
|
vec2 P = projectedCoordStart.xy;
|
|
@@ -72,6 +72,10 @@ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform
|
|
|
72
72
|
return vec3(P, 0.0);
|
|
73
73
|
float dDepthBefore = 0.0;
|
|
74
74
|
|
|
75
|
+
P = clamp(P + offset * dP, vec2(0.0), vec2(0.999));
|
|
76
|
+
Q.z += offset * dQ.z;
|
|
77
|
+
k += offset * dk;
|
|
78
|
+
|
|
75
79
|
for(int i = 0; i < maxSteps-1; i++)
|
|
76
80
|
{
|
|
77
81
|
depth = -linearDepthFromTexture(depthMap, P); // get linear depth from the depth buffer
|
|
@@ -106,12 +110,22 @@ import{ReadDepth as e}from"../output/ReadDepth.glsl.js";import{Float2BindUniform
|
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
|
|
113
|
+
if (globalIllumination && (P.x <= 0.0 || P.x >= 1.0)) {
|
|
114
|
+
return vec3(P, 0.0);
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
// continue with ray marching
|
|
110
|
-
|
|
118
|
+
// Clamp to 0.999 to avoid sampling edge artifacts for water reflections
|
|
119
|
+
P = P + dP;
|
|
111
120
|
Q.z += dQ.z;
|
|
112
121
|
k += dk;
|
|
113
122
|
rayDiffZOld = rayDiffZ;
|
|
114
123
|
dDepthBefore = dDepth;
|
|
124
|
+
|
|
125
|
+
// Clamp to 0.999 to avoid sampling edge artifacts for water reflections
|
|
126
|
+
if (!globalIllumination) {
|
|
127
|
+
P = clamp(P, vec2(0.0), vec2(0.999));
|
|
128
|
+
}
|
|
115
129
|
}
|
|
116
130
|
return vec3(P, 0.0);
|
|
117
131
|
}
|
|
@@ -46,7 +46,7 @@ vec3 viewNormal = normalize(viewNormalVectorCoordinate.xyz);
|
|
|
46
46
|
vec4 viewUp = view * vec4(localUp, 0.0);
|
|
47
47
|
vec3 viewNormalCorrectedSSR = mix(viewUp.xyz, viewNormal, correctionViewingFactor);
|
|
48
48
|
vec3 reflected = normalize(reflect(viewDir, viewNormalCorrectedSSR));
|
|
49
|
-
vec3 hitCoordinate = screenSpaceIntersection(reflected, viewPosition, viewDir, viewUp.xyz);
|
|
49
|
+
vec3 hitCoordinate = screenSpaceIntersection(reflected, viewPosition, viewDir, viewUp.xyz, 0.0, false);
|
|
50
50
|
vec3 reflectedColor = vec3(0.0);
|
|
51
51
|
if (hitCoordinate.z > 0.0)
|
|
52
52
|
{
|
|
@@ -14,7 +14,7 @@ return (rotMat * vec4(inVec, 0.0)).xyz;
|
|
|
14
14
|
float upDotLight = dot(cameraPosition, mainLightDirection);
|
|
15
15
|
float dirDotLight = max(dot(worldSpaceRay, mainLightDirection), 0.0);
|
|
16
16
|
float sunsetTransition = clamp(pow(max(upDotLight, 0.0), sunsetTransitionFactor), 0.0, 1.0);
|
|
17
|
-
vec3 ambientLight = calculateAmbientIrradiance(cameraPosition
|
|
17
|
+
vec3 ambientLight = calculateAmbientIrradiance(cameraPosition);
|
|
18
18
|
vec3 combinedLight = clamp((mainLightIntensity + ambientLight )/PI, vec3(0.0), vec3(1.0));
|
|
19
19
|
vec3 baseCloudColor = pow(combinedLight * pow(clouds.xyz, vec3(GAMMA)), vec3(INV_GAMMA));
|
|
20
20
|
float scatteringMod = max(clouds.a < 0.5 ? clouds.a / 0.5 : - clouds.a / 0.5 + 2.0, 0.0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Accessor.js";const r={required:[]},t={required:[3]};class s extends e{precompile(e){return!!this.acquireTechniques(e)}get usedMemory(){return 0}get renderOccludedFlags(){return 1}get testsTransparentRenderOrder(){return 0}get isDecoration(){return!1}get readyToRun(){return!1}get numGeometries(){return 0}get hasOccludees(){return!1}get
|
|
2
|
+
import e from"../../../../core/Accessor.js";const r={required:[]},t={required:[3]};class s extends e{precompile(e){return!!this.acquireTechniques(e)}get usedMemory(){return 0}get renderOccludedFlags(){return 1}get testsTransparentRenderOrder(){return 0}get isDecoration(){return!1}get readyToRun(){return!1}get numGeometries(){return 0}get hasOccludees(){return!1}get hasEmissions(){return 0}forEachGeometry(e){}}class n extends s{}class u extends s{}export{u as AsyncRenderPlugin,t as ConsumesDepth,r as ConsumesNone,n as SyncRenderPlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{removeUnordered as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{sort as t}from"../../../../core/heapSort.js";import{isPromiseLike as r,createAbortError as s}from"../../../../core/promiseUtils.js";import{signal as n}from"../../../../core/signal.js";import{
|
|
2
|
+
import{removeUnordered as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{sort as t}from"../../../../core/heapSort.js";import{isPromiseLike as r,createAbortError as s}from"../../../../core/promiseUtils.js";import{signal as n}from"../../../../core/signal.js";import{someEmissions as o}from"./emissive/emissions.js";import{DepthRange as i}from"../lib/DepthRange.js";class h{constructor(e){this.context=e,this._renderPlugins=new Array,this._slots=new Array,this._version=n(0);for(let t=0;t<21;++t)this._slots[t]=[]}destroy(){this._renderPlugins.forEach(e=>e.destroy()),this._renderPlugins.length=0}get plugins(){return this._renderPlugins}add(e,t){const n=()=>{if(t?.aborted)throw e.uninitializeRenderContext(),s();this._renderPlugins.push(e),e.produces.forEach((t,r)=>this._slots[r].push(e)),this.context.requestRender(),this._version.value++},o=e.initializeRenderContext(this.context,t);if(r(o))return o.then(n);n()}remove(t){e(this._renderPlugins,t),t.uninitializeRenderContext();for(let e=0;e<this._slots.length;++e)this._slots[e]=this._slots[e].filter(e=>e!==t);this.context.requestRender(),this._version.value++}sortTestsTransparentOrderedSlots(e){if("test"!==process.env.NODE_ENV)return;if(this._renderPlugins.some(e=>0!==e.testsTransparentRenderOrder))for(const r of e){const e=this._slots[r];t(e,0,e.length,(e,t)=>(e.testsTransparentRenderOrder??0)-(t.testsTransparentRenderOrder??0))}}prepareRender(){this._renderPlugins.forEach(e=>{e.prepareRender&&e.prepareRender(this.context.renderContext)})}updateAnimation(e){let t=!1;return this._renderPlugins.forEach(r=>t=r.updateAnimation?.(e)||t),t}precompile(...e){++this.context.techniques.precompiling;const t=this.context.renderContext.bind.slot;for(const r of e)this.context.renderContext.bind.slot=r,this._forEachRender(()=>{});this.context.renderContext.bind.slot=t,--this.context.techniques.precompiling}render(...e){for(const t of e)this.context.renderContext.bind.slot=t,this._forEachRender((e,t)=>e.render(this.context.renderContext,t))}_forEachRender(e){const t=this.context.renderContext.bind.slot,r=this.context.renderContext.output;this._slots[t].forEach(s=>{const n=s.produces.get(t);if(!n?.(r)||s.isDecoration&&!this.context.renderContext.bind.decorations)return;const o=s.acquireTechniques(this.context.renderContext);o&&e(s,o)})}queryDepthRange(e){return this._renderPlugins.reduce((t,r)=>t.union(r.queryDepthRange?.(e)),new i)}get updating(){return this._version.value>=0&&this._renderPlugins.some(e=>e.readyToRun)}produces(e,...t){return t.some(t=>this._slots[t].some(r=>{const s=r.produces.get(t);return!!s&&s(e)}))}hasHighlight(e){return d.some(t=>this._slots[t].some(t=>t.hasHighlight(e)))}get hasDecorations(){return this._renderPlugins.some(e=>e.isDecoration)}get hasOccludees(){return this._renderPlugins.some(e=>e.hasOccludees)}get hasEmissions(){return o(this._renderPlugins)}get renderOccludedFlags(){return this._renderPlugins.reduce((e,t)=>e|(t.renderOccludedFlags??0),0)}get usedMemory(){return this._renderPlugins.reduce((e,t)=>t.material?e:e+(t.usedMemory??0),0)}get test(){}}const d=[2,4,19,13,14,15];export{h as RenderPluginManager};
|