Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/gl/framebuffer.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/gl/framebuffer.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/gl/framebuffer.js
-
curl -L -o framebuffer.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/gl/framebuffer.js
1.28 kB
| // @flow | |
| import {ColorAttachment, DepthAttachment} from './value'; | |
| import assert from 'assert'; | |
| import type Context from './context'; | |
| class Framebuffer { | |
| context: Context; | |
| width: number; | |
| height: number; | |
| framebuffer: WebGLFramebuffer; | |
| colorAttachment: ColorAttachment; | |
| depthAttachment: DepthAttachment; | |
| constructor(context: Context, width: number, height: number, hasDepth: boolean) { | |
| this.context = context; | |
| this.width = width; | |
| this.height = height; | |
| const gl = context.gl; | |
| const fbo = this.framebuffer = gl.createFramebuffer(); | |
| this.colorAttachment = new ColorAttachment(context, fbo); | |
| if (hasDepth) { | |
| this.depthAttachment = new DepthAttachment(context, fbo); | |
| } | |
| assert(gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE); | |
| } | |
| destroy() { | |
| const gl = this.context.gl; | |
| const texture = this.colorAttachment.get(); | |
| if (texture) gl.deleteTexture(texture); | |
| if (this.depthAttachment) { | |
| const renderbuffer = this.depthAttachment.get(); | |
| if (renderbuffer) gl.deleteRenderbuffer(renderbuffer); | |
| } | |
| gl.deleteFramebuffer(this.framebuffer); | |
| } | |
| } | |
| export default Framebuffer; | |