twgl.js 5.0.1 → 5.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/dist/5.x/twgl-full.js +31 -6
- package/dist/5.x/twgl-full.module.js +26 -6
- package/dist/5.x/twgl.js +31 -6
- package/package.json +1 -1
package/dist/5.x/twgl-full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license twgl.js 5.0.
|
|
2
|
+
* @license twgl.js 5.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
|
*/
|
|
@@ -1585,24 +1585,49 @@ function warn() {
|
|
|
1585
1585
|
(_console2 = console).warn.apply(_console2, arguments);
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
+
var isTypeWeakMaps = new Map();
|
|
1589
|
+
|
|
1590
|
+
function isType(object, type) {
|
|
1591
|
+
if (!object) {
|
|
1592
|
+
return false;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
var weakMap = isTypeWeakMaps.get(type);
|
|
1596
|
+
|
|
1597
|
+
if (!weakMap) {
|
|
1598
|
+
weakMap = new WeakMap();
|
|
1599
|
+
isTypeWeakMaps.set(type, weakMap);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
var isOfType = weakMap.get(object);
|
|
1603
|
+
|
|
1604
|
+
if (isOfType === undefined) {
|
|
1605
|
+
var s = Object.prototype.toString.call(object);
|
|
1606
|
+
isOfType = s.substring(8, s.length - 1) === type;
|
|
1607
|
+
weakMap.set(object, isOfType);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
return isOfType;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1588
1613
|
function isBuffer(gl, t) {
|
|
1589
|
-
return typeof WebGLBuffer !== 'undefined' && t
|
|
1614
|
+
return typeof WebGLBuffer !== 'undefined' && isType(t, 'WebGLBuffer');
|
|
1590
1615
|
}
|
|
1591
1616
|
|
|
1592
1617
|
function isRenderbuffer(gl, t) {
|
|
1593
|
-
return typeof WebGLRenderbuffer !== 'undefined' && t
|
|
1618
|
+
return typeof WebGLRenderbuffer !== 'undefined' && isType(t, 'WebGLRenderbuffer');
|
|
1594
1619
|
}
|
|
1595
1620
|
|
|
1596
1621
|
function isShader(gl, t) {
|
|
1597
|
-
return typeof WebGLShader !== 'undefined' && t
|
|
1622
|
+
return typeof WebGLShader !== 'undefined' && isType(t, 'WebGLShader');
|
|
1598
1623
|
}
|
|
1599
1624
|
|
|
1600
1625
|
function isTexture(gl, t) {
|
|
1601
|
-
return typeof WebGLTexture !== 'undefined' && t
|
|
1626
|
+
return typeof WebGLTexture !== 'undefined' && isType(t, 'WebGLTexture');
|
|
1602
1627
|
}
|
|
1603
1628
|
|
|
1604
1629
|
function isSampler(gl, t) {
|
|
1605
|
-
return typeof WebGLSampler !== 'undefined' && t
|
|
1630
|
+
return typeof WebGLSampler !== 'undefined' && isType(t, 'WebGLSampler');
|
|
1606
1631
|
}
|
|
1607
1632
|
|
|
1608
1633
|
/***/ }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @license twgl.js 5.0.
|
|
1
|
+
/* @license twgl.js 5.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
|
/*
|
|
@@ -1949,24 +1949,44 @@ function warn(...args) {
|
|
|
1949
1949
|
console.warn(...args);
|
|
1950
1950
|
}
|
|
1951
1951
|
|
|
1952
|
+
const isTypeWeakMaps = new Map();
|
|
1953
|
+
|
|
1954
|
+
function isType(object, type) {
|
|
1955
|
+
if (!object) {
|
|
1956
|
+
return false;
|
|
1957
|
+
}
|
|
1958
|
+
let weakMap = isTypeWeakMaps.get(type);
|
|
1959
|
+
if (!weakMap) {
|
|
1960
|
+
weakMap = new WeakMap();
|
|
1961
|
+
isTypeWeakMaps.set(type, weakMap);
|
|
1962
|
+
}
|
|
1963
|
+
let isOfType = weakMap.get(object);
|
|
1964
|
+
if (isOfType === undefined) {
|
|
1965
|
+
const s = Object.prototype.toString.call(object);
|
|
1966
|
+
isOfType = s.substring(8, s.length - 1) === type;
|
|
1967
|
+
weakMap.set(object, isOfType);
|
|
1968
|
+
}
|
|
1969
|
+
return isOfType;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1952
1972
|
function isBuffer(gl, t) {
|
|
1953
|
-
return typeof WebGLBuffer !== 'undefined' && t
|
|
1973
|
+
return typeof WebGLBuffer !== 'undefined' && isType(t, 'WebGLBuffer');
|
|
1954
1974
|
}
|
|
1955
1975
|
|
|
1956
1976
|
function isRenderbuffer(gl, t) {
|
|
1957
|
-
return typeof WebGLRenderbuffer !== 'undefined' && t
|
|
1977
|
+
return typeof WebGLRenderbuffer !== 'undefined' && isType(t, 'WebGLRenderbuffer');
|
|
1958
1978
|
}
|
|
1959
1979
|
|
|
1960
1980
|
function isShader(gl, t) {
|
|
1961
|
-
return typeof WebGLShader !== 'undefined' && t
|
|
1981
|
+
return typeof WebGLShader !== 'undefined' && isType(t, 'WebGLShader');
|
|
1962
1982
|
}
|
|
1963
1983
|
|
|
1964
1984
|
function isTexture(gl, t) {
|
|
1965
|
-
return typeof WebGLTexture !== 'undefined' && t
|
|
1985
|
+
return typeof WebGLTexture !== 'undefined' && isType(t, 'WebGLTexture');
|
|
1966
1986
|
}
|
|
1967
1987
|
|
|
1968
1988
|
function isSampler(gl, t) {
|
|
1969
|
-
return typeof WebGLSampler !== 'undefined' && t
|
|
1989
|
+
return typeof WebGLSampler !== 'undefined' && isType(t, 'WebGLSampler');
|
|
1970
1990
|
}
|
|
1971
1991
|
|
|
1972
1992
|
/*
|
package/dist/5.x/twgl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license twgl.js 5.0.
|
|
2
|
+
* @license twgl.js 5.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
|
*/
|
|
@@ -1585,24 +1585,49 @@ function warn() {
|
|
|
1585
1585
|
(_console2 = console).warn.apply(_console2, arguments);
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
+
var isTypeWeakMaps = new Map();
|
|
1589
|
+
|
|
1590
|
+
function isType(object, type) {
|
|
1591
|
+
if (!object) {
|
|
1592
|
+
return false;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
var weakMap = isTypeWeakMaps.get(type);
|
|
1596
|
+
|
|
1597
|
+
if (!weakMap) {
|
|
1598
|
+
weakMap = new WeakMap();
|
|
1599
|
+
isTypeWeakMaps.set(type, weakMap);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
var isOfType = weakMap.get(object);
|
|
1603
|
+
|
|
1604
|
+
if (isOfType === undefined) {
|
|
1605
|
+
var s = Object.prototype.toString.call(object);
|
|
1606
|
+
isOfType = s.substring(8, s.length - 1) === type;
|
|
1607
|
+
weakMap.set(object, isOfType);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
return isOfType;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1588
1613
|
function isBuffer(gl, t) {
|
|
1589
|
-
return typeof WebGLBuffer !== 'undefined' && t
|
|
1614
|
+
return typeof WebGLBuffer !== 'undefined' && isType(t, 'WebGLBuffer');
|
|
1590
1615
|
}
|
|
1591
1616
|
|
|
1592
1617
|
function isRenderbuffer(gl, t) {
|
|
1593
|
-
return typeof WebGLRenderbuffer !== 'undefined' && t
|
|
1618
|
+
return typeof WebGLRenderbuffer !== 'undefined' && isType(t, 'WebGLRenderbuffer');
|
|
1594
1619
|
}
|
|
1595
1620
|
|
|
1596
1621
|
function isShader(gl, t) {
|
|
1597
|
-
return typeof WebGLShader !== 'undefined' && t
|
|
1622
|
+
return typeof WebGLShader !== 'undefined' && isType(t, 'WebGLShader');
|
|
1598
1623
|
}
|
|
1599
1624
|
|
|
1600
1625
|
function isTexture(gl, t) {
|
|
1601
|
-
return typeof WebGLTexture !== 'undefined' && t
|
|
1626
|
+
return typeof WebGLTexture !== 'undefined' && isType(t, 'WebGLTexture');
|
|
1602
1627
|
}
|
|
1603
1628
|
|
|
1604
1629
|
function isSampler(gl, t) {
|
|
1605
|
-
return typeof WebGLSampler !== 'undefined' && t
|
|
1630
|
+
return typeof WebGLSampler !== 'undefined' && isType(t, 'WebGLSampler');
|
|
1606
1631
|
}
|
|
1607
1632
|
|
|
1608
1633
|
/***/ }),
|