twgl.js 5.2.0 → 5.3.1

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.
@@ -36,6 +36,7 @@ export type FullArraySpec = {
36
36
  name?: string;
37
37
  attribName?: string;
38
38
  buffer?: WebGLBuffer;
39
+ drawType?: number;
39
40
  };
40
41
  export type ArraySpec = number | number[] | ArrayBufferView | FullArraySpec;
41
42
  export type Arrays = {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @license twgl.js 5.2.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
+ * @license twgl.js 5.3.1 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
3
3
  * Available via the MIT license.
4
4
  * see: http://github.com/greggman/twgl.js for details
5
5
  */
@@ -391,6 +391,7 @@ function attribBufferFromArrayLike(gl, array, arrayName) {
391
391
  * position: bufferInfo1.attribs.position, // use the same buffer from bufferInfo1
392
392
  * });
393
393
  *
394
+ * @property {number} [drawType] the draw type passed to gl.bufferData. Default = gl.STATIC_DRAW
394
395
  * @memberOf module:twgl
395
396
  */
396
397
 
@@ -4816,7 +4817,7 @@ function samplerSetter(gl, type, unit, location) {
4816
4817
  return utils.isWebGL2(gl) ? function (textureOrPair) {
4817
4818
  var texture;
4818
4819
  var sampler;
4819
- if (helper.isTexture(gl, textureOrPair)) {
4820
+ if (!textureOrPair || helper.isTexture(gl, textureOrPair)) {
4820
4821
  texture = textureOrPair;
4821
4822
  sampler = null;
4822
4823
  } else {
@@ -4845,7 +4846,7 @@ function samplerArraySetter(gl, type, unit, location, size) {
4845
4846
  gl.activeTexture(TEXTURE0 + units[index]);
4846
4847
  var texture;
4847
4848
  var sampler;
4848
- if (helper.isTexture(gl, textureOrPair)) {
4849
+ if (!textureOrPair || helper.isTexture(gl, textureOrPair)) {
4849
4850
  texture = textureOrPair;
4850
4851
  sampler = null;
4851
4852
  } else {
@@ -6487,7 +6488,7 @@ function setUniformTree(tree, values) {
6487
6488
  * ],
6488
6489
  * };
6489
6490
  *
6490
- * gl.useProgram(program);
6491
+ * gl.useProgram(programInfo.program);
6491
6492
  *
6492
6493
  * This will automatically bind the textures AND set the
6493
6494
  * uniforms.
@@ -6496,7 +6497,7 @@ function setUniformTree(tree, values) {
6496
6497
  *
6497
6498
  * For the example above it is equivalent to
6498
6499
  *
6499
- * var texUnit = 0;
6500
+ * let texUnit = 0;
6500
6501
  * gl.activeTexture(gl.TEXTURE0 + texUnit);
6501
6502
  * gl.bindTexture(gl.TEXTURE_2D, tex1);
6502
6503
  * gl.uniform1i(u_someSamplerLocation, texUnit++);
@@ -1,4 +1,4 @@
1
- /* @license twgl.js 5.2.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
1
+ /* @license twgl.js 5.3.1 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
2
  Available via the MIT license.
3
3
  see: http://github.com/greggman/twgl.js for details */
4
4
  /*
@@ -2248,6 +2248,7 @@ function attribBufferFromArrayLike(gl, array, arrayName) {
2248
2248
  * position: bufferInfo1.attribs.position, // use the same buffer from bufferInfo1
2249
2249
  * });
2250
2250
  *
2251
+ * @property {number} [drawType] the draw type passed to gl.bufferData. Default = gl.STATIC_DRAW
2251
2252
  * @memberOf module:twgl
2252
2253
  */
2253
2254
 
@@ -7071,7 +7072,7 @@ function samplerSetter(gl, type, unit, location) {
7071
7072
  return isWebGL2(gl) ? function(textureOrPair) {
7072
7073
  let texture;
7073
7074
  let sampler;
7074
- if (isTexture(gl, textureOrPair)) {
7075
+ if (!textureOrPair || isTexture(gl, textureOrPair)) {
7075
7076
  texture = textureOrPair;
7076
7077
  sampler = null;
7077
7078
  } else {
@@ -7102,7 +7103,7 @@ function samplerArraySetter(gl, type, unit, location, size) {
7102
7103
  gl.activeTexture(TEXTURE0 + units[index]);
7103
7104
  let texture;
7104
7105
  let sampler;
7105
- if (isTexture(gl, textureOrPair)) {
7106
+ if (!textureOrPair || isTexture(gl, textureOrPair)) {
7106
7107
  texture = textureOrPair;
7107
7108
  sampler = null;
7108
7109
  } else {
@@ -8409,7 +8410,7 @@ function setUniformTree(tree, values) {
8409
8410
  * ],
8410
8411
  * };
8411
8412
  *
8412
- * gl.useProgram(program);
8413
+ * gl.useProgram(programInfo.program);
8413
8414
  *
8414
8415
  * This will automatically bind the textures AND set the
8415
8416
  * uniforms.
@@ -8418,7 +8419,7 @@ function setUniformTree(tree, values) {
8418
8419
  *
8419
8420
  * For the example above it is equivalent to
8420
8421
  *
8421
- * var texUnit = 0;
8422
+ * let texUnit = 0;
8422
8423
  * gl.activeTexture(gl.TEXTURE0 + texUnit);
8423
8424
  * gl.bindTexture(gl.TEXTURE_2D, tex1);
8424
8425
  * gl.uniform1i(u_someSamplerLocation, texUnit++);
@@ -36,6 +36,7 @@ export type FullArraySpec = {
36
36
  name?: string;
37
37
  attribName?: string;
38
38
  buffer?: WebGLBuffer;
39
+ drawType?: number;
39
40
  };
40
41
  export type ArraySpec = number | number[] | ArrayBufferView | FullArraySpec;
41
42
  export type Arrays = {
package/dist/5.x/twgl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @license twgl.js 5.2.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
+ * @license twgl.js 5.3.1 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
3
3
  * Available via the MIT license.
4
4
  * see: http://github.com/greggman/twgl.js for details
5
5
  */
@@ -391,6 +391,7 @@ function attribBufferFromArrayLike(gl, array, arrayName) {
391
391
  * position: bufferInfo1.attribs.position, // use the same buffer from bufferInfo1
392
392
  * });
393
393
  *
394
+ * @property {number} [drawType] the draw type passed to gl.bufferData. Default = gl.STATIC_DRAW
394
395
  * @memberOf module:twgl
395
396
  */
396
397
 
@@ -1814,7 +1815,7 @@ function samplerSetter(gl, type, unit, location) {
1814
1815
  return utils.isWebGL2(gl) ? function (textureOrPair) {
1815
1816
  var texture;
1816
1817
  var sampler;
1817
- if (helper.isTexture(gl, textureOrPair)) {
1818
+ if (!textureOrPair || helper.isTexture(gl, textureOrPair)) {
1818
1819
  texture = textureOrPair;
1819
1820
  sampler = null;
1820
1821
  } else {
@@ -1843,7 +1844,7 @@ function samplerArraySetter(gl, type, unit, location, size) {
1843
1844
  gl.activeTexture(TEXTURE0 + units[index]);
1844
1845
  var texture;
1845
1846
  var sampler;
1846
- if (helper.isTexture(gl, textureOrPair)) {
1847
+ if (!textureOrPair || helper.isTexture(gl, textureOrPair)) {
1847
1848
  texture = textureOrPair;
1848
1849
  sampler = null;
1849
1850
  } else {
@@ -3485,7 +3486,7 @@ function setUniformTree(tree, values) {
3485
3486
  * ],
3486
3487
  * };
3487
3488
  *
3488
- * gl.useProgram(program);
3489
+ * gl.useProgram(programInfo.program);
3489
3490
  *
3490
3491
  * This will automatically bind the textures AND set the
3491
3492
  * uniforms.
@@ -3494,7 +3495,7 @@ function setUniformTree(tree, values) {
3494
3495
  *
3495
3496
  * For the example above it is equivalent to
3496
3497
  *
3497
- * var texUnit = 0;
3498
+ * let texUnit = 0;
3498
3499
  * gl.activeTexture(gl.TEXTURE0 + texUnit);
3499
3500
  * gl.bindTexture(gl.TEXTURE_2D, tex1);
3500
3501
  * gl.uniform1i(u_someSamplerLocation, texUnit++);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twgl.js",
3
- "version": "5.2.0",
3
+ "version": "5.3.1",
4
4
  "description": "A Tiny WebGL helper library",
5
5
  "main": "dist/5.x/twgl-full.js",
6
6
  "types": "dist/5.x/twgl-full.d.ts",