mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add type declaration for gl-fbo (#42394)
This commit is contained in:
parent
308f467a17
commit
71171f48b5
32
types/gl-fbo/gl-fbo-tests.ts
Normal file
32
types/gl-fbo/gl-fbo-tests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import texture2D = require('gl-texture2d');
|
||||
import glFBO from 'gl-fbo';
|
||||
|
||||
type Texture = ReturnType<typeof texture2D>;
|
||||
|
||||
const gl = new WebGLRenderingContext();
|
||||
|
||||
glFBO(gl, [12, 34]);
|
||||
glFBO(gl, [12, 34], {preferFloat: true});
|
||||
glFBO(gl, [12, 34], {float: false});
|
||||
glFBO(gl, [12, 34], {color: 2});
|
||||
glFBO(gl, [12, 34], {depth: false});
|
||||
glFBO(gl, [12, 34], {stencil: false});
|
||||
|
||||
const fbo = glFBO(gl, [12, 34]);
|
||||
fbo.bind();
|
||||
fbo.dispose();
|
||||
|
||||
// $ExpectType [number, number]
|
||||
fbo.shape;
|
||||
|
||||
// $ExpectType WebGLRenderingContext
|
||||
fbo.gl;
|
||||
|
||||
// $ExpectType WebGLFramebuffer
|
||||
fbo.handle;
|
||||
|
||||
// $ExpectType Texture[]
|
||||
fbo.color;
|
||||
|
||||
// $ExpectType Texture | null
|
||||
fbo.depth;
|
||||
35
types/gl-fbo/index.d.ts
vendored
Normal file
35
types/gl-fbo/index.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Type definitions for gl-fbo 2.0
|
||||
// Project: https://github.com/stackgl/gl-fbo
|
||||
// Definitions by: Nick Krichevsky <https://github.com/ollien>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import texture2D = require('gl-texture2d');
|
||||
|
||||
type Texture = ReturnType<typeof texture2D>;
|
||||
|
||||
declare class FrameBuffer {
|
||||
shape: [number, number];
|
||||
gl: WebGLRenderingContext;
|
||||
handle: WebGLFramebuffer;
|
||||
color: Texture[];
|
||||
depth: Texture|null;
|
||||
|
||||
bind(): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
interface FrameBufferOptions {
|
||||
preferFloat?: boolean;
|
||||
float?: boolean;
|
||||
color?: number;
|
||||
depth?: boolean;
|
||||
stencil?: boolean;
|
||||
}
|
||||
|
||||
declare function glFBO(
|
||||
gl: WebGLRenderingContext,
|
||||
shape: [number, number],
|
||||
options?: FrameBufferOptions
|
||||
): FrameBuffer;
|
||||
|
||||
export = glFBO;
|
||||
25
types/gl-fbo/tsconfig.json
Normal file
25
types/gl-fbo/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gl-fbo-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/gl-fbo/tslint.json
Normal file
1
types/gl-fbo/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user