/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{property as t,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{SyncRenderPlugin as s}from"../../effects/RenderPlugin.js";import{MergedBuffer as i}from"./MergedBuffer.js";import{VaoRenderer as a}from"./VaoRenderer.js";let n=class extends s{constructor(e){super(e),this._dataByBaseInstance=new Map,this._buffer=null,this._renderer=null,this.drapedPriority=0}initialize(){this._buffer=new i({material:this.material,dataByBaseInstance:this._dataByBaseInstance,highlightOrderMap:this.highlightOrderMap}),this._renderer=new a({material:this.material,dataByBaseInstance:this._dataByBaseInstance})}destroy(){for(const e of this._dataByBaseInstance.values())e.dispose();this._dataByBaseInstance.clear(),this._buffer.destroy(),this._renderer.destroy()}hasHighlight(e){return this._renderer.hasHighlight(e)}initializeRenderContext(e){this._buffer.initializeRenderContext(e),this._renderer.initializeRenderContext(e)}uninitializeRenderContext(){this._buffer.uninitializeRenderContext(),this._renderer.uninitializeRenderContext()}get produces(){return this._renderer.produces}get hasOccludees(){return this._buffer.hasOccludees}get hasOnlyOccluders(){return!!(-2&this.renderOccludedFlags)}get hasEmitters(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}get renderOccludedFlags(){return this.material.renderOccludedFlags}get numGeometries(){let e=0;for(const t of this._dataByBaseInstance.values())for(const r of t.dataByOrigin.values())e+=r.buffers.reduce((e,t)=>e+t.instances.size,0);return e}get usedMemory(){let e=0;for(const t of this._dataByBaseInstance.values())for(const r of t.dataByOrigin.values())e+=r.buffers.reduce((e,t)=>e+t.vao.usedMemory,0);return e}forEachGeometry(e){for(const t of this._dataByBaseInstance.values())for(const r of t.dataByOrigin.values())for(const t of r.buffers)for(const{geometry:r}of t.instances.values())e(r)}modify(e,t){this._buffer.modify(e,t),this._renderer.updateHighlights()}get canCompact(){return this._buffer.canCompact}compact(e){return this._buffer.compact(e)}updateHighlights(e){this.highlightOrderMap=e,this._buffer.updateHighlights(e),this._renderer.updateHighlights()}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){return this._renderer.acquireTechniques(e)}render(e,t){return this._renderer.render(e,t)}static prune(){i.prune()}get test(){}};e([t({constructOnly:!0})],n.prototype,"material",void 0),e([t()],n.prototype,"highlightOrderMap",void 0),n=e([r("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],n);export{n as MergedRenderer};
