@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.68 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{copy as r}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as t}from"./Object3DVisualElement.js";import{createSquareGeometry as i}from"../../webgl-engine/lib/GeometryUtil.js";import{SlicePlaneMaterial as a}from"../../webgl-engine/materials/SlicePlaneMaterial.js";class s extends t{constructor(r){super(r),this._material=null,this._renderOccluded=4,this._gridWidth=1,this._gridColor=e(1,0,0,1),this._backgroundColor=e(1,0,0,1),this.applyProperties(r)}get renderOccluded(){return this._renderOccluded}set renderOccluded(r){r!==this._renderOccluded&&(this._renderOccluded=r,this._updateMaterial())}get gridWidth(){return this._gridWidth}set gridWidth(r){this._gridWidth!==r&&(this._gridWidth=r,this._updateMaterial())}get gridColor(){return this._gridColor}set gridColor(e){r(this._gridColor,e),this._updateMaterial()}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){r(this._backgroundColor,e),this._updateMaterial()}createExternalResources(){this._material=new a(this._materialParameters)}destroyExternalResources(){this._material=null}forEachMaterial(r){r(this._material)}createGeometries(r){if(null!=this._material){const e=i(this._material);r.addGeometry(e)}}get _materialParameters(){return{backgroundColor:this._backgroundColor,gridWidth:this._gridWidth,gridColor:this._gridColor,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateMaterial(){this._material?.setParameters(this._materialParameters)}}export{s as SlicePlaneVisualElement};