globe.gl 2.32.4 → 2.32.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globe.gl.js +1401 -955
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +5 -5
- package/dist/globe.gl.mjs +61 -69
- package/package.json +8 -8
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.32.
|
|
1
|
+
// Version 2.32.5 globe.gl - https://github.com/vasturiano/globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
})(this, (function () { 'use strict';
|
|
7
7
|
|
|
8
8
|
function styleInject$1(css, ref) {
|
|
9
|
-
ref = {};
|
|
10
|
-
ref.insertAt;
|
|
9
|
+
if ( ref === void 0 ) ref = {};
|
|
10
|
+
var insertAt = ref.insertAt;
|
|
11
11
|
|
|
12
12
|
if (typeof document === 'undefined') { return; }
|
|
13
13
|
|
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
var style = document.createElement('style');
|
|
16
16
|
style.type = 'text/css';
|
|
17
17
|
|
|
18
|
-
{
|
|
18
|
+
if (insertAt === 'top') {
|
|
19
|
+
if (head.firstChild) {
|
|
20
|
+
head.insertBefore(style, head.firstChild);
|
|
21
|
+
} else {
|
|
22
|
+
head.appendChild(style);
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
19
25
|
head.appendChild(style);
|
|
20
26
|
}
|
|
21
27
|
|
|
@@ -29,6 +35,28 @@
|
|
|
29
35
|
var css_248z$1 = ".scene-container .clickable {\n cursor: pointer;\n}";
|
|
30
36
|
styleInject$1(css_248z$1);
|
|
31
37
|
|
|
38
|
+
function _arrayLikeToArray$7(r, a) {
|
|
39
|
+
(null == a || a > r.length) && (a = r.length);
|
|
40
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
41
|
+
return n;
|
|
42
|
+
}
|
|
43
|
+
function _arrayWithoutHoles$5(r) {
|
|
44
|
+
if (Array.isArray(r)) return _arrayLikeToArray$7(r);
|
|
45
|
+
}
|
|
46
|
+
function _defineProperty$3(e, r, t) {
|
|
47
|
+
return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, {
|
|
48
|
+
value: t,
|
|
49
|
+
enumerable: !0,
|
|
50
|
+
configurable: !0,
|
|
51
|
+
writable: !0
|
|
52
|
+
}) : e[r] = t, e;
|
|
53
|
+
}
|
|
54
|
+
function _iterableToArray$5(r) {
|
|
55
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
56
|
+
}
|
|
57
|
+
function _nonIterableSpread$5() {
|
|
58
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
59
|
+
}
|
|
32
60
|
function ownKeys$2(e, r) {
|
|
33
61
|
var t = Object.keys(e);
|
|
34
62
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -50,93 +78,57 @@
|
|
|
50
78
|
}
|
|
51
79
|
return e;
|
|
52
80
|
}
|
|
81
|
+
function _objectWithoutProperties$3(e, t) {
|
|
82
|
+
if (null == e) return {};
|
|
83
|
+
var o,
|
|
84
|
+
r,
|
|
85
|
+
i = _objectWithoutPropertiesLoose$3(e, t);
|
|
86
|
+
if (Object.getOwnPropertySymbols) {
|
|
87
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
88
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
89
|
+
}
|
|
90
|
+
return i;
|
|
91
|
+
}
|
|
92
|
+
function _objectWithoutPropertiesLoose$3(r, e) {
|
|
93
|
+
if (null == r) return {};
|
|
94
|
+
var t = {};
|
|
95
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
96
|
+
if (e.indexOf(n) >= 0) continue;
|
|
97
|
+
t[n] = r[n];
|
|
98
|
+
}
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
function _toConsumableArray$5(r) {
|
|
102
|
+
return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$7(r) || _nonIterableSpread$5();
|
|
103
|
+
}
|
|
53
104
|
function _toPrimitive$4(t, r) {
|
|
54
105
|
if ("object" != typeof t || !t) return t;
|
|
55
106
|
var e = t[Symbol.toPrimitive];
|
|
56
107
|
if (void 0 !== e) {
|
|
57
|
-
var i = e.call(t, r );
|
|
108
|
+
var i = e.call(t, r || "default");
|
|
58
109
|
if ("object" != typeof i) return i;
|
|
59
110
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
60
111
|
}
|
|
61
|
-
return (String )(t);
|
|
112
|
+
return ("string" === r ? String : Number)(t);
|
|
62
113
|
}
|
|
63
114
|
function _toPropertyKey$4(t) {
|
|
64
115
|
var i = _toPrimitive$4(t, "string");
|
|
65
116
|
return "symbol" == typeof i ? i : i + "";
|
|
66
117
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
enumerable: true,
|
|
73
|
-
configurable: true,
|
|
74
|
-
writable: true
|
|
75
|
-
});
|
|
76
|
-
} else {
|
|
77
|
-
obj[key] = value;
|
|
118
|
+
function _unsupportedIterableToArray$7(r, a) {
|
|
119
|
+
if (r) {
|
|
120
|
+
if ("string" == typeof r) return _arrayLikeToArray$7(r, a);
|
|
121
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
122
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$7(r, a) : void 0;
|
|
78
123
|
}
|
|
79
|
-
return obj;
|
|
80
|
-
}
|
|
81
|
-
function _objectWithoutPropertiesLoose$3(source, excluded) {
|
|
82
|
-
if (source == null) return {};
|
|
83
|
-
var target = {};
|
|
84
|
-
var sourceKeys = Object.keys(source);
|
|
85
|
-
var key, i;
|
|
86
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
87
|
-
key = sourceKeys[i];
|
|
88
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
89
|
-
target[key] = source[key];
|
|
90
|
-
}
|
|
91
|
-
return target;
|
|
92
|
-
}
|
|
93
|
-
function _objectWithoutProperties$3(source, excluded) {
|
|
94
|
-
if (source == null) return {};
|
|
95
|
-
var target = _objectWithoutPropertiesLoose$3(source, excluded);
|
|
96
|
-
var key, i;
|
|
97
|
-
if (Object.getOwnPropertySymbols) {
|
|
98
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
99
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
100
|
-
key = sourceSymbolKeys[i];
|
|
101
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
102
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
103
|
-
target[key] = source[key];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return target;
|
|
107
|
-
}
|
|
108
|
-
function _toConsumableArray$5(arr) {
|
|
109
|
-
return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$5();
|
|
110
|
-
}
|
|
111
|
-
function _arrayWithoutHoles$5(arr) {
|
|
112
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
|
|
113
|
-
}
|
|
114
|
-
function _iterableToArray$5(iter) {
|
|
115
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
116
|
-
}
|
|
117
|
-
function _unsupportedIterableToArray$7(o, minLen) {
|
|
118
|
-
if (!o) return;
|
|
119
|
-
if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
|
|
120
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
121
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
122
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
123
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
|
124
|
-
}
|
|
125
|
-
function _arrayLikeToArray$7(arr, len) {
|
|
126
|
-
len = arr.length;
|
|
127
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
128
|
-
return arr2;
|
|
129
|
-
}
|
|
130
|
-
function _nonIterableSpread$5() {
|
|
131
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
132
124
|
}
|
|
133
125
|
|
|
134
126
|
/**
|
|
135
127
|
* @license
|
|
136
|
-
* Copyright 2010-
|
|
128
|
+
* Copyright 2010-2024 Three.js Authors
|
|
137
129
|
* SPDX-License-Identifier: MIT
|
|
138
130
|
*/
|
|
139
|
-
const REVISION = '
|
|
131
|
+
const REVISION = '165';
|
|
140
132
|
|
|
141
133
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
142
134
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -1630,6 +1622,35 @@
|
|
|
1630
1622
|
|
|
1631
1623
|
}
|
|
1632
1624
|
|
|
1625
|
+
function probeAsync( gl, sync, interval ) {
|
|
1626
|
+
|
|
1627
|
+
return new Promise( function ( resolve, reject ) {
|
|
1628
|
+
|
|
1629
|
+
function probe() {
|
|
1630
|
+
|
|
1631
|
+
switch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {
|
|
1632
|
+
|
|
1633
|
+
case gl.WAIT_FAILED:
|
|
1634
|
+
reject();
|
|
1635
|
+
break;
|
|
1636
|
+
|
|
1637
|
+
case gl.TIMEOUT_EXPIRED:
|
|
1638
|
+
setTimeout( probe, interval );
|
|
1639
|
+
break;
|
|
1640
|
+
|
|
1641
|
+
default:
|
|
1642
|
+
resolve();
|
|
1643
|
+
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
setTimeout( probe, interval );
|
|
1649
|
+
|
|
1650
|
+
} );
|
|
1651
|
+
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1633
1654
|
/**
|
|
1634
1655
|
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
|
|
1635
1656
|
* or clipping. Based on W3C specifications for sRGB and Display P3,
|
|
@@ -2991,6 +3012,8 @@
|
|
|
2991
3012
|
minFilter: LinearFilter,
|
|
2992
3013
|
depthBuffer: true,
|
|
2993
3014
|
stencilBuffer: false,
|
|
3015
|
+
resolveDepthBuffer: true,
|
|
3016
|
+
resolveStencilBuffer: true,
|
|
2994
3017
|
depthTexture: null,
|
|
2995
3018
|
samples: 0,
|
|
2996
3019
|
count: 1
|
|
@@ -3015,6 +3038,9 @@
|
|
|
3015
3038
|
this.depthBuffer = options.depthBuffer;
|
|
3016
3039
|
this.stencilBuffer = options.stencilBuffer;
|
|
3017
3040
|
|
|
3041
|
+
this.resolveDepthBuffer = options.resolveDepthBuffer;
|
|
3042
|
+
this.resolveStencilBuffer = options.resolveStencilBuffer;
|
|
3043
|
+
|
|
3018
3044
|
this.depthTexture = options.depthTexture;
|
|
3019
3045
|
|
|
3020
3046
|
this.samples = options.samples;
|
|
@@ -3092,6 +3118,9 @@
|
|
|
3092
3118
|
this.depthBuffer = source.depthBuffer;
|
|
3093
3119
|
this.stencilBuffer = source.stencilBuffer;
|
|
3094
3120
|
|
|
3121
|
+
this.resolveDepthBuffer = source.resolveDepthBuffer;
|
|
3122
|
+
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
3123
|
+
|
|
3095
3124
|
if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
|
|
3096
3125
|
|
|
3097
3126
|
this.samples = source.samples;
|
|
@@ -3139,6 +3168,20 @@
|
|
|
3139
3168
|
this.flipY = false;
|
|
3140
3169
|
this.unpackAlignment = 1;
|
|
3141
3170
|
|
|
3171
|
+
this.layerUpdates = new Set();
|
|
3172
|
+
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
addLayerUpdate( layerIndex ) {
|
|
3176
|
+
|
|
3177
|
+
this.layerUpdates.add( layerIndex );
|
|
3178
|
+
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
clearLayerUpdates() {
|
|
3182
|
+
|
|
3183
|
+
this.layerUpdates.clear();
|
|
3184
|
+
|
|
3142
3185
|
}
|
|
3143
3186
|
|
|
3144
3187
|
}
|
|
@@ -7872,6 +7915,8 @@
|
|
|
7872
7915
|
|
|
7873
7916
|
object.matricesTexture = this._matricesTexture.toJSON( meta );
|
|
7874
7917
|
|
|
7918
|
+
if ( this._colorsTexture !== null ) object.colorsTexture = this._colorsTexture.toJSON( meta );
|
|
7919
|
+
|
|
7875
7920
|
if ( this.boundingSphere !== null ) {
|
|
7876
7921
|
|
|
7877
7922
|
object.boundingSphere = {
|
|
@@ -9271,6 +9316,8 @@
|
|
|
9271
9316
|
|
|
9272
9317
|
}
|
|
9273
9318
|
|
|
9319
|
+
if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
|
|
9320
|
+
|
|
9274
9321
|
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
9275
9322
|
if ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;
|
|
9276
9323
|
if ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;
|
|
@@ -11446,7 +11493,7 @@
|
|
|
11446
11493
|
|
|
11447
11494
|
}
|
|
11448
11495
|
|
|
11449
|
-
function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
11496
|
+
function checkIntersection$1( object, material, raycaster, ray, pA, pB, pC, point ) {
|
|
11450
11497
|
|
|
11451
11498
|
let intersect;
|
|
11452
11499
|
|
|
@@ -11483,7 +11530,7 @@
|
|
|
11483
11530
|
object.getVertexPosition( b, _vB$1 );
|
|
11484
11531
|
object.getVertexPosition( c, _vC$1 );
|
|
11485
11532
|
|
|
11486
|
-
const intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
|
|
11533
|
+
const intersection = checkIntersection$1( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
|
|
11487
11534
|
|
|
11488
11535
|
if ( intersection ) {
|
|
11489
11536
|
|
|
@@ -13409,7 +13456,7 @@
|
|
|
13409
13456
|
|
|
13410
13457
|
var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
|
|
13411
13458
|
|
|
13412
|
-
var batching_pars_vertex = "#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";
|
|
13459
|
+
var batching_pars_vertex = "#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";
|
|
13413
13460
|
|
|
13414
13461
|
var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif";
|
|
13415
13462
|
|
|
@@ -13435,9 +13482,9 @@
|
|
|
13435
13482
|
|
|
13436
13483
|
var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif";
|
|
13437
13484
|
|
|
13438
|
-
var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif";
|
|
13485
|
+
var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif";
|
|
13439
13486
|
|
|
13440
|
-
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
|
|
13487
|
+
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( batchId );\n\tvColor.xyz *= batchingColor.xyz;\n#endif";
|
|
13441
13488
|
|
|
13442
13489
|
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; }\nvec3 pow2( const in vec3 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 v ) { return dot( v, vec3( 0.3333333 ) ); }\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};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\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 luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, 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}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
|
|
13443
13490
|
|
|
@@ -13477,15 +13524,13 @@
|
|
|
13477
13524
|
|
|
13478
13525
|
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
|
|
13479
13526
|
|
|
13480
|
-
var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
|
|
13481
|
-
|
|
13482
13527
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
|
|
13483
13528
|
|
|
13484
13529
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
13485
13530
|
|
|
13486
13531
|
var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";
|
|
13487
13532
|
|
|
13488
|
-
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\
|
|
13533
|
+
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
|
|
13489
13534
|
|
|
13490
13535
|
var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
|
|
13491
13536
|
|
|
@@ -13497,9 +13542,9 @@
|
|
|
13497
13542
|
|
|
13498
13543
|
var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
|
|
13499
13544
|
|
|
13500
|
-
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
13545
|
+
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
13501
13546
|
|
|
13502
|
-
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
13547
|
+
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
13503
13548
|
|
|
13504
13549
|
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
13505
13550
|
|
|
@@ -13527,15 +13572,15 @@
|
|
|
13527
13572
|
|
|
13528
13573
|
var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
|
|
13529
13574
|
|
|
13530
|
-
var morphinstance_vertex = "#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif";
|
|
13575
|
+
var morphinstance_vertex = "#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif";
|
|
13531
13576
|
|
|
13532
|
-
var morphcolor_vertex = "#if defined( USE_MORPHCOLORS )
|
|
13577
|
+
var morphcolor_vertex = "#if defined( USE_MORPHCOLORS )\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";
|
|
13533
13578
|
|
|
13534
|
-
var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\
|
|
13579
|
+
var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";
|
|
13535
13580
|
|
|
13536
|
-
var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t
|
|
13581
|
+
var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif";
|
|
13537
13582
|
|
|
13538
|
-
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\
|
|
13583
|
+
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";
|
|
13539
13584
|
|
|
13540
13585
|
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
|
|
13541
13586
|
|
|
@@ -13595,11 +13640,11 @@
|
|
|
13595
13640
|
|
|
13596
13641
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
13597
13642
|
|
|
13598
|
-
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\
|
|
13643
|
+
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
13599
13644
|
|
|
13600
|
-
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
13645
|
+
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
13601
13646
|
|
|
13602
|
-
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\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\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 lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\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,
|
|
13647
|
+
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\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\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 lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\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 dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
|
|
13603
13648
|
|
|
13604
13649
|
var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
|
|
13605
13650
|
|
|
@@ -13659,7 +13704,7 @@
|
|
|
13659
13704
|
|
|
13660
13705
|
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_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}";
|
|
13661
13706
|
|
|
13662
|
-
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_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 USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\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 <iridescence_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <alphahash_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 + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13707
|
+
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_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 USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\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 <iridescence_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <alphahash_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 + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
13663
13708
|
|
|
13664
13709
|
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_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}";
|
|
13665
13710
|
|
|
@@ -13721,7 +13766,6 @@
|
|
|
13721
13766
|
fog_fragment: fog_fragment,
|
|
13722
13767
|
fog_pars_fragment: fog_pars_fragment,
|
|
13723
13768
|
gradientmap_pars_fragment: gradientmap_pars_fragment,
|
|
13724
|
-
lightmap_fragment: lightmap_fragment,
|
|
13725
13769
|
lightmap_pars_fragment: lightmap_pars_fragment,
|
|
13726
13770
|
lights_lambert_fragment: lights_lambert_fragment,
|
|
13727
13771
|
lights_lambert_pars_fragment: lights_lambert_pars_fragment,
|
|
@@ -14357,6 +14401,7 @@
|
|
|
14357
14401
|
clearcoatRoughness: { value: 0 },
|
|
14358
14402
|
clearcoatRoughnessMap: { value: null },
|
|
14359
14403
|
clearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },
|
|
14404
|
+
dispersion: { value: 0 },
|
|
14360
14405
|
iridescence: { value: 0 },
|
|
14361
14406
|
iridescenceMap: { value: null },
|
|
14362
14407
|
iridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },
|
|
@@ -14415,9 +14460,8 @@
|
|
|
14415
14460
|
let currentBackgroundVersion = 0;
|
|
14416
14461
|
let currentTonemapping = null;
|
|
14417
14462
|
|
|
14418
|
-
function
|
|
14463
|
+
function getBackground( scene ) {
|
|
14419
14464
|
|
|
14420
|
-
let forceClear = false;
|
|
14421
14465
|
let background = scene.isScene === true ? scene.background : null;
|
|
14422
14466
|
|
|
14423
14467
|
if ( background && background.isTexture ) {
|
|
@@ -14427,6 +14471,15 @@
|
|
|
14427
14471
|
|
|
14428
14472
|
}
|
|
14429
14473
|
|
|
14474
|
+
return background;
|
|
14475
|
+
|
|
14476
|
+
}
|
|
14477
|
+
|
|
14478
|
+
function render( scene ) {
|
|
14479
|
+
|
|
14480
|
+
let forceClear = false;
|
|
14481
|
+
const background = getBackground( scene );
|
|
14482
|
+
|
|
14430
14483
|
if ( background === null ) {
|
|
14431
14484
|
|
|
14432
14485
|
setClear( clearColor, clearAlpha );
|
|
@@ -14452,10 +14505,22 @@
|
|
|
14452
14505
|
|
|
14453
14506
|
if ( renderer.autoClear || forceClear ) {
|
|
14454
14507
|
|
|
14508
|
+
// buffers might not be writable which is required to ensure a correct clear
|
|
14509
|
+
|
|
14510
|
+
state.buffers.depth.setTest( true );
|
|
14511
|
+
state.buffers.depth.setMask( true );
|
|
14512
|
+
state.buffers.color.setMask( true );
|
|
14513
|
+
|
|
14455
14514
|
renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
|
14456
14515
|
|
|
14457
14516
|
}
|
|
14458
14517
|
|
|
14518
|
+
}
|
|
14519
|
+
|
|
14520
|
+
function addToRenderList( renderList, scene ) {
|
|
14521
|
+
|
|
14522
|
+
const background = getBackground( scene );
|
|
14523
|
+
|
|
14459
14524
|
if ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {
|
|
14460
14525
|
|
|
14461
14526
|
if ( boxMesh === undefined ) {
|
|
@@ -14636,7 +14701,8 @@
|
|
|
14636
14701
|
setClear( clearColor, clearAlpha );
|
|
14637
14702
|
|
|
14638
14703
|
},
|
|
14639
|
-
render: render
|
|
14704
|
+
render: render,
|
|
14705
|
+
addToRenderList: addToRenderList
|
|
14640
14706
|
|
|
14641
14707
|
};
|
|
14642
14708
|
|
|
@@ -15291,16 +15357,52 @@
|
|
|
15291
15357
|
|
|
15292
15358
|
}
|
|
15293
15359
|
|
|
15360
|
+
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
15361
|
+
|
|
15362
|
+
if ( drawCount === 0 ) return;
|
|
15363
|
+
|
|
15364
|
+
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15365
|
+
|
|
15366
|
+
if ( extension === null ) {
|
|
15367
|
+
|
|
15368
|
+
for ( let i = 0; i < starts.length; i ++ ) {
|
|
15369
|
+
|
|
15370
|
+
renderInstances( starts[ i ], counts[ i ], primcount[ i ] );
|
|
15371
|
+
|
|
15372
|
+
}
|
|
15373
|
+
|
|
15374
|
+
} else {
|
|
15375
|
+
|
|
15376
|
+
extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );
|
|
15377
|
+
|
|
15378
|
+
let elementCount = 0;
|
|
15379
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15380
|
+
|
|
15381
|
+
elementCount += counts[ i ];
|
|
15382
|
+
|
|
15383
|
+
}
|
|
15384
|
+
|
|
15385
|
+
for ( let i = 0; i < primcount.length; i ++ ) {
|
|
15386
|
+
|
|
15387
|
+
info.update( elementCount, mode, primcount[ i ] );
|
|
15388
|
+
|
|
15389
|
+
}
|
|
15390
|
+
|
|
15391
|
+
}
|
|
15392
|
+
|
|
15393
|
+
}
|
|
15394
|
+
|
|
15294
15395
|
//
|
|
15295
15396
|
|
|
15296
15397
|
this.setMode = setMode;
|
|
15297
15398
|
this.render = render;
|
|
15298
15399
|
this.renderInstances = renderInstances;
|
|
15299
15400
|
this.renderMultiDraw = renderMultiDraw;
|
|
15401
|
+
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
15300
15402
|
|
|
15301
15403
|
}
|
|
15302
15404
|
|
|
15303
|
-
function WebGLCapabilities( gl, extensions, parameters ) {
|
|
15405
|
+
function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
15304
15406
|
|
|
15305
15407
|
let maxAnisotropy;
|
|
15306
15408
|
|
|
@@ -15324,6 +15426,33 @@
|
|
|
15324
15426
|
|
|
15325
15427
|
}
|
|
15326
15428
|
|
|
15429
|
+
function textureFormatReadable( textureFormat ) {
|
|
15430
|
+
|
|
15431
|
+
if ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {
|
|
15432
|
+
|
|
15433
|
+
return false;
|
|
15434
|
+
|
|
15435
|
+
}
|
|
15436
|
+
|
|
15437
|
+
return true;
|
|
15438
|
+
|
|
15439
|
+
}
|
|
15440
|
+
|
|
15441
|
+
function textureTypeReadable( textureType ) {
|
|
15442
|
+
|
|
15443
|
+
const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );
|
|
15444
|
+
|
|
15445
|
+
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
15446
|
+
textureType !== FloatType && ! halfFloatSupportedByExt ) {
|
|
15447
|
+
|
|
15448
|
+
return false;
|
|
15449
|
+
|
|
15450
|
+
}
|
|
15451
|
+
|
|
15452
|
+
return true;
|
|
15453
|
+
|
|
15454
|
+
}
|
|
15455
|
+
|
|
15327
15456
|
function getMaxPrecision( precision ) {
|
|
15328
15457
|
|
|
15329
15458
|
if ( precision === 'highp' ) {
|
|
@@ -15387,6 +15516,9 @@
|
|
|
15387
15516
|
getMaxAnisotropy: getMaxAnisotropy,
|
|
15388
15517
|
getMaxPrecision: getMaxPrecision,
|
|
15389
15518
|
|
|
15519
|
+
textureFormatReadable: textureFormatReadable,
|
|
15520
|
+
textureTypeReadable: textureTypeReadable,
|
|
15521
|
+
|
|
15390
15522
|
precision: precision,
|
|
15391
15523
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
15392
15524
|
|
|
@@ -15828,16 +15960,16 @@
|
|
|
15828
15960
|
// Vertices of a dodecahedron (except the opposites, which represent the
|
|
15829
15961
|
// same axis), used as axis directions evenly spread on a sphere.
|
|
15830
15962
|
const _axisDirections = [
|
|
15831
|
-
/*@__PURE__*/ new Vector3(
|
|
15832
|
-
/*@__PURE__*/ new Vector3( - 1, 1, 1 ),
|
|
15833
|
-
/*@__PURE__*/ new Vector3( 1, 1, - 1 ),
|
|
15834
|
-
/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
|
|
15835
|
-
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
15836
|
-
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
15837
|
-
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
15838
|
-
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
15963
|
+
/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),
|
|
15839
15964
|
/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),
|
|
15840
|
-
/*@__PURE__*/ new Vector3( -
|
|
15965
|
+
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
15966
|
+
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
15967
|
+
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
15968
|
+
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
15969
|
+
/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
|
|
15970
|
+
/*@__PURE__*/ new Vector3( 1, 1, - 1 ),
|
|
15971
|
+
/*@__PURE__*/ new Vector3( - 1, 1, 1 ),
|
|
15972
|
+
/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
|
|
15841
15973
|
|
|
15842
15974
|
/**
|
|
15843
15975
|
* This class generates a Prefiltered, Mipmapped Radiance Environment Map
|
|
@@ -16223,12 +16355,13 @@
|
|
|
16223
16355
|
const renderer = this._renderer;
|
|
16224
16356
|
const autoClear = renderer.autoClear;
|
|
16225
16357
|
renderer.autoClear = false;
|
|
16358
|
+
const n = this._lodPlanes.length;
|
|
16226
16359
|
|
|
16227
|
-
for ( let i = 1; i <
|
|
16360
|
+
for ( let i = 1; i < n; i ++ ) {
|
|
16228
16361
|
|
|
16229
16362
|
const sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );
|
|
16230
16363
|
|
|
16231
|
-
const poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];
|
|
16364
|
+
const poleAxis = _axisDirections[ ( n - i - 1 ) % _axisDirections.length ];
|
|
16232
16365
|
|
|
16233
16366
|
this._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );
|
|
16234
16367
|
|
|
@@ -16891,7 +17024,7 @@
|
|
|
16891
17024
|
|
|
16892
17025
|
if ( extension === null ) {
|
|
16893
17026
|
|
|
16894
|
-
|
|
17027
|
+
warnOnce( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );
|
|
16895
17028
|
|
|
16896
17029
|
}
|
|
16897
17030
|
|
|
@@ -17177,6 +17310,41 @@
|
|
|
17177
17310
|
|
|
17178
17311
|
}
|
|
17179
17312
|
|
|
17313
|
+
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
17314
|
+
|
|
17315
|
+
if ( drawCount === 0 ) return;
|
|
17316
|
+
|
|
17317
|
+
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17318
|
+
|
|
17319
|
+
if ( extension === null ) {
|
|
17320
|
+
|
|
17321
|
+
for ( let i = 0; i < starts.length; i ++ ) {
|
|
17322
|
+
|
|
17323
|
+
renderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );
|
|
17324
|
+
|
|
17325
|
+
}
|
|
17326
|
+
|
|
17327
|
+
} else {
|
|
17328
|
+
|
|
17329
|
+
extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );
|
|
17330
|
+
|
|
17331
|
+
let elementCount = 0;
|
|
17332
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17333
|
+
|
|
17334
|
+
elementCount += counts[ i ];
|
|
17335
|
+
|
|
17336
|
+
}
|
|
17337
|
+
|
|
17338
|
+
for ( let i = 0; i < primcount.length; i ++ ) {
|
|
17339
|
+
|
|
17340
|
+
info.update( elementCount, mode, primcount[ i ] );
|
|
17341
|
+
|
|
17342
|
+
}
|
|
17343
|
+
|
|
17344
|
+
}
|
|
17345
|
+
|
|
17346
|
+
}
|
|
17347
|
+
|
|
17180
17348
|
//
|
|
17181
17349
|
|
|
17182
17350
|
this.setMode = setMode;
|
|
@@ -17184,6 +17352,7 @@
|
|
|
17184
17352
|
this.render = render;
|
|
17185
17353
|
this.renderInstances = renderInstances;
|
|
17186
17354
|
this.renderMultiDraw = renderMultiDraw;
|
|
17355
|
+
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
17187
17356
|
|
|
17188
17357
|
}
|
|
17189
17358
|
|
|
@@ -17265,8 +17434,7 @@
|
|
|
17265
17434
|
|
|
17266
17435
|
const objectInfluences = object.morphTargetInfluences;
|
|
17267
17436
|
|
|
17268
|
-
//
|
|
17269
|
-
// into an array of data textures. Each layer represents a single morph target.
|
|
17437
|
+
// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.
|
|
17270
17438
|
|
|
17271
17439
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
17272
17440
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
@@ -17510,9 +17678,7 @@
|
|
|
17510
17678
|
|
|
17511
17679
|
class DepthTexture extends Texture {
|
|
17512
17680
|
|
|
17513
|
-
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
17514
|
-
|
|
17515
|
-
format = format !== undefined ? format : DepthFormat;
|
|
17681
|
+
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format = DepthFormat ) {
|
|
17516
17682
|
|
|
17517
17683
|
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
17518
17684
|
|
|
@@ -18962,11 +19128,7 @@
|
|
|
18962
19128
|
|
|
18963
19129
|
}
|
|
18964
19130
|
|
|
18965
|
-
const shaderChunkMap = new Map(
|
|
18966
|
-
[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154
|
|
18967
|
-
[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154
|
|
18968
|
-
[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154
|
|
18969
|
-
] );
|
|
19131
|
+
const shaderChunkMap = new Map();
|
|
18970
19132
|
|
|
18971
19133
|
function includeReplacer( match, include ) {
|
|
18972
19134
|
|
|
@@ -19244,6 +19406,7 @@
|
|
|
19244
19406
|
|
|
19245
19407
|
parameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',
|
|
19246
19408
|
parameters.batching ? '#define USE_BATCHING' : '',
|
|
19409
|
+
parameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',
|
|
19247
19410
|
parameters.instancing ? '#define USE_INSTANCING' : '',
|
|
19248
19411
|
parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
|
|
19249
19412
|
parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
|
|
@@ -19340,7 +19503,6 @@
|
|
|
19340
19503
|
parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
|
|
19341
19504
|
parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
|
|
19342
19505
|
( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',
|
|
19343
|
-
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE' : '',
|
|
19344
19506
|
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
|
|
19345
19507
|
( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
|
|
19346
19508
|
parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
|
|
@@ -19353,8 +19515,6 @@
|
|
|
19353
19515
|
|
|
19354
19516
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
19355
19517
|
|
|
19356
|
-
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
19357
|
-
|
|
19358
19518
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
19359
19519
|
|
|
19360
19520
|
'uniform mat4 modelMatrix;',
|
|
@@ -19421,31 +19581,6 @@
|
|
|
19421
19581
|
|
|
19422
19582
|
'#endif',
|
|
19423
19583
|
|
|
19424
|
-
'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',
|
|
19425
|
-
|
|
19426
|
-
' attribute vec3 morphTarget0;',
|
|
19427
|
-
' attribute vec3 morphTarget1;',
|
|
19428
|
-
' attribute vec3 morphTarget2;',
|
|
19429
|
-
' attribute vec3 morphTarget3;',
|
|
19430
|
-
|
|
19431
|
-
' #ifdef USE_MORPHNORMALS',
|
|
19432
|
-
|
|
19433
|
-
' attribute vec3 morphNormal0;',
|
|
19434
|
-
' attribute vec3 morphNormal1;',
|
|
19435
|
-
' attribute vec3 morphNormal2;',
|
|
19436
|
-
' attribute vec3 morphNormal3;',
|
|
19437
|
-
|
|
19438
|
-
' #else',
|
|
19439
|
-
|
|
19440
|
-
' attribute vec3 morphTarget4;',
|
|
19441
|
-
' attribute vec3 morphTarget5;',
|
|
19442
|
-
' attribute vec3 morphTarget6;',
|
|
19443
|
-
' attribute vec3 morphTarget7;',
|
|
19444
|
-
|
|
19445
|
-
' #endif',
|
|
19446
|
-
|
|
19447
|
-
'#endif',
|
|
19448
|
-
|
|
19449
19584
|
'#ifdef USE_SKINNING',
|
|
19450
19585
|
|
|
19451
19586
|
' attribute vec4 skinIndex;',
|
|
@@ -19495,6 +19630,8 @@
|
|
|
19495
19630
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
19496
19631
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
19497
19632
|
|
|
19633
|
+
parameters.dispersion ? '#define USE_DISPERSION' : '',
|
|
19634
|
+
|
|
19498
19635
|
parameters.iridescence ? '#define USE_IRIDESCENCE' : '',
|
|
19499
19636
|
parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',
|
|
19500
19637
|
parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',
|
|
@@ -19519,7 +19656,7 @@
|
|
|
19519
19656
|
parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',
|
|
19520
19657
|
|
|
19521
19658
|
parameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',
|
|
19522
|
-
parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',
|
|
19659
|
+
parameters.vertexColors || parameters.instancingColor || parameters.batchingColor ? '#define USE_COLOR' : '',
|
|
19523
19660
|
parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',
|
|
19524
19661
|
parameters.vertexUv1s ? '#define USE_UV1' : '',
|
|
19525
19662
|
parameters.vertexUv2s ? '#define USE_UV2' : '',
|
|
@@ -19541,8 +19678,6 @@
|
|
|
19541
19678
|
|
|
19542
19679
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
19543
19680
|
|
|
19544
|
-
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
19545
|
-
|
|
19546
19681
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
19547
19682
|
|
|
19548
19683
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
@@ -20050,6 +20185,7 @@
|
|
|
20050
20185
|
|
|
20051
20186
|
const HAS_ANISOTROPY = material.anisotropy > 0;
|
|
20052
20187
|
const HAS_CLEARCOAT = material.clearcoat > 0;
|
|
20188
|
+
const HAS_DISPERSION = material.dispersion > 0;
|
|
20053
20189
|
const HAS_IRIDESCENCE = material.iridescence > 0;
|
|
20054
20190
|
const HAS_SHEEN = material.sheen > 0;
|
|
20055
20191
|
const HAS_TRANSMISSION = material.transmission > 0;
|
|
@@ -20114,6 +20250,7 @@
|
|
|
20114
20250
|
precision: precision,
|
|
20115
20251
|
|
|
20116
20252
|
batching: IS_BATCHEDMESH,
|
|
20253
|
+
batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,
|
|
20117
20254
|
instancing: IS_INSTANCEDMESH,
|
|
20118
20255
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
20119
20256
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
@@ -20148,6 +20285,8 @@
|
|
|
20148
20285
|
clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,
|
|
20149
20286
|
clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,
|
|
20150
20287
|
|
|
20288
|
+
dispersion: HAS_DISPERSION,
|
|
20289
|
+
|
|
20151
20290
|
iridescence: HAS_IRIDESCENCE,
|
|
20152
20291
|
iridescenceMap: HAS_IRIDESCENCEMAP,
|
|
20153
20292
|
iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,
|
|
@@ -20256,7 +20395,6 @@
|
|
|
20256
20395
|
shadowMapType: renderer.shadowMap.type,
|
|
20257
20396
|
|
|
20258
20397
|
toneMapping: toneMapping,
|
|
20259
|
-
useLegacyLights: renderer._useLegacyLights,
|
|
20260
20398
|
|
|
20261
20399
|
decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
|
|
20262
20400
|
|
|
@@ -20428,6 +20566,10 @@
|
|
|
20428
20566
|
_programLayers.enable( 18 );
|
|
20429
20567
|
if ( parameters.batching )
|
|
20430
20568
|
_programLayers.enable( 19 );
|
|
20569
|
+
if ( parameters.dispersion )
|
|
20570
|
+
_programLayers.enable( 20 );
|
|
20571
|
+
if ( parameters.batchingColor )
|
|
20572
|
+
_programLayers.enable( 21 );
|
|
20431
20573
|
|
|
20432
20574
|
array.push( _programLayers.mask );
|
|
20433
20575
|
_programLayers.disableAll();
|
|
@@ -20452,28 +20594,26 @@
|
|
|
20452
20594
|
_programLayers.enable( 8 );
|
|
20453
20595
|
if ( parameters.shadowMapEnabled )
|
|
20454
20596
|
_programLayers.enable( 9 );
|
|
20455
|
-
if ( parameters.useLegacyLights )
|
|
20456
|
-
_programLayers.enable( 10 );
|
|
20457
20597
|
if ( parameters.doubleSided )
|
|
20458
|
-
_programLayers.enable(
|
|
20598
|
+
_programLayers.enable( 10 );
|
|
20459
20599
|
if ( parameters.flipSided )
|
|
20460
|
-
_programLayers.enable(
|
|
20600
|
+
_programLayers.enable( 11 );
|
|
20461
20601
|
if ( parameters.useDepthPacking )
|
|
20462
|
-
_programLayers.enable(
|
|
20602
|
+
_programLayers.enable( 12 );
|
|
20463
20603
|
if ( parameters.dithering )
|
|
20464
|
-
_programLayers.enable(
|
|
20604
|
+
_programLayers.enable( 13 );
|
|
20465
20605
|
if ( parameters.transmission )
|
|
20466
|
-
_programLayers.enable(
|
|
20606
|
+
_programLayers.enable( 14 );
|
|
20467
20607
|
if ( parameters.sheen )
|
|
20468
|
-
_programLayers.enable(
|
|
20608
|
+
_programLayers.enable( 15 );
|
|
20469
20609
|
if ( parameters.opaque )
|
|
20470
|
-
_programLayers.enable(
|
|
20610
|
+
_programLayers.enable( 16 );
|
|
20471
20611
|
if ( parameters.pointsUvs )
|
|
20472
|
-
_programLayers.enable(
|
|
20612
|
+
_programLayers.enable( 17 );
|
|
20473
20613
|
if ( parameters.decodeVideoTexture )
|
|
20474
|
-
_programLayers.enable(
|
|
20614
|
+
_programLayers.enable( 18 );
|
|
20475
20615
|
if ( parameters.alphaToCoverage )
|
|
20476
|
-
_programLayers.enable(
|
|
20616
|
+
_programLayers.enable( 19 );
|
|
20477
20617
|
|
|
20478
20618
|
array.push( _programLayers.mask );
|
|
20479
20619
|
|
|
@@ -21055,7 +21195,7 @@
|
|
|
21055
21195
|
const matrix4 = new Matrix4();
|
|
21056
21196
|
const matrix42 = new Matrix4();
|
|
21057
21197
|
|
|
21058
|
-
function setup( lights
|
|
21198
|
+
function setup( lights ) {
|
|
21059
21199
|
|
|
21060
21200
|
let r = 0, g = 0, b = 0;
|
|
21061
21201
|
|
|
@@ -21078,9 +21218,6 @@
|
|
|
21078
21218
|
// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
|
|
21079
21219
|
lights.sort( shadowCastingAndTexturingLightsFirst );
|
|
21080
21220
|
|
|
21081
|
-
// artist-friendly light intensity scaling factor
|
|
21082
|
-
const scaleFactor = ( useLegacyLights === true ) ? Math.PI : 1;
|
|
21083
|
-
|
|
21084
21221
|
for ( let i = 0, l = lights.length; i < l; i ++ ) {
|
|
21085
21222
|
|
|
21086
21223
|
const light = lights[ i ];
|
|
@@ -21093,9 +21230,9 @@
|
|
|
21093
21230
|
|
|
21094
21231
|
if ( light.isAmbientLight ) {
|
|
21095
21232
|
|
|
21096
|
-
r += color.r * intensity
|
|
21097
|
-
g += color.g * intensity
|
|
21098
|
-
b += color.b * intensity
|
|
21233
|
+
r += color.r * intensity;
|
|
21234
|
+
g += color.g * intensity;
|
|
21235
|
+
b += color.b * intensity;
|
|
21099
21236
|
|
|
21100
21237
|
} else if ( light.isLightProbe ) {
|
|
21101
21238
|
|
|
@@ -21111,7 +21248,7 @@
|
|
|
21111
21248
|
|
|
21112
21249
|
const uniforms = cache.get( light );
|
|
21113
21250
|
|
|
21114
|
-
uniforms.color.copy( light.color ).multiplyScalar( light.intensity
|
|
21251
|
+
uniforms.color.copy( light.color ).multiplyScalar( light.intensity );
|
|
21115
21252
|
|
|
21116
21253
|
if ( light.castShadow ) {
|
|
21117
21254
|
|
|
@@ -21142,7 +21279,7 @@
|
|
|
21142
21279
|
|
|
21143
21280
|
uniforms.position.setFromMatrixPosition( light.matrixWorld );
|
|
21144
21281
|
|
|
21145
|
-
uniforms.color.copy( color ).multiplyScalar( intensity
|
|
21282
|
+
uniforms.color.copy( color ).multiplyScalar( intensity );
|
|
21146
21283
|
uniforms.distance = distance;
|
|
21147
21284
|
|
|
21148
21285
|
uniforms.coneCos = Math.cos( light.angle );
|
|
@@ -21203,7 +21340,7 @@
|
|
|
21203
21340
|
|
|
21204
21341
|
const uniforms = cache.get( light );
|
|
21205
21342
|
|
|
21206
|
-
uniforms.color.copy( light.color ).multiplyScalar( light.intensity
|
|
21343
|
+
uniforms.color.copy( light.color ).multiplyScalar( light.intensity );
|
|
21207
21344
|
uniforms.distance = light.distance;
|
|
21208
21345
|
uniforms.decay = light.decay;
|
|
21209
21346
|
|
|
@@ -21236,8 +21373,8 @@
|
|
|
21236
21373
|
|
|
21237
21374
|
const uniforms = cache.get( light );
|
|
21238
21375
|
|
|
21239
|
-
uniforms.skyColor.copy( light.color ).multiplyScalar( intensity
|
|
21240
|
-
uniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity
|
|
21376
|
+
uniforms.skyColor.copy( light.color ).multiplyScalar( intensity );
|
|
21377
|
+
uniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );
|
|
21241
21378
|
|
|
21242
21379
|
state.hemi[ hemiLength ] = uniforms;
|
|
21243
21380
|
|
|
@@ -21417,7 +21554,9 @@
|
|
|
21417
21554
|
const lightsArray = [];
|
|
21418
21555
|
const shadowsArray = [];
|
|
21419
21556
|
|
|
21420
|
-
function init() {
|
|
21557
|
+
function init( camera ) {
|
|
21558
|
+
|
|
21559
|
+
state.camera = camera;
|
|
21421
21560
|
|
|
21422
21561
|
lightsArray.length = 0;
|
|
21423
21562
|
shadowsArray.length = 0;
|
|
@@ -21436,9 +21575,9 @@
|
|
|
21436
21575
|
|
|
21437
21576
|
}
|
|
21438
21577
|
|
|
21439
|
-
function setupLights(
|
|
21578
|
+
function setupLights() {
|
|
21440
21579
|
|
|
21441
|
-
lights.setup( lightsArray
|
|
21580
|
+
lights.setup( lightsArray );
|
|
21442
21581
|
|
|
21443
21582
|
}
|
|
21444
21583
|
|
|
@@ -21452,9 +21591,11 @@
|
|
|
21452
21591
|
lightsArray: lightsArray,
|
|
21453
21592
|
shadowsArray: shadowsArray,
|
|
21454
21593
|
|
|
21594
|
+
camera: null,
|
|
21595
|
+
|
|
21455
21596
|
lights: lights,
|
|
21456
21597
|
|
|
21457
|
-
transmissionRenderTarget:
|
|
21598
|
+
transmissionRenderTarget: {}
|
|
21458
21599
|
};
|
|
21459
21600
|
|
|
21460
21601
|
return {
|
|
@@ -21609,7 +21750,7 @@
|
|
|
21609
21750
|
|
|
21610
21751
|
const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
|
|
21611
21752
|
|
|
21612
|
-
function WebGLShadowMap(
|
|
21753
|
+
function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
21613
21754
|
|
|
21614
21755
|
let _frustum = new Frustum();
|
|
21615
21756
|
|
|
@@ -21623,7 +21764,7 @@
|
|
|
21623
21764
|
|
|
21624
21765
|
_materialCache = {},
|
|
21625
21766
|
|
|
21626
|
-
_maxTextureSize =
|
|
21767
|
+
_maxTextureSize = capabilities.maxTextureSize;
|
|
21627
21768
|
|
|
21628
21769
|
const shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };
|
|
21629
21770
|
|
|
@@ -21673,11 +21814,11 @@
|
|
|
21673
21814
|
|
|
21674
21815
|
if ( lights.length === 0 ) return;
|
|
21675
21816
|
|
|
21676
|
-
const currentRenderTarget =
|
|
21677
|
-
const activeCubeFace =
|
|
21678
|
-
const activeMipmapLevel =
|
|
21817
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
21818
|
+
const activeCubeFace = renderer.getActiveCubeFace();
|
|
21819
|
+
const activeMipmapLevel = renderer.getActiveMipmapLevel();
|
|
21679
21820
|
|
|
21680
|
-
const _state =
|
|
21821
|
+
const _state = renderer.state;
|
|
21681
21822
|
|
|
21682
21823
|
// Set GL state for depth map.
|
|
21683
21824
|
_state.setBlending( NoBlending );
|
|
@@ -21751,8 +21892,8 @@
|
|
|
21751
21892
|
|
|
21752
21893
|
}
|
|
21753
21894
|
|
|
21754
|
-
|
|
21755
|
-
|
|
21895
|
+
renderer.setRenderTarget( shadow.map );
|
|
21896
|
+
renderer.clear();
|
|
21756
21897
|
|
|
21757
21898
|
const viewportCount = shadow.getViewportCount();
|
|
21758
21899
|
|
|
@@ -21793,13 +21934,13 @@
|
|
|
21793
21934
|
|
|
21794
21935
|
scope.needsUpdate = false;
|
|
21795
21936
|
|
|
21796
|
-
|
|
21937
|
+
renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );
|
|
21797
21938
|
|
|
21798
21939
|
};
|
|
21799
21940
|
|
|
21800
21941
|
function VSMPass( shadow, camera ) {
|
|
21801
21942
|
|
|
21802
|
-
const geometry =
|
|
21943
|
+
const geometry = objects.update( fullScreenMesh );
|
|
21803
21944
|
|
|
21804
21945
|
if ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {
|
|
21805
21946
|
|
|
@@ -21822,18 +21963,18 @@
|
|
|
21822
21963
|
shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;
|
|
21823
21964
|
shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
|
|
21824
21965
|
shadowMaterialVertical.uniforms.radius.value = shadow.radius;
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21966
|
+
renderer.setRenderTarget( shadow.mapPass );
|
|
21967
|
+
renderer.clear();
|
|
21968
|
+
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );
|
|
21828
21969
|
|
|
21829
21970
|
// horizontal pass
|
|
21830
21971
|
|
|
21831
21972
|
shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
|
|
21832
21973
|
shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
|
|
21833
21974
|
shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21975
|
+
renderer.setRenderTarget( shadow.map );
|
|
21976
|
+
renderer.clear();
|
|
21977
|
+
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );
|
|
21837
21978
|
|
|
21838
21979
|
}
|
|
21839
21980
|
|
|
@@ -21851,7 +21992,7 @@
|
|
|
21851
21992
|
|
|
21852
21993
|
result = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;
|
|
21853
21994
|
|
|
21854
|
-
if ( (
|
|
21995
|
+
if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
|
|
21855
21996
|
( material.displacementMap && material.displacementScale !== 0 ) ||
|
|
21856
21997
|
( material.alphaMap && material.alphaTest > 0 ) ||
|
|
21857
21998
|
( material.map && material.alphaTest > 0 ) ) {
|
|
@@ -21916,7 +22057,7 @@
|
|
|
21916
22057
|
|
|
21917
22058
|
if ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {
|
|
21918
22059
|
|
|
21919
|
-
const materialProperties =
|
|
22060
|
+
const materialProperties = renderer.properties.get( result );
|
|
21920
22061
|
materialProperties.light = light;
|
|
21921
22062
|
|
|
21922
22063
|
}
|
|
@@ -21937,7 +22078,7 @@
|
|
|
21937
22078
|
|
|
21938
22079
|
object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );
|
|
21939
22080
|
|
|
21940
|
-
const geometry =
|
|
22081
|
+
const geometry = objects.update( object );
|
|
21941
22082
|
const material = object.material;
|
|
21942
22083
|
|
|
21943
22084
|
if ( Array.isArray( material ) ) {
|
|
@@ -21953,11 +22094,11 @@
|
|
|
21953
22094
|
|
|
21954
22095
|
const depthMaterial = getDepthMaterial( object, groupMaterial, light, type );
|
|
21955
22096
|
|
|
21956
|
-
object.onBeforeShadow(
|
|
22097
|
+
object.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
|
|
21957
22098
|
|
|
21958
|
-
|
|
22099
|
+
renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
|
|
21959
22100
|
|
|
21960
|
-
object.onAfterShadow(
|
|
22101
|
+
object.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
|
|
21961
22102
|
|
|
21962
22103
|
}
|
|
21963
22104
|
|
|
@@ -21967,11 +22108,11 @@
|
|
|
21967
22108
|
|
|
21968
22109
|
const depthMaterial = getDepthMaterial( object, material, light, type );
|
|
21969
22110
|
|
|
21970
|
-
object.onBeforeShadow(
|
|
22111
|
+
object.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
|
|
21971
22112
|
|
|
21972
|
-
|
|
22113
|
+
renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
|
|
21973
22114
|
|
|
21974
|
-
object.onAfterShadow(
|
|
22115
|
+
object.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
|
|
21975
22116
|
|
|
21976
22117
|
}
|
|
21977
22118
|
|
|
@@ -23479,6 +23620,48 @@
|
|
|
23479
23620
|
|
|
23480
23621
|
}
|
|
23481
23622
|
|
|
23623
|
+
function getInternalDepthFormat( useStencil, depthType ) {
|
|
23624
|
+
|
|
23625
|
+
let glInternalFormat;
|
|
23626
|
+
if ( useStencil ) {
|
|
23627
|
+
|
|
23628
|
+
if ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {
|
|
23629
|
+
|
|
23630
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
23631
|
+
|
|
23632
|
+
} else if ( depthType === FloatType ) {
|
|
23633
|
+
|
|
23634
|
+
glInternalFormat = _gl.DEPTH32F_STENCIL8;
|
|
23635
|
+
|
|
23636
|
+
} else if ( depthType === UnsignedShortType ) {
|
|
23637
|
+
|
|
23638
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
23639
|
+
console.warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );
|
|
23640
|
+
|
|
23641
|
+
}
|
|
23642
|
+
|
|
23643
|
+
} else {
|
|
23644
|
+
|
|
23645
|
+
if ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {
|
|
23646
|
+
|
|
23647
|
+
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
23648
|
+
|
|
23649
|
+
} else if ( depthType === FloatType ) {
|
|
23650
|
+
|
|
23651
|
+
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
23652
|
+
|
|
23653
|
+
} else if ( depthType === UnsignedShortType ) {
|
|
23654
|
+
|
|
23655
|
+
glInternalFormat = _gl.DEPTH_COMPONENT16;
|
|
23656
|
+
|
|
23657
|
+
}
|
|
23658
|
+
|
|
23659
|
+
}
|
|
23660
|
+
|
|
23661
|
+
return glInternalFormat;
|
|
23662
|
+
|
|
23663
|
+
}
|
|
23664
|
+
|
|
23482
23665
|
function getMipLevels( texture, image ) {
|
|
23483
23666
|
|
|
23484
23667
|
if ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
|
|
@@ -23986,30 +24169,14 @@
|
|
|
23986
24169
|
let mipmap;
|
|
23987
24170
|
const mipmaps = texture.mipmaps;
|
|
23988
24171
|
|
|
23989
|
-
const useTexStorage = ( texture.isVideoTexture !== true
|
|
24172
|
+
const useTexStorage = ( texture.isVideoTexture !== true );
|
|
23990
24173
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
23991
24174
|
const dataReady = source.dataReady;
|
|
23992
24175
|
const levels = getMipLevels( texture, image );
|
|
23993
24176
|
|
|
23994
24177
|
if ( texture.isDepthTexture ) {
|
|
23995
24178
|
|
|
23996
|
-
|
|
23997
|
-
|
|
23998
|
-
glInternalFormat = _gl.DEPTH_COMPONENT16;
|
|
23999
|
-
|
|
24000
|
-
if ( texture.type === FloatType ) {
|
|
24001
|
-
|
|
24002
|
-
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
24003
|
-
|
|
24004
|
-
} else if ( texture.type === UnsignedIntType ) {
|
|
24005
|
-
|
|
24006
|
-
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24007
|
-
|
|
24008
|
-
} else if ( texture.type === UnsignedInt248Type ) {
|
|
24009
|
-
|
|
24010
|
-
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
24011
|
-
|
|
24012
|
-
}
|
|
24179
|
+
glInternalFormat = getInternalDepthFormat( texture.format === DepthStencilFormat, texture.type );
|
|
24013
24180
|
|
|
24014
24181
|
//
|
|
24015
24182
|
|
|
@@ -24109,7 +24276,22 @@
|
|
|
24109
24276
|
|
|
24110
24277
|
if ( dataReady ) {
|
|
24111
24278
|
|
|
24112
|
-
|
|
24279
|
+
if ( texture.layerUpdates.size > 0 ) {
|
|
24280
|
+
|
|
24281
|
+
for ( const layerIndex of texture.layerUpdates ) {
|
|
24282
|
+
|
|
24283
|
+
const layerSize = mipmap.width * mipmap.height;
|
|
24284
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, mipmap.data.slice( layerSize * layerIndex, layerSize * ( layerIndex + 1 ) ), 0, 0 );
|
|
24285
|
+
|
|
24286
|
+
}
|
|
24287
|
+
|
|
24288
|
+
texture.clearLayerUpdates();
|
|
24289
|
+
|
|
24290
|
+
} else {
|
|
24291
|
+
|
|
24292
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
|
|
24293
|
+
|
|
24294
|
+
}
|
|
24113
24295
|
|
|
24114
24296
|
}
|
|
24115
24297
|
|
|
@@ -24215,7 +24397,72 @@
|
|
|
24215
24397
|
|
|
24216
24398
|
if ( dataReady ) {
|
|
24217
24399
|
|
|
24218
|
-
|
|
24400
|
+
if ( texture.layerUpdates.size > 0 ) {
|
|
24401
|
+
|
|
24402
|
+
// When type is GL_UNSIGNED_BYTE, each of these bytes is
|
|
24403
|
+
// interpreted as one color component, depending on format. When
|
|
24404
|
+
// type is one of GL_UNSIGNED_SHORT_5_6_5,
|
|
24405
|
+
// GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, each
|
|
24406
|
+
// unsigned value is interpreted as containing all the components
|
|
24407
|
+
// for a single pixel, with the color components arranged
|
|
24408
|
+
// according to format.
|
|
24409
|
+
//
|
|
24410
|
+
// See https://registry.khronos.org/OpenGL-Refpages/es1.1/xhtml/glTexImage2D.xml
|
|
24411
|
+
let texelSize;
|
|
24412
|
+
switch ( glType ) {
|
|
24413
|
+
|
|
24414
|
+
case _gl.UNSIGNED_BYTE:
|
|
24415
|
+
switch ( glFormat ) {
|
|
24416
|
+
|
|
24417
|
+
case _gl.ALPHA:
|
|
24418
|
+
texelSize = 1;
|
|
24419
|
+
break;
|
|
24420
|
+
case _gl.LUMINANCE:
|
|
24421
|
+
texelSize = 1;
|
|
24422
|
+
break;
|
|
24423
|
+
case _gl.LUMINANCE_ALPHA:
|
|
24424
|
+
texelSize = 2;
|
|
24425
|
+
break;
|
|
24426
|
+
case _gl.RGB:
|
|
24427
|
+
texelSize = 3;
|
|
24428
|
+
break;
|
|
24429
|
+
case _gl.RGBA:
|
|
24430
|
+
texelSize = 4;
|
|
24431
|
+
break;
|
|
24432
|
+
|
|
24433
|
+
default:
|
|
24434
|
+
throw new Error( `Unknown texel size for format ${glFormat}.` );
|
|
24435
|
+
|
|
24436
|
+
}
|
|
24437
|
+
|
|
24438
|
+
break;
|
|
24439
|
+
|
|
24440
|
+
case _gl.UNSIGNED_SHORT_4_4_4_4:
|
|
24441
|
+
case _gl.UNSIGNED_SHORT_5_5_5_1:
|
|
24442
|
+
case _gl.UNSIGNED_SHORT_5_6_5:
|
|
24443
|
+
texelSize = 1;
|
|
24444
|
+
break;
|
|
24445
|
+
|
|
24446
|
+
default:
|
|
24447
|
+
throw new Error( `Unknown texel size for type ${glType}.` );
|
|
24448
|
+
|
|
24449
|
+
}
|
|
24450
|
+
|
|
24451
|
+
const layerSize = image.width * image.height * texelSize;
|
|
24452
|
+
|
|
24453
|
+
for ( const layerIndex of texture.layerUpdates ) {
|
|
24454
|
+
|
|
24455
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, image.data.slice( layerSize * layerIndex, layerSize * ( layerIndex + 1 ) ) );
|
|
24456
|
+
|
|
24457
|
+
}
|
|
24458
|
+
|
|
24459
|
+
texture.clearLayerUpdates();
|
|
24460
|
+
|
|
24461
|
+
} else {
|
|
24462
|
+
|
|
24463
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
|
|
24464
|
+
|
|
24465
|
+
}
|
|
24219
24466
|
|
|
24220
24467
|
}
|
|
24221
24468
|
|
|
@@ -24636,74 +24883,37 @@
|
|
|
24636
24883
|
|
|
24637
24884
|
}
|
|
24638
24885
|
|
|
24639
|
-
|
|
24640
24886
|
// Setup storage for internal depth/stencil buffers and bind to correct framebuffer
|
|
24641
24887
|
function setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {
|
|
24642
24888
|
|
|
24643
24889
|
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
24644
24890
|
|
|
24645
|
-
if ( renderTarget.depthBuffer
|
|
24646
|
-
|
|
24647
|
-
let glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24648
|
-
|
|
24649
|
-
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
24650
|
-
|
|
24651
|
-
const depthTexture = renderTarget.depthTexture;
|
|
24652
|
-
|
|
24653
|
-
if ( depthTexture && depthTexture.isDepthTexture ) {
|
|
24654
|
-
|
|
24655
|
-
if ( depthTexture.type === FloatType ) {
|
|
24656
|
-
|
|
24657
|
-
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
24658
|
-
|
|
24659
|
-
} else if ( depthTexture.type === UnsignedIntType ) {
|
|
24660
|
-
|
|
24661
|
-
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
24662
|
-
|
|
24663
|
-
}
|
|
24664
|
-
|
|
24665
|
-
}
|
|
24666
|
-
|
|
24667
|
-
const samples = getRenderTargetSamples( renderTarget );
|
|
24668
|
-
|
|
24669
|
-
if ( useMultisampledRTT( renderTarget ) ) {
|
|
24670
|
-
|
|
24671
|
-
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24672
|
-
|
|
24673
|
-
} else {
|
|
24674
|
-
|
|
24675
|
-
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24676
|
-
|
|
24677
|
-
}
|
|
24678
|
-
|
|
24679
|
-
} else {
|
|
24680
|
-
|
|
24681
|
-
_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24682
|
-
|
|
24683
|
-
}
|
|
24684
|
-
|
|
24685
|
-
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );
|
|
24891
|
+
if ( renderTarget.depthBuffer ) {
|
|
24686
24892
|
|
|
24687
|
-
|
|
24893
|
+
// retrieve the depth attachment types
|
|
24894
|
+
const depthTexture = renderTarget.depthTexture;
|
|
24895
|
+
const depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null;
|
|
24896
|
+
const glInternalFormat = getInternalDepthFormat( renderTarget.stencilBuffer, depthType );
|
|
24897
|
+
const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
24688
24898
|
|
|
24899
|
+
// set up the attachment
|
|
24689
24900
|
const samples = getRenderTargetSamples( renderTarget );
|
|
24901
|
+
const isUseMultisampledRTT = useMultisampledRTT( renderTarget );
|
|
24902
|
+
if ( isUseMultisampledRTT ) {
|
|
24690
24903
|
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );
|
|
24904
|
+
multisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24694
24905
|
|
|
24695
|
-
} else if (
|
|
24906
|
+
} else if ( isMultisample ) {
|
|
24696
24907
|
|
|
24697
|
-
|
|
24908
|
+
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24698
24909
|
|
|
24699
24910
|
} else {
|
|
24700
24911
|
|
|
24701
|
-
_gl.renderbufferStorage( _gl.RENDERBUFFER,
|
|
24912
|
+
_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
24702
24913
|
|
|
24703
24914
|
}
|
|
24704
24915
|
|
|
24705
|
-
|
|
24706
|
-
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );
|
|
24916
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );
|
|
24707
24917
|
|
|
24708
24918
|
} else {
|
|
24709
24919
|
|
|
@@ -25114,112 +25324,120 @@
|
|
|
25114
25324
|
|
|
25115
25325
|
}
|
|
25116
25326
|
|
|
25327
|
+
const invalidationArrayRead = [];
|
|
25328
|
+
const invalidationArrayDraw = [];
|
|
25329
|
+
|
|
25117
25330
|
function updateMultisampleRenderTarget( renderTarget ) {
|
|
25118
25331
|
|
|
25119
|
-
if (
|
|
25332
|
+
if ( renderTarget.samples > 0 ) {
|
|
25120
25333
|
|
|
25121
|
-
|
|
25122
|
-
const width = renderTarget.width;
|
|
25123
|
-
const height = renderTarget.height;
|
|
25124
|
-
let mask = _gl.COLOR_BUFFER_BIT;
|
|
25125
|
-
const invalidationArray = [];
|
|
25126
|
-
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
25127
|
-
const renderTargetProperties = properties.get( renderTarget );
|
|
25128
|
-
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
25334
|
+
if ( useMultisampledRTT( renderTarget ) === false ) {
|
|
25129
25335
|
|
|
25130
|
-
|
|
25131
|
-
|
|
25336
|
+
const textures = renderTarget.textures;
|
|
25337
|
+
const width = renderTarget.width;
|
|
25338
|
+
const height = renderTarget.height;
|
|
25339
|
+
let mask = _gl.COLOR_BUFFER_BIT;
|
|
25340
|
+
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
25341
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
25342
|
+
const isMultipleRenderTargets = ( textures.length > 1 );
|
|
25132
25343
|
|
|
25133
|
-
|
|
25344
|
+
// If MRT we need to remove FBO attachments
|
|
25345
|
+
if ( isMultipleRenderTargets ) {
|
|
25346
|
+
|
|
25347
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
25134
25348
|
|
|
25135
|
-
|
|
25136
|
-
|
|
25349
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25350
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );
|
|
25137
25351
|
|
|
25138
|
-
|
|
25139
|
-
|
|
25352
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25353
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );
|
|
25354
|
+
|
|
25355
|
+
}
|
|
25140
25356
|
|
|
25141
25357
|
}
|
|
25142
25358
|
|
|
25143
|
-
|
|
25359
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25360
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25144
25361
|
|
|
25145
|
-
|
|
25146
|
-
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25362
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
25147
25363
|
|
|
25148
|
-
|
|
25364
|
+
if ( renderTarget.resolveDepthBuffer ) {
|
|
25149
25365
|
|
|
25150
|
-
|
|
25366
|
+
if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
|
|
25151
25367
|
|
|
25152
|
-
|
|
25368
|
+
// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)
|
|
25153
25369
|
|
|
25154
|
-
|
|
25370
|
+
if ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;
|
|
25155
25371
|
|
|
25156
|
-
|
|
25372
|
+
}
|
|
25157
25373
|
|
|
25158
|
-
|
|
25374
|
+
if ( isMultipleRenderTargets ) {
|
|
25159
25375
|
|
|
25160
|
-
|
|
25376
|
+
_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
25161
25377
|
|
|
25162
|
-
|
|
25378
|
+
const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
25379
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
25163
25380
|
|
|
25164
|
-
|
|
25381
|
+
}
|
|
25165
25382
|
|
|
25166
|
-
|
|
25383
|
+
_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );
|
|
25167
25384
|
|
|
25168
|
-
|
|
25385
|
+
if ( supportsInvalidateFramebuffer === true ) {
|
|
25169
25386
|
|
|
25170
|
-
|
|
25387
|
+
invalidationArrayRead.length = 0;
|
|
25388
|
+
invalidationArrayDraw.length = 0;
|
|
25171
25389
|
|
|
25172
|
-
|
|
25390
|
+
invalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );
|
|
25173
25391
|
|
|
25174
|
-
|
|
25392
|
+
if ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {
|
|
25175
25393
|
|
|
25176
|
-
|
|
25394
|
+
invalidationArrayRead.push( depthStyle );
|
|
25395
|
+
invalidationArrayDraw.push( depthStyle );
|
|
25177
25396
|
|
|
25178
|
-
|
|
25179
|
-
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
|
|
25397
|
+
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );
|
|
25180
25398
|
|
|
25181
|
-
|
|
25399
|
+
}
|
|
25182
25400
|
|
|
25183
|
-
|
|
25401
|
+
_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );
|
|
25184
25402
|
|
|
25185
|
-
|
|
25186
|
-
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
25403
|
+
}
|
|
25187
25404
|
|
|
25188
25405
|
}
|
|
25189
25406
|
|
|
25190
|
-
|
|
25407
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );
|
|
25408
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
25409
|
+
|
|
25410
|
+
// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments
|
|
25411
|
+
if ( isMultipleRenderTargets ) {
|
|
25191
25412
|
|
|
25192
|
-
|
|
25413
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
25193
25414
|
|
|
25194
|
-
|
|
25415
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25416
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
25195
25417
|
|
|
25196
|
-
|
|
25418
|
+
const webglTexture = properties.get( textures[ i ] ).__webglTexture;
|
|
25197
25419
|
|
|
25420
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25421
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
25198
25422
|
|
|
25199
|
-
|
|
25423
|
+
}
|
|
25200
25424
|
|
|
25201
|
-
|
|
25202
|
-
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
25425
|
+
}
|
|
25203
25426
|
|
|
25204
|
-
|
|
25205
|
-
if ( isMultipleRenderTargets ) {
|
|
25427
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25206
25428
|
|
|
25207
|
-
|
|
25429
|
+
} else {
|
|
25208
25430
|
|
|
25209
|
-
|
|
25210
|
-
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );
|
|
25431
|
+
if ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {
|
|
25211
25432
|
|
|
25212
|
-
const
|
|
25433
|
+
const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
25213
25434
|
|
|
25214
|
-
|
|
25215
|
-
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );
|
|
25435
|
+
_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
|
|
25216
25436
|
|
|
25217
25437
|
}
|
|
25218
25438
|
|
|
25219
25439
|
}
|
|
25220
25440
|
|
|
25221
|
-
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
25222
|
-
|
|
25223
25441
|
}
|
|
25224
25442
|
|
|
25225
25443
|
}
|
|
@@ -25431,33 +25649,15 @@
|
|
|
25431
25649
|
|
|
25432
25650
|
}
|
|
25433
25651
|
|
|
25434
|
-
//
|
|
25435
|
-
|
|
25436
|
-
if ( p === RGB_ETC1_Format ) {
|
|
25437
|
-
|
|
25438
|
-
extension = extensions.get( 'WEBGL_compressed_texture_etc1' );
|
|
25439
|
-
|
|
25440
|
-
if ( extension !== null ) {
|
|
25441
|
-
|
|
25442
|
-
return extension.COMPRESSED_RGB_ETC1_WEBGL;
|
|
25443
|
-
|
|
25444
|
-
} else {
|
|
25445
|
-
|
|
25446
|
-
return null;
|
|
25652
|
+
// ETC
|
|
25447
25653
|
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
}
|
|
25451
|
-
|
|
25452
|
-
// ETC2
|
|
25453
|
-
|
|
25454
|
-
if ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
|
|
25654
|
+
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
|
|
25455
25655
|
|
|
25456
25656
|
extension = extensions.get( 'WEBGL_compressed_texture_etc' );
|
|
25457
25657
|
|
|
25458
25658
|
if ( extension !== null ) {
|
|
25459
25659
|
|
|
25460
|
-
if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
25660
|
+
if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
|
|
25461
25661
|
if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
|
|
25462
25662
|
|
|
25463
25663
|
} else {
|
|
@@ -25986,7 +26186,7 @@ void main() {
|
|
|
25986
26186
|
|
|
25987
26187
|
}
|
|
25988
26188
|
|
|
25989
|
-
|
|
26189
|
+
getMesh( cameraXR ) {
|
|
25990
26190
|
|
|
25991
26191
|
if ( this.texture !== null ) {
|
|
25992
26192
|
|
|
@@ -26007,10 +26207,10 @@ void main() {
|
|
|
26007
26207
|
|
|
26008
26208
|
}
|
|
26009
26209
|
|
|
26010
|
-
renderer.render( this.mesh, cameraXR );
|
|
26011
|
-
|
|
26012
26210
|
}
|
|
26013
26211
|
|
|
26212
|
+
return this.mesh;
|
|
26213
|
+
|
|
26014
26214
|
}
|
|
26015
26215
|
|
|
26016
26216
|
reset() {
|
|
@@ -26355,12 +26555,10 @@ void main() {
|
|
|
26355
26555
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
26356
26556
|
stencilBuffer: attributes.stencil,
|
|
26357
26557
|
colorSpace: renderer.outputColorSpace,
|
|
26358
|
-
samples: attributes.antialias ? 4 : 0
|
|
26558
|
+
samples: attributes.antialias ? 4 : 0,
|
|
26559
|
+
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
|
|
26359
26560
|
} );
|
|
26360
26561
|
|
|
26361
|
-
const renderTargetProperties = renderer.properties.get( newRenderTarget );
|
|
26362
|
-
renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
|
|
26363
|
-
|
|
26364
26562
|
}
|
|
26365
26563
|
|
|
26366
26564
|
newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
|
|
@@ -26676,6 +26874,12 @@ void main() {
|
|
|
26676
26874
|
|
|
26677
26875
|
};
|
|
26678
26876
|
|
|
26877
|
+
this.getDepthSensingMesh = function () {
|
|
26878
|
+
|
|
26879
|
+
return depthSensing.getMesh( cameraXR );
|
|
26880
|
+
|
|
26881
|
+
};
|
|
26882
|
+
|
|
26679
26883
|
// Animation Loop
|
|
26680
26884
|
|
|
26681
26885
|
let onAnimationFrameCallback = null;
|
|
@@ -26801,8 +27005,6 @@ void main() {
|
|
|
26801
27005
|
|
|
26802
27006
|
}
|
|
26803
27007
|
|
|
26804
|
-
depthSensing.render( renderer, cameraXR );
|
|
26805
|
-
|
|
26806
27008
|
if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
|
|
26807
27009
|
|
|
26808
27010
|
if ( frame.detectedPlanes ) {
|
|
@@ -27077,11 +27279,7 @@ void main() {
|
|
|
27077
27279
|
if ( material.lightMap ) {
|
|
27078
27280
|
|
|
27079
27281
|
uniforms.lightMap.value = material.lightMap;
|
|
27080
|
-
|
|
27081
|
-
// artist-friendly light intensity scaling factor
|
|
27082
|
-
const scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;
|
|
27083
|
-
|
|
27084
|
-
uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;
|
|
27282
|
+
uniforms.lightMapIntensity.value = material.lightMapIntensity;
|
|
27085
27283
|
|
|
27086
27284
|
refreshTransformUniform( material.lightMap, uniforms.lightMapTransform );
|
|
27087
27285
|
|
|
@@ -27298,6 +27496,12 @@ void main() {
|
|
|
27298
27496
|
|
|
27299
27497
|
}
|
|
27300
27498
|
|
|
27499
|
+
if ( material.dispersion > 0 ) {
|
|
27500
|
+
|
|
27501
|
+
uniforms.dispersion.value = material.dispersion;
|
|
27502
|
+
|
|
27503
|
+
}
|
|
27504
|
+
|
|
27301
27505
|
if ( material.iridescence > 0 ) {
|
|
27302
27506
|
|
|
27303
27507
|
uniforms.iridescence.value = material.iridescence;
|
|
@@ -27892,10 +28096,6 @@ void main() {
|
|
|
27892
28096
|
|
|
27893
28097
|
this._outputColorSpace = SRGBColorSpace;
|
|
27894
28098
|
|
|
27895
|
-
// physical lights
|
|
27896
|
-
|
|
27897
|
-
this._useLegacyLights = false;
|
|
27898
|
-
|
|
27899
28099
|
// tone mapping
|
|
27900
28100
|
|
|
27901
28101
|
this.toneMapping = NoToneMapping;
|
|
@@ -27949,11 +28149,12 @@ void main() {
|
|
|
27949
28149
|
|
|
27950
28150
|
const _projScreenMatrix = new Matrix4();
|
|
27951
28151
|
|
|
27952
|
-
const _vector2 = new Vector2();
|
|
27953
28152
|
const _vector3 = new Vector3();
|
|
27954
28153
|
|
|
27955
28154
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
27956
28155
|
|
|
28156
|
+
let _renderBackground = false;
|
|
28157
|
+
|
|
27957
28158
|
function getTargetPixelRatio() {
|
|
27958
28159
|
|
|
27959
28160
|
return _currentRenderTarget === null ? _pixelRatio : 1;
|
|
@@ -27966,10 +28167,7 @@ void main() {
|
|
|
27966
28167
|
|
|
27967
28168
|
function getContext( contextName, contextAttributes ) {
|
|
27968
28169
|
|
|
27969
|
-
|
|
27970
|
-
if ( context !== null ) return context;
|
|
27971
|
-
|
|
27972
|
-
return null;
|
|
28170
|
+
return canvas.getContext( contextName, contextAttributes );
|
|
27973
28171
|
|
|
27974
28172
|
}
|
|
27975
28173
|
|
|
@@ -28036,10 +28234,10 @@ void main() {
|
|
|
28036
28234
|
extensions = new WebGLExtensions( _gl );
|
|
28037
28235
|
extensions.init();
|
|
28038
28236
|
|
|
28039
|
-
capabilities = new WebGLCapabilities( _gl, extensions, parameters );
|
|
28040
|
-
|
|
28041
28237
|
utils = new WebGLUtils( _gl, extensions );
|
|
28042
28238
|
|
|
28239
|
+
capabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );
|
|
28240
|
+
|
|
28043
28241
|
state = new WebGLState( _gl );
|
|
28044
28242
|
|
|
28045
28243
|
info = new WebGLInfo( _gl );
|
|
@@ -28604,7 +28802,15 @@ void main() {
|
|
|
28604
28802
|
|
|
28605
28803
|
if ( object.isBatchedMesh ) {
|
|
28606
28804
|
|
|
28607
|
-
|
|
28805
|
+
if ( object._multiDrawInstances !== null ) {
|
|
28806
|
+
|
|
28807
|
+
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
28808
|
+
|
|
28809
|
+
} else {
|
|
28810
|
+
|
|
28811
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
28812
|
+
|
|
28813
|
+
}
|
|
28608
28814
|
|
|
28609
28815
|
} else if ( object.isInstancedMesh ) {
|
|
28610
28816
|
|
|
@@ -28654,7 +28860,7 @@ void main() {
|
|
|
28654
28860
|
if ( targetScene === null ) targetScene = scene;
|
|
28655
28861
|
|
|
28656
28862
|
currentRenderState = renderStates.get( targetScene );
|
|
28657
|
-
currentRenderState.init();
|
|
28863
|
+
currentRenderState.init( camera );
|
|
28658
28864
|
|
|
28659
28865
|
renderStateStack.push( currentRenderState );
|
|
28660
28866
|
|
|
@@ -28696,7 +28902,7 @@ void main() {
|
|
|
28696
28902
|
|
|
28697
28903
|
}
|
|
28698
28904
|
|
|
28699
|
-
currentRenderState.setupLights(
|
|
28905
|
+
currentRenderState.setupLights();
|
|
28700
28906
|
|
|
28701
28907
|
// Only initialize materials in the new scene, not the targetScene.
|
|
28702
28908
|
|
|
@@ -28871,7 +29077,7 @@ void main() {
|
|
|
28871
29077
|
if ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );
|
|
28872
29078
|
|
|
28873
29079
|
currentRenderState = renderStates.get( scene, renderStateStack.length );
|
|
28874
|
-
currentRenderState.init();
|
|
29080
|
+
currentRenderState.init( camera );
|
|
28875
29081
|
|
|
28876
29082
|
renderStateStack.push( currentRenderState );
|
|
28877
29083
|
|
|
@@ -28886,6 +29092,18 @@ void main() {
|
|
|
28886
29092
|
|
|
28887
29093
|
renderListStack.push( currentRenderList );
|
|
28888
29094
|
|
|
29095
|
+
if ( xr.enabled === true && xr.isPresenting === true ) {
|
|
29096
|
+
|
|
29097
|
+
const depthSensingMesh = _this.xr.getDepthSensingMesh();
|
|
29098
|
+
|
|
29099
|
+
if ( depthSensingMesh !== null ) {
|
|
29100
|
+
|
|
29101
|
+
projectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );
|
|
29102
|
+
|
|
29103
|
+
}
|
|
29104
|
+
|
|
29105
|
+
}
|
|
29106
|
+
|
|
28889
29107
|
projectObject( scene, camera, 0, _this.sortObjects );
|
|
28890
29108
|
|
|
28891
29109
|
currentRenderList.finish();
|
|
@@ -28896,6 +29114,13 @@ void main() {
|
|
|
28896
29114
|
|
|
28897
29115
|
}
|
|
28898
29116
|
|
|
29117
|
+
_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
|
|
29118
|
+
if ( _renderBackground ) {
|
|
29119
|
+
|
|
29120
|
+
background.addToRenderList( currentRenderList, scene );
|
|
29121
|
+
|
|
29122
|
+
}
|
|
29123
|
+
|
|
28899
29124
|
//
|
|
28900
29125
|
|
|
28901
29126
|
this.info.render.frame ++;
|
|
@@ -28912,22 +29137,30 @@ void main() {
|
|
|
28912
29137
|
|
|
28913
29138
|
if ( this.info.autoReset === true ) this.info.reset();
|
|
28914
29139
|
|
|
29140
|
+
// render scene
|
|
28915
29141
|
|
|
28916
|
-
|
|
29142
|
+
const opaqueObjects = currentRenderList.opaque;
|
|
29143
|
+
const transmissiveObjects = currentRenderList.transmissive;
|
|
28917
29144
|
|
|
28918
|
-
|
|
29145
|
+
currentRenderState.setupLights();
|
|
28919
29146
|
|
|
28920
|
-
|
|
29147
|
+
if ( camera.isArrayCamera ) {
|
|
28921
29148
|
|
|
28922
|
-
|
|
29149
|
+
const cameras = camera.cameras;
|
|
28923
29150
|
|
|
28924
|
-
|
|
29151
|
+
if ( transmissiveObjects.length > 0 ) {
|
|
28925
29152
|
|
|
28926
|
-
|
|
29153
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
28927
29154
|
|
|
28928
|
-
|
|
29155
|
+
const camera2 = cameras[ i ];
|
|
28929
29156
|
|
|
28930
|
-
|
|
29157
|
+
renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );
|
|
29158
|
+
|
|
29159
|
+
}
|
|
29160
|
+
|
|
29161
|
+
}
|
|
29162
|
+
|
|
29163
|
+
if ( _renderBackground ) background.render( scene );
|
|
28931
29164
|
|
|
28932
29165
|
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
28933
29166
|
|
|
@@ -28939,6 +29172,10 @@ void main() {
|
|
|
28939
29172
|
|
|
28940
29173
|
} else {
|
|
28941
29174
|
|
|
29175
|
+
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
29176
|
+
|
|
29177
|
+
if ( _renderBackground ) background.render( scene );
|
|
29178
|
+
|
|
28942
29179
|
renderScene( currentRenderList, scene, camera );
|
|
28943
29180
|
|
|
28944
29181
|
}
|
|
@@ -28973,6 +29210,8 @@ void main() {
|
|
|
28973
29210
|
|
|
28974
29211
|
currentRenderState = renderStateStack[ renderStateStack.length - 1 ];
|
|
28975
29212
|
|
|
29213
|
+
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );
|
|
29214
|
+
|
|
28976
29215
|
} else {
|
|
28977
29216
|
|
|
28978
29217
|
currentRenderState = null;
|
|
@@ -29117,8 +29356,6 @@ void main() {
|
|
|
29117
29356
|
|
|
29118
29357
|
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );
|
|
29119
29358
|
|
|
29120
|
-
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
29121
|
-
|
|
29122
29359
|
if ( viewport ) state.viewport( _currentViewport.copy( viewport ) );
|
|
29123
29360
|
|
|
29124
29361
|
if ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );
|
|
@@ -29145,19 +29382,19 @@ void main() {
|
|
|
29145
29382
|
|
|
29146
29383
|
}
|
|
29147
29384
|
|
|
29148
|
-
if ( currentRenderState.state.transmissionRenderTarget ===
|
|
29385
|
+
if ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {
|
|
29149
29386
|
|
|
29150
|
-
currentRenderState.state.transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
|
|
29387
|
+
currentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {
|
|
29151
29388
|
generateMipmaps: true,
|
|
29152
29389
|
type: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,
|
|
29153
29390
|
minFilter: LinearMipmapLinearFilter,
|
|
29154
29391
|
samples: 4,
|
|
29155
|
-
stencilBuffer: stencil
|
|
29392
|
+
stencilBuffer: stencil,
|
|
29393
|
+
resolveDepthBuffer: false,
|
|
29394
|
+
resolveStencilBuffer: false,
|
|
29395
|
+
colorSpace: ColorManagement.workingColorSpace,
|
|
29156
29396
|
} );
|
|
29157
29397
|
|
|
29158
|
-
const renderTargetProperties = properties.get( currentRenderState.state.transmissionRenderTarget );
|
|
29159
|
-
renderTargetProperties.__isTransmissionRenderTarget = true;
|
|
29160
|
-
|
|
29161
29398
|
// debug
|
|
29162
29399
|
|
|
29163
29400
|
/*
|
|
@@ -29170,10 +29407,10 @@ void main() {
|
|
|
29170
29407
|
|
|
29171
29408
|
}
|
|
29172
29409
|
|
|
29173
|
-
const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget;
|
|
29410
|
+
const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];
|
|
29174
29411
|
|
|
29175
|
-
|
|
29176
|
-
transmissionRenderTarget.setSize(
|
|
29412
|
+
const activeViewport = camera.viewport || _currentViewport;
|
|
29413
|
+
transmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );
|
|
29177
29414
|
|
|
29178
29415
|
//
|
|
29179
29416
|
|
|
@@ -29184,51 +29421,72 @@ void main() {
|
|
|
29184
29421
|
_currentClearAlpha = _this.getClearAlpha();
|
|
29185
29422
|
if ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );
|
|
29186
29423
|
|
|
29187
|
-
|
|
29424
|
+
if ( _renderBackground ) {
|
|
29425
|
+
|
|
29426
|
+
background.render( scene );
|
|
29427
|
+
|
|
29428
|
+
} else {
|
|
29429
|
+
|
|
29430
|
+
_this.clear();
|
|
29431
|
+
|
|
29432
|
+
}
|
|
29188
29433
|
|
|
29189
29434
|
// Turn off the features which can affect the frag color for opaque objects pass.
|
|
29190
29435
|
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
|
|
29191
29436
|
const currentToneMapping = _this.toneMapping;
|
|
29192
29437
|
_this.toneMapping = NoToneMapping;
|
|
29193
29438
|
|
|
29439
|
+
// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).
|
|
29440
|
+
// Transmission render pass requires viewport to match the transmissionRenderTarget.
|
|
29441
|
+
const currentCameraViewport = camera.viewport;
|
|
29442
|
+
if ( camera.viewport !== undefined ) camera.viewport = undefined;
|
|
29443
|
+
|
|
29444
|
+
currentRenderState.setupLightsView( camera );
|
|
29445
|
+
|
|
29446
|
+
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );
|
|
29447
|
+
|
|
29194
29448
|
renderObjects( opaqueObjects, scene, camera );
|
|
29195
29449
|
|
|
29196
29450
|
textures.updateMultisampleRenderTarget( transmissionRenderTarget );
|
|
29197
29451
|
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
29198
29452
|
|
|
29199
|
-
|
|
29453
|
+
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131
|
|
29200
29454
|
|
|
29201
|
-
|
|
29455
|
+
let renderTargetNeedsUpdate = false;
|
|
29202
29456
|
|
|
29203
|
-
|
|
29457
|
+
for ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {
|
|
29204
29458
|
|
|
29205
|
-
|
|
29206
|
-
const geometry = renderItem.geometry;
|
|
29207
|
-
const material = renderItem.material;
|
|
29208
|
-
const group = renderItem.group;
|
|
29459
|
+
const renderItem = transmissiveObjects[ i ];
|
|
29209
29460
|
|
|
29210
|
-
|
|
29461
|
+
const object = renderItem.object;
|
|
29462
|
+
const geometry = renderItem.geometry;
|
|
29463
|
+
const material = renderItem.material;
|
|
29464
|
+
const group = renderItem.group;
|
|
29211
29465
|
|
|
29212
|
-
|
|
29466
|
+
if ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {
|
|
29213
29467
|
|
|
29214
|
-
|
|
29215
|
-
material.needsUpdate = true;
|
|
29468
|
+
const currentSide = material.side;
|
|
29216
29469
|
|
|
29217
|
-
|
|
29470
|
+
material.side = BackSide;
|
|
29471
|
+
material.needsUpdate = true;
|
|
29472
|
+
|
|
29473
|
+
renderObject( object, scene, camera, geometry, material, group );
|
|
29218
29474
|
|
|
29219
|
-
|
|
29220
|
-
|
|
29475
|
+
material.side = currentSide;
|
|
29476
|
+
material.needsUpdate = true;
|
|
29221
29477
|
|
|
29222
|
-
|
|
29478
|
+
renderTargetNeedsUpdate = true;
|
|
29479
|
+
|
|
29480
|
+
}
|
|
29223
29481
|
|
|
29224
29482
|
}
|
|
29225
29483
|
|
|
29226
|
-
|
|
29484
|
+
if ( renderTargetNeedsUpdate === true ) {
|
|
29227
29485
|
|
|
29228
|
-
|
|
29486
|
+
textures.updateMultisampleRenderTarget( transmissionRenderTarget );
|
|
29487
|
+
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
29229
29488
|
|
|
29230
|
-
|
|
29231
|
-
textures.updateRenderTargetMipmap( transmissionRenderTarget );
|
|
29489
|
+
}
|
|
29232
29490
|
|
|
29233
29491
|
}
|
|
29234
29492
|
|
|
@@ -29236,6 +29494,8 @@ void main() {
|
|
|
29236
29494
|
|
|
29237
29495
|
_this.setClearColor( _currentClearColor, _currentClearAlpha );
|
|
29238
29496
|
|
|
29497
|
+
if ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;
|
|
29498
|
+
|
|
29239
29499
|
_this.toneMapping = currentToneMapping;
|
|
29240
29500
|
|
|
29241
29501
|
}
|
|
@@ -29426,6 +29686,7 @@ void main() {
|
|
|
29426
29686
|
|
|
29427
29687
|
materialProperties.outputColorSpace = parameters.outputColorSpace;
|
|
29428
29688
|
materialProperties.batching = parameters.batching;
|
|
29689
|
+
materialProperties.batchingColor = parameters.batchingColor;
|
|
29429
29690
|
materialProperties.instancing = parameters.instancing;
|
|
29430
29691
|
materialProperties.instancingColor = parameters.instancingColor;
|
|
29431
29692
|
materialProperties.instancingMorph = parameters.instancingMorph;
|
|
@@ -29515,6 +29776,14 @@ void main() {
|
|
|
29515
29776
|
|
|
29516
29777
|
needsProgramChange = true;
|
|
29517
29778
|
|
|
29779
|
+
} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {
|
|
29780
|
+
|
|
29781
|
+
needsProgramChange = true;
|
|
29782
|
+
|
|
29783
|
+
} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {
|
|
29784
|
+
|
|
29785
|
+
needsProgramChange = true;
|
|
29786
|
+
|
|
29518
29787
|
} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {
|
|
29519
29788
|
|
|
29520
29789
|
needsProgramChange = true;
|
|
@@ -29707,6 +29976,13 @@ void main() {
|
|
|
29707
29976
|
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
29708
29977
|
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
29709
29978
|
|
|
29979
|
+
p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
|
|
29980
|
+
if ( object._colorsTexture !== null ) {
|
|
29981
|
+
|
|
29982
|
+
p_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );
|
|
29983
|
+
|
|
29984
|
+
}
|
|
29985
|
+
|
|
29710
29986
|
}
|
|
29711
29987
|
|
|
29712
29988
|
const morphAttributes = geometry.morphAttributes;
|
|
@@ -29767,7 +30043,7 @@ void main() {
|
|
|
29767
30043
|
|
|
29768
30044
|
}
|
|
29769
30045
|
|
|
29770
|
-
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget );
|
|
30046
|
+
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[ camera.id ] );
|
|
29771
30047
|
|
|
29772
30048
|
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
29773
30049
|
|
|
@@ -30032,17 +30308,14 @@ void main() {
|
|
|
30032
30308
|
const textureFormat = texture.format;
|
|
30033
30309
|
const textureType = texture.type;
|
|
30034
30310
|
|
|
30035
|
-
if (
|
|
30311
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
30036
30312
|
|
|
30037
30313
|
console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
30038
30314
|
return;
|
|
30039
30315
|
|
|
30040
30316
|
}
|
|
30041
30317
|
|
|
30042
|
-
|
|
30043
|
-
|
|
30044
|
-
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
30045
|
-
textureType !== FloatType && ! halfFloatSupportedByExt ) {
|
|
30318
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
30046
30319
|
|
|
30047
30320
|
console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
30048
30321
|
return;
|
|
@@ -30070,24 +30343,159 @@ void main() {
|
|
|
30070
30343
|
|
|
30071
30344
|
};
|
|
30072
30345
|
|
|
30073
|
-
this.
|
|
30346
|
+
this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
30347
|
+
|
|
30348
|
+
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
30349
|
+
|
|
30350
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
|
|
30351
|
+
|
|
30352
|
+
}
|
|
30353
|
+
|
|
30354
|
+
let framebuffer = properties.get( renderTarget ).__webglFramebuffer;
|
|
30355
|
+
if ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {
|
|
30356
|
+
|
|
30357
|
+
framebuffer = framebuffer[ activeCubeFaceIndex ];
|
|
30358
|
+
|
|
30359
|
+
}
|
|
30360
|
+
|
|
30361
|
+
if ( framebuffer ) {
|
|
30362
|
+
|
|
30363
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
30364
|
+
|
|
30365
|
+
try {
|
|
30366
|
+
|
|
30367
|
+
const texture = renderTarget.texture;
|
|
30368
|
+
const textureFormat = texture.format;
|
|
30369
|
+
const textureType = texture.type;
|
|
30370
|
+
|
|
30371
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
30372
|
+
|
|
30373
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
30374
|
+
|
|
30375
|
+
}
|
|
30376
|
+
|
|
30377
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
30378
|
+
|
|
30379
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
30380
|
+
|
|
30381
|
+
}
|
|
30382
|
+
|
|
30383
|
+
// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
|
|
30384
|
+
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
30385
|
+
|
|
30386
|
+
const glBuffer = _gl.createBuffer();
|
|
30387
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
30388
|
+
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
30389
|
+
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
30390
|
+
_gl.flush();
|
|
30391
|
+
|
|
30392
|
+
// check if the commands have finished every 8 ms
|
|
30393
|
+
const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
|
|
30394
|
+
await probeAsync( _gl, sync, 4 );
|
|
30395
|
+
|
|
30396
|
+
try {
|
|
30397
|
+
|
|
30398
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
30399
|
+
_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
|
|
30400
|
+
|
|
30401
|
+
} finally {
|
|
30402
|
+
|
|
30403
|
+
_gl.deleteBuffer( glBuffer );
|
|
30404
|
+
_gl.deleteSync( sync );
|
|
30405
|
+
|
|
30406
|
+
}
|
|
30407
|
+
|
|
30408
|
+
return buffer;
|
|
30409
|
+
|
|
30410
|
+
}
|
|
30411
|
+
|
|
30412
|
+
} finally {
|
|
30413
|
+
|
|
30414
|
+
// restore framebuffer of current render target if necessary
|
|
30415
|
+
|
|
30416
|
+
const framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
30417
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
30418
|
+
|
|
30419
|
+
}
|
|
30420
|
+
|
|
30421
|
+
}
|
|
30422
|
+
|
|
30423
|
+
};
|
|
30424
|
+
|
|
30425
|
+
this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {
|
|
30426
|
+
|
|
30427
|
+
// support previous signature with position first
|
|
30428
|
+
if ( texture.isTexture !== true ) {
|
|
30429
|
+
|
|
30430
|
+
// @deprecated, r165
|
|
30431
|
+
console.warn( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
|
|
30432
|
+
|
|
30433
|
+
position = arguments[ 0 ] || null;
|
|
30434
|
+
texture = arguments[ 1 ];
|
|
30435
|
+
|
|
30436
|
+
}
|
|
30074
30437
|
|
|
30075
30438
|
const levelScale = Math.pow( 2, - level );
|
|
30076
30439
|
const width = Math.floor( texture.image.width * levelScale );
|
|
30077
30440
|
const height = Math.floor( texture.image.height * levelScale );
|
|
30078
30441
|
|
|
30442
|
+
const x = position !== null ? position.x : 0;
|
|
30443
|
+
const y = position !== null ? position.y : 0;
|
|
30444
|
+
|
|
30079
30445
|
textures.setTexture2D( texture, 0 );
|
|
30080
30446
|
|
|
30081
|
-
_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0,
|
|
30447
|
+
_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );
|
|
30082
30448
|
|
|
30083
30449
|
state.unbindTexture();
|
|
30084
30450
|
|
|
30085
30451
|
};
|
|
30086
30452
|
|
|
30087
|
-
this.copyTextureToTexture = function (
|
|
30453
|
+
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
30454
|
+
|
|
30455
|
+
// support previous signature with dstPosition first
|
|
30456
|
+
if ( srcTexture.isTexture !== true ) {
|
|
30457
|
+
|
|
30458
|
+
// @deprecated, r165
|
|
30459
|
+
console.warn( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
|
|
30460
|
+
|
|
30461
|
+
dstPosition = arguments[ 0 ] || null;
|
|
30462
|
+
srcTexture = arguments[ 1 ];
|
|
30463
|
+
dstTexture = arguments[ 2 ];
|
|
30464
|
+
level = arguments[ 3 ] || 0;
|
|
30465
|
+
srcRegion = null;
|
|
30466
|
+
|
|
30467
|
+
}
|
|
30468
|
+
|
|
30469
|
+
let width, height, minX, minY;
|
|
30470
|
+
let dstX, dstY;
|
|
30471
|
+
if ( srcRegion !== null ) {
|
|
30472
|
+
|
|
30473
|
+
width = srcRegion.max.x - srcRegion.min.x;
|
|
30474
|
+
height = srcRegion.max.y - srcRegion.min.y;
|
|
30475
|
+
minX = srcRegion.min.x;
|
|
30476
|
+
minY = srcRegion.min.y;
|
|
30477
|
+
|
|
30478
|
+
} else {
|
|
30479
|
+
|
|
30480
|
+
width = srcTexture.image.width;
|
|
30481
|
+
height = srcTexture.image.height;
|
|
30482
|
+
minX = 0;
|
|
30483
|
+
minY = 0;
|
|
30484
|
+
|
|
30485
|
+
}
|
|
30486
|
+
|
|
30487
|
+
if ( dstPosition !== null ) {
|
|
30488
|
+
|
|
30489
|
+
dstX = dstPosition.x;
|
|
30490
|
+
dstY = dstPosition.y;
|
|
30491
|
+
|
|
30492
|
+
} else {
|
|
30493
|
+
|
|
30494
|
+
dstX = 0;
|
|
30495
|
+
dstY = 0;
|
|
30496
|
+
|
|
30497
|
+
}
|
|
30088
30498
|
|
|
30089
|
-
const width = srcTexture.image.width;
|
|
30090
|
-
const height = srcTexture.image.height;
|
|
30091
30499
|
const glFormat = utils.convert( dstTexture.format );
|
|
30092
30500
|
const glType = utils.convert( dstTexture.type );
|
|
30093
30501
|
|
|
@@ -30099,24 +30507,43 @@ void main() {
|
|
|
30099
30507
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
30100
30508
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
30101
30509
|
|
|
30510
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
30511
|
+
const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
30512
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
30513
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
30514
|
+
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
30515
|
+
|
|
30516
|
+
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
30517
|
+
|
|
30518
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
30519
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
30520
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
30521
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
30522
|
+
|
|
30102
30523
|
if ( srcTexture.isDataTexture ) {
|
|
30103
30524
|
|
|
30104
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level,
|
|
30525
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image.data );
|
|
30105
30526
|
|
|
30106
30527
|
} else {
|
|
30107
30528
|
|
|
30108
30529
|
if ( srcTexture.isCompressedTexture ) {
|
|
30109
30530
|
|
|
30110
|
-
_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level,
|
|
30531
|
+
_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, image.width, image.height, glFormat, image.data );
|
|
30111
30532
|
|
|
30112
30533
|
} else {
|
|
30113
30534
|
|
|
30114
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level,
|
|
30535
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, glFormat, glType, image );
|
|
30115
30536
|
|
|
30116
30537
|
}
|
|
30117
30538
|
|
|
30118
30539
|
}
|
|
30119
30540
|
|
|
30541
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
30542
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
30543
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
30544
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
30545
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
30546
|
+
|
|
30120
30547
|
// Generate mipmaps only when copying level 0
|
|
30121
30548
|
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );
|
|
30122
30549
|
|
|
@@ -30124,11 +30551,59 @@ void main() {
|
|
|
30124
30551
|
|
|
30125
30552
|
};
|
|
30126
30553
|
|
|
30127
|
-
this.copyTextureToTexture3D = function (
|
|
30554
|
+
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
30555
|
+
|
|
30556
|
+
// support previous signature with source box first
|
|
30557
|
+
if ( srcTexture.isTexture !== true ) {
|
|
30558
|
+
|
|
30559
|
+
// @deprecated, r165
|
|
30560
|
+
console.warn( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
30561
|
+
|
|
30562
|
+
srcRegion = arguments[ 0 ] || null;
|
|
30563
|
+
dstPosition = arguments[ 1 ] || null;
|
|
30564
|
+
srcTexture = arguments[ 2 ];
|
|
30565
|
+
dstTexture = arguments[ 3 ];
|
|
30566
|
+
level = arguments[ 4 ] || 0;
|
|
30567
|
+
|
|
30568
|
+
}
|
|
30569
|
+
|
|
30570
|
+
let width, height, depth, minX, minY, minZ;
|
|
30571
|
+
let dstX, dstY, dstZ;
|
|
30572
|
+
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
30573
|
+
if ( srcRegion !== null ) {
|
|
30574
|
+
|
|
30575
|
+
width = srcRegion.max.x - srcRegion.min.x;
|
|
30576
|
+
height = srcRegion.max.y - srcRegion.min.y;
|
|
30577
|
+
depth = srcRegion.max.z - srcRegion.min.z;
|
|
30578
|
+
minX = srcRegion.min.x;
|
|
30579
|
+
minY = srcRegion.min.y;
|
|
30580
|
+
minZ = srcRegion.min.z;
|
|
30581
|
+
|
|
30582
|
+
} else {
|
|
30583
|
+
|
|
30584
|
+
width = image.width;
|
|
30585
|
+
height = image.height;
|
|
30586
|
+
depth = image.depth;
|
|
30587
|
+
minX = 0;
|
|
30588
|
+
minY = 0;
|
|
30589
|
+
minZ = 0;
|
|
30590
|
+
|
|
30591
|
+
}
|
|
30592
|
+
|
|
30593
|
+
if ( dstPosition !== null ) {
|
|
30594
|
+
|
|
30595
|
+
dstX = dstPosition.x;
|
|
30596
|
+
dstY = dstPosition.y;
|
|
30597
|
+
dstZ = dstPosition.z;
|
|
30598
|
+
|
|
30599
|
+
} else {
|
|
30600
|
+
|
|
30601
|
+
dstX = 0;
|
|
30602
|
+
dstY = 0;
|
|
30603
|
+
dstZ = 0;
|
|
30604
|
+
|
|
30605
|
+
}
|
|
30128
30606
|
|
|
30129
|
-
const width = Math.round( sourceBox.max.x - sourceBox.min.x );
|
|
30130
|
-
const height = Math.round( sourceBox.max.y - sourceBox.min.y );
|
|
30131
|
-
const depth = sourceBox.max.z - sourceBox.min.z + 1;
|
|
30132
30607
|
const glFormat = utils.convert( dstTexture.format );
|
|
30133
30608
|
const glType = utils.convert( dstTexture.type );
|
|
30134
30609
|
let glTarget;
|
|
@@ -30154,43 +30629,41 @@ void main() {
|
|
|
30154
30629
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
30155
30630
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
30156
30631
|
|
|
30157
|
-
const
|
|
30158
|
-
const
|
|
30159
|
-
const
|
|
30160
|
-
const
|
|
30161
|
-
const
|
|
30162
|
-
|
|
30163
|
-
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
30632
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
30633
|
+
const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
30634
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
30635
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
30636
|
+
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
30164
30637
|
|
|
30165
30638
|
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
30166
30639
|
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
30167
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS,
|
|
30168
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS,
|
|
30169
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES,
|
|
30640
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
30641
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
30642
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
30170
30643
|
|
|
30171
30644
|
if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
|
|
30172
30645
|
|
|
30173
|
-
_gl.texSubImage3D( glTarget, level,
|
|
30646
|
+
_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );
|
|
30174
30647
|
|
|
30175
30648
|
} else {
|
|
30176
30649
|
|
|
30177
30650
|
if ( dstTexture.isCompressedArrayTexture ) {
|
|
30178
30651
|
|
|
30179
|
-
_gl.compressedTexSubImage3D( glTarget, level,
|
|
30652
|
+
_gl.compressedTexSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );
|
|
30180
30653
|
|
|
30181
30654
|
} else {
|
|
30182
30655
|
|
|
30183
|
-
_gl.texSubImage3D( glTarget, level,
|
|
30656
|
+
_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image );
|
|
30184
30657
|
|
|
30185
30658
|
}
|
|
30186
30659
|
|
|
30187
30660
|
}
|
|
30188
30661
|
|
|
30189
|
-
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH,
|
|
30190
|
-
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT,
|
|
30191
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS,
|
|
30192
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS,
|
|
30193
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES,
|
|
30662
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
30663
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
30664
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
30665
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
30666
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
30194
30667
|
|
|
30195
30668
|
// Generate mipmaps only when copying level 0
|
|
30196
30669
|
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );
|
|
@@ -30199,6 +30672,16 @@ void main() {
|
|
|
30199
30672
|
|
|
30200
30673
|
};
|
|
30201
30674
|
|
|
30675
|
+
this.initRenderTarget = function ( target ) {
|
|
30676
|
+
|
|
30677
|
+
if ( properties.get( target ).__webglFramebuffer === undefined ) {
|
|
30678
|
+
|
|
30679
|
+
textures.setupRenderTarget( target );
|
|
30680
|
+
|
|
30681
|
+
}
|
|
30682
|
+
|
|
30683
|
+
};
|
|
30684
|
+
|
|
30202
30685
|
this.initTexture = function ( texture ) {
|
|
30203
30686
|
|
|
30204
30687
|
if ( texture.isCubeTexture ) {
|
|
@@ -30264,20 +30747,6 @@ void main() {
|
|
|
30264
30747
|
|
|
30265
30748
|
}
|
|
30266
30749
|
|
|
30267
|
-
get useLegacyLights() { // @deprecated, r155
|
|
30268
|
-
|
|
30269
|
-
console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
|
|
30270
|
-
return this._useLegacyLights;
|
|
30271
|
-
|
|
30272
|
-
}
|
|
30273
|
-
|
|
30274
|
-
set useLegacyLights( value ) { // @deprecated, r155
|
|
30275
|
-
|
|
30276
|
-
console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
|
|
30277
|
-
this._useLegacyLights = value;
|
|
30278
|
-
|
|
30279
|
-
}
|
|
30280
|
-
|
|
30281
30750
|
}
|
|
30282
30751
|
|
|
30283
30752
|
class Scene extends Object3D {
|
|
@@ -30940,12 +31409,16 @@ void main() {
|
|
|
30940
31409
|
|
|
30941
31410
|
}
|
|
30942
31411
|
|
|
30943
|
-
const
|
|
30944
|
-
const
|
|
31412
|
+
const _vStart = /*@__PURE__*/ new Vector3();
|
|
31413
|
+
const _vEnd = /*@__PURE__*/ new Vector3();
|
|
31414
|
+
|
|
30945
31415
|
const _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();
|
|
30946
31416
|
const _ray$1 = /*@__PURE__*/ new Ray();
|
|
30947
31417
|
const _sphere$1 = /*@__PURE__*/ new Sphere();
|
|
30948
31418
|
|
|
31419
|
+
const _intersectPointOnRay = /*@__PURE__*/ new Vector3();
|
|
31420
|
+
const _intersectPointOnSegment = /*@__PURE__*/ new Vector3();
|
|
31421
|
+
|
|
30949
31422
|
class Line extends Object3D {
|
|
30950
31423
|
|
|
30951
31424
|
constructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {
|
|
@@ -30987,11 +31460,11 @@ void main() {
|
|
|
30987
31460
|
|
|
30988
31461
|
for ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {
|
|
30989
31462
|
|
|
30990
|
-
|
|
30991
|
-
|
|
31463
|
+
_vStart.fromBufferAttribute( positionAttribute, i - 1 );
|
|
31464
|
+
_vEnd.fromBufferAttribute( positionAttribute, i );
|
|
30992
31465
|
|
|
30993
31466
|
lineDistances[ i ] = lineDistances[ i - 1 ];
|
|
30994
|
-
lineDistances[ i ] +=
|
|
31467
|
+
lineDistances[ i ] += _vStart.distanceTo( _vEnd );
|
|
30995
31468
|
|
|
30996
31469
|
}
|
|
30997
31470
|
|
|
@@ -31032,10 +31505,6 @@ void main() {
|
|
|
31032
31505
|
const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );
|
|
31033
31506
|
const localThresholdSq = localThreshold * localThreshold;
|
|
31034
31507
|
|
|
31035
|
-
const vStart = new Vector3();
|
|
31036
|
-
const vEnd = new Vector3();
|
|
31037
|
-
const interSegment = new Vector3();
|
|
31038
|
-
const interRay = new Vector3();
|
|
31039
31508
|
const step = this.isLineSegments ? 2 : 1;
|
|
31040
31509
|
|
|
31041
31510
|
const index = geometry.index;
|
|
@@ -31052,31 +31521,28 @@ void main() {
|
|
|
31052
31521
|
const a = index.getX( i );
|
|
31053
31522
|
const b = index.getX( i + 1 );
|
|
31054
31523
|
|
|
31055
|
-
|
|
31056
|
-
vEnd.fromBufferAttribute( positionAttribute, b );
|
|
31524
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
|
|
31057
31525
|
|
|
31058
|
-
|
|
31526
|
+
if ( intersect ) {
|
|
31059
31527
|
|
|
31060
|
-
|
|
31528
|
+
intersects.push( intersect );
|
|
31061
31529
|
|
|
31062
|
-
|
|
31530
|
+
}
|
|
31063
31531
|
|
|
31064
|
-
|
|
31532
|
+
}
|
|
31065
31533
|
|
|
31066
|
-
|
|
31534
|
+
if ( this.isLineLoop ) {
|
|
31067
31535
|
|
|
31068
|
-
|
|
31536
|
+
const a = index.getX( end - 1 );
|
|
31537
|
+
const b = index.getX( start );
|
|
31069
31538
|
|
|
31070
|
-
|
|
31071
|
-
// What do we want? intersection point on the ray or on the segment??
|
|
31072
|
-
// point: raycaster.ray.at( distance ),
|
|
31073
|
-
point: interSegment.clone().applyMatrix4( this.matrixWorld ),
|
|
31074
|
-
index: i,
|
|
31075
|
-
face: null,
|
|
31076
|
-
faceIndex: null,
|
|
31077
|
-
object: this
|
|
31539
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
|
|
31078
31540
|
|
|
31079
|
-
|
|
31541
|
+
if ( intersect ) {
|
|
31542
|
+
|
|
31543
|
+
intersects.push( intersect );
|
|
31544
|
+
|
|
31545
|
+
}
|
|
31080
31546
|
|
|
31081
31547
|
}
|
|
31082
31548
|
|
|
@@ -31087,31 +31553,25 @@ void main() {
|
|
|
31087
31553
|
|
|
31088
31554
|
for ( let i = start, l = end - 1; i < l; i += step ) {
|
|
31089
31555
|
|
|
31090
|
-
|
|
31091
|
-
vEnd.fromBufferAttribute( positionAttribute, i + 1 );
|
|
31556
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );
|
|
31092
31557
|
|
|
31093
|
-
|
|
31558
|
+
if ( intersect ) {
|
|
31094
31559
|
|
|
31095
|
-
|
|
31560
|
+
intersects.push( intersect );
|
|
31096
31561
|
|
|
31097
|
-
|
|
31562
|
+
}
|
|
31098
31563
|
|
|
31099
|
-
|
|
31564
|
+
}
|
|
31100
31565
|
|
|
31101
|
-
|
|
31566
|
+
if ( this.isLineLoop ) {
|
|
31102
31567
|
|
|
31103
|
-
|
|
31568
|
+
const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );
|
|
31104
31569
|
|
|
31105
|
-
|
|
31106
|
-
// What do we want? intersection point on the ray or on the segment??
|
|
31107
|
-
// point: raycaster.ray.at( distance ),
|
|
31108
|
-
point: interSegment.clone().applyMatrix4( this.matrixWorld ),
|
|
31109
|
-
index: i,
|
|
31110
|
-
face: null,
|
|
31111
|
-
faceIndex: null,
|
|
31112
|
-
object: this
|
|
31570
|
+
if ( intersect ) {
|
|
31113
31571
|
|
|
31114
|
-
|
|
31572
|
+
intersects.push( intersect );
|
|
31573
|
+
|
|
31574
|
+
}
|
|
31115
31575
|
|
|
31116
31576
|
}
|
|
31117
31577
|
|
|
@@ -31152,8 +31612,40 @@ void main() {
|
|
|
31152
31612
|
|
|
31153
31613
|
}
|
|
31154
31614
|
|
|
31155
|
-
|
|
31156
|
-
|
|
31615
|
+
function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
31616
|
+
|
|
31617
|
+
const positionAttribute = object.geometry.attributes.position;
|
|
31618
|
+
|
|
31619
|
+
_vStart.fromBufferAttribute( positionAttribute, a );
|
|
31620
|
+
_vEnd.fromBufferAttribute( positionAttribute, b );
|
|
31621
|
+
|
|
31622
|
+
const distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );
|
|
31623
|
+
|
|
31624
|
+
if ( distSq > thresholdSq ) return;
|
|
31625
|
+
|
|
31626
|
+
_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation
|
|
31627
|
+
|
|
31628
|
+
const distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );
|
|
31629
|
+
|
|
31630
|
+
if ( distance < raycaster.near || distance > raycaster.far ) return;
|
|
31631
|
+
|
|
31632
|
+
return {
|
|
31633
|
+
|
|
31634
|
+
distance: distance,
|
|
31635
|
+
// What do we want? intersection point on the ray or on the segment??
|
|
31636
|
+
// point: raycaster.ray.at( distance ),
|
|
31637
|
+
point: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),
|
|
31638
|
+
index: a,
|
|
31639
|
+
face: null,
|
|
31640
|
+
faceIndex: null,
|
|
31641
|
+
object: object
|
|
31642
|
+
|
|
31643
|
+
};
|
|
31644
|
+
|
|
31645
|
+
}
|
|
31646
|
+
|
|
31647
|
+
const _start$1 = /*@__PURE__*/ new Vector3();
|
|
31648
|
+
const _end$1 = /*@__PURE__*/ new Vector3();
|
|
31157
31649
|
|
|
31158
31650
|
class LineSegments extends Line {
|
|
31159
31651
|
|
|
@@ -31180,11 +31672,11 @@ void main() {
|
|
|
31180
31672
|
|
|
31181
31673
|
for ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {
|
|
31182
31674
|
|
|
31183
|
-
_start$
|
|
31184
|
-
_end$
|
|
31675
|
+
_start$1.fromBufferAttribute( positionAttribute, i );
|
|
31676
|
+
_end$1.fromBufferAttribute( positionAttribute, i + 1 );
|
|
31185
31677
|
|
|
31186
31678
|
lineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];
|
|
31187
|
-
lineDistances[ i + 1 ] = lineDistances[ i ] + _start$
|
|
31679
|
+
lineDistances[ i + 1 ] = lineDistances[ i ] + _start$1.distanceTo( _end$1 );
|
|
31188
31680
|
|
|
31189
31681
|
}
|
|
31190
31682
|
|
|
@@ -36840,13 +37332,17 @@ void main() {
|
|
|
36840
37332
|
|
|
36841
37333
|
function intersect( object, raycaster, intersects, recursive ) {
|
|
36842
37334
|
|
|
37335
|
+
let propagate = true;
|
|
37336
|
+
|
|
36843
37337
|
if ( object.layers.test( raycaster.layers ) ) {
|
|
36844
37338
|
|
|
36845
|
-
object.raycast( raycaster, intersects );
|
|
37339
|
+
const result = object.raycast( raycaster, intersects );
|
|
37340
|
+
|
|
37341
|
+
if ( result === false ) propagate = false;
|
|
36846
37342
|
|
|
36847
37343
|
}
|
|
36848
37344
|
|
|
36849
|
-
if ( recursive === true ) {
|
|
37345
|
+
if ( propagate === true && recursive === true ) {
|
|
36850
37346
|
|
|
36851
37347
|
const children = object.children;
|
|
36852
37348
|
|
|
@@ -37468,22 +37964,42 @@ void main() {
|
|
|
37468
37964
|
|
|
37469
37965
|
};
|
|
37470
37966
|
|
|
37967
|
+
function hideObject( object ) {
|
|
37968
|
+
|
|
37969
|
+
if ( object.isCSS2DObject ) object.element.style.display = 'none';
|
|
37970
|
+
|
|
37971
|
+
for ( let i = 0, l = object.children.length; i < l; i ++ ) {
|
|
37972
|
+
|
|
37973
|
+
hideObject( object.children[ i ] );
|
|
37974
|
+
|
|
37975
|
+
}
|
|
37976
|
+
|
|
37977
|
+
}
|
|
37978
|
+
|
|
37471
37979
|
function renderObject( object, scene, camera ) {
|
|
37472
37980
|
|
|
37981
|
+
if ( object.visible === false ) {
|
|
37982
|
+
|
|
37983
|
+
hideObject( object );
|
|
37984
|
+
|
|
37985
|
+
return;
|
|
37986
|
+
|
|
37987
|
+
}
|
|
37988
|
+
|
|
37473
37989
|
if ( object.isCSS2DObject ) {
|
|
37474
37990
|
|
|
37475
37991
|
_vector$1.setFromMatrixPosition( object.matrixWorld );
|
|
37476
37992
|
_vector$1.applyMatrix4( _viewProjectionMatrix );
|
|
37477
37993
|
|
|
37478
|
-
const visible = (
|
|
37479
|
-
|
|
37994
|
+
const visible = ( _vector$1.z >= - 1 && _vector$1.z <= 1 ) && ( object.layers.test( camera.layers ) === true );
|
|
37995
|
+
|
|
37996
|
+
const element = object.element;
|
|
37997
|
+
element.style.display = visible === true ? '' : 'none';
|
|
37480
37998
|
|
|
37481
37999
|
if ( visible === true ) {
|
|
37482
38000
|
|
|
37483
38001
|
object.onBeforeRender( _this, scene, camera );
|
|
37484
38002
|
|
|
37485
|
-
const element = object.element;
|
|
37486
|
-
|
|
37487
38003
|
element.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector$1.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector$1.y * _heightHalf + _heightHalf ) + 'px)';
|
|
37488
38004
|
|
|
37489
38005
|
if ( element.parentNode !== domElement ) {
|
|
@@ -37525,7 +38041,7 @@ void main() {
|
|
|
37525
38041
|
|
|
37526
38042
|
const result = [];
|
|
37527
38043
|
|
|
37528
|
-
scene.
|
|
38044
|
+
scene.traverseVisible( function ( object ) {
|
|
37529
38045
|
|
|
37530
38046
|
if ( object.isCSS2DObject ) result.push( object );
|
|
37531
38047
|
|
|
@@ -38097,7 +38613,7 @@ void main() {
|
|
|
38097
38613
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
|
|
38098
38614
|
}
|
|
38099
38615
|
function _arrayLikeToArray$6(arr, len) {
|
|
38100
|
-
if (len > arr.length) len = arr.length;
|
|
38616
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
38101
38617
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
38102
38618
|
return arr2;
|
|
38103
38619
|
}
|
|
@@ -38243,13 +38759,13 @@ void main() {
|
|
|
38243
38759
|
return amount;
|
|
38244
38760
|
},
|
|
38245
38761
|
In: function (amount) {
|
|
38246
|
-
return
|
|
38762
|
+
return amount;
|
|
38247
38763
|
},
|
|
38248
38764
|
Out: function (amount) {
|
|
38249
|
-
return
|
|
38765
|
+
return amount;
|
|
38250
38766
|
},
|
|
38251
38767
|
InOut: function (amount) {
|
|
38252
|
-
return
|
|
38768
|
+
return amount;
|
|
38253
38769
|
},
|
|
38254
38770
|
}),
|
|
38255
38771
|
Quadratic: Object.freeze({
|
|
@@ -38912,13 +39428,11 @@ void main() {
|
|
|
38912
39428
|
* it is still playing, just paused).
|
|
38913
39429
|
*/
|
|
38914
39430
|
Tween.prototype.update = function (time, autoStart) {
|
|
38915
|
-
var _this = this;
|
|
38916
39431
|
var _a;
|
|
38917
39432
|
if (time === void 0) { time = now(); }
|
|
38918
39433
|
if (autoStart === void 0) { autoStart = true; }
|
|
38919
39434
|
if (this._isPaused)
|
|
38920
39435
|
return true;
|
|
38921
|
-
var property;
|
|
38922
39436
|
var endTime = this._startTime + this._duration;
|
|
38923
39437
|
if (!this._goToEnd && !this._isPlaying) {
|
|
38924
39438
|
if (time > endTime)
|
|
@@ -38945,72 +39459,85 @@ void main() {
|
|
|
38945
39459
|
var elapsedTime = time - this._startTime;
|
|
38946
39460
|
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
|
38947
39461
|
var totalTime = this._duration + this._repeat * durationAndDelay;
|
|
38948
|
-
var
|
|
38949
|
-
if (_this._duration === 0)
|
|
38950
|
-
return 1;
|
|
38951
|
-
if (elapsedTime > totalTime) {
|
|
38952
|
-
return 1;
|
|
38953
|
-
}
|
|
38954
|
-
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
|
38955
|
-
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
|
38956
|
-
// TODO use %?
|
|
38957
|
-
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
|
38958
|
-
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
|
38959
|
-
if (portion === 0 && elapsedTime === _this._duration) {
|
|
38960
|
-
return 1;
|
|
38961
|
-
}
|
|
38962
|
-
return portion;
|
|
38963
|
-
};
|
|
38964
|
-
var elapsed = calculateElapsedPortion();
|
|
39462
|
+
var elapsed = this._calculateElapsedPortion(elapsedTime, durationAndDelay, totalTime);
|
|
38965
39463
|
var value = this._easingFunction(elapsed);
|
|
38966
|
-
|
|
39464
|
+
var status = this._calculateCompletionStatus(elapsedTime, durationAndDelay);
|
|
39465
|
+
if (status === 'repeat') {
|
|
39466
|
+
// the current update is happening after the instant the tween repeated
|
|
39467
|
+
this._processRepetition(elapsedTime, durationAndDelay);
|
|
39468
|
+
}
|
|
38967
39469
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
|
39470
|
+
if (status === 'about-to-repeat') {
|
|
39471
|
+
// the current update is happening at the exact instant the tween is going to repeat
|
|
39472
|
+
// the values should match the end of the tween, not the beginning,
|
|
39473
|
+
// that's why _processRepetition happens after _updateProperties
|
|
39474
|
+
this._processRepetition(elapsedTime, durationAndDelay);
|
|
39475
|
+
}
|
|
38968
39476
|
if (this._onUpdateCallback) {
|
|
38969
39477
|
this._onUpdateCallback(this._object, elapsed);
|
|
38970
39478
|
}
|
|
38971
|
-
if (
|
|
38972
|
-
if (this.
|
|
38973
|
-
|
|
38974
|
-
if (isFinite(this._repeat)) {
|
|
38975
|
-
this._repeat -= completeCount;
|
|
38976
|
-
}
|
|
38977
|
-
// Reassign starting values, restart by making startTime = now
|
|
38978
|
-
for (property in this._valuesStartRepeat) {
|
|
38979
|
-
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
|
38980
|
-
this._valuesStartRepeat[property] =
|
|
38981
|
-
// eslint-disable-next-line
|
|
38982
|
-
// @ts-ignore FIXME?
|
|
38983
|
-
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
|
38984
|
-
}
|
|
38985
|
-
if (this._yoyo) {
|
|
38986
|
-
this._swapEndStartRepeatValues(property);
|
|
38987
|
-
}
|
|
38988
|
-
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
38989
|
-
}
|
|
38990
|
-
if (this._yoyo) {
|
|
38991
|
-
this._reversed = !this._reversed;
|
|
38992
|
-
}
|
|
38993
|
-
this._startTime += durationAndDelay * completeCount;
|
|
38994
|
-
if (this._onRepeatCallback) {
|
|
38995
|
-
this._onRepeatCallback(this._object);
|
|
38996
|
-
}
|
|
38997
|
-
this._onEveryStartCallbackFired = false;
|
|
38998
|
-
return true;
|
|
39479
|
+
if (status === 'repeat' || status === 'about-to-repeat') {
|
|
39480
|
+
if (this._onRepeatCallback) {
|
|
39481
|
+
this._onRepeatCallback(this._object);
|
|
38999
39482
|
}
|
|
39000
|
-
|
|
39001
|
-
|
|
39002
|
-
|
|
39003
|
-
|
|
39004
|
-
|
|
39005
|
-
|
|
39006
|
-
|
|
39007
|
-
|
|
39008
|
-
|
|
39009
|
-
|
|
39010
|
-
|
|
39483
|
+
this._onEveryStartCallbackFired = false;
|
|
39484
|
+
}
|
|
39485
|
+
else if (status === 'completed') {
|
|
39486
|
+
this._isPlaying = false;
|
|
39487
|
+
if (this._onCompleteCallback) {
|
|
39488
|
+
this._onCompleteCallback(this._object);
|
|
39489
|
+
}
|
|
39490
|
+
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
39491
|
+
// Make the chained tweens start exactly at the time they should,
|
|
39492
|
+
// even if the `update()` method was called way past the duration of the tween
|
|
39493
|
+
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
|
39011
39494
|
}
|
|
39012
39495
|
}
|
|
39013
|
-
return
|
|
39496
|
+
return status !== 'completed';
|
|
39497
|
+
};
|
|
39498
|
+
Tween.prototype._calculateElapsedPortion = function (elapsedTime, durationAndDelay, totalTime) {
|
|
39499
|
+
if (this._duration === 0 || elapsedTime > totalTime) {
|
|
39500
|
+
return 1;
|
|
39501
|
+
}
|
|
39502
|
+
var timeIntoCurrentRepeat = elapsedTime % durationAndDelay;
|
|
39503
|
+
var portion = Math.min(timeIntoCurrentRepeat / this._duration, 1);
|
|
39504
|
+
if (portion === 0 && elapsedTime !== 0 && elapsedTime % this._duration === 0) {
|
|
39505
|
+
return 1;
|
|
39506
|
+
}
|
|
39507
|
+
return portion;
|
|
39508
|
+
};
|
|
39509
|
+
Tween.prototype._calculateCompletionStatus = function (elapsedTime, durationAndDelay) {
|
|
39510
|
+
if (this._duration !== 0 && elapsedTime < this._duration) {
|
|
39511
|
+
return 'playing';
|
|
39512
|
+
}
|
|
39513
|
+
if (this._repeat <= 0) {
|
|
39514
|
+
return 'completed';
|
|
39515
|
+
}
|
|
39516
|
+
if (elapsedTime === this._duration) {
|
|
39517
|
+
return 'about-to-repeat';
|
|
39518
|
+
}
|
|
39519
|
+
return 'repeat';
|
|
39520
|
+
};
|
|
39521
|
+
Tween.prototype._processRepetition = function (elapsedTime, durationAndDelay) {
|
|
39522
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
|
39523
|
+
if (isFinite(this._repeat)) {
|
|
39524
|
+
this._repeat -= completeCount;
|
|
39525
|
+
}
|
|
39526
|
+
// Reassign starting values, restart by making startTime = now
|
|
39527
|
+
for (var property in this._valuesStartRepeat) {
|
|
39528
|
+
var valueEnd = this._valuesEnd[property];
|
|
39529
|
+
if (!this._yoyo && typeof valueEnd === 'string') {
|
|
39530
|
+
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(valueEnd);
|
|
39531
|
+
}
|
|
39532
|
+
if (this._yoyo) {
|
|
39533
|
+
this._swapEndStartRepeatValues(property);
|
|
39534
|
+
}
|
|
39535
|
+
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
39536
|
+
}
|
|
39537
|
+
if (this._yoyo) {
|
|
39538
|
+
this._reversed = !this._reversed;
|
|
39539
|
+
}
|
|
39540
|
+
this._startTime += durationAndDelay * completeCount;
|
|
39014
39541
|
};
|
|
39015
39542
|
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
|
39016
39543
|
for (var property in _valuesEnd) {
|
|
@@ -43175,20 +43702,22 @@ void main() {
|
|
|
43175
43702
|
const name = attributeNames[ i ];
|
|
43176
43703
|
const attr = geometry.attributes[ name ];
|
|
43177
43704
|
|
|
43178
|
-
tmpAttributes[ name ] = new
|
|
43705
|
+
tmpAttributes[ name ] = new attr.constructor(
|
|
43179
43706
|
new attr.array.constructor( attr.count * attr.itemSize ),
|
|
43180
43707
|
attr.itemSize,
|
|
43181
43708
|
attr.normalized
|
|
43182
43709
|
);
|
|
43183
43710
|
|
|
43184
|
-
const
|
|
43185
|
-
if (
|
|
43711
|
+
const morphAttributes = geometry.morphAttributes[ name ];
|
|
43712
|
+
if ( morphAttributes ) {
|
|
43186
43713
|
|
|
43187
|
-
tmpMorphAttributes[ name ] =
|
|
43188
|
-
|
|
43189
|
-
|
|
43190
|
-
morphAttr.
|
|
43191
|
-
|
|
43714
|
+
if ( ! tmpMorphAttributes[ name ] ) tmpMorphAttributes[ name ] = [];
|
|
43715
|
+
morphAttributes.forEach( ( morphAttr, i ) => {
|
|
43716
|
+
|
|
43717
|
+
const array = new morphAttr.array.constructor( morphAttr.count * morphAttr.itemSize );
|
|
43718
|
+
tmpMorphAttributes[ name ][ i ] = new morphAttr.constructor( array, morphAttr.itemSize, morphAttr.normalized );
|
|
43719
|
+
|
|
43720
|
+
} );
|
|
43192
43721
|
|
|
43193
43722
|
}
|
|
43194
43723
|
|
|
@@ -43233,22 +43762,22 @@ void main() {
|
|
|
43233
43762
|
|
|
43234
43763
|
const name = attributeNames[ j ];
|
|
43235
43764
|
const attribute = geometry.getAttribute( name );
|
|
43236
|
-
const
|
|
43765
|
+
const morphAttributes = geometry.morphAttributes[ name ];
|
|
43237
43766
|
const itemSize = attribute.itemSize;
|
|
43238
|
-
const
|
|
43767
|
+
const newArray = tmpAttributes[ name ];
|
|
43239
43768
|
const newMorphArrays = tmpMorphAttributes[ name ];
|
|
43240
43769
|
|
|
43241
43770
|
for ( let k = 0; k < itemSize; k ++ ) {
|
|
43242
43771
|
|
|
43243
43772
|
const getterFunc = getters[ k ];
|
|
43244
43773
|
const setterFunc = setters[ k ];
|
|
43245
|
-
|
|
43774
|
+
newArray[ setterFunc ]( nextIndex, attribute[ getterFunc ]( index ) );
|
|
43246
43775
|
|
|
43247
|
-
if (
|
|
43776
|
+
if ( morphAttributes ) {
|
|
43248
43777
|
|
|
43249
|
-
for ( let m = 0, ml =
|
|
43778
|
+
for ( let m = 0, ml = morphAttributes.length; m < ml; m ++ ) {
|
|
43250
43779
|
|
|
43251
|
-
newMorphArrays[ m ][ setterFunc ]( nextIndex,
|
|
43780
|
+
newMorphArrays[ m ][ setterFunc ]( nextIndex, morphAttributes[ m ][ getterFunc ]( index ) );
|
|
43252
43781
|
|
|
43253
43782
|
}
|
|
43254
43783
|
|
|
@@ -43272,7 +43801,7 @@ void main() {
|
|
|
43272
43801
|
|
|
43273
43802
|
const tmpAttribute = tmpAttributes[ name ];
|
|
43274
43803
|
|
|
43275
|
-
result.setAttribute( name, new
|
|
43804
|
+
result.setAttribute( name, new tmpAttribute.constructor(
|
|
43276
43805
|
tmpAttribute.array.slice( 0, nextIndex * tmpAttribute.itemSize ),
|
|
43277
43806
|
tmpAttribute.itemSize,
|
|
43278
43807
|
tmpAttribute.normalized,
|
|
@@ -43284,7 +43813,7 @@ void main() {
|
|
|
43284
43813
|
|
|
43285
43814
|
const tmpMorphAttribute = tmpMorphAttributes[ name ][ j ];
|
|
43286
43815
|
|
|
43287
|
-
result.morphAttributes[ name ][ j ] = new
|
|
43816
|
+
result.morphAttributes[ name ][ j ] = new tmpMorphAttribute.constructor(
|
|
43288
43817
|
tmpMorphAttribute.array.slice( 0, nextIndex * tmpMorphAttribute.itemSize ),
|
|
43289
43818
|
tmpMorphAttribute.itemSize,
|
|
43290
43819
|
tmpMorphAttribute.normalized,
|
|
@@ -45836,11 +46365,11 @@ void main() {
|
|
|
45836
46365
|
if (typeof input !== "object" || input === null) return input;
|
|
45837
46366
|
var prim = input[Symbol.toPrimitive];
|
|
45838
46367
|
if (prim !== undefined) {
|
|
45839
|
-
var res = prim.call(input, hint );
|
|
46368
|
+
var res = prim.call(input, hint || "default");
|
|
45840
46369
|
if (typeof res !== "object") return res;
|
|
45841
46370
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
45842
46371
|
}
|
|
45843
|
-
return (String )(input);
|
|
46372
|
+
return (hint === "string" ? String : Number)(input);
|
|
45844
46373
|
}
|
|
45845
46374
|
function _toPropertyKey$2(arg) {
|
|
45846
46375
|
var key = _toPrimitive$2(arg, "string");
|
|
@@ -47583,7 +48112,7 @@ void main() {
|
|
|
47583
48112
|
* //= true
|
|
47584
48113
|
*/
|
|
47585
48114
|
function booleanPointInPolygon(point, polygon, options) {
|
|
47586
|
-
{ options = {}; }
|
|
48115
|
+
if (options === void 0) { options = {}; }
|
|
47587
48116
|
// validation
|
|
47588
48117
|
if (!point) {
|
|
47589
48118
|
throw new Error("point is required");
|
|
@@ -48312,7 +48841,7 @@ void main() {
|
|
|
48312
48841
|
const sin = Math.sin;
|
|
48313
48842
|
const sign =
|
|
48314
48843
|
Math.sign ||
|
|
48315
|
-
function(x) {
|
|
48844
|
+
function (x) {
|
|
48316
48845
|
return x > 0 ? 1 : x < 0 ? -1 : 0;
|
|
48317
48846
|
};
|
|
48318
48847
|
const sqrt = Math.sqrt;
|
|
@@ -48329,7 +48858,7 @@ void main() {
|
|
|
48329
48858
|
return [
|
|
48330
48859
|
a[1] * b[2] - a[2] * b[1],
|
|
48331
48860
|
a[2] * b[0] - a[0] * b[2],
|
|
48332
|
-
a[0] * b[1] - a[1] * b[0]
|
|
48861
|
+
a[0] * b[1] - a[1] * b[0],
|
|
48333
48862
|
];
|
|
48334
48863
|
}
|
|
48335
48864
|
|
|
@@ -48346,7 +48875,7 @@ void main() {
|
|
|
48346
48875
|
function spherical(cartesian) {
|
|
48347
48876
|
return [
|
|
48348
48877
|
atan2(cartesian[1], cartesian[0]) * degrees,
|
|
48349
|
-
asin(max(-1, min(1, cartesian[2]))) * degrees
|
|
48878
|
+
asin(max(-1, min(1, cartesian[2]))) * degrees,
|
|
48350
48879
|
];
|
|
48351
48880
|
}
|
|
48352
48881
|
|
|
@@ -48360,7 +48889,7 @@ void main() {
|
|
|
48360
48889
|
|
|
48361
48890
|
// Spherical excess of a triangle (in spherical coordinates)
|
|
48362
48891
|
function excess(triangle) {
|
|
48363
|
-
triangle = triangle.map(p => cartesian(p));
|
|
48892
|
+
triangle = triangle.map((p) => cartesian(p));
|
|
48364
48893
|
return cartesianDot(triangle[0], cartesianCross(triangle[2], triangle[1]));
|
|
48365
48894
|
}
|
|
48366
48895
|
|
|
@@ -48387,15 +48916,15 @@ void main() {
|
|
|
48387
48916
|
mesh,
|
|
48388
48917
|
hull,
|
|
48389
48918
|
urquhart,
|
|
48390
|
-
find
|
|
48919
|
+
find,
|
|
48391
48920
|
};
|
|
48392
48921
|
}
|
|
48393
48922
|
|
|
48394
48923
|
function geo_find(neighbors, points) {
|
|
48395
|
-
function distance2(a,b) {
|
|
48924
|
+
function distance2(a, b) {
|
|
48396
48925
|
let x = a[0] - b[0],
|
|
48397
|
-
|
|
48398
|
-
|
|
48926
|
+
y = a[1] - b[1],
|
|
48927
|
+
z = a[2] - b[2];
|
|
48399
48928
|
return x * x + y * y + z * z;
|
|
48400
48929
|
}
|
|
48401
48930
|
|
|
@@ -48409,7 +48938,7 @@ void main() {
|
|
|
48409
48938
|
cell = next;
|
|
48410
48939
|
next = null;
|
|
48411
48940
|
dist = distance2(xyz, cartesian(points[cell]));
|
|
48412
|
-
neighbors[cell].forEach(i => {
|
|
48941
|
+
neighbors[cell].forEach((i) => {
|
|
48413
48942
|
let ndist = distance2(xyz, cartesian(points[i]));
|
|
48414
48943
|
if (ndist < dist) {
|
|
48415
48944
|
dist = ndist;
|
|
@@ -48429,7 +48958,7 @@ void main() {
|
|
|
48429
48958
|
|
|
48430
48959
|
// find a valid point to send to infinity
|
|
48431
48960
|
let pivot = 0;
|
|
48432
|
-
while (isNaN(points[pivot][0]+points[pivot][1]) && pivot++ < points.length);
|
|
48961
|
+
while (isNaN(points[pivot][0] + points[pivot][1]) && pivot++ < points.length);
|
|
48433
48962
|
|
|
48434
48963
|
const r = geoRotation(points[pivot]),
|
|
48435
48964
|
projection = geoStereographic()
|
|
@@ -48448,19 +48977,19 @@ void main() {
|
|
|
48448
48977
|
|
|
48449
48978
|
const FAR = 1e6 * sqrt(max2);
|
|
48450
48979
|
|
|
48451
|
-
zeros.forEach(i => (points[i] = [FAR, 0]));
|
|
48980
|
+
zeros.forEach((i) => (points[i] = [FAR, 0]));
|
|
48452
48981
|
|
|
48453
48982
|
// Add infinite horizon points
|
|
48454
|
-
points.push([0,FAR]);
|
|
48455
|
-
points.push([-FAR,0]);
|
|
48456
|
-
points.push([0
|
|
48983
|
+
points.push([0, FAR]);
|
|
48984
|
+
points.push([-FAR, 0]);
|
|
48985
|
+
points.push([0, -FAR]);
|
|
48457
48986
|
|
|
48458
48987
|
const delaunay = Delaunay.from(points);
|
|
48459
48988
|
|
|
48460
48989
|
delaunay.projection = projection;
|
|
48461
48990
|
|
|
48462
48991
|
// clean up the triangulation
|
|
48463
|
-
const {triangles, halfedges, inedges} = delaunay;
|
|
48992
|
+
const { triangles, halfedges, inedges } = delaunay;
|
|
48464
48993
|
for (let i = 0, l = halfedges.length; i < l; i++) {
|
|
48465
48994
|
if (halfedges[i] < 0) {
|
|
48466
48995
|
const j = i % 3 == 2 ? i - 2 : i + 1;
|
|
@@ -48473,33 +49002,33 @@ void main() {
|
|
|
48473
49002
|
triangles[i] = triangles[j] = triangles[k] = pivot;
|
|
48474
49003
|
inedges[triangles[a]] = a % 3 == 0 ? a + 2 : a - 1;
|
|
48475
49004
|
inedges[triangles[b]] = b % 3 == 0 ? b + 2 : b - 1;
|
|
48476
|
-
i += 2 - i % 3;
|
|
49005
|
+
i += 2 - (i % 3);
|
|
48477
49006
|
} else if (triangles[i] > points.length - 3 - 1) {
|
|
48478
49007
|
triangles[i] = pivot;
|
|
48479
49008
|
}
|
|
48480
49009
|
}
|
|
48481
|
-
|
|
49010
|
+
|
|
48482
49011
|
// there should always be 4 degenerate triangles
|
|
48483
49012
|
// console.warn(degenerate);
|
|
48484
49013
|
return delaunay;
|
|
48485
49014
|
}
|
|
48486
49015
|
|
|
48487
49016
|
function geo_edges(triangles, points) {
|
|
48488
|
-
const _index = new Set;
|
|
49017
|
+
const _index = new Set();
|
|
48489
49018
|
if (points.length === 2) return [[0, 1]];
|
|
48490
|
-
triangles.forEach(tri => {
|
|
49019
|
+
triangles.forEach((tri) => {
|
|
48491
49020
|
if (tri[0] === tri[1]) return;
|
|
48492
|
-
if (excess(tri.map(i => points[i])) < 0) return;
|
|
49021
|
+
if (excess(tri.map((i) => points[i])) < 0) return;
|
|
48493
49022
|
for (let i = 0, j; i < 3; i++) {
|
|
48494
49023
|
j = (i + 1) % 3;
|
|
48495
49024
|
_index.add(extent([tri[i], tri[j]]).join("-"));
|
|
48496
49025
|
}
|
|
48497
49026
|
});
|
|
48498
|
-
return Array.from(_index, d => d.split("-").map(Number));
|
|
49027
|
+
return Array.from(_index, (d) => d.split("-").map(Number));
|
|
48499
49028
|
}
|
|
48500
49029
|
|
|
48501
49030
|
function geo_triangles(delaunay) {
|
|
48502
|
-
const {triangles} = delaunay;
|
|
49031
|
+
const { triangles } = delaunay;
|
|
48503
49032
|
if (!triangles) return [];
|
|
48504
49033
|
|
|
48505
49034
|
const geo_triangles = [];
|
|
@@ -48516,8 +49045,8 @@ void main() {
|
|
|
48516
49045
|
|
|
48517
49046
|
function geo_circumcenters(triangles, points) {
|
|
48518
49047
|
// if (!use_centroids) {
|
|
48519
|
-
return triangles.map(tri => {
|
|
48520
|
-
const c = tri.map(i => points[i]).map(cartesian),
|
|
49048
|
+
return triangles.map((tri) => {
|
|
49049
|
+
const c = tri.map((i) => points[i]).map(cartesian),
|
|
48521
49050
|
V = cartesianAdd(
|
|
48522
49051
|
cartesianAdd(cartesianCross(c[1], c[0]), cartesianCross(c[2], c[1])),
|
|
48523
49052
|
cartesianCross(c[0], c[2])
|
|
@@ -48536,7 +49065,7 @@ void main() {
|
|
|
48536
49065
|
|
|
48537
49066
|
function geo_neighbors(triangles, npoints) {
|
|
48538
49067
|
const neighbors = [];
|
|
48539
|
-
triangles.forEach(tri => {
|
|
49068
|
+
triangles.forEach((tri) => {
|
|
48540
49069
|
for (let j = 0; j < 3; j++) {
|
|
48541
49070
|
const a = tri[j],
|
|
48542
49071
|
b = tri[(j + 1) % 3];
|
|
@@ -48572,7 +49101,7 @@ void main() {
|
|
|
48572
49101
|
m,
|
|
48573
49102
|
cartesianCross(m, c),
|
|
48574
49103
|
cartesianCross(cartesianCross(m, c), c),
|
|
48575
|
-
cartesianCross(cartesianCross(cartesianCross(m, c), c), c)
|
|
49104
|
+
cartesianCross(cartesianCross(cartesianCross(m, c), c), c),
|
|
48576
49105
|
]
|
|
48577
49106
|
.map(spherical)
|
|
48578
49107
|
.map(supplement);
|
|
@@ -48595,7 +49124,7 @@ void main() {
|
|
|
48595
49124
|
});
|
|
48596
49125
|
|
|
48597
49126
|
// reorder each polygon
|
|
48598
|
-
const reordered = polygons.map(poly => {
|
|
49127
|
+
const reordered = polygons.map((poly) => {
|
|
48599
49128
|
const p = [poly[0][2]]; // t
|
|
48600
49129
|
let k = poly[0][1]; // k = c
|
|
48601
49130
|
for (let i = 1; i < poly.length; i++) {
|
|
@@ -48645,12 +49174,12 @@ void main() {
|
|
|
48645
49174
|
b = cartesian(b);
|
|
48646
49175
|
c = cartesian(c);
|
|
48647
49176
|
const s = sign(cartesianDot(cartesianCross(b, a), c));
|
|
48648
|
-
return spherical(cartesianNormalize(cartesianAdd(a, b)).map(d => s * d));
|
|
49177
|
+
return spherical(cartesianNormalize(cartesianAdd(a, b)).map((d) => s * d));
|
|
48649
49178
|
}
|
|
48650
49179
|
|
|
48651
49180
|
function geo_mesh(polygons) {
|
|
48652
49181
|
const mesh = [];
|
|
48653
|
-
polygons.forEach(poly => {
|
|
49182
|
+
polygons.forEach((poly) => {
|
|
48654
49183
|
if (!poly) return;
|
|
48655
49184
|
let p = poly[poly.length - 1];
|
|
48656
49185
|
for (let q of poly) {
|
|
@@ -48662,7 +49191,7 @@ void main() {
|
|
|
48662
49191
|
}
|
|
48663
49192
|
|
|
48664
49193
|
function geo_urquhart(edges, triangles) {
|
|
48665
|
-
return function(distances) {
|
|
49194
|
+
return function (distances) {
|
|
48666
49195
|
const _lengths = new Map(),
|
|
48667
49196
|
_urquhart = new Map();
|
|
48668
49197
|
edges.forEach((edge, i) => {
|
|
@@ -48671,7 +49200,7 @@ void main() {
|
|
|
48671
49200
|
_urquhart.set(u, true);
|
|
48672
49201
|
});
|
|
48673
49202
|
|
|
48674
|
-
triangles.forEach(tri => {
|
|
49203
|
+
triangles.forEach((tri) => {
|
|
48675
49204
|
let l = 0,
|
|
48676
49205
|
remove = -1;
|
|
48677
49206
|
for (let j = 0; j < 3; j++) {
|
|
@@ -48681,18 +49210,19 @@ void main() {
|
|
|
48681
49210
|
remove = u;
|
|
48682
49211
|
}
|
|
48683
49212
|
}
|
|
48684
|
-
_urquhart.set(remove,
|
|
49213
|
+
_urquhart.set(remove, false);
|
|
48685
49214
|
});
|
|
48686
49215
|
|
|
48687
|
-
return edges.map(edge => _urquhart.get(edge.join("-")));
|
|
49216
|
+
return edges.map((edge) => _urquhart.get(edge.join("-")));
|
|
48688
49217
|
};
|
|
48689
49218
|
}
|
|
48690
49219
|
|
|
48691
49220
|
function geo_hull(triangles, points) {
|
|
48692
49221
|
const _hull = new Set(),
|
|
48693
49222
|
hull = [];
|
|
48694
|
-
triangles.map(tri => {
|
|
48695
|
-
if (excess(tri.map(i => points[i > points.length ? 0 : i])) > 1e-12)
|
|
49223
|
+
triangles.map((tri) => {
|
|
49224
|
+
if (excess(tri.map((i) => points[i > points.length ? 0 : i])) > 1e-12)
|
|
49225
|
+
return;
|
|
48696
49226
|
for (let i = 0; i < 3; i++) {
|
|
48697
49227
|
let e = [tri[i], tri[(i + 1) % 3]],
|
|
48698
49228
|
code = `${e[0]}-${e[1]}`;
|
|
@@ -48701,11 +49231,11 @@ void main() {
|
|
|
48701
49231
|
}
|
|
48702
49232
|
});
|
|
48703
49233
|
|
|
48704
|
-
const _index = new Map;
|
|
49234
|
+
const _index = new Map();
|
|
48705
49235
|
let start;
|
|
48706
|
-
_hull.forEach(e => {
|
|
49236
|
+
_hull.forEach((e) => {
|
|
48707
49237
|
e = e.split("-").map(Number);
|
|
48708
|
-
_index.set(e[0],e[1]);
|
|
49238
|
+
_index.set(e[0], e[1]);
|
|
48709
49239
|
start = e[0];
|
|
48710
49240
|
});
|
|
48711
49241
|
|
|
@@ -48723,7 +49253,7 @@ void main() {
|
|
|
48723
49253
|
}
|
|
48724
49254
|
|
|
48725
49255
|
function geoVoronoi(data) {
|
|
48726
|
-
const v = function(data) {
|
|
49256
|
+
const v = function (data) {
|
|
48727
49257
|
v.delaunay = null;
|
|
48728
49258
|
v._data = data;
|
|
48729
49259
|
|
|
@@ -48732,40 +49262,40 @@ void main() {
|
|
|
48732
49262
|
}
|
|
48733
49263
|
if (typeof v._data === "object") {
|
|
48734
49264
|
const temp = v._data
|
|
48735
|
-
.map(d => [v._vx(d), v._vy(d), d])
|
|
48736
|
-
.filter(d => isFinite(d[0] + d[1]));
|
|
48737
|
-
v.points = temp.map(d => [d[0], d[1]]);
|
|
48738
|
-
v.valid = temp.map(d => d[2]);
|
|
49265
|
+
.map((d) => [v._vx(d), v._vy(d), d])
|
|
49266
|
+
.filter((d) => isFinite(d[0] + d[1]));
|
|
49267
|
+
v.points = temp.map((d) => [d[0], d[1]]);
|
|
49268
|
+
v.valid = temp.map((d) => d[2]);
|
|
48739
49269
|
v.delaunay = geoDelaunay(v.points);
|
|
48740
49270
|
}
|
|
48741
49271
|
return v;
|
|
48742
49272
|
};
|
|
48743
49273
|
|
|
48744
|
-
v._vx = function(d) {
|
|
49274
|
+
v._vx = function (d) {
|
|
48745
49275
|
if (typeof d == "object" && "type" in d) {
|
|
48746
49276
|
return geoCentroid(d)[0];
|
|
48747
49277
|
}
|
|
48748
49278
|
if (0 in d) return d[0];
|
|
48749
49279
|
};
|
|
48750
|
-
v._vy = function(d) {
|
|
49280
|
+
v._vy = function (d) {
|
|
48751
49281
|
if (typeof d == "object" && "type" in d) {
|
|
48752
49282
|
return geoCentroid(d)[1];
|
|
48753
49283
|
}
|
|
48754
49284
|
if (1 in d) return d[1];
|
|
48755
49285
|
};
|
|
48756
49286
|
|
|
48757
|
-
v.x = function(f) {
|
|
49287
|
+
v.x = function (f) {
|
|
48758
49288
|
if (!f) return v._vx;
|
|
48759
49289
|
v._vx = f;
|
|
48760
49290
|
return v;
|
|
48761
49291
|
};
|
|
48762
|
-
v.y = function(f) {
|
|
49292
|
+
v.y = function (f) {
|
|
48763
49293
|
if (!f) return v._vy;
|
|
48764
49294
|
v._vy = f;
|
|
48765
49295
|
return v;
|
|
48766
49296
|
};
|
|
48767
49297
|
|
|
48768
|
-
v.polygons = function(data) {
|
|
49298
|
+
v.polygons = function (data) {
|
|
48769
49299
|
if (data !== undefined) {
|
|
48770
49300
|
v(data);
|
|
48771
49301
|
}
|
|
@@ -48773,7 +49303,7 @@ void main() {
|
|
|
48773
49303
|
if (!v.delaunay) return false;
|
|
48774
49304
|
const coll = {
|
|
48775
49305
|
type: "FeatureCollection",
|
|
48776
|
-
features: []
|
|
49306
|
+
features: [],
|
|
48777
49307
|
};
|
|
48778
49308
|
if (v.valid.length === 0) return coll;
|
|
48779
49309
|
v.delaunay.polygons.forEach((poly, i) =>
|
|
@@ -48783,13 +49313,15 @@ void main() {
|
|
|
48783
49313
|
? null
|
|
48784
49314
|
: {
|
|
48785
49315
|
type: "Polygon",
|
|
48786
|
-
coordinates: [
|
|
49316
|
+
coordinates: [
|
|
49317
|
+
[...poly, poly[0]].map((i) => v.delaunay.centers[i]),
|
|
49318
|
+
],
|
|
48787
49319
|
},
|
|
48788
49320
|
properties: {
|
|
48789
49321
|
site: v.valid[i],
|
|
48790
49322
|
sitecoordinates: v.points[i],
|
|
48791
|
-
neighbours: v.delaunay.neighbors[i] // not part of the public API
|
|
48792
|
-
}
|
|
49323
|
+
neighbours: v.delaunay.neighbors[i], // not part of the public API
|
|
49324
|
+
},
|
|
48793
49325
|
})
|
|
48794
49326
|
);
|
|
48795
49327
|
if (v.valid.length === 1)
|
|
@@ -48799,13 +49331,13 @@ void main() {
|
|
|
48799
49331
|
properties: {
|
|
48800
49332
|
site: v.valid[0],
|
|
48801
49333
|
sitecoordinates: v.points[0],
|
|
48802
|
-
neighbours: []
|
|
48803
|
-
}
|
|
49334
|
+
neighbours: [],
|
|
49335
|
+
},
|
|
48804
49336
|
});
|
|
48805
49337
|
return coll;
|
|
48806
49338
|
};
|
|
48807
49339
|
|
|
48808
|
-
v.triangles = function(data) {
|
|
49340
|
+
v.triangles = function (data) {
|
|
48809
49341
|
if (data !== undefined) {
|
|
48810
49342
|
v(data);
|
|
48811
49343
|
}
|
|
@@ -48815,30 +49347,30 @@ void main() {
|
|
|
48815
49347
|
type: "FeatureCollection",
|
|
48816
49348
|
features: v.delaunay.triangles
|
|
48817
49349
|
.map((tri, index) => {
|
|
48818
|
-
tri = tri.map(i => v.points[i]);
|
|
49350
|
+
tri = tri.map((i) => v.points[i]);
|
|
48819
49351
|
tri.center = v.delaunay.centers[index];
|
|
48820
49352
|
return tri;
|
|
48821
49353
|
})
|
|
48822
|
-
.filter(tri => excess(tri) > 0)
|
|
48823
|
-
.map(tri => ({
|
|
49354
|
+
.filter((tri) => excess(tri) > 0)
|
|
49355
|
+
.map((tri) => ({
|
|
48824
49356
|
type: "Feature",
|
|
48825
49357
|
properties: {
|
|
48826
|
-
circumcenter: tri.center
|
|
49358
|
+
circumcenter: tri.center,
|
|
48827
49359
|
},
|
|
48828
49360
|
geometry: {
|
|
48829
49361
|
type: "Polygon",
|
|
48830
|
-
coordinates: [[...tri, tri[0]]]
|
|
48831
|
-
}
|
|
48832
|
-
}))
|
|
49362
|
+
coordinates: [[...tri, tri[0]]],
|
|
49363
|
+
},
|
|
49364
|
+
})),
|
|
48833
49365
|
};
|
|
48834
49366
|
};
|
|
48835
49367
|
|
|
48836
|
-
v.links = function(data) {
|
|
49368
|
+
v.links = function (data) {
|
|
48837
49369
|
if (data !== undefined) {
|
|
48838
49370
|
v(data);
|
|
48839
49371
|
}
|
|
48840
49372
|
if (!v.delaunay) return false;
|
|
48841
|
-
const _distances = v.delaunay.edges.map(e =>
|
|
49373
|
+
const _distances = v.delaunay.edges.map((e) =>
|
|
48842
49374
|
geoDistance$1(v.points[e[0]], v.points[e[1]])
|
|
48843
49375
|
),
|
|
48844
49376
|
_urquart = v.delaunay.urquhart(_distances);
|
|
@@ -48850,28 +49382,31 @@ void main() {
|
|
|
48850
49382
|
source: v.valid[e[0]],
|
|
48851
49383
|
target: v.valid[e[1]],
|
|
48852
49384
|
length: _distances[i],
|
|
48853
|
-
urquhart: !!_urquart[i]
|
|
49385
|
+
urquhart: !!_urquart[i],
|
|
48854
49386
|
},
|
|
48855
49387
|
geometry: {
|
|
48856
49388
|
type: "LineString",
|
|
48857
|
-
coordinates: [v.points[e[0]], v.points[e[1]]]
|
|
48858
|
-
}
|
|
48859
|
-
}))
|
|
49389
|
+
coordinates: [v.points[e[0]], v.points[e[1]]],
|
|
49390
|
+
},
|
|
49391
|
+
})),
|
|
48860
49392
|
};
|
|
48861
49393
|
};
|
|
48862
49394
|
|
|
48863
|
-
v.mesh = function(data) {
|
|
49395
|
+
v.mesh = function (data) {
|
|
48864
49396
|
if (data !== undefined) {
|
|
48865
49397
|
v(data);
|
|
48866
49398
|
}
|
|
48867
49399
|
if (!v.delaunay) return false;
|
|
48868
49400
|
return {
|
|
48869
49401
|
type: "MultiLineString",
|
|
48870
|
-
coordinates: v.delaunay.edges.map(e => [
|
|
49402
|
+
coordinates: v.delaunay.edges.map((e) => [
|
|
49403
|
+
v.points[e[0]],
|
|
49404
|
+
v.points[e[1]],
|
|
49405
|
+
]),
|
|
48871
49406
|
};
|
|
48872
49407
|
};
|
|
48873
49408
|
|
|
48874
|
-
v.cellMesh = function(data) {
|
|
49409
|
+
v.cellMesh = function (data) {
|
|
48875
49410
|
if (data !== undefined) {
|
|
48876
49411
|
v(data);
|
|
48877
49412
|
}
|
|
@@ -48892,18 +49427,18 @@ void main() {
|
|
|
48892
49427
|
}
|
|
48893
49428
|
return {
|
|
48894
49429
|
type: "MultiLineString",
|
|
48895
|
-
coordinates
|
|
49430
|
+
coordinates,
|
|
48896
49431
|
};
|
|
48897
49432
|
};
|
|
48898
49433
|
|
|
48899
49434
|
v._found = undefined;
|
|
48900
|
-
v.find = function(x, y, radius) {
|
|
49435
|
+
v.find = function (x, y, radius) {
|
|
48901
49436
|
v._found = v.delaunay.find(x, y, v._found);
|
|
48902
49437
|
if (!radius || geoDistance$1([x, y], v.points[v._found]) < radius)
|
|
48903
49438
|
return v._found;
|
|
48904
49439
|
};
|
|
48905
49440
|
|
|
48906
|
-
v.hull = function(data) {
|
|
49441
|
+
v.hull = function (data) {
|
|
48907
49442
|
if (data !== undefined) {
|
|
48908
49443
|
v(data);
|
|
48909
49444
|
}
|
|
@@ -48913,7 +49448,7 @@ void main() {
|
|
|
48913
49448
|
? null
|
|
48914
49449
|
: {
|
|
48915
49450
|
type: "Polygon",
|
|
48916
|
-
coordinates: [[...hull.map(i => points[i]), points[hull[0]]]]
|
|
49451
|
+
coordinates: [[...hull.map((i) => points[i]), points[hull[0]]]],
|
|
48917
49452
|
};
|
|
48918
49453
|
};
|
|
48919
49454
|
|
|
@@ -65329,7 +65864,7 @@ void main() {
|
|
|
65329
65864
|
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
65330
65865
|
|
|
65331
65866
|
#include <tonemapping_fragment>
|
|
65332
|
-
#include <
|
|
65867
|
+
#include <colorspace_fragment>
|
|
65333
65868
|
#include <fog_fragment>
|
|
65334
65869
|
#include <premultiplied_alpha_fragment>
|
|
65335
65870
|
|
|
@@ -65933,9 +66468,46 @@ void main() {
|
|
|
65933
66468
|
|
|
65934
66469
|
}
|
|
65935
66470
|
|
|
66471
|
+
function _arrayLikeToArray$1(r, a) {
|
|
66472
|
+
(null == a || a > r.length) && (a = r.length);
|
|
66473
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
66474
|
+
return n;
|
|
66475
|
+
}
|
|
66476
|
+
function _arrayWithHoles$1(r) {
|
|
66477
|
+
if (Array.isArray(r)) return r;
|
|
66478
|
+
}
|
|
66479
|
+
function _arrayWithoutHoles$1(r) {
|
|
66480
|
+
if (Array.isArray(r)) return _arrayLikeToArray$1(r);
|
|
66481
|
+
}
|
|
66482
|
+
function _assertClassBrand(e, t, n) {
|
|
66483
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
66484
|
+
throw new TypeError("Private element is not present on this object");
|
|
66485
|
+
}
|
|
66486
|
+
function _assertThisInitialized$1(e) {
|
|
66487
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
66488
|
+
return e;
|
|
66489
|
+
}
|
|
65936
66490
|
function _callSuper(t, o, e) {
|
|
65937
66491
|
return o = _getPrototypeOf$1(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf$1(t).constructor) : o.apply(t, e));
|
|
65938
66492
|
}
|
|
66493
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
66494
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
66495
|
+
}
|
|
66496
|
+
function _classCallCheck(a, n) {
|
|
66497
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
66498
|
+
}
|
|
66499
|
+
function _classPrivateFieldGet2(s, a) {
|
|
66500
|
+
return s.get(_assertClassBrand(s, a));
|
|
66501
|
+
}
|
|
66502
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
66503
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
66504
|
+
}
|
|
66505
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
66506
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
66507
|
+
}
|
|
66508
|
+
function _classPrivateMethodInitSpec(e, a) {
|
|
66509
|
+
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
66510
|
+
}
|
|
65939
66511
|
function _construct$1(t, e, r) {
|
|
65940
66512
|
if (_isNativeReflectConstruct$1()) return Reflect.construct.apply(null, arguments);
|
|
65941
66513
|
var o = [null];
|
|
@@ -65943,6 +66515,42 @@ void main() {
|
|
|
65943
66515
|
var p = new (t.bind.apply(t, o))();
|
|
65944
66516
|
return p;
|
|
65945
66517
|
}
|
|
66518
|
+
function _defineProperties(e, r) {
|
|
66519
|
+
for (var t = 0; t < r.length; t++) {
|
|
66520
|
+
var o = r[t];
|
|
66521
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
|
|
66522
|
+
}
|
|
66523
|
+
}
|
|
66524
|
+
function _createClass(e, r, t) {
|
|
66525
|
+
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
66526
|
+
writable: !1
|
|
66527
|
+
}), e;
|
|
66528
|
+
}
|
|
66529
|
+
function _defineProperty$1(e, r, t) {
|
|
66530
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
66531
|
+
value: t,
|
|
66532
|
+
enumerable: !0,
|
|
66533
|
+
configurable: !0,
|
|
66534
|
+
writable: !0
|
|
66535
|
+
}) : e[r] = t, e;
|
|
66536
|
+
}
|
|
66537
|
+
function _getPrototypeOf$1(t) {
|
|
66538
|
+
return _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
66539
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
66540
|
+
}, _getPrototypeOf$1(t);
|
|
66541
|
+
}
|
|
66542
|
+
function _inherits(t, e) {
|
|
66543
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
66544
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
66545
|
+
constructor: {
|
|
66546
|
+
value: t,
|
|
66547
|
+
writable: !0,
|
|
66548
|
+
configurable: !0
|
|
66549
|
+
}
|
|
66550
|
+
}), Object.defineProperty(t, "prototype", {
|
|
66551
|
+
writable: !1
|
|
66552
|
+
}), e && _setPrototypeOf$1(t, e);
|
|
66553
|
+
}
|
|
65946
66554
|
function _isNativeReflectConstruct$1() {
|
|
65947
66555
|
try {
|
|
65948
66556
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
@@ -65951,6 +66559,9 @@ void main() {
|
|
|
65951
66559
|
return !!t;
|
|
65952
66560
|
})();
|
|
65953
66561
|
}
|
|
66562
|
+
function _iterableToArray$1(r) {
|
|
66563
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
66564
|
+
}
|
|
65954
66565
|
function _iterableToArrayLimit$1(r, l) {
|
|
65955
66566
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
65956
66567
|
if (null != t) {
|
|
@@ -65978,6 +66589,12 @@ void main() {
|
|
|
65978
66589
|
return a;
|
|
65979
66590
|
}
|
|
65980
66591
|
}
|
|
66592
|
+
function _nonIterableRest$1() {
|
|
66593
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
66594
|
+
}
|
|
66595
|
+
function _nonIterableSpread$1() {
|
|
66596
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
66597
|
+
}
|
|
65981
66598
|
function ownKeys(e, r) {
|
|
65982
66599
|
var t = Object.keys(e);
|
|
65983
66600
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -65999,209 +66616,63 @@ void main() {
|
|
|
65999
66616
|
}
|
|
66000
66617
|
return e;
|
|
66001
66618
|
}
|
|
66002
|
-
function
|
|
66003
|
-
if (
|
|
66004
|
-
var
|
|
66005
|
-
|
|
66006
|
-
|
|
66007
|
-
if ("object" != typeof i) return i;
|
|
66008
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
66009
|
-
}
|
|
66010
|
-
return (String )(t);
|
|
66011
|
-
}
|
|
66012
|
-
function _toPropertyKey$1(t) {
|
|
66013
|
-
var i = _toPrimitive$1(t, "string");
|
|
66014
|
-
return "symbol" == typeof i ? i : String(i);
|
|
66015
|
-
}
|
|
66016
|
-
function _classCallCheck(instance, Constructor) {
|
|
66017
|
-
if (!(instance instanceof Constructor)) {
|
|
66018
|
-
throw new TypeError("Cannot call a class as a function");
|
|
66019
|
-
}
|
|
66020
|
-
}
|
|
66021
|
-
function _defineProperties(target, props) {
|
|
66022
|
-
for (var i = 0; i < props.length; i++) {
|
|
66023
|
-
var descriptor = props[i];
|
|
66024
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
66025
|
-
descriptor.configurable = true;
|
|
66026
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
66027
|
-
Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
|
|
66028
|
-
}
|
|
66029
|
-
}
|
|
66030
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
66031
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
66032
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
66033
|
-
writable: false
|
|
66034
|
-
});
|
|
66035
|
-
return Constructor;
|
|
66036
|
-
}
|
|
66037
|
-
function _defineProperty$1(obj, key, value) {
|
|
66038
|
-
key = _toPropertyKey$1(key);
|
|
66039
|
-
if (key in obj) {
|
|
66040
|
-
Object.defineProperty(obj, key, {
|
|
66041
|
-
value: value,
|
|
66042
|
-
enumerable: true,
|
|
66043
|
-
configurable: true,
|
|
66044
|
-
writable: true
|
|
66045
|
-
});
|
|
66046
|
-
} else {
|
|
66047
|
-
obj[key] = value;
|
|
66048
|
-
}
|
|
66049
|
-
return obj;
|
|
66050
|
-
}
|
|
66051
|
-
function _inherits(subClass, superClass) {
|
|
66052
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
66053
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
66054
|
-
}
|
|
66055
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
66056
|
-
constructor: {
|
|
66057
|
-
value: subClass,
|
|
66058
|
-
writable: true,
|
|
66059
|
-
configurable: true
|
|
66060
|
-
}
|
|
66061
|
-
});
|
|
66062
|
-
Object.defineProperty(subClass, "prototype", {
|
|
66063
|
-
writable: false
|
|
66064
|
-
});
|
|
66065
|
-
if (superClass) _setPrototypeOf$1(subClass, superClass);
|
|
66066
|
-
}
|
|
66067
|
-
function _getPrototypeOf$1(o) {
|
|
66068
|
-
_getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
66069
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
66070
|
-
};
|
|
66071
|
-
return _getPrototypeOf$1(o);
|
|
66072
|
-
}
|
|
66073
|
-
function _setPrototypeOf$1(o, p) {
|
|
66074
|
-
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
66075
|
-
o.__proto__ = p;
|
|
66076
|
-
return o;
|
|
66077
|
-
};
|
|
66078
|
-
return _setPrototypeOf$1(o, p);
|
|
66079
|
-
}
|
|
66080
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
66081
|
-
if (source == null) return {};
|
|
66082
|
-
var target = {};
|
|
66083
|
-
var sourceKeys = Object.keys(source);
|
|
66084
|
-
var key, i;
|
|
66085
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
66086
|
-
key = sourceKeys[i];
|
|
66087
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
66088
|
-
target[key] = source[key];
|
|
66089
|
-
}
|
|
66090
|
-
return target;
|
|
66091
|
-
}
|
|
66092
|
-
function _objectWithoutProperties(source, excluded) {
|
|
66093
|
-
if (source == null) return {};
|
|
66094
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
66095
|
-
var key, i;
|
|
66619
|
+
function _objectWithoutProperties(e, t) {
|
|
66620
|
+
if (null == e) return {};
|
|
66621
|
+
var o,
|
|
66622
|
+
r,
|
|
66623
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
66096
66624
|
if (Object.getOwnPropertySymbols) {
|
|
66097
|
-
var
|
|
66098
|
-
for (
|
|
66099
|
-
key = sourceSymbolKeys[i];
|
|
66100
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
66101
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
66102
|
-
target[key] = source[key];
|
|
66103
|
-
}
|
|
66625
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
66626
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
66104
66627
|
}
|
|
66105
|
-
return
|
|
66106
|
-
}
|
|
66107
|
-
function
|
|
66108
|
-
if (
|
|
66109
|
-
|
|
66628
|
+
return i;
|
|
66629
|
+
}
|
|
66630
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
66631
|
+
if (null == r) return {};
|
|
66632
|
+
var t = {};
|
|
66633
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
66634
|
+
if (e.indexOf(n) >= 0) continue;
|
|
66635
|
+
t[n] = r[n];
|
|
66110
66636
|
}
|
|
66111
|
-
return
|
|
66112
|
-
}
|
|
66113
|
-
function _possibleConstructorReturn(self, call) {
|
|
66114
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
66115
|
-
return call;
|
|
66116
|
-
} else if (call !== void 0) {
|
|
66117
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
66118
|
-
}
|
|
66119
|
-
return _assertThisInitialized$1(self);
|
|
66120
|
-
}
|
|
66121
|
-
function _slicedToArray$1(arr, i) {
|
|
66122
|
-
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
66123
|
-
}
|
|
66124
|
-
function _toConsumableArray$1(arr) {
|
|
66125
|
-
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
|
|
66126
|
-
}
|
|
66127
|
-
function _arrayWithoutHoles$1(arr) {
|
|
66128
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
|
|
66129
|
-
}
|
|
66130
|
-
function _arrayWithHoles$1(arr) {
|
|
66131
|
-
if (Array.isArray(arr)) return arr;
|
|
66132
|
-
}
|
|
66133
|
-
function _iterableToArray$1(iter) {
|
|
66134
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
66135
|
-
}
|
|
66136
|
-
function _unsupportedIterableToArray$1(o, minLen) {
|
|
66137
|
-
if (!o) return;
|
|
66138
|
-
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
66139
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
66140
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
66141
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
66142
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
66143
|
-
}
|
|
66144
|
-
function _arrayLikeToArray$1(arr, len) {
|
|
66145
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
66146
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
66147
|
-
return arr2;
|
|
66637
|
+
return t;
|
|
66148
66638
|
}
|
|
66149
|
-
function
|
|
66150
|
-
|
|
66639
|
+
function _possibleConstructorReturn(t, e) {
|
|
66640
|
+
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
66641
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
66642
|
+
return _assertThisInitialized$1(t);
|
|
66151
66643
|
}
|
|
66152
|
-
function
|
|
66153
|
-
|
|
66154
|
-
|
|
66155
|
-
|
|
66156
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
66157
|
-
return _classApplyDescriptorGet(receiver, descriptor);
|
|
66644
|
+
function _setPrototypeOf$1(t, e) {
|
|
66645
|
+
return _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
66646
|
+
return t.__proto__ = e, t;
|
|
66647
|
+
}, _setPrototypeOf$1(t, e);
|
|
66158
66648
|
}
|
|
66159
|
-
function
|
|
66160
|
-
|
|
66161
|
-
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
66162
|
-
return value;
|
|
66649
|
+
function _slicedToArray$1(r, e) {
|
|
66650
|
+
return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
|
|
66163
66651
|
}
|
|
66164
|
-
function
|
|
66165
|
-
|
|
66166
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
66167
|
-
}
|
|
66168
|
-
return privateMap.get(receiver);
|
|
66652
|
+
function _toConsumableArray$1(r) {
|
|
66653
|
+
return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1();
|
|
66169
66654
|
}
|
|
66170
|
-
function
|
|
66171
|
-
if (
|
|
66172
|
-
|
|
66173
|
-
|
|
66174
|
-
|
|
66175
|
-
|
|
66176
|
-
|
|
66177
|
-
if (descriptor.set) {
|
|
66178
|
-
descriptor.set.call(receiver, value);
|
|
66179
|
-
} else {
|
|
66180
|
-
if (!descriptor.writable) {
|
|
66181
|
-
throw new TypeError("attempted to set read only private field");
|
|
66182
|
-
}
|
|
66183
|
-
descriptor.value = value;
|
|
66655
|
+
function _toPrimitive$1(t, r) {
|
|
66656
|
+
if ("object" != typeof t || !t) return t;
|
|
66657
|
+
var e = t[Symbol.toPrimitive];
|
|
66658
|
+
if (void 0 !== e) {
|
|
66659
|
+
var i = e.call(t, r || "default");
|
|
66660
|
+
if ("object" != typeof i) return i;
|
|
66661
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
66184
66662
|
}
|
|
66663
|
+
return ("string" === r ? String : Number)(t);
|
|
66185
66664
|
}
|
|
66186
|
-
function
|
|
66187
|
-
|
|
66188
|
-
|
|
66189
|
-
}
|
|
66190
|
-
return fn;
|
|
66665
|
+
function _toPropertyKey$1(t) {
|
|
66666
|
+
var i = _toPrimitive$1(t, "string");
|
|
66667
|
+
return "symbol" == typeof i ? i : i + "";
|
|
66191
66668
|
}
|
|
66192
|
-
function
|
|
66193
|
-
if (
|
|
66194
|
-
|
|
66669
|
+
function _unsupportedIterableToArray$1(r, a) {
|
|
66670
|
+
if (r) {
|
|
66671
|
+
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
66672
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
66673
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
|
|
66195
66674
|
}
|
|
66196
66675
|
}
|
|
66197
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
66198
|
-
_checkPrivateRedeclaration(obj, privateMap);
|
|
66199
|
-
privateMap.set(obj, value);
|
|
66200
|
-
}
|
|
66201
|
-
function _classPrivateMethodInitSpec(obj, privateSet) {
|
|
66202
|
-
_checkPrivateRedeclaration(obj, privateSet);
|
|
66203
|
-
privateSet.add(obj);
|
|
66204
|
-
}
|
|
66205
66676
|
|
|
66206
66677
|
var materialDispose = function materialDispose(material) {
|
|
66207
66678
|
if (material instanceof Array) {
|
|
@@ -67432,45 +67903,35 @@ void main() {
|
|
|
67432
67903
|
var RES_BW_FACTOR = 3.5; // divider of bandwidth to use in geometry resolution
|
|
67433
67904
|
var MIN_RESOLUTION = 0.1; // degrees
|
|
67434
67905
|
var BW_RADIUS_INFLUENCE = 3.5; // multiplier of bandwidth to use in octree for max radius of point influence
|
|
67435
|
-
var
|
|
67906
|
+
var _PointsOctree_brand = /*#__PURE__*/new WeakSet();
|
|
67436
67907
|
var _points = /*#__PURE__*/new WeakMap();
|
|
67437
67908
|
var _pntOctree = /*#__PURE__*/new WeakMap();
|
|
67438
67909
|
var _distance = /*#__PURE__*/new WeakMap();
|
|
67439
67910
|
var PointsOctree = /*#__PURE__*/function () {
|
|
67440
67911
|
function PointsOctree(points, neighborhoodAngularDistance) {
|
|
67441
67912
|
_classCallCheck(this, PointsOctree);
|
|
67442
|
-
_classPrivateMethodInitSpec(this,
|
|
67443
|
-
_classPrivateFieldInitSpec(this, _points,
|
|
67444
|
-
|
|
67445
|
-
|
|
67446
|
-
|
|
67447
|
-
|
|
67448
|
-
|
|
67449
|
-
value: void 0
|
|
67450
|
-
});
|
|
67451
|
-
_classPrivateFieldInitSpec(this, _distance, {
|
|
67452
|
-
writable: true,
|
|
67453
|
-
value: void 0
|
|
67454
|
-
});
|
|
67455
|
-
_classPrivateFieldSet(this, _points, points);
|
|
67456
|
-
_classPrivateFieldSet(this, _pntOctree, yaOctree());
|
|
67457
|
-
_classPrivateFieldGet(this, _pntOctree).init(points.map(function (d) {
|
|
67913
|
+
_classPrivateMethodInitSpec(this, _PointsOctree_brand);
|
|
67914
|
+
_classPrivateFieldInitSpec(this, _points, void 0);
|
|
67915
|
+
_classPrivateFieldInitSpec(this, _pntOctree, void 0);
|
|
67916
|
+
_classPrivateFieldInitSpec(this, _distance, void 0);
|
|
67917
|
+
_classPrivateFieldSet2(_points, this, points);
|
|
67918
|
+
_classPrivateFieldSet2(_pntOctree, this, yaOctree());
|
|
67919
|
+
_classPrivateFieldGet2(_pntOctree, this).init(points.map(function (d) {
|
|
67458
67920
|
return [d.x, d.y, d.z];
|
|
67459
67921
|
}).flat());
|
|
67460
|
-
|
|
67922
|
+
_classPrivateFieldSet2(_distance, this, _assertClassBrand(_PointsOctree_brand, this, _getDistance).call(this, polar2Cartesian(0, 0), polar2Cartesian(0, Math.min(180, neighborhoodAngularDistance))));
|
|
67461
67923
|
}
|
|
67462
|
-
_createClass(PointsOctree, [{
|
|
67924
|
+
return _createClass(PointsOctree, [{
|
|
67463
67925
|
key: "getNearPoints",
|
|
67464
67926
|
value: function getNearPoints(x, y, z) {
|
|
67465
67927
|
var _this = this;
|
|
67466
|
-
return
|
|
67467
|
-
return
|
|
67928
|
+
return _classPrivateFieldGet2(_pntOctree, this).intersectSphere(x, y, z, _classPrivateFieldGet2(_distance, this)).map(function (idx) {
|
|
67929
|
+
return _classPrivateFieldGet2(_points, _this)[idx / 3];
|
|
67468
67930
|
});
|
|
67469
67931
|
}
|
|
67470
67932
|
}]);
|
|
67471
|
-
return PointsOctree;
|
|
67472
67933
|
}();
|
|
67473
|
-
function
|
|
67934
|
+
function _getDistance(a, b) {
|
|
67474
67935
|
return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2) + Math.pow(a.z - b.z, 2));
|
|
67475
67936
|
}
|
|
67476
67937
|
var defaultColorInterpolator = function defaultColorInterpolator(t) {
|
|
@@ -68803,6 +69264,7 @@ void main() {
|
|
|
68803
69264
|
textObj.geometry = new THREE$5.TextGeometry(textAccessor(d), {
|
|
68804
69265
|
font: state.font,
|
|
68805
69266
|
size: textHeight,
|
|
69267
|
+
depth: 0,
|
|
68806
69268
|
height: 0,
|
|
68807
69269
|
curveSegments: state.labelResolution
|
|
68808
69270
|
});
|
|
@@ -68874,7 +69336,6 @@ void main() {
|
|
|
68874
69336
|
BufferGeometry: BufferGeometry
|
|
68875
69337
|
};
|
|
68876
69338
|
var CircleLineGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
|
|
68877
|
-
_inherits(CircleLineGeometry, _THREE$BufferGeometry);
|
|
68878
69339
|
function CircleLineGeometry() {
|
|
68879
69340
|
var _this;
|
|
68880
69341
|
var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
@@ -68898,6 +69359,7 @@ void main() {
|
|
|
68898
69359
|
_this.setFromPoints(points);
|
|
68899
69360
|
return _this;
|
|
68900
69361
|
}
|
|
69362
|
+
_inherits(CircleLineGeometry, _THREE$BufferGeometry);
|
|
68901
69363
|
return _createClass(CircleLineGeometry);
|
|
68902
69364
|
}(THREE$4.BufferGeometry);
|
|
68903
69365
|
|
|
@@ -69556,7 +70018,6 @@ void main() {
|
|
|
69556
70018
|
var baseClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Object;
|
|
69557
70019
|
var initKapsuleWithSelf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
69558
70020
|
var FromKapsule = /*#__PURE__*/function (_baseClass) {
|
|
69559
|
-
_inherits(FromKapsule, _baseClass);
|
|
69560
70021
|
function FromKapsule() {
|
|
69561
70022
|
var _this;
|
|
69562
70023
|
_classCallCheck(this, FromKapsule);
|
|
@@ -69564,9 +70025,10 @@ void main() {
|
|
|
69564
70025
|
args[_key] = arguments[_key];
|
|
69565
70026
|
}
|
|
69566
70027
|
_this = _callSuper(this, FromKapsule, [].concat(args));
|
|
69567
|
-
_this.__kapsuleInstance = kapsule.apply(void 0, args).apply(void 0, [].concat(_toConsumableArray$1(initKapsuleWithSelf ? [
|
|
70028
|
+
_this.__kapsuleInstance = kapsule.apply(void 0, args).apply(void 0, [].concat(_toConsumableArray$1(initKapsuleWithSelf ? [_this] : []), args));
|
|
69568
70029
|
return _this;
|
|
69569
70030
|
}
|
|
70031
|
+
_inherits(FromKapsule, _baseClass);
|
|
69570
70032
|
return _createClass(FromKapsule);
|
|
69571
70033
|
}(baseClass); // attach kapsule props/methods to class prototype
|
|
69572
70034
|
Object.keys(kapsule()).forEach(function (m) {
|
|
@@ -72799,7 +73261,7 @@ void main() {
|
|
|
72799
73261
|
if ( this.clearColor !== null ) {
|
|
72800
73262
|
|
|
72801
73263
|
renderer.getClearColor( this._oldClearColor );
|
|
72802
|
-
renderer.setClearColor( this.clearColor );
|
|
73264
|
+
renderer.setClearColor( this.clearColor, renderer.getClearAlpha() );
|
|
72803
73265
|
|
|
72804
73266
|
}
|
|
72805
73267
|
|
|
@@ -72854,53 +73316,41 @@ void main() {
|
|
|
72854
73316
|
}
|
|
72855
73317
|
|
|
72856
73318
|
function _extends() {
|
|
72857
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
72858
|
-
for (var
|
|
72859
|
-
var
|
|
72860
|
-
for (var
|
|
72861
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
72862
|
-
target[key] = source[key];
|
|
72863
|
-
}
|
|
72864
|
-
}
|
|
73319
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
73320
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
73321
|
+
var t = arguments[e];
|
|
73322
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
72865
73323
|
}
|
|
72866
|
-
return
|
|
72867
|
-
};
|
|
72868
|
-
return _extends.apply(this, arguments);
|
|
73324
|
+
return n;
|
|
73325
|
+
}, _extends.apply(null, arguments);
|
|
72869
73326
|
}
|
|
72870
73327
|
|
|
72871
|
-
function _assertThisInitialized(
|
|
72872
|
-
if (
|
|
72873
|
-
|
|
72874
|
-
}
|
|
72875
|
-
return self;
|
|
73328
|
+
function _assertThisInitialized(e) {
|
|
73329
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
73330
|
+
return e;
|
|
72876
73331
|
}
|
|
72877
73332
|
|
|
72878
|
-
function _setPrototypeOf(
|
|
72879
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function
|
|
72880
|
-
|
|
72881
|
-
|
|
72882
|
-
};
|
|
72883
|
-
return _setPrototypeOf(o, p);
|
|
73333
|
+
function _setPrototypeOf(t, e) {
|
|
73334
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
73335
|
+
return t.__proto__ = e, t;
|
|
73336
|
+
}, _setPrototypeOf(t, e);
|
|
72884
73337
|
}
|
|
72885
73338
|
|
|
72886
|
-
function _inheritsLoose(
|
|
72887
|
-
|
|
72888
|
-
subClass.prototype.constructor = subClass;
|
|
72889
|
-
_setPrototypeOf(subClass, superClass);
|
|
73339
|
+
function _inheritsLoose(t, o) {
|
|
73340
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
72890
73341
|
}
|
|
72891
73342
|
|
|
72892
|
-
function _getPrototypeOf(
|
|
72893
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function
|
|
72894
|
-
return
|
|
72895
|
-
};
|
|
72896
|
-
return _getPrototypeOf(o);
|
|
73343
|
+
function _getPrototypeOf(t) {
|
|
73344
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
73345
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
73346
|
+
}, _getPrototypeOf(t);
|
|
72897
73347
|
}
|
|
72898
73348
|
|
|
72899
|
-
function _isNativeFunction(
|
|
73349
|
+
function _isNativeFunction(t) {
|
|
72900
73350
|
try {
|
|
72901
|
-
return Function.toString.call(
|
|
72902
|
-
} catch (
|
|
72903
|
-
return
|
|
73351
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
73352
|
+
} catch (n) {
|
|
73353
|
+
return "function" == typeof t;
|
|
72904
73354
|
}
|
|
72905
73355
|
}
|
|
72906
73356
|
|
|
@@ -72921,31 +73371,27 @@ void main() {
|
|
|
72921
73371
|
return r && _setPrototypeOf(p, r.prototype), p;
|
|
72922
73372
|
}
|
|
72923
73373
|
|
|
72924
|
-
function _wrapNativeSuper(
|
|
72925
|
-
var
|
|
72926
|
-
_wrapNativeSuper = function _wrapNativeSuper(
|
|
72927
|
-
if (
|
|
72928
|
-
if (typeof
|
|
72929
|
-
|
|
72930
|
-
|
|
72931
|
-
|
|
72932
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
72933
|
-
_cache.set(Class, Wrapper);
|
|
73374
|
+
function _wrapNativeSuper(t) {
|
|
73375
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
73376
|
+
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
73377
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
73378
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
73379
|
+
if (void 0 !== r) {
|
|
73380
|
+
if (r.has(t)) return r.get(t);
|
|
73381
|
+
r.set(t, Wrapper);
|
|
72934
73382
|
}
|
|
72935
73383
|
function Wrapper() {
|
|
72936
|
-
return _construct(
|
|
73384
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
72937
73385
|
}
|
|
72938
|
-
Wrapper.prototype = Object.create(
|
|
73386
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
72939
73387
|
constructor: {
|
|
72940
73388
|
value: Wrapper,
|
|
72941
|
-
enumerable:
|
|
72942
|
-
writable:
|
|
72943
|
-
configurable:
|
|
73389
|
+
enumerable: !1,
|
|
73390
|
+
writable: !0,
|
|
73391
|
+
configurable: !0
|
|
72944
73392
|
}
|
|
72945
|
-
});
|
|
72946
|
-
|
|
72947
|
-
};
|
|
72948
|
-
return _wrapNativeSuper(Class);
|
|
73393
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
73394
|
+
}, _wrapNativeSuper(t);
|
|
72949
73395
|
}
|
|
72950
73396
|
|
|
72951
73397
|
// based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
|