Skip to content

Commit e980664

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into SSRPassChangeInfiniteThickBehaviorPr
2 parents c5a1418 + 51afad9 commit e980664

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+813134
-383
lines changed

build/three.js

+146-68
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
1010
}(this, (function (exports) { 'use strict';
1111

12-
const REVISION = '127dev';
12+
const REVISION = '127';
1313
const MOUSE = {
1414
LEFT: 0,
1515
MIDDLE: 1,
@@ -303,6 +303,14 @@
303303
mapLinear: function (x, a1, a2, b1, b2) {
304304
return b1 + (x - a1) * (b2 - b1) / (a2 - a1);
305305
},
306+
// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
307+
inverseLerp: function (x, y, value) {
308+
if (x !== y) {
309+
return (value - x) / (y - x);
310+
} else {
311+
return 0;
312+
}
313+
},
306314
// https://en.wikipedia.org/wiki/Linear_interpolation
307315
lerp: function (x, y, t) {
308316
return (1 - t) * x + t * y;
@@ -11840,7 +11848,7 @@
1184011848
gl.uniform4fv(this.addr, v);
1184111849
copyArray(cache, v);
1184211850
}
11843-
} // Single matrix (from flat array or MatrixN)
11851+
} // Single matrix (from flat array or THREE.MatrixN)
1184411852

1184511853

1184611854
function setValueM2(gl, v) {
@@ -11889,22 +11897,70 @@
1188911897
gl.uniformMatrix4fv(this.addr, false, mat4array);
1189011898
copyArray(cache, elements);
1189111899
}
11892-
} // Single texture (2D / Cube)
11900+
} // Single integer / boolean
1189311901

1189411902

11895-
function setValueT1(gl, v, textures) {
11903+
function setValueV1i(gl, v) {
1189611904
const cache = this.cache;
11897-
const unit = textures.allocateTextureUnit();
11905+
if (cache[0] === v) return;
11906+
gl.uniform1i(this.addr, v);
11907+
cache[0] = v;
11908+
} // Single integer / boolean vector (from flat array)
1189811909

11899-
if (cache[0] !== unit) {
11900-
gl.uniform1i(this.addr, unit);
11901-
cache[0] = unit;
11902-
}
1190311910

11904-
textures.safeSetTexture2D(v || emptyTexture, unit);
11911+
function setValueV2i(gl, v) {
11912+
const cache = this.cache;
11913+
if (arraysEqual(cache, v)) return;
11914+
gl.uniform2iv(this.addr, v);
11915+
copyArray(cache, v);
1190511916
}
1190611917

11907-
function setValueT2DArray1(gl, v, textures) {
11918+
function setValueV3i(gl, v) {
11919+
const cache = this.cache;
11920+
if (arraysEqual(cache, v)) return;
11921+
gl.uniform3iv(this.addr, v);
11922+
copyArray(cache, v);
11923+
}
11924+
11925+
function setValueV4i(gl, v) {
11926+
const cache = this.cache;
11927+
if (arraysEqual(cache, v)) return;
11928+
gl.uniform4iv(this.addr, v);
11929+
copyArray(cache, v);
11930+
} // Single unsigned integer
11931+
11932+
11933+
function setValueV1ui(gl, v) {
11934+
const cache = this.cache;
11935+
if (cache[0] === v) return;
11936+
gl.uniform1ui(this.addr, v);
11937+
cache[0] = v;
11938+
} // Single unsigned integer vector (from flat array)
11939+
11940+
11941+
function setValueV2ui(gl, v) {
11942+
const cache = this.cache;
11943+
if (arraysEqual(cache, v)) return;
11944+
gl.uniform2uiv(this.addr, v);
11945+
copyArray(cache, v);
11946+
}
11947+
11948+
function setValueV3ui(gl, v) {
11949+
const cache = this.cache;
11950+
if (arraysEqual(cache, v)) return;
11951+
gl.uniform3uiv(this.addr, v);
11952+
copyArray(cache, v);
11953+
}
11954+
11955+
function setValueV4ui(gl, v) {
11956+
const cache = this.cache;
11957+
if (arraysEqual(cache, v)) return;
11958+
gl.uniform4uiv(this.addr, v);
11959+
copyArray(cache, v);
11960+
} // Single texture (2D / Cube)
11961+
11962+
11963+
function setValueT1(gl, v, textures) {
1190811964
const cache = this.cache;
1190911965
const unit = textures.allocateTextureUnit();
1191011966

@@ -11913,7 +11969,7 @@
1191311969
cache[0] = unit;
1191411970
}
1191511971

11916-
textures.setTexture2DArray(v || emptyTexture2dArray, unit);
11972+
textures.safeSetTexture2D(v || emptyTexture, unit);
1191711973
}
1191811974

1191911975
function setValueT3D1(gl, v, textures) {
@@ -11938,43 +11994,18 @@
1193811994
}
1193911995

1194011996
textures.safeSetTextureCube(v || emptyCubeTexture, unit);
11941-
} // Integer / Boolean vectors or arrays thereof (always flat arrays)
11942-
11943-
11944-
function setValueV1i(gl, v) {
11945-
const cache = this.cache;
11946-
if (cache[0] === v) return;
11947-
gl.uniform1i(this.addr, v);
11948-
cache[0] = v;
11949-
}
11950-
11951-
function setValueV2i(gl, v) {
11952-
const cache = this.cache;
11953-
if (arraysEqual(cache, v)) return;
11954-
gl.uniform2iv(this.addr, v);
11955-
copyArray(cache, v);
11956-
}
11957-
11958-
function setValueV3i(gl, v) {
11959-
const cache = this.cache;
11960-
if (arraysEqual(cache, v)) return;
11961-
gl.uniform3iv(this.addr, v);
11962-
copyArray(cache, v);
1196311997
}
1196411998

11965-
function setValueV4i(gl, v) {
11999+
function setValueT2DArray1(gl, v, textures) {
1196612000
const cache = this.cache;
11967-
if (arraysEqual(cache, v)) return;
11968-
gl.uniform4iv(this.addr, v);
11969-
copyArray(cache, v);
11970-
} // uint
12001+
const unit = textures.allocateTextureUnit();
1197112002

12003+
if (cache[0] !== unit) {
12004+
gl.uniform1i(this.addr, unit);
12005+
cache[0] = unit;
12006+
}
1197212007

11973-
function setValueV1ui(gl, v) {
11974-
const cache = this.cache;
11975-
if (cache[0] === v) return;
11976-
gl.uniform1ui(this.addr, v);
11977-
cache[0] = v;
12008+
textures.setTexture2DArray(v || emptyTexture2dArray, unit);
1197812009
} // Helper to pick the right setter for the singular case
1197912010

1198012011

@@ -12032,6 +12063,18 @@
1203212063
return setValueV1ui;
1203312064
// UINT
1203412065

12066+
case 0x8dc6:
12067+
return setValueV2ui;
12068+
// _VEC2
12069+
12070+
case 0x8dc7:
12071+
return setValueV3ui;
12072+
// _VEC3
12073+
12074+
case 0x8dc8:
12075+
return setValueV4ui;
12076+
// _VEC4
12077+
1203512078
case 0x8b5e: // SAMPLER_2D
1203612079

1203712080
case 0x8d66: // SAMPLER_EXTERNAL_OES
@@ -12077,24 +12120,7 @@
1207712120

1207812121
function setValueV1fArray(gl, v) {
1207912122
gl.uniform1fv(this.addr, v);
12080-
} // Integer / Boolean vectors or arrays thereof (always flat arrays)
12081-
12082-
12083-
function setValueV1iArray(gl, v) {
12084-
gl.uniform1iv(this.addr, v);
12085-
}
12086-
12087-
function setValueV2iArray(gl, v) {
12088-
gl.uniform2iv(this.addr, v);
12089-
}
12090-
12091-
function setValueV3iArray(gl, v) {
12092-
gl.uniform3iv(this.addr, v);
12093-
}
12094-
12095-
function setValueV4iArray(gl, v) {
12096-
gl.uniform4iv(this.addr, v);
12097-
} // Array of vectors (flat or from THREE classes)
12123+
} // Array of vectors (from flat array or array of THREE.VectorN)
1209812124

1209912125

1210012126
function setValueV2fArray(gl, v) {
@@ -12110,7 +12136,7 @@
1211012136
function setValueV4fArray(gl, v) {
1211112137
const data = flatten(v, this.size, 4);
1211212138
gl.uniform4fv(this.addr, data);
12113-
} // Array of matrices (flat or from THREE clases)
12139+
} // Array of matrices (from flat array or array of THREE.MatrixN)
1211412140

1211512141

1211612142
function setValueM2Array(gl, v) {
@@ -12126,6 +12152,42 @@
1212612152
function setValueM4Array(gl, v) {
1212712153
const data = flatten(v, this.size, 16);
1212812154
gl.uniformMatrix4fv(this.addr, false, data);
12155+
} // Array of integer / boolean
12156+
12157+
12158+
function setValueV1iArray(gl, v) {
12159+
gl.uniform1iv(this.addr, v);
12160+
} // Array of integer / boolean vectors (from flat array)
12161+
12162+
12163+
function setValueV2iArray(gl, v) {
12164+
gl.uniform2iv(this.addr, v);
12165+
}
12166+
12167+
function setValueV3iArray(gl, v) {
12168+
gl.uniform3iv(this.addr, v);
12169+
}
12170+
12171+
function setValueV4iArray(gl, v) {
12172+
gl.uniform4iv(this.addr, v);
12173+
} // Array of unsigned integer
12174+
12175+
12176+
function setValueV1uiArray(gl, v) {
12177+
gl.uniform1uiv(this.addr, v);
12178+
} // Array of unsigned integer vectors (from flat array)
12179+
12180+
12181+
function setValueV2uiArray(gl, v) {
12182+
gl.uniform2uiv(this.addr, v);
12183+
}
12184+
12185+
function setValueV3uiArray(gl, v) {
12186+
gl.uniform3uiv(this.addr, v);
12187+
}
12188+
12189+
function setValueV4uiArray(gl, v) {
12190+
gl.uniform4uiv(this.addr, v);
1212912191
} // Array of textures (2D / Cube)
1213012192

1213112193

@@ -12200,6 +12262,22 @@
1220012262
return setValueV4iArray;
1220112263
// _VEC4
1220212264

12265+
case 0x1405:
12266+
return setValueV1uiArray;
12267+
// UINT
12268+
12269+
case 0x8dc6:
12270+
return setValueV2uiArray;
12271+
// _VEC2
12272+
12273+
case 0x8dc7:
12274+
return setValueV3uiArray;
12275+
// _VEC3
12276+
12277+
case 0x8dc8:
12278+
return setValueV4uiArray;
12279+
// _VEC4
12280+
1220312281
case 0x8b5e: // SAMPLER_2D
1220412282

1220512283
case 0x8d66: // SAMPLER_EXTERNAL_OES
@@ -18319,10 +18397,10 @@
1831918397
WebGL1Renderer.prototype.isWebGL1Renderer = true;
1832018398

1832118399
class FogExp2 {
18322-
constructor(color, density) {
18400+
constructor(color, density = 0.00025) {
1832318401
this.name = '';
1832418402
this.color = new Color(color);
18325-
this.density = density !== undefined ? density : 0.00025;
18403+
this.density = density;
1832618404
}
1832718405

1832818406
clone() {
@@ -18344,11 +18422,11 @@
1834418422
FogExp2.prototype.isFogExp2 = true;
1834518423

1834618424
class Fog {
18347-
constructor(color, near, far) {
18425+
constructor(color, near = 1, far = 1000) {
1834818426
this.name = '';
1834918427
this.color = new Color(color);
18350-
this.near = near !== undefined ? near : 1;
18351-
this.far = far !== undefined ? far : 1000;
18428+
this.near = near;
18429+
this.far = far;
1835218430
}
1835318431

1835418432
clone() {

build/three.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)