globe.gl 2.25.1 → 2.25.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/globe.gl.js +1213 -934
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +4 -4
- package/example/satellites/index.html +7 -2
- package/package.json +4 -4
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.25.
|
|
1
|
+
// Version 2.25.2 globe.gl - https://github.com/vasturiano/globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
* Copyright 2010-2022 Three.js Authors
|
|
151
151
|
* SPDX-License-Identifier: MIT
|
|
152
152
|
*/
|
|
153
|
-
const REVISION = '
|
|
153
|
+
const REVISION = '138';
|
|
154
154
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
155
155
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
156
156
|
const CullFaceNone = 0;
|
|
@@ -2169,6 +2169,125 @@
|
|
|
2169
2169
|
|
|
2170
2170
|
}
|
|
2171
2171
|
|
|
2172
|
+
class Source {
|
|
2173
|
+
|
|
2174
|
+
constructor( data = null ) {
|
|
2175
|
+
|
|
2176
|
+
this.uuid = generateUUID();
|
|
2177
|
+
|
|
2178
|
+
this.data = data;
|
|
2179
|
+
|
|
2180
|
+
this.version = 0;
|
|
2181
|
+
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
set needsUpdate( value ) {
|
|
2185
|
+
|
|
2186
|
+
if ( value === true ) this.version ++;
|
|
2187
|
+
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
toJSON( meta ) {
|
|
2191
|
+
|
|
2192
|
+
const isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
2193
|
+
|
|
2194
|
+
if ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {
|
|
2195
|
+
|
|
2196
|
+
return meta.images[ this.uuid ];
|
|
2197
|
+
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
const output = {
|
|
2201
|
+
uuid: this.uuid,
|
|
2202
|
+
url: ''
|
|
2203
|
+
};
|
|
2204
|
+
|
|
2205
|
+
const data = this.data;
|
|
2206
|
+
|
|
2207
|
+
if ( data !== null ) {
|
|
2208
|
+
|
|
2209
|
+
let url;
|
|
2210
|
+
|
|
2211
|
+
if ( Array.isArray( data ) ) {
|
|
2212
|
+
|
|
2213
|
+
// cube texture
|
|
2214
|
+
|
|
2215
|
+
url = [];
|
|
2216
|
+
|
|
2217
|
+
for ( let i = 0, l = data.length; i < l; i ++ ) {
|
|
2218
|
+
|
|
2219
|
+
if ( data[ i ].isDataTexture ) {
|
|
2220
|
+
|
|
2221
|
+
url.push( serializeImage( data[ i ].image ) );
|
|
2222
|
+
|
|
2223
|
+
} else {
|
|
2224
|
+
|
|
2225
|
+
url.push( serializeImage( data[ i ] ) );
|
|
2226
|
+
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
} else {
|
|
2232
|
+
|
|
2233
|
+
// texture
|
|
2234
|
+
|
|
2235
|
+
url = serializeImage( data );
|
|
2236
|
+
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
output.url = url;
|
|
2240
|
+
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
if ( ! isRootObject ) {
|
|
2244
|
+
|
|
2245
|
+
meta.images[ this.uuid ] = output;
|
|
2246
|
+
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
return output;
|
|
2250
|
+
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
function serializeImage( image ) {
|
|
2256
|
+
|
|
2257
|
+
if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
|
|
2258
|
+
( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
|
|
2259
|
+
( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
|
|
2260
|
+
|
|
2261
|
+
// default images
|
|
2262
|
+
|
|
2263
|
+
return ImageUtils.getDataURL( image );
|
|
2264
|
+
|
|
2265
|
+
} else {
|
|
2266
|
+
|
|
2267
|
+
if ( image.data ) {
|
|
2268
|
+
|
|
2269
|
+
// images of DataTexture
|
|
2270
|
+
|
|
2271
|
+
return {
|
|
2272
|
+
data: Array.prototype.slice.call( image.data ),
|
|
2273
|
+
width: image.width,
|
|
2274
|
+
height: image.height,
|
|
2275
|
+
type: image.data.constructor.name
|
|
2276
|
+
};
|
|
2277
|
+
|
|
2278
|
+
} else {
|
|
2279
|
+
|
|
2280
|
+
console.warn( 'THREE.Texture: Unable to serialize Texture.' );
|
|
2281
|
+
return {};
|
|
2282
|
+
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
Source.prototype.isSource = true;
|
|
2290
|
+
|
|
2172
2291
|
let textureId = 0;
|
|
2173
2292
|
|
|
2174
2293
|
class Texture extends EventDispatcher {
|
|
@@ -2183,7 +2302,7 @@
|
|
|
2183
2302
|
|
|
2184
2303
|
this.name = '';
|
|
2185
2304
|
|
|
2186
|
-
this.
|
|
2305
|
+
this.source = new Source( image );
|
|
2187
2306
|
this.mipmaps = [];
|
|
2188
2307
|
|
|
2189
2308
|
this.mapping = mapping;
|
|
@@ -2229,6 +2348,18 @@
|
|
|
2229
2348
|
|
|
2230
2349
|
}
|
|
2231
2350
|
|
|
2351
|
+
get image() {
|
|
2352
|
+
|
|
2353
|
+
return this.source.data;
|
|
2354
|
+
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
set image( value ) {
|
|
2358
|
+
|
|
2359
|
+
this.source.data = value;
|
|
2360
|
+
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2232
2363
|
updateMatrix() {
|
|
2233
2364
|
|
|
2234
2365
|
this.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );
|
|
@@ -2245,7 +2376,7 @@
|
|
|
2245
2376
|
|
|
2246
2377
|
this.name = source.name;
|
|
2247
2378
|
|
|
2248
|
-
this.
|
|
2379
|
+
this.source = source.source;
|
|
2249
2380
|
this.mipmaps = source.mipmaps.slice( 0 );
|
|
2250
2381
|
|
|
2251
2382
|
this.mapping = source.mapping;
|
|
@@ -2303,6 +2434,8 @@
|
|
|
2303
2434
|
uuid: this.uuid,
|
|
2304
2435
|
name: this.name,
|
|
2305
2436
|
|
|
2437
|
+
image: this.source.toJSON( meta ).uuid,
|
|
2438
|
+
|
|
2306
2439
|
mapping: this.mapping,
|
|
2307
2440
|
|
|
2308
2441
|
repeat: [ this.repeat.x, this.repeat.y ],
|
|
@@ -2327,63 +2460,6 @@
|
|
|
2327
2460
|
|
|
2328
2461
|
};
|
|
2329
2462
|
|
|
2330
|
-
if ( this.image !== undefined ) {
|
|
2331
|
-
|
|
2332
|
-
// TODO: Move to THREE.Image
|
|
2333
|
-
|
|
2334
|
-
const image = this.image;
|
|
2335
|
-
|
|
2336
|
-
if ( image.uuid === undefined ) {
|
|
2337
|
-
|
|
2338
|
-
image.uuid = generateUUID(); // UGH
|
|
2339
|
-
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
if ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {
|
|
2343
|
-
|
|
2344
|
-
let url;
|
|
2345
|
-
|
|
2346
|
-
if ( Array.isArray( image ) ) {
|
|
2347
|
-
|
|
2348
|
-
// process array of images e.g. CubeTexture
|
|
2349
|
-
|
|
2350
|
-
url = [];
|
|
2351
|
-
|
|
2352
|
-
for ( let i = 0, l = image.length; i < l; i ++ ) {
|
|
2353
|
-
|
|
2354
|
-
// check cube texture with data textures
|
|
2355
|
-
|
|
2356
|
-
if ( image[ i ].isDataTexture ) {
|
|
2357
|
-
|
|
2358
|
-
url.push( serializeImage( image[ i ].image ) );
|
|
2359
|
-
|
|
2360
|
-
} else {
|
|
2361
|
-
|
|
2362
|
-
url.push( serializeImage( image[ i ] ) );
|
|
2363
|
-
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
} else {
|
|
2369
|
-
|
|
2370
|
-
// process single image
|
|
2371
|
-
|
|
2372
|
-
url = serializeImage( image );
|
|
2373
|
-
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
meta.images[ image.uuid ] = {
|
|
2377
|
-
uuid: image.uuid,
|
|
2378
|
-
url: url
|
|
2379
|
-
};
|
|
2380
|
-
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
output.image = image.uuid;
|
|
2384
|
-
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
2463
|
if ( JSON.stringify( this.userData ) !== '{}' ) output.userData = this.userData;
|
|
2388
2464
|
|
|
2389
2465
|
if ( ! isRootObject ) {
|
|
@@ -2484,51 +2560,22 @@
|
|
|
2484
2560
|
|
|
2485
2561
|
set needsUpdate( value ) {
|
|
2486
2562
|
|
|
2487
|
-
if ( value === true )
|
|
2563
|
+
if ( value === true ) {
|
|
2564
|
+
|
|
2565
|
+
this.version ++;
|
|
2566
|
+
this.source.needsUpdate = true;
|
|
2567
|
+
|
|
2568
|
+
}
|
|
2488
2569
|
|
|
2489
2570
|
}
|
|
2490
2571
|
|
|
2491
2572
|
}
|
|
2492
2573
|
|
|
2493
|
-
Texture.DEFAULT_IMAGE =
|
|
2574
|
+
Texture.DEFAULT_IMAGE = null;
|
|
2494
2575
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
2495
2576
|
|
|
2496
2577
|
Texture.prototype.isTexture = true;
|
|
2497
2578
|
|
|
2498
|
-
function serializeImage( image ) {
|
|
2499
|
-
|
|
2500
|
-
if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
|
|
2501
|
-
( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
|
|
2502
|
-
( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
|
|
2503
|
-
|
|
2504
|
-
// default images
|
|
2505
|
-
|
|
2506
|
-
return ImageUtils.getDataURL( image );
|
|
2507
|
-
|
|
2508
|
-
} else {
|
|
2509
|
-
|
|
2510
|
-
if ( image.data ) {
|
|
2511
|
-
|
|
2512
|
-
// images of DataTexture
|
|
2513
|
-
|
|
2514
|
-
return {
|
|
2515
|
-
data: Array.prototype.slice.call( image.data ),
|
|
2516
|
-
width: image.width,
|
|
2517
|
-
height: image.height,
|
|
2518
|
-
type: image.data.constructor.name
|
|
2519
|
-
};
|
|
2520
|
-
|
|
2521
|
-
} else {
|
|
2522
|
-
|
|
2523
|
-
console.warn( 'THREE.Texture: Unable to serialize Texture.' );
|
|
2524
|
-
return {};
|
|
2525
|
-
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
|
-
}
|
|
2531
|
-
|
|
2532
2579
|
class Vector4 {
|
|
2533
2580
|
|
|
2534
2581
|
constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
@@ -3212,10 +3259,10 @@
|
|
|
3212
3259
|
|
|
3213
3260
|
this.viewport = new Vector4( 0, 0, width, height );
|
|
3214
3261
|
|
|
3215
|
-
|
|
3216
|
-
this.texture.isRenderTargetTexture = true;
|
|
3262
|
+
const image = { width: width, height: height, depth: 1 };
|
|
3217
3263
|
|
|
3218
|
-
this.texture
|
|
3264
|
+
this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
|
|
3265
|
+
this.texture.isRenderTargetTexture = true;
|
|
3219
3266
|
|
|
3220
3267
|
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
|
|
3221
3268
|
this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
|
|
@@ -3223,19 +3270,10 @@
|
|
|
3223
3270
|
|
|
3224
3271
|
this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
|
|
3225
3272
|
this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
|
|
3226
|
-
this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
|
|
3227
|
-
|
|
3228
|
-
}
|
|
3229
3273
|
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
texture.image = {
|
|
3233
|
-
width: this.width,
|
|
3234
|
-
height: this.height,
|
|
3235
|
-
depth: this.depth
|
|
3236
|
-
};
|
|
3274
|
+
this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
|
|
3237
3275
|
|
|
3238
|
-
this.
|
|
3276
|
+
this.samples = options.samples !== undefined ? options.samples : 0;
|
|
3239
3277
|
|
|
3240
3278
|
}
|
|
3241
3279
|
|
|
@@ -3282,7 +3320,10 @@
|
|
|
3282
3320
|
|
|
3283
3321
|
this.depthBuffer = source.depthBuffer;
|
|
3284
3322
|
this.stencilBuffer = source.stencilBuffer;
|
|
3285
|
-
|
|
3323
|
+
|
|
3324
|
+
if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
|
|
3325
|
+
|
|
3326
|
+
this.samples = source.samples;
|
|
3286
3327
|
|
|
3287
3328
|
return this;
|
|
3288
3329
|
|
|
@@ -3298,12 +3339,102 @@
|
|
|
3298
3339
|
|
|
3299
3340
|
WebGLRenderTarget.prototype.isWebGLRenderTarget = true;
|
|
3300
3341
|
|
|
3301
|
-
class
|
|
3342
|
+
class DataArrayTexture extends Texture {
|
|
3343
|
+
|
|
3344
|
+
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
3345
|
+
|
|
3346
|
+
super( null );
|
|
3347
|
+
|
|
3348
|
+
this.image = { data, width, height, depth };
|
|
3349
|
+
|
|
3350
|
+
this.magFilter = NearestFilter;
|
|
3351
|
+
this.minFilter = NearestFilter;
|
|
3302
3352
|
|
|
3303
|
-
|
|
3353
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
3354
|
+
|
|
3355
|
+
this.generateMipmaps = false;
|
|
3356
|
+
this.flipY = false;
|
|
3357
|
+
this.unpackAlignment = 1;
|
|
3358
|
+
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
DataArrayTexture.prototype.isDataArrayTexture = true;
|
|
3364
|
+
|
|
3365
|
+
class WebGLArrayRenderTarget extends WebGLRenderTarget {
|
|
3366
|
+
|
|
3367
|
+
constructor( width, height, depth ) {
|
|
3368
|
+
|
|
3369
|
+
super( width, height );
|
|
3370
|
+
|
|
3371
|
+
this.depth = depth;
|
|
3372
|
+
|
|
3373
|
+
this.texture = new DataArrayTexture( null, width, height, depth );
|
|
3374
|
+
|
|
3375
|
+
this.texture.isRenderTargetTexture = true;
|
|
3376
|
+
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
WebGLArrayRenderTarget.prototype.isWebGLArrayRenderTarget = true;
|
|
3382
|
+
|
|
3383
|
+
class Data3DTexture extends Texture {
|
|
3384
|
+
|
|
3385
|
+
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
3386
|
+
|
|
3387
|
+
// We're going to add .setXXX() methods for setting properties later.
|
|
3388
|
+
// Users can still set in DataTexture3D directly.
|
|
3389
|
+
//
|
|
3390
|
+
// const texture = new THREE.DataTexture3D( data, width, height, depth );
|
|
3391
|
+
// texture.anisotropy = 16;
|
|
3392
|
+
//
|
|
3393
|
+
// See #14839
|
|
3394
|
+
|
|
3395
|
+
super( null );
|
|
3396
|
+
|
|
3397
|
+
this.image = { data, width, height, depth };
|
|
3398
|
+
|
|
3399
|
+
this.magFilter = NearestFilter;
|
|
3400
|
+
this.minFilter = NearestFilter;
|
|
3401
|
+
|
|
3402
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
3403
|
+
|
|
3404
|
+
this.generateMipmaps = false;
|
|
3405
|
+
this.flipY = false;
|
|
3406
|
+
this.unpackAlignment = 1;
|
|
3407
|
+
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
Data3DTexture.prototype.isData3DTexture = true;
|
|
3413
|
+
|
|
3414
|
+
class WebGL3DRenderTarget extends WebGLRenderTarget {
|
|
3415
|
+
|
|
3416
|
+
constructor( width, height, depth ) {
|
|
3304
3417
|
|
|
3305
3418
|
super( width, height );
|
|
3306
3419
|
|
|
3420
|
+
this.depth = depth;
|
|
3421
|
+
|
|
3422
|
+
this.texture = new Data3DTexture( null, width, height, depth );
|
|
3423
|
+
|
|
3424
|
+
this.texture.isRenderTargetTexture = true;
|
|
3425
|
+
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
WebGL3DRenderTarget.prototype.isWebGL3DRenderTarget = true;
|
|
3431
|
+
|
|
3432
|
+
class WebGLMultipleRenderTargets extends WebGLRenderTarget {
|
|
3433
|
+
|
|
3434
|
+
constructor( width, height, count, options = {} ) {
|
|
3435
|
+
|
|
3436
|
+
super( width, height, options );
|
|
3437
|
+
|
|
3307
3438
|
const texture = this.texture;
|
|
3308
3439
|
|
|
3309
3440
|
this.texture = [];
|
|
@@ -3374,36 +3505,6 @@
|
|
|
3374
3505
|
|
|
3375
3506
|
WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;
|
|
3376
3507
|
|
|
3377
|
-
class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
|
|
3378
|
-
|
|
3379
|
-
constructor( width, height, options = {} ) {
|
|
3380
|
-
|
|
3381
|
-
super( width, height, options );
|
|
3382
|
-
|
|
3383
|
-
this.samples = 4;
|
|
3384
|
-
|
|
3385
|
-
this.ignoreDepthForMultisampleCopy = options.ignoreDepth !== undefined ? options.ignoreDepth : true;
|
|
3386
|
-
this.useRenderToTexture = ( options.useRenderToTexture !== undefined ) ? options.useRenderToTexture : false;
|
|
3387
|
-
this.useRenderbuffer = this.useRenderToTexture === false;
|
|
3388
|
-
|
|
3389
|
-
}
|
|
3390
|
-
|
|
3391
|
-
copy( source ) {
|
|
3392
|
-
|
|
3393
|
-
super.copy.call( this, source );
|
|
3394
|
-
|
|
3395
|
-
this.samples = source.samples;
|
|
3396
|
-
this.useRenderToTexture = source.useRenderToTexture;
|
|
3397
|
-
this.useRenderbuffer = source.useRenderbuffer;
|
|
3398
|
-
|
|
3399
|
-
return this;
|
|
3400
|
-
|
|
3401
|
-
}
|
|
3402
|
-
|
|
3403
|
-
}
|
|
3404
|
-
|
|
3405
|
-
WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true;
|
|
3406
|
-
|
|
3407
3508
|
class Quaternion {
|
|
3408
3509
|
|
|
3409
3510
|
constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
@@ -4748,6 +4849,16 @@
|
|
|
4748
4849
|
|
|
4749
4850
|
}
|
|
4750
4851
|
|
|
4852
|
+
setFromEuler( e ) {
|
|
4853
|
+
|
|
4854
|
+
this.x = e._x;
|
|
4855
|
+
this.y = e._y;
|
|
4856
|
+
this.z = e._z;
|
|
4857
|
+
|
|
4858
|
+
return this;
|
|
4859
|
+
|
|
4860
|
+
}
|
|
4861
|
+
|
|
4751
4862
|
equals( v ) {
|
|
4752
4863
|
|
|
4753
4864
|
return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );
|
|
@@ -7244,20 +7355,6 @@
|
|
|
7244
7355
|
|
|
7245
7356
|
}
|
|
7246
7357
|
|
|
7247
|
-
toVector3( optionalResult ) {
|
|
7248
|
-
|
|
7249
|
-
if ( optionalResult ) {
|
|
7250
|
-
|
|
7251
|
-
return optionalResult.set( this._x, this._y, this._z );
|
|
7252
|
-
|
|
7253
|
-
} else {
|
|
7254
|
-
|
|
7255
|
-
return new Vector3( this._x, this._y, this._z );
|
|
7256
|
-
|
|
7257
|
-
}
|
|
7258
|
-
|
|
7259
|
-
}
|
|
7260
|
-
|
|
7261
7358
|
_onChange( callback ) {
|
|
7262
7359
|
|
|
7263
7360
|
this._onChangeCallback = callback;
|
|
@@ -7972,7 +8069,8 @@
|
|
|
7972
8069
|
images: {},
|
|
7973
8070
|
shapes: {},
|
|
7974
8071
|
skeletons: {},
|
|
7975
|
-
animations: {}
|
|
8072
|
+
animations: {},
|
|
8073
|
+
nodes: {}
|
|
7976
8074
|
};
|
|
7977
8075
|
|
|
7978
8076
|
output.metadata = {
|
|
@@ -8156,6 +8254,7 @@
|
|
|
8156
8254
|
const shapes = extractFromCache( meta.shapes );
|
|
8157
8255
|
const skeletons = extractFromCache( meta.skeletons );
|
|
8158
8256
|
const animations = extractFromCache( meta.animations );
|
|
8257
|
+
const nodes = extractFromCache( meta.nodes );
|
|
8159
8258
|
|
|
8160
8259
|
if ( geometries.length > 0 ) output.geometries = geometries;
|
|
8161
8260
|
if ( materials.length > 0 ) output.materials = materials;
|
|
@@ -8164,6 +8263,7 @@
|
|
|
8164
8263
|
if ( shapes.length > 0 ) output.shapes = shapes;
|
|
8165
8264
|
if ( skeletons.length > 0 ) output.skeletons = skeletons;
|
|
8166
8265
|
if ( animations.length > 0 ) output.animations = animations;
|
|
8266
|
+
if ( nodes.length > 0 ) output.nodes = nodes;
|
|
8167
8267
|
|
|
8168
8268
|
}
|
|
8169
8269
|
|
|
@@ -8701,9 +8801,9 @@
|
|
|
8701
8801
|
|
|
8702
8802
|
toJSON( meta ) {
|
|
8703
8803
|
|
|
8704
|
-
const
|
|
8804
|
+
const isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
8705
8805
|
|
|
8706
|
-
if (
|
|
8806
|
+
if ( isRootObject ) {
|
|
8707
8807
|
|
|
8708
8808
|
meta = {
|
|
8709
8809
|
textures: {},
|
|
@@ -8863,13 +8963,13 @@
|
|
|
8863
8963
|
data.stencilZPass = this.stencilZPass;
|
|
8864
8964
|
|
|
8865
8965
|
// rotation (SpriteMaterial)
|
|
8866
|
-
if ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation;
|
|
8966
|
+
if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
|
|
8867
8967
|
|
|
8868
8968
|
if ( this.polygonOffset === true ) data.polygonOffset = true;
|
|
8869
8969
|
if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
|
|
8870
8970
|
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
8871
8971
|
|
|
8872
|
-
if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;
|
|
8972
|
+
if ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;
|
|
8873
8973
|
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
|
|
8874
8974
|
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
|
|
8875
8975
|
if ( this.scale !== undefined ) data.scale = this.scale;
|
|
@@ -8911,7 +9011,7 @@
|
|
|
8911
9011
|
|
|
8912
9012
|
}
|
|
8913
9013
|
|
|
8914
|
-
if (
|
|
9014
|
+
if ( isRootObject ) {
|
|
8915
9015
|
|
|
8916
9016
|
const textures = extractFromCache( meta.textures );
|
|
8917
9017
|
const images = extractFromCache( meta.images );
|
|
@@ -9026,6 +9126,14 @@
|
|
|
9026
9126
|
|
|
9027
9127
|
Material.prototype.isMaterial = true;
|
|
9028
9128
|
|
|
9129
|
+
Material.fromType = function ( /*type*/ ) {
|
|
9130
|
+
|
|
9131
|
+
// TODO: Behavior added in Materials.js
|
|
9132
|
+
|
|
9133
|
+
return null;
|
|
9134
|
+
|
|
9135
|
+
};
|
|
9136
|
+
|
|
9029
9137
|
/**
|
|
9030
9138
|
* parameters = {
|
|
9031
9139
|
* color: <hex>,
|
|
@@ -10054,13 +10162,13 @@
|
|
|
10054
10162
|
|
|
10055
10163
|
const nVertices = positions.length / 3;
|
|
10056
10164
|
|
|
10057
|
-
if (
|
|
10165
|
+
if ( this.hasAttribute( 'tangent' ) === false ) {
|
|
10058
10166
|
|
|
10059
10167
|
this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
|
|
10060
10168
|
|
|
10061
10169
|
}
|
|
10062
10170
|
|
|
10063
|
-
const tangents =
|
|
10171
|
+
const tangents = this.getAttribute( 'tangent' ).array;
|
|
10064
10172
|
|
|
10065
10173
|
const tan1 = [], tan2 = [];
|
|
10066
10174
|
|
|
@@ -11951,19 +12059,14 @@
|
|
|
11951
12059
|
|
|
11952
12060
|
class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
11953
12061
|
|
|
11954
|
-
constructor( size, options
|
|
11955
|
-
|
|
11956
|
-
if ( Number.isInteger( options ) ) {
|
|
11957
|
-
|
|
11958
|
-
console.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );
|
|
11959
|
-
|
|
11960
|
-
options = dummy;
|
|
11961
|
-
|
|
11962
|
-
}
|
|
12062
|
+
constructor( size, options = {} ) {
|
|
11963
12063
|
|
|
11964
12064
|
super( size, size, options );
|
|
11965
12065
|
|
|
11966
|
-
|
|
12066
|
+
const image = { width: size, height: size, depth: 1 };
|
|
12067
|
+
const images = [ image, image, image, image, image, image ];
|
|
12068
|
+
|
|
12069
|
+
this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
|
|
11967
12070
|
|
|
11968
12071
|
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
11969
12072
|
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
@@ -11973,7 +12076,6 @@
|
|
|
11973
12076
|
// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
|
|
11974
12077
|
// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).
|
|
11975
12078
|
|
|
11976
|
-
this.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
|
|
11977
12079
|
this.texture.isRenderTargetTexture = true;
|
|
11978
12080
|
|
|
11979
12081
|
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
|
|
@@ -12519,16 +12621,12 @@
|
|
|
12519
12621
|
|
|
12520
12622
|
attribute.onUploadCallback();
|
|
12521
12623
|
|
|
12522
|
-
let type
|
|
12624
|
+
let type;
|
|
12523
12625
|
|
|
12524
12626
|
if ( array instanceof Float32Array ) {
|
|
12525
12627
|
|
|
12526
12628
|
type = 5126;
|
|
12527
12629
|
|
|
12528
|
-
} else if ( array instanceof Float64Array ) {
|
|
12529
|
-
|
|
12530
|
-
console.warn( 'THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.' );
|
|
12531
|
-
|
|
12532
12630
|
} else if ( array instanceof Uint16Array ) {
|
|
12533
12631
|
|
|
12534
12632
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -12539,7 +12637,7 @@
|
|
|
12539
12637
|
|
|
12540
12638
|
} else {
|
|
12541
12639
|
|
|
12542
|
-
|
|
12640
|
+
throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
|
|
12543
12641
|
|
|
12544
12642
|
}
|
|
12545
12643
|
|
|
@@ -12573,6 +12671,10 @@
|
|
|
12573
12671
|
|
|
12574
12672
|
type = 5121;
|
|
12575
12673
|
|
|
12674
|
+
} else {
|
|
12675
|
+
|
|
12676
|
+
throw new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );
|
|
12677
|
+
|
|
12576
12678
|
}
|
|
12577
12679
|
|
|
12578
12680
|
return {
|
|
@@ -12813,7 +12915,7 @@
|
|
|
12813
12915
|
|
|
12814
12916
|
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}";
|
|
12815
12917
|
|
|
12816
|
-
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define
|
|
12918
|
+
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";
|
|
12817
12919
|
|
|
12818
12920
|
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";
|
|
12819
12921
|
|
|
@@ -12897,11 +12999,13 @@
|
|
|
12897
12999
|
|
|
12898
13000
|
var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
|
|
12899
13001
|
|
|
12900
|
-
var
|
|
13002
|
+
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";
|
|
13003
|
+
|
|
13004
|
+
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";
|
|
12901
13005
|
|
|
12902
|
-
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\
|
|
13006
|
+
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";
|
|
12903
13007
|
|
|
12904
|
-
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\
|
|
13008
|
+
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";
|
|
12905
13009
|
|
|
12906
13010
|
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;";
|
|
12907
13011
|
|
|
@@ -12963,7 +13067,7 @@
|
|
|
12963
13067
|
|
|
12964
13068
|
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";
|
|
12965
13069
|
|
|
12966
|
-
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
|
|
13070
|
+
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";
|
|
12967
13071
|
|
|
12968
13072
|
var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
|
|
12969
13073
|
|
|
@@ -12999,19 +13103,19 @@
|
|
|
12999
13103
|
|
|
13000
13104
|
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}";
|
|
13001
13105
|
|
|
13002
|
-
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}";
|
|
13106
|
+
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}";
|
|
13003
13107
|
|
|
13004
13108
|
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}";
|
|
13005
13109
|
|
|
13006
|
-
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}";
|
|
13110
|
+
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}";
|
|
13007
13111
|
|
|
13008
13112
|
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}";
|
|
13009
13113
|
|
|
13010
|
-
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}";
|
|
13114
|
+
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}";
|
|
13011
13115
|
|
|
13012
13116
|
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}";
|
|
13013
13117
|
|
|
13014
|
-
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}";
|
|
13118
|
+
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}";
|
|
13015
13119
|
|
|
13016
13120
|
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}";
|
|
13017
13121
|
|
|
@@ -13019,19 +13123,19 @@
|
|
|
13019
13123
|
|
|
13020
13124
|
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}";
|
|
13021
13125
|
|
|
13022
|
-
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}";
|
|
13126
|
+
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}";
|
|
13023
13127
|
|
|
13024
13128
|
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}";
|
|
13025
13129
|
|
|
13026
|
-
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}";
|
|
13130
|
+
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}";
|
|
13027
13131
|
|
|
13028
13132
|
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}";
|
|
13029
13133
|
|
|
13030
|
-
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}";
|
|
13134
|
+
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}";
|
|
13031
13135
|
|
|
13032
13136
|
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}";
|
|
13033
13137
|
|
|
13034
|
-
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}";
|
|
13138
|
+
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}";
|
|
13035
13139
|
|
|
13036
13140
|
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}";
|
|
13037
13141
|
|
|
@@ -13105,6 +13209,7 @@
|
|
|
13105
13209
|
map_particle_pars_fragment: map_particle_pars_fragment,
|
|
13106
13210
|
metalnessmap_fragment: metalnessmap_fragment,
|
|
13107
13211
|
metalnessmap_pars_fragment: metalnessmap_pars_fragment,
|
|
13212
|
+
morphcolor_vertex: morphcolor_vertex,
|
|
13108
13213
|
morphnormal_vertex: morphnormal_vertex,
|
|
13109
13214
|
morphtarget_pars_vertex: morphtarget_pars_vertex,
|
|
13110
13215
|
morphtarget_vertex: morphtarget_vertex,
|
|
@@ -14278,7 +14383,7 @@
|
|
|
14278
14383
|
const stride = data.stride;
|
|
14279
14384
|
const offset = geometryAttribute.offset;
|
|
14280
14385
|
|
|
14281
|
-
if ( data
|
|
14386
|
+
if ( data.isInstancedInterleavedBuffer ) {
|
|
14282
14387
|
|
|
14283
14388
|
for ( let i = 0; i < programAttribute.locationSize; i ++ ) {
|
|
14284
14389
|
|
|
@@ -15083,23 +15188,7 @@
|
|
|
15083
15188
|
|
|
15084
15189
|
OrthographicCamera.prototype.isOrthographicCamera = true;
|
|
15085
15190
|
|
|
15086
|
-
class RawShaderMaterial extends ShaderMaterial {
|
|
15087
|
-
|
|
15088
|
-
constructor( parameters ) {
|
|
15089
|
-
|
|
15090
|
-
super( parameters );
|
|
15091
|
-
|
|
15092
|
-
this.type = 'RawShaderMaterial';
|
|
15093
|
-
|
|
15094
|
-
}
|
|
15095
|
-
|
|
15096
|
-
}
|
|
15097
|
-
|
|
15098
|
-
RawShaderMaterial.prototype.isRawShaderMaterial = true;
|
|
15099
|
-
|
|
15100
15191
|
const LOD_MIN = 4;
|
|
15101
|
-
const LOD_MAX = 8;
|
|
15102
|
-
const SIZE_MAX = Math.pow( 2, LOD_MAX );
|
|
15103
15192
|
|
|
15104
15193
|
// The standard deviations (radians) associated with the extra mips. These are
|
|
15105
15194
|
// chosen to approximate a Trowbridge-Reitz distribution function times the
|
|
@@ -15107,14 +15196,11 @@
|
|
|
15107
15196
|
// variance #defines in cube_uv_reflection_fragment.glsl.js.
|
|
15108
15197
|
const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];
|
|
15109
15198
|
|
|
15110
|
-
const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;
|
|
15111
|
-
|
|
15112
15199
|
// The maximum length of the blur for loop. Smaller sigmas will use fewer
|
|
15113
15200
|
// samples and exit early, but not recompile the shader.
|
|
15114
15201
|
const MAX_SAMPLES = 20;
|
|
15115
15202
|
|
|
15116
15203
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
15117
|
-
const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes();
|
|
15118
15204
|
const _clearColor = /*@__PURE__*/ new Color$1();
|
|
15119
15205
|
let _oldTarget = null;
|
|
15120
15206
|
|
|
@@ -15158,9 +15244,15 @@
|
|
|
15158
15244
|
this._renderer = renderer;
|
|
15159
15245
|
this._pingPongRenderTarget = null;
|
|
15160
15246
|
|
|
15161
|
-
this.
|
|
15162
|
-
this.
|
|
15163
|
-
this.
|
|
15247
|
+
this._lodMax = 0;
|
|
15248
|
+
this._cubeSize = 0;
|
|
15249
|
+
this._lodPlanes = [];
|
|
15250
|
+
this._sizeLods = [];
|
|
15251
|
+
this._sigmas = [];
|
|
15252
|
+
|
|
15253
|
+
this._blurMaterial = null;
|
|
15254
|
+
this._cubemapMaterial = null;
|
|
15255
|
+
this._equirectMaterial = null;
|
|
15164
15256
|
|
|
15165
15257
|
this._compileMaterial( this._blurMaterial );
|
|
15166
15258
|
|
|
@@ -15176,9 +15268,14 @@
|
|
|
15176
15268
|
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
|
|
15177
15269
|
|
|
15178
15270
|
_oldTarget = this._renderer.getRenderTarget();
|
|
15271
|
+
|
|
15272
|
+
this._setSize( 256 );
|
|
15273
|
+
|
|
15179
15274
|
const cubeUVRenderTarget = this._allocateTargets();
|
|
15275
|
+
cubeUVRenderTarget.depthBuffer = true;
|
|
15180
15276
|
|
|
15181
15277
|
this._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );
|
|
15278
|
+
|
|
15182
15279
|
if ( sigma > 0 ) {
|
|
15183
15280
|
|
|
15184
15281
|
this._blur( cubeUVRenderTarget, 0, 0, sigma );
|
|
@@ -15220,10 +15317,10 @@
|
|
|
15220
15317
|
*/
|
|
15221
15318
|
compileCubemapShader() {
|
|
15222
15319
|
|
|
15223
|
-
if ( this.
|
|
15320
|
+
if ( this._cubemapMaterial === null ) {
|
|
15224
15321
|
|
|
15225
|
-
this.
|
|
15226
|
-
this._compileMaterial( this.
|
|
15322
|
+
this._cubemapMaterial = _getCubemapMaterial();
|
|
15323
|
+
this._compileMaterial( this._cubemapMaterial );
|
|
15227
15324
|
|
|
15228
15325
|
}
|
|
15229
15326
|
|
|
@@ -15235,10 +15332,10 @@
|
|
|
15235
15332
|
*/
|
|
15236
15333
|
compileEquirectangularShader() {
|
|
15237
15334
|
|
|
15238
|
-
if ( this.
|
|
15335
|
+
if ( this._equirectMaterial === null ) {
|
|
15239
15336
|
|
|
15240
|
-
this.
|
|
15241
|
-
this._compileMaterial( this.
|
|
15337
|
+
this._equirectMaterial = _getEquirectMaterial();
|
|
15338
|
+
this._compileMaterial( this._equirectMaterial );
|
|
15242
15339
|
|
|
15243
15340
|
}
|
|
15244
15341
|
|
|
@@ -15251,23 +15348,36 @@
|
|
|
15251
15348
|
*/
|
|
15252
15349
|
dispose() {
|
|
15253
15350
|
|
|
15351
|
+
this._dispose();
|
|
15352
|
+
|
|
15353
|
+
if ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();
|
|
15354
|
+
if ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();
|
|
15355
|
+
|
|
15356
|
+
}
|
|
15357
|
+
|
|
15358
|
+
// private interface
|
|
15359
|
+
|
|
15360
|
+
_setSize( cubeSize ) {
|
|
15361
|
+
|
|
15362
|
+
this._lodMax = Math.floor( Math.log2( cubeSize ) );
|
|
15363
|
+
this._cubeSize = Math.pow( 2, this._lodMax );
|
|
15364
|
+
|
|
15365
|
+
}
|
|
15366
|
+
|
|
15367
|
+
_dispose() {
|
|
15368
|
+
|
|
15254
15369
|
this._blurMaterial.dispose();
|
|
15255
15370
|
|
|
15256
15371
|
if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
|
|
15257
15372
|
|
|
15258
|
-
|
|
15259
|
-
if ( this._equirectShader !== null ) this._equirectShader.dispose();
|
|
15373
|
+
for ( let i = 0; i < this._lodPlanes.length; i ++ ) {
|
|
15260
15374
|
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
_lodPlanes[ i ].dispose();
|
|
15375
|
+
this._lodPlanes[ i ].dispose();
|
|
15264
15376
|
|
|
15265
15377
|
}
|
|
15266
15378
|
|
|
15267
15379
|
}
|
|
15268
15380
|
|
|
15269
|
-
// private interface
|
|
15270
|
-
|
|
15271
15381
|
_cleanup( outputTarget ) {
|
|
15272
15382
|
|
|
15273
15383
|
this._renderer.setRenderTarget( _oldTarget );
|
|
@@ -15278,8 +15388,19 @@
|
|
|
15278
15388
|
|
|
15279
15389
|
_fromTexture( texture, renderTarget ) {
|
|
15280
15390
|
|
|
15391
|
+
if ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {
|
|
15392
|
+
|
|
15393
|
+
this._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );
|
|
15394
|
+
|
|
15395
|
+
} else { // Equirectangular
|
|
15396
|
+
|
|
15397
|
+
this._setSize( texture.image.width / 4 );
|
|
15398
|
+
|
|
15399
|
+
}
|
|
15400
|
+
|
|
15281
15401
|
_oldTarget = this._renderer.getRenderTarget();
|
|
15282
|
-
|
|
15402
|
+
|
|
15403
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
15283
15404
|
this._textureToCubeUV( texture, cubeUVRenderTarget );
|
|
15284
15405
|
this._applyPMREM( cubeUVRenderTarget );
|
|
15285
15406
|
this._cleanup( cubeUVRenderTarget );
|
|
@@ -15288,7 +15409,10 @@
|
|
|
15288
15409
|
|
|
15289
15410
|
}
|
|
15290
15411
|
|
|
15291
|
-
_allocateTargets(
|
|
15412
|
+
_allocateTargets() {
|
|
15413
|
+
|
|
15414
|
+
const width = 3 * Math.max( this._cubeSize, 16 * 7 );
|
|
15415
|
+
const height = 4 * this._cubeSize - 32;
|
|
15292
15416
|
|
|
15293
15417
|
const params = {
|
|
15294
15418
|
magFilter: LinearFilter,
|
|
@@ -15300,12 +15424,22 @@
|
|
|
15300
15424
|
depthBuffer: false
|
|
15301
15425
|
};
|
|
15302
15426
|
|
|
15303
|
-
const cubeUVRenderTarget = _createRenderTarget( params );
|
|
15304
|
-
cubeUVRenderTarget.depthBuffer = texture ? false : true;
|
|
15427
|
+
const cubeUVRenderTarget = _createRenderTarget( width, height, params );
|
|
15305
15428
|
|
|
15306
|
-
if ( this._pingPongRenderTarget === null ) {
|
|
15429
|
+
if ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width ) {
|
|
15307
15430
|
|
|
15308
|
-
this._pingPongRenderTarget
|
|
15431
|
+
if ( this._pingPongRenderTarget !== null ) {
|
|
15432
|
+
|
|
15433
|
+
this._dispose();
|
|
15434
|
+
|
|
15435
|
+
}
|
|
15436
|
+
|
|
15437
|
+
this._pingPongRenderTarget = _createRenderTarget( width, height, params );
|
|
15438
|
+
|
|
15439
|
+
const { _lodMax } = this;
|
|
15440
|
+
( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
|
|
15441
|
+
|
|
15442
|
+
this._blurMaterial = _getBlurShader( _lodMax, width, height );
|
|
15309
15443
|
|
|
15310
15444
|
}
|
|
15311
15445
|
|
|
@@ -15315,7 +15449,7 @@
|
|
|
15315
15449
|
|
|
15316
15450
|
_compileMaterial( material ) {
|
|
15317
15451
|
|
|
15318
|
-
const tmpMesh = new Mesh( _lodPlanes[ 0 ], material );
|
|
15452
|
+
const tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );
|
|
15319
15453
|
this._renderer.compile( tmpMesh, _flatCamera );
|
|
15320
15454
|
|
|
15321
15455
|
}
|
|
@@ -15368,6 +15502,7 @@
|
|
|
15368
15502
|
for ( let i = 0; i < 6; i ++ ) {
|
|
15369
15503
|
|
|
15370
15504
|
const col = i % 3;
|
|
15505
|
+
|
|
15371
15506
|
if ( col === 0 ) {
|
|
15372
15507
|
|
|
15373
15508
|
cubeCamera.up.set( 0, upSign[ i ], 0 );
|
|
@@ -15385,8 +15520,10 @@
|
|
|
15385
15520
|
|
|
15386
15521
|
}
|
|
15387
15522
|
|
|
15388
|
-
|
|
15389
|
-
|
|
15523
|
+
const size = this._cubeSize;
|
|
15524
|
+
|
|
15525
|
+
_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );
|
|
15526
|
+
|
|
15390
15527
|
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
15391
15528
|
|
|
15392
15529
|
if ( useSolidColor ) {
|
|
@@ -15416,38 +15553,34 @@
|
|
|
15416
15553
|
|
|
15417
15554
|
if ( isCubeTexture ) {
|
|
15418
15555
|
|
|
15419
|
-
if ( this.
|
|
15556
|
+
if ( this._cubemapMaterial === null ) {
|
|
15420
15557
|
|
|
15421
|
-
this.
|
|
15558
|
+
this._cubemapMaterial = _getCubemapMaterial();
|
|
15422
15559
|
|
|
15423
15560
|
}
|
|
15424
15561
|
|
|
15425
|
-
this.
|
|
15562
|
+
this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;
|
|
15426
15563
|
|
|
15427
15564
|
} else {
|
|
15428
15565
|
|
|
15429
|
-
if ( this.
|
|
15566
|
+
if ( this._equirectMaterial === null ) {
|
|
15430
15567
|
|
|
15431
|
-
this.
|
|
15568
|
+
this._equirectMaterial = _getEquirectMaterial();
|
|
15432
15569
|
|
|
15433
15570
|
}
|
|
15434
15571
|
|
|
15435
15572
|
}
|
|
15436
15573
|
|
|
15437
|
-
const material = isCubeTexture ? this.
|
|
15438
|
-
const mesh = new Mesh( _lodPlanes[ 0 ], material );
|
|
15574
|
+
const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;
|
|
15575
|
+
const mesh = new Mesh( this._lodPlanes[ 0 ], material );
|
|
15439
15576
|
|
|
15440
15577
|
const uniforms = material.uniforms;
|
|
15441
15578
|
|
|
15442
15579
|
uniforms[ 'envMap' ].value = texture;
|
|
15443
15580
|
|
|
15444
|
-
|
|
15581
|
+
const size = this._cubeSize;
|
|
15445
15582
|
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
}
|
|
15449
|
-
|
|
15450
|
-
_setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );
|
|
15583
|
+
_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );
|
|
15451
15584
|
|
|
15452
15585
|
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
15453
15586
|
renderer.render( mesh, _flatCamera );
|
|
@@ -15460,9 +15593,9 @@
|
|
|
15460
15593
|
const autoClear = renderer.autoClear;
|
|
15461
15594
|
renderer.autoClear = false;
|
|
15462
15595
|
|
|
15463
|
-
for ( let i = 1; i <
|
|
15596
|
+
for ( let i = 1; i < this._lodPlanes.length; i ++ ) {
|
|
15464
15597
|
|
|
15465
|
-
const sigma = Math.sqrt( _sigmas[ i ] * _sigmas[ i ] - _sigmas[ i - 1 ] * _sigmas[ i - 1 ] );
|
|
15598
|
+
const sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );
|
|
15466
15599
|
|
|
15467
15600
|
const poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];
|
|
15468
15601
|
|
|
@@ -15520,10 +15653,10 @@
|
|
|
15520
15653
|
// Number of standard deviations at which to cut off the discrete approximation.
|
|
15521
15654
|
const STANDARD_DEVIATIONS = 3;
|
|
15522
15655
|
|
|
15523
|
-
const blurMesh = new Mesh( _lodPlanes[ lodOut ], blurMaterial );
|
|
15656
|
+
const blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );
|
|
15524
15657
|
const blurUniforms = blurMaterial.uniforms;
|
|
15525
15658
|
|
|
15526
|
-
const pixels = _sizeLods[ lodIn ] - 1;
|
|
15659
|
+
const pixels = this._sizeLods[ lodIn ] - 1;
|
|
15527
15660
|
const radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );
|
|
15528
15661
|
const sigmaPixels = sigmaRadians / radiansPerPixel;
|
|
15529
15662
|
const samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;
|
|
@@ -15574,12 +15707,13 @@
|
|
|
15574
15707
|
|
|
15575
15708
|
}
|
|
15576
15709
|
|
|
15710
|
+
const { _lodMax } = this;
|
|
15577
15711
|
blurUniforms[ 'dTheta' ].value = radiansPerPixel;
|
|
15578
|
-
blurUniforms[ 'mipInt' ].value =
|
|
15712
|
+
blurUniforms[ 'mipInt' ].value = _lodMax - lodIn;
|
|
15579
15713
|
|
|
15580
|
-
const outputSize = _sizeLods[ lodOut ];
|
|
15581
|
-
const x = 3 *
|
|
15582
|
-
const y =
|
|
15714
|
+
const outputSize = this._sizeLods[ lodOut ];
|
|
15715
|
+
const x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );
|
|
15716
|
+
const y = 4 * ( this._cubeSize - outputSize );
|
|
15583
15717
|
|
|
15584
15718
|
_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );
|
|
15585
15719
|
renderer.setRenderTarget( targetOut );
|
|
@@ -15589,23 +15723,27 @@
|
|
|
15589
15723
|
|
|
15590
15724
|
}
|
|
15591
15725
|
|
|
15592
|
-
function _createPlanes() {
|
|
15593
15726
|
|
|
15594
|
-
const _lodPlanes = [];
|
|
15595
|
-
const _sizeLods = [];
|
|
15596
|
-
const _sigmas = [];
|
|
15597
15727
|
|
|
15598
|
-
|
|
15728
|
+
function _createPlanes( lodMax ) {
|
|
15729
|
+
|
|
15730
|
+
const lodPlanes = [];
|
|
15731
|
+
const sizeLods = [];
|
|
15732
|
+
const sigmas = [];
|
|
15733
|
+
|
|
15734
|
+
let lod = lodMax;
|
|
15599
15735
|
|
|
15600
|
-
|
|
15736
|
+
const totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;
|
|
15737
|
+
|
|
15738
|
+
for ( let i = 0; i < totalLods; i ++ ) {
|
|
15601
15739
|
|
|
15602
15740
|
const sizeLod = Math.pow( 2, lod );
|
|
15603
|
-
|
|
15741
|
+
sizeLods.push( sizeLod );
|
|
15604
15742
|
let sigma = 1.0 / sizeLod;
|
|
15605
15743
|
|
|
15606
|
-
if ( i >
|
|
15744
|
+
if ( i > lodMax - LOD_MIN ) {
|
|
15607
15745
|
|
|
15608
|
-
sigma = EXTRA_LOD_SIGMA[ i -
|
|
15746
|
+
sigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];
|
|
15609
15747
|
|
|
15610
15748
|
} else if ( i === 0 ) {
|
|
15611
15749
|
|
|
@@ -15613,7 +15751,7 @@
|
|
|
15613
15751
|
|
|
15614
15752
|
}
|
|
15615
15753
|
|
|
15616
|
-
|
|
15754
|
+
sigmas.push( sigma );
|
|
15617
15755
|
|
|
15618
15756
|
const texelSize = 1.0 / ( sizeLod - 1 );
|
|
15619
15757
|
const min = - texelSize / 2;
|
|
@@ -15653,7 +15791,7 @@
|
|
|
15653
15791
|
planes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );
|
|
15654
15792
|
planes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );
|
|
15655
15793
|
planes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );
|
|
15656
|
-
|
|
15794
|
+
lodPlanes.push( planes );
|
|
15657
15795
|
|
|
15658
15796
|
if ( lod > LOD_MIN ) {
|
|
15659
15797
|
|
|
@@ -15663,13 +15801,13 @@
|
|
|
15663
15801
|
|
|
15664
15802
|
}
|
|
15665
15803
|
|
|
15666
|
-
return {
|
|
15804
|
+
return { lodPlanes, sizeLods, sigmas };
|
|
15667
15805
|
|
|
15668
15806
|
}
|
|
15669
15807
|
|
|
15670
|
-
function _createRenderTarget( params ) {
|
|
15808
|
+
function _createRenderTarget( width, height, params ) {
|
|
15671
15809
|
|
|
15672
|
-
const cubeUVRenderTarget = new WebGLRenderTarget(
|
|
15810
|
+
const cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );
|
|
15673
15811
|
cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;
|
|
15674
15812
|
cubeUVRenderTarget.texture.name = 'PMREM.cubeUv';
|
|
15675
15813
|
cubeUVRenderTarget.scissorTest = true;
|
|
@@ -15684,15 +15822,20 @@
|
|
|
15684
15822
|
|
|
15685
15823
|
}
|
|
15686
15824
|
|
|
15687
|
-
function _getBlurShader(
|
|
15825
|
+
function _getBlurShader( lodMax, width, height ) {
|
|
15688
15826
|
|
|
15689
|
-
const weights = new Float32Array(
|
|
15827
|
+
const weights = new Float32Array( MAX_SAMPLES );
|
|
15690
15828
|
const poleAxis = new Vector3( 0, 1, 0 );
|
|
15691
|
-
const shaderMaterial = new
|
|
15829
|
+
const shaderMaterial = new ShaderMaterial( {
|
|
15692
15830
|
|
|
15693
15831
|
name: 'SphericalGaussianBlur',
|
|
15694
15832
|
|
|
15695
|
-
defines: {
|
|
15833
|
+
defines: {
|
|
15834
|
+
'n': MAX_SAMPLES,
|
|
15835
|
+
'CUBEUV_TEXEL_WIDTH': 1.0 / width,
|
|
15836
|
+
'CUBEUV_TEXEL_HEIGHT': 1.0 / height,
|
|
15837
|
+
'CUBEUV_MAX_MIP': `${lodMax}.0`,
|
|
15838
|
+
},
|
|
15696
15839
|
|
|
15697
15840
|
uniforms: {
|
|
15698
15841
|
'envMap': { value: null },
|
|
@@ -15778,16 +15921,14 @@
|
|
|
15778
15921
|
|
|
15779
15922
|
}
|
|
15780
15923
|
|
|
15781
|
-
function
|
|
15924
|
+
function _getEquirectMaterial() {
|
|
15782
15925
|
|
|
15783
|
-
|
|
15784
|
-
const shaderMaterial = new RawShaderMaterial( {
|
|
15926
|
+
return new ShaderMaterial( {
|
|
15785
15927
|
|
|
15786
15928
|
name: 'EquirectangularToCubeUV',
|
|
15787
15929
|
|
|
15788
15930
|
uniforms: {
|
|
15789
|
-
'envMap': { value: null }
|
|
15790
|
-
'texelSize': { value: texelSize }
|
|
15931
|
+
'envMap': { value: null }
|
|
15791
15932
|
},
|
|
15792
15933
|
|
|
15793
15934
|
vertexShader: _getCommonVertexShader(),
|
|
@@ -15800,30 +15941,15 @@
|
|
|
15800
15941
|
varying vec3 vOutputDirection;
|
|
15801
15942
|
|
|
15802
15943
|
uniform sampler2D envMap;
|
|
15803
|
-
uniform vec2 texelSize;
|
|
15804
15944
|
|
|
15805
15945
|
#include <common>
|
|
15806
15946
|
|
|
15807
15947
|
void main() {
|
|
15808
15948
|
|
|
15809
|
-
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
15810
|
-
|
|
15811
15949
|
vec3 outputDirection = normalize( vOutputDirection );
|
|
15812
15950
|
vec2 uv = equirectUv( outputDirection );
|
|
15813
15951
|
|
|
15814
|
-
|
|
15815
|
-
uv -= f * texelSize;
|
|
15816
|
-
vec3 tl = texture2D ( envMap, uv ).rgb;
|
|
15817
|
-
uv.x += texelSize.x;
|
|
15818
|
-
vec3 tr = texture2D ( envMap, uv ).rgb;
|
|
15819
|
-
uv.y += texelSize.y;
|
|
15820
|
-
vec3 br = texture2D ( envMap, uv ).rgb;
|
|
15821
|
-
uv.x -= texelSize.x;
|
|
15822
|
-
vec3 bl = texture2D ( envMap, uv ).rgb;
|
|
15823
|
-
|
|
15824
|
-
vec3 tm = mix( tl, tr, f.x );
|
|
15825
|
-
vec3 bm = mix( bl, br, f.x );
|
|
15826
|
-
gl_FragColor.rgb = mix( tm, bm, f.y );
|
|
15952
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
15827
15953
|
|
|
15828
15954
|
}
|
|
15829
15955
|
`,
|
|
@@ -15834,13 +15960,11 @@
|
|
|
15834
15960
|
|
|
15835
15961
|
} );
|
|
15836
15962
|
|
|
15837
|
-
return shaderMaterial;
|
|
15838
|
-
|
|
15839
15963
|
}
|
|
15840
15964
|
|
|
15841
|
-
function
|
|
15965
|
+
function _getCubemapMaterial() {
|
|
15842
15966
|
|
|
15843
|
-
|
|
15967
|
+
return new ShaderMaterial( {
|
|
15844
15968
|
|
|
15845
15969
|
name: 'CubemapToCubeUV',
|
|
15846
15970
|
|
|
@@ -15875,8 +15999,6 @@
|
|
|
15875
15999
|
|
|
15876
16000
|
} );
|
|
15877
16001
|
|
|
15878
|
-
return shaderMaterial;
|
|
15879
|
-
|
|
15880
16002
|
}
|
|
15881
16003
|
|
|
15882
16004
|
function _getCommonVertexShader() {
|
|
@@ -15886,8 +16008,6 @@
|
|
|
15886
16008
|
precision mediump float;
|
|
15887
16009
|
precision mediump int;
|
|
15888
16010
|
|
|
15889
|
-
attribute vec3 position;
|
|
15890
|
-
attribute vec2 uv;
|
|
15891
16011
|
attribute float faceIndex;
|
|
15892
16012
|
|
|
15893
16013
|
varying vec3 vOutputDirection;
|
|
@@ -16491,29 +16611,6 @@
|
|
|
16491
16611
|
|
|
16492
16612
|
}
|
|
16493
16613
|
|
|
16494
|
-
class DataTexture2DArray extends Texture {
|
|
16495
|
-
|
|
16496
|
-
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
16497
|
-
|
|
16498
|
-
super( null );
|
|
16499
|
-
|
|
16500
|
-
this.image = { data, width, height, depth };
|
|
16501
|
-
|
|
16502
|
-
this.magFilter = NearestFilter;
|
|
16503
|
-
this.minFilter = NearestFilter;
|
|
16504
|
-
|
|
16505
|
-
this.wrapR = ClampToEdgeWrapping;
|
|
16506
|
-
|
|
16507
|
-
this.generateMipmaps = false;
|
|
16508
|
-
this.flipY = false;
|
|
16509
|
-
this.unpackAlignment = 1;
|
|
16510
|
-
|
|
16511
|
-
}
|
|
16512
|
-
|
|
16513
|
-
}
|
|
16514
|
-
|
|
16515
|
-
DataTexture2DArray.prototype.isDataTexture2DArray = true;
|
|
16516
|
-
|
|
16517
16614
|
function numericalSort( a, b ) {
|
|
16518
16615
|
|
|
16519
16616
|
return a[ 0 ] - b[ 0 ];
|
|
@@ -16545,7 +16642,7 @@
|
|
|
16545
16642
|
const influencesList = {};
|
|
16546
16643
|
const morphInfluences = new Float32Array( 8 );
|
|
16547
16644
|
const morphTextures = new WeakMap();
|
|
16548
|
-
const morph = new
|
|
16645
|
+
const morph = new Vector4();
|
|
16549
16646
|
|
|
16550
16647
|
const workInfluences = [];
|
|
16551
16648
|
|
|
@@ -16564,23 +16661,30 @@
|
|
|
16564
16661
|
// instead of using attributes, the WebGL 2 code path encodes morph targets
|
|
16565
16662
|
// into an array of data textures. Each layer represents a single morph target.
|
|
16566
16663
|
|
|
16567
|
-
const
|
|
16664
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
16665
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
16568
16666
|
|
|
16569
16667
|
let entry = morphTextures.get( geometry );
|
|
16570
16668
|
|
|
16571
|
-
if ( entry === undefined || entry.count !==
|
|
16669
|
+
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
16572
16670
|
|
|
16573
16671
|
if ( entry !== undefined ) entry.texture.dispose();
|
|
16574
16672
|
|
|
16673
|
+
const hasMorphPosition = geometry.morphAttributes.position !== undefined;
|
|
16575
16674
|
const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
|
|
16675
|
+
const hasMorphColors = geometry.morphAttributes.color !== undefined;
|
|
16576
16676
|
|
|
16577
|
-
const morphTargets = geometry.morphAttributes.position;
|
|
16677
|
+
const morphTargets = geometry.morphAttributes.position || [];
|
|
16578
16678
|
const morphNormals = geometry.morphAttributes.normal || [];
|
|
16679
|
+
const morphColors = geometry.morphAttributes.color || [];
|
|
16680
|
+
|
|
16681
|
+
let vertexDataCount = 0;
|
|
16579
16682
|
|
|
16580
|
-
|
|
16581
|
-
|
|
16683
|
+
if ( hasMorphPosition === true ) vertexDataCount = 1;
|
|
16684
|
+
if ( hasMorphNormals === true ) vertexDataCount = 2;
|
|
16685
|
+
if ( hasMorphColors === true ) vertexDataCount = 3;
|
|
16582
16686
|
|
|
16583
|
-
let width =
|
|
16687
|
+
let width = geometry.attributes.position.count * vertexDataCount;
|
|
16584
16688
|
let height = 1;
|
|
16585
16689
|
|
|
16586
16690
|
if ( width > capabilities.maxTextureSize ) {
|
|
@@ -16590,36 +16694,41 @@
|
|
|
16590
16694
|
|
|
16591
16695
|
}
|
|
16592
16696
|
|
|
16593
|
-
const buffer = new Float32Array( width * height * 4 *
|
|
16697
|
+
const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
|
|
16594
16698
|
|
|
16595
|
-
const texture = new
|
|
16699
|
+
const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
|
|
16596
16700
|
texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower)
|
|
16597
16701
|
texture.type = FloatType;
|
|
16598
16702
|
texture.needsUpdate = true;
|
|
16599
16703
|
|
|
16600
16704
|
// fill buffer
|
|
16601
16705
|
|
|
16602
|
-
const vertexDataStride =
|
|
16706
|
+
const vertexDataStride = vertexDataCount * 4;
|
|
16603
16707
|
|
|
16604
|
-
for ( let i = 0; i <
|
|
16708
|
+
for ( let i = 0; i < morphTargetsCount; i ++ ) {
|
|
16605
16709
|
|
|
16606
16710
|
const morphTarget = morphTargets[ i ];
|
|
16607
16711
|
const morphNormal = morphNormals[ i ];
|
|
16712
|
+
const morphColor = morphColors[ i ];
|
|
16608
16713
|
|
|
16609
16714
|
const offset = width * height * 4 * i;
|
|
16610
16715
|
|
|
16611
16716
|
for ( let j = 0; j < morphTarget.count; j ++ ) {
|
|
16612
16717
|
|
|
16613
|
-
|
|
16718
|
+
const stride = j * vertexDataStride;
|
|
16614
16719
|
|
|
16615
|
-
if (
|
|
16720
|
+
if ( hasMorphPosition === true ) {
|
|
16616
16721
|
|
|
16617
|
-
|
|
16722
|
+
morph.fromBufferAttribute( morphTarget, j );
|
|
16618
16723
|
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
|
|
16724
|
+
if ( morphTarget.normalized === true ) denormalize( morph, morphTarget );
|
|
16725
|
+
|
|
16726
|
+
buffer[ offset + stride + 0 ] = morph.x;
|
|
16727
|
+
buffer[ offset + stride + 1 ] = morph.y;
|
|
16728
|
+
buffer[ offset + stride + 2 ] = morph.z;
|
|
16729
|
+
buffer[ offset + stride + 3 ] = 0;
|
|
16730
|
+
|
|
16731
|
+
}
|
|
16623
16732
|
|
|
16624
16733
|
if ( hasMorphNormals === true ) {
|
|
16625
16734
|
|
|
@@ -16634,12 +16743,25 @@
|
|
|
16634
16743
|
|
|
16635
16744
|
}
|
|
16636
16745
|
|
|
16746
|
+
if ( hasMorphColors === true ) {
|
|
16747
|
+
|
|
16748
|
+
morph.fromBufferAttribute( morphColor, j );
|
|
16749
|
+
|
|
16750
|
+
if ( morphColor.normalized === true ) denormalize( morph, morphNormal );
|
|
16751
|
+
|
|
16752
|
+
buffer[ offset + stride + 8 ] = morph.x;
|
|
16753
|
+
buffer[ offset + stride + 9 ] = morph.y;
|
|
16754
|
+
buffer[ offset + stride + 10 ] = morph.z;
|
|
16755
|
+
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
|
|
16756
|
+
|
|
16757
|
+
}
|
|
16758
|
+
|
|
16637
16759
|
}
|
|
16638
16760
|
|
|
16639
16761
|
}
|
|
16640
16762
|
|
|
16641
16763
|
entry = {
|
|
16642
|
-
count:
|
|
16764
|
+
count: morphTargetsCount,
|
|
16643
16765
|
texture: texture,
|
|
16644
16766
|
size: new Vector2( width, height )
|
|
16645
16767
|
};
|
|
@@ -16873,37 +16995,6 @@
|
|
|
16873
16995
|
|
|
16874
16996
|
}
|
|
16875
16997
|
|
|
16876
|
-
class DataTexture3D extends Texture {
|
|
16877
|
-
|
|
16878
|
-
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
16879
|
-
|
|
16880
|
-
// We're going to add .setXXX() methods for setting properties later.
|
|
16881
|
-
// Users can still set in DataTexture3D directly.
|
|
16882
|
-
//
|
|
16883
|
-
// const texture = new THREE.DataTexture3D( data, width, height, depth );
|
|
16884
|
-
// texture.anisotropy = 16;
|
|
16885
|
-
//
|
|
16886
|
-
// See #14839
|
|
16887
|
-
|
|
16888
|
-
super( null );
|
|
16889
|
-
|
|
16890
|
-
this.image = { data, width, height, depth };
|
|
16891
|
-
|
|
16892
|
-
this.magFilter = NearestFilter;
|
|
16893
|
-
this.minFilter = NearestFilter;
|
|
16894
|
-
|
|
16895
|
-
this.wrapR = ClampToEdgeWrapping;
|
|
16896
|
-
|
|
16897
|
-
this.generateMipmaps = false;
|
|
16898
|
-
this.flipY = false;
|
|
16899
|
-
this.unpackAlignment = 1;
|
|
16900
|
-
|
|
16901
|
-
}
|
|
16902
|
-
|
|
16903
|
-
}
|
|
16904
|
-
|
|
16905
|
-
DataTexture3D.prototype.isDataTexture3D = true;
|
|
16906
|
-
|
|
16907
16998
|
/**
|
|
16908
16999
|
* Uniforms of a program.
|
|
16909
17000
|
* Those form a tree structure with a special top-level container for the root,
|
|
@@ -16948,8 +17039,8 @@
|
|
|
16948
17039
|
*/
|
|
16949
17040
|
|
|
16950
17041
|
const emptyTexture = new Texture();
|
|
16951
|
-
const
|
|
16952
|
-
const
|
|
17042
|
+
const emptyArrayTexture = new DataArrayTexture();
|
|
17043
|
+
const empty3dTexture = new Data3DTexture();
|
|
16953
17044
|
const emptyCubeTexture = new CubeTexture();
|
|
16954
17045
|
|
|
16955
17046
|
// --- Utilities ---
|
|
@@ -17368,7 +17459,7 @@
|
|
|
17368
17459
|
|
|
17369
17460
|
}
|
|
17370
17461
|
|
|
17371
|
-
textures.
|
|
17462
|
+
textures.setTexture2D( v || emptyTexture, unit );
|
|
17372
17463
|
|
|
17373
17464
|
}
|
|
17374
17465
|
|
|
@@ -17384,7 +17475,7 @@
|
|
|
17384
17475
|
|
|
17385
17476
|
}
|
|
17386
17477
|
|
|
17387
|
-
textures.setTexture3D( v ||
|
|
17478
|
+
textures.setTexture3D( v || empty3dTexture, unit );
|
|
17388
17479
|
|
|
17389
17480
|
}
|
|
17390
17481
|
|
|
@@ -17400,7 +17491,7 @@
|
|
|
17400
17491
|
|
|
17401
17492
|
}
|
|
17402
17493
|
|
|
17403
|
-
textures.
|
|
17494
|
+
textures.setTextureCube( v || emptyCubeTexture, unit );
|
|
17404
17495
|
|
|
17405
17496
|
}
|
|
17406
17497
|
|
|
@@ -17416,7 +17507,7 @@
|
|
|
17416
17507
|
|
|
17417
17508
|
}
|
|
17418
17509
|
|
|
17419
|
-
textures.setTexture2DArray( v ||
|
|
17510
|
+
textures.setTexture2DArray( v || emptyArrayTexture, unit );
|
|
17420
17511
|
|
|
17421
17512
|
}
|
|
17422
17513
|
|
|
@@ -17603,7 +17694,7 @@
|
|
|
17603
17694
|
|
|
17604
17695
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17605
17696
|
|
|
17606
|
-
textures.
|
|
17697
|
+
textures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );
|
|
17607
17698
|
|
|
17608
17699
|
}
|
|
17609
17700
|
|
|
@@ -17619,7 +17710,7 @@
|
|
|
17619
17710
|
|
|
17620
17711
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17621
17712
|
|
|
17622
|
-
textures.setTexture3D( v[ i ] ||
|
|
17713
|
+
textures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );
|
|
17623
17714
|
|
|
17624
17715
|
}
|
|
17625
17716
|
|
|
@@ -17635,7 +17726,7 @@
|
|
|
17635
17726
|
|
|
17636
17727
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17637
17728
|
|
|
17638
|
-
textures.
|
|
17729
|
+
textures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );
|
|
17639
17730
|
|
|
17640
17731
|
}
|
|
17641
17732
|
|
|
@@ -17651,7 +17742,7 @@
|
|
|
17651
17742
|
|
|
17652
17743
|
for ( let i = 0; i !== n; ++ i ) {
|
|
17653
17744
|
|
|
17654
|
-
textures.setTexture2DArray( v[ i ] ||
|
|
17745
|
+
textures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );
|
|
17655
17746
|
|
|
17656
17747
|
}
|
|
17657
17748
|
|
|
@@ -18020,7 +18111,7 @@
|
|
|
18020
18111
|
function generateExtensions( parameters ) {
|
|
18021
18112
|
|
|
18022
18113
|
const chunks = [
|
|
18023
|
-
( parameters.extensionDerivatives || parameters.
|
|
18114
|
+
( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
|
|
18024
18115
|
( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
|
|
18025
18116
|
( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
|
|
18026
18117
|
( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
|
|
@@ -18288,6 +18379,22 @@
|
|
|
18288
18379
|
|
|
18289
18380
|
}
|
|
18290
18381
|
|
|
18382
|
+
function generateCubeUVSize( parameters ) {
|
|
18383
|
+
|
|
18384
|
+
const imageHeight = parameters.envMapCubeUVHeight;
|
|
18385
|
+
|
|
18386
|
+
if ( imageHeight === null ) return null;
|
|
18387
|
+
|
|
18388
|
+
const maxMip = Math.log2( imageHeight / 32 + 1 ) + 3;
|
|
18389
|
+
|
|
18390
|
+
const texelHeight = 1.0 / imageHeight;
|
|
18391
|
+
|
|
18392
|
+
const texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );
|
|
18393
|
+
|
|
18394
|
+
return { texelWidth, texelHeight, maxMip };
|
|
18395
|
+
|
|
18396
|
+
}
|
|
18397
|
+
|
|
18291
18398
|
function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
18292
18399
|
|
|
18293
18400
|
// TODO Send this event to Three.js DevTools
|
|
@@ -18304,6 +18411,7 @@
|
|
|
18304
18411
|
const envMapTypeDefine = generateEnvMapTypeDefine( parameters );
|
|
18305
18412
|
const envMapModeDefine = generateEnvMapModeDefine( parameters );
|
|
18306
18413
|
const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
|
|
18414
|
+
const envMapCubeUVSize = generateCubeUVSize( parameters );
|
|
18307
18415
|
|
|
18308
18416
|
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
18309
18417
|
|
|
@@ -18405,8 +18513,10 @@
|
|
|
18405
18513
|
|
|
18406
18514
|
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
|
|
18407
18515
|
parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
|
|
18408
|
-
( parameters.
|
|
18409
|
-
( parameters.
|
|
18516
|
+
( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',
|
|
18517
|
+
( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',
|
|
18518
|
+
( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
|
|
18519
|
+
( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
|
|
18410
18520
|
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
|
|
18411
18521
|
parameters.flipSided ? '#define FLIP_SIDED' : '',
|
|
18412
18522
|
|
|
@@ -18513,6 +18623,9 @@
|
|
|
18513
18623
|
parameters.envMap ? '#define ' + envMapTypeDefine : '',
|
|
18514
18624
|
parameters.envMap ? '#define ' + envMapModeDefine : '',
|
|
18515
18625
|
parameters.envMap ? '#define ' + envMapBlendingDefine : '',
|
|
18626
|
+
envMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',
|
|
18627
|
+
envMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',
|
|
18628
|
+
envMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',
|
|
18516
18629
|
parameters.lightMap ? '#define USE_LIGHTMAP' : '',
|
|
18517
18630
|
parameters.aoMap ? '#define USE_AOMAP' : '',
|
|
18518
18631
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
@@ -18568,8 +18681,6 @@
|
|
|
18568
18681
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
18569
18682
|
( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
|
18570
18683
|
|
|
18571
|
-
( ( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ) ? '#define TEXTURE_LOD_EXT' : '',
|
|
18572
|
-
|
|
18573
18684
|
'uniform mat4 viewMatrix;',
|
|
18574
18685
|
'uniform vec3 cameraPosition;',
|
|
18575
18686
|
'uniform bool isOrthographic;',
|
|
@@ -18579,7 +18690,7 @@
|
|
|
18579
18690
|
( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',
|
|
18580
18691
|
|
|
18581
18692
|
parameters.dithering ? '#define DITHERING' : '',
|
|
18582
|
-
parameters.
|
|
18693
|
+
parameters.opaque ? '#define OPAQUE' : '',
|
|
18583
18694
|
|
|
18584
18695
|
ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
18585
18696
|
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ),
|
|
@@ -18979,9 +19090,11 @@
|
|
|
18979
19090
|
function getParameters( material, lights, shadows, scene, object ) {
|
|
18980
19091
|
|
|
18981
19092
|
const fog = scene.fog;
|
|
19093
|
+
const geometry = object.geometry;
|
|
18982
19094
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
18983
19095
|
|
|
18984
19096
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
19097
|
+
const envMapCubeUVHeight = ( !! envMap ) && ( ( envMap.mapping === CubeUVReflectionMapping ) || ( envMap.mapping === CubeUVRefractionMapping ) ) ? envMap.image.height : null;
|
|
18985
19098
|
|
|
18986
19099
|
const shaderID = shaderIDs[ material.type ];
|
|
18987
19100
|
|
|
@@ -19002,6 +19115,19 @@
|
|
|
19002
19115
|
|
|
19003
19116
|
}
|
|
19004
19117
|
|
|
19118
|
+
//
|
|
19119
|
+
|
|
19120
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
19121
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
19122
|
+
|
|
19123
|
+
let morphTextureStride = 0;
|
|
19124
|
+
|
|
19125
|
+
if ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;
|
|
19126
|
+
if ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;
|
|
19127
|
+
if ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;
|
|
19128
|
+
|
|
19129
|
+
//
|
|
19130
|
+
|
|
19005
19131
|
let vertexShader, fragmentShader;
|
|
19006
19132
|
let customVertexShaderID, customFragmentShaderID;
|
|
19007
19133
|
|
|
@@ -19057,7 +19183,7 @@
|
|
|
19057
19183
|
matcap: !! material.matcap,
|
|
19058
19184
|
envMap: !! envMap,
|
|
19059
19185
|
envMapMode: envMap && envMap.mapping,
|
|
19060
|
-
|
|
19186
|
+
envMapCubeUVHeight: envMapCubeUVHeight,
|
|
19061
19187
|
lightMap: !! material.lightMap,
|
|
19062
19188
|
aoMap: !! material.aoMap,
|
|
19063
19189
|
emissiveMap: !! material.emissiveMap,
|
|
@@ -19080,7 +19206,7 @@
|
|
|
19080
19206
|
specularIntensityMap: !! material.specularIntensityMap,
|
|
19081
19207
|
specularColorMap: !! material.specularColorMap,
|
|
19082
19208
|
|
|
19083
|
-
|
|
19209
|
+
opaque: material.transparent === false && material.blending === NormalBlending,
|
|
19084
19210
|
|
|
19085
19211
|
alphaMap: !! material.alphaMap,
|
|
19086
19212
|
alphaTest: useAlphaTest,
|
|
@@ -19097,9 +19223,9 @@
|
|
|
19097
19223
|
|
|
19098
19224
|
combine: material.combine,
|
|
19099
19225
|
|
|
19100
|
-
vertexTangents: ( !! material.normalMap && !!
|
|
19226
|
+
vertexTangents: ( !! material.normalMap && !! geometry.attributes.tangent ),
|
|
19101
19227
|
vertexColors: material.vertexColors,
|
|
19102
|
-
vertexAlphas: material.vertexColors === true && !!
|
|
19228
|
+
vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
19103
19229
|
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,
|
|
19104
19230
|
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,
|
|
19105
19231
|
|
|
@@ -19116,9 +19242,11 @@
|
|
|
19116
19242
|
maxBones: maxBones,
|
|
19117
19243
|
useVertexTexture: floatVertexTextures,
|
|
19118
19244
|
|
|
19119
|
-
morphTargets:
|
|
19120
|
-
morphNormals:
|
|
19121
|
-
|
|
19245
|
+
morphTargets: geometry.morphAttributes.position !== undefined,
|
|
19246
|
+
morphNormals: geometry.morphAttributes.normal !== undefined,
|
|
19247
|
+
morphColors: geometry.morphAttributes.color !== undefined,
|
|
19248
|
+
morphTargetsCount: morphTargetsCount,
|
|
19249
|
+
morphTextureStride: morphTextureStride,
|
|
19122
19250
|
|
|
19123
19251
|
numDirLights: lights.directional.length,
|
|
19124
19252
|
numPointLights: lights.point.length,
|
|
@@ -19212,12 +19340,14 @@
|
|
|
19212
19340
|
array.push( parameters.precision );
|
|
19213
19341
|
array.push( parameters.outputEncoding );
|
|
19214
19342
|
array.push( parameters.envMapMode );
|
|
19343
|
+
array.push( parameters.envMapCubeUVHeight );
|
|
19215
19344
|
array.push( parameters.combine );
|
|
19216
19345
|
array.push( parameters.vertexUvs );
|
|
19217
19346
|
array.push( parameters.fogExp2 );
|
|
19218
19347
|
array.push( parameters.sizeAttenuation );
|
|
19219
19348
|
array.push( parameters.maxBones );
|
|
19220
19349
|
array.push( parameters.morphTargetsCount );
|
|
19350
|
+
array.push( parameters.morphAttributeCount );
|
|
19221
19351
|
array.push( parameters.numDirLights );
|
|
19222
19352
|
array.push( parameters.numPointLights );
|
|
19223
19353
|
array.push( parameters.numSpotLights );
|
|
@@ -19251,56 +19381,54 @@
|
|
|
19251
19381
|
_programLayers.enable( 5 );
|
|
19252
19382
|
if ( parameters.envMap )
|
|
19253
19383
|
_programLayers.enable( 6 );
|
|
19254
|
-
if ( parameters.envMapCubeUV )
|
|
19255
|
-
_programLayers.enable( 7 );
|
|
19256
19384
|
if ( parameters.lightMap )
|
|
19257
|
-
_programLayers.enable(
|
|
19385
|
+
_programLayers.enable( 7 );
|
|
19258
19386
|
if ( parameters.aoMap )
|
|
19259
|
-
_programLayers.enable(
|
|
19387
|
+
_programLayers.enable( 8 );
|
|
19260
19388
|
if ( parameters.emissiveMap )
|
|
19261
|
-
_programLayers.enable(
|
|
19389
|
+
_programLayers.enable( 9 );
|
|
19262
19390
|
if ( parameters.bumpMap )
|
|
19263
|
-
_programLayers.enable(
|
|
19391
|
+
_programLayers.enable( 10 );
|
|
19264
19392
|
if ( parameters.normalMap )
|
|
19265
|
-
_programLayers.enable(
|
|
19393
|
+
_programLayers.enable( 11 );
|
|
19266
19394
|
if ( parameters.objectSpaceNormalMap )
|
|
19267
|
-
_programLayers.enable(
|
|
19395
|
+
_programLayers.enable( 12 );
|
|
19268
19396
|
if ( parameters.tangentSpaceNormalMap )
|
|
19269
|
-
_programLayers.enable(
|
|
19397
|
+
_programLayers.enable( 13 );
|
|
19270
19398
|
if ( parameters.clearcoat )
|
|
19271
|
-
_programLayers.enable(
|
|
19399
|
+
_programLayers.enable( 14 );
|
|
19272
19400
|
if ( parameters.clearcoatMap )
|
|
19273
|
-
_programLayers.enable(
|
|
19401
|
+
_programLayers.enable( 15 );
|
|
19274
19402
|
if ( parameters.clearcoatRoughnessMap )
|
|
19275
|
-
_programLayers.enable(
|
|
19403
|
+
_programLayers.enable( 16 );
|
|
19276
19404
|
if ( parameters.clearcoatNormalMap )
|
|
19277
|
-
_programLayers.enable(
|
|
19405
|
+
_programLayers.enable( 17 );
|
|
19278
19406
|
if ( parameters.displacementMap )
|
|
19279
|
-
_programLayers.enable(
|
|
19407
|
+
_programLayers.enable( 18 );
|
|
19280
19408
|
if ( parameters.specularMap )
|
|
19281
|
-
_programLayers.enable(
|
|
19409
|
+
_programLayers.enable( 19 );
|
|
19282
19410
|
if ( parameters.roughnessMap )
|
|
19283
|
-
_programLayers.enable(
|
|
19411
|
+
_programLayers.enable( 20 );
|
|
19284
19412
|
if ( parameters.metalnessMap )
|
|
19285
|
-
_programLayers.enable(
|
|
19413
|
+
_programLayers.enable( 21 );
|
|
19286
19414
|
if ( parameters.gradientMap )
|
|
19287
|
-
_programLayers.enable(
|
|
19415
|
+
_programLayers.enable( 22 );
|
|
19288
19416
|
if ( parameters.alphaMap )
|
|
19289
|
-
_programLayers.enable(
|
|
19417
|
+
_programLayers.enable( 23 );
|
|
19290
19418
|
if ( parameters.alphaTest )
|
|
19291
|
-
_programLayers.enable(
|
|
19419
|
+
_programLayers.enable( 24 );
|
|
19292
19420
|
if ( parameters.vertexColors )
|
|
19293
|
-
_programLayers.enable(
|
|
19421
|
+
_programLayers.enable( 25 );
|
|
19294
19422
|
if ( parameters.vertexAlphas )
|
|
19295
|
-
_programLayers.enable(
|
|
19423
|
+
_programLayers.enable( 26 );
|
|
19296
19424
|
if ( parameters.vertexUvs )
|
|
19297
|
-
_programLayers.enable(
|
|
19425
|
+
_programLayers.enable( 27 );
|
|
19298
19426
|
if ( parameters.vertexTangents )
|
|
19299
|
-
_programLayers.enable(
|
|
19427
|
+
_programLayers.enable( 28 );
|
|
19300
19428
|
if ( parameters.uvsVertexOnly )
|
|
19301
|
-
_programLayers.enable(
|
|
19429
|
+
_programLayers.enable( 29 );
|
|
19302
19430
|
if ( parameters.fog )
|
|
19303
|
-
_programLayers.enable(
|
|
19431
|
+
_programLayers.enable( 30 );
|
|
19304
19432
|
|
|
19305
19433
|
array.push( _programLayers.mask );
|
|
19306
19434
|
_programLayers.disableAll();
|
|
@@ -19319,40 +19447,42 @@
|
|
|
19319
19447
|
_programLayers.enable( 5 );
|
|
19320
19448
|
if ( parameters.morphNormals )
|
|
19321
19449
|
_programLayers.enable( 6 );
|
|
19322
|
-
if ( parameters.
|
|
19450
|
+
if ( parameters.morphColors )
|
|
19323
19451
|
_programLayers.enable( 7 );
|
|
19324
|
-
if ( parameters.
|
|
19452
|
+
if ( parameters.premultipliedAlpha )
|
|
19325
19453
|
_programLayers.enable( 8 );
|
|
19326
|
-
if ( parameters.
|
|
19454
|
+
if ( parameters.shadowMapEnabled )
|
|
19327
19455
|
_programLayers.enable( 9 );
|
|
19328
|
-
if ( parameters.
|
|
19456
|
+
if ( parameters.physicallyCorrectLights )
|
|
19329
19457
|
_programLayers.enable( 10 );
|
|
19330
|
-
if ( parameters.
|
|
19458
|
+
if ( parameters.doubleSided )
|
|
19331
19459
|
_programLayers.enable( 11 );
|
|
19332
|
-
if ( parameters.
|
|
19460
|
+
if ( parameters.flipSided )
|
|
19333
19461
|
_programLayers.enable( 12 );
|
|
19334
|
-
if ( parameters.
|
|
19462
|
+
if ( parameters.depthPacking )
|
|
19335
19463
|
_programLayers.enable( 13 );
|
|
19336
|
-
if ( parameters.
|
|
19464
|
+
if ( parameters.dithering )
|
|
19337
19465
|
_programLayers.enable( 14 );
|
|
19338
|
-
if ( parameters.
|
|
19466
|
+
if ( parameters.specularIntensityMap )
|
|
19339
19467
|
_programLayers.enable( 15 );
|
|
19340
|
-
if ( parameters.
|
|
19468
|
+
if ( parameters.specularColorMap )
|
|
19341
19469
|
_programLayers.enable( 16 );
|
|
19342
|
-
if ( parameters.
|
|
19470
|
+
if ( parameters.transmission )
|
|
19343
19471
|
_programLayers.enable( 17 );
|
|
19344
|
-
if ( parameters.
|
|
19472
|
+
if ( parameters.transmissionMap )
|
|
19345
19473
|
_programLayers.enable( 18 );
|
|
19346
|
-
if ( parameters.
|
|
19474
|
+
if ( parameters.thicknessMap )
|
|
19347
19475
|
_programLayers.enable( 19 );
|
|
19348
|
-
if ( parameters.
|
|
19476
|
+
if ( parameters.sheen )
|
|
19349
19477
|
_programLayers.enable( 20 );
|
|
19350
|
-
if ( parameters.
|
|
19478
|
+
if ( parameters.sheenColorMap )
|
|
19351
19479
|
_programLayers.enable( 21 );
|
|
19352
|
-
if ( parameters.
|
|
19480
|
+
if ( parameters.sheenRoughnessMap )
|
|
19353
19481
|
_programLayers.enable( 22 );
|
|
19354
|
-
if ( parameters.
|
|
19482
|
+
if ( parameters.decodeVideoTexture )
|
|
19355
19483
|
_programLayers.enable( 23 );
|
|
19484
|
+
if ( parameters.opaque )
|
|
19485
|
+
_programLayers.enable( 24 );
|
|
19356
19486
|
|
|
19357
19487
|
array.push( _programLayers.mask );
|
|
19358
19488
|
|
|
@@ -20740,7 +20870,7 @@
|
|
|
20740
20870
|
|
|
20741
20871
|
}
|
|
20742
20872
|
|
|
20743
|
-
function getDepthMaterial( object,
|
|
20873
|
+
function getDepthMaterial( object, material, light, shadowCameraNear, shadowCameraFar, type ) {
|
|
20744
20874
|
|
|
20745
20875
|
let result = null;
|
|
20746
20876
|
|
|
@@ -20852,7 +20982,7 @@
|
|
|
20852
20982
|
|
|
20853
20983
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
20854
20984
|
|
|
20855
|
-
const depthMaterial = getDepthMaterial( object,
|
|
20985
|
+
const depthMaterial = getDepthMaterial( object, groupMaterial, light, shadowCamera.near, shadowCamera.far, type );
|
|
20856
20986
|
|
|
20857
20987
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
|
|
20858
20988
|
|
|
@@ -20862,7 +20992,7 @@
|
|
|
20862
20992
|
|
|
20863
20993
|
} else if ( material.visible ) {
|
|
20864
20994
|
|
|
20865
|
-
const depthMaterial = getDepthMaterial( object,
|
|
20995
|
+
const depthMaterial = getDepthMaterial( object, material, light, shadowCamera.near, shadowCamera.far, type );
|
|
20866
20996
|
|
|
20867
20997
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
|
|
20868
20998
|
|
|
@@ -22096,12 +22226,13 @@
|
|
|
22096
22226
|
const maxCubemapSize = capabilities.maxCubemapSize;
|
|
22097
22227
|
const maxTextureSize = capabilities.maxTextureSize;
|
|
22098
22228
|
const maxSamples = capabilities.maxSamples;
|
|
22099
|
-
const
|
|
22100
|
-
const MultisampledRenderToTextureExtension = hasMultisampledRenderToTexture ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : undefined;
|
|
22229
|
+
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
22101
22230
|
|
|
22102
22231
|
const _videoTextures = new WeakMap();
|
|
22103
22232
|
let _canvas;
|
|
22104
22233
|
|
|
22234
|
+
const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source
|
|
22235
|
+
|
|
22105
22236
|
// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
|
|
22106
22237
|
// also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
|
|
22107
22238
|
// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
|
|
@@ -22325,8 +22456,6 @@
|
|
|
22325
22456
|
|
|
22326
22457
|
}
|
|
22327
22458
|
|
|
22328
|
-
info.memory.textures --;
|
|
22329
|
-
|
|
22330
22459
|
}
|
|
22331
22460
|
|
|
22332
22461
|
function onRenderTargetDispose( event ) {
|
|
@@ -22347,12 +22476,51 @@
|
|
|
22347
22476
|
|
|
22348
22477
|
if ( textureProperties.__webglInit === undefined ) return;
|
|
22349
22478
|
|
|
22350
|
-
|
|
22479
|
+
// check if it's necessary to remove the WebGLTexture object
|
|
22480
|
+
|
|
22481
|
+
const source = texture.source;
|
|
22482
|
+
const webglTextures = _sources.get( source );
|
|
22483
|
+
|
|
22484
|
+
if ( webglTextures ) {
|
|
22485
|
+
|
|
22486
|
+
const webglTexture = webglTextures[ textureProperties.__cacheKey ];
|
|
22487
|
+
webglTexture.usedTimes --;
|
|
22488
|
+
|
|
22489
|
+
// the WebGLTexture object is not used anymore, remove it
|
|
22490
|
+
|
|
22491
|
+
if ( webglTexture.usedTimes === 0 ) {
|
|
22492
|
+
|
|
22493
|
+
deleteTexture( texture );
|
|
22494
|
+
|
|
22495
|
+
}
|
|
22496
|
+
|
|
22497
|
+
// remove the weak map entry if no WebGLTexture uses the source anymore
|
|
22498
|
+
|
|
22499
|
+
if ( Object.keys( webglTextures ).length === 0 ) {
|
|
22500
|
+
|
|
22501
|
+
_sources.delete( source );
|
|
22502
|
+
|
|
22503
|
+
}
|
|
22504
|
+
|
|
22505
|
+
}
|
|
22351
22506
|
|
|
22352
22507
|
properties.remove( texture );
|
|
22353
22508
|
|
|
22354
22509
|
}
|
|
22355
22510
|
|
|
22511
|
+
function deleteTexture( texture ) {
|
|
22512
|
+
|
|
22513
|
+
const textureProperties = properties.get( texture );
|
|
22514
|
+
_gl.deleteTexture( textureProperties.__webglTexture );
|
|
22515
|
+
|
|
22516
|
+
const source = texture.source;
|
|
22517
|
+
const webglTextures = _sources.get( source );
|
|
22518
|
+
delete webglTextures[ textureProperties.__cacheKey ];
|
|
22519
|
+
|
|
22520
|
+
info.memory.textures --;
|
|
22521
|
+
|
|
22522
|
+
}
|
|
22523
|
+
|
|
22356
22524
|
function deallocateRenderTarget( renderTarget ) {
|
|
22357
22525
|
|
|
22358
22526
|
const texture = renderTarget.texture;
|
|
@@ -22360,8 +22528,6 @@
|
|
|
22360
22528
|
const renderTargetProperties = properties.get( renderTarget );
|
|
22361
22529
|
const textureProperties = properties.get( texture );
|
|
22362
22530
|
|
|
22363
|
-
if ( ! renderTarget ) return;
|
|
22364
|
-
|
|
22365
22531
|
if ( textureProperties.__webglTexture !== undefined ) {
|
|
22366
22532
|
|
|
22367
22533
|
_gl.deleteTexture( textureProperties.__webglTexture );
|
|
@@ -22446,6 +22612,28 @@
|
|
|
22446
22612
|
|
|
22447
22613
|
}
|
|
22448
22614
|
|
|
22615
|
+
function getTextureCacheKey( texture ) {
|
|
22616
|
+
|
|
22617
|
+
const array = [];
|
|
22618
|
+
|
|
22619
|
+
array.push( texture.wrapS );
|
|
22620
|
+
array.push( texture.wrapT );
|
|
22621
|
+
array.push( texture.magFilter );
|
|
22622
|
+
array.push( texture.minFilter );
|
|
22623
|
+
array.push( texture.anisotropy );
|
|
22624
|
+
array.push( texture.internalFormat );
|
|
22625
|
+
array.push( texture.format );
|
|
22626
|
+
array.push( texture.type );
|
|
22627
|
+
array.push( texture.generateMipmaps );
|
|
22628
|
+
array.push( texture.premultiplyAlpha );
|
|
22629
|
+
array.push( texture.flipY );
|
|
22630
|
+
array.push( texture.unpackAlignment );
|
|
22631
|
+
array.push( texture.encoding );
|
|
22632
|
+
|
|
22633
|
+
return array.join();
|
|
22634
|
+
|
|
22635
|
+
}
|
|
22636
|
+
|
|
22449
22637
|
//
|
|
22450
22638
|
|
|
22451
22639
|
function setTexture2D( texture, slot ) {
|
|
@@ -22458,9 +22646,9 @@
|
|
|
22458
22646
|
|
|
22459
22647
|
const image = texture.image;
|
|
22460
22648
|
|
|
22461
|
-
if ( image ===
|
|
22649
|
+
if ( image === null ) {
|
|
22462
22650
|
|
|
22463
|
-
console.warn( 'THREE.WebGLRenderer: Texture marked for update but image
|
|
22651
|
+
console.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );
|
|
22464
22652
|
|
|
22465
22653
|
} else if ( image.complete === false ) {
|
|
22466
22654
|
|
|
@@ -22608,452 +22796,528 @@
|
|
|
22608
22796
|
|
|
22609
22797
|
function initTexture( textureProperties, texture ) {
|
|
22610
22798
|
|
|
22799
|
+
let forceUpload = false;
|
|
22800
|
+
|
|
22611
22801
|
if ( textureProperties.__webglInit === undefined ) {
|
|
22612
22802
|
|
|
22613
22803
|
textureProperties.__webglInit = true;
|
|
22614
22804
|
|
|
22615
22805
|
texture.addEventListener( 'dispose', onTextureDispose );
|
|
22616
22806
|
|
|
22617
|
-
|
|
22807
|
+
}
|
|
22618
22808
|
|
|
22619
|
-
|
|
22809
|
+
// create Source <-> WebGLTextures mapping if necessary
|
|
22620
22810
|
|
|
22621
|
-
|
|
22811
|
+
const source = texture.source;
|
|
22812
|
+
let webglTextures = _sources.get( source );
|
|
22622
22813
|
|
|
22623
|
-
|
|
22814
|
+
if ( webglTextures === undefined ) {
|
|
22624
22815
|
|
|
22625
|
-
|
|
22816
|
+
webglTextures = {};
|
|
22817
|
+
_sources.set( source, webglTextures );
|
|
22626
22818
|
|
|
22627
|
-
|
|
22819
|
+
}
|
|
22628
22820
|
|
|
22629
|
-
if
|
|
22630
|
-
if ( texture.isDataTexture3D ) textureType = 32879;
|
|
22821
|
+
// check if there is already a WebGLTexture object for the given texture parameters
|
|
22631
22822
|
|
|
22632
|
-
|
|
22823
|
+
const textureCacheKey = getTextureCacheKey( texture );
|
|
22633
22824
|
|
|
22634
|
-
|
|
22635
|
-
state.bindTexture( textureType, textureProperties.__webglTexture );
|
|
22825
|
+
if ( textureCacheKey !== textureProperties.__cacheKey ) {
|
|
22636
22826
|
|
|
22637
|
-
|
|
22638
|
-
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
22639
|
-
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
22640
|
-
_gl.pixelStorei( 37443, 0 );
|
|
22827
|
+
// if not, create a new instance of WebGLTexture
|
|
22641
22828
|
|
|
22642
|
-
|
|
22643
|
-
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
22644
|
-
image = verifyColorSpace( texture, image );
|
|
22829
|
+
if ( webglTextures[ textureCacheKey ] === undefined ) {
|
|
22645
22830
|
|
|
22646
|
-
|
|
22647
|
-
glFormat = utils.convert( texture.format, texture.encoding );
|
|
22831
|
+
// create new entry
|
|
22648
22832
|
|
|
22649
|
-
|
|
22650
|
-
|
|
22833
|
+
webglTextures[ textureCacheKey ] = {
|
|
22834
|
+
texture: _gl.createTexture(),
|
|
22835
|
+
usedTimes: 0
|
|
22836
|
+
};
|
|
22651
22837
|
|
|
22652
|
-
|
|
22838
|
+
info.memory.textures ++;
|
|
22653
22839
|
|
|
22654
|
-
|
|
22655
|
-
|
|
22840
|
+
// when a new instance of WebGLTexture was created, a texture upload is required
|
|
22841
|
+
// even if the image contents are identical
|
|
22656
22842
|
|
|
22657
|
-
|
|
22658
|
-
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22659
|
-
const levels = getMipLevels( texture, image, supportsMips );
|
|
22843
|
+
forceUpload = true;
|
|
22660
22844
|
|
|
22661
|
-
|
|
22845
|
+
}
|
|
22662
22846
|
|
|
22663
|
-
|
|
22847
|
+
webglTextures[ textureCacheKey ].usedTimes ++;
|
|
22664
22848
|
|
|
22665
|
-
|
|
22849
|
+
// every time the texture cache key changes, it's necessary to check if an instance of
|
|
22850
|
+
// WebGLTexture can be deleted in order to avoid a memory leak.
|
|
22666
22851
|
|
|
22667
|
-
|
|
22852
|
+
const webglTexture = webglTextures[ textureProperties.__cacheKey ];
|
|
22668
22853
|
|
|
22669
|
-
|
|
22854
|
+
if ( webglTexture !== undefined ) {
|
|
22670
22855
|
|
|
22671
|
-
|
|
22856
|
+
webglTextures[ textureProperties.__cacheKey ].usedTimes --;
|
|
22672
22857
|
|
|
22673
|
-
|
|
22858
|
+
if ( webglTexture.usedTimes === 0 ) {
|
|
22674
22859
|
|
|
22675
|
-
|
|
22860
|
+
deleteTexture( texture );
|
|
22676
22861
|
|
|
22677
|
-
}
|
|
22862
|
+
}
|
|
22678
22863
|
|
|
22679
|
-
|
|
22864
|
+
}
|
|
22680
22865
|
|
|
22681
|
-
|
|
22866
|
+
// store references to cache key and WebGLTexture object
|
|
22682
22867
|
|
|
22683
|
-
|
|
22868
|
+
textureProperties.__cacheKey = textureCacheKey;
|
|
22869
|
+
textureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;
|
|
22684
22870
|
|
|
22685
|
-
|
|
22871
|
+
}
|
|
22686
22872
|
|
|
22687
|
-
|
|
22873
|
+
return forceUpload;
|
|
22688
22874
|
|
|
22689
|
-
|
|
22875
|
+
}
|
|
22690
22876
|
|
|
22691
|
-
|
|
22877
|
+
function uploadTexture( textureProperties, texture, slot ) {
|
|
22692
22878
|
|
|
22693
|
-
|
|
22879
|
+
let textureType = 3553;
|
|
22694
22880
|
|
|
22695
|
-
|
|
22881
|
+
if ( texture.isDataArrayTexture ) textureType = 35866;
|
|
22882
|
+
if ( texture.isData3DTexture ) textureType = 32879;
|
|
22696
22883
|
|
|
22697
|
-
|
|
22884
|
+
const forceUpload = initTexture( textureProperties, texture );
|
|
22885
|
+
const source = texture.source;
|
|
22698
22886
|
|
|
22699
|
-
|
|
22887
|
+
state.activeTexture( 33984 + slot );
|
|
22888
|
+
state.bindTexture( textureType, textureProperties.__webglTexture );
|
|
22700
22889
|
|
|
22701
|
-
|
|
22702
|
-
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
22703
|
-
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
22704
|
-
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
|
|
22890
|
+
if ( source.version !== source.__currentVersion || forceUpload === true ) {
|
|
22705
22891
|
|
|
22706
|
-
|
|
22892
|
+
_gl.pixelStorei( 37440, texture.flipY );
|
|
22893
|
+
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
22894
|
+
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
22895
|
+
_gl.pixelStorei( 37443, 0 );
|
|
22707
22896
|
|
|
22708
|
-
|
|
22709
|
-
|
|
22897
|
+
const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
|
|
22898
|
+
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
22899
|
+
image = verifyColorSpace( texture, image );
|
|
22710
22900
|
|
|
22711
|
-
|
|
22901
|
+
const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
22902
|
+
glFormat = utils.convert( texture.format, texture.encoding );
|
|
22712
22903
|
|
|
22713
|
-
|
|
22904
|
+
let glType = utils.convert( texture.type ),
|
|
22905
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding, texture.isVideoTexture );
|
|
22714
22906
|
|
|
22715
|
-
|
|
22907
|
+
setTextureParameters( textureType, texture, supportsMips );
|
|
22716
22908
|
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
glInternalFormat = 34041;
|
|
22909
|
+
let mipmap;
|
|
22910
|
+
const mipmaps = texture.mipmaps;
|
|
22720
22911
|
|
|
22721
|
-
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
if ( texture.type !== UnsignedInt248Type ) {
|
|
22912
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
22913
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
22914
|
+
const levels = getMipLevels( texture, image, supportsMips );
|
|
22725
22915
|
|
|
22726
|
-
|
|
22916
|
+
if ( texture.isDepthTexture ) {
|
|
22727
22917
|
|
|
22728
|
-
|
|
22729
|
-
glType = utils.convert( texture.type );
|
|
22918
|
+
// populate depth texture with dummy data
|
|
22730
22919
|
|
|
22731
|
-
|
|
22920
|
+
glInternalFormat = 6402;
|
|
22732
22921
|
|
|
22733
|
-
|
|
22922
|
+
if ( isWebGL2 ) {
|
|
22734
22923
|
|
|
22735
|
-
|
|
22924
|
+
if ( texture.type === FloatType ) {
|
|
22736
22925
|
|
|
22737
|
-
|
|
22926
|
+
glInternalFormat = 36012;
|
|
22738
22927
|
|
|
22739
|
-
|
|
22928
|
+
} else if ( texture.type === UnsignedIntType ) {
|
|
22740
22929
|
|
|
22741
|
-
|
|
22930
|
+
glInternalFormat = 33190;
|
|
22742
22931
|
|
|
22743
|
-
|
|
22932
|
+
} else if ( texture.type === UnsignedInt248Type ) {
|
|
22744
22933
|
|
|
22745
|
-
|
|
22934
|
+
glInternalFormat = 35056;
|
|
22746
22935
|
|
|
22747
|
-
|
|
22936
|
+
} else {
|
|
22748
22937
|
|
|
22749
|
-
|
|
22750
|
-
// if there are no manual mipmaps
|
|
22751
|
-
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
22938
|
+
glInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D
|
|
22752
22939
|
|
|
22753
|
-
|
|
22940
|
+
}
|
|
22754
22941
|
|
|
22755
|
-
|
|
22942
|
+
} else {
|
|
22756
22943
|
|
|
22757
|
-
|
|
22944
|
+
if ( texture.type === FloatType ) {
|
|
22758
22945
|
|
|
22759
|
-
|
|
22946
|
+
console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
|
|
22760
22947
|
|
|
22761
|
-
|
|
22948
|
+
}
|
|
22762
22949
|
|
|
22763
|
-
|
|
22950
|
+
}
|
|
22764
22951
|
|
|
22765
|
-
|
|
22952
|
+
// validation checks for WebGL 1
|
|
22766
22953
|
|
|
22767
|
-
|
|
22954
|
+
if ( texture.format === DepthFormat && glInternalFormat === 6402 ) {
|
|
22768
22955
|
|
|
22769
|
-
|
|
22956
|
+
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
22957
|
+
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
|
|
22958
|
+
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
22959
|
+
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
|
|
22960
|
+
|
|
22961
|
+
console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
|
|
22770
22962
|
|
|
22771
|
-
|
|
22963
|
+
texture.type = UnsignedShortType;
|
|
22964
|
+
glType = utils.convert( texture.type );
|
|
22772
22965
|
|
|
22773
22966
|
}
|
|
22774
22967
|
|
|
22775
22968
|
}
|
|
22776
22969
|
|
|
22777
|
-
texture.
|
|
22970
|
+
if ( texture.format === DepthStencilFormat && glInternalFormat === 6402 ) {
|
|
22778
22971
|
|
|
22779
|
-
|
|
22972
|
+
// Depth stencil textures need the DEPTH_STENCIL internal format
|
|
22973
|
+
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
22974
|
+
glInternalFormat = 34041;
|
|
22780
22975
|
|
|
22781
|
-
|
|
22976
|
+
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
22977
|
+
// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
|
|
22978
|
+
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
22979
|
+
if ( texture.type !== UnsignedInt248Type ) {
|
|
22782
22980
|
|
|
22783
|
-
|
|
22981
|
+
console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
|
|
22784
22982
|
|
|
22785
|
-
|
|
22983
|
+
texture.type = UnsignedInt248Type;
|
|
22984
|
+
glType = utils.convert( texture.type );
|
|
22786
22985
|
|
|
22787
22986
|
}
|
|
22788
22987
|
|
|
22789
|
-
|
|
22988
|
+
}
|
|
22989
|
+
|
|
22990
|
+
//
|
|
22991
|
+
|
|
22992
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22993
|
+
|
|
22994
|
+
state.texStorage2D( 3553, 1, glInternalFormat, image.width, image.height );
|
|
22790
22995
|
|
|
22791
22996
|
} else {
|
|
22792
22997
|
|
|
22793
|
-
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType,
|
|
22998
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22794
22999
|
|
|
22795
23000
|
}
|
|
22796
23001
|
|
|
22797
|
-
}
|
|
23002
|
+
} else if ( texture.isDataTexture ) {
|
|
22798
23003
|
|
|
22799
|
-
|
|
23004
|
+
// use manually created mipmaps if available
|
|
23005
|
+
// if there are no manual mipmaps
|
|
23006
|
+
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
22800
23007
|
|
|
22801
|
-
|
|
23008
|
+
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22802
23009
|
|
|
22803
|
-
|
|
23010
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22804
23011
|
|
|
22805
|
-
|
|
23012
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22806
23013
|
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
mipmap = mipmaps[ i ];
|
|
23014
|
+
}
|
|
22810
23015
|
|
|
22811
|
-
|
|
23016
|
+
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22812
23017
|
|
|
22813
|
-
|
|
23018
|
+
mipmap = mipmaps[ i ];
|
|
22814
23019
|
|
|
22815
23020
|
if ( useTexStorage ) {
|
|
22816
23021
|
|
|
22817
|
-
state.
|
|
23022
|
+
state.texSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
22818
23023
|
|
|
22819
23024
|
} else {
|
|
22820
23025
|
|
|
22821
|
-
state.
|
|
23026
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
22822
23027
|
|
|
22823
23028
|
}
|
|
22824
23029
|
|
|
22825
|
-
} else {
|
|
22826
|
-
|
|
22827
|
-
console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
22828
|
-
|
|
22829
23030
|
}
|
|
22830
23031
|
|
|
23032
|
+
texture.generateMipmaps = false;
|
|
23033
|
+
|
|
22831
23034
|
} else {
|
|
22832
23035
|
|
|
22833
23036
|
if ( useTexStorage ) {
|
|
22834
23037
|
|
|
22835
|
-
|
|
23038
|
+
if ( allocateMemory ) {
|
|
23039
|
+
|
|
23040
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
23041
|
+
|
|
23042
|
+
}
|
|
23043
|
+
|
|
23044
|
+
state.texSubImage2D( 3553, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
22836
23045
|
|
|
22837
23046
|
} else {
|
|
22838
23047
|
|
|
22839
|
-
state.texImage2D( 3553,
|
|
23048
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
|
|
22840
23049
|
|
|
22841
23050
|
}
|
|
22842
23051
|
|
|
22843
23052
|
}
|
|
22844
23053
|
|
|
22845
|
-
}
|
|
23054
|
+
} else if ( texture.isCompressedTexture ) {
|
|
22846
23055
|
|
|
22847
|
-
|
|
23056
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22848
23057
|
|
|
22849
|
-
|
|
23058
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22850
23059
|
|
|
22851
|
-
|
|
23060
|
+
}
|
|
22852
23061
|
|
|
22853
|
-
|
|
23062
|
+
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22854
23063
|
|
|
22855
|
-
|
|
23064
|
+
mipmap = mipmaps[ i ];
|
|
22856
23065
|
|
|
22857
|
-
|
|
23066
|
+
if ( texture.format !== RGBAFormat ) {
|
|
22858
23067
|
|
|
22859
|
-
|
|
23068
|
+
if ( glFormat !== null ) {
|
|
22860
23069
|
|
|
22861
|
-
|
|
23070
|
+
if ( useTexStorage ) {
|
|
22862
23071
|
|
|
22863
|
-
|
|
23072
|
+
state.compressedTexSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
22864
23073
|
|
|
22865
|
-
|
|
23074
|
+
} else {
|
|
22866
23075
|
|
|
22867
|
-
|
|
23076
|
+
state.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
22868
23077
|
|
|
22869
|
-
|
|
23078
|
+
}
|
|
23079
|
+
|
|
23080
|
+
} else {
|
|
23081
|
+
|
|
23082
|
+
console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
23083
|
+
|
|
23084
|
+
}
|
|
23085
|
+
|
|
23086
|
+
} else {
|
|
23087
|
+
|
|
23088
|
+
if ( useTexStorage ) {
|
|
23089
|
+
|
|
23090
|
+
state.texSubImage2D( 3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23091
|
+
|
|
23092
|
+
} else {
|
|
22870
23093
|
|
|
22871
|
-
|
|
23094
|
+
state.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23095
|
+
|
|
23096
|
+
}
|
|
23097
|
+
|
|
23098
|
+
}
|
|
22872
23099
|
|
|
22873
23100
|
}
|
|
22874
23101
|
|
|
22875
|
-
|
|
23102
|
+
} else if ( texture.isDataArrayTexture ) {
|
|
22876
23103
|
|
|
22877
|
-
|
|
23104
|
+
if ( useTexStorage ) {
|
|
22878
23105
|
|
|
22879
|
-
|
|
23106
|
+
if ( allocateMemory ) {
|
|
22880
23107
|
|
|
22881
|
-
|
|
23108
|
+
state.texStorage3D( 35866, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
22882
23109
|
|
|
22883
|
-
|
|
23110
|
+
}
|
|
22884
23111
|
|
|
22885
|
-
|
|
23112
|
+
state.texSubImage3D( 35866, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
22886
23113
|
|
|
22887
|
-
|
|
23114
|
+
} else {
|
|
22888
23115
|
|
|
22889
|
-
|
|
23116
|
+
state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
22890
23117
|
|
|
22891
|
-
|
|
23118
|
+
}
|
|
22892
23119
|
|
|
22893
|
-
}
|
|
23120
|
+
} else if ( texture.isData3DTexture ) {
|
|
22894
23121
|
|
|
22895
|
-
|
|
23122
|
+
if ( useTexStorage ) {
|
|
22896
23123
|
|
|
22897
|
-
|
|
23124
|
+
if ( allocateMemory ) {
|
|
22898
23125
|
|
|
22899
|
-
|
|
22900
|
-
// if there are no manual mipmaps
|
|
22901
|
-
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
23126
|
+
state.texStorage3D( 32879, levels, glInternalFormat, image.width, image.height, image.depth );
|
|
22902
23127
|
|
|
22903
|
-
|
|
23128
|
+
}
|
|
23129
|
+
|
|
23130
|
+
state.texSubImage3D( 32879, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
23131
|
+
|
|
23132
|
+
} else {
|
|
23133
|
+
|
|
23134
|
+
state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
|
|
23135
|
+
|
|
23136
|
+
}
|
|
23137
|
+
|
|
23138
|
+
} else if ( texture.isFramebufferTexture ) {
|
|
22904
23139
|
|
|
22905
23140
|
if ( useTexStorage && allocateMemory ) {
|
|
22906
23141
|
|
|
22907
|
-
state.texStorage2D( 3553, levels, glInternalFormat,
|
|
23142
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
23143
|
+
|
|
23144
|
+
} else {
|
|
23145
|
+
|
|
23146
|
+
state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
22908
23147
|
|
|
22909
23148
|
}
|
|
22910
23149
|
|
|
22911
|
-
|
|
23150
|
+
} else {
|
|
22912
23151
|
|
|
22913
|
-
|
|
23152
|
+
// regular Texture (image, video, canvas)
|
|
22914
23153
|
|
|
22915
|
-
|
|
23154
|
+
// use manually created mipmaps if available
|
|
23155
|
+
// if there are no manual mipmaps
|
|
23156
|
+
// set 0 level mipmap and then use GL to generate other mipmap levels
|
|
22916
23157
|
|
|
22917
|
-
|
|
23158
|
+
if ( mipmaps.length > 0 && supportsMips ) {
|
|
22918
23159
|
|
|
22919
|
-
|
|
23160
|
+
if ( useTexStorage && allocateMemory ) {
|
|
22920
23161
|
|
|
22921
|
-
state.
|
|
23162
|
+
state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
|
|
22922
23163
|
|
|
22923
23164
|
}
|
|
22924
23165
|
|
|
22925
|
-
|
|
23166
|
+
for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
|
|
22926
23167
|
|
|
22927
|
-
|
|
23168
|
+
mipmap = mipmaps[ i ];
|
|
22928
23169
|
|
|
22929
|
-
|
|
23170
|
+
if ( useTexStorage ) {
|
|
22930
23171
|
|
|
22931
|
-
|
|
23172
|
+
state.texSubImage2D( 3553, i, 0, 0, glFormat, glType, mipmap );
|
|
22932
23173
|
|
|
22933
|
-
|
|
23174
|
+
} else {
|
|
22934
23175
|
|
|
22935
|
-
|
|
23176
|
+
state.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );
|
|
23177
|
+
|
|
23178
|
+
}
|
|
22936
23179
|
|
|
22937
23180
|
}
|
|
22938
23181
|
|
|
22939
|
-
|
|
23182
|
+
texture.generateMipmaps = false;
|
|
22940
23183
|
|
|
22941
23184
|
} else {
|
|
22942
23185
|
|
|
22943
|
-
|
|
23186
|
+
if ( useTexStorage ) {
|
|
23187
|
+
|
|
23188
|
+
if ( allocateMemory ) {
|
|
23189
|
+
|
|
23190
|
+
state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
|
|
23191
|
+
|
|
23192
|
+
}
|
|
23193
|
+
|
|
23194
|
+
state.texSubImage2D( 3553, 0, 0, 0, glFormat, glType, image );
|
|
23195
|
+
|
|
23196
|
+
} else {
|
|
23197
|
+
|
|
23198
|
+
state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
|
|
23199
|
+
|
|
23200
|
+
}
|
|
22944
23201
|
|
|
22945
23202
|
}
|
|
22946
23203
|
|
|
22947
23204
|
}
|
|
22948
23205
|
|
|
22949
|
-
|
|
23206
|
+
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23207
|
+
|
|
23208
|
+
generateMipmap( textureType );
|
|
23209
|
+
|
|
23210
|
+
}
|
|
22950
23211
|
|
|
22951
|
-
|
|
23212
|
+
source.__currentVersion = source.version;
|
|
22952
23213
|
|
|
22953
|
-
|
|
23214
|
+
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
22954
23215
|
|
|
22955
23216
|
}
|
|
22956
23217
|
|
|
22957
23218
|
textureProperties.__version = texture.version;
|
|
22958
23219
|
|
|
22959
|
-
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
22960
|
-
|
|
22961
23220
|
}
|
|
22962
23221
|
|
|
22963
23222
|
function uploadCubeTexture( textureProperties, texture, slot ) {
|
|
22964
23223
|
|
|
22965
23224
|
if ( texture.image.length !== 6 ) return;
|
|
22966
23225
|
|
|
22967
|
-
initTexture( textureProperties, texture );
|
|
23226
|
+
const forceUpload = initTexture( textureProperties, texture );
|
|
23227
|
+
const source = texture.source;
|
|
22968
23228
|
|
|
22969
23229
|
state.activeTexture( 33984 + slot );
|
|
22970
23230
|
state.bindTexture( 34067, textureProperties.__webglTexture );
|
|
22971
23231
|
|
|
22972
|
-
|
|
22973
|
-
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
22974
|
-
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
22975
|
-
_gl.pixelStorei( 37443, 0 );
|
|
23232
|
+
if ( source.version !== source.__currentVersion || forceUpload === true ) {
|
|
22976
23233
|
|
|
22977
|
-
|
|
22978
|
-
|
|
23234
|
+
_gl.pixelStorei( 37440, texture.flipY );
|
|
23235
|
+
_gl.pixelStorei( 37441, texture.premultiplyAlpha );
|
|
23236
|
+
_gl.pixelStorei( 3317, texture.unpackAlignment );
|
|
23237
|
+
_gl.pixelStorei( 37443, 0 );
|
|
22979
23238
|
|
|
22980
|
-
|
|
23239
|
+
const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
|
|
23240
|
+
const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
|
|
22981
23241
|
|
|
22982
|
-
|
|
23242
|
+
const cubeImage = [];
|
|
22983
23243
|
|
|
22984
|
-
|
|
23244
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
22985
23245
|
|
|
22986
|
-
|
|
23246
|
+
if ( ! isCompressed && ! isDataTexture ) {
|
|
22987
23247
|
|
|
22988
|
-
|
|
23248
|
+
cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );
|
|
23249
|
+
|
|
23250
|
+
} else {
|
|
23251
|
+
|
|
23252
|
+
cubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];
|
|
23253
|
+
|
|
23254
|
+
}
|
|
22989
23255
|
|
|
22990
|
-
cubeImage[ i ] =
|
|
23256
|
+
cubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );
|
|
22991
23257
|
|
|
22992
23258
|
}
|
|
22993
23259
|
|
|
22994
|
-
|
|
23260
|
+
const image = cubeImage[ 0 ],
|
|
23261
|
+
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23262
|
+
glFormat = utils.convert( texture.format, texture.encoding ),
|
|
23263
|
+
glType = utils.convert( texture.type ),
|
|
23264
|
+
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
22995
23265
|
|
|
22996
|
-
|
|
23266
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
23267
|
+
const allocateMemory = ( textureProperties.__version === undefined );
|
|
23268
|
+
let levels = getMipLevels( texture, image, supportsMips );
|
|
22997
23269
|
|
|
22998
|
-
|
|
22999
|
-
supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
23000
|
-
glFormat = utils.convert( texture.format, texture.encoding ),
|
|
23001
|
-
glType = utils.convert( texture.type ),
|
|
23002
|
-
glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23270
|
+
setTextureParameters( 34067, texture, supportsMips );
|
|
23003
23271
|
|
|
23004
|
-
|
|
23005
|
-
const allocateMemory = ( textureProperties.__version === undefined );
|
|
23006
|
-
let levels = getMipLevels( texture, image, supportsMips );
|
|
23272
|
+
let mipmaps;
|
|
23007
23273
|
|
|
23008
|
-
|
|
23274
|
+
if ( isCompressed ) {
|
|
23009
23275
|
|
|
23010
|
-
|
|
23276
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23011
23277
|
|
|
23012
|
-
|
|
23278
|
+
state.texStorage2D( 34067, levels, glInternalFormat, image.width, image.height );
|
|
23013
23279
|
|
|
23014
|
-
|
|
23280
|
+
}
|
|
23015
23281
|
|
|
23016
|
-
|
|
23282
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
23017
23283
|
|
|
23018
|
-
|
|
23284
|
+
mipmaps = cubeImage[ i ].mipmaps;
|
|
23019
23285
|
|
|
23020
|
-
|
|
23286
|
+
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
23021
23287
|
|
|
23022
|
-
|
|
23288
|
+
const mipmap = mipmaps[ j ];
|
|
23023
23289
|
|
|
23024
|
-
|
|
23290
|
+
if ( texture.format !== RGBAFormat ) {
|
|
23025
23291
|
|
|
23026
|
-
|
|
23292
|
+
if ( glFormat !== null ) {
|
|
23027
23293
|
|
|
23028
|
-
|
|
23294
|
+
if ( useTexStorage ) {
|
|
23029
23295
|
|
|
23030
|
-
|
|
23296
|
+
state.compressedTexSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
|
|
23031
23297
|
|
|
23032
|
-
|
|
23298
|
+
} else {
|
|
23299
|
+
|
|
23300
|
+
state.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
|
|
23033
23301
|
|
|
23034
|
-
|
|
23302
|
+
}
|
|
23035
23303
|
|
|
23036
23304
|
} else {
|
|
23037
23305
|
|
|
23038
|
-
|
|
23306
|
+
console.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );
|
|
23039
23307
|
|
|
23040
23308
|
}
|
|
23041
23309
|
|
|
23042
23310
|
} else {
|
|
23043
23311
|
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
}
|
|
23047
|
-
|
|
23048
|
-
} else {
|
|
23312
|
+
if ( useTexStorage ) {
|
|
23049
23313
|
|
|
23050
|
-
|
|
23314
|
+
state.texSubImage2D( 34069 + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
|
|
23051
23315
|
|
|
23052
|
-
|
|
23316
|
+
} else {
|
|
23053
23317
|
|
|
23054
|
-
|
|
23318
|
+
state.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
|
|
23055
23319
|
|
|
23056
|
-
|
|
23320
|
+
}
|
|
23057
23321
|
|
|
23058
23322
|
}
|
|
23059
23323
|
|
|
@@ -23061,78 +23325,78 @@
|
|
|
23061
23325
|
|
|
23062
23326
|
}
|
|
23063
23327
|
|
|
23064
|
-
}
|
|
23328
|
+
} else {
|
|
23065
23329
|
|
|
23066
|
-
|
|
23330
|
+
mipmaps = texture.mipmaps;
|
|
23067
23331
|
|
|
23068
|
-
|
|
23332
|
+
if ( useTexStorage && allocateMemory ) {
|
|
23069
23333
|
|
|
23070
|
-
|
|
23334
|
+
// TODO: Uniformly handle mipmap definitions
|
|
23335
|
+
// Normal textures and compressed cube textures define base level + mips with their mipmap array
|
|
23336
|
+
// Uncompressed cube textures use their mipmap array only for mips (no base level)
|
|
23071
23337
|
|
|
23072
|
-
|
|
23073
|
-
// Normal textures and compressed cube textures define base level + mips with their mipmap array
|
|
23074
|
-
// Uncompressed cube textures use their mipmap array only for mips (no base level)
|
|
23338
|
+
if ( mipmaps.length > 0 ) levels ++;
|
|
23075
23339
|
|
|
23076
|
-
|
|
23340
|
+
state.texStorage2D( 34067, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
|
|
23077
23341
|
|
|
23078
|
-
|
|
23342
|
+
}
|
|
23079
23343
|
|
|
23080
|
-
|
|
23344
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
23081
23345
|
|
|
23082
|
-
|
|
23346
|
+
if ( isDataTexture ) {
|
|
23083
23347
|
|
|
23084
|
-
|
|
23348
|
+
if ( useTexStorage ) {
|
|
23085
23349
|
|
|
23086
|
-
|
|
23350
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
|
|
23087
23351
|
|
|
23088
|
-
|
|
23352
|
+
} else {
|
|
23089
23353
|
|
|
23090
|
-
|
|
23354
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
|
|
23091
23355
|
|
|
23092
|
-
|
|
23356
|
+
}
|
|
23093
23357
|
|
|
23094
|
-
|
|
23358
|
+
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
23095
23359
|
|
|
23096
|
-
|
|
23360
|
+
const mipmap = mipmaps[ j ];
|
|
23361
|
+
const mipmapImage = mipmap.image[ i ].image;
|
|
23097
23362
|
|
|
23098
|
-
|
|
23099
|
-
const mipmapImage = mipmap.image[ i ].image;
|
|
23363
|
+
if ( useTexStorage ) {
|
|
23100
23364
|
|
|
23101
|
-
|
|
23365
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
|
|
23102
23366
|
|
|
23103
|
-
|
|
23367
|
+
} else {
|
|
23104
23368
|
|
|
23105
|
-
|
|
23369
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );
|
|
23106
23370
|
|
|
23107
|
-
|
|
23371
|
+
}
|
|
23108
23372
|
|
|
23109
23373
|
}
|
|
23110
23374
|
|
|
23111
|
-
}
|
|
23375
|
+
} else {
|
|
23112
23376
|
|
|
23113
|
-
|
|
23377
|
+
if ( useTexStorage ) {
|
|
23114
23378
|
|
|
23115
|
-
|
|
23379
|
+
state.texSubImage2D( 34069 + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
|
|
23116
23380
|
|
|
23117
|
-
|
|
23381
|
+
} else {
|
|
23118
23382
|
|
|
23119
|
-
|
|
23383
|
+
state.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );
|
|
23120
23384
|
|
|
23121
|
-
|
|
23385
|
+
}
|
|
23122
23386
|
|
|
23123
|
-
|
|
23387
|
+
for ( let j = 0; j < mipmaps.length; j ++ ) {
|
|
23124
23388
|
|
|
23125
|
-
|
|
23389
|
+
const mipmap = mipmaps[ j ];
|
|
23126
23390
|
|
|
23127
|
-
|
|
23391
|
+
if ( useTexStorage ) {
|
|
23128
23392
|
|
|
23129
|
-
|
|
23393
|
+
state.texSubImage2D( 34069 + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
|
|
23130
23394
|
|
|
23131
|
-
|
|
23395
|
+
} else {
|
|
23132
23396
|
|
|
23133
|
-
|
|
23397
|
+
state.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );
|
|
23134
23398
|
|
|
23135
|
-
|
|
23399
|
+
}
|
|
23136
23400
|
|
|
23137
23401
|
}
|
|
23138
23402
|
|
|
@@ -23142,19 +23406,21 @@
|
|
|
23142
23406
|
|
|
23143
23407
|
}
|
|
23144
23408
|
|
|
23145
|
-
|
|
23409
|
+
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
|
|
23410
|
+
|
|
23411
|
+
// We assume images for cube map have the same size.
|
|
23412
|
+
generateMipmap( 34067 );
|
|
23146
23413
|
|
|
23147
|
-
|
|
23414
|
+
}
|
|
23415
|
+
|
|
23416
|
+
source.__currentVersion = source.version;
|
|
23148
23417
|
|
|
23149
|
-
|
|
23150
|
-
generateMipmap( 34067 );
|
|
23418
|
+
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
23151
23419
|
|
|
23152
23420
|
}
|
|
23153
23421
|
|
|
23154
23422
|
textureProperties.__version = texture.version;
|
|
23155
23423
|
|
|
23156
|
-
if ( texture.onUpdate ) texture.onUpdate( texture );
|
|
23157
|
-
|
|
23158
23424
|
}
|
|
23159
23425
|
|
|
23160
23426
|
// Render targets
|
|
@@ -23182,9 +23448,10 @@
|
|
|
23182
23448
|
}
|
|
23183
23449
|
|
|
23184
23450
|
state.bindFramebuffer( 36160, framebuffer );
|
|
23185
|
-
if ( renderTarget.useRenderToTexture ) {
|
|
23186
23451
|
|
|
23187
|
-
|
|
23452
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23453
|
+
|
|
23454
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
23188
23455
|
|
|
23189
23456
|
} else {
|
|
23190
23457
|
|
|
@@ -23206,7 +23473,7 @@
|
|
|
23206
23473
|
|
|
23207
23474
|
let glInternalFormat = 33189;
|
|
23208
23475
|
|
|
23209
|
-
if ( isMultisample || renderTarget
|
|
23476
|
+
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
23210
23477
|
|
|
23211
23478
|
const depthTexture = renderTarget.depthTexture;
|
|
23212
23479
|
|
|
@@ -23226,9 +23493,9 @@
|
|
|
23226
23493
|
|
|
23227
23494
|
const samples = getRenderTargetSamples( renderTarget );
|
|
23228
23495
|
|
|
23229
|
-
if ( renderTarget
|
|
23496
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23230
23497
|
|
|
23231
|
-
|
|
23498
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23232
23499
|
|
|
23233
23500
|
} else {
|
|
23234
23501
|
|
|
@@ -23248,13 +23515,13 @@
|
|
|
23248
23515
|
|
|
23249
23516
|
const samples = getRenderTargetSamples( renderTarget );
|
|
23250
23517
|
|
|
23251
|
-
if ( isMultisample && renderTarget
|
|
23518
|
+
if ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {
|
|
23252
23519
|
|
|
23253
23520
|
_gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height );
|
|
23254
23521
|
|
|
23255
|
-
} else if ( renderTarget
|
|
23522
|
+
} else if ( useMultisampledRTT( renderTarget ) ) {
|
|
23256
23523
|
|
|
23257
|
-
|
|
23524
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( 36161, samples, 35056, renderTarget.width, renderTarget.height );
|
|
23258
23525
|
|
|
23259
23526
|
} else {
|
|
23260
23527
|
|
|
@@ -23275,13 +23542,13 @@
|
|
|
23275
23542
|
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23276
23543
|
const samples = getRenderTargetSamples( renderTarget );
|
|
23277
23544
|
|
|
23278
|
-
if ( isMultisample && renderTarget
|
|
23545
|
+
if ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {
|
|
23279
23546
|
|
|
23280
23547
|
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23281
23548
|
|
|
23282
|
-
} else if ( renderTarget
|
|
23549
|
+
} else if ( useMultisampledRTT( renderTarget ) ) {
|
|
23283
23550
|
|
|
23284
|
-
|
|
23551
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23285
23552
|
|
|
23286
23553
|
} else {
|
|
23287
23554
|
|
|
@@ -23327,9 +23594,9 @@
|
|
|
23327
23594
|
|
|
23328
23595
|
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
23329
23596
|
|
|
23330
|
-
if ( renderTarget
|
|
23597
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23331
23598
|
|
|
23332
|
-
|
|
23599
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( 36160, 36096, 3553, webglDepthTexture, 0, samples );
|
|
23333
23600
|
|
|
23334
23601
|
} else {
|
|
23335
23602
|
|
|
@@ -23339,9 +23606,9 @@
|
|
|
23339
23606
|
|
|
23340
23607
|
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
23341
23608
|
|
|
23342
|
-
if ( renderTarget
|
|
23609
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
23343
23610
|
|
|
23344
|
-
|
|
23611
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( 36160, 33306, 3553, webglDepthTexture, 0, samples );
|
|
23345
23612
|
|
|
23346
23613
|
} else {
|
|
23347
23614
|
|
|
@@ -23441,7 +23708,6 @@
|
|
|
23441
23708
|
|
|
23442
23709
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
23443
23710
|
const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
|
|
23444
|
-
const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
|
|
23445
23711
|
const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
|
|
23446
23712
|
|
|
23447
23713
|
// Setup framebuffer
|
|
@@ -23486,41 +23752,32 @@
|
|
|
23486
23752
|
|
|
23487
23753
|
}
|
|
23488
23754
|
|
|
23489
|
-
} else if ( renderTarget.
|
|
23490
|
-
|
|
23491
|
-
if ( isWebGL2 ) {
|
|
23492
|
-
|
|
23493
|
-
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
23494
|
-
renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
|
|
23495
|
-
|
|
23496
|
-
_gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23497
|
-
|
|
23498
|
-
const glFormat = utils.convert( texture.format, texture.encoding );
|
|
23499
|
-
const glType = utils.convert( texture.type );
|
|
23500
|
-
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23501
|
-
const samples = getRenderTargetSamples( renderTarget );
|
|
23502
|
-
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23503
|
-
|
|
23504
|
-
state.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23505
|
-
_gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23506
|
-
_gl.bindRenderbuffer( 36161, null );
|
|
23507
|
-
|
|
23508
|
-
if ( renderTarget.depthBuffer ) {
|
|
23755
|
+
} else if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
23509
23756
|
|
|
23510
|
-
|
|
23511
|
-
|
|
23757
|
+
renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
|
|
23758
|
+
renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
|
|
23512
23759
|
|
|
23513
|
-
|
|
23760
|
+
_gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23514
23761
|
|
|
23515
|
-
|
|
23762
|
+
const glFormat = utils.convert( texture.format, texture.encoding );
|
|
23763
|
+
const glType = utils.convert( texture.type );
|
|
23764
|
+
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
|
|
23765
|
+
const samples = getRenderTargetSamples( renderTarget );
|
|
23766
|
+
_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
23516
23767
|
|
|
23768
|
+
state.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23769
|
+
_gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer );
|
|
23770
|
+
_gl.bindRenderbuffer( 36161, null );
|
|
23517
23771
|
|
|
23518
|
-
|
|
23772
|
+
if ( renderTarget.depthBuffer ) {
|
|
23519
23773
|
|
|
23520
|
-
|
|
23774
|
+
renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();
|
|
23775
|
+
setupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );
|
|
23521
23776
|
|
|
23522
23777
|
}
|
|
23523
23778
|
|
|
23779
|
+
state.bindFramebuffer( 36160, null );
|
|
23780
|
+
|
|
23524
23781
|
}
|
|
23525
23782
|
|
|
23526
23783
|
}
|
|
@@ -23573,18 +23830,15 @@
|
|
|
23573
23830
|
|
|
23574
23831
|
let glTextureType = 3553;
|
|
23575
23832
|
|
|
23576
|
-
if (
|
|
23577
|
-
|
|
23578
|
-
// Render targets containing layers, i.e: Texture 3D and 2d arrays
|
|
23833
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
23579
23834
|
|
|
23580
23835
|
if ( isWebGL2 ) {
|
|
23581
23836
|
|
|
23582
|
-
|
|
23583
|
-
glTextureType = isTexture3D ? 32879 : 35866;
|
|
23837
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? 32879 : 35866;
|
|
23584
23838
|
|
|
23585
23839
|
} else {
|
|
23586
23840
|
|
|
23587
|
-
console.
|
|
23841
|
+
console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
|
|
23588
23842
|
|
|
23589
23843
|
}
|
|
23590
23844
|
|
|
@@ -23641,61 +23895,61 @@
|
|
|
23641
23895
|
|
|
23642
23896
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
23643
23897
|
|
|
23644
|
-
if ( renderTarget.
|
|
23898
|
+
if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
|
|
23645
23899
|
|
|
23646
|
-
|
|
23900
|
+
const width = renderTarget.width;
|
|
23901
|
+
const height = renderTarget.height;
|
|
23902
|
+
let mask = 16384;
|
|
23903
|
+
const invalidationArray = [ 36064 ];
|
|
23904
|
+
const depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;
|
|
23647
23905
|
|
|
23648
|
-
|
|
23649
|
-
const height = renderTarget.height;
|
|
23650
|
-
let mask = 16384;
|
|
23651
|
-
const invalidationArray = [ 36064 ];
|
|
23652
|
-
const depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;
|
|
23906
|
+
if ( renderTarget.depthBuffer ) {
|
|
23653
23907
|
|
|
23654
|
-
|
|
23655
|
-
|
|
23656
|
-
invalidationArray.push( depthStyle );
|
|
23908
|
+
invalidationArray.push( depthStyle );
|
|
23657
23909
|
|
|
23658
|
-
|
|
23910
|
+
}
|
|
23659
23911
|
|
|
23660
|
-
|
|
23912
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
23913
|
+
const ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : true;
|
|
23661
23914
|
|
|
23662
|
-
|
|
23663
|
-
if ( renderTarget.stencilBuffer ) mask |= 1024;
|
|
23915
|
+
if ( ignoreDepthValues === false ) {
|
|
23664
23916
|
|
|
23665
|
-
|
|
23917
|
+
if ( renderTarget.depthBuffer ) mask |= 256;
|
|
23918
|
+
if ( renderTarget.stencilBuffer ) mask |= 1024;
|
|
23666
23919
|
|
|
23667
|
-
|
|
23920
|
+
}
|
|
23668
23921
|
|
|
23669
|
-
|
|
23670
|
-
|
|
23922
|
+
state.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23923
|
+
state.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer );
|
|
23671
23924
|
|
|
23672
|
-
|
|
23925
|
+
if ( ignoreDepthValues === true ) {
|
|
23673
23926
|
|
|
23674
|
-
|
|
23675
|
-
|
|
23927
|
+
_gl.invalidateFramebuffer( 36008, [ depthStyle ] );
|
|
23928
|
+
_gl.invalidateFramebuffer( 36009, [ depthStyle ] );
|
|
23676
23929
|
|
|
23677
|
-
|
|
23930
|
+
}
|
|
23678
23931
|
|
|
23679
|
-
|
|
23680
|
-
|
|
23932
|
+
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 );
|
|
23933
|
+
_gl.invalidateFramebuffer( 36008, invalidationArray );
|
|
23681
23934
|
|
|
23682
|
-
|
|
23683
|
-
|
|
23935
|
+
state.bindFramebuffer( 36008, null );
|
|
23936
|
+
state.bindFramebuffer( 36009, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
23684
23937
|
|
|
23685
|
-
|
|
23938
|
+
}
|
|
23686
23939
|
|
|
23687
|
-
|
|
23940
|
+
}
|
|
23688
23941
|
|
|
23689
|
-
|
|
23942
|
+
function getRenderTargetSamples( renderTarget ) {
|
|
23690
23943
|
|
|
23691
|
-
|
|
23944
|
+
return Math.min( maxSamples, renderTarget.samples );
|
|
23692
23945
|
|
|
23693
23946
|
}
|
|
23694
23947
|
|
|
23695
|
-
function
|
|
23948
|
+
function useMultisampledRTT( renderTarget ) {
|
|
23696
23949
|
|
|
23697
|
-
|
|
23698
|
-
|
|
23950
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
23951
|
+
|
|
23952
|
+
return isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
|
|
23699
23953
|
|
|
23700
23954
|
}
|
|
23701
23955
|
|
|
@@ -23773,50 +24027,6 @@
|
|
|
23773
24027
|
|
|
23774
24028
|
}
|
|
23775
24029
|
|
|
23776
|
-
// backwards compatibility
|
|
23777
|
-
|
|
23778
|
-
let warnedTexture2D = false;
|
|
23779
|
-
let warnedTextureCube = false;
|
|
23780
|
-
|
|
23781
|
-
function safeSetTexture2D( texture, slot ) {
|
|
23782
|
-
|
|
23783
|
-
if ( texture && texture.isWebGLRenderTarget ) {
|
|
23784
|
-
|
|
23785
|
-
if ( warnedTexture2D === false ) {
|
|
23786
|
-
|
|
23787
|
-
console.warn( 'THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.' );
|
|
23788
|
-
warnedTexture2D = true;
|
|
23789
|
-
|
|
23790
|
-
}
|
|
23791
|
-
|
|
23792
|
-
texture = texture.texture;
|
|
23793
|
-
|
|
23794
|
-
}
|
|
23795
|
-
|
|
23796
|
-
setTexture2D( texture, slot );
|
|
23797
|
-
|
|
23798
|
-
}
|
|
23799
|
-
|
|
23800
|
-
function safeSetTextureCube( texture, slot ) {
|
|
23801
|
-
|
|
23802
|
-
if ( texture && texture.isWebGLCubeRenderTarget ) {
|
|
23803
|
-
|
|
23804
|
-
if ( warnedTextureCube === false ) {
|
|
23805
|
-
|
|
23806
|
-
console.warn( 'THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.' );
|
|
23807
|
-
warnedTextureCube = true;
|
|
23808
|
-
|
|
23809
|
-
}
|
|
23810
|
-
|
|
23811
|
-
texture = texture.texture;
|
|
23812
|
-
|
|
23813
|
-
}
|
|
23814
|
-
|
|
23815
|
-
|
|
23816
|
-
setTextureCube( texture, slot );
|
|
23817
|
-
|
|
23818
|
-
}
|
|
23819
|
-
|
|
23820
24030
|
//
|
|
23821
24031
|
|
|
23822
24032
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
@@ -23832,9 +24042,7 @@
|
|
|
23832
24042
|
this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
|
|
23833
24043
|
this.setupDepthRenderbuffer = setupDepthRenderbuffer;
|
|
23834
24044
|
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
23835
|
-
|
|
23836
|
-
this.safeSetTexture2D = safeSetTexture2D;
|
|
23837
|
-
this.safeSetTextureCube = safeSetTextureCube;
|
|
24045
|
+
this.useMultisampledRTT = useMultisampledRTT;
|
|
23838
24046
|
|
|
23839
24047
|
}
|
|
23840
24048
|
|
|
@@ -24461,13 +24669,11 @@
|
|
|
24461
24669
|
|
|
24462
24670
|
let referenceSpace = null;
|
|
24463
24671
|
let referenceSpaceType = 'local-floor';
|
|
24464
|
-
const hasMultisampledRenderToTexture = renderer.extensions.has( 'WEBGL_multisampled_render_to_texture' );
|
|
24465
24672
|
|
|
24466
24673
|
let pose = null;
|
|
24467
24674
|
let glBinding = null;
|
|
24468
24675
|
let glProjLayer = null;
|
|
24469
24676
|
let glBaseLayer = null;
|
|
24470
|
-
let isMultisample = false;
|
|
24471
24677
|
let xrFrame = null;
|
|
24472
24678
|
const attributes = gl.getContextAttributes();
|
|
24473
24679
|
let initialRenderTarget = null;
|
|
@@ -24697,7 +24903,6 @@
|
|
|
24697
24903
|
|
|
24698
24904
|
} else {
|
|
24699
24905
|
|
|
24700
|
-
isMultisample = attributes.antialias;
|
|
24701
24906
|
let depthFormat = null;
|
|
24702
24907
|
let depthType = null;
|
|
24703
24908
|
let glDepthFormat = null;
|
|
@@ -24722,36 +24927,20 @@
|
|
|
24722
24927
|
|
|
24723
24928
|
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
24724
24929
|
|
|
24725
|
-
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
useRenderToTexture: hasMultisampledRenderToTexture,
|
|
24737
|
-
encoding: renderer.outputEncoding
|
|
24738
|
-
} );
|
|
24739
|
-
|
|
24740
|
-
} else {
|
|
24741
|
-
|
|
24742
|
-
newRenderTarget = new WebGLRenderTarget(
|
|
24743
|
-
glProjLayer.textureWidth,
|
|
24744
|
-
glProjLayer.textureHeight,
|
|
24745
|
-
{
|
|
24746
|
-
format: RGBAFormat,
|
|
24747
|
-
type: UnsignedByteType,
|
|
24748
|
-
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
24749
|
-
stencilBuffer: attributes.stencil,
|
|
24750
|
-
ignoreDepth: glProjLayer.ignoreDepthValues,
|
|
24751
|
-
encoding: renderer.outputEncoding
|
|
24752
|
-
} );
|
|
24930
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
24931
|
+
glProjLayer.textureWidth,
|
|
24932
|
+
glProjLayer.textureHeight,
|
|
24933
|
+
{
|
|
24934
|
+
format: RGBAFormat,
|
|
24935
|
+
type: UnsignedByteType,
|
|
24936
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
24937
|
+
stencilBuffer: attributes.stencil,
|
|
24938
|
+
encoding: renderer.outputEncoding,
|
|
24939
|
+
samples: attributes.antialias ? 4 : 0
|
|
24940
|
+
} );
|
|
24753
24941
|
|
|
24754
|
-
|
|
24942
|
+
const renderTargetProperties = renderer.properties.get( newRenderTarget );
|
|
24943
|
+
renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
|
|
24755
24944
|
|
|
24756
24945
|
}
|
|
24757
24946
|
|
|
@@ -25922,7 +26111,6 @@
|
|
|
25922
26111
|
const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(),
|
|
25923
26112
|
_context = parameters.context !== undefined ? parameters.context : null,
|
|
25924
26113
|
|
|
25925
|
-
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
|
|
25926
26114
|
_depth = parameters.depth !== undefined ? parameters.depth : true,
|
|
25927
26115
|
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
|
|
25928
26116
|
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
|
|
@@ -25931,6 +26119,18 @@
|
|
|
25931
26119
|
_powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',
|
|
25932
26120
|
_failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;
|
|
25933
26121
|
|
|
26122
|
+
let _alpha;
|
|
26123
|
+
|
|
26124
|
+
if ( parameters.context !== undefined ) {
|
|
26125
|
+
|
|
26126
|
+
_alpha = _context.getContextAttributes().alpha;
|
|
26127
|
+
|
|
26128
|
+
} else {
|
|
26129
|
+
|
|
26130
|
+
_alpha = parameters.alpha !== undefined ? parameters.alpha : false;
|
|
26131
|
+
|
|
26132
|
+
}
|
|
26133
|
+
|
|
25934
26134
|
let currentRenderList = null;
|
|
25935
26135
|
let currentRenderState = null;
|
|
25936
26136
|
|
|
@@ -26032,6 +26232,7 @@
|
|
|
26032
26232
|
|
|
26033
26233
|
const _projScreenMatrix = new Matrix4();
|
|
26034
26234
|
|
|
26235
|
+
const _vector2 = new Vector2();
|
|
26035
26236
|
const _vector3 = new Vector3();
|
|
26036
26237
|
|
|
26037
26238
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
@@ -26384,13 +26585,13 @@
|
|
|
26384
26585
|
|
|
26385
26586
|
};
|
|
26386
26587
|
|
|
26387
|
-
this.clear = function ( color, depth, stencil ) {
|
|
26588
|
+
this.clear = function ( color = true, depth = true, stencil = true ) {
|
|
26388
26589
|
|
|
26389
26590
|
let bits = 0;
|
|
26390
26591
|
|
|
26391
|
-
if ( color
|
|
26392
|
-
if ( depth
|
|
26393
|
-
if ( stencil
|
|
26592
|
+
if ( color ) bits |= 16384;
|
|
26593
|
+
if ( depth ) bits |= 256;
|
|
26594
|
+
if ( stencil ) bits |= 1024;
|
|
26394
26595
|
|
|
26395
26596
|
_gl.clear( bits );
|
|
26396
26597
|
|
|
@@ -26872,14 +27073,6 @@
|
|
|
26872
27073
|
|
|
26873
27074
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
26874
27075
|
|
|
26875
|
-
// Ensure depth buffer writing is enabled so it can be cleared on next render
|
|
26876
|
-
|
|
26877
|
-
state.buffers.depth.setTest( true );
|
|
26878
|
-
state.buffers.depth.setMask( true );
|
|
26879
|
-
state.buffers.color.setMask( true );
|
|
26880
|
-
|
|
26881
|
-
state.setPolygonOffset( false );
|
|
26882
|
-
|
|
26883
27076
|
// _gl.finish();
|
|
26884
27077
|
|
|
26885
27078
|
bindingStates.resetDefaultState();
|
|
@@ -27042,27 +27235,45 @@
|
|
|
27042
27235
|
if ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );
|
|
27043
27236
|
if ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );
|
|
27044
27237
|
|
|
27238
|
+
// Ensure depth buffer writing is enabled so it can be cleared on next render
|
|
27239
|
+
|
|
27240
|
+
state.buffers.depth.setTest( true );
|
|
27241
|
+
state.buffers.depth.setMask( true );
|
|
27242
|
+
state.buffers.color.setMask( true );
|
|
27243
|
+
|
|
27244
|
+
state.setPolygonOffset( false );
|
|
27245
|
+
|
|
27045
27246
|
}
|
|
27046
27247
|
|
|
27047
27248
|
function renderTransmissionPass( opaqueObjects, scene, camera ) {
|
|
27048
27249
|
|
|
27049
|
-
|
|
27250
|
+
const isWebGL2 = capabilities.isWebGL2;
|
|
27050
27251
|
|
|
27051
|
-
|
|
27052
|
-
const renderTargetType = needsAntialias ? WebGLMultisampleRenderTarget : WebGLRenderTarget;
|
|
27252
|
+
if ( _transmissionRenderTarget === null ) {
|
|
27053
27253
|
|
|
27054
|
-
_transmissionRenderTarget = new
|
|
27254
|
+
_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
|
|
27055
27255
|
generateMipmaps: true,
|
|
27056
27256
|
type: utils.convert( HalfFloatType ) !== null ? HalfFloatType : UnsignedByteType,
|
|
27057
27257
|
minFilter: LinearMipmapLinearFilter,
|
|
27058
|
-
|
|
27059
|
-
wrapS: ClampToEdgeWrapping,
|
|
27060
|
-
wrapT: ClampToEdgeWrapping,
|
|
27061
|
-
useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
|
|
27258
|
+
samples: ( isWebGL2 && _antialias === true ) ? 4 : 0
|
|
27062
27259
|
} );
|
|
27063
27260
|
|
|
27064
27261
|
}
|
|
27065
27262
|
|
|
27263
|
+
_this.getDrawingBufferSize( _vector2 );
|
|
27264
|
+
|
|
27265
|
+
if ( isWebGL2 ) {
|
|
27266
|
+
|
|
27267
|
+
_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
|
|
27268
|
+
|
|
27269
|
+
} else {
|
|
27270
|
+
|
|
27271
|
+
_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
|
|
27272
|
+
|
|
27273
|
+
}
|
|
27274
|
+
|
|
27275
|
+
//
|
|
27276
|
+
|
|
27066
27277
|
const currentRenderTarget = _this.getRenderTarget();
|
|
27067
27278
|
_this.setRenderTarget( _transmissionRenderTarget );
|
|
27068
27279
|
_this.clear();
|
|
@@ -27260,6 +27471,7 @@
|
|
|
27260
27471
|
materialProperties.skinning = parameters.skinning;
|
|
27261
27472
|
materialProperties.morphTargets = parameters.morphTargets;
|
|
27262
27473
|
materialProperties.morphNormals = parameters.morphNormals;
|
|
27474
|
+
materialProperties.morphColors = parameters.morphColors;
|
|
27263
27475
|
materialProperties.morphTargetsCount = parameters.morphTargetsCount;
|
|
27264
27476
|
materialProperties.numClippingPlanes = parameters.numClippingPlanes;
|
|
27265
27477
|
materialProperties.numIntersection = parameters.numClipIntersection;
|
|
@@ -27283,9 +27495,12 @@
|
|
|
27283
27495
|
const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
|
|
27284
27496
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
27285
27497
|
const morphNormals = !! geometry.morphAttributes.normal;
|
|
27286
|
-
const
|
|
27498
|
+
const morphColors = !! geometry.morphAttributes.color;
|
|
27287
27499
|
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;
|
|
27288
27500
|
|
|
27501
|
+
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
27502
|
+
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
27503
|
+
|
|
27289
27504
|
const materialProperties = properties.get( material );
|
|
27290
27505
|
const lights = currentRenderState.state.lights;
|
|
27291
27506
|
|
|
@@ -27366,6 +27581,10 @@
|
|
|
27366
27581
|
|
|
27367
27582
|
needsProgramChange = true;
|
|
27368
27583
|
|
|
27584
|
+
} else if ( materialProperties.morphColors !== morphColors ) {
|
|
27585
|
+
|
|
27586
|
+
needsProgramChange = true;
|
|
27587
|
+
|
|
27369
27588
|
} else if ( materialProperties.toneMapping !== toneMapping ) {
|
|
27370
27589
|
|
|
27371
27590
|
needsProgramChange = true;
|
|
@@ -27516,7 +27735,9 @@
|
|
|
27516
27735
|
|
|
27517
27736
|
}
|
|
27518
27737
|
|
|
27519
|
-
|
|
27738
|
+
const morphAttributes = geometry.morphAttributes;
|
|
27739
|
+
|
|
27740
|
+
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
|
|
27520
27741
|
|
|
27521
27742
|
morphtargets.update( object, geometry, material, program );
|
|
27522
27743
|
|
|
@@ -27602,6 +27823,13 @@
|
|
|
27602
27823
|
uniforms.rectAreaLights.needsUpdate = value;
|
|
27603
27824
|
uniforms.hemisphereLights.needsUpdate = value;
|
|
27604
27825
|
|
|
27826
|
+
uniforms.directionalShadowMap.needsUpdate = value;
|
|
27827
|
+
uniforms.directionalShadowMatrix.needsUpdate = value;
|
|
27828
|
+
uniforms.spotShadowMap.needsUpdate = value;
|
|
27829
|
+
uniforms.spotShadowMatrix.needsUpdate = value;
|
|
27830
|
+
uniforms.pointShadowMap.needsUpdate = value;
|
|
27831
|
+
uniforms.pointShadowMatrix.needsUpdate = value;
|
|
27832
|
+
|
|
27605
27833
|
}
|
|
27606
27834
|
|
|
27607
27835
|
function materialNeedsLights( material ) {
|
|
@@ -27646,9 +27874,9 @@
|
|
|
27646
27874
|
|
|
27647
27875
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
27648
27876
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
27649
|
-
if (
|
|
27877
|
+
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
|
|
27650
27878
|
|
|
27651
|
-
console.warn( '
|
|
27879
|
+
console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
|
|
27652
27880
|
renderTarget.useRenderToTexture = false;
|
|
27653
27881
|
renderTarget.useRenderbuffer = true;
|
|
27654
27882
|
|
|
@@ -27673,6 +27901,7 @@
|
|
|
27673
27901
|
_currentRenderTarget = renderTarget;
|
|
27674
27902
|
_currentActiveCubeFace = activeCubeFace;
|
|
27675
27903
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
27904
|
+
|
|
27676
27905
|
let useDefaultFramebuffer = true;
|
|
27677
27906
|
|
|
27678
27907
|
if ( renderTarget ) {
|
|
@@ -27706,7 +27935,7 @@
|
|
|
27706
27935
|
|
|
27707
27936
|
const texture = renderTarget.texture;
|
|
27708
27937
|
|
|
27709
|
-
if ( texture.
|
|
27938
|
+
if ( texture.isData3DTexture || texture.isDataArrayTexture ) {
|
|
27710
27939
|
|
|
27711
27940
|
isRenderTarget3D = true;
|
|
27712
27941
|
|
|
@@ -27719,7 +27948,7 @@
|
|
|
27719
27948
|
framebuffer = __webglFramebuffer[ activeCubeFace ];
|
|
27720
27949
|
isCube = true;
|
|
27721
27950
|
|
|
27722
|
-
} else if ( renderTarget.
|
|
27951
|
+
} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
|
|
27723
27952
|
|
|
27724
27953
|
framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
|
|
27725
27954
|
|
|
@@ -27921,12 +28150,12 @@
|
|
|
27921
28150
|
const glType = utils.convert( dstTexture.type );
|
|
27922
28151
|
let glTarget;
|
|
27923
28152
|
|
|
27924
|
-
if ( dstTexture.
|
|
28153
|
+
if ( dstTexture.isData3DTexture ) {
|
|
27925
28154
|
|
|
27926
28155
|
textures.setTexture3D( dstTexture, 0 );
|
|
27927
28156
|
glTarget = 32879;
|
|
27928
28157
|
|
|
27929
|
-
} else if ( dstTexture.
|
|
28158
|
+
} else if ( dstTexture.isDataArrayTexture ) {
|
|
27930
28159
|
|
|
27931
28160
|
textures.setTexture2DArray( dstTexture, 0 );
|
|
27932
28161
|
glTarget = 35866;
|
|
@@ -27956,7 +28185,7 @@
|
|
|
27956
28185
|
_gl.pixelStorei( 3315, sourceBox.min.y );
|
|
27957
28186
|
_gl.pixelStorei( 32877, sourceBox.min.z );
|
|
27958
28187
|
|
|
27959
|
-
if ( srcTexture.isDataTexture || srcTexture.
|
|
28188
|
+
if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
|
|
27960
28189
|
|
|
27961
28190
|
_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );
|
|
27962
28191
|
|
|
@@ -28896,9 +29125,6 @@
|
|
|
28896
29125
|
|
|
28897
29126
|
this.image = { data: data, width: width, height: height };
|
|
28898
29127
|
|
|
28899
|
-
this.magFilter = magFilter;
|
|
28900
|
-
this.minFilter = minFilter;
|
|
28901
|
-
|
|
28902
29128
|
this.generateMipmaps = false;
|
|
28903
29129
|
this.flipY = false;
|
|
28904
29130
|
this.unpackAlignment = 1;
|
|
@@ -31749,9 +31975,9 @@
|
|
|
31749
31975
|
for ( let i = 0, curves = this.curves; i < curves.length; i ++ ) {
|
|
31750
31976
|
|
|
31751
31977
|
const curve = curves[ i ];
|
|
31752
|
-
const resolution =
|
|
31753
|
-
: ( curve
|
|
31754
|
-
:
|
|
31978
|
+
const resolution = curve.isEllipseCurve ? divisions * 2
|
|
31979
|
+
: ( curve.isLineCurve || curve.isLineCurve3 ) ? 1
|
|
31980
|
+
: curve.isSplineCurve ? divisions * curve.points.length
|
|
31755
31981
|
: divisions;
|
|
31756
31982
|
|
|
31757
31983
|
const pts = curve.getPoints( resolution );
|
|
@@ -34401,7 +34627,8 @@
|
|
|
34401
34627
|
|
|
34402
34628
|
} else {
|
|
34403
34629
|
|
|
34404
|
-
edges.add( hash1
|
|
34630
|
+
edges.add( hash1 );
|
|
34631
|
+
edges.add( hash2 );
|
|
34405
34632
|
return true;
|
|
34406
34633
|
|
|
34407
34634
|
}
|
|
@@ -34443,6 +34670,20 @@
|
|
|
34443
34670
|
|
|
34444
34671
|
ShadowMaterial.prototype.isShadowMaterial = true;
|
|
34445
34672
|
|
|
34673
|
+
class RawShaderMaterial extends ShaderMaterial {
|
|
34674
|
+
|
|
34675
|
+
constructor( parameters ) {
|
|
34676
|
+
|
|
34677
|
+
super( parameters );
|
|
34678
|
+
|
|
34679
|
+
this.type = 'RawShaderMaterial';
|
|
34680
|
+
|
|
34681
|
+
}
|
|
34682
|
+
|
|
34683
|
+
}
|
|
34684
|
+
|
|
34685
|
+
RawShaderMaterial.prototype.isRawShaderMaterial = true;
|
|
34686
|
+
|
|
34446
34687
|
/**
|
|
34447
34688
|
* parameters = {
|
|
34448
34689
|
* color: <hex>,
|
|
@@ -35422,6 +35663,33 @@
|
|
|
35422
35663
|
|
|
35423
35664
|
LineDashedMaterial.prototype.isLineDashedMaterial = true;
|
|
35424
35665
|
|
|
35666
|
+
const materialLib = {
|
|
35667
|
+
ShadowMaterial,
|
|
35668
|
+
SpriteMaterial,
|
|
35669
|
+
RawShaderMaterial,
|
|
35670
|
+
ShaderMaterial,
|
|
35671
|
+
PointsMaterial,
|
|
35672
|
+
MeshPhysicalMaterial,
|
|
35673
|
+
MeshStandardMaterial,
|
|
35674
|
+
MeshPhongMaterial,
|
|
35675
|
+
MeshToonMaterial,
|
|
35676
|
+
MeshNormalMaterial,
|
|
35677
|
+
MeshLambertMaterial,
|
|
35678
|
+
MeshDepthMaterial,
|
|
35679
|
+
MeshDistanceMaterial,
|
|
35680
|
+
MeshBasicMaterial,
|
|
35681
|
+
MeshMatcapMaterial,
|
|
35682
|
+
LineDashedMaterial,
|
|
35683
|
+
LineBasicMaterial,
|
|
35684
|
+
Material
|
|
35685
|
+
};
|
|
35686
|
+
|
|
35687
|
+
Material.fromType = function ( type ) {
|
|
35688
|
+
|
|
35689
|
+
return new materialLib[ type ]();
|
|
35690
|
+
|
|
35691
|
+
};
|
|
35692
|
+
|
|
35425
35693
|
const AnimationUtils = {
|
|
35426
35694
|
|
|
35427
35695
|
// same as Array.prototype.slice, but also works on typed arrays
|
|
@@ -37036,7 +37304,7 @@
|
|
|
37036
37304
|
|
|
37037
37305
|
}
|
|
37038
37306
|
|
|
37039
|
-
duration = morphTargetNames.length *
|
|
37307
|
+
duration = morphTargetNames.length * fps;
|
|
37040
37308
|
|
|
37041
37309
|
} else {
|
|
37042
37310
|
|
|
@@ -37563,7 +37831,9 @@
|
|
|
37563
37831
|
|
|
37564
37832
|
}
|
|
37565
37833
|
|
|
37566
|
-
|
|
37834
|
+
// Workaround: Checking if response.body === undefined for Alipay browser #23548
|
|
37835
|
+
|
|
37836
|
+
if ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {
|
|
37567
37837
|
|
|
37568
37838
|
return response;
|
|
37569
37839
|
|
|
@@ -37808,7 +38078,7 @@
|
|
|
37808
38078
|
image.addEventListener( 'load', onImageLoad, false );
|
|
37809
38079
|
image.addEventListener( 'error', onImageError, false );
|
|
37810
38080
|
|
|
37811
|
-
if ( url.
|
|
38081
|
+
if ( url.slice( 0, 5 ) !== 'data:' ) {
|
|
37812
38082
|
|
|
37813
38083
|
if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
|
|
37814
38084
|
|
|
@@ -38825,7 +39095,7 @@
|
|
|
38825
39095
|
|
|
38826
39096
|
if ( index === - 1 ) return './';
|
|
38827
39097
|
|
|
38828
|
-
return url.
|
|
39098
|
+
return url.slice( 0, index + 1 );
|
|
38829
39099
|
|
|
38830
39100
|
}
|
|
38831
39101
|
|
|
@@ -40041,7 +40311,7 @@
|
|
|
40041
40311
|
|
|
40042
40312
|
const matches = _trackRe.exec( trackName );
|
|
40043
40313
|
|
|
40044
|
-
if (
|
|
40314
|
+
if ( matches === null ) {
|
|
40045
40315
|
|
|
40046
40316
|
throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
|
|
40047
40317
|
|
|
@@ -40087,7 +40357,7 @@
|
|
|
40087
40357
|
|
|
40088
40358
|
static findNode( root, nodeName ) {
|
|
40089
40359
|
|
|
40090
|
-
if (
|
|
40360
|
+
if ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
|
|
40091
40361
|
|
|
40092
40362
|
return root;
|
|
40093
40363
|
|
|
@@ -42121,13 +42391,13 @@
|
|
|
42121
42391
|
|
|
42122
42392
|
setFromCamera( coords, camera ) {
|
|
42123
42393
|
|
|
42124
|
-
if ( camera
|
|
42394
|
+
if ( camera.isPerspectiveCamera ) {
|
|
42125
42395
|
|
|
42126
42396
|
this.ray.origin.setFromMatrixPosition( camera.matrixWorld );
|
|
42127
42397
|
this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();
|
|
42128
42398
|
this.camera = camera;
|
|
42129
42399
|
|
|
42130
|
-
} else if ( camera
|
|
42400
|
+
} else if ( camera.isOrthographicCamera ) {
|
|
42131
42401
|
|
|
42132
42402
|
this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
|
|
42133
42403
|
this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
|
|
@@ -42483,7 +42753,7 @@
|
|
|
42483
42753
|
|
|
42484
42754
|
const boneList = [];
|
|
42485
42755
|
|
|
42486
|
-
if ( object
|
|
42756
|
+
if ( object.isBone === true ) {
|
|
42487
42757
|
|
|
42488
42758
|
boneList.push( object );
|
|
42489
42759
|
|
|
@@ -42747,7 +43017,7 @@
|
|
|
42747
43017
|
if ( newShapes.length > 1 ) {
|
|
42748
43018
|
|
|
42749
43019
|
let ambiguous = false;
|
|
42750
|
-
|
|
43020
|
+
let toChange = 0;
|
|
42751
43021
|
|
|
42752
43022
|
for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
|
|
42753
43023
|
|
|
@@ -42768,7 +43038,8 @@
|
|
|
42768
43038
|
|
|
42769
43039
|
if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
|
|
42770
43040
|
|
|
42771
|
-
if ( sIdx !== s2Idx ) toChange
|
|
43041
|
+
if ( sIdx !== s2Idx ) toChange ++;
|
|
43042
|
+
|
|
42772
43043
|
if ( hole_unassigned ) {
|
|
42773
43044
|
|
|
42774
43045
|
hole_unassigned = false;
|
|
@@ -42793,12 +43064,10 @@
|
|
|
42793
43064
|
}
|
|
42794
43065
|
|
|
42795
43066
|
}
|
|
42796
|
-
// console.log("ambiguous: ", ambiguous);
|
|
42797
43067
|
|
|
42798
|
-
if ( toChange
|
|
43068
|
+
if ( toChange > 0 && ambiguous === false ) {
|
|
42799
43069
|
|
|
42800
|
-
|
|
42801
|
-
if ( ! ambiguous ) newShapeHoles = betterShapeHoles;
|
|
43070
|
+
newShapeHoles = betterShapeHoles;
|
|
42802
43071
|
|
|
42803
43072
|
}
|
|
42804
43073
|
|
|
@@ -42930,6 +43199,15 @@
|
|
|
42930
43199
|
|
|
42931
43200
|
};
|
|
42932
43201
|
|
|
43202
|
+
//
|
|
43203
|
+
|
|
43204
|
+
Euler.prototype.toVector3 = function () {
|
|
43205
|
+
|
|
43206
|
+
console.error( 'THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead' );
|
|
43207
|
+
|
|
43208
|
+
};
|
|
43209
|
+
|
|
43210
|
+
|
|
42933
43211
|
//
|
|
42934
43212
|
|
|
42935
43213
|
Sphere.prototype.empty = function () {
|
|
@@ -49841,7 +50119,7 @@
|
|
|
49841
50119
|
|
|
49842
50120
|
}
|
|
49843
50121
|
|
|
49844
|
-
} else
|
|
50122
|
+
} else {
|
|
49845
50123
|
|
|
49846
50124
|
// non-indexed buffer geometry
|
|
49847
50125
|
|
|
@@ -72570,13 +72848,15 @@
|
|
|
72570
72848
|
|
|
72571
72849
|
state.scene = threeObj;
|
|
72572
72850
|
},
|
|
72573
|
-
update: function update(state) {
|
|
72851
|
+
update: function update(state, changedProps) {
|
|
72574
72852
|
// Data accessors
|
|
72575
72853
|
var latAccessor = index$1(state.objectLat);
|
|
72576
72854
|
var lngAccessor = index$1(state.objectLng);
|
|
72577
72855
|
var altitudeAccessor = index$1(state.objectAltitude);
|
|
72578
72856
|
var threeObjAccessor = index$1(state.objectThreeObject);
|
|
72579
72857
|
threeDigest(state.objectsData, state.scene, {
|
|
72858
|
+
// objs need to be recreated if this prop has changed
|
|
72859
|
+
purge: changedProps.hasOwnProperty('objectThreeObject'),
|
|
72580
72860
|
createObj: function createObj(d) {
|
|
72581
72861
|
var obj = threeObjAccessor(d);
|
|
72582
72862
|
|
|
@@ -72615,7 +72895,7 @@
|
|
|
72615
72895
|
|
|
72616
72896
|
state.scene = threeObj;
|
|
72617
72897
|
},
|
|
72618
|
-
update: function update(state) {
|
|
72898
|
+
update: function update(state, changedProps) {
|
|
72619
72899
|
if (!state.customThreeObjectUpdate) {
|
|
72620
72900
|
emptyObject(state.scene);
|
|
72621
72901
|
} // Clear the existing objects to create all new, if there's no update method (brute-force)
|
|
@@ -72624,6 +72904,8 @@
|
|
|
72624
72904
|
var customObjectAccessor = index$1(state.customThreeObject);
|
|
72625
72905
|
var customObjectUpdateAccessor = index$1(state.customThreeObjectUpdate);
|
|
72626
72906
|
threeDigest(state.customLayerData, state.scene, {
|
|
72907
|
+
// objs need to be recreated if this prop has changed
|
|
72908
|
+
purge: changedProps.hasOwnProperty('customThreeObject'),
|
|
72627
72909
|
createObj: function createObj(d) {
|
|
72628
72910
|
var obj = customObjectAccessor(d, GLOBE_RADIUS$1);
|
|
72629
72911
|
|
|
@@ -73388,9 +73670,6 @@
|
|
|
73388
73670
|
_state = STATE.PAN;
|
|
73389
73671
|
break;
|
|
73390
73672
|
|
|
73391
|
-
default:
|
|
73392
|
-
_state = STATE.NONE;
|
|
73393
|
-
|
|
73394
73673
|
}
|
|
73395
73674
|
|
|
73396
73675
|
}
|
|
@@ -75155,7 +75434,7 @@
|
|
|
75155
75434
|
* Full-screen textured quad shader
|
|
75156
75435
|
*/
|
|
75157
75436
|
|
|
75158
|
-
|
|
75437
|
+
const CopyShader = {
|
|
75159
75438
|
|
|
75160
75439
|
uniforms: {
|
|
75161
75440
|
|