Skip to content

Commit d546239

Browse files
committed
build
1 parent b271e96 commit d546239

18 files changed

+882
-99
lines changed

dist/5.x/twgl-full.d.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ export type UniformBlockSpec = {
591591
* @property {ArrayBuffer} array The array buffer that contains the uniform values
592592
* @property {Float32Array} asFloat A float view on the array buffer. This is useful
593593
* inspecting the contents of the buffer in the debugger.
594+
* @property {Uint8Array} asUint8t A uint8 view on the array buffer.
594595
* @property {WebGLBuffer} buffer A WebGL buffer that will hold a copy of the uniform values for rendering.
595596
* @property {number} [offset] offset into buffer
596597
* @property {Object<string, ArrayBufferView>} uniforms A uniform name to ArrayBufferView map.
@@ -612,6 +613,7 @@ export type UniformBlockInfo = {
612613
name: string;
613614
array: ArrayBuffer;
614615
asFloat: Float32Array;
616+
asUint8t: Uint8Array;
615617
buffer: WebGLBuffer;
616618
offset?: number;
617619
uniforms: {
@@ -624,6 +626,8 @@ export type UniformBlockInfo = {
624626
/**
625627
* @typedef {Object} ProgramInfo
626628
* @property {WebGLProgram} program A shader program
629+
* @property {Object<string, WebGLUniformLocation>} uniformLocations The uniform locations of each uniform
630+
* @property {Object<string, number>} attribLocations The locations of each attribute
627631
* @property {Object<string, function>} uniformSetters object of setters as returned from createUniformSetters,
628632
* @property {Object<string, function>} attribSetters object of setters as returned from createAttribSetters,
629633
* @property {UniformBlockSpec} [uniformBlockSpec] a uniform block spec for making UniformBlockInfos with createUniformBlockInfo etc..
@@ -632,6 +636,12 @@ export type UniformBlockInfo = {
632636
*/
633637
export type ProgramInfo = {
634638
program: WebGLProgram;
639+
uniformLocations: {
640+
[key: string]: WebGLUniformLocation;
641+
};
642+
attribLocations: {
643+
[key: string]: number;
644+
};
635645
uniformSetters: {
636646
[key: string]: (...params: any[]) => any;
637647
};
@@ -1211,10 +1221,11 @@ export function createProgramInfo(gl: WebGLRenderingContext, shaderSources: stri
12111221
* @param {ProgramInfo} programInfo a `ProgramInfo`
12121222
* as returned from {@link createProgramInfo}
12131223
* @param {string} blockName The name of the block.
1224+
* @param {UniformBlockInfoOptions} [options] Optional options for using existing an existing buffer and arrayBuffer
12141225
* @return {UniformBlockInfo} The created UniformBlockInfo
12151226
* @memberOf module:twgl/programs
12161227
*/
1217-
export function createUniformBlockInfo(gl: WebGL2RenderingContext, programInfo: ProgramInfo, blockName: string): UniformBlockInfo;
1228+
export function createUniformBlockInfo(gl: WebGL2RenderingContext, programInfo: ProgramInfo, blockName: string, options?: UniformBlockInfoOptions): UniformBlockInfo;
12181229
/**
12191230
* Binds a uniform block to the matching uniform block point.
12201231
* Matches by blocks by name so blocks must have the same name not just the same
@@ -2222,6 +2233,20 @@ export function createUniformSetters(gl: WebGLRenderingContext, program: WebGLPr
22222233
* @memberOf module:twgl/programs
22232234
*/
22242235
export function createUniformBlockSpecFromProgram(gl: WebGL2RenderingContext, program: WebGLProgram): UniformBlockSpec;
2236+
/**
2237+
* Options to allow createUniformBlockInfo to use an existing buffer and arrayBuffer at an offset
2238+
* @typedef {Object} UniformBlockInfoOptions
2239+
* @property {ArrayBuffer} [array] an existing array buffer to use for values
2240+
* @property {number} [offset] the offset in bytes to use in the array buffer (default = 0)
2241+
* @property {WebGLBuffer} [buffer] the buffer to use for this uniform block info
2242+
* @property {number} [bufferOffset] the offset in bytes in the buffer to use (default = use offset above)
2243+
*/
2244+
export type UniformBlockInfoOptions = {
2245+
array?: ArrayBuffer;
2246+
offset?: number;
2247+
buffer?: WebGLBuffer;
2248+
bufferOffset?: number;
2249+
};
22252250
/**
22262251
* Creates a `UniformBlockInfo` for the specified block
22272252
*
@@ -2236,10 +2261,11 @@ export function createUniformBlockSpecFromProgram(gl: WebGL2RenderingContext, pr
22362261
* @param {UniformBlockSpec} uniformBlockSpec. A UniformBlockSpec as returned
22372262
* from {@link createUniformBlockSpecFromProgram}.
22382263
* @param {string} blockName The name of the block.
2264+
* @param {UniformBlockInfoOptions} [options] Optional options for using existing an existing buffer and arrayBuffer
22392265
* @return {UniformBlockInfo} The created UniformBlockInfo
22402266
* @memberOf module:twgl/programs
22412267
*/
2242-
export function createUniformBlockInfoFromProgram(gl: WebGL2RenderingContext, program: WebGLProgram, blockName: string): UniformBlockInfo;
2268+
export function createUniformBlockInfoFromProgram(gl: WebGL2RenderingContext, program: WebGLProgram, blockName: string, options?: UniformBlockInfoOptions): UniformBlockInfo;
22432269
/**
22442270
* Creates a `UniformBlockInfo` for the specified block
22452271
*
@@ -2253,10 +2279,11 @@ export function createUniformBlockInfoFromProgram(gl: WebGL2RenderingContext, pr
22532279
* @param {ProgramInfo} programInfo a `ProgramInfo`
22542280
* as returned from {@link createProgramInfo}
22552281
* @param {string} blockName The name of the block.
2282+
* @param {UniformBlockInfoOptions} [options] Optional options for using existing an existing buffer and arrayBuffer
22562283
* @return {UniformBlockInfo} The created UniformBlockInfo
22572284
* @memberOf module:twgl/programs
22582285
*/
2259-
export function createUniformBlockInfo(gl: WebGL2RenderingContext, programInfo: ProgramInfo, blockName: string): UniformBlockInfo;
2286+
export function createUniformBlockInfo(gl: WebGL2RenderingContext, programInfo: ProgramInfo, blockName: string, options?: UniformBlockInfoOptions): UniformBlockInfo;
22602287
/**
22612288
* Binds a uniform block to the matching uniform block point.
22622289
* Matches by blocks by name so blocks must have the same name not just the same

dist/5.x/twgl-full.js

Lines changed: 55 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/5.x/twgl-full.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/5.x/twgl-full.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)