twgl.js 5.0.4 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,9 +24,9 @@ export type AttribInfo = {
24
24
  };
25
25
  export type FullArraySpec = {
26
26
  value?: number[] | ArrayBufferView;
27
- data: number | number[] | ArrayBufferView;
27
+ data?: number | number[] | ArrayBufferView;
28
28
  numComponents?: number;
29
- type?: Function;
29
+ type?: number | TypedArrayConstructor;
30
30
  size?: number;
31
31
  normalize?: boolean;
32
32
  stride?: number;
@@ -79,11 +79,24 @@ export type FramebufferInfo = {
79
79
  height: number;
80
80
  };
81
81
  export type ErrorCallback = (msg: string, lineOffset?: number) => void;
82
+ export type FullProgramSpec = {
83
+ shaders: string[];
84
+ errorCallback?: (...params: any[]) => any;
85
+ attribLocations?: {
86
+ [key: string]: number;
87
+ } | string[];
88
+ transformFeedbackVaryings?: BufferInfo | {
89
+ [key: string]: AttribInfo;
90
+ } | string[];
91
+ transformFeedbackMode?: number;
92
+ callback?: ProgramCallback;
93
+ };
94
+ export type ProgramSpec = string[] | FullProgramSpec;
82
95
  export type ProgramOptions = {
83
96
  errorCallback?: (...params: any[]) => any;
84
97
  attribLocations?: {
85
98
  [key: string]: number;
86
- };
99
+ } | string[];
87
100
  transformFeedbackVaryings?: BufferInfo | {
88
101
  [key: string]: AttribInfo;
89
102
  } | string[];
@@ -235,6 +248,7 @@ export function createTextures(gl: WebGLRenderingContext, options: {
235
248
 
236
249
  export function setAttributePrefix(prefix: string): void;
237
250
  export function createBufferFromTypedArray(gl: WebGLRenderingContext, typedArray: ArrayBuffer | SharedArrayBuffer | ArrayBufferView | WebGLBuffer, type?: number, drawType?: number): WebGLBuffer;
251
+ export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
238
252
  export function createAttribsFromArrays(gl: WebGLRenderingContext, arrays: Arrays, srcBufferInfo?: BufferInfo): {
239
253
  [key: string]: AttribInfo;
240
254
  };
@@ -290,6 +304,26 @@ export function setBuffersAndAttributes(gl: WebGLRenderingContext, setters: Prog
290
304
  }, buffers: BufferInfo | VertexArrayInfo): void;
291
305
  export function createProgramInfoFromProgram(gl: WebGLRenderingContext, program: WebGLProgram): ProgramInfo;
292
306
  export function createProgramInfo(gl: WebGLRenderingContext, shaderSources: string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): ProgramInfo;
307
+ export function createPrograms(gl: WebGLRenderingContext, programSpecs: {
308
+ [key: string]: ProgramSpec;
309
+ }, programOptions?: ProgramOptions): {
310
+ [key: string]: WebGLProgram;
311
+ };
312
+ export function createProgramInfos(gl: WebGLRenderingContext, programSpecs: {
313
+ [key: string]: ProgramSpec;
314
+ }, programOptions?: ProgramOptions): {
315
+ [key: string]: ProgramInfo;
316
+ };
317
+ export function createProgramsAsync(gl: WebGLRenderingContext, programSpecs: {
318
+ [key: string]: ProgramSpec;
319
+ }, programOptions?: ProgramOptions): {
320
+ [key: string]: WebGLProgram;
321
+ };
322
+ export function createProgramInfosAsync(gl: WebGLRenderingContext, programSpecs: {
323
+ [key: string]: ProgramSpec;
324
+ }, programOptions?: ProgramOptions): Promise<{
325
+ [key: string]: ProgramInfo;
326
+ }>;
293
327
 
294
328
 
295
329
  export function getBytesPerElementForInternalFormat(internalFormat: number, type: number): number;