MCPcopy Create free account
hub / github.com/gre/gl-react / FakeTextureLoader

Class FakeTextureLoader

packages/tests/utils.js:387–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385 return texture;
386}
387class FakeTextureLoader extends WebGLTextureLoader<FakeTexture> {
388 textures: Array<WebGLTexture>;
389 constructor(gl: WebGLRenderingContext) {
390 super(gl);
391 this.textures = [];
392 }
393 dispose() {
394 const { gl } = this;
395 this.textures.forEach(t => gl.deleteTexture(t));
396 }
397 canLoad(input: any) {
398 return input instanceof FakeTexture;
399 }
400 get(ft: FakeTexture) {
401 const array = ft.getPixels();
402 if (array) {
403 const t = createNDArrayTexture(this.gl, array);
404 this.textures.push(t);
405 return {
406 texture: t,
407 width: ft.width,
408 height: ft.height
409 };
410 }
411 }
412 load(ft: FakeTexture) {
413 const res = this.get(ft);
414 return res ? Promise.resolve(res) : Promise.reject();
415 }
416}
417
418globalRegistry.add(FakeTextureLoader);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…