globe.gl 2.28.6 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globe.gl.js +383 -59
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +5 -5
- package/dist/globe.gl.mjs +2 -1
- package/package.json +7 -7
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.
|
|
1
|
+
// Version 2.29.0 globe.gl - https://github.com/vasturiano/globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
* Copyright 2010-2023 Three.js Authors
|
|
143
143
|
* SPDX-License-Identifier: MIT
|
|
144
144
|
*/
|
|
145
|
-
const REVISION = '
|
|
145
|
+
const REVISION = '155';
|
|
146
146
|
|
|
147
147
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
148
148
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -2960,13 +2960,13 @@
|
|
|
2960
2960
|
* Texture parameters for an auto-generated target texture
|
|
2961
2961
|
* depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
|
|
2962
2962
|
*/
|
|
2963
|
-
class
|
|
2963
|
+
class RenderTarget extends EventDispatcher {
|
|
2964
2964
|
|
|
2965
2965
|
constructor( width = 1, height = 1, options = {} ) {
|
|
2966
2966
|
|
|
2967
2967
|
super();
|
|
2968
2968
|
|
|
2969
|
-
this.
|
|
2969
|
+
this.isRenderTarget = true;
|
|
2970
2970
|
|
|
2971
2971
|
this.width = width;
|
|
2972
2972
|
this.height = height;
|
|
@@ -3069,6 +3069,18 @@
|
|
|
3069
3069
|
|
|
3070
3070
|
}
|
|
3071
3071
|
|
|
3072
|
+
class WebGLRenderTarget extends RenderTarget {
|
|
3073
|
+
|
|
3074
|
+
constructor( width = 1, height = 1, options = {} ) {
|
|
3075
|
+
|
|
3076
|
+
super( width, height, options );
|
|
3077
|
+
|
|
3078
|
+
this.isWebGLRenderTarget = true;
|
|
3079
|
+
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3072
3084
|
class DataArrayTexture extends Texture {
|
|
3073
3085
|
|
|
3074
3086
|
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
@@ -7985,7 +7997,7 @@
|
|
|
7985
7997
|
this.frustumCulled = source.frustumCulled;
|
|
7986
7998
|
this.renderOrder = source.renderOrder;
|
|
7987
7999
|
|
|
7988
|
-
this.animations = source.animations;
|
|
8000
|
+
this.animations = source.animations.slice();
|
|
7989
8001
|
|
|
7990
8002
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
7991
8003
|
|
|
@@ -9708,6 +9720,26 @@
|
|
|
9708
9720
|
|
|
9709
9721
|
}
|
|
9710
9722
|
|
|
9723
|
+
getComponent( index, component ) {
|
|
9724
|
+
|
|
9725
|
+
let value = this.array[ index * this.itemSize + component ];
|
|
9726
|
+
|
|
9727
|
+
if ( this.normalized ) value = denormalize( value, this.array );
|
|
9728
|
+
|
|
9729
|
+
return value;
|
|
9730
|
+
|
|
9731
|
+
}
|
|
9732
|
+
|
|
9733
|
+
setComponent( index, component, value ) {
|
|
9734
|
+
|
|
9735
|
+
if ( this.normalized ) value = normalize$1( value, this.array );
|
|
9736
|
+
|
|
9737
|
+
this.array[ index * this.itemSize + component ] = value;
|
|
9738
|
+
|
|
9739
|
+
return this;
|
|
9740
|
+
|
|
9741
|
+
}
|
|
9742
|
+
|
|
9711
9743
|
getX( index ) {
|
|
9712
9744
|
|
|
9713
9745
|
let x = this.array[ index * this.itemSize ];
|
|
@@ -12276,10 +12308,8 @@
|
|
|
12276
12308
|
|
|
12277
12309
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
12278
12310
|
|
|
12279
|
-
const currentToneMapping = renderer.toneMapping;
|
|
12280
12311
|
const currentXrEnabled = renderer.xr.enabled;
|
|
12281
12312
|
|
|
12282
|
-
renderer.toneMapping = NoToneMapping;
|
|
12283
12313
|
renderer.xr.enabled = false;
|
|
12284
12314
|
|
|
12285
12315
|
const generateMipmaps = renderTarget.texture.generateMipmaps;
|
|
@@ -12308,7 +12338,6 @@
|
|
|
12308
12338
|
|
|
12309
12339
|
renderer.setRenderTarget( currentRenderTarget );
|
|
12310
12340
|
|
|
12311
|
-
renderer.toneMapping = currentToneMapping;
|
|
12312
12341
|
renderer.xr.enabled = currentXrEnabled;
|
|
12313
12342
|
|
|
12314
12343
|
renderTarget.texture.needsPMREMUpdate = true;
|
|
@@ -13231,7 +13260,7 @@
|
|
|
13231
13260
|
|
|
13232
13261
|
var bsdfs = "float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated";
|
|
13233
13262
|
|
|
13234
|
-
var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\
|
|
13263
|
+
var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";
|
|
13235
13264
|
|
|
13236
13265
|
var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
|
|
13237
13266
|
|
|
@@ -16859,7 +16888,7 @@
|
|
|
16859
16888
|
|
|
16860
16889
|
}
|
|
16861
16890
|
|
|
16862
|
-
} else {
|
|
16891
|
+
} else if ( geometryPosition !== undefined ) {
|
|
16863
16892
|
|
|
16864
16893
|
const array = geometryPosition.array;
|
|
16865
16894
|
version = geometryPosition.version;
|
|
@@ -16874,6 +16903,10 @@
|
|
|
16874
16903
|
|
|
16875
16904
|
}
|
|
16876
16905
|
|
|
16906
|
+
} else {
|
|
16907
|
+
|
|
16908
|
+
return;
|
|
16909
|
+
|
|
16877
16910
|
}
|
|
16878
16911
|
|
|
16879
16912
|
const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
|
|
@@ -19881,6 +19914,18 @@
|
|
|
19881
19914
|
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
|
|
19882
19915
|
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
|
|
19883
19916
|
|
|
19917
|
+
let toneMapping = NoToneMapping;
|
|
19918
|
+
|
|
19919
|
+
if ( material.toneMapped ) {
|
|
19920
|
+
|
|
19921
|
+
if ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {
|
|
19922
|
+
|
|
19923
|
+
toneMapping = renderer.toneMapping;
|
|
19924
|
+
|
|
19925
|
+
}
|
|
19926
|
+
|
|
19927
|
+
}
|
|
19928
|
+
|
|
19884
19929
|
const parameters = {
|
|
19885
19930
|
|
|
19886
19931
|
isWebGL2: IS_WEBGL2,
|
|
@@ -20041,8 +20086,8 @@
|
|
|
20041
20086
|
shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
|
|
20042
20087
|
shadowMapType: renderer.shadowMap.type,
|
|
20043
20088
|
|
|
20044
|
-
toneMapping:
|
|
20045
|
-
useLegacyLights: renderer.
|
|
20089
|
+
toneMapping: toneMapping,
|
|
20090
|
+
useLegacyLights: renderer._useLegacyLights,
|
|
20046
20091
|
|
|
20047
20092
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
20048
20093
|
|
|
@@ -23214,6 +23259,17 @@
|
|
|
23214
23259
|
|
|
23215
23260
|
}
|
|
23216
23261
|
|
|
23262
|
+
if ( glFormat === _gl.RED_INTEGER ) {
|
|
23263
|
+
|
|
23264
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;
|
|
23265
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;
|
|
23266
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;
|
|
23267
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.R8I;
|
|
23268
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.R16I;
|
|
23269
|
+
if ( glType === _gl.INT ) internalFormat = _gl.R32I;
|
|
23270
|
+
|
|
23271
|
+
}
|
|
23272
|
+
|
|
23217
23273
|
if ( glFormat === _gl.RG ) {
|
|
23218
23274
|
|
|
23219
23275
|
if ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;
|
|
@@ -23390,14 +23446,32 @@
|
|
|
23390
23446
|
|
|
23391
23447
|
for ( let i = 0; i < 6; i ++ ) {
|
|
23392
23448
|
|
|
23393
|
-
|
|
23449
|
+
if ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {
|
|
23450
|
+
|
|
23451
|
+
for ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );
|
|
23452
|
+
|
|
23453
|
+
} else {
|
|
23454
|
+
|
|
23455
|
+
_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );
|
|
23456
|
+
|
|
23457
|
+
}
|
|
23458
|
+
|
|
23394
23459
|
if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );
|
|
23395
23460
|
|
|
23396
23461
|
}
|
|
23397
23462
|
|
|
23398
23463
|
} else {
|
|
23399
23464
|
|
|
23400
|
-
|
|
23465
|
+
if ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {
|
|
23466
|
+
|
|
23467
|
+
for ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );
|
|
23468
|
+
|
|
23469
|
+
} else {
|
|
23470
|
+
|
|
23471
|
+
_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );
|
|
23472
|
+
|
|
23473
|
+
}
|
|
23474
|
+
|
|
23401
23475
|
if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );
|
|
23402
23476
|
if ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23403
23477
|
|
|
@@ -24372,7 +24446,7 @@
|
|
|
24372
24446
|
// Render targets
|
|
24373
24447
|
|
|
24374
24448
|
// Setup storage for target texture and bind it to correct framebuffer
|
|
24375
|
-
function setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget ) {
|
|
24449
|
+
function setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {
|
|
24376
24450
|
|
|
24377
24451
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24378
24452
|
const glType = utils.convert( texture.type );
|
|
@@ -24381,13 +24455,16 @@
|
|
|
24381
24455
|
|
|
24382
24456
|
if ( ! renderTargetProperties.__hasExternalTextures ) {
|
|
24383
24457
|
|
|
24458
|
+
const width = Math.max( 1, renderTarget.width >> level );
|
|
24459
|
+
const height = Math.max( 1, renderTarget.height >> level );
|
|
24460
|
+
|
|
24384
24461
|
if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
24385
24462
|
|
|
24386
|
-
state.texImage3D( textureTarget,
|
|
24463
|
+
state.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );
|
|
24387
24464
|
|
|
24388
24465
|
} else {
|
|
24389
24466
|
|
|
24390
|
-
state.texImage2D( textureTarget,
|
|
24467
|
+
state.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );
|
|
24391
24468
|
|
|
24392
24469
|
}
|
|
24393
24470
|
|
|
@@ -24401,7 +24478,7 @@
|
|
|
24401
24478
|
|
|
24402
24479
|
} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
|
|
24403
24480
|
|
|
24404
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture,
|
|
24481
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );
|
|
24405
24482
|
|
|
24406
24483
|
}
|
|
24407
24484
|
|
|
@@ -24622,7 +24699,7 @@
|
|
|
24622
24699
|
|
|
24623
24700
|
if ( colorTexture !== undefined ) {
|
|
24624
24701
|
|
|
24625
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D );
|
|
24702
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );
|
|
24626
24703
|
|
|
24627
24704
|
}
|
|
24628
24705
|
|
|
@@ -24669,13 +24746,41 @@
|
|
|
24669
24746
|
|
|
24670
24747
|
for ( let i = 0; i < 6; i ++ ) {
|
|
24671
24748
|
|
|
24672
|
-
|
|
24749
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
24750
|
+
|
|
24751
|
+
renderTargetProperties.__webglFramebuffer[ i ] = [];
|
|
24752
|
+
|
|
24753
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
24754
|
+
|
|
24755
|
+
renderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();
|
|
24756
|
+
|
|
24757
|
+
}
|
|
24758
|
+
|
|
24759
|
+
} else {
|
|
24760
|
+
|
|
24761
|
+
renderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();
|
|
24762
|
+
|
|
24763
|
+
}
|
|
24673
24764
|
|
|
24674
24765
|
}
|
|
24675
24766
|
|
|
24676
24767
|
} else {
|
|
24677
24768
|
|
|
24678
|
-
|
|
24769
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
24770
|
+
|
|
24771
|
+
renderTargetProperties.__webglFramebuffer = [];
|
|
24772
|
+
|
|
24773
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
24774
|
+
|
|
24775
|
+
renderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();
|
|
24776
|
+
|
|
24777
|
+
}
|
|
24778
|
+
|
|
24779
|
+
} else {
|
|
24780
|
+
|
|
24781
|
+
renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();
|
|
24782
|
+
|
|
24783
|
+
}
|
|
24679
24784
|
|
|
24680
24785
|
if ( isMultipleRenderTargets ) {
|
|
24681
24786
|
|
|
@@ -24755,7 +24860,19 @@
|
|
|
24755
24860
|
|
|
24756
24861
|
for ( let i = 0; i < 6; i ++ ) {
|
|
24757
24862
|
|
|
24758
|
-
|
|
24863
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
24864
|
+
|
|
24865
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
24866
|
+
|
|
24867
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );
|
|
24868
|
+
|
|
24869
|
+
}
|
|
24870
|
+
|
|
24871
|
+
} else {
|
|
24872
|
+
|
|
24873
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );
|
|
24874
|
+
|
|
24875
|
+
}
|
|
24759
24876
|
|
|
24760
24877
|
}
|
|
24761
24878
|
|
|
@@ -24778,7 +24895,7 @@
|
|
|
24778
24895
|
|
|
24779
24896
|
state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
|
|
24780
24897
|
setTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );
|
|
24781
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D );
|
|
24898
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
|
|
24782
24899
|
|
|
24783
24900
|
if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
|
|
24784
24901
|
|
|
@@ -24810,7 +24927,20 @@
|
|
|
24810
24927
|
|
|
24811
24928
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
24812
24929
|
setTextureParameters( glTextureType, texture, supportsMips );
|
|
24813
|
-
|
|
24930
|
+
|
|
24931
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
24932
|
+
|
|
24933
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
24934
|
+
|
|
24935
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );
|
|
24936
|
+
|
|
24937
|
+
}
|
|
24938
|
+
|
|
24939
|
+
} else {
|
|
24940
|
+
|
|
24941
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );
|
|
24942
|
+
|
|
24943
|
+
}
|
|
24814
24944
|
|
|
24815
24945
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
24816
24946
|
|
|
@@ -26749,7 +26879,7 @@
|
|
|
26749
26879
|
uniforms.lightMap.value = material.lightMap;
|
|
26750
26880
|
|
|
26751
26881
|
// artist-friendly light intensity scaling factor
|
|
26752
|
-
const scaleFactor = ( renderer.
|
|
26882
|
+
const scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;
|
|
26753
26883
|
|
|
26754
26884
|
uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;
|
|
26755
26885
|
|
|
@@ -27588,7 +27718,7 @@
|
|
|
27588
27718
|
|
|
27589
27719
|
// physical lights
|
|
27590
27720
|
|
|
27591
|
-
this.
|
|
27721
|
+
this._useLegacyLights = false;
|
|
27592
27722
|
|
|
27593
27723
|
// tone mapping
|
|
27594
27724
|
|
|
@@ -28231,6 +28361,9 @@
|
|
|
28231
28361
|
if ( material.wireframe === true ) {
|
|
28232
28362
|
|
|
28233
28363
|
index = geometries.getWireframeAttribute( geometry );
|
|
28364
|
+
|
|
28365
|
+
if ( index === undefined ) return;
|
|
28366
|
+
|
|
28234
28367
|
rangeFactor = 2;
|
|
28235
28368
|
|
|
28236
28369
|
}
|
|
@@ -28395,7 +28528,7 @@
|
|
|
28395
28528
|
|
|
28396
28529
|
} );
|
|
28397
28530
|
|
|
28398
|
-
currentRenderState.setupLights( _this.
|
|
28531
|
+
currentRenderState.setupLights( _this._useLegacyLights );
|
|
28399
28532
|
|
|
28400
28533
|
scene.traverse( function ( object ) {
|
|
28401
28534
|
|
|
@@ -28548,7 +28681,7 @@
|
|
|
28548
28681
|
|
|
28549
28682
|
// render scene
|
|
28550
28683
|
|
|
28551
|
-
currentRenderState.setupLights( _this.
|
|
28684
|
+
currentRenderState.setupLights( _this._useLegacyLights );
|
|
28552
28685
|
|
|
28553
28686
|
if ( camera.isArrayCamera ) {
|
|
28554
28687
|
|
|
@@ -29037,6 +29170,7 @@
|
|
|
29037
29170
|
|
|
29038
29171
|
materialProperties.outputColorSpace = parameters.outputColorSpace;
|
|
29039
29172
|
materialProperties.instancing = parameters.instancing;
|
|
29173
|
+
materialProperties.instancingColor = parameters.instancingColor;
|
|
29040
29174
|
materialProperties.skinning = parameters.skinning;
|
|
29041
29175
|
materialProperties.morphTargets = parameters.morphTargets;
|
|
29042
29176
|
materialProperties.morphNormals = parameters.morphNormals;
|
|
@@ -29065,7 +29199,18 @@
|
|
|
29065
29199
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
29066
29200
|
const morphNormals = !! geometry.morphAttributes.normal;
|
|
29067
29201
|
const morphColors = !! geometry.morphAttributes.color;
|
|
29068
|
-
|
|
29202
|
+
|
|
29203
|
+
let toneMapping = NoToneMapping;
|
|
29204
|
+
|
|
29205
|
+
if ( material.toneMapped ) {
|
|
29206
|
+
|
|
29207
|
+
if ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {
|
|
29208
|
+
|
|
29209
|
+
toneMapping = _this.toneMapping;
|
|
29210
|
+
|
|
29211
|
+
}
|
|
29212
|
+
|
|
29213
|
+
}
|
|
29069
29214
|
|
|
29070
29215
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
29071
29216
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
@@ -29120,6 +29265,14 @@
|
|
|
29120
29265
|
|
|
29121
29266
|
needsProgramChange = true;
|
|
29122
29267
|
|
|
29268
|
+
} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {
|
|
29269
|
+
|
|
29270
|
+
needsProgramChange = true;
|
|
29271
|
+
|
|
29272
|
+
} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {
|
|
29273
|
+
|
|
29274
|
+
needsProgramChange = true;
|
|
29275
|
+
|
|
29123
29276
|
} else if ( materialProperties.envMap !== envMap ) {
|
|
29124
29277
|
|
|
29125
29278
|
needsProgramChange = true;
|
|
@@ -29535,7 +29688,16 @@
|
|
|
29535
29688
|
|
|
29536
29689
|
if ( renderTarget.isWebGLCubeRenderTarget ) {
|
|
29537
29690
|
|
|
29538
|
-
|
|
29691
|
+
if ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {
|
|
29692
|
+
|
|
29693
|
+
framebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];
|
|
29694
|
+
|
|
29695
|
+
} else {
|
|
29696
|
+
|
|
29697
|
+
framebuffer = __webglFramebuffer[ activeCubeFace ];
|
|
29698
|
+
|
|
29699
|
+
}
|
|
29700
|
+
|
|
29539
29701
|
isCube = true;
|
|
29540
29702
|
|
|
29541
29703
|
} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
|
|
@@ -29544,7 +29706,15 @@
|
|
|
29544
29706
|
|
|
29545
29707
|
} else {
|
|
29546
29708
|
|
|
29547
|
-
|
|
29709
|
+
if ( Array.isArray( __webglFramebuffer ) ) {
|
|
29710
|
+
|
|
29711
|
+
framebuffer = __webglFramebuffer[ activeMipmapLevel ];
|
|
29712
|
+
|
|
29713
|
+
} else {
|
|
29714
|
+
|
|
29715
|
+
framebuffer = __webglFramebuffer;
|
|
29716
|
+
|
|
29717
|
+
}
|
|
29548
29718
|
|
|
29549
29719
|
}
|
|
29550
29720
|
|
|
@@ -29843,14 +30013,14 @@
|
|
|
29843
30013
|
|
|
29844
30014
|
get physicallyCorrectLights() { // @deprecated, r150
|
|
29845
30015
|
|
|
29846
|
-
console.warn( 'THREE.WebGLRenderer:
|
|
30016
|
+
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
29847
30017
|
return ! this.useLegacyLights;
|
|
29848
30018
|
|
|
29849
30019
|
}
|
|
29850
30020
|
|
|
29851
30021
|
set physicallyCorrectLights( value ) { // @deprecated, r150
|
|
29852
30022
|
|
|
29853
|
-
console.warn( 'THREE.WebGLRenderer:
|
|
30023
|
+
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
29854
30024
|
this.useLegacyLights = ! value;
|
|
29855
30025
|
|
|
29856
30026
|
}
|
|
@@ -29869,6 +30039,20 @@
|
|
|
29869
30039
|
|
|
29870
30040
|
}
|
|
29871
30041
|
|
|
30042
|
+
get useLegacyLights() { // @deprecated, r155
|
|
30043
|
+
|
|
30044
|
+
console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
|
|
30045
|
+
return this._useLegacyLights;
|
|
30046
|
+
|
|
30047
|
+
}
|
|
30048
|
+
|
|
30049
|
+
set useLegacyLights( value ) { // @deprecated, r155
|
|
30050
|
+
|
|
30051
|
+
console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
|
|
30052
|
+
this._useLegacyLights = value;
|
|
30053
|
+
|
|
30054
|
+
}
|
|
30055
|
+
|
|
29872
30056
|
}
|
|
29873
30057
|
|
|
29874
30058
|
class WebGL1Renderer extends WebGLRenderer {}
|
|
@@ -43337,14 +43521,21 @@
|
|
|
43337
43521
|
}
|
|
43338
43522
|
|
|
43339
43523
|
|
|
43340
|
-
|
|
43341
|
-
|
|
43524
|
+
/**
|
|
43525
|
+
* Modifies the supplied geometry if it is non-indexed, otherwise creates a new,
|
|
43526
|
+
* non-indexed geometry. Returns the geometry with smooth normals everywhere except
|
|
43527
|
+
* faces that meet at an angle greater than the crease angle.
|
|
43528
|
+
*
|
|
43529
|
+
* @param {BufferGeometry} geometry
|
|
43530
|
+
* @param {number} [creaseAngle]
|
|
43531
|
+
* @return {BufferGeometry}
|
|
43532
|
+
*/
|
|
43342
43533
|
function toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {
|
|
43343
43534
|
|
|
43344
43535
|
const creaseDot = Math.cos( creaseAngle );
|
|
43345
43536
|
const hashMultiplier = ( 1 + 1e-10 ) * 1e2;
|
|
43346
43537
|
|
|
43347
|
-
// reusable
|
|
43538
|
+
// reusable vectors
|
|
43348
43539
|
const verts = [ new Vector3(), new Vector3(), new Vector3() ];
|
|
43349
43540
|
const tempVec1 = new Vector3();
|
|
43350
43541
|
const tempVec2 = new Vector3();
|
|
@@ -43361,7 +43552,9 @@
|
|
|
43361
43552
|
|
|
43362
43553
|
}
|
|
43363
43554
|
|
|
43364
|
-
|
|
43555
|
+
// BufferGeometry.toNonIndexed() warns if the geometry is non-indexed
|
|
43556
|
+
// and returns the original geometry
|
|
43557
|
+
const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;
|
|
43365
43558
|
const posAttr = resultGeometry.attributes.position;
|
|
43366
43559
|
const vertexMap = {};
|
|
43367
43560
|
|
|
@@ -66787,12 +66980,20 @@
|
|
|
66787
66980
|
margin: margin,
|
|
66788
66981
|
curvatureResolution: curvatureResolution
|
|
66789
66982
|
};
|
|
66983
|
+
var memD = {
|
|
66984
|
+
geoJson: geoJson,
|
|
66985
|
+
h3Res: h3Res
|
|
66986
|
+
};
|
|
66790
66987
|
var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
|
|
66791
66988
|
alt: -1e-3
|
|
66792
66989
|
});
|
|
66990
|
+
var currentMemD = obj.__currentMemD || memD;
|
|
66793
66991
|
if (Object.keys(targetD).some(function (k) {
|
|
66794
66992
|
return currentTargetD[k] !== targetD[k];
|
|
66993
|
+
}) || Object.keys(memD).some(function (k) {
|
|
66994
|
+
return currentMemD[k] !== memD[k];
|
|
66795
66995
|
})) {
|
|
66996
|
+
obj.__currentMemD = memD;
|
|
66796
66997
|
var h3Idxs = [];
|
|
66797
66998
|
if (geoJson.type === 'Polygon') {
|
|
66798
66999
|
polygonToCells(geoJson.coordinates, h3Res, true).forEach(function (idx) {
|
|
@@ -69191,6 +69392,9 @@
|
|
|
69191
69392
|
const _changeEvent$1 = { type: 'change' };
|
|
69192
69393
|
const _startEvent = { type: 'start' };
|
|
69193
69394
|
const _endEvent = { type: 'end' };
|
|
69395
|
+
const _ray = new Ray();
|
|
69396
|
+
const _plane = new Plane();
|
|
69397
|
+
const TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD );
|
|
69194
69398
|
|
|
69195
69399
|
class OrbitControls extends EventDispatcher {
|
|
69196
69400
|
|
|
@@ -69245,6 +69449,7 @@
|
|
|
69245
69449
|
this.panSpeed = 1.0;
|
|
69246
69450
|
this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
|
|
69247
69451
|
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
|
|
69452
|
+
this.zoomToCursor = false;
|
|
69248
69453
|
|
|
69249
69454
|
// Set to true to automatically rotate around the target
|
|
69250
69455
|
// If auto-rotate is enabled, you must call controls.update() in your animation loop
|
|
@@ -69403,11 +69608,6 @@
|
|
|
69403
69608
|
spherical.makeSafe();
|
|
69404
69609
|
|
|
69405
69610
|
|
|
69406
|
-
spherical.radius *= scale;
|
|
69407
|
-
|
|
69408
|
-
// restrict radius to be between desired limits
|
|
69409
|
-
spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
|
|
69410
|
-
|
|
69411
69611
|
// move target to panned location
|
|
69412
69612
|
|
|
69413
69613
|
if ( scope.enableDamping === true ) {
|
|
@@ -69420,6 +69620,19 @@
|
|
|
69420
69620
|
|
|
69421
69621
|
}
|
|
69422
69622
|
|
|
69623
|
+
// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
|
|
69624
|
+
// we adjust zoom later in these cases
|
|
69625
|
+
if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {
|
|
69626
|
+
|
|
69627
|
+
spherical.radius = clampDistance( spherical.radius );
|
|
69628
|
+
|
|
69629
|
+
} else {
|
|
69630
|
+
|
|
69631
|
+
spherical.radius = clampDistance( spherical.radius * scale );
|
|
69632
|
+
|
|
69633
|
+
}
|
|
69634
|
+
|
|
69635
|
+
|
|
69423
69636
|
offset.setFromSpherical( spherical );
|
|
69424
69637
|
|
|
69425
69638
|
// rotate offset back to "camera-up-vector-is-up" space
|
|
@@ -69444,7 +69657,91 @@
|
|
|
69444
69657
|
|
|
69445
69658
|
}
|
|
69446
69659
|
|
|
69660
|
+
// adjust camera position
|
|
69661
|
+
let zoomChanged = false;
|
|
69662
|
+
if ( scope.zoomToCursor && performCursorZoom ) {
|
|
69663
|
+
|
|
69664
|
+
let newRadius = null;
|
|
69665
|
+
if ( scope.object.isPerspectiveCamera ) {
|
|
69666
|
+
|
|
69667
|
+
// move the camera down the pointer ray
|
|
69668
|
+
// this method avoids floating point error
|
|
69669
|
+
const prevRadius = offset.length();
|
|
69670
|
+
newRadius = clampDistance( prevRadius * scale );
|
|
69671
|
+
|
|
69672
|
+
const radiusDelta = prevRadius - newRadius;
|
|
69673
|
+
scope.object.position.addScaledVector( dollyDirection, radiusDelta );
|
|
69674
|
+
scope.object.updateMatrixWorld();
|
|
69675
|
+
|
|
69676
|
+
} else if ( scope.object.isOrthographicCamera ) {
|
|
69677
|
+
|
|
69678
|
+
// adjust the ortho camera position based on zoom changes
|
|
69679
|
+
const mouseBefore = new Vector3( mouse.x, mouse.y, 0 );
|
|
69680
|
+
mouseBefore.unproject( scope.object );
|
|
69681
|
+
|
|
69682
|
+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
|
|
69683
|
+
scope.object.updateProjectionMatrix();
|
|
69684
|
+
zoomChanged = true;
|
|
69685
|
+
|
|
69686
|
+
const mouseAfter = new Vector3( mouse.x, mouse.y, 0 );
|
|
69687
|
+
mouseAfter.unproject( scope.object );
|
|
69688
|
+
|
|
69689
|
+
scope.object.position.sub( mouseAfter ).add( mouseBefore );
|
|
69690
|
+
scope.object.updateMatrixWorld();
|
|
69691
|
+
|
|
69692
|
+
newRadius = offset.length();
|
|
69693
|
+
|
|
69694
|
+
} else {
|
|
69695
|
+
|
|
69696
|
+
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' );
|
|
69697
|
+
scope.zoomToCursor = false;
|
|
69698
|
+
|
|
69699
|
+
}
|
|
69700
|
+
|
|
69701
|
+
// handle the placement of the target
|
|
69702
|
+
if ( newRadius !== null ) {
|
|
69703
|
+
|
|
69704
|
+
if ( this.screenSpacePanning ) {
|
|
69705
|
+
|
|
69706
|
+
// position the orbit target in front of the new camera position
|
|
69707
|
+
scope.target.set( 0, 0, - 1 )
|
|
69708
|
+
.transformDirection( scope.object.matrix )
|
|
69709
|
+
.multiplyScalar( newRadius )
|
|
69710
|
+
.add( scope.object.position );
|
|
69711
|
+
|
|
69712
|
+
} else {
|
|
69713
|
+
|
|
69714
|
+
// get the ray and translation plane to compute target
|
|
69715
|
+
_ray.origin.copy( scope.object.position );
|
|
69716
|
+
_ray.direction.set( 0, 0, - 1 ).transformDirection( scope.object.matrix );
|
|
69717
|
+
|
|
69718
|
+
// if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid
|
|
69719
|
+
// extremely large values
|
|
69720
|
+
if ( Math.abs( scope.object.up.dot( _ray.direction ) ) < TILT_LIMIT ) {
|
|
69721
|
+
|
|
69722
|
+
object.lookAt( scope.target );
|
|
69723
|
+
|
|
69724
|
+
} else {
|
|
69725
|
+
|
|
69726
|
+
_plane.setFromNormalAndCoplanarPoint( scope.object.up, scope.target );
|
|
69727
|
+
_ray.intersectPlane( _plane, scope.target );
|
|
69728
|
+
|
|
69729
|
+
}
|
|
69730
|
+
|
|
69731
|
+
}
|
|
69732
|
+
|
|
69733
|
+
}
|
|
69734
|
+
|
|
69735
|
+
} else if ( scope.object.isOrthographicCamera ) {
|
|
69736
|
+
|
|
69737
|
+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
|
|
69738
|
+
scope.object.updateProjectionMatrix();
|
|
69739
|
+
zoomChanged = true;
|
|
69740
|
+
|
|
69741
|
+
}
|
|
69742
|
+
|
|
69447
69743
|
scale = 1;
|
|
69744
|
+
performCursorZoom = false;
|
|
69448
69745
|
|
|
69449
69746
|
// update condition is:
|
|
69450
69747
|
// min(camera displacement, camera rotation in radians)^2 > EPS
|
|
@@ -69523,7 +69820,6 @@
|
|
|
69523
69820
|
|
|
69524
69821
|
let scale = 1;
|
|
69525
69822
|
const panOffset = new Vector3();
|
|
69526
|
-
let zoomChanged = false;
|
|
69527
69823
|
|
|
69528
69824
|
const rotateStart = new Vector2();
|
|
69529
69825
|
const rotateEnd = new Vector2();
|
|
@@ -69537,6 +69833,10 @@
|
|
|
69537
69833
|
const dollyEnd = new Vector2();
|
|
69538
69834
|
const dollyDelta = new Vector2();
|
|
69539
69835
|
|
|
69836
|
+
const dollyDirection = new Vector3();
|
|
69837
|
+
const mouse = new Vector2();
|
|
69838
|
+
let performCursorZoom = false;
|
|
69839
|
+
|
|
69540
69840
|
const pointers = [];
|
|
69541
69841
|
const pointerPositions = {};
|
|
69542
69842
|
|
|
@@ -69647,16 +69947,10 @@
|
|
|
69647
69947
|
|
|
69648
69948
|
function dollyOut( dollyScale ) {
|
|
69649
69949
|
|
|
69650
|
-
if ( scope.object.isPerspectiveCamera ) {
|
|
69950
|
+
if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {
|
|
69651
69951
|
|
|
69652
69952
|
scale /= dollyScale;
|
|
69653
69953
|
|
|
69654
|
-
} else if ( scope.object.isOrthographicCamera ) {
|
|
69655
|
-
|
|
69656
|
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
|
|
69657
|
-
scope.object.updateProjectionMatrix();
|
|
69658
|
-
zoomChanged = true;
|
|
69659
|
-
|
|
69660
69954
|
} else {
|
|
69661
69955
|
|
|
69662
69956
|
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
|
@@ -69668,16 +69962,10 @@
|
|
|
69668
69962
|
|
|
69669
69963
|
function dollyIn( dollyScale ) {
|
|
69670
69964
|
|
|
69671
|
-
if ( scope.object.isPerspectiveCamera ) {
|
|
69965
|
+
if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {
|
|
69672
69966
|
|
|
69673
69967
|
scale *= dollyScale;
|
|
69674
69968
|
|
|
69675
|
-
} else if ( scope.object.isOrthographicCamera ) {
|
|
69676
|
-
|
|
69677
|
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
|
|
69678
|
-
scope.object.updateProjectionMatrix();
|
|
69679
|
-
zoomChanged = true;
|
|
69680
|
-
|
|
69681
69969
|
} else {
|
|
69682
69970
|
|
|
69683
69971
|
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
|
@@ -69687,6 +69975,35 @@
|
|
|
69687
69975
|
|
|
69688
69976
|
}
|
|
69689
69977
|
|
|
69978
|
+
function updateMouseParameters( event ) {
|
|
69979
|
+
|
|
69980
|
+
if ( ! scope.zoomToCursor ) {
|
|
69981
|
+
|
|
69982
|
+
return;
|
|
69983
|
+
|
|
69984
|
+
}
|
|
69985
|
+
|
|
69986
|
+
performCursorZoom = true;
|
|
69987
|
+
|
|
69988
|
+
const rect = scope.domElement.getBoundingClientRect();
|
|
69989
|
+
const x = event.clientX - rect.left;
|
|
69990
|
+
const y = event.clientY - rect.top;
|
|
69991
|
+
const w = rect.width;
|
|
69992
|
+
const h = rect.height;
|
|
69993
|
+
|
|
69994
|
+
mouse.x = ( x / w ) * 2 - 1;
|
|
69995
|
+
mouse.y = - ( y / h ) * 2 + 1;
|
|
69996
|
+
|
|
69997
|
+
dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( object ).sub( object.position ).normalize();
|
|
69998
|
+
|
|
69999
|
+
}
|
|
70000
|
+
|
|
70001
|
+
function clampDistance( dist ) {
|
|
70002
|
+
|
|
70003
|
+
return Math.max( scope.minDistance, Math.min( scope.maxDistance, dist ) );
|
|
70004
|
+
|
|
70005
|
+
}
|
|
70006
|
+
|
|
69690
70007
|
//
|
|
69691
70008
|
// event callbacks - update the object state
|
|
69692
70009
|
//
|
|
@@ -69699,6 +70016,7 @@
|
|
|
69699
70016
|
|
|
69700
70017
|
function handleMouseDownDolly( event ) {
|
|
69701
70018
|
|
|
70019
|
+
updateMouseParameters( event );
|
|
69702
70020
|
dollyStart.set( event.clientX, event.clientY );
|
|
69703
70021
|
|
|
69704
70022
|
}
|
|
@@ -69765,6 +70083,8 @@
|
|
|
69765
70083
|
|
|
69766
70084
|
function handleMouseWheel( event ) {
|
|
69767
70085
|
|
|
70086
|
+
updateMouseParameters( event );
|
|
70087
|
+
|
|
69768
70088
|
if ( event.deltaY < 0 ) {
|
|
69769
70089
|
|
|
69770
70090
|
dollyIn( getZoomScale() );
|
|
@@ -70982,11 +71302,14 @@
|
|
|
70982
71302
|
if ( this.clear ) renderer.clear();
|
|
70983
71303
|
renderer.render( this.scene, this.camera );
|
|
70984
71304
|
|
|
70985
|
-
// unlock color and depth buffer for subsequent rendering
|
|
71305
|
+
// unlock color and depth buffer and make them writable for subsequent rendering/clearing
|
|
70986
71306
|
|
|
70987
71307
|
state.buffers.color.setLocked( false );
|
|
70988
71308
|
state.buffers.depth.setLocked( false );
|
|
70989
71309
|
|
|
71310
|
+
state.buffers.color.setMask( true );
|
|
71311
|
+
state.buffers.depth.setMask( true );
|
|
71312
|
+
|
|
70990
71313
|
// only render where stencil is set to 1
|
|
70991
71314
|
|
|
70992
71315
|
state.buffers.stencil.setLocked( false );
|
|
@@ -73145,9 +73468,10 @@
|
|
|
73145
73468
|
return d;
|
|
73146
73469
|
}
|
|
73147
73470
|
};
|
|
73471
|
+
state.renderObjs.renderer().useLegacyLights = false; // force behavior of three < 155
|
|
73148
73472
|
state.renderObjs.objects([
|
|
73149
73473
|
// Populate scene
|
|
73150
|
-
new THREE.AmbientLight(0xcccccc), new THREE.DirectionalLight(0xffffff, 0.6), state.globe]).hoverOrderComparator(function (a, b) {
|
|
73474
|
+
new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI), state.globe]).hoverOrderComparator(function (a, b) {
|
|
73151
73475
|
var aObj = getGlobeObj(a);
|
|
73152
73476
|
var bObj = getGlobeObj(b);
|
|
73153
73477
|
|