globe.gl 2.32.3 → 2.32.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globe.gl.js +462 -1194
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +5 -5
- package/dist/globe.gl.mjs +7 -13
- package/package.json +5 -5
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.32.
|
|
1
|
+
// Version 2.32.4 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) :
|
|
@@ -6,22 +6,16 @@
|
|
|
6
6
|
})(this, (function () { 'use strict';
|
|
7
7
|
|
|
8
8
|
function styleInject$1(css, ref) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
ref = {};
|
|
10
|
+
ref.insertAt;
|
|
11
11
|
|
|
12
|
-
if (
|
|
12
|
+
if (typeof document === 'undefined') { return; }
|
|
13
13
|
|
|
14
14
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
15
15
|
var style = document.createElement('style');
|
|
16
16
|
style.type = 'text/css';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
if (head.firstChild) {
|
|
20
|
-
head.insertBefore(style, head.firstChild);
|
|
21
|
-
} else {
|
|
22
|
-
head.appendChild(style);
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
18
|
+
{
|
|
25
19
|
head.appendChild(style);
|
|
26
20
|
}
|
|
27
21
|
|
|
@@ -56,22 +50,22 @@
|
|
|
56
50
|
}
|
|
57
51
|
return e;
|
|
58
52
|
}
|
|
59
|
-
function _toPrimitive$
|
|
53
|
+
function _toPrimitive$4(t, r) {
|
|
60
54
|
if ("object" != typeof t || !t) return t;
|
|
61
55
|
var e = t[Symbol.toPrimitive];
|
|
62
56
|
if (void 0 !== e) {
|
|
63
|
-
var i = e.call(t, r
|
|
57
|
+
var i = e.call(t, r );
|
|
64
58
|
if ("object" != typeof i) return i;
|
|
65
59
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
66
60
|
}
|
|
67
|
-
return (
|
|
61
|
+
return (String )(t);
|
|
68
62
|
}
|
|
69
|
-
function _toPropertyKey$
|
|
70
|
-
var i = _toPrimitive$
|
|
63
|
+
function _toPropertyKey$4(t) {
|
|
64
|
+
var i = _toPrimitive$4(t, "string");
|
|
71
65
|
return "symbol" == typeof i ? i : i + "";
|
|
72
66
|
}
|
|
73
67
|
function _defineProperty$3(obj, key, value) {
|
|
74
|
-
key = _toPropertyKey$
|
|
68
|
+
key = _toPropertyKey$4(key);
|
|
75
69
|
if (key in obj) {
|
|
76
70
|
Object.defineProperty(obj, key, {
|
|
77
71
|
value: value,
|
|
@@ -129,7 +123,7 @@
|
|
|
129
123
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
|
130
124
|
}
|
|
131
125
|
function _arrayLikeToArray$7(arr, len) {
|
|
132
|
-
|
|
126
|
+
len = arr.length;
|
|
133
127
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
134
128
|
return arr2;
|
|
135
129
|
}
|
|
@@ -142,7 +136,7 @@
|
|
|
142
136
|
* Copyright 2010-2023 Three.js Authors
|
|
143
137
|
* SPDX-License-Identifier: MIT
|
|
144
138
|
*/
|
|
145
|
-
const REVISION = '
|
|
139
|
+
const REVISION = '163';
|
|
146
140
|
|
|
147
141
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
148
142
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -227,7 +221,9 @@
|
|
|
227
221
|
const UnsignedShort4444Type = 1017;
|
|
228
222
|
const UnsignedShort5551Type = 1018;
|
|
229
223
|
const UnsignedInt248Type = 1020;
|
|
224
|
+
const UnsignedInt5999Type = 35902;
|
|
230
225
|
const AlphaFormat = 1021;
|
|
226
|
+
const RGBFormat = 1022;
|
|
231
227
|
const RGBAFormat = 1023;
|
|
232
228
|
const LuminanceFormat = 1024;
|
|
233
229
|
const LuminanceAlphaFormat = 1025;
|
|
@@ -306,8 +302,6 @@
|
|
|
306
302
|
const StaticDrawUsage = 35044;
|
|
307
303
|
const GLSL3 = '300 es';
|
|
308
304
|
|
|
309
|
-
const _SRGBAFormat = 1035; // fallback for WebGL 1
|
|
310
|
-
|
|
311
305
|
const WebGLCoordinateSystem = 2000;
|
|
312
306
|
const WebGPUCoordinateSystem = 2001;
|
|
313
307
|
|
|
@@ -2077,7 +2071,7 @@
|
|
|
2077
2071
|
this.onUpdate = null;
|
|
2078
2072
|
|
|
2079
2073
|
this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
|
|
2080
|
-
this.
|
|
2074
|
+
this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
|
|
2081
2075
|
|
|
2082
2076
|
}
|
|
2083
2077
|
|
|
@@ -2308,6 +2302,16 @@
|
|
|
2308
2302
|
|
|
2309
2303
|
}
|
|
2310
2304
|
|
|
2305
|
+
set needsPMREMUpdate( value ) {
|
|
2306
|
+
|
|
2307
|
+
if ( value === true ) {
|
|
2308
|
+
|
|
2309
|
+
this.pmremVersion ++;
|
|
2310
|
+
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2311
2315
|
}
|
|
2312
2316
|
|
|
2313
2317
|
Texture.DEFAULT_IMAGE = null;
|
|
@@ -7440,12 +7444,7 @@
|
|
|
7440
7444
|
|
|
7441
7445
|
if ( object && object.isObject3D ) {
|
|
7442
7446
|
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
object.parent.remove( object );
|
|
7446
|
-
|
|
7447
|
-
}
|
|
7448
|
-
|
|
7447
|
+
object.removeFromParent();
|
|
7449
7448
|
object.parent = this;
|
|
7450
7449
|
this.children.push( object );
|
|
7451
7450
|
|
|
@@ -7538,10 +7537,18 @@
|
|
|
7538
7537
|
|
|
7539
7538
|
object.applyMatrix4( _m1$3 );
|
|
7540
7539
|
|
|
7541
|
-
|
|
7540
|
+
object.removeFromParent();
|
|
7541
|
+
object.parent = this;
|
|
7542
|
+
this.children.push( object );
|
|
7542
7543
|
|
|
7543
7544
|
object.updateWorldMatrix( false, true );
|
|
7544
7545
|
|
|
7546
|
+
object.dispatchEvent( _addedEvent );
|
|
7547
|
+
|
|
7548
|
+
_childaddedEvent.child = object;
|
|
7549
|
+
this.dispatchEvent( _childaddedEvent );
|
|
7550
|
+
_childaddedEvent.child = null;
|
|
7551
|
+
|
|
7545
7552
|
return this;
|
|
7546
7553
|
|
|
7547
7554
|
}
|
|
@@ -11795,13 +11802,22 @@
|
|
|
11795
11802
|
|
|
11796
11803
|
function getUnlitUniformColorSpace( renderer ) {
|
|
11797
11804
|
|
|
11798
|
-
|
|
11805
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
11806
|
+
|
|
11807
|
+
if ( currentRenderTarget === null ) {
|
|
11799
11808
|
|
|
11800
11809
|
// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
|
|
11801
11810
|
return renderer.outputColorSpace;
|
|
11802
11811
|
|
|
11803
11812
|
}
|
|
11804
11813
|
|
|
11814
|
+
// https://github.com/mrdoob/three.js/issues/27868
|
|
11815
|
+
if ( currentRenderTarget.isXRRenderTarget === true ) {
|
|
11816
|
+
|
|
11817
|
+
return currentRenderTarget.texture.colorSpace;
|
|
11818
|
+
|
|
11819
|
+
}
|
|
11820
|
+
|
|
11805
11821
|
return ColorManagement.workingColorSpace;
|
|
11806
11822
|
|
|
11807
11823
|
}
|
|
@@ -11843,10 +11859,6 @@
|
|
|
11843
11859
|
this.forceSinglePass = true;
|
|
11844
11860
|
|
|
11845
11861
|
this.extensions = {
|
|
11846
|
-
derivatives: false, // set to use derivatives
|
|
11847
|
-
fragDepth: false, // set to use fragment depth values
|
|
11848
|
-
drawBuffers: false, // set to use draw buffers
|
|
11849
|
-
shaderTextureLOD: false, // set to use shader texture LOD
|
|
11850
11862
|
clipCullDistance: false, // set to use vertex shader clipping
|
|
11851
11863
|
multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
|
|
11852
11864
|
};
|
|
@@ -13087,9 +13099,7 @@
|
|
|
13087
13099
|
|
|
13088
13100
|
}
|
|
13089
13101
|
|
|
13090
|
-
function WebGLAttributes( gl
|
|
13091
|
-
|
|
13092
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
13102
|
+
function WebGLAttributes( gl ) {
|
|
13093
13103
|
|
|
13094
13104
|
const buffers = new WeakMap();
|
|
13095
13105
|
|
|
@@ -13116,15 +13126,7 @@
|
|
|
13116
13126
|
|
|
13117
13127
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
13118
13128
|
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
type = gl.HALF_FLOAT;
|
|
13122
|
-
|
|
13123
|
-
} else {
|
|
13124
|
-
|
|
13125
|
-
throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
|
|
13126
|
-
|
|
13127
|
-
}
|
|
13129
|
+
type = gl.HALF_FLOAT;
|
|
13128
13130
|
|
|
13129
13131
|
} else {
|
|
13130
13132
|
|
|
@@ -13192,17 +13194,9 @@
|
|
|
13192
13194
|
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
13193
13195
|
|
|
13194
13196
|
const range = updateRanges[ i ];
|
|
13195
|
-
if ( isWebGL2 ) {
|
|
13196
|
-
|
|
13197
|
-
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13198
|
-
array, range.start, range.count );
|
|
13199
|
-
|
|
13200
|
-
} else {
|
|
13201
13197
|
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
}
|
|
13198
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13199
|
+
array, range.start, range.count );
|
|
13206
13200
|
|
|
13207
13201
|
}
|
|
13208
13202
|
|
|
@@ -13213,17 +13207,8 @@
|
|
|
13213
13207
|
// @deprecated, r159
|
|
13214
13208
|
if ( updateRange.count !== - 1 ) {
|
|
13215
13209
|
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
|
|
13219
|
-
array, updateRange.offset, updateRange.count );
|
|
13220
|
-
|
|
13221
|
-
} else {
|
|
13222
|
-
|
|
13223
|
-
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
|
|
13224
|
-
array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
|
|
13225
|
-
|
|
13226
|
-
}
|
|
13210
|
+
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
|
|
13211
|
+
array, updateRange.offset, updateRange.count );
|
|
13227
13212
|
|
|
13228
13213
|
updateRange.count = - 1; // reset range
|
|
13229
13214
|
|
|
@@ -13522,13 +13507,13 @@
|
|
|
13522
13507
|
|
|
13523
13508
|
var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
|
|
13524
13509
|
|
|
13525
|
-
var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )
|
|
13510
|
+
var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
13526
13511
|
|
|
13527
|
-
var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )
|
|
13512
|
+
var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
13528
13513
|
|
|
13529
|
-
var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\
|
|
13514
|
+
var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
13530
13515
|
|
|
13531
|
-
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\
|
|
13516
|
+
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
|
|
13532
13517
|
|
|
13533
13518
|
var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
13534
13519
|
|
|
@@ -13588,7 +13573,7 @@
|
|
|
13588
13573
|
|
|
13589
13574
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
13590
13575
|
|
|
13591
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\
|
|
13576
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif";
|
|
13592
13577
|
|
|
13593
13578
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
13594
13579
|
|
|
@@ -13610,7 +13595,7 @@
|
|
|
13610
13595
|
|
|
13611
13596
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
13612
13597
|
|
|
13613
|
-
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
13598
|
+
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, newPeak * vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
13614
13599
|
|
|
13615
13600
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
13616
13601
|
|
|
@@ -14151,7 +14136,7 @@
|
|
|
14151
14136
|
emissive: { value: /*@__PURE__*/ new Color$1( 0x000000 ) },
|
|
14152
14137
|
roughness: { value: 1.0 },
|
|
14153
14138
|
metalness: { value: 0.0 },
|
|
14154
|
-
envMapIntensity: { value: 1 }
|
|
14139
|
+
envMapIntensity: { value: 1 }
|
|
14155
14140
|
}
|
|
14156
14141
|
] ),
|
|
14157
14142
|
|
|
@@ -14657,13 +14642,10 @@
|
|
|
14657
14642
|
|
|
14658
14643
|
}
|
|
14659
14644
|
|
|
14660
|
-
function WebGLBindingStates( gl,
|
|
14645
|
+
function WebGLBindingStates( gl, attributes ) {
|
|
14661
14646
|
|
|
14662
14647
|
const maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
|
|
14663
14648
|
|
|
14664
|
-
const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );
|
|
14665
|
-
const vaoAvailable = capabilities.isWebGL2 || extension !== null;
|
|
14666
|
-
|
|
14667
14649
|
const bindingStates = {};
|
|
14668
14650
|
|
|
14669
14651
|
const defaultState = createBindingState( null );
|
|
@@ -14674,38 +14656,18 @@
|
|
|
14674
14656
|
|
|
14675
14657
|
let updateBuffers = false;
|
|
14676
14658
|
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
const state = getBindingState( geometry, program, material );
|
|
14680
|
-
|
|
14681
|
-
if ( currentState !== state ) {
|
|
14682
|
-
|
|
14683
|
-
currentState = state;
|
|
14684
|
-
bindVertexArrayObject( currentState.object );
|
|
14685
|
-
|
|
14686
|
-
}
|
|
14687
|
-
|
|
14688
|
-
updateBuffers = needsUpdate( object, geometry, program, index );
|
|
14689
|
-
|
|
14690
|
-
if ( updateBuffers ) saveCache( object, geometry, program, index );
|
|
14691
|
-
|
|
14692
|
-
} else {
|
|
14659
|
+
const state = getBindingState( geometry, program, material );
|
|
14693
14660
|
|
|
14694
|
-
|
|
14661
|
+
if ( currentState !== state ) {
|
|
14695
14662
|
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
currentState.wireframe !== wireframe ) {
|
|
14663
|
+
currentState = state;
|
|
14664
|
+
bindVertexArrayObject( currentState.object );
|
|
14699
14665
|
|
|
14700
|
-
|
|
14701
|
-
currentState.program = program.id;
|
|
14702
|
-
currentState.wireframe = wireframe;
|
|
14666
|
+
}
|
|
14703
14667
|
|
|
14704
|
-
|
|
14668
|
+
updateBuffers = needsUpdate( object, geometry, program, index );
|
|
14705
14669
|
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
}
|
|
14670
|
+
if ( updateBuffers ) saveCache( object, geometry, program, index );
|
|
14709
14671
|
|
|
14710
14672
|
if ( index !== null ) {
|
|
14711
14673
|
|
|
@@ -14731,25 +14693,19 @@
|
|
|
14731
14693
|
|
|
14732
14694
|
function createVertexArrayObject() {
|
|
14733
14695
|
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
return extension.createVertexArrayOES();
|
|
14696
|
+
return gl.createVertexArray();
|
|
14737
14697
|
|
|
14738
14698
|
}
|
|
14739
14699
|
|
|
14740
14700
|
function bindVertexArrayObject( vao ) {
|
|
14741
14701
|
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
return extension.bindVertexArrayOES( vao );
|
|
14702
|
+
return gl.bindVertexArray( vao );
|
|
14745
14703
|
|
|
14746
14704
|
}
|
|
14747
14705
|
|
|
14748
14706
|
function deleteVertexArrayObject( vao ) {
|
|
14749
14707
|
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
return extension.deleteVertexArrayOES( vao );
|
|
14708
|
+
return gl.deleteVertexArray( vao );
|
|
14753
14709
|
|
|
14754
14710
|
}
|
|
14755
14711
|
|
|
@@ -14947,9 +14903,7 @@
|
|
|
14947
14903
|
|
|
14948
14904
|
if ( attributeDivisors[ attribute ] !== meshPerAttribute ) {
|
|
14949
14905
|
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
extension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );
|
|
14906
|
+
gl.vertexAttribDivisor( attribute, meshPerAttribute );
|
|
14953
14907
|
attributeDivisors[ attribute ] = meshPerAttribute;
|
|
14954
14908
|
|
|
14955
14909
|
}
|
|
@@ -14990,12 +14944,6 @@
|
|
|
14990
14944
|
|
|
14991
14945
|
function setupVertexAttributes( object, material, program, geometry ) {
|
|
14992
14946
|
|
|
14993
|
-
if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {
|
|
14994
|
-
|
|
14995
|
-
if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;
|
|
14996
|
-
|
|
14997
|
-
}
|
|
14998
|
-
|
|
14999
14947
|
initAttributes();
|
|
15000
14948
|
|
|
15001
14949
|
const geometryAttributes = geometry.attributes;
|
|
@@ -15034,9 +14982,9 @@
|
|
|
15034
14982
|
const type = attribute.type;
|
|
15035
14983
|
const bytesPerElement = attribute.bytesPerElement;
|
|
15036
14984
|
|
|
15037
|
-
// check for integer attributes
|
|
14985
|
+
// check for integer attributes
|
|
15038
14986
|
|
|
15039
|
-
const integer = (
|
|
14987
|
+
const integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );
|
|
15040
14988
|
|
|
15041
14989
|
if ( geometryAttribute.isInterleavedBufferAttribute ) {
|
|
15042
14990
|
|
|
@@ -15284,9 +15232,7 @@
|
|
|
15284
15232
|
|
|
15285
15233
|
}
|
|
15286
15234
|
|
|
15287
|
-
function WebGLBufferRenderer( gl, extensions, info
|
|
15288
|
-
|
|
15289
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
15235
|
+
function WebGLBufferRenderer( gl, extensions, info ) {
|
|
15290
15236
|
|
|
15291
15237
|
let mode;
|
|
15292
15238
|
|
|
@@ -15308,28 +15254,7 @@
|
|
|
15308
15254
|
|
|
15309
15255
|
if ( primcount === 0 ) return;
|
|
15310
15256
|
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
if ( isWebGL2 ) {
|
|
15314
|
-
|
|
15315
|
-
extension = gl;
|
|
15316
|
-
methodName = 'drawArraysInstanced';
|
|
15317
|
-
|
|
15318
|
-
} else {
|
|
15319
|
-
|
|
15320
|
-
extension = extensions.get( 'ANGLE_instanced_arrays' );
|
|
15321
|
-
methodName = 'drawArraysInstancedANGLE';
|
|
15322
|
-
|
|
15323
|
-
if ( extension === null ) {
|
|
15324
|
-
|
|
15325
|
-
console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
|
|
15326
|
-
return;
|
|
15327
|
-
|
|
15328
|
-
}
|
|
15329
|
-
|
|
15330
|
-
}
|
|
15331
|
-
|
|
15332
|
-
extension[ methodName ]( mode, start, count, primcount );
|
|
15257
|
+
gl.drawArraysInstanced( mode, start, count, primcount );
|
|
15333
15258
|
|
|
15334
15259
|
info.update( count, mode, primcount );
|
|
15335
15260
|
|
|
@@ -15340,6 +15265,7 @@
|
|
|
15340
15265
|
if ( drawCount === 0 ) return;
|
|
15341
15266
|
|
|
15342
15267
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15268
|
+
|
|
15343
15269
|
if ( extension === null ) {
|
|
15344
15270
|
|
|
15345
15271
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
@@ -15428,8 +15354,6 @@
|
|
|
15428
15354
|
|
|
15429
15355
|
}
|
|
15430
15356
|
|
|
15431
|
-
const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';
|
|
15432
|
-
|
|
15433
15357
|
let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
|
|
15434
15358
|
const maxPrecision = getMaxPrecision( precision );
|
|
15435
15359
|
|
|
@@ -15440,8 +15364,6 @@
|
|
|
15440
15364
|
|
|
15441
15365
|
}
|
|
15442
15366
|
|
|
15443
|
-
const drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );
|
|
15444
|
-
|
|
15445
15367
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
15446
15368
|
|
|
15447
15369
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
@@ -15455,16 +15377,12 @@
|
|
|
15455
15377
|
const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
|
|
15456
15378
|
|
|
15457
15379
|
const vertexTextures = maxVertexTextures > 0;
|
|
15458
|
-
const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );
|
|
15459
|
-
const floatVertexTextures = vertexTextures && floatFragmentTextures;
|
|
15460
15380
|
|
|
15461
|
-
const maxSamples =
|
|
15381
|
+
const maxSamples = gl.getParameter( gl.MAX_SAMPLES );
|
|
15462
15382
|
|
|
15463
15383
|
return {
|
|
15464
15384
|
|
|
15465
|
-
isWebGL2:
|
|
15466
|
-
|
|
15467
|
-
drawBuffers: drawBuffers,
|
|
15385
|
+
isWebGL2: true, // keeping this for backwards compatibility
|
|
15468
15386
|
|
|
15469
15387
|
getMaxAnisotropy: getMaxAnisotropy,
|
|
15470
15388
|
getMaxPrecision: getMaxPrecision,
|
|
@@ -15483,8 +15401,6 @@
|
|
|
15483
15401
|
maxFragmentUniforms: maxFragmentUniforms,
|
|
15484
15402
|
|
|
15485
15403
|
vertexTextures: vertexTextures,
|
|
15486
|
-
floatFragmentTextures: floatFragmentTextures,
|
|
15487
|
-
floatVertexTextures: floatVertexTextures,
|
|
15488
15404
|
|
|
15489
15405
|
maxSamples: maxSamples
|
|
15490
15406
|
|
|
@@ -15903,6 +15819,7 @@
|
|
|
15903
15819
|
let _oldTarget = null;
|
|
15904
15820
|
let _oldActiveCubeFace = 0;
|
|
15905
15821
|
let _oldActiveMipmapLevel = 0;
|
|
15822
|
+
let _oldXrEnabled = false;
|
|
15906
15823
|
|
|
15907
15824
|
// Golden Ratio
|
|
15908
15825
|
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
@@ -15970,6 +15887,9 @@
|
|
|
15970
15887
|
_oldTarget = this._renderer.getRenderTarget();
|
|
15971
15888
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
15972
15889
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
15890
|
+
_oldXrEnabled = this._renderer.xr.enabled;
|
|
15891
|
+
|
|
15892
|
+
this._renderer.xr.enabled = false;
|
|
15973
15893
|
|
|
15974
15894
|
this._setSize( 256 );
|
|
15975
15895
|
|
|
@@ -16085,6 +16005,8 @@
|
|
|
16085
16005
|
_cleanup( outputTarget ) {
|
|
16086
16006
|
|
|
16087
16007
|
this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
|
|
16008
|
+
this._renderer.xr.enabled = _oldXrEnabled;
|
|
16009
|
+
|
|
16088
16010
|
outputTarget.scissorTest = false;
|
|
16089
16011
|
_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
|
|
16090
16012
|
|
|
@@ -16105,6 +16027,9 @@
|
|
|
16105
16027
|
_oldTarget = this._renderer.getRenderTarget();
|
|
16106
16028
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
16107
16029
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
16030
|
+
_oldXrEnabled = this._renderer.xr.enabled;
|
|
16031
|
+
|
|
16032
|
+
this._renderer.xr.enabled = false;
|
|
16108
16033
|
|
|
16109
16034
|
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
16110
16035
|
this._textureToCubeUV( texture, cubeUVRenderTarget );
|
|
@@ -16787,24 +16712,26 @@
|
|
|
16787
16712
|
|
|
16788
16713
|
if ( isEquirectMap || isCubeMap ) {
|
|
16789
16714
|
|
|
16790
|
-
|
|
16715
|
+
let renderTarget = cubeUVmaps.get( texture );
|
|
16791
16716
|
|
|
16792
|
-
|
|
16717
|
+
const currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;
|
|
16793
16718
|
|
|
16794
|
-
|
|
16719
|
+
if ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {
|
|
16795
16720
|
|
|
16796
16721
|
if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
|
|
16797
16722
|
|
|
16798
16723
|
renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );
|
|
16724
|
+
renderTarget.texture.pmremVersion = texture.pmremVersion;
|
|
16725
|
+
|
|
16799
16726
|
cubeUVmaps.set( texture, renderTarget );
|
|
16800
16727
|
|
|
16801
16728
|
return renderTarget.texture;
|
|
16802
16729
|
|
|
16803
16730
|
} else {
|
|
16804
16731
|
|
|
16805
|
-
if (
|
|
16732
|
+
if ( renderTarget !== undefined ) {
|
|
16806
16733
|
|
|
16807
|
-
return
|
|
16734
|
+
return renderTarget.texture;
|
|
16808
16735
|
|
|
16809
16736
|
} else {
|
|
16810
16737
|
|
|
@@ -16814,7 +16741,9 @@
|
|
|
16814
16741
|
|
|
16815
16742
|
if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
|
|
16816
16743
|
|
|
16817
|
-
|
|
16744
|
+
renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
|
|
16745
|
+
renderTarget.texture.pmremVersion = texture.pmremVersion;
|
|
16746
|
+
|
|
16818
16747
|
cubeUVmaps.set( texture, renderTarget );
|
|
16819
16748
|
|
|
16820
16749
|
texture.addEventListener( 'dispose', onTextureDispose );
|
|
@@ -16945,29 +16874,14 @@
|
|
|
16945
16874
|
|
|
16946
16875
|
},
|
|
16947
16876
|
|
|
16948
|
-
init: function (
|
|
16949
|
-
|
|
16950
|
-
if ( capabilities.isWebGL2 ) {
|
|
16951
|
-
|
|
16952
|
-
getExtension( 'EXT_color_buffer_float' );
|
|
16953
|
-
getExtension( 'WEBGL_clip_cull_distance' );
|
|
16954
|
-
|
|
16955
|
-
} else {
|
|
16956
|
-
|
|
16957
|
-
getExtension( 'WEBGL_depth_texture' );
|
|
16958
|
-
getExtension( 'OES_texture_float' );
|
|
16959
|
-
getExtension( 'OES_texture_half_float' );
|
|
16960
|
-
getExtension( 'OES_texture_half_float_linear' );
|
|
16961
|
-
getExtension( 'OES_standard_derivatives' );
|
|
16962
|
-
getExtension( 'OES_element_index_uint' );
|
|
16963
|
-
getExtension( 'OES_vertex_array_object' );
|
|
16964
|
-
getExtension( 'ANGLE_instanced_arrays' );
|
|
16965
|
-
|
|
16966
|
-
}
|
|
16877
|
+
init: function () {
|
|
16967
16878
|
|
|
16879
|
+
getExtension( 'EXT_color_buffer_float' );
|
|
16880
|
+
getExtension( 'WEBGL_clip_cull_distance' );
|
|
16968
16881
|
getExtension( 'OES_texture_float_linear' );
|
|
16969
16882
|
getExtension( 'EXT_color_buffer_half_float' );
|
|
16970
16883
|
getExtension( 'WEBGL_multisampled_render_to_texture' );
|
|
16884
|
+
getExtension( 'WEBGL_render_shared_exponent' );
|
|
16971
16885
|
|
|
16972
16886
|
},
|
|
16973
16887
|
|
|
@@ -17195,9 +17109,7 @@
|
|
|
17195
17109
|
|
|
17196
17110
|
}
|
|
17197
17111
|
|
|
17198
|
-
function WebGLIndexedBufferRenderer( gl, extensions, info
|
|
17199
|
-
|
|
17200
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
17112
|
+
function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
17201
17113
|
|
|
17202
17114
|
let mode;
|
|
17203
17115
|
|
|
@@ -17228,28 +17140,7 @@
|
|
|
17228
17140
|
|
|
17229
17141
|
if ( primcount === 0 ) return;
|
|
17230
17142
|
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
if ( isWebGL2 ) {
|
|
17234
|
-
|
|
17235
|
-
extension = gl;
|
|
17236
|
-
methodName = 'drawElementsInstanced';
|
|
17237
|
-
|
|
17238
|
-
} else {
|
|
17239
|
-
|
|
17240
|
-
extension = extensions.get( 'ANGLE_instanced_arrays' );
|
|
17241
|
-
methodName = 'drawElementsInstancedANGLE';
|
|
17242
|
-
|
|
17243
|
-
if ( extension === null ) {
|
|
17244
|
-
|
|
17245
|
-
console.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
|
|
17246
|
-
return;
|
|
17247
|
-
|
|
17248
|
-
}
|
|
17249
|
-
|
|
17250
|
-
}
|
|
17251
|
-
|
|
17252
|
-
extension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );
|
|
17143
|
+
gl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );
|
|
17253
17144
|
|
|
17254
17145
|
info.update( count, mode, primcount );
|
|
17255
17146
|
|
|
@@ -17260,6 +17151,7 @@
|
|
|
17260
17151
|
if ( drawCount === 0 ) return;
|
|
17261
17152
|
|
|
17262
17153
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17154
|
+
|
|
17263
17155
|
if ( extension === null ) {
|
|
17264
17156
|
|
|
17265
17157
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
@@ -17364,296 +17256,158 @@
|
|
|
17364
17256
|
|
|
17365
17257
|
}
|
|
17366
17258
|
|
|
17367
|
-
function numericalSort( a, b ) {
|
|
17368
|
-
|
|
17369
|
-
return a[ 0 ] - b[ 0 ];
|
|
17370
|
-
|
|
17371
|
-
}
|
|
17372
|
-
|
|
17373
|
-
function absNumericalSort( a, b ) {
|
|
17374
|
-
|
|
17375
|
-
return Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );
|
|
17376
|
-
|
|
17377
|
-
}
|
|
17378
|
-
|
|
17379
17259
|
function WebGLMorphtargets( gl, capabilities, textures ) {
|
|
17380
17260
|
|
|
17381
|
-
const influencesList = {};
|
|
17382
|
-
const morphInfluences = new Float32Array( 8 );
|
|
17383
17261
|
const morphTextures = new WeakMap();
|
|
17384
17262
|
const morph = new Vector4();
|
|
17385
17263
|
|
|
17386
|
-
const workInfluences = [];
|
|
17387
|
-
|
|
17388
|
-
for ( let i = 0; i < 8; i ++ ) {
|
|
17389
|
-
|
|
17390
|
-
workInfluences[ i ] = [ i, 0 ];
|
|
17391
|
-
|
|
17392
|
-
}
|
|
17393
|
-
|
|
17394
17264
|
function update( object, geometry, program ) {
|
|
17395
17265
|
|
|
17396
17266
|
const objectInfluences = object.morphTargetInfluences;
|
|
17397
17267
|
|
|
17398
|
-
|
|
17399
|
-
|
|
17400
|
-
// instead of using attributes, the WebGL 2 code path encodes morph targets
|
|
17401
|
-
// into an array of data textures. Each layer represents a single morph target.
|
|
17402
|
-
|
|
17403
|
-
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
17404
|
-
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
17405
|
-
|
|
17406
|
-
let entry = morphTextures.get( geometry );
|
|
17407
|
-
|
|
17408
|
-
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
17409
|
-
|
|
17410
|
-
if ( entry !== undefined ) entry.texture.dispose();
|
|
17411
|
-
|
|
17412
|
-
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
17413
|
-
const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
|
|
17414
|
-
const hasMorphColors = geometry.morphAttributes.color !== undefined;
|
|
17415
|
-
|
|
17416
|
-
const morphTargets = geometry.morphAttributes.position || [];
|
|
17417
|
-
const morphNormals = geometry.morphAttributes.normal || [];
|
|
17418
|
-
const morphColors = geometry.morphAttributes.color || [];
|
|
17419
|
-
|
|
17420
|
-
let vertexDataCount = 0;
|
|
17421
|
-
|
|
17422
|
-
if ( hasMorphPosition === true ) vertexDataCount = 1;
|
|
17423
|
-
if ( hasMorphNormals === true ) vertexDataCount = 2;
|
|
17424
|
-
if ( hasMorphColors === true ) vertexDataCount = 3;
|
|
17268
|
+
// instead of using attributes, the WebGL 2 code path encodes morph targets
|
|
17269
|
+
// into an array of data textures. Each layer represents a single morph target.
|
|
17425
17270
|
|
|
17426
|
-
|
|
17427
|
-
|
|
17271
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
17272
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
17428
17273
|
|
|
17429
|
-
|
|
17274
|
+
let entry = morphTextures.get( geometry );
|
|
17430
17275
|
|
|
17431
|
-
|
|
17432
|
-
width = capabilities.maxTextureSize;
|
|
17276
|
+
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
17433
17277
|
|
|
17434
|
-
|
|
17278
|
+
if ( entry !== undefined ) entry.texture.dispose();
|
|
17435
17279
|
|
|
17436
|
-
|
|
17280
|
+
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
17281
|
+
const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
|
|
17282
|
+
const hasMorphColors = geometry.morphAttributes.color !== undefined;
|
|
17437
17283
|
|
|
17438
|
-
|
|
17439
|
-
|
|
17440
|
-
|
|
17284
|
+
const morphTargets = geometry.morphAttributes.position || [];
|
|
17285
|
+
const morphNormals = geometry.morphAttributes.normal || [];
|
|
17286
|
+
const morphColors = geometry.morphAttributes.color || [];
|
|
17441
17287
|
|
|
17442
|
-
|
|
17288
|
+
let vertexDataCount = 0;
|
|
17443
17289
|
|
|
17444
|
-
|
|
17290
|
+
if ( hasMorphPosition === true ) vertexDataCount = 1;
|
|
17291
|
+
if ( hasMorphNormals === true ) vertexDataCount = 2;
|
|
17292
|
+
if ( hasMorphColors === true ) vertexDataCount = 3;
|
|
17445
17293
|
|
|
17446
|
-
|
|
17294
|
+
let width = geometry.attributes.position.count * vertexDataCount;
|
|
17295
|
+
let height = 1;
|
|
17447
17296
|
|
|
17448
|
-
|
|
17449
|
-
const morphNormal = morphNormals[ i ];
|
|
17450
|
-
const morphColor = morphColors[ i ];
|
|
17297
|
+
if ( width > capabilities.maxTextureSize ) {
|
|
17451
17298
|
|
|
17452
|
-
|
|
17299
|
+
height = Math.ceil( width / capabilities.maxTextureSize );
|
|
17300
|
+
width = capabilities.maxTextureSize;
|
|
17453
17301
|
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
const stride = j * vertexDataStride;
|
|
17302
|
+
}
|
|
17457
17303
|
|
|
17458
|
-
|
|
17304
|
+
const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
|
|
17459
17305
|
|
|
17460
|
-
|
|
17306
|
+
const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
|
|
17307
|
+
texture.type = FloatType;
|
|
17308
|
+
texture.needsUpdate = true;
|
|
17461
17309
|
|
|
17462
|
-
|
|
17463
|
-
buffer[ offset + stride + 1 ] = morph.y;
|
|
17464
|
-
buffer[ offset + stride + 2 ] = morph.z;
|
|
17465
|
-
buffer[ offset + stride + 3 ] = 0;
|
|
17310
|
+
// fill buffer
|
|
17466
17311
|
|
|
17467
|
-
|
|
17312
|
+
const vertexDataStride = vertexDataCount * 4;
|
|
17468
17313
|
|
|
17469
|
-
|
|
17314
|
+
for ( let i = 0; i < morphTargetsCount; i ++ ) {
|
|
17470
17315
|
|
|
17471
|
-
|
|
17316
|
+
const morphTarget = morphTargets[ i ];
|
|
17317
|
+
const morphNormal = morphNormals[ i ];
|
|
17318
|
+
const morphColor = morphColors[ i ];
|
|
17472
17319
|
|
|
17473
|
-
|
|
17474
|
-
buffer[ offset + stride + 5 ] = morph.y;
|
|
17475
|
-
buffer[ offset + stride + 6 ] = morph.z;
|
|
17476
|
-
buffer[ offset + stride + 7 ] = 0;
|
|
17320
|
+
const offset = width * height * 4 * i;
|
|
17477
17321
|
|
|
17478
|
-
|
|
17322
|
+
for ( let j = 0; j < morphTarget.count; j ++ ) {
|
|
17479
17323
|
|
|
17480
|
-
|
|
17324
|
+
const stride = j * vertexDataStride;
|
|
17481
17325
|
|
|
17482
|
-
|
|
17326
|
+
if ( hasMorphPosition === true ) {
|
|
17483
17327
|
|
|
17484
|
-
|
|
17485
|
-
buffer[ offset + stride + 9 ] = morph.y;
|
|
17486
|
-
buffer[ offset + stride + 10 ] = morph.z;
|
|
17487
|
-
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
|
|
17328
|
+
morph.fromBufferAttribute( morphTarget, j );
|
|
17488
17329
|
|
|
17489
|
-
|
|
17330
|
+
buffer[ offset + stride + 0 ] = morph.x;
|
|
17331
|
+
buffer[ offset + stride + 1 ] = morph.y;
|
|
17332
|
+
buffer[ offset + stride + 2 ] = morph.z;
|
|
17333
|
+
buffer[ offset + stride + 3 ] = 0;
|
|
17490
17334
|
|
|
17491
17335
|
}
|
|
17492
17336
|
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
entry = {
|
|
17496
|
-
count: morphTargetsCount,
|
|
17497
|
-
texture: texture,
|
|
17498
|
-
size: new Vector2( width, height )
|
|
17499
|
-
};
|
|
17500
|
-
|
|
17501
|
-
morphTextures.set( geometry, entry );
|
|
17502
|
-
|
|
17503
|
-
function disposeTexture() {
|
|
17504
|
-
|
|
17505
|
-
texture.dispose();
|
|
17506
|
-
|
|
17507
|
-
morphTextures.delete( geometry );
|
|
17508
|
-
|
|
17509
|
-
geometry.removeEventListener( 'dispose', disposeTexture );
|
|
17337
|
+
if ( hasMorphNormals === true ) {
|
|
17510
17338
|
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
geometry.addEventListener( 'dispose', disposeTexture );
|
|
17339
|
+
morph.fromBufferAttribute( morphNormal, j );
|
|
17514
17340
|
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17341
|
+
buffer[ offset + stride + 4 ] = morph.x;
|
|
17342
|
+
buffer[ offset + stride + 5 ] = morph.y;
|
|
17343
|
+
buffer[ offset + stride + 6 ] = morph.z;
|
|
17344
|
+
buffer[ offset + stride + 7 ] = 0;
|
|
17519
17345
|
|
|
17520
|
-
|
|
17346
|
+
}
|
|
17521
17347
|
|
|
17522
|
-
|
|
17348
|
+
if ( hasMorphColors === true ) {
|
|
17523
17349
|
|
|
17524
|
-
|
|
17350
|
+
morph.fromBufferAttribute( morphColor, j );
|
|
17525
17351
|
|
|
17526
|
-
|
|
17352
|
+
buffer[ offset + stride + 8 ] = morph.x;
|
|
17353
|
+
buffer[ offset + stride + 9 ] = morph.y;
|
|
17354
|
+
buffer[ offset + stride + 10 ] = morph.z;
|
|
17355
|
+
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
|
|
17527
17356
|
|
|
17528
|
-
|
|
17357
|
+
}
|
|
17529
17358
|
|
|
17530
17359
|
}
|
|
17531
17360
|
|
|
17532
|
-
const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
|
|
17536
|
-
program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
|
|
17537
|
-
|
|
17538
17361
|
}
|
|
17539
17362
|
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
// When object doesn't have morph target influences defined, we treat it as a 0-length array
|
|
17546
|
-
// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
|
|
17547
|
-
|
|
17548
|
-
const length = objectInfluences === undefined ? 0 : objectInfluences.length;
|
|
17549
|
-
|
|
17550
|
-
let influences = influencesList[ geometry.id ];
|
|
17551
|
-
|
|
17552
|
-
if ( influences === undefined || influences.length !== length ) {
|
|
17553
|
-
|
|
17554
|
-
// initialise list
|
|
17555
|
-
|
|
17556
|
-
influences = [];
|
|
17557
|
-
|
|
17558
|
-
for ( let i = 0; i < length; i ++ ) {
|
|
17559
|
-
|
|
17560
|
-
influences[ i ] = [ i, 0 ];
|
|
17561
|
-
|
|
17562
|
-
}
|
|
17563
|
-
|
|
17564
|
-
influencesList[ geometry.id ] = influences;
|
|
17363
|
+
entry = {
|
|
17364
|
+
count: morphTargetsCount,
|
|
17365
|
+
texture: texture,
|
|
17366
|
+
size: new Vector2( width, height )
|
|
17367
|
+
};
|
|
17565
17368
|
|
|
17566
|
-
|
|
17369
|
+
morphTextures.set( geometry, entry );
|
|
17567
17370
|
|
|
17568
|
-
|
|
17371
|
+
function disposeTexture() {
|
|
17569
17372
|
|
|
17570
|
-
|
|
17373
|
+
texture.dispose();
|
|
17571
17374
|
|
|
17572
|
-
|
|
17375
|
+
morphTextures.delete( geometry );
|
|
17573
17376
|
|
|
17574
|
-
|
|
17575
|
-
influence[ 1 ] = objectInfluences[ i ];
|
|
17377
|
+
geometry.removeEventListener( 'dispose', disposeTexture );
|
|
17576
17378
|
|
|
17577
17379
|
}
|
|
17578
17380
|
|
|
17579
|
-
|
|
17381
|
+
geometry.addEventListener( 'dispose', disposeTexture );
|
|
17580
17382
|
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
if ( i < length && influences[ i ][ 1 ] ) {
|
|
17584
|
-
|
|
17585
|
-
workInfluences[ i ][ 0 ] = influences[ i ][ 0 ];
|
|
17586
|
-
workInfluences[ i ][ 1 ] = influences[ i ][ 1 ];
|
|
17587
|
-
|
|
17588
|
-
} else {
|
|
17589
|
-
|
|
17590
|
-
workInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;
|
|
17591
|
-
workInfluences[ i ][ 1 ] = 0;
|
|
17592
|
-
|
|
17593
|
-
}
|
|
17383
|
+
}
|
|
17594
17384
|
|
|
17595
|
-
|
|
17385
|
+
//
|
|
17386
|
+
if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
|
|
17596
17387
|
|
|
17597
|
-
|
|
17388
|
+
program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
|
|
17598
17389
|
|
|
17599
|
-
|
|
17600
|
-
const morphNormals = geometry.morphAttributes.normal;
|
|
17390
|
+
} else {
|
|
17601
17391
|
|
|
17602
17392
|
let morphInfluencesSum = 0;
|
|
17603
17393
|
|
|
17604
|
-
for ( let i = 0; i <
|
|
17605
|
-
|
|
17606
|
-
const influence = workInfluences[ i ];
|
|
17607
|
-
const index = influence[ 0 ];
|
|
17608
|
-
const value = influence[ 1 ];
|
|
17609
|
-
|
|
17610
|
-
if ( index !== Number.MAX_SAFE_INTEGER && value ) {
|
|
17611
|
-
|
|
17612
|
-
if ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {
|
|
17613
|
-
|
|
17614
|
-
geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );
|
|
17615
|
-
|
|
17616
|
-
}
|
|
17617
|
-
|
|
17618
|
-
if ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {
|
|
17619
|
-
|
|
17620
|
-
geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );
|
|
17621
|
-
|
|
17622
|
-
}
|
|
17623
|
-
|
|
17624
|
-
morphInfluences[ i ] = value;
|
|
17625
|
-
morphInfluencesSum += value;
|
|
17626
|
-
|
|
17627
|
-
} else {
|
|
17628
|
-
|
|
17629
|
-
if ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {
|
|
17394
|
+
for ( let i = 0; i < objectInfluences.length; i ++ ) {
|
|
17630
17395
|
|
|
17631
|
-
|
|
17632
|
-
|
|
17633
|
-
}
|
|
17634
|
-
|
|
17635
|
-
if ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {
|
|
17636
|
-
|
|
17637
|
-
geometry.deleteAttribute( 'morphNormal' + i );
|
|
17638
|
-
|
|
17639
|
-
}
|
|
17640
|
-
|
|
17641
|
-
morphInfluences[ i ] = 0;
|
|
17642
|
-
|
|
17643
|
-
}
|
|
17396
|
+
morphInfluencesSum += objectInfluences[ i ];
|
|
17644
17397
|
|
|
17645
17398
|
}
|
|
17646
17399
|
|
|
17647
|
-
// GLSL shader uses formula baseinfluence * base + sum(target * influence)
|
|
17648
|
-
// This allows us to switch between absolute morphs and relative morphs without changing shader code
|
|
17649
|
-
// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
|
|
17650
17400
|
const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
|
|
17651
17401
|
|
|
17402
|
+
|
|
17652
17403
|
program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
|
|
17653
|
-
program.getUniforms().setValue( gl, 'morphTargetInfluences',
|
|
17404
|
+
program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
|
|
17654
17405
|
|
|
17655
17406
|
}
|
|
17656
17407
|
|
|
17408
|
+
program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
|
|
17409
|
+
program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
|
|
17410
|
+
|
|
17657
17411
|
}
|
|
17658
17412
|
|
|
17659
17413
|
return {
|
|
@@ -19106,19 +18860,6 @@
|
|
|
19106
18860
|
|
|
19107
18861
|
}
|
|
19108
18862
|
|
|
19109
|
-
function generateExtensions( parameters ) {
|
|
19110
|
-
|
|
19111
|
-
const chunks = [
|
|
19112
|
-
( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
|
|
19113
|
-
( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
|
|
19114
|
-
( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
|
|
19115
|
-
( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
|
|
19116
|
-
];
|
|
19117
|
-
|
|
19118
|
-
return chunks.filter( filterEmptyLine ).join( '\n' );
|
|
19119
|
-
|
|
19120
|
-
}
|
|
19121
|
-
|
|
19122
18863
|
function generateVertexExtensions( parameters ) {
|
|
19123
18864
|
|
|
19124
18865
|
const chunks = [
|
|
@@ -19286,27 +19027,21 @@
|
|
|
19286
19027
|
precision ${parameters.precision} int;
|
|
19287
19028
|
precision ${parameters.precision} sampler2D;
|
|
19288
19029
|
precision ${parameters.precision} samplerCube;
|
|
19030
|
+
precision ${parameters.precision} sampler3D;
|
|
19031
|
+
precision ${parameters.precision} sampler2DArray;
|
|
19032
|
+
precision ${parameters.precision} sampler2DShadow;
|
|
19033
|
+
precision ${parameters.precision} samplerCubeShadow;
|
|
19034
|
+
precision ${parameters.precision} sampler2DArrayShadow;
|
|
19035
|
+
precision ${parameters.precision} isampler2D;
|
|
19036
|
+
precision ${parameters.precision} isampler3D;
|
|
19037
|
+
precision ${parameters.precision} isamplerCube;
|
|
19038
|
+
precision ${parameters.precision} isampler2DArray;
|
|
19039
|
+
precision ${parameters.precision} usampler2D;
|
|
19040
|
+
precision ${parameters.precision} usampler3D;
|
|
19041
|
+
precision ${parameters.precision} usamplerCube;
|
|
19042
|
+
precision ${parameters.precision} usampler2DArray;
|
|
19289
19043
|
`;
|
|
19290
19044
|
|
|
19291
|
-
if ( parameters.isWebGL2 ) {
|
|
19292
|
-
|
|
19293
|
-
precisionstring += `precision ${parameters.precision} sampler3D;
|
|
19294
|
-
precision ${parameters.precision} sampler2DArray;
|
|
19295
|
-
precision ${parameters.precision} sampler2DShadow;
|
|
19296
|
-
precision ${parameters.precision} samplerCubeShadow;
|
|
19297
|
-
precision ${parameters.precision} sampler2DArrayShadow;
|
|
19298
|
-
precision ${parameters.precision} isampler2D;
|
|
19299
|
-
precision ${parameters.precision} isampler3D;
|
|
19300
|
-
precision ${parameters.precision} isamplerCube;
|
|
19301
|
-
precision ${parameters.precision} isampler2DArray;
|
|
19302
|
-
precision ${parameters.precision} usampler2D;
|
|
19303
|
-
precision ${parameters.precision} usampler3D;
|
|
19304
|
-
precision ${parameters.precision} usamplerCube;
|
|
19305
|
-
precision ${parameters.precision} usampler2DArray;
|
|
19306
|
-
`;
|
|
19307
|
-
|
|
19308
|
-
}
|
|
19309
|
-
|
|
19310
19045
|
if ( parameters.precision === 'highp' ) {
|
|
19311
19046
|
|
|
19312
19047
|
precisionstring += '\n#define HIGH_PRECISION';
|
|
@@ -19455,8 +19190,6 @@
|
|
|
19455
19190
|
const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
|
|
19456
19191
|
const envMapCubeUVSize = generateCubeUVSize( parameters );
|
|
19457
19192
|
|
|
19458
|
-
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
19459
|
-
|
|
19460
19193
|
const customVertexExtensions = generateVertexExtensions( parameters );
|
|
19461
19194
|
|
|
19462
19195
|
const customDefines = generateDefines( defines );
|
|
@@ -19485,8 +19218,6 @@
|
|
|
19485
19218
|
|
|
19486
19219
|
prefixFragment = [
|
|
19487
19220
|
|
|
19488
|
-
customExtensions,
|
|
19489
|
-
|
|
19490
19221
|
'#define SHADER_TYPE ' + parameters.shaderType,
|
|
19491
19222
|
'#define SHADER_NAME ' + parameters.shaderName,
|
|
19492
19223
|
|
|
@@ -19608,10 +19339,10 @@
|
|
|
19608
19339
|
|
|
19609
19340
|
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
|
|
19610
19341
|
parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
|
|
19611
|
-
( parameters.morphColors
|
|
19612
|
-
( parameters.morphTargetsCount > 0
|
|
19613
|
-
( parameters.morphTargetsCount > 0
|
|
19614
|
-
( parameters.morphTargetsCount > 0
|
|
19342
|
+
( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',
|
|
19343
|
+
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE' : '',
|
|
19344
|
+
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
|
|
19345
|
+
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
|
|
19615
19346
|
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
|
|
19616
19347
|
parameters.flipSided ? '#define FLIP_SIDED' : '',
|
|
19617
19348
|
|
|
@@ -19625,7 +19356,6 @@
|
|
|
19625
19356
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
19626
19357
|
|
|
19627
19358
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
19628
|
-
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
19629
19359
|
|
|
19630
19360
|
'uniform mat4 modelMatrix;',
|
|
19631
19361
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -19729,8 +19459,6 @@
|
|
|
19729
19459
|
|
|
19730
19460
|
prefixFragment = [
|
|
19731
19461
|
|
|
19732
|
-
customExtensions,
|
|
19733
|
-
|
|
19734
19462
|
generatePrecision( parameters ),
|
|
19735
19463
|
|
|
19736
19464
|
'#define SHADER_TYPE ' + parameters.shaderType,
|
|
@@ -19818,7 +19546,6 @@
|
|
|
19818
19546
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
19819
19547
|
|
|
19820
19548
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
19821
|
-
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
19822
19549
|
|
|
19823
19550
|
'uniform mat4 viewMatrix;',
|
|
19824
19551
|
'uniform vec3 cameraPosition;',
|
|
@@ -19853,7 +19580,7 @@
|
|
|
19853
19580
|
vertexShader = unrollLoops( vertexShader );
|
|
19854
19581
|
fragmentShader = unrollLoops( fragmentShader );
|
|
19855
19582
|
|
|
19856
|
-
if ( parameters.
|
|
19583
|
+
if ( parameters.isRawShaderMaterial !== true ) {
|
|
19857
19584
|
|
|
19858
19585
|
// GLSL 3.0 conversion for built-in materials and ShaderMaterial
|
|
19859
19586
|
|
|
@@ -19861,14 +19588,12 @@
|
|
|
19861
19588
|
|
|
19862
19589
|
prefixVertex = [
|
|
19863
19590
|
customVertexExtensions,
|
|
19864
|
-
'precision mediump sampler2DArray;',
|
|
19865
19591
|
'#define attribute in',
|
|
19866
19592
|
'#define varying out',
|
|
19867
19593
|
'#define texture2D texture'
|
|
19868
19594
|
].join( '\n' ) + '\n' + prefixVertex;
|
|
19869
19595
|
|
|
19870
19596
|
prefixFragment = [
|
|
19871
|
-
'precision mediump sampler2DArray;',
|
|
19872
19597
|
'#define varying in',
|
|
19873
19598
|
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
|
|
19874
19599
|
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
@@ -20211,7 +19936,6 @@
|
|
|
20211
19936
|
const _activeChannels = new Set();
|
|
20212
19937
|
const programs = [];
|
|
20213
19938
|
|
|
20214
|
-
const IS_WEBGL2 = capabilities.isWebGL2;
|
|
20215
19939
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
20216
19940
|
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
20217
19941
|
|
|
@@ -20373,8 +20097,6 @@
|
|
|
20373
20097
|
|
|
20374
20098
|
const parameters = {
|
|
20375
20099
|
|
|
20376
|
-
isWebGL2: IS_WEBGL2,
|
|
20377
|
-
|
|
20378
20100
|
shaderID: shaderID,
|
|
20379
20101
|
shaderType: material.type,
|
|
20380
20102
|
shaderName: material.name,
|
|
@@ -20548,16 +20270,9 @@
|
|
|
20548
20270
|
|
|
20549
20271
|
index0AttributeName: material.index0AttributeName,
|
|
20550
20272
|
|
|
20551
|
-
extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,
|
|
20552
|
-
extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
|
|
20553
|
-
extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
|
|
20554
|
-
extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
|
|
20555
20273
|
extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
|
|
20556
20274
|
extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
|
|
20557
20275
|
|
|
20558
|
-
rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
|
|
20559
|
-
rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
|
|
20560
|
-
rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
|
|
20561
20276
|
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
20562
20277
|
|
|
20563
20278
|
customProgramCacheKey: material.customProgramCacheKey()
|
|
@@ -20673,48 +20388,46 @@
|
|
|
20673
20388
|
|
|
20674
20389
|
_programLayers.disableAll();
|
|
20675
20390
|
|
|
20676
|
-
if ( parameters.isWebGL2 )
|
|
20677
|
-
_programLayers.enable( 0 );
|
|
20678
20391
|
if ( parameters.supportsVertexTextures )
|
|
20679
|
-
_programLayers.enable(
|
|
20392
|
+
_programLayers.enable( 0 );
|
|
20680
20393
|
if ( parameters.instancing )
|
|
20681
|
-
_programLayers.enable(
|
|
20394
|
+
_programLayers.enable( 1 );
|
|
20682
20395
|
if ( parameters.instancingColor )
|
|
20683
|
-
_programLayers.enable(
|
|
20396
|
+
_programLayers.enable( 2 );
|
|
20684
20397
|
if ( parameters.instancingMorph )
|
|
20685
|
-
_programLayers.enable(
|
|
20398
|
+
_programLayers.enable( 3 );
|
|
20686
20399
|
if ( parameters.matcap )
|
|
20687
|
-
_programLayers.enable(
|
|
20400
|
+
_programLayers.enable( 4 );
|
|
20688
20401
|
if ( parameters.envMap )
|
|
20689
|
-
_programLayers.enable(
|
|
20402
|
+
_programLayers.enable( 5 );
|
|
20690
20403
|
if ( parameters.normalMapObjectSpace )
|
|
20691
|
-
_programLayers.enable(
|
|
20404
|
+
_programLayers.enable( 6 );
|
|
20692
20405
|
if ( parameters.normalMapTangentSpace )
|
|
20693
|
-
_programLayers.enable(
|
|
20406
|
+
_programLayers.enable( 7 );
|
|
20694
20407
|
if ( parameters.clearcoat )
|
|
20695
|
-
_programLayers.enable(
|
|
20408
|
+
_programLayers.enable( 8 );
|
|
20696
20409
|
if ( parameters.iridescence )
|
|
20697
|
-
_programLayers.enable(
|
|
20410
|
+
_programLayers.enable( 9 );
|
|
20698
20411
|
if ( parameters.alphaTest )
|
|
20699
|
-
_programLayers.enable(
|
|
20412
|
+
_programLayers.enable( 10 );
|
|
20700
20413
|
if ( parameters.vertexColors )
|
|
20701
|
-
_programLayers.enable(
|
|
20414
|
+
_programLayers.enable( 11 );
|
|
20702
20415
|
if ( parameters.vertexAlphas )
|
|
20703
|
-
_programLayers.enable(
|
|
20416
|
+
_programLayers.enable( 12 );
|
|
20704
20417
|
if ( parameters.vertexUv1s )
|
|
20705
|
-
_programLayers.enable(
|
|
20418
|
+
_programLayers.enable( 13 );
|
|
20706
20419
|
if ( parameters.vertexUv2s )
|
|
20707
|
-
_programLayers.enable(
|
|
20420
|
+
_programLayers.enable( 14 );
|
|
20708
20421
|
if ( parameters.vertexUv3s )
|
|
20709
|
-
_programLayers.enable(
|
|
20422
|
+
_programLayers.enable( 15 );
|
|
20710
20423
|
if ( parameters.vertexTangents )
|
|
20711
|
-
_programLayers.enable(
|
|
20424
|
+
_programLayers.enable( 16 );
|
|
20712
20425
|
if ( parameters.anisotropy )
|
|
20713
|
-
_programLayers.enable(
|
|
20426
|
+
_programLayers.enable( 17 );
|
|
20714
20427
|
if ( parameters.alphaHash )
|
|
20715
|
-
_programLayers.enable(
|
|
20428
|
+
_programLayers.enable( 18 );
|
|
20716
20429
|
if ( parameters.batching )
|
|
20717
|
-
_programLayers.enable(
|
|
20430
|
+
_programLayers.enable( 19 );
|
|
20718
20431
|
|
|
20719
20432
|
array.push( _programLayers.mask );
|
|
20720
20433
|
_programLayers.disableAll();
|
|
@@ -21287,7 +21000,7 @@
|
|
|
21287
21000
|
|
|
21288
21001
|
}
|
|
21289
21002
|
|
|
21290
|
-
function WebGLLights( extensions
|
|
21003
|
+
function WebGLLights( extensions ) {
|
|
21291
21004
|
|
|
21292
21005
|
const cache = new UniformsCache();
|
|
21293
21006
|
|
|
@@ -21536,41 +21249,15 @@
|
|
|
21536
21249
|
|
|
21537
21250
|
if ( rectAreaLength > 0 ) {
|
|
21538
21251
|
|
|
21539
|
-
if (
|
|
21252
|
+
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
21540
21253
|
|
|
21541
|
-
|
|
21542
|
-
|
|
21543
|
-
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
21544
|
-
|
|
21545
|
-
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
21546
|
-
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
21547
|
-
|
|
21548
|
-
} else {
|
|
21549
|
-
|
|
21550
|
-
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
21551
|
-
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
21552
|
-
|
|
21553
|
-
}
|
|
21254
|
+
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
21255
|
+
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
21554
21256
|
|
|
21555
21257
|
} else {
|
|
21556
21258
|
|
|
21557
|
-
|
|
21558
|
-
|
|
21559
|
-
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
21560
|
-
|
|
21561
|
-
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
21562
|
-
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
21563
|
-
|
|
21564
|
-
} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {
|
|
21565
|
-
|
|
21566
|
-
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
21567
|
-
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
21568
|
-
|
|
21569
|
-
} else {
|
|
21570
|
-
|
|
21571
|
-
console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
|
|
21572
|
-
|
|
21573
|
-
}
|
|
21259
|
+
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
21260
|
+
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
21574
21261
|
|
|
21575
21262
|
}
|
|
21576
21263
|
|
|
@@ -21723,9 +21410,9 @@
|
|
|
21723
21410
|
|
|
21724
21411
|
}
|
|
21725
21412
|
|
|
21726
|
-
function WebGLRenderState( extensions
|
|
21413
|
+
function WebGLRenderState( extensions ) {
|
|
21727
21414
|
|
|
21728
|
-
const lights = new WebGLLights( extensions
|
|
21415
|
+
const lights = new WebGLLights( extensions );
|
|
21729
21416
|
|
|
21730
21417
|
const lightsArray = [];
|
|
21731
21418
|
const shadowsArray = [];
|
|
@@ -21765,7 +21452,9 @@
|
|
|
21765
21452
|
lightsArray: lightsArray,
|
|
21766
21453
|
shadowsArray: shadowsArray,
|
|
21767
21454
|
|
|
21768
|
-
lights: lights
|
|
21455
|
+
lights: lights,
|
|
21456
|
+
|
|
21457
|
+
transmissionRenderTarget: null
|
|
21769
21458
|
};
|
|
21770
21459
|
|
|
21771
21460
|
return {
|
|
@@ -21780,7 +21469,7 @@
|
|
|
21780
21469
|
|
|
21781
21470
|
}
|
|
21782
21471
|
|
|
21783
|
-
function WebGLRenderStates( extensions
|
|
21472
|
+
function WebGLRenderStates( extensions ) {
|
|
21784
21473
|
|
|
21785
21474
|
let renderStates = new WeakMap();
|
|
21786
21475
|
|
|
@@ -21791,14 +21480,14 @@
|
|
|
21791
21480
|
|
|
21792
21481
|
if ( renderStateArray === undefined ) {
|
|
21793
21482
|
|
|
21794
|
-
renderState = new WebGLRenderState( extensions
|
|
21483
|
+
renderState = new WebGLRenderState( extensions );
|
|
21795
21484
|
renderStates.set( scene, [ renderState ] );
|
|
21796
21485
|
|
|
21797
21486
|
} else {
|
|
21798
21487
|
|
|
21799
21488
|
if ( renderCallDepth >= renderStateArray.length ) {
|
|
21800
21489
|
|
|
21801
|
-
renderState = new WebGLRenderState( extensions
|
|
21490
|
+
renderState = new WebGLRenderState( extensions );
|
|
21802
21491
|
renderStateArray.push( renderState );
|
|
21803
21492
|
|
|
21804
21493
|
} else {
|
|
@@ -22328,9 +22017,7 @@
|
|
|
22328
22017
|
|
|
22329
22018
|
}
|
|
22330
22019
|
|
|
22331
|
-
function WebGLState( gl
|
|
22332
|
-
|
|
22333
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
22020
|
+
function WebGLState( gl ) {
|
|
22334
22021
|
|
|
22335
22022
|
function ColorBuffer() {
|
|
22336
22023
|
|
|
@@ -22702,7 +22389,7 @@
|
|
|
22702
22389
|
|
|
22703
22390
|
for ( let i = 0; i < count; i ++ ) {
|
|
22704
22391
|
|
|
22705
|
-
if (
|
|
22392
|
+
if ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {
|
|
22706
22393
|
|
|
22707
22394
|
gl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
|
|
22708
22395
|
|
|
@@ -22721,13 +22408,8 @@
|
|
|
22721
22408
|
const emptyTextures = {};
|
|
22722
22409
|
emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
|
|
22723
22410
|
emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
|
|
22724
|
-
|
|
22725
|
-
|
|
22726
|
-
|
|
22727
|
-
emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
|
|
22728
|
-
emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
|
|
22729
|
-
|
|
22730
|
-
}
|
|
22411
|
+
emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
|
|
22412
|
+
emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
|
|
22731
22413
|
|
|
22732
22414
|
// init
|
|
22733
22415
|
|
|
@@ -22776,21 +22458,17 @@
|
|
|
22776
22458
|
|
|
22777
22459
|
currentBoundFramebuffers[ target ] = framebuffer;
|
|
22778
22460
|
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
|
|
22461
|
+
// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
|
|
22782
22462
|
|
|
22783
|
-
|
|
22463
|
+
if ( target === gl.DRAW_FRAMEBUFFER ) {
|
|
22784
22464
|
|
|
22785
|
-
|
|
22465
|
+
currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
|
|
22786
22466
|
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
if ( target === gl.FRAMEBUFFER ) {
|
|
22467
|
+
}
|
|
22790
22468
|
|
|
22791
|
-
|
|
22469
|
+
if ( target === gl.FRAMEBUFFER ) {
|
|
22792
22470
|
|
|
22793
|
-
|
|
22471
|
+
currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
|
|
22794
22472
|
|
|
22795
22473
|
}
|
|
22796
22474
|
|
|
@@ -22849,23 +22527,10 @@
|
|
|
22849
22527
|
|
|
22850
22528
|
if ( needsUpdate ) {
|
|
22851
22529
|
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
gl.drawBuffers( drawBuffers );
|
|
22855
|
-
|
|
22856
|
-
} else if ( extensions.has( 'WEBGL_draw_buffers' ) === true ) {
|
|
22857
|
-
|
|
22858
|
-
extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
|
|
22859
|
-
|
|
22860
|
-
} else {
|
|
22861
|
-
|
|
22862
|
-
throw new Error( 'THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension' );
|
|
22863
|
-
|
|
22864
|
-
}
|
|
22530
|
+
gl.drawBuffers( drawBuffers );
|
|
22865
22531
|
|
|
22866
22532
|
}
|
|
22867
22533
|
|
|
22868
|
-
|
|
22869
22534
|
}
|
|
22870
22535
|
|
|
22871
22536
|
function useProgram( program ) {
|
|
@@ -22890,23 +22555,8 @@
|
|
|
22890
22555
|
[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT
|
|
22891
22556
|
};
|
|
22892
22557
|
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
equationToGL[ MinEquation ] = gl.MIN;
|
|
22896
|
-
equationToGL[ MaxEquation ] = gl.MAX;
|
|
22897
|
-
|
|
22898
|
-
} else {
|
|
22899
|
-
|
|
22900
|
-
const extension = extensions.get( 'EXT_blend_minmax' );
|
|
22901
|
-
|
|
22902
|
-
if ( extension !== null ) {
|
|
22903
|
-
|
|
22904
|
-
equationToGL[ MinEquation ] = extension.MIN_EXT;
|
|
22905
|
-
equationToGL[ MaxEquation ] = extension.MAX_EXT;
|
|
22906
|
-
|
|
22907
|
-
}
|
|
22908
|
-
|
|
22909
|
-
}
|
|
22558
|
+
equationToGL[ MinEquation ] = gl.MIN;
|
|
22559
|
+
equationToGL[ MaxEquation ] = gl.MAX;
|
|
22910
22560
|
|
|
22911
22561
|
const factorToGL = {
|
|
22912
22562
|
[ ZeroFactor ]: gl.ZERO,
|
|
@@ -23530,13 +23180,8 @@
|
|
|
23530
23180
|
gl.activeTexture( gl.TEXTURE0 );
|
|
23531
23181
|
|
|
23532
23182
|
gl.bindFramebuffer( gl.FRAMEBUFFER, null );
|
|
23533
|
-
|
|
23534
|
-
|
|
23535
|
-
|
|
23536
|
-
gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
|
|
23537
|
-
gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
|
|
23538
|
-
|
|
23539
|
-
}
|
|
23183
|
+
gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
|
|
23184
|
+
gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
|
|
23540
23185
|
|
|
23541
23186
|
gl.useProgram( null );
|
|
23542
23187
|
|
|
@@ -23643,7 +23288,6 @@
|
|
|
23643
23288
|
|
|
23644
23289
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
|
|
23645
23290
|
|
|
23646
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
23647
23291
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
23648
23292
|
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
|
|
23649
23293
|
|
|
@@ -23681,7 +23325,7 @@
|
|
|
23681
23325
|
|
|
23682
23326
|
}
|
|
23683
23327
|
|
|
23684
|
-
function resizeImage( image,
|
|
23328
|
+
function resizeImage( image, needsNewCanvas, maxSize ) {
|
|
23685
23329
|
|
|
23686
23330
|
let scale = 1;
|
|
23687
23331
|
|
|
@@ -23697,7 +23341,7 @@
|
|
|
23697
23341
|
|
|
23698
23342
|
// only perform resize if necessary
|
|
23699
23343
|
|
|
23700
|
-
if ( scale < 1
|
|
23344
|
+
if ( scale < 1 ) {
|
|
23701
23345
|
|
|
23702
23346
|
// only perform resize for certain image types
|
|
23703
23347
|
|
|
@@ -23706,10 +23350,8 @@
|
|
|
23706
23350
|
( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
|
|
23707
23351
|
( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
|
|
23708
23352
|
|
|
23709
|
-
const
|
|
23710
|
-
|
|
23711
|
-
const width = floor( scale * dimensions.width );
|
|
23712
|
-
const height = floor( scale * dimensions.height );
|
|
23353
|
+
const width = Math.floor( scale * dimensions.width );
|
|
23354
|
+
const height = Math.floor( scale * dimensions.height );
|
|
23713
23355
|
|
|
23714
23356
|
if ( _canvas === undefined ) _canvas = createCanvas( width, height );
|
|
23715
23357
|
|
|
@@ -23745,27 +23387,9 @@
|
|
|
23745
23387
|
|
|
23746
23388
|
}
|
|
23747
23389
|
|
|
23748
|
-
function
|
|
23749
|
-
|
|
23750
|
-
const dimensions = getDimensions( image );
|
|
23751
|
-
|
|
23752
|
-
return isPowerOfTwo( dimensions.width ) && isPowerOfTwo( dimensions.height );
|
|
23753
|
-
|
|
23754
|
-
}
|
|
23755
|
-
|
|
23756
|
-
function textureNeedsPowerOfTwo( texture ) {
|
|
23757
|
-
|
|
23758
|
-
if ( isWebGL2 ) return false;
|
|
23390
|
+
function textureNeedsGenerateMipmaps( texture ) {
|
|
23759
23391
|
|
|
23760
|
-
return
|
|
23761
|
-
( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );
|
|
23762
|
-
|
|
23763
|
-
}
|
|
23764
|
-
|
|
23765
|
-
function textureNeedsGenerateMipmaps( texture, supportsMips ) {
|
|
23766
|
-
|
|
23767
|
-
return texture.generateMipmaps && supportsMips &&
|
|
23768
|
-
texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
|
|
23392
|
+
return texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
|
|
23769
23393
|
|
|
23770
23394
|
}
|
|
23771
23395
|
|
|
@@ -23777,8 +23401,6 @@
|
|
|
23777
23401
|
|
|
23778
23402
|
function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
|
|
23779
23403
|
|
|
23780
|
-
if ( isWebGL2 === false ) return glFormat;
|
|
23781
|
-
|
|
23782
23404
|
if ( internalFormatName !== null ) {
|
|
23783
23405
|
|
|
23784
23406
|
if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
|
|
@@ -23827,6 +23449,12 @@
|
|
|
23827
23449
|
|
|
23828
23450
|
}
|
|
23829
23451
|
|
|
23452
|
+
if ( glFormat === _gl.RGB ) {
|
|
23453
|
+
|
|
23454
|
+
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
23455
|
+
|
|
23456
|
+
}
|
|
23457
|
+
|
|
23830
23458
|
if ( glFormat === _gl.RGBA ) {
|
|
23831
23459
|
|
|
23832
23460
|
const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
|
|
@@ -23851,9 +23479,9 @@
|
|
|
23851
23479
|
|
|
23852
23480
|
}
|
|
23853
23481
|
|
|
23854
|
-
function getMipLevels( texture, image
|
|
23482
|
+
function getMipLevels( texture, image ) {
|
|
23855
23483
|
|
|
23856
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
23484
|
+
if ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
|
|
23857
23485
|
|
|
23858
23486
|
return Math.log2( Math.max( image.width, image.height ) ) + 1;
|
|
23859
23487
|
|
|
@@ -23877,20 +23505,6 @@
|
|
|
23877
23505
|
|
|
23878
23506
|
}
|
|
23879
23507
|
|
|
23880
|
-
// Fallback filters for non-power-of-2 textures
|
|
23881
|
-
|
|
23882
|
-
function filterFallback( f ) {
|
|
23883
|
-
|
|
23884
|
-
if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {
|
|
23885
|
-
|
|
23886
|
-
return _gl.NEAREST;
|
|
23887
|
-
|
|
23888
|
-
}
|
|
23889
|
-
|
|
23890
|
-
return _gl.LINEAR;
|
|
23891
|
-
|
|
23892
|
-
}
|
|
23893
|
-
|
|
23894
23508
|
//
|
|
23895
23509
|
|
|
23896
23510
|
function onTextureDispose( event ) {
|
|
@@ -24205,7 +23819,7 @@
|
|
|
24205
23819
|
[ NotEqualCompare ]: _gl.NOTEQUAL
|
|
24206
23820
|
};
|
|
24207
23821
|
|
|
24208
|
-
function setTextureParameters( textureType, texture
|
|
23822
|
+
function setTextureParameters( textureType, texture ) {
|
|
24209
23823
|
|
|
24210
23824
|
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
|
|
24211
23825
|
( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
|
|
@@ -24215,48 +23829,18 @@
|
|
|
24215
23829
|
|
|
24216
23830
|
}
|
|
24217
23831
|
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
|
|
24221
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
|
|
24222
|
-
|
|
24223
|
-
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
24224
|
-
|
|
24225
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
|
|
24226
|
-
|
|
24227
|
-
}
|
|
24228
|
-
|
|
24229
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
|
|
24230
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
|
|
24231
|
-
|
|
24232
|
-
} else {
|
|
24233
|
-
|
|
24234
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
|
|
24235
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
|
|
24236
|
-
|
|
24237
|
-
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
24238
|
-
|
|
24239
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
|
|
24240
|
-
|
|
24241
|
-
}
|
|
24242
|
-
|
|
24243
|
-
if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {
|
|
24244
|
-
|
|
24245
|
-
console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
|
|
24246
|
-
|
|
24247
|
-
}
|
|
23832
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
|
|
23833
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
|
|
24248
23834
|
|
|
24249
|
-
|
|
24250
|
-
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );
|
|
23835
|
+
if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
|
|
24251
23836
|
|
|
24252
|
-
|
|
24253
|
-
|
|
24254
|
-
console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );
|
|
24255
|
-
|
|
24256
|
-
}
|
|
23837
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
|
|
24257
23838
|
|
|
24258
23839
|
}
|
|
24259
23840
|
|
|
23841
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
|
|
23842
|
+
_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
|
|
23843
|
+
|
|
24260
23844
|
if ( texture.compareFunction ) {
|
|
24261
23845
|
|
|
24262
23846
|
_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );
|
|
@@ -24268,8 +23852,7 @@
|
|
|
24268
23852
|
|
|
24269
23853
|
if ( texture.magFilter === NearestFilter ) return;
|
|
24270
23854
|
if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
|
|
24271
|
-
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension
|
|
24272
|
-
if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only
|
|
23855
|
+
if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension
|
|
24273
23856
|
|
|
24274
23857
|
if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
|
|
24275
23858
|
|
|
@@ -24390,97 +23973,41 @@
|
|
|
24390
23973
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
24391
23974
|
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
24392
23975
|
|
|
24393
|
-
|
|
24394
|
-
let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
|
|
23976
|
+
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
|
|
24395
23977
|
image = verifyColorSpace( texture, image );
|
|
24396
23978
|
|
|
24397
|
-
const
|
|
24398
|
-
glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
23979
|
+
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24399
23980
|
|
|
24400
|
-
|
|
24401
|
-
|
|
23981
|
+
const glType = utils.convert( texture.type );
|
|
23982
|
+
let glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
|
|
24402
23983
|
|
|
24403
|
-
setTextureParameters( textureType, texture
|
|
23984
|
+
setTextureParameters( textureType, texture );
|
|
24404
23985
|
|
|
24405
23986
|
let mipmap;
|
|
24406
23987
|
const mipmaps = texture.mipmaps;
|
|
24407
23988
|
|
|
24408
|
-
const useTexStorage = (
|
|
23989
|
+
const useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
|
|
24409
23990
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
24410
23991
|
const dataReady = source.dataReady;
|
|
24411
|
-
const levels = getMipLevels( texture, image
|
|
23992
|
+
const levels = getMipLevels( texture, image );
|
|
24412
23993
|
|
|
24413
23994
|
if ( texture.isDepthTexture ) {
|
|
24414
23995
|
|
|
24415
23996
|
// populate depth texture with dummy data
|
|
24416
23997
|
|
|
24417
|
-
glInternalFormat = _gl.
|
|
24418
|
-
|
|
24419
|
-
if ( isWebGL2 ) {
|
|
24420
|
-
|
|
24421
|
-
if ( texture.type === FloatType ) {
|
|
24422
|
-
|
|
24423
|
-
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
24424
|
-
|
|
24425
|
-
} else if ( texture.type === UnsignedIntType ) {
|
|
24426
|
-
|
|
24427
|
-
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24428
|
-
|
|
24429
|
-
} else if ( texture.type === UnsignedInt248Type ) {
|
|
24430
|
-
|
|
24431
|
-
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
24432
|
-
|
|
24433
|
-
} else {
|
|
24434
|
-
|
|
24435
|
-
glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
|
|
24436
|
-
|
|
24437
|
-
}
|
|
24438
|
-
|
|
24439
|
-
} else {
|
|
24440
|
-
|
|
24441
|
-
if ( texture.type === FloatType ) {
|
|
24442
|
-
|
|
24443
|
-
console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
|
|
24444
|
-
|
|
24445
|
-
}
|
|
24446
|
-
|
|
24447
|
-
}
|
|
23998
|
+
glInternalFormat = _gl.DEPTH_COMPONENT16;
|
|
24448
23999
|
|
|
24449
|
-
|
|
24000
|
+
if ( texture.type === FloatType ) {
|
|
24450
24001
|
|
|
24451
|
-
|
|
24002
|
+
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
24452
24003
|
|
|
24453
|
-
|
|
24454
|
-
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
24455
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
24456
|
-
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
|
|
24004
|
+
} else if ( texture.type === UnsignedIntType ) {
|
|
24457
24005
|
|
|
24458
|
-
|
|
24006
|
+
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24459
24007
|
|
|
24460
|
-
|
|
24461
|
-
glType = utils.convert( texture.type );
|
|
24008
|
+
} else if ( texture.type === UnsignedInt248Type ) {
|
|
24462
24009
|
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
}
|
|
24466
|
-
|
|
24467
|
-
if ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
|
|
24468
|
-
|
|
24469
|
-
// Depth stencil textures need the DEPTH_STENCIL internal format
|
|
24470
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
24471
|
-
glInternalFormat = _gl.DEPTH_STENCIL;
|
|
24472
|
-
|
|
24473
|
-
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
24474
|
-
// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
|
|
24475
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
24476
|
-
if ( texture.type !== UnsignedInt248Type ) {
|
|
24477
|
-
|
|
24478
|
-
console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
|
|
24479
|
-
|
|
24480
|
-
texture.type = UnsignedInt248Type;
|
|
24481
|
-
glType = utils.convert( texture.type );
|
|
24482
|
-
|
|
24483
|
-
}
|
|
24010
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
24484
24011
|
|
|
24485
24012
|
}
|
|
24486
24013
|
|
|
@@ -24506,7 +24033,7 @@
|
|
|
24506
24033
|
// if there are no manual mipmaps
|
|
24507
24034
|
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
24508
24035
|
|
|
24509
|
-
if ( mipmaps.length > 0
|
|
24036
|
+
if ( mipmaps.length > 0 ) {
|
|
24510
24037
|
|
|
24511
24038
|
if ( useTexStorage && allocateMemory ) {
|
|
24512
24039
|
|
|
@@ -24753,7 +24280,7 @@
|
|
|
24753
24280
|
// if there are no manual mipmaps
|
|
24754
24281
|
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
24755
24282
|
|
|
24756
|
-
if ( mipmaps.length > 0
|
|
24283
|
+
if ( mipmaps.length > 0 ) {
|
|
24757
24284
|
|
|
24758
24285
|
if ( useTexStorage && allocateMemory ) {
|
|
24759
24286
|
|
|
@@ -24813,7 +24340,7 @@
|
|
|
24813
24340
|
|
|
24814
24341
|
}
|
|
24815
24342
|
|
|
24816
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
24343
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
24817
24344
|
|
|
24818
24345
|
generateMipmap( textureType );
|
|
24819
24346
|
|
|
@@ -24862,7 +24389,7 @@
|
|
|
24862
24389
|
|
|
24863
24390
|
if ( ! isCompressed && ! isDataTexture ) {
|
|
24864
24391
|
|
|
24865
|
-
cubeImage[ i ] = resizeImage( texture.image[ i ],
|
|
24392
|
+
cubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );
|
|
24866
24393
|
|
|
24867
24394
|
} else {
|
|
24868
24395
|
|
|
@@ -24875,17 +24402,16 @@
|
|
|
24875
24402
|
}
|
|
24876
24403
|
|
|
24877
24404
|
const image = cubeImage[ 0 ],
|
|
24878
|
-
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
24879
24405
|
glFormat = utils.convert( texture.format, texture.colorSpace ),
|
|
24880
24406
|
glType = utils.convert( texture.type ),
|
|
24881
24407
|
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
24882
24408
|
|
|
24883
|
-
const useTexStorage = (
|
|
24409
|
+
const useTexStorage = ( texture.isVideoTexture !== true );
|
|
24884
24410
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
24885
24411
|
const dataReady = source.dataReady;
|
|
24886
|
-
let levels = getMipLevels( texture, image
|
|
24412
|
+
let levels = getMipLevels( texture, image );
|
|
24887
24413
|
|
|
24888
|
-
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture
|
|
24414
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
|
|
24889
24415
|
|
|
24890
24416
|
let mipmaps;
|
|
24891
24417
|
|
|
@@ -25050,7 +24576,7 @@
|
|
|
25050
24576
|
|
|
25051
24577
|
}
|
|
25052
24578
|
|
|
25053
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
24579
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
25054
24580
|
|
|
25055
24581
|
// We assume images for cube map have the same size.
|
|
25056
24582
|
generateMipmap( _gl.TEXTURE_CUBE_MAP );
|
|
@@ -25118,7 +24644,7 @@
|
|
|
25118
24644
|
|
|
25119
24645
|
if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
25120
24646
|
|
|
25121
|
-
let glInternalFormat =
|
|
24647
|
+
let glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
25122
24648
|
|
|
25123
24649
|
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
25124
24650
|
|
|
@@ -25349,7 +24875,6 @@
|
|
|
25349
24875
|
|
|
25350
24876
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
25351
24877
|
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
25352
|
-
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
25353
24878
|
|
|
25354
24879
|
if ( ! isMultipleRenderTargets ) {
|
|
25355
24880
|
|
|
@@ -25372,7 +24897,7 @@
|
|
|
25372
24897
|
|
|
25373
24898
|
for ( let i = 0; i < 6; i ++ ) {
|
|
25374
24899
|
|
|
25375
|
-
if (
|
|
24900
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
25376
24901
|
|
|
25377
24902
|
renderTargetProperties.__webglFramebuffer[ i ] = [];
|
|
25378
24903
|
|
|
@@ -25392,7 +24917,7 @@
|
|
|
25392
24917
|
|
|
25393
24918
|
} else {
|
|
25394
24919
|
|
|
25395
|
-
if (
|
|
24920
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
25396
24921
|
|
|
25397
24922
|
renderTargetProperties.__webglFramebuffer = [];
|
|
25398
24923
|
|
|
@@ -25410,31 +24935,23 @@
|
|
|
25410
24935
|
|
|
25411
24936
|
if ( isMultipleRenderTargets ) {
|
|
25412
24937
|
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
25416
|
-
|
|
25417
|
-
const attachmentProperties = properties.get( textures[ i ] );
|
|
24938
|
+
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
25418
24939
|
|
|
25419
|
-
|
|
24940
|
+
const attachmentProperties = properties.get( textures[ i ] );
|
|
25420
24941
|
|
|
25421
|
-
|
|
24942
|
+
if ( attachmentProperties.__webglTexture === undefined ) {
|
|
25422
24943
|
|
|
25423
|
-
|
|
24944
|
+
attachmentProperties.__webglTexture = _gl.createTexture();
|
|
25424
24945
|
|
|
25425
|
-
|
|
24946
|
+
info.memory.textures ++;
|
|
25426
24947
|
|
|
25427
24948
|
}
|
|
25428
24949
|
|
|
25429
|
-
} else {
|
|
25430
|
-
|
|
25431
|
-
console.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );
|
|
25432
|
-
|
|
25433
24950
|
}
|
|
25434
24951
|
|
|
25435
24952
|
}
|
|
25436
24953
|
|
|
25437
|
-
if ( (
|
|
24954
|
+
if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
25438
24955
|
|
|
25439
24956
|
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
25440
24957
|
renderTargetProperties.__webglColorRenderbuffer = [];
|
|
@@ -25478,11 +24995,11 @@
|
|
|
25478
24995
|
if ( isCube ) {
|
|
25479
24996
|
|
|
25480
24997
|
state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
|
|
25481
|
-
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture
|
|
24998
|
+
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
|
|
25482
24999
|
|
|
25483
25000
|
for ( let i = 0; i < 6; i ++ ) {
|
|
25484
25001
|
|
|
25485
|
-
if (
|
|
25002
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
25486
25003
|
|
|
25487
25004
|
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
25488
25005
|
|
|
@@ -25498,7 +25015,7 @@
|
|
|
25498
25015
|
|
|
25499
25016
|
}
|
|
25500
25017
|
|
|
25501
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25018
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
25502
25019
|
|
|
25503
25020
|
generateMipmap( _gl.TEXTURE_CUBE_MAP );
|
|
25504
25021
|
|
|
@@ -25514,10 +25031,10 @@
|
|
|
25514
25031
|
const attachmentProperties = properties.get( attachment );
|
|
25515
25032
|
|
|
25516
25033
|
state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
|
|
25517
|
-
setTextureParameters( _gl.TEXTURE_2D, attachment
|
|
25034
|
+
setTextureParameters( _gl.TEXTURE_2D, attachment );
|
|
25518
25035
|
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
|
|
25519
25036
|
|
|
25520
|
-
if ( textureNeedsGenerateMipmaps( attachment
|
|
25037
|
+
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
25521
25038
|
|
|
25522
25039
|
generateMipmap( _gl.TEXTURE_2D );
|
|
25523
25040
|
|
|
@@ -25533,22 +25050,14 @@
|
|
|
25533
25050
|
|
|
25534
25051
|
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
25535
25052
|
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
25539
|
-
|
|
25540
|
-
} else {
|
|
25541
|
-
|
|
25542
|
-
console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
|
|
25543
|
-
|
|
25544
|
-
}
|
|
25053
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
25545
25054
|
|
|
25546
25055
|
}
|
|
25547
25056
|
|
|
25548
25057
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
25549
|
-
setTextureParameters( glTextureType, texture
|
|
25058
|
+
setTextureParameters( glTextureType, texture );
|
|
25550
25059
|
|
|
25551
|
-
if (
|
|
25060
|
+
if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
25552
25061
|
|
|
25553
25062
|
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
25554
25063
|
|
|
@@ -25562,7 +25071,7 @@
|
|
|
25562
25071
|
|
|
25563
25072
|
}
|
|
25564
25073
|
|
|
25565
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25074
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
25566
25075
|
|
|
25567
25076
|
generateMipmap( glTextureType );
|
|
25568
25077
|
|
|
@@ -25584,15 +25093,13 @@
|
|
|
25584
25093
|
|
|
25585
25094
|
function updateRenderTargetMipmap( renderTarget ) {
|
|
25586
25095
|
|
|
25587
|
-
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
25588
|
-
|
|
25589
25096
|
const textures = renderTarget.textures;
|
|
25590
25097
|
|
|
25591
25098
|
for ( let i = 0, il = textures.length; i < il; i ++ ) {
|
|
25592
25099
|
|
|
25593
25100
|
const texture = textures[ i ];
|
|
25594
25101
|
|
|
25595
|
-
if ( textureNeedsGenerateMipmaps( texture
|
|
25102
|
+
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
25596
25103
|
|
|
25597
25104
|
const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
|
|
25598
25105
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
@@ -25609,7 +25116,7 @@
|
|
|
25609
25116
|
|
|
25610
25117
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
25611
25118
|
|
|
25612
|
-
if ( (
|
|
25119
|
+
if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
25613
25120
|
|
|
25614
25121
|
const textures = renderTarget.textures;
|
|
25615
25122
|
const width = renderTarget.width;
|
|
@@ -25653,7 +25160,10 @@
|
|
|
25653
25160
|
if ( ignoreDepthValues === false ) {
|
|
25654
25161
|
|
|
25655
25162
|
if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
|
|
25656
|
-
|
|
25163
|
+
|
|
25164
|
+
// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)
|
|
25165
|
+
|
|
25166
|
+
if ( renderTarget.stencilBuffer && renderTargetProperties.__isTransmissionRenderTarget !== true ) mask |= _gl.STENCIL_BUFFER_BIT;
|
|
25657
25167
|
|
|
25658
25168
|
}
|
|
25659
25169
|
|
|
@@ -25724,7 +25234,7 @@
|
|
|
25724
25234
|
|
|
25725
25235
|
const renderTargetProperties = properties.get( renderTarget );
|
|
25726
25236
|
|
|
25727
|
-
return
|
|
25237
|
+
return renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
|
|
25728
25238
|
|
|
25729
25239
|
}
|
|
25730
25240
|
|
|
@@ -25749,7 +25259,7 @@
|
|
|
25749
25259
|
const format = texture.format;
|
|
25750
25260
|
const type = texture.type;
|
|
25751
25261
|
|
|
25752
|
-
if ( texture.isCompressedTexture === true || texture.isVideoTexture === true
|
|
25262
|
+
if ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;
|
|
25753
25263
|
|
|
25754
25264
|
if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
|
|
25755
25265
|
|
|
@@ -25757,36 +25267,11 @@
|
|
|
25757
25267
|
|
|
25758
25268
|
if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
|
|
25759
25269
|
|
|
25760
|
-
if
|
|
25270
|
+
// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
|
|
25761
25271
|
|
|
25762
|
-
|
|
25763
|
-
|
|
25764
|
-
if ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {
|
|
25765
|
-
|
|
25766
|
-
texture.format = _SRGBAFormat;
|
|
25767
|
-
|
|
25768
|
-
// it's not possible to generate mips in WebGL 1 with this extension
|
|
25769
|
-
|
|
25770
|
-
texture.minFilter = LinearFilter;
|
|
25771
|
-
texture.generateMipmaps = false;
|
|
25772
|
-
|
|
25773
|
-
} else {
|
|
25272
|
+
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
25774
25273
|
|
|
25775
|
-
|
|
25776
|
-
|
|
25777
|
-
image = ImageUtils.sRGBToLinear( image );
|
|
25778
|
-
|
|
25779
|
-
}
|
|
25780
|
-
|
|
25781
|
-
} else {
|
|
25782
|
-
|
|
25783
|
-
// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
|
|
25784
|
-
|
|
25785
|
-
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
25786
|
-
|
|
25787
|
-
console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
25788
|
-
|
|
25789
|
-
}
|
|
25274
|
+
console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
25790
25275
|
|
|
25791
25276
|
}
|
|
25792
25277
|
|
|
@@ -25846,9 +25331,7 @@
|
|
|
25846
25331
|
|
|
25847
25332
|
}
|
|
25848
25333
|
|
|
25849
|
-
function WebGLUtils( gl, extensions
|
|
25850
|
-
|
|
25851
|
-
const isWebGL2 = capabilities.isWebGL2;
|
|
25334
|
+
function WebGLUtils( gl, extensions ) {
|
|
25852
25335
|
|
|
25853
25336
|
function convert( p, colorSpace = NoColorSpace ) {
|
|
25854
25337
|
|
|
@@ -25859,6 +25342,7 @@
|
|
|
25859
25342
|
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
25860
25343
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
25861
25344
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
25345
|
+
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
25862
25346
|
|
|
25863
25347
|
if ( p === ByteType ) return gl.BYTE;
|
|
25864
25348
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -25866,50 +25350,16 @@
|
|
|
25866
25350
|
if ( p === IntType ) return gl.INT;
|
|
25867
25351
|
if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
|
|
25868
25352
|
if ( p === FloatType ) return gl.FLOAT;
|
|
25869
|
-
|
|
25870
|
-
if ( p === HalfFloatType ) {
|
|
25871
|
-
|
|
25872
|
-
if ( isWebGL2 ) return gl.HALF_FLOAT;
|
|
25873
|
-
|
|
25874
|
-
extension = extensions.get( 'OES_texture_half_float' );
|
|
25875
|
-
|
|
25876
|
-
if ( extension !== null ) {
|
|
25877
|
-
|
|
25878
|
-
return extension.HALF_FLOAT_OES;
|
|
25879
|
-
|
|
25880
|
-
} else {
|
|
25881
|
-
|
|
25882
|
-
return null;
|
|
25883
|
-
|
|
25884
|
-
}
|
|
25885
|
-
|
|
25886
|
-
}
|
|
25353
|
+
if ( p === HalfFloatType ) return gl.HALF_FLOAT;
|
|
25887
25354
|
|
|
25888
25355
|
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
25356
|
+
if ( p === RGBFormat ) return gl.RGB;
|
|
25889
25357
|
if ( p === RGBAFormat ) return gl.RGBA;
|
|
25890
25358
|
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
25891
25359
|
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
25892
25360
|
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
25893
25361
|
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
25894
25362
|
|
|
25895
|
-
// WebGL 1 sRGB fallback
|
|
25896
|
-
|
|
25897
|
-
if ( p === _SRGBAFormat ) {
|
|
25898
|
-
|
|
25899
|
-
extension = extensions.get( 'EXT_sRGB' );
|
|
25900
|
-
|
|
25901
|
-
if ( extension !== null ) {
|
|
25902
|
-
|
|
25903
|
-
return extension.SRGB_ALPHA_EXT;
|
|
25904
|
-
|
|
25905
|
-
} else {
|
|
25906
|
-
|
|
25907
|
-
return null;
|
|
25908
|
-
|
|
25909
|
-
}
|
|
25910
|
-
|
|
25911
|
-
}
|
|
25912
|
-
|
|
25913
25363
|
// WebGL2 formats.
|
|
25914
25364
|
|
|
25915
25365
|
if ( p === RedFormat ) return gl.RED;
|
|
@@ -26096,23 +25546,7 @@
|
|
|
26096
25546
|
|
|
26097
25547
|
//
|
|
26098
25548
|
|
|
26099
|
-
if ( p === UnsignedInt248Type )
|
|
26100
|
-
|
|
26101
|
-
if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
|
|
26102
|
-
|
|
26103
|
-
extension = extensions.get( 'WEBGL_depth_texture' );
|
|
26104
|
-
|
|
26105
|
-
if ( extension !== null ) {
|
|
26106
|
-
|
|
26107
|
-
return extension.UNSIGNED_INT_24_8_WEBGL;
|
|
26108
|
-
|
|
26109
|
-
} else {
|
|
26110
|
-
|
|
26111
|
-
return null;
|
|
26112
|
-
|
|
26113
|
-
}
|
|
26114
|
-
|
|
26115
|
-
}
|
|
25549
|
+
if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
|
|
26116
25550
|
|
|
26117
25551
|
// if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
|
|
26118
25552
|
|
|
@@ -26508,11 +25942,11 @@ void main() {
|
|
|
26508
25942
|
|
|
26509
25943
|
if ( coord.x >= 1.0 ) {
|
|
26510
25944
|
|
|
26511
|
-
|
|
25945
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
|
26512
25946
|
|
|
26513
25947
|
} else {
|
|
26514
25948
|
|
|
26515
|
-
|
|
25949
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
|
26516
25950
|
|
|
26517
25951
|
}
|
|
26518
25952
|
|
|
@@ -26560,7 +25994,6 @@ void main() {
|
|
|
26560
25994
|
|
|
26561
25995
|
const viewport = cameraXR.cameras[ 0 ].viewport;
|
|
26562
25996
|
const material = new ShaderMaterial( {
|
|
26563
|
-
extensions: { fragDepth: true },
|
|
26564
25997
|
vertexShader: _occlusion_vertex,
|
|
26565
25998
|
fragmentShader: _occlusion_fragment,
|
|
26566
25999
|
uniforms: {
|
|
@@ -26856,10 +26289,10 @@ void main() {
|
|
|
26856
26289
|
currentPixelRatio = renderer.getPixelRatio();
|
|
26857
26290
|
renderer.getSize( currentSize );
|
|
26858
26291
|
|
|
26859
|
-
if (
|
|
26292
|
+
if ( session.renderState.layers === undefined ) {
|
|
26860
26293
|
|
|
26861
26294
|
const layerInit = {
|
|
26862
|
-
antialias:
|
|
26295
|
+
antialias: attributes.antialias,
|
|
26863
26296
|
alpha: true,
|
|
26864
26297
|
depth: attributes.depth,
|
|
26865
26298
|
stencil: attributes.stencil,
|
|
@@ -27788,11 +27221,10 @@ void main() {
|
|
|
27788
27221
|
|
|
27789
27222
|
}
|
|
27790
27223
|
|
|
27791
|
-
|
|
27792
|
-
|
|
27793
|
-
if ( envMap ) {
|
|
27224
|
+
if ( material.envMap ) {
|
|
27794
27225
|
|
|
27795
27226
|
//uniforms.envMap.value = material.envMap; // part of uniforms common
|
|
27227
|
+
|
|
27796
27228
|
uniforms.envMapIntensity.value = material.envMapIntensity;
|
|
27797
27229
|
|
|
27798
27230
|
}
|
|
@@ -27988,7 +27420,7 @@ void main() {
|
|
|
27988
27420
|
let updateList = {};
|
|
27989
27421
|
let allocatedBindingPoints = [];
|
|
27990
27422
|
|
|
27991
|
-
const maxBindingPoints =
|
|
27423
|
+
const maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program
|
|
27992
27424
|
|
|
27993
27425
|
function bind( uniformsGroup, program ) {
|
|
27994
27426
|
|
|
@@ -28380,7 +27812,7 @@ void main() {
|
|
|
28380
27812
|
canvas = createCanvasElement(),
|
|
28381
27813
|
context = null,
|
|
28382
27814
|
depth = true,
|
|
28383
|
-
stencil =
|
|
27815
|
+
stencil = false,
|
|
28384
27816
|
alpha = false,
|
|
28385
27817
|
antialias = false,
|
|
28386
27818
|
premultipliedAlpha = true,
|
|
@@ -28395,6 +27827,12 @@ void main() {
|
|
|
28395
27827
|
|
|
28396
27828
|
if ( context !== null ) {
|
|
28397
27829
|
|
|
27830
|
+
if ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {
|
|
27831
|
+
|
|
27832
|
+
throw new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );
|
|
27833
|
+
|
|
27834
|
+
}
|
|
27835
|
+
|
|
28398
27836
|
_alpha = context.getContextAttributes().alpha;
|
|
28399
27837
|
|
|
28400
27838
|
} else {
|
|
@@ -28507,10 +27945,6 @@ void main() {
|
|
|
28507
27945
|
let _clippingEnabled = false;
|
|
28508
27946
|
let _localClippingEnabled = false;
|
|
28509
27947
|
|
|
28510
|
-
// transmission
|
|
28511
|
-
|
|
28512
|
-
let _transmissionRenderTarget = null;
|
|
28513
|
-
|
|
28514
27948
|
// camera matrices cache
|
|
28515
27949
|
|
|
28516
27950
|
const _projScreenMatrix = new Matrix4();
|
|
@@ -28530,15 +27964,10 @@ void main() {
|
|
|
28530
27964
|
|
|
28531
27965
|
let _gl = context;
|
|
28532
27966
|
|
|
28533
|
-
function getContext(
|
|
28534
|
-
|
|
28535
|
-
for ( let i = 0; i < contextNames.length; i ++ ) {
|
|
28536
|
-
|
|
28537
|
-
const contextName = contextNames[ i ];
|
|
28538
|
-
const context = canvas.getContext( contextName, contextAttributes );
|
|
28539
|
-
if ( context !== null ) return context;
|
|
27967
|
+
function getContext( contextName, contextAttributes ) {
|
|
28540
27968
|
|
|
28541
|
-
|
|
27969
|
+
const context = canvas.getContext( contextName, contextAttributes );
|
|
27970
|
+
if ( context !== null ) return context;
|
|
28542
27971
|
|
|
28543
27972
|
return null;
|
|
28544
27973
|
|
|
@@ -28567,19 +27996,13 @@ void main() {
|
|
|
28567
27996
|
|
|
28568
27997
|
if ( _gl === null ) {
|
|
28569
27998
|
|
|
28570
|
-
const
|
|
28571
|
-
|
|
28572
|
-
if ( _this.isWebGL1Renderer === true ) {
|
|
28573
|
-
|
|
28574
|
-
contextNames.shift();
|
|
27999
|
+
const contextName = 'webgl2';
|
|
28575
28000
|
|
|
28576
|
-
|
|
28577
|
-
|
|
28578
|
-
_gl = getContext( contextNames, contextAttributes );
|
|
28001
|
+
_gl = getContext( contextName, contextAttributes );
|
|
28579
28002
|
|
|
28580
28003
|
if ( _gl === null ) {
|
|
28581
28004
|
|
|
28582
|
-
if ( getContext(
|
|
28005
|
+
if ( getContext( contextName ) ) {
|
|
28583
28006
|
|
|
28584
28007
|
throw new Error( 'Error creating WebGL context with your selected attributes.' );
|
|
28585
28008
|
|
|
@@ -28593,24 +28016,6 @@ void main() {
|
|
|
28593
28016
|
|
|
28594
28017
|
}
|
|
28595
28018
|
|
|
28596
|
-
if ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153
|
|
28597
|
-
|
|
28598
|
-
console.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
|
|
28599
|
-
|
|
28600
|
-
}
|
|
28601
|
-
|
|
28602
|
-
// Some experimental-webgl implementations do not have getShaderPrecisionFormat
|
|
28603
|
-
|
|
28604
|
-
if ( _gl.getShaderPrecisionFormat === undefined ) {
|
|
28605
|
-
|
|
28606
|
-
_gl.getShaderPrecisionFormat = function () {
|
|
28607
|
-
|
|
28608
|
-
return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };
|
|
28609
|
-
|
|
28610
|
-
};
|
|
28611
|
-
|
|
28612
|
-
}
|
|
28613
|
-
|
|
28614
28019
|
} catch ( error ) {
|
|
28615
28020
|
|
|
28616
28021
|
console.error( 'THREE.WebGLRenderer: ' + error.message );
|
|
@@ -28629,22 +28034,21 @@ void main() {
|
|
|
28629
28034
|
function initGLContext() {
|
|
28630
28035
|
|
|
28631
28036
|
extensions = new WebGLExtensions( _gl );
|
|
28037
|
+
extensions.init();
|
|
28632
28038
|
|
|
28633
28039
|
capabilities = new WebGLCapabilities( _gl, extensions, parameters );
|
|
28634
28040
|
|
|
28635
|
-
|
|
28041
|
+
utils = new WebGLUtils( _gl, extensions );
|
|
28636
28042
|
|
|
28637
|
-
|
|
28638
|
-
|
|
28639
|
-
state = new WebGLState( _gl, extensions, capabilities );
|
|
28043
|
+
state = new WebGLState( _gl );
|
|
28640
28044
|
|
|
28641
28045
|
info = new WebGLInfo( _gl );
|
|
28642
28046
|
properties = new WebGLProperties();
|
|
28643
28047
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
28644
28048
|
cubemaps = new WebGLCubeMaps( _this );
|
|
28645
28049
|
cubeuvmaps = new WebGLCubeUVMaps( _this );
|
|
28646
|
-
attributes = new WebGLAttributes( _gl
|
|
28647
|
-
bindingStates = new WebGLBindingStates( _gl,
|
|
28050
|
+
attributes = new WebGLAttributes( _gl );
|
|
28051
|
+
bindingStates = new WebGLBindingStates( _gl, attributes );
|
|
28648
28052
|
geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
|
|
28649
28053
|
objects = new WebGLObjects( _gl, geometries, attributes, info );
|
|
28650
28054
|
morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
|
|
@@ -28652,13 +28056,13 @@ void main() {
|
|
|
28652
28056
|
programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
|
|
28653
28057
|
materials = new WebGLMaterials( _this, properties );
|
|
28654
28058
|
renderLists = new WebGLRenderLists();
|
|
28655
|
-
renderStates = new WebGLRenderStates( extensions
|
|
28059
|
+
renderStates = new WebGLRenderStates( extensions );
|
|
28656
28060
|
background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
|
|
28657
28061
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
28658
28062
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
28659
28063
|
|
|
28660
|
-
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info
|
|
28661
|
-
indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info
|
|
28064
|
+
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );
|
|
28065
|
+
indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );
|
|
28662
28066
|
|
|
28663
28067
|
info.programs = programCache.programs;
|
|
28664
28068
|
|
|
@@ -28990,13 +28394,6 @@ void main() {
|
|
|
28990
28394
|
xr.removeEventListener( 'sessionstart', onXRSessionStart );
|
|
28991
28395
|
xr.removeEventListener( 'sessionend', onXRSessionEnd );
|
|
28992
28396
|
|
|
28993
|
-
if ( _transmissionRenderTarget ) {
|
|
28994
|
-
|
|
28995
|
-
_transmissionRenderTarget.dispose();
|
|
28996
|
-
_transmissionRenderTarget = null;
|
|
28997
|
-
|
|
28998
|
-
}
|
|
28999
|
-
|
|
29000
28397
|
animation.stop();
|
|
29001
28398
|
|
|
29002
28399
|
};
|
|
@@ -29748,17 +29145,19 @@ void main() {
|
|
|
29748
29145
|
|
|
29749
29146
|
}
|
|
29750
29147
|
|
|
29751
|
-
|
|
29752
|
-
|
|
29753
|
-
if ( _transmissionRenderTarget === null ) {
|
|
29148
|
+
if ( currentRenderState.state.transmissionRenderTarget === null ) {
|
|
29754
29149
|
|
|
29755
|
-
|
|
29150
|
+
currentRenderState.state.transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
|
|
29756
29151
|
generateMipmaps: true,
|
|
29757
|
-
type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
|
|
29152
|
+
type: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,
|
|
29758
29153
|
minFilter: LinearMipmapLinearFilter,
|
|
29759
|
-
samples:
|
|
29154
|
+
samples: 4,
|
|
29155
|
+
stencilBuffer: stencil
|
|
29760
29156
|
} );
|
|
29761
29157
|
|
|
29158
|
+
const renderTargetProperties = properties.get( currentRenderState.state.transmissionRenderTarget );
|
|
29159
|
+
renderTargetProperties.__isTransmissionRenderTarget = true;
|
|
29160
|
+
|
|
29762
29161
|
// debug
|
|
29763
29162
|
|
|
29764
29163
|
/*
|
|
@@ -29771,22 +29170,15 @@ void main() {
|
|
|
29771
29170
|
|
|
29772
29171
|
}
|
|
29773
29172
|
|
|
29774
|
-
|
|
29775
|
-
|
|
29776
|
-
if ( isWebGL2 ) {
|
|
29777
|
-
|
|
29778
|
-
_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
|
|
29779
|
-
|
|
29780
|
-
} else {
|
|
29173
|
+
const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget;
|
|
29781
29174
|
|
|
29782
|
-
|
|
29783
|
-
|
|
29784
|
-
}
|
|
29175
|
+
_this.getDrawingBufferSize( _vector2 );
|
|
29176
|
+
transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
|
|
29785
29177
|
|
|
29786
29178
|
//
|
|
29787
29179
|
|
|
29788
29180
|
const currentRenderTarget = _this.getRenderTarget();
|
|
29789
|
-
_this.setRenderTarget(
|
|
29181
|
+
_this.setRenderTarget( transmissionRenderTarget );
|
|
29790
29182
|
|
|
29791
29183
|
_this.getClearColor( _currentClearColor );
|
|
29792
29184
|
_currentClearAlpha = _this.getClearAlpha();
|
|
@@ -29801,8 +29193,8 @@ void main() {
|
|
|
29801
29193
|
|
|
29802
29194
|
renderObjects( opaqueObjects, scene, camera );
|
|
29803
29195
|
|
|
29804
|
-
textures.updateMultisampleRenderTarget(
|
|
29805
|
-
textures.updateRenderTargetMipmap(
|
|
29196
|
+
textures.updateMultisampleRenderTarget( transmissionRenderTarget );
|
|
29197
|
+
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
29806
29198
|
|
|
29807
29199
|
let renderTargetNeedsUpdate = false;
|
|
29808
29200
|
|
|
@@ -29835,8 +29227,8 @@ void main() {
|
|
|
29835
29227
|
|
|
29836
29228
|
if ( renderTargetNeedsUpdate === true ) {
|
|
29837
29229
|
|
|
29838
|
-
textures.updateMultisampleRenderTarget(
|
|
29839
|
-
textures.updateRenderTargetMipmap(
|
|
29230
|
+
textures.updateMultisampleRenderTarget( transmissionRenderTarget );
|
|
29231
|
+
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
29840
29232
|
|
|
29841
29233
|
}
|
|
29842
29234
|
|
|
@@ -30193,7 +29585,7 @@ void main() {
|
|
|
30193
29585
|
|
|
30194
29586
|
needsProgramChange = true;
|
|
30195
29587
|
|
|
30196
|
-
} else if (
|
|
29588
|
+
} else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {
|
|
30197
29589
|
|
|
30198
29590
|
needsProgramChange = true;
|
|
30199
29591
|
|
|
@@ -30302,17 +29694,9 @@ void main() {
|
|
|
30302
29694
|
|
|
30303
29695
|
if ( skeleton ) {
|
|
30304
29696
|
|
|
30305
|
-
if (
|
|
29697
|
+
if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
|
|
30306
29698
|
|
|
30307
|
-
|
|
30308
|
-
|
|
30309
|
-
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
|
|
30310
|
-
|
|
30311
|
-
} else {
|
|
30312
|
-
|
|
30313
|
-
console.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );
|
|
30314
|
-
|
|
30315
|
-
}
|
|
29699
|
+
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
|
|
30316
29700
|
|
|
30317
29701
|
}
|
|
30318
29702
|
|
|
@@ -30327,7 +29711,7 @@ void main() {
|
|
|
30327
29711
|
|
|
30328
29712
|
const morphAttributes = geometry.morphAttributes;
|
|
30329
29713
|
|
|
30330
|
-
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined
|
|
29714
|
+
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {
|
|
30331
29715
|
|
|
30332
29716
|
morphtargets.update( object, geometry, program );
|
|
30333
29717
|
|
|
@@ -30350,6 +29734,12 @@ void main() {
|
|
|
30350
29734
|
|
|
30351
29735
|
}
|
|
30352
29736
|
|
|
29737
|
+
if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {
|
|
29738
|
+
|
|
29739
|
+
m_uniforms.envMapIntensity.value = scene.environmentIntensity;
|
|
29740
|
+
|
|
29741
|
+
}
|
|
29742
|
+
|
|
30353
29743
|
if ( refreshMaterial ) {
|
|
30354
29744
|
|
|
30355
29745
|
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
|
|
@@ -30377,7 +29767,7 @@ void main() {
|
|
|
30377
29767
|
|
|
30378
29768
|
}
|
|
30379
29769
|
|
|
30380
|
-
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height,
|
|
29770
|
+
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget );
|
|
30381
29771
|
|
|
30382
29772
|
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
30383
29773
|
|
|
@@ -30410,18 +29800,10 @@ void main() {
|
|
|
30410
29800
|
|
|
30411
29801
|
for ( let i = 0, l = groups.length; i < l; i ++ ) {
|
|
30412
29802
|
|
|
30413
|
-
|
|
30414
|
-
|
|
30415
|
-
const group = groups[ i ];
|
|
30416
|
-
|
|
30417
|
-
uniformsGroups.update( group, program );
|
|
30418
|
-
uniformsGroups.bind( group, program );
|
|
30419
|
-
|
|
30420
|
-
} else {
|
|
30421
|
-
|
|
30422
|
-
console.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
|
|
29803
|
+
const group = groups[ i ];
|
|
30423
29804
|
|
|
30424
|
-
|
|
29805
|
+
uniformsGroups.update( group, program );
|
|
29806
|
+
uniformsGroups.bind( group, program );
|
|
30425
29807
|
|
|
30426
29808
|
}
|
|
30427
29809
|
|
|
@@ -30564,7 +29946,7 @@ void main() {
|
|
|
30564
29946
|
|
|
30565
29947
|
isCube = true;
|
|
30566
29948
|
|
|
30567
|
-
} else if ( (
|
|
29949
|
+
} else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
|
|
30568
29950
|
|
|
30569
29951
|
framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
|
|
30570
29952
|
|
|
@@ -30596,7 +29978,7 @@ void main() {
|
|
|
30596
29978
|
|
|
30597
29979
|
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
30598
29980
|
|
|
30599
|
-
if ( framebufferBound &&
|
|
29981
|
+
if ( framebufferBound && useDefaultFramebuffer ) {
|
|
30600
29982
|
|
|
30601
29983
|
state.drawBuffers( renderTarget, framebuffer );
|
|
30602
29984
|
|
|
@@ -30657,11 +30039,10 @@ void main() {
|
|
|
30657
30039
|
|
|
30658
30040
|
}
|
|
30659
30041
|
|
|
30660
|
-
const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) ||
|
|
30042
|
+
const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );
|
|
30661
30043
|
|
|
30662
30044
|
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
30663
|
-
|
|
30664
|
-
! halfFloatSupportedByExt ) {
|
|
30045
|
+
textureType !== FloatType && ! halfFloatSupportedByExt ) {
|
|
30665
30046
|
|
|
30666
30047
|
console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
30667
30048
|
return;
|
|
@@ -30745,13 +30126,6 @@ void main() {
|
|
|
30745
30126
|
|
|
30746
30127
|
this.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {
|
|
30747
30128
|
|
|
30748
|
-
if ( _this.isWebGL1Renderer ) {
|
|
30749
|
-
|
|
30750
|
-
console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );
|
|
30751
|
-
return;
|
|
30752
|
-
|
|
30753
|
-
}
|
|
30754
|
-
|
|
30755
30129
|
const width = Math.round( sourceBox.max.x - sourceBox.min.x );
|
|
30756
30130
|
const height = Math.round( sourceBox.max.y - sourceBox.min.y );
|
|
30757
30131
|
const depth = sourceBox.max.z - sourceBox.min.z + 1;
|
|
@@ -30906,10 +30280,6 @@ void main() {
|
|
|
30906
30280
|
|
|
30907
30281
|
}
|
|
30908
30282
|
|
|
30909
|
-
class WebGL1Renderer extends WebGLRenderer {}
|
|
30910
|
-
|
|
30911
|
-
WebGL1Renderer.prototype.isWebGL1Renderer = true;
|
|
30912
|
-
|
|
30913
30283
|
class Scene extends Object3D {
|
|
30914
30284
|
|
|
30915
30285
|
constructor() {
|
|
@@ -30927,6 +30297,8 @@ void main() {
|
|
|
30927
30297
|
this.backgroundBlurriness = 0;
|
|
30928
30298
|
this.backgroundIntensity = 1;
|
|
30929
30299
|
this.backgroundRotation = new Euler();
|
|
30300
|
+
|
|
30301
|
+
this.environmentIntensity = 1;
|
|
30930
30302
|
this.environmentRotation = new Euler();
|
|
30931
30303
|
|
|
30932
30304
|
this.overrideMaterial = null;
|
|
@@ -30950,6 +30322,8 @@ void main() {
|
|
|
30950
30322
|
this.backgroundBlurriness = source.backgroundBlurriness;
|
|
30951
30323
|
this.backgroundIntensity = source.backgroundIntensity;
|
|
30952
30324
|
this.backgroundRotation.copy( source.backgroundRotation );
|
|
30325
|
+
|
|
30326
|
+
this.environmentIntensity = source.environmentIntensity;
|
|
30953
30327
|
this.environmentRotation.copy( source.environmentRotation );
|
|
30954
30328
|
|
|
30955
30329
|
if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
|
|
@@ -30965,10 +30339,12 @@ void main() {
|
|
|
30965
30339
|
const data = super.toJSON( meta );
|
|
30966
30340
|
|
|
30967
30341
|
if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
|
|
30342
|
+
|
|
30968
30343
|
if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
|
|
30969
30344
|
if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
|
|
30970
|
-
|
|
30971
30345
|
data.object.backgroundRotation = this.backgroundRotation.toArray();
|
|
30346
|
+
|
|
30347
|
+
if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
|
|
30972
30348
|
data.object.environmentRotation = this.environmentRotation.toArray();
|
|
30973
30349
|
|
|
30974
30350
|
return data;
|
|
@@ -37487,11 +36863,9 @@ void main() {
|
|
|
37487
36863
|
/**
|
|
37488
36864
|
* Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
|
|
37489
36865
|
*
|
|
37490
|
-
*
|
|
37491
|
-
*
|
|
36866
|
+
* phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.
|
|
36867
|
+
* theta (the azimuthal angle) is measured from the positive z-axis.
|
|
37492
36868
|
*/
|
|
37493
|
-
|
|
37494
|
-
|
|
37495
36869
|
class Spherical {
|
|
37496
36870
|
|
|
37497
36871
|
constructor( radius = 1, phi = 0, theta = 0 ) {
|
|
@@ -38684,10 +38058,7 @@ void main() {
|
|
|
38684
38058
|
f = !0,
|
|
38685
38059
|
o = !1;
|
|
38686
38060
|
try {
|
|
38687
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
38688
|
-
if (Object(t) !== t) return;
|
|
38689
|
-
f = !1;
|
|
38690
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
38061
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
38691
38062
|
} catch (r) {
|
|
38692
38063
|
o = !0, n = r;
|
|
38693
38064
|
} finally {
|
|
@@ -38705,18 +38076,7 @@ void main() {
|
|
|
38705
38076
|
throw new TypeError("Cannot call a class as a function");
|
|
38706
38077
|
}
|
|
38707
38078
|
}
|
|
38708
|
-
function _defineProperties$3(target, props) {
|
|
38709
|
-
for (var i = 0; i < props.length; i++) {
|
|
38710
|
-
var descriptor = props[i];
|
|
38711
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
38712
|
-
descriptor.configurable = true;
|
|
38713
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
38714
|
-
Object.defineProperty(target, _toPropertyKey$6(descriptor.key), descriptor);
|
|
38715
|
-
}
|
|
38716
|
-
}
|
|
38717
38079
|
function _createClass$3(Constructor, protoProps, staticProps) {
|
|
38718
|
-
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
38719
|
-
if (staticProps) _defineProperties$3(Constructor, staticProps);
|
|
38720
38080
|
Object.defineProperty(Constructor, "prototype", {
|
|
38721
38081
|
writable: false
|
|
38722
38082
|
});
|
|
@@ -38737,27 +38097,13 @@ void main() {
|
|
|
38737
38097
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
|
|
38738
38098
|
}
|
|
38739
38099
|
function _arrayLikeToArray$6(arr, len) {
|
|
38740
|
-
if (len
|
|
38100
|
+
if (len > arr.length) len = arr.length;
|
|
38741
38101
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
38742
38102
|
return arr2;
|
|
38743
38103
|
}
|
|
38744
38104
|
function _nonIterableRest$6() {
|
|
38745
38105
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
38746
38106
|
}
|
|
38747
|
-
function _toPrimitive$6(input, hint) {
|
|
38748
|
-
if (typeof input !== "object" || input === null) return input;
|
|
38749
|
-
var prim = input[Symbol.toPrimitive];
|
|
38750
|
-
if (prim !== undefined) {
|
|
38751
|
-
var res = prim.call(input, hint || "default");
|
|
38752
|
-
if (typeof res !== "object") return res;
|
|
38753
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
38754
|
-
}
|
|
38755
|
-
return (hint === "string" ? String : Number)(input);
|
|
38756
|
-
}
|
|
38757
|
-
function _toPropertyKey$6(arg) {
|
|
38758
|
-
var key = _toPrimitive$6(arg, "string");
|
|
38759
|
-
return typeof key === "symbol" ? key : String(key);
|
|
38760
|
-
}
|
|
38761
38107
|
|
|
38762
38108
|
var Prop = /*#__PURE__*/_createClass$3(function Prop(name, _ref) {
|
|
38763
38109
|
var _ref$default = _ref["default"],
|
|
@@ -40631,21 +39977,13 @@ void main() {
|
|
|
40631
39977
|
|
|
40632
39978
|
function max$1(values, valueof) {
|
|
40633
39979
|
let max;
|
|
40634
|
-
|
|
39980
|
+
{
|
|
40635
39981
|
for (const value of values) {
|
|
40636
39982
|
if (value != null
|
|
40637
39983
|
&& (max < value || (max === undefined && value >= value))) {
|
|
40638
39984
|
max = value;
|
|
40639
39985
|
}
|
|
40640
39986
|
}
|
|
40641
|
-
} else {
|
|
40642
|
-
let index = -1;
|
|
40643
|
-
for (let value of values) {
|
|
40644
|
-
if ((value = valueof(value, ++index, values)) != null
|
|
40645
|
-
&& (max < value || (max === undefined && value >= value))) {
|
|
40646
|
-
max = value;
|
|
40647
|
-
}
|
|
40648
|
-
}
|
|
40649
39987
|
}
|
|
40650
39988
|
return max;
|
|
40651
39989
|
}
|
|
@@ -40696,19 +40034,12 @@ void main() {
|
|
|
40696
40034
|
|
|
40697
40035
|
function sum$1(values, valueof) {
|
|
40698
40036
|
let sum = 0;
|
|
40699
|
-
|
|
40037
|
+
{
|
|
40700
40038
|
for (let value of values) {
|
|
40701
40039
|
if (value = +value) {
|
|
40702
40040
|
sum += value;
|
|
40703
40041
|
}
|
|
40704
40042
|
}
|
|
40705
|
-
} else {
|
|
40706
|
-
let index = -1;
|
|
40707
|
-
for (let value of values) {
|
|
40708
|
-
if (value = +valueof(value, ++index, values)) {
|
|
40709
|
-
sum += value;
|
|
40710
|
-
}
|
|
40711
|
-
}
|
|
40712
40043
|
}
|
|
40713
40044
|
return sum;
|
|
40714
40045
|
}
|
|
@@ -40923,22 +40254,22 @@ void main() {
|
|
|
40923
40254
|
ranges,
|
|
40924
40255
|
range;
|
|
40925
40256
|
|
|
40926
|
-
var boundsStream$
|
|
40257
|
+
var boundsStream$1 = {
|
|
40927
40258
|
point: boundsPoint$1,
|
|
40928
40259
|
lineStart: boundsLineStart,
|
|
40929
40260
|
lineEnd: boundsLineEnd,
|
|
40930
40261
|
polygonStart: function() {
|
|
40931
|
-
boundsStream$
|
|
40932
|
-
boundsStream$
|
|
40933
|
-
boundsStream$
|
|
40262
|
+
boundsStream$1.point = boundsRingPoint;
|
|
40263
|
+
boundsStream$1.lineStart = boundsRingStart;
|
|
40264
|
+
boundsStream$1.lineEnd = boundsRingEnd;
|
|
40934
40265
|
deltaSum = new Adder();
|
|
40935
40266
|
areaStream.polygonStart();
|
|
40936
40267
|
},
|
|
40937
40268
|
polygonEnd: function() {
|
|
40938
40269
|
areaStream.polygonEnd();
|
|
40939
|
-
boundsStream$
|
|
40940
|
-
boundsStream$
|
|
40941
|
-
boundsStream$
|
|
40270
|
+
boundsStream$1.point = boundsPoint$1;
|
|
40271
|
+
boundsStream$1.lineStart = boundsLineStart;
|
|
40272
|
+
boundsStream$1.lineEnd = boundsLineEnd;
|
|
40942
40273
|
if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);
|
|
40943
40274
|
else if (deltaSum > epsilon$2) phi1 = 90;
|
|
40944
40275
|
else if (deltaSum < -epsilon$2) phi0 = -90;
|
|
@@ -41005,12 +40336,12 @@ void main() {
|
|
|
41005
40336
|
}
|
|
41006
40337
|
|
|
41007
40338
|
function boundsLineStart() {
|
|
41008
|
-
boundsStream$
|
|
40339
|
+
boundsStream$1.point = linePoint;
|
|
41009
40340
|
}
|
|
41010
40341
|
|
|
41011
40342
|
function boundsLineEnd() {
|
|
41012
40343
|
range[0] = lambda0$1, range[1] = lambda1;
|
|
41013
|
-
boundsStream$
|
|
40344
|
+
boundsStream$1.point = boundsPoint$1;
|
|
41014
40345
|
p0 = null;
|
|
41015
40346
|
}
|
|
41016
40347
|
|
|
@@ -41057,7 +40388,7 @@ void main() {
|
|
|
41057
40388
|
|
|
41058
40389
|
phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);
|
|
41059
40390
|
ranges = [];
|
|
41060
|
-
geoStream(feature, boundsStream$
|
|
40391
|
+
geoStream(feature, boundsStream$1);
|
|
41061
40392
|
|
|
41062
40393
|
// First, sort ranges by their minimum longitudes.
|
|
41063
40394
|
if (n = ranges.length) {
|
|
@@ -42473,8 +41804,6 @@ void main() {
|
|
|
42473
41804
|
if (y > y1) y1 = y;
|
|
42474
41805
|
}
|
|
42475
41806
|
|
|
42476
|
-
var boundsStream$1 = boundsStream;
|
|
42477
|
-
|
|
42478
41807
|
function transformer$1(methods) {
|
|
42479
41808
|
return function(stream) {
|
|
42480
41809
|
var s = new TransformStream;
|
|
@@ -42500,8 +41829,8 @@ void main() {
|
|
|
42500
41829
|
var clip = projection.clipExtent && projection.clipExtent();
|
|
42501
41830
|
projection.scale(150).translate([0, 0]);
|
|
42502
41831
|
if (clip != null) projection.clipExtent(null);
|
|
42503
|
-
geoStream(object, projection.stream(boundsStream
|
|
42504
|
-
fitBounds(boundsStream
|
|
41832
|
+
geoStream(object, projection.stream(boundsStream));
|
|
41833
|
+
fitBounds(boundsStream.result());
|
|
42505
41834
|
if (clip != null) projection.clipExtent(clip);
|
|
42506
41835
|
return projection;
|
|
42507
41836
|
}
|
|
@@ -42836,7 +42165,7 @@ void main() {
|
|
|
42836
42165
|
}
|
|
42837
42166
|
|
|
42838
42167
|
function _callSuper$2(t, o, e) {
|
|
42839
|
-
return o = _getPrototypeOf$3(o), _possibleConstructorReturn$2(t, _isNativeReflectConstruct$3() ? Reflect.construct(o,
|
|
42168
|
+
return o = _getPrototypeOf$3(o), _possibleConstructorReturn$2(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, [], _getPrototypeOf$3(t).constructor) : o.apply(t, e));
|
|
42840
42169
|
}
|
|
42841
42170
|
function _isNativeReflectConstruct$3() {
|
|
42842
42171
|
try {
|
|
@@ -42873,37 +42202,12 @@ void main() {
|
|
|
42873
42202
|
return a;
|
|
42874
42203
|
}
|
|
42875
42204
|
}
|
|
42876
|
-
function _toPrimitive$5(t, r) {
|
|
42877
|
-
if ("object" != typeof t || !t) return t;
|
|
42878
|
-
var e = t[Symbol.toPrimitive];
|
|
42879
|
-
if (void 0 !== e) {
|
|
42880
|
-
var i = e.call(t, r || "default");
|
|
42881
|
-
if ("object" != typeof i) return i;
|
|
42882
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
42883
|
-
}
|
|
42884
|
-
return ("string" === r ? String : Number)(t);
|
|
42885
|
-
}
|
|
42886
|
-
function _toPropertyKey$5(t) {
|
|
42887
|
-
var i = _toPrimitive$5(t, "string");
|
|
42888
|
-
return "symbol" == typeof i ? i : String(i);
|
|
42889
|
-
}
|
|
42890
42205
|
function _classCallCheck$2(instance, Constructor) {
|
|
42891
42206
|
if (!(instance instanceof Constructor)) {
|
|
42892
42207
|
throw new TypeError("Cannot call a class as a function");
|
|
42893
42208
|
}
|
|
42894
42209
|
}
|
|
42895
|
-
function _defineProperties$2(target, props) {
|
|
42896
|
-
for (var i = 0; i < props.length; i++) {
|
|
42897
|
-
var descriptor = props[i];
|
|
42898
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
42899
|
-
descriptor.configurable = true;
|
|
42900
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
42901
|
-
Object.defineProperty(target, _toPropertyKey$5(descriptor.key), descriptor);
|
|
42902
|
-
}
|
|
42903
|
-
}
|
|
42904
42210
|
function _createClass$2(Constructor, protoProps, staticProps) {
|
|
42905
|
-
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
42906
|
-
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
42907
42211
|
Object.defineProperty(Constructor, "prototype", {
|
|
42908
42212
|
writable: false
|
|
42909
42213
|
});
|
|
@@ -42977,7 +42281,7 @@ void main() {
|
|
|
42977
42281
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
42978
42282
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
42979
42283
|
if (!it) {
|
|
42980
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike
|
|
42284
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike ) {
|
|
42981
42285
|
if (it) o = it;
|
|
42982
42286
|
var i = 0;
|
|
42983
42287
|
var F = function () {};
|
|
@@ -46228,10 +45532,7 @@ void main() {
|
|
|
46228
45532
|
_n = !0,
|
|
46229
45533
|
_d = !1;
|
|
46230
45534
|
try {
|
|
46231
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i)
|
|
46232
|
-
if (Object(_i) !== _i) return;
|
|
46233
|
-
_n = !1;
|
|
46234
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
45535
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
46235
45536
|
} catch (err) {
|
|
46236
45537
|
_d = !0, _e = err;
|
|
46237
45538
|
} finally {
|
|
@@ -46305,18 +45606,18 @@ void main() {
|
|
|
46305
45606
|
function _nonIterableRest$4() {
|
|
46306
45607
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
46307
45608
|
}
|
|
46308
|
-
function _toPrimitive$
|
|
45609
|
+
function _toPrimitive$3(input, hint) {
|
|
46309
45610
|
if (typeof input !== "object" || input === null) return input;
|
|
46310
45611
|
var prim = input[Symbol.toPrimitive];
|
|
46311
45612
|
if (prim !== undefined) {
|
|
46312
|
-
var res = prim.call(input, hint
|
|
45613
|
+
var res = prim.call(input, hint );
|
|
46313
45614
|
if (typeof res !== "object") return res;
|
|
46314
45615
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
46315
45616
|
}
|
|
46316
|
-
return (
|
|
45617
|
+
return (String )(input);
|
|
46317
45618
|
}
|
|
46318
|
-
function _toPropertyKey$
|
|
46319
|
-
var key = _toPrimitive$
|
|
45619
|
+
function _toPropertyKey$3(arg) {
|
|
45620
|
+
var key = _toPrimitive$3(arg, "string");
|
|
46320
45621
|
return typeof key === "symbol" ? key : String(key);
|
|
46321
45622
|
}
|
|
46322
45623
|
|
|
@@ -46341,7 +45642,7 @@ void main() {
|
|
|
46341
45642
|
if (isProp) {
|
|
46342
45643
|
var _itemVal = itemVal,
|
|
46343
45644
|
propVal = _itemVal[keyAccessor],
|
|
46344
|
-
rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$
|
|
45645
|
+
rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$3));
|
|
46345
45646
|
key = propVal;
|
|
46346
45647
|
itemVal = rest;
|
|
46347
45648
|
} else {
|
|
@@ -46422,10 +45723,7 @@ void main() {
|
|
|
46422
45723
|
_n = !0,
|
|
46423
45724
|
_d = !1;
|
|
46424
45725
|
try {
|
|
46425
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i)
|
|
46426
|
-
if (Object(_i) !== _i) return;
|
|
46427
|
-
_n = !1;
|
|
46428
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
45726
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
46429
45727
|
} catch (err) {
|
|
46430
45728
|
_d = !0, _e = err;
|
|
46431
45729
|
} finally {
|
|
@@ -46460,7 +45758,7 @@ void main() {
|
|
|
46460
45758
|
return target;
|
|
46461
45759
|
}
|
|
46462
45760
|
function _defineProperty$2(obj, key, value) {
|
|
46463
|
-
key = _toPropertyKey$
|
|
45761
|
+
key = _toPropertyKey$2(key);
|
|
46464
45762
|
if (key in obj) {
|
|
46465
45763
|
Object.defineProperty(obj, key, {
|
|
46466
45764
|
value: value,
|
|
@@ -46534,18 +45832,18 @@ void main() {
|
|
|
46534
45832
|
function _nonIterableRest$3() {
|
|
46535
45833
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
46536
45834
|
}
|
|
46537
|
-
function _toPrimitive$
|
|
45835
|
+
function _toPrimitive$2(input, hint) {
|
|
46538
45836
|
if (typeof input !== "object" || input === null) return input;
|
|
46539
45837
|
var prim = input[Symbol.toPrimitive];
|
|
46540
45838
|
if (prim !== undefined) {
|
|
46541
|
-
var res = prim.call(input, hint
|
|
45839
|
+
var res = prim.call(input, hint );
|
|
46542
45840
|
if (typeof res !== "object") return res;
|
|
46543
45841
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
46544
45842
|
}
|
|
46545
|
-
return (
|
|
45843
|
+
return (String )(input);
|
|
46546
45844
|
}
|
|
46547
|
-
function _toPropertyKey$
|
|
46548
|
-
var key = _toPrimitive$
|
|
45845
|
+
function _toPropertyKey$2(arg) {
|
|
45846
|
+
var key = _toPrimitive$2(arg, "string");
|
|
46549
45847
|
return typeof key === "symbol" ? key : String(key);
|
|
46550
45848
|
}
|
|
46551
45849
|
|
|
@@ -48285,7 +47583,7 @@ void main() {
|
|
|
48285
47583
|
* //= true
|
|
48286
47584
|
*/
|
|
48287
47585
|
function booleanPointInPolygon(point, polygon, options) {
|
|
48288
|
-
|
|
47586
|
+
{ options = {}; }
|
|
48289
47587
|
// validation
|
|
48290
47588
|
if (!point) {
|
|
48291
47589
|
throw new Error("point is required");
|
|
@@ -49623,7 +48921,7 @@ void main() {
|
|
|
49623
48921
|
}
|
|
49624
48922
|
|
|
49625
48923
|
function _callSuper$1(t, o, e) {
|
|
49626
|
-
return o = _getPrototypeOf$2(o), _possibleConstructorReturn$1(t, _isNativeReflectConstruct$2() ? Reflect.construct(o,
|
|
48924
|
+
return o = _getPrototypeOf$2(o), _possibleConstructorReturn$1(t, _isNativeReflectConstruct$2() ? Reflect.construct(o, [], _getPrototypeOf$2(t).constructor) : o.apply(t, e));
|
|
49627
48925
|
}
|
|
49628
48926
|
function _isNativeReflectConstruct$2() {
|
|
49629
48927
|
try {
|
|
@@ -49644,10 +48942,7 @@ void main() {
|
|
|
49644
48942
|
f = !0,
|
|
49645
48943
|
o = !1;
|
|
49646
48944
|
try {
|
|
49647
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
49648
|
-
if (Object(t) !== t) return;
|
|
49649
|
-
f = !1;
|
|
49650
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
48945
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
49651
48946
|
} catch (r) {
|
|
49652
48947
|
o = !0, n = r;
|
|
49653
48948
|
} finally {
|
|
@@ -49660,37 +48955,12 @@ void main() {
|
|
|
49660
48955
|
return a;
|
|
49661
48956
|
}
|
|
49662
48957
|
}
|
|
49663
|
-
function _toPrimitive$2(t, r) {
|
|
49664
|
-
if ("object" != typeof t || !t) return t;
|
|
49665
|
-
var e = t[Symbol.toPrimitive];
|
|
49666
|
-
if (void 0 !== e) {
|
|
49667
|
-
var i = e.call(t, r || "default");
|
|
49668
|
-
if ("object" != typeof i) return i;
|
|
49669
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
49670
|
-
}
|
|
49671
|
-
return ("string" === r ? String : Number)(t);
|
|
49672
|
-
}
|
|
49673
|
-
function _toPropertyKey$2(t) {
|
|
49674
|
-
var i = _toPrimitive$2(t, "string");
|
|
49675
|
-
return "symbol" == typeof i ? i : String(i);
|
|
49676
|
-
}
|
|
49677
48958
|
function _classCallCheck$1(instance, Constructor) {
|
|
49678
48959
|
if (!(instance instanceof Constructor)) {
|
|
49679
48960
|
throw new TypeError("Cannot call a class as a function");
|
|
49680
48961
|
}
|
|
49681
48962
|
}
|
|
49682
|
-
function _defineProperties$1(target, props) {
|
|
49683
|
-
for (var i = 0; i < props.length; i++) {
|
|
49684
|
-
var descriptor = props[i];
|
|
49685
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
49686
|
-
descriptor.configurable = true;
|
|
49687
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
49688
|
-
Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
|
|
49689
|
-
}
|
|
49690
|
-
}
|
|
49691
48963
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
49692
|
-
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
49693
|
-
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
49694
48964
|
Object.defineProperty(Constructor, "prototype", {
|
|
49695
48965
|
writable: false
|
|
49696
48966
|
});
|
|
@@ -64914,13 +64184,13 @@ void main() {
|
|
|
64914
64184
|
var vertsPos = cellBoundary + SZ_DBL;
|
|
64915
64185
|
var out = []; // Support [lng, lat] pairs if GeoJSON is specified
|
|
64916
64186
|
|
|
64917
|
-
var readCoord =
|
|
64187
|
+
var readCoord = readLatLngGeoJson ;
|
|
64918
64188
|
|
|
64919
64189
|
for (var i = 0; i < numVerts * 2; i += 2) {
|
|
64920
64190
|
out.push(readCoord(vertsPos + SZ_DBL * i));
|
|
64921
64191
|
}
|
|
64922
64192
|
|
|
64923
|
-
|
|
64193
|
+
{
|
|
64924
64194
|
// Close loop if GeoJSON is specified
|
|
64925
64195
|
out.push(out[0]);
|
|
64926
64196
|
}
|
|
@@ -66468,7 +65738,7 @@ void main() {
|
|
|
66468
65738
|
* font: <THREE.Font>, // font
|
|
66469
65739
|
*
|
|
66470
65740
|
* size: <float>, // size of the text
|
|
66471
|
-
*
|
|
65741
|
+
* depth: <float>, // thickness to extrude text
|
|
66472
65742
|
* curveSegments: <int>, // number of points on the curves
|
|
66473
65743
|
*
|
|
66474
65744
|
* bevelEnabled: <bool>, // turn on bevel
|
|
@@ -66495,7 +65765,15 @@ void main() {
|
|
|
66495
65765
|
|
|
66496
65766
|
// translate parameters to ExtrudeGeometry API
|
|
66497
65767
|
|
|
66498
|
-
parameters.depth
|
|
65768
|
+
if ( parameters.depth === undefined && parameters.height !== undefined ) {
|
|
65769
|
+
|
|
65770
|
+
console.warn( 'THREE.TextGeometry: .height is now depreciated. Please use .depth instead' ); // @deprecated, r163
|
|
65771
|
+
|
|
65772
|
+
}
|
|
65773
|
+
|
|
65774
|
+
parameters.depth = parameters.depth !== undefined ?
|
|
65775
|
+
parameters.depth : parameters.height !== undefined ?
|
|
65776
|
+
parameters.height : 50;
|
|
66499
65777
|
|
|
66500
65778
|
// defaults
|
|
66501
65779
|
|
|
@@ -66663,7 +65941,7 @@ void main() {
|
|
|
66663
65941
|
var o = [null];
|
|
66664
65942
|
o.push.apply(o, e);
|
|
66665
65943
|
var p = new (t.bind.apply(t, o))();
|
|
66666
|
-
return
|
|
65944
|
+
return p;
|
|
66667
65945
|
}
|
|
66668
65946
|
function _isNativeReflectConstruct$1() {
|
|
66669
65947
|
try {
|
|
@@ -66725,11 +66003,11 @@ void main() {
|
|
|
66725
66003
|
if ("object" != typeof t || !t) return t;
|
|
66726
66004
|
var e = t[Symbol.toPrimitive];
|
|
66727
66005
|
if (void 0 !== e) {
|
|
66728
|
-
var i = e.call(t, r
|
|
66006
|
+
var i = e.call(t, r );
|
|
66729
66007
|
if ("object" != typeof i) return i;
|
|
66730
66008
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
66731
66009
|
}
|
|
66732
|
-
return (
|
|
66010
|
+
return (String )(t);
|
|
66733
66011
|
}
|
|
66734
66012
|
function _toPropertyKey$1(t) {
|
|
66735
66013
|
var i = _toPrimitive$1(t, "string");
|
|
@@ -66751,7 +66029,6 @@ void main() {
|
|
|
66751
66029
|
}
|
|
66752
66030
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
66753
66031
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
66754
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
66755
66032
|
Object.defineProperty(Constructor, "prototype", {
|
|
66756
66033
|
writable: false
|
|
66757
66034
|
});
|
|
@@ -67273,7 +66550,7 @@ void main() {
|
|
|
67273
66550
|
function setMaterialOpacity(material, opacity, depthWrite) {
|
|
67274
66551
|
material.opacity = opacity;
|
|
67275
66552
|
material.transparent = opacity < 1;
|
|
67276
|
-
material.depthWrite =
|
|
66553
|
+
material.depthWrite = opacity >= 1 ; // depthWrite=false recommended for transparent materials, to prevent transparency issues https://discourse.threejs.org/t/threejs-and-the-transparent-problem/11553/31
|
|
67277
66554
|
|
|
67278
66555
|
return material;
|
|
67279
66556
|
}
|
|
@@ -74278,7 +73555,7 @@ void main() {
|
|
|
74278
73555
|
*/
|
|
74279
73556
|
function hsla(value, saturation, lightness, alpha) {
|
|
74280
73557
|
if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
|
|
74281
|
-
return
|
|
73558
|
+
return "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
|
|
74282
73559
|
} else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
|
|
74283
73560
|
return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
|
|
74284
73561
|
}
|
|
@@ -74356,7 +73633,7 @@ void main() {
|
|
|
74356
73633
|
var rgbValue = parseToRgb(firstValue);
|
|
74357
73634
|
return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
|
|
74358
73635
|
} else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
|
|
74359
|
-
return
|
|
73636
|
+
return "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
|
|
74360
73637
|
} else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
|
|
74361
73638
|
return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
|
|
74362
73639
|
}
|
|
@@ -74915,21 +74192,15 @@ void main() {
|
|
|
74915
74192
|
curry /* ::<number | string, string, string> */(transparentize);
|
|
74916
74193
|
|
|
74917
74194
|
function styleInject(css, ref) {
|
|
74918
|
-
|
|
74919
|
-
|
|
74920
|
-
if (
|
|
74195
|
+
ref = {};
|
|
74196
|
+
ref.insertAt;
|
|
74197
|
+
if (typeof document === 'undefined') {
|
|
74921
74198
|
return;
|
|
74922
74199
|
}
|
|
74923
74200
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
74924
74201
|
var style = document.createElement('style');
|
|
74925
74202
|
style.type = 'text/css';
|
|
74926
|
-
|
|
74927
|
-
if (head.firstChild) {
|
|
74928
|
-
head.insertBefore(style, head.firstChild);
|
|
74929
|
-
} else {
|
|
74930
|
-
head.appendChild(style);
|
|
74931
|
-
}
|
|
74932
|
-
} else {
|
|
74203
|
+
{
|
|
74933
74204
|
head.appendChild(style);
|
|
74934
74205
|
}
|
|
74935
74206
|
if (style.styleSheet) {
|
|
@@ -74953,10 +74224,7 @@ void main() {
|
|
|
74953
74224
|
f = !0,
|
|
74954
74225
|
o = !1;
|
|
74955
74226
|
try {
|
|
74956
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
74957
|
-
if (Object(t) !== t) return;
|
|
74958
|
-
f = !1;
|
|
74959
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
74227
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
74960
74228
|
} catch (r) {
|
|
74961
74229
|
o = !0, n = r;
|
|
74962
74230
|
} finally {
|
|
@@ -74973,15 +74241,15 @@ void main() {
|
|
|
74973
74241
|
if ("object" != typeof t || !t) return t;
|
|
74974
74242
|
var e = t[Symbol.toPrimitive];
|
|
74975
74243
|
if (void 0 !== e) {
|
|
74976
|
-
var i = e.call(t, r
|
|
74244
|
+
var i = e.call(t, r );
|
|
74977
74245
|
if ("object" != typeof i) return i;
|
|
74978
74246
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
74979
74247
|
}
|
|
74980
|
-
return (
|
|
74248
|
+
return (String )(t);
|
|
74981
74249
|
}
|
|
74982
74250
|
function _toPropertyKey(t) {
|
|
74983
74251
|
var i = _toPrimitive(t, "string");
|
|
74984
|
-
return "symbol" == typeof i ? i :
|
|
74252
|
+
return "symbol" == typeof i ? i : i + "";
|
|
74985
74253
|
}
|
|
74986
74254
|
function _defineProperty(obj, key, value) {
|
|
74987
74255
|
key = _toPropertyKey(key);
|
|
@@ -75138,7 +74406,7 @@ void main() {
|
|
|
75138
74406
|
methods: {
|
|
75139
74407
|
tick: function tick(state) {
|
|
75140
74408
|
if (state.initialised) {
|
|
75141
|
-
state.controls.update && state.controls.update(state.clock.getDelta()); // timedelta is required for fly controls
|
|
74409
|
+
state.controls.update && state.controls.update(Math.min(1, state.clock.getDelta())); // timedelta is required for fly controls
|
|
75142
74410
|
|
|
75143
74411
|
state.postProcessingComposer ? state.postProcessingComposer.render() // if using postprocessing, switch the output to it
|
|
75144
74412
|
: state.renderer.render(state.scene, state.camera);
|