import type { WebGLCanvas } from "./WebGLCanvas"; import { WebGLStateAbstract } from "./WebGLStateAbstract"; class WebGLState extends WebGLStateAbstract { private statePool: Array = []; private registerState(state: WebGLStateAbstract) { this.statePool.push(state); } public override contextWillBind(newcanvas: WebGLCanvas) { for (const state of this.statePool) { state.bindCanvas(newcanvas); } } public override contextLost() { for (const state of this.statePool) { state.contextLost(); } } public override resetState() { for (const state of this.statePool) { state.resetState(); } } public override destroy() { for (const state of this.statePool) { state.destroy(); } } } export { WebGLState };