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.module.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright 2010-
|
|
3
|
+
* Copyright 2010-2022 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
const REVISION = '
|
|
6
|
+
const REVISION = '137';
|
|
7
7
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
8
8
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
9
9
|
const CullFaceNone = 0;
|
|
@@ -89,7 +89,6 @@ const FloatType = 1015;
|
|
|
89
89
|
const HalfFloatType = 1016;
|
|
90
90
|
const UnsignedShort4444Type = 1017;
|
|
91
91
|
const UnsignedShort5551Type = 1018;
|
|
92
|
-
const UnsignedShort565Type = 1019;
|
|
93
92
|
const UnsignedInt248Type = 1020;
|
|
94
93
|
const AlphaFormat = 1021;
|
|
95
94
|
const RGBAFormat = 1023;
|
|
@@ -101,7 +100,6 @@ const RedFormat = 1028;
|
|
|
101
100
|
const RedIntegerFormat = 1029;
|
|
102
101
|
const RGFormat = 1030;
|
|
103
102
|
const RGIntegerFormat = 1031;
|
|
104
|
-
const RGBIntegerFormat = 1032;
|
|
105
103
|
const RGBAIntegerFormat = 1033;
|
|
106
104
|
|
|
107
105
|
const RGB_S3TC_DXT1_Format = 33776;
|
|
@@ -1347,19 +1345,17 @@ class Matrix3 {
|
|
|
1347
1345
|
|
|
1348
1346
|
Matrix3.prototype.isMatrix3 = true;
|
|
1349
1347
|
|
|
1350
|
-
function
|
|
1348
|
+
function arrayNeedsUint32( array ) {
|
|
1351
1349
|
|
|
1352
|
-
|
|
1350
|
+
// assumes larger values usually on last
|
|
1353
1351
|
|
|
1354
|
-
let
|
|
1352
|
+
for ( let i = array.length - 1; i >= 0; -- i ) {
|
|
1355
1353
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
if ( array[ i ] > max ) max = array[ i ];
|
|
1354
|
+
if ( array[ i ] > 65535 ) return true;
|
|
1359
1355
|
|
|
1360
1356
|
}
|
|
1361
1357
|
|
|
1362
|
-
return
|
|
1358
|
+
return false;
|
|
1363
1359
|
|
|
1364
1360
|
}
|
|
1365
1361
|
|
|
@@ -3181,7 +3177,10 @@ class WebGLRenderTarget extends EventDispatcher {
|
|
|
3181
3177
|
this.viewport.copy( source.viewport );
|
|
3182
3178
|
|
|
3183
3179
|
this.texture = source.texture.clone();
|
|
3184
|
-
|
|
3180
|
+
|
|
3181
|
+
// ensure image object is not shared, see #20328
|
|
3182
|
+
|
|
3183
|
+
this.texture.image = Object.assign( {}, source.texture.image );
|
|
3185
3184
|
|
|
3186
3185
|
this.depthBuffer = source.depthBuffer;
|
|
3187
3186
|
this.stencilBuffer = source.stencilBuffer;
|
|
@@ -4843,11 +4842,11 @@ class Box3 {
|
|
|
4843
4842
|
|
|
4844
4843
|
}
|
|
4845
4844
|
|
|
4846
|
-
setFromObject( object ) {
|
|
4845
|
+
setFromObject( object, precise = false ) {
|
|
4847
4846
|
|
|
4848
4847
|
this.makeEmpty();
|
|
4849
4848
|
|
|
4850
|
-
return this.expandByObject( object );
|
|
4849
|
+
return this.expandByObject( object, precise );
|
|
4851
4850
|
|
|
4852
4851
|
}
|
|
4853
4852
|
|
|
@@ -4922,7 +4921,7 @@ class Box3 {
|
|
|
4922
4921
|
|
|
4923
4922
|
}
|
|
4924
4923
|
|
|
4925
|
-
expandByObject( object ) {
|
|
4924
|
+
expandByObject( object, precise = false ) {
|
|
4926
4925
|
|
|
4927
4926
|
// Computes the world-axis-aligned bounding box of an object (including its children),
|
|
4928
4927
|
// accounting for both the object's, and children's, world transforms
|
|
@@ -4933,16 +4932,30 @@ class Box3 {
|
|
|
4933
4932
|
|
|
4934
4933
|
if ( geometry !== undefined ) {
|
|
4935
4934
|
|
|
4936
|
-
if ( geometry.
|
|
4935
|
+
if ( precise && geometry.attributes != undefined && geometry.attributes.position !== undefined ) {
|
|
4937
4936
|
|
|
4938
|
-
geometry.
|
|
4937
|
+
const position = geometry.attributes.position;
|
|
4938
|
+
for ( let i = 0, l = position.count; i < l; i ++ ) {
|
|
4939
4939
|
|
|
4940
|
-
|
|
4940
|
+
_vector$b.fromBufferAttribute( position, i ).applyMatrix4( object.matrixWorld );
|
|
4941
|
+
this.expandByPoint( _vector$b );
|
|
4941
4942
|
|
|
4942
|
-
|
|
4943
|
-
|
|
4943
|
+
}
|
|
4944
|
+
|
|
4945
|
+
} else {
|
|
4946
|
+
|
|
4947
|
+
if ( geometry.boundingBox === null ) {
|
|
4948
|
+
|
|
4949
|
+
geometry.computeBoundingBox();
|
|
4950
|
+
|
|
4951
|
+
}
|
|
4944
4952
|
|
|
4945
|
-
|
|
4953
|
+
_box$3.copy( geometry.boundingBox );
|
|
4954
|
+
_box$3.applyMatrix4( object.matrixWorld );
|
|
4955
|
+
|
|
4956
|
+
this.union( _box$3 );
|
|
4957
|
+
|
|
4958
|
+
}
|
|
4946
4959
|
|
|
4947
4960
|
}
|
|
4948
4961
|
|
|
@@ -4950,7 +4963,7 @@ class Box3 {
|
|
|
4950
4963
|
|
|
4951
4964
|
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
4952
4965
|
|
|
4953
|
-
this.expandByObject( children[ i ] );
|
|
4966
|
+
this.expandByObject( children[ i ], precise );
|
|
4954
4967
|
|
|
4955
4968
|
}
|
|
4956
4969
|
|
|
@@ -9575,7 +9588,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
9575
9588
|
|
|
9576
9589
|
if ( Array.isArray( index ) ) {
|
|
9577
9590
|
|
|
9578
|
-
this.index = new (
|
|
9591
|
+
this.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );
|
|
9579
9592
|
|
|
9580
9593
|
} else {
|
|
9581
9594
|
|
|
@@ -12851,11 +12864,11 @@ var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_META
|
|
|
12851
12864
|
|
|
12852
12865
|
var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
|
|
12853
12866
|
|
|
12854
|
-
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 ]
|
|
12867
|
+
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";
|
|
12855
12868
|
|
|
12856
12869
|
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";
|
|
12857
12870
|
|
|
12858
|
-
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 ]
|
|
12871
|
+
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";
|
|
12859
12872
|
|
|
12860
12873
|
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;";
|
|
12861
12874
|
|
|
@@ -13662,10 +13675,10 @@ ShaderLib.physical = {
|
|
|
13662
13675
|
|
|
13663
13676
|
};
|
|
13664
13677
|
|
|
13665
|
-
function WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha ) {
|
|
13678
|
+
function WebGLBackground( renderer, cubemaps, state, objects, alpha, premultipliedAlpha ) {
|
|
13666
13679
|
|
|
13667
13680
|
const clearColor = new Color( 0x000000 );
|
|
13668
|
-
let clearAlpha = 0;
|
|
13681
|
+
let clearAlpha = alpha === true ? 0 : 1;
|
|
13669
13682
|
|
|
13670
13683
|
let planeMesh;
|
|
13671
13684
|
let boxMesh;
|
|
@@ -16248,7 +16261,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
|
|
|
16248
16261
|
|
|
16249
16262
|
}
|
|
16250
16263
|
|
|
16251
|
-
const attribute = new (
|
|
16264
|
+
const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
|
|
16252
16265
|
attribute.version = version;
|
|
16253
16266
|
|
|
16254
16267
|
// Updating index buffer in VAO now. See WebGLBindingStates
|
|
@@ -19006,7 +19019,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
19006
19019
|
instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
|
|
19007
19020
|
|
|
19008
19021
|
supportsVertexTextures: vertexTextures,
|
|
19009
|
-
outputEncoding: ( currentRenderTarget
|
|
19022
|
+
outputEncoding: ( currentRenderTarget === null ) ? renderer.outputEncoding : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.encoding : LinearEncoding ),
|
|
19010
19023
|
map: !! material.map,
|
|
19011
19024
|
matcap: !! material.matcap,
|
|
19012
19025
|
envMap: !! envMap,
|
|
@@ -21476,7 +21489,7 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
21476
21489
|
break;
|
|
21477
21490
|
|
|
21478
21491
|
case SubtractiveBlending:
|
|
21479
|
-
gl.blendFuncSeparate( 0,
|
|
21492
|
+
gl.blendFuncSeparate( 0, 769, 0, 1 );
|
|
21480
21493
|
break;
|
|
21481
21494
|
|
|
21482
21495
|
case MultiplyBlending:
|
|
@@ -21502,7 +21515,7 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
21502
21515
|
break;
|
|
21503
21516
|
|
|
21504
21517
|
case SubtractiveBlending:
|
|
21505
|
-
gl.
|
|
21518
|
+
gl.blendFuncSeparate( 0, 769, 0, 1 );
|
|
21506
21519
|
break;
|
|
21507
21520
|
|
|
21508
21521
|
case MultiplyBlending:
|
|
@@ -22191,11 +22204,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22191
22204
|
|
|
22192
22205
|
}
|
|
22193
22206
|
|
|
22194
|
-
if ( glFormat ===
|
|
22207
|
+
if ( glFormat === 33319 ) {
|
|
22195
22208
|
|
|
22196
|
-
if ( glType === 5126 ) internalFormat =
|
|
22197
|
-
if ( glType === 5131 ) internalFormat =
|
|
22198
|
-
if ( glType === 5121 ) internalFormat =
|
|
22209
|
+
if ( glType === 5126 ) internalFormat = 33328;
|
|
22210
|
+
if ( glType === 5131 ) internalFormat = 33327;
|
|
22211
|
+
if ( glType === 5121 ) internalFormat = 33323;
|
|
22199
22212
|
|
|
22200
22213
|
}
|
|
22201
22214
|
|
|
@@ -22204,10 +22217,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
22204
22217
|
if ( glType === 5126 ) internalFormat = 34836;
|
|
22205
22218
|
if ( glType === 5131 ) internalFormat = 34842;
|
|
22206
22219
|
if ( glType === 5121 ) internalFormat = ( encoding === sRGBEncoding && isVideoTexture === false ) ? 35907 : 32856;
|
|
22220
|
+
if ( glType === 32819 ) internalFormat = 32854;
|
|
22221
|
+
if ( glType === 32820 ) internalFormat = 32855;
|
|
22207
22222
|
|
|
22208
22223
|
}
|
|
22209
22224
|
|
|
22210
22225
|
if ( internalFormat === 33325 || internalFormat === 33326 ||
|
|
22226
|
+
internalFormat === 33327 || internalFormat === 33328 ||
|
|
22211
22227
|
internalFormat === 34842 || internalFormat === 34836 ) {
|
|
22212
22228
|
|
|
22213
22229
|
extensions.get( 'EXT_color_buffer_float' );
|
|
@@ -23669,13 +23685,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
23669
23685
|
const format = texture.format;
|
|
23670
23686
|
const type = texture.type;
|
|
23671
23687
|
|
|
23672
|
-
if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
23688
|
+
if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
|
|
23673
23689
|
|
|
23674
23690
|
if ( encoding !== LinearEncoding ) {
|
|
23675
23691
|
|
|
23676
23692
|
// sRGB
|
|
23677
23693
|
|
|
23678
|
-
if ( encoding === sRGBEncoding
|
|
23694
|
+
if ( encoding === sRGBEncoding ) {
|
|
23679
23695
|
|
|
23680
23696
|
if ( isWebGL2 === false ) {
|
|
23681
23697
|
|
|
@@ -23798,7 +23814,6 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
23798
23814
|
if ( p === UnsignedByteType ) return 5121;
|
|
23799
23815
|
if ( p === UnsignedShort4444Type ) return 32819;
|
|
23800
23816
|
if ( p === UnsignedShort5551Type ) return 32820;
|
|
23801
|
-
if ( p === UnsignedShort565Type ) return 33635;
|
|
23802
23817
|
|
|
23803
23818
|
if ( p === ByteType ) return 5120;
|
|
23804
23819
|
if ( p === ShortType ) return 5122;
|
|
@@ -23856,7 +23871,6 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
23856
23871
|
if ( p === RedIntegerFormat ) return 36244;
|
|
23857
23872
|
if ( p === RGFormat ) return 33319;
|
|
23858
23873
|
if ( p === RGIntegerFormat ) return 33320;
|
|
23859
|
-
if ( p === RGBIntegerFormat ) return 36248;
|
|
23860
23874
|
if ( p === RGBAIntegerFormat ) return 36249;
|
|
23861
23875
|
|
|
23862
23876
|
// S3TC
|
|
@@ -25208,6 +25222,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
25208
25222
|
|
|
25209
25223
|
}
|
|
25210
25224
|
|
|
25225
|
+
newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
|
|
25226
|
+
|
|
25211
25227
|
// Set foveation to maximum.
|
|
25212
25228
|
this.setFoveation( 1.0 );
|
|
25213
25229
|
|
|
@@ -26541,7 +26557,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
26541
26557
|
try {
|
|
26542
26558
|
|
|
26543
26559
|
const contextAttributes = {
|
|
26544
|
-
alpha:
|
|
26560
|
+
alpha: true,
|
|
26545
26561
|
depth: _depth,
|
|
26546
26562
|
stencil: _stencil,
|
|
26547
26563
|
antialias: _antialias,
|
|
@@ -26640,7 +26656,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
26640
26656
|
materials = new WebGLMaterials( properties );
|
|
26641
26657
|
renderLists = new WebGLRenderLists();
|
|
26642
26658
|
renderStates = new WebGLRenderStates( extensions, capabilities );
|
|
26643
|
-
background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
|
|
26659
|
+
background = new WebGLBackground( _this, cubemaps, state, objects, _alpha, _premultipliedAlpha );
|
|
26644
26660
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
26645
26661
|
|
|
26646
26662
|
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
|
|
@@ -27759,7 +27775,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
27759
27775
|
|
|
27760
27776
|
const fog = scene.fog;
|
|
27761
27777
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
27762
|
-
const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
|
|
27778
|
+
const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.encoding : LinearEncoding );
|
|
27763
27779
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
27764
27780
|
const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
27765
27781
|
const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
|
|
@@ -35539,7 +35555,7 @@ class LatheGeometry extends BufferGeometry {
|
|
|
35539
35555
|
// faces
|
|
35540
35556
|
|
|
35541
35557
|
indices.push( a, b, d );
|
|
35542
|
-
indices.push(
|
|
35558
|
+
indices.push( c, d, b );
|
|
35543
35559
|
|
|
35544
35560
|
}
|
|
35545
35561
|
|
|
@@ -39804,6 +39820,10 @@ class FileLoader extends Loader {
|
|
|
39804
39820
|
// An abort controller could be added within a future PR
|
|
39805
39821
|
} );
|
|
39806
39822
|
|
|
39823
|
+
// record states ( avoid data race )
|
|
39824
|
+
const mimeType = this.mimeType;
|
|
39825
|
+
const responseType = this.responseType;
|
|
39826
|
+
|
|
39807
39827
|
// start the fetch
|
|
39808
39828
|
fetch( req )
|
|
39809
39829
|
.then( response => {
|
|
@@ -39882,7 +39902,7 @@ class FileLoader extends Loader {
|
|
|
39882
39902
|
} )
|
|
39883
39903
|
.then( response => {
|
|
39884
39904
|
|
|
39885
|
-
switch (
|
|
39905
|
+
switch ( responseType ) {
|
|
39886
39906
|
|
|
39887
39907
|
case 'arraybuffer':
|
|
39888
39908
|
|
|
@@ -39898,7 +39918,7 @@ class FileLoader extends Loader {
|
|
|
39898
39918
|
.then( text => {
|
|
39899
39919
|
|
|
39900
39920
|
const parser = new DOMParser();
|
|
39901
|
-
return parser.parseFromString( text,
|
|
39921
|
+
return parser.parseFromString( text, mimeType );
|
|
39902
39922
|
|
|
39903
39923
|
} );
|
|
39904
39924
|
|
|
@@ -39908,7 +39928,20 @@ class FileLoader extends Loader {
|
|
|
39908
39928
|
|
|
39909
39929
|
default:
|
|
39910
39930
|
|
|
39911
|
-
|
|
39931
|
+
if ( mimeType === undefined ) {
|
|
39932
|
+
|
|
39933
|
+
return response.text();
|
|
39934
|
+
|
|
39935
|
+
} else {
|
|
39936
|
+
|
|
39937
|
+
// sniff encoding
|
|
39938
|
+
const re = /charset="?([^;"\s]*)"?/i;
|
|
39939
|
+
const exec = re.exec( mimeType );
|
|
39940
|
+
const label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;
|
|
39941
|
+
const decoder = new TextDecoder( label );
|
|
39942
|
+
return response.arrayBuffer().then( ab => decoder.decode( ab ) );
|
|
39943
|
+
|
|
39944
|
+
}
|
|
39912
39945
|
|
|
39913
39946
|
}
|
|
39914
39947
|
|
|
@@ -50969,4 +51002,4 @@ if ( typeof window !== 'undefined' ) {
|
|
|
50969
51002
|
|
|
50970
51003
|
}
|
|
50971
51004
|
|
|
50972
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format,
|
|
51005
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, sRGBEncoding };
|
|
@@ -510,7 +510,9 @@
|
|
|
510
510
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
function
|
|
513
|
+
function
|
|
514
|
+
/*event*/
|
|
515
|
+
handleMouseUp() { // no-op
|
|
514
516
|
}
|
|
515
517
|
|
|
516
518
|
function handleMouseWheel( event ) {
|
|
@@ -691,7 +693,9 @@
|
|
|
691
693
|
|
|
692
694
|
}
|
|
693
695
|
|
|
694
|
-
function
|
|
696
|
+
function
|
|
697
|
+
/*event*/
|
|
698
|
+
handleTouchEnd() { // no-op
|
|
695
699
|
} //
|
|
696
700
|
// event handlers - FSM: listen for events and reset state
|
|
697
701
|
//
|
|
@@ -624,6 +624,71 @@
|
|
|
624
624
|
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
buildORMTexture( material ) {
|
|
630
|
+
|
|
631
|
+
const occlusion = material.aoMap?.image;
|
|
632
|
+
const roughness = material.roughnessMap?.image;
|
|
633
|
+
const metalness = material.metalnessMap?.image;
|
|
634
|
+
if ( occlusion === roughness && roughness === metalness ) return occlusion;
|
|
635
|
+
|
|
636
|
+
if ( occlusion || roughness || metalness ) {
|
|
637
|
+
|
|
638
|
+
const width = Math.max( occlusion?.width || 0, roughness?.width || 0, metalness?.width || 0 );
|
|
639
|
+
const height = Math.max( occlusion?.height || 0, roughness?.height || 0, metalness?.height || 0 );
|
|
640
|
+
const canvas = document.createElement( 'canvas' );
|
|
641
|
+
canvas.width = width;
|
|
642
|
+
canvas.height = height;
|
|
643
|
+
const context = canvas.getContext( '2d' );
|
|
644
|
+
context.fillStyle = '#ffffff';
|
|
645
|
+
context.fillRect( 0, 0, width, height );
|
|
646
|
+
const composite = context.getImageData( 0, 0, width, height );
|
|
647
|
+
|
|
648
|
+
if ( occlusion ) {
|
|
649
|
+
|
|
650
|
+
context.drawImage( occlusion, 0, 0, width, height );
|
|
651
|
+
const data = context.getImageData( 0, 0, width, height ).data;
|
|
652
|
+
|
|
653
|
+
for ( let i = 0; i < data.length; i += 4 ) {
|
|
654
|
+
|
|
655
|
+
composite.data[ i ] = data[ i ];
|
|
656
|
+
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if ( roughness ) {
|
|
662
|
+
|
|
663
|
+
context.drawImage( roughness, 0, 0, width, height );
|
|
664
|
+
const data = context.getImageData( 0, 0, width, height ).data;
|
|
665
|
+
|
|
666
|
+
for ( let i = 1; i < data.length; i += 4 ) {
|
|
667
|
+
|
|
668
|
+
composite.data[ i ] = data[ i ];
|
|
669
|
+
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
if ( metalness ) {
|
|
675
|
+
|
|
676
|
+
context.drawImage( metalness, 0, 0, width, height );
|
|
677
|
+
const data = context.getImageData( 0, 0, width, height ).data;
|
|
678
|
+
|
|
679
|
+
for ( let i = 2; i < data.length; i += 4 ) {
|
|
680
|
+
|
|
681
|
+
composite.data[ i ] = data[ i ];
|
|
682
|
+
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
context.putImageData( composite, 0, 0 );
|
|
688
|
+
return new THREE.Texture( canvas );
|
|
689
|
+
|
|
690
|
+
}
|
|
691
|
+
|
|
627
692
|
}
|
|
628
693
|
/**
|
|
629
694
|
* Process a buffer to append to the default one.
|
|
@@ -866,7 +931,7 @@
|
|
|
866
931
|
/**
|
|
867
932
|
* Process image
|
|
868
933
|
* @param {Image} image to process
|
|
869
|
-
* @param {Integer} format of the image (
|
|
934
|
+
* @param {Integer} format of the image (THREE.RGBAFormat)
|
|
870
935
|
* @param {Boolean} flipY before writing out the image
|
|
871
936
|
* @return {Integer} Index of the processed texture in the "images" array
|
|
872
937
|
*/
|
|
@@ -909,9 +974,9 @@
|
|
|
909
974
|
|
|
910
975
|
} else {
|
|
911
976
|
|
|
912
|
-
if ( format !== THREE.RGBAFormat
|
|
977
|
+
if ( format !== THREE.RGBAFormat ) {
|
|
913
978
|
|
|
914
|
-
console.error( 'GLTFExporter: Only
|
|
979
|
+
console.error( 'GLTFExporter: Only THREE.RGBAFormat is supported.' );
|
|
915
980
|
|
|
916
981
|
}
|
|
917
982
|
|
|
@@ -923,27 +988,12 @@
|
|
|
923
988
|
|
|
924
989
|
const data = new Uint8ClampedArray( image.height * image.width * 4 );
|
|
925
990
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
for ( let i = 0; i < data.length; i += 4 ) {
|
|
929
|
-
|
|
930
|
-
data[ i + 0 ] = image.data[ i + 0 ];
|
|
931
|
-
data[ i + 1 ] = image.data[ i + 1 ];
|
|
932
|
-
data[ i + 2 ] = image.data[ i + 2 ];
|
|
933
|
-
data[ i + 3 ] = image.data[ i + 3 ];
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
} else {
|
|
991
|
+
for ( let i = 0; i < data.length; i += 4 ) {
|
|
938
992
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
data[ i + 2 ] = image.data[ j + 2 ];
|
|
944
|
-
data[ i + 3 ] = 255;
|
|
945
|
-
|
|
946
|
-
}
|
|
993
|
+
data[ i + 0 ] = image.data[ i + 0 ];
|
|
994
|
+
data[ i + 1 ] = image.data[ i + 1 ];
|
|
995
|
+
data[ i + 2 ] = image.data[ i + 2 ];
|
|
996
|
+
data[ i + 3 ] = image.data[ i + 3 ];
|
|
947
997
|
|
|
948
998
|
}
|
|
949
999
|
|
|
@@ -987,7 +1037,7 @@
|
|
|
987
1037
|
}
|
|
988
1038
|
/**
|
|
989
1039
|
* Process sampler
|
|
990
|
-
* @param {Texture} map Texture to process
|
|
1040
|
+
* @param {Texture} map THREE.Texture to process
|
|
991
1041
|
* @return {Integer} Index of the processed texture in the "samplers" array
|
|
992
1042
|
*/
|
|
993
1043
|
|
|
@@ -1086,24 +1136,17 @@
|
|
|
1086
1136
|
materialDef.pbrMetallicRoughness.metallicFactor = 0.5;
|
|
1087
1137
|
materialDef.pbrMetallicRoughness.roughnessFactor = 0.5;
|
|
1088
1138
|
|
|
1089
|
-
}
|
|
1139
|
+
}
|
|
1090
1140
|
|
|
1141
|
+
const ormTexture = this.buildORMTexture( material ); // pbrMetallicRoughness.metallicRoughnessTexture
|
|
1091
1142
|
|
|
1092
1143
|
if ( material.metalnessMap || material.roughnessMap ) {
|
|
1093
1144
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
this.applyTextureTransform( metalRoughMapDef, material.metalnessMap );
|
|
1100
|
-
materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef;
|
|
1101
|
-
|
|
1102
|
-
} else {
|
|
1103
|
-
|
|
1104
|
-
console.warn( 'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
|
|
1105
|
-
|
|
1106
|
-
}
|
|
1145
|
+
const metalRoughMapDef = {
|
|
1146
|
+
index: this.processTexture( ormTexture )
|
|
1147
|
+
};
|
|
1148
|
+
this.applyTextureTransform( metalRoughMapDef, material.metalnessMap || material.roughnessMap );
|
|
1149
|
+
materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef;
|
|
1107
1150
|
|
|
1108
1151
|
} // pbrMetallicRoughness.baseColorTexture or pbrSpecularGlossiness diffuseTexture
|
|
1109
1152
|
|
|
@@ -1174,7 +1217,7 @@
|
|
|
1174
1217
|
if ( material.aoMap ) {
|
|
1175
1218
|
|
|
1176
1219
|
const occlusionMapDef = {
|
|
1177
|
-
index: this.processTexture(
|
|
1220
|
+
index: this.processTexture( ormTexture ),
|
|
1178
1221
|
texCoord: 1
|
|
1179
1222
|
};
|
|
1180
1223
|
|
|
@@ -23,21 +23,23 @@
|
|
|
23
23
|
|
|
24
24
|
const font = parameters.font;
|
|
25
25
|
|
|
26
|
-
if (
|
|
26
|
+
if ( font === undefined ) {
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
return new THREE.BufferGeometry();
|
|
28
|
+
super(); // generate default extrude geometry
|
|
30
29
|
|
|
31
|
-
}
|
|
30
|
+
} else {
|
|
31
|
+
|
|
32
|
+
const shapes = font.generateShapes( text, parameters.size ); // translate parameters to THREE.ExtrudeGeometry API
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
|
|
37
|
+
if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
|
|
38
|
+
if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
|
|
39
|
+
super( shapes, parameters );
|
|
40
|
+
|
|
41
|
+
}
|
|
36
42
|
|
|
37
|
-
if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
|
|
38
|
-
if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
|
|
39
|
-
if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
|
|
40
|
-
super( shapes, parameters );
|
|
41
43
|
this.type = 'TextGeometry';
|
|
42
44
|
|
|
43
45
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
function onEvent( event ) {
|
|
16
16
|
|
|
17
|
-
material.map.
|
|
17
|
+
material.map.dispatchDOMEvent( event );
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,6 +23,18 @@
|
|
|
23
23
|
this.addEventListener( 'mouseup', onEvent );
|
|
24
24
|
this.addEventListener( 'click', onEvent );
|
|
25
25
|
|
|
26
|
+
this.dispose = function () {
|
|
27
|
+
|
|
28
|
+
geometry.dispose();
|
|
29
|
+
material.dispose();
|
|
30
|
+
material.map.dispose();
|
|
31
|
+
this.removeEventListener( 'mousedown', onEvent );
|
|
32
|
+
this.removeEventListener( 'mousemove', onEvent );
|
|
33
|
+
this.removeEventListener( 'mouseup', onEvent );
|
|
34
|
+
this.removeEventListener( 'click', onEvent );
|
|
35
|
+
|
|
36
|
+
};
|
|
37
|
+
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
}
|
|
@@ -40,7 +52,7 @@
|
|
|
40
52
|
|
|
41
53
|
}
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
dispatchDOMEvent( event ) {
|
|
44
56
|
|
|
45
57
|
htmlevent( this.dom, event.type, event.data.x, event.data.y );
|
|
46
58
|
this.update();
|