globe.gl 2.28.2 → 2.28.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/globe.gl.js +842 -676
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +5 -5
- package/package.json +7 -7
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.28.
|
|
1
|
+
// Version 2.28.3 globe.gl - https://github.com/vasturiano/globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -142,7 +142,8 @@
|
|
|
142
142
|
* Copyright 2010-2023 Three.js Authors
|
|
143
143
|
* SPDX-License-Identifier: MIT
|
|
144
144
|
*/
|
|
145
|
-
const REVISION = '
|
|
145
|
+
const REVISION = '152';
|
|
146
|
+
|
|
146
147
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
147
148
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
148
149
|
const CullFaceNone = 0;
|
|
@@ -265,12 +266,17 @@
|
|
|
265
266
|
const TrianglesDrawMode = 0;
|
|
266
267
|
const TriangleStripDrawMode = 1;
|
|
267
268
|
const TriangleFanDrawMode = 2;
|
|
269
|
+
/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */
|
|
268
270
|
const LinearEncoding = 3000;
|
|
271
|
+
/** @deprecated Use SRGBColorSpace in three.js r152+. */
|
|
269
272
|
const sRGBEncoding = 3001;
|
|
270
273
|
const BasicDepthPacking = 3200;
|
|
271
274
|
const RGBADepthPacking = 3201;
|
|
272
275
|
const TangentSpaceNormalMap = 0;
|
|
273
276
|
const ObjectSpaceNormalMap = 1;
|
|
277
|
+
|
|
278
|
+
// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.
|
|
279
|
+
const NoColorSpace = '';
|
|
274
280
|
const SRGBColorSpace = 'srgb';
|
|
275
281
|
const LinearSRGBColorSpace = 'srgb-linear';
|
|
276
282
|
const DisplayP3ColorSpace = 'display-p3';
|
|
@@ -1551,6 +1557,18 @@
|
|
|
1551
1557
|
|
|
1552
1558
|
}
|
|
1553
1559
|
|
|
1560
|
+
const _cache = {};
|
|
1561
|
+
|
|
1562
|
+
function warnOnce( message ) {
|
|
1563
|
+
|
|
1564
|
+
if ( message in _cache ) return;
|
|
1565
|
+
|
|
1566
|
+
_cache[ message ] = true;
|
|
1567
|
+
|
|
1568
|
+
console.warn( message );
|
|
1569
|
+
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1554
1572
|
function SRGBToLinear( c ) {
|
|
1555
1573
|
|
|
1556
1574
|
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
@@ -1617,7 +1635,7 @@
|
|
|
1617
1635
|
|
|
1618
1636
|
const ColorManagement = {
|
|
1619
1637
|
|
|
1620
|
-
enabled:
|
|
1638
|
+
enabled: true,
|
|
1621
1639
|
|
|
1622
1640
|
get legacyMode() {
|
|
1623
1641
|
|
|
@@ -1930,7 +1948,7 @@
|
|
|
1930
1948
|
|
|
1931
1949
|
class Texture extends EventDispatcher {
|
|
1932
1950
|
|
|
1933
|
-
constructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY,
|
|
1951
|
+
constructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {
|
|
1934
1952
|
|
|
1935
1953
|
super();
|
|
1936
1954
|
|
|
@@ -1973,11 +1991,17 @@
|
|
|
1973
1991
|
this.flipY = true;
|
|
1974
1992
|
this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
|
|
1975
1993
|
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1994
|
+
if ( typeof colorSpace === 'string' ) {
|
|
1995
|
+
|
|
1996
|
+
this.colorSpace = colorSpace;
|
|
1997
|
+
|
|
1998
|
+
} else { // @deprecated, r152
|
|
1999
|
+
|
|
2000
|
+
warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
|
|
2001
|
+
this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
|
|
2002
|
+
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1981
2005
|
|
|
1982
2006
|
this.userData = {};
|
|
1983
2007
|
|
|
@@ -2047,7 +2071,7 @@
|
|
|
2047
2071
|
this.premultiplyAlpha = source.premultiplyAlpha;
|
|
2048
2072
|
this.flipY = source.flipY;
|
|
2049
2073
|
this.unpackAlignment = source.unpackAlignment;
|
|
2050
|
-
this.
|
|
2074
|
+
this.colorSpace = source.colorSpace;
|
|
2051
2075
|
|
|
2052
2076
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
2053
2077
|
|
|
@@ -2093,7 +2117,7 @@
|
|
|
2093
2117
|
format: this.format,
|
|
2094
2118
|
internalFormat: this.internalFormat,
|
|
2095
2119
|
type: this.type,
|
|
2096
|
-
|
|
2120
|
+
colorSpace: this.colorSpace,
|
|
2097
2121
|
|
|
2098
2122
|
minFilter: this.minFilter,
|
|
2099
2123
|
magFilter: this.magFilter,
|
|
@@ -2216,6 +2240,20 @@
|
|
|
2216
2240
|
|
|
2217
2241
|
}
|
|
2218
2242
|
|
|
2243
|
+
get encoding() { // @deprecated, r152
|
|
2244
|
+
|
|
2245
|
+
warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
|
|
2246
|
+
return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
|
|
2247
|
+
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
set encoding( encoding ) { // @deprecated, r152
|
|
2251
|
+
|
|
2252
|
+
warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
|
|
2253
|
+
this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
|
|
2254
|
+
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2219
2257
|
}
|
|
2220
2258
|
|
|
2221
2259
|
Texture.DEFAULT_IMAGE = null;
|
|
@@ -2889,7 +2927,15 @@
|
|
|
2889
2927
|
|
|
2890
2928
|
const image = { width: width, height: height, depth: 1 };
|
|
2891
2929
|
|
|
2892
|
-
|
|
2930
|
+
if ( options.encoding !== undefined ) {
|
|
2931
|
+
|
|
2932
|
+
// @deprecated, r152
|
|
2933
|
+
warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
|
|
2934
|
+
options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
|
|
2935
|
+
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
|
|
2893
2939
|
this.texture.isRenderTargetTexture = true;
|
|
2894
2940
|
|
|
2895
2941
|
this.texture.flipY = false;
|
|
@@ -2939,6 +2985,9 @@
|
|
|
2939
2985
|
this.height = source.height;
|
|
2940
2986
|
this.depth = source.depth;
|
|
2941
2987
|
|
|
2988
|
+
this.scissor.copy( source.scissor );
|
|
2989
|
+
this.scissorTest = source.scissorTest;
|
|
2990
|
+
|
|
2942
2991
|
this.viewport.copy( source.viewport );
|
|
2943
2992
|
|
|
2944
2993
|
this.texture = source.texture.clone();
|
|
@@ -7830,6 +7879,8 @@
|
|
|
7830
7879
|
this.frustumCulled = source.frustumCulled;
|
|
7831
7880
|
this.renderOrder = source.renderOrder;
|
|
7832
7881
|
|
|
7882
|
+
this.animations = source.animations;
|
|
7883
|
+
|
|
7833
7884
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
7834
7885
|
|
|
7835
7886
|
if ( recursive === true ) {
|
|
@@ -8847,30 +8898,30 @@
|
|
|
8847
8898
|
if ( color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
|
|
8848
8899
|
|
|
8849
8900
|
// rgb(255,0,0) rgba(255,0,0,0.5)
|
|
8850
|
-
this.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;
|
|
8851
|
-
this.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;
|
|
8852
|
-
this.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;
|
|
8853
|
-
|
|
8854
|
-
ColorManagement.toWorkingColorSpace( this, colorSpace );
|
|
8855
8901
|
|
|
8856
8902
|
handleAlpha( color[ 4 ] );
|
|
8857
8903
|
|
|
8858
|
-
return this
|
|
8904
|
+
return this.setRGB(
|
|
8905
|
+
Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,
|
|
8906
|
+
Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,
|
|
8907
|
+
Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,
|
|
8908
|
+
colorSpace
|
|
8909
|
+
);
|
|
8859
8910
|
|
|
8860
8911
|
}
|
|
8861
8912
|
|
|
8862
8913
|
if ( color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
|
|
8863
8914
|
|
|
8864
8915
|
// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
|
|
8865
|
-
this.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;
|
|
8866
|
-
this.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;
|
|
8867
|
-
this.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;
|
|
8868
|
-
|
|
8869
|
-
ColorManagement.toWorkingColorSpace( this, colorSpace );
|
|
8870
8916
|
|
|
8871
8917
|
handleAlpha( color[ 4 ] );
|
|
8872
8918
|
|
|
8873
|
-
return this
|
|
8919
|
+
return this.setRGB(
|
|
8920
|
+
Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,
|
|
8921
|
+
Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,
|
|
8922
|
+
Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,
|
|
8923
|
+
colorSpace
|
|
8924
|
+
);
|
|
8874
8925
|
|
|
8875
8926
|
}
|
|
8876
8927
|
|
|
@@ -8882,13 +8933,15 @@
|
|
|
8882
8933
|
if ( color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
|
|
8883
8934
|
|
|
8884
8935
|
// hsl(120,50%,50%) hsla(120,50%,50%,0.5)
|
|
8885
|
-
const h = parseFloat( color[ 1 ] ) / 360;
|
|
8886
|
-
const s = parseFloat( color[ 2 ] ) / 100;
|
|
8887
|
-
const l = parseFloat( color[ 3 ] ) / 100;
|
|
8888
8936
|
|
|
8889
8937
|
handleAlpha( color[ 4 ] );
|
|
8890
8938
|
|
|
8891
|
-
return this.setHSL(
|
|
8939
|
+
return this.setHSL(
|
|
8940
|
+
parseFloat( color[ 1 ] ) / 360,
|
|
8941
|
+
parseFloat( color[ 2 ] ) / 100,
|
|
8942
|
+
parseFloat( color[ 3 ] ) / 100,
|
|
8943
|
+
colorSpace
|
|
8944
|
+
);
|
|
8892
8945
|
|
|
8893
8946
|
}
|
|
8894
8947
|
|
|
@@ -9015,7 +9068,7 @@
|
|
|
9015
9068
|
|
|
9016
9069
|
ColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );
|
|
9017
9070
|
|
|
9018
|
-
return clamp( _color.r * 255, 0, 255 )
|
|
9071
|
+
return Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );
|
|
9019
9072
|
|
|
9020
9073
|
}
|
|
9021
9074
|
|
|
@@ -9095,7 +9148,7 @@
|
|
|
9095
9148
|
|
|
9096
9149
|
}
|
|
9097
9150
|
|
|
9098
|
-
return `rgb(${( r * 255 )
|
|
9151
|
+
return `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;
|
|
9099
9152
|
|
|
9100
9153
|
}
|
|
9101
9154
|
|
|
@@ -10965,12 +11018,6 @@
|
|
|
10965
11018
|
|
|
10966
11019
|
}
|
|
10967
11020
|
|
|
10968
|
-
if ( this.isSkinnedMesh ) {
|
|
10969
|
-
|
|
10970
|
-
this.applyBoneTransform( index, target );
|
|
10971
|
-
|
|
10972
|
-
}
|
|
10973
|
-
|
|
10974
11021
|
return target;
|
|
10975
11022
|
|
|
10976
11023
|
}
|
|
@@ -11013,12 +11060,21 @@
|
|
|
11013
11060
|
|
|
11014
11061
|
}
|
|
11015
11062
|
|
|
11063
|
+
this._computeIntersections( raycaster, intersects );
|
|
11064
|
+
|
|
11065
|
+
}
|
|
11066
|
+
|
|
11067
|
+
_computeIntersections( raycaster, intersects ) {
|
|
11068
|
+
|
|
11016
11069
|
let intersection;
|
|
11017
11070
|
|
|
11071
|
+
const geometry = this.geometry;
|
|
11072
|
+
const material = this.material;
|
|
11073
|
+
|
|
11018
11074
|
const index = geometry.index;
|
|
11019
11075
|
const position = geometry.attributes.position;
|
|
11020
11076
|
const uv = geometry.attributes.uv;
|
|
11021
|
-
const
|
|
11077
|
+
const uv1 = geometry.attributes.uv1;
|
|
11022
11078
|
const normal = geometry.attributes.normal;
|
|
11023
11079
|
const groups = geometry.groups;
|
|
11024
11080
|
const drawRange = geometry.drawRange;
|
|
@@ -11043,7 +11099,7 @@
|
|
|
11043
11099
|
const b = index.getX( j + 1 );
|
|
11044
11100
|
const c = index.getX( j + 2 );
|
|
11045
11101
|
|
|
11046
|
-
intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv,
|
|
11102
|
+
intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv, uv1, normal, a, b, c );
|
|
11047
11103
|
|
|
11048
11104
|
if ( intersection ) {
|
|
11049
11105
|
|
|
@@ -11068,7 +11124,7 @@
|
|
|
11068
11124
|
const b = index.getX( i + 1 );
|
|
11069
11125
|
const c = index.getX( i + 2 );
|
|
11070
11126
|
|
|
11071
|
-
intersection = checkGeometryIntersection( this, material, raycaster, _ray$2, uv,
|
|
11127
|
+
intersection = checkGeometryIntersection( this, material, raycaster, _ray$2, uv, uv1, normal, a, b, c );
|
|
11072
11128
|
|
|
11073
11129
|
if ( intersection ) {
|
|
11074
11130
|
|
|
@@ -11101,7 +11157,7 @@
|
|
|
11101
11157
|
const b = j + 1;
|
|
11102
11158
|
const c = j + 2;
|
|
11103
11159
|
|
|
11104
|
-
intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv,
|
|
11160
|
+
intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv, uv1, normal, a, b, c );
|
|
11105
11161
|
|
|
11106
11162
|
if ( intersection ) {
|
|
11107
11163
|
|
|
@@ -11126,7 +11182,7 @@
|
|
|
11126
11182
|
const b = i + 1;
|
|
11127
11183
|
const c = i + 2;
|
|
11128
11184
|
|
|
11129
|
-
intersection = checkGeometryIntersection( this, material, raycaster, _ray$2, uv,
|
|
11185
|
+
intersection = checkGeometryIntersection( this, material, raycaster, _ray$2, uv, uv1, normal, a, b, c );
|
|
11130
11186
|
|
|
11131
11187
|
if ( intersection ) {
|
|
11132
11188
|
|
|
@@ -11176,7 +11232,7 @@
|
|
|
11176
11232
|
|
|
11177
11233
|
}
|
|
11178
11234
|
|
|
11179
|
-
function checkGeometryIntersection( object, material, raycaster, ray, uv,
|
|
11235
|
+
function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {
|
|
11180
11236
|
|
|
11181
11237
|
object.getVertexPosition( a, _vA$1 );
|
|
11182
11238
|
object.getVertexPosition( b, _vB$1 );
|
|
@@ -11196,13 +11252,14 @@
|
|
|
11196
11252
|
|
|
11197
11253
|
}
|
|
11198
11254
|
|
|
11199
|
-
if (
|
|
11255
|
+
if ( uv1 ) {
|
|
11200
11256
|
|
|
11201
|
-
_uvA$1.fromBufferAttribute(
|
|
11202
|
-
_uvB$1.fromBufferAttribute(
|
|
11203
|
-
_uvC$1.fromBufferAttribute(
|
|
11257
|
+
_uvA$1.fromBufferAttribute( uv1, a );
|
|
11258
|
+
_uvB$1.fromBufferAttribute( uv1, b );
|
|
11259
|
+
_uvC$1.fromBufferAttribute( uv1, c );
|
|
11204
11260
|
|
|
11205
|
-
intersection.
|
|
11261
|
+
intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
|
|
11262
|
+
intersection.uv2 = intersection.uv1; // Backwards compatibility
|
|
11206
11263
|
|
|
11207
11264
|
}
|
|
11208
11265
|
|
|
@@ -11504,7 +11561,7 @@
|
|
|
11504
11561
|
if ( renderer.getRenderTarget() === null ) {
|
|
11505
11562
|
|
|
11506
11563
|
// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
|
|
11507
|
-
return renderer.
|
|
11564
|
+
return renderer.outputColorSpace;
|
|
11508
11565
|
|
|
11509
11566
|
}
|
|
11510
11567
|
|
|
@@ -11560,7 +11617,7 @@
|
|
|
11560
11617
|
this.defaultAttributeValues = {
|
|
11561
11618
|
'color': [ 1, 1, 1 ],
|
|
11562
11619
|
'uv': [ 0, 0 ],
|
|
11563
|
-
'
|
|
11620
|
+
'uv1': [ 0, 0 ]
|
|
11564
11621
|
};
|
|
11565
11622
|
|
|
11566
11623
|
this.index0AttributeName = undefined;
|
|
@@ -11681,6 +11738,9 @@
|
|
|
11681
11738
|
data.vertexShader = this.vertexShader;
|
|
11682
11739
|
data.fragmentShader = this.fragmentShader;
|
|
11683
11740
|
|
|
11741
|
+
data.lights = this.lights;
|
|
11742
|
+
data.clipping = this.clipping;
|
|
11743
|
+
|
|
11684
11744
|
const extensions = {};
|
|
11685
11745
|
|
|
11686
11746
|
for ( const key in this.extensions ) {
|
|
@@ -12094,12 +12154,12 @@
|
|
|
12094
12154
|
|
|
12095
12155
|
class CubeTexture extends Texture {
|
|
12096
12156
|
|
|
12097
|
-
constructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy,
|
|
12157
|
+
constructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {
|
|
12098
12158
|
|
|
12099
12159
|
images = images !== undefined ? images : [];
|
|
12100
12160
|
mapping = mapping !== undefined ? mapping : CubeReflectionMapping;
|
|
12101
12161
|
|
|
12102
|
-
super( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy,
|
|
12162
|
+
super( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );
|
|
12103
12163
|
|
|
12104
12164
|
this.isCubeTexture = true;
|
|
12105
12165
|
|
|
@@ -12132,7 +12192,15 @@
|
|
|
12132
12192
|
const image = { width: size, height: size, depth: 1 };
|
|
12133
12193
|
const images = [ image, image, image, image, image, image ];
|
|
12134
12194
|
|
|
12135
|
-
|
|
12195
|
+
if ( options.encoding !== undefined ) {
|
|
12196
|
+
|
|
12197
|
+
// @deprecated, r152
|
|
12198
|
+
warnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
|
|
12199
|
+
options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
|
|
12200
|
+
|
|
12201
|
+
}
|
|
12202
|
+
|
|
12203
|
+
this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
|
|
12136
12204
|
|
|
12137
12205
|
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
12138
12206
|
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
@@ -12152,7 +12220,7 @@
|
|
|
12152
12220
|
fromEquirectangularTexture( renderer, texture ) {
|
|
12153
12221
|
|
|
12154
12222
|
this.texture.type = texture.type;
|
|
12155
|
-
this.texture.
|
|
12223
|
+
this.texture.colorSpace = texture.colorSpace;
|
|
12156
12224
|
|
|
12157
12225
|
this.texture.generateMipmaps = texture.generateMipmaps;
|
|
12158
12226
|
this.texture.minFilter = texture.minFilter;
|
|
@@ -12698,7 +12766,7 @@
|
|
|
12698
12766
|
|
|
12699
12767
|
if ( array instanceof Float32Array ) {
|
|
12700
12768
|
|
|
12701
|
-
type =
|
|
12769
|
+
type = gl.FLOAT;
|
|
12702
12770
|
|
|
12703
12771
|
} else if ( array instanceof Uint16Array ) {
|
|
12704
12772
|
|
|
@@ -12706,7 +12774,7 @@
|
|
|
12706
12774
|
|
|
12707
12775
|
if ( isWebGL2 ) {
|
|
12708
12776
|
|
|
12709
|
-
type =
|
|
12777
|
+
type = gl.HALF_FLOAT;
|
|
12710
12778
|
|
|
12711
12779
|
} else {
|
|
12712
12780
|
|
|
@@ -12716,33 +12784,33 @@
|
|
|
12716
12784
|
|
|
12717
12785
|
} else {
|
|
12718
12786
|
|
|
12719
|
-
type =
|
|
12787
|
+
type = gl.UNSIGNED_SHORT;
|
|
12720
12788
|
|
|
12721
12789
|
}
|
|
12722
12790
|
|
|
12723
12791
|
} else if ( array instanceof Int16Array ) {
|
|
12724
12792
|
|
|
12725
|
-
type =
|
|
12793
|
+
type = gl.SHORT;
|
|
12726
12794
|
|
|
12727
12795
|
} else if ( array instanceof Uint32Array ) {
|
|
12728
12796
|
|
|
12729
|
-
type =
|
|
12797
|
+
type = gl.UNSIGNED_INT;
|
|
12730
12798
|
|
|
12731
12799
|
} else if ( array instanceof Int32Array ) {
|
|
12732
12800
|
|
|
12733
|
-
type =
|
|
12801
|
+
type = gl.INT;
|
|
12734
12802
|
|
|
12735
12803
|
} else if ( array instanceof Int8Array ) {
|
|
12736
12804
|
|
|
12737
|
-
type =
|
|
12805
|
+
type = gl.BYTE;
|
|
12738
12806
|
|
|
12739
12807
|
} else if ( array instanceof Uint8Array ) {
|
|
12740
12808
|
|
|
12741
|
-
type =
|
|
12809
|
+
type = gl.UNSIGNED_BYTE;
|
|
12742
12810
|
|
|
12743
12811
|
} else if ( array instanceof Uint8ClampedArray ) {
|
|
12744
12812
|
|
|
12745
|
-
type =
|
|
12813
|
+
type = gl.UNSIGNED_BYTE;
|
|
12746
12814
|
|
|
12747
12815
|
} else {
|
|
12748
12816
|
|
|
@@ -13077,7 +13145,7 @@
|
|
|
13077
13145
|
|
|
13078
13146
|
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
|
|
13079
13147
|
|
|
13080
|
-
var map_fragment = "#ifdef USE_MAP\n\
|
|
13148
|
+
var map_fragment = "#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif";
|
|
13081
13149
|
|
|
13082
13150
|
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
|
|
13083
13151
|
|
|
@@ -13159,11 +13227,11 @@
|
|
|
13159
13227
|
|
|
13160
13228
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif";
|
|
13161
13229
|
|
|
13162
|
-
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize,
|
|
13230
|
+
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
|
|
13163
13231
|
|
|
13164
13232
|
var uv_pars_fragment = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
|
|
13165
13233
|
|
|
13166
|
-
var uv_pars_vertex = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef
|
|
13234
|
+
var uv_pars_vertex = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
|
|
13167
13235
|
|
|
13168
13236
|
var uv_vertex = "#ifdef USE_UV\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
|
|
13169
13237
|
|
|
@@ -13171,7 +13239,7 @@
|
|
|
13171
13239
|
|
|
13172
13240
|
const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
13173
13241
|
|
|
13174
|
-
const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\
|
|
13242
|
+
const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
|
|
13175
13243
|
|
|
13176
13244
|
const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
|
|
13177
13245
|
|
|
@@ -13973,26 +14041,35 @@
|
|
|
13973
14041
|
|
|
13974
14042
|
}
|
|
13975
14043
|
|
|
13976
|
-
|
|
13977
|
-
// TODO: Reconsider this.
|
|
14044
|
+
if ( background === null ) {
|
|
13978
14045
|
|
|
13979
|
-
|
|
13980
|
-
const session = xr.getSession && xr.getSession();
|
|
14046
|
+
setClear( clearColor, clearAlpha );
|
|
13981
14047
|
|
|
13982
|
-
if (
|
|
14048
|
+
} else if ( background && background.isColor ) {
|
|
13983
14049
|
|
|
13984
|
-
background
|
|
14050
|
+
setClear( background, 1 );
|
|
14051
|
+
forceClear = true;
|
|
13985
14052
|
|
|
13986
14053
|
}
|
|
13987
14054
|
|
|
13988
|
-
|
|
14055
|
+
const xr = renderer.xr;
|
|
14056
|
+
const environmentBlendMode = xr.getEnvironmentBlendMode();
|
|
13989
14057
|
|
|
13990
|
-
|
|
14058
|
+
switch ( environmentBlendMode ) {
|
|
13991
14059
|
|
|
13992
|
-
|
|
14060
|
+
case 'opaque':
|
|
14061
|
+
forceClear = true;
|
|
14062
|
+
break;
|
|
13993
14063
|
|
|
13994
|
-
|
|
13995
|
-
|
|
14064
|
+
case 'additive':
|
|
14065
|
+
state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
|
|
14066
|
+
forceClear = true;
|
|
14067
|
+
break;
|
|
14068
|
+
|
|
14069
|
+
case 'alpha-blend':
|
|
14070
|
+
state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
|
|
14071
|
+
forceClear = true;
|
|
14072
|
+
break;
|
|
13996
14073
|
|
|
13997
14074
|
}
|
|
13998
14075
|
|
|
@@ -14048,7 +14125,7 @@
|
|
|
14048
14125
|
boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
|
|
14049
14126
|
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
14050
14127
|
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
14051
|
-
boxMesh.material.toneMapped = ( background.
|
|
14128
|
+
boxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
|
|
14052
14129
|
|
|
14053
14130
|
if ( currentBackground !== background ||
|
|
14054
14131
|
currentBackgroundVersion !== background.version ||
|
|
@@ -14104,7 +14181,7 @@
|
|
|
14104
14181
|
|
|
14105
14182
|
planeMesh.material.uniforms.t2D.value = background;
|
|
14106
14183
|
planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
14107
|
-
planeMesh.material.toneMapped = ( background.
|
|
14184
|
+
planeMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
|
|
14108
14185
|
|
|
14109
14186
|
if ( background.matrixAutoUpdate === true ) {
|
|
14110
14187
|
|
|
@@ -14176,7 +14253,7 @@
|
|
|
14176
14253
|
|
|
14177
14254
|
function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
|
|
14178
14255
|
|
|
14179
|
-
const maxVertexAttributes = gl.getParameter(
|
|
14256
|
+
const maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
|
|
14180
14257
|
|
|
14181
14258
|
const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );
|
|
14182
14259
|
const vaoAvailable = capabilities.isWebGL2 || extension !== null;
|
|
@@ -14226,7 +14303,7 @@
|
|
|
14226
14303
|
|
|
14227
14304
|
if ( index !== null ) {
|
|
14228
14305
|
|
|
14229
|
-
attributes.update( index,
|
|
14306
|
+
attributes.update( index, gl.ELEMENT_ARRAY_BUFFER );
|
|
14230
14307
|
|
|
14231
14308
|
}
|
|
14232
14309
|
|
|
@@ -14238,7 +14315,7 @@
|
|
|
14238
14315
|
|
|
14239
14316
|
if ( index !== null ) {
|
|
14240
14317
|
|
|
14241
|
-
gl.bindBuffer(
|
|
14318
|
+
gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );
|
|
14242
14319
|
|
|
14243
14320
|
}
|
|
14244
14321
|
|
|
@@ -14493,7 +14570,7 @@
|
|
|
14493
14570
|
|
|
14494
14571
|
function vertexAttribPointer( index, size, type, normalized, stride, offset ) {
|
|
14495
14572
|
|
|
14496
|
-
if ( capabilities.isWebGL2 === true && ( type ===
|
|
14573
|
+
if ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT ) ) {
|
|
14497
14574
|
|
|
14498
14575
|
gl.vertexAttribIPointer( index, size, type, stride, offset );
|
|
14499
14576
|
|
|
@@ -14581,7 +14658,7 @@
|
|
|
14581
14658
|
|
|
14582
14659
|
}
|
|
14583
14660
|
|
|
14584
|
-
gl.bindBuffer(
|
|
14661
|
+
gl.bindBuffer( gl.ARRAY_BUFFER, buffer );
|
|
14585
14662
|
|
|
14586
14663
|
for ( let i = 0; i < programAttribute.locationSize; i ++ ) {
|
|
14587
14664
|
|
|
@@ -14622,7 +14699,7 @@
|
|
|
14622
14699
|
|
|
14623
14700
|
}
|
|
14624
14701
|
|
|
14625
|
-
gl.bindBuffer(
|
|
14702
|
+
gl.bindBuffer( gl.ARRAY_BUFFER, buffer );
|
|
14626
14703
|
|
|
14627
14704
|
for ( let i = 0; i < programAttribute.locationSize; i ++ ) {
|
|
14628
14705
|
|
|
@@ -14882,8 +14959,8 @@
|
|
|
14882
14959
|
|
|
14883
14960
|
if ( precision === 'highp' ) {
|
|
14884
14961
|
|
|
14885
|
-
if ( gl.getShaderPrecisionFormat(
|
|
14886
|
-
gl.getShaderPrecisionFormat(
|
|
14962
|
+
if ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&
|
|
14963
|
+
gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {
|
|
14887
14964
|
|
|
14888
14965
|
return 'highp';
|
|
14889
14966
|
|
|
@@ -14895,8 +14972,8 @@
|
|
|
14895
14972
|
|
|
14896
14973
|
if ( precision === 'mediump' ) {
|
|
14897
14974
|
|
|
14898
|
-
if ( gl.getShaderPrecisionFormat(
|
|
14899
|
-
gl.getShaderPrecisionFormat(
|
|
14975
|
+
if ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&
|
|
14976
|
+
gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {
|
|
14900
14977
|
|
|
14901
14978
|
return 'mediump';
|
|
14902
14979
|
|
|
@@ -14924,21 +15001,21 @@
|
|
|
14924
15001
|
|
|
14925
15002
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
14926
15003
|
|
|
14927
|
-
const maxTextures = gl.getParameter(
|
|
14928
|
-
const maxVertexTextures = gl.getParameter(
|
|
14929
|
-
const maxTextureSize = gl.getParameter(
|
|
14930
|
-
const maxCubemapSize = gl.getParameter(
|
|
15004
|
+
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
15005
|
+
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
15006
|
+
const maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );
|
|
15007
|
+
const maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );
|
|
14931
15008
|
|
|
14932
|
-
const maxAttributes = gl.getParameter(
|
|
14933
|
-
const maxVertexUniforms = gl.getParameter(
|
|
14934
|
-
const maxVaryings = gl.getParameter(
|
|
14935
|
-
const maxFragmentUniforms = gl.getParameter(
|
|
15009
|
+
const maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
|
|
15010
|
+
const maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );
|
|
15011
|
+
const maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );
|
|
15012
|
+
const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
|
|
14936
15013
|
|
|
14937
15014
|
const vertexTextures = maxVertexTextures > 0;
|
|
14938
15015
|
const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );
|
|
14939
15016
|
const floatVertexTextures = vertexTextures && floatFragmentTextures;
|
|
14940
15017
|
|
|
14941
|
-
const maxSamples = isWebGL2 ? gl.getParameter(
|
|
15018
|
+
const maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
|
|
14942
15019
|
|
|
14943
15020
|
return {
|
|
14944
15021
|
|
|
@@ -15598,7 +15675,7 @@
|
|
|
15598
15675
|
generateMipmaps: false,
|
|
15599
15676
|
type: HalfFloatType,
|
|
15600
15677
|
format: RGBAFormat,
|
|
15601
|
-
|
|
15678
|
+
colorSpace: LinearSRGBColorSpace,
|
|
15602
15679
|
depthBuffer: false
|
|
15603
15680
|
};
|
|
15604
15681
|
|
|
@@ -16530,7 +16607,7 @@
|
|
|
16530
16607
|
|
|
16531
16608
|
for ( const name in geometryAttributes ) {
|
|
16532
16609
|
|
|
16533
|
-
attributes.update( geometryAttributes[ name ],
|
|
16610
|
+
attributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );
|
|
16534
16611
|
|
|
16535
16612
|
}
|
|
16536
16613
|
|
|
@@ -16544,7 +16621,7 @@
|
|
|
16544
16621
|
|
|
16545
16622
|
for ( let i = 0, l = array.length; i < l; i ++ ) {
|
|
16546
16623
|
|
|
16547
|
-
attributes.update( array[ i ],
|
|
16624
|
+
attributes.update( array[ i ], gl.ARRAY_BUFFER );
|
|
16548
16625
|
|
|
16549
16626
|
}
|
|
16550
16627
|
|
|
@@ -16740,23 +16817,23 @@
|
|
|
16740
16817
|
|
|
16741
16818
|
switch ( mode ) {
|
|
16742
16819
|
|
|
16743
|
-
case
|
|
16820
|
+
case gl.TRIANGLES:
|
|
16744
16821
|
render.triangles += instanceCount * ( count / 3 );
|
|
16745
16822
|
break;
|
|
16746
16823
|
|
|
16747
|
-
case
|
|
16824
|
+
case gl.LINES:
|
|
16748
16825
|
render.lines += instanceCount * ( count / 2 );
|
|
16749
16826
|
break;
|
|
16750
16827
|
|
|
16751
|
-
case
|
|
16828
|
+
case gl.LINE_STRIP:
|
|
16752
16829
|
render.lines += instanceCount * ( count - 1 );
|
|
16753
16830
|
break;
|
|
16754
16831
|
|
|
16755
|
-
case
|
|
16832
|
+
case gl.LINE_LOOP:
|
|
16756
16833
|
render.lines += instanceCount * count;
|
|
16757
16834
|
break;
|
|
16758
16835
|
|
|
16759
|
-
case
|
|
16836
|
+
case gl.POINTS:
|
|
16760
16837
|
render.points += instanceCount * count;
|
|
16761
16838
|
break;
|
|
16762
16839
|
|
|
@@ -17111,11 +17188,11 @@
|
|
|
17111
17188
|
|
|
17112
17189
|
}
|
|
17113
17190
|
|
|
17114
|
-
attributes.update( object.instanceMatrix,
|
|
17191
|
+
attributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );
|
|
17115
17192
|
|
|
17116
17193
|
if ( object.instanceColor !== null ) {
|
|
17117
17194
|
|
|
17118
|
-
attributes.update( object.instanceColor,
|
|
17195
|
+
attributes.update( object.instanceColor, gl.ARRAY_BUFFER );
|
|
17119
17196
|
|
|
17120
17197
|
}
|
|
17121
17198
|
|
|
@@ -18228,7 +18305,7 @@
|
|
|
18228
18305
|
this.seq = [];
|
|
18229
18306
|
this.map = {};
|
|
18230
18307
|
|
|
18231
|
-
const n = gl.getProgramParameter( program,
|
|
18308
|
+
const n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );
|
|
18232
18309
|
|
|
18233
18310
|
for ( let i = 0; i < n; ++ i ) {
|
|
18234
18311
|
|
|
@@ -18324,16 +18401,16 @@
|
|
|
18324
18401
|
|
|
18325
18402
|
}
|
|
18326
18403
|
|
|
18327
|
-
function getEncodingComponents(
|
|
18404
|
+
function getEncodingComponents( colorSpace ) {
|
|
18328
18405
|
|
|
18329
|
-
switch (
|
|
18406
|
+
switch ( colorSpace ) {
|
|
18330
18407
|
|
|
18331
|
-
case
|
|
18408
|
+
case LinearSRGBColorSpace:
|
|
18332
18409
|
return [ 'Linear', '( value )' ];
|
|
18333
|
-
case
|
|
18410
|
+
case SRGBColorSpace:
|
|
18334
18411
|
return [ 'sRGB', '( value )' ];
|
|
18335
18412
|
default:
|
|
18336
|
-
console.warn( 'THREE.WebGLProgram: Unsupported
|
|
18413
|
+
console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
|
|
18337
18414
|
return [ 'Linear', '( value )' ];
|
|
18338
18415
|
|
|
18339
18416
|
}
|
|
@@ -18342,7 +18419,7 @@
|
|
|
18342
18419
|
|
|
18343
18420
|
function getShaderErrors( gl, shader, type ) {
|
|
18344
18421
|
|
|
18345
|
-
const status = gl.getShaderParameter( shader,
|
|
18422
|
+
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
18346
18423
|
const errors = gl.getShaderInfoLog( shader ).trim();
|
|
18347
18424
|
|
|
18348
18425
|
if ( status && errors === '' ) return '';
|
|
@@ -18364,9 +18441,9 @@
|
|
|
18364
18441
|
|
|
18365
18442
|
}
|
|
18366
18443
|
|
|
18367
|
-
function getTexelEncodingFunction( functionName,
|
|
18444
|
+
function getTexelEncodingFunction( functionName, colorSpace ) {
|
|
18368
18445
|
|
|
18369
|
-
const components = getEncodingComponents(
|
|
18446
|
+
const components = getEncodingComponents( colorSpace );
|
|
18370
18447
|
return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';
|
|
18371
18448
|
|
|
18372
18449
|
}
|
|
@@ -18442,7 +18519,7 @@
|
|
|
18442
18519
|
|
|
18443
18520
|
const attributes = {};
|
|
18444
18521
|
|
|
18445
|
-
const n = gl.getProgramParameter( program,
|
|
18522
|
+
const n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );
|
|
18446
18523
|
|
|
18447
18524
|
for ( let i = 0; i < n; i ++ ) {
|
|
18448
18525
|
|
|
@@ -18450,9 +18527,9 @@
|
|
|
18450
18527
|
const name = info.name;
|
|
18451
18528
|
|
|
18452
18529
|
let locationSize = 1;
|
|
18453
|
-
if ( info.type ===
|
|
18454
|
-
if ( info.type ===
|
|
18455
|
-
if ( info.type ===
|
|
18530
|
+
if ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;
|
|
18531
|
+
if ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;
|
|
18532
|
+
if ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;
|
|
18456
18533
|
|
|
18457
18534
|
// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
|
|
18458
18535
|
|
|
@@ -18827,7 +18904,9 @@
|
|
|
18827
18904
|
parameters.vertexTangents ? '#define USE_TANGENT' : '',
|
|
18828
18905
|
parameters.vertexColors ? '#define USE_COLOR' : '',
|
|
18829
18906
|
parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',
|
|
18830
|
-
parameters.
|
|
18907
|
+
parameters.vertexUv1s ? '#define USE_UV1' : '',
|
|
18908
|
+
parameters.vertexUv2s ? '#define USE_UV2' : '',
|
|
18909
|
+
parameters.vertexUv3s ? '#define USE_UV3' : '',
|
|
18831
18910
|
|
|
18832
18911
|
parameters.pointsUvs ? '#define USE_POINTS_UV' : '',
|
|
18833
18912
|
|
|
@@ -18876,6 +18955,24 @@
|
|
|
18876
18955
|
'attribute vec3 normal;',
|
|
18877
18956
|
'attribute vec2 uv;',
|
|
18878
18957
|
|
|
18958
|
+
'#ifdef USE_UV1',
|
|
18959
|
+
|
|
18960
|
+
' attribute vec2 uv1;',
|
|
18961
|
+
|
|
18962
|
+
'#endif',
|
|
18963
|
+
|
|
18964
|
+
'#ifdef USE_UV2',
|
|
18965
|
+
|
|
18966
|
+
' attribute vec2 uv2;',
|
|
18967
|
+
|
|
18968
|
+
'#endif',
|
|
18969
|
+
|
|
18970
|
+
'#ifdef USE_UV3',
|
|
18971
|
+
|
|
18972
|
+
' attribute vec2 uv3;',
|
|
18973
|
+
|
|
18974
|
+
'#endif',
|
|
18975
|
+
|
|
18879
18976
|
'#ifdef USE_TANGENT',
|
|
18880
18977
|
|
|
18881
18978
|
' attribute vec4 tangent;',
|
|
@@ -18985,12 +19082,12 @@
|
|
|
18985
19082
|
parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',
|
|
18986
19083
|
parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',
|
|
18987
19084
|
|
|
18988
|
-
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
18989
|
-
|
|
18990
19085
|
parameters.vertexTangents ? '#define USE_TANGENT' : '',
|
|
18991
19086
|
parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',
|
|
18992
19087
|
parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',
|
|
18993
|
-
parameters.
|
|
19088
|
+
parameters.vertexUv1s ? '#define USE_UV1' : '',
|
|
19089
|
+
parameters.vertexUv2s ? '#define USE_UV2' : '',
|
|
19090
|
+
parameters.vertexUv3s ? '#define USE_UV3' : '',
|
|
18994
19091
|
|
|
18995
19092
|
parameters.pointsUvs ? '#define USE_POINTS_UV' : '',
|
|
18996
19093
|
|
|
@@ -19023,7 +19120,7 @@
|
|
|
19023
19120
|
parameters.opaque ? '#define OPAQUE' : '',
|
|
19024
19121
|
|
|
19025
19122
|
ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
19026
|
-
getTexelEncodingFunction( 'linearToOutputTexel', parameters.
|
|
19123
|
+
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),
|
|
19027
19124
|
|
|
19028
19125
|
parameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',
|
|
19029
19126
|
|
|
@@ -19081,8 +19178,8 @@
|
|
|
19081
19178
|
// console.log( '*VERTEX*', vertexGlsl );
|
|
19082
19179
|
// console.log( '*FRAGMENT*', fragmentGlsl );
|
|
19083
19180
|
|
|
19084
|
-
const glVertexShader = WebGLShader( gl,
|
|
19085
|
-
const glFragmentShader = WebGLShader( gl,
|
|
19181
|
+
const glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );
|
|
19182
|
+
const glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );
|
|
19086
19183
|
|
|
19087
19184
|
gl.attachShader( program, glVertexShader );
|
|
19088
19185
|
gl.attachShader( program, glFragmentShader );
|
|
@@ -19112,7 +19209,7 @@
|
|
|
19112
19209
|
let runnable = true;
|
|
19113
19210
|
let haveDiagnostics = true;
|
|
19114
19211
|
|
|
19115
|
-
if ( gl.getProgramParameter( program,
|
|
19212
|
+
if ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {
|
|
19116
19213
|
|
|
19117
19214
|
runnable = false;
|
|
19118
19215
|
|
|
@@ -19129,7 +19226,7 @@
|
|
|
19129
19226
|
|
|
19130
19227
|
console.error(
|
|
19131
19228
|
'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
19132
|
-
'VALIDATE_STATUS ' + gl.getProgramParameter( program,
|
|
19229
|
+
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
19133
19230
|
'Program Info Log: ' + programLog + '\n' +
|
|
19134
19231
|
vertexErrors + '\n' +
|
|
19135
19232
|
fragmentErrors
|
|
@@ -19396,7 +19493,9 @@
|
|
|
19396
19493
|
|
|
19397
19494
|
function getChannel( value ) {
|
|
19398
19495
|
|
|
19399
|
-
if ( value === 1 ) return '
|
|
19496
|
+
if ( value === 1 ) return 'uv1';
|
|
19497
|
+
if ( value === 2 ) return 'uv2';
|
|
19498
|
+
if ( value === 3 ) return 'uv3';
|
|
19400
19499
|
|
|
19401
19500
|
return 'uv';
|
|
19402
19501
|
|
|
@@ -19510,7 +19609,9 @@
|
|
|
19510
19609
|
|
|
19511
19610
|
const HAS_EXTENSIONS = !! material.extensions;
|
|
19512
19611
|
|
|
19612
|
+
const HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;
|
|
19513
19613
|
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
|
|
19614
|
+
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
|
|
19514
19615
|
|
|
19515
19616
|
const parameters = {
|
|
19516
19617
|
|
|
@@ -19535,7 +19636,7 @@
|
|
|
19535
19636
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
19536
19637
|
|
|
19537
19638
|
supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
|
|
19538
|
-
|
|
19639
|
+
outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
|
|
19539
19640
|
|
|
19540
19641
|
map: HAS_MAP,
|
|
19541
19642
|
matcap: HAS_MATCAP,
|
|
@@ -19552,8 +19653,6 @@
|
|
|
19552
19653
|
normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
|
|
19553
19654
|
normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
|
|
19554
19655
|
|
|
19555
|
-
decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( material.map.encoding === sRGBEncoding ),
|
|
19556
|
-
|
|
19557
19656
|
metalnessMap: HAS_METALNESSMAP,
|
|
19558
19657
|
roughnessMap: HAS_ROUGHNESSMAP,
|
|
19559
19658
|
|
|
@@ -19624,7 +19723,9 @@
|
|
|
19624
19723
|
vertexTangents: HAS_NORMALMAP && !! geometry.attributes.tangent,
|
|
19625
19724
|
vertexColors: material.vertexColors,
|
|
19626
19725
|
vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
19627
|
-
|
|
19726
|
+
vertexUv1s: HAS_ATTRIBUTE_UV1,
|
|
19727
|
+
vertexUv2s: HAS_ATTRIBUTE_UV2,
|
|
19728
|
+
vertexUv3s: HAS_ATTRIBUTE_UV3,
|
|
19628
19729
|
|
|
19629
19730
|
pointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),
|
|
19630
19731
|
|
|
@@ -19725,7 +19826,7 @@
|
|
|
19725
19826
|
|
|
19726
19827
|
getProgramCacheKeyParameters( array, parameters );
|
|
19727
19828
|
getProgramCacheKeyBooleans( array, parameters );
|
|
19728
|
-
array.push( renderer.
|
|
19829
|
+
array.push( renderer.outputColorSpace );
|
|
19729
19830
|
|
|
19730
19831
|
}
|
|
19731
19832
|
|
|
@@ -19738,7 +19839,7 @@
|
|
|
19738
19839
|
function getProgramCacheKeyParameters( array, parameters ) {
|
|
19739
19840
|
|
|
19740
19841
|
array.push( parameters.precision );
|
|
19741
|
-
array.push( parameters.
|
|
19842
|
+
array.push( parameters.outputColorSpace );
|
|
19742
19843
|
array.push( parameters.envMapMode );
|
|
19743
19844
|
array.push( parameters.envMapCubeUVHeight );
|
|
19744
19845
|
array.push( parameters.mapUv );
|
|
@@ -19816,10 +19917,14 @@
|
|
|
19816
19917
|
_programLayers.enable( 11 );
|
|
19817
19918
|
if ( parameters.vertexAlphas )
|
|
19818
19919
|
_programLayers.enable( 12 );
|
|
19819
|
-
if ( parameters.
|
|
19920
|
+
if ( parameters.vertexUv1s )
|
|
19820
19921
|
_programLayers.enable( 13 );
|
|
19821
|
-
if ( parameters.
|
|
19922
|
+
if ( parameters.vertexUv2s )
|
|
19822
19923
|
_programLayers.enable( 14 );
|
|
19924
|
+
if ( parameters.vertexUv3s )
|
|
19925
|
+
_programLayers.enable( 15 );
|
|
19926
|
+
if ( parameters.vertexTangents )
|
|
19927
|
+
_programLayers.enable( 16 );
|
|
19823
19928
|
|
|
19824
19929
|
array.push( _programLayers.mask );
|
|
19825
19930
|
_programLayers.disableAll();
|
|
@@ -19858,12 +19963,10 @@
|
|
|
19858
19963
|
_programLayers.enable( 15 );
|
|
19859
19964
|
if ( parameters.sheen )
|
|
19860
19965
|
_programLayers.enable( 16 );
|
|
19861
|
-
if ( parameters.decodeVideoTexture )
|
|
19862
|
-
_programLayers.enable( 17 );
|
|
19863
19966
|
if ( parameters.opaque )
|
|
19864
|
-
_programLayers.enable(
|
|
19967
|
+
_programLayers.enable( 17 );
|
|
19865
19968
|
if ( parameters.pointsUvs )
|
|
19866
|
-
_programLayers.enable(
|
|
19969
|
+
_programLayers.enable( 18 );
|
|
19867
19970
|
|
|
19868
19971
|
array.push( _programLayers.mask );
|
|
19869
19972
|
|
|
@@ -21058,6 +21161,7 @@
|
|
|
21058
21161
|
this.needsUpdate = false;
|
|
21059
21162
|
|
|
21060
21163
|
this.type = PCFShadowMap;
|
|
21164
|
+
let _previousType = this.type;
|
|
21061
21165
|
|
|
21062
21166
|
this.render = function ( lights, scene, camera ) {
|
|
21063
21167
|
|
|
@@ -21078,6 +21182,11 @@
|
|
|
21078
21182
|
_state.buffers.depth.setTest( true );
|
|
21079
21183
|
_state.setScissorTest( false );
|
|
21080
21184
|
|
|
21185
|
+
// check for shadow map type changes
|
|
21186
|
+
|
|
21187
|
+
const toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );
|
|
21188
|
+
const fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );
|
|
21189
|
+
|
|
21081
21190
|
// render depth map
|
|
21082
21191
|
|
|
21083
21192
|
for ( let i = 0, il = lights.length; i < il; i ++ ) {
|
|
@@ -21122,10 +21231,16 @@
|
|
|
21122
21231
|
|
|
21123
21232
|
}
|
|
21124
21233
|
|
|
21125
|
-
if ( shadow.map === null ) {
|
|
21234
|
+
if ( shadow.map === null || toVSM === true || fromVSM === true ) {
|
|
21126
21235
|
|
|
21127
21236
|
const pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};
|
|
21128
21237
|
|
|
21238
|
+
if ( shadow.map !== null ) {
|
|
21239
|
+
|
|
21240
|
+
shadow.map.dispose();
|
|
21241
|
+
|
|
21242
|
+
}
|
|
21243
|
+
|
|
21129
21244
|
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
|
|
21130
21245
|
shadow.map.texture.name = light.name + '.shadowMap';
|
|
21131
21246
|
|
|
@@ -21171,6 +21286,8 @@
|
|
|
21171
21286
|
|
|
21172
21287
|
}
|
|
21173
21288
|
|
|
21289
|
+
_previousType = this.type;
|
|
21290
|
+
|
|
21174
21291
|
scope.needsUpdate = false;
|
|
21175
21292
|
|
|
21176
21293
|
_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );
|
|
@@ -21439,11 +21556,11 @@
|
|
|
21439
21556
|
|
|
21440
21557
|
if ( depthTest ) {
|
|
21441
21558
|
|
|
21442
|
-
enable(
|
|
21559
|
+
enable( gl.DEPTH_TEST );
|
|
21443
21560
|
|
|
21444
21561
|
} else {
|
|
21445
21562
|
|
|
21446
|
-
disable(
|
|
21563
|
+
disable( gl.DEPTH_TEST );
|
|
21447
21564
|
|
|
21448
21565
|
}
|
|
21449
21566
|
|
|
@@ -21468,47 +21585,47 @@
|
|
|
21468
21585
|
|
|
21469
21586
|
case NeverDepth:
|
|
21470
21587
|
|
|
21471
|
-
gl.depthFunc(
|
|
21588
|
+
gl.depthFunc( gl.NEVER );
|
|
21472
21589
|
break;
|
|
21473
21590
|
|
|
21474
21591
|
case AlwaysDepth:
|
|
21475
21592
|
|
|
21476
|
-
gl.depthFunc(
|
|
21593
|
+
gl.depthFunc( gl.ALWAYS );
|
|
21477
21594
|
break;
|
|
21478
21595
|
|
|
21479
21596
|
case LessDepth:
|
|
21480
21597
|
|
|
21481
|
-
gl.depthFunc(
|
|
21598
|
+
gl.depthFunc( gl.LESS );
|
|
21482
21599
|
break;
|
|
21483
21600
|
|
|
21484
21601
|
case LessEqualDepth:
|
|
21485
21602
|
|
|
21486
|
-
gl.depthFunc(
|
|
21603
|
+
gl.depthFunc( gl.LEQUAL );
|
|
21487
21604
|
break;
|
|
21488
21605
|
|
|
21489
21606
|
case EqualDepth:
|
|
21490
21607
|
|
|
21491
|
-
gl.depthFunc(
|
|
21608
|
+
gl.depthFunc( gl.EQUAL );
|
|
21492
21609
|
break;
|
|
21493
21610
|
|
|
21494
21611
|
case GreaterEqualDepth:
|
|
21495
21612
|
|
|
21496
|
-
gl.depthFunc(
|
|
21613
|
+
gl.depthFunc( gl.GEQUAL );
|
|
21497
21614
|
break;
|
|
21498
21615
|
|
|
21499
21616
|
case GreaterDepth:
|
|
21500
21617
|
|
|
21501
|
-
gl.depthFunc(
|
|
21618
|
+
gl.depthFunc( gl.GREATER );
|
|
21502
21619
|
break;
|
|
21503
21620
|
|
|
21504
21621
|
case NotEqualDepth:
|
|
21505
21622
|
|
|
21506
|
-
gl.depthFunc(
|
|
21623
|
+
gl.depthFunc( gl.NOTEQUAL );
|
|
21507
21624
|
break;
|
|
21508
21625
|
|
|
21509
21626
|
default:
|
|
21510
21627
|
|
|
21511
|
-
gl.depthFunc(
|
|
21628
|
+
gl.depthFunc( gl.LEQUAL );
|
|
21512
21629
|
|
|
21513
21630
|
}
|
|
21514
21631
|
|
|
@@ -21570,11 +21687,11 @@
|
|
|
21570
21687
|
|
|
21571
21688
|
if ( stencilTest ) {
|
|
21572
21689
|
|
|
21573
|
-
enable(
|
|
21690
|
+
enable( gl.STENCIL_TEST );
|
|
21574
21691
|
|
|
21575
21692
|
} else {
|
|
21576
21693
|
|
|
21577
|
-
disable(
|
|
21694
|
+
disable( gl.STENCIL_TEST );
|
|
21578
21695
|
|
|
21579
21696
|
}
|
|
21580
21697
|
|
|
@@ -21696,11 +21813,11 @@
|
|
|
21696
21813
|
let currentPolygonOffsetFactor = null;
|
|
21697
21814
|
let currentPolygonOffsetUnits = null;
|
|
21698
21815
|
|
|
21699
|
-
const maxTextures = gl.getParameter(
|
|
21816
|
+
const maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );
|
|
21700
21817
|
|
|
21701
21818
|
let lineWidthAvailable = false;
|
|
21702
21819
|
let version = 0;
|
|
21703
|
-
const glVersion = gl.getParameter(
|
|
21820
|
+
const glVersion = gl.getParameter( gl.VERSION );
|
|
21704
21821
|
|
|
21705
21822
|
if ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {
|
|
21706
21823
|
|
|
@@ -21717,24 +21834,32 @@
|
|
|
21717
21834
|
let currentTextureSlot = null;
|
|
21718
21835
|
let currentBoundTextures = {};
|
|
21719
21836
|
|
|
21720
|
-
const scissorParam = gl.getParameter(
|
|
21721
|
-
const viewportParam = gl.getParameter(
|
|
21837
|
+
const scissorParam = gl.getParameter( gl.SCISSOR_BOX );
|
|
21838
|
+
const viewportParam = gl.getParameter( gl.VIEWPORT );
|
|
21722
21839
|
|
|
21723
21840
|
const currentScissor = new Vector4().fromArray( scissorParam );
|
|
21724
21841
|
const currentViewport = new Vector4().fromArray( viewportParam );
|
|
21725
21842
|
|
|
21726
|
-
function createTexture( type, target, count ) {
|
|
21843
|
+
function createTexture( type, target, count, dimensions ) {
|
|
21727
21844
|
|
|
21728
21845
|
const data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.
|
|
21729
21846
|
const texture = gl.createTexture();
|
|
21730
21847
|
|
|
21731
21848
|
gl.bindTexture( type, texture );
|
|
21732
|
-
gl.texParameteri( type,
|
|
21733
|
-
gl.texParameteri( type,
|
|
21849
|
+
gl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );
|
|
21850
|
+
gl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );
|
|
21734
21851
|
|
|
21735
21852
|
for ( let i = 0; i < count; i ++ ) {
|
|
21736
21853
|
|
|
21737
|
-
|
|
21854
|
+
if ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {
|
|
21855
|
+
|
|
21856
|
+
gl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
|
|
21857
|
+
|
|
21858
|
+
} else {
|
|
21859
|
+
|
|
21860
|
+
gl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
|
|
21861
|
+
|
|
21862
|
+
}
|
|
21738
21863
|
|
|
21739
21864
|
}
|
|
21740
21865
|
|
|
@@ -21743,8 +21868,15 @@
|
|
|
21743
21868
|
}
|
|
21744
21869
|
|
|
21745
21870
|
const emptyTextures = {};
|
|
21746
|
-
emptyTextures[
|
|
21747
|
-
emptyTextures[
|
|
21871
|
+
emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
|
|
21872
|
+
emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
|
|
21873
|
+
|
|
21874
|
+
if ( isWebGL2 ) {
|
|
21875
|
+
|
|
21876
|
+
emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
|
|
21877
|
+
emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
|
|
21878
|
+
|
|
21879
|
+
}
|
|
21748
21880
|
|
|
21749
21881
|
// init
|
|
21750
21882
|
|
|
@@ -21752,12 +21884,12 @@
|
|
|
21752
21884
|
depthBuffer.setClear( 1 );
|
|
21753
21885
|
stencilBuffer.setClear( 0 );
|
|
21754
21886
|
|
|
21755
|
-
enable(
|
|
21887
|
+
enable( gl.DEPTH_TEST );
|
|
21756
21888
|
depthBuffer.setFunc( LessEqualDepth );
|
|
21757
21889
|
|
|
21758
21890
|
setFlipSided( false );
|
|
21759
21891
|
setCullFace( CullFaceBack );
|
|
21760
|
-
enable(
|
|
21892
|
+
enable( gl.CULL_FACE );
|
|
21761
21893
|
|
|
21762
21894
|
setBlending( NoBlending );
|
|
21763
21895
|
|
|
@@ -21795,17 +21927,17 @@
|
|
|
21795
21927
|
|
|
21796
21928
|
if ( isWebGL2 ) {
|
|
21797
21929
|
|
|
21798
|
-
//
|
|
21930
|
+
// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
|
|
21799
21931
|
|
|
21800
|
-
if ( target ===
|
|
21932
|
+
if ( target === gl.DRAW_FRAMEBUFFER ) {
|
|
21801
21933
|
|
|
21802
|
-
currentBoundFramebuffers[
|
|
21934
|
+
currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
|
|
21803
21935
|
|
|
21804
21936
|
}
|
|
21805
21937
|
|
|
21806
|
-
if ( target ===
|
|
21938
|
+
if ( target === gl.FRAMEBUFFER ) {
|
|
21807
21939
|
|
|
21808
|
-
currentBoundFramebuffers[
|
|
21940
|
+
currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
|
|
21809
21941
|
|
|
21810
21942
|
}
|
|
21811
21943
|
|
|
@@ -21840,11 +21972,11 @@
|
|
|
21840
21972
|
|
|
21841
21973
|
const textures = renderTarget.texture;
|
|
21842
21974
|
|
|
21843
|
-
if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !==
|
|
21975
|
+
if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
|
|
21844
21976
|
|
|
21845
21977
|
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
21846
21978
|
|
|
21847
|
-
drawBuffers[ i ] =
|
|
21979
|
+
drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
|
|
21848
21980
|
|
|
21849
21981
|
}
|
|
21850
21982
|
|
|
@@ -21856,9 +21988,9 @@
|
|
|
21856
21988
|
|
|
21857
21989
|
} else {
|
|
21858
21990
|
|
|
21859
|
-
if ( drawBuffers[ 0 ] !==
|
|
21991
|
+
if ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
|
|
21860
21992
|
|
|
21861
|
-
drawBuffers[ 0 ] =
|
|
21993
|
+
drawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;
|
|
21862
21994
|
|
|
21863
21995
|
needsUpdate = true;
|
|
21864
21996
|
|
|
@@ -21868,9 +22000,9 @@
|
|
|
21868
22000
|
|
|
21869
22001
|
} else {
|
|
21870
22002
|
|
|
21871
|
-
if ( drawBuffers[ 0 ] !==
|
|
22003
|
+
if ( drawBuffers[ 0 ] !== gl.BACK ) {
|
|
21872
22004
|
|
|
21873
|
-
drawBuffers[ 0 ] =
|
|
22005
|
+
drawBuffers[ 0 ] = gl.BACK;
|
|
21874
22006
|
|
|
21875
22007
|
needsUpdate = true;
|
|
21876
22008
|
|
|
@@ -21912,15 +22044,15 @@
|
|
|
21912
22044
|
}
|
|
21913
22045
|
|
|
21914
22046
|
const equationToGL = {
|
|
21915
|
-
[ AddEquation ]:
|
|
21916
|
-
[ SubtractEquation ]:
|
|
21917
|
-
[ ReverseSubtractEquation ]:
|
|
22047
|
+
[ AddEquation ]: gl.FUNC_ADD,
|
|
22048
|
+
[ SubtractEquation ]: gl.FUNC_SUBTRACT,
|
|
22049
|
+
[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT
|
|
21918
22050
|
};
|
|
21919
22051
|
|
|
21920
22052
|
if ( isWebGL2 ) {
|
|
21921
22053
|
|
|
21922
|
-
equationToGL[ MinEquation ] =
|
|
21923
|
-
equationToGL[ MaxEquation ] =
|
|
22054
|
+
equationToGL[ MinEquation ] = gl.MIN;
|
|
22055
|
+
equationToGL[ MaxEquation ] = gl.MAX;
|
|
21924
22056
|
|
|
21925
22057
|
} else {
|
|
21926
22058
|
|
|
@@ -21936,17 +22068,17 @@
|
|
|
21936
22068
|
}
|
|
21937
22069
|
|
|
21938
22070
|
const factorToGL = {
|
|
21939
|
-
[ ZeroFactor ]:
|
|
21940
|
-
[ OneFactor ]:
|
|
21941
|
-
[ SrcColorFactor ]:
|
|
21942
|
-
[ SrcAlphaFactor ]:
|
|
21943
|
-
[ SrcAlphaSaturateFactor ]:
|
|
21944
|
-
[ DstColorFactor ]:
|
|
21945
|
-
[ DstAlphaFactor ]:
|
|
21946
|
-
[ OneMinusSrcColorFactor ]:
|
|
21947
|
-
[ OneMinusSrcAlphaFactor ]:
|
|
21948
|
-
[ OneMinusDstColorFactor ]:
|
|
21949
|
-
[ OneMinusDstAlphaFactor ]:
|
|
22071
|
+
[ ZeroFactor ]: gl.ZERO,
|
|
22072
|
+
[ OneFactor ]: gl.ONE,
|
|
22073
|
+
[ SrcColorFactor ]: gl.SRC_COLOR,
|
|
22074
|
+
[ SrcAlphaFactor ]: gl.SRC_ALPHA,
|
|
22075
|
+
[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,
|
|
22076
|
+
[ DstColorFactor ]: gl.DST_COLOR,
|
|
22077
|
+
[ DstAlphaFactor ]: gl.DST_ALPHA,
|
|
22078
|
+
[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,
|
|
22079
|
+
[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,
|
|
22080
|
+
[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,
|
|
22081
|
+
[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA
|
|
21950
22082
|
};
|
|
21951
22083
|
|
|
21952
22084
|
function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {
|
|
@@ -21955,7 +22087,7 @@
|
|
|
21955
22087
|
|
|
21956
22088
|
if ( currentBlendingEnabled === true ) {
|
|
21957
22089
|
|
|
21958
|
-
disable(
|
|
22090
|
+
disable( gl.BLEND );
|
|
21959
22091
|
currentBlendingEnabled = false;
|
|
21960
22092
|
|
|
21961
22093
|
}
|
|
@@ -21966,7 +22098,7 @@
|
|
|
21966
22098
|
|
|
21967
22099
|
if ( currentBlendingEnabled === false ) {
|
|
21968
22100
|
|
|
21969
|
-
enable(
|
|
22101
|
+
enable( gl.BLEND );
|
|
21970
22102
|
currentBlendingEnabled = true;
|
|
21971
22103
|
|
|
21972
22104
|
}
|
|
@@ -21977,7 +22109,7 @@
|
|
|
21977
22109
|
|
|
21978
22110
|
if ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {
|
|
21979
22111
|
|
|
21980
|
-
gl.blendEquation(
|
|
22112
|
+
gl.blendEquation( gl.FUNC_ADD );
|
|
21981
22113
|
|
|
21982
22114
|
currentBlendEquation = AddEquation;
|
|
21983
22115
|
currentBlendEquationAlpha = AddEquation;
|
|
@@ -21989,19 +22121,19 @@
|
|
|
21989
22121
|
switch ( blending ) {
|
|
21990
22122
|
|
|
21991
22123
|
case NormalBlending:
|
|
21992
|
-
gl.blendFuncSeparate(
|
|
22124
|
+
gl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );
|
|
21993
22125
|
break;
|
|
21994
22126
|
|
|
21995
22127
|
case AdditiveBlending:
|
|
21996
|
-
gl.blendFunc(
|
|
22128
|
+
gl.blendFunc( gl.ONE, gl.ONE );
|
|
21997
22129
|
break;
|
|
21998
22130
|
|
|
21999
22131
|
case SubtractiveBlending:
|
|
22000
|
-
gl.blendFuncSeparate(
|
|
22132
|
+
gl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );
|
|
22001
22133
|
break;
|
|
22002
22134
|
|
|
22003
22135
|
case MultiplyBlending:
|
|
22004
|
-
gl.blendFuncSeparate(
|
|
22136
|
+
gl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );
|
|
22005
22137
|
break;
|
|
22006
22138
|
|
|
22007
22139
|
default:
|
|
@@ -22015,19 +22147,19 @@
|
|
|
22015
22147
|
switch ( blending ) {
|
|
22016
22148
|
|
|
22017
22149
|
case NormalBlending:
|
|
22018
|
-
gl.blendFuncSeparate(
|
|
22150
|
+
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );
|
|
22019
22151
|
break;
|
|
22020
22152
|
|
|
22021
22153
|
case AdditiveBlending:
|
|
22022
|
-
gl.blendFunc(
|
|
22154
|
+
gl.blendFunc( gl.SRC_ALPHA, gl.ONE );
|
|
22023
22155
|
break;
|
|
22024
22156
|
|
|
22025
22157
|
case SubtractiveBlending:
|
|
22026
|
-
gl.blendFuncSeparate(
|
|
22158
|
+
gl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );
|
|
22027
22159
|
break;
|
|
22028
22160
|
|
|
22029
22161
|
case MultiplyBlending:
|
|
22030
|
-
gl.blendFunc(
|
|
22162
|
+
gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
|
|
22031
22163
|
break;
|
|
22032
22164
|
|
|
22033
22165
|
default:
|
|
@@ -22086,8 +22218,8 @@
|
|
|
22086
22218
|
function setMaterial( material, frontFaceCW ) {
|
|
22087
22219
|
|
|
22088
22220
|
material.side === DoubleSide
|
|
22089
|
-
? disable(
|
|
22090
|
-
: enable(
|
|
22221
|
+
? disable( gl.CULL_FACE )
|
|
22222
|
+
: enable( gl.CULL_FACE );
|
|
22091
22223
|
|
|
22092
22224
|
let flipSided = ( material.side === BackSide );
|
|
22093
22225
|
if ( frontFaceCW ) flipSided = ! flipSided;
|
|
@@ -22116,8 +22248,8 @@
|
|
|
22116
22248
|
setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
|
|
22117
22249
|
|
|
22118
22250
|
material.alphaToCoverage === true
|
|
22119
|
-
? enable(
|
|
22120
|
-
: disable(
|
|
22251
|
+
? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )
|
|
22252
|
+
: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );
|
|
22121
22253
|
|
|
22122
22254
|
}
|
|
22123
22255
|
|
|
@@ -22129,11 +22261,11 @@
|
|
|
22129
22261
|
|
|
22130
22262
|
if ( flipSided ) {
|
|
22131
22263
|
|
|
22132
|
-
gl.frontFace(
|
|
22264
|
+
gl.frontFace( gl.CW );
|
|
22133
22265
|
|
|
22134
22266
|
} else {
|
|
22135
22267
|
|
|
22136
|
-
gl.frontFace(
|
|
22268
|
+
gl.frontFace( gl.CCW );
|
|
22137
22269
|
|
|
22138
22270
|
}
|
|
22139
22271
|
|
|
@@ -22147,21 +22279,21 @@
|
|
|
22147
22279
|
|
|
22148
22280
|
if ( cullFace !== CullFaceNone ) {
|
|
22149
22281
|
|
|
22150
|
-
enable(
|
|
22282
|
+
enable( gl.CULL_FACE );
|
|
22151
22283
|
|
|
22152
22284
|
if ( cullFace !== currentCullFace ) {
|
|
22153
22285
|
|
|
22154
22286
|
if ( cullFace === CullFaceBack ) {
|
|
22155
22287
|
|
|
22156
|
-
gl.cullFace(
|
|
22288
|
+
gl.cullFace( gl.BACK );
|
|
22157
22289
|
|
|
22158
22290
|
} else if ( cullFace === CullFaceFront ) {
|
|
22159
22291
|
|
|
22160
|
-
gl.cullFace(
|
|
22292
|
+
gl.cullFace( gl.FRONT );
|
|
22161
22293
|
|
|
22162
22294
|
} else {
|
|
22163
22295
|
|
|
22164
|
-
gl.cullFace(
|
|
22296
|
+
gl.cullFace( gl.FRONT_AND_BACK );
|
|
22165
22297
|
|
|
22166
22298
|
}
|
|
22167
22299
|
|
|
@@ -22169,7 +22301,7 @@
|
|
|
22169
22301
|
|
|
22170
22302
|
} else {
|
|
22171
22303
|
|
|
22172
|
-
disable(
|
|
22304
|
+
disable( gl.CULL_FACE );
|
|
22173
22305
|
|
|
22174
22306
|
}
|
|
22175
22307
|
|
|
@@ -22193,7 +22325,7 @@
|
|
|
22193
22325
|
|
|
22194
22326
|
if ( polygonOffset ) {
|
|
22195
22327
|
|
|
22196
|
-
enable(
|
|
22328
|
+
enable( gl.POLYGON_OFFSET_FILL );
|
|
22197
22329
|
|
|
22198
22330
|
if ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {
|
|
22199
22331
|
|
|
@@ -22206,7 +22338,7 @@
|
|
|
22206
22338
|
|
|
22207
22339
|
} else {
|
|
22208
22340
|
|
|
22209
|
-
disable(
|
|
22341
|
+
disable( gl.POLYGON_OFFSET_FILL );
|
|
22210
22342
|
|
|
22211
22343
|
}
|
|
22212
22344
|
|
|
@@ -22216,11 +22348,11 @@
|
|
|
22216
22348
|
|
|
22217
22349
|
if ( scissorTest ) {
|
|
22218
22350
|
|
|
22219
|
-
enable(
|
|
22351
|
+
enable( gl.SCISSOR_TEST );
|
|
22220
22352
|
|
|
22221
22353
|
} else {
|
|
22222
22354
|
|
|
22223
|
-
disable(
|
|
22355
|
+
disable( gl.SCISSOR_TEST );
|
|
22224
22356
|
|
|
22225
22357
|
}
|
|
22226
22358
|
|
|
@@ -22230,7 +22362,7 @@
|
|
|
22230
22362
|
|
|
22231
22363
|
function activeTexture( webglSlot ) {
|
|
22232
22364
|
|
|
22233
|
-
if ( webglSlot === undefined ) webglSlot =
|
|
22365
|
+
if ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;
|
|
22234
22366
|
|
|
22235
22367
|
if ( currentTextureSlot !== webglSlot ) {
|
|
22236
22368
|
|
|
@@ -22247,7 +22379,7 @@
|
|
|
22247
22379
|
|
|
22248
22380
|
if ( currentTextureSlot === null ) {
|
|
22249
22381
|
|
|
22250
|
-
webglSlot =
|
|
22382
|
+
webglSlot = gl.TEXTURE0 + maxTextures - 1;
|
|
22251
22383
|
|
|
22252
22384
|
} else {
|
|
22253
22385
|
|
|
@@ -22509,43 +22641,43 @@
|
|
|
22509
22641
|
|
|
22510
22642
|
// reset state
|
|
22511
22643
|
|
|
22512
|
-
gl.disable(
|
|
22513
|
-
gl.disable(
|
|
22514
|
-
gl.disable(
|
|
22515
|
-
gl.disable(
|
|
22516
|
-
gl.disable(
|
|
22517
|
-
gl.disable(
|
|
22518
|
-
gl.disable(
|
|
22644
|
+
gl.disable( gl.BLEND );
|
|
22645
|
+
gl.disable( gl.CULL_FACE );
|
|
22646
|
+
gl.disable( gl.DEPTH_TEST );
|
|
22647
|
+
gl.disable( gl.POLYGON_OFFSET_FILL );
|
|
22648
|
+
gl.disable( gl.SCISSOR_TEST );
|
|
22649
|
+
gl.disable( gl.STENCIL_TEST );
|
|
22650
|
+
gl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );
|
|
22519
22651
|
|
|
22520
|
-
gl.blendEquation(
|
|
22521
|
-
gl.blendFunc(
|
|
22522
|
-
gl.blendFuncSeparate(
|
|
22652
|
+
gl.blendEquation( gl.FUNC_ADD );
|
|
22653
|
+
gl.blendFunc( gl.ONE, gl.ZERO );
|
|
22654
|
+
gl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );
|
|
22523
22655
|
|
|
22524
22656
|
gl.colorMask( true, true, true, true );
|
|
22525
22657
|
gl.clearColor( 0, 0, 0, 0 );
|
|
22526
22658
|
|
|
22527
22659
|
gl.depthMask( true );
|
|
22528
|
-
gl.depthFunc(
|
|
22660
|
+
gl.depthFunc( gl.LESS );
|
|
22529
22661
|
gl.clearDepth( 1 );
|
|
22530
22662
|
|
|
22531
22663
|
gl.stencilMask( 0xffffffff );
|
|
22532
|
-
gl.stencilFunc(
|
|
22533
|
-
gl.stencilOp(
|
|
22664
|
+
gl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );
|
|
22665
|
+
gl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );
|
|
22534
22666
|
gl.clearStencil( 0 );
|
|
22535
22667
|
|
|
22536
|
-
gl.cullFace(
|
|
22537
|
-
gl.frontFace(
|
|
22668
|
+
gl.cullFace( gl.BACK );
|
|
22669
|
+
gl.frontFace( gl.CCW );
|
|
22538
22670
|
|
|
22539
22671
|
gl.polygonOffset( 0, 0 );
|
|
22540
22672
|
|
|
22541
|
-
gl.activeTexture(
|
|
22673
|
+
gl.activeTexture( gl.TEXTURE0 );
|
|
22542
22674
|
|
|
22543
|
-
gl.bindFramebuffer(
|
|
22675
|
+
gl.bindFramebuffer( gl.FRAMEBUFFER, null );
|
|
22544
22676
|
|
|
22545
22677
|
if ( isWebGL2 === true ) {
|
|
22546
22678
|
|
|
22547
|
-
gl.bindFramebuffer(
|
|
22548
|
-
gl.bindFramebuffer(
|
|
22679
|
+
gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
|
|
22680
|
+
gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
|
|
22549
22681
|
|
|
22550
22682
|
}
|
|
22551
22683
|
|
|
@@ -22782,7 +22914,7 @@
|
|
|
22782
22914
|
|
|
22783
22915
|
}
|
|
22784
22916
|
|
|
22785
|
-
function getInternalFormat( internalFormatName, glFormat, glType,
|
|
22917
|
+
function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
|
|
22786
22918
|
|
|
22787
22919
|
if ( isWebGL2 === false ) return glFormat;
|
|
22788
22920
|
|
|
@@ -22796,35 +22928,35 @@
|
|
|
22796
22928
|
|
|
22797
22929
|
let internalFormat = glFormat;
|
|
22798
22930
|
|
|
22799
|
-
if ( glFormat ===
|
|
22931
|
+
if ( glFormat === _gl.RED ) {
|
|
22800
22932
|
|
|
22801
|
-
if ( glType ===
|
|
22802
|
-
if ( glType ===
|
|
22803
|
-
if ( glType ===
|
|
22933
|
+
if ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;
|
|
22934
|
+
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;
|
|
22935
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;
|
|
22804
22936
|
|
|
22805
22937
|
}
|
|
22806
22938
|
|
|
22807
|
-
if ( glFormat ===
|
|
22939
|
+
if ( glFormat === _gl.RG ) {
|
|
22808
22940
|
|
|
22809
|
-
if ( glType ===
|
|
22810
|
-
if ( glType ===
|
|
22811
|
-
if ( glType ===
|
|
22941
|
+
if ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;
|
|
22942
|
+
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;
|
|
22943
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;
|
|
22812
22944
|
|
|
22813
22945
|
}
|
|
22814
22946
|
|
|
22815
|
-
if ( glFormat ===
|
|
22947
|
+
if ( glFormat === _gl.RGBA ) {
|
|
22816
22948
|
|
|
22817
|
-
if ( glType ===
|
|
22818
|
-
if ( glType ===
|
|
22819
|
-
if ( glType ===
|
|
22820
|
-
if ( glType ===
|
|
22821
|
-
if ( glType ===
|
|
22949
|
+
if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
|
|
22950
|
+
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
|
|
22951
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
22952
|
+
if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
|
|
22953
|
+
if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
|
|
22822
22954
|
|
|
22823
22955
|
}
|
|
22824
22956
|
|
|
22825
|
-
if ( internalFormat ===
|
|
22826
|
-
internalFormat ===
|
|
22827
|
-
internalFormat ===
|
|
22957
|
+
if ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||
|
|
22958
|
+
internalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||
|
|
22959
|
+
internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {
|
|
22828
22960
|
|
|
22829
22961
|
extensions.get( 'EXT_color_buffer_float' );
|
|
22830
22962
|
|
|
@@ -22866,11 +22998,11 @@
|
|
|
22866
22998
|
|
|
22867
22999
|
if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {
|
|
22868
23000
|
|
|
22869
|
-
return
|
|
23001
|
+
return _gl.NEAREST;
|
|
22870
23002
|
|
|
22871
23003
|
}
|
|
22872
23004
|
|
|
22873
|
-
return
|
|
23005
|
+
return _gl.LINEAR;
|
|
22874
23006
|
|
|
22875
23007
|
}
|
|
22876
23008
|
|
|
@@ -23073,7 +23205,7 @@
|
|
|
23073
23205
|
array.push( texture.premultiplyAlpha );
|
|
23074
23206
|
array.push( texture.flipY );
|
|
23075
23207
|
array.push( texture.unpackAlignment );
|
|
23076
|
-
array.push( texture.
|
|
23208
|
+
array.push( texture.colorSpace );
|
|
23077
23209
|
|
|
23078
23210
|
return array.join();
|
|
23079
23211
|
|
|
@@ -23108,7 +23240,7 @@
|
|
|
23108
23240
|
|
|
23109
23241
|
}
|
|
23110
23242
|
|
|
23111
|
-
state.bindTexture(
|
|
23243
|
+
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
23112
23244
|
|
|
23113
23245
|
}
|
|
23114
23246
|
|
|
@@ -23123,7 +23255,7 @@
|
|
|
23123
23255
|
|
|
23124
23256
|
}
|
|
23125
23257
|
|
|
23126
|
-
state.bindTexture(
|
|
23258
|
+
state.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
23127
23259
|
|
|
23128
23260
|
}
|
|
23129
23261
|
|
|
@@ -23138,7 +23270,7 @@
|
|
|
23138
23270
|
|
|
23139
23271
|
}
|
|
23140
23272
|
|
|
23141
|
-
state.bindTexture(
|
|
23273
|
+
state.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
23142
23274
|
|
|
23143
23275
|
}
|
|
23144
23276
|
|
|
@@ -23153,50 +23285,50 @@
|
|
|
23153
23285
|
|
|
23154
23286
|
}
|
|
23155
23287
|
|
|
23156
|
-
state.bindTexture(
|
|
23288
|
+
state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
23157
23289
|
|
|
23158
23290
|
}
|
|
23159
23291
|
|
|
23160
23292
|
const wrappingToGL = {
|
|
23161
|
-
[ RepeatWrapping ]:
|
|
23162
|
-
[ ClampToEdgeWrapping ]:
|
|
23163
|
-
[ MirroredRepeatWrapping ]:
|
|
23293
|
+
[ RepeatWrapping ]: _gl.REPEAT,
|
|
23294
|
+
[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,
|
|
23295
|
+
[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT
|
|
23164
23296
|
};
|
|
23165
23297
|
|
|
23166
23298
|
const filterToGL = {
|
|
23167
|
-
[ NearestFilter ]:
|
|
23168
|
-
[ NearestMipmapNearestFilter ]:
|
|
23169
|
-
[ NearestMipmapLinearFilter ]:
|
|
23299
|
+
[ NearestFilter ]: _gl.NEAREST,
|
|
23300
|
+
[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,
|
|
23301
|
+
[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,
|
|
23170
23302
|
|
|
23171
|
-
[ LinearFilter ]:
|
|
23172
|
-
[ LinearMipmapNearestFilter ]:
|
|
23173
|
-
[ LinearMipmapLinearFilter ]:
|
|
23303
|
+
[ LinearFilter ]: _gl.LINEAR,
|
|
23304
|
+
[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,
|
|
23305
|
+
[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR
|
|
23174
23306
|
};
|
|
23175
23307
|
|
|
23176
23308
|
function setTextureParameters( textureType, texture, supportsMips ) {
|
|
23177
23309
|
|
|
23178
23310
|
if ( supportsMips ) {
|
|
23179
23311
|
|
|
23180
|
-
_gl.texParameteri( textureType,
|
|
23181
|
-
_gl.texParameteri( textureType,
|
|
23312
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
|
|
23313
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
|
|
23182
23314
|
|
|
23183
|
-
if ( textureType ===
|
|
23315
|
+
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
23184
23316
|
|
|
23185
|
-
_gl.texParameteri( textureType,
|
|
23317
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
|
|
23186
23318
|
|
|
23187
23319
|
}
|
|
23188
23320
|
|
|
23189
|
-
_gl.texParameteri( textureType,
|
|
23190
|
-
_gl.texParameteri( textureType,
|
|
23321
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
|
|
23322
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
|
|
23191
23323
|
|
|
23192
23324
|
} else {
|
|
23193
23325
|
|
|
23194
|
-
_gl.texParameteri( textureType,
|
|
23195
|
-
_gl.texParameteri( textureType,
|
|
23326
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
|
|
23327
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
|
|
23196
23328
|
|
|
23197
|
-
if ( textureType ===
|
|
23329
|
+
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
23198
23330
|
|
|
23199
|
-
_gl.texParameteri( textureType,
|
|
23331
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
|
|
23200
23332
|
|
|
23201
23333
|
}
|
|
23202
23334
|
|
|
@@ -23206,8 +23338,8 @@
|
|
|
23206
23338
|
|
|
23207
23339
|
}
|
|
23208
23340
|
|
|
23209
|
-
_gl.texParameteri( textureType,
|
|
23210
|
-
_gl.texParameteri( textureType,
|
|
23341
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );
|
|
23342
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );
|
|
23211
23343
|
|
|
23212
23344
|
if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {
|
|
23213
23345
|
|
|
@@ -23319,36 +23451,36 @@
|
|
|
23319
23451
|
|
|
23320
23452
|
function uploadTexture( textureProperties, texture, slot ) {
|
|
23321
23453
|
|
|
23322
|
-
let textureType =
|
|
23454
|
+
let textureType = _gl.TEXTURE_2D;
|
|
23323
23455
|
|
|
23324
|
-
if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType =
|
|
23325
|
-
if ( texture.isData3DTexture ) textureType =
|
|
23456
|
+
if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
23457
|
+
if ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;
|
|
23326
23458
|
|
|
23327
23459
|
const forceUpload = initTexture( textureProperties, texture );
|
|
23328
23460
|
const source = texture.source;
|
|
23329
23461
|
|
|
23330
|
-
state.bindTexture( textureType, textureProperties.__webglTexture,
|
|
23462
|
+
state.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
23331
23463
|
|
|
23332
23464
|
const sourceProperties = properties.get( source );
|
|
23333
23465
|
|
|
23334
23466
|
if ( source.version !== sourceProperties.__version || forceUpload === true ) {
|
|
23335
23467
|
|
|
23336
|
-
state.activeTexture(
|
|
23468
|
+
state.activeTexture( _gl.TEXTURE0 + slot );
|
|
23337
23469
|
|
|
23338
|
-
_gl.pixelStorei(
|
|
23339
|
-
_gl.pixelStorei(
|
|
23340
|
-
_gl.pixelStorei(
|
|
23341
|
-
_gl.pixelStorei(
|
|
23470
|
+
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
23471
|
+
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
23472
|
+
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
23473
|
+
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
|
|
23342
23474
|
|
|
23343
23475
|
const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
|
|
23344
23476
|
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
23345
23477
|
image = verifyColorSpace( texture, image );
|
|
23346
23478
|
|
|
23347
23479
|
const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23348
|
-
glFormat = utils.convert( texture.format, texture.
|
|
23480
|
+
glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
23349
23481
|
|
|
23350
23482
|
let glType = utils.convert( texture.type ),
|
|
23351
|
-
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.
|
|
23483
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
23352
23484
|
|
|
23353
23485
|
setTextureParameters( textureType, texture, supportsMips );
|
|
23354
23486
|
|
|
@@ -23363,25 +23495,25 @@
|
|
|
23363
23495
|
|
|
23364
23496
|
// populate depth texture with dummy data
|
|
23365
23497
|
|
|
23366
|
-
glInternalFormat =
|
|
23498
|
+
glInternalFormat = _gl.DEPTH_COMPONENT;
|
|
23367
23499
|
|
|
23368
23500
|
if ( isWebGL2 ) {
|
|
23369
23501
|
|
|
23370
23502
|
if ( texture.type === FloatType ) {
|
|
23371
23503
|
|
|
23372
|
-
glInternalFormat =
|
|
23504
|
+
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
23373
23505
|
|
|
23374
23506
|
} else if ( texture.type === UnsignedIntType ) {
|
|
23375
23507
|
|
|
23376
|
-
glInternalFormat =
|
|
23508
|
+
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
23377
23509
|
|
|
23378
23510
|
} else if ( texture.type === UnsignedInt248Type ) {
|
|
23379
23511
|
|
|
23380
|
-
glInternalFormat =
|
|
23512
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
23381
23513
|
|
|
23382
23514
|
} else {
|
|
23383
23515
|
|
|
23384
|
-
glInternalFormat =
|
|
23516
|
+
glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
|
|
23385
23517
|
|
|
23386
23518
|
}
|
|
23387
23519
|
|
|
@@ -23397,7 +23529,7 @@
|
|
|
23397
23529
|
|
|
23398
23530
|
// validation checks for WebGL 1
|
|
23399
23531
|
|
|
23400
|
-
if ( texture.format === DepthFormat && glInternalFormat ===
|
|
23532
|
+
if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
|
|
23401
23533
|
|
|
23402
23534
|
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
23403
23535
|
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
@@ -23413,11 +23545,11 @@
|
|
|
23413
23545
|
|
|
23414
23546
|
}
|
|
23415
23547
|
|
|
23416
|
-
if ( texture.format === DepthStencilFormat && glInternalFormat ===
|
|
23548
|
+
if ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
|
|
23417
23549
|
|
|
23418
23550
|
// Depth stencil textures need the DEPTH_STENCIL internal format
|
|
23419
23551
|
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
23420
|
-
glInternalFormat =
|
|
23552
|
+
glInternalFormat = _gl.DEPTH_STENCIL;
|
|
23421
23553
|
|
|
23422
23554
|
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
23423
23555
|
// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
|
|
@@ -23439,11 +23571,11 @@
|
|
|
23439
23571
|
|
|
23440
23572
|
if ( useTexStorage ) {
|
|
23441
23573
|
|
|
23442
|
-
state.texStorage2D(
|
|
23574
|
+
state.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );
|
|
23443
23575
|
|
|
23444
23576
|
} else {
|
|
23445
23577
|
|
|
23446
|
-
state.texImage2D(
|
|
23578
|
+
state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
23447
23579
|
|
|
23448
23580
|
}
|
|
23449
23581
|
|
|
@@ -23459,7 +23591,7 @@
|
|
|
23459
23591
|
|
|
23460
23592
|
if ( useTexStorage && allocateMemory ) {
|
|
23461
23593
|
|
|
23462
|
-
state.texStorage2D(
|
|
23594
|
+
state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
23463
23595
|
|
|
23464
23596
|
}
|
|
23465
23597
|
|
|
@@ -23469,11 +23601,11 @@
|
|
|
23469
23601
|
|
|
23470
23602
|
if ( useTexStorage ) {
|
|
23471
23603
|
|
|
23472
|
-
state.texSubImage2D(
|
|
23604
|
+
state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23473
23605
|
|
|
23474
23606
|
} else {
|
|
23475
23607
|
|
|
23476
|
-
state.texImage2D(
|
|
23608
|
+
state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23477
23609
|
|
|
23478
23610
|
}
|
|
23479
23611
|
|
|
@@ -23487,15 +23619,15 @@
|
|
|
23487
23619
|
|
|
23488
23620
|
if ( allocateMemory ) {
|
|
23489
23621
|
|
|
23490
|
-
state.texStorage2D(
|
|
23622
|
+
state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
|
|
23491
23623
|
|
|
23492
23624
|
}
|
|
23493
23625
|
|
|
23494
|
-
state.texSubImage2D(
|
|
23626
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
23495
23627
|
|
|
23496
23628
|
} else {
|
|
23497
23629
|
|
|
23498
|
-
state.texImage2D(
|
|
23630
|
+
state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
23499
23631
|
|
|
23500
23632
|
}
|
|
23501
23633
|
|
|
@@ -23507,7 +23639,7 @@
|
|
|
23507
23639
|
|
|
23508
23640
|
if ( useTexStorage && allocateMemory ) {
|
|
23509
23641
|
|
|
23510
|
-
state.texStorage3D(
|
|
23642
|
+
state.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );
|
|
23511
23643
|
|
|
23512
23644
|
}
|
|
23513
23645
|
|
|
@@ -23521,11 +23653,11 @@
|
|
|
23521
23653
|
|
|
23522
23654
|
if ( useTexStorage ) {
|
|
23523
23655
|
|
|
23524
|
-
state.compressedTexSubImage3D(
|
|
23656
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
|
|
23525
23657
|
|
|
23526
23658
|
} else {
|
|
23527
23659
|
|
|
23528
|
-
state.compressedTexImage3D(
|
|
23660
|
+
state.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );
|
|
23529
23661
|
|
|
23530
23662
|
}
|
|
23531
23663
|
|
|
@@ -23539,11 +23671,11 @@
|
|
|
23539
23671
|
|
|
23540
23672
|
if ( useTexStorage ) {
|
|
23541
23673
|
|
|
23542
|
-
state.texSubImage3D(
|
|
23674
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );
|
|
23543
23675
|
|
|
23544
23676
|
} else {
|
|
23545
23677
|
|
|
23546
|
-
state.texImage3D(
|
|
23678
|
+
state.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );
|
|
23547
23679
|
|
|
23548
23680
|
}
|
|
23549
23681
|
|
|
@@ -23555,7 +23687,7 @@
|
|
|
23555
23687
|
|
|
23556
23688
|
if ( useTexStorage && allocateMemory ) {
|
|
23557
23689
|
|
|
23558
|
-
state.texStorage2D(
|
|
23690
|
+
state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
23559
23691
|
|
|
23560
23692
|
}
|
|
23561
23693
|
|
|
@@ -23569,11 +23701,11 @@
|
|
|
23569
23701
|
|
|
23570
23702
|
if ( useTexStorage ) {
|
|
23571
23703
|
|
|
23572
|
-
state.compressedTexSubImage2D(
|
|
23704
|
+
state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
23573
23705
|
|
|
23574
23706
|
} else {
|
|
23575
23707
|
|
|
23576
|
-
state.compressedTexImage2D(
|
|
23708
|
+
state.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
23577
23709
|
|
|
23578
23710
|
}
|
|
23579
23711
|
|
|
@@ -23587,11 +23719,11 @@
|
|
|
23587
23719
|
|
|
23588
23720
|
if ( useTexStorage ) {
|
|
23589
23721
|
|
|
23590
|
-
state.texSubImage2D(
|
|
23722
|
+
state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23591
23723
|
|
|
23592
23724
|
} else {
|
|
23593
23725
|
|
|
23594
|
-
state.texImage2D(
|
|
23726
|
+
state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23595
23727
|
|
|
23596
23728
|
}
|
|
23597
23729
|
|
|
@@ -23607,15 +23739,15 @@
|
|
|
23607
23739
|
|
|
23608
23740
|
if ( allocateMemory ) {
|
|
23609
23741
|
|
|
23610
|
-
state.texStorage3D(
|
|
23742
|
+
state.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
23611
23743
|
|
|
23612
23744
|
}
|
|
23613
23745
|
|
|
23614
|
-
state.texSubImage3D(
|
|
23746
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
23615
23747
|
|
|
23616
23748
|
} else {
|
|
23617
23749
|
|
|
23618
|
-
state.texImage3D(
|
|
23750
|
+
state.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
23619
23751
|
|
|
23620
23752
|
}
|
|
23621
23753
|
|
|
@@ -23625,15 +23757,15 @@
|
|
|
23625
23757
|
|
|
23626
23758
|
if ( allocateMemory ) {
|
|
23627
23759
|
|
|
23628
|
-
state.texStorage3D(
|
|
23760
|
+
state.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
23629
23761
|
|
|
23630
23762
|
}
|
|
23631
23763
|
|
|
23632
|
-
state.texSubImage3D(
|
|
23764
|
+
state.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
23633
23765
|
|
|
23634
23766
|
} else {
|
|
23635
23767
|
|
|
23636
|
-
state.texImage3D(
|
|
23768
|
+
state.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
23637
23769
|
|
|
23638
23770
|
}
|
|
23639
23771
|
|
|
@@ -23643,7 +23775,7 @@
|
|
|
23643
23775
|
|
|
23644
23776
|
if ( useTexStorage ) {
|
|
23645
23777
|
|
|
23646
|
-
state.texStorage2D(
|
|
23778
|
+
state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
|
|
23647
23779
|
|
|
23648
23780
|
} else {
|
|
23649
23781
|
|
|
@@ -23651,7 +23783,7 @@
|
|
|
23651
23783
|
|
|
23652
23784
|
for ( let i = 0; i < levels; i ++ ) {
|
|
23653
23785
|
|
|
23654
|
-
state.texImage2D(
|
|
23786
|
+
state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );
|
|
23655
23787
|
|
|
23656
23788
|
width >>= 1;
|
|
23657
23789
|
height >>= 1;
|
|
@@ -23674,7 +23806,7 @@
|
|
|
23674
23806
|
|
|
23675
23807
|
if ( useTexStorage && allocateMemory ) {
|
|
23676
23808
|
|
|
23677
|
-
state.texStorage2D(
|
|
23809
|
+
state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
23678
23810
|
|
|
23679
23811
|
}
|
|
23680
23812
|
|
|
@@ -23684,11 +23816,11 @@
|
|
|
23684
23816
|
|
|
23685
23817
|
if ( useTexStorage ) {
|
|
23686
23818
|
|
|
23687
|
-
state.texSubImage2D(
|
|
23819
|
+
state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );
|
|
23688
23820
|
|
|
23689
23821
|
} else {
|
|
23690
23822
|
|
|
23691
|
-
state.texImage2D(
|
|
23823
|
+
state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );
|
|
23692
23824
|
|
|
23693
23825
|
}
|
|
23694
23826
|
|
|
@@ -23702,15 +23834,15 @@
|
|
|
23702
23834
|
|
|
23703
23835
|
if ( allocateMemory ) {
|
|
23704
23836
|
|
|
23705
|
-
state.texStorage2D(
|
|
23837
|
+
state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
|
|
23706
23838
|
|
|
23707
23839
|
}
|
|
23708
23840
|
|
|
23709
|
-
state.texSubImage2D(
|
|
23841
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );
|
|
23710
23842
|
|
|
23711
23843
|
} else {
|
|
23712
23844
|
|
|
23713
|
-
state.texImage2D(
|
|
23845
|
+
state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );
|
|
23714
23846
|
|
|
23715
23847
|
}
|
|
23716
23848
|
|
|
@@ -23741,18 +23873,18 @@
|
|
|
23741
23873
|
const forceUpload = initTexture( textureProperties, texture );
|
|
23742
23874
|
const source = texture.source;
|
|
23743
23875
|
|
|
23744
|
-
state.bindTexture(
|
|
23876
|
+
state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
23745
23877
|
|
|
23746
23878
|
const sourceProperties = properties.get( source );
|
|
23747
23879
|
|
|
23748
23880
|
if ( source.version !== sourceProperties.__version || forceUpload === true ) {
|
|
23749
23881
|
|
|
23750
|
-
state.activeTexture(
|
|
23882
|
+
state.activeTexture( _gl.TEXTURE0 + slot );
|
|
23751
23883
|
|
|
23752
|
-
_gl.pixelStorei(
|
|
23753
|
-
_gl.pixelStorei(
|
|
23754
|
-
_gl.pixelStorei(
|
|
23755
|
-
_gl.pixelStorei(
|
|
23884
|
+
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
23885
|
+
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
23886
|
+
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
23887
|
+
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
|
|
23756
23888
|
|
|
23757
23889
|
const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
|
|
23758
23890
|
const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
|
|
@@ -23777,15 +23909,15 @@
|
|
|
23777
23909
|
|
|
23778
23910
|
const image = cubeImage[ 0 ],
|
|
23779
23911
|
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23780
|
-
glFormat = utils.convert( texture.format, texture.
|
|
23912
|
+
glFormat = utils.convert( texture.format, texture.colorSpace ),
|
|
23781
23913
|
glType = utils.convert( texture.type ),
|
|
23782
|
-
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.
|
|
23914
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
23783
23915
|
|
|
23784
23916
|
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
23785
23917
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
23786
23918
|
let levels = getMipLevels( texture, image, supportsMips );
|
|
23787
23919
|
|
|
23788
|
-
setTextureParameters(
|
|
23920
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
|
|
23789
23921
|
|
|
23790
23922
|
let mipmaps;
|
|
23791
23923
|
|
|
@@ -23793,7 +23925,7 @@
|
|
|
23793
23925
|
|
|
23794
23926
|
if ( useTexStorage && allocateMemory ) {
|
|
23795
23927
|
|
|
23796
|
-
state.texStorage2D(
|
|
23928
|
+
state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );
|
|
23797
23929
|
|
|
23798
23930
|
}
|
|
23799
23931
|
|
|
@@ -23811,11 +23943,11 @@
|
|
|
23811
23943
|
|
|
23812
23944
|
if ( useTexStorage ) {
|
|
23813
23945
|
|
|
23814
|
-
state.compressedTexSubImage2D(
|
|
23946
|
+
state.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
23815
23947
|
|
|
23816
23948
|
} else {
|
|
23817
23949
|
|
|
23818
|
-
state.compressedTexImage2D(
|
|
23950
|
+
state.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
23819
23951
|
|
|
23820
23952
|
}
|
|
23821
23953
|
|
|
@@ -23829,11 +23961,11 @@
|
|
|
23829
23961
|
|
|
23830
23962
|
if ( useTexStorage ) {
|
|
23831
23963
|
|
|
23832
|
-
state.texSubImage2D(
|
|
23964
|
+
state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23833
23965
|
|
|
23834
23966
|
} else {
|
|
23835
23967
|
|
|
23836
|
-
state.texImage2D(
|
|
23968
|
+
state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23837
23969
|
|
|
23838
23970
|
}
|
|
23839
23971
|
|
|
@@ -23855,7 +23987,7 @@
|
|
|
23855
23987
|
|
|
23856
23988
|
if ( mipmaps.length > 0 ) levels ++;
|
|
23857
23989
|
|
|
23858
|
-
state.texStorage2D(
|
|
23990
|
+
state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
|
|
23859
23991
|
|
|
23860
23992
|
}
|
|
23861
23993
|
|
|
@@ -23865,11 +23997,11 @@
|
|
|
23865
23997
|
|
|
23866
23998
|
if ( useTexStorage ) {
|
|
23867
23999
|
|
|
23868
|
-
state.texSubImage2D(
|
|
24000
|
+
state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
|
|
23869
24001
|
|
|
23870
24002
|
} else {
|
|
23871
24003
|
|
|
23872
|
-
state.texImage2D(
|
|
24004
|
+
state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
|
|
23873
24005
|
|
|
23874
24006
|
}
|
|
23875
24007
|
|
|
@@ -23880,11 +24012,11 @@
|
|
|
23880
24012
|
|
|
23881
24013
|
if ( useTexStorage ) {
|
|
23882
24014
|
|
|
23883
|
-
state.texSubImage2D(
|
|
24015
|
+
state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
|
|
23884
24016
|
|
|
23885
24017
|
} else {
|
|
23886
24018
|
|
|
23887
|
-
state.texImage2D(
|
|
24019
|
+
state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );
|
|
23888
24020
|
|
|
23889
24021
|
}
|
|
23890
24022
|
|
|
@@ -23894,11 +24026,11 @@
|
|
|
23894
24026
|
|
|
23895
24027
|
if ( useTexStorage ) {
|
|
23896
24028
|
|
|
23897
|
-
state.texSubImage2D(
|
|
24029
|
+
state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
|
|
23898
24030
|
|
|
23899
24031
|
} else {
|
|
23900
24032
|
|
|
23901
|
-
state.texImage2D(
|
|
24033
|
+
state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );
|
|
23902
24034
|
|
|
23903
24035
|
}
|
|
23904
24036
|
|
|
@@ -23908,11 +24040,11 @@
|
|
|
23908
24040
|
|
|
23909
24041
|
if ( useTexStorage ) {
|
|
23910
24042
|
|
|
23911
|
-
state.texSubImage2D(
|
|
24043
|
+
state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
|
|
23912
24044
|
|
|
23913
24045
|
} else {
|
|
23914
24046
|
|
|
23915
|
-
state.texImage2D(
|
|
24047
|
+
state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );
|
|
23916
24048
|
|
|
23917
24049
|
}
|
|
23918
24050
|
|
|
@@ -23927,7 +24059,7 @@
|
|
|
23927
24059
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23928
24060
|
|
|
23929
24061
|
// We assume images for cube map have the same size.
|
|
23930
|
-
generateMipmap(
|
|
24062
|
+
generateMipmap( _gl.TEXTURE_CUBE_MAP );
|
|
23931
24063
|
|
|
23932
24064
|
}
|
|
23933
24065
|
|
|
@@ -23946,14 +24078,14 @@
|
|
|
23946
24078
|
// Setup storage for target texture and bind it to correct framebuffer
|
|
23947
24079
|
function setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget ) {
|
|
23948
24080
|
|
|
23949
|
-
const glFormat = utils.convert( texture.format, texture.
|
|
24081
|
+
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
23950
24082
|
const glType = utils.convert( texture.type );
|
|
23951
|
-
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.
|
|
24083
|
+
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
23952
24084
|
const renderTargetProperties = properties.get( renderTarget );
|
|
23953
24085
|
|
|
23954
24086
|
if ( ! renderTargetProperties.__hasExternalTextures ) {
|
|
23955
24087
|
|
|
23956
|
-
if ( textureTarget ===
|
|
24088
|
+
if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
23957
24089
|
|
|
23958
24090
|
state.texImage3D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null );
|
|
23959
24091
|
|
|
@@ -23965,19 +24097,19 @@
|
|
|
23965
24097
|
|
|
23966
24098
|
}
|
|
23967
24099
|
|
|
23968
|
-
state.bindFramebuffer(
|
|
24100
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
23969
24101
|
|
|
23970
24102
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23971
24103
|
|
|
23972
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT(
|
|
24104
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
23973
24105
|
|
|
23974
|
-
} else if ( textureTarget ===
|
|
24106
|
+
} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
|
|
23975
24107
|
|
|
23976
|
-
_gl.framebufferTexture2D(
|
|
24108
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 );
|
|
23977
24109
|
|
|
23978
24110
|
}
|
|
23979
24111
|
|
|
23980
|
-
state.bindFramebuffer(
|
|
24112
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, null );
|
|
23981
24113
|
|
|
23982
24114
|
}
|
|
23983
24115
|
|
|
@@ -23985,11 +24117,11 @@
|
|
|
23985
24117
|
// Setup storage for internal depth/stencil buffers and bind to correct framebuffer
|
|
23986
24118
|
function setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {
|
|
23987
24119
|
|
|
23988
|
-
_gl.bindRenderbuffer(
|
|
24120
|
+
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
23989
24121
|
|
|
23990
24122
|
if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
23991
24123
|
|
|
23992
|
-
let glInternalFormat =
|
|
24124
|
+
let glInternalFormat = _gl.DEPTH_COMPONENT16;
|
|
23993
24125
|
|
|
23994
24126
|
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
23995
24127
|
|
|
@@ -23999,11 +24131,11 @@
|
|
|
23999
24131
|
|
|
24000
24132
|
if ( depthTexture.type === FloatType ) {
|
|
24001
24133
|
|
|
24002
|
-
glInternalFormat =
|
|
24134
|
+
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
24003
24135
|
|
|
24004
24136
|
} else if ( depthTexture.type === UnsignedIntType ) {
|
|
24005
24137
|
|
|
24006
|
-
glInternalFormat =
|
|
24138
|
+
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24007
24139
|
|
|
24008
24140
|
}
|
|
24009
24141
|
|
|
@@ -24013,21 +24145,21 @@
|
|
|
24013
24145
|
|
|
24014
24146
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
24015
24147
|
|
|
24016
|
-
multisampledRTTExt.renderbufferStorageMultisampleEXT(
|
|
24148
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24017
24149
|
|
|
24018
24150
|
} else {
|
|
24019
24151
|
|
|
24020
|
-
_gl.renderbufferStorageMultisample(
|
|
24152
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24021
24153
|
|
|
24022
24154
|
}
|
|
24023
24155
|
|
|
24024
24156
|
} else {
|
|
24025
24157
|
|
|
24026
|
-
_gl.renderbufferStorage(
|
|
24158
|
+
_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24027
24159
|
|
|
24028
24160
|
}
|
|
24029
24161
|
|
|
24030
|
-
_gl.framebufferRenderbuffer(
|
|
24162
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );
|
|
24031
24163
|
|
|
24032
24164
|
} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {
|
|
24033
24165
|
|
|
@@ -24035,20 +24167,20 @@
|
|
|
24035
24167
|
|
|
24036
24168
|
if ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {
|
|
24037
24169
|
|
|
24038
|
-
_gl.renderbufferStorageMultisample(
|
|
24170
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );
|
|
24039
24171
|
|
|
24040
24172
|
} else if ( useMultisampledRTT( renderTarget ) ) {
|
|
24041
24173
|
|
|
24042
|
-
multisampledRTTExt.renderbufferStorageMultisampleEXT(
|
|
24174
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );
|
|
24043
24175
|
|
|
24044
24176
|
} else {
|
|
24045
24177
|
|
|
24046
|
-
_gl.renderbufferStorage(
|
|
24178
|
+
_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );
|
|
24047
24179
|
|
|
24048
24180
|
}
|
|
24049
24181
|
|
|
24050
24182
|
|
|
24051
|
-
_gl.framebufferRenderbuffer(
|
|
24183
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );
|
|
24052
24184
|
|
|
24053
24185
|
} else {
|
|
24054
24186
|
|
|
@@ -24058,22 +24190,22 @@
|
|
|
24058
24190
|
|
|
24059
24191
|
const texture = textures[ i ];
|
|
24060
24192
|
|
|
24061
|
-
const glFormat = utils.convert( texture.format, texture.
|
|
24193
|
+
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24062
24194
|
const glType = utils.convert( texture.type );
|
|
24063
|
-
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.
|
|
24195
|
+
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
24064
24196
|
const samples = getRenderTargetSamples( renderTarget );
|
|
24065
24197
|
|
|
24066
24198
|
if ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {
|
|
24067
24199
|
|
|
24068
|
-
_gl.renderbufferStorageMultisample(
|
|
24200
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24069
24201
|
|
|
24070
24202
|
} else if ( useMultisampledRTT( renderTarget ) ) {
|
|
24071
24203
|
|
|
24072
|
-
multisampledRTTExt.renderbufferStorageMultisampleEXT(
|
|
24204
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24073
24205
|
|
|
24074
24206
|
} else {
|
|
24075
24207
|
|
|
24076
|
-
_gl.renderbufferStorage(
|
|
24208
|
+
_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24077
24209
|
|
|
24078
24210
|
}
|
|
24079
24211
|
|
|
@@ -24081,7 +24213,7 @@
|
|
|
24081
24213
|
|
|
24082
24214
|
}
|
|
24083
24215
|
|
|
24084
|
-
_gl.bindRenderbuffer(
|
|
24216
|
+
_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );
|
|
24085
24217
|
|
|
24086
24218
|
}
|
|
24087
24219
|
|
|
@@ -24091,7 +24223,7 @@
|
|
|
24091
24223
|
const isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );
|
|
24092
24224
|
if ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );
|
|
24093
24225
|
|
|
24094
|
-
state.bindFramebuffer(
|
|
24226
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
24095
24227
|
|
|
24096
24228
|
if ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {
|
|
24097
24229
|
|
|
@@ -24119,11 +24251,11 @@
|
|
|
24119
24251
|
|
|
24120
24252
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
24121
24253
|
|
|
24122
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT(
|
|
24254
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
24123
24255
|
|
|
24124
24256
|
} else {
|
|
24125
24257
|
|
|
24126
|
-
_gl.framebufferTexture2D(
|
|
24258
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
24127
24259
|
|
|
24128
24260
|
}
|
|
24129
24261
|
|
|
@@ -24131,11 +24263,11 @@
|
|
|
24131
24263
|
|
|
24132
24264
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
24133
24265
|
|
|
24134
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT(
|
|
24266
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
24135
24267
|
|
|
24136
24268
|
} else {
|
|
24137
24269
|
|
|
24138
|
-
_gl.framebufferTexture2D(
|
|
24270
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
24139
24271
|
|
|
24140
24272
|
}
|
|
24141
24273
|
|
|
@@ -24167,7 +24299,7 @@
|
|
|
24167
24299
|
|
|
24168
24300
|
for ( let i = 0; i < 6; i ++ ) {
|
|
24169
24301
|
|
|
24170
|
-
state.bindFramebuffer(
|
|
24302
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );
|
|
24171
24303
|
renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();
|
|
24172
24304
|
setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );
|
|
24173
24305
|
|
|
@@ -24175,7 +24307,7 @@
|
|
|
24175
24307
|
|
|
24176
24308
|
} else {
|
|
24177
24309
|
|
|
24178
|
-
state.bindFramebuffer(
|
|
24310
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
24179
24311
|
renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
|
|
24180
24312
|
setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );
|
|
24181
24313
|
|
|
@@ -24183,7 +24315,7 @@
|
|
|
24183
24315
|
|
|
24184
24316
|
}
|
|
24185
24317
|
|
|
24186
|
-
state.bindFramebuffer(
|
|
24318
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, null );
|
|
24187
24319
|
|
|
24188
24320
|
}
|
|
24189
24321
|
|
|
@@ -24194,7 +24326,7 @@
|
|
|
24194
24326
|
|
|
24195
24327
|
if ( colorTexture !== undefined ) {
|
|
24196
24328
|
|
|
24197
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture,
|
|
24329
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D );
|
|
24198
24330
|
|
|
24199
24331
|
}
|
|
24200
24332
|
|
|
@@ -24284,26 +24416,26 @@
|
|
|
24284
24416
|
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
24285
24417
|
renderTargetProperties.__webglColorRenderbuffer = [];
|
|
24286
24418
|
|
|
24287
|
-
state.bindFramebuffer(
|
|
24419
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
24288
24420
|
|
|
24289
24421
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
24290
24422
|
|
|
24291
24423
|
const texture = textures[ i ];
|
|
24292
24424
|
renderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();
|
|
24293
24425
|
|
|
24294
|
-
_gl.bindRenderbuffer(
|
|
24426
|
+
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
24295
24427
|
|
|
24296
|
-
const glFormat = utils.convert( texture.format, texture.
|
|
24428
|
+
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24297
24429
|
const glType = utils.convert( texture.type );
|
|
24298
|
-
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.
|
|
24430
|
+
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );
|
|
24299
24431
|
const samples = getRenderTargetSamples( renderTarget );
|
|
24300
|
-
_gl.renderbufferStorageMultisample(
|
|
24432
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24301
24433
|
|
|
24302
|
-
_gl.framebufferRenderbuffer(
|
|
24434
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
24303
24435
|
|
|
24304
24436
|
}
|
|
24305
24437
|
|
|
24306
|
-
_gl.bindRenderbuffer(
|
|
24438
|
+
_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );
|
|
24307
24439
|
|
|
24308
24440
|
if ( renderTarget.depthBuffer ) {
|
|
24309
24441
|
|
|
@@ -24312,7 +24444,7 @@
|
|
|
24312
24444
|
|
|
24313
24445
|
}
|
|
24314
24446
|
|
|
24315
|
-
state.bindFramebuffer(
|
|
24447
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, null );
|
|
24316
24448
|
|
|
24317
24449
|
}
|
|
24318
24450
|
|
|
@@ -24322,18 +24454,18 @@
|
|
|
24322
24454
|
|
|
24323
24455
|
if ( isCube ) {
|
|
24324
24456
|
|
|
24325
|
-
state.bindTexture(
|
|
24326
|
-
setTextureParameters(
|
|
24457
|
+
state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
|
|
24458
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
|
|
24327
24459
|
|
|
24328
24460
|
for ( let i = 0; i < 6; i ++ ) {
|
|
24329
24461
|
|
|
24330
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture,
|
|
24462
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i );
|
|
24331
24463
|
|
|
24332
24464
|
}
|
|
24333
24465
|
|
|
24334
24466
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
24335
24467
|
|
|
24336
|
-
generateMipmap(
|
|
24468
|
+
generateMipmap( _gl.TEXTURE_CUBE_MAP );
|
|
24337
24469
|
|
|
24338
24470
|
}
|
|
24339
24471
|
|
|
@@ -24348,13 +24480,13 @@
|
|
|
24348
24480
|
const attachment = textures[ i ];
|
|
24349
24481
|
const attachmentProperties = properties.get( attachment );
|
|
24350
24482
|
|
|
24351
|
-
state.bindTexture(
|
|
24352
|
-
setTextureParameters(
|
|
24353
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment,
|
|
24483
|
+
state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
|
|
24484
|
+
setTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );
|
|
24485
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D );
|
|
24354
24486
|
|
|
24355
24487
|
if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
|
|
24356
24488
|
|
|
24357
|
-
generateMipmap(
|
|
24489
|
+
generateMipmap( _gl.TEXTURE_2D );
|
|
24358
24490
|
|
|
24359
24491
|
}
|
|
24360
24492
|
|
|
@@ -24364,13 +24496,13 @@
|
|
|
24364
24496
|
|
|
24365
24497
|
} else {
|
|
24366
24498
|
|
|
24367
|
-
let glTextureType =
|
|
24499
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
24368
24500
|
|
|
24369
24501
|
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
24370
24502
|
|
|
24371
24503
|
if ( isWebGL2 ) {
|
|
24372
24504
|
|
|
24373
|
-
glTextureType = renderTarget.isWebGL3DRenderTarget ?
|
|
24505
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
24374
24506
|
|
|
24375
24507
|
} else {
|
|
24376
24508
|
|
|
@@ -24382,7 +24514,7 @@
|
|
|
24382
24514
|
|
|
24383
24515
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
24384
24516
|
setTextureParameters( glTextureType, texture, supportsMips );
|
|
24385
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture,
|
|
24517
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType );
|
|
24386
24518
|
|
|
24387
24519
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
24388
24520
|
|
|
@@ -24416,7 +24548,7 @@
|
|
|
24416
24548
|
|
|
24417
24549
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
24418
24550
|
|
|
24419
|
-
const target = renderTarget.isWebGLCubeRenderTarget ?
|
|
24551
|
+
const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
|
|
24420
24552
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
24421
24553
|
|
|
24422
24554
|
state.bindTexture( target, webglTexture );
|
|
@@ -24436,9 +24568,9 @@
|
|
|
24436
24568
|
const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];
|
|
24437
24569
|
const width = renderTarget.width;
|
|
24438
24570
|
const height = renderTarget.height;
|
|
24439
|
-
let mask =
|
|
24571
|
+
let mask = _gl.COLOR_BUFFER_BIT;
|
|
24440
24572
|
const invalidationArray = [];
|
|
24441
|
-
const depthStyle = renderTarget.stencilBuffer ?
|
|
24573
|
+
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
24442
24574
|
const renderTargetProperties = properties.get( renderTarget );
|
|
24443
24575
|
const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
|
|
24444
24576
|
|
|
@@ -24447,22 +24579,22 @@
|
|
|
24447
24579
|
|
|
24448
24580
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
24449
24581
|
|
|
24450
|
-
state.bindFramebuffer(
|
|
24451
|
-
_gl.framebufferRenderbuffer(
|
|
24582
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
24583
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );
|
|
24452
24584
|
|
|
24453
|
-
state.bindFramebuffer(
|
|
24454
|
-
_gl.framebufferTexture2D(
|
|
24585
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
24586
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );
|
|
24455
24587
|
|
|
24456
24588
|
}
|
|
24457
24589
|
|
|
24458
24590
|
}
|
|
24459
24591
|
|
|
24460
|
-
state.bindFramebuffer(
|
|
24461
|
-
state.bindFramebuffer(
|
|
24592
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
24593
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
24462
24594
|
|
|
24463
24595
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
24464
24596
|
|
|
24465
|
-
invalidationArray.push(
|
|
24597
|
+
invalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );
|
|
24466
24598
|
|
|
24467
24599
|
if ( renderTarget.depthBuffer ) {
|
|
24468
24600
|
|
|
@@ -24474,63 +24606,63 @@
|
|
|
24474
24606
|
|
|
24475
24607
|
if ( ignoreDepthValues === false ) {
|
|
24476
24608
|
|
|
24477
|
-
if ( renderTarget.depthBuffer ) mask |=
|
|
24478
|
-
if ( renderTarget.stencilBuffer ) mask |=
|
|
24609
|
+
if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
|
|
24610
|
+
if ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;
|
|
24479
24611
|
|
|
24480
24612
|
}
|
|
24481
24613
|
|
|
24482
24614
|
if ( isMultipleRenderTargets ) {
|
|
24483
24615
|
|
|
24484
|
-
_gl.framebufferRenderbuffer(
|
|
24616
|
+
_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
24485
24617
|
|
|
24486
24618
|
}
|
|
24487
24619
|
|
|
24488
24620
|
if ( ignoreDepthValues === true ) {
|
|
24489
24621
|
|
|
24490
|
-
_gl.invalidateFramebuffer(
|
|
24491
|
-
_gl.invalidateFramebuffer(
|
|
24622
|
+
_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );
|
|
24623
|
+
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
|
|
24492
24624
|
|
|
24493
24625
|
}
|
|
24494
24626
|
|
|
24495
24627
|
if ( isMultipleRenderTargets ) {
|
|
24496
24628
|
|
|
24497
24629
|
const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
24498
|
-
_gl.framebufferTexture2D(
|
|
24630
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
24499
24631
|
|
|
24500
24632
|
}
|
|
24501
24633
|
|
|
24502
|
-
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask,
|
|
24634
|
+
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );
|
|
24503
24635
|
|
|
24504
24636
|
if ( supportsInvalidateFramebuffer ) {
|
|
24505
24637
|
|
|
24506
|
-
_gl.invalidateFramebuffer(
|
|
24638
|
+
_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );
|
|
24507
24639
|
|
|
24508
24640
|
}
|
|
24509
24641
|
|
|
24510
24642
|
|
|
24511
24643
|
}
|
|
24512
24644
|
|
|
24513
|
-
state.bindFramebuffer(
|
|
24514
|
-
state.bindFramebuffer(
|
|
24645
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );
|
|
24646
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
24515
24647
|
|
|
24516
24648
|
// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments
|
|
24517
24649
|
if ( isMultipleRenderTargets ) {
|
|
24518
24650
|
|
|
24519
24651
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
24520
24652
|
|
|
24521
|
-
state.bindFramebuffer(
|
|
24522
|
-
_gl.framebufferRenderbuffer(
|
|
24653
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
24654
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
24523
24655
|
|
|
24524
24656
|
const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
24525
24657
|
|
|
24526
|
-
state.bindFramebuffer(
|
|
24527
|
-
_gl.framebufferTexture2D(
|
|
24658
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
24659
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
24528
24660
|
|
|
24529
24661
|
}
|
|
24530
24662
|
|
|
24531
24663
|
}
|
|
24532
24664
|
|
|
24533
|
-
state.bindFramebuffer(
|
|
24665
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
24534
24666
|
|
|
24535
24667
|
}
|
|
24536
24668
|
|
|
@@ -24567,17 +24699,17 @@
|
|
|
24567
24699
|
|
|
24568
24700
|
function verifyColorSpace( texture, image ) {
|
|
24569
24701
|
|
|
24570
|
-
const
|
|
24702
|
+
const colorSpace = texture.colorSpace;
|
|
24571
24703
|
const format = texture.format;
|
|
24572
24704
|
const type = texture.type;
|
|
24573
24705
|
|
|
24574
|
-
if ( texture.isCompressedTexture === true || texture.
|
|
24706
|
+
if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
24575
24707
|
|
|
24576
|
-
if (
|
|
24708
|
+
if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
|
|
24577
24709
|
|
|
24578
24710
|
// sRGB
|
|
24579
24711
|
|
|
24580
|
-
if (
|
|
24712
|
+
if ( colorSpace === SRGBColorSpace ) {
|
|
24581
24713
|
|
|
24582
24714
|
if ( isWebGL2 === false ) {
|
|
24583
24715
|
|
|
@@ -24614,7 +24746,7 @@
|
|
|
24614
24746
|
|
|
24615
24747
|
} else {
|
|
24616
24748
|
|
|
24617
|
-
console.error( 'THREE.WebGLTextures: Unsupported texture
|
|
24749
|
+
console.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );
|
|
24618
24750
|
|
|
24619
24751
|
}
|
|
24620
24752
|
|
|
@@ -24647,24 +24779,24 @@
|
|
|
24647
24779
|
|
|
24648
24780
|
const isWebGL2 = capabilities.isWebGL2;
|
|
24649
24781
|
|
|
24650
|
-
function convert( p,
|
|
24782
|
+
function convert( p, colorSpace = NoColorSpace ) {
|
|
24651
24783
|
|
|
24652
24784
|
let extension;
|
|
24653
24785
|
|
|
24654
|
-
if ( p === UnsignedByteType ) return
|
|
24655
|
-
if ( p === UnsignedShort4444Type ) return
|
|
24656
|
-
if ( p === UnsignedShort5551Type ) return
|
|
24786
|
+
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
24787
|
+
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
24788
|
+
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
24657
24789
|
|
|
24658
|
-
if ( p === ByteType ) return
|
|
24659
|
-
if ( p === ShortType ) return
|
|
24660
|
-
if ( p === UnsignedShortType ) return
|
|
24661
|
-
if ( p === IntType ) return
|
|
24662
|
-
if ( p === UnsignedIntType ) return
|
|
24663
|
-
if ( p === FloatType ) return
|
|
24790
|
+
if ( p === ByteType ) return gl.BYTE;
|
|
24791
|
+
if ( p === ShortType ) return gl.SHORT;
|
|
24792
|
+
if ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;
|
|
24793
|
+
if ( p === IntType ) return gl.INT;
|
|
24794
|
+
if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
|
|
24795
|
+
if ( p === FloatType ) return gl.FLOAT;
|
|
24664
24796
|
|
|
24665
24797
|
if ( p === HalfFloatType ) {
|
|
24666
24798
|
|
|
24667
|
-
if ( isWebGL2 ) return
|
|
24799
|
+
if ( isWebGL2 ) return gl.HALF_FLOAT;
|
|
24668
24800
|
|
|
24669
24801
|
extension = extensions.get( 'OES_texture_half_float' );
|
|
24670
24802
|
|
|
@@ -24680,12 +24812,12 @@
|
|
|
24680
24812
|
|
|
24681
24813
|
}
|
|
24682
24814
|
|
|
24683
|
-
if ( p === AlphaFormat ) return
|
|
24684
|
-
if ( p === RGBAFormat ) return
|
|
24685
|
-
if ( p === LuminanceFormat ) return
|
|
24686
|
-
if ( p === LuminanceAlphaFormat ) return
|
|
24687
|
-
if ( p === DepthFormat ) return
|
|
24688
|
-
if ( p === DepthStencilFormat ) return
|
|
24815
|
+
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
24816
|
+
if ( p === RGBAFormat ) return gl.RGBA;
|
|
24817
|
+
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
24818
|
+
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
24819
|
+
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
24820
|
+
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
24689
24821
|
|
|
24690
24822
|
// WebGL 1 sRGB fallback
|
|
24691
24823
|
|
|
@@ -24707,17 +24839,17 @@
|
|
|
24707
24839
|
|
|
24708
24840
|
// WebGL2 formats.
|
|
24709
24841
|
|
|
24710
|
-
if ( p === RedFormat ) return
|
|
24711
|
-
if ( p === RedIntegerFormat ) return
|
|
24712
|
-
if ( p === RGFormat ) return
|
|
24713
|
-
if ( p === RGIntegerFormat ) return
|
|
24714
|
-
if ( p === RGBAIntegerFormat ) return
|
|
24842
|
+
if ( p === RedFormat ) return gl.RED;
|
|
24843
|
+
if ( p === RedIntegerFormat ) return gl.RED_INTEGER;
|
|
24844
|
+
if ( p === RGFormat ) return gl.RG;
|
|
24845
|
+
if ( p === RGIntegerFormat ) return gl.RG_INTEGER;
|
|
24846
|
+
if ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;
|
|
24715
24847
|
|
|
24716
24848
|
// S3TC
|
|
24717
24849
|
|
|
24718
24850
|
if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
|
|
24719
24851
|
|
|
24720
|
-
if (
|
|
24852
|
+
if ( colorSpace === SRGBColorSpace ) {
|
|
24721
24853
|
|
|
24722
24854
|
extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
|
|
24723
24855
|
|
|
@@ -24802,8 +24934,8 @@
|
|
|
24802
24934
|
|
|
24803
24935
|
if ( extension !== null ) {
|
|
24804
24936
|
|
|
24805
|
-
if ( p === RGB_ETC2_Format ) return (
|
|
24806
|
-
if ( p === RGBA_ETC2_EAC_Format ) return (
|
|
24937
|
+
if ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
24938
|
+
if ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
24807
24939
|
|
|
24808
24940
|
} else {
|
|
24809
24941
|
|
|
@@ -24825,20 +24957,20 @@
|
|
|
24825
24957
|
|
|
24826
24958
|
if ( extension !== null ) {
|
|
24827
24959
|
|
|
24828
|
-
if ( p === RGBA_ASTC_4x4_Format ) return (
|
|
24829
|
-
if ( p === RGBA_ASTC_5x4_Format ) return (
|
|
24830
|
-
if ( p === RGBA_ASTC_5x5_Format ) return (
|
|
24831
|
-
if ( p === RGBA_ASTC_6x5_Format ) return (
|
|
24832
|
-
if ( p === RGBA_ASTC_6x6_Format ) return (
|
|
24833
|
-
if ( p === RGBA_ASTC_8x5_Format ) return (
|
|
24834
|
-
if ( p === RGBA_ASTC_8x6_Format ) return (
|
|
24835
|
-
if ( p === RGBA_ASTC_8x8_Format ) return (
|
|
24836
|
-
if ( p === RGBA_ASTC_10x5_Format ) return (
|
|
24837
|
-
if ( p === RGBA_ASTC_10x6_Format ) return (
|
|
24838
|
-
if ( p === RGBA_ASTC_10x8_Format ) return (
|
|
24839
|
-
if ( p === RGBA_ASTC_10x10_Format ) return (
|
|
24840
|
-
if ( p === RGBA_ASTC_12x10_Format ) return (
|
|
24841
|
-
if ( p === RGBA_ASTC_12x12_Format ) return (
|
|
24960
|
+
if ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
|
|
24961
|
+
if ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
|
|
24962
|
+
if ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
|
|
24963
|
+
if ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
|
|
24964
|
+
if ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
|
|
24965
|
+
if ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
|
|
24966
|
+
if ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
|
|
24967
|
+
if ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
|
|
24968
|
+
if ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
|
|
24969
|
+
if ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
|
|
24970
|
+
if ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
|
|
24971
|
+
if ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
|
|
24972
|
+
if ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
|
|
24973
|
+
if ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
|
|
24842
24974
|
|
|
24843
24975
|
} else {
|
|
24844
24976
|
|
|
@@ -24856,7 +24988,7 @@
|
|
|
24856
24988
|
|
|
24857
24989
|
if ( extension !== null ) {
|
|
24858
24990
|
|
|
24859
|
-
if ( p === RGBA_BPTC_Format ) return (
|
|
24991
|
+
if ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
|
|
24860
24992
|
|
|
24861
24993
|
} else {
|
|
24862
24994
|
|
|
@@ -24891,7 +25023,7 @@
|
|
|
24891
25023
|
|
|
24892
25024
|
if ( p === UnsignedInt248Type ) {
|
|
24893
25025
|
|
|
24894
|
-
if ( isWebGL2 ) return
|
|
25026
|
+
if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
|
|
24895
25027
|
|
|
24896
25028
|
extension = extensions.get( 'WEBGL_depth_texture' );
|
|
24897
25029
|
|
|
@@ -25113,6 +25245,7 @@
|
|
|
25113
25245
|
|
|
25114
25246
|
joint.matrix.fromArray( jointPose.transform.matrix );
|
|
25115
25247
|
joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
|
|
25248
|
+
joint.matrixWorldNeedsUpdate = true;
|
|
25116
25249
|
joint.jointRadius = jointPose.radius;
|
|
25117
25250
|
|
|
25118
25251
|
}
|
|
@@ -25161,6 +25294,7 @@
|
|
|
25161
25294
|
|
|
25162
25295
|
grip.matrix.fromArray( gripPose.transform.matrix );
|
|
25163
25296
|
grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
|
|
25297
|
+
grip.matrixWorldNeedsUpdate = true;
|
|
25164
25298
|
|
|
25165
25299
|
if ( gripPose.linearVelocity ) {
|
|
25166
25300
|
|
|
@@ -25205,6 +25339,7 @@
|
|
|
25205
25339
|
|
|
25206
25340
|
targetRay.matrix.fromArray( inputPose.transform.matrix );
|
|
25207
25341
|
targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
|
|
25342
|
+
targetRay.matrixWorldNeedsUpdate = true;
|
|
25208
25343
|
|
|
25209
25344
|
if ( inputPose.linearVelocity ) {
|
|
25210
25345
|
|
|
@@ -25321,6 +25456,7 @@
|
|
|
25321
25456
|
const scope = this;
|
|
25322
25457
|
|
|
25323
25458
|
let session = null;
|
|
25459
|
+
|
|
25324
25460
|
let framebufferScaleFactor = 1.0;
|
|
25325
25461
|
|
|
25326
25462
|
let referenceSpace = null;
|
|
@@ -25431,6 +25567,7 @@
|
|
|
25431
25567
|
|
|
25432
25568
|
if ( controller !== undefined ) {
|
|
25433
25569
|
|
|
25570
|
+
controller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );
|
|
25434
25571
|
controller.dispatchEvent( { type: event.type, data: event.inputSource } );
|
|
25435
25572
|
|
|
25436
25573
|
}
|
|
@@ -25570,7 +25707,7 @@
|
|
|
25570
25707
|
|
|
25571
25708
|
const layerInit = {
|
|
25572
25709
|
antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
|
|
25573
|
-
alpha:
|
|
25710
|
+
alpha: true,
|
|
25574
25711
|
depth: attributes.depth,
|
|
25575
25712
|
stencil: attributes.stencil,
|
|
25576
25713
|
framebufferScaleFactor: framebufferScaleFactor
|
|
@@ -25586,7 +25723,7 @@
|
|
|
25586
25723
|
{
|
|
25587
25724
|
format: RGBAFormat,
|
|
25588
25725
|
type: UnsignedByteType,
|
|
25589
|
-
|
|
25726
|
+
colorSpace: renderer.outputColorSpace,
|
|
25590
25727
|
stencilBuffer: attributes.stencil
|
|
25591
25728
|
}
|
|
25592
25729
|
);
|
|
@@ -25599,14 +25736,14 @@
|
|
|
25599
25736
|
|
|
25600
25737
|
if ( attributes.depth ) {
|
|
25601
25738
|
|
|
25602
|
-
glDepthFormat = attributes.stencil ?
|
|
25739
|
+
glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;
|
|
25603
25740
|
depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;
|
|
25604
25741
|
depthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;
|
|
25605
25742
|
|
|
25606
25743
|
}
|
|
25607
25744
|
|
|
25608
25745
|
const projectionlayerInit = {
|
|
25609
|
-
colorFormat:
|
|
25746
|
+
colorFormat: gl.RGBA8,
|
|
25610
25747
|
depthFormat: glDepthFormat,
|
|
25611
25748
|
scaleFactor: framebufferScaleFactor
|
|
25612
25749
|
};
|
|
@@ -25625,7 +25762,7 @@
|
|
|
25625
25762
|
type: UnsignedByteType,
|
|
25626
25763
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
25627
25764
|
stencilBuffer: attributes.stencil,
|
|
25628
|
-
|
|
25765
|
+
colorSpace: renderer.outputColorSpace,
|
|
25629
25766
|
samples: attributes.antialias ? 4 : 0
|
|
25630
25767
|
} );
|
|
25631
25768
|
|
|
@@ -25652,6 +25789,16 @@
|
|
|
25652
25789
|
|
|
25653
25790
|
};
|
|
25654
25791
|
|
|
25792
|
+
this.getEnvironmentBlendMode = function () {
|
|
25793
|
+
|
|
25794
|
+
if ( session !== null ) {
|
|
25795
|
+
|
|
25796
|
+
return session.environmentBlendMode;
|
|
25797
|
+
|
|
25798
|
+
}
|
|
25799
|
+
|
|
25800
|
+
};
|
|
25801
|
+
|
|
25655
25802
|
function onInputSourcesChange( event ) {
|
|
25656
25803
|
|
|
25657
25804
|
// Notify disconnected
|
|
@@ -26670,7 +26817,7 @@
|
|
|
26670
26817
|
let updateList = {};
|
|
26671
26818
|
let allocatedBindingPoints = [];
|
|
26672
26819
|
|
|
26673
|
-
const maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter(
|
|
26820
|
+
const maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program
|
|
26674
26821
|
|
|
26675
26822
|
function bind( uniformsGroup, program ) {
|
|
26676
26823
|
|
|
@@ -26724,10 +26871,10 @@
|
|
|
26724
26871
|
const size = uniformsGroup.__size;
|
|
26725
26872
|
const usage = uniformsGroup.usage;
|
|
26726
26873
|
|
|
26727
|
-
gl.bindBuffer(
|
|
26728
|
-
gl.bufferData(
|
|
26729
|
-
gl.bindBuffer(
|
|
26730
|
-
gl.bindBufferBase(
|
|
26874
|
+
gl.bindBuffer( gl.UNIFORM_BUFFER, buffer );
|
|
26875
|
+
gl.bufferData( gl.UNIFORM_BUFFER, size, usage );
|
|
26876
|
+
gl.bindBuffer( gl.UNIFORM_BUFFER, null );
|
|
26877
|
+
gl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );
|
|
26731
26878
|
|
|
26732
26879
|
return buffer;
|
|
26733
26880
|
|
|
@@ -26758,7 +26905,7 @@
|
|
|
26758
26905
|
const uniforms = uniformsGroup.uniforms;
|
|
26759
26906
|
const cache = uniformsGroup.__cache;
|
|
26760
26907
|
|
|
26761
|
-
gl.bindBuffer(
|
|
26908
|
+
gl.bindBuffer( gl.UNIFORM_BUFFER, buffer );
|
|
26762
26909
|
|
|
26763
26910
|
for ( let i = 0, il = uniforms.length; i < il; i ++ ) {
|
|
26764
26911
|
|
|
@@ -26783,7 +26930,7 @@
|
|
|
26783
26930
|
if ( typeof value === 'number' ) {
|
|
26784
26931
|
|
|
26785
26932
|
uniform.__data[ 0 ] = value;
|
|
26786
|
-
gl.bufferSubData(
|
|
26933
|
+
gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
|
|
26787
26934
|
|
|
26788
26935
|
} else if ( value.isMatrix3 ) {
|
|
26789
26936
|
|
|
@@ -26812,13 +26959,13 @@
|
|
|
26812
26959
|
|
|
26813
26960
|
}
|
|
26814
26961
|
|
|
26815
|
-
gl.bufferSubData(
|
|
26962
|
+
gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
|
|
26816
26963
|
|
|
26817
26964
|
}
|
|
26818
26965
|
|
|
26819
26966
|
}
|
|
26820
26967
|
|
|
26821
|
-
gl.bindBuffer(
|
|
26968
|
+
gl.bindBuffer( gl.UNIFORM_BUFFER, null );
|
|
26822
26969
|
|
|
26823
26970
|
}
|
|
26824
26971
|
|
|
@@ -27160,7 +27307,7 @@
|
|
|
27160
27307
|
|
|
27161
27308
|
// physically based shading
|
|
27162
27309
|
|
|
27163
|
-
this.
|
|
27310
|
+
this.outputColorSpace = SRGBColorSpace;
|
|
27164
27311
|
|
|
27165
27312
|
// physical lights
|
|
27166
27313
|
|
|
@@ -27336,7 +27483,7 @@
|
|
|
27336
27483
|
|
|
27337
27484
|
state = new WebGLState( _gl, extensions, capabilities );
|
|
27338
27485
|
|
|
27339
|
-
info = new WebGLInfo();
|
|
27486
|
+
info = new WebGLInfo( _gl );
|
|
27340
27487
|
properties = new WebGLProperties();
|
|
27341
27488
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
27342
27489
|
cubemaps = new WebGLCubeMaps( _this );
|
|
@@ -27578,9 +27725,9 @@
|
|
|
27578
27725
|
|
|
27579
27726
|
let bits = 0;
|
|
27580
27727
|
|
|
27581
|
-
if ( color ) bits |=
|
|
27582
|
-
if ( depth ) bits |=
|
|
27583
|
-
if ( stencil ) bits |=
|
|
27728
|
+
if ( color ) bits |= _gl.COLOR_BUFFER_BIT;
|
|
27729
|
+
if ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;
|
|
27730
|
+
if ( stencil ) bits |= _gl.STENCIL_BUFFER_BIT;
|
|
27584
27731
|
|
|
27585
27732
|
_gl.clear( bits );
|
|
27586
27733
|
|
|
@@ -27799,11 +27946,11 @@
|
|
|
27799
27946
|
if ( material.wireframe === true ) {
|
|
27800
27947
|
|
|
27801
27948
|
state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );
|
|
27802
|
-
renderer.setMode(
|
|
27949
|
+
renderer.setMode( _gl.LINES );
|
|
27803
27950
|
|
|
27804
27951
|
} else {
|
|
27805
27952
|
|
|
27806
|
-
renderer.setMode(
|
|
27953
|
+
renderer.setMode( _gl.TRIANGLES );
|
|
27807
27954
|
|
|
27808
27955
|
}
|
|
27809
27956
|
|
|
@@ -27817,25 +27964,25 @@
|
|
|
27817
27964
|
|
|
27818
27965
|
if ( object.isLineSegments ) {
|
|
27819
27966
|
|
|
27820
|
-
renderer.setMode(
|
|
27967
|
+
renderer.setMode( _gl.LINES );
|
|
27821
27968
|
|
|
27822
27969
|
} else if ( object.isLineLoop ) {
|
|
27823
27970
|
|
|
27824
|
-
renderer.setMode(
|
|
27971
|
+
renderer.setMode( _gl.LINE_LOOP );
|
|
27825
27972
|
|
|
27826
27973
|
} else {
|
|
27827
27974
|
|
|
27828
|
-
renderer.setMode(
|
|
27975
|
+
renderer.setMode( _gl.LINE_STRIP );
|
|
27829
27976
|
|
|
27830
27977
|
}
|
|
27831
27978
|
|
|
27832
27979
|
} else if ( object.isPoints ) {
|
|
27833
27980
|
|
|
27834
|
-
renderer.setMode(
|
|
27981
|
+
renderer.setMode( _gl.POINTS );
|
|
27835
27982
|
|
|
27836
27983
|
} else if ( object.isSprite ) {
|
|
27837
27984
|
|
|
27838
|
-
renderer.setMode(
|
|
27985
|
+
renderer.setMode( _gl.TRIANGLES );
|
|
27839
27986
|
|
|
27840
27987
|
}
|
|
27841
27988
|
|
|
@@ -28175,31 +28322,35 @@
|
|
|
28175
28322
|
|
|
28176
28323
|
} else if ( object.isMesh || object.isLine || object.isPoints ) {
|
|
28177
28324
|
|
|
28178
|
-
if ( object.
|
|
28325
|
+
if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {
|
|
28179
28326
|
|
|
28180
|
-
|
|
28327
|
+
if ( object.isSkinnedMesh ) {
|
|
28181
28328
|
|
|
28182
|
-
|
|
28329
|
+
// update skeleton only once in a frame
|
|
28183
28330
|
|
|
28184
|
-
object.skeleton.
|
|
28185
|
-
object.skeleton.frame = info.render.frame;
|
|
28331
|
+
if ( object.skeleton.frame !== info.render.frame ) {
|
|
28186
28332
|
|
|
28187
|
-
|
|
28333
|
+
object.skeleton.update();
|
|
28334
|
+
object.skeleton.frame = info.render.frame;
|
|
28188
28335
|
|
|
28189
|
-
|
|
28336
|
+
}
|
|
28190
28337
|
|
|
28191
|
-
|
|
28338
|
+
}
|
|
28339
|
+
|
|
28340
|
+
const geometry = objects.update( object );
|
|
28341
|
+
const material = object.material;
|
|
28192
28342
|
|
|
28193
28343
|
if ( sortObjects ) {
|
|
28194
28344
|
|
|
28195
|
-
|
|
28345
|
+
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
28346
|
+
|
|
28347
|
+
_vector3
|
|
28348
|
+
.copy( geometry.boundingSphere.center )
|
|
28349
|
+
.applyMatrix4( object.matrixWorld )
|
|
28196
28350
|
.applyMatrix4( _projScreenMatrix );
|
|
28197
28351
|
|
|
28198
28352
|
}
|
|
28199
28353
|
|
|
28200
|
-
const geometry = objects.update( object );
|
|
28201
|
-
const material = object.material;
|
|
28202
|
-
|
|
28203
28354
|
if ( Array.isArray( material ) ) {
|
|
28204
28355
|
|
|
28205
28356
|
const groups = geometry.groups;
|
|
@@ -28523,7 +28674,7 @@
|
|
|
28523
28674
|
|
|
28524
28675
|
const materialProperties = properties.get( material );
|
|
28525
28676
|
|
|
28526
|
-
materialProperties.
|
|
28677
|
+
materialProperties.outputColorSpace = parameters.outputColorSpace;
|
|
28527
28678
|
materialProperties.instancing = parameters.instancing;
|
|
28528
28679
|
materialProperties.skinning = parameters.skinning;
|
|
28529
28680
|
materialProperties.morphTargets = parameters.morphTargets;
|
|
@@ -28546,7 +28697,7 @@
|
|
|
28546
28697
|
|
|
28547
28698
|
const fog = scene.fog;
|
|
28548
28699
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
28549
|
-
const
|
|
28700
|
+
const colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );
|
|
28550
28701
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
28551
28702
|
const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
28552
28703
|
const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
|
|
@@ -28588,7 +28739,7 @@
|
|
|
28588
28739
|
|
|
28589
28740
|
needsProgramChange = true;
|
|
28590
28741
|
|
|
28591
|
-
} else if ( materialProperties.
|
|
28742
|
+
} else if ( materialProperties.outputColorSpace !== colorSpace ) {
|
|
28592
28743
|
|
|
28593
28744
|
needsProgramChange = true;
|
|
28594
28745
|
|
|
@@ -28997,7 +29148,7 @@
|
|
|
28997
29148
|
if ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {
|
|
28998
29149
|
|
|
28999
29150
|
// We need to make sure to rebind the framebuffer.
|
|
29000
|
-
state.bindFramebuffer(
|
|
29151
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, null );
|
|
29001
29152
|
useDefaultFramebuffer = false;
|
|
29002
29153
|
|
|
29003
29154
|
} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {
|
|
@@ -29048,7 +29199,7 @@
|
|
|
29048
29199
|
|
|
29049
29200
|
}
|
|
29050
29201
|
|
|
29051
|
-
const framebufferBound = state.bindFramebuffer(
|
|
29202
|
+
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
29052
29203
|
|
|
29053
29204
|
if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
|
|
29054
29205
|
|
|
@@ -29063,13 +29214,13 @@
|
|
|
29063
29214
|
if ( isCube ) {
|
|
29064
29215
|
|
|
29065
29216
|
const textureProperties = properties.get( renderTarget.texture );
|
|
29066
|
-
_gl.framebufferTexture2D(
|
|
29217
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );
|
|
29067
29218
|
|
|
29068
29219
|
} else if ( isRenderTarget3D ) {
|
|
29069
29220
|
|
|
29070
29221
|
const textureProperties = properties.get( renderTarget.texture );
|
|
29071
29222
|
const layer = activeCubeFace || 0;
|
|
29072
|
-
_gl.framebufferTextureLayer(
|
|
29223
|
+
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );
|
|
29073
29224
|
|
|
29074
29225
|
}
|
|
29075
29226
|
|
|
@@ -29096,7 +29247,7 @@
|
|
|
29096
29247
|
|
|
29097
29248
|
if ( framebuffer ) {
|
|
29098
29249
|
|
|
29099
|
-
state.bindFramebuffer(
|
|
29250
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
29100
29251
|
|
|
29101
29252
|
try {
|
|
29102
29253
|
|
|
@@ -29104,7 +29255,7 @@
|
|
|
29104
29255
|
const textureFormat = texture.format;
|
|
29105
29256
|
const textureType = texture.type;
|
|
29106
29257
|
|
|
29107
|
-
if ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter(
|
|
29258
|
+
if ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {
|
|
29108
29259
|
|
|
29109
29260
|
console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
29110
29261
|
return;
|
|
@@ -29113,7 +29264,7 @@
|
|
|
29113
29264
|
|
|
29114
29265
|
const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );
|
|
29115
29266
|
|
|
29116
|
-
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter(
|
|
29267
|
+
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
29117
29268
|
! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
|
|
29118
29269
|
! halfFloatSupportedByExt ) {
|
|
29119
29270
|
|
|
@@ -29135,7 +29286,7 @@
|
|
|
29135
29286
|
// restore framebuffer of current render target if necessary
|
|
29136
29287
|
|
|
29137
29288
|
const framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
29138
|
-
state.bindFramebuffer(
|
|
29289
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
29139
29290
|
|
|
29140
29291
|
}
|
|
29141
29292
|
|
|
@@ -29151,7 +29302,7 @@
|
|
|
29151
29302
|
|
|
29152
29303
|
textures.setTexture2D( texture, 0 );
|
|
29153
29304
|
|
|
29154
|
-
_gl.copyTexSubImage2D(
|
|
29305
|
+
_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );
|
|
29155
29306
|
|
|
29156
29307
|
state.unbindTexture();
|
|
29157
29308
|
|
|
@@ -29168,30 +29319,30 @@
|
|
|
29168
29319
|
|
|
29169
29320
|
// As another texture upload may have changed pixelStorei
|
|
29170
29321
|
// parameters, make sure they are correct for the dstTexture
|
|
29171
|
-
_gl.pixelStorei(
|
|
29172
|
-
_gl.pixelStorei(
|
|
29173
|
-
_gl.pixelStorei(
|
|
29322
|
+
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
29323
|
+
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
29324
|
+
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
29174
29325
|
|
|
29175
29326
|
if ( srcTexture.isDataTexture ) {
|
|
29176
29327
|
|
|
29177
|
-
_gl.texSubImage2D(
|
|
29328
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );
|
|
29178
29329
|
|
|
29179
29330
|
} else {
|
|
29180
29331
|
|
|
29181
29332
|
if ( srcTexture.isCompressedTexture ) {
|
|
29182
29333
|
|
|
29183
|
-
_gl.compressedTexSubImage2D(
|
|
29334
|
+
_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );
|
|
29184
29335
|
|
|
29185
29336
|
} else {
|
|
29186
29337
|
|
|
29187
|
-
_gl.texSubImage2D(
|
|
29338
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );
|
|
29188
29339
|
|
|
29189
29340
|
}
|
|
29190
29341
|
|
|
29191
29342
|
}
|
|
29192
29343
|
|
|
29193
29344
|
// Generate mipmaps only when copying level 0
|
|
29194
|
-
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap(
|
|
29345
|
+
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );
|
|
29195
29346
|
|
|
29196
29347
|
state.unbindTexture();
|
|
29197
29348
|
|
|
@@ -29216,12 +29367,12 @@
|
|
|
29216
29367
|
if ( dstTexture.isData3DTexture ) {
|
|
29217
29368
|
|
|
29218
29369
|
textures.setTexture3D( dstTexture, 0 );
|
|
29219
|
-
glTarget =
|
|
29370
|
+
glTarget = _gl.TEXTURE_3D;
|
|
29220
29371
|
|
|
29221
29372
|
} else if ( dstTexture.isDataArrayTexture ) {
|
|
29222
29373
|
|
|
29223
29374
|
textures.setTexture2DArray( dstTexture, 0 );
|
|
29224
|
-
glTarget =
|
|
29375
|
+
glTarget = _gl.TEXTURE_2D_ARRAY;
|
|
29225
29376
|
|
|
29226
29377
|
} else {
|
|
29227
29378
|
|
|
@@ -29230,23 +29381,23 @@
|
|
|
29230
29381
|
|
|
29231
29382
|
}
|
|
29232
29383
|
|
|
29233
|
-
_gl.pixelStorei(
|
|
29234
|
-
_gl.pixelStorei(
|
|
29235
|
-
_gl.pixelStorei(
|
|
29384
|
+
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
29385
|
+
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
29386
|
+
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
29236
29387
|
|
|
29237
|
-
const unpackRowLen = _gl.getParameter(
|
|
29238
|
-
const unpackImageHeight = _gl.getParameter(
|
|
29239
|
-
const unpackSkipPixels = _gl.getParameter(
|
|
29240
|
-
const unpackSkipRows = _gl.getParameter(
|
|
29241
|
-
const unpackSkipImages = _gl.getParameter(
|
|
29388
|
+
const unpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
29389
|
+
const unpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
29390
|
+
const unpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
29391
|
+
const unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
29392
|
+
const unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
29242
29393
|
|
|
29243
29394
|
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;
|
|
29244
29395
|
|
|
29245
|
-
_gl.pixelStorei(
|
|
29246
|
-
_gl.pixelStorei(
|
|
29247
|
-
_gl.pixelStorei(
|
|
29248
|
-
_gl.pixelStorei(
|
|
29249
|
-
_gl.pixelStorei(
|
|
29396
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
29397
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
29398
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, sourceBox.min.x );
|
|
29399
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );
|
|
29400
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );
|
|
29250
29401
|
|
|
29251
29402
|
if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
|
|
29252
29403
|
|
|
@@ -29267,11 +29418,11 @@
|
|
|
29267
29418
|
|
|
29268
29419
|
}
|
|
29269
29420
|
|
|
29270
|
-
_gl.pixelStorei(
|
|
29271
|
-
_gl.pixelStorei(
|
|
29272
|
-
_gl.pixelStorei(
|
|
29273
|
-
_gl.pixelStorei(
|
|
29274
|
-
_gl.pixelStorei(
|
|
29421
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, unpackRowLen );
|
|
29422
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight );
|
|
29423
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, unpackSkipPixels );
|
|
29424
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, unpackSkipRows );
|
|
29425
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, unpackSkipImages );
|
|
29275
29426
|
|
|
29276
29427
|
// Generate mipmaps only when copying level 0
|
|
29277
29428
|
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );
|
|
@@ -29337,6 +29488,20 @@
|
|
|
29337
29488
|
|
|
29338
29489
|
}
|
|
29339
29490
|
|
|
29491
|
+
get outputEncoding() { // @deprecated, r152
|
|
29492
|
+
|
|
29493
|
+
console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
|
|
29494
|
+
return this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
|
|
29495
|
+
|
|
29496
|
+
}
|
|
29497
|
+
|
|
29498
|
+
set outputEncoding( encoding ) { // @deprecated, r152
|
|
29499
|
+
|
|
29500
|
+
console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
|
|
29501
|
+
this.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
29502
|
+
|
|
29503
|
+
}
|
|
29504
|
+
|
|
29340
29505
|
}
|
|
29341
29506
|
|
|
29342
29507
|
class WebGL1Renderer extends WebGLRenderer {}
|
|
@@ -35649,7 +35814,7 @@
|
|
|
35649
35814
|
|
|
35650
35815
|
start() {
|
|
35651
35816
|
|
|
35652
|
-
this.startTime = now$
|
|
35817
|
+
this.startTime = now$3();
|
|
35653
35818
|
|
|
35654
35819
|
this.oldTime = this.startTime;
|
|
35655
35820
|
this.elapsedTime = 0;
|
|
@@ -35685,7 +35850,7 @@
|
|
|
35685
35850
|
|
|
35686
35851
|
if ( this.running ) {
|
|
35687
35852
|
|
|
35688
|
-
const newTime = now$
|
|
35853
|
+
const newTime = now$3();
|
|
35689
35854
|
|
|
35690
35855
|
diff = ( newTime - this.oldTime ) / 1000;
|
|
35691
35856
|
this.oldTime = newTime;
|
|
@@ -35700,7 +35865,7 @@
|
|
|
35700
35865
|
|
|
35701
35866
|
}
|
|
35702
35867
|
|
|
35703
|
-
function now$
|
|
35868
|
+
function now$3() {
|
|
35704
35869
|
|
|
35705
35870
|
return ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732
|
|
35706
35871
|
|
|
@@ -36482,7 +36647,7 @@
|
|
|
36482
36647
|
|
|
36483
36648
|
const element = object.element;
|
|
36484
36649
|
|
|
36485
|
-
element.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' +
|
|
36650
|
+
element.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector$1.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector$1.y * _heightHalf + _heightHalf ) + 'px)';
|
|
36486
36651
|
|
|
36487
36652
|
if ( element.parentNode !== domElement ) {
|
|
36488
36653
|
|
|
@@ -36861,11 +37026,11 @@
|
|
|
36861
37026
|
* }, _.now());
|
|
36862
37027
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
36863
37028
|
*/
|
|
36864
|
-
var now$
|
|
37029
|
+
var now$1 = function() {
|
|
36865
37030
|
return root$1.Date.now();
|
|
36866
37031
|
};
|
|
36867
37032
|
|
|
36868
|
-
var now$
|
|
37033
|
+
var now$2 = now$1;
|
|
36869
37034
|
|
|
36870
37035
|
/** Error message constants. */
|
|
36871
37036
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
@@ -36992,7 +37157,7 @@
|
|
|
36992
37157
|
}
|
|
36993
37158
|
|
|
36994
37159
|
function timerExpired() {
|
|
36995
|
-
var time = now$
|
|
37160
|
+
var time = now$2();
|
|
36996
37161
|
if (shouldInvoke(time)) {
|
|
36997
37162
|
return trailingEdge(time);
|
|
36998
37163
|
}
|
|
@@ -37021,11 +37186,11 @@
|
|
|
37021
37186
|
}
|
|
37022
37187
|
|
|
37023
37188
|
function flush() {
|
|
37024
|
-
return timerId === undefined ? result : trailingEdge(now$
|
|
37189
|
+
return timerId === undefined ? result : trailingEdge(now$2());
|
|
37025
37190
|
}
|
|
37026
37191
|
|
|
37027
37192
|
function debounced() {
|
|
37028
|
-
var time = now$
|
|
37193
|
+
var time = now$2(),
|
|
37029
37194
|
isInvoking = shouldInvoke(time);
|
|
37030
37195
|
|
|
37031
37196
|
lastArgs = arguments;
|
|
@@ -37483,37 +37648,7 @@
|
|
|
37483
37648
|
},
|
|
37484
37649
|
});
|
|
37485
37650
|
|
|
37486
|
-
var now;
|
|
37487
|
-
// Include a performance.now polyfill.
|
|
37488
|
-
// In node.js, use process.hrtime.
|
|
37489
|
-
// eslint-disable-next-line
|
|
37490
|
-
// @ts-ignore
|
|
37491
|
-
if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {
|
|
37492
|
-
now = function () {
|
|
37493
|
-
// eslint-disable-next-line
|
|
37494
|
-
// @ts-ignore
|
|
37495
|
-
var time = process.hrtime();
|
|
37496
|
-
// Convert [seconds, nanoseconds] to milliseconds.
|
|
37497
|
-
return time[0] * 1000 + time[1] / 1000000;
|
|
37498
|
-
};
|
|
37499
|
-
}
|
|
37500
|
-
// In a browser, use self.performance.now if it is available.
|
|
37501
|
-
else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {
|
|
37502
|
-
// This must be bound, because directly assigning this function
|
|
37503
|
-
// leads to an invocation exception in Chrome.
|
|
37504
|
-
now = self.performance.now.bind(self.performance);
|
|
37505
|
-
}
|
|
37506
|
-
// Use Date.now if it is available.
|
|
37507
|
-
else if (Date.now !== undefined) {
|
|
37508
|
-
now = Date.now;
|
|
37509
|
-
}
|
|
37510
|
-
// Otherwise, use 'new Date().getTime()'.
|
|
37511
|
-
else {
|
|
37512
|
-
now = function () {
|
|
37513
|
-
return new Date().getTime();
|
|
37514
|
-
};
|
|
37515
|
-
}
|
|
37516
|
-
var now$1 = now;
|
|
37651
|
+
var now = function () { return performance.now(); };
|
|
37517
37652
|
|
|
37518
37653
|
/**
|
|
37519
37654
|
* Controlling groups of tweens
|
|
@@ -37544,7 +37679,7 @@
|
|
|
37544
37679
|
delete this._tweensAddedDuringUpdate[tween.getId()];
|
|
37545
37680
|
};
|
|
37546
37681
|
Group.prototype.update = function (time, preserve) {
|
|
37547
|
-
if (time === void 0) { time = now
|
|
37682
|
+
if (time === void 0) { time = now(); }
|
|
37548
37683
|
if (preserve === void 0) { preserve = false; }
|
|
37549
37684
|
var tweenIds = Object.keys(this._tweens);
|
|
37550
37685
|
if (tweenIds.length === 0) {
|
|
@@ -37685,6 +37820,7 @@
|
|
|
37685
37820
|
this._valuesEnd = {};
|
|
37686
37821
|
this._valuesStartRepeat = {};
|
|
37687
37822
|
this._duration = 1000;
|
|
37823
|
+
this._isDynamic = false;
|
|
37688
37824
|
this._initialRepeat = 0;
|
|
37689
37825
|
this._repeat = 0;
|
|
37690
37826
|
this._yoyo = false;
|
|
@@ -37700,6 +37836,7 @@
|
|
|
37700
37836
|
this._onEveryStartCallbackFired = false;
|
|
37701
37837
|
this._id = Sequence.nextId();
|
|
37702
37838
|
this._isChainStopped = false;
|
|
37839
|
+
this._propertiesAreSetUp = false;
|
|
37703
37840
|
this._goToEnd = false;
|
|
37704
37841
|
}
|
|
37705
37842
|
Tween.prototype.getId = function () {
|
|
@@ -37711,24 +37848,27 @@
|
|
|
37711
37848
|
Tween.prototype.isPaused = function () {
|
|
37712
37849
|
return this._isPaused;
|
|
37713
37850
|
};
|
|
37714
|
-
Tween.prototype.to = function (
|
|
37715
|
-
|
|
37716
|
-
|
|
37717
|
-
|
|
37718
|
-
|
|
37719
|
-
this.
|
|
37720
|
-
|
|
37721
|
-
|
|
37722
|
-
|
|
37851
|
+
Tween.prototype.to = function (target, duration) {
|
|
37852
|
+
if (duration === void 0) { duration = 1000; }
|
|
37853
|
+
if (this._isPlaying)
|
|
37854
|
+
throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
|
|
37855
|
+
this._valuesEnd = target;
|
|
37856
|
+
this._propertiesAreSetUp = false;
|
|
37857
|
+
this._duration = duration;
|
|
37858
|
+
return this;
|
|
37859
|
+
};
|
|
37860
|
+
Tween.prototype.duration = function (duration) {
|
|
37861
|
+
if (duration === void 0) { duration = 1000; }
|
|
37862
|
+
this._duration = duration;
|
|
37723
37863
|
return this;
|
|
37724
37864
|
};
|
|
37725
|
-
Tween.prototype.
|
|
37726
|
-
if (
|
|
37727
|
-
this.
|
|
37865
|
+
Tween.prototype.dynamic = function (dynamic) {
|
|
37866
|
+
if (dynamic === void 0) { dynamic = false; }
|
|
37867
|
+
this._isDynamic = dynamic;
|
|
37728
37868
|
return this;
|
|
37729
37869
|
};
|
|
37730
37870
|
Tween.prototype.start = function (time, overrideStartingValues) {
|
|
37731
|
-
if (time === void 0) { time = now
|
|
37871
|
+
if (time === void 0) { time = now(); }
|
|
37732
37872
|
if (overrideStartingValues === void 0) { overrideStartingValues = false; }
|
|
37733
37873
|
if (this._isPlaying) {
|
|
37734
37874
|
return this;
|
|
@@ -37752,7 +37892,17 @@
|
|
|
37752
37892
|
this._isChainStopped = false;
|
|
37753
37893
|
this._startTime = time;
|
|
37754
37894
|
this._startTime += this._delayTime;
|
|
37755
|
-
|
|
37895
|
+
if (!this._propertiesAreSetUp || overrideStartingValues) {
|
|
37896
|
+
this._propertiesAreSetUp = true;
|
|
37897
|
+
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
|
37898
|
+
if (!this._isDynamic) {
|
|
37899
|
+
var tmp = {};
|
|
37900
|
+
for (var prop in this._valuesEnd)
|
|
37901
|
+
tmp[prop] = this._valuesEnd[prop];
|
|
37902
|
+
this._valuesEnd = tmp;
|
|
37903
|
+
}
|
|
37904
|
+
this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
|
|
37905
|
+
}
|
|
37756
37906
|
return this;
|
|
37757
37907
|
};
|
|
37758
37908
|
Tween.prototype.startFromCurrentValues = function (time) {
|
|
@@ -37775,26 +37925,42 @@
|
|
|
37775
37925
|
if (endValues.length === 0) {
|
|
37776
37926
|
continue;
|
|
37777
37927
|
}
|
|
37778
|
-
//
|
|
37779
|
-
|
|
37780
|
-
|
|
37781
|
-
|
|
37782
|
-
|
|
37928
|
+
// Handle an array of relative values.
|
|
37929
|
+
// Creates a local copy of the Array with the start value at the front
|
|
37930
|
+
var temp = [startValue];
|
|
37931
|
+
for (var i = 0, l = endValues.length; i < l; i += 1) {
|
|
37932
|
+
var value = this._handleRelativeValue(startValue, endValues[i]);
|
|
37933
|
+
if (isNaN(value)) {
|
|
37934
|
+
isInterpolationList = false;
|
|
37935
|
+
console.warn('Found invalid interpolation list. Skipping.');
|
|
37936
|
+
break;
|
|
37937
|
+
}
|
|
37938
|
+
temp.push(value);
|
|
37939
|
+
}
|
|
37940
|
+
if (isInterpolationList) {
|
|
37941
|
+
// if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
|
|
37942
|
+
_valuesEnd[property] = temp;
|
|
37943
|
+
// }
|
|
37783
37944
|
}
|
|
37784
37945
|
}
|
|
37785
37946
|
// handle the deepness of the values
|
|
37786
37947
|
if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
|
|
37787
37948
|
_valuesStart[property] = startValueIsArray ? [] : {};
|
|
37788
|
-
|
|
37789
|
-
for (var prop in
|
|
37790
|
-
|
|
37791
|
-
// @ts-ignore FIXME?
|
|
37792
|
-
_valuesStart[property][prop] = startValue[prop];
|
|
37949
|
+
var nestedObject = startValue;
|
|
37950
|
+
for (var prop in nestedObject) {
|
|
37951
|
+
_valuesStart[property][prop] = nestedObject[prop];
|
|
37793
37952
|
}
|
|
37794
|
-
|
|
37795
|
-
|
|
37796
|
-
|
|
37797
|
-
|
|
37953
|
+
// TODO? repeat nested values? And yoyo? And array values?
|
|
37954
|
+
_valuesStartRepeat[property] = startValueIsArray ? [] : {};
|
|
37955
|
+
var endValues = _valuesEnd[property];
|
|
37956
|
+
// If dynamic is not enabled, clone the end values instead of using the passed-in end values.
|
|
37957
|
+
if (!this._isDynamic) {
|
|
37958
|
+
var tmp = {};
|
|
37959
|
+
for (var prop in endValues)
|
|
37960
|
+
tmp[prop] = endValues[prop];
|
|
37961
|
+
_valuesEnd[property] = endValues = tmp;
|
|
37962
|
+
}
|
|
37963
|
+
this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
|
|
37798
37964
|
}
|
|
37799
37965
|
else {
|
|
37800
37966
|
// Save the starting value, but only once unless override is requested.
|
|
@@ -37840,7 +38006,7 @@
|
|
|
37840
38006
|
return this;
|
|
37841
38007
|
};
|
|
37842
38008
|
Tween.prototype.pause = function (time) {
|
|
37843
|
-
if (time === void 0) { time = now
|
|
38009
|
+
if (time === void 0) { time = now(); }
|
|
37844
38010
|
if (this._isPaused || !this._isPlaying) {
|
|
37845
38011
|
return this;
|
|
37846
38012
|
}
|
|
@@ -37851,7 +38017,7 @@
|
|
|
37851
38017
|
return this;
|
|
37852
38018
|
};
|
|
37853
38019
|
Tween.prototype.resume = function (time) {
|
|
37854
|
-
if (time === void 0) { time = now
|
|
38020
|
+
if (time === void 0) { time = now(); }
|
|
37855
38021
|
if (!this._isPaused || !this._isPlaying) {
|
|
37856
38022
|
return this;
|
|
37857
38023
|
}
|
|
@@ -37942,7 +38108,7 @@
|
|
|
37942
38108
|
* it is still playing, just paused).
|
|
37943
38109
|
*/
|
|
37944
38110
|
Tween.prototype.update = function (time, autoStart) {
|
|
37945
|
-
if (time === void 0) { time = now
|
|
38111
|
+
if (time === void 0) { time = now(); }
|
|
37946
38112
|
if (autoStart === void 0) { autoStart = true; }
|
|
37947
38113
|
if (this._isPaused)
|
|
37948
38114
|
return true;
|
|
@@ -38065,9 +38231,7 @@
|
|
|
38065
38231
|
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
|
|
38066
38232
|
return start + parseFloat(end);
|
|
38067
38233
|
}
|
|
38068
|
-
|
|
38069
|
-
return parseFloat(end);
|
|
38070
|
-
}
|
|
38234
|
+
return parseFloat(end);
|
|
38071
38235
|
};
|
|
38072
38236
|
Tween.prototype._swapEndStartRepeatValues = function (property) {
|
|
38073
38237
|
var tmp = this._valuesStartRepeat[property];
|
|
@@ -38083,7 +38247,7 @@
|
|
|
38083
38247
|
return Tween;
|
|
38084
38248
|
}());
|
|
38085
38249
|
|
|
38086
|
-
var VERSION = '
|
|
38250
|
+
var VERSION = '20.0.3';
|
|
38087
38251
|
|
|
38088
38252
|
/**
|
|
38089
38253
|
* Tween.js - Licensed under the MIT license
|
|
@@ -38114,7 +38278,7 @@
|
|
|
38114
38278
|
Easing: Easing,
|
|
38115
38279
|
Group: Group,
|
|
38116
38280
|
Interpolation: Interpolation,
|
|
38117
|
-
now: now
|
|
38281
|
+
now: now,
|
|
38118
38282
|
Sequence: Sequence,
|
|
38119
38283
|
nextId: nextId,
|
|
38120
38284
|
Tween: Tween,
|
|
@@ -38126,8 +38290,6 @@
|
|
|
38126
38290
|
update: update,
|
|
38127
38291
|
};
|
|
38128
38292
|
|
|
38129
|
-
var TWEEN$1 = exports$1;
|
|
38130
|
-
|
|
38131
38293
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
38132
38294
|
|
|
38133
38295
|
function getDefaultExportFromCjs (x) {
|
|
@@ -41645,9 +41807,9 @@
|
|
|
41645
41807
|
|
|
41646
41808
|
if ( attribute.normalized || attribute.isInterleavedBufferAttribute ) {
|
|
41647
41809
|
|
|
41648
|
-
const dstArray = new Float32Array( attribute.
|
|
41810
|
+
const dstArray = new Float32Array( attribute.count * attribute.itemSize );
|
|
41649
41811
|
|
|
41650
|
-
for ( let i = 0, j = 0; i < attribute.
|
|
41812
|
+
for ( let i = 0, j = 0; i < attribute.count; i ++ ) {
|
|
41651
41813
|
|
|
41652
41814
|
dstArray[ j ++ ] = attribute.getX( i );
|
|
41653
41815
|
dstArray[ j ++ ] = attribute.getY( i );
|
|
@@ -64990,6 +65152,7 @@
|
|
|
64990
65152
|
Mesh: Mesh,
|
|
64991
65153
|
MeshPhongMaterial: MeshPhongMaterial,
|
|
64992
65154
|
SphereGeometry: SphereGeometry,
|
|
65155
|
+
SRGBColorSpace: SRGBColorSpace,
|
|
64993
65156
|
TextureLoader: TextureLoader
|
|
64994
65157
|
};
|
|
64995
65158
|
|
|
@@ -65086,6 +65249,7 @@
|
|
|
65086
65249
|
!globeMaterial.color && (globeMaterial.color = new THREE$e.Color(0x000000));
|
|
65087
65250
|
} else {
|
|
65088
65251
|
new THREE$e.TextureLoader().load(state.globeImageUrl, function (texture) {
|
|
65252
|
+
texture.colorSpace = THREE$e.SRGBColorSpace;
|
|
65089
65253
|
globeMaterial.map = texture;
|
|
65090
65254
|
globeMaterial.color = null;
|
|
65091
65255
|
globeMaterial.needsUpdate = true;
|
|
@@ -65341,7 +65505,7 @@
|
|
|
65341
65505
|
applyUpdate(targetD);
|
|
65342
65506
|
} else {
|
|
65343
65507
|
// animate
|
|
65344
|
-
new
|
|
65508
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.pointsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
65345
65509
|
}
|
|
65346
65510
|
}
|
|
65347
65511
|
if (!state.pointsMerge) {
|
|
@@ -65609,7 +65773,7 @@
|
|
|
65609
65773
|
applyUpdate(targetD);
|
|
65610
65774
|
} else {
|
|
65611
65775
|
// animate
|
|
65612
|
-
new
|
|
65776
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.arcsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
65613
65777
|
}
|
|
65614
65778
|
}
|
|
65615
65779
|
}
|
|
@@ -65945,7 +66109,7 @@
|
|
|
65945
66109
|
applyUpdate(targetD);
|
|
65946
66110
|
} else {
|
|
65947
66111
|
// animate
|
|
65948
|
-
new
|
|
66112
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.hexTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
65949
66113
|
}
|
|
65950
66114
|
}
|
|
65951
66115
|
if (!state.hexBinMerge) {
|
|
@@ -66169,7 +66333,7 @@
|
|
|
66169
66333
|
applyUpdate(targetD);
|
|
66170
66334
|
} else {
|
|
66171
66335
|
// animate
|
|
66172
|
-
new
|
|
66336
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.polygonsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
66173
66337
|
}
|
|
66174
66338
|
}
|
|
66175
66339
|
}
|
|
@@ -66350,7 +66514,7 @@
|
|
|
66350
66514
|
applyUpdate(targetD);
|
|
66351
66515
|
} else {
|
|
66352
66516
|
// animate
|
|
66353
|
-
new
|
|
66517
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.hexPolygonsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
66354
66518
|
}
|
|
66355
66519
|
}
|
|
66356
66520
|
}
|
|
@@ -66684,7 +66848,7 @@
|
|
|
66684
66848
|
applyUpdate(targetD);
|
|
66685
66849
|
} else {
|
|
66686
66850
|
// animate
|
|
66687
|
-
new
|
|
66851
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.pathTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
66688
66852
|
}
|
|
66689
66853
|
}
|
|
66690
66854
|
}
|
|
@@ -66922,7 +67086,7 @@
|
|
|
66922
67086
|
applyPosition(targetD);
|
|
66923
67087
|
} else {
|
|
66924
67088
|
// animate
|
|
66925
|
-
new
|
|
67089
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.tilesTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyPosition).start();
|
|
66926
67090
|
}
|
|
66927
67091
|
}
|
|
66928
67092
|
}
|
|
@@ -67128,7 +67292,7 @@
|
|
|
67128
67292
|
applyPosition(targetD);
|
|
67129
67293
|
} else {
|
|
67130
67294
|
// animate
|
|
67131
|
-
new
|
|
67295
|
+
new exports$1.Tween(currentTargetD).to(targetD, state.labelsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyPosition).start();
|
|
67132
67296
|
}
|
|
67133
67297
|
}
|
|
67134
67298
|
}
|
|
@@ -67303,7 +67467,7 @@
|
|
|
67303
67467
|
obj.add(circleObj);
|
|
67304
67468
|
} else {
|
|
67305
67469
|
var transitionTime = Math.abs(maxRadius / propagationSpeed) * 1000;
|
|
67306
|
-
new
|
|
67470
|
+
new exports$1.Tween({
|
|
67307
67471
|
t: 0
|
|
67308
67472
|
}).to({
|
|
67309
67473
|
t: 1
|
|
@@ -67439,7 +67603,7 @@
|
|
|
67439
67603
|
applyUpdate(targetD);
|
|
67440
67604
|
} else {
|
|
67441
67605
|
// animate
|
|
67442
|
-
new
|
|
67606
|
+
new exports$1.Tween(obj.__currentTargetD).to(targetD, state.pointsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
|
|
67443
67607
|
}
|
|
67444
67608
|
}
|
|
67445
67609
|
});
|
|
@@ -67729,7 +67893,7 @@
|
|
|
67729
67893
|
},
|
|
67730
67894
|
_animationCycle: function _animationCycle(state) {
|
|
67731
67895
|
state.animationFrameRequestId = requestAnimationFrame(this._animationCycle);
|
|
67732
|
-
|
|
67896
|
+
exports$1.update(); // run tween updates
|
|
67733
67897
|
},
|
|
67734
67898
|
|
|
67735
67899
|
_destructor: function _destructor(state) {
|
|
@@ -67789,20 +67953,20 @@
|
|
|
67789
67953
|
if (animateIn) {
|
|
67790
67954
|
// Animate build-in just once
|
|
67791
67955
|
state.scene.scale.set(1e-6, 1e-6, 1e-6);
|
|
67792
|
-
new
|
|
67956
|
+
new exports$1.Tween({
|
|
67793
67957
|
k: 1e-6
|
|
67794
67958
|
}).to({
|
|
67795
67959
|
k: 1
|
|
67796
|
-
}, 600).easing(
|
|
67960
|
+
}, 600).easing(exports$1.Easing.Quadratic.Out).onUpdate(function (_ref16) {
|
|
67797
67961
|
var k = _ref16.k;
|
|
67798
67962
|
return state.scene.scale.set(k, k, k);
|
|
67799
67963
|
}).start();
|
|
67800
67964
|
var rotAxis = new THREE$g.Vector3(0, 1, 0);
|
|
67801
|
-
new
|
|
67965
|
+
new exports$1.Tween({
|
|
67802
67966
|
rot: Math.PI * 2
|
|
67803
67967
|
}).to({
|
|
67804
67968
|
rot: 0
|
|
67805
|
-
}, 1200).easing(
|
|
67969
|
+
}, 1200).easing(exports$1.Easing.Quintic.Out).onUpdate(function (_ref17) {
|
|
67806
67970
|
var rot = _ref17.rot;
|
|
67807
67971
|
return state.scene.setRotationFromAxisAngle(rotAxis, rot);
|
|
67808
67972
|
}).start();
|
|
@@ -68054,13 +68218,13 @@
|
|
|
68054
68218
|
|
|
68055
68219
|
} else if ( scope.object.isOrthographicCamera ) {
|
|
68056
68220
|
|
|
68057
|
-
|
|
68058
|
-
|
|
68059
|
-
if ( lastZoom !== scope.object.zoom ) {
|
|
68221
|
+
scope.object.zoom = MathUtils.clamp( scope.object.zoom / factor, scope.minZoom, scope.maxZoom );
|
|
68060
68222
|
|
|
68061
|
-
|
|
68062
|
-
|
|
68063
|
-
|
|
68223
|
+
if ( lastZoom !== scope.object.zoom ) {
|
|
68224
|
+
|
|
68225
|
+
scope.object.updateProjectionMatrix();
|
|
68226
|
+
|
|
68227
|
+
}
|
|
68064
68228
|
|
|
68065
68229
|
} else {
|
|
68066
68230
|
|
|
@@ -68081,11 +68245,11 @@
|
|
|
68081
68245
|
} else if ( scope.object.isOrthographicCamera ) {
|
|
68082
68246
|
|
|
68083
68247
|
scope.object.zoom = MathUtils.clamp( scope.object.zoom / factor, scope.minZoom, scope.maxZoom );
|
|
68084
|
-
|
|
68248
|
+
|
|
68085
68249
|
if ( lastZoom !== scope.object.zoom ) {
|
|
68086
68250
|
|
|
68087
68251
|
scope.object.updateProjectionMatrix();
|
|
68088
|
-
|
|
68252
|
+
|
|
68089
68253
|
}
|
|
68090
68254
|
|
|
68091
68255
|
} else {
|
|
@@ -70489,10 +70653,11 @@
|
|
|
70489
70653
|
|
|
70490
70654
|
this.renderer = renderer;
|
|
70491
70655
|
|
|
70656
|
+
this._pixelRatio = renderer.getPixelRatio();
|
|
70657
|
+
|
|
70492
70658
|
if ( renderTarget === undefined ) {
|
|
70493
70659
|
|
|
70494
70660
|
const size = renderer.getSize( new Vector2() );
|
|
70495
|
-
this._pixelRatio = renderer.getPixelRatio();
|
|
70496
70661
|
this._width = size.width;
|
|
70497
70662
|
this._height = size.height;
|
|
70498
70663
|
|
|
@@ -70501,7 +70666,6 @@
|
|
|
70501
70666
|
|
|
70502
70667
|
} else {
|
|
70503
70668
|
|
|
70504
|
-
this._pixelRatio = 1;
|
|
70505
70669
|
this._width = renderTarget.width;
|
|
70506
70670
|
this._height = renderTarget.height;
|
|
70507
70671
|
|
|
@@ -71653,6 +71817,7 @@
|
|
|
71653
71817
|
Scene: Scene,
|
|
71654
71818
|
PerspectiveCamera: PerspectiveCamera,
|
|
71655
71819
|
Raycaster: Raycaster,
|
|
71820
|
+
SRGBColorSpace: SRGBColorSpace,
|
|
71656
71821
|
TextureLoader: TextureLoader,
|
|
71657
71822
|
Vector2: Vector2,
|
|
71658
71823
|
Vector3: Vector3,
|
|
@@ -71775,7 +71940,7 @@
|
|
|
71775
71940
|
state.hoverObj = topObject;
|
|
71776
71941
|
}
|
|
71777
71942
|
}
|
|
71778
|
-
|
|
71943
|
+
exports$1.update(); // update camera animation tweens
|
|
71779
71944
|
}
|
|
71780
71945
|
|
|
71781
71946
|
return this;
|
|
@@ -71807,10 +71972,10 @@
|
|
|
71807
71972
|
} else {
|
|
71808
71973
|
var camPos = Object.assign({}, camera.position);
|
|
71809
71974
|
var camLookAt = getLookAt();
|
|
71810
|
-
new
|
|
71975
|
+
new exports$1.Tween(camPos).to(finalPos, transitionDuration).easing(exports$1.Easing.Quadratic.Out).onUpdate(setCameraPos).start();
|
|
71811
71976
|
|
|
71812
71977
|
// Face direction in 1/3rd of time
|
|
71813
|
-
new
|
|
71978
|
+
new exports$1.Tween(camLookAt).to(finalLookAt, transitionDuration / 3).easing(exports$1.Easing.Quadratic.Out).onUpdate(setLookAt).start();
|
|
71814
71979
|
}
|
|
71815
71980
|
return this;
|
|
71816
71981
|
}
|
|
@@ -72142,6 +72307,7 @@
|
|
|
72142
72307
|
!state.loadComplete && finishLoad();
|
|
72143
72308
|
} else {
|
|
72144
72309
|
new three.TextureLoader().load(state.backgroundImageUrl, function (texture) {
|
|
72310
|
+
texture.colorSpace = three.SRGBColorSpace;
|
|
72145
72311
|
state.skysphere.material = new three.MeshBasicMaterial({
|
|
72146
72312
|
map: texture,
|
|
72147
72313
|
side: three.BackSide
|
|
@@ -72435,7 +72601,7 @@
|
|
|
72435
72601
|
// Avoid rotating more than 180deg longitude
|
|
72436
72602
|
while (curGeoCoords.lng - finalGeoCoords.lng > 180) curGeoCoords.lng -= 360;
|
|
72437
72603
|
while (curGeoCoords.lng - finalGeoCoords.lng < -180) curGeoCoords.lng += 360;
|
|
72438
|
-
new
|
|
72604
|
+
new exports$1.Tween(curGeoCoords).to(finalGeoCoords, transitionDuration).easing(exports$1.Easing.Cubic.InOut).onUpdate(setCameraPos).start();
|
|
72439
72605
|
}
|
|
72440
72606
|
return this;
|
|
72441
72607
|
}
|