UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 3.63 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as s}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as r,c as o}from"../../../../chunks/vec42.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as d}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as _}from"../../../webgl/Util.js";const c=4e4,p=5e4,m=1/512;let u=class extends t{constructor(s,t,e,i){super({}),this._techniques=s,this._rctx=t,this._data=e,this._requestRender=i,this._passParameters=new h(this._data),this._configuration=new l,this._enabled=!1,this._vao=n(t)}dispose(){this._stop(),this._vao=e(this._vao)}precompile(){this._showVisualization&&this._techniques.precompile(d,this._configuration)}render(s){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const t=this._techniques.get(d,this._configuration);this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(t,s,this._passParameters),this._rctx.drawArrays(t.primitiveType,0,_(this._vao,"geometry"))}setOptions(s){void 0!==s.enabled&&this._setEnabled(s.enabled),void 0!==s.color&&this._setColor(s.color),void 0!==s.threshold&&(this._threshold=s.threshold),void 0!==s.visualization&&(this._visualization=s.visualization),void 0!==s.bandSize&&(this._bandSize=s.bandSize),void 0!==s.bandsEnabled&&(this._bandsEnabled=s.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(s){this._passParameters.opacityFromElevation!==s&&(this._passParameters.opacityFromElevation=s,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>m}get _threshold(){return this._passParameters.threshold}set _threshold(s){this._threshold!==s&&(this._passParameters.threshold=s,this._requestRenderIfEnabled())}get _visualization(){return this._configuration.visualization}set _visualization(s){s!==this._visualization&&(this._configuration.visualization=s,this._requestRenderIfEnabled())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(s){s!==this._bandSize&&(this._passParameters.bandSize=s,this._requestRenderIfEnabled())}get _bandsEnabled(){return this._configuration.bandsEnabled}set _bandsEnabled(s){s!==this._bandsEnabled&&(this._configuration.bandsEnabled=s,this._requestRenderIfEnabled())}_setColor(s){const t=this._passParameters.color;r(s,t)||(o(this._passParameters.color,s),this._requestRenderIfEnabled())}_setEnabled(s){s!==this._enabled&&(s?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};s([i()],u.prototype,"opacityFromElevation",null),u=s([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],u);export{u as ShadowCastRenderer,p as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,m as shadowCastDisabledElevationThreshold};