react-globe.gl 2.21.1 → 2.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/react-globe.gl.js +1213 -934
- package/dist/react-globe.gl.js.map +1 -1
- package/dist/react-globe.gl.min.js +4 -4
- package/package.json +1 -1
package/dist/react-globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.21.
|
|
1
|
+
// Version 2.21.2 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) :
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
* Copyright 2010-2022 Three.js Authors
|
|
309
309
|
* SPDX-License-Identifier: MIT
|
|
310
310
|
*/
|
|
311
|
-
const REVISION = '
|
|
311
|
+
const REVISION = '138';
|
|
312
312
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
313
313
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
314
314
|
const CullFaceNone = 0;
|
|
@@ -2327,6 +2327,125 @@
|
|
|
2327
2327
|
|
|
2328
2328
|
}
|
|
2329
2329
|
|
|
2330
|
+
class Source {
|
|
2331
|
+
|
|
2332
|
+
constructor( data = null ) {
|
|
2333
|
+
|
|
2334
|
+
this.uuid = generateUUID();
|
|
2335
|
+
|
|
2336
|
+
this.data = data;
|
|
2337
|
+
|
|
2338
|
+
this.version = 0;
|
|
2339
|
+
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
set needsUpdate( value ) {
|
|
2343
|
+
|
|
2344
|
+
if ( value === true ) this.version ++;
|
|
2345
|
+
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
toJSON( meta ) {
|
|
2349
|
+
|
|
2350
|
+
const isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
2351
|
+
|
|
2352
|
+
if ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {
|
|
2353
|
+
|
|
2354
|
+
return meta.images[ this.uuid ];
|
|
2355
|
+
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
const output = {
|
|
2359
|
+
uuid: this.uuid,
|
|
2360
|
+
url: ''
|
|
2361
|
+
};
|
|
2362
|
+
|
|
2363
|
+
const data = this.data;
|
|
2364
|
+
|
|
2365
|
+
if ( data !== null ) {
|
|
2366
|
+
|
|
2367
|
+
let url;
|
|
2368
|
+
|
|
2369
|
+
if ( Array.isArray( data ) ) {
|
|
2370
|
+
|
|
2371
|
+
// cube texture
|
|
2372
|
+
|
|
2373
|
+
url = [];
|
|
2374
|
+
|
|
2375
|
+
for ( let i = 0, l = data.length; i < l; i ++ ) {
|
|
2376
|
+
|
|
2377
|
+
if ( data[ i ].isDataTexture ) {
|
|
2378
|
+
|
|
2379
|
+
url.push( serializeImage( data[ i ].image ) );
|
|
2380
|
+
|
|
2381
|
+
} else {
|
|
2382
|
+
|
|
2383
|
+
url.push( serializeImage( data[ i ] ) );
|
|
2384
|
+
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
} else {
|
|
2390
|
+
|
|
2391
|
+
// texture
|
|
2392
|
+
|
|
2393
|
+
url = serializeImage( data );
|
|
2394
|
+
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
output.url = url;
|
|
2398
|
+
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
if ( ! isRootObject ) {
|
|
2402
|
+
|
|
2403
|
+
meta.images[ this.uuid ] = output;
|
|
2404
|
+
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
return output;
|
|
2408
|
+
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
function serializeImage( image ) {
|
|
2414
|
+
|
|
2415
|
+
if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
|
|
2416
|
+
( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
|
|
2417
|
+
( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
|
|
2418
|
+
|
|
2419
|
+
// default images
|
|
2420
|
+
|
|
2421
|
+
return ImageUtils.getDataURL( image );
|
|
2422
|
+
|
|
2423
|
+
} else {
|
|
2424
|
+
|
|
2425
|
+
if ( image.data ) {
|
|
2426
|
+
|
|
2427
|
+
// images of DataTexture
|
|
2428
|
+
|
|
2429
|
+
return {
|
|
2430
|
+
data: Array.prototype.slice.call( image.data ),
|
|
2431
|
+
width: image.width,
|
|
2432
|
+
height: image.height,
|
|
2433
|
+
type: image.data.constructor.name
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
} else {
|
|
2437
|
+
|
|
2438
|
+
console.warn( 'THREE.Texture: Unable to serialize Texture.' );
|
|
2439
|
+
return {};
|
|
2440
|
+
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
Source.prototype.isSource = true;
|
|
2448
|
+
|
|
2330
2449
|
let textureId = 0;
|
|
2331
2450
|
|
|
2332
2451
|
class Texture extends EventDispatcher {
|
|
@@ -2341,7 +2460,7 @@
|
|
|
2341
2460
|
|
|
2342
2461
|
this.name = '';
|
|
2343
2462
|
|
|
2344
|
-
this.
|
|
2463
|
+
this.source = new Source( image );
|
|
2345
2464
|
this.mipmaps = [];
|
|
2346
2465
|
|
|
2347
2466
|
this.mapping = mapping;
|
|
@@ -2387,6 +2506,18 @@
|
|
|
2387
2506
|
|
|
2388
2507
|
}
|
|
2389
2508
|
|
|
2509
|
+
get image() {
|
|
2510
|
+
|
|
2511
|
+
return this.source.data;
|
|
2512
|
+
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
set image( value ) {
|
|
2516
|
+
|
|
2517
|
+
this.source.data = value;
|
|
2518
|
+
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2390
2521
|
updateMatrix() {
|
|
2391
2522
|
|
|
2392
2523
|
this.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );
|
|
@@ -2403,7 +2534,7 @@
|
|
|
2403
2534
|
|
|
2404
2535
|
this.name = source.name;
|
|
2405
2536
|
|
|
2406
|
-
this.
|
|
2537
|
+
this.source = source.source;
|
|
2407
2538
|
this.mipmaps = source.mipmaps.slice( 0 );
|
|
2408
2539
|
|
|
2409
2540
|
this.mapping = source.mapping;
|
|
@@ -2461,6 +2592,8 @@
|
|
|
2461
2592
|
uuid: this.uuid,
|
|
2462
2593
|
name: this.name,
|
|
2463
2594
|
|
|
2595
|
+
image: this.source.toJSON( meta ).uuid,
|
|
2596
|
+
|
|
2464
2597
|
mapping: this.mapping,
|
|
2465
2598
|
|
|
2466
2599
|
repeat: [ this.repeat.x, this.repeat.y ],
|
|
@@ -2485,63 +2618,6 @@
|
|
|
2485
2618
|
|
|
2486
2619
|
};
|
|
2487
2620
|
|
|
2488
|
-
if ( this.image !== undefined ) {
|
|
2489
|
-
|
|
2490
|
-
// TODO: Move to THREE.Image
|
|
2491
|
-
|
|
2492
|
-
const image = this.image;
|
|
2493
|
-
|
|
2494
|
-
if ( image.uuid === undefined ) {
|
|
2495
|
-
|
|
2496
|
-
image.uuid = generateUUID(); // UGH
|
|
2497
|
-
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
if ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {
|
|
2501
|
-
|
|
2502
|
-
let url;
|
|
2503
|
-
|
|
2504
|
-
if ( Array.isArray( image ) ) {
|
|
2505
|
-
|
|
2506
|
-
// process array of images e.g. CubeTexture
|
|
2507
|
-
|
|
2508
|
-
url = [];
|
|
2509
|
-
|
|
2510
|
-
for ( let i = 0, l = image.length; i < l; i ++ ) {
|
|
2511
|
-
|
|
2512
|
-
// check cube texture with data textures
|
|
2513
|
-
|
|
2514
|
-
if ( image[ i ].isDataTexture ) {
|
|
2515
|
-
|
|
2516
|
-
url.push( serializeImage( image[ i ].image ) );
|
|
2517
|
-
|
|
2518
|
-
} else {
|
|
2519
|
-
|
|
2520
|
-
url.push( serializeImage( image[ i ] ) );
|
|
2521
|
-
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
}
|
|
2525
|
-
|
|
2526
|
-
} else {
|
|
2527
|
-
|
|
2528
|
-
// process single image
|
|
2529
|
-
|
|
2530
|
-
url = serializeImage( image );
|
|
2531
|
-
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
meta.images[ image.uuid ] = {
|
|
2535
|
-
uuid: image.uuid,
|
|
2536
|
-
url: url
|
|
2537
|
-
};
|
|
2538
|
-
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
output.image = image.uuid;
|
|
2542
|
-
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
2621
|
if ( JSON.stringify( this.userData ) !== '{}' ) output.userData = this.userData;
|
|
2546
2622
|
|
|
2547
2623
|
if ( ! isRootObject ) {
|
|
@@ -2642,51 +2718,22 @@
|
|
|
2642
2718
|
|
|
2643
2719
|
set needsUpdate( value ) {
|
|
2644
2720
|
|
|
2645
|
-
if ( value === true )
|
|
2721
|
+
if ( value === true ) {
|
|
2722
|
+
|
|
2723
|
+
this.version ++;
|
|
2724
|
+
this.source.needsUpdate = true;
|
|
2725
|
+
|
|
2726
|
+
}
|
|
2646
2727
|
|
|
2647
2728
|
}
|
|
2648
2729
|
|
|
2649
2730
|
}
|
|
2650
2731
|
|
|
2651
|
-
Texture.DEFAULT_IMAGE =
|
|
2732
|
+
Texture.DEFAULT_IMAGE = null;
|
|
2652
2733
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
2653
2734
|
|
|
2654
2735
|
Texture.prototype.isTexture = true;
|
|
2655
2736
|
|
|
2656
|
-
function serializeImage( image ) {
|
|
2657
|
-
|
|
2658
|
-
if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
|
|
2659
|
-
( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
|
|
2660
|
-
( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
|
|
2661
|
-
|
|
2662
|
-
// default images
|
|
2663
|
-
|
|
2664
|
-
return ImageUtils.getDataURL( image );
|
|
2665
|
-
|
|
2666
|
-
} else {
|
|
2667
|
-
|
|
2668
|
-
if ( image.data ) {
|
|
2669
|
-
|
|
2670
|
-
// images of DataTexture
|
|
2671
|
-
|
|
2672
|
-
return {
|
|
2673
|
-
data: Array.prototype.slice.call( image.data ),
|
|
2674
|
-
width: image.width,
|
|
2675
|
-
height: image.height,
|
|
2676
|
-
type: image.data.constructor.name
|
|
2677
|
-
};
|
|
2678
|
-
|
|
2679
|
-
} else {
|
|
2680
|
-
|
|
2681
|
-
console.warn( 'THREE.Texture: Unable to serialize Texture.' );
|
|
2682
|
-
return {};
|
|
2683
|
-
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
2737
|
class Vector4 {
|
|
2691
2738
|
|
|
2692
2739
|
constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
@@ -3370,10 +3417,10 @@
|
|
|
3370
3417
|
|
|
3371
3418
|
this.viewport = new Vector4( 0, 0, width, height );
|
|
3372
3419
|
|
|
3373
|
-
|
|
3374
|
-
this.texture.isRenderTargetTexture = true;
|
|
3420
|
+
const image = { width: width, height: height, depth: 1 };
|
|
3375
3421
|
|
|
3376
|
-
this.texture
|
|
3422
|
+
this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
|
|
3423
|
+
this.texture.isRenderTargetTexture = true;
|
|
3377
3424
|
|
|
3378
3425
|
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
|
|
3379
3426
|
this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
|
|
@@ -3381,19 +3428,10 @@
|
|
|
3381
3428
|
|
|
3382
3429
|
this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
|
|
3383
3430
|
this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
|
|
3384
|
-
this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
|
|
3385
|
-
|
|
3386
|
-
}
|
|
3387
3431
|
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
texture.image = {
|
|
3391
|
-
width: this.width,
|
|
3392
|
-
height: this.height,
|
|
3393
|
-
depth: this.depth
|
|
3394
|
-
};
|
|
3432
|
+
this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
|
|
3395
3433
|
|
|
3396
|
-
this.
|
|
3434
|
+
this.samples = options.samples !== undefined ? options.samples : 0;
|
|
3397
3435
|
|
|
3398
3436
|
}
|
|
3399
3437
|
|
|
@@ -3440,7 +3478,10 @@
|
|
|
3440
3478
|
|
|
3441
3479
|
this.depthBuffer = source.depthBuffer;
|
|
3442
3480
|
this.stencilBuffer = source.stencilBuffer;
|
|
3443
|
-
|
|
3481
|
+
|
|
3482
|
+
if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
|
|
3483
|
+
|
|
3484
|
+
this.samples = source.samples;
|
|
3444
3485
|
|
|
3445
3486
|
return this;
|
|
3446
3487
|
|
|
@@ -3456,12 +3497,102 @@
|
|
|
3456
3497
|
|
|
3457
3498
|
WebGLRenderTarget.prototype.isWebGLRenderTarget = true;
|
|
3458
3499
|
|
|
3459
|
-
class
|
|
3500
|
+
class DataArrayTexture extends Texture {
|
|
3501
|
+
|
|
3502
|
+
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
3503
|
+
|
|
3504
|
+
super( null );
|
|
3505
|
+
|
|
3506
|
+
this.image = { data, width, height, depth };
|
|
3507
|
+
|
|
3508
|
+
this.magFilter = NearestFilter;
|
|
3509
|
+
this.minFilter = NearestFilter;
|
|
3460
3510
|
|
|
3461
|
-
|
|
3511
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
3512
|
+
|
|
3513
|
+
this.generateMipmaps = false;
|
|
3514
|
+
this.flipY = false;
|
|
3515
|
+
this.unpackAlignment = 1;
|
|
3516
|
+
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
DataArrayTexture.prototype.isDataArrayTexture = true;
|
|
3522
|
+
|
|
3523
|
+
class WebGLArrayRenderTarget extends WebGLRenderTarget {
|
|
3524
|
+
|
|
3525
|
+
constructor( width, height, depth ) {
|
|
3526
|
+
|
|
3527
|
+
super( width, height );
|
|
3528
|
+
|
|
3529
|
+
this.depth = depth;
|
|
3530
|
+
|
|
3531
|
+
this.texture = new DataArrayTexture( null, width, height, depth );
|
|
3532
|
+
|
|
3533
|
+
this.texture.isRenderTargetTexture = true;
|
|
3534
|
+
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
WebGLArrayRenderTarget.prototype.isWebGLArrayRenderTarget = true;
|
|
3540
|
+
|
|
3541
|
+
class Data3DTexture extends Texture {
|
|
3542
|
+
|
|
3543
|
+
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
3544
|
+
|
|
3545
|
+
// We're going to add .setXXX() methods for setting properties later.
|
|
3546
|
+
// Users can still set in DataTexture3D directly.
|
|
3547
|
+
//
|
|
3548
|
+
// const texture = new THREE.DataTexture3D( data, width, height, depth );
|
|
3549
|
+
// texture.anisotropy = 16;
|
|
3550
|
+
//
|
|
3551
|
+
// See #14839
|
|
3552
|
+
|
|
3553
|
+
super( null );
|
|
3554
|
+
|
|
3555
|
+
this.image = { data, width, height, depth };
|
|
3556
|
+
|
|
3557
|
+
this.magFilter = NearestFilter;
|
|
3558
|
+
this.minFilter = NearestFilter;
|
|
3559
|
+
|
|
3560
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
3561
|
+
|
|
3562
|
+
this.generateMipmaps = false;
|
|
3563
|
+
this.flipY = false;
|
|
3564
|
+
this.unpackAlignment = 1;
|
|
3565
|
+
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
Data3DTexture.prototype.isData3DTexture = true;
|
|
3571
|
+
|
|
3572
|
+
class WebGL3DRenderTarget extends WebGLRenderTarget {
|
|
3573
|
+
|
|
3574
|
+
constructor( width, height, depth ) {
|
|
3462
3575
|
|
|
3463
3576
|
super( width, height );
|
|
3464
3577
|
|
|
3578
|
+
this.depth = depth;
|
|
3579
|
+
|
|
3580
|
+
this.texture = new Data3DTexture( null, width, height, depth );
|
|
3581
|
+
|
|
3582
|
+
this.texture.isRenderTargetTexture = true;
|
|
3583
|
+
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3588
|
+
WebGL3DRenderTarget.prototype.isWebGL3DRenderTarget = true;
|
|
3589
|
+
|
|
3590
|
+
class WebGLMultipleRenderTargets extends WebGLRenderTarget {
|
|
3591
|
+
|
|
3592
|
+
constructor( width, height, count, options = {} ) {
|
|
3593
|
+
|
|
3594
|
+
super( width, height, options );
|
|
3595
|
+
|
|
3465
3596
|
const texture = this.texture;
|
|
3466
3597
|
|
|
3467
3598
|
this.texture = [];
|
|
@@ -3532,36 +3663,6 @@
|
|
|
3532
3663
|
|
|
3533
3664
|
WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;
|
|
3534
3665
|
|
|
3535
|
-
class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
|
|
3536
|
-
|
|
3537
|
-
constructor( width, height, options = {} ) {
|
|
3538
|
-
|
|
3539
|
-
super( width, height, options );
|
|
3540
|
-
|
|
3541
|
-
this.samples = 4;
|
|
3542
|
-
|
|
3543
|
-
this.ignoreDepthForMultisampleCopy = options.ignoreDepth !== undefined ? options.ignoreDepth : true;
|
|
3544
|
-
this.useRenderToTexture = ( options.useRenderToTexture !== undefined ) ? options.useRenderToTexture : false;
|
|
3545
|
-
this.useRenderbuffer = this.useRenderToTexture === false;
|
|
3546
|
-
|
|
3547
|
-
}
|
|
3548
|
-
|
|
3549
|
-
copy( source ) {
|
|
3550
|
-
|
|
3551
|
-
super.copy.call( this, source );
|
|
3552
|
-
|
|
3553
|
-
this.samples = source.samples;
|
|
3554
|
-
this.useRenderToTexture = source.useRenderToTexture;
|
|
3555
|
-
this.useRenderbuffer = source.useRenderbuffer;
|
|
3556
|
-
|
|
3557
|
-
return this;
|
|
3558
|
-
|
|
3559
|
-
}
|
|
3560
|
-
|
|
3561
|
-
}
|
|
3562
|
-
|
|
3563
|
-
WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true;
|
|
3564
|
-
|
|
3565
3666
|
class Quaternion {
|
|
3566
3667
|
|
|
3567
3668
|
constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
@@ -4906,6 +5007,16 @@
|
|
|
4906
5007
|
|
|
4907
5008
|
}
|
|
4908
5009
|
|
|
5010
|
+
setFromEuler( e ) {
|
|
5011
|
+
|
|
5012
|
+
this.x = e._x;
|
|
5013
|
+
this.y = e._y;
|
|
5014
|
+
this.z = e._z;
|
|
5015
|
+
|
|
5016
|
+
return this;
|
|
5017
|
+
|
|
5018
|
+
}
|
|
5019
|
+
|
|
4909
5020
|
equals( v ) {
|
|
4910
5021
|
|
|
4911
5022
|
return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
|
|
@@ -7402,20 +7513,6 @@
|
|
|
7402
7513
|
|
|
7403
7514
|
}
|
|
7404
7515
|
|
|
7405
|
-
toVector3( optionalResult ) {
|
|
7406
|
-
|
|
7407
|
-
if ( optionalResult ) {
|
|
7408
|
-
|
|
7409
|
-
return optionalResult.set( this._x, this._y, this._z );
|
|
7410
|
-
|
|
7411
|
-
} else {
|
|
7412
|
-
|
|
7413
|
-
return new Vector3( this._x, this._y, this._z );
|
|
7414
|
-
|
|
7415
|
-
}
|
|
7416
|
-
|
|
7417
|
-
}
|
|
7418
|
-
|
|
7419
7516
|
_onChange( callback ) {
|
|
7420
7517
|
|
|
7421
7518
|
this._onChangeCallback = callback;
|
|
@@ -8130,7 +8227,8 @@
|
|
|
8130
8227
|
images: {},
|
|
8131
8228
|
shapes: {},
|
|
8132
8229
|
skeletons: {},
|
|
8133
|
-
animations: {}
|
|
8230
|
+
animations: {},
|
|
8231
|
+
nodes: {}
|
|
8134
8232
|
};
|
|
8135
8233
|
|
|
8136
8234
|
output.metadata = {
|
|
@@ -8314,6 +8412,7 @@
|
|
|
8314
8412
|
const shapes = extractFromCache( meta.shapes );
|
|
8315
8413
|
const skeletons = extractFromCache( meta.skeletons );
|
|
8316
8414
|
const animations = extractFromCache( meta.animations );
|
|
8415
|
+
const nodes = extractFromCache( meta.nodes );
|
|
8317
8416
|
|
|
8318
8417
|
if ( geometries.length > 0 ) output.geometries = geometries;
|
|
8319
8418
|
if ( materials.length > 0 ) output.materials = materials;
|
|
@@ -8322,6 +8421,7 @@
|
|
|
8322
8421
|
if ( shapes.length > 0 ) output.shapes = shapes;
|
|
8323
8422
|
if ( skeletons.length > 0 ) output.skeletons = skeletons;
|
|
8324
8423
|
if ( animations.length > 0 ) output.animations = animations;
|
|
8424
|
+
if ( nodes.length > 0 ) output.nodes = nodes;
|
|
8325
8425
|
|
|
8326
8426
|
}
|
|
8327
8427
|
|
|
@@ -8859,9 +8959,9 @@
|
|
|
8859
8959
|
|
|
8860
8960
|
toJSON( meta ) {
|
|
8861
8961
|
|
|
8862
|
-
const
|
|
8962
|
+
const isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
8863
8963
|
|
|
8864
|
-
if (
|
|
8964
|
+
if ( isRootObject ) {
|
|
8865
8965
|
|
|
8866
8966
|
meta = {
|
|
8867
8967
|
textures: {},
|
|
@@ -9021,13 +9121,13 @@
|
|
|
9021
9121
|
data.stencilZPass = this.stencilZPass;
|
|
9022
9122
|
|
|
9023
9123
|
// rotation (SpriteMaterial)
|
|
9024
|
-
if ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation;
|
|
9124
|
+
if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
|
|
9025
9125
|
|
|
9026
9126
|
if ( this.polygonOffset === true ) data.polygonOffset = true;
|
|
9027
9127
|
if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
|
|
9028
9128
|
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
9029
9129
|
|
|
9030
|
-
if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;
|
|
9130
|
+
if ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;
|
|
9031
9131
|
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
|
|
9032
9132
|
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
|
|
9033
9133
|
if ( this.scale !== undefined ) data.scale = this.scale;
|
|
@@ -9069,7 +9169,7 @@
|
|
|
9069
9169
|
|
|
9070
9170
|
}
|
|
9071
9171
|
|
|
9072
|
-
if (
|
|
9172
|
+
if ( isRootObject ) {
|
|
9073
9173
|
|
|
9074
9174
|
const textures = extractFromCache( meta.textures );
|
|
9075
9175
|
const images = extractFromCache( meta.images );
|
|
@@ -9184,6 +9284,14 @@
|
|
|
9184
9284
|
|
|
9185
9285
|
Material.prototype.isMaterial = true;
|
|
9186
9286
|
|
|
9287
|
+
Material.fromType = function ( /*type*/ ) {
|
|
9288
|
+
|
|
9289
|
+
// TODO: Behavior added in Materials.js
|
|
9290
|
+
|
|
9291
|
+
return null;
|
|
9292
|
+
|
|
9293
|
+
};
|
|
9294
|
+
|
|
9187
9295
|
/**
|
|
9188
9296
|
* parameters = {
|
|
9189
9297
|
* color: <hex>,
|
|
@@ -10212,13 +10320,13 @@
|
|
|
10212
10320
|
|
|
10213
10321
|
const nVertices = positions.length / 3;
|
|
10214
10322
|
|
|
10215
|
-
if (
|
|
10323
|
+
if ( this.hasAttribute( 'tangent' ) === false ) {
|
|
10216
10324
|
|
|
10217
10325
|
this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
|
|
10218
10326
|
|
|
10219
10327
|
}
|
|
10220
10328
|
|
|
10221
|
-
const tangents =
|
|
10329
|
+
const tangents = this.getAttribute( 'tangent' ).array;
|
|
10222
10330
|
|
|
10223
10331
|
const tan1 = [], tan2 = [];
|
|
10224
10332
|
|
|
@@ -12109,19 +12217,14 @@
|
|
|
12109
12217
|
|
|
12110
12218
|
class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
12111
12219
|
|
|
12112
|
-
constructor( size, options
|
|
12113
|
-
|
|
12114
|
-
if ( Number.isInteger( options ) ) {
|
|
12115
|
-
|
|
12116
|
-
console.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );
|
|
12117
|
-
|
|
12118
|
-
options = dummy;
|
|
12119
|
-
|
|
12120
|
-
}
|
|
12220
|
+
constructor( size, options = {} ) {
|
|
12121
12221
|
|
|
12122
12222
|
super( size, size, options );
|
|
12123
12223
|
|
|
12124
|
-
|
|
12224
|
+
const image = { width: size, height: size, depth: 1 };
|
|
12225
|
+
const images = [ image, image, image, image, image, image ];
|
|
12226
|
+
|
|
12227
|
+
this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
|
|
12125
12228
|
|
|
12126
12229
|
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
12127
12230
|
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
@@ -12131,7 +12234,6 @@
|
|
|
12131
12234
|
// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
|
|
12132
12235
|
// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).
|
|
12133
12236
|
|
|
12134
|
-
this.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
|
|
12135
12237
|
this.texture.isRenderTargetTexture = true;
|
|
12136
12238
|
|
|
12137
12239
|
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
|
|
@@ -12677,16 +12779,12 @@
|
|
|
12677
12779
|
|
|
12678
12780
|
attribute.onUploadCallback();
|
|
12679
12781
|
|
|
12680
|
-
let type
|
|
12782
|
+
let type;
|
|
12681
12783
|
|
|
12682
12784
|
if ( array instanceof Float32Array ) {
|
|
12683
12785
|
|
|
12684
12786
|
type = 5126;
|
|
12685
12787
|
|
|
12686
|
-
} else if ( array instanceof Float64Array ) {
|
|
12687
|
-
|
|
12688
|
-
console.warn( 'THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.' );
|
|
12689
|
-
|
|
12690
12788
|
} else if ( array instanceof Uint16Array ) {
|
|
12691
12789
|
|
|
12692
12790
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -12697,7 +12795,7 @@
|
|
|
12697
12795
|
|
|
12698
12796
|
} else {
|
|
12699
12797
|
|
|
12700
|
-
|
|
12798
|
+
throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
|
|
12701
12799
|
|
|
12702
12800
|
}
|
|
12703
12801
|
|
|
@@ -12731,6 +12829,10 @@
|
|
|
12731
12829
|
|
|
12732
12830
|
type = 5121;
|
|
12733
12831
|
|
|
12832
|
+
} else {
|
|
12833
|
+
|
|
12834
|
+
throw new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );
|
|
12835
|
+
|
|
12734
12836
|
}
|
|
12735
12837
|
|
|
12736
12838
|
return {
|
|
@@ -12971,7 +13073,7 @@
|
|
|
12971
13073
|
|
|
12972
13074
|
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
|
|
12973
13075
|
|
|
12974
|
-
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define
|
|
13076
|
+
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
12975
13077
|
|
|
12976
13078
|
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
|
|
12977
13079
|
|
|
@@ -13055,11 +13157,13 @@
|
|
|
13055
13157
|
|
|
13056
13158
|
var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
|
|
13057
13159
|
|
|
13058
|
-
var
|
|
13160
|
+
var morphcolor_vertex = "#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]\n\t\t#endif\n\t}\n#endif";
|
|
13161
|
+
|
|
13162
|
+
var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
|
|
13059
13163
|
|
|
13060
|
-
var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\
|
|
13164
|
+
var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tfloat texelIndex = float( vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
|
|
13061
13165
|
|
|
13062
|
-
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\
|
|
13166
|
+
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
|
|
13063
13167
|
|
|
13064
13168
|
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
|
|
13065
13169
|
|
|
@@ -13121,7 +13225,7 @@
|
|
|
13121
13225
|
|
|
13122
13226
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif";
|
|
13123
13227
|
|
|
13124
|
-
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef
|
|
13228
|
+
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
|
|
13125
13229
|
|
|
13126
13230
|
var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
|
|
13127
13231
|
|
|
@@ -13157,19 +13261,19 @@
|
|
|
13157
13261
|
|
|
13158
13262
|
const fragment$c = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
|
|
13159
13263
|
|
|
13160
|
-
const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
|
|
13264
|
+
const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
|
|
13161
13265
|
|
|
13162
13266
|
const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
|
|
13163
13267
|
|
|
13164
|
-
const vertex$a = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13268
|
+
const vertex$a = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13165
13269
|
|
|
13166
13270
|
const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13167
13271
|
|
|
13168
|
-
const vertex$9 = "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13272
|
+
const vertex$9 = "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13169
13273
|
|
|
13170
13274
|
const fragment$9 = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13171
13275
|
|
|
13172
|
-
const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
|
|
13276
|
+
const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
|
|
13173
13277
|
|
|
13174
13278
|
const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13175
13279
|
|
|
@@ -13177,19 +13281,19 @@
|
|
|
13177
13281
|
|
|
13178
13282
|
const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
|
|
13179
13283
|
|
|
13180
|
-
const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13284
|
+
const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13181
13285
|
|
|
13182
13286
|
const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13183
13287
|
|
|
13184
|
-
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
|
|
13288
|
+
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
|
|
13185
13289
|
|
|
13186
13290
|
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13187
13291
|
|
|
13188
|
-
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13292
|
+
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13189
13293
|
|
|
13190
13294
|
const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13191
13295
|
|
|
13192
|
-
const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
|
|
13296
|
+
const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
|
|
13193
13297
|
|
|
13194
13298
|
const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
|
|
13195
13299
|
|
|
@@ -13263,6 +13367,7 @@
|
|
|
13263
13367
|
map_particle_pars_fragment: map_particle_pars_fragment,
|
|
13264
13368
|
metalnessmap_fragment: metalnessmap_fragment,
|
|
13265
13369
|
metalnessmap_pars_fragment: metalnessmap_pars_fragment,
|
|
13370
|
+
morphcolor_vertex: morphcolor_vertex,
|
|
13266
13371
|
morphnormal_vertex: morphnormal_vertex,
|
|
13267
13372
|
morphtarget_pars_vertex: morphtarget_pars_vertex,
|
|
13268
13373
|
morphtarget_vertex: morphtarget_vertex,
|
|
@@ -14436,7 +14541,7 @@
|
|
|
14436
14541
|
const stride = data.stride;
|
|
14437
14542
|
const offset = geometryAttribute.offset;
|
|
14438
14543
|
|
|
14439
|
-
if ( data
|
|
14544
|
+
if ( data.isInstancedInterleavedBuffer ) {
|
|
14440
14545
|
|
|
14441
14546
|
for ( let i = 0; i < programAttribute.locationSize; i ++ ) {
|
|
14442
14547
|
|
|
@@ -15241,23 +15346,7 @@
|
|
|
15241
15346
|
|
|
15242
15347
|
OrthographicCamera.prototype.isOrthographicCamera = true;
|
|
15243
15348
|
|
|
15244
|
-
class RawShaderMaterial extends ShaderMaterial {
|
|
15245
|
-
|
|
15246
|
-
constructor( parameters ) {
|
|
15247
|
-
|
|
15248
|
-
super( parameters );
|
|
15249
|
-
|
|
15250
|
-
this.type = 'RawShaderMaterial';
|
|
15251
|
-
|
|
15252
|
-
}
|
|
15253
|
-
|
|
15254
|
-
}
|
|
15255
|
-
|
|
15256
|
-
RawShaderMaterial.prototype.isRawShaderMaterial = true;
|
|
15257
|
-
|
|
15258
15349
|
const LOD_MIN = 4;
|
|
15259
|
-
const LOD_MAX = 8;
|
|
15260
|
-
const SIZE_MAX = Math.pow( 2, LOD_MAX );
|
|
15261
15350
|
|
|
15262
15351
|
// The standard deviations (radians) associated with the extra mips. These are
|
|
15263
15352
|
// chosen to approximate a Trowbridge-Reitz distribution function times the
|
|
@@ -15265,14 +15354,11 @@
|
|
|
15265
15354
|
// variance #defines in cube_uv_reflection_fragment.glsl.js.
|
|
15266
15355
|
const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];
|
|
15267
15356
|
|
|
15268
|
-
const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;
|
|
15269
|
-
|
|
15270
15357
|
// The maximum length of the blur for loop. Smaller sigmas will use fewer
|
|
15271
15358
|
// samples and exit early, but not recompile the shader.
|
|
15272
15359
|
const MAX_SAMPLES = 20;
|
|
15273
15360
|
|
|
15274
15361
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
15275
|
-
const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes();
|
|
15276
15362
|
const _clearColor = /*@__PURE__*/ new Color$1();
|
|
15277
15363
|
let _oldTarget = null;
|
|
15278
15364
|
|
|
@@ -15316,9 +15402,15 @@
|
|
|
15316
15402
|
this._renderer = renderer;
|
|
15317
15403
|
this._pingPongRenderTarget = null;
|
|
15318
15404
|
|
|
15319
|
-
this.
|
|
15320
|
-
this.
|
|
15321
|
-
this.
|
|
15405
|
+
this._lodMax = 0;
|
|
15406
|
+
this._cubeSize = 0;
|
|
15407
|
+
this._lodPlanes = [];
|
|
15408
|
+
this._sizeLods = [];
|
|
15409
|
+
this._sigmas = [];
|
|
15410
|
+
|
|
15411
|
+
this._blurMaterial = null;
|
|
15412
|
+
this._cubemapMaterial = null;
|
|
15413
|
+
this._equirectMaterial = null;
|
|
15322
15414
|
|
|
15323
15415
|
this._compileMaterial( this._blurMaterial );
|
|
15324
15416
|
|
|
@@ -15334,9 +15426,14 @@
|
|
|
15334
15426
|
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
|
|
15335
15427
|
|
|
15336
15428
|
_oldTarget = this._renderer.getRenderTarget();
|
|
15429
|
+
|
|
15430
|
+
this._setSize( 256 );
|
|
15431
|
+
|
|
15337
15432
|
const cubeUVRenderTarget = this._allocateTargets();
|
|
15433
|
+
cubeUVRenderTarget.depthBuffer = true;
|
|
15338
15434
|
|
|
15339
15435
|
this._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );
|
|
15436
|
+
|
|
15340
15437
|
if ( sigma > 0 ) {
|
|
15341
15438
|
|
|
15342
15439
|
this._blur( cubeUVRenderTarget, 0, 0, sigma );
|
|
@@ -15378,10 +15475,10 @@
|
|
|
15378
15475
|
*/
|
|
15379
15476
|
compileCubemapShader() {
|
|
15380
15477
|
|
|
15381
|
-
if ( this.
|
|
15478
|
+
if ( this._cubemapMaterial === null ) {
|
|
15382
15479
|
|
|
15383
|
-
this.
|
|
15384
|
-
this._compileMaterial( this.
|
|
15480
|
+
this._cubemapMaterial = _getCubemapMaterial();
|
|
15481
|
+
this._compileMaterial( this._cubemapMaterial );
|
|
15385
15482
|
|
|
15386
15483
|
}
|
|
15387
15484
|
|
|
@@ -15393,10 +15490,10 @@
|
|
|
15393
15490
|
*/
|
|
15394
15491
|
compileEquirectangularShader() {
|
|
15395
15492
|
|
|
15396
|
-
if ( this.
|
|
15493
|
+
if ( this._equirectMaterial === null ) {
|
|
15397
15494
|
|
|
15398
|
-
this.
|
|
15399
|
-
this._compileMaterial( this.
|
|
15495
|
+
this._equirectMaterial = _getEquirectMaterial();
|
|
15496
|
+
this._compileMaterial( this._equirectMaterial );
|
|
15400
15497
|
|
|
15401
15498
|
}
|
|
15402
15499
|
|
|
@@ -15409,23 +15506,36 @@
|
|
|
15409
15506
|
*/
|
|
15410
15507
|
dispose() {
|
|
15411
15508
|
|
|
15509
|
+
this._dispose();
|
|
15510
|
+
|
|
15511
|
+
if ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();
|
|
15512
|
+
if ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();
|
|
15513
|
+
|
|
15514
|
+
}
|
|
15515
|
+
|
|
15516
|
+
// private interface
|
|
15517
|
+
|
|
15518
|
+
_setSize( cubeSize ) {
|
|
15519
|
+
|
|
15520
|
+
this._lodMax = Math.floor( Math.log2( cubeSize ) );
|
|
15521
|
+
this._cubeSize = Math.pow( 2, this._lodMax );
|
|
15522
|
+
|
|
15523
|
+
}
|
|
15524
|
+
|
|
15525
|
+
_dispose() {
|
|
15526
|
+
|
|
15412
15527
|
this._blurMaterial.dispose();
|
|
15413
15528
|
|
|
15414
15529
|
if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
|
|
15415
15530
|
|
|
15416
|
-
|
|
15417
|
-
if ( this._equirectShader !== null ) this._equirectShader.dispose();
|
|
15531
|
+
for ( let i = 0; i < this._lodPlanes.length; i ++ ) {
|
|
15418
15532
|
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
_lodPlanes[ i ].dispose();
|
|
15533
|
+
this._lodPlanes[ i ].dispose();
|
|
15422
15534
|
|
|
15423
15535
|
}
|
|
15424
15536
|
|
|
15425
15537
|
}
|
|
15426
15538
|
|
|
15427
|
-
// private interface
|
|
15428
|
-
|
|
15429
15539
|
_cleanup( outputTarget ) {
|
|
15430
15540
|
|
|
15431
15541
|
this._renderer.setRenderTarget( _oldTarget );
|
|
@@ -15436,8 +15546,19 @@
|
|
|
15436
15546
|
|
|
15437
15547
|
_fromTexture( texture, renderTarget ) {
|
|
15438
15548
|
|
|
15549
|
+
if ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {
|
|
15550
|
+
|
|
15551
|
+
this._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );
|
|
15552
|
+
|
|
15553
|
+
} else { // Equirectangular
|
|
15554
|
+
|
|
15555
|
+
this._setSize( texture.image.width / 4 );
|
|
15556
|
+
|
|
15557
|
+
}
|
|
15558
|
+
|
|
15439
15559
|
_oldTarget = this._renderer.getRenderTarget();
|
|
15440
|
-
|
|
15560
|
+
|
|
15561
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
15441
15562
|
this._textureToCubeUV( texture, cubeUVRenderTarget );
|
|
15442
15563
|
this._applyPMREM( cubeUVRenderTarget );
|
|
15443
15564
|
this._cleanup( cubeUVRenderTarget );
|
|
@@ -15446,7 +15567,10 @@
|
|
|
15446
15567
|
|
|
15447
15568
|
}
|
|
15448
15569
|
|
|
15449
|
-
_allocateTargets(
|
|
15570
|
+
_allocateTargets() {
|
|
15571
|
+
|
|
15572
|
+
const width = 3 * Math.max( this._cubeSize, 16 * 7 );
|
|
15573
|
+
const height = 4 * this._cubeSize - 32;
|
|
15450
15574
|
|
|
15451
15575
|
const params = {
|
|
15452
15576
|
magFilter: LinearFilter,
|
|
@@ -15458,12 +15582,22 @@
|
|
|
15458
15582
|
depthBuffer: false
|
|
15459
15583
|
};
|
|
15460
15584
|
|
|
15461
|
-
const cubeUVRenderTarget = _createRenderTarget( params );
|
|
15462
|
-
cubeUVRenderTarget.depthBuffer = texture ? false : true;
|
|
15585
|
+
const cubeUVRenderTarget = _createRenderTarget( width, height, params );
|
|
15463
15586
|
|
|
15464
|
-
if ( this._pingPongRenderTarget === null ) {
|
|
15587
|
+
if ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width ) {
|
|
15465
15588
|
|
|
15466
|
-
this._pingPongRenderTarget
|
|
15589
|
+
if ( this._pingPongRenderTarget !== null ) {
|
|
15590
|
+
|
|
15591
|
+
this._dispose();
|
|
15592
|
+
|
|
15593
|
+
}
|
|
15594
|
+
|
|
15595
|
+
this._pingPongRenderTarget = _createRenderTarget( width, height, params );
|
|
15596
|
+
|
|
15597
|
+
const { _lodMax } = this;
|
|
15598
|
+
( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
|
|
15599
|
+
|
|
15600
|
+
this._blurMaterial = _getBlurShader( _lodMax, width, height );
|
|
15467
15601
|
|
|
15468
15602
|
}
|
|
15469
15603
|
|
|
@@ -15473,7 +15607,7 @@
|
|
|
15473
15607
|
|
|
15474
15608
|
_compileMaterial( material ) {
|
|
15475
15609
|
|
|
15476
|
-
const tmpMesh = new Mesh( _lodPlanes[ 0 ], material );
|
|
15610
|
+
const tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );
|
|
15477
15611
|
this._renderer.compile( tmpMesh, _flatCamera );
|
|
15478
15612
|
|
|
15479
15613
|
}
|
|
@@ -15526,6 +15660,7 @@
|
|
|
15526
15660
|
for ( let i = 0; i < 6; i ++ ) {
|
|
15527
15661
|
|
|
15528
15662
|
const col = i % 3;
|
|
15663
|
+
|
|
15529
15664
|
if ( col === 0 ) {
|
|
15530
15665
|
|
|
15531
15666
|
cubeCamera.up.set( 0, upSign[ i ], 0 );
|
|
@@ -15543,8 +15678,10 @@
|
|
|
15543
15678
|
|
|
15544
15679
|
}
|
|
15545
15680
|
|
|
15546
|
-
|
|
15547
|
-
|
|
15681
|
+
const size = this._cubeSize;
|
|
15682
|
+
|
|
15683
|
+
_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );
|
|
15684
|
+
|
|
15548
15685
|
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
15549
15686
|
|
|
15550
15687
|
if ( useSolidColor ) {
|
|
@@ -15574,38 +15711,34 @@
|
|
|
15574
15711
|
|
|
15575
15712
|
if ( isCubeTexture ) {
|
|
15576
15713
|
|
|
15577
|
-
if ( this.
|
|
15714
|
+
if ( this._cubemapMaterial === null ) {
|
|
15578
15715
|
|
|
15579
|
-
this.
|
|
15716
|
+
this._cubemapMaterial = _getCubemapMaterial();
|
|
15580
15717
|
|
|
15581
15718
|
}
|
|
15582
15719
|
|
|
15583
|
-
this.
|
|
15720
|
+
this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;
|
|
15584
15721
|
|
|
15585
15722
|
} else {
|
|
15586
15723
|
|
|
15587
|
-
if ( this.
|
|
15724
|
+
if ( this._equirectMaterial === null ) {
|
|
15588
15725
|
|
|
15589
|
-
this.
|
|
15726
|
+
this._equirectMaterial = _getEquirectMaterial();
|
|
15590
15727
|
|
|
15591
15728
|
}
|
|
15592
15729
|
|
|
15593
15730
|
}
|
|
15594
15731
|
|
|
15595
|
-
const material = isCubeTexture ? this.
|
|
15596
|
-
const mesh = new Mesh( _lodPlanes[ 0 ], material );
|
|
15732
|
+
const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;
|
|
15733
|
+
const mesh = new Mesh( this._lodPlanes[ 0 ], material );
|
|
15597
15734
|
|
|
15598
15735
|
const uniforms = material.uniforms;
|
|
15599
15736
|
|
|
15600
15737
|
uniforms[ 'envMap' ].value = texture;
|
|
15601
15738
|
|
|
15602
|
-
|
|
15739
|
+
const size = this._cubeSize;
|
|
15603
15740
|
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
}
|
|
15607
|
-
|
|
15608
|
-
_setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );
|
|
15741
|
+
_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );
|
|
15609
15742
|
|
|
15610
15743
|
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
15611
15744
|
renderer.render( mesh, _flatCamera );
|
|
@@ -15618,9 +15751,9 @@
|
|
|
15618
15751
|
const autoClear = renderer.autoClear;
|
|
15619
15752
|
renderer.autoClear = false;
|
|
15620
15753
|
|
|
15621
|
-
for ( let i = 1; i <
|
|
15754
|
+
for ( let i = 1; i < this._lodPlanes.length; i ++ ) {
|
|
15622
15755
|
|
|
15623
|
-
const sigma = Math.sqrt( _sigmas[ i ] * _sigmas[ i ] - _sigmas[ i - 1 ] * _sigmas[ i - 1 ] );
|
|
15756
|
+
const sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );
|
|
15624
15757
|
|
|
15625
15758
|
const poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];
|
|
15626
15759
|
|
|
@@ -15678,10 +15811,10 @@
|
|
|
15678
15811
|
// Number of standard deviations at which to cut off the discrete approximation.
|
|
15679
15812
|
const STANDARD_DEVIATIONS = 3;
|
|
15680
15813
|
|
|
15681
|
-
const blurMesh = new Mesh( _lodPlanes[ lodOut ], blurMaterial );
|
|
15814
|
+
const blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );
|
|
15682
15815
|
const blurUniforms = blurMaterial.uniforms;
|
|
15683
15816
|
|
|
15684
|
-
const pixels = _sizeLods[ lodIn ] - 1;
|
|
15817
|
+
const pixels = this._sizeLods[ lodIn ] - 1;
|
|
15685
15818
|
const radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );
|
|
15686
15819
|
const sigmaPixels = sigmaRadians / radiansPerPixel;
|
|
15687
15820
|
const samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;
|
|
@@ -15732,12 +15865,13 @@
|
|
|
15732
15865
|
|
|
15733
15866
|
}
|
|
15734
15867
|
|
|
15868
|
+
const { _lodMax } = this;
|
|
15735
15869
|
blurUniforms[ 'dTheta' ].value = radiansPerPixel;
|
|
15736
|
-
blurUniforms[ 'mipInt' ].value =
|
|
15870
|
+
blurUniforms[ 'mipInt' ].value = _lodMax - lodIn;
|
|
15737
15871
|
|
|
15738
|
-
const outputSize = _sizeLods[ lodOut ];
|
|
15739
|
-
const x = 3 *
|
|
15740
|
-
const y =
|
|
15872
|
+
const outputSize = this._sizeLods[ lodOut ];
|
|
15873
|
+
const x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );
|
|
15874
|
+
const y = 4 * ( this._cubeSize - outputSize );
|
|
15741
15875
|
|
|
15742
15876
|
_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );
|
|
15743
15877
|
renderer.setRenderTarget( targetOut );
|
|
@@ -15747,23 +15881,27 @@
|
|
|
15747
15881
|
|
|
15748
15882
|
}
|
|
15749
15883
|
|
|
15750
|
-
function _createPlanes() {
|
|
15751
15884
|
|
|
15752
|
-
const _lodPlanes = [];
|
|
15753
|
-
const _sizeLods = [];
|
|
15754
|
-
const _sigmas = [];
|
|
15755
15885
|
|
|
15756
|
-
|
|
15886
|
+
function _createPlanes( lodMax ) {
|
|
15887
|
+
|
|
15888
|
+
const lodPlanes = [];
|
|
15889
|
+
const sizeLods = [];
|
|
15890
|
+
const sigmas = [];
|
|
15891
|
+
|
|
15892
|
+
let lod = lodMax;
|
|
15757
15893
|
|
|
15758
|
-
|
|
15894
|
+
const totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;
|
|
15895
|
+
|
|
15896
|
+
for ( let i = 0; i < totalLods; i ++ ) {
|
|
15759
15897
|
|
|
15760
15898
|
const sizeLod = Math.pow( 2, lod );
|
|
15761
|
-
|
|
15899
|
+
sizeLods.push( sizeLod );
|
|
15762
15900
|
let sigma = 1.0 / sizeLod;
|
|
15763
15901
|
|
|
15764
|
-
if ( i >
|
|
15902
|
+
if ( i > lodMax - LOD_MIN ) {
|
|
15765
15903
|
|
|
15766
|
-
sigma = EXTRA_LOD_SIGMA[ i -
|
|
15904
|
+
sigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];
|
|
15767
15905
|
|
|
15768
15906
|
} else if ( i === 0 ) {
|
|
15769
15907
|
|
|
@@ -15771,7 +15909,7 @@
|
|
|
15771
15909
|
|
|
15772
15910
|
}
|
|
15773
15911
|
|
|
15774
|
-
|
|
15912
|
+
sigmas.push( sigma );
|
|
15775
15913
|
|
|
15776
15914
|
const texelSize = 1.0 / ( sizeLod - 1 );
|
|
15777
15915
|
const min = - texelSize / 2;
|
|
@@ -15811,7 +15949,7 @@
|
|
|
15811
15949
|
planes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );
|
|
15812
15950
|
planes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );
|
|
15813
15951
|
planes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );
|
|
15814
|
-
|
|
15952
|
+
lodPlanes.push( planes );
|
|
15815
15953
|
|
|
15816
15954
|
if ( lod > LOD_MIN ) {
|
|
15817
15955
|
|
|
@@ -15821,13 +15959,13 @@
|
|
|
15821
15959
|
|
|
15822
15960
|
}
|
|
15823
15961
|
|
|
15824
|
-
return {
|
|
15962
|
+
return { lodPlanes, sizeLods, sigmas };
|
|
15825
15963
|
|
|
15826
15964
|
}
|
|
15827
15965
|
|
|
15828
|
-
function _createRenderTarget( params ) {
|
|
15966
|
+
function _createRenderTarget( width, height, params ) {
|
|
15829
15967
|
|
|
15830
|
-
const cubeUVRenderTarget = new WebGLRenderTarget(
|
|
15968
|
+
const cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );
|
|
15831
15969
|
cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;
|
|
15832
15970
|
cubeUVRenderTarget.texture.name = 'PMREM.cubeUv';
|
|
15833
15971
|
cubeUVRenderTarget.scissorTest = true;
|
|
@@ -15842,15 +15980,20 @@
|
|
|
15842
15980
|
|
|
15843
15981
|
}
|
|
15844
15982
|
|
|
15845
|
-
function _getBlurShader(
|
|
15983
|
+
function _getBlurShader( lodMax, width, height ) {
|
|
15846
15984
|
|
|
15847
|
-
const weights = new Float32Array(
|
|
15985
|
+
const weights = new Float32Array( MAX_SAMPLES );
|
|
15848
15986
|
const poleAxis = new Vector3( 0, 1, 0 );
|
|
15849
|
-
const shaderMaterial = new
|
|
15987
|
+
const shaderMaterial = new ShaderMaterial( {
|
|
15850
15988
|
|
|
15851
15989
|
name: 'SphericalGaussianBlur',
|
|
15852
15990
|
|
|
15853
|
-
defines: {
|
|
15991
|
+
defines: {
|
|
15992
|
+
'n': MAX_SAMPLES,
|
|
15993
|
+
'CUBEUV_TEXEL_WIDTH': 1.0 / width,
|
|
15994
|
+
'CUBEUV_TEXEL_HEIGHT': 1.0 / height,
|
|
15995
|
+
'CUBEUV_MAX_MIP': `${lodMax}.0`,
|
|
15996
|
+
},
|
|
15854
15997
|
|
|
15855
15998
|
uniforms: {
|
|
15856
15999
|
'envMap': { value: null },
|
|
@@ -15936,16 +16079,14 @@
|
|
|
15936
16079
|
|
|
15937
16080
|
}
|
|
15938
16081
|
|
|
15939
|
-
function
|
|
16082
|
+
function _getEquirectMaterial() {
|
|
15940
16083
|
|
|
15941
|
-
|
|
15942
|
-
const shaderMaterial = new RawShaderMaterial( {
|
|
16084
|
+
return new ShaderMaterial( {
|
|
15943
16085
|
|
|
15944
16086
|
name: 'EquirectangularToCubeUV',
|
|
15945
16087
|
|
|
15946
16088
|
uniforms: {
|
|
15947
|
-
'envMap': { value: null }
|
|
15948
|
-
'texelSize': { value: texelSize }
|
|
16089
|
+
'envMap': { value: null }
|
|
15949
16090
|
},
|
|
15950
16091
|
|
|
15951
16092
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15958,30 +16099,15 @@
|
|
|
15958
16099
|
varying vec3 vOutputDirection;
|
|
15959
16100
|
|
|
15960
16101
|
uniform sampler2D envMap;
|
|
15961
|
-
uniform vec2 texelSize;
|
|
15962
16102
|
|
|
15963
16103
|
#include <common>
|
|
15964
16104
|
|
|
15965
16105
|
void main() {
|
|
15966
16106
|
|
|
15967
|
-
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
15968
|
-
|
|
15969
16107
|
vec3 outputDirection = normalize( vOutputDirection );
|
|
15970
16108
|
vec2 uv = equirectUv( outputDirection );
|
|
15971
16109
|
|
|
15972
|
-
|
|
15973
|
-
uv -= f * texelSize;
|
|
15974
|
-
vec3 tl = texture2D ( envMap, uv ).rgb;
|
|
15975
|
-
uv.x += texelSize.x;
|
|
15976
|
-
vec3 tr = texture2D ( envMap, uv ).rgb;
|
|
15977
|
-
uv.y += texelSize.y;
|
|
15978
|
-
vec3 br = texture2D ( envMap, uv ).rgb;
|
|
15979
|
-
uv.x -= texelSize.x;
|
|
15980
|
-
vec3 bl = texture2D ( envMap, uv ).rgb;
|
|
15981
|
-
|
|
15982
|
-
vec3 tm = mix( tl, tr, f.x );
|
|
15983
|
-
vec3 bm = mix( bl, br, f.x );
|
|
15984
|
-
gl_FragColor.rgb = mix( tm, bm, f.y );
|
|
16110
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
15985
16111
|
|
|
15986
16112
|
}
|
|
15987
16113
|
`,
|
|
@@ -15992,13 +16118,11 @@
|
|
|
15992
16118
|
|
|
15993
16119
|
} );
|
|
15994
16120
|
|
|
15995
|
-
return shaderMaterial;
|
|
15996
|
-
|
|
15997
16121
|
}
|
|
15998
16122
|
|
|
15999
|
-
function
|
|
16123
|
+
function _getCubemapMaterial() {
|
|
16000
16124
|
|
|
16001
|
-
|
|
16125
|
+
return new ShaderMaterial( {
|
|
16002
16126
|
|
|
16003
16127
|
name: 'CubemapToCubeUV',
|
|
16004
16128
|
|
|
@@ -16033,8 +16157,6 @@
|
|
|
16033
16157
|
|
|
16034
16158
|
} );
|
|
16035
16159
|
|
|
16036
|
-
return shaderMaterial;
|
|
16037
|
-
|
|
16038
16160
|
}
|
|
16039
16161
|
|
|
16040
16162
|
function _getCommonVertexShader() {
|
|
@@ -16044,8 +16166,6 @@
|
|
|
16044
16166
|
precision mediump float;
|
|
16045
16167
|
precision mediump int;
|
|
16046
16168
|
|
|
16047
|
-
attribute vec3 position;
|
|
16048
|
-
attribute vec2 uv;
|
|
16049
16169
|
attribute float faceIndex;
|
|
16050
16170
|
|
|
16051
16171
|
varying vec3 vOutputDirection;
|
|
@@ -16649,29 +16769,6 @@
|
|
|
16649
16769
|
|
|
16650
16770
|
}
|
|
16651
16771
|
|
|
16652
|
-
class DataTexture2DArray extends Texture {
|
|
16653
|
-
|
|
16654
|
-
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
16655
|
-
|
|
16656
|
-
super( null );
|
|
16657
|
-
|
|
16658
|
-
this.image = { data, width, height, depth };
|
|
16659
|
-
|
|
16660
|
-
this.magFilter = NearestFilter;
|
|
16661
|
-
this.minFilter = NearestFilter;
|
|
16662
|
-
|
|
16663
|
-
this.wrapR = ClampToEdgeWrapping;
|
|
16664
|
-
|
|
16665
|
-
this.generateMipmaps = false;
|
|
16666
|
-
this.flipY = false;
|
|
16667
|
-
this.unpackAlignment = 1;
|
|
16668
|
-
|
|
16669
|
-
}
|
|
16670
|
-
|
|
16671
|
-
}
|
|
16672
|
-
|
|
16673
|
-
DataTexture2DArray.prototype.isDataTexture2DArray = true;
|
|
16674
|
-
|
|
16675
16772
|
function numericalSort( a, b ) {
|
|
16676
16773
|
|
|
16677
16774
|
return a[ 0 ] - b[ 0 ];
|
|
@@ -16703,7 +16800,7 @@
|
|
|
16703
16800
|
const influencesList = {};
|
|
16704
16801
|
const morphInfluences = new Float32Array( 8 );
|
|
16705
16802
|
const morphTextures = new WeakMap();
|
|
16706
|
-
const morph = new
|
|
16803
|
+
const morph = new Vector4();
|
|
16707
16804
|
|
|
16708
16805
|
const workInfluences = [];
|
|
16709
16806
|
|
|
@@ -16722,23 +16819,30 @@
|
|
|
16722
16819
|
// instead of using attributes, the WebGL 2 code path encodes morph targets
|
|
16723
16820
|
// into an array of data textures. Each layer represents a single morph target.
|
|
16724
16821
|
|
|
16725
|
-
const
|
|
16822
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
16823
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
16726
16824
|
|
|
16727
16825
|
let entry = morphTextures.get( geometry );
|
|
16728
16826
|
|
|
16729
|
-
if ( entry === undefined || entry.count !==
|
|
16827
|
+
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
16730
16828
|
|
|
16731
16829
|
if ( entry !== undefined ) entry.texture.dispose();
|
|
16732
16830
|
|
|
16831
|
+
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
16733
16832
|
const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
|
|
16833
|
+
const hasMorphColors = geometry.morphAttributes.color !== undefined;
|
|
16734
16834
|
|
|
16735
|
-
const morphTargets = geometry.morphAttributes.position;
|
|
16835
|
+
const morphTargets = geometry.morphAttributes.position || [];
|
|
16736
16836
|
const morphNormals = geometry.morphAttributes.normal || [];
|
|
16837
|
+
const morphColors = geometry.morphAttributes.color || [];
|
|
16838
|
+
|
|
16839
|
+
let vertexDataCount = 0;
|
|
16737
16840
|
|
|
16738
|
-
|
|
16739
|
-
|
|
16841
|
+
if ( hasMorphPosition === true ) vertexDataCount = 1;
|
|
16842
|
+
if ( hasMorphNormals === true ) vertexDataCount = 2;
|
|
16843
|
+
if ( hasMorphColors === true ) vertexDataCount = 3;
|
|
16740
16844
|
|
|
16741
|
-
let width =
|
|
16845
|
+
let width = geometry.attributes.position.count * vertexDataCount;
|
|
16742
16846
|
let height = 1;
|
|
16743
16847
|
|
|
16744
16848
|
if ( width > capabilities.maxTextureSize ) {
|
|
@@ -16748,36 +16852,41 @@
|
|
|
16748
16852
|
|
|
16749
16853
|
}
|
|
16750
16854
|
|
|
16751
|
-
const buffer = new Float32Array( width * height * 4 *
|
|
16855
|
+
const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
|
|
16752
16856
|
|
|
16753
|
-
const texture = new
|
|
16857
|
+
const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
|
|
16754
16858
|
texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower)
|
|
16755
16859
|
texture.type = FloatType;
|
|
16756
16860
|
texture.needsUpdate = true;
|
|
16757
16861
|
|
|
16758
16862
|
// fill buffer
|
|
16759
16863
|
|
|
16760
|
-
const vertexDataStride =
|
|
16864
|
+
const vertexDataStride = vertexDataCount * 4;
|
|
16761
16865
|
|
|
16762
|
-
for ( let i = 0; i <
|
|
16866
|
+
for ( let i = 0; i < morphTargetsCount; i ++ ) {
|
|
16763
16867
|
|
|
16764
16868
|
const morphTarget = morphTargets[ i ];
|
|
16765
16869
|
const morphNormal = morphNormals[ i ];
|
|
16870
|
+
const morphColor = morphColors[ i ];
|
|
16766
16871
|
|
|
16767
16872
|
const offset = width * height * 4 * i;
|
|
16768
16873
|
|
|
16769
16874
|
for ( let j = 0; j < morphTarget.count; j ++ ) {
|
|
16770
16875
|
|
|
16771
|
-
|
|
16876
|
+
const stride = j * vertexDataStride;
|
|
16772
16877
|
|
|
16773
|
-
if (
|
|
16878
|
+
if ( hasMorphPosition === true ) {
|
|
16774
16879
|
|
|
16775
|
-
|
|
16880
|
+
morph.fromBufferAttribute( morphTarget, j );
|
|
16776
16881
|
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16882
|
+
if ( morphTarget.normalized === true ) denormalize( morph, morphTarget );
|
|
16883
|
+
|
|
16884
|
+
buffer[ offset + stride + 0 ] = morph.x;
|
|
16885
|
+
buffer[ offset + stride + 1 ] = morph.y;
|
|
16886
|
+
buffer[ offset + stride + 2 ] = morph.z;
|
|
16887
|
+
buffer[ offset + stride + 3 ] = 0;
|
|
16888
|
+
|
|
16889
|
+
}
|
|
16781
16890
|
|
|
16782
16891
|
if ( hasMorphNormals === true ) {
|
|
16783
16892
|
|
|
@@ -16792,12 +16901,25 @@
|
|
|
16792
16901
|
|
|
16793
16902
|
}
|
|
16794
16903
|
|
|
16904
|
+
if ( hasMorphColors === true ) {
|
|
16905
|
+
|
|
16906
|
+
morph.fromBufferAttribute( morphColor, j );
|
|
16907
|
+
|
|
16908
|
+
if ( morphColor.normalized === true ) denormalize( morph, morphNormal );
|
|
16909
|
+
|
|
16910
|
+
buffer[ offset + stride + 8 ] = morph.x;
|
|
16911
|
+
buffer[ offset + stride + 9 ] = morph.y;
|
|
16912
|
+
buffer[ offset + stride + 10 ] = morph.z;
|
|
16913
|
+
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
|
|
16914
|
+
|
|
16915
|
+
}
|
|
16916
|
+
|
|
16795
16917
|
}
|
|
16796
16918
|
|
|
16797
16919
|
}
|
|
16798
16920
|
|
|
16799
16921
|
entry = {
|
|
16800
|
-
count:
|
|
16922
|
+
count: morphTargetsCount,
|
|
16801
16923
|
texture: texture,
|
|
16802
16924
|
size: new Vector2( width, height )
|
|
16803
16925
|
};
|
|
@@ -17031,37 +17153,6 @@
|
|
|
17031
17153
|
|
|
17032
17154
|
}
|
|
17033
17155
|
|
|
17034
|
-
class DataTexture3D extends Texture {
|
|
17035
|
-
|
|
17036
|
-
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
17037
|
-
|
|
17038
|
-
// We're going to add .setXXX() methods for setting properties later.
|
|
17039
|
-
// Users can still set in DataTexture3D directly.
|
|
17040
|
-
//
|
|
17041
|
-
// const texture = new THREE.DataTexture3D( data, width, height, depth );
|
|
17042
|
-
// texture.anisotropy = 16;
|
|
17043
|
-
//
|
|
17044
|
-
// See #14839
|
|
17045
|
-
|
|
17046
|
-
super( null );
|
|
17047
|
-
|
|
17048
|
-
this.image = { data, width, height, depth };
|
|
17049
|
-
|
|
17050
|
-
this.magFilter = NearestFilter;
|
|
17051
|
-
this.minFilter = NearestFilter;
|
|
17052
|
-
|
|
17053
|
-
this.wrapR = ClampToEdgeWrapping;
|
|
17054
|
-
|
|
17055
|
-
this.generateMipmaps = false;
|
|
17056
|
-
this.flipY = false;
|
|
17057
|
-
this.unpackAlignment = 1;
|
|
17058
|
-
|
|
17059
|
-
}
|
|
17060
|
-
|
|
17061
|
-
}
|
|
17062
|
-
|
|
17063
|
-
DataTexture3D.prototype.isDataTexture3D = true;
|
|
17064
|
-
|
|
17065
17156
|
/**
|
|
17066
17157
|
* Uniforms of a program.
|
|
17067
17158
|
* Those form a tree structure with a special top-level container for the root,
|
|
@@ -17106,8 +17197,8 @@
|
|
|
17106
17197
|
*/
|
|
17107
17198
|
|
|
17108
17199
|
const emptyTexture = new Texture();
|
|
17109
|
-
const
|
|
17110
|
-
const
|
|
17200
|
+
const emptyArrayTexture = new DataArrayTexture();
|
|
17201
|
+
const empty3dTexture = new Data3DTexture();
|
|
17111
17202
|
const emptyCubeTexture = new CubeTexture();
|
|
17112
17203
|
|
|
17113
17204
|
// --- Utilities ---
|
|
@@ -17526,7 +17617,7 @@
|
|
|
17526
17617
|
|
|
17527
17618
|
}
|
|
17528
17619
|
|
|
17529
|
-
textures.
|
|
17620
|
+
textures.setTexture2D( v || emptyTexture, unit );
|
|
17530
17621
|
|
|
17531
17622
|
}
|
|
17532
17623
|
|
|
@@ -17542,7 +17633,7 @@
|
|
|
17542
17633
|
|
|
17543
17634
|
}
|
|
17544
17635
|
|
|
17545
|
-
textures.setTexture3D( v ||
|
|
17636
|
+
textures.setTexture3D( v || empty3dTexture, unit );
|
|
17546
17637
|
|
|
17547
17638
|
}
|
|
17548
17639
|
|
|
@@ -17558,7 +17649,7 @@
|
|
|
17558
17649
|
|
|
17559
17650
|
}
|
|
17560
17651
|
|
|
17561
|
-
textures.
|
|
17652
|
+
textures.setTextureCube( v || emptyCubeTexture, unit );
|
|
17562
17653
|
|
|
17563
17654
|
}
|
|
17564
17655
|
|
|
@@ -17574,7 +17665,7 @@
|
|
|
17574
17665
|
|
|
17575
17666
|
}
|
|
17576
17667
|
|
|
17577
|
-
textures.setTexture2DArray( v ||
|
|
17668
|
+
textures.setTexture2DArray( v || emptyArrayTexture, unit );
|
|
17578
17669
|
|
|
17579
17670
|
}
|
|
17580
17671
|
|
|
@@ -17761,7 +17852,7 @@
|
|
|
17761
17852
|
|
|
17762
17853
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17763
17854
|
|
|
17764
|
-
textures.
|
|
17855
|
+
textures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );
|
|
17765
17856
|
|
|
17766
17857
|
}
|
|
17767
17858
|
|
|
@@ -17777,7 +17868,7 @@
|
|
|
17777
17868
|
|
|
17778
17869
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17779
17870
|
|
|
17780
|
-
textures.setTexture3D( v[ i ] ||
|
|
17871
|
+
textures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );
|
|
17781
17872
|
|
|
17782
17873
|
}
|
|
17783
17874
|
|
|
@@ -17793,7 +17884,7 @@
|
|
|
17793
17884
|
|
|
17794
17885
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17795
17886
|
|
|
17796
|
-
textures.
|
|
17887
|
+
textures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );
|
|
17797
17888
|
|
|
17798
17889
|
}
|
|
17799
17890
|
|
|
@@ -17809,7 +17900,7 @@
|
|
|
17809
17900
|
|
|
17810
17901
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17811
17902
|
|
|
17812
|
-
textures.setTexture2DArray( v[ i ] ||
|
|
17903
|
+
textures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );
|
|
17813
17904
|
|
|
17814
17905
|
}
|
|
17815
17906
|
|
|
@@ -18178,7 +18269,7 @@
|
|
|
18178
18269
|
function generateExtensions( parameters ) {
|
|
18179
18270
|
|
|
18180
18271
|
const chunks = [
|
|
18181
|
-
( parameters.extensionDerivatives || parameters.
|
|
18272
|
+
( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
|
|
18182
18273
|
( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
|
|
18183
18274
|
( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
|
|
18184
18275
|
( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
|
|
@@ -18446,6 +18537,22 @@
|
|
|
18446
18537
|
|
|
18447
18538
|
}
|
|
18448
18539
|
|
|
18540
|
+
function generateCubeUVSize( parameters ) {
|
|
18541
|
+
|
|
18542
|
+
const imageHeight = parameters.envMapCubeUVHeight;
|
|
18543
|
+
|
|
18544
|
+
if ( imageHeight === null ) return null;
|
|
18545
|
+
|
|
18546
|
+
const maxMip = Math.log2( imageHeight / 32 + 1 ) + 3;
|
|
18547
|
+
|
|
18548
|
+
const texelHeight = 1.0 / imageHeight;
|
|
18549
|
+
|
|
18550
|
+
const texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );
|
|
18551
|
+
|
|
18552
|
+
return { texelWidth, texelHeight, maxMip };
|
|
18553
|
+
|
|
18554
|
+
}
|
|
18555
|
+
|
|
18449
18556
|
function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
18450
18557
|
|
|
18451
18558
|
// TODO Send this event to Three.js DevTools
|
|
@@ -18462,6 +18569,7 @@
|
|
|
18462
18569
|
const envMapTypeDefine = generateEnvMapTypeDefine( parameters );
|
|
18463
18570
|
const envMapModeDefine = generateEnvMapModeDefine( parameters );
|
|
18464
18571
|
const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
|
|
18572
|
+
const envMapCubeUVSize = generateCubeUVSize( parameters );
|
|
18465
18573
|
|
|
18466
18574
|
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
18467
18575
|
|
|
@@ -18563,8 +18671,10 @@
|
|
|
18563
18671
|
|
|
18564
18672
|
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
|
|
18565
18673
|
parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
|
|
18566
|
-
( parameters.
|
|
18567
|
-
( parameters.
|
|
18674
|
+
( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',
|
|
18675
|
+
( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',
|
|
18676
|
+
( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
|
|
18677
|
+
( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
|
|
18568
18678
|
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
|
|
18569
18679
|
parameters.flipSided ? '#define FLIP_SIDED' : '',
|
|
18570
18680
|
|
|
@@ -18671,6 +18781,9 @@
|
|
|
18671
18781
|
parameters.envMap ? '#define ' + envMapTypeDefine : '',
|
|
18672
18782
|
parameters.envMap ? '#define ' + envMapModeDefine : '',
|
|
18673
18783
|
parameters.envMap ? '#define ' + envMapBlendingDefine : '',
|
|
18784
|
+
envMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',
|
|
18785
|
+
envMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',
|
|
18786
|
+
envMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',
|
|
18674
18787
|
parameters.lightMap ? '#define USE_LIGHTMAP' : '',
|
|
18675
18788
|
parameters.aoMap ? '#define USE_AOMAP' : '',
|
|
18676
18789
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
@@ -18726,8 +18839,6 @@
|
|
|
18726
18839
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
18727
18840
|
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
18728
18841
|
|
|
18729
|
-
( ( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ) ? '#define TEXTURE_LOD_EXT' : '',
|
|
18730
|
-
|
|
18731
18842
|
'uniform mat4 viewMatrix;',
|
|
18732
18843
|
'uniform vec3 cameraPosition;',
|
|
18733
18844
|
'uniform bool isOrthographic;',
|
|
@@ -18737,7 +18848,7 @@
|
|
|
18737
18848
|
( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',
|
|
18738
18849
|
|
|
18739
18850
|
parameters.dithering ? '#define DITHERING' : '',
|
|
18740
|
-
parameters.
|
|
18851
|
+
parameters.opaque ? '#define OPAQUE' : '',
|
|
18741
18852
|
|
|
18742
18853
|
ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
18743
18854
|
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ),
|
|
@@ -19137,9 +19248,11 @@
|
|
|
19137
19248
|
function getParameters( material, lights, shadows, scene, object ) {
|
|
19138
19249
|
|
|
19139
19250
|
const fog = scene.fog;
|
|
19251
|
+
const geometry = object.geometry;
|
|
19140
19252
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
19141
19253
|
|
|
19142
19254
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
19255
|
+
const envMapCubeUVHeight = ( !! envMap ) && ( ( envMap.mapping === CubeUVReflectionMapping ) || ( envMap.mapping === CubeUVRefractionMapping ) ) ? envMap.image.height : null;
|
|
19143
19256
|
|
|
19144
19257
|
const shaderID = shaderIDs[ material.type ];
|
|
19145
19258
|
|
|
@@ -19160,6 +19273,19 @@
|
|
|
19160
19273
|
|
|
19161
19274
|
}
|
|
19162
19275
|
|
|
19276
|
+
//
|
|
19277
|
+
|
|
19278
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
19279
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
19280
|
+
|
|
19281
|
+
let morphTextureStride = 0;
|
|
19282
|
+
|
|
19283
|
+
if ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;
|
|
19284
|
+
if ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;
|
|
19285
|
+
if ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;
|
|
19286
|
+
|
|
19287
|
+
//
|
|
19288
|
+
|
|
19163
19289
|
let vertexShader, fragmentShader;
|
|
19164
19290
|
let customVertexShaderID, customFragmentShaderID;
|
|
19165
19291
|
|
|
@@ -19215,7 +19341,7 @@
|
|
|
19215
19341
|
matcap: !! material.matcap,
|
|
19216
19342
|
envMap: !! envMap,
|
|
19217
19343
|
envMapMode: envMap && envMap.mapping,
|
|
19218
|
-
|
|
19344
|
+
envMapCubeUVHeight: envMapCubeUVHeight,
|
|
19219
19345
|
lightMap: !! material.lightMap,
|
|
19220
19346
|
aoMap: !! material.aoMap,
|
|
19221
19347
|
emissiveMap: !! material.emissiveMap,
|
|
@@ -19238,7 +19364,7 @@
|
|
|
19238
19364
|
specularIntensityMap: !! material.specularIntensityMap,
|
|
19239
19365
|
specularColorMap: !! material.specularColorMap,
|
|
19240
19366
|
|
|
19241
|
-
|
|
19367
|
+
opaque: material.transparent === false && material.blending === NormalBlending,
|
|
19242
19368
|
|
|
19243
19369
|
alphaMap: !! material.alphaMap,
|
|
19244
19370
|
alphaTest: useAlphaTest,
|
|
@@ -19255,9 +19381,9 @@
|
|
|
19255
19381
|
|
|
19256
19382
|
combine: material.combine,
|
|
19257
19383
|
|
|
19258
|
-
vertexTangents: ( !! material.normalMap && !!
|
|
19384
|
+
vertexTangents: ( !! material.normalMap && !! geometry.attributes.tangent ),
|
|
19259
19385
|
vertexColors: material.vertexColors,
|
|
19260
|
-
vertexAlphas: material.vertexColors === true && !!
|
|
19386
|
+
vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
19261
19387
|
vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || !! material.sheenRoughnessMap,
|
|
19262
19388
|
uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
|
|
19263
19389
|
|
|
@@ -19274,9 +19400,11 @@
|
|
|
19274
19400
|
maxBones: maxBones,
|
|
19275
19401
|
useVertexTexture: floatVertexTextures,
|
|
19276
19402
|
|
|
19277
|
-
morphTargets:
|
|
19278
|
-
morphNormals:
|
|
19279
|
-
|
|
19403
|
+
morphTargets: geometry.morphAttributes.position !== undefined,
|
|
19404
|
+
morphNormals: geometry.morphAttributes.normal !== undefined,
|
|
19405
|
+
morphColors: geometry.morphAttributes.color !== undefined,
|
|
19406
|
+
morphTargetsCount: morphTargetsCount,
|
|
19407
|
+
morphTextureStride: morphTextureStride,
|
|
19280
19408
|
|
|
19281
19409
|
numDirLights: lights.directional.length,
|
|
19282
19410
|
numPointLights: lights.point.length,
|
|
@@ -19370,12 +19498,14 @@
|
|
|
19370
19498
|
array.push( parameters.precision );
|
|
19371
19499
|
array.push( parameters.outputEncoding );
|
|
19372
19500
|
array.push( parameters.envMapMode );
|
|
19501
|
+
array.push( parameters.envMapCubeUVHeight );
|
|
19373
19502
|
array.push( parameters.combine );
|
|
19374
19503
|
array.push( parameters.vertexUvs );
|
|
19375
19504
|
array.push( parameters.fogExp2 );
|
|
19376
19505
|
array.push( parameters.sizeAttenuation );
|
|
19377
19506
|
array.push( parameters.maxBones );
|
|
19378
19507
|
array.push( parameters.morphTargetsCount );
|
|
19508
|
+
array.push( parameters.morphAttributeCount );
|
|
19379
19509
|
array.push( parameters.numDirLights );
|
|
19380
19510
|
array.push( parameters.numPointLights );
|
|
19381
19511
|
array.push( parameters.numSpotLights );
|
|
@@ -19409,56 +19539,54 @@
|
|
|
19409
19539
|
_programLayers.enable( 5 );
|
|
19410
19540
|
if ( parameters.envMap )
|
|
19411
19541
|
_programLayers.enable( 6 );
|
|
19412
|
-
if ( parameters.envMapCubeUV )
|
|
19413
|
-
_programLayers.enable( 7 );
|
|
19414
19542
|
if ( parameters.lightMap )
|
|
19415
|
-
_programLayers.enable(
|
|
19543
|
+
_programLayers.enable( 7 );
|
|
19416
19544
|
if ( parameters.aoMap )
|
|
19417
|
-
_programLayers.enable(
|
|
19545
|
+
_programLayers.enable( 8 );
|
|
19418
19546
|
if ( parameters.emissiveMap )
|
|
19419
|
-
_programLayers.enable(
|
|
19547
|
+
_programLayers.enable( 9 );
|
|
19420
19548
|
if ( parameters.bumpMap )
|
|
19421
|
-
_programLayers.enable(
|
|
19549
|
+
_programLayers.enable( 10 );
|
|
19422
19550
|
if ( parameters.normalMap )
|
|
19423
|
-
_programLayers.enable(
|
|
19551
|
+
_programLayers.enable( 11 );
|
|
19424
19552
|
if ( parameters.objectSpaceNormalMap )
|
|
19425
|
-
_programLayers.enable(
|
|
19553
|
+
_programLayers.enable( 12 );
|
|
19426
19554
|
if ( parameters.tangentSpaceNormalMap )
|
|
19427
|
-
_programLayers.enable(
|
|
19555
|
+
_programLayers.enable( 13 );
|
|
19428
19556
|
if ( parameters.clearcoat )
|
|
19429
|
-
_programLayers.enable(
|
|
19557
|
+
_programLayers.enable( 14 );
|
|
19430
19558
|
if ( parameters.clearcoatMap )
|
|
19431
|
-
_programLayers.enable(
|
|
19559
|
+
_programLayers.enable( 15 );
|
|
19432
19560
|
if ( parameters.clearcoatRoughnessMap )
|
|
19433
|
-
_programLayers.enable(
|
|
19561
|
+
_programLayers.enable( 16 );
|
|
19434
19562
|
if ( parameters.clearcoatNormalMap )
|
|
19435
|
-
_programLayers.enable(
|
|
19563
|
+
_programLayers.enable( 17 );
|
|
19436
19564
|
if ( parameters.displacementMap )
|
|
19437
|
-
_programLayers.enable(
|
|
19565
|
+
_programLayers.enable( 18 );
|
|
19438
19566
|
if ( parameters.specularMap )
|
|
19439
|
-
_programLayers.enable(
|
|
19567
|
+
_programLayers.enable( 19 );
|
|
19440
19568
|
if ( parameters.roughnessMap )
|
|
19441
|
-
_programLayers.enable(
|
|
19569
|
+
_programLayers.enable( 20 );
|
|
19442
19570
|
if ( parameters.metalnessMap )
|
|
19443
|
-
_programLayers.enable(
|
|
19571
|
+
_programLayers.enable( 21 );
|
|
19444
19572
|
if ( parameters.gradientMap )
|
|
19445
|
-
_programLayers.enable(
|
|
19573
|
+
_programLayers.enable( 22 );
|
|
19446
19574
|
if ( parameters.alphaMap )
|
|
19447
|
-
_programLayers.enable(
|
|
19575
|
+
_programLayers.enable( 23 );
|
|
19448
19576
|
if ( parameters.alphaTest )
|
|
19449
|
-
_programLayers.enable(
|
|
19577
|
+
_programLayers.enable( 24 );
|
|
19450
19578
|
if ( parameters.vertexColors )
|
|
19451
|
-
_programLayers.enable(
|
|
19579
|
+
_programLayers.enable( 25 );
|
|
19452
19580
|
if ( parameters.vertexAlphas )
|
|
19453
|
-
_programLayers.enable(
|
|
19581
|
+
_programLayers.enable( 26 );
|
|
19454
19582
|
if ( parameters.vertexUvs )
|
|
19455
|
-
_programLayers.enable(
|
|
19583
|
+
_programLayers.enable( 27 );
|
|
19456
19584
|
if ( parameters.vertexTangents )
|
|
19457
|
-
_programLayers.enable(
|
|
19585
|
+
_programLayers.enable( 28 );
|
|
19458
19586
|
if ( parameters.uvsVertexOnly )
|
|
19459
|
-
_programLayers.enable(
|
|
19587
|
+
_programLayers.enable( 29 );
|
|
19460
19588
|
if ( parameters.fog )
|
|
19461
|
-
_programLayers.enable(
|
|
19589
|
+
_programLayers.enable( 30 );
|
|
19462
19590
|
|
|
19463
19591
|
array.push( _programLayers.mask );
|
|
19464
19592
|
_programLayers.disableAll();
|
|
@@ -19477,40 +19605,42 @@
|
|
|
19477
19605
|
_programLayers.enable( 5 );
|
|
19478
19606
|
if ( parameters.morphNormals )
|
|
19479
19607
|
_programLayers.enable( 6 );
|
|
19480
|
-
if ( parameters.
|
|
19608
|
+
if ( parameters.morphColors )
|
|
19481
19609
|
_programLayers.enable( 7 );
|
|
19482
|
-
if ( parameters.
|
|
19610
|
+
if ( parameters.premultipliedAlpha )
|
|
19483
19611
|
_programLayers.enable( 8 );
|
|
19484
|
-
if ( parameters.
|
|
19612
|
+
if ( parameters.shadowMapEnabled )
|
|
19485
19613
|
_programLayers.enable( 9 );
|
|
19486
|
-
if ( parameters.
|
|
19614
|
+
if ( parameters.physicallyCorrectLights )
|
|
19487
19615
|
_programLayers.enable( 10 );
|
|
19488
|
-
if ( parameters.
|
|
19616
|
+
if ( parameters.doubleSided )
|
|
19489
19617
|
_programLayers.enable( 11 );
|
|
19490
|
-
if ( parameters.
|
|
19618
|
+
if ( parameters.flipSided )
|
|
19491
19619
|
_programLayers.enable( 12 );
|
|
19492
|
-
if ( parameters.
|
|
19620
|
+
if ( parameters.depthPacking )
|
|
19493
19621
|
_programLayers.enable( 13 );
|
|
19494
|
-
if ( parameters.
|
|
19622
|
+
if ( parameters.dithering )
|
|
19495
19623
|
_programLayers.enable( 14 );
|
|
19496
|
-
if ( parameters.
|
|
19624
|
+
if ( parameters.specularIntensityMap )
|
|
19497
19625
|
_programLayers.enable( 15 );
|
|
19498
|
-
if ( parameters.
|
|
19626
|
+
if ( parameters.specularColorMap )
|
|
19499
19627
|
_programLayers.enable( 16 );
|
|
19500
|
-
if ( parameters.
|
|
19628
|
+
if ( parameters.transmission )
|
|
19501
19629
|
_programLayers.enable( 17 );
|
|
19502
|
-
if ( parameters.
|
|
19630
|
+
if ( parameters.transmissionMap )
|
|
19503
19631
|
_programLayers.enable( 18 );
|
|
19504
|
-
if ( parameters.
|
|
19632
|
+
if ( parameters.thicknessMap )
|
|
19505
19633
|
_programLayers.enable( 19 );
|
|
19506
|
-
if ( parameters.
|
|
19634
|
+
if ( parameters.sheen )
|
|
19507
19635
|
_programLayers.enable( 20 );
|
|
19508
|
-
if ( parameters.
|
|
19636
|
+
if ( parameters.sheenColorMap )
|
|
19509
19637
|
_programLayers.enable( 21 );
|
|
19510
|
-
if ( parameters.
|
|
19638
|
+
if ( parameters.sheenRoughnessMap )
|
|
19511
19639
|
_programLayers.enable( 22 );
|
|
19512
|
-
if ( parameters.
|
|
19640
|
+
if ( parameters.decodeVideoTexture )
|
|
19513
19641
|
_programLayers.enable( 23 );
|
|
19642
|
+
if ( parameters.opaque )
|
|
19643
|
+
_programLayers.enable( 24 );
|
|
19514
19644
|
|
|
19515
19645
|
array.push( _programLayers.mask );
|
|
19516
19646
|
|
|
@@ -20898,7 +21028,7 @@
|
|
|
20898
21028
|
|
|
20899
21029
|
}
|
|
20900
21030
|
|
|
20901
|
-
function getDepthMaterial( object,
|
|
21031
|
+
function getDepthMaterial( object, material, light, shadowCameraNear, shadowCameraFar, type ) {
|
|
20902
21032
|
|
|
20903
21033
|
let result = null;
|
|
20904
21034
|
|
|
@@ -21010,7 +21140,7 @@
|
|
|
21010
21140
|
|
|
21011
21141
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
21012
21142
|
|
|
21013
|
-
const depthMaterial = getDepthMaterial( object,
|
|
21143
|
+
const depthMaterial = getDepthMaterial( object, groupMaterial, light, shadowCamera.near, shadowCamera.far, type );
|
|
21014
21144
|
|
|
21015
21145
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
|
|
21016
21146
|
|
|
@@ -21020,7 +21150,7 @@
|
|
|
21020
21150
|
|
|
21021
21151
|
} else if ( material.visible ) {
|
|
21022
21152
|
|
|
21023
|
-
const depthMaterial = getDepthMaterial( object,
|
|
21153
|
+
const depthMaterial = getDepthMaterial( object, material, light, shadowCamera.near, shadowCamera.far, type );
|
|
21024
21154
|
|
|
21025
21155
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
|
|
21026
21156
|
|
|
@@ -22254,12 +22384,13 @@
|
|
|
22254
22384
|
const maxCubemapSize = capabilities.maxCubemapSize;
|
|
22255
22385
|
const maxTextureSize = capabilities.maxTextureSize;
|
|
22256
22386
|
const maxSamples = capabilities.maxSamples;
|
|
22257
|
-
const
|
|
22258
|
-
const MultisampledRenderToTextureExtension = hasMultisampledRenderToTexture ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : undefined;
|
|
22387
|
+
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
22259
22388
|
|
|
22260
22389
|
const _videoTextures = new WeakMap();
|
|
22261
22390
|
let _canvas;
|
|
22262
22391
|
|
|
22392
|
+
const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source
|
|
22393
|
+
|
|
22263
22394
|
// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
|
|
22264
22395
|
// also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
|
|
22265
22396
|
// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
|
|
@@ -22483,8 +22614,6 @@
|
|
|
22483
22614
|
|
|
22484
22615
|
}
|
|
22485
22616
|
|
|
22486
|
-
info.memory.textures --;
|
|
22487
|
-
|
|
22488
22617
|
}
|
|
22489
22618
|
|
|
22490
22619
|
function onRenderTargetDispose( event ) {
|
|
@@ -22505,12 +22634,51 @@
|
|
|
22505
22634
|
|
|
22506
22635
|
if ( textureProperties.__webglInit === undefined ) return;
|
|
22507
22636
|
|
|
22508
|
-
|
|
22637
|
+
// check if it's necessary to remove the WebGLTexture object
|
|
22638
|
+
|
|
22639
|
+
const source = texture.source;
|
|
22640
|
+
const webglTextures = _sources.get( source );
|
|
22641
|
+
|
|
22642
|
+
if ( webglTextures ) {
|
|
22643
|
+
|
|
22644
|
+
const webglTexture = webglTextures[ textureProperties.__cacheKey ];
|
|
22645
|
+
webglTexture.usedTimes --;
|
|
22646
|
+
|
|
22647
|
+
// the WebGLTexture object is not used anymore, remove it
|
|
22648
|
+
|
|
22649
|
+
if ( webglTexture.usedTimes === 0 ) {
|
|
22650
|
+
|
|
22651
|
+
deleteTexture( texture );
|
|
22652
|
+
|
|
22653
|
+
}
|
|
22654
|
+
|
|
22655
|
+
// remove the weak map entry if no WebGLTexture uses the source anymore
|
|
22656
|
+
|
|
22657
|
+
if ( Object.keys( webglTextures ).length === 0 ) {
|
|
22658
|
+
|
|
22659
|
+
_sources.delete( source );
|
|
22660
|
+
|
|
22661
|
+
}
|
|
22662
|
+
|
|
22663
|
+
}
|
|
22509
22664
|
|
|
22510
22665
|
properties.remove( texture );
|
|
22511
22666
|
|
|
22512
22667
|
}
|
|
22513
22668
|
|
|
22669
|
+
function deleteTexture( texture ) {
|
|
22670
|
+
|
|
22671
|
+
const textureProperties = properties.get( texture );
|
|
22672
|
+
_gl.deleteTexture( textureProperties.__webglTexture );
|
|
22673
|
+
|
|
22674
|
+
const source = texture.source;
|
|
22675
|
+
const webglTextures = _sources.get( source );
|
|
22676
|
+
delete webglTextures[ textureProperties.__cacheKey ];
|
|
22677
|
+
|
|
22678
|
+
info.memory.textures --;
|
|
22679
|
+
|
|
22680
|
+
}
|
|
22681
|
+
|
|
22514
22682
|
function deallocateRenderTarget( renderTarget ) {
|
|
22515
22683
|
|
|
22516
22684
|
const texture = renderTarget.texture;
|
|
@@ -22518,8 +22686,6 @@
|
|
|
22518
22686
|
const renderTargetProperties = properties.get( renderTarget );
|
|
22519
22687
|
const textureProperties = properties.get( texture );
|
|
22520
22688
|
|
|
22521
|
-
if ( ! renderTarget ) return;
|
|
22522
|
-
|
|
22523
22689
|
if ( textureProperties.__webglTexture !== undefined ) {
|
|
22524
22690
|
|
|
22525
22691
|
_gl.deleteTexture( textureProperties.__webglTexture );
|
|
@@ -22604,6 +22770,28 @@
|
|
|
22604
22770
|
|
|
22605
22771
|
}
|
|
22606
22772
|
|
|
22773
|
+
function getTextureCacheKey( texture ) {
|
|
22774
|
+
|
|
22775
|
+
const array = [];
|
|
22776
|
+
|
|
22777
|
+
array.push( texture.wrapS );
|
|
22778
|
+
array.push( texture.wrapT );
|
|
22779
|
+
array.push( texture.magFilter );
|
|
22780
|
+
array.push( texture.minFilter );
|
|
22781
|
+
array.push( texture.anisotropy );
|
|
22782
|
+
array.push( texture.internalFormat );
|
|
22783
|
+
array.push( texture.format );
|
|
22784
|
+
array.push( texture.type );
|
|
22785
|
+
array.push( texture.generateMipmaps );
|
|
22786
|
+
array.push( texture.premultiplyAlpha );
|
|
22787
|
+
array.push( texture.flipY );
|
|
22788
|
+
array.push( texture.unpackAlignment );
|
|
22789
|
+
array.push( texture.encoding );
|
|
22790
|
+
|
|
22791
|
+
return array.join();
|
|
22792
|
+
|
|
22793
|
+
}
|
|
22794
|
+
|
|
22607
22795
|
//
|
|
22608
22796
|
|
|
22609
22797
|
function setTexture2D( texture, slot ) {
|
|
@@ -22616,9 +22804,9 @@
|
|
|
22616
22804
|
|
|
22617
22805
|
const image = texture.image;
|
|
22618
22806
|
|
|
22619
|
-
if ( image ===
|
|
22807
|
+
if ( image === null ) {
|
|
22620
22808
|
|
|
22621
|
-
console.warn( 'THREE.WebGLRenderer: Texture marked for update but image
|
|
22809
|
+
console.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );
|
|
22622
22810
|
|
|
22623
22811
|
} else if ( image.complete === false ) {
|
|
22624
22812
|
|
|
@@ -22766,452 +22954,528 @@
|
|
|
22766
22954
|
|
|
22767
22955
|
function initTexture( textureProperties, texture ) {
|
|
22768
22956
|
|
|
22957
|
+
let forceUpload = false;
|
|
22958
|
+
|
|
22769
22959
|
if ( textureProperties.__webglInit === undefined ) {
|
|
22770
22960
|
|
|
22771
22961
|
textureProperties.__webglInit = true;
|
|
22772
22962
|
|
|
22773
22963
|
texture.addEventListener( 'dispose', onTextureDispose );
|
|
22774
22964
|
|
|
22775
|
-
|
|
22965
|
+
}
|
|
22776
22966
|
|
|
22777
|
-
|
|
22967
|
+
// create Source <-> WebGLTextures mapping if necessary
|
|
22778
22968
|
|
|
22779
|
-
|
|
22969
|
+
const source = texture.source;
|
|
22970
|
+
let webglTextures = _sources.get( source );
|
|
22780
22971
|
|
|
22781
|
-
|
|
22972
|
+
if ( webglTextures === undefined ) {
|
|
22782
22973
|
|
|
22783
|
-
|
|
22974
|
+
webglTextures = {};
|
|
22975
|
+
_sources.set( source, webglTextures );
|
|
22784
22976
|
|
|
22785
|
-
|
|
22977
|
+
}
|
|
22786
22978
|
|
|
22787
|
-
if
|
|
22788
|
-
if ( texture.isDataTexture3D ) textureType = 32879;
|
|
22979
|
+
// check if there is already a WebGLTexture object for the given texture parameters
|
|
22789
22980
|
|
|
22790
|
-
|
|
22981
|
+
const textureCacheKey = getTextureCacheKey( texture );
|
|
22791
22982
|
|
|
22792
|
-
|
|
22793
|
-
state.bindTexture( textureType, textureProperties.__webglTexture );
|
|
22983
|
+
if ( textureCacheKey !== textureProperties.__cacheKey ) {
|
|
22794
22984
|
|
|
22795
|
-
|
|
22796
|
-
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
22797
|
-
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
22798
|
-
_gl.pixelStorei( 37443, 0 );
|
|
22985
|
+
// if not, create a new instance of WebGLTexture
|
|
22799
22986
|
|
|
22800
|
-
|
|
22801
|
-
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
22802
|
-
image = verifyColorSpace( texture, image );
|
|
22987
|
+
if ( webglTextures[ textureCacheKey ] === undefined ) {
|
|
22803
22988
|
|
|
22804
|
-
|
|
22805
|
-
glFormat = utils.convert( texture.format, texture.encoding );
|
|
22989
|
+
// create new entry
|
|
22806
22990
|
|
|
22807
|
-
|
|
22808
|
-
|
|
22991
|
+
webglTextures[ textureCacheKey ] = {
|
|
22992
|
+
texture: _gl.createTexture(),
|
|
22993
|
+
usedTimes: 0
|
|
22994
|
+
};
|
|
22809
22995
|
|
|
22810
|
-
|
|
22996
|
+
info.memory.textures ++;
|
|
22811
22997
|
|
|
22812
|
-
|
|
22813
|
-
|
|
22998
|
+
// when a new instance of WebGLTexture was created, a texture upload is required
|
|
22999
|
+
// even if the image contents are identical
|
|
22814
23000
|
|
|
22815
|
-
|
|
22816
|
-
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22817
|
-
const levels = getMipLevels( texture, image, supportsMips );
|
|
23001
|
+
forceUpload = true;
|
|
22818
23002
|
|
|
22819
|
-
|
|
23003
|
+
}
|
|
22820
23004
|
|
|
22821
|
-
|
|
23005
|
+
webglTextures[ textureCacheKey ].usedTimes ++;
|
|
22822
23006
|
|
|
22823
|
-
|
|
23007
|
+
// every time the texture cache key changes, it's necessary to check if an instance of
|
|
23008
|
+
// WebGLTexture can be deleted in order to avoid a memory leak.
|
|
22824
23009
|
|
|
22825
|
-
|
|
23010
|
+
const webglTexture = webglTextures[ textureProperties.__cacheKey ];
|
|
22826
23011
|
|
|
22827
|
-
|
|
23012
|
+
if ( webglTexture !== undefined ) {
|
|
22828
23013
|
|
|
22829
|
-
|
|
23014
|
+
webglTextures[ textureProperties.__cacheKey ].usedTimes --;
|
|
22830
23015
|
|
|
22831
|
-
|
|
23016
|
+
if ( webglTexture.usedTimes === 0 ) {
|
|
22832
23017
|
|
|
22833
|
-
|
|
23018
|
+
deleteTexture( texture );
|
|
22834
23019
|
|
|
22835
|
-
}
|
|
23020
|
+
}
|
|
22836
23021
|
|
|
22837
|
-
|
|
23022
|
+
}
|
|
22838
23023
|
|
|
22839
|
-
|
|
23024
|
+
// store references to cache key and WebGLTexture object
|
|
22840
23025
|
|
|
22841
|
-
|
|
23026
|
+
textureProperties.__cacheKey = textureCacheKey;
|
|
23027
|
+
textureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;
|
|
22842
23028
|
|
|
22843
|
-
|
|
23029
|
+
}
|
|
22844
23030
|
|
|
22845
|
-
|
|
23031
|
+
return forceUpload;
|
|
22846
23032
|
|
|
22847
|
-
|
|
23033
|
+
}
|
|
22848
23034
|
|
|
22849
|
-
|
|
23035
|
+
function uploadTexture( textureProperties, texture, slot ) {
|
|
22850
23036
|
|
|
22851
|
-
|
|
23037
|
+
let textureType = 3553;
|
|
22852
23038
|
|
|
22853
|
-
|
|
23039
|
+
if ( texture.isDataArrayTexture ) textureType = 35866;
|
|
23040
|
+
if ( texture.isData3DTexture ) textureType = 32879;
|
|
22854
23041
|
|
|
22855
|
-
|
|
23042
|
+
const forceUpload = initTexture( textureProperties, texture );
|
|
23043
|
+
const source = texture.source;
|
|
22856
23044
|
|
|
22857
|
-
|
|
23045
|
+
state.activeTexture( 33984 + slot );
|
|
23046
|
+
state.bindTexture( textureType, textureProperties.__webglTexture );
|
|
22858
23047
|
|
|
22859
|
-
|
|
22860
|
-
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
22861
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
22862
|
-
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
|
|
23048
|
+
if ( source.version !== source.__currentVersion || forceUpload === true ) {
|
|
22863
23049
|
|
|
22864
|
-
|
|
23050
|
+
_gl.pixelStorei( 37440, texture.flipY );
|
|
23051
|
+
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
23052
|
+
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
23053
|
+
_gl.pixelStorei( 37443, 0 );
|
|
22865
23054
|
|
|
22866
|
-
|
|
22867
|
-
|
|
23055
|
+
const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
|
|
23056
|
+
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
23057
|
+
image = verifyColorSpace( texture, image );
|
|
22868
23058
|
|
|
22869
|
-
|
|
23059
|
+
const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23060
|
+
glFormat = utils.convert( texture.format, texture.encoding );
|
|
22870
23061
|
|
|
22871
|
-
|
|
23062
|
+
let glType = utils.convert( texture.type ),
|
|
23063
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding, texture.isVideoTexture );
|
|
22872
23064
|
|
|
22873
|
-
|
|
23065
|
+
setTextureParameters( textureType, texture, supportsMips );
|
|
22874
23066
|
|
|
22875
|
-
|
|
22876
|
-
|
|
22877
|
-
glInternalFormat = 34041;
|
|
23067
|
+
let mipmap;
|
|
23068
|
+
const mipmaps = texture.mipmaps;
|
|
22878
23069
|
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
if ( texture.type !== UnsignedInt248Type ) {
|
|
23070
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
23071
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
23072
|
+
const levels = getMipLevels( texture, image, supportsMips );
|
|
22883
23073
|
|
|
22884
|
-
|
|
23074
|
+
if ( texture.isDepthTexture ) {
|
|
22885
23075
|
|
|
22886
|
-
|
|
22887
|
-
glType = utils.convert( texture.type );
|
|
23076
|
+
// populate depth texture with dummy data
|
|
22888
23077
|
|
|
22889
|
-
|
|
23078
|
+
glInternalFormat = 6402;
|
|
22890
23079
|
|
|
22891
|
-
|
|
23080
|
+
if ( isWebGL2 ) {
|
|
22892
23081
|
|
|
22893
|
-
|
|
23082
|
+
if ( texture.type === FloatType ) {
|
|
22894
23083
|
|
|
22895
|
-
|
|
23084
|
+
glInternalFormat = 36012;
|
|
22896
23085
|
|
|
22897
|
-
|
|
23086
|
+
} else if ( texture.type === UnsignedIntType ) {
|
|
22898
23087
|
|
|
22899
|
-
|
|
23088
|
+
glInternalFormat = 33190;
|
|
22900
23089
|
|
|
22901
|
-
|
|
23090
|
+
} else if ( texture.type === UnsignedInt248Type ) {
|
|
22902
23091
|
|
|
22903
|
-
|
|
23092
|
+
glInternalFormat = 35056;
|
|
22904
23093
|
|
|
22905
|
-
|
|
23094
|
+
} else {
|
|
22906
23095
|
|
|
22907
|
-
|
|
22908
|
-
// if there are no manual mipmaps
|
|
22909
|
-
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
23096
|
+
glInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D
|
|
22910
23097
|
|
|
22911
|
-
|
|
23098
|
+
}
|
|
22912
23099
|
|
|
22913
|
-
|
|
23100
|
+
} else {
|
|
22914
23101
|
|
|
22915
|
-
|
|
23102
|
+
if ( texture.type === FloatType ) {
|
|
22916
23103
|
|
|
22917
|
-
|
|
23104
|
+
console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
|
|
22918
23105
|
|
|
22919
|
-
|
|
23106
|
+
}
|
|
22920
23107
|
|
|
22921
|
-
|
|
23108
|
+
}
|
|
22922
23109
|
|
|
22923
|
-
|
|
23110
|
+
// validation checks for WebGL 1
|
|
22924
23111
|
|
|
22925
|
-
|
|
23112
|
+
if ( texture.format === DepthFormat && glInternalFormat === 6402 ) {
|
|
22926
23113
|
|
|
22927
|
-
|
|
23114
|
+
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
23115
|
+
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
23116
|
+
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
23117
|
+
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
|
|
23118
|
+
|
|
23119
|
+
console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
|
|
22928
23120
|
|
|
22929
|
-
|
|
23121
|
+
texture.type = UnsignedShortType;
|
|
23122
|
+
glType = utils.convert( texture.type );
|
|
22930
23123
|
|
|
22931
23124
|
}
|
|
22932
23125
|
|
|
22933
23126
|
}
|
|
22934
23127
|
|
|
22935
|
-
texture.
|
|
23128
|
+
if ( texture.format === DepthStencilFormat && glInternalFormat === 6402 ) {
|
|
22936
23129
|
|
|
22937
|
-
|
|
23130
|
+
// Depth stencil textures need the DEPTH_STENCIL internal format
|
|
23131
|
+
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
23132
|
+
glInternalFormat = 34041;
|
|
22938
23133
|
|
|
22939
|
-
|
|
23134
|
+
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
23135
|
+
// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
|
|
23136
|
+
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
23137
|
+
if ( texture.type !== UnsignedInt248Type ) {
|
|
22940
23138
|
|
|
22941
|
-
|
|
23139
|
+
console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
|
|
22942
23140
|
|
|
22943
|
-
|
|
23141
|
+
texture.type = UnsignedInt248Type;
|
|
23142
|
+
glType = utils.convert( texture.type );
|
|
22944
23143
|
|
|
22945
23144
|
}
|
|
22946
23145
|
|
|
22947
|
-
|
|
23146
|
+
}
|
|
23147
|
+
|
|
23148
|
+
//
|
|
23149
|
+
|
|
23150
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23151
|
+
|
|
23152
|
+
state.texStorage2D( 3553, 1, glInternalFormat, image.width, image.height );
|
|
22948
23153
|
|
|
22949
23154
|
} else {
|
|
22950
23155
|
|
|
22951
|
-
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType,
|
|
23156
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22952
23157
|
|
|
22953
23158
|
}
|
|
22954
23159
|
|
|
22955
|
-
}
|
|
23160
|
+
} else if ( texture.isDataTexture ) {
|
|
22956
23161
|
|
|
22957
|
-
|
|
23162
|
+
// use manually created mipmaps if available
|
|
23163
|
+
// if there are no manual mipmaps
|
|
23164
|
+
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
22958
23165
|
|
|
22959
|
-
|
|
23166
|
+
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22960
23167
|
|
|
22961
|
-
|
|
23168
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22962
23169
|
|
|
22963
|
-
|
|
23170
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22964
23171
|
|
|
22965
|
-
|
|
22966
|
-
|
|
22967
|
-
mipmap = mipmaps[ i ];
|
|
23172
|
+
}
|
|
22968
23173
|
|
|
22969
|
-
|
|
23174
|
+
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22970
23175
|
|
|
22971
|
-
|
|
23176
|
+
mipmap = mipmaps[ i ];
|
|
22972
23177
|
|
|
22973
23178
|
if ( useTexStorage ) {
|
|
22974
23179
|
|
|
22975
|
-
state.
|
|
23180
|
+
state.texSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22976
23181
|
|
|
22977
23182
|
} else {
|
|
22978
23183
|
|
|
22979
|
-
state.
|
|
23184
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22980
23185
|
|
|
22981
23186
|
}
|
|
22982
23187
|
|
|
22983
|
-
} else {
|
|
22984
|
-
|
|
22985
|
-
console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
22986
|
-
|
|
22987
23188
|
}
|
|
22988
23189
|
|
|
23190
|
+
texture.generateMipmaps = false;
|
|
23191
|
+
|
|
22989
23192
|
} else {
|
|
22990
23193
|
|
|
22991
23194
|
if ( useTexStorage ) {
|
|
22992
23195
|
|
|
22993
|
-
|
|
23196
|
+
if ( allocateMemory ) {
|
|
23197
|
+
|
|
23198
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
23199
|
+
|
|
23200
|
+
}
|
|
23201
|
+
|
|
23202
|
+
state.texSubImage2D( 3553, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
22994
23203
|
|
|
22995
23204
|
} else {
|
|
22996
23205
|
|
|
22997
|
-
state.texImage2D( 3553,
|
|
23206
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
22998
23207
|
|
|
22999
23208
|
}
|
|
23000
23209
|
|
|
23001
23210
|
}
|
|
23002
23211
|
|
|
23003
|
-
}
|
|
23212
|
+
} else if ( texture.isCompressedTexture ) {
|
|
23004
23213
|
|
|
23005
|
-
|
|
23214
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23006
23215
|
|
|
23007
|
-
|
|
23216
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
23008
23217
|
|
|
23009
|
-
|
|
23218
|
+
}
|
|
23010
23219
|
|
|
23011
|
-
|
|
23220
|
+
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
23012
23221
|
|
|
23013
|
-
|
|
23222
|
+
mipmap = mipmaps[ i ];
|
|
23014
23223
|
|
|
23015
|
-
|
|
23224
|
+
if ( texture.format !== RGBAFormat ) {
|
|
23016
23225
|
|
|
23017
|
-
|
|
23226
|
+
if ( glFormat !== null ) {
|
|
23018
23227
|
|
|
23019
|
-
|
|
23228
|
+
if ( useTexStorage ) {
|
|
23020
23229
|
|
|
23021
|
-
|
|
23230
|
+
state.compressedTexSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
23022
23231
|
|
|
23023
|
-
|
|
23232
|
+
} else {
|
|
23024
23233
|
|
|
23025
|
-
|
|
23234
|
+
state.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
23026
23235
|
|
|
23027
|
-
|
|
23236
|
+
}
|
|
23237
|
+
|
|
23238
|
+
} else {
|
|
23239
|
+
|
|
23240
|
+
console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
23241
|
+
|
|
23242
|
+
}
|
|
23243
|
+
|
|
23244
|
+
} else {
|
|
23245
|
+
|
|
23246
|
+
if ( useTexStorage ) {
|
|
23247
|
+
|
|
23248
|
+
state.texSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23249
|
+
|
|
23250
|
+
} else {
|
|
23028
23251
|
|
|
23029
|
-
|
|
23252
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23253
|
+
|
|
23254
|
+
}
|
|
23255
|
+
|
|
23256
|
+
}
|
|
23030
23257
|
|
|
23031
23258
|
}
|
|
23032
23259
|
|
|
23033
|
-
|
|
23260
|
+
} else if ( texture.isDataArrayTexture ) {
|
|
23034
23261
|
|
|
23035
|
-
|
|
23262
|
+
if ( useTexStorage ) {
|
|
23036
23263
|
|
|
23037
|
-
|
|
23264
|
+
if ( allocateMemory ) {
|
|
23038
23265
|
|
|
23039
|
-
|
|
23266
|
+
state.texStorage3D( 35866, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
23040
23267
|
|
|
23041
|
-
|
|
23268
|
+
}
|
|
23042
23269
|
|
|
23043
|
-
|
|
23270
|
+
state.texSubImage3D( 35866, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
23044
23271
|
|
|
23045
|
-
|
|
23272
|
+
} else {
|
|
23046
23273
|
|
|
23047
|
-
|
|
23274
|
+
state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
23048
23275
|
|
|
23049
|
-
|
|
23276
|
+
}
|
|
23050
23277
|
|
|
23051
|
-
}
|
|
23278
|
+
} else if ( texture.isData3DTexture ) {
|
|
23052
23279
|
|
|
23053
|
-
|
|
23280
|
+
if ( useTexStorage ) {
|
|
23054
23281
|
|
|
23055
|
-
|
|
23282
|
+
if ( allocateMemory ) {
|
|
23056
23283
|
|
|
23057
|
-
|
|
23058
|
-
// if there are no manual mipmaps
|
|
23059
|
-
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
23284
|
+
state.texStorage3D( 32879, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
23060
23285
|
|
|
23061
|
-
|
|
23286
|
+
}
|
|
23287
|
+
|
|
23288
|
+
state.texSubImage3D( 32879, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
23289
|
+
|
|
23290
|
+
} else {
|
|
23291
|
+
|
|
23292
|
+
state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
23293
|
+
|
|
23294
|
+
}
|
|
23295
|
+
|
|
23296
|
+
} else if ( texture.isFramebufferTexture ) {
|
|
23062
23297
|
|
|
23063
23298
|
if ( useTexStorage && allocateMemory ) {
|
|
23064
23299
|
|
|
23065
|
-
state.texStorage2D( 3553, levels, glInternalFormat,
|
|
23300
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
23301
|
+
|
|
23302
|
+
} else {
|
|
23303
|
+
|
|
23304
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
23066
23305
|
|
|
23067
23306
|
}
|
|
23068
23307
|
|
|
23069
|
-
|
|
23308
|
+
} else {
|
|
23070
23309
|
|
|
23071
|
-
|
|
23310
|
+
// regular Texture (image, video, canvas)
|
|
23072
23311
|
|
|
23073
|
-
|
|
23312
|
+
// use manually created mipmaps if available
|
|
23313
|
+
// if there are no manual mipmaps
|
|
23314
|
+
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
23074
23315
|
|
|
23075
|
-
|
|
23316
|
+
if ( mipmaps.length > 0 && supportsMips ) {
|
|
23076
23317
|
|
|
23077
|
-
|
|
23318
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23078
23319
|
|
|
23079
|
-
state.
|
|
23320
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
23080
23321
|
|
|
23081
23322
|
}
|
|
23082
23323
|
|
|
23083
|
-
|
|
23324
|
+
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
23084
23325
|
|
|
23085
|
-
|
|
23326
|
+
mipmap = mipmaps[ i ];
|
|
23086
23327
|
|
|
23087
|
-
|
|
23328
|
+
if ( useTexStorage ) {
|
|
23088
23329
|
|
|
23089
|
-
|
|
23330
|
+
state.texSubImage2D( 3553, i, 0, 0, glFormat, glType, mipmap );
|
|
23090
23331
|
|
|
23091
|
-
|
|
23332
|
+
} else {
|
|
23092
23333
|
|
|
23093
|
-
|
|
23334
|
+
state.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );
|
|
23335
|
+
|
|
23336
|
+
}
|
|
23094
23337
|
|
|
23095
23338
|
}
|
|
23096
23339
|
|
|
23097
|
-
|
|
23340
|
+
texture.generateMipmaps = false;
|
|
23098
23341
|
|
|
23099
23342
|
} else {
|
|
23100
23343
|
|
|
23101
|
-
|
|
23344
|
+
if ( useTexStorage ) {
|
|
23345
|
+
|
|
23346
|
+
if ( allocateMemory ) {
|
|
23347
|
+
|
|
23348
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
23349
|
+
|
|
23350
|
+
}
|
|
23351
|
+
|
|
23352
|
+
state.texSubImage2D( 3553, 0, 0, 0, glFormat, glType, image );
|
|
23353
|
+
|
|
23354
|
+
} else {
|
|
23355
|
+
|
|
23356
|
+
state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
|
|
23357
|
+
|
|
23358
|
+
}
|
|
23102
23359
|
|
|
23103
23360
|
}
|
|
23104
23361
|
|
|
23105
23362
|
}
|
|
23106
23363
|
|
|
23107
|
-
|
|
23364
|
+
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23365
|
+
|
|
23366
|
+
generateMipmap( textureType );
|
|
23367
|
+
|
|
23368
|
+
}
|
|
23108
23369
|
|
|
23109
|
-
|
|
23370
|
+
source.__currentVersion = source.version;
|
|
23110
23371
|
|
|
23111
|
-
|
|
23372
|
+
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
23112
23373
|
|
|
23113
23374
|
}
|
|
23114
23375
|
|
|
23115
23376
|
textureProperties.__version = texture.version;
|
|
23116
23377
|
|
|
23117
|
-
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
23118
|
-
|
|
23119
23378
|
}
|
|
23120
23379
|
|
|
23121
23380
|
function uploadCubeTexture( textureProperties, texture, slot ) {
|
|
23122
23381
|
|
|
23123
23382
|
if ( texture.image.length !== 6 ) return;
|
|
23124
23383
|
|
|
23125
|
-
initTexture( textureProperties, texture );
|
|
23384
|
+
const forceUpload = initTexture( textureProperties, texture );
|
|
23385
|
+
const source = texture.source;
|
|
23126
23386
|
|
|
23127
23387
|
state.activeTexture( 33984 + slot );
|
|
23128
23388
|
state.bindTexture( 34067, textureProperties.__webglTexture );
|
|
23129
23389
|
|
|
23130
|
-
|
|
23131
|
-
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
23132
|
-
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
23133
|
-
_gl.pixelStorei( 37443, 0 );
|
|
23390
|
+
if ( source.version !== source.__currentVersion || forceUpload === true ) {
|
|
23134
23391
|
|
|
23135
|
-
|
|
23136
|
-
|
|
23392
|
+
_gl.pixelStorei( 37440, texture.flipY );
|
|
23393
|
+
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
23394
|
+
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
23395
|
+
_gl.pixelStorei( 37443, 0 );
|
|
23137
23396
|
|
|
23138
|
-
|
|
23397
|
+
const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
|
|
23398
|
+
const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
|
|
23139
23399
|
|
|
23140
|
-
|
|
23400
|
+
const cubeImage = [];
|
|
23141
23401
|
|
|
23142
|
-
|
|
23402
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
23143
23403
|
|
|
23144
|
-
|
|
23404
|
+
if ( ! isCompressed && ! isDataTexture ) {
|
|
23145
23405
|
|
|
23146
|
-
|
|
23406
|
+
cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );
|
|
23407
|
+
|
|
23408
|
+
} else {
|
|
23409
|
+
|
|
23410
|
+
cubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];
|
|
23411
|
+
|
|
23412
|
+
}
|
|
23147
23413
|
|
|
23148
|
-
cubeImage[ i ] =
|
|
23414
|
+
cubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );
|
|
23149
23415
|
|
|
23150
23416
|
}
|
|
23151
23417
|
|
|
23152
|
-
|
|
23418
|
+
const image = cubeImage[ 0 ],
|
|
23419
|
+
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23420
|
+
glFormat = utils.convert( texture.format, texture.encoding ),
|
|
23421
|
+
glType = utils.convert( texture.type ),
|
|
23422
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23153
23423
|
|
|
23154
|
-
|
|
23424
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
23425
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
23426
|
+
let levels = getMipLevels( texture, image, supportsMips );
|
|
23155
23427
|
|
|
23156
|
-
|
|
23157
|
-
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23158
|
-
glFormat = utils.convert( texture.format, texture.encoding ),
|
|
23159
|
-
glType = utils.convert( texture.type ),
|
|
23160
|
-
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23428
|
+
setTextureParameters( 34067, texture, supportsMips );
|
|
23161
23429
|
|
|
23162
|
-
|
|
23163
|
-
const allocateMemory = ( textureProperties.__version === undefined );
|
|
23164
|
-
let levels = getMipLevels( texture, image, supportsMips );
|
|
23430
|
+
let mipmaps;
|
|
23165
23431
|
|
|
23166
|
-
|
|
23432
|
+
if ( isCompressed ) {
|
|
23167
23433
|
|
|
23168
|
-
|
|
23434
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23169
23435
|
|
|
23170
|
-
|
|
23436
|
+
state.texStorage2D( 34067, levels, glInternalFormat, image.width, image.height );
|
|
23171
23437
|
|
|
23172
|
-
|
|
23438
|
+
}
|
|
23173
23439
|
|
|
23174
|
-
|
|
23440
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
23175
23441
|
|
|
23176
|
-
|
|
23442
|
+
mipmaps = cubeImage[ i ].mipmaps;
|
|
23177
23443
|
|
|
23178
|
-
|
|
23444
|
+
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
23179
23445
|
|
|
23180
|
-
|
|
23446
|
+
const mipmap = mipmaps[ j ];
|
|
23181
23447
|
|
|
23182
|
-
|
|
23448
|
+
if ( texture.format !== RGBAFormat ) {
|
|
23183
23449
|
|
|
23184
|
-
|
|
23450
|
+
if ( glFormat !== null ) {
|
|
23185
23451
|
|
|
23186
|
-
|
|
23452
|
+
if ( useTexStorage ) {
|
|
23187
23453
|
|
|
23188
|
-
|
|
23454
|
+
state.compressedTexSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
23189
23455
|
|
|
23190
|
-
|
|
23456
|
+
} else {
|
|
23457
|
+
|
|
23458
|
+
state.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
23191
23459
|
|
|
23192
|
-
|
|
23460
|
+
}
|
|
23193
23461
|
|
|
23194
23462
|
} else {
|
|
23195
23463
|
|
|
23196
|
-
|
|
23464
|
+
console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );
|
|
23197
23465
|
|
|
23198
23466
|
}
|
|
23199
23467
|
|
|
23200
23468
|
} else {
|
|
23201
23469
|
|
|
23202
|
-
|
|
23203
|
-
|
|
23204
|
-
}
|
|
23205
|
-
|
|
23206
|
-
} else {
|
|
23470
|
+
if ( useTexStorage ) {
|
|
23207
23471
|
|
|
23208
|
-
|
|
23472
|
+
state.texSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23209
23473
|
|
|
23210
|
-
|
|
23474
|
+
} else {
|
|
23211
23475
|
|
|
23212
|
-
|
|
23476
|
+
state.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23213
23477
|
|
|
23214
|
-
|
|
23478
|
+
}
|
|
23215
23479
|
|
|
23216
23480
|
}
|
|
23217
23481
|
|
|
@@ -23219,78 +23483,78 @@
|
|
|
23219
23483
|
|
|
23220
23484
|
}
|
|
23221
23485
|
|
|
23222
|
-
}
|
|
23486
|
+
} else {
|
|
23223
23487
|
|
|
23224
|
-
|
|
23488
|
+
mipmaps = texture.mipmaps;
|
|
23225
23489
|
|
|
23226
|
-
|
|
23490
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23227
23491
|
|
|
23228
|
-
|
|
23492
|
+
// TODO: Uniformly handle mipmap definitions
|
|
23493
|
+
// Normal textures and compressed cube textures define base level + mips with their mipmap array
|
|
23494
|
+
// Uncompressed cube textures use their mipmap array only for mips (no base level)
|
|
23229
23495
|
|
|
23230
|
-
|
|
23231
|
-
// Normal textures and compressed cube textures define base level + mips with their mipmap array
|
|
23232
|
-
// Uncompressed cube textures use their mipmap array only for mips (no base level)
|
|
23496
|
+
if ( mipmaps.length > 0 ) levels ++;
|
|
23233
23497
|
|
|
23234
|
-
|
|
23498
|
+
state.texStorage2D( 34067, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
|
|
23235
23499
|
|
|
23236
|
-
|
|
23500
|
+
}
|
|
23237
23501
|
|
|
23238
|
-
|
|
23502
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
23239
23503
|
|
|
23240
|
-
|
|
23504
|
+
if ( isDataTexture ) {
|
|
23241
23505
|
|
|
23242
|
-
|
|
23506
|
+
if ( useTexStorage ) {
|
|
23243
23507
|
|
|
23244
|
-
|
|
23508
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
|
|
23245
23509
|
|
|
23246
|
-
|
|
23510
|
+
} else {
|
|
23247
23511
|
|
|
23248
|
-
|
|
23512
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
|
|
23249
23513
|
|
|
23250
|
-
|
|
23514
|
+
}
|
|
23251
23515
|
|
|
23252
|
-
|
|
23516
|
+
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
23253
23517
|
|
|
23254
|
-
|
|
23518
|
+
const mipmap = mipmaps[ j ];
|
|
23519
|
+
const mipmapImage = mipmap.image[ i ].image;
|
|
23255
23520
|
|
|
23256
|
-
|
|
23257
|
-
const mipmapImage = mipmap.image[ i ].image;
|
|
23521
|
+
if ( useTexStorage ) {
|
|
23258
23522
|
|
|
23259
|
-
|
|
23523
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
|
|
23260
23524
|
|
|
23261
|
-
|
|
23525
|
+
} else {
|
|
23262
23526
|
|
|
23263
|
-
|
|
23527
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );
|
|
23264
23528
|
|
|
23265
|
-
|
|
23529
|
+
}
|
|
23266
23530
|
|
|
23267
23531
|
}
|
|
23268
23532
|
|
|
23269
|
-
}
|
|
23533
|
+
} else {
|
|
23270
23534
|
|
|
23271
|
-
|
|
23535
|
+
if ( useTexStorage ) {
|
|
23272
23536
|
|
|
23273
|
-
|
|
23537
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
|
|
23274
23538
|
|
|
23275
|
-
|
|
23539
|
+
} else {
|
|
23276
23540
|
|
|
23277
|
-
|
|
23541
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );
|
|
23278
23542
|
|
|
23279
|
-
|
|
23543
|
+
}
|
|
23280
23544
|
|
|
23281
|
-
|
|
23545
|
+
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
23282
23546
|
|
|
23283
|
-
|
|
23547
|
+
const mipmap = mipmaps[ j ];
|
|
23284
23548
|
|
|
23285
|
-
|
|
23549
|
+
if ( useTexStorage ) {
|
|
23286
23550
|
|
|
23287
|
-
|
|
23551
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
|
|
23288
23552
|
|
|
23289
|
-
|
|
23553
|
+
} else {
|
|
23290
23554
|
|
|
23291
|
-
|
|
23555
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );
|
|
23292
23556
|
|
|
23293
|
-
|
|
23557
|
+
}
|
|
23294
23558
|
|
|
23295
23559
|
}
|
|
23296
23560
|
|
|
@@ -23300,19 +23564,21 @@
|
|
|
23300
23564
|
|
|
23301
23565
|
}
|
|
23302
23566
|
|
|
23303
|
-
|
|
23567
|
+
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23568
|
+
|
|
23569
|
+
// We assume images for cube map have the same size.
|
|
23570
|
+
generateMipmap( 34067 );
|
|
23304
23571
|
|
|
23305
|
-
|
|
23572
|
+
}
|
|
23573
|
+
|
|
23574
|
+
source.__currentVersion = source.version;
|
|
23306
23575
|
|
|
23307
|
-
|
|
23308
|
-
generateMipmap( 34067 );
|
|
23576
|
+
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
23309
23577
|
|
|
23310
23578
|
}
|
|
23311
23579
|
|
|
23312
23580
|
textureProperties.__version = texture.version;
|
|
23313
23581
|
|
|
23314
|
-
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
23315
|
-
|
|
23316
23582
|
}
|
|
23317
23583
|
|
|
23318
23584
|
// Render targets
|
|
@@ -23340,9 +23606,10 @@
|
|
|
23340
23606
|
}
|
|
23341
23607
|
|
|
23342
23608
|
state.bindFramebuffer( 36160, framebuffer );
|
|
23343
|
-
if ( renderTarget.useRenderToTexture ) {
|
|
23344
23609
|
|
|
23345
|
-
|
|
23610
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23611
|
+
|
|
23612
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
23346
23613
|
|
|
23347
23614
|
} else {
|
|
23348
23615
|
|
|
@@ -23364,7 +23631,7 @@
|
|
|
23364
23631
|
|
|
23365
23632
|
let glInternalFormat = 33189;
|
|
23366
23633
|
|
|
23367
|
-
if ( isMultisample || renderTarget
|
|
23634
|
+
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
23368
23635
|
|
|
23369
23636
|
const depthTexture = renderTarget.depthTexture;
|
|
23370
23637
|
|
|
@@ -23384,9 +23651,9 @@
|
|
|
23384
23651
|
|
|
23385
23652
|
const samples = getRenderTargetSamples( renderTarget );
|
|
23386
23653
|
|
|
23387
|
-
if ( renderTarget
|
|
23654
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23388
23655
|
|
|
23389
|
-
|
|
23656
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23390
23657
|
|
|
23391
23658
|
} else {
|
|
23392
23659
|
|
|
@@ -23406,13 +23673,13 @@
|
|
|
23406
23673
|
|
|
23407
23674
|
const samples = getRenderTargetSamples( renderTarget );
|
|
23408
23675
|
|
|
23409
|
-
if ( isMultisample && renderTarget
|
|
23676
|
+
if ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {
|
|
23410
23677
|
|
|
23411
23678
|
_gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height );
|
|
23412
23679
|
|
|
23413
|
-
} else if ( renderTarget
|
|
23680
|
+
} else if ( useMultisampledRTT( renderTarget ) ) {
|
|
23414
23681
|
|
|
23415
|
-
|
|
23682
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( 36161, samples, 35056, renderTarget.width, renderTarget.height );
|
|
23416
23683
|
|
|
23417
23684
|
} else {
|
|
23418
23685
|
|
|
@@ -23433,13 +23700,13 @@
|
|
|
23433
23700
|
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23434
23701
|
const samples = getRenderTargetSamples( renderTarget );
|
|
23435
23702
|
|
|
23436
|
-
if ( isMultisample && renderTarget
|
|
23703
|
+
if ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {
|
|
23437
23704
|
|
|
23438
23705
|
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23439
23706
|
|
|
23440
|
-
} else if ( renderTarget
|
|
23707
|
+
} else if ( useMultisampledRTT( renderTarget ) ) {
|
|
23441
23708
|
|
|
23442
|
-
|
|
23709
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23443
23710
|
|
|
23444
23711
|
} else {
|
|
23445
23712
|
|
|
@@ -23485,9 +23752,9 @@
|
|
|
23485
23752
|
|
|
23486
23753
|
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
23487
23754
|
|
|
23488
|
-
if ( renderTarget
|
|
23755
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23489
23756
|
|
|
23490
|
-
|
|
23757
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( 36160, 36096, 3553, webglDepthTexture, 0, samples );
|
|
23491
23758
|
|
|
23492
23759
|
} else {
|
|
23493
23760
|
|
|
@@ -23497,9 +23764,9 @@
|
|
|
23497
23764
|
|
|
23498
23765
|
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
23499
23766
|
|
|
23500
|
-
if ( renderTarget
|
|
23767
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23501
23768
|
|
|
23502
|
-
|
|
23769
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( 36160, 33306, 3553, webglDepthTexture, 0, samples );
|
|
23503
23770
|
|
|
23504
23771
|
} else {
|
|
23505
23772
|
|
|
@@ -23599,7 +23866,6 @@
|
|
|
23599
23866
|
|
|
23600
23867
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
23601
23868
|
const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
|
|
23602
|
-
const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
|
|
23603
23869
|
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
23604
23870
|
|
|
23605
23871
|
// Setup framebuffer
|
|
@@ -23644,41 +23910,32 @@
|
|
|
23644
23910
|
|
|
23645
23911
|
}
|
|
23646
23912
|
|
|
23647
|
-
} else if ( renderTarget.
|
|
23648
|
-
|
|
23649
|
-
if ( isWebGL2 ) {
|
|
23650
|
-
|
|
23651
|
-
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
23652
|
-
renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
|
|
23653
|
-
|
|
23654
|
-
_gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23655
|
-
|
|
23656
|
-
const glFormat = utils.convert( texture.format, texture.encoding );
|
|
23657
|
-
const glType = utils.convert( texture.type );
|
|
23658
|
-
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23659
|
-
const samples = getRenderTargetSamples( renderTarget );
|
|
23660
|
-
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23661
|
-
|
|
23662
|
-
state.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23663
|
-
_gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23664
|
-
_gl.bindRenderbuffer( 36161, null );
|
|
23665
|
-
|
|
23666
|
-
if ( renderTarget.depthBuffer ) {
|
|
23913
|
+
} else if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
23667
23914
|
|
|
23668
|
-
|
|
23669
|
-
|
|
23915
|
+
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
23916
|
+
renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
|
|
23670
23917
|
|
|
23671
|
-
|
|
23918
|
+
_gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23672
23919
|
|
|
23673
|
-
|
|
23920
|
+
const glFormat = utils.convert( texture.format, texture.encoding );
|
|
23921
|
+
const glType = utils.convert( texture.type );
|
|
23922
|
+
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23923
|
+
const samples = getRenderTargetSamples( renderTarget );
|
|
23924
|
+
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23674
23925
|
|
|
23926
|
+
state.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23927
|
+
_gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23928
|
+
_gl.bindRenderbuffer( 36161, null );
|
|
23675
23929
|
|
|
23676
|
-
|
|
23930
|
+
if ( renderTarget.depthBuffer ) {
|
|
23677
23931
|
|
|
23678
|
-
|
|
23932
|
+
renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();
|
|
23933
|
+
setupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );
|
|
23679
23934
|
|
|
23680
23935
|
}
|
|
23681
23936
|
|
|
23937
|
+
state.bindFramebuffer( 36160, null );
|
|
23938
|
+
|
|
23682
23939
|
}
|
|
23683
23940
|
|
|
23684
23941
|
}
|
|
@@ -23731,18 +23988,15 @@
|
|
|
23731
23988
|
|
|
23732
23989
|
let glTextureType = 3553;
|
|
23733
23990
|
|
|
23734
|
-
if (
|
|
23735
|
-
|
|
23736
|
-
// Render targets containing layers, i.e: Texture 3D and 2d arrays
|
|
23991
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
23737
23992
|
|
|
23738
23993
|
if ( isWebGL2 ) {
|
|
23739
23994
|
|
|
23740
|
-
|
|
23741
|
-
glTextureType = isTexture3D ? 32879 : 35866;
|
|
23995
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? 32879 : 35866;
|
|
23742
23996
|
|
|
23743
23997
|
} else {
|
|
23744
23998
|
|
|
23745
|
-
console.
|
|
23999
|
+
console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
|
|
23746
24000
|
|
|
23747
24001
|
}
|
|
23748
24002
|
|
|
@@ -23799,61 +24053,61 @@
|
|
|
23799
24053
|
|
|
23800
24054
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
23801
24055
|
|
|
23802
|
-
if ( renderTarget.
|
|
24056
|
+
if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
23803
24057
|
|
|
23804
|
-
|
|
24058
|
+
const width = renderTarget.width;
|
|
24059
|
+
const height = renderTarget.height;
|
|
24060
|
+
let mask = 16384;
|
|
24061
|
+
const invalidationArray = [ 36064 ];
|
|
24062
|
+
const depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;
|
|
23805
24063
|
|
|
23806
|
-
|
|
23807
|
-
const height = renderTarget.height;
|
|
23808
|
-
let mask = 16384;
|
|
23809
|
-
const invalidationArray = [ 36064 ];
|
|
23810
|
-
const depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;
|
|
24064
|
+
if ( renderTarget.depthBuffer ) {
|
|
23811
24065
|
|
|
23812
|
-
|
|
23813
|
-
|
|
23814
|
-
invalidationArray.push( depthStyle );
|
|
24066
|
+
invalidationArray.push( depthStyle );
|
|
23815
24067
|
|
|
23816
|
-
|
|
24068
|
+
}
|
|
23817
24069
|
|
|
23818
|
-
|
|
24070
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
24071
|
+
const ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : true;
|
|
23819
24072
|
|
|
23820
|
-
|
|
23821
|
-
if ( renderTarget.stencilBuffer ) mask |= 1024;
|
|
24073
|
+
if ( ignoreDepthValues === false ) {
|
|
23822
24074
|
|
|
23823
|
-
|
|
24075
|
+
if ( renderTarget.depthBuffer ) mask |= 256;
|
|
24076
|
+
if ( renderTarget.stencilBuffer ) mask |= 1024;
|
|
23824
24077
|
|
|
23825
|
-
|
|
24078
|
+
}
|
|
23826
24079
|
|
|
23827
|
-
|
|
23828
|
-
|
|
24080
|
+
state.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
24081
|
+
state.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer );
|
|
23829
24082
|
|
|
23830
|
-
|
|
24083
|
+
if ( ignoreDepthValues === true ) {
|
|
23831
24084
|
|
|
23832
|
-
|
|
23833
|
-
|
|
24085
|
+
_gl.invalidateFramebuffer( 36008, [ depthStyle ] );
|
|
24086
|
+
_gl.invalidateFramebuffer( 36009, [ depthStyle ] );
|
|
23834
24087
|
|
|
23835
|
-
|
|
24088
|
+
}
|
|
23836
24089
|
|
|
23837
|
-
|
|
23838
|
-
|
|
24090
|
+
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 );
|
|
24091
|
+
_gl.invalidateFramebuffer( 36008, invalidationArray );
|
|
23839
24092
|
|
|
23840
|
-
|
|
23841
|
-
|
|
24093
|
+
state.bindFramebuffer( 36008, null );
|
|
24094
|
+
state.bindFramebuffer( 36009, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23842
24095
|
|
|
23843
|
-
|
|
24096
|
+
}
|
|
23844
24097
|
|
|
23845
|
-
|
|
24098
|
+
}
|
|
23846
24099
|
|
|
23847
|
-
|
|
24100
|
+
function getRenderTargetSamples( renderTarget ) {
|
|
23848
24101
|
|
|
23849
|
-
|
|
24102
|
+
return Math.min( maxSamples, renderTarget.samples );
|
|
23850
24103
|
|
|
23851
24104
|
}
|
|
23852
24105
|
|
|
23853
|
-
function
|
|
24106
|
+
function useMultisampledRTT( renderTarget ) {
|
|
23854
24107
|
|
|
23855
|
-
|
|
23856
|
-
|
|
24108
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
24109
|
+
|
|
24110
|
+
return isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
|
|
23857
24111
|
|
|
23858
24112
|
}
|
|
23859
24113
|
|
|
@@ -23931,50 +24185,6 @@
|
|
|
23931
24185
|
|
|
23932
24186
|
}
|
|
23933
24187
|
|
|
23934
|
-
// backwards compatibility
|
|
23935
|
-
|
|
23936
|
-
let warnedTexture2D = false;
|
|
23937
|
-
let warnedTextureCube = false;
|
|
23938
|
-
|
|
23939
|
-
function safeSetTexture2D( texture, slot ) {
|
|
23940
|
-
|
|
23941
|
-
if ( texture && texture.isWebGLRenderTarget ) {
|
|
23942
|
-
|
|
23943
|
-
if ( warnedTexture2D === false ) {
|
|
23944
|
-
|
|
23945
|
-
console.warn( 'THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.' );
|
|
23946
|
-
warnedTexture2D = true;
|
|
23947
|
-
|
|
23948
|
-
}
|
|
23949
|
-
|
|
23950
|
-
texture = texture.texture;
|
|
23951
|
-
|
|
23952
|
-
}
|
|
23953
|
-
|
|
23954
|
-
setTexture2D( texture, slot );
|
|
23955
|
-
|
|
23956
|
-
}
|
|
23957
|
-
|
|
23958
|
-
function safeSetTextureCube( texture, slot ) {
|
|
23959
|
-
|
|
23960
|
-
if ( texture && texture.isWebGLCubeRenderTarget ) {
|
|
23961
|
-
|
|
23962
|
-
if ( warnedTextureCube === false ) {
|
|
23963
|
-
|
|
23964
|
-
console.warn( 'THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.' );
|
|
23965
|
-
warnedTextureCube = true;
|
|
23966
|
-
|
|
23967
|
-
}
|
|
23968
|
-
|
|
23969
|
-
texture = texture.texture;
|
|
23970
|
-
|
|
23971
|
-
}
|
|
23972
|
-
|
|
23973
|
-
|
|
23974
|
-
setTextureCube( texture, slot );
|
|
23975
|
-
|
|
23976
|
-
}
|
|
23977
|
-
|
|
23978
24188
|
//
|
|
23979
24189
|
|
|
23980
24190
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
@@ -23990,9 +24200,7 @@
|
|
|
23990
24200
|
this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
|
|
23991
24201
|
this.setupDepthRenderbuffer = setupDepthRenderbuffer;
|
|
23992
24202
|
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
23993
|
-
|
|
23994
|
-
this.safeSetTexture2D = safeSetTexture2D;
|
|
23995
|
-
this.safeSetTextureCube = safeSetTextureCube;
|
|
24203
|
+
this.useMultisampledRTT = useMultisampledRTT;
|
|
23996
24204
|
|
|
23997
24205
|
}
|
|
23998
24206
|
|
|
@@ -24619,13 +24827,11 @@
|
|
|
24619
24827
|
|
|
24620
24828
|
let referenceSpace = null;
|
|
24621
24829
|
let referenceSpaceType = 'local-floor';
|
|
24622
|
-
const hasMultisampledRenderToTexture = renderer.extensions.has( 'WEBGL_multisampled_render_to_texture' );
|
|
24623
24830
|
|
|
24624
24831
|
let pose = null;
|
|
24625
24832
|
let glBinding = null;
|
|
24626
24833
|
let glProjLayer = null;
|
|
24627
24834
|
let glBaseLayer = null;
|
|
24628
|
-
let isMultisample = false;
|
|
24629
24835
|
let xrFrame = null;
|
|
24630
24836
|
const attributes = gl.getContextAttributes();
|
|
24631
24837
|
let initialRenderTarget = null;
|
|
@@ -24855,7 +25061,6 @@
|
|
|
24855
25061
|
|
|
24856
25062
|
} else {
|
|
24857
25063
|
|
|
24858
|
-
isMultisample = attributes.antialias;
|
|
24859
25064
|
let depthFormat = null;
|
|
24860
25065
|
let depthType = null;
|
|
24861
25066
|
let glDepthFormat = null;
|
|
@@ -24880,36 +25085,20 @@
|
|
|
24880
25085
|
|
|
24881
25086
|
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
24882
25087
|
|
|
24883
|
-
|
|
24884
|
-
|
|
24885
|
-
|
|
24886
|
-
|
|
24887
|
-
|
|
24888
|
-
|
|
24889
|
-
|
|
24890
|
-
|
|
24891
|
-
|
|
24892
|
-
|
|
24893
|
-
|
|
24894
|
-
useRenderToTexture: hasMultisampledRenderToTexture,
|
|
24895
|
-
encoding: renderer.outputEncoding
|
|
24896
|
-
} );
|
|
24897
|
-
|
|
24898
|
-
} else {
|
|
24899
|
-
|
|
24900
|
-
newRenderTarget = new WebGLRenderTarget(
|
|
24901
|
-
glProjLayer.textureWidth,
|
|
24902
|
-
glProjLayer.textureHeight,
|
|
24903
|
-
{
|
|
24904
|
-
format: RGBAFormat,
|
|
24905
|
-
type: UnsignedByteType,
|
|
24906
|
-
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
24907
|
-
stencilBuffer: attributes.stencil,
|
|
24908
|
-
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
24909
|
-
encoding: renderer.outputEncoding
|
|
24910
|
-
} );
|
|
25088
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
25089
|
+
glProjLayer.textureWidth,
|
|
25090
|
+
glProjLayer.textureHeight,
|
|
25091
|
+
{
|
|
25092
|
+
format: RGBAFormat,
|
|
25093
|
+
type: UnsignedByteType,
|
|
25094
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
25095
|
+
stencilBuffer: attributes.stencil,
|
|
25096
|
+
encoding: renderer.outputEncoding,
|
|
25097
|
+
samples: attributes.antialias ? 4 : 0
|
|
25098
|
+
} );
|
|
24911
25099
|
|
|
24912
|
-
|
|
25100
|
+
const renderTargetProperties = renderer.properties.get( newRenderTarget );
|
|
25101
|
+
renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
|
|
24913
25102
|
|
|
24914
25103
|
}
|
|
24915
25104
|
|
|
@@ -26080,7 +26269,6 @@
|
|
|
26080
26269
|
const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(),
|
|
26081
26270
|
_context = parameters.context !== undefined ? parameters.context : null,
|
|
26082
26271
|
|
|
26083
|
-
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
|
|
26084
26272
|
_depth = parameters.depth !== undefined ? parameters.depth : true,
|
|
26085
26273
|
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
|
|
26086
26274
|
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
|
|
@@ -26089,6 +26277,18 @@
|
|
|
26089
26277
|
_powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',
|
|
26090
26278
|
_failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;
|
|
26091
26279
|
|
|
26280
|
+
let _alpha;
|
|
26281
|
+
|
|
26282
|
+
if ( parameters.context !== undefined ) {
|
|
26283
|
+
|
|
26284
|
+
_alpha = _context.getContextAttributes().alpha;
|
|
26285
|
+
|
|
26286
|
+
} else {
|
|
26287
|
+
|
|
26288
|
+
_alpha = parameters.alpha !== undefined ? parameters.alpha : false;
|
|
26289
|
+
|
|
26290
|
+
}
|
|
26291
|
+
|
|
26092
26292
|
let currentRenderList = null;
|
|
26093
26293
|
let currentRenderState = null;
|
|
26094
26294
|
|
|
@@ -26190,6 +26390,7 @@
|
|
|
26190
26390
|
|
|
26191
26391
|
const _projScreenMatrix = new Matrix4();
|
|
26192
26392
|
|
|
26393
|
+
const _vector2 = new Vector2();
|
|
26193
26394
|
const _vector3 = new Vector3();
|
|
26194
26395
|
|
|
26195
26396
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
@@ -26542,13 +26743,13 @@
|
|
|
26542
26743
|
|
|
26543
26744
|
};
|
|
26544
26745
|
|
|
26545
|
-
this.clear = function ( color, depth, stencil ) {
|
|
26746
|
+
this.clear = function ( color = true, depth = true, stencil = true ) {
|
|
26546
26747
|
|
|
26547
26748
|
let bits = 0;
|
|
26548
26749
|
|
|
26549
|
-
if ( color
|
|
26550
|
-
if ( depth
|
|
26551
|
-
if ( stencil
|
|
26750
|
+
if ( color ) bits |= 16384;
|
|
26751
|
+
if ( depth ) bits |= 256;
|
|
26752
|
+
if ( stencil ) bits |= 1024;
|
|
26552
26753
|
|
|
26553
26754
|
_gl.clear( bits );
|
|
26554
26755
|
|
|
@@ -27030,14 +27231,6 @@
|
|
|
27030
27231
|
|
|
27031
27232
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
27032
27233
|
|
|
27033
|
-
// Ensure depth buffer writing is enabled so it can be cleared on next render
|
|
27034
|
-
|
|
27035
|
-
state.buffers.depth.setTest( true );
|
|
27036
|
-
state.buffers.depth.setMask( true );
|
|
27037
|
-
state.buffers.color.setMask( true );
|
|
27038
|
-
|
|
27039
|
-
state.setPolygonOffset( false );
|
|
27040
|
-
|
|
27041
27234
|
// _gl.finish();
|
|
27042
27235
|
|
|
27043
27236
|
bindingStates.resetDefaultState();
|
|
@@ -27200,27 +27393,45 @@
|
|
|
27200
27393
|
if ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );
|
|
27201
27394
|
if ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );
|
|
27202
27395
|
|
|
27396
|
+
// Ensure depth buffer writing is enabled so it can be cleared on next render
|
|
27397
|
+
|
|
27398
|
+
state.buffers.depth.setTest( true );
|
|
27399
|
+
state.buffers.depth.setMask( true );
|
|
27400
|
+
state.buffers.color.setMask( true );
|
|
27401
|
+
|
|
27402
|
+
state.setPolygonOffset( false );
|
|
27403
|
+
|
|
27203
27404
|
}
|
|
27204
27405
|
|
|
27205
27406
|
function renderTransmissionPass( opaqueObjects, scene, camera ) {
|
|
27206
27407
|
|
|
27207
|
-
|
|
27408
|
+
const isWebGL2 = capabilities.isWebGL2;
|
|
27208
27409
|
|
|
27209
|
-
|
|
27210
|
-
const renderTargetType = needsAntialias ? WebGLMultisampleRenderTarget : WebGLRenderTarget;
|
|
27410
|
+
if ( _transmissionRenderTarget === null ) {
|
|
27211
27411
|
|
|
27212
|
-
_transmissionRenderTarget = new
|
|
27412
|
+
_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
|
|
27213
27413
|
generateMipmaps: true,
|
|
27214
27414
|
type: utils.convert( HalfFloatType ) !== null ? HalfFloatType : UnsignedByteType,
|
|
27215
27415
|
minFilter: LinearMipmapLinearFilter,
|
|
27216
|
-
|
|
27217
|
-
wrapS: ClampToEdgeWrapping,
|
|
27218
|
-
wrapT: ClampToEdgeWrapping,
|
|
27219
|
-
useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
|
|
27416
|
+
samples: ( isWebGL2 && _antialias === true ) ? 4 : 0
|
|
27220
27417
|
} );
|
|
27221
27418
|
|
|
27222
27419
|
}
|
|
27223
27420
|
|
|
27421
|
+
_this.getDrawingBufferSize( _vector2 );
|
|
27422
|
+
|
|
27423
|
+
if ( isWebGL2 ) {
|
|
27424
|
+
|
|
27425
|
+
_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
|
|
27426
|
+
|
|
27427
|
+
} else {
|
|
27428
|
+
|
|
27429
|
+
_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
|
|
27430
|
+
|
|
27431
|
+
}
|
|
27432
|
+
|
|
27433
|
+
//
|
|
27434
|
+
|
|
27224
27435
|
const currentRenderTarget = _this.getRenderTarget();
|
|
27225
27436
|
_this.setRenderTarget( _transmissionRenderTarget );
|
|
27226
27437
|
_this.clear();
|
|
@@ -27418,6 +27629,7 @@
|
|
|
27418
27629
|
materialProperties.skinning = parameters.skinning;
|
|
27419
27630
|
materialProperties.morphTargets = parameters.morphTargets;
|
|
27420
27631
|
materialProperties.morphNormals = parameters.morphNormals;
|
|
27632
|
+
materialProperties.morphColors = parameters.morphColors;
|
|
27421
27633
|
materialProperties.morphTargetsCount = parameters.morphTargetsCount;
|
|
27422
27634
|
materialProperties.numClippingPlanes = parameters.numClippingPlanes;
|
|
27423
27635
|
materialProperties.numIntersection = parameters.numClipIntersection;
|
|
@@ -27441,9 +27653,12 @@
|
|
|
27441
27653
|
const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
|
|
27442
27654
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
27443
27655
|
const morphNormals = !! geometry.morphAttributes.normal;
|
|
27444
|
-
const
|
|
27656
|
+
const morphColors = !! geometry.morphAttributes.color;
|
|
27445
27657
|
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;
|
|
27446
27658
|
|
|
27659
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
27660
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
27661
|
+
|
|
27447
27662
|
const materialProperties = properties.get( material );
|
|
27448
27663
|
const lights = currentRenderState.state.lights;
|
|
27449
27664
|
|
|
@@ -27524,6 +27739,10 @@
|
|
|
27524
27739
|
|
|
27525
27740
|
needsProgramChange = true;
|
|
27526
27741
|
|
|
27742
|
+
} else if ( materialProperties.morphColors !== morphColors ) {
|
|
27743
|
+
|
|
27744
|
+
needsProgramChange = true;
|
|
27745
|
+
|
|
27527
27746
|
} else if ( materialProperties.toneMapping !== toneMapping ) {
|
|
27528
27747
|
|
|
27529
27748
|
needsProgramChange = true;
|
|
@@ -27674,7 +27893,9 @@
|
|
|
27674
27893
|
|
|
27675
27894
|
}
|
|
27676
27895
|
|
|
27677
|
-
|
|
27896
|
+
const morphAttributes = geometry.morphAttributes;
|
|
27897
|
+
|
|
27898
|
+
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
|
|
27678
27899
|
|
|
27679
27900
|
morphtargets.update( object, geometry, material, program );
|
|
27680
27901
|
|
|
@@ -27760,6 +27981,13 @@
|
|
|
27760
27981
|
uniforms.rectAreaLights.needsUpdate = value;
|
|
27761
27982
|
uniforms.hemisphereLights.needsUpdate = value;
|
|
27762
27983
|
|
|
27984
|
+
uniforms.directionalShadowMap.needsUpdate = value;
|
|
27985
|
+
uniforms.directionalShadowMatrix.needsUpdate = value;
|
|
27986
|
+
uniforms.spotShadowMap.needsUpdate = value;
|
|
27987
|
+
uniforms.spotShadowMatrix.needsUpdate = value;
|
|
27988
|
+
uniforms.pointShadowMap.needsUpdate = value;
|
|
27989
|
+
uniforms.pointShadowMatrix.needsUpdate = value;
|
|
27990
|
+
|
|
27763
27991
|
}
|
|
27764
27992
|
|
|
27765
27993
|
function materialNeedsLights( material ) {
|
|
@@ -27804,9 +28032,9 @@
|
|
|
27804
28032
|
|
|
27805
28033
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
27806
28034
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
27807
|
-
if (
|
|
28035
|
+
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
|
|
27808
28036
|
|
|
27809
|
-
console.warn( '
|
|
28037
|
+
console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
|
|
27810
28038
|
renderTarget.useRenderToTexture = false;
|
|
27811
28039
|
renderTarget.useRenderbuffer = true;
|
|
27812
28040
|
|
|
@@ -27831,6 +28059,7 @@
|
|
|
27831
28059
|
_currentRenderTarget = renderTarget;
|
|
27832
28060
|
_currentActiveCubeFace = activeCubeFace;
|
|
27833
28061
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
28062
|
+
|
|
27834
28063
|
let useDefaultFramebuffer = true;
|
|
27835
28064
|
|
|
27836
28065
|
if ( renderTarget ) {
|
|
@@ -27864,7 +28093,7 @@
|
|
|
27864
28093
|
|
|
27865
28094
|
const texture = renderTarget.texture;
|
|
27866
28095
|
|
|
27867
|
-
if ( texture.
|
|
28096
|
+
if ( texture.isData3DTexture || texture.isDataArrayTexture ) {
|
|
27868
28097
|
|
|
27869
28098
|
isRenderTarget3D = true;
|
|
27870
28099
|
|
|
@@ -27877,7 +28106,7 @@
|
|
|
27877
28106
|
framebuffer = __webglFramebuffer[ activeCubeFace ];
|
|
27878
28107
|
isCube = true;
|
|
27879
28108
|
|
|
27880
|
-
} else if ( renderTarget.
|
|
28109
|
+
} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
|
|
27881
28110
|
|
|
27882
28111
|
framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
|
|
27883
28112
|
|
|
@@ -28079,12 +28308,12 @@
|
|
|
28079
28308
|
const glType = utils.convert( dstTexture.type );
|
|
28080
28309
|
let glTarget;
|
|
28081
28310
|
|
|
28082
|
-
if ( dstTexture.
|
|
28311
|
+
if ( dstTexture.isData3DTexture ) {
|
|
28083
28312
|
|
|
28084
28313
|
textures.setTexture3D( dstTexture, 0 );
|
|
28085
28314
|
glTarget = 32879;
|
|
28086
28315
|
|
|
28087
|
-
} else if ( dstTexture.
|
|
28316
|
+
} else if ( dstTexture.isDataArrayTexture ) {
|
|
28088
28317
|
|
|
28089
28318
|
textures.setTexture2DArray( dstTexture, 0 );
|
|
28090
28319
|
glTarget = 35866;
|
|
@@ -28114,7 +28343,7 @@
|
|
|
28114
28343
|
_gl.pixelStorei( 3315, sourceBox.min.y );
|
|
28115
28344
|
_gl.pixelStorei( 32877, sourceBox.min.z );
|
|
28116
28345
|
|
|
28117
|
-
if ( srcTexture.isDataTexture || srcTexture.
|
|
28346
|
+
if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
|
|
28118
28347
|
|
|
28119
28348
|
_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );
|
|
28120
28349
|
|
|
@@ -29054,9 +29283,6 @@
|
|
|
29054
29283
|
|
|
29055
29284
|
this.image = { data: data, width: width, height: height };
|
|
29056
29285
|
|
|
29057
|
-
this.magFilter = magFilter;
|
|
29058
|
-
this.minFilter = minFilter;
|
|
29059
|
-
|
|
29060
29286
|
this.generateMipmaps = false;
|
|
29061
29287
|
this.flipY = false;
|
|
29062
29288
|
this.unpackAlignment = 1;
|
|
@@ -31907,9 +32133,9 @@
|
|
|
31907
32133
|
for ( let i = 0, curves = this.curves; i < curves.length; i ++ ) {
|
|
31908
32134
|
|
|
31909
32135
|
const curve = curves[ i ];
|
|
31910
|
-
const resolution =
|
|
31911
|
-
: ( curve
|
|
31912
|
-
:
|
|
32136
|
+
const resolution = curve.isEllipseCurve ? divisions * 2
|
|
32137
|
+
: ( curve.isLineCurve || curve.isLineCurve3 ) ? 1
|
|
32138
|
+
: curve.isSplineCurve ? divisions * curve.points.length
|
|
31913
32139
|
: divisions;
|
|
31914
32140
|
|
|
31915
32141
|
const pts = curve.getPoints( resolution );
|
|
@@ -34559,7 +34785,8 @@
|
|
|
34559
34785
|
|
|
34560
34786
|
} else {
|
|
34561
34787
|
|
|
34562
|
-
edges.add( hash1
|
|
34788
|
+
edges.add( hash1 );
|
|
34789
|
+
edges.add( hash2 );
|
|
34563
34790
|
return true;
|
|
34564
34791
|
|
|
34565
34792
|
}
|
|
@@ -34601,6 +34828,20 @@
|
|
|
34601
34828
|
|
|
34602
34829
|
ShadowMaterial.prototype.isShadowMaterial = true;
|
|
34603
34830
|
|
|
34831
|
+
class RawShaderMaterial extends ShaderMaterial {
|
|
34832
|
+
|
|
34833
|
+
constructor( parameters ) {
|
|
34834
|
+
|
|
34835
|
+
super( parameters );
|
|
34836
|
+
|
|
34837
|
+
this.type = 'RawShaderMaterial';
|
|
34838
|
+
|
|
34839
|
+
}
|
|
34840
|
+
|
|
34841
|
+
}
|
|
34842
|
+
|
|
34843
|
+
RawShaderMaterial.prototype.isRawShaderMaterial = true;
|
|
34844
|
+
|
|
34604
34845
|
/**
|
|
34605
34846
|
* parameters = {
|
|
34606
34847
|
* color: <hex>,
|
|
@@ -35580,6 +35821,33 @@
|
|
|
35580
35821
|
|
|
35581
35822
|
LineDashedMaterial.prototype.isLineDashedMaterial = true;
|
|
35582
35823
|
|
|
35824
|
+
const materialLib = {
|
|
35825
|
+
ShadowMaterial,
|
|
35826
|
+
SpriteMaterial,
|
|
35827
|
+
RawShaderMaterial,
|
|
35828
|
+
ShaderMaterial,
|
|
35829
|
+
PointsMaterial,
|
|
35830
|
+
MeshPhysicalMaterial,
|
|
35831
|
+
MeshStandardMaterial,
|
|
35832
|
+
MeshPhongMaterial,
|
|
35833
|
+
MeshToonMaterial,
|
|
35834
|
+
MeshNormalMaterial,
|
|
35835
|
+
MeshLambertMaterial,
|
|
35836
|
+
MeshDepthMaterial,
|
|
35837
|
+
MeshDistanceMaterial,
|
|
35838
|
+
MeshBasicMaterial,
|
|
35839
|
+
MeshMatcapMaterial,
|
|
35840
|
+
LineDashedMaterial,
|
|
35841
|
+
LineBasicMaterial,
|
|
35842
|
+
Material
|
|
35843
|
+
};
|
|
35844
|
+
|
|
35845
|
+
Material.fromType = function ( type ) {
|
|
35846
|
+
|
|
35847
|
+
return new materialLib[ type ]();
|
|
35848
|
+
|
|
35849
|
+
};
|
|
35850
|
+
|
|
35583
35851
|
const AnimationUtils = {
|
|
35584
35852
|
|
|
35585
35853
|
// same as Array.prototype.slice, but also works on typed arrays
|
|
@@ -37194,7 +37462,7 @@
|
|
|
37194
37462
|
|
|
37195
37463
|
}
|
|
37196
37464
|
|
|
37197
|
-
duration = morphTargetNames.length *
|
|
37465
|
+
duration = morphTargetNames.length * fps;
|
|
37198
37466
|
|
|
37199
37467
|
} else {
|
|
37200
37468
|
|
|
@@ -37721,7 +37989,9 @@
|
|
|
37721
37989
|
|
|
37722
37990
|
}
|
|
37723
37991
|
|
|
37724
|
-
|
|
37992
|
+
// Workaround: Checking if response.body === undefined for Alipay browser #23548
|
|
37993
|
+
|
|
37994
|
+
if ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {
|
|
37725
37995
|
|
|
37726
37996
|
return response;
|
|
37727
37997
|
|
|
@@ -37966,7 +38236,7 @@
|
|
|
37966
38236
|
image.addEventListener( 'load', onImageLoad, false );
|
|
37967
38237
|
image.addEventListener( 'error', onImageError, false );
|
|
37968
38238
|
|
|
37969
|
-
if ( url.
|
|
38239
|
+
if ( url.slice( 0, 5 ) !== 'data:' ) {
|
|
37970
38240
|
|
|
37971
38241
|
if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
|
|
37972
38242
|
|
|
@@ -38983,7 +39253,7 @@
|
|
|
38983
39253
|
|
|
38984
39254
|
if ( index === - 1 ) return './';
|
|
38985
39255
|
|
|
38986
|
-
return url.
|
|
39256
|
+
return url.slice( 0, index + 1 );
|
|
38987
39257
|
|
|
38988
39258
|
}
|
|
38989
39259
|
|
|
@@ -40199,7 +40469,7 @@
|
|
|
40199
40469
|
|
|
40200
40470
|
const matches = _trackRe.exec( trackName );
|
|
40201
40471
|
|
|
40202
|
-
if (
|
|
40472
|
+
if ( matches === null ) {
|
|
40203
40473
|
|
|
40204
40474
|
throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
|
|
40205
40475
|
|
|
@@ -40245,7 +40515,7 @@
|
|
|
40245
40515
|
|
|
40246
40516
|
static findNode( root, nodeName ) {
|
|
40247
40517
|
|
|
40248
|
-
if (
|
|
40518
|
+
if ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
|
|
40249
40519
|
|
|
40250
40520
|
return root;
|
|
40251
40521
|
|
|
@@ -42279,13 +42549,13 @@
|
|
|
42279
42549
|
|
|
42280
42550
|
setFromCamera( coords, camera ) {
|
|
42281
42551
|
|
|
42282
|
-
if ( camera
|
|
42552
|
+
if ( camera.isPerspectiveCamera ) {
|
|
42283
42553
|
|
|
42284
42554
|
this.ray.origin.setFromMatrixPosition( camera.matrixWorld );
|
|
42285
42555
|
this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();
|
|
42286
42556
|
this.camera = camera;
|
|
42287
42557
|
|
|
42288
|
-
} else if ( camera
|
|
42558
|
+
} else if ( camera.isOrthographicCamera ) {
|
|
42289
42559
|
|
|
42290
42560
|
this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
|
|
42291
42561
|
this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
|
|
@@ -42641,7 +42911,7 @@
|
|
|
42641
42911
|
|
|
42642
42912
|
const boneList = [];
|
|
42643
42913
|
|
|
42644
|
-
if ( object
|
|
42914
|
+
if ( object.isBone === true ) {
|
|
42645
42915
|
|
|
42646
42916
|
boneList.push( object );
|
|
42647
42917
|
|
|
@@ -42905,7 +43175,7 @@
|
|
|
42905
43175
|
if ( newShapes.length > 1 ) {
|
|
42906
43176
|
|
|
42907
43177
|
let ambiguous = false;
|
|
42908
|
-
|
|
43178
|
+
let toChange = 0;
|
|
42909
43179
|
|
|
42910
43180
|
for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
|
|
42911
43181
|
|
|
@@ -42926,7 +43196,8 @@
|
|
|
42926
43196
|
|
|
42927
43197
|
if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
|
|
42928
43198
|
|
|
42929
|
-
if ( sIdx !== s2Idx ) toChange
|
|
43199
|
+
if ( sIdx !== s2Idx ) toChange ++;
|
|
43200
|
+
|
|
42930
43201
|
if ( hole_unassigned ) {
|
|
42931
43202
|
|
|
42932
43203
|
hole_unassigned = false;
|
|
@@ -42951,12 +43222,10 @@
|
|
|
42951
43222
|
}
|
|
42952
43223
|
|
|
42953
43224
|
}
|
|
42954
|
-
// console.log("ambiguous: ", ambiguous);
|
|
42955
43225
|
|
|
42956
|
-
if ( toChange
|
|
43226
|
+
if ( toChange > 0 && ambiguous === false ) {
|
|
42957
43227
|
|
|
42958
|
-
|
|
42959
|
-
if ( ! ambiguous ) newShapeHoles = betterShapeHoles;
|
|
43228
|
+
newShapeHoles = betterShapeHoles;
|
|
42960
43229
|
|
|
42961
43230
|
}
|
|
42962
43231
|
|
|
@@ -43088,6 +43357,15 @@
|
|
|
43088
43357
|
|
|
43089
43358
|
};
|
|
43090
43359
|
|
|
43360
|
+
//
|
|
43361
|
+
|
|
43362
|
+
Euler.prototype.toVector3 = function () {
|
|
43363
|
+
|
|
43364
|
+
console.error( 'THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead' );
|
|
43365
|
+
|
|
43366
|
+
};
|
|
43367
|
+
|
|
43368
|
+
|
|
43091
43369
|
//
|
|
43092
43370
|
|
|
43093
43371
|
Sphere.prototype.empty = function () {
|
|
@@ -49993,7 +50271,7 @@
|
|
|
49993
50271
|
|
|
49994
50272
|
}
|
|
49995
50273
|
|
|
49996
|
-
} else
|
|
50274
|
+
} else {
|
|
49997
50275
|
|
|
49998
50276
|
// non-indexed buffer geometry
|
|
49999
50277
|
|
|
@@ -72722,13 +73000,15 @@
|
|
|
72722
73000
|
|
|
72723
73001
|
state.scene = threeObj;
|
|
72724
73002
|
},
|
|
72725
|
-
update: function update(state) {
|
|
73003
|
+
update: function update(state, changedProps) {
|
|
72726
73004
|
// Data accessors
|
|
72727
73005
|
var latAccessor = index$1(state.objectLat);
|
|
72728
73006
|
var lngAccessor = index$1(state.objectLng);
|
|
72729
73007
|
var altitudeAccessor = index$1(state.objectAltitude);
|
|
72730
73008
|
var threeObjAccessor = index$1(state.objectThreeObject);
|
|
72731
73009
|
threeDigest(state.objectsData, state.scene, {
|
|
73010
|
+
// objs need to be recreated if this prop has changed
|
|
73011
|
+
purge: changedProps.hasOwnProperty('objectThreeObject'),
|
|
72732
73012
|
createObj: function createObj(d) {
|
|
72733
73013
|
var obj = threeObjAccessor(d);
|
|
72734
73014
|
|
|
@@ -72767,7 +73047,7 @@
|
|
|
72767
73047
|
|
|
72768
73048
|
state.scene = threeObj;
|
|
72769
73049
|
},
|
|
72770
|
-
update: function update(state) {
|
|
73050
|
+
update: function update(state, changedProps) {
|
|
72771
73051
|
if (!state.customThreeObjectUpdate) {
|
|
72772
73052
|
emptyObject(state.scene);
|
|
72773
73053
|
} // Clear the existing objects to create all new, if there's no update method (brute-force)
|
|
@@ -72776,6 +73056,8 @@
|
|
|
72776
73056
|
var customObjectAccessor = index$1(state.customThreeObject);
|
|
72777
73057
|
var customObjectUpdateAccessor = index$1(state.customThreeObjectUpdate);
|
|
72778
73058
|
threeDigest(state.customLayerData, state.scene, {
|
|
73059
|
+
// objs need to be recreated if this prop has changed
|
|
73060
|
+
purge: changedProps.hasOwnProperty('customThreeObject'),
|
|
72779
73061
|
createObj: function createObj(d) {
|
|
72780
73062
|
var obj = customObjectAccessor(d, GLOBE_RADIUS$1);
|
|
72781
73063
|
|
|
@@ -73540,9 +73822,6 @@
|
|
|
73540
73822
|
_state = STATE.PAN;
|
|
73541
73823
|
break;
|
|
73542
73824
|
|
|
73543
|
-
default:
|
|
73544
|
-
_state = STATE.NONE;
|
|
73545
|
-
|
|
73546
73825
|
}
|
|
73547
73826
|
|
|
73548
73827
|
}
|
|
@@ -75307,7 +75586,7 @@
|
|
|
75307
75586
|
* Full-screen textured quad shader
|
|
75308
75587
|
*/
|
|
75309
75588
|
|
|
75310
|
-
|
|
75589
|
+
const CopyShader = {
|
|
75311
75590
|
|
|
75312
75591
|
uniforms: {
|
|
75313
75592
|
|