react-globe.gl 2.24.2 → 2.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-globe.gl.js +383 -59
- package/dist/react-globe.gl.js.map +1 -1
- package/dist/react-globe.gl.min.js +5 -5
- package/package.json +8 -8
package/dist/react-globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.24.
|
|
1
|
+
// Version 2.24.3 react-globe.gl - https://github.com/vasturiano/react-globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['react'], factory) :
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
* Copyright 2010-2023 Three.js Authors
|
|
315
315
|
* SPDX-License-Identifier: MIT
|
|
316
316
|
*/
|
|
317
|
-
const REVISION = '
|
|
317
|
+
const REVISION = '155';
|
|
318
318
|
|
|
319
319
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
320
320
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -3132,13 +3132,13 @@
|
|
|
3132
3132
|
* Texture parameters for an auto-generated target texture
|
|
3133
3133
|
* depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
|
|
3134
3134
|
*/
|
|
3135
|
-
class
|
|
3135
|
+
class RenderTarget extends EventDispatcher {
|
|
3136
3136
|
|
|
3137
3137
|
constructor( width = 1, height = 1, options = {} ) {
|
|
3138
3138
|
|
|
3139
3139
|
super();
|
|
3140
3140
|
|
|
3141
|
-
this.
|
|
3141
|
+
this.isRenderTarget = true;
|
|
3142
3142
|
|
|
3143
3143
|
this.width = width;
|
|
3144
3144
|
this.height = height;
|
|
@@ -3241,6 +3241,18 @@
|
|
|
3241
3241
|
|
|
3242
3242
|
}
|
|
3243
3243
|
|
|
3244
|
+
class WebGLRenderTarget extends RenderTarget {
|
|
3245
|
+
|
|
3246
|
+
constructor( width = 1, height = 1, options = {} ) {
|
|
3247
|
+
|
|
3248
|
+
super( width, height, options );
|
|
3249
|
+
|
|
3250
|
+
this.isWebGLRenderTarget = true;
|
|
3251
|
+
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3244
3256
|
class DataArrayTexture extends Texture {
|
|
3245
3257
|
|
|
3246
3258
|
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
@@ -8157,7 +8169,7 @@
|
|
|
8157
8169
|
this.frustumCulled = source.frustumCulled;
|
|
8158
8170
|
this.renderOrder = source.renderOrder;
|
|
8159
8171
|
|
|
8160
|
-
this.animations = source.animations;
|
|
8172
|
+
this.animations = source.animations.slice();
|
|
8161
8173
|
|
|
8162
8174
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
8163
8175
|
|
|
@@ -9880,6 +9892,26 @@
|
|
|
9880
9892
|
|
|
9881
9893
|
}
|
|
9882
9894
|
|
|
9895
|
+
getComponent( index, component ) {
|
|
9896
|
+
|
|
9897
|
+
let value = this.array[ index * this.itemSize + component ];
|
|
9898
|
+
|
|
9899
|
+
if ( this.normalized ) value = denormalize( value, this.array );
|
|
9900
|
+
|
|
9901
|
+
return value;
|
|
9902
|
+
|
|
9903
|
+
}
|
|
9904
|
+
|
|
9905
|
+
setComponent( index, component, value ) {
|
|
9906
|
+
|
|
9907
|
+
if ( this.normalized ) value = normalize$1( value, this.array );
|
|
9908
|
+
|
|
9909
|
+
this.array[ index * this.itemSize + component ] = value;
|
|
9910
|
+
|
|
9911
|
+
return this;
|
|
9912
|
+
|
|
9913
|
+
}
|
|
9914
|
+
|
|
9883
9915
|
getX( index ) {
|
|
9884
9916
|
|
|
9885
9917
|
let x = this.array[ index * this.itemSize ];
|
|
@@ -12448,10 +12480,8 @@
|
|
|
12448
12480
|
|
|
12449
12481
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
12450
12482
|
|
|
12451
|
-
const currentToneMapping = renderer.toneMapping;
|
|
12452
12483
|
const currentXrEnabled = renderer.xr.enabled;
|
|
12453
12484
|
|
|
12454
|
-
renderer.toneMapping = NoToneMapping;
|
|
12455
12485
|
renderer.xr.enabled = false;
|
|
12456
12486
|
|
|
12457
12487
|
const generateMipmaps = renderTarget.texture.generateMipmaps;
|
|
@@ -12480,7 +12510,6 @@
|
|
|
12480
12510
|
|
|
12481
12511
|
renderer.setRenderTarget( currentRenderTarget );
|
|
12482
12512
|
|
|
12483
|
-
renderer.toneMapping = currentToneMapping;
|
|
12484
12513
|
renderer.xr.enabled = currentXrEnabled;
|
|
12485
12514
|
|
|
12486
12515
|
renderTarget.texture.needsPMREMUpdate = true;
|
|
@@ -13403,7 +13432,7 @@
|
|
|
13403
13432
|
|
|
13404
13433
|
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";
|
|
13405
13434
|
|
|
13406
|
-
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\
|
|
13435
|
+
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";
|
|
13407
13436
|
|
|
13408
13437
|
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";
|
|
13409
13438
|
|
|
@@ -17031,7 +17060,7 @@
|
|
|
17031
17060
|
|
|
17032
17061
|
}
|
|
17033
17062
|
|
|
17034
|
-
} else {
|
|
17063
|
+
} else if ( geometryPosition !== undefined ) {
|
|
17035
17064
|
|
|
17036
17065
|
const array = geometryPosition.array;
|
|
17037
17066
|
version = geometryPosition.version;
|
|
@@ -17046,6 +17075,10 @@
|
|
|
17046
17075
|
|
|
17047
17076
|
}
|
|
17048
17077
|
|
|
17078
|
+
} else {
|
|
17079
|
+
|
|
17080
|
+
return;
|
|
17081
|
+
|
|
17049
17082
|
}
|
|
17050
17083
|
|
|
17051
17084
|
const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
|
|
@@ -20053,6 +20086,18 @@
|
|
|
20053
20086
|
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
|
|
20054
20087
|
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
|
|
20055
20088
|
|
|
20089
|
+
let toneMapping = NoToneMapping;
|
|
20090
|
+
|
|
20091
|
+
if ( material.toneMapped ) {
|
|
20092
|
+
|
|
20093
|
+
if ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {
|
|
20094
|
+
|
|
20095
|
+
toneMapping = renderer.toneMapping;
|
|
20096
|
+
|
|
20097
|
+
}
|
|
20098
|
+
|
|
20099
|
+
}
|
|
20100
|
+
|
|
20056
20101
|
const parameters = {
|
|
20057
20102
|
|
|
20058
20103
|
isWebGL2: IS_WEBGL2,
|
|
@@ -20213,8 +20258,8 @@
|
|
|
20213
20258
|
shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
|
|
20214
20259
|
shadowMapType: renderer.shadowMap.type,
|
|
20215
20260
|
|
|
20216
|
-
toneMapping:
|
|
20217
|
-
useLegacyLights: renderer.
|
|
20261
|
+
toneMapping: toneMapping,
|
|
20262
|
+
useLegacyLights: renderer._useLegacyLights,
|
|
20218
20263
|
|
|
20219
20264
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
20220
20265
|
|
|
@@ -23386,6 +23431,17 @@
|
|
|
23386
23431
|
|
|
23387
23432
|
}
|
|
23388
23433
|
|
|
23434
|
+
if ( glFormat === _gl.RED_INTEGER ) {
|
|
23435
|
+
|
|
23436
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;
|
|
23437
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;
|
|
23438
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;
|
|
23439
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.R8I;
|
|
23440
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.R16I;
|
|
23441
|
+
if ( glType === _gl.INT ) internalFormat = _gl.R32I;
|
|
23442
|
+
|
|
23443
|
+
}
|
|
23444
|
+
|
|
23389
23445
|
if ( glFormat === _gl.RG ) {
|
|
23390
23446
|
|
|
23391
23447
|
if ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;
|
|
@@ -23562,14 +23618,32 @@
|
|
|
23562
23618
|
|
|
23563
23619
|
for ( let i = 0; i < 6; i ++ ) {
|
|
23564
23620
|
|
|
23565
|
-
|
|
23621
|
+
if ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {
|
|
23622
|
+
|
|
23623
|
+
for ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );
|
|
23624
|
+
|
|
23625
|
+
} else {
|
|
23626
|
+
|
|
23627
|
+
_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );
|
|
23628
|
+
|
|
23629
|
+
}
|
|
23630
|
+
|
|
23566
23631
|
if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );
|
|
23567
23632
|
|
|
23568
23633
|
}
|
|
23569
23634
|
|
|
23570
23635
|
} else {
|
|
23571
23636
|
|
|
23572
|
-
|
|
23637
|
+
if ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {
|
|
23638
|
+
|
|
23639
|
+
for ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );
|
|
23640
|
+
|
|
23641
|
+
} else {
|
|
23642
|
+
|
|
23643
|
+
_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );
|
|
23644
|
+
|
|
23645
|
+
}
|
|
23646
|
+
|
|
23573
23647
|
if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );
|
|
23574
23648
|
if ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23575
23649
|
|
|
@@ -24544,7 +24618,7 @@
|
|
|
24544
24618
|
// Render targets
|
|
24545
24619
|
|
|
24546
24620
|
// Setup storage for target texture and bind it to correct framebuffer
|
|
24547
|
-
function setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget ) {
|
|
24621
|
+
function setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {
|
|
24548
24622
|
|
|
24549
24623
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
24550
24624
|
const glType = utils.convert( texture.type );
|
|
@@ -24553,13 +24627,16 @@
|
|
|
24553
24627
|
|
|
24554
24628
|
if ( ! renderTargetProperties.__hasExternalTextures ) {
|
|
24555
24629
|
|
|
24630
|
+
const width = Math.max( 1, renderTarget.width >> level );
|
|
24631
|
+
const height = Math.max( 1, renderTarget.height >> level );
|
|
24632
|
+
|
|
24556
24633
|
if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
24557
24634
|
|
|
24558
|
-
state.texImage3D( textureTarget,
|
|
24635
|
+
state.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );
|
|
24559
24636
|
|
|
24560
24637
|
} else {
|
|
24561
24638
|
|
|
24562
|
-
state.texImage2D( textureTarget,
|
|
24639
|
+
state.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );
|
|
24563
24640
|
|
|
24564
24641
|
}
|
|
24565
24642
|
|
|
@@ -24573,7 +24650,7 @@
|
|
|
24573
24650
|
|
|
24574
24651
|
} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
|
|
24575
24652
|
|
|
24576
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture,
|
|
24653
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );
|
|
24577
24654
|
|
|
24578
24655
|
}
|
|
24579
24656
|
|
|
@@ -24794,7 +24871,7 @@
|
|
|
24794
24871
|
|
|
24795
24872
|
if ( colorTexture !== undefined ) {
|
|
24796
24873
|
|
|
24797
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D );
|
|
24874
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );
|
|
24798
24875
|
|
|
24799
24876
|
}
|
|
24800
24877
|
|
|
@@ -24841,13 +24918,41 @@
|
|
|
24841
24918
|
|
|
24842
24919
|
for ( let i = 0; i < 6; i ++ ) {
|
|
24843
24920
|
|
|
24844
|
-
|
|
24921
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
24922
|
+
|
|
24923
|
+
renderTargetProperties.__webglFramebuffer[ i ] = [];
|
|
24924
|
+
|
|
24925
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
24926
|
+
|
|
24927
|
+
renderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();
|
|
24928
|
+
|
|
24929
|
+
}
|
|
24930
|
+
|
|
24931
|
+
} else {
|
|
24932
|
+
|
|
24933
|
+
renderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();
|
|
24934
|
+
|
|
24935
|
+
}
|
|
24845
24936
|
|
|
24846
24937
|
}
|
|
24847
24938
|
|
|
24848
24939
|
} else {
|
|
24849
24940
|
|
|
24850
|
-
|
|
24941
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
24942
|
+
|
|
24943
|
+
renderTargetProperties.__webglFramebuffer = [];
|
|
24944
|
+
|
|
24945
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
24946
|
+
|
|
24947
|
+
renderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();
|
|
24948
|
+
|
|
24949
|
+
}
|
|
24950
|
+
|
|
24951
|
+
} else {
|
|
24952
|
+
|
|
24953
|
+
renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();
|
|
24954
|
+
|
|
24955
|
+
}
|
|
24851
24956
|
|
|
24852
24957
|
if ( isMultipleRenderTargets ) {
|
|
24853
24958
|
|
|
@@ -24927,7 +25032,19 @@
|
|
|
24927
25032
|
|
|
24928
25033
|
for ( let i = 0; i < 6; i ++ ) {
|
|
24929
25034
|
|
|
24930
|
-
|
|
25035
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
25036
|
+
|
|
25037
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
25038
|
+
|
|
25039
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );
|
|
25040
|
+
|
|
25041
|
+
}
|
|
25042
|
+
|
|
25043
|
+
} else {
|
|
25044
|
+
|
|
25045
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );
|
|
25046
|
+
|
|
25047
|
+
}
|
|
24931
25048
|
|
|
24932
25049
|
}
|
|
24933
25050
|
|
|
@@ -24950,7 +25067,7 @@
|
|
|
24950
25067
|
|
|
24951
25068
|
state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
|
|
24952
25069
|
setTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );
|
|
24953
|
-
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D );
|
|
25070
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
|
|
24954
25071
|
|
|
24955
25072
|
if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
|
|
24956
25073
|
|
|
@@ -24982,7 +25099,20 @@
|
|
|
24982
25099
|
|
|
24983
25100
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
24984
25101
|
setTextureParameters( glTextureType, texture, supportsMips );
|
|
24985
|
-
|
|
25102
|
+
|
|
25103
|
+
if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
|
|
25104
|
+
|
|
25105
|
+
for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
|
|
25106
|
+
|
|
25107
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );
|
|
25108
|
+
|
|
25109
|
+
}
|
|
25110
|
+
|
|
25111
|
+
} else {
|
|
25112
|
+
|
|
25113
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );
|
|
25114
|
+
|
|
25115
|
+
}
|
|
24986
25116
|
|
|
24987
25117
|
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
24988
25118
|
|
|
@@ -26921,7 +27051,7 @@
|
|
|
26921
27051
|
uniforms.lightMap.value = material.lightMap;
|
|
26922
27052
|
|
|
26923
27053
|
// artist-friendly light intensity scaling factor
|
|
26924
|
-
const scaleFactor = ( renderer.
|
|
27054
|
+
const scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;
|
|
26925
27055
|
|
|
26926
27056
|
uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;
|
|
26927
27057
|
|
|
@@ -27760,7 +27890,7 @@
|
|
|
27760
27890
|
|
|
27761
27891
|
// physical lights
|
|
27762
27892
|
|
|
27763
|
-
this.
|
|
27893
|
+
this._useLegacyLights = false;
|
|
27764
27894
|
|
|
27765
27895
|
// tone mapping
|
|
27766
27896
|
|
|
@@ -28403,6 +28533,9 @@
|
|
|
28403
28533
|
if ( material.wireframe === true ) {
|
|
28404
28534
|
|
|
28405
28535
|
index = geometries.getWireframeAttribute( geometry );
|
|
28536
|
+
|
|
28537
|
+
if ( index === undefined ) return;
|
|
28538
|
+
|
|
28406
28539
|
rangeFactor = 2;
|
|
28407
28540
|
|
|
28408
28541
|
}
|
|
@@ -28567,7 +28700,7 @@
|
|
|
28567
28700
|
|
|
28568
28701
|
} );
|
|
28569
28702
|
|
|
28570
|
-
currentRenderState.setupLights( _this.
|
|
28703
|
+
currentRenderState.setupLights( _this._useLegacyLights );
|
|
28571
28704
|
|
|
28572
28705
|
scene.traverse( function ( object ) {
|
|
28573
28706
|
|
|
@@ -28720,7 +28853,7 @@
|
|
|
28720
28853
|
|
|
28721
28854
|
// render scene
|
|
28722
28855
|
|
|
28723
|
-
currentRenderState.setupLights( _this.
|
|
28856
|
+
currentRenderState.setupLights( _this._useLegacyLights );
|
|
28724
28857
|
|
|
28725
28858
|
if ( camera.isArrayCamera ) {
|
|
28726
28859
|
|
|
@@ -29209,6 +29342,7 @@
|
|
|
29209
29342
|
|
|
29210
29343
|
materialProperties.outputColorSpace = parameters.outputColorSpace;
|
|
29211
29344
|
materialProperties.instancing = parameters.instancing;
|
|
29345
|
+
materialProperties.instancingColor = parameters.instancingColor;
|
|
29212
29346
|
materialProperties.skinning = parameters.skinning;
|
|
29213
29347
|
materialProperties.morphTargets = parameters.morphTargets;
|
|
29214
29348
|
materialProperties.morphNormals = parameters.morphNormals;
|
|
@@ -29237,7 +29371,18 @@
|
|
|
29237
29371
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
29238
29372
|
const morphNormals = !! geometry.morphAttributes.normal;
|
|
29239
29373
|
const morphColors = !! geometry.morphAttributes.color;
|
|
29240
|
-
|
|
29374
|
+
|
|
29375
|
+
let toneMapping = NoToneMapping;
|
|
29376
|
+
|
|
29377
|
+
if ( material.toneMapped ) {
|
|
29378
|
+
|
|
29379
|
+
if ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {
|
|
29380
|
+
|
|
29381
|
+
toneMapping = _this.toneMapping;
|
|
29382
|
+
|
|
29383
|
+
}
|
|
29384
|
+
|
|
29385
|
+
}
|
|
29241
29386
|
|
|
29242
29387
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
29243
29388
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
@@ -29292,6 +29437,14 @@
|
|
|
29292
29437
|
|
|
29293
29438
|
needsProgramChange = true;
|
|
29294
29439
|
|
|
29440
|
+
} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {
|
|
29441
|
+
|
|
29442
|
+
needsProgramChange = true;
|
|
29443
|
+
|
|
29444
|
+
} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {
|
|
29445
|
+
|
|
29446
|
+
needsProgramChange = true;
|
|
29447
|
+
|
|
29295
29448
|
} else if ( materialProperties.envMap !== envMap ) {
|
|
29296
29449
|
|
|
29297
29450
|
needsProgramChange = true;
|
|
@@ -29707,7 +29860,16 @@
|
|
|
29707
29860
|
|
|
29708
29861
|
if ( renderTarget.isWebGLCubeRenderTarget ) {
|
|
29709
29862
|
|
|
29710
|
-
|
|
29863
|
+
if ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {
|
|
29864
|
+
|
|
29865
|
+
framebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];
|
|
29866
|
+
|
|
29867
|
+
} else {
|
|
29868
|
+
|
|
29869
|
+
framebuffer = __webglFramebuffer[ activeCubeFace ];
|
|
29870
|
+
|
|
29871
|
+
}
|
|
29872
|
+
|
|
29711
29873
|
isCube = true;
|
|
29712
29874
|
|
|
29713
29875
|
} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
|
|
@@ -29716,7 +29878,15 @@
|
|
|
29716
29878
|
|
|
29717
29879
|
} else {
|
|
29718
29880
|
|
|
29719
|
-
|
|
29881
|
+
if ( Array.isArray( __webglFramebuffer ) ) {
|
|
29882
|
+
|
|
29883
|
+
framebuffer = __webglFramebuffer[ activeMipmapLevel ];
|
|
29884
|
+
|
|
29885
|
+
} else {
|
|
29886
|
+
|
|
29887
|
+
framebuffer = __webglFramebuffer;
|
|
29888
|
+
|
|
29889
|
+
}
|
|
29720
29890
|
|
|
29721
29891
|
}
|
|
29722
29892
|
|
|
@@ -30015,14 +30185,14 @@
|
|
|
30015
30185
|
|
|
30016
30186
|
get physicallyCorrectLights() { // @deprecated, r150
|
|
30017
30187
|
|
|
30018
|
-
console.warn( 'THREE.WebGLRenderer:
|
|
30188
|
+
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
30019
30189
|
return ! this.useLegacyLights;
|
|
30020
30190
|
|
|
30021
30191
|
}
|
|
30022
30192
|
|
|
30023
30193
|
set physicallyCorrectLights( value ) { // @deprecated, r150
|
|
30024
30194
|
|
|
30025
|
-
console.warn( 'THREE.WebGLRenderer:
|
|
30195
|
+
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
30026
30196
|
this.useLegacyLights = ! value;
|
|
30027
30197
|
|
|
30028
30198
|
}
|
|
@@ -30041,6 +30211,20 @@
|
|
|
30041
30211
|
|
|
30042
30212
|
}
|
|
30043
30213
|
|
|
30214
|
+
get useLegacyLights() { // @deprecated, r155
|
|
30215
|
+
|
|
30216
|
+
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.' );
|
|
30217
|
+
return this._useLegacyLights;
|
|
30218
|
+
|
|
30219
|
+
}
|
|
30220
|
+
|
|
30221
|
+
set useLegacyLights( value ) { // @deprecated, r155
|
|
30222
|
+
|
|
30223
|
+
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.' );
|
|
30224
|
+
this._useLegacyLights = value;
|
|
30225
|
+
|
|
30226
|
+
}
|
|
30227
|
+
|
|
30044
30228
|
}
|
|
30045
30229
|
|
|
30046
30230
|
class WebGL1Renderer extends WebGLRenderer {}
|
|
@@ -43503,14 +43687,21 @@
|
|
|
43503
43687
|
}
|
|
43504
43688
|
|
|
43505
43689
|
|
|
43506
|
-
|
|
43507
|
-
|
|
43690
|
+
/**
|
|
43691
|
+
* Modifies the supplied geometry if it is non-indexed, otherwise creates a new,
|
|
43692
|
+
* non-indexed geometry. Returns the geometry with smooth normals everywhere except
|
|
43693
|
+
* faces that meet at an angle greater than the crease angle.
|
|
43694
|
+
*
|
|
43695
|
+
* @param {BufferGeometry} geometry
|
|
43696
|
+
* @param {number} [creaseAngle]
|
|
43697
|
+
* @return {BufferGeometry}
|
|
43698
|
+
*/
|
|
43508
43699
|
function toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {
|
|
43509
43700
|
|
|
43510
43701
|
const creaseDot = Math.cos( creaseAngle );
|
|
43511
43702
|
const hashMultiplier = ( 1 + 1e-10 ) * 1e2;
|
|
43512
43703
|
|
|
43513
|
-
// reusable
|
|
43704
|
+
// reusable vectors
|
|
43514
43705
|
const verts = [ new Vector3(), new Vector3(), new Vector3() ];
|
|
43515
43706
|
const tempVec1 = new Vector3();
|
|
43516
43707
|
const tempVec2 = new Vector3();
|
|
@@ -43527,7 +43718,9 @@
|
|
|
43527
43718
|
|
|
43528
43719
|
}
|
|
43529
43720
|
|
|
43530
|
-
|
|
43721
|
+
// BufferGeometry.toNonIndexed() warns if the geometry is non-indexed
|
|
43722
|
+
// and returns the original geometry
|
|
43723
|
+
const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;
|
|
43531
43724
|
const posAttr = resultGeometry.attributes.position;
|
|
43532
43725
|
const vertexMap = {};
|
|
43533
43726
|
|
|
@@ -66953,12 +67146,20 @@
|
|
|
66953
67146
|
margin: margin,
|
|
66954
67147
|
curvatureResolution: curvatureResolution
|
|
66955
67148
|
};
|
|
67149
|
+
var memD = {
|
|
67150
|
+
geoJson: geoJson,
|
|
67151
|
+
h3Res: h3Res
|
|
67152
|
+
};
|
|
66956
67153
|
var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
|
|
66957
67154
|
alt: -1e-3
|
|
66958
67155
|
});
|
|
67156
|
+
var currentMemD = obj.__currentMemD || memD;
|
|
66959
67157
|
if (Object.keys(targetD).some(function (k) {
|
|
66960
67158
|
return currentTargetD[k] !== targetD[k];
|
|
67159
|
+
}) || Object.keys(memD).some(function (k) {
|
|
67160
|
+
return currentMemD[k] !== memD[k];
|
|
66961
67161
|
})) {
|
|
67162
|
+
obj.__currentMemD = memD;
|
|
66962
67163
|
var h3Idxs = [];
|
|
66963
67164
|
if (geoJson.type === 'Polygon') {
|
|
66964
67165
|
polygonToCells(geoJson.coordinates, h3Res, true).forEach(function (idx) {
|
|
@@ -69357,6 +69558,9 @@
|
|
|
69357
69558
|
const _changeEvent$1 = { type: 'change' };
|
|
69358
69559
|
const _startEvent = { type: 'start' };
|
|
69359
69560
|
const _endEvent = { type: 'end' };
|
|
69561
|
+
const _ray = new Ray();
|
|
69562
|
+
const _plane = new Plane();
|
|
69563
|
+
const TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD );
|
|
69360
69564
|
|
|
69361
69565
|
class OrbitControls extends EventDispatcher {
|
|
69362
69566
|
|
|
@@ -69411,6 +69615,7 @@
|
|
|
69411
69615
|
this.panSpeed = 1.0;
|
|
69412
69616
|
this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
|
|
69413
69617
|
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
|
|
69618
|
+
this.zoomToCursor = false;
|
|
69414
69619
|
|
|
69415
69620
|
// Set to true to automatically rotate around the target
|
|
69416
69621
|
// If auto-rotate is enabled, you must call controls.update() in your animation loop
|
|
@@ -69569,11 +69774,6 @@
|
|
|
69569
69774
|
spherical.makeSafe();
|
|
69570
69775
|
|
|
69571
69776
|
|
|
69572
|
-
spherical.radius *= scale;
|
|
69573
|
-
|
|
69574
|
-
// restrict radius to be between desired limits
|
|
69575
|
-
spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
|
|
69576
|
-
|
|
69577
69777
|
// move target to panned location
|
|
69578
69778
|
|
|
69579
69779
|
if ( scope.enableDamping === true ) {
|
|
@@ -69586,6 +69786,19 @@
|
|
|
69586
69786
|
|
|
69587
69787
|
}
|
|
69588
69788
|
|
|
69789
|
+
// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
|
|
69790
|
+
// we adjust zoom later in these cases
|
|
69791
|
+
if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {
|
|
69792
|
+
|
|
69793
|
+
spherical.radius = clampDistance( spherical.radius );
|
|
69794
|
+
|
|
69795
|
+
} else {
|
|
69796
|
+
|
|
69797
|
+
spherical.radius = clampDistance( spherical.radius * scale );
|
|
69798
|
+
|
|
69799
|
+
}
|
|
69800
|
+
|
|
69801
|
+
|
|
69589
69802
|
offset.setFromSpherical( spherical );
|
|
69590
69803
|
|
|
69591
69804
|
// rotate offset back to "camera-up-vector-is-up" space
|
|
@@ -69610,7 +69823,91 @@
|
|
|
69610
69823
|
|
|
69611
69824
|
}
|
|
69612
69825
|
|
|
69826
|
+
// adjust camera position
|
|
69827
|
+
let zoomChanged = false;
|
|
69828
|
+
if ( scope.zoomToCursor && performCursorZoom ) {
|
|
69829
|
+
|
|
69830
|
+
let newRadius = null;
|
|
69831
|
+
if ( scope.object.isPerspectiveCamera ) {
|
|
69832
|
+
|
|
69833
|
+
// move the camera down the pointer ray
|
|
69834
|
+
// this method avoids floating point error
|
|
69835
|
+
const prevRadius = offset.length();
|
|
69836
|
+
newRadius = clampDistance( prevRadius * scale );
|
|
69837
|
+
|
|
69838
|
+
const radiusDelta = prevRadius - newRadius;
|
|
69839
|
+
scope.object.position.addScaledVector( dollyDirection, radiusDelta );
|
|
69840
|
+
scope.object.updateMatrixWorld();
|
|
69841
|
+
|
|
69842
|
+
} else if ( scope.object.isOrthographicCamera ) {
|
|
69843
|
+
|
|
69844
|
+
// adjust the ortho camera position based on zoom changes
|
|
69845
|
+
const mouseBefore = new Vector3( mouse.x, mouse.y, 0 );
|
|
69846
|
+
mouseBefore.unproject( scope.object );
|
|
69847
|
+
|
|
69848
|
+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
|
|
69849
|
+
scope.object.updateProjectionMatrix();
|
|
69850
|
+
zoomChanged = true;
|
|
69851
|
+
|
|
69852
|
+
const mouseAfter = new Vector3( mouse.x, mouse.y, 0 );
|
|
69853
|
+
mouseAfter.unproject( scope.object );
|
|
69854
|
+
|
|
69855
|
+
scope.object.position.sub( mouseAfter ).add( mouseBefore );
|
|
69856
|
+
scope.object.updateMatrixWorld();
|
|
69857
|
+
|
|
69858
|
+
newRadius = offset.length();
|
|
69859
|
+
|
|
69860
|
+
} else {
|
|
69861
|
+
|
|
69862
|
+
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' );
|
|
69863
|
+
scope.zoomToCursor = false;
|
|
69864
|
+
|
|
69865
|
+
}
|
|
69866
|
+
|
|
69867
|
+
// handle the placement of the target
|
|
69868
|
+
if ( newRadius !== null ) {
|
|
69869
|
+
|
|
69870
|
+
if ( this.screenSpacePanning ) {
|
|
69871
|
+
|
|
69872
|
+
// position the orbit target in front of the new camera position
|
|
69873
|
+
scope.target.set( 0, 0, - 1 )
|
|
69874
|
+
.transformDirection( scope.object.matrix )
|
|
69875
|
+
.multiplyScalar( newRadius )
|
|
69876
|
+
.add( scope.object.position );
|
|
69877
|
+
|
|
69878
|
+
} else {
|
|
69879
|
+
|
|
69880
|
+
// get the ray and translation plane to compute target
|
|
69881
|
+
_ray.origin.copy( scope.object.position );
|
|
69882
|
+
_ray.direction.set( 0, 0, - 1 ).transformDirection( scope.object.matrix );
|
|
69883
|
+
|
|
69884
|
+
// if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid
|
|
69885
|
+
// extremely large values
|
|
69886
|
+
if ( Math.abs( scope.object.up.dot( _ray.direction ) ) < TILT_LIMIT ) {
|
|
69887
|
+
|
|
69888
|
+
object.lookAt( scope.target );
|
|
69889
|
+
|
|
69890
|
+
} else {
|
|
69891
|
+
|
|
69892
|
+
_plane.setFromNormalAndCoplanarPoint( scope.object.up, scope.target );
|
|
69893
|
+
_ray.intersectPlane( _plane, scope.target );
|
|
69894
|
+
|
|
69895
|
+
}
|
|
69896
|
+
|
|
69897
|
+
}
|
|
69898
|
+
|
|
69899
|
+
}
|
|
69900
|
+
|
|
69901
|
+
} else if ( scope.object.isOrthographicCamera ) {
|
|
69902
|
+
|
|
69903
|
+
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
|
|
69904
|
+
scope.object.updateProjectionMatrix();
|
|
69905
|
+
zoomChanged = true;
|
|
69906
|
+
|
|
69907
|
+
}
|
|
69908
|
+
|
|
69613
69909
|
scale = 1;
|
|
69910
|
+
performCursorZoom = false;
|
|
69614
69911
|
|
|
69615
69912
|
// update condition is:
|
|
69616
69913
|
// min(camera displacement, camera rotation in radians)^2 > EPS
|
|
@@ -69689,7 +69986,6 @@
|
|
|
69689
69986
|
|
|
69690
69987
|
let scale = 1;
|
|
69691
69988
|
const panOffset = new Vector3();
|
|
69692
|
-
let zoomChanged = false;
|
|
69693
69989
|
|
|
69694
69990
|
const rotateStart = new Vector2();
|
|
69695
69991
|
const rotateEnd = new Vector2();
|
|
@@ -69703,6 +69999,10 @@
|
|
|
69703
69999
|
const dollyEnd = new Vector2();
|
|
69704
70000
|
const dollyDelta = new Vector2();
|
|
69705
70001
|
|
|
70002
|
+
const dollyDirection = new Vector3();
|
|
70003
|
+
const mouse = new Vector2();
|
|
70004
|
+
let performCursorZoom = false;
|
|
70005
|
+
|
|
69706
70006
|
const pointers = [];
|
|
69707
70007
|
const pointerPositions = {};
|
|
69708
70008
|
|
|
@@ -69813,16 +70113,10 @@
|
|
|
69813
70113
|
|
|
69814
70114
|
function dollyOut( dollyScale ) {
|
|
69815
70115
|
|
|
69816
|
-
if ( scope.object.isPerspectiveCamera ) {
|
|
70116
|
+
if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {
|
|
69817
70117
|
|
|
69818
70118
|
scale /= dollyScale;
|
|
69819
70119
|
|
|
69820
|
-
} else if ( scope.object.isOrthographicCamera ) {
|
|
69821
|
-
|
|
69822
|
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
|
|
69823
|
-
scope.object.updateProjectionMatrix();
|
|
69824
|
-
zoomChanged = true;
|
|
69825
|
-
|
|
69826
70120
|
} else {
|
|
69827
70121
|
|
|
69828
70122
|
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
|
@@ -69834,16 +70128,10 @@
|
|
|
69834
70128
|
|
|
69835
70129
|
function dollyIn( dollyScale ) {
|
|
69836
70130
|
|
|
69837
|
-
if ( scope.object.isPerspectiveCamera ) {
|
|
70131
|
+
if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {
|
|
69838
70132
|
|
|
69839
70133
|
scale *= dollyScale;
|
|
69840
70134
|
|
|
69841
|
-
} else if ( scope.object.isOrthographicCamera ) {
|
|
69842
|
-
|
|
69843
|
-
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
|
|
69844
|
-
scope.object.updateProjectionMatrix();
|
|
69845
|
-
zoomChanged = true;
|
|
69846
|
-
|
|
69847
70135
|
} else {
|
|
69848
70136
|
|
|
69849
70137
|
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
|
|
@@ -69853,6 +70141,35 @@
|
|
|
69853
70141
|
|
|
69854
70142
|
}
|
|
69855
70143
|
|
|
70144
|
+
function updateMouseParameters( event ) {
|
|
70145
|
+
|
|
70146
|
+
if ( ! scope.zoomToCursor ) {
|
|
70147
|
+
|
|
70148
|
+
return;
|
|
70149
|
+
|
|
70150
|
+
}
|
|
70151
|
+
|
|
70152
|
+
performCursorZoom = true;
|
|
70153
|
+
|
|
70154
|
+
const rect = scope.domElement.getBoundingClientRect();
|
|
70155
|
+
const x = event.clientX - rect.left;
|
|
70156
|
+
const y = event.clientY - rect.top;
|
|
70157
|
+
const w = rect.width;
|
|
70158
|
+
const h = rect.height;
|
|
70159
|
+
|
|
70160
|
+
mouse.x = ( x / w ) * 2 - 1;
|
|
70161
|
+
mouse.y = - ( y / h ) * 2 + 1;
|
|
70162
|
+
|
|
70163
|
+
dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( object ).sub( object.position ).normalize();
|
|
70164
|
+
|
|
70165
|
+
}
|
|
70166
|
+
|
|
70167
|
+
function clampDistance( dist ) {
|
|
70168
|
+
|
|
70169
|
+
return Math.max( scope.minDistance, Math.min( scope.maxDistance, dist ) );
|
|
70170
|
+
|
|
70171
|
+
}
|
|
70172
|
+
|
|
69856
70173
|
//
|
|
69857
70174
|
// event callbacks - update the object state
|
|
69858
70175
|
//
|
|
@@ -69865,6 +70182,7 @@
|
|
|
69865
70182
|
|
|
69866
70183
|
function handleMouseDownDolly( event ) {
|
|
69867
70184
|
|
|
70185
|
+
updateMouseParameters( event );
|
|
69868
70186
|
dollyStart.set( event.clientX, event.clientY );
|
|
69869
70187
|
|
|
69870
70188
|
}
|
|
@@ -69931,6 +70249,8 @@
|
|
|
69931
70249
|
|
|
69932
70250
|
function handleMouseWheel( event ) {
|
|
69933
70251
|
|
|
70252
|
+
updateMouseParameters( event );
|
|
70253
|
+
|
|
69934
70254
|
if ( event.deltaY < 0 ) {
|
|
69935
70255
|
|
|
69936
70256
|
dollyIn( getZoomScale() );
|
|
@@ -71148,11 +71468,14 @@
|
|
|
71148
71468
|
if ( this.clear ) renderer.clear();
|
|
71149
71469
|
renderer.render( this.scene, this.camera );
|
|
71150
71470
|
|
|
71151
|
-
// unlock color and depth buffer for subsequent rendering
|
|
71471
|
+
// unlock color and depth buffer and make them writable for subsequent rendering/clearing
|
|
71152
71472
|
|
|
71153
71473
|
state.buffers.color.setLocked( false );
|
|
71154
71474
|
state.buffers.depth.setLocked( false );
|
|
71155
71475
|
|
|
71476
|
+
state.buffers.color.setMask( true );
|
|
71477
|
+
state.buffers.depth.setMask( true );
|
|
71478
|
+
|
|
71156
71479
|
// only render where stencil is set to 1
|
|
71157
71480
|
|
|
71158
71481
|
state.buffers.stencil.setLocked( false );
|
|
@@ -73439,9 +73762,10 @@
|
|
|
73439
73762
|
return d;
|
|
73440
73763
|
}
|
|
73441
73764
|
};
|
|
73765
|
+
state.renderObjs.renderer().useLegacyLights = false; // force behavior of three < 155
|
|
73442
73766
|
state.renderObjs.objects([
|
|
73443
73767
|
// Populate scene
|
|
73444
|
-
new THREE.AmbientLight(0xcccccc), new THREE.DirectionalLight(0xffffff, 0.6), state.globe]).hoverOrderComparator(function (a, b) {
|
|
73768
|
+
new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI), state.globe]).hoverOrderComparator(function (a, b) {
|
|
73445
73769
|
var aObj = getGlobeObj(a);
|
|
73446
73770
|
var bObj = getGlobeObj(b);
|
|
73447
73771
|
|