twgl.js 4.21.2 → 4.23.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.
package/README.md CHANGED
@@ -427,7 +427,7 @@ If you just want to set the 2nd light in TWGL you can do this
427
427
  const progInfo = twgl.createProgramInfo(gl, [vs, fs]);
428
428
  ...
429
429
  twgl.setUniforms(progInfo, {
430
- lights[1]: { intensity: 5.0, shininess: 100, color: [1, 0, 0, 1] },
430
+ 'lights[1]': { intensity: 5.0, shininess: 100, color: [1, 0, 0, 1] },
431
431
  });
432
432
  ```
433
433
 
@@ -68,6 +68,7 @@ export type AttachmentOptions = TextureOptions & {
68
68
  format?: number;
69
69
  type?: number;
70
70
  target?: number;
71
+ samples?: number;
71
72
  level?: number;
72
73
  layer?: number;
73
74
  attachment?: WebGLRenderbuffer | WebGLTexture;
@@ -88,6 +89,7 @@ export type ProgramOptions = {
88
89
  [key: string]: AttribInfo;
89
90
  } | string[];
90
91
  transformFeedbackMode?: number;
92
+ callback?: ProgramCallback;
91
93
  };
92
94
  export type TransformFeedbackInfo = {
93
95
  index: number;
@@ -255,7 +257,14 @@ export function bindFramebufferInfo(gl: WebGLRenderingContext, framebufferInfo?:
255
257
 
256
258
 
257
259
  export function getBindPointForSamplerType(): void;
260
+ export type ProgramCallback = (err?: string, result?: WebGLProgram | ProgramInfo) => void;
261
+ export function prepShaderSource(shaderSource: string): any;
262
+ export function checkShaderStatus(gl: WebGLRenderingContext, shader: WebGLShader, errFn?: ErrorCallback): boolean;
258
263
  export function createProgram(gl: WebGLRenderingContext, shaders: WebGLShader[] | string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): WebGLProgram;
264
+ export function createProgramAsync(gl: WebGLRenderingContext, shaders: WebGLShader[] | string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): Promise<WebGLProgram>;
265
+ export function createProgramInfoAsync(gl: WebGLRenderingContext, shaderSources: string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): Promise<ProgramInfo>;
266
+ export function checkForProgramLinkCompletionAsync(gl: WebGLRenderingContext, program: WebGLProgram, progOptions: ProgramOptions): void;
267
+ export function checkProgramStatus(gl: WebGLRenderingContext, program: WebGLProgram, errFn?: ErrorCallback): boolean;
259
268
  export function createProgramFromScripts(gl: WebGLRenderingContext, shaderScriptIds: string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): WebGLProgram;
260
269
  export function createProgramFromSources(gl: WebGLRenderingContext, shaderSources: string[], opt_attribs?: ProgramOptions | string[] | ErrorCallback, opt_errorCallback?: ErrorCallback): WebGLProgram;
261
270
  export function createUniformSetters(gl: WebGLRenderingContext, program: WebGLProgram): {
@@ -333,10 +342,10 @@ export function createVAOAndSetAttributes(gl: WebGLRenderingContext, setters: {
333
342
  [key: string]: (...params: any[]) => any;
334
343
  }, attribs: {
335
344
  [key: string]: AttribInfo;
336
- }, indices?: WebGLBuffer): void;
345
+ }, indices?: WebGLBuffer): WebGLVertexArrayObject | null;
337
346
  export function createVAOFromBufferInfo(gl: WebGLRenderingContext, programInfo: {
338
347
  [key: string]: (...params: any[]) => any;
339
- } | ProgramInfo, bufferInfo: BufferInfo, indices?: WebGLBuffer): void;
348
+ } | ProgramInfo, bufferInfo: BufferInfo, indices?: WebGLBuffer): WebGLVertexArrayObject | null;
340
349
 
341
350
  declare module v3 {
342
351
  export type Vec3 = number[] | Float32Array;
@@ -366,6 +375,7 @@ declare module m4 {
366
375
  export type Mat4 = number[] | Float32Array;
367
376
  export function setDefaultType(ctor: Function): Function;
368
377
  export function negate(m: m4.Mat4, dst?: m4.Mat4): m4.Mat4;
378
+ export function create(): m4.Mat4;
369
379
  export function copy(m: m4.Mat4, dst?: m4.Mat4): m4.Mat4;
370
380
  export function identity(dst?: m4.Mat4): m4.Mat4;
371
381
  export function transpose(m: m4.Mat4, dst?: m4.Mat4): m4.Mat4;