globe.gl 2.23.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -18
- package/dist/globe.gl.common.js +15 -25
- package/dist/globe.gl.d.ts +18 -18
- package/dist/globe.gl.js +1131 -610
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +4 -4
- package/dist/globe.gl.module.js +15 -25
- package/package.json +11 -11
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.
|
|
1
|
+
// Version 2.24.0 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) :
|
|
@@ -40,14 +40,9 @@
|
|
|
40
40
|
|
|
41
41
|
if (Object.getOwnPropertySymbols) {
|
|
42
42
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
keys.push.apply(keys, symbols);
|
|
43
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
44
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
45
|
+
})), keys.push.apply(keys, symbols);
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
return keys;
|
|
@@ -55,19 +50,12 @@
|
|
|
55
50
|
|
|
56
51
|
function _objectSpread2$2(target) {
|
|
57
52
|
for (var i = 1; i < arguments.length; i++) {
|
|
58
|
-
var source = arguments[i]
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
65
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
66
|
-
} else {
|
|
67
|
-
ownKeys$2(Object(source)).forEach(function (key) {
|
|
68
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
69
|
-
});
|
|
70
|
-
}
|
|
53
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
54
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
55
|
+
_defineProperty$3(target, key, source[key]);
|
|
56
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
57
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
58
|
+
});
|
|
71
59
|
}
|
|
72
60
|
|
|
73
61
|
return target;
|
|
@@ -162,7 +150,7 @@
|
|
|
162
150
|
* Copyright 2010-2021 Three.js Authors
|
|
163
151
|
* SPDX-License-Identifier: MIT
|
|
164
152
|
*/
|
|
165
|
-
const REVISION = '
|
|
153
|
+
const REVISION = '136';
|
|
166
154
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
167
155
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
168
156
|
const CullFaceNone = 0;
|
|
@@ -248,7 +236,6 @@
|
|
|
248
236
|
const RGBAFormat = 1023;
|
|
249
237
|
const LuminanceFormat = 1024;
|
|
250
238
|
const LuminanceAlphaFormat = 1025;
|
|
251
|
-
const RGBEFormat = RGBAFormat;
|
|
252
239
|
const DepthFormat = 1026;
|
|
253
240
|
const DepthStencilFormat = 1027;
|
|
254
241
|
const RedFormat = 1028;
|
|
@@ -314,12 +301,6 @@
|
|
|
314
301
|
const TriangleFanDrawMode = 2;
|
|
315
302
|
const LinearEncoding = 3000;
|
|
316
303
|
const sRGBEncoding = 3001;
|
|
317
|
-
const GammaEncoding = 3007;
|
|
318
|
-
const RGBEEncoding = 3002;
|
|
319
|
-
const LogLuvEncoding = 3003;
|
|
320
|
-
const RGBM7Encoding = 3004;
|
|
321
|
-
const RGBM16Encoding = 3005;
|
|
322
|
-
const RGBDEncoding = 3006;
|
|
323
304
|
const BasicDepthPacking = 3200;
|
|
324
305
|
const RGBADepthPacking = 3201;
|
|
325
306
|
const TangentSpaceNormalMap = 0;
|
|
@@ -416,13 +397,6 @@
|
|
|
416
397
|
|
|
417
398
|
}
|
|
418
399
|
|
|
419
|
-
let _seed = 1234567;
|
|
420
|
-
|
|
421
|
-
const DEG2RAD = Math.PI / 180;
|
|
422
|
-
const RAD2DEG = 180 / Math.PI;
|
|
423
|
-
|
|
424
|
-
//
|
|
425
|
-
|
|
426
400
|
const _lut = [];
|
|
427
401
|
|
|
428
402
|
for ( let i = 0; i < 256; i ++ ) {
|
|
@@ -431,18 +405,14 @@
|
|
|
431
405
|
|
|
432
406
|
}
|
|
433
407
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
function generateUUID() {
|
|
437
|
-
|
|
438
|
-
if ( hasRandomUUID ) {
|
|
408
|
+
let _seed = 1234567;
|
|
439
409
|
|
|
440
|
-
return crypto.randomUUID().toUpperCase();
|
|
441
410
|
|
|
442
|
-
|
|
411
|
+
const DEG2RAD = Math.PI / 180;
|
|
412
|
+
const RAD2DEG = 180 / Math.PI;
|
|
443
413
|
|
|
444
|
-
|
|
445
|
-
|
|
414
|
+
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
|
|
415
|
+
function generateUUID() {
|
|
446
416
|
|
|
447
417
|
const d0 = Math.random() * 0xffffffff | 0;
|
|
448
418
|
const d1 = Math.random() * 0xffffffff | 0;
|
|
@@ -1527,42 +1497,6 @@
|
|
|
1527
1497
|
|
|
1528
1498
|
}
|
|
1529
1499
|
|
|
1530
|
-
/**
|
|
1531
|
-
* cyrb53 hash for string from: https://stackoverflow.com/a/52171480
|
|
1532
|
-
*
|
|
1533
|
-
* Public Domain, @bryc - https://stackoverflow.com/users/815680/bryc
|
|
1534
|
-
*
|
|
1535
|
-
* It is roughly similar to the well-known MurmurHash/xxHash algorithms. It uses a combination
|
|
1536
|
-
* of multiplication and Xorshift to generate the hash, but not as thorough. As a result it's
|
|
1537
|
-
* faster than either would be in JavaScript and significantly simpler to implement. Keep in
|
|
1538
|
-
* mind this is not a secure algorithm, if privacy/security is a concern, this is not for you.
|
|
1539
|
-
*
|
|
1540
|
-
* @param {string} str
|
|
1541
|
-
* @param {number} seed, default 0
|
|
1542
|
-
* @returns number
|
|
1543
|
-
*/
|
|
1544
|
-
function hashString( str, seed = 0 ) {
|
|
1545
|
-
|
|
1546
|
-
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
1547
|
-
|
|
1548
|
-
for ( let i = 0, ch; i < str.length; i ++ ) {
|
|
1549
|
-
|
|
1550
|
-
ch = str.charCodeAt( i );
|
|
1551
|
-
|
|
1552
|
-
h1 = Math.imul( h1 ^ ch, 2654435761 );
|
|
1553
|
-
|
|
1554
|
-
h2 = Math.imul( h2 ^ ch, 1597334677 );
|
|
1555
|
-
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
h1 = Math.imul( h1 ^ ( h1 >>> 16 ), 2246822507 ) ^ Math.imul( h2 ^ ( h2 >>> 13 ), 3266489909 );
|
|
1559
|
-
|
|
1560
|
-
h2 = Math.imul( h2 ^ ( h2 >>> 16 ), 2246822507 ) ^ Math.imul( h1 ^ ( h1 >>> 13 ), 3266489909 );
|
|
1561
|
-
|
|
1562
|
-
return 4294967296 * ( 2097151 & h2 ) + ( h1 >>> 0 );
|
|
1563
|
-
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
1500
|
let _canvas;
|
|
1567
1501
|
|
|
1568
1502
|
class ImageUtils {
|
|
@@ -2829,12 +2763,16 @@
|
|
|
2829
2763
|
|
|
2830
2764
|
class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
|
|
2831
2765
|
|
|
2832
|
-
constructor( width, height, options ) {
|
|
2766
|
+
constructor( width, height, options = {} ) {
|
|
2833
2767
|
|
|
2834
2768
|
super( width, height, options );
|
|
2835
2769
|
|
|
2836
2770
|
this.samples = 4;
|
|
2837
2771
|
|
|
2772
|
+
this.ignoreDepthForMultisampleCopy = options.ignoreDepth !== undefined ? options.ignoreDepth : true;
|
|
2773
|
+
this.useRenderToTexture = ( options.useRenderToTexture !== undefined ) ? options.useRenderToTexture : false;
|
|
2774
|
+
this.useRenderbuffer = this.useRenderToTexture === false;
|
|
2775
|
+
|
|
2838
2776
|
}
|
|
2839
2777
|
|
|
2840
2778
|
copy( source ) {
|
|
@@ -2842,6 +2780,8 @@
|
|
|
2842
2780
|
super.copy.call( this, source );
|
|
2843
2781
|
|
|
2844
2782
|
this.samples = source.samples;
|
|
2783
|
+
this.useRenderToTexture = source.useRenderToTexture;
|
|
2784
|
+
this.useRenderbuffer = source.useRenderbuffer;
|
|
2845
2785
|
|
|
2846
2786
|
return this;
|
|
2847
2787
|
|
|
@@ -4985,7 +4925,16 @@
|
|
|
4985
4925
|
// 1) Enclose the farthest point on the other sphere into this sphere.
|
|
4986
4926
|
// 2) Enclose the opposite point of the farthest point into this sphere.
|
|
4987
4927
|
|
|
4988
|
-
|
|
4928
|
+
if ( this.center.equals( sphere.center ) === true ) {
|
|
4929
|
+
|
|
4930
|
+
_toFarthestPoint.set( 0, 0, 1 ).multiplyScalar( sphere.radius );
|
|
4931
|
+
|
|
4932
|
+
|
|
4933
|
+
} else {
|
|
4934
|
+
|
|
4935
|
+
_toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius );
|
|
4936
|
+
|
|
4937
|
+
}
|
|
4989
4938
|
|
|
4990
4939
|
this.expandByPoint( _v1$6.copy( sphere.center ).add( _toFarthestPoint ) );
|
|
4991
4940
|
this.expandByPoint( _v1$6.copy( sphere.center ).sub( _toFarthestPoint ) );
|
|
@@ -5108,7 +5057,7 @@
|
|
|
5108
5057
|
|
|
5109
5058
|
distanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {
|
|
5110
5059
|
|
|
5111
|
-
// from
|
|
5060
|
+
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h
|
|
5112
5061
|
// It returns the min distance between the ray and the segment
|
|
5113
5062
|
// defined by v0 and v1
|
|
5114
5063
|
// It can also set two optional targets :
|
|
@@ -5407,7 +5356,7 @@
|
|
|
5407
5356
|
|
|
5408
5357
|
// Compute the offset origin, edges, and normal.
|
|
5409
5358
|
|
|
5410
|
-
// from
|
|
5359
|
+
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
|
|
5411
5360
|
|
|
5412
5361
|
_edge1.subVectors( b, a );
|
|
5413
5362
|
_edge2.subVectors( c, a );
|
|
@@ -6709,7 +6658,7 @@
|
|
|
6709
6658
|
|
|
6710
6659
|
set( channel ) {
|
|
6711
6660
|
|
|
6712
|
-
this.mask = 1 << channel | 0;
|
|
6661
|
+
this.mask = ( 1 << channel | 0 ) >>> 0;
|
|
6713
6662
|
|
|
6714
6663
|
}
|
|
6715
6664
|
|
|
@@ -6749,6 +6698,12 @@
|
|
|
6749
6698
|
|
|
6750
6699
|
}
|
|
6751
6700
|
|
|
6701
|
+
isEnabled( channel ) {
|
|
6702
|
+
|
|
6703
|
+
return ( this.mask & ( 1 << channel | 0 ) ) !== 0;
|
|
6704
|
+
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6752
6707
|
}
|
|
6753
6708
|
|
|
6754
6709
|
let _object3DId = 0;
|
|
@@ -7149,6 +7104,8 @@
|
|
|
7149
7104
|
|
|
7150
7105
|
// adds object as a child of this, while maintaining the object's world transform
|
|
7151
7106
|
|
|
7107
|
+
// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)
|
|
7108
|
+
|
|
7152
7109
|
this.updateWorldMatrix( true, false );
|
|
7153
7110
|
|
|
7154
7111
|
_m1$1.copy( this.matrixWorld ).invert();
|
|
@@ -7242,7 +7199,7 @@
|
|
|
7242
7199
|
|
|
7243
7200
|
}
|
|
7244
7201
|
|
|
7245
|
-
raycast() {}
|
|
7202
|
+
raycast( /* raycaster, intersects */ ) {}
|
|
7246
7203
|
|
|
7247
7204
|
traverse( callback ) {
|
|
7248
7205
|
|
|
@@ -8743,44 +8700,6 @@
|
|
|
8743
8700
|
|
|
8744
8701
|
}
|
|
8745
8702
|
|
|
8746
|
-
copyGammaToLinear( color, gammaFactor = 2.0 ) {
|
|
8747
|
-
|
|
8748
|
-
this.r = Math.pow( color.r, gammaFactor );
|
|
8749
|
-
this.g = Math.pow( color.g, gammaFactor );
|
|
8750
|
-
this.b = Math.pow( color.b, gammaFactor );
|
|
8751
|
-
|
|
8752
|
-
return this;
|
|
8753
|
-
|
|
8754
|
-
}
|
|
8755
|
-
|
|
8756
|
-
copyLinearToGamma( color, gammaFactor = 2.0 ) {
|
|
8757
|
-
|
|
8758
|
-
const safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;
|
|
8759
|
-
|
|
8760
|
-
this.r = Math.pow( color.r, safeInverse );
|
|
8761
|
-
this.g = Math.pow( color.g, safeInverse );
|
|
8762
|
-
this.b = Math.pow( color.b, safeInverse );
|
|
8763
|
-
|
|
8764
|
-
return this;
|
|
8765
|
-
|
|
8766
|
-
}
|
|
8767
|
-
|
|
8768
|
-
convertGammaToLinear( gammaFactor ) {
|
|
8769
|
-
|
|
8770
|
-
this.copyGammaToLinear( this, gammaFactor );
|
|
8771
|
-
|
|
8772
|
-
return this;
|
|
8773
|
-
|
|
8774
|
-
}
|
|
8775
|
-
|
|
8776
|
-
convertLinearToGamma( gammaFactor ) {
|
|
8777
|
-
|
|
8778
|
-
this.copyLinearToGamma( this, gammaFactor );
|
|
8779
|
-
|
|
8780
|
-
return this;
|
|
8781
|
-
|
|
8782
|
-
}
|
|
8783
|
-
|
|
8784
8703
|
copySRGBToLinear( color ) {
|
|
8785
8704
|
|
|
8786
8705
|
this.r = SRGBToLinear( color.r );
|
|
@@ -9592,7 +9511,7 @@
|
|
|
9592
9511
|
|
|
9593
9512
|
}
|
|
9594
9513
|
|
|
9595
|
-
let _id = 0;
|
|
9514
|
+
let _id$1 = 0;
|
|
9596
9515
|
|
|
9597
9516
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
9598
9517
|
const _obj = /*@__PURE__*/ new Object3D();
|
|
@@ -9607,7 +9526,7 @@
|
|
|
9607
9526
|
|
|
9608
9527
|
super();
|
|
9609
9528
|
|
|
9610
|
-
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
9529
|
+
Object.defineProperty( this, 'id', { value: _id$1 ++ } );
|
|
9611
9530
|
|
|
9612
9531
|
this.uuid = generateUUID();
|
|
9613
9532
|
|
|
@@ -12833,7 +12752,7 @@
|
|
|
12833
12752
|
|
|
12834
12753
|
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
|
|
12835
12754
|
|
|
12836
|
-
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 )
|
|
12755
|
+
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\treturn texture2D( envMap, uv ).rgb;\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
12837
12756
|
|
|
12838
12757
|
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
|
|
12839
12758
|
|
|
@@ -12847,11 +12766,11 @@
|
|
|
12847
12766
|
|
|
12848
12767
|
var encodings_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
12849
12768
|
|
|
12850
|
-
var encodings_pars_fragment = "
|
|
12769
|
+
var encodings_pars_fragment = "vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
|
|
12851
12770
|
|
|
12852
12771
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
12853
12772
|
|
|
12854
|
-
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\
|
|
12773
|
+
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
|
|
12855
12774
|
|
|
12856
12775
|
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
12857
12776
|
|
|
@@ -12867,7 +12786,7 @@
|
|
|
12867
12786
|
|
|
12868
12787
|
var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
|
|
12869
12788
|
|
|
12870
|
-
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).
|
|
12789
|
+
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
|
|
12871
12790
|
|
|
12872
12791
|
var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
|
|
12873
12792
|
|
|
@@ -12889,7 +12808,7 @@
|
|
|
12889
12808
|
|
|
12890
12809
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
|
|
12891
12810
|
|
|
12892
|
-
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\
|
|
12811
|
+
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
12893
12812
|
|
|
12894
12813
|
var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
12895
12814
|
|
|
@@ -13045,7 +12964,7 @@
|
|
|
13045
12964
|
|
|
13046
12965
|
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
|
|
13047
12966
|
|
|
13048
|
-
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
12967
|
+
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13049
12968
|
|
|
13050
12969
|
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13051
12970
|
|
|
@@ -13233,8 +13152,7 @@
|
|
|
13233
13152
|
flipEnvMap: { value: - 1 },
|
|
13234
13153
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
13235
13154
|
ior: { value: 1.5 }, // standard, physical
|
|
13236
|
-
refractionRatio: { value: 0.98 }
|
|
13237
|
-
maxMipLevel: { value: 0 }
|
|
13155
|
+
refractionRatio: { value: 0.98 }
|
|
13238
13156
|
|
|
13239
13157
|
},
|
|
13240
13158
|
|
|
@@ -14649,10 +14567,8 @@
|
|
|
14649
14567
|
|
|
14650
14568
|
}
|
|
14651
14569
|
|
|
14652
|
-
/* eslint-disable no-undef */
|
|
14653
14570
|
const isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ) ||
|
|
14654
14571
|
( typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext );
|
|
14655
|
-
/* eslint-enable no-undef */
|
|
14656
14572
|
|
|
14657
14573
|
let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
|
|
14658
14574
|
const maxPrecision = getMaxPrecision( precision );
|
|
@@ -15142,12 +15058,7 @@
|
|
|
15142
15058
|
|
|
15143
15059
|
const ENCODINGS = {
|
|
15144
15060
|
[ LinearEncoding ]: 0,
|
|
15145
|
-
[ sRGBEncoding ]: 1
|
|
15146
|
-
[ RGBEEncoding ]: 2,
|
|
15147
|
-
[ RGBM7Encoding ]: 3,
|
|
15148
|
-
[ RGBM16Encoding ]: 4,
|
|
15149
|
-
[ RGBDEncoding ]: 5,
|
|
15150
|
-
[ GammaEncoding ]: 6
|
|
15061
|
+
[ sRGBEncoding ]: 1
|
|
15151
15062
|
};
|
|
15152
15063
|
|
|
15153
15064
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
@@ -15231,7 +15142,7 @@
|
|
|
15231
15142
|
|
|
15232
15143
|
/**
|
|
15233
15144
|
* Generates a PMREM from an equirectangular texture, which can be either LDR
|
|
15234
|
-
*
|
|
15145
|
+
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
15235
15146
|
* as this matches best with the 256 x 256 cubemap output.
|
|
15236
15147
|
*/
|
|
15237
15148
|
fromEquirectangular( equirectangular ) {
|
|
@@ -15242,7 +15153,7 @@
|
|
|
15242
15153
|
|
|
15243
15154
|
/**
|
|
15244
15155
|
* Generates a PMREM from an cubemap texture, which can be either LDR
|
|
15245
|
-
*
|
|
15156
|
+
* or HDR. The ideal input cube size is 256 x 256,
|
|
15246
15157
|
* as this matches best with the 256 x 256 cubemap output.
|
|
15247
15158
|
*/
|
|
15248
15159
|
fromCubemap( cubemap ) {
|
|
@@ -15327,12 +15238,12 @@
|
|
|
15327
15238
|
_allocateTargets( texture ) { // warning: null texture is valid
|
|
15328
15239
|
|
|
15329
15240
|
const params = {
|
|
15330
|
-
magFilter:
|
|
15331
|
-
minFilter:
|
|
15241
|
+
magFilter: LinearFilter,
|
|
15242
|
+
minFilter: LinearFilter,
|
|
15332
15243
|
generateMipmaps: false,
|
|
15333
|
-
type:
|
|
15334
|
-
format:
|
|
15335
|
-
encoding:
|
|
15244
|
+
type: HalfFloatType,
|
|
15245
|
+
format: RGBAFormat,
|
|
15246
|
+
encoding: LinearEncoding,
|
|
15336
15247
|
depthBuffer: false
|
|
15337
15248
|
};
|
|
15338
15249
|
|
|
@@ -15360,12 +15271,10 @@
|
|
|
15360
15271
|
const renderer = this._renderer;
|
|
15361
15272
|
|
|
15362
15273
|
const originalAutoClear = renderer.autoClear;
|
|
15363
|
-
const outputEncoding = renderer.outputEncoding;
|
|
15364
15274
|
const toneMapping = renderer.toneMapping;
|
|
15365
15275
|
renderer.getClearColor( _clearColor );
|
|
15366
15276
|
|
|
15367
15277
|
renderer.toneMapping = NoToneMapping;
|
|
15368
|
-
renderer.outputEncoding = LinearEncoding;
|
|
15369
15278
|
renderer.autoClear = false;
|
|
15370
15279
|
|
|
15371
15280
|
const backgroundMaterial = new MeshBasicMaterial( {
|
|
@@ -15435,7 +15344,6 @@
|
|
|
15435
15344
|
backgroundBox.material.dispose();
|
|
15436
15345
|
|
|
15437
15346
|
renderer.toneMapping = toneMapping;
|
|
15438
|
-
renderer.outputEncoding = outputEncoding;
|
|
15439
15347
|
renderer.autoClear = originalAutoClear;
|
|
15440
15348
|
scene.background = background;
|
|
15441
15349
|
|
|
@@ -15493,7 +15401,6 @@
|
|
|
15493
15401
|
}
|
|
15494
15402
|
|
|
15495
15403
|
this._setEncoding( uniforms[ 'inputEncoding' ], texture );
|
|
15496
|
-
this._setEncoding( uniforms[ 'outputEncoding' ], cubeUVRenderTarget.texture );
|
|
15497
15404
|
|
|
15498
15405
|
_setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );
|
|
15499
15406
|
|
|
@@ -15625,9 +15532,6 @@
|
|
|
15625
15532
|
blurUniforms[ 'dTheta' ].value = radiansPerPixel;
|
|
15626
15533
|
blurUniforms[ 'mipInt' ].value = LOD_MAX - lodIn;
|
|
15627
15534
|
|
|
15628
|
-
this._setEncoding( blurUniforms[ 'inputEncoding' ], targetIn.texture );
|
|
15629
|
-
this._setEncoding( blurUniforms[ 'outputEncoding' ], targetIn.texture );
|
|
15630
|
-
|
|
15631
15535
|
const outputSize = _sizeLods[ lodOut ];
|
|
15632
15536
|
const x = 3 * Math.max( 0, SIZE_MAX - 2 * outputSize );
|
|
15633
15537
|
const y = ( lodOut === 0 ? 0 : 2 * SIZE_MAX ) + 2 * outputSize * ( lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0 );
|
|
@@ -15640,14 +15544,6 @@
|
|
|
15640
15544
|
|
|
15641
15545
|
}
|
|
15642
15546
|
|
|
15643
|
-
function _isLDR( texture ) {
|
|
15644
|
-
|
|
15645
|
-
if ( texture === undefined || texture.type !== UnsignedByteType ) return false;
|
|
15646
|
-
|
|
15647
|
-
return texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding;
|
|
15648
|
-
|
|
15649
|
-
}
|
|
15650
|
-
|
|
15651
15547
|
function _createPlanes() {
|
|
15652
15548
|
|
|
15653
15549
|
const _lodPlanes = [];
|
|
@@ -15760,9 +15656,7 @@
|
|
|
15760
15656
|
'latitudinal': { value: false },
|
|
15761
15657
|
'dTheta': { value: 0 },
|
|
15762
15658
|
'mipInt': { value: 0 },
|
|
15763
|
-
'poleAxis': { value: poleAxis }
|
|
15764
|
-
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },
|
|
15765
|
-
'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15659
|
+
'poleAxis': { value: poleAxis }
|
|
15766
15660
|
},
|
|
15767
15661
|
|
|
15768
15662
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15828,8 +15722,6 @@
|
|
|
15828
15722
|
|
|
15829
15723
|
}
|
|
15830
15724
|
|
|
15831
|
-
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
15832
|
-
|
|
15833
15725
|
}
|
|
15834
15726
|
`,
|
|
15835
15727
|
|
|
@@ -15853,8 +15745,7 @@
|
|
|
15853
15745
|
uniforms: {
|
|
15854
15746
|
'envMap': { value: null },
|
|
15855
15747
|
'texelSize': { value: texelSize },
|
|
15856
|
-
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15857
|
-
'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15748
|
+
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15858
15749
|
},
|
|
15859
15750
|
|
|
15860
15751
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15894,8 +15785,6 @@
|
|
|
15894
15785
|
vec3 bm = mix( bl, br, f.x );
|
|
15895
15786
|
gl_FragColor.rgb = mix( tm, bm, f.y );
|
|
15896
15787
|
|
|
15897
|
-
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
15898
|
-
|
|
15899
15788
|
}
|
|
15900
15789
|
`,
|
|
15901
15790
|
|
|
@@ -15917,8 +15806,7 @@
|
|
|
15917
15806
|
|
|
15918
15807
|
uniforms: {
|
|
15919
15808
|
'envMap': { value: null },
|
|
15920
|
-
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15921
|
-
'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15809
|
+
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] }
|
|
15922
15810
|
},
|
|
15923
15811
|
|
|
15924
15812
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15936,9 +15824,7 @@
|
|
|
15936
15824
|
|
|
15937
15825
|
void main() {
|
|
15938
15826
|
|
|
15939
|
-
gl_FragColor =
|
|
15940
|
-
gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
|
|
15941
|
-
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
15827
|
+
gl_FragColor = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) );
|
|
15942
15828
|
|
|
15943
15829
|
}
|
|
15944
15830
|
`,
|
|
@@ -16021,7 +15907,6 @@
|
|
|
16021
15907
|
return /* glsl */`
|
|
16022
15908
|
|
|
16023
15909
|
uniform int inputEncoding;
|
|
16024
|
-
uniform int outputEncoding;
|
|
16025
15910
|
|
|
16026
15911
|
#include <encodings_pars_fragment>
|
|
16027
15912
|
|
|
@@ -16031,63 +15916,9 @@
|
|
|
16031
15916
|
|
|
16032
15917
|
return value;
|
|
16033
15918
|
|
|
16034
|
-
} else if ( inputEncoding == 1 ) {
|
|
16035
|
-
|
|
16036
|
-
return sRGBToLinear( value );
|
|
16037
|
-
|
|
16038
|
-
} else if ( inputEncoding == 2 ) {
|
|
16039
|
-
|
|
16040
|
-
return RGBEToLinear( value );
|
|
16041
|
-
|
|
16042
|
-
} else if ( inputEncoding == 3 ) {
|
|
16043
|
-
|
|
16044
|
-
return RGBMToLinear( value, 7.0 );
|
|
16045
|
-
|
|
16046
|
-
} else if ( inputEncoding == 4 ) {
|
|
16047
|
-
|
|
16048
|
-
return RGBMToLinear( value, 16.0 );
|
|
16049
|
-
|
|
16050
|
-
} else if ( inputEncoding == 5 ) {
|
|
16051
|
-
|
|
16052
|
-
return RGBDToLinear( value, 256.0 );
|
|
16053
|
-
|
|
16054
|
-
} else {
|
|
16055
|
-
|
|
16056
|
-
return GammaToLinear( value, 2.2 );
|
|
16057
|
-
|
|
16058
|
-
}
|
|
16059
|
-
|
|
16060
|
-
}
|
|
16061
|
-
|
|
16062
|
-
vec4 linearToOutputTexel( vec4 value ) {
|
|
16063
|
-
|
|
16064
|
-
if ( outputEncoding == 0 ) {
|
|
16065
|
-
|
|
16066
|
-
return value;
|
|
16067
|
-
|
|
16068
|
-
} else if ( outputEncoding == 1 ) {
|
|
16069
|
-
|
|
16070
|
-
return LinearTosRGB( value );
|
|
16071
|
-
|
|
16072
|
-
} else if ( outputEncoding == 2 ) {
|
|
16073
|
-
|
|
16074
|
-
return LinearToRGBE( value );
|
|
16075
|
-
|
|
16076
|
-
} else if ( outputEncoding == 3 ) {
|
|
16077
|
-
|
|
16078
|
-
return LinearToRGBM( value, 7.0 );
|
|
16079
|
-
|
|
16080
|
-
} else if ( outputEncoding == 4 ) {
|
|
16081
|
-
|
|
16082
|
-
return LinearToRGBM( value, 16.0 );
|
|
16083
|
-
|
|
16084
|
-
} else if ( outputEncoding == 5 ) {
|
|
16085
|
-
|
|
16086
|
-
return LinearToRGBD( value, 256.0 );
|
|
16087
|
-
|
|
16088
15919
|
} else {
|
|
16089
15920
|
|
|
16090
|
-
return
|
|
15921
|
+
return sRGBToLinear( value );
|
|
16091
15922
|
|
|
16092
15923
|
}
|
|
16093
15924
|
|
|
@@ -16287,6 +16118,7 @@
|
|
|
16287
16118
|
|
|
16288
16119
|
getExtension( 'OES_texture_float_linear' );
|
|
16289
16120
|
getExtension( 'EXT_color_buffer_half_float' );
|
|
16121
|
+
getExtension( 'WEBGL_multisampled_render_to_texture' );
|
|
16290
16122
|
|
|
16291
16123
|
},
|
|
16292
16124
|
|
|
@@ -16654,8 +16486,6 @@
|
|
|
16654
16486
|
this.flipY = false;
|
|
16655
16487
|
this.unpackAlignment = 1;
|
|
16656
16488
|
|
|
16657
|
-
this.needsUpdate = true;
|
|
16658
|
-
|
|
16659
16489
|
}
|
|
16660
16490
|
|
|
16661
16491
|
}
|
|
@@ -16743,6 +16573,7 @@
|
|
|
16743
16573
|
const texture = new DataTexture2DArray( buffer, width, height, numberOfMorphTargets );
|
|
16744
16574
|
texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower)
|
|
16745
16575
|
texture.type = FloatType;
|
|
16576
|
+
texture.needsUpdate = true;
|
|
16746
16577
|
|
|
16747
16578
|
// fill buffer
|
|
16748
16579
|
|
|
@@ -17033,8 +16864,6 @@
|
|
|
17033
16864
|
this.flipY = false;
|
|
17034
16865
|
this.unpackAlignment = 1;
|
|
17035
16866
|
|
|
17036
|
-
this.needsUpdate = true;
|
|
17037
|
-
|
|
17038
16867
|
}
|
|
17039
16868
|
|
|
17040
16869
|
}
|
|
@@ -17728,7 +17557,7 @@
|
|
|
17728
17557
|
}
|
|
17729
17558
|
|
|
17730
17559
|
|
|
17731
|
-
// Array of textures (2D / Cube)
|
|
17560
|
+
// Array of textures (2D / 3D / Cube / 2DArray)
|
|
17732
17561
|
|
|
17733
17562
|
function setValueT1Array( gl, v, textures ) {
|
|
17734
17563
|
|
|
@@ -17746,6 +17575,22 @@
|
|
|
17746
17575
|
|
|
17747
17576
|
}
|
|
17748
17577
|
|
|
17578
|
+
function setValueT3DArray( gl, v, textures ) {
|
|
17579
|
+
|
|
17580
|
+
const n = v.length;
|
|
17581
|
+
|
|
17582
|
+
const units = allocTexUnits( textures, n );
|
|
17583
|
+
|
|
17584
|
+
gl.uniform1iv( this.addr, units );
|
|
17585
|
+
|
|
17586
|
+
for ( let i = 0; i !== n; ++ i ) {
|
|
17587
|
+
|
|
17588
|
+
textures.setTexture3D( v[ i ] || emptyTexture3d, units[ i ] );
|
|
17589
|
+
|
|
17590
|
+
}
|
|
17591
|
+
|
|
17592
|
+
}
|
|
17593
|
+
|
|
17749
17594
|
function setValueT6Array( gl, v, textures ) {
|
|
17750
17595
|
|
|
17751
17596
|
const n = v.length;
|
|
@@ -17762,6 +17607,23 @@
|
|
|
17762
17607
|
|
|
17763
17608
|
}
|
|
17764
17609
|
|
|
17610
|
+
function setValueT2DArrayArray( gl, v, textures ) {
|
|
17611
|
+
|
|
17612
|
+
const n = v.length;
|
|
17613
|
+
|
|
17614
|
+
const units = allocTexUnits( textures, n );
|
|
17615
|
+
|
|
17616
|
+
gl.uniform1iv( this.addr, units );
|
|
17617
|
+
|
|
17618
|
+
for ( let i = 0; i !== n; ++ i ) {
|
|
17619
|
+
|
|
17620
|
+
textures.setTexture2DArray( v[ i ] || emptyTexture2dArray, units[ i ] );
|
|
17621
|
+
|
|
17622
|
+
}
|
|
17623
|
+
|
|
17624
|
+
}
|
|
17625
|
+
|
|
17626
|
+
|
|
17765
17627
|
// Helper to pick the right setter for a pure (bottom-level) array
|
|
17766
17628
|
|
|
17767
17629
|
function getPureArraySetter( type ) {
|
|
@@ -17794,12 +17656,23 @@
|
|
|
17794
17656
|
case 0x8b62: // SAMPLER_2D_SHADOW
|
|
17795
17657
|
return setValueT1Array;
|
|
17796
17658
|
|
|
17659
|
+
case 0x8b5f: // SAMPLER_3D
|
|
17660
|
+
case 0x8dcb: // INT_SAMPLER_3D
|
|
17661
|
+
case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D
|
|
17662
|
+
return setValueT3DArray;
|
|
17663
|
+
|
|
17797
17664
|
case 0x8b60: // SAMPLER_CUBE
|
|
17798
17665
|
case 0x8dcc: // INT_SAMPLER_CUBE
|
|
17799
17666
|
case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE
|
|
17800
17667
|
case 0x8dc5: // SAMPLER_CUBE_SHADOW
|
|
17801
17668
|
return setValueT6Array;
|
|
17802
17669
|
|
|
17670
|
+
case 0x8dc1: // SAMPLER_2D_ARRAY
|
|
17671
|
+
case 0x8dcf: // INT_SAMPLER_2D_ARRAY
|
|
17672
|
+
case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY
|
|
17673
|
+
case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW
|
|
17674
|
+
return setValueT2DArrayArray;
|
|
17675
|
+
|
|
17803
17676
|
}
|
|
17804
17677
|
|
|
17805
17678
|
}
|
|
@@ -18045,18 +17918,6 @@
|
|
|
18045
17918
|
return [ 'Linear', '( value )' ];
|
|
18046
17919
|
case sRGBEncoding:
|
|
18047
17920
|
return [ 'sRGB', '( value )' ];
|
|
18048
|
-
case RGBEEncoding:
|
|
18049
|
-
return [ 'RGBE', '( value )' ];
|
|
18050
|
-
case RGBM7Encoding:
|
|
18051
|
-
return [ 'RGBM', '( value, 7.0 )' ];
|
|
18052
|
-
case RGBM16Encoding:
|
|
18053
|
-
return [ 'RGBM', '( value, 16.0 )' ];
|
|
18054
|
-
case RGBDEncoding:
|
|
18055
|
-
return [ 'RGBD', '( value, 256.0 )' ];
|
|
18056
|
-
case GammaEncoding:
|
|
18057
|
-
return [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];
|
|
18058
|
-
case LogLuvEncoding:
|
|
18059
|
-
return [ 'LogLuv', '( value )' ];
|
|
18060
17921
|
default:
|
|
18061
17922
|
console.warn( 'THREE.WebGLProgram: Unsupported encoding:', encoding );
|
|
18062
17923
|
return [ 'Linear', '( value )' ];
|
|
@@ -18417,9 +18278,6 @@
|
|
|
18417
18278
|
const envMapModeDefine = generateEnvMapModeDefine( parameters );
|
|
18418
18279
|
const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
|
|
18419
18280
|
|
|
18420
|
-
|
|
18421
|
-
const gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;
|
|
18422
|
-
|
|
18423
18281
|
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
18424
18282
|
|
|
18425
18283
|
const customDefines = generateDefines( defines );
|
|
@@ -18471,8 +18329,6 @@
|
|
|
18471
18329
|
|
|
18472
18330
|
parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',
|
|
18473
18331
|
|
|
18474
|
-
'#define GAMMA_FACTOR ' + gammaFactorDefine,
|
|
18475
|
-
|
|
18476
18332
|
'#define MAX_BONES ' + parameters.maxBones,
|
|
18477
18333
|
( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',
|
|
18478
18334
|
( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',
|
|
@@ -18621,8 +18477,6 @@
|
|
|
18621
18477
|
|
|
18622
18478
|
customDefines,
|
|
18623
18479
|
|
|
18624
|
-
'#define GAMMA_FACTOR ' + gammaFactorDefine,
|
|
18625
|
-
|
|
18626
18480
|
( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',
|
|
18627
18481
|
( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',
|
|
18628
18482
|
|
|
@@ -18742,7 +18596,7 @@
|
|
|
18742
18596
|
|
|
18743
18597
|
prefixFragment = [
|
|
18744
18598
|
'#define varying in',
|
|
18745
|
-
( parameters.glslVersion === GLSL3 ) ? '' : 'out highp vec4 pc_fragColor;',
|
|
18599
|
+
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
|
|
18746
18600
|
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
18747
18601
|
'#define gl_FragDepthEXT gl_FragDepth',
|
|
18748
18602
|
'#define texture2D texture',
|
|
@@ -18914,8 +18768,129 @@
|
|
|
18914
18768
|
|
|
18915
18769
|
}
|
|
18916
18770
|
|
|
18771
|
+
let _id = 0;
|
|
18772
|
+
|
|
18773
|
+
class WebGLShaderCache {
|
|
18774
|
+
|
|
18775
|
+
constructor() {
|
|
18776
|
+
|
|
18777
|
+
this.shaderCache = new Map();
|
|
18778
|
+
this.materialCache = new Map();
|
|
18779
|
+
|
|
18780
|
+
}
|
|
18781
|
+
|
|
18782
|
+
update( material ) {
|
|
18783
|
+
|
|
18784
|
+
const vertexShader = material.vertexShader;
|
|
18785
|
+
const fragmentShader = material.fragmentShader;
|
|
18786
|
+
|
|
18787
|
+
const vertexShaderStage = this._getShaderStage( vertexShader );
|
|
18788
|
+
const fragmentShaderStage = this._getShaderStage( fragmentShader );
|
|
18789
|
+
|
|
18790
|
+
const materialShaders = this._getShaderCacheForMaterial( material );
|
|
18791
|
+
|
|
18792
|
+
if ( materialShaders.has( vertexShaderStage ) === false ) {
|
|
18793
|
+
|
|
18794
|
+
materialShaders.add( vertexShaderStage );
|
|
18795
|
+
vertexShaderStage.usedTimes ++;
|
|
18796
|
+
|
|
18797
|
+
}
|
|
18798
|
+
|
|
18799
|
+
if ( materialShaders.has( fragmentShaderStage ) === false ) {
|
|
18800
|
+
|
|
18801
|
+
materialShaders.add( fragmentShaderStage );
|
|
18802
|
+
fragmentShaderStage.usedTimes ++;
|
|
18803
|
+
|
|
18804
|
+
}
|
|
18805
|
+
|
|
18806
|
+
return this;
|
|
18807
|
+
|
|
18808
|
+
}
|
|
18809
|
+
|
|
18810
|
+
remove( material ) {
|
|
18811
|
+
|
|
18812
|
+
const materialShaders = this.materialCache.get( material );
|
|
18813
|
+
|
|
18814
|
+
for ( const shaderStage of materialShaders ) {
|
|
18815
|
+
|
|
18816
|
+
shaderStage.usedTimes --;
|
|
18817
|
+
|
|
18818
|
+
if ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage );
|
|
18819
|
+
|
|
18820
|
+
}
|
|
18821
|
+
|
|
18822
|
+
this.materialCache.delete( material );
|
|
18823
|
+
|
|
18824
|
+
return this;
|
|
18825
|
+
|
|
18826
|
+
}
|
|
18827
|
+
|
|
18828
|
+
getVertexShaderID( material ) {
|
|
18829
|
+
|
|
18830
|
+
return this._getShaderStage( material.vertexShader ).id;
|
|
18831
|
+
|
|
18832
|
+
}
|
|
18833
|
+
|
|
18834
|
+
getFragmentShaderID( material ) {
|
|
18835
|
+
|
|
18836
|
+
return this._getShaderStage( material.fragmentShader ).id;
|
|
18837
|
+
|
|
18838
|
+
}
|
|
18839
|
+
|
|
18840
|
+
dispose() {
|
|
18841
|
+
|
|
18842
|
+
this.shaderCache.clear();
|
|
18843
|
+
this.materialCache.clear();
|
|
18844
|
+
|
|
18845
|
+
}
|
|
18846
|
+
|
|
18847
|
+
_getShaderCacheForMaterial( material ) {
|
|
18848
|
+
|
|
18849
|
+
const cache = this.materialCache;
|
|
18850
|
+
|
|
18851
|
+
if ( cache.has( material ) === false ) {
|
|
18852
|
+
|
|
18853
|
+
cache.set( material, new Set() );
|
|
18854
|
+
|
|
18855
|
+
}
|
|
18856
|
+
|
|
18857
|
+
return cache.get( material );
|
|
18858
|
+
|
|
18859
|
+
}
|
|
18860
|
+
|
|
18861
|
+
_getShaderStage( code ) {
|
|
18862
|
+
|
|
18863
|
+
const cache = this.shaderCache;
|
|
18864
|
+
|
|
18865
|
+
if ( cache.has( code ) === false ) {
|
|
18866
|
+
|
|
18867
|
+
const stage = new WebGLShaderStage();
|
|
18868
|
+
cache.set( code, stage );
|
|
18869
|
+
|
|
18870
|
+
}
|
|
18871
|
+
|
|
18872
|
+
return cache.get( code );
|
|
18873
|
+
|
|
18874
|
+
}
|
|
18875
|
+
|
|
18876
|
+
}
|
|
18877
|
+
|
|
18878
|
+
class WebGLShaderStage {
|
|
18879
|
+
|
|
18880
|
+
constructor() {
|
|
18881
|
+
|
|
18882
|
+
this.id = _id ++;
|
|
18883
|
+
|
|
18884
|
+
this.usedTimes = 0;
|
|
18885
|
+
|
|
18886
|
+
}
|
|
18887
|
+
|
|
18888
|
+
}
|
|
18889
|
+
|
|
18917
18890
|
function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {
|
|
18918
18891
|
|
|
18892
|
+
const _programLayers = new Layers();
|
|
18893
|
+
const _customShaders = new WebGLShaderCache();
|
|
18919
18894
|
const programs = [];
|
|
18920
18895
|
|
|
18921
18896
|
const isWebGL2 = capabilities.isWebGL2;
|
|
@@ -18923,7 +18898,6 @@
|
|
|
18923
18898
|
const floatVertexTextures = capabilities.floatVertexTextures;
|
|
18924
18899
|
const maxVertexUniforms = capabilities.maxVertexUniforms;
|
|
18925
18900
|
const vertexTextures = capabilities.vertexTextures;
|
|
18926
|
-
|
|
18927
18901
|
let precision = capabilities.precision;
|
|
18928
18902
|
|
|
18929
18903
|
const shaderIDs = {
|
|
@@ -18944,25 +18918,6 @@
|
|
|
18944
18918
|
SpriteMaterial: 'sprite'
|
|
18945
18919
|
};
|
|
18946
18920
|
|
|
18947
|
-
const parameterNames = [
|
|
18948
|
-
'precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor',
|
|
18949
|
-
'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV',
|
|
18950
|
-
'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap',
|
|
18951
|
-
'objectSpaceNormalMap', 'tangentSpaceNormalMap',
|
|
18952
|
-
'clearcoat', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap',
|
|
18953
|
-
'displacementMap', 'specularMap', , 'roughnessMap', 'metalnessMap', 'gradientMap',
|
|
18954
|
-
'alphaMap', 'alphaTest', 'combine', 'vertexColors', 'vertexAlphas', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2',
|
|
18955
|
-
'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning',
|
|
18956
|
-
'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'morphTargetsCount', 'premultipliedAlpha',
|
|
18957
|
-
'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights',
|
|
18958
|
-
'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows',
|
|
18959
|
-
'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights',
|
|
18960
|
-
'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'format',
|
|
18961
|
-
'specularIntensityMap', 'specularColorMap', 'specularColorMapEncoding',
|
|
18962
|
-
'transmission', 'transmissionMap', 'thicknessMap',
|
|
18963
|
-
'sheen', 'sheenColorMap', 'sheenColorMapEncoding', 'sheenRoughnessMap'
|
|
18964
|
-
];
|
|
18965
|
-
|
|
18966
18921
|
function getMaxBones( object ) {
|
|
18967
18922
|
|
|
18968
18923
|
const skeleton = object.skeleton;
|
|
@@ -19055,6 +19010,7 @@
|
|
|
19055
19010
|
}
|
|
19056
19011
|
|
|
19057
19012
|
let vertexShader, fragmentShader;
|
|
19013
|
+
let customVertexShaderID, customFragmentShaderID;
|
|
19058
19014
|
|
|
19059
19015
|
if ( shaderID ) {
|
|
19060
19016
|
|
|
@@ -19068,6 +19024,11 @@
|
|
|
19068
19024
|
vertexShader = material.vertexShader;
|
|
19069
19025
|
fragmentShader = material.fragmentShader;
|
|
19070
19026
|
|
|
19027
|
+
_customShaders.update( material );
|
|
19028
|
+
|
|
19029
|
+
customVertexShaderID = _customShaders.getVertexShaderID( material );
|
|
19030
|
+
customFragmentShaderID = _customShaders.getFragmentShaderID( material );
|
|
19031
|
+
|
|
19071
19032
|
}
|
|
19072
19033
|
|
|
19073
19034
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
@@ -19086,6 +19047,9 @@
|
|
|
19086
19047
|
fragmentShader: fragmentShader,
|
|
19087
19048
|
defines: material.defines,
|
|
19088
19049
|
|
|
19050
|
+
customVertexShaderID: customVertexShaderID,
|
|
19051
|
+
customFragmentShaderID: customFragmentShaderID,
|
|
19052
|
+
|
|
19089
19053
|
isRawShaderMaterial: material.isRawShaderMaterial === true,
|
|
19090
19054
|
glslVersion: material.glslVersion,
|
|
19091
19055
|
|
|
@@ -19146,8 +19110,8 @@
|
|
|
19146
19110
|
vertexTangents: ( !! material.normalMap && !! object.geometry && !! object.geometry.attributes.tangent ),
|
|
19147
19111
|
vertexColors: material.vertexColors,
|
|
19148
19112
|
vertexAlphas: material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
|
|
19149
|
-
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || material.sheenRoughnessMap,
|
|
19150
|
-
uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap ||
|
|
19113
|
+
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || !! material.sheenRoughnessMap,
|
|
19114
|
+
uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
|
|
19151
19115
|
|
|
19152
19116
|
fog: !! fog,
|
|
19153
19117
|
useFog: material.fog,
|
|
@@ -19224,8 +19188,8 @@
|
|
|
19224
19188
|
|
|
19225
19189
|
} else {
|
|
19226
19190
|
|
|
19227
|
-
array.push(
|
|
19228
|
-
array.push(
|
|
19191
|
+
array.push( parameters.customVertexShaderID );
|
|
19192
|
+
array.push( parameters.customFragmentShaderID );
|
|
19229
19193
|
|
|
19230
19194
|
}
|
|
19231
19195
|
|
|
@@ -19242,14 +19206,9 @@
|
|
|
19242
19206
|
|
|
19243
19207
|
if ( parameters.isRawShaderMaterial === false ) {
|
|
19244
19208
|
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
array.push( parameters[ parameterNames[ i ] ] );
|
|
19248
|
-
|
|
19249
|
-
}
|
|
19250
|
-
|
|
19209
|
+
getProgramCacheKeyParameters( array, parameters );
|
|
19210
|
+
getProgramCacheKeyBooleans( array, parameters );
|
|
19251
19211
|
array.push( renderer.outputEncoding );
|
|
19252
|
-
array.push( renderer.gammaFactor );
|
|
19253
19212
|
|
|
19254
19213
|
}
|
|
19255
19214
|
|
|
@@ -19259,6 +19218,161 @@
|
|
|
19259
19218
|
|
|
19260
19219
|
}
|
|
19261
19220
|
|
|
19221
|
+
function getProgramCacheKeyParameters( array, parameters ) {
|
|
19222
|
+
|
|
19223
|
+
array.push( parameters.precision );
|
|
19224
|
+
array.push( parameters.outputEncoding );
|
|
19225
|
+
array.push( parameters.mapEncoding );
|
|
19226
|
+
array.push( parameters.matcapEncoding );
|
|
19227
|
+
array.push( parameters.envMapMode );
|
|
19228
|
+
array.push( parameters.envMapEncoding );
|
|
19229
|
+
array.push( parameters.lightMapEncoding );
|
|
19230
|
+
array.push( parameters.emissiveMapEncoding );
|
|
19231
|
+
array.push( parameters.combine );
|
|
19232
|
+
array.push( parameters.vertexUvs );
|
|
19233
|
+
array.push( parameters.fogExp2 );
|
|
19234
|
+
array.push( parameters.sizeAttenuation );
|
|
19235
|
+
array.push( parameters.maxBones );
|
|
19236
|
+
array.push( parameters.morphTargetsCount );
|
|
19237
|
+
array.push( parameters.numDirLights );
|
|
19238
|
+
array.push( parameters.numPointLights );
|
|
19239
|
+
array.push( parameters.numSpotLights );
|
|
19240
|
+
array.push( parameters.numHemiLights );
|
|
19241
|
+
array.push( parameters.numRectAreaLights );
|
|
19242
|
+
array.push( parameters.numDirLightShadows );
|
|
19243
|
+
array.push( parameters.numPointLightShadows );
|
|
19244
|
+
array.push( parameters.numSpotLightShadows );
|
|
19245
|
+
array.push( parameters.shadowMapType );
|
|
19246
|
+
array.push( parameters.toneMapping );
|
|
19247
|
+
array.push( parameters.numClippingPlanes );
|
|
19248
|
+
array.push( parameters.numClipIntersection );
|
|
19249
|
+
array.push( parameters.format );
|
|
19250
|
+
array.push( parameters.specularColorMapEncoding );
|
|
19251
|
+
array.push( parameters.sheenColorMapEncoding );
|
|
19252
|
+
|
|
19253
|
+
}
|
|
19254
|
+
|
|
19255
|
+
function getProgramCacheKeyBooleans( array, parameters ) {
|
|
19256
|
+
|
|
19257
|
+
_programLayers.disableAll();
|
|
19258
|
+
|
|
19259
|
+
if ( parameters.isWebGL2 )
|
|
19260
|
+
_programLayers.enable( 0 );
|
|
19261
|
+
if ( parameters.supportsVertexTextures )
|
|
19262
|
+
_programLayers.enable( 1 );
|
|
19263
|
+
if ( parameters.instancing )
|
|
19264
|
+
_programLayers.enable( 2 );
|
|
19265
|
+
if ( parameters.instancingColor )
|
|
19266
|
+
_programLayers.enable( 3 );
|
|
19267
|
+
if ( parameters.map )
|
|
19268
|
+
_programLayers.enable( 4 );
|
|
19269
|
+
if ( parameters.matcap )
|
|
19270
|
+
_programLayers.enable( 5 );
|
|
19271
|
+
if ( parameters.envMap )
|
|
19272
|
+
_programLayers.enable( 6 );
|
|
19273
|
+
if ( parameters.envMapCubeUV )
|
|
19274
|
+
_programLayers.enable( 7 );
|
|
19275
|
+
if ( parameters.lightMap )
|
|
19276
|
+
_programLayers.enable( 8 );
|
|
19277
|
+
if ( parameters.aoMap )
|
|
19278
|
+
_programLayers.enable( 9 );
|
|
19279
|
+
if ( parameters.emissiveMap )
|
|
19280
|
+
_programLayers.enable( 10 );
|
|
19281
|
+
if ( parameters.bumpMap )
|
|
19282
|
+
_programLayers.enable( 11 );
|
|
19283
|
+
if ( parameters.normalMap )
|
|
19284
|
+
_programLayers.enable( 12 );
|
|
19285
|
+
if ( parameters.objectSpaceNormalMap )
|
|
19286
|
+
_programLayers.enable( 13 );
|
|
19287
|
+
if ( parameters.tangentSpaceNormalMap )
|
|
19288
|
+
_programLayers.enable( 14 );
|
|
19289
|
+
if ( parameters.clearcoat )
|
|
19290
|
+
_programLayers.enable( 15 );
|
|
19291
|
+
if ( parameters.clearcoatMap )
|
|
19292
|
+
_programLayers.enable( 16 );
|
|
19293
|
+
if ( parameters.clearcoatRoughnessMap )
|
|
19294
|
+
_programLayers.enable( 17 );
|
|
19295
|
+
if ( parameters.clearcoatNormalMap )
|
|
19296
|
+
_programLayers.enable( 18 );
|
|
19297
|
+
if ( parameters.displacementMap )
|
|
19298
|
+
_programLayers.enable( 19 );
|
|
19299
|
+
if ( parameters.specularMap )
|
|
19300
|
+
_programLayers.enable( 20 );
|
|
19301
|
+
if ( parameters.roughnessMap )
|
|
19302
|
+
_programLayers.enable( 21 );
|
|
19303
|
+
if ( parameters.metalnessMap )
|
|
19304
|
+
_programLayers.enable( 22 );
|
|
19305
|
+
if ( parameters.gradientMap )
|
|
19306
|
+
_programLayers.enable( 23 );
|
|
19307
|
+
if ( parameters.alphaMap )
|
|
19308
|
+
_programLayers.enable( 24 );
|
|
19309
|
+
if ( parameters.alphaTest )
|
|
19310
|
+
_programLayers.enable( 25 );
|
|
19311
|
+
if ( parameters.vertexColors )
|
|
19312
|
+
_programLayers.enable( 26 );
|
|
19313
|
+
if ( parameters.vertexAlphas )
|
|
19314
|
+
_programLayers.enable( 27 );
|
|
19315
|
+
if ( parameters.vertexUvs )
|
|
19316
|
+
_programLayers.enable( 28 );
|
|
19317
|
+
if ( parameters.vertexTangents )
|
|
19318
|
+
_programLayers.enable( 29 );
|
|
19319
|
+
if ( parameters.uvsVertexOnly )
|
|
19320
|
+
_programLayers.enable( 30 );
|
|
19321
|
+
if ( parameters.fog )
|
|
19322
|
+
_programLayers.enable( 31 );
|
|
19323
|
+
|
|
19324
|
+
array.push( _programLayers.mask );
|
|
19325
|
+
_programLayers.disableAll();
|
|
19326
|
+
|
|
19327
|
+
if ( parameters.useFog )
|
|
19328
|
+
_programLayers.enable( 0 );
|
|
19329
|
+
if ( parameters.flatShading )
|
|
19330
|
+
_programLayers.enable( 1 );
|
|
19331
|
+
if ( parameters.logarithmicDepthBuffer )
|
|
19332
|
+
_programLayers.enable( 2 );
|
|
19333
|
+
if ( parameters.skinning )
|
|
19334
|
+
_programLayers.enable( 3 );
|
|
19335
|
+
if ( parameters.useVertexTexture )
|
|
19336
|
+
_programLayers.enable( 4 );
|
|
19337
|
+
if ( parameters.morphTargets )
|
|
19338
|
+
_programLayers.enable( 5 );
|
|
19339
|
+
if ( parameters.morphNormals )
|
|
19340
|
+
_programLayers.enable( 6 );
|
|
19341
|
+
if ( parameters.premultipliedAlpha )
|
|
19342
|
+
_programLayers.enable( 7 );
|
|
19343
|
+
if ( parameters.shadowMapEnabled )
|
|
19344
|
+
_programLayers.enable( 8 );
|
|
19345
|
+
if ( parameters.physicallyCorrectLights )
|
|
19346
|
+
_programLayers.enable( 9 );
|
|
19347
|
+
if ( parameters.doubleSided )
|
|
19348
|
+
_programLayers.enable( 10 );
|
|
19349
|
+
if ( parameters.flipSided )
|
|
19350
|
+
_programLayers.enable( 11 );
|
|
19351
|
+
if ( parameters.depthPacking )
|
|
19352
|
+
_programLayers.enable( 12 );
|
|
19353
|
+
if ( parameters.dithering )
|
|
19354
|
+
_programLayers.enable( 13 );
|
|
19355
|
+
if ( parameters.specularIntensityMap )
|
|
19356
|
+
_programLayers.enable( 14 );
|
|
19357
|
+
if ( parameters.specularColorMap )
|
|
19358
|
+
_programLayers.enable( 15 );
|
|
19359
|
+
if ( parameters.transmission )
|
|
19360
|
+
_programLayers.enable( 16 );
|
|
19361
|
+
if ( parameters.transmissionMap )
|
|
19362
|
+
_programLayers.enable( 17 );
|
|
19363
|
+
if ( parameters.thicknessMap )
|
|
19364
|
+
_programLayers.enable( 18 );
|
|
19365
|
+
if ( parameters.sheen )
|
|
19366
|
+
_programLayers.enable( 19 );
|
|
19367
|
+
if ( parameters.sheenColorMap )
|
|
19368
|
+
_programLayers.enable( 20 );
|
|
19369
|
+
if ( parameters.sheenRoughnessMap )
|
|
19370
|
+
_programLayers.enable( 21 );
|
|
19371
|
+
|
|
19372
|
+
array.push( _programLayers.mask );
|
|
19373
|
+
|
|
19374
|
+
}
|
|
19375
|
+
|
|
19262
19376
|
function getUniforms( material ) {
|
|
19263
19377
|
|
|
19264
19378
|
const shaderID = shaderIDs[ material.type ];
|
|
@@ -19326,14 +19440,28 @@
|
|
|
19326
19440
|
|
|
19327
19441
|
}
|
|
19328
19442
|
|
|
19443
|
+
function releaseShaderCache( material ) {
|
|
19444
|
+
|
|
19445
|
+
_customShaders.remove( material );
|
|
19446
|
+
|
|
19447
|
+
}
|
|
19448
|
+
|
|
19449
|
+
function dispose() {
|
|
19450
|
+
|
|
19451
|
+
_customShaders.dispose();
|
|
19452
|
+
|
|
19453
|
+
}
|
|
19454
|
+
|
|
19329
19455
|
return {
|
|
19330
19456
|
getParameters: getParameters,
|
|
19331
19457
|
getProgramCacheKey: getProgramCacheKey,
|
|
19332
19458
|
getUniforms: getUniforms,
|
|
19333
19459
|
acquireProgram: acquireProgram,
|
|
19334
19460
|
releaseProgram: releaseProgram,
|
|
19461
|
+
releaseShaderCache: releaseShaderCache,
|
|
19335
19462
|
// Exposed for resource monitoring & error feedback via renderer.info:
|
|
19336
|
-
programs: programs
|
|
19463
|
+
programs: programs,
|
|
19464
|
+
dispose: dispose
|
|
19337
19465
|
};
|
|
19338
19466
|
|
|
19339
19467
|
}
|
|
@@ -19394,10 +19522,6 @@
|
|
|
19394
19522
|
|
|
19395
19523
|
return a.renderOrder - b.renderOrder;
|
|
19396
19524
|
|
|
19397
|
-
} else if ( a.program !== b.program ) {
|
|
19398
|
-
|
|
19399
|
-
return a.program.id - b.program.id;
|
|
19400
|
-
|
|
19401
19525
|
} else if ( a.material.id !== b.material.id ) {
|
|
19402
19526
|
|
|
19403
19527
|
return a.material.id - b.material.id;
|
|
@@ -19437,7 +19561,7 @@
|
|
|
19437
19561
|
}
|
|
19438
19562
|
|
|
19439
19563
|
|
|
19440
|
-
function WebGLRenderList(
|
|
19564
|
+
function WebGLRenderList() {
|
|
19441
19565
|
|
|
19442
19566
|
const renderItems = [];
|
|
19443
19567
|
let renderItemsIndex = 0;
|
|
@@ -19446,8 +19570,6 @@
|
|
|
19446
19570
|
const transmissive = [];
|
|
19447
19571
|
const transparent = [];
|
|
19448
19572
|
|
|
19449
|
-
const defaultProgram = { id: - 1 };
|
|
19450
|
-
|
|
19451
19573
|
function init() {
|
|
19452
19574
|
|
|
19453
19575
|
renderItemsIndex = 0;
|
|
@@ -19461,7 +19583,6 @@
|
|
|
19461
19583
|
function getNextRenderItem( object, geometry, material, groupOrder, z, group ) {
|
|
19462
19584
|
|
|
19463
19585
|
let renderItem = renderItems[ renderItemsIndex ];
|
|
19464
|
-
const materialProperties = properties.get( material );
|
|
19465
19586
|
|
|
19466
19587
|
if ( renderItem === undefined ) {
|
|
19467
19588
|
|
|
@@ -19470,7 +19591,6 @@
|
|
|
19470
19591
|
object: object,
|
|
19471
19592
|
geometry: geometry,
|
|
19472
19593
|
material: material,
|
|
19473
|
-
program: materialProperties.program || defaultProgram,
|
|
19474
19594
|
groupOrder: groupOrder,
|
|
19475
19595
|
renderOrder: object.renderOrder,
|
|
19476
19596
|
z: z,
|
|
@@ -19485,7 +19605,6 @@
|
|
|
19485
19605
|
renderItem.object = object;
|
|
19486
19606
|
renderItem.geometry = geometry;
|
|
19487
19607
|
renderItem.material = material;
|
|
19488
|
-
renderItem.program = materialProperties.program || defaultProgram;
|
|
19489
19608
|
renderItem.groupOrder = groupOrder;
|
|
19490
19609
|
renderItem.renderOrder = object.renderOrder;
|
|
19491
19610
|
renderItem.z = z;
|
|
@@ -19561,7 +19680,6 @@
|
|
|
19561
19680
|
renderItem.object = null;
|
|
19562
19681
|
renderItem.geometry = null;
|
|
19563
19682
|
renderItem.material = null;
|
|
19564
|
-
renderItem.program = null;
|
|
19565
19683
|
renderItem.group = null;
|
|
19566
19684
|
|
|
19567
19685
|
}
|
|
@@ -19584,7 +19702,7 @@
|
|
|
19584
19702
|
|
|
19585
19703
|
}
|
|
19586
19704
|
|
|
19587
|
-
function WebGLRenderLists(
|
|
19705
|
+
function WebGLRenderLists() {
|
|
19588
19706
|
|
|
19589
19707
|
let lists = new WeakMap();
|
|
19590
19708
|
|
|
@@ -19594,14 +19712,14 @@
|
|
|
19594
19712
|
|
|
19595
19713
|
if ( lists.has( scene ) === false ) {
|
|
19596
19714
|
|
|
19597
|
-
list = new WebGLRenderList(
|
|
19715
|
+
list = new WebGLRenderList();
|
|
19598
19716
|
lists.set( scene, [ list ] );
|
|
19599
19717
|
|
|
19600
19718
|
} else {
|
|
19601
19719
|
|
|
19602
19720
|
if ( renderCallDepth >= lists.get( scene ).length ) {
|
|
19603
19721
|
|
|
19604
|
-
list = new WebGLRenderList(
|
|
19722
|
+
list = new WebGLRenderList();
|
|
19605
19723
|
lists.get( scene ).push( list );
|
|
19606
19724
|
|
|
19607
19725
|
} else {
|
|
@@ -21096,7 +21214,6 @@
|
|
|
21096
21214
|
|
|
21097
21215
|
let enabledCapabilities = {};
|
|
21098
21216
|
|
|
21099
|
-
let xrFramebuffer = null;
|
|
21100
21217
|
let currentBoundFramebuffers = {};
|
|
21101
21218
|
|
|
21102
21219
|
let currentProgram = null;
|
|
@@ -21208,22 +21325,8 @@
|
|
|
21208
21325
|
|
|
21209
21326
|
}
|
|
21210
21327
|
|
|
21211
|
-
function bindXRFramebuffer( framebuffer ) {
|
|
21212
|
-
|
|
21213
|
-
if ( framebuffer !== xrFramebuffer ) {
|
|
21214
|
-
|
|
21215
|
-
gl.bindFramebuffer( 36160, framebuffer );
|
|
21216
|
-
|
|
21217
|
-
xrFramebuffer = framebuffer;
|
|
21218
|
-
|
|
21219
|
-
}
|
|
21220
|
-
|
|
21221
|
-
}
|
|
21222
|
-
|
|
21223
21328
|
function bindFramebuffer( target, framebuffer ) {
|
|
21224
21329
|
|
|
21225
|
-
if ( framebuffer === null && xrFramebuffer !== null ) framebuffer = xrFramebuffer; // use active XR framebuffer if available
|
|
21226
|
-
|
|
21227
21330
|
if ( currentBoundFramebuffers[ target ] !== framebuffer ) {
|
|
21228
21331
|
|
|
21229
21332
|
gl.bindFramebuffer( target, framebuffer );
|
|
@@ -21659,6 +21762,76 @@
|
|
|
21659
21762
|
|
|
21660
21763
|
}
|
|
21661
21764
|
|
|
21765
|
+
function texSubImage2D() {
|
|
21766
|
+
|
|
21767
|
+
try {
|
|
21768
|
+
|
|
21769
|
+
gl.texSubImage2D.apply( gl, arguments );
|
|
21770
|
+
|
|
21771
|
+
} catch ( error ) {
|
|
21772
|
+
|
|
21773
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21774
|
+
|
|
21775
|
+
}
|
|
21776
|
+
|
|
21777
|
+
}
|
|
21778
|
+
|
|
21779
|
+
function texSubImage3D() {
|
|
21780
|
+
|
|
21781
|
+
try {
|
|
21782
|
+
|
|
21783
|
+
gl.texSubImage3D.apply( gl, arguments );
|
|
21784
|
+
|
|
21785
|
+
} catch ( error ) {
|
|
21786
|
+
|
|
21787
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21788
|
+
|
|
21789
|
+
}
|
|
21790
|
+
|
|
21791
|
+
}
|
|
21792
|
+
|
|
21793
|
+
function compressedTexSubImage2D() {
|
|
21794
|
+
|
|
21795
|
+
try {
|
|
21796
|
+
|
|
21797
|
+
gl.compressedTexSubImage2D.apply( gl, arguments );
|
|
21798
|
+
|
|
21799
|
+
} catch ( error ) {
|
|
21800
|
+
|
|
21801
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21802
|
+
|
|
21803
|
+
}
|
|
21804
|
+
|
|
21805
|
+
}
|
|
21806
|
+
|
|
21807
|
+
function texStorage2D() {
|
|
21808
|
+
|
|
21809
|
+
try {
|
|
21810
|
+
|
|
21811
|
+
gl.texStorage2D.apply( gl, arguments );
|
|
21812
|
+
|
|
21813
|
+
} catch ( error ) {
|
|
21814
|
+
|
|
21815
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21816
|
+
|
|
21817
|
+
}
|
|
21818
|
+
|
|
21819
|
+
}
|
|
21820
|
+
|
|
21821
|
+
function texStorage3D() {
|
|
21822
|
+
|
|
21823
|
+
try {
|
|
21824
|
+
|
|
21825
|
+
gl.texStorage3D.apply( gl, arguments );
|
|
21826
|
+
|
|
21827
|
+
} catch ( error ) {
|
|
21828
|
+
|
|
21829
|
+
console.error( 'THREE.WebGLState:', error );
|
|
21830
|
+
|
|
21831
|
+
}
|
|
21832
|
+
|
|
21833
|
+
}
|
|
21834
|
+
|
|
21662
21835
|
function texImage2D() {
|
|
21663
21836
|
|
|
21664
21837
|
try {
|
|
@@ -21771,7 +21944,6 @@
|
|
|
21771
21944
|
currentTextureSlot = null;
|
|
21772
21945
|
currentBoundTextures = {};
|
|
21773
21946
|
|
|
21774
|
-
xrFramebuffer = null;
|
|
21775
21947
|
currentBoundFramebuffers = {};
|
|
21776
21948
|
|
|
21777
21949
|
currentProgram = null;
|
|
@@ -21815,7 +21987,6 @@
|
|
|
21815
21987
|
disable: disable,
|
|
21816
21988
|
|
|
21817
21989
|
bindFramebuffer: bindFramebuffer,
|
|
21818
|
-
bindXRFramebuffer: bindXRFramebuffer,
|
|
21819
21990
|
|
|
21820
21991
|
useProgram: useProgram,
|
|
21821
21992
|
|
|
@@ -21837,6 +22008,12 @@
|
|
|
21837
22008
|
texImage2D: texImage2D,
|
|
21838
22009
|
texImage3D: texImage3D,
|
|
21839
22010
|
|
|
22011
|
+
texStorage2D: texStorage2D,
|
|
22012
|
+
texStorage3D: texStorage3D,
|
|
22013
|
+
texSubImage2D: texSubImage2D,
|
|
22014
|
+
texSubImage3D: texSubImage3D,
|
|
22015
|
+
compressedTexSubImage2D: compressedTexSubImage2D,
|
|
22016
|
+
|
|
21840
22017
|
scissor: scissor,
|
|
21841
22018
|
viewport: viewport,
|
|
21842
22019
|
|
|
@@ -21853,6 +22030,8 @@
|
|
|
21853
22030
|
const maxCubemapSize = capabilities.maxCubemapSize;
|
|
21854
22031
|
const maxTextureSize = capabilities.maxTextureSize;
|
|
21855
22032
|
const maxSamples = capabilities.maxSamples;
|
|
22033
|
+
const hasMultisampledRenderToTexture = extensions.has( 'WEBGL_multisampled_render_to_texture' );
|
|
22034
|
+
const MultisampledRenderToTextureExtension = hasMultisampledRenderToTexture ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : undefined;
|
|
21856
22035
|
|
|
21857
22036
|
const _videoTextures = new WeakMap();
|
|
21858
22037
|
let _canvas;
|
|
@@ -21966,14 +22145,10 @@
|
|
|
21966
22145
|
|
|
21967
22146
|
}
|
|
21968
22147
|
|
|
21969
|
-
function generateMipmap( target
|
|
22148
|
+
function generateMipmap( target ) {
|
|
21970
22149
|
|
|
21971
22150
|
_gl.generateMipmap( target );
|
|
21972
22151
|
|
|
21973
|
-
const textureProperties = properties.get( texture );
|
|
21974
|
-
|
|
21975
|
-
textureProperties.__maxMipLevel = Math.log2( Math.max( width, height, depth ) );
|
|
21976
|
-
|
|
21977
22152
|
}
|
|
21978
22153
|
|
|
21979
22154
|
function getInternalFormat( internalFormatName, glFormat, glType, encoding ) {
|
|
@@ -22025,6 +22200,32 @@
|
|
|
22025
22200
|
|
|
22026
22201
|
}
|
|
22027
22202
|
|
|
22203
|
+
function getMipLevels( texture, image, supportsMips ) {
|
|
22204
|
+
|
|
22205
|
+
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
|
|
22206
|
+
|
|
22207
|
+
return Math.log2( Math.max( image.width, image.height ) ) + 1;
|
|
22208
|
+
|
|
22209
|
+
} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {
|
|
22210
|
+
|
|
22211
|
+
// user-defined mipmaps
|
|
22212
|
+
|
|
22213
|
+
return texture.mipmaps.length;
|
|
22214
|
+
|
|
22215
|
+
} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {
|
|
22216
|
+
|
|
22217
|
+
return image.mipmaps.length;
|
|
22218
|
+
|
|
22219
|
+
} else {
|
|
22220
|
+
|
|
22221
|
+
// texture without mipmaps (only base level)
|
|
22222
|
+
|
|
22223
|
+
return 1;
|
|
22224
|
+
|
|
22225
|
+
}
|
|
22226
|
+
|
|
22227
|
+
}
|
|
22228
|
+
|
|
22028
22229
|
// Fallback filters for non-power-of-2 textures
|
|
22029
22230
|
|
|
22030
22231
|
function filterFallback( f ) {
|
|
@@ -22383,6 +22584,10 @@
|
|
|
22383
22584
|
let mipmap;
|
|
22384
22585
|
const mipmaps = texture.mipmaps;
|
|
22385
22586
|
|
|
22587
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
22588
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22589
|
+
const levels = getMipLevels( texture, image, supportsMips );
|
|
22590
|
+
|
|
22386
22591
|
if ( texture.isDepthTexture ) {
|
|
22387
22592
|
|
|
22388
22593
|
// populate depth texture with dummy data
|
|
@@ -22459,7 +22664,15 @@
|
|
|
22459
22664
|
|
|
22460
22665
|
//
|
|
22461
22666
|
|
|
22462
|
-
|
|
22667
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22668
|
+
|
|
22669
|
+
state.texStorage2D( 3553, 1, glInternalFormat, image.width, image.height );
|
|
22670
|
+
|
|
22671
|
+
} else {
|
|
22672
|
+
|
|
22673
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22674
|
+
|
|
22675
|
+
}
|
|
22463
22676
|
|
|
22464
22677
|
} else if ( texture.isDataTexture ) {
|
|
22465
22678
|
|
|
@@ -22469,25 +22682,58 @@
|
|
|
22469
22682
|
|
|
22470
22683
|
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22471
22684
|
|
|
22685
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22686
|
+
|
|
22687
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22688
|
+
|
|
22689
|
+
}
|
|
22690
|
+
|
|
22472
22691
|
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22473
22692
|
|
|
22474
22693
|
mipmap = mipmaps[ i ];
|
|
22475
|
-
|
|
22694
|
+
|
|
22695
|
+
if ( useTexStorage ) {
|
|
22696
|
+
|
|
22697
|
+
state.texSubImage2D( 3553, 0, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22698
|
+
|
|
22699
|
+
} else {
|
|
22700
|
+
|
|
22701
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22702
|
+
|
|
22703
|
+
}
|
|
22476
22704
|
|
|
22477
22705
|
}
|
|
22478
22706
|
|
|
22479
22707
|
texture.generateMipmaps = false;
|
|
22480
|
-
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
22481
22708
|
|
|
22482
22709
|
} else {
|
|
22483
22710
|
|
|
22484
|
-
|
|
22485
|
-
|
|
22711
|
+
if ( useTexStorage ) {
|
|
22712
|
+
|
|
22713
|
+
if ( allocateMemory ) {
|
|
22714
|
+
|
|
22715
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
22716
|
+
|
|
22717
|
+
}
|
|
22718
|
+
|
|
22719
|
+
state.texSubImage2D( 3553, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
22720
|
+
|
|
22721
|
+
} else {
|
|
22722
|
+
|
|
22723
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
22724
|
+
|
|
22725
|
+
}
|
|
22486
22726
|
|
|
22487
22727
|
}
|
|
22488
22728
|
|
|
22489
22729
|
} else if ( texture.isCompressedTexture ) {
|
|
22490
22730
|
|
|
22731
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22732
|
+
|
|
22733
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22734
|
+
|
|
22735
|
+
}
|
|
22736
|
+
|
|
22491
22737
|
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22492
22738
|
|
|
22493
22739
|
mipmap = mipmaps[ i ];
|
|
@@ -22496,7 +22742,15 @@
|
|
|
22496
22742
|
|
|
22497
22743
|
if ( glFormat !== null ) {
|
|
22498
22744
|
|
|
22499
|
-
|
|
22745
|
+
if ( useTexStorage ) {
|
|
22746
|
+
|
|
22747
|
+
state.compressedTexSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
22748
|
+
|
|
22749
|
+
} else {
|
|
22750
|
+
|
|
22751
|
+
state.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
22752
|
+
|
|
22753
|
+
}
|
|
22500
22754
|
|
|
22501
22755
|
} else {
|
|
22502
22756
|
|
|
@@ -22506,23 +22760,67 @@
|
|
|
22506
22760
|
|
|
22507
22761
|
} else {
|
|
22508
22762
|
|
|
22509
|
-
|
|
22763
|
+
if ( useTexStorage ) {
|
|
22764
|
+
|
|
22765
|
+
state.texSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22766
|
+
|
|
22767
|
+
} else {
|
|
22768
|
+
|
|
22769
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22770
|
+
|
|
22771
|
+
}
|
|
22510
22772
|
|
|
22511
22773
|
}
|
|
22512
22774
|
|
|
22513
22775
|
}
|
|
22514
22776
|
|
|
22515
|
-
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
22516
|
-
|
|
22517
22777
|
} else if ( texture.isDataTexture2DArray ) {
|
|
22518
22778
|
|
|
22519
|
-
|
|
22520
|
-
|
|
22779
|
+
if ( useTexStorage ) {
|
|
22780
|
+
|
|
22781
|
+
if ( allocateMemory ) {
|
|
22782
|
+
|
|
22783
|
+
state.texStorage3D( 35866, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
22784
|
+
|
|
22785
|
+
}
|
|
22786
|
+
|
|
22787
|
+
state.texSubImage3D( 35866, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
22788
|
+
|
|
22789
|
+
} else {
|
|
22790
|
+
|
|
22791
|
+
state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
22792
|
+
|
|
22793
|
+
}
|
|
22521
22794
|
|
|
22522
22795
|
} else if ( texture.isDataTexture3D ) {
|
|
22523
22796
|
|
|
22524
|
-
|
|
22525
|
-
|
|
22797
|
+
if ( useTexStorage ) {
|
|
22798
|
+
|
|
22799
|
+
if ( allocateMemory ) {
|
|
22800
|
+
|
|
22801
|
+
state.texStorage3D( 32879, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
22802
|
+
|
|
22803
|
+
}
|
|
22804
|
+
|
|
22805
|
+
state.texSubImage3D( 32879, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
22806
|
+
|
|
22807
|
+
} else {
|
|
22808
|
+
|
|
22809
|
+
state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
22810
|
+
|
|
22811
|
+
}
|
|
22812
|
+
|
|
22813
|
+
} else if ( texture.isFramebufferTexture ) {
|
|
22814
|
+
|
|
22815
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22816
|
+
|
|
22817
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
22818
|
+
|
|
22819
|
+
} else {
|
|
22820
|
+
|
|
22821
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22822
|
+
|
|
22823
|
+
}
|
|
22526
22824
|
|
|
22527
22825
|
} else {
|
|
22528
22826
|
|
|
@@ -22534,20 +22832,47 @@
|
|
|
22534
22832
|
|
|
22535
22833
|
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22536
22834
|
|
|
22835
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22836
|
+
|
|
22837
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22838
|
+
|
|
22839
|
+
}
|
|
22840
|
+
|
|
22537
22841
|
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22538
22842
|
|
|
22539
22843
|
mipmap = mipmaps[ i ];
|
|
22540
|
-
|
|
22844
|
+
|
|
22845
|
+
if ( useTexStorage ) {
|
|
22846
|
+
|
|
22847
|
+
state.texSubImage2D( 3553, i, 0, 0, glFormat, glType, mipmap );
|
|
22848
|
+
|
|
22849
|
+
} else {
|
|
22850
|
+
|
|
22851
|
+
state.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );
|
|
22852
|
+
|
|
22853
|
+
}
|
|
22541
22854
|
|
|
22542
22855
|
}
|
|
22543
22856
|
|
|
22544
22857
|
texture.generateMipmaps = false;
|
|
22545
|
-
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
22546
22858
|
|
|
22547
22859
|
} else {
|
|
22548
22860
|
|
|
22549
|
-
|
|
22550
|
-
|
|
22861
|
+
if ( useTexStorage ) {
|
|
22862
|
+
|
|
22863
|
+
if ( allocateMemory ) {
|
|
22864
|
+
|
|
22865
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
22866
|
+
|
|
22867
|
+
}
|
|
22868
|
+
|
|
22869
|
+
state.texSubImage2D( 3553, 0, 0, 0, glFormat, glType, image );
|
|
22870
|
+
|
|
22871
|
+
} else {
|
|
22872
|
+
|
|
22873
|
+
state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
|
|
22874
|
+
|
|
22875
|
+
}
|
|
22551
22876
|
|
|
22552
22877
|
}
|
|
22553
22878
|
|
|
@@ -22555,7 +22880,7 @@
|
|
|
22555
22880
|
|
|
22556
22881
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
22557
22882
|
|
|
22558
|
-
generateMipmap( textureType
|
|
22883
|
+
generateMipmap( textureType );
|
|
22559
22884
|
|
|
22560
22885
|
}
|
|
22561
22886
|
|
|
@@ -22604,12 +22929,22 @@
|
|
|
22604
22929
|
glType = utils.convert( texture.type ),
|
|
22605
22930
|
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
22606
22931
|
|
|
22932
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
22933
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22934
|
+
let levels = getMipLevels( texture, image, supportsMips );
|
|
22935
|
+
|
|
22607
22936
|
setTextureParameters( 34067, texture, supportsMips );
|
|
22608
22937
|
|
|
22609
22938
|
let mipmaps;
|
|
22610
22939
|
|
|
22611
22940
|
if ( isCompressed ) {
|
|
22612
22941
|
|
|
22942
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22943
|
+
|
|
22944
|
+
state.texStorage2D( 34067, levels, glInternalFormat, image.width, image.height );
|
|
22945
|
+
|
|
22946
|
+
}
|
|
22947
|
+
|
|
22613
22948
|
for ( let i = 0; i < 6; i ++ ) {
|
|
22614
22949
|
|
|
22615
22950
|
mipmaps = cubeImage[ i ].mipmaps;
|
|
@@ -22622,7 +22957,15 @@
|
|
|
22622
22957
|
|
|
22623
22958
|
if ( glFormat !== null ) {
|
|
22624
22959
|
|
|
22625
|
-
|
|
22960
|
+
if ( useTexStorage ) {
|
|
22961
|
+
|
|
22962
|
+
state.compressedTexSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
22963
|
+
|
|
22964
|
+
} else {
|
|
22965
|
+
|
|
22966
|
+
state.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
22967
|
+
|
|
22968
|
+
}
|
|
22626
22969
|
|
|
22627
22970
|
} else {
|
|
22628
22971
|
|
|
@@ -22632,7 +22975,15 @@
|
|
|
22632
22975
|
|
|
22633
22976
|
} else {
|
|
22634
22977
|
|
|
22635
|
-
|
|
22978
|
+
if ( useTexStorage ) {
|
|
22979
|
+
|
|
22980
|
+
state.texSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22981
|
+
|
|
22982
|
+
} else {
|
|
22983
|
+
|
|
22984
|
+
state.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22985
|
+
|
|
22986
|
+
}
|
|
22636
22987
|
|
|
22637
22988
|
}
|
|
22638
22989
|
|
|
@@ -22640,36 +22991,78 @@
|
|
|
22640
22991
|
|
|
22641
22992
|
}
|
|
22642
22993
|
|
|
22643
|
-
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
22644
|
-
|
|
22645
22994
|
} else {
|
|
22646
22995
|
|
|
22647
22996
|
mipmaps = texture.mipmaps;
|
|
22648
22997
|
|
|
22998
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22999
|
+
|
|
23000
|
+
// TODO: Uniformly handle mipmap definitions
|
|
23001
|
+
// Normal textures and compressed cube textures define base level + mips with their mipmap array
|
|
23002
|
+
// Uncompressed cube textures use their mipmap array only for mips (no base level)
|
|
23003
|
+
|
|
23004
|
+
if ( mipmaps.length > 0 ) levels ++;
|
|
23005
|
+
|
|
23006
|
+
state.texStorage2D( 34067, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
|
|
23007
|
+
|
|
23008
|
+
}
|
|
23009
|
+
|
|
22649
23010
|
for ( let i = 0; i < 6; i ++ ) {
|
|
22650
23011
|
|
|
22651
23012
|
if ( isDataTexture ) {
|
|
22652
23013
|
|
|
22653
|
-
|
|
23014
|
+
if ( useTexStorage ) {
|
|
23015
|
+
|
|
23016
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
|
|
23017
|
+
|
|
23018
|
+
} else {
|
|
23019
|
+
|
|
23020
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
|
|
23021
|
+
|
|
23022
|
+
}
|
|
22654
23023
|
|
|
22655
23024
|
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
22656
23025
|
|
|
22657
23026
|
const mipmap = mipmaps[ j ];
|
|
22658
23027
|
const mipmapImage = mipmap.image[ i ].image;
|
|
22659
23028
|
|
|
22660
|
-
|
|
23029
|
+
if ( useTexStorage ) {
|
|
23030
|
+
|
|
23031
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
|
|
23032
|
+
|
|
23033
|
+
} else {
|
|
23034
|
+
|
|
23035
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );
|
|
23036
|
+
|
|
23037
|
+
}
|
|
22661
23038
|
|
|
22662
23039
|
}
|
|
22663
23040
|
|
|
22664
23041
|
} else {
|
|
22665
23042
|
|
|
22666
|
-
|
|
23043
|
+
if ( useTexStorage ) {
|
|
23044
|
+
|
|
23045
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
|
|
23046
|
+
|
|
23047
|
+
} else {
|
|
23048
|
+
|
|
23049
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );
|
|
23050
|
+
|
|
23051
|
+
}
|
|
22667
23052
|
|
|
22668
23053
|
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
22669
23054
|
|
|
22670
23055
|
const mipmap = mipmaps[ j ];
|
|
22671
23056
|
|
|
22672
|
-
|
|
23057
|
+
if ( useTexStorage ) {
|
|
23058
|
+
|
|
23059
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
|
|
23060
|
+
|
|
23061
|
+
} else {
|
|
23062
|
+
|
|
23063
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );
|
|
23064
|
+
|
|
23065
|
+
}
|
|
22673
23066
|
|
|
22674
23067
|
}
|
|
22675
23068
|
|
|
@@ -22677,14 +23070,12 @@
|
|
|
22677
23070
|
|
|
22678
23071
|
}
|
|
22679
23072
|
|
|
22680
|
-
textureProperties.__maxMipLevel = mipmaps.length;
|
|
22681
|
-
|
|
22682
23073
|
}
|
|
22683
23074
|
|
|
22684
23075
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
22685
23076
|
|
|
22686
23077
|
// We assume images for cube map have the same size.
|
|
22687
|
-
generateMipmap( 34067
|
|
23078
|
+
generateMipmap( 34067 );
|
|
22688
23079
|
|
|
22689
23080
|
}
|
|
22690
23081
|
|
|
@@ -22702,23 +23093,38 @@
|
|
|
22702
23093
|
const glFormat = utils.convert( texture.format );
|
|
22703
23094
|
const glType = utils.convert( texture.type );
|
|
22704
23095
|
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23096
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
22705
23097
|
|
|
22706
|
-
if (
|
|
23098
|
+
if ( ! renderTargetProperties.__hasExternalTextures ) {
|
|
22707
23099
|
|
|
22708
|
-
|
|
23100
|
+
if ( textureTarget === 32879 || textureTarget === 35866 ) {
|
|
22709
23101
|
|
|
22710
|
-
|
|
23102
|
+
state.texImage3D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null );
|
|
23103
|
+
|
|
23104
|
+
} else {
|
|
23105
|
+
|
|
23106
|
+
state.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );
|
|
22711
23107
|
|
|
22712
|
-
|
|
23108
|
+
}
|
|
22713
23109
|
|
|
22714
23110
|
}
|
|
22715
23111
|
|
|
22716
23112
|
state.bindFramebuffer( 36160, framebuffer );
|
|
22717
|
-
|
|
23113
|
+
if ( renderTarget.useRenderToTexture ) {
|
|
23114
|
+
|
|
23115
|
+
MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
23116
|
+
|
|
23117
|
+
} else {
|
|
23118
|
+
|
|
23119
|
+
_gl.framebufferTexture2D( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 );
|
|
23120
|
+
|
|
23121
|
+
}
|
|
23122
|
+
|
|
22718
23123
|
state.bindFramebuffer( 36160, null );
|
|
22719
23124
|
|
|
22720
23125
|
}
|
|
22721
23126
|
|
|
23127
|
+
|
|
22722
23128
|
// Setup storage for internal depth/stencil buffers and bind to correct framebuffer
|
|
22723
23129
|
function setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {
|
|
22724
23130
|
|
|
@@ -22728,7 +23134,7 @@
|
|
|
22728
23134
|
|
|
22729
23135
|
let glInternalFormat = 33189;
|
|
22730
23136
|
|
|
22731
|
-
if ( isMultisample ) {
|
|
23137
|
+
if ( isMultisample || renderTarget.useRenderToTexture ) {
|
|
22732
23138
|
|
|
22733
23139
|
const depthTexture = renderTarget.depthTexture;
|
|
22734
23140
|
|
|
@@ -22748,7 +23154,15 @@
|
|
|
22748
23154
|
|
|
22749
23155
|
const samples = getRenderTargetSamples( renderTarget );
|
|
22750
23156
|
|
|
22751
|
-
|
|
23157
|
+
if ( renderTarget.useRenderToTexture ) {
|
|
23158
|
+
|
|
23159
|
+
MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23160
|
+
|
|
23161
|
+
} else {
|
|
23162
|
+
|
|
23163
|
+
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23164
|
+
|
|
23165
|
+
}
|
|
22752
23166
|
|
|
22753
23167
|
} else {
|
|
22754
23168
|
|
|
@@ -22760,12 +23174,16 @@
|
|
|
22760
23174
|
|
|
22761
23175
|
} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {
|
|
22762
23176
|
|
|
22763
|
-
|
|
23177
|
+
const samples = getRenderTargetSamples( renderTarget );
|
|
22764
23178
|
|
|
22765
|
-
|
|
23179
|
+
if ( isMultisample && renderTarget.useRenderbuffer ) {
|
|
22766
23180
|
|
|
22767
23181
|
_gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height );
|
|
22768
23182
|
|
|
23183
|
+
} else if ( renderTarget.useRenderToTexture ) {
|
|
23184
|
+
|
|
23185
|
+
MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( 36161, samples, 35056, renderTarget.width, renderTarget.height );
|
|
23186
|
+
|
|
22769
23187
|
} else {
|
|
22770
23188
|
|
|
22771
23189
|
_gl.renderbufferStorage( 36161, 34041, renderTarget.width, renderTarget.height );
|
|
@@ -22783,13 +23201,16 @@
|
|
|
22783
23201
|
const glFormat = utils.convert( texture.format );
|
|
22784
23202
|
const glType = utils.convert( texture.type );
|
|
22785
23203
|
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23204
|
+
const samples = getRenderTargetSamples( renderTarget );
|
|
22786
23205
|
|
|
22787
|
-
if ( isMultisample ) {
|
|
22788
|
-
|
|
22789
|
-
const samples = getRenderTargetSamples( renderTarget );
|
|
23206
|
+
if ( isMultisample && renderTarget.useRenderbuffer ) {
|
|
22790
23207
|
|
|
22791
23208
|
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
22792
23209
|
|
|
23210
|
+
} else if ( renderTarget.useRenderToTexture ) {
|
|
23211
|
+
|
|
23212
|
+
MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23213
|
+
|
|
22793
23214
|
} else {
|
|
22794
23215
|
|
|
22795
23216
|
_gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
@@ -22830,14 +23251,31 @@
|
|
|
22830
23251
|
setTexture2D( renderTarget.depthTexture, 0 );
|
|
22831
23252
|
|
|
22832
23253
|
const webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
|
|
23254
|
+
const samples = getRenderTargetSamples( renderTarget );
|
|
22833
23255
|
|
|
22834
23256
|
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
22835
23257
|
|
|
22836
|
-
|
|
23258
|
+
if ( renderTarget.useRenderToTexture ) {
|
|
23259
|
+
|
|
23260
|
+
MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( 36160, 36096, 3553, webglDepthTexture, 0, samples );
|
|
23261
|
+
|
|
23262
|
+
} else {
|
|
23263
|
+
|
|
23264
|
+
_gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 );
|
|
23265
|
+
|
|
23266
|
+
}
|
|
22837
23267
|
|
|
22838
23268
|
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
22839
23269
|
|
|
22840
|
-
|
|
23270
|
+
if ( renderTarget.useRenderToTexture ) {
|
|
23271
|
+
|
|
23272
|
+
MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( 36160, 33306, 3553, webglDepthTexture, 0, samples );
|
|
23273
|
+
|
|
23274
|
+
} else {
|
|
23275
|
+
|
|
23276
|
+
_gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 );
|
|
23277
|
+
|
|
23278
|
+
}
|
|
22841
23279
|
|
|
22842
23280
|
} else {
|
|
22843
23281
|
|
|
@@ -22851,10 +23289,9 @@
|
|
|
22851
23289
|
function setupDepthRenderbuffer( renderTarget ) {
|
|
22852
23290
|
|
|
22853
23291
|
const renderTargetProperties = properties.get( renderTarget );
|
|
22854
|
-
|
|
22855
23292
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
22856
23293
|
|
|
22857
|
-
if ( renderTarget.depthTexture ) {
|
|
23294
|
+
if ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
22858
23295
|
|
|
22859
23296
|
if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
|
|
22860
23297
|
|
|
@@ -22888,6 +23325,25 @@
|
|
|
22888
23325
|
|
|
22889
23326
|
}
|
|
22890
23327
|
|
|
23328
|
+
// rebind framebuffer with external textures
|
|
23329
|
+
function rebindTextures( renderTarget, colorTexture, depthTexture ) {
|
|
23330
|
+
|
|
23331
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
23332
|
+
|
|
23333
|
+
if ( colorTexture !== undefined ) {
|
|
23334
|
+
|
|
23335
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, 36064, 3553 );
|
|
23336
|
+
|
|
23337
|
+
}
|
|
23338
|
+
|
|
23339
|
+
if ( depthTexture !== undefined ) {
|
|
23340
|
+
|
|
23341
|
+
setupDepthRenderbuffer( renderTarget );
|
|
23342
|
+
|
|
23343
|
+
}
|
|
23344
|
+
|
|
23345
|
+
}
|
|
23346
|
+
|
|
22891
23347
|
// Set up GL resources for the render target
|
|
22892
23348
|
function setupRenderTarget( renderTarget ) {
|
|
22893
23349
|
|
|
@@ -22900,7 +23356,12 @@
|
|
|
22900
23356
|
|
|
22901
23357
|
if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
|
|
22902
23358
|
|
|
22903
|
-
textureProperties.__webglTexture
|
|
23359
|
+
if ( textureProperties.__webglTexture === undefined ) {
|
|
23360
|
+
|
|
23361
|
+
textureProperties.__webglTexture = _gl.createTexture();
|
|
23362
|
+
|
|
23363
|
+
}
|
|
23364
|
+
|
|
22904
23365
|
textureProperties.__version = texture.version;
|
|
22905
23366
|
info.memory.textures ++;
|
|
22906
23367
|
|
|
@@ -22908,7 +23369,6 @@
|
|
|
22908
23369
|
|
|
22909
23370
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
22910
23371
|
const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
|
|
22911
|
-
const isMultisample = ( renderTarget.isWebGLMultisampleRenderTarget === true );
|
|
22912
23372
|
const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
|
|
22913
23373
|
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
22914
23374
|
|
|
@@ -22964,7 +23424,7 @@
|
|
|
22964
23424
|
|
|
22965
23425
|
}
|
|
22966
23426
|
|
|
22967
|
-
} else if (
|
|
23427
|
+
} else if ( renderTarget.useRenderbuffer ) {
|
|
22968
23428
|
|
|
22969
23429
|
if ( isWebGL2 ) {
|
|
22970
23430
|
|
|
@@ -23018,7 +23478,7 @@
|
|
|
23018
23478
|
|
|
23019
23479
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23020
23480
|
|
|
23021
|
-
generateMipmap( 34067
|
|
23481
|
+
generateMipmap( 34067 );
|
|
23022
23482
|
|
|
23023
23483
|
}
|
|
23024
23484
|
|
|
@@ -23039,7 +23499,7 @@
|
|
|
23039
23499
|
|
|
23040
23500
|
if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
|
|
23041
23501
|
|
|
23042
|
-
generateMipmap( 3553
|
|
23502
|
+
generateMipmap( 3553 );
|
|
23043
23503
|
|
|
23044
23504
|
}
|
|
23045
23505
|
|
|
@@ -23074,7 +23534,7 @@
|
|
|
23074
23534
|
|
|
23075
23535
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23076
23536
|
|
|
23077
|
-
generateMipmap( glTextureType
|
|
23537
|
+
generateMipmap( glTextureType );
|
|
23078
23538
|
|
|
23079
23539
|
}
|
|
23080
23540
|
|
|
@@ -23108,7 +23568,7 @@
|
|
|
23108
23568
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
23109
23569
|
|
|
23110
23570
|
state.bindTexture( target, webglTexture );
|
|
23111
|
-
generateMipmap( target
|
|
23571
|
+
generateMipmap( target );
|
|
23112
23572
|
state.unbindTexture();
|
|
23113
23573
|
|
|
23114
23574
|
}
|
|
@@ -23119,23 +23579,43 @@
|
|
|
23119
23579
|
|
|
23120
23580
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
23121
23581
|
|
|
23122
|
-
if ( renderTarget.
|
|
23582
|
+
if ( renderTarget.useRenderbuffer ) {
|
|
23123
23583
|
|
|
23124
23584
|
if ( isWebGL2 ) {
|
|
23125
23585
|
|
|
23126
23586
|
const width = renderTarget.width;
|
|
23127
23587
|
const height = renderTarget.height;
|
|
23128
23588
|
let mask = 16384;
|
|
23589
|
+
const invalidationArray = [ 36064 ];
|
|
23590
|
+
const depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;
|
|
23129
23591
|
|
|
23130
|
-
if ( renderTarget.depthBuffer )
|
|
23131
|
-
|
|
23592
|
+
if ( renderTarget.depthBuffer ) {
|
|
23593
|
+
|
|
23594
|
+
invalidationArray.push( depthStyle );
|
|
23595
|
+
|
|
23596
|
+
}
|
|
23597
|
+
|
|
23598
|
+
if ( ! renderTarget.ignoreDepthForMultisampleCopy ) {
|
|
23599
|
+
|
|
23600
|
+
if ( renderTarget.depthBuffer ) mask |= 256;
|
|
23601
|
+
if ( renderTarget.stencilBuffer ) mask |= 1024;
|
|
23602
|
+
|
|
23603
|
+
}
|
|
23132
23604
|
|
|
23133
23605
|
const renderTargetProperties = properties.get( renderTarget );
|
|
23134
23606
|
|
|
23135
23607
|
state.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23136
23608
|
state.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer );
|
|
23137
23609
|
|
|
23610
|
+
if ( renderTarget.ignoreDepthForMultisampleCopy ) {
|
|
23611
|
+
|
|
23612
|
+
_gl.invalidateFramebuffer( 36008, [ depthStyle ] );
|
|
23613
|
+
_gl.invalidateFramebuffer( 36009, [ depthStyle ] );
|
|
23614
|
+
|
|
23615
|
+
}
|
|
23616
|
+
|
|
23138
23617
|
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 );
|
|
23618
|
+
_gl.invalidateFramebuffer( 36008, invalidationArray );
|
|
23139
23619
|
|
|
23140
23620
|
state.bindFramebuffer( 36008, null );
|
|
23141
23621
|
state.bindFramebuffer( 36009, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
@@ -23152,7 +23632,7 @@
|
|
|
23152
23632
|
|
|
23153
23633
|
function getRenderTargetSamples( renderTarget ) {
|
|
23154
23634
|
|
|
23155
|
-
return ( isWebGL2 && renderTarget.
|
|
23635
|
+
return ( isWebGL2 && ( renderTarget.useRenderbuffer || renderTarget.useRenderToTexture ) ) ?
|
|
23156
23636
|
Math.min( maxSamples, renderTarget.samples ) : 0;
|
|
23157
23637
|
|
|
23158
23638
|
}
|
|
@@ -23225,9 +23705,12 @@
|
|
|
23225
23705
|
this.setTexture2DArray = setTexture2DArray;
|
|
23226
23706
|
this.setTexture3D = setTexture3D;
|
|
23227
23707
|
this.setTextureCube = setTextureCube;
|
|
23708
|
+
this.rebindTextures = rebindTextures;
|
|
23228
23709
|
this.setupRenderTarget = setupRenderTarget;
|
|
23229
23710
|
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
|
|
23230
23711
|
this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
|
|
23712
|
+
this.setupDepthRenderbuffer = setupDepthRenderbuffer;
|
|
23713
|
+
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
23231
23714
|
|
|
23232
23715
|
this.safeSetTexture2D = safeSetTexture2D;
|
|
23233
23716
|
this.safeSetTextureCube = safeSetTextureCube;
|
|
@@ -23749,6 +24232,38 @@
|
|
|
23749
24232
|
|
|
23750
24233
|
}
|
|
23751
24234
|
|
|
24235
|
+
class DepthTexture extends Texture {
|
|
24236
|
+
|
|
24237
|
+
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
24238
|
+
|
|
24239
|
+
format = format !== undefined ? format : DepthFormat;
|
|
24240
|
+
|
|
24241
|
+
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
24242
|
+
|
|
24243
|
+
throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
|
24244
|
+
|
|
24245
|
+
}
|
|
24246
|
+
|
|
24247
|
+
if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
|
|
24248
|
+
if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
|
|
24249
|
+
|
|
24250
|
+
super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
24251
|
+
|
|
24252
|
+
this.image = { width: width, height: height };
|
|
24253
|
+
|
|
24254
|
+
this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
24255
|
+
this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
24256
|
+
|
|
24257
|
+
this.flipY = false;
|
|
24258
|
+
this.generateMipmaps = false;
|
|
24259
|
+
|
|
24260
|
+
}
|
|
24261
|
+
|
|
24262
|
+
|
|
24263
|
+
}
|
|
24264
|
+
|
|
24265
|
+
DepthTexture.prototype.isDepthTexture = true;
|
|
24266
|
+
|
|
23752
24267
|
class WebXRManager extends EventDispatcher {
|
|
23753
24268
|
|
|
23754
24269
|
constructor( renderer, gl ) {
|
|
@@ -23756,26 +24271,23 @@
|
|
|
23756
24271
|
super();
|
|
23757
24272
|
|
|
23758
24273
|
const scope = this;
|
|
23759
|
-
const state = renderer.state;
|
|
23760
24274
|
|
|
23761
24275
|
let session = null;
|
|
23762
24276
|
let framebufferScaleFactor = 1.0;
|
|
23763
24277
|
|
|
23764
24278
|
let referenceSpace = null;
|
|
23765
24279
|
let referenceSpaceType = 'local-floor';
|
|
24280
|
+
const hasMultisampledRenderToTexture = renderer.extensions.has( 'WEBGL_multisampled_render_to_texture' );
|
|
23766
24281
|
|
|
23767
24282
|
let pose = null;
|
|
23768
24283
|
let glBinding = null;
|
|
23769
|
-
let glFramebuffer = null;
|
|
23770
24284
|
let glProjLayer = null;
|
|
23771
24285
|
let glBaseLayer = null;
|
|
23772
24286
|
let isMultisample = false;
|
|
23773
|
-
let glMultisampledFramebuffer = null;
|
|
23774
|
-
let glColorRenderbuffer = null;
|
|
23775
|
-
let glDepthRenderbuffer = null;
|
|
23776
24287
|
let xrFrame = null;
|
|
23777
|
-
|
|
23778
|
-
let
|
|
24288
|
+
const attributes = gl.getContextAttributes();
|
|
24289
|
+
let initialRenderTarget = null;
|
|
24290
|
+
let newRenderTarget = null;
|
|
23779
24291
|
|
|
23780
24292
|
const controllers = [];
|
|
23781
24293
|
const inputSourcesMap = new Map();
|
|
@@ -23880,21 +24392,13 @@
|
|
|
23880
24392
|
|
|
23881
24393
|
// restore framebuffer/rendering state
|
|
23882
24394
|
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
if ( glFramebuffer ) gl.deleteFramebuffer( glFramebuffer );
|
|
23887
|
-
if ( glMultisampledFramebuffer ) gl.deleteFramebuffer( glMultisampledFramebuffer );
|
|
23888
|
-
if ( glColorRenderbuffer ) gl.deleteRenderbuffer( glColorRenderbuffer );
|
|
23889
|
-
if ( glDepthRenderbuffer ) gl.deleteRenderbuffer( glDepthRenderbuffer );
|
|
23890
|
-
glFramebuffer = null;
|
|
23891
|
-
glMultisampledFramebuffer = null;
|
|
23892
|
-
glColorRenderbuffer = null;
|
|
23893
|
-
glDepthRenderbuffer = null;
|
|
24395
|
+
renderer.setRenderTarget( initialRenderTarget );
|
|
24396
|
+
|
|
23894
24397
|
glBaseLayer = null;
|
|
23895
24398
|
glProjLayer = null;
|
|
23896
24399
|
glBinding = null;
|
|
23897
24400
|
session = null;
|
|
24401
|
+
newRenderTarget = null;
|
|
23898
24402
|
|
|
23899
24403
|
//
|
|
23900
24404
|
|
|
@@ -23966,6 +24470,8 @@
|
|
|
23966
24470
|
|
|
23967
24471
|
if ( session !== null ) {
|
|
23968
24472
|
|
|
24473
|
+
initialRenderTarget = renderer.getRenderTarget();
|
|
24474
|
+
|
|
23969
24475
|
session.addEventListener( 'select', onSessionEvent );
|
|
23970
24476
|
session.addEventListener( 'selectstart', onSessionEvent );
|
|
23971
24477
|
session.addEventListener( 'selectend', onSessionEvent );
|
|
@@ -23975,18 +24481,16 @@
|
|
|
23975
24481
|
session.addEventListener( 'end', onSessionEnd );
|
|
23976
24482
|
session.addEventListener( 'inputsourceschange', onInputSourcesChange );
|
|
23977
24483
|
|
|
23978
|
-
const attributes = gl.getContextAttributes();
|
|
23979
|
-
|
|
23980
24484
|
if ( attributes.xrCompatible !== true ) {
|
|
23981
24485
|
|
|
23982
24486
|
await gl.makeXRCompatible();
|
|
23983
24487
|
|
|
23984
24488
|
}
|
|
23985
24489
|
|
|
23986
|
-
if ( session.renderState.layers === undefined ) {
|
|
24490
|
+
if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
|
|
23987
24491
|
|
|
23988
24492
|
const layerInit = {
|
|
23989
|
-
antialias: attributes.antialias,
|
|
24493
|
+
antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
|
|
23990
24494
|
alpha: attributes.alpha,
|
|
23991
24495
|
depth: attributes.depth,
|
|
23992
24496
|
stencil: attributes.stencil,
|
|
@@ -23997,43 +24501,34 @@
|
|
|
23997
24501
|
|
|
23998
24502
|
session.updateRenderState( { baseLayer: glBaseLayer } );
|
|
23999
24503
|
|
|
24000
|
-
|
|
24001
|
-
|
|
24002
|
-
|
|
24003
|
-
|
|
24004
|
-
|
|
24005
|
-
|
|
24006
|
-
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
stencil: attributes.stencil,
|
|
24010
|
-
framebufferScaleFactor: framebufferScaleFactor
|
|
24011
|
-
};
|
|
24012
|
-
|
|
24013
|
-
glBaseLayer = new XRWebGLLayer( session, gl, layerInit );
|
|
24014
|
-
|
|
24015
|
-
session.updateRenderState( { layers: [ glBaseLayer ] } );
|
|
24504
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
24505
|
+
glBaseLayer.framebufferWidth,
|
|
24506
|
+
glBaseLayer.framebufferHeight,
|
|
24507
|
+
{
|
|
24508
|
+
format: RGBAFormat,
|
|
24509
|
+
type: UnsignedByteType,
|
|
24510
|
+
encoding: renderer.outputEncoding
|
|
24511
|
+
}
|
|
24512
|
+
);
|
|
24016
24513
|
|
|
24017
24514
|
} else {
|
|
24018
24515
|
|
|
24019
24516
|
isMultisample = attributes.antialias;
|
|
24020
24517
|
let depthFormat = null;
|
|
24021
|
-
|
|
24518
|
+
let depthType = null;
|
|
24519
|
+
let glDepthFormat = null;
|
|
24022
24520
|
|
|
24023
24521
|
if ( attributes.depth ) {
|
|
24024
24522
|
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
depthStyle = attributes.stencil ? 33306 : 36096;
|
|
24030
|
-
depthFormat = attributes.stencil ? 35056 : 33190;
|
|
24523
|
+
glDepthFormat = attributes.stencil ? 35056 : 33190;
|
|
24524
|
+
depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;
|
|
24525
|
+
depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType;
|
|
24031
24526
|
|
|
24032
24527
|
}
|
|
24033
24528
|
|
|
24034
24529
|
const projectionlayerInit = {
|
|
24035
|
-
colorFormat: attributes.alpha ? 32856 : 32849,
|
|
24036
|
-
depthFormat:
|
|
24530
|
+
colorFormat: ( attributes.alpha || isMultisample ) ? 32856 : 32849,
|
|
24531
|
+
depthFormat: glDepthFormat,
|
|
24037
24532
|
scaleFactor: framebufferScaleFactor
|
|
24038
24533
|
};
|
|
24039
24534
|
|
|
@@ -24041,41 +24536,44 @@
|
|
|
24041
24536
|
|
|
24042
24537
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
24043
24538
|
|
|
24044
|
-
glFramebuffer = gl.createFramebuffer();
|
|
24045
|
-
|
|
24046
24539
|
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
24047
24540
|
|
|
24048
24541
|
if ( isMultisample ) {
|
|
24049
24542
|
|
|
24050
|
-
|
|
24051
|
-
glColorRenderbuffer = gl.createRenderbuffer();
|
|
24052
|
-
gl.bindRenderbuffer( 36161, glColorRenderbuffer );
|
|
24053
|
-
gl.renderbufferStorageMultisample(
|
|
24054
|
-
36161,
|
|
24055
|
-
4,
|
|
24056
|
-
32856,
|
|
24543
|
+
newRenderTarget = new WebGLMultisampleRenderTarget(
|
|
24057
24544
|
glProjLayer.textureWidth,
|
|
24058
|
-
glProjLayer.textureHeight
|
|
24059
|
-
|
|
24060
|
-
|
|
24061
|
-
|
|
24062
|
-
|
|
24063
|
-
|
|
24064
|
-
|
|
24065
|
-
|
|
24066
|
-
|
|
24067
|
-
|
|
24068
|
-
gl.framebufferRenderbuffer( 36160, depthStyle, 36161, glDepthRenderbuffer );
|
|
24069
|
-
gl.bindRenderbuffer( 36161, null );
|
|
24545
|
+
glProjLayer.textureHeight,
|
|
24546
|
+
{
|
|
24547
|
+
format: RGBAFormat,
|
|
24548
|
+
type: UnsignedByteType,
|
|
24549
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
24550
|
+
stencilBuffer: attributes.stencil,
|
|
24551
|
+
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
24552
|
+
useRenderToTexture: hasMultisampledRenderToTexture,
|
|
24553
|
+
encoding: renderer.outputEncoding
|
|
24554
|
+
} );
|
|
24070
24555
|
|
|
24071
|
-
|
|
24556
|
+
} else {
|
|
24072
24557
|
|
|
24073
|
-
|
|
24558
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
24559
|
+
glProjLayer.textureWidth,
|
|
24560
|
+
glProjLayer.textureHeight,
|
|
24561
|
+
{
|
|
24562
|
+
format: attributes.alpha ? RGBAFormat : RGBFormat,
|
|
24563
|
+
type: UnsignedByteType,
|
|
24564
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
24565
|
+
stencilBuffer: attributes.stencil,
|
|
24566
|
+
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
24567
|
+
encoding: renderer.outputEncoding
|
|
24568
|
+
} );
|
|
24074
24569
|
|
|
24075
24570
|
}
|
|
24076
24571
|
|
|
24077
24572
|
}
|
|
24078
24573
|
|
|
24574
|
+
// Set foveation to maximum.
|
|
24575
|
+
this.setFoveation( 1.0 );
|
|
24576
|
+
|
|
24079
24577
|
referenceSpace = await session.requestReferenceSpace( referenceSpaceType );
|
|
24080
24578
|
|
|
24081
24579
|
animation.setContext( session );
|
|
@@ -24334,7 +24832,8 @@
|
|
|
24334
24832
|
|
|
24335
24833
|
if ( glBaseLayer !== null ) {
|
|
24336
24834
|
|
|
24337
|
-
|
|
24835
|
+
renderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );
|
|
24836
|
+
renderer.setRenderTarget( newRenderTarget );
|
|
24338
24837
|
|
|
24339
24838
|
}
|
|
24340
24839
|
|
|
@@ -24345,7 +24844,6 @@
|
|
|
24345
24844
|
if ( views.length !== cameraVR.cameras.length ) {
|
|
24346
24845
|
|
|
24347
24846
|
cameraVR.cameras.length = 0;
|
|
24348
|
-
|
|
24349
24847
|
cameraVRNeedsUpdate = true;
|
|
24350
24848
|
|
|
24351
24849
|
}
|
|
@@ -24363,19 +24861,20 @@
|
|
|
24363
24861
|
} else {
|
|
24364
24862
|
|
|
24365
24863
|
const glSubImage = glBinding.getViewSubImage( glProjLayer, view );
|
|
24864
|
+
viewport = glSubImage.viewport;
|
|
24366
24865
|
|
|
24367
|
-
|
|
24866
|
+
// For side-by-side projection, we only produce a single texture for both eyes.
|
|
24867
|
+
if ( i === 0 ) {
|
|
24368
24868
|
|
|
24369
|
-
|
|
24869
|
+
renderer.setRenderTargetTextures(
|
|
24870
|
+
newRenderTarget,
|
|
24871
|
+
glSubImage.colorTexture,
|
|
24872
|
+
glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );
|
|
24370
24873
|
|
|
24371
|
-
|
|
24874
|
+
renderer.setRenderTarget( newRenderTarget );
|
|
24372
24875
|
|
|
24373
24876
|
}
|
|
24374
24877
|
|
|
24375
|
-
gl.framebufferTexture2D( 36160, 36064, 3553, glSubImage.colorTexture, 0 );
|
|
24376
|
-
|
|
24377
|
-
viewport = glSubImage.viewport;
|
|
24378
|
-
|
|
24379
24878
|
}
|
|
24380
24879
|
|
|
24381
24880
|
const camera = cameras[ i ];
|
|
@@ -24398,14 +24897,6 @@
|
|
|
24398
24897
|
|
|
24399
24898
|
}
|
|
24400
24899
|
|
|
24401
|
-
if ( isMultisample ) {
|
|
24402
|
-
|
|
24403
|
-
state.bindXRFramebuffer( glMultisampledFramebuffer );
|
|
24404
|
-
|
|
24405
|
-
if ( clearStyle !== null ) gl.clear( clearStyle );
|
|
24406
|
-
|
|
24407
|
-
}
|
|
24408
|
-
|
|
24409
24900
|
}
|
|
24410
24901
|
|
|
24411
24902
|
//
|
|
@@ -24423,26 +24914,6 @@
|
|
|
24423
24914
|
|
|
24424
24915
|
if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
|
|
24425
24916
|
|
|
24426
|
-
if ( isMultisample ) {
|
|
24427
|
-
|
|
24428
|
-
const width = glProjLayer.textureWidth;
|
|
24429
|
-
const height = glProjLayer.textureHeight;
|
|
24430
|
-
|
|
24431
|
-
state.bindFramebuffer( 36008, glMultisampledFramebuffer );
|
|
24432
|
-
state.bindFramebuffer( 36009, glFramebuffer );
|
|
24433
|
-
// Invalidate the depth here to avoid flush of the depth data to main memory.
|
|
24434
|
-
gl.invalidateFramebuffer( 36008, [ depthStyle ] );
|
|
24435
|
-
gl.invalidateFramebuffer( 36009, [ depthStyle ] );
|
|
24436
|
-
gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, 16384, 9728 );
|
|
24437
|
-
// Invalidate the MSAA buffer because it's not needed anymore.
|
|
24438
|
-
gl.invalidateFramebuffer( 36008, [ 36064 ] );
|
|
24439
|
-
state.bindFramebuffer( 36008, null );
|
|
24440
|
-
state.bindFramebuffer( 36009, null );
|
|
24441
|
-
|
|
24442
|
-
state.bindFramebuffer( 36160, glMultisampledFramebuffer );
|
|
24443
|
-
|
|
24444
|
-
}
|
|
24445
|
-
|
|
24446
24917
|
xrFrame = null;
|
|
24447
24918
|
|
|
24448
24919
|
}
|
|
@@ -24620,14 +25091,6 @@
|
|
|
24620
25091
|
uniforms.ior.value = material.ior;
|
|
24621
25092
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
24622
25093
|
|
|
24623
|
-
const maxMipLevel = properties.get( envMap ).__maxMipLevel;
|
|
24624
|
-
|
|
24625
|
-
if ( maxMipLevel !== undefined ) {
|
|
24626
|
-
|
|
24627
|
-
uniforms.maxMipLevel.value = maxMipLevel;
|
|
24628
|
-
|
|
24629
|
-
}
|
|
24630
|
-
|
|
24631
25094
|
}
|
|
24632
25095
|
|
|
24633
25096
|
if ( material.lightMap ) {
|
|
@@ -25323,7 +25786,6 @@
|
|
|
25323
25786
|
|
|
25324
25787
|
// physically based shading
|
|
25325
25788
|
|
|
25326
|
-
this.gammaFactor = 2.0; // for backwards compatibility
|
|
25327
25789
|
this.outputEncoding = LinearEncoding;
|
|
25328
25790
|
|
|
25329
25791
|
// physical lights
|
|
@@ -25429,8 +25891,10 @@
|
|
|
25429
25891
|
failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
|
|
25430
25892
|
};
|
|
25431
25893
|
|
|
25432
|
-
//
|
|
25894
|
+
// OffscreenCanvas does not have setAttribute, see #22811
|
|
25895
|
+
if ( 'setAttribute' in _canvas ) _canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );
|
|
25433
25896
|
|
|
25897
|
+
// event listeners must be registered before WebGL context is created, see #12753
|
|
25434
25898
|
_canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
25435
25899
|
_canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );
|
|
25436
25900
|
|
|
@@ -25516,7 +25980,7 @@
|
|
|
25516
25980
|
clipping = new WebGLClipping( properties );
|
|
25517
25981
|
programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
|
|
25518
25982
|
materials = new WebGLMaterials( properties );
|
|
25519
|
-
renderLists = new WebGLRenderLists(
|
|
25983
|
+
renderLists = new WebGLRenderLists();
|
|
25520
25984
|
renderStates = new WebGLRenderStates( extensions, capabilities );
|
|
25521
25985
|
background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
|
|
25522
25986
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
@@ -25784,6 +26248,7 @@
|
|
|
25784
26248
|
cubeuvmaps.dispose();
|
|
25785
26249
|
objects.dispose();
|
|
25786
26250
|
bindingStates.dispose();
|
|
26251
|
+
programCache.dispose();
|
|
25787
26252
|
|
|
25788
26253
|
xr.dispose();
|
|
25789
26254
|
|
|
@@ -25868,6 +26333,12 @@
|
|
|
25868
26333
|
|
|
25869
26334
|
} );
|
|
25870
26335
|
|
|
26336
|
+
if ( material.isShaderMaterial ) {
|
|
26337
|
+
|
|
26338
|
+
programCache.releaseShaderCache( material );
|
|
26339
|
+
|
|
26340
|
+
}
|
|
26341
|
+
|
|
25871
26342
|
}
|
|
25872
26343
|
|
|
25873
26344
|
}
|
|
@@ -26406,7 +26877,8 @@
|
|
|
26406
26877
|
minFilter: LinearMipmapLinearFilter,
|
|
26407
26878
|
magFilter: NearestFilter,
|
|
26408
26879
|
wrapS: ClampToEdgeWrapping,
|
|
26409
|
-
wrapT: ClampToEdgeWrapping
|
|
26880
|
+
wrapT: ClampToEdgeWrapping,
|
|
26881
|
+
useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
|
|
26410
26882
|
} );
|
|
26411
26883
|
|
|
26412
26884
|
}
|
|
@@ -26613,6 +27085,7 @@
|
|
|
26613
27085
|
materialProperties.numIntersection = parameters.numClipIntersection;
|
|
26614
27086
|
materialProperties.vertexAlphas = parameters.vertexAlphas;
|
|
26615
27087
|
materialProperties.vertexTangents = parameters.vertexTangents;
|
|
27088
|
+
materialProperties.toneMapping = parameters.toneMapping;
|
|
26616
27089
|
|
|
26617
27090
|
}
|
|
26618
27091
|
|
|
@@ -26631,6 +27104,7 @@
|
|
|
26631
27104
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
26632
27105
|
const morphNormals = !! geometry.morphAttributes.normal;
|
|
26633
27106
|
const morphTargetsCount = !! geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0;
|
|
27107
|
+
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;
|
|
26634
27108
|
|
|
26635
27109
|
const materialProperties = properties.get( material );
|
|
26636
27110
|
const lights = currentRenderState.state.lights;
|
|
@@ -26712,6 +27186,10 @@
|
|
|
26712
27186
|
|
|
26713
27187
|
needsProgramChange = true;
|
|
26714
27188
|
|
|
27189
|
+
} else if ( materialProperties.toneMapping !== toneMapping ) {
|
|
27190
|
+
|
|
27191
|
+
needsProgramChange = true;
|
|
27192
|
+
|
|
26715
27193
|
} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {
|
|
26716
27194
|
|
|
26717
27195
|
needsProgramChange = true;
|
|
@@ -26972,15 +27450,71 @@
|
|
|
26972
27450
|
|
|
26973
27451
|
};
|
|
26974
27452
|
|
|
27453
|
+
this.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {
|
|
27454
|
+
|
|
27455
|
+
properties.get( renderTarget.texture ).__webglTexture = colorTexture;
|
|
27456
|
+
properties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;
|
|
27457
|
+
|
|
27458
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
27459
|
+
renderTargetProperties.__hasExternalTextures = true;
|
|
27460
|
+
|
|
27461
|
+
if ( renderTargetProperties.__hasExternalTextures ) {
|
|
27462
|
+
|
|
27463
|
+
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
27464
|
+
|
|
27465
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
27466
|
+
|
|
27467
|
+
// The multisample_render_to_texture extension doesn't work properly if there
|
|
27468
|
+
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
27469
|
+
if ( renderTarget.useRenderToTexture ) {
|
|
27470
|
+
|
|
27471
|
+
console.warn( 'render-to-texture extension was disabled because an external texture was provided' );
|
|
27472
|
+
renderTarget.useRenderToTexture = false;
|
|
27473
|
+
renderTarget.useRenderbuffer = true;
|
|
27474
|
+
|
|
27475
|
+
}
|
|
27476
|
+
|
|
27477
|
+
}
|
|
27478
|
+
|
|
27479
|
+
}
|
|
27480
|
+
|
|
27481
|
+
};
|
|
27482
|
+
|
|
27483
|
+
this.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {
|
|
27484
|
+
|
|
27485
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
27486
|
+
renderTargetProperties.__webglFramebuffer = defaultFramebuffer;
|
|
27487
|
+
renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;
|
|
27488
|
+
|
|
27489
|
+
};
|
|
27490
|
+
|
|
26975
27491
|
this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
|
|
26976
27492
|
|
|
26977
27493
|
_currentRenderTarget = renderTarget;
|
|
26978
27494
|
_currentActiveCubeFace = activeCubeFace;
|
|
26979
27495
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
27496
|
+
let useDefaultFramebuffer = true;
|
|
27497
|
+
|
|
27498
|
+
if ( renderTarget ) {
|
|
27499
|
+
|
|
27500
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
27501
|
+
|
|
27502
|
+
if ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {
|
|
27503
|
+
|
|
27504
|
+
// We need to make sure to rebind the framebuffer.
|
|
27505
|
+
state.bindFramebuffer( 36160, null );
|
|
27506
|
+
useDefaultFramebuffer = false;
|
|
27507
|
+
|
|
27508
|
+
} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {
|
|
26980
27509
|
|
|
26981
|
-
|
|
27510
|
+
textures.setupRenderTarget( renderTarget );
|
|
26982
27511
|
|
|
26983
|
-
|
|
27512
|
+
} else if ( renderTargetProperties.__hasExternalTextures ) {
|
|
27513
|
+
|
|
27514
|
+
// Color and depth texture must be rebound in order for the swapchain to update.
|
|
27515
|
+
textures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );
|
|
27516
|
+
|
|
27517
|
+
}
|
|
26984
27518
|
|
|
26985
27519
|
}
|
|
26986
27520
|
|
|
@@ -27005,7 +27539,7 @@
|
|
|
27005
27539
|
framebuffer = __webglFramebuffer[ activeCubeFace ];
|
|
27006
27540
|
isCube = true;
|
|
27007
27541
|
|
|
27008
|
-
} else if ( renderTarget.
|
|
27542
|
+
} else if ( renderTarget.useRenderbuffer ) {
|
|
27009
27543
|
|
|
27010
27544
|
framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
|
|
27011
27545
|
|
|
@@ -27029,7 +27563,7 @@
|
|
|
27029
27563
|
|
|
27030
27564
|
const framebufferBound = state.bindFramebuffer( 36160, framebuffer );
|
|
27031
27565
|
|
|
27032
|
-
if ( framebufferBound && capabilities.drawBuffers ) {
|
|
27566
|
+
if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
|
|
27033
27567
|
|
|
27034
27568
|
let needsUpdate = false;
|
|
27035
27569
|
|
|
@@ -27192,25 +27726,20 @@
|
|
|
27192
27726
|
|
|
27193
27727
|
this.copyFramebufferToTexture = function ( position, texture, level = 0 ) {
|
|
27194
27728
|
|
|
27195
|
-
|
|
27196
|
-
const width = Math.floor( texture.image.width * levelScale );
|
|
27197
|
-
const height = Math.floor( texture.image.height * levelScale );
|
|
27198
|
-
|
|
27199
|
-
let glFormat = utils.convert( texture.format );
|
|
27200
|
-
|
|
27201
|
-
if ( capabilities.isWebGL2 ) {
|
|
27202
|
-
|
|
27203
|
-
// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
|
|
27204
|
-
// Not needed in Chrome 93+
|
|
27729
|
+
if ( texture.isFramebufferTexture !== true ) {
|
|
27205
27730
|
|
|
27206
|
-
|
|
27207
|
-
|
|
27731
|
+
console.error( 'THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.' );
|
|
27732
|
+
return;
|
|
27208
27733
|
|
|
27209
27734
|
}
|
|
27210
27735
|
|
|
27736
|
+
const levelScale = Math.pow( 2, - level );
|
|
27737
|
+
const width = Math.floor( texture.image.width * levelScale );
|
|
27738
|
+
const height = Math.floor( texture.image.height * levelScale );
|
|
27739
|
+
|
|
27211
27740
|
textures.setTexture2D( texture, 0 );
|
|
27212
27741
|
|
|
27213
|
-
_gl.
|
|
27742
|
+
_gl.copyTexSubImage2D( 3553, level, 0, 0, position.x, position.y, width, height );
|
|
27214
27743
|
|
|
27215
27744
|
state.unbindTexture();
|
|
27216
27745
|
|
|
@@ -27360,7 +27889,7 @@
|
|
|
27360
27889
|
|
|
27361
27890
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
27362
27891
|
|
|
27363
|
-
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
27892
|
+
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
27364
27893
|
|
|
27365
27894
|
}
|
|
27366
27895
|
|
|
@@ -27390,7 +27919,7 @@
|
|
|
27390
27919
|
|
|
27391
27920
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
27392
27921
|
|
|
27393
|
-
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
27922
|
+
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );
|
|
27394
27923
|
|
|
27395
27924
|
}
|
|
27396
27925
|
|
|
@@ -28254,8 +28783,6 @@
|
|
|
28254
28783
|
this.flipY = false;
|
|
28255
28784
|
this.unpackAlignment = 1;
|
|
28256
28785
|
|
|
28257
|
-
this.needsUpdate = true;
|
|
28258
|
-
|
|
28259
28786
|
}
|
|
28260
28787
|
|
|
28261
28788
|
}
|
|
@@ -29078,6 +29605,27 @@
|
|
|
29078
29605
|
|
|
29079
29606
|
VideoTexture.prototype.isVideoTexture = true;
|
|
29080
29607
|
|
|
29608
|
+
class FramebufferTexture extends Texture {
|
|
29609
|
+
|
|
29610
|
+
constructor( width, height, format ) {
|
|
29611
|
+
|
|
29612
|
+
super( { width, height } );
|
|
29613
|
+
|
|
29614
|
+
this.format = format;
|
|
29615
|
+
|
|
29616
|
+
this.magFilter = NearestFilter;
|
|
29617
|
+
this.minFilter = NearestFilter;
|
|
29618
|
+
|
|
29619
|
+
this.generateMipmaps = false;
|
|
29620
|
+
|
|
29621
|
+
this.needsUpdate = true;
|
|
29622
|
+
|
|
29623
|
+
}
|
|
29624
|
+
|
|
29625
|
+
}
|
|
29626
|
+
|
|
29627
|
+
FramebufferTexture.prototype.isFramebufferTexture = true;
|
|
29628
|
+
|
|
29081
29629
|
class CompressedTexture extends Texture {
|
|
29082
29630
|
|
|
29083
29631
|
constructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
|
|
@@ -29117,38 +29665,6 @@
|
|
|
29117
29665
|
|
|
29118
29666
|
CanvasTexture.prototype.isCanvasTexture = true;
|
|
29119
29667
|
|
|
29120
|
-
class DepthTexture extends Texture {
|
|
29121
|
-
|
|
29122
|
-
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
29123
|
-
|
|
29124
|
-
format = format !== undefined ? format : DepthFormat;
|
|
29125
|
-
|
|
29126
|
-
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
29127
|
-
|
|
29128
|
-
throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
|
29129
|
-
|
|
29130
|
-
}
|
|
29131
|
-
|
|
29132
|
-
if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
|
|
29133
|
-
if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
|
|
29134
|
-
|
|
29135
|
-
super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
29136
|
-
|
|
29137
|
-
this.image = { width: width, height: height };
|
|
29138
|
-
|
|
29139
|
-
this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
29140
|
-
this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
29141
|
-
|
|
29142
|
-
this.flipY = false;
|
|
29143
|
-
this.generateMipmaps = false;
|
|
29144
|
-
|
|
29145
|
-
}
|
|
29146
|
-
|
|
29147
|
-
|
|
29148
|
-
}
|
|
29149
|
-
|
|
29150
|
-
DepthTexture.prototype.isDepthTexture = true;
|
|
29151
|
-
|
|
29152
29668
|
class CircleGeometry extends BufferGeometry {
|
|
29153
29669
|
|
|
29154
29670
|
constructor( radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2 ) {
|
|
@@ -30332,7 +30848,7 @@
|
|
|
30332
30848
|
|
|
30333
30849
|
/**
|
|
30334
30850
|
* Bezier Curves formulas obtained from
|
|
30335
|
-
*
|
|
30851
|
+
* https://en.wikipedia.org/wiki/B%C3%A9zier_curve
|
|
30336
30852
|
*/
|
|
30337
30853
|
|
|
30338
30854
|
function CatmullRom( t, p0, p1, p2, p3 ) {
|
|
@@ -34051,7 +34567,7 @@
|
|
|
34051
34567
|
|
|
34052
34568
|
this.transmissionMap = null;
|
|
34053
34569
|
|
|
34054
|
-
this.thickness = 0
|
|
34570
|
+
this.thickness = 0;
|
|
34055
34571
|
this.thicknessMap = null;
|
|
34056
34572
|
this.attenuationDistance = 0.0;
|
|
34057
34573
|
this.attenuationColor = new Color$2( 1, 1, 1 );
|
|
@@ -36925,6 +37441,12 @@
|
|
|
36925
37441
|
|
|
36926
37442
|
}
|
|
36927
37443
|
|
|
37444
|
+
if ( typeof ReadableStream === 'undefined' || response.body.getReader === undefined ) {
|
|
37445
|
+
|
|
37446
|
+
return response;
|
|
37447
|
+
|
|
37448
|
+
}
|
|
37449
|
+
|
|
36928
37450
|
const callbacks = loading[ url ];
|
|
36929
37451
|
const reader = response.body.getReader();
|
|
36930
37452
|
const contentLength = response.headers.get( 'Content-Length' );
|
|
@@ -36933,7 +37455,7 @@
|
|
|
36933
37455
|
let loaded = 0;
|
|
36934
37456
|
|
|
36935
37457
|
// periodically read data into the new stream tracking while download progress
|
|
36936
|
-
|
|
37458
|
+
const stream = new ReadableStream( {
|
|
36937
37459
|
start( controller ) {
|
|
36938
37460
|
|
|
36939
37461
|
readData();
|
|
@@ -36971,6 +37493,8 @@
|
|
|
36971
37493
|
|
|
36972
37494
|
} );
|
|
36973
37495
|
|
|
37496
|
+
return new Response( stream );
|
|
37497
|
+
|
|
36974
37498
|
} else {
|
|
36975
37499
|
|
|
36976
37500
|
throw Error( `fetch for "${response.url}" responded with ${response.status}: ${response.statusText}` );
|
|
@@ -36978,9 +37502,7 @@
|
|
|
36978
37502
|
}
|
|
36979
37503
|
|
|
36980
37504
|
} )
|
|
36981
|
-
.then(
|
|
36982
|
-
|
|
36983
|
-
const response = new Response( stream );
|
|
37505
|
+
.then( response => {
|
|
36984
37506
|
|
|
36985
37507
|
switch ( this.responseType ) {
|
|
36986
37508
|
|
|
@@ -37029,14 +37551,21 @@
|
|
|
37029
37551
|
|
|
37030
37552
|
}
|
|
37031
37553
|
|
|
37032
|
-
this.manager.itemEnd( url );
|
|
37033
|
-
|
|
37034
37554
|
} )
|
|
37035
37555
|
.catch( err => {
|
|
37036
37556
|
|
|
37037
37557
|
// Abort errors and other errors are handled the same
|
|
37038
37558
|
|
|
37039
37559
|
const callbacks = loading[ url ];
|
|
37560
|
+
|
|
37561
|
+
if ( callbacks === undefined ) {
|
|
37562
|
+
|
|
37563
|
+
// When onLoad was called and url was deleted in `loading`
|
|
37564
|
+
this.manager.itemError( url );
|
|
37565
|
+
throw err;
|
|
37566
|
+
|
|
37567
|
+
}
|
|
37568
|
+
|
|
37040
37569
|
delete loading[ url ];
|
|
37041
37570
|
|
|
37042
37571
|
for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
|
|
@@ -37047,6 +37576,10 @@
|
|
|
37047
37576
|
}
|
|
37048
37577
|
|
|
37049
37578
|
this.manager.itemError( url );
|
|
37579
|
+
|
|
37580
|
+
} )
|
|
37581
|
+
.finally( () => {
|
|
37582
|
+
|
|
37050
37583
|
this.manager.itemEnd( url );
|
|
37051
37584
|
|
|
37052
37585
|
} );
|
|
@@ -43450,7 +43983,19 @@
|
|
|
43450
43983
|
|
|
43451
43984
|
}
|
|
43452
43985
|
},
|
|
43986
|
+
gammaFactor: {
|
|
43987
|
+
get: function () {
|
|
43988
|
+
|
|
43989
|
+
console.warn( 'THREE.WebGLRenderer: .gammaFactor has been removed.' );
|
|
43990
|
+
return 2;
|
|
43991
|
+
|
|
43992
|
+
},
|
|
43993
|
+
set: function () {
|
|
43994
|
+
|
|
43995
|
+
console.warn( 'THREE.WebGLRenderer: .gammaFactor has been removed.' );
|
|
43453
43996
|
|
|
43997
|
+
}
|
|
43998
|
+
}
|
|
43454
43999
|
} );
|
|
43455
44000
|
|
|
43456
44001
|
Object.defineProperties( WebGLShadowMap.prototype, {
|
|
@@ -43722,11 +44267,9 @@
|
|
|
43722
44267
|
|
|
43723
44268
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
43724
44269
|
|
|
43725
|
-
/* eslint-disable no-undef */
|
|
43726
44270
|
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
|
|
43727
44271
|
revision: REVISION,
|
|
43728
44272
|
} } ) );
|
|
43729
|
-
/* eslint-enable no-undef */
|
|
43730
44273
|
|
|
43731
44274
|
}
|
|
43732
44275
|
|
|
@@ -43835,7 +44378,7 @@
|
|
|
43835
44378
|
}
|
|
43836
44379
|
|
|
43837
44380
|
function _iterableToArrayLimit$6(arr, i) {
|
|
43838
|
-
var _i = arr
|
|
44381
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
43839
44382
|
|
|
43840
44383
|
if (_i == null) return;
|
|
43841
44384
|
var _arr = [];
|
|
@@ -46485,6 +47028,8 @@
|
|
|
46485
47028
|
function _possibleConstructorReturn$2(self, call) {
|
|
46486
47029
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
46487
47030
|
return call;
|
|
47031
|
+
} else if (call !== void 0) {
|
|
47032
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
46488
47033
|
}
|
|
46489
47034
|
|
|
46490
47035
|
return _assertThisInitialized$3(self);
|
|
@@ -46790,8 +47335,8 @@
|
|
|
46790
47335
|
holes = _earcut$flatten2.holes;
|
|
46791
47336
|
|
|
46792
47337
|
var firstHoleIdx = holes[0] || Infinity;
|
|
46793
|
-
var outerVertices = vertices.slice(0, firstHoleIdx);
|
|
46794
|
-
var holeVertices = vertices.slice(firstHoleIdx);
|
|
47338
|
+
var outerVertices = vertices.slice(0, firstHoleIdx * 3);
|
|
47339
|
+
var holeVertices = vertices.slice(firstHoleIdx * 3);
|
|
46795
47340
|
var holesIdx = new Set(holes);
|
|
46796
47341
|
var numPoints = Math.round(vertices.length / 3);
|
|
46797
47342
|
var outerIndices = [],
|
|
@@ -71919,8 +72464,8 @@
|
|
|
71919
72464
|
: {
|
|
71920
72465
|
DoubleSide: DoubleSide,
|
|
71921
72466
|
Group: Group$1,
|
|
71922
|
-
Line: Line,
|
|
71923
72467
|
LineBasicMaterial: LineBasicMaterial,
|
|
72468
|
+
LineSegments: LineSegments,
|
|
71924
72469
|
Mesh: Mesh,
|
|
71925
72470
|
MeshBasicMaterial: MeshBasicMaterial
|
|
71926
72471
|
};
|
|
@@ -72028,7 +72573,7 @@
|
|
|
72028
72573
|
obj.__defaultCapMaterial // cap material
|
|
72029
72574
|
])); // polygon stroke
|
|
72030
72575
|
|
|
72031
|
-
obj.add(new THREE$8.
|
|
72576
|
+
obj.add(new THREE$8.LineSegments(undefined, new THREE$8.LineBasicMaterial()));
|
|
72032
72577
|
obj.__globeObjType = 'polygon'; // Add object type
|
|
72033
72578
|
|
|
72034
72579
|
return obj;
|
|
@@ -75184,30 +75729,20 @@
|
|
|
75184
75729
|
|
|
75185
75730
|
function onPointerUp( event ) {
|
|
75186
75731
|
|
|
75187
|
-
|
|
75732
|
+
removePointer( event );
|
|
75188
75733
|
|
|
75189
|
-
|
|
75734
|
+
if ( pointers.length === 0 ) {
|
|
75190
75735
|
|
|
75191
|
-
|
|
75736
|
+
scope.domElement.releasePointerCapture( event.pointerId );
|
|
75192
75737
|
|
|
75193
|
-
|
|
75194
|
-
|
|
75195
|
-
onMouseUp();
|
|
75196
|
-
|
|
75197
|
-
}
|
|
75198
|
-
|
|
75199
|
-
removePointer( event );
|
|
75200
|
-
|
|
75201
|
-
//
|
|
75202
|
-
|
|
75203
|
-
if ( pointers.length === 0 ) {
|
|
75738
|
+
scope.domElement.removeEventListener( 'pointermove', onPointerMove );
|
|
75739
|
+
scope.domElement.removeEventListener( 'pointerup', onPointerUp );
|
|
75204
75740
|
|
|
75205
|
-
|
|
75741
|
+
}
|
|
75206
75742
|
|
|
75207
|
-
|
|
75208
|
-
scope.domElement.removeEventListener( 'pointerup', onPointerUp );
|
|
75743
|
+
scope.dispatchEvent( _endEvent );
|
|
75209
75744
|
|
|
75210
|
-
|
|
75745
|
+
state = STATE.NONE;
|
|
75211
75746
|
|
|
75212
75747
|
}
|
|
75213
75748
|
|
|
@@ -75348,14 +75883,6 @@
|
|
|
75348
75883
|
|
|
75349
75884
|
}
|
|
75350
75885
|
|
|
75351
|
-
function onMouseUp( event ) {
|
|
75352
|
-
|
|
75353
|
-
scope.dispatchEvent( _endEvent );
|
|
75354
|
-
|
|
75355
|
-
state = STATE.NONE;
|
|
75356
|
-
|
|
75357
|
-
}
|
|
75358
|
-
|
|
75359
75886
|
function onMouseWheel( event ) {
|
|
75360
75887
|
|
|
75361
75888
|
if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
|
|
@@ -75516,14 +76043,6 @@
|
|
|
75516
76043
|
|
|
75517
76044
|
}
|
|
75518
76045
|
|
|
75519
|
-
function onTouchEnd( event ) {
|
|
75520
|
-
|
|
75521
|
-
scope.dispatchEvent( _endEvent );
|
|
75522
|
-
|
|
75523
|
-
state = STATE.NONE;
|
|
75524
|
-
|
|
75525
|
-
}
|
|
75526
|
-
|
|
75527
76046
|
function onContextMenu( event ) {
|
|
75528
76047
|
|
|
75529
76048
|
if ( scope.enabled === false ) return;
|
|
@@ -78394,10 +78913,9 @@
|
|
|
78394
78913
|
var objType = globeObj.__globeObjType;
|
|
78395
78914
|
|
|
78396
78915
|
if (globeObj && objFns.hasOwnProperty(objType) && objFns[objType]) {
|
|
78397
|
-
var args = [ev];
|
|
78916
|
+
var args = [ev]; // include click coords
|
|
78398
78917
|
|
|
78399
78918
|
if (objType === 'globe') {
|
|
78400
|
-
// include click coords in { lat, lng }
|
|
78401
78919
|
var _this$toGeoCoords = _this.toGeoCoords(point),
|
|
78402
78920
|
lat = _this$toGeoCoords.lat,
|
|
78403
78921
|
lng = _this$toGeoCoords.lng;
|
|
@@ -78406,6 +78924,8 @@
|
|
|
78406
78924
|
lat: lat,
|
|
78407
78925
|
lng: lng
|
|
78408
78926
|
});
|
|
78927
|
+
} else {
|
|
78928
|
+
args.push(_this.toGeoCoords(point));
|
|
78409
78929
|
}
|
|
78410
78930
|
|
|
78411
78931
|
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
|
|
@@ -78431,10 +78951,9 @@
|
|
|
78431
78951
|
var objType = globeObj.__globeObjType;
|
|
78432
78952
|
|
|
78433
78953
|
if (globeObj && objFns.hasOwnProperty(objType) && objFns[objType]) {
|
|
78434
|
-
var args = [ev];
|
|
78954
|
+
var args = [ev]; // include click coords
|
|
78435
78955
|
|
|
78436
78956
|
if (objType === 'globe') {
|
|
78437
|
-
// include click coords in { lat, lng }
|
|
78438
78957
|
var _this$toGeoCoords2 = _this.toGeoCoords(point),
|
|
78439
78958
|
lat = _this$toGeoCoords2.lat,
|
|
78440
78959
|
lng = _this$toGeoCoords2.lng;
|
|
@@ -78443,6 +78962,8 @@
|
|
|
78443
78962
|
lat: lat,
|
|
78444
78963
|
lng: lng
|
|
78445
78964
|
});
|
|
78965
|
+
} else {
|
|
78966
|
+
args.push(_this.toGeoCoords(point));
|
|
78446
78967
|
}
|
|
78447
78968
|
|
|
78448
78969
|
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
|