twgl.js 7.0.0 → 7.0.3

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
@@ -446,6 +446,7 @@ twgl.setUniforms(progInfo, {
446
446
  * [zoom-around](http://twgljs.org/examples/zoom-around.html)
447
447
  * [text](http://twgljs.org/examples/text.html)
448
448
  * [kaleidoscope](http://twgljs.org/examples/kaleidoscope.html)
449
+ * [stencil](http://twgljs.org/examples/stencil.html)
449
450
  * [tunnel](http://twgljs.org/examples/tunnel.html)
450
451
  * [GPGPU particles](http://twgljs.org/examples/gpgpu-particles.html)
451
452
  * [item list](http://twgljs.org/examples/itemlist.html)
@@ -3290,7 +3290,7 @@ export function createVAOFromBufferInfo(gl: WebGLRenderingContext, programInfo:
3290
3290
  [key: string]: (...params: any[]) => any;
3291
3291
  } | ProgramInfo, bufferInfo: BufferInfo, indices?: WebGLBuffer): WebGLVertexArrayObject | null;
3292
3292
 
3293
- declare module v3 {
3293
+ declare namespace v3 {
3294
3294
  /**
3295
3295
  * A JavaScript array with 3 values or a Float32Array with 3 values.
3296
3296
  * When created by the library will create the default type which is `Float32Array`
@@ -3493,7 +3493,7 @@ declare module v3 {
3493
3493
  */
3494
3494
  export function divide(a: v3.Vec3, b: v3.Vec3, dst?: v3.Vec3): v3.Vec3;
3495
3495
  }
3496
- declare module m4 {
3496
+ declare namespace m4 {
3497
3497
  /**
3498
3498
  * A JavaScript array with 16 values or a Float32Array with 16 values.
3499
3499
  * When created by the library will create the default type which is `Float32Array`
@@ -3611,8 +3611,7 @@ declare module m4 {
3611
3611
  * the distances to the near and far clipping planes. Note that near and far
3612
3612
  * are not z coordinates, but rather they are distances along the negative
3613
3613
  * z-axis. The matrix generated sends the viewing frustum to the unit box.
3614
- * We assume a unit box extending from -1 to 1 in the x and y dimensions and
3615
- * from 0 to 1 in the z dimension.
3614
+ * We assume a unit box extending from -1 to 1 in the x, y and z dimensions.
3616
3615
  * @param {number} fieldOfViewYInRadians The camera angle from top to bottom (in radians).
3617
3616
  * @param {number} aspect The aspect ratio width / height.
3618
3617
  * @param {number} zNear The depth (negative z coordinate)
@@ -3648,8 +3647,7 @@ declare module m4 {
3648
3647
  * distances to the near and far clipping planes. Note that near and far are not
3649
3648
  * z coordinates, but rather they are distances along the negative z-axis. The
3650
3649
  * matrix generated sends the viewing frustum to the unit box. We assume a unit
3651
- * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z
3652
- * dimension.
3650
+ * box extending from -1 to 1 in the x, y and z dimensions.
3653
3651
  * @param {number} left The x coordinate of the left plane of the box.
3654
3652
  * @param {number} right The x coordinate of the right plane of the box.
3655
3653
  * @param {number} bottom The y coordinate of the bottom plane of the box.
@@ -3838,7 +3836,7 @@ declare module m4 {
3838
3836
  */
3839
3837
  export function transformNormal(m: m4.Mat4, v: v3.Vec3, dst?: v3.Vec3): v3.Vec3;
3840
3838
  }
3841
- declare module primitives {
3839
+ declare namespace primitives {
3842
3840
  /**
3843
3841
  * @typedef {(Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array)} TypedArray
3844
3842
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @license twgl.js 7.0.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
+ * @license twgl.js 7.0.3 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
  */
@@ -1093,6 +1093,8 @@ renderbufferFormats[RGB5_A1] = true;
1093
1093
  renderbufferFormats[RGB565] = true;
1094
1094
  renderbufferFormats[DEPTH_STENCIL] = true;
1095
1095
  renderbufferFormats[DEPTH_COMPONENT16] = true;
1096
+ renderbufferFormats[DEPTH_COMPONENT24] = true;
1097
+ renderbufferFormats[DEPTH_COMPONENT32F] = true;
1096
1098
  renderbufferFormats[STENCIL_INDEX] = true;
1097
1099
  renderbufferFormats[STENCIL_INDEX8] = true;
1098
1100
  function isRenderbufferFormat(format) {
@@ -1938,8 +1940,7 @@ function setAxis(a, v, axis, dst) {
1938
1940
  * the distances to the near and far clipping planes. Note that near and far
1939
1941
  * are not z coordinates, but rather they are distances along the negative
1940
1942
  * z-axis. The matrix generated sends the viewing frustum to the unit box.
1941
- * We assume a unit box extending from -1 to 1 in the x and y dimensions and
1942
- * from 0 to 1 in the z dimension.
1943
+ * We assume a unit box extending from -1 to 1 in the x, y and z dimensions.
1943
1944
  * @param {number} fieldOfViewYInRadians The camera angle from top to bottom (in radians).
1944
1945
  * @param {number} aspect The aspect ratio width / height.
1945
1946
  * @param {number} zNear The depth (negative z coordinate)
@@ -2017,8 +2018,7 @@ function ortho(left, right, bottom, top, near, far, dst) {
2017
2018
  * distances to the near and far clipping planes. Note that near and far are not
2018
2019
  * z coordinates, but rather they are distances along the negative z-axis. The
2019
2020
  * matrix generated sends the viewing frustum to the unit box. We assume a unit
2020
- * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z
2021
- * dimension.
2021
+ * box extending from -1 to 1 in the x, y and z dimensions.
2022
2022
  * @param {number} left The x coordinate of the left plane of the box.
2023
2023
  * @param {number} right The x coordinate of the right plane of the box.
2024
2024
  * @param {number} bottom The y coordinate of the bottom plane of the box.
@@ -2044,11 +2044,11 @@ function frustum(left, right, bottom, top, near, far, dst) {
2044
2044
  dst[7] = 0;
2045
2045
  dst[8] = (left + right) / dx;
2046
2046
  dst[9] = (top + bottom) / dy;
2047
- dst[10] = far / dz;
2047
+ dst[10] = (near + far) / dz;
2048
2048
  dst[11] = -1;
2049
2049
  dst[12] = 0;
2050
2050
  dst[13] = 0;
2051
- dst[14] = near * far / dz;
2051
+ dst[14] = 2 * near * far / dz;
2052
2052
  dst[15] = 0;
2053
2053
  return dst;
2054
2054
  }
@@ -3620,29 +3620,29 @@ function create3DFVertices() {
3620
3620
  // left column front
3621
3621
  // top rung front
3622
3622
  // middle rung front
3623
- 18, 0, 0, 1,
3623
+ 18, 0, 0, -1,
3624
3624
  // left column back
3625
3625
  // top rung back
3626
3626
  // middle rung back
3627
- 18, 0, 0, -1,
3627
+ 18, 0, 0, 1,
3628
3628
  // top
3629
- 6, 0, 1, 0,
3629
+ 6, 0, -1, 0,
3630
3630
  // top rung front
3631
3631
  6, 1, 0, 0,
3632
3632
  // under top rung
3633
- 6, 0, -1, 0,
3633
+ 6, 0, 1, 0,
3634
3634
  // between top rung and middle
3635
3635
  6, 1, 0, 0,
3636
3636
  // top of middle rung
3637
- 6, 0, 1, 0,
3637
+ 6, 0, -1, 0,
3638
3638
  // front of middle rung
3639
3639
  6, 1, 0, 0,
3640
3640
  // bottom of middle rung.
3641
- 6, 0, -1, 0,
3641
+ 6, 0, 1, 0,
3642
3642
  // front of bottom
3643
3643
  6, 1, 0, 0,
3644
3644
  // bottom
3645
- 6, 0, -1, 0,
3645
+ 6, 0, 1, 0,
3646
3646
  // left side
3647
3647
  6, -1, 0, 0]);
3648
3648
  var colors = expandRLEData([
@@ -1,4 +1,4 @@
1
- /* @license twgl.js 7.0.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
1
+ /* @license twgl.js 7.0.3 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
  /*
@@ -944,8 +944,7 @@ function setAxis(a, v, axis, dst) {
944
944
  * the distances to the near and far clipping planes. Note that near and far
945
945
  * are not z coordinates, but rather they are distances along the negative
946
946
  * z-axis. The matrix generated sends the viewing frustum to the unit box.
947
- * We assume a unit box extending from -1 to 1 in the x and y dimensions and
948
- * from 0 to 1 in the z dimension.
947
+ * We assume a unit box extending from -1 to 1 in the x, y and z dimensions.
949
948
  * @param {number} fieldOfViewYInRadians The camera angle from top to bottom (in radians).
950
949
  * @param {number} aspect The aspect ratio width / height.
951
950
  * @param {number} zNear The depth (negative z coordinate)
@@ -1034,8 +1033,7 @@ function ortho(left, right, bottom, top, near, far, dst) {
1034
1033
  * distances to the near and far clipping planes. Note that near and far are not
1035
1034
  * z coordinates, but rather they are distances along the negative z-axis. The
1036
1035
  * matrix generated sends the viewing frustum to the unit box. We assume a unit
1037
- * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z
1038
- * dimension.
1036
+ * box extending from -1 to 1 in the x, y and z dimensions.
1039
1037
  * @param {number} left The x coordinate of the left plane of the box.
1040
1038
  * @param {number} right The x coordinate of the right plane of the box.
1041
1039
  * @param {number} bottom The y coordinate of the bottom plane of the box.
@@ -1063,11 +1061,11 @@ function frustum(left, right, bottom, top, near, far, dst) {
1063
1061
  dst[ 7] = 0;
1064
1062
  dst[ 8] = (left + right) / dx;
1065
1063
  dst[ 9] = (top + bottom) / dy;
1066
- dst[10] = far / dz;
1064
+ dst[10] = (near + far) / dz;
1067
1065
  dst[11] = -1;
1068
1066
  dst[12] = 0;
1069
1067
  dst[13] = 0;
1070
- dst[14] = near * far / dz;
1068
+ dst[14] = 2 * near * far / dz;
1071
1069
  dst[15] = 0;
1072
1070
 
1073
1071
  return dst;
@@ -3925,39 +3923,39 @@ function create3DFVertices() {
3925
3923
  // left column front
3926
3924
  // top rung front
3927
3925
  // middle rung front
3928
- 18, 0, 0, 1,
3926
+ 18, 0, 0, -1,
3929
3927
 
3930
3928
  // left column back
3931
3929
  // top rung back
3932
3930
  // middle rung back
3933
- 18, 0, 0, -1,
3931
+ 18, 0, 0, 1,
3934
3932
 
3935
3933
  // top
3936
- 6, 0, 1, 0,
3934
+ 6, 0, -1, 0,
3937
3935
 
3938
3936
  // top rung front
3939
3937
  6, 1, 0, 0,
3940
3938
 
3941
3939
  // under top rung
3942
- 6, 0, -1, 0,
3940
+ 6, 0, 1, 0,
3943
3941
 
3944
3942
  // between top rung and middle
3945
3943
  6, 1, 0, 0,
3946
3944
 
3947
3945
  // top of middle rung
3948
- 6, 0, 1, 0,
3946
+ 6, 0, -1, 0,
3949
3947
 
3950
3948
  // front of middle rung
3951
3949
  6, 1, 0, 0,
3952
3950
 
3953
3951
  // bottom of middle rung.
3954
- 6, 0, -1, 0,
3952
+ 6, 0, 1, 0,
3955
3953
 
3956
3954
  // front of bottom
3957
3955
  6, 1, 0, 0,
3958
3956
 
3959
3957
  // bottom
3960
- 6, 0, -1, 0,
3958
+ 6, 0, 1, 0,
3961
3959
 
3962
3960
  // left side
3963
3961
  6, -1, 0, 0,
@@ -9798,6 +9796,8 @@ renderbufferFormats[RGB5_A1] = true;
9798
9796
  renderbufferFormats[RGB565] = true;
9799
9797
  renderbufferFormats[DEPTH_STENCIL] = true;
9800
9798
  renderbufferFormats[DEPTH_COMPONENT16] = true;
9799
+ renderbufferFormats[DEPTH_COMPONENT24] = true;
9800
+ renderbufferFormats[DEPTH_COMPONENT32F] = true;
9801
9801
  renderbufferFormats[STENCIL_INDEX] = true;
9802
9802
  renderbufferFormats[STENCIL_INDEX8] = true;
9803
9803
 
package/dist/7.x/twgl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @license twgl.js 7.0.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
+ * @license twgl.js 7.0.3 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
  */
@@ -1093,6 +1093,8 @@ renderbufferFormats[RGB5_A1] = true;
1093
1093
  renderbufferFormats[RGB565] = true;
1094
1094
  renderbufferFormats[DEPTH_STENCIL] = true;
1095
1095
  renderbufferFormats[DEPTH_COMPONENT16] = true;
1096
+ renderbufferFormats[DEPTH_COMPONENT24] = true;
1097
+ renderbufferFormats[DEPTH_COMPONENT32F] = true;
1096
1098
  renderbufferFormats[STENCIL_INDEX] = true;
1097
1099
  renderbufferFormats[STENCIL_INDEX8] = true;
1098
1100
  function isRenderbufferFormat(format) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twgl.js",
3
- "version": "7.0.0",
3
+ "version": "7.0.3",
4
4
  "description": "A Tiny WebGL helper library",
5
5
  "main": "dist/7.x/twgl-full.js",
6
6
  "types": "dist/7.x/twgl-full.d.ts",