super-three 0.136.1 → 0.137.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/three.cjs +37132 -0
- package/build/three.js +71 -53
- package/build/three.min.js +2 -2
- package/build/three.module.js +80 -47
- package/examples/js/animation/MMDAnimationHelper.js +3 -1
- package/examples/js/controls/experimental/CameraControls.js +6 -2
- package/examples/js/exporters/GLTFExporter.js +82 -39
- package/examples/js/geometries/TextGeometry.js +12 -10
- package/examples/js/interactive/HTMLMesh.js +14 -2
- package/examples/js/loaders/EXRLoader.js +20 -9
- package/examples/js/loaders/GLTFLoader.js +1 -1
- package/examples/js/loaders/LDrawLoader.js +541 -425
- package/examples/js/loaders/MD2Loader.js +5 -5
- package/examples/js/loaders/MTLLoader.js +10 -3
- package/examples/js/loaders/PCDLoader.js +2 -2
- package/examples/js/loaders/STLLoader.js +1 -1
- package/examples/js/loaders/SVGLoader.js +3 -2
- package/examples/js/modifiers/EdgeSplitModifier.js +0 -6
- package/examples/js/modifiers/SimplifyModifier.js +0 -10
- package/examples/js/objects/Lensflare.js +2 -2
- package/examples/js/postprocessing/OutlinePass.js +1 -5
- package/examples/js/renderers/CSS2DRenderer.js +25 -19
- package/examples/js/renderers/CSS3DRenderer.js +37 -32
- package/examples/js/utils/LDrawUtils.js +182 -0
- package/examples/jsm/exporters/GLTFExporter.js +80 -12
- package/examples/jsm/geometries/TextGeometry.js +13 -13
- package/examples/jsm/interactive/HTMLMesh.js +16 -2
- package/examples/jsm/libs/flow.module.js +930 -169
- package/examples/jsm/loaders/EXRLoader.js +19 -9
- package/examples/jsm/loaders/GLTFLoader.js +1 -1
- package/examples/jsm/loaders/LDrawLoader.js +534 -442
- package/examples/jsm/loaders/MD2Loader.js +5 -5
- package/examples/jsm/loaders/MTLLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +2 -2
- package/examples/jsm/loaders/STLLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +3 -1
- package/examples/jsm/loaders/VRMLLoader.js +0 -1
- package/examples/jsm/modifiers/EdgeSplitModifier.js +0 -6
- package/examples/jsm/modifiers/SimplifyModifier.js +0 -10
- package/examples/jsm/node-editor/NodeEditor.js +435 -181
- package/examples/jsm/node-editor/accessors/NormalEditor.js +8 -8
- package/examples/jsm/node-editor/accessors/PositionEditor.js +8 -8
- package/examples/jsm/node-editor/accessors/UVEditor.js +6 -7
- package/examples/jsm/node-editor/core/BaseNode.js +83 -0
- package/examples/jsm/node-editor/display/BlendEditor.js +7 -6
- package/examples/jsm/node-editor/examples/animate-uv.json +1 -1
- package/examples/jsm/node-editor/examples/fake-top-light.json +1 -1
- package/examples/jsm/node-editor/examples/oscillator-color.json +1 -1
- package/examples/jsm/node-editor/examples/rim.json +1 -1
- package/examples/jsm/node-editor/inputs/ColorEditor.js +14 -10
- package/examples/jsm/node-editor/inputs/FloatEditor.js +6 -7
- package/examples/jsm/node-editor/inputs/SliderEditor.js +4 -5
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +6 -7
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +8 -9
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +9 -10
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +87 -0
- package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +97 -0
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +20 -17
- package/examples/jsm/node-editor/math/AngleEditor.js +39 -0
- package/examples/jsm/node-editor/math/DotEditor.js +6 -7
- package/examples/jsm/node-editor/math/InvertEditor.js +4 -3
- package/examples/jsm/node-editor/math/LimiterEditor.js +11 -10
- package/examples/jsm/node-editor/math/NormalizeEditor.js +6 -5
- package/examples/jsm/node-editor/math/OperatorEditor.js +12 -11
- package/examples/jsm/node-editor/math/PowerEditor.js +6 -5
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +12 -7
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +4 -3
- package/examples/jsm/node-editor/scene/MeshEditor.js +99 -0
- package/examples/jsm/node-editor/scene/Object3DEditor.js +160 -0
- package/examples/jsm/node-editor/scene/PointsEditor.js +99 -0
- package/examples/jsm/node-editor/utils/JoinEditor.js +58 -0
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +7 -6
- package/examples/jsm/node-editor/utils/SplitEditor.js +39 -0
- package/examples/jsm/node-editor/utils/TimerEditor.js +6 -5
- package/examples/jsm/postprocessing/OutlinePass.js +1 -4
- package/examples/jsm/renderers/CSS2DRenderer.js +24 -19
- package/examples/jsm/renderers/CSS3DRenderer.js +36 -30
- package/examples/jsm/renderers/nodes/accessors/UVNode.js +4 -4
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +2 -1
- package/examples/jsm/renderers/nodes/utils/SplitNode.js +19 -4
- package/examples/jsm/utils/LDrawUtils.js +18 -11
- package/package.json +16 -9
- package/src/constants.js +1 -3
- package/src/core/BufferGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +1 -1
- package/src/loaders/FileLoader.js +20 -3
- package/src/math/Box3.js +24 -10
- package/src/renderers/WebGLRenderTarget.js +4 -1
- package/src/renderers/WebGLRenderer.js +3 -3
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +2 -2
- package/src/renderers/webgl/WebGLGeometries.js +2 -2
- package/src/renderers/webgl/WebGLPrograms.js +2 -2
- package/src/renderers/webgl/WebGLState.js +2 -2
- package/src/renderers/webgl/WebGLTextures.js +9 -6
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webxr/WebXRManager.js +2 -0
- package/src/utils.js +15 -1
package/build/three.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright 2010-
|
|
3
|
+
* Copyright 2010-2022 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
|
|
10
10
|
}(this, (function (exports) { 'use strict';
|
|
11
11
|
|
|
12
|
-
const REVISION = '
|
|
12
|
+
const REVISION = '137';
|
|
13
13
|
const MOUSE = {
|
|
14
14
|
LEFT: 0,
|
|
15
15
|
MIDDLE: 1,
|
|
@@ -106,7 +106,6 @@
|
|
|
106
106
|
const HalfFloatType = 1016;
|
|
107
107
|
const UnsignedShort4444Type = 1017;
|
|
108
108
|
const UnsignedShort5551Type = 1018;
|
|
109
|
-
const UnsignedShort565Type = 1019;
|
|
110
109
|
const UnsignedInt248Type = 1020;
|
|
111
110
|
const AlphaFormat = 1021;
|
|
112
111
|
const RGBAFormat = 1023;
|
|
@@ -118,7 +117,6 @@
|
|
|
118
117
|
const RedIntegerFormat = 1029;
|
|
119
118
|
const RGFormat = 1030;
|
|
120
119
|
const RGIntegerFormat = 1031;
|
|
121
|
-
const RGBIntegerFormat = 1032;
|
|
122
120
|
const RGBAIntegerFormat = 1033;
|
|
123
121
|
const RGB_S3TC_DXT1_Format = 33776;
|
|
124
122
|
const RGBA_S3TC_DXT1_Format = 33777;
|
|
@@ -1056,15 +1054,13 @@
|
|
|
1056
1054
|
|
|
1057
1055
|
Matrix3.prototype.isMatrix3 = true;
|
|
1058
1056
|
|
|
1059
|
-
function
|
|
1060
|
-
|
|
1061
|
-
let
|
|
1062
|
-
|
|
1063
|
-
for (let i = 1, l = array.length; i < l; ++i) {
|
|
1064
|
-
if (array[i] > max) max = array[i];
|
|
1057
|
+
function arrayNeedsUint32(array) {
|
|
1058
|
+
// assumes larger values usually on last
|
|
1059
|
+
for (let i = array.length - 1; i >= 0; --i) {
|
|
1060
|
+
if (array[i] > 65535) return true;
|
|
1065
1061
|
}
|
|
1066
1062
|
|
|
1067
|
-
return
|
|
1063
|
+
return false;
|
|
1068
1064
|
}
|
|
1069
1065
|
|
|
1070
1066
|
const TYPED_ARRAYS = {
|
|
@@ -2516,10 +2512,9 @@
|
|
|
2516
2512
|
this.height = source.height;
|
|
2517
2513
|
this.depth = source.depth;
|
|
2518
2514
|
this.viewport.copy(source.viewport);
|
|
2519
|
-
this.texture = source.texture.clone();
|
|
2520
|
-
this.texture.image = { ...this.texture.image
|
|
2521
|
-
}; // See #20328.
|
|
2515
|
+
this.texture = source.texture.clone(); // ensure image object is not shared, see #20328
|
|
2522
2516
|
|
|
2517
|
+
this.texture.image = Object.assign({}, source.texture.image);
|
|
2523
2518
|
this.depthBuffer = source.depthBuffer;
|
|
2524
2519
|
this.stencilBuffer = source.stencilBuffer;
|
|
2525
2520
|
this.depthTexture = source.depthTexture;
|
|
@@ -3766,9 +3761,9 @@
|
|
|
3766
3761
|
return this;
|
|
3767
3762
|
}
|
|
3768
3763
|
|
|
3769
|
-
setFromObject(object) {
|
|
3764
|
+
setFromObject(object, precise = false) {
|
|
3770
3765
|
this.makeEmpty();
|
|
3771
|
-
return this.expandByObject(object);
|
|
3766
|
+
return this.expandByObject(object, precise);
|
|
3772
3767
|
}
|
|
3773
3768
|
|
|
3774
3769
|
clone() {
|
|
@@ -3818,28 +3813,38 @@
|
|
|
3818
3813
|
return this;
|
|
3819
3814
|
}
|
|
3820
3815
|
|
|
3821
|
-
expandByObject(object) {
|
|
3816
|
+
expandByObject(object, precise = false) {
|
|
3822
3817
|
// Computes the world-axis-aligned bounding box of an object (including its children),
|
|
3823
3818
|
// accounting for both the object's, and children's, world transforms
|
|
3824
3819
|
object.updateWorldMatrix(false, false);
|
|
3825
3820
|
const geometry = object.geometry;
|
|
3826
3821
|
|
|
3827
3822
|
if (geometry !== undefined) {
|
|
3828
|
-
if (geometry.
|
|
3829
|
-
geometry.
|
|
3830
|
-
|
|
3823
|
+
if (precise && geometry.attributes != undefined && geometry.attributes.position !== undefined) {
|
|
3824
|
+
const position = geometry.attributes.position;
|
|
3825
|
+
|
|
3826
|
+
for (let i = 0, l = position.count; i < l; i++) {
|
|
3827
|
+
_vector$b.fromBufferAttribute(position, i).applyMatrix4(object.matrixWorld);
|
|
3828
|
+
|
|
3829
|
+
this.expandByPoint(_vector$b);
|
|
3830
|
+
}
|
|
3831
|
+
} else {
|
|
3832
|
+
if (geometry.boundingBox === null) {
|
|
3833
|
+
geometry.computeBoundingBox();
|
|
3834
|
+
}
|
|
3831
3835
|
|
|
3832
|
-
|
|
3836
|
+
_box$3.copy(geometry.boundingBox);
|
|
3833
3837
|
|
|
3834
|
-
|
|
3838
|
+
_box$3.applyMatrix4(object.matrixWorld);
|
|
3835
3839
|
|
|
3836
|
-
|
|
3840
|
+
this.union(_box$3);
|
|
3841
|
+
}
|
|
3837
3842
|
}
|
|
3838
3843
|
|
|
3839
3844
|
const children = object.children;
|
|
3840
3845
|
|
|
3841
3846
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
3842
|
-
this.expandByObject(children[i]);
|
|
3847
|
+
this.expandByObject(children[i], precise);
|
|
3843
3848
|
}
|
|
3844
3849
|
|
|
3845
3850
|
return this;
|
|
@@ -7363,7 +7368,7 @@
|
|
|
7363
7368
|
|
|
7364
7369
|
setIndex(index) {
|
|
7365
7370
|
if (Array.isArray(index)) {
|
|
7366
|
-
this.index = new (
|
|
7371
|
+
this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1);
|
|
7367
7372
|
} else {
|
|
7368
7373
|
this.index = index;
|
|
7369
7374
|
}
|
|
@@ -9775,11 +9780,11 @@
|
|
|
9775
9780
|
|
|
9776
9781
|
var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
|
|
9777
9782
|
|
|
9778
|
-
var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ]
|
|
9783
|
+
var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
|
|
9779
9784
|
|
|
9780
9785
|
var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
|
|
9781
9786
|
|
|
9782
|
-
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ]
|
|
9787
|
+
var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
|
|
9783
9788
|
|
|
9784
9789
|
var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
|
|
9785
9790
|
|
|
@@ -10576,9 +10581,9 @@
|
|
|
10576
10581
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
10577
10582
|
};
|
|
10578
10583
|
|
|
10579
|
-
function WebGLBackground(renderer, cubemaps, state, objects, premultipliedAlpha) {
|
|
10584
|
+
function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultipliedAlpha) {
|
|
10580
10585
|
const clearColor = new Color(0x000000);
|
|
10581
|
-
let clearAlpha = 0;
|
|
10586
|
+
let clearAlpha = alpha === true ? 0 : 1;
|
|
10582
10587
|
let planeMesh;
|
|
10583
10588
|
let boxMesh;
|
|
10584
10589
|
let currentBackground = null;
|
|
@@ -12474,7 +12479,7 @@
|
|
|
12474
12479
|
}
|
|
12475
12480
|
}
|
|
12476
12481
|
|
|
12477
|
-
const attribute = new (
|
|
12482
|
+
const attribute = new (arrayNeedsUint32(indices) ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1);
|
|
12478
12483
|
attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates
|
|
12479
12484
|
//
|
|
12480
12485
|
|
|
@@ -14320,7 +14325,7 @@
|
|
|
14320
14325
|
instancing: object.isInstancedMesh === true,
|
|
14321
14326
|
instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
|
|
14322
14327
|
supportsVertexTextures: vertexTextures,
|
|
14323
|
-
outputEncoding: currentRenderTarget
|
|
14328
|
+
outputEncoding: currentRenderTarget === null ? renderer.outputEncoding : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.encoding : LinearEncoding,
|
|
14324
14329
|
map: !!material.map,
|
|
14325
14330
|
matcap: !!material.matcap,
|
|
14326
14331
|
envMap: !!envMap,
|
|
@@ -16054,7 +16059,7 @@
|
|
|
16054
16059
|
break;
|
|
16055
16060
|
|
|
16056
16061
|
case SubtractiveBlending:
|
|
16057
|
-
gl.blendFuncSeparate(gl.ZERO, gl.
|
|
16062
|
+
gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE);
|
|
16058
16063
|
break;
|
|
16059
16064
|
|
|
16060
16065
|
case MultiplyBlending:
|
|
@@ -16076,7 +16081,7 @@
|
|
|
16076
16081
|
break;
|
|
16077
16082
|
|
|
16078
16083
|
case SubtractiveBlending:
|
|
16079
|
-
gl.
|
|
16084
|
+
gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE);
|
|
16080
16085
|
break;
|
|
16081
16086
|
|
|
16082
16087
|
case MultiplyBlending:
|
|
@@ -16526,19 +16531,21 @@
|
|
|
16526
16531
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
|
|
16527
16532
|
}
|
|
16528
16533
|
|
|
16529
|
-
if (glFormat === _gl.
|
|
16530
|
-
if (glType === _gl.FLOAT) internalFormat = _gl.
|
|
16531
|
-
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.
|
|
16532
|
-
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.
|
|
16534
|
+
if (glFormat === _gl.RG) {
|
|
16535
|
+
if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
|
|
16536
|
+
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
|
|
16537
|
+
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
|
|
16533
16538
|
}
|
|
16534
16539
|
|
|
16535
16540
|
if (glFormat === _gl.RGBA) {
|
|
16536
16541
|
if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
|
|
16537
16542
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
|
|
16538
16543
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = encoding === sRGBEncoding && isVideoTexture === false ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
16544
|
+
if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
|
|
16545
|
+
if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
|
|
16539
16546
|
}
|
|
16540
16547
|
|
|
16541
|
-
if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) {
|
|
16548
|
+
if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) {
|
|
16542
16549
|
extensions.get('EXT_color_buffer_float');
|
|
16543
16550
|
}
|
|
16544
16551
|
|
|
@@ -17511,11 +17518,11 @@
|
|
|
17511
17518
|
const encoding = texture.encoding;
|
|
17512
17519
|
const format = texture.format;
|
|
17513
17520
|
const type = texture.type;
|
|
17514
|
-
if (texture.isCompressedTexture === true || texture.format === _SRGBAFormat) return image;
|
|
17521
|
+
if (texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat) return image;
|
|
17515
17522
|
|
|
17516
17523
|
if (encoding !== LinearEncoding) {
|
|
17517
17524
|
// sRGB
|
|
17518
|
-
if (encoding === sRGBEncoding
|
|
17525
|
+
if (encoding === sRGBEncoding) {
|
|
17519
17526
|
if (isWebGL2 === false) {
|
|
17520
17527
|
// in WebGL 1, try to use EXT_sRGB extension and unsized formats
|
|
17521
17528
|
if (extensions.has('EXT_sRGB') === true && format === RGBAFormat) {
|
|
@@ -17596,7 +17603,6 @@
|
|
|
17596
17603
|
if (p === UnsignedByteType) return gl.UNSIGNED_BYTE;
|
|
17597
17604
|
if (p === UnsignedShort4444Type) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
17598
17605
|
if (p === UnsignedShort5551Type) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
17599
|
-
if (p === UnsignedShort565Type) return gl.UNSIGNED_SHORT_5_6_5;
|
|
17600
17606
|
if (p === ByteType) return gl.BYTE;
|
|
17601
17607
|
if (p === ShortType) return gl.SHORT;
|
|
17602
17608
|
if (p === UnsignedShortType) return gl.UNSIGNED_SHORT;
|
|
@@ -17637,7 +17643,6 @@
|
|
|
17637
17643
|
if (p === RedIntegerFormat) return gl.RED_INTEGER;
|
|
17638
17644
|
if (p === RGFormat) return gl.RG;
|
|
17639
17645
|
if (p === RGIntegerFormat) return gl.RG_INTEGER;
|
|
17640
|
-
if (p === RGBIntegerFormat) return gl.RGB_INTEGER;
|
|
17641
17646
|
if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER; // S3TC
|
|
17642
17647
|
|
|
17643
17648
|
if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) {
|
|
@@ -18606,8 +18611,10 @@
|
|
|
18606
18611
|
encoding: renderer.outputEncoding
|
|
18607
18612
|
});
|
|
18608
18613
|
}
|
|
18609
|
-
}
|
|
18614
|
+
}
|
|
18610
18615
|
|
|
18616
|
+
newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
|
|
18617
|
+
// Set foveation to maximum.
|
|
18611
18618
|
|
|
18612
18619
|
this.setFoveation(1.0);
|
|
18613
18620
|
referenceSpace = await session.requestReferenceSpace(referenceSpaceType);
|
|
@@ -19552,7 +19559,7 @@
|
|
|
19552
19559
|
|
|
19553
19560
|
try {
|
|
19554
19561
|
const contextAttributes = {
|
|
19555
|
-
alpha:
|
|
19562
|
+
alpha: true,
|
|
19556
19563
|
depth: _depth,
|
|
19557
19564
|
stencil: _stencil,
|
|
19558
19565
|
antialias: _antialias,
|
|
@@ -19628,7 +19635,7 @@
|
|
|
19628
19635
|
materials = new WebGLMaterials(properties);
|
|
19629
19636
|
renderLists = new WebGLRenderLists();
|
|
19630
19637
|
renderStates = new WebGLRenderStates(extensions, capabilities);
|
|
19631
|
-
background = new WebGLBackground(_this, cubemaps, state, objects, _premultipliedAlpha);
|
|
19638
|
+
background = new WebGLBackground(_this, cubemaps, state, objects, _alpha, _premultipliedAlpha);
|
|
19632
19639
|
shadowMap = new WebGLShadowMap(_this, objects, capabilities);
|
|
19633
19640
|
bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
|
|
19634
19641
|
indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);
|
|
@@ -20374,7 +20381,7 @@
|
|
|
20374
20381
|
textures.resetTextureUnits();
|
|
20375
20382
|
const fog = scene.fog;
|
|
20376
20383
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
20377
|
-
const encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
|
|
20384
|
+
const encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.encoding : LinearEncoding;
|
|
20378
20385
|
const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);
|
|
20379
20386
|
const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
20380
20387
|
const vertexTangents = !!material.normalMap && !!geometry.attributes.tangent;
|
|
@@ -25812,7 +25819,7 @@
|
|
|
25812
25819
|
const d = base + 1; // faces
|
|
25813
25820
|
|
|
25814
25821
|
indices.push(a, b, d);
|
|
25815
|
-
indices.push(
|
|
25822
|
+
indices.push(c, d, b);
|
|
25816
25823
|
}
|
|
25817
25824
|
} // build geometry
|
|
25818
25825
|
|
|
@@ -28836,7 +28843,10 @@
|
|
|
28836
28843
|
headers: new Headers(this.requestHeader),
|
|
28837
28844
|
credentials: this.withCredentials ? 'include' : 'same-origin' // An abort controller could be added within a future PR
|
|
28838
28845
|
|
|
28839
|
-
}); //
|
|
28846
|
+
}); // record states ( avoid data race )
|
|
28847
|
+
|
|
28848
|
+
const mimeType = this.mimeType;
|
|
28849
|
+
const responseType = this.responseType; // start the fetch
|
|
28840
28850
|
|
|
28841
28851
|
fetch(req).then(response => {
|
|
28842
28852
|
if (response.status === 200 || response.status === 0) {
|
|
@@ -28894,7 +28904,7 @@
|
|
|
28894
28904
|
throw Error(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`);
|
|
28895
28905
|
}
|
|
28896
28906
|
}).then(response => {
|
|
28897
|
-
switch (
|
|
28907
|
+
switch (responseType) {
|
|
28898
28908
|
case 'arraybuffer':
|
|
28899
28909
|
return response.arrayBuffer();
|
|
28900
28910
|
|
|
@@ -28904,14 +28914,24 @@
|
|
|
28904
28914
|
case 'document':
|
|
28905
28915
|
return response.text().then(text => {
|
|
28906
28916
|
const parser = new DOMParser();
|
|
28907
|
-
return parser.parseFromString(text,
|
|
28917
|
+
return parser.parseFromString(text, mimeType);
|
|
28908
28918
|
});
|
|
28909
28919
|
|
|
28910
28920
|
case 'json':
|
|
28911
28921
|
return response.json();
|
|
28912
28922
|
|
|
28913
28923
|
default:
|
|
28914
|
-
|
|
28924
|
+
if (mimeType === undefined) {
|
|
28925
|
+
return response.text();
|
|
28926
|
+
} else {
|
|
28927
|
+
// sniff encoding
|
|
28928
|
+
const re = /charset="?([^;"\s]*)"?/i;
|
|
28929
|
+
const exec = re.exec(mimeType);
|
|
28930
|
+
const label = exec && exec[1] ? exec[1].toLowerCase() : undefined;
|
|
28931
|
+
const decoder = new TextDecoder(label);
|
|
28932
|
+
return response.arrayBuffer().then(ab => decoder.decode(ab));
|
|
28933
|
+
}
|
|
28934
|
+
|
|
28915
28935
|
}
|
|
28916
28936
|
}).then(data => {
|
|
28917
28937
|
// Add to cache only on HTTP success, so that we do not cache
|
|
@@ -36993,7 +37013,6 @@
|
|
|
36993
37013
|
exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
|
|
36994
37014
|
exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
|
|
36995
37015
|
exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
|
|
36996
|
-
exports.RGBIntegerFormat = RGBIntegerFormat;
|
|
36997
37016
|
exports.RGB_ETC1_Format = RGB_ETC1_Format;
|
|
36998
37017
|
exports.RGB_ETC2_Format = RGB_ETC2_Format;
|
|
36999
37018
|
exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
|
|
@@ -37086,7 +37105,6 @@
|
|
|
37086
37105
|
exports.UnsignedIntType = UnsignedIntType;
|
|
37087
37106
|
exports.UnsignedShort4444Type = UnsignedShort4444Type;
|
|
37088
37107
|
exports.UnsignedShort5551Type = UnsignedShort5551Type;
|
|
37089
|
-
exports.UnsignedShort565Type = UnsignedShort565Type;
|
|
37090
37108
|
exports.UnsignedShortType = UnsignedShortType;
|
|
37091
37109
|
exports.VSMShadowMap = VSMShadowMap;
|
|
37092
37110
|
exports.Vector2 = Vector2;
|