UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.59 kB
import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{GLTextureMaterial as r}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as s}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as i}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as u}from"./DefaultLayouts.js";import{TriangleMaterial as o}from"./TriangleMaterial.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";class c extends o{constructor(e){super(e,new m),this.supportsEdges=!0,this._configuration=new h}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<s,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}requiresSlot(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===i.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===i.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?i.TRANSPARENT_MATERIAL:i.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:i.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new n(u)}}class p extends r{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class m extends a{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=t.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0}}export{c as ImageMaterial,m as Parameters};