super-three 0.158.0 → 0.160.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/build/three.cjs +1719 -379
- package/build/three.js +1719 -379
- package/build/three.min.js +1 -1
- package/build/three.module.js +1718 -380
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/controls/OrbitControls.js +50 -40
- package/examples/jsm/csm/CSMShader.js +52 -47
- package/examples/jsm/exporters/GLTFExporter.js +79 -1
- package/examples/jsm/exporters/USDZExporter.js +27 -19
- package/examples/jsm/helpers/TextureHelper.js +237 -0
- package/examples/jsm/interactive/HTMLMesh.js +9 -2
- package/examples/jsm/lines/LineMaterial.js +16 -33
- package/examples/jsm/loaders/ColladaLoader.js +0 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -3
- package/examples/jsm/loaders/FBXLoader.js +294 -124
- package/examples/jsm/loaders/GLTFLoader.js +71 -3
- package/examples/jsm/loaders/MaterialXLoader.js +73 -54
- package/examples/jsm/loaders/NRRDLoader.js +0 -13
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/USDZLoader.js +3 -17
- package/examples/jsm/math/Octree.js +15 -4
- package/examples/jsm/misc/Timer.js +119 -0
- package/examples/jsm/misc/TubePainter.js +3 -6
- package/examples/jsm/modifiers/CurveModifier.js +20 -2
- package/examples/jsm/nodes/Nodes.js +11 -7
- package/examples/jsm/nodes/accessors/CameraNode.js +18 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +5 -73
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +11 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -3
- package/examples/jsm/nodes/accessors/MorphNode.js +191 -16
- package/examples/jsm/nodes/accessors/ReferenceNode.js +25 -1
- package/examples/jsm/nodes/accessors/TextureNode.js +122 -36
- package/examples/jsm/nodes/code/CodeNode.js +3 -3
- package/examples/jsm/nodes/core/AttributeNode.js +7 -1
- package/examples/jsm/nodes/core/CacheNode.js +4 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +6 -3
- package/examples/jsm/nodes/core/NodeBuilder.js +84 -27
- package/examples/jsm/nodes/core/NodeFrame.js +10 -8
- package/examples/jsm/nodes/core/NodeUniform.js +12 -0
- package/examples/jsm/nodes/core/NodeUtils.js +3 -7
- package/examples/jsm/nodes/core/OutputStructNode.js +3 -3
- package/examples/jsm/nodes/core/PropertyNode.js +17 -2
- package/examples/jsm/nodes/core/StructTypeNode.js +4 -4
- package/examples/jsm/nodes/core/UniformGroup.js +13 -0
- package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
- package/examples/jsm/nodes/core/UniformNode.js +17 -0
- package/examples/jsm/nodes/core/VarNode.js +2 -0
- package/examples/jsm/nodes/core/VaryingNode.js +1 -7
- package/examples/jsm/nodes/display/BumpMapNode.js +1 -1
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +6 -10
- package/examples/jsm/nodes/display/GaussianBlurNode.js +170 -0
- package/examples/jsm/nodes/display/PassNode.js +182 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +31 -3
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportNode.js +5 -8
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +52 -17
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -12
- package/examples/jsm/nodes/lighting/LightsNode.js +34 -32
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +12 -12
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/NodeMaterial.js +66 -41
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +10 -10
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +128 -54
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +24 -14
- package/examples/jsm/nodes/math/MathNode.js +2 -0
- package/examples/jsm/nodes/math/OperatorNode.js +19 -6
- package/examples/jsm/nodes/shadernode/ShaderNode.js +32 -3
- package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +8 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/examples/jsm/objects/QuadMesh.js +60 -0
- package/examples/jsm/postprocessing/GTAOPass.js +572 -0
- package/examples/jsm/postprocessing/OutputPass.js +2 -0
- package/examples/jsm/renderers/common/Animation.js +10 -21
- package/examples/jsm/renderers/common/Backend.js +19 -3
- package/examples/jsm/renderers/common/Background.js +20 -22
- package/examples/jsm/renderers/common/Bindings.js +30 -21
- package/examples/jsm/renderers/common/ChainMap.js +3 -3
- package/examples/jsm/renderers/common/Color4.js +37 -0
- package/examples/jsm/renderers/common/Geometries.js +4 -4
- package/examples/jsm/renderers/common/Info.js +12 -2
- package/examples/jsm/renderers/common/Pipelines.js +3 -51
- package/examples/jsm/renderers/common/PostProcessing.js +25 -0
- package/examples/jsm/renderers/common/RenderContext.js +1 -1
- package/examples/jsm/renderers/common/RenderContexts.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +13 -1
- package/examples/jsm/renderers/common/RenderObjects.js +4 -2
- package/examples/jsm/renderers/common/Renderer.js +137 -37
- package/examples/jsm/renderers/common/StorageTexture.js +1 -0
- package/examples/jsm/renderers/common/Textures.js +4 -1
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +10 -2
- package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +74 -7
- package/examples/jsm/renderers/webgl/WebGLBackend.js +91 -33
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +100 -31
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +57 -5
- package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +11 -1
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +71 -2
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +42 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +33 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +4 -14
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +186 -137
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +1 -1
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +209 -90
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -10
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +11 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +2 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +88 -6
- package/examples/jsm/shaders/FXAAShader.js +133 -133
- package/examples/jsm/shaders/GTAOShader.js +424 -0
- package/examples/jsm/shaders/OutputShader.js +4 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
- package/examples/jsm/shaders/SAOShader.js +2 -3
- package/examples/jsm/shaders/SSAOShader.js +2 -3
- package/examples/jsm/transpiler/AST.js +40 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +50 -8
- package/examples/jsm/transpiler/ShaderToyDecoder.js +4 -4
- package/examples/jsm/transpiler/TSLEncoder.js +124 -20
- package/examples/jsm/utils/SortUtils.js +158 -0
- package/examples/jsm/utils/TextureUtils.js +33 -21
- package/examples/jsm/webxr/ARButton.js +14 -0
- package/examples/jsm/webxr/VRButton.js +23 -8
- package/examples/jsm/webxr/XRButton.js +25 -11
- package/package.json +5 -6
- package/src/Three.js +1 -0
- package/src/constants.js +2 -1
- package/src/core/BufferAttribute.js +21 -2
- package/src/core/InterleavedBuffer.js +21 -1
- package/src/core/Object3D.js +60 -12
- package/src/core/UniformsGroup.js +7 -1
- package/src/extras/curves/LineCurve3.js +4 -0
- package/src/loaders/AudioLoader.js +1 -1
- package/src/loaders/BufferGeometryLoader.js +0 -7
- package/src/loaders/ImageBitmapLoader.js +25 -1
- package/src/loaders/ObjectLoader.js +49 -0
- package/src/materials/ShaderMaterial.js +2 -1
- package/src/math/ColorManagement.js +0 -16
- package/src/math/Quaternion.js +5 -4
- package/src/math/Sphere.js +2 -0
- package/src/math/Triangle.js +17 -5
- package/src/objects/BatchedMesh.js +1020 -0
- package/src/objects/Skeleton.js +1 -3
- package/src/renderers/WebGL3DRenderTarget.js +2 -2
- package/src/renderers/WebGLArrayRenderTarget.js +2 -2
- package/src/renderers/WebGLRenderer.js +23 -18
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -5
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +31 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +9 -4
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +9 -17
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +84 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk.js +4 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +39 -5
- package/src/renderers/webgl/WebGLBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLLights.js +11 -2
- package/src/renderers/webgl/WebGLProgram.js +20 -1
- package/src/renderers/webgl/WebGLPrograms.js +5 -0
- package/src/renderers/webgl/WebGLShadowMap.js +35 -0
- package/src/renderers/webgl/WebGLTextures.js +7 -11
- package/src/renderers/webgl/WebGLUniforms.js +11 -1
- package/src/renderers/webgl/WebGLUniformsGroups.js +72 -93
- package/src/renderers/webxr/WebXRManager.js +16 -0
- package/examples/jsm/objects/BatchedMesh.js +0 -586
package/build/three.js
CHANGED
|
@@ -10,7 +10,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10
10
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
|
|
11
11
|
})(this, (function (exports) { 'use strict';
|
|
12
12
|
|
|
13
|
-
const REVISION = '
|
|
13
|
+
const REVISION = '160';
|
|
14
14
|
|
|
15
15
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
16
16
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -69,6 +69,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
69
69
|
const CineonToneMapping = 3;
|
|
70
70
|
const ACESFilmicToneMapping = 4;
|
|
71
71
|
const CustomToneMapping = 5;
|
|
72
|
+
const AgXToneMapping = 6;
|
|
72
73
|
const AttachedBindMode = 'attached';
|
|
73
74
|
const DetachedBindMode = 'detached';
|
|
74
75
|
|
|
@@ -1633,22 +1634,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
1633
1634
|
|
|
1634
1635
|
_workingColorSpace: LinearSRGBColorSpace,
|
|
1635
1636
|
|
|
1636
|
-
get legacyMode() {
|
|
1637
|
-
|
|
1638
|
-
console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
|
|
1639
|
-
|
|
1640
|
-
return ! this.enabled;
|
|
1641
|
-
|
|
1642
|
-
},
|
|
1643
|
-
|
|
1644
|
-
set legacyMode( legacyMode ) {
|
|
1645
|
-
|
|
1646
|
-
console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
|
|
1647
|
-
|
|
1648
|
-
this.enabled = ! legacyMode;
|
|
1649
|
-
|
|
1650
|
-
},
|
|
1651
|
-
|
|
1652
1637
|
get workingColorSpace() {
|
|
1653
1638
|
|
|
1654
1639
|
return this._workingColorSpace;
|
|
@@ -3090,9 +3075,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
3090
3075
|
|
|
3091
3076
|
class WebGLArrayRenderTarget extends WebGLRenderTarget {
|
|
3092
3077
|
|
|
3093
|
-
constructor( width = 1, height = 1, depth = 1 ) {
|
|
3078
|
+
constructor( width = 1, height = 1, depth = 1, options = {} ) {
|
|
3094
3079
|
|
|
3095
|
-
super( width, height );
|
|
3080
|
+
super( width, height, options );
|
|
3096
3081
|
|
|
3097
3082
|
this.isWebGLArrayRenderTarget = true;
|
|
3098
3083
|
|
|
@@ -3139,9 +3124,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
3139
3124
|
|
|
3140
3125
|
class WebGL3DRenderTarget extends WebGLRenderTarget {
|
|
3141
3126
|
|
|
3142
|
-
constructor( width = 1, height = 1, depth = 1 ) {
|
|
3127
|
+
constructor( width = 1, height = 1, depth = 1, options = {} ) {
|
|
3143
3128
|
|
|
3144
|
-
super( width, height );
|
|
3129
|
+
super( width, height, options );
|
|
3145
3130
|
|
|
3146
3131
|
this.isWebGL3DRenderTarget = true;
|
|
3147
3132
|
|
|
@@ -3432,7 +3417,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
3432
3417
|
|
|
3433
3418
|
}
|
|
3434
3419
|
|
|
3435
|
-
setFromEuler( euler, update ) {
|
|
3420
|
+
setFromEuler( euler, update = true ) {
|
|
3436
3421
|
|
|
3437
3422
|
const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
|
|
3438
3423
|
|
|
@@ -3500,7 +3485,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
3500
3485
|
|
|
3501
3486
|
}
|
|
3502
3487
|
|
|
3503
|
-
if ( update
|
|
3488
|
+
if ( update === true ) this._onChangeCallback();
|
|
3504
3489
|
|
|
3505
3490
|
return this;
|
|
3506
3491
|
|
|
@@ -3795,8 +3780,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
3795
3780
|
this._y = s * y + t * this._y;
|
|
3796
3781
|
this._z = s * z + t * this._z;
|
|
3797
3782
|
|
|
3798
|
-
this.normalize();
|
|
3799
|
-
this._onChangeCallback();
|
|
3783
|
+
this.normalize(); // normalize calls _onChangeCallback()
|
|
3800
3784
|
|
|
3801
3785
|
return this;
|
|
3802
3786
|
|
|
@@ -3884,6 +3868,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
3884
3868
|
this._z = attribute.getZ( index );
|
|
3885
3869
|
this._w = attribute.getW( index );
|
|
3886
3870
|
|
|
3871
|
+
this._onChangeCallback();
|
|
3872
|
+
|
|
3887
3873
|
return this;
|
|
3888
3874
|
|
|
3889
3875
|
}
|
|
@@ -4419,9 +4405,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4419
4405
|
|
|
4420
4406
|
projectOnPlane( planeNormal ) {
|
|
4421
4407
|
|
|
4422
|
-
_vector$
|
|
4408
|
+
_vector$c.copy( this ).projectOnVector( planeNormal );
|
|
4423
4409
|
|
|
4424
|
-
return this.sub( _vector$
|
|
4410
|
+
return this.sub( _vector$c );
|
|
4425
4411
|
|
|
4426
4412
|
}
|
|
4427
4413
|
|
|
@@ -4430,7 +4416,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4430
4416
|
// reflect incident vector off plane orthogonal to normal
|
|
4431
4417
|
// normal is assumed to have unit length
|
|
4432
4418
|
|
|
4433
|
-
return this.sub( _vector$
|
|
4419
|
+
return this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
|
|
4434
4420
|
|
|
4435
4421
|
}
|
|
4436
4422
|
|
|
@@ -4632,7 +4618,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4632
4618
|
|
|
4633
4619
|
}
|
|
4634
4620
|
|
|
4635
|
-
const _vector$
|
|
4621
|
+
const _vector$c = /*@__PURE__*/ new Vector3();
|
|
4636
4622
|
const _quaternion$4 = /*@__PURE__*/ new Quaternion();
|
|
4637
4623
|
|
|
4638
4624
|
class Box3 {
|
|
@@ -4661,7 +4647,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4661
4647
|
|
|
4662
4648
|
for ( let i = 0, il = array.length; i < il; i += 3 ) {
|
|
4663
4649
|
|
|
4664
|
-
this.expandByPoint( _vector$
|
|
4650
|
+
this.expandByPoint( _vector$b.fromArray( array, i ) );
|
|
4665
4651
|
|
|
4666
4652
|
}
|
|
4667
4653
|
|
|
@@ -4675,7 +4661,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4675
4661
|
|
|
4676
4662
|
for ( let i = 0, il = attribute.count; i < il; i ++ ) {
|
|
4677
4663
|
|
|
4678
|
-
this.expandByPoint( _vector$
|
|
4664
|
+
this.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );
|
|
4679
4665
|
|
|
4680
4666
|
}
|
|
4681
4667
|
|
|
@@ -4699,7 +4685,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4699
4685
|
|
|
4700
4686
|
setFromCenterAndSize( center, size ) {
|
|
4701
4687
|
|
|
4702
|
-
const halfSize = _vector$
|
|
4688
|
+
const halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );
|
|
4703
4689
|
|
|
4704
4690
|
this.min.copy( center ).sub( halfSize );
|
|
4705
4691
|
this.max.copy( center ).add( halfSize );
|
|
@@ -4809,16 +4795,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4809
4795
|
|
|
4810
4796
|
if ( object.isMesh === true ) {
|
|
4811
4797
|
|
|
4812
|
-
object.getVertexPosition( i, _vector$
|
|
4798
|
+
object.getVertexPosition( i, _vector$b );
|
|
4813
4799
|
|
|
4814
4800
|
} else {
|
|
4815
4801
|
|
|
4816
|
-
_vector$
|
|
4802
|
+
_vector$b.fromBufferAttribute( positionAttribute, i );
|
|
4817
4803
|
|
|
4818
4804
|
}
|
|
4819
4805
|
|
|
4820
|
-
_vector$
|
|
4821
|
-
this.expandByPoint( _vector$
|
|
4806
|
+
_vector$b.applyMatrix4( object.matrixWorld );
|
|
4807
|
+
this.expandByPoint( _vector$b );
|
|
4822
4808
|
|
|
4823
4809
|
}
|
|
4824
4810
|
|
|
@@ -4834,7 +4820,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4834
4820
|
|
|
4835
4821
|
}
|
|
4836
4822
|
|
|
4837
|
-
_box$
|
|
4823
|
+
_box$4.copy( object.boundingBox );
|
|
4838
4824
|
|
|
4839
4825
|
|
|
4840
4826
|
} else {
|
|
@@ -4847,13 +4833,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4847
4833
|
|
|
4848
4834
|
}
|
|
4849
4835
|
|
|
4850
|
-
_box$
|
|
4836
|
+
_box$4.copy( geometry.boundingBox );
|
|
4851
4837
|
|
|
4852
4838
|
}
|
|
4853
4839
|
|
|
4854
|
-
_box$
|
|
4840
|
+
_box$4.applyMatrix4( object.matrixWorld );
|
|
4855
4841
|
|
|
4856
|
-
this.union( _box$
|
|
4842
|
+
this.union( _box$4 );
|
|
4857
4843
|
|
|
4858
4844
|
}
|
|
4859
4845
|
|
|
@@ -4912,10 +4898,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4912
4898
|
intersectsSphere( sphere ) {
|
|
4913
4899
|
|
|
4914
4900
|
// Find the point on the AABB closest to the sphere center.
|
|
4915
|
-
this.clampPoint( sphere.center, _vector$
|
|
4901
|
+
this.clampPoint( sphere.center, _vector$b );
|
|
4916
4902
|
|
|
4917
4903
|
// If that point is inside the sphere, the AABB and sphere intersect.
|
|
4918
|
-
return _vector$
|
|
4904
|
+
return _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );
|
|
4919
4905
|
|
|
4920
4906
|
}
|
|
4921
4907
|
|
|
@@ -5027,7 +5013,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5027
5013
|
|
|
5028
5014
|
distanceToPoint( point ) {
|
|
5029
5015
|
|
|
5030
|
-
return this.clampPoint( point, _vector$
|
|
5016
|
+
return this.clampPoint( point, _vector$b ).distanceTo( point );
|
|
5031
5017
|
|
|
5032
5018
|
}
|
|
5033
5019
|
|
|
@@ -5041,7 +5027,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5041
5027
|
|
|
5042
5028
|
this.getCenter( target.center );
|
|
5043
5029
|
|
|
5044
|
-
target.radius = this.getSize( _vector$
|
|
5030
|
+
target.radius = this.getSize( _vector$b ).length() * 0.5;
|
|
5045
5031
|
|
|
5046
5032
|
}
|
|
5047
5033
|
|
|
@@ -5119,9 +5105,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5119
5105
|
/*@__PURE__*/ new Vector3()
|
|
5120
5106
|
];
|
|
5121
5107
|
|
|
5122
|
-
const _vector$
|
|
5108
|
+
const _vector$b = /*@__PURE__*/ new Vector3();
|
|
5123
5109
|
|
|
5124
|
-
const _box$
|
|
5110
|
+
const _box$4 = /*@__PURE__*/ new Box3();
|
|
5125
5111
|
|
|
5126
5112
|
// triangle centered vertices
|
|
5127
5113
|
|
|
@@ -5166,7 +5152,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5166
5152
|
|
|
5167
5153
|
}
|
|
5168
5154
|
|
|
5169
|
-
const _box$
|
|
5155
|
+
const _box$3 = /*@__PURE__*/ new Box3();
|
|
5170
5156
|
const _v1$6 = /*@__PURE__*/ new Vector3();
|
|
5171
5157
|
const _v2$3 = /*@__PURE__*/ new Vector3();
|
|
5172
5158
|
|
|
@@ -5174,6 +5160,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5174
5160
|
|
|
5175
5161
|
constructor( center = new Vector3(), radius = - 1 ) {
|
|
5176
5162
|
|
|
5163
|
+
this.isSphere = true;
|
|
5164
|
+
|
|
5177
5165
|
this.center = center;
|
|
5178
5166
|
this.radius = radius;
|
|
5179
5167
|
|
|
@@ -5198,7 +5186,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5198
5186
|
|
|
5199
5187
|
} else {
|
|
5200
5188
|
|
|
5201
|
-
_box$
|
|
5189
|
+
_box$3.setFromPoints( points ).getCenter( center );
|
|
5202
5190
|
|
|
5203
5191
|
}
|
|
5204
5192
|
|
|
@@ -5405,7 +5393,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5405
5393
|
|
|
5406
5394
|
}
|
|
5407
5395
|
|
|
5408
|
-
const _vector$
|
|
5396
|
+
const _vector$a = /*@__PURE__*/ new Vector3();
|
|
5409
5397
|
const _segCenter = /*@__PURE__*/ new Vector3();
|
|
5410
5398
|
const _segDir = /*@__PURE__*/ new Vector3();
|
|
5411
5399
|
const _diff = /*@__PURE__*/ new Vector3();
|
|
@@ -5457,7 +5445,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5457
5445
|
|
|
5458
5446
|
recast( t ) {
|
|
5459
5447
|
|
|
5460
|
-
this.origin.copy( this.at( t, _vector$
|
|
5448
|
+
this.origin.copy( this.at( t, _vector$a ) );
|
|
5461
5449
|
|
|
5462
5450
|
return this;
|
|
5463
5451
|
|
|
@@ -5487,7 +5475,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5487
5475
|
|
|
5488
5476
|
distanceSqToPoint( point ) {
|
|
5489
5477
|
|
|
5490
|
-
const directionDistance = _vector$
|
|
5478
|
+
const directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );
|
|
5491
5479
|
|
|
5492
5480
|
// point behind the ray
|
|
5493
5481
|
|
|
@@ -5497,9 +5485,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5497
5485
|
|
|
5498
5486
|
}
|
|
5499
5487
|
|
|
5500
|
-
_vector$
|
|
5488
|
+
_vector$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );
|
|
5501
5489
|
|
|
5502
|
-
return _vector$
|
|
5490
|
+
return _vector$a.distanceToSquared( point );
|
|
5503
5491
|
|
|
5504
5492
|
}
|
|
5505
5493
|
|
|
@@ -5624,9 +5612,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5624
5612
|
|
|
5625
5613
|
intersectSphere( sphere, target ) {
|
|
5626
5614
|
|
|
5627
|
-
_vector$
|
|
5628
|
-
const tca = _vector$
|
|
5629
|
-
const d2 = _vector$
|
|
5615
|
+
_vector$a.subVectors( sphere.center, this.origin );
|
|
5616
|
+
const tca = _vector$a.dot( this.direction );
|
|
5617
|
+
const d2 = _vector$a.dot( _vector$a ) - tca * tca;
|
|
5630
5618
|
const radius2 = sphere.radius * sphere.radius;
|
|
5631
5619
|
|
|
5632
5620
|
if ( d2 > radius2 ) return null;
|
|
@@ -5793,7 +5781,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
5793
5781
|
|
|
5794
5782
|
intersectsBox( box ) {
|
|
5795
5783
|
|
|
5796
|
-
return this.intersectBox( box, _vector$
|
|
5784
|
+
return this.intersectBox( box, _vector$a ) !== null;
|
|
5797
5785
|
|
|
5798
5786
|
}
|
|
5799
5787
|
|
|
@@ -6806,7 +6794,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
6806
6794
|
const _y = /*@__PURE__*/ new Vector3();
|
|
6807
6795
|
const _z = /*@__PURE__*/ new Vector3();
|
|
6808
6796
|
|
|
6809
|
-
const _matrix = /*@__PURE__*/ new Matrix4();
|
|
6797
|
+
const _matrix$1 = /*@__PURE__*/ new Matrix4();
|
|
6810
6798
|
const _quaternion$3 = /*@__PURE__*/ new Quaternion();
|
|
6811
6799
|
|
|
6812
6800
|
class Euler {
|
|
@@ -7041,9 +7029,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
7041
7029
|
|
|
7042
7030
|
setFromQuaternion( q, order, update ) {
|
|
7043
7031
|
|
|
7044
|
-
_matrix.makeRotationFromQuaternion( q );
|
|
7032
|
+
_matrix$1.makeRotationFromQuaternion( q );
|
|
7045
7033
|
|
|
7046
|
-
return this.setFromRotationMatrix( _matrix, order, update );
|
|
7034
|
+
return this.setFromRotationMatrix( _matrix$1, order, update );
|
|
7047
7035
|
|
|
7048
7036
|
}
|
|
7049
7037
|
|
|
@@ -7265,9 +7253,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
7265
7253
|
this.matrixWorld = new Matrix4();
|
|
7266
7254
|
|
|
7267
7255
|
this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
|
|
7268
|
-
this.matrixWorldNeedsUpdate = false;
|
|
7269
7256
|
|
|
7270
7257
|
this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer
|
|
7258
|
+
this.matrixWorldNeedsUpdate = false;
|
|
7271
7259
|
|
|
7272
7260
|
this.layers = new Layers();
|
|
7273
7261
|
this.visible = true;
|
|
@@ -7284,6 +7272,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
7284
7272
|
|
|
7285
7273
|
}
|
|
7286
7274
|
|
|
7275
|
+
onBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
7276
|
+
|
|
7277
|
+
onAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
7278
|
+
|
|
7287
7279
|
onBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
7288
7280
|
|
|
7289
7281
|
onAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
@@ -7624,21 +7616,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
7624
7616
|
|
|
7625
7617
|
}
|
|
7626
7618
|
|
|
7627
|
-
getObjectsByProperty( name, value ) {
|
|
7628
|
-
|
|
7629
|
-
let result = [];
|
|
7619
|
+
getObjectsByProperty( name, value, result = [] ) {
|
|
7630
7620
|
|
|
7631
7621
|
if ( this[ name ] === value ) result.push( this );
|
|
7632
7622
|
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
const childResult = this.children[ i ].getObjectsByProperty( name, value );
|
|
7623
|
+
const children = this.children;
|
|
7636
7624
|
|
|
7637
|
-
|
|
7625
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
7638
7626
|
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
}
|
|
7627
|
+
children[ i ].getObjectsByProperty( name, value, result );
|
|
7642
7628
|
|
|
7643
7629
|
}
|
|
7644
7630
|
|
|
@@ -7886,6 +7872,56 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
7886
7872
|
|
|
7887
7873
|
}
|
|
7888
7874
|
|
|
7875
|
+
if ( this.isBatchedMesh ) {
|
|
7876
|
+
|
|
7877
|
+
object.type = 'BatchedMesh';
|
|
7878
|
+
object.perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
7879
|
+
object.sortObjects = this.sortObjects;
|
|
7880
|
+
|
|
7881
|
+
object.drawRanges = this._drawRanges;
|
|
7882
|
+
object.reservedRanges = this._reservedRanges;
|
|
7883
|
+
|
|
7884
|
+
object.visibility = this._visibility;
|
|
7885
|
+
object.active = this._active;
|
|
7886
|
+
object.bounds = this._bounds.map( bound => ( {
|
|
7887
|
+
boxInitialized: bound.boxInitialized,
|
|
7888
|
+
boxMin: bound.box.min.toArray(),
|
|
7889
|
+
boxMax: bound.box.max.toArray(),
|
|
7890
|
+
|
|
7891
|
+
sphereInitialized: bound.sphereInitialized,
|
|
7892
|
+
sphereRadius: bound.sphere.radius,
|
|
7893
|
+
sphereCenter: bound.sphere.center.toArray()
|
|
7894
|
+
} ) );
|
|
7895
|
+
|
|
7896
|
+
object.maxGeometryCount = this._maxGeometryCount;
|
|
7897
|
+
object.maxVertexCount = this._maxVertexCount;
|
|
7898
|
+
object.maxIndexCount = this._maxIndexCount;
|
|
7899
|
+
|
|
7900
|
+
object.geometryInitialized = this._geometryInitialized;
|
|
7901
|
+
object.geometryCount = this._geometryCount;
|
|
7902
|
+
|
|
7903
|
+
object.matricesTexture = this._matricesTexture.toJSON( meta );
|
|
7904
|
+
|
|
7905
|
+
if ( this.boundingSphere !== null ) {
|
|
7906
|
+
|
|
7907
|
+
object.boundingSphere = {
|
|
7908
|
+
center: object.boundingSphere.center.toArray(),
|
|
7909
|
+
radius: object.boundingSphere.radius
|
|
7910
|
+
};
|
|
7911
|
+
|
|
7912
|
+
}
|
|
7913
|
+
|
|
7914
|
+
if ( this.boundingBox !== null ) {
|
|
7915
|
+
|
|
7916
|
+
object.boundingBox = {
|
|
7917
|
+
min: object.boundingBox.min.toArray(),
|
|
7918
|
+
max: object.boundingBox.max.toArray()
|
|
7919
|
+
};
|
|
7920
|
+
|
|
7921
|
+
}
|
|
7922
|
+
|
|
7923
|
+
}
|
|
7924
|
+
|
|
7889
7925
|
//
|
|
7890
7926
|
|
|
7891
7927
|
function serialize( library, element ) {
|
|
@@ -8086,9 +8122,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
8086
8122
|
this.matrixWorld.copy( source.matrixWorld );
|
|
8087
8123
|
|
|
8088
8124
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
8089
|
-
this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
8090
8125
|
|
|
8091
8126
|
this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
|
|
8127
|
+
this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
8092
8128
|
|
|
8093
8129
|
this.layers.mask = source.layers.mask;
|
|
8094
8130
|
this.visible = source.visible;
|
|
@@ -8184,9 +8220,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
8184
8220
|
// collinear or singular triangle
|
|
8185
8221
|
if ( denom === 0 ) {
|
|
8186
8222
|
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
return target.set( - 2, - 1, - 1 );
|
|
8223
|
+
target.set( 0, 0, 0 );
|
|
8224
|
+
return null;
|
|
8190
8225
|
|
|
8191
8226
|
}
|
|
8192
8227
|
|
|
@@ -8201,7 +8236,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
8201
8236
|
|
|
8202
8237
|
static containsPoint( point, a, b, c ) {
|
|
8203
8238
|
|
|
8204
|
-
|
|
8239
|
+
// if the triangle is degenerate then we can't contain a point
|
|
8240
|
+
if ( this.getBarycoord( point, a, b, c, _v3$1 ) === null ) {
|
|
8241
|
+
|
|
8242
|
+
return false;
|
|
8243
|
+
|
|
8244
|
+
}
|
|
8205
8245
|
|
|
8206
8246
|
return ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );
|
|
8207
8247
|
|
|
@@ -8223,7 +8263,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
8223
8263
|
|
|
8224
8264
|
static getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {
|
|
8225
8265
|
|
|
8226
|
-
this.getBarycoord( point, p1, p2, p3, _v3$1 )
|
|
8266
|
+
if ( this.getBarycoord( point, p1, p2, p3, _v3$1 ) === null ) {
|
|
8267
|
+
|
|
8268
|
+
target.x = 0;
|
|
8269
|
+
target.y = 0;
|
|
8270
|
+
if ( 'z' in target ) target.z = 0;
|
|
8271
|
+
if ( 'w' in target ) target.w = 0;
|
|
8272
|
+
return null;
|
|
8273
|
+
|
|
8274
|
+
}
|
|
8227
8275
|
|
|
8228
8276
|
target.setScalar( 0 );
|
|
8229
8277
|
target.addScaledVector( v1, _v3$1.x );
|
|
@@ -9829,7 +9877,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9829
9877
|
fromHalfFloat: fromHalfFloat,
|
|
9830
9878
|
};
|
|
9831
9879
|
|
|
9832
|
-
const _vector$
|
|
9880
|
+
const _vector$9 = /*@__PURE__*/ new Vector3();
|
|
9833
9881
|
const _vector2$1 = /*@__PURE__*/ new Vector2();
|
|
9834
9882
|
|
|
9835
9883
|
class BufferAttribute {
|
|
@@ -9852,7 +9900,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9852
9900
|
this.normalized = normalized;
|
|
9853
9901
|
|
|
9854
9902
|
this.usage = StaticDrawUsage;
|
|
9855
|
-
this.
|
|
9903
|
+
this._updateRange = { offset: 0, count: - 1 };
|
|
9904
|
+
this.updateRanges = [];
|
|
9856
9905
|
this.gpuType = FloatType;
|
|
9857
9906
|
|
|
9858
9907
|
this.version = 0;
|
|
@@ -9867,6 +9916,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9867
9916
|
|
|
9868
9917
|
}
|
|
9869
9918
|
|
|
9919
|
+
get updateRange() {
|
|
9920
|
+
|
|
9921
|
+
console.warn( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
9922
|
+
return this._updateRange;
|
|
9923
|
+
|
|
9924
|
+
}
|
|
9925
|
+
|
|
9870
9926
|
setUsage( value ) {
|
|
9871
9927
|
|
|
9872
9928
|
this.usage = value;
|
|
@@ -9875,6 +9931,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9875
9931
|
|
|
9876
9932
|
}
|
|
9877
9933
|
|
|
9934
|
+
addUpdateRange( start, count ) {
|
|
9935
|
+
|
|
9936
|
+
this.updateRanges.push( { start, count } );
|
|
9937
|
+
|
|
9938
|
+
}
|
|
9939
|
+
|
|
9940
|
+
clearUpdateRanges() {
|
|
9941
|
+
|
|
9942
|
+
this.updateRanges.length = 0;
|
|
9943
|
+
|
|
9944
|
+
}
|
|
9945
|
+
|
|
9878
9946
|
copy( source ) {
|
|
9879
9947
|
|
|
9880
9948
|
this.name = source.name;
|
|
@@ -9930,10 +9998,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9930
9998
|
|
|
9931
9999
|
for ( let i = 0, l = this.count; i < l; i ++ ) {
|
|
9932
10000
|
|
|
9933
|
-
_vector$
|
|
9934
|
-
_vector$
|
|
10001
|
+
_vector$9.fromBufferAttribute( this, i );
|
|
10002
|
+
_vector$9.applyMatrix3( m );
|
|
9935
10003
|
|
|
9936
|
-
this.setXYZ( i, _vector$
|
|
10004
|
+
this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
|
|
9937
10005
|
|
|
9938
10006
|
}
|
|
9939
10007
|
|
|
@@ -9947,11 +10015,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9947
10015
|
|
|
9948
10016
|
for ( let i = 0, l = this.count; i < l; i ++ ) {
|
|
9949
10017
|
|
|
9950
|
-
_vector$
|
|
10018
|
+
_vector$9.fromBufferAttribute( this, i );
|
|
9951
10019
|
|
|
9952
|
-
_vector$
|
|
10020
|
+
_vector$9.applyMatrix4( m );
|
|
9953
10021
|
|
|
9954
|
-
this.setXYZ( i, _vector$
|
|
10022
|
+
this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
|
|
9955
10023
|
|
|
9956
10024
|
}
|
|
9957
10025
|
|
|
@@ -9963,11 +10031,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9963
10031
|
|
|
9964
10032
|
for ( let i = 0, l = this.count; i < l; i ++ ) {
|
|
9965
10033
|
|
|
9966
|
-
_vector$
|
|
10034
|
+
_vector$9.fromBufferAttribute( this, i );
|
|
9967
10035
|
|
|
9968
|
-
_vector$
|
|
10036
|
+
_vector$9.applyNormalMatrix( m );
|
|
9969
10037
|
|
|
9970
|
-
this.setXYZ( i, _vector$
|
|
10038
|
+
this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
|
|
9971
10039
|
|
|
9972
10040
|
}
|
|
9973
10041
|
|
|
@@ -9979,11 +10047,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
9979
10047
|
|
|
9980
10048
|
for ( let i = 0, l = this.count; i < l; i ++ ) {
|
|
9981
10049
|
|
|
9982
|
-
_vector$
|
|
10050
|
+
_vector$9.fromBufferAttribute( this, i );
|
|
9983
10051
|
|
|
9984
|
-
_vector$
|
|
10052
|
+
_vector$9.transformDirection( m );
|
|
9985
10053
|
|
|
9986
|
-
this.setXYZ( i, _vector$
|
|
10054
|
+
this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
|
|
9987
10055
|
|
|
9988
10056
|
}
|
|
9989
10057
|
|
|
@@ -10185,7 +10253,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10185
10253
|
|
|
10186
10254
|
if ( this.name !== '' ) data.name = this.name;
|
|
10187
10255
|
if ( this.usage !== StaticDrawUsage ) data.usage = this.usage;
|
|
10188
|
-
if ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;
|
|
10189
10256
|
|
|
10190
10257
|
return data;
|
|
10191
10258
|
|
|
@@ -10443,9 +10510,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10443
10510
|
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
10444
10511
|
const _obj = /*@__PURE__*/ new Object3D();
|
|
10445
10512
|
const _offset = /*@__PURE__*/ new Vector3();
|
|
10446
|
-
const _box$
|
|
10513
|
+
const _box$2 = /*@__PURE__*/ new Box3();
|
|
10447
10514
|
const _boxMorphTargets = /*@__PURE__*/ new Box3();
|
|
10448
|
-
const _vector$
|
|
10515
|
+
const _vector$8 = /*@__PURE__*/ new Vector3();
|
|
10449
10516
|
|
|
10450
10517
|
class BufferGeometry extends EventDispatcher {
|
|
10451
10518
|
|
|
@@ -10750,20 +10817,20 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10750
10817
|
for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
|
|
10751
10818
|
|
|
10752
10819
|
const morphAttribute = morphAttributesPosition[ i ];
|
|
10753
|
-
_box$
|
|
10820
|
+
_box$2.setFromBufferAttribute( morphAttribute );
|
|
10754
10821
|
|
|
10755
10822
|
if ( this.morphTargetsRelative ) {
|
|
10756
10823
|
|
|
10757
|
-
_vector$
|
|
10758
|
-
this.boundingBox.expandByPoint( _vector$
|
|
10824
|
+
_vector$8.addVectors( this.boundingBox.min, _box$2.min );
|
|
10825
|
+
this.boundingBox.expandByPoint( _vector$8 );
|
|
10759
10826
|
|
|
10760
|
-
_vector$
|
|
10761
|
-
this.boundingBox.expandByPoint( _vector$
|
|
10827
|
+
_vector$8.addVectors( this.boundingBox.max, _box$2.max );
|
|
10828
|
+
this.boundingBox.expandByPoint( _vector$8 );
|
|
10762
10829
|
|
|
10763
10830
|
} else {
|
|
10764
10831
|
|
|
10765
|
-
this.boundingBox.expandByPoint( _box$
|
|
10766
|
-
this.boundingBox.expandByPoint( _box$
|
|
10832
|
+
this.boundingBox.expandByPoint( _box$2.min );
|
|
10833
|
+
this.boundingBox.expandByPoint( _box$2.max );
|
|
10767
10834
|
|
|
10768
10835
|
}
|
|
10769
10836
|
|
|
@@ -10812,7 +10879,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10812
10879
|
|
|
10813
10880
|
const center = this.boundingSphere.center;
|
|
10814
10881
|
|
|
10815
|
-
_box$
|
|
10882
|
+
_box$2.setFromBufferAttribute( position );
|
|
10816
10883
|
|
|
10817
10884
|
// process morph attributes if present
|
|
10818
10885
|
|
|
@@ -10825,16 +10892,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10825
10892
|
|
|
10826
10893
|
if ( this.morphTargetsRelative ) {
|
|
10827
10894
|
|
|
10828
|
-
_vector$
|
|
10829
|
-
_box$
|
|
10895
|
+
_vector$8.addVectors( _box$2.min, _boxMorphTargets.min );
|
|
10896
|
+
_box$2.expandByPoint( _vector$8 );
|
|
10830
10897
|
|
|
10831
|
-
_vector$
|
|
10832
|
-
_box$
|
|
10898
|
+
_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );
|
|
10899
|
+
_box$2.expandByPoint( _vector$8 );
|
|
10833
10900
|
|
|
10834
10901
|
} else {
|
|
10835
10902
|
|
|
10836
|
-
_box$
|
|
10837
|
-
_box$
|
|
10903
|
+
_box$2.expandByPoint( _boxMorphTargets.min );
|
|
10904
|
+
_box$2.expandByPoint( _boxMorphTargets.max );
|
|
10838
10905
|
|
|
10839
10906
|
}
|
|
10840
10907
|
|
|
@@ -10842,7 +10909,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10842
10909
|
|
|
10843
10910
|
}
|
|
10844
10911
|
|
|
10845
|
-
_box$
|
|
10912
|
+
_box$2.getCenter( center );
|
|
10846
10913
|
|
|
10847
10914
|
// second, try to find a boundingSphere with a radius smaller than the
|
|
10848
10915
|
// boundingSphere of the boundingBox: sqrt(3) smaller in the best case
|
|
@@ -10851,9 +10918,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10851
10918
|
|
|
10852
10919
|
for ( let i = 0, il = position.count; i < il; i ++ ) {
|
|
10853
10920
|
|
|
10854
|
-
_vector$
|
|
10921
|
+
_vector$8.fromBufferAttribute( position, i );
|
|
10855
10922
|
|
|
10856
|
-
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$
|
|
10923
|
+
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );
|
|
10857
10924
|
|
|
10858
10925
|
}
|
|
10859
10926
|
|
|
@@ -10868,16 +10935,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
10868
10935
|
|
|
10869
10936
|
for ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
|
|
10870
10937
|
|
|
10871
|
-
_vector$
|
|
10938
|
+
_vector$8.fromBufferAttribute( morphAttribute, j );
|
|
10872
10939
|
|
|
10873
10940
|
if ( morphTargetsRelative ) {
|
|
10874
10941
|
|
|
10875
10942
|
_offset.fromBufferAttribute( position, j );
|
|
10876
|
-
_vector$
|
|
10943
|
+
_vector$8.add( _offset );
|
|
10877
10944
|
|
|
10878
10945
|
}
|
|
10879
10946
|
|
|
10880
|
-
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$
|
|
10947
|
+
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );
|
|
10881
10948
|
|
|
10882
10949
|
}
|
|
10883
10950
|
|
|
@@ -11160,11 +11227,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
11160
11227
|
|
|
11161
11228
|
for ( let i = 0, il = normals.count; i < il; i ++ ) {
|
|
11162
11229
|
|
|
11163
|
-
_vector$
|
|
11230
|
+
_vector$8.fromBufferAttribute( normals, i );
|
|
11164
11231
|
|
|
11165
|
-
_vector$
|
|
11232
|
+
_vector$8.normalize();
|
|
11166
11233
|
|
|
11167
|
-
normals.setXYZ( i, _vector$
|
|
11234
|
+
normals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );
|
|
11168
11235
|
|
|
11169
11236
|
}
|
|
11170
11237
|
|
|
@@ -11506,7 +11573,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
11506
11573
|
|
|
11507
11574
|
const _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();
|
|
11508
11575
|
const _ray$3 = /*@__PURE__*/ new Ray();
|
|
11509
|
-
const _sphere$
|
|
11576
|
+
const _sphere$6 = /*@__PURE__*/ new Sphere();
|
|
11510
11577
|
const _sphereHitAt = /*@__PURE__*/ new Vector3();
|
|
11511
11578
|
|
|
11512
11579
|
const _vA$1 = /*@__PURE__*/ new Vector3();
|
|
@@ -11654,16 +11721,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
11654
11721
|
|
|
11655
11722
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
11656
11723
|
|
|
11657
|
-
_sphere$
|
|
11658
|
-
_sphere$
|
|
11724
|
+
_sphere$6.copy( geometry.boundingSphere );
|
|
11725
|
+
_sphere$6.applyMatrix4( matrixWorld );
|
|
11659
11726
|
|
|
11660
11727
|
// check distance from ray origin to bounding sphere
|
|
11661
11728
|
|
|
11662
11729
|
_ray$3.copy( raycaster.ray ).recast( raycaster.near );
|
|
11663
11730
|
|
|
11664
|
-
if ( _sphere$
|
|
11731
|
+
if ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {
|
|
11665
11732
|
|
|
11666
|
-
if ( _ray$3.intersectSphere( _sphere$
|
|
11733
|
+
if ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;
|
|
11667
11734
|
|
|
11668
11735
|
if ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;
|
|
11669
11736
|
|
|
@@ -12233,7 +12300,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
12233
12300
|
derivatives: false, // set to use derivatives
|
|
12234
12301
|
fragDepth: false, // set to use fragment depth values
|
|
12235
12302
|
drawBuffers: false, // set to use draw buffers
|
|
12236
|
-
shaderTextureLOD: false // set to use shader texture LOD
|
|
12303
|
+
shaderTextureLOD: false, // set to use shader texture LOD
|
|
12304
|
+
clipCullDistance: false // set to use vertex shader clipping
|
|
12237
12305
|
};
|
|
12238
12306
|
|
|
12239
12307
|
// When rendered geometry doesn't include these attributes but the material does,
|
|
@@ -13216,8 +13284,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13216
13284
|
|
|
13217
13285
|
}
|
|
13218
13286
|
|
|
13219
|
-
const _sphere$
|
|
13220
|
-
const _vector$
|
|
13287
|
+
const _sphere$5 = /*@__PURE__*/ new Sphere();
|
|
13288
|
+
const _vector$7 = /*@__PURE__*/ new Vector3();
|
|
13221
13289
|
|
|
13222
13290
|
class Frustum {
|
|
13223
13291
|
|
|
@@ -13295,7 +13363,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13295
13363
|
|
|
13296
13364
|
if ( object.boundingSphere === null ) object.computeBoundingSphere();
|
|
13297
13365
|
|
|
13298
|
-
_sphere$
|
|
13366
|
+
_sphere$5.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );
|
|
13299
13367
|
|
|
13300
13368
|
} else {
|
|
13301
13369
|
|
|
@@ -13303,21 +13371,21 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13303
13371
|
|
|
13304
13372
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
13305
13373
|
|
|
13306
|
-
_sphere$
|
|
13374
|
+
_sphere$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
|
|
13307
13375
|
|
|
13308
13376
|
}
|
|
13309
13377
|
|
|
13310
|
-
return this.intersectsSphere( _sphere$
|
|
13378
|
+
return this.intersectsSphere( _sphere$5 );
|
|
13311
13379
|
|
|
13312
13380
|
}
|
|
13313
13381
|
|
|
13314
13382
|
intersectsSprite( sprite ) {
|
|
13315
13383
|
|
|
13316
|
-
_sphere$
|
|
13317
|
-
_sphere$
|
|
13318
|
-
_sphere$
|
|
13384
|
+
_sphere$5.center.set( 0, 0, 0 );
|
|
13385
|
+
_sphere$5.radius = 0.7071067811865476;
|
|
13386
|
+
_sphere$5.applyMatrix4( sprite.matrixWorld );
|
|
13319
13387
|
|
|
13320
|
-
return this.intersectsSphere( _sphere$
|
|
13388
|
+
return this.intersectsSphere( _sphere$5 );
|
|
13321
13389
|
|
|
13322
13390
|
}
|
|
13323
13391
|
|
|
@@ -13353,11 +13421,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13353
13421
|
|
|
13354
13422
|
// corner at max distance
|
|
13355
13423
|
|
|
13356
|
-
_vector$
|
|
13357
|
-
_vector$
|
|
13358
|
-
_vector$
|
|
13424
|
+
_vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;
|
|
13425
|
+
_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;
|
|
13426
|
+
_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;
|
|
13359
13427
|
|
|
13360
|
-
if ( plane.distanceToPoint( _vector$
|
|
13428
|
+
if ( plane.distanceToPoint( _vector$7 ) < 0 ) {
|
|
13361
13429
|
|
|
13362
13430
|
return false;
|
|
13363
13431
|
|
|
@@ -13457,6 +13525,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13457
13525
|
|
|
13458
13526
|
const array = attribute.array;
|
|
13459
13527
|
const usage = attribute.usage;
|
|
13528
|
+
const size = array.byteLength;
|
|
13460
13529
|
|
|
13461
13530
|
const buffer = gl.createBuffer();
|
|
13462
13531
|
|
|
@@ -13525,7 +13594,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13525
13594
|
buffer: buffer,
|
|
13526
13595
|
type: type,
|
|
13527
13596
|
bytesPerElement: array.BYTES_PER_ELEMENT,
|
|
13528
|
-
version: attribute.version
|
|
13597
|
+
version: attribute.version,
|
|
13598
|
+
size: size
|
|
13529
13599
|
};
|
|
13530
13600
|
|
|
13531
13601
|
}
|
|
@@ -13533,17 +13603,43 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13533
13603
|
function updateBuffer( buffer, attribute, bufferType ) {
|
|
13534
13604
|
|
|
13535
13605
|
const array = attribute.array;
|
|
13536
|
-
const updateRange = attribute.
|
|
13606
|
+
const updateRange = attribute._updateRange; // deprecated
|
|
13607
|
+
const updateRanges = attribute.updateRanges;
|
|
13537
13608
|
|
|
13538
13609
|
gl.bindBuffer( bufferType, buffer );
|
|
13539
13610
|
|
|
13540
|
-
if ( updateRange.count === - 1 ) {
|
|
13611
|
+
if ( updateRange.count === - 1 && updateRanges.length === 0 ) {
|
|
13541
13612
|
|
|
13542
13613
|
// Not using update ranges
|
|
13543
|
-
|
|
13544
13614
|
gl.bufferSubData( bufferType, 0, array );
|
|
13545
13615
|
|
|
13546
|
-
}
|
|
13616
|
+
}
|
|
13617
|
+
|
|
13618
|
+
if ( updateRanges.length !== 0 ) {
|
|
13619
|
+
|
|
13620
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
13621
|
+
|
|
13622
|
+
const range = updateRanges[ i ];
|
|
13623
|
+
if ( isWebGL2 ) {
|
|
13624
|
+
|
|
13625
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13626
|
+
array, range.start, range.count );
|
|
13627
|
+
|
|
13628
|
+
} else {
|
|
13629
|
+
|
|
13630
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13631
|
+
array.subarray( range.start, range.start + range.count ) );
|
|
13632
|
+
|
|
13633
|
+
}
|
|
13634
|
+
|
|
13635
|
+
}
|
|
13636
|
+
|
|
13637
|
+
attribute.clearUpdateRanges();
|
|
13638
|
+
|
|
13639
|
+
}
|
|
13640
|
+
|
|
13641
|
+
// deprecated
|
|
13642
|
+
if ( updateRange.count !== - 1 ) {
|
|
13547
13643
|
|
|
13548
13644
|
if ( isWebGL2 ) {
|
|
13549
13645
|
|
|
@@ -13622,6 +13718,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13622
13718
|
|
|
13623
13719
|
} else if ( data.version < attribute.version ) {
|
|
13624
13720
|
|
|
13721
|
+
if ( data.size !== attribute.array.byteLength ) {
|
|
13722
|
+
|
|
13723
|
+
throw new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );
|
|
13724
|
+
|
|
13725
|
+
}
|
|
13726
|
+
|
|
13625
13727
|
updateBuffer( data.buffer, attribute, bufferType );
|
|
13626
13728
|
|
|
13627
13729
|
data.version = attribute.version;
|
|
@@ -13750,6 +13852,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13750
13852
|
|
|
13751
13853
|
var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
|
|
13752
13854
|
|
|
13855
|
+
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";
|
|
13856
|
+
|
|
13857
|
+
var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif";
|
|
13858
|
+
|
|
13753
13859
|
var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
|
|
13754
13860
|
|
|
13755
13861
|
var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
|
|
@@ -13778,9 +13884,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13778
13884
|
|
|
13779
13885
|
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";
|
|
13780
13886
|
|
|
13781
|
-
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define
|
|
13887
|
+
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
13782
13888
|
|
|
13783
|
-
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3
|
|
13889
|
+
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
|
|
13784
13890
|
|
|
13785
13891
|
var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
|
|
13786
13892
|
|
|
@@ -13834,7 +13940,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13834
13940
|
|
|
13835
13941
|
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";
|
|
13836
13942
|
|
|
13837
|
-
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\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x
|
|
13943
|
+
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";
|
|
13838
13944
|
|
|
13839
13945
|
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}";
|
|
13840
13946
|
|
|
@@ -13898,7 +14004,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13898
14004
|
|
|
13899
14005
|
var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
|
|
13900
14006
|
|
|
13901
|
-
var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
|
|
14007
|
+
var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
|
|
13902
14008
|
|
|
13903
14009
|
var dithering_fragment = "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";
|
|
13904
14010
|
|
|
@@ -13918,7 +14024,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13918
14024
|
|
|
13919
14025
|
var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
|
|
13920
14026
|
|
|
13921
|
-
var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\
|
|
14027
|
+
var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 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( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";
|
|
13922
14028
|
|
|
13923
14029
|
var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";
|
|
13924
14030
|
|
|
@@ -13930,7 +14036,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13930
14036
|
|
|
13931
14037
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
13932
14038
|
|
|
13933
|
-
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}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
14039
|
+
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 = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor *= toneMappingExposure;\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\treturn color;\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
13934
14040
|
|
|
13935
14041
|
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";
|
|
13936
14042
|
|
|
@@ -13942,7 +14048,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13942
14048
|
|
|
13943
14049
|
var uv_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
|
|
13944
14050
|
|
|
13945
|
-
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
|
|
14051
|
+
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
|
|
13946
14052
|
|
|
13947
14053
|
const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
13948
14054
|
|
|
@@ -13956,11 +14062,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13956
14062
|
|
|
13957
14063
|
const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
|
|
13958
14064
|
|
|
13959
|
-
const vertex$e = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
14065
|
+
const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
13960
14066
|
|
|
13961
14067
|
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
|
|
13962
14068
|
|
|
13963
|
-
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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 <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
14069
|
+
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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 <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
13964
14070
|
|
|
13965
14071
|
const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\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 <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
|
|
13966
14072
|
|
|
@@ -13972,31 +14078,31 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13972
14078
|
|
|
13973
14079
|
const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
|
|
13974
14080
|
|
|
13975
|
-
const vertex$a = "#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
14081
|
+
const vertex$a = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13976
14082
|
|
|
13977
14083
|
const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <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}";
|
|
13978
14084
|
|
|
13979
|
-
const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
14085
|
+
const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_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 <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13980
14086
|
|
|
13981
14087
|
const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
|
|
13982
14088
|
|
|
13983
|
-
const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
|
|
14089
|
+
const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
|
|
13984
14090
|
|
|
13985
14091
|
const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <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}";
|
|
13986
14092
|
|
|
13987
|
-
const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
|
|
14093
|
+
const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
|
|
13988
14094
|
|
|
13989
14095
|
const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
|
|
13990
14096
|
|
|
13991
|
-
const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
14097
|
+
const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_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 <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
13992
14098
|
|
|
13993
14099
|
const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <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}";
|
|
13994
14100
|
|
|
13995
|
-
const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <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 <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
|
|
14101
|
+
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 <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}";
|
|
13996
14102
|
|
|
13997
14103
|
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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <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}";
|
|
13998
14104
|
|
|
13999
|
-
const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\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 <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
14105
|
+
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 <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}";
|
|
14000
14106
|
|
|
14001
14107
|
const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <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}";
|
|
14002
14108
|
|
|
@@ -14004,7 +14110,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
14004
14110
|
|
|
14005
14111
|
const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
|
|
14006
14112
|
|
|
14007
|
-
const vertex$2 = "#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
14113
|
+
const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
14008
14114
|
|
|
14009
14115
|
const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
|
|
14010
14116
|
|
|
@@ -14021,6 +14127,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
14021
14127
|
alphatest_pars_fragment: alphatest_pars_fragment,
|
|
14022
14128
|
aomap_fragment: aomap_fragment,
|
|
14023
14129
|
aomap_pars_fragment: aomap_pars_fragment,
|
|
14130
|
+
batching_pars_vertex: batching_pars_vertex,
|
|
14131
|
+
batching_vertex: batching_vertex,
|
|
14024
14132
|
begin_vertex: begin_vertex,
|
|
14025
14133
|
beginnormal_vertex: beginnormal_vertex,
|
|
14026
14134
|
bsdfs: bsdfs,
|
|
@@ -15634,11 +15742,42 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
15634
15742
|
|
|
15635
15743
|
}
|
|
15636
15744
|
|
|
15745
|
+
function renderMultiDraw( starts, counts, drawCount ) {
|
|
15746
|
+
|
|
15747
|
+
if ( drawCount === 0 ) return;
|
|
15748
|
+
|
|
15749
|
+
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15750
|
+
if ( extension === null ) {
|
|
15751
|
+
|
|
15752
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15753
|
+
|
|
15754
|
+
this.render( starts[ i ], counts[ i ] );
|
|
15755
|
+
|
|
15756
|
+
}
|
|
15757
|
+
|
|
15758
|
+
} else {
|
|
15759
|
+
|
|
15760
|
+
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
15761
|
+
|
|
15762
|
+
let elementCount = 0;
|
|
15763
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15764
|
+
|
|
15765
|
+
elementCount += counts[ i ];
|
|
15766
|
+
|
|
15767
|
+
}
|
|
15768
|
+
|
|
15769
|
+
info.update( elementCount, mode, 1 );
|
|
15770
|
+
|
|
15771
|
+
}
|
|
15772
|
+
|
|
15773
|
+
}
|
|
15774
|
+
|
|
15637
15775
|
//
|
|
15638
15776
|
|
|
15639
15777
|
this.setMode = setMode;
|
|
15640
15778
|
this.render = render;
|
|
15641
15779
|
this.renderInstances = renderInstances;
|
|
15780
|
+
this.renderMultiDraw = renderMultiDraw;
|
|
15642
15781
|
|
|
15643
15782
|
}
|
|
15644
15783
|
|
|
@@ -15948,7 +16087,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
15948
16087
|
|
|
15949
16088
|
function get( texture ) {
|
|
15950
16089
|
|
|
15951
|
-
if ( texture && texture.isTexture
|
|
16090
|
+
if ( texture && texture.isTexture ) {
|
|
15952
16091
|
|
|
15953
16092
|
const mapping = texture.mapping;
|
|
15954
16093
|
|
|
@@ -17216,6 +17355,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
17216
17355
|
if ( capabilities.isWebGL2 ) {
|
|
17217
17356
|
|
|
17218
17357
|
getExtension( 'EXT_color_buffer_float' );
|
|
17358
|
+
getExtension( 'WEBGL_clip_cull_distance' );
|
|
17219
17359
|
|
|
17220
17360
|
} else {
|
|
17221
17361
|
|
|
@@ -17520,12 +17660,43 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
17520
17660
|
|
|
17521
17661
|
}
|
|
17522
17662
|
|
|
17663
|
+
function renderMultiDraw( starts, counts, drawCount ) {
|
|
17664
|
+
|
|
17665
|
+
if ( drawCount === 0 ) return;
|
|
17666
|
+
|
|
17667
|
+
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17668
|
+
if ( extension === null ) {
|
|
17669
|
+
|
|
17670
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17671
|
+
|
|
17672
|
+
this.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
17673
|
+
|
|
17674
|
+
}
|
|
17675
|
+
|
|
17676
|
+
} else {
|
|
17677
|
+
|
|
17678
|
+
extension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );
|
|
17679
|
+
|
|
17680
|
+
let elementCount = 0;
|
|
17681
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17682
|
+
|
|
17683
|
+
elementCount += counts[ i ];
|
|
17684
|
+
|
|
17685
|
+
}
|
|
17686
|
+
|
|
17687
|
+
info.update( elementCount, mode, 1 );
|
|
17688
|
+
|
|
17689
|
+
}
|
|
17690
|
+
|
|
17691
|
+
}
|
|
17692
|
+
|
|
17523
17693
|
//
|
|
17524
17694
|
|
|
17525
17695
|
this.setMode = setMode;
|
|
17526
17696
|
this.setIndex = setIndex;
|
|
17527
17697
|
this.render = render;
|
|
17528
17698
|
this.renderInstances = renderInstances;
|
|
17699
|
+
this.renderMultiDraw = renderMultiDraw;
|
|
17529
17700
|
|
|
17530
17701
|
}
|
|
17531
17702
|
|
|
@@ -18078,6 +18249,60 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
18078
18249
|
|
|
18079
18250
|
}
|
|
18080
18251
|
|
|
18252
|
+
class DepthTexture extends Texture {
|
|
18253
|
+
|
|
18254
|
+
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
18255
|
+
|
|
18256
|
+
format = format !== undefined ? format : DepthFormat;
|
|
18257
|
+
|
|
18258
|
+
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
18259
|
+
|
|
18260
|
+
throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
|
18261
|
+
|
|
18262
|
+
}
|
|
18263
|
+
|
|
18264
|
+
if ( type === undefined && format === DepthFormat ) type = UnsignedIntType;
|
|
18265
|
+
if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
|
|
18266
|
+
|
|
18267
|
+
super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
18268
|
+
|
|
18269
|
+
this.isDepthTexture = true;
|
|
18270
|
+
|
|
18271
|
+
this.image = { width: width, height: height };
|
|
18272
|
+
|
|
18273
|
+
this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
18274
|
+
this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
18275
|
+
|
|
18276
|
+
this.flipY = false;
|
|
18277
|
+
this.generateMipmaps = false;
|
|
18278
|
+
|
|
18279
|
+
this.compareFunction = null;
|
|
18280
|
+
|
|
18281
|
+
}
|
|
18282
|
+
|
|
18283
|
+
|
|
18284
|
+
copy( source ) {
|
|
18285
|
+
|
|
18286
|
+
super.copy( source );
|
|
18287
|
+
|
|
18288
|
+
this.compareFunction = source.compareFunction;
|
|
18289
|
+
|
|
18290
|
+
return this;
|
|
18291
|
+
|
|
18292
|
+
}
|
|
18293
|
+
|
|
18294
|
+
toJSON( meta ) {
|
|
18295
|
+
|
|
18296
|
+
const data = super.toJSON( meta );
|
|
18297
|
+
|
|
18298
|
+
if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
|
|
18299
|
+
|
|
18300
|
+
return data;
|
|
18301
|
+
|
|
18302
|
+
}
|
|
18303
|
+
|
|
18304
|
+
}
|
|
18305
|
+
|
|
18081
18306
|
/**
|
|
18082
18307
|
* Uniforms of a program.
|
|
18083
18308
|
* Those form a tree structure with a special top-level container for the root,
|
|
@@ -18123,6 +18348,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
18123
18348
|
|
|
18124
18349
|
|
|
18125
18350
|
const emptyTexture = /*@__PURE__*/ new Texture();
|
|
18351
|
+
|
|
18352
|
+
const emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );
|
|
18353
|
+
emptyShadowTexture.compareFunction = LessEqualCompare;
|
|
18354
|
+
|
|
18126
18355
|
const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
|
|
18127
18356
|
const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
|
|
18128
18357
|
const emptyCubeTexture = /*@__PURE__*/ new CubeTexture();
|
|
@@ -18639,7 +18868,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
18639
18868
|
|
|
18640
18869
|
}
|
|
18641
18870
|
|
|
18642
|
-
|
|
18871
|
+
const emptyTexture2D = ( this.type === gl.SAMPLER_2D_SHADOW ) ? emptyShadowTexture : emptyTexture;
|
|
18872
|
+
|
|
18873
|
+
textures.setTexture2D( v || emptyTexture2D, unit );
|
|
18643
18874
|
|
|
18644
18875
|
}
|
|
18645
18876
|
|
|
@@ -19023,6 +19254,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19023
19254
|
this.id = id;
|
|
19024
19255
|
this.addr = addr;
|
|
19025
19256
|
this.cache = [];
|
|
19257
|
+
this.type = activeInfo.type;
|
|
19026
19258
|
this.setValue = getSingularSetter( activeInfo.type );
|
|
19027
19259
|
|
|
19028
19260
|
// this.path = activeInfo.name; // DEBUG
|
|
@@ -19038,6 +19270,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19038
19270
|
this.id = id;
|
|
19039
19271
|
this.addr = addr;
|
|
19040
19272
|
this.cache = [];
|
|
19273
|
+
this.type = activeInfo.type;
|
|
19041
19274
|
this.size = activeInfo.size;
|
|
19042
19275
|
this.setValue = getPureArraySetter( activeInfo.type );
|
|
19043
19276
|
|
|
@@ -19346,6 +19579,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19346
19579
|
toneMappingName = 'ACESFilmic';
|
|
19347
19580
|
break;
|
|
19348
19581
|
|
|
19582
|
+
case AgXToneMapping:
|
|
19583
|
+
toneMappingName = 'AgX';
|
|
19584
|
+
break;
|
|
19585
|
+
|
|
19349
19586
|
case CustomToneMapping:
|
|
19350
19587
|
toneMappingName = 'Custom';
|
|
19351
19588
|
break;
|
|
@@ -19373,6 +19610,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19373
19610
|
|
|
19374
19611
|
}
|
|
19375
19612
|
|
|
19613
|
+
function generateVertexExtensions( parameters ) {
|
|
19614
|
+
|
|
19615
|
+
const chunks = [
|
|
19616
|
+
parameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : ''
|
|
19617
|
+
];
|
|
19618
|
+
|
|
19619
|
+
return chunks.filter( filterEmptyLine ).join( '\n' );
|
|
19620
|
+
|
|
19621
|
+
}
|
|
19622
|
+
|
|
19376
19623
|
function generateDefines( defines ) {
|
|
19377
19624
|
|
|
19378
19625
|
const chunks = [];
|
|
@@ -19677,6 +19924,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19677
19924
|
|
|
19678
19925
|
const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
|
|
19679
19926
|
|
|
19927
|
+
const customVertexExtensions = generateVertexExtensions( parameters );
|
|
19928
|
+
|
|
19680
19929
|
const customDefines = generateDefines( defines );
|
|
19681
19930
|
|
|
19682
19931
|
const program = gl.createProgram();
|
|
@@ -19731,6 +19980,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19731
19980
|
|
|
19732
19981
|
customDefines,
|
|
19733
19982
|
|
|
19983
|
+
parameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',
|
|
19984
|
+
parameters.batching ? '#define USE_BATCHING' : '',
|
|
19734
19985
|
parameters.instancing ? '#define USE_INSTANCING' : '',
|
|
19735
19986
|
parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
|
|
19736
19987
|
|
|
@@ -20070,6 +20321,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20070
20321
|
versionString = '#version 300 es\n';
|
|
20071
20322
|
|
|
20072
20323
|
prefixVertex = [
|
|
20324
|
+
customVertexExtensions,
|
|
20073
20325
|
'precision mediump sampler2DArray;',
|
|
20074
20326
|
'#define attribute in',
|
|
20075
20327
|
'#define varying out',
|
|
@@ -20563,6 +20815,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20563
20815
|
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
20564
20816
|
|
|
20565
20817
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
20818
|
+
const IS_BATCHEDMESH = object.isBatchedMesh === true;
|
|
20566
20819
|
|
|
20567
20820
|
const HAS_MAP = !! material.map;
|
|
20568
20821
|
const HAS_MATCAP = !! material.matcap;
|
|
@@ -20648,6 +20901,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20648
20901
|
|
|
20649
20902
|
precision: precision,
|
|
20650
20903
|
|
|
20904
|
+
batching: IS_BATCHEDMESH,
|
|
20651
20905
|
instancing: IS_INSTANCEDMESH,
|
|
20652
20906
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
20653
20907
|
|
|
@@ -20810,6 +21064,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20810
21064
|
extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
|
|
20811
21065
|
extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
|
|
20812
21066
|
extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
|
|
21067
|
+
extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance && extensions.has( 'WEBGL_clip_cull_distance' ),
|
|
20813
21068
|
|
|
20814
21069
|
rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
|
|
20815
21070
|
rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
|
|
@@ -20959,6 +21214,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20959
21214
|
_programLayers.enable( 17 );
|
|
20960
21215
|
if ( parameters.alphaHash )
|
|
20961
21216
|
_programLayers.enable( 18 );
|
|
21217
|
+
if ( parameters.batching )
|
|
21218
|
+
_programLayers.enable( 19 );
|
|
20962
21219
|
|
|
20963
21220
|
array.push( _programLayers.mask );
|
|
20964
21221
|
_programLayers.disableAll();
|
|
@@ -21784,8 +22041,17 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
21784
22041
|
|
|
21785
22042
|
// WebGL 2
|
|
21786
22043
|
|
|
21787
|
-
|
|
21788
|
-
|
|
22044
|
+
if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
|
|
22045
|
+
|
|
22046
|
+
state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
|
|
22047
|
+
state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
|
|
22048
|
+
|
|
22049
|
+
} else {
|
|
22050
|
+
|
|
22051
|
+
state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
|
|
22052
|
+
state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
|
|
22053
|
+
|
|
22054
|
+
}
|
|
21789
22055
|
|
|
21790
22056
|
} else {
|
|
21791
22057
|
|
|
@@ -22422,6 +22688,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22422
22688
|
|
|
22423
22689
|
cachedMaterial = result.clone();
|
|
22424
22690
|
materialsForVariant[ keyB ] = cachedMaterial;
|
|
22691
|
+
material.addEventListener( 'dispose', onMaterialDispose );
|
|
22425
22692
|
|
|
22426
22693
|
}
|
|
22427
22694
|
|
|
@@ -22498,8 +22765,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22498
22765
|
|
|
22499
22766
|
const depthMaterial = getDepthMaterial( object, groupMaterial, light, type );
|
|
22500
22767
|
|
|
22768
|
+
object.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
|
|
22769
|
+
|
|
22501
22770
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
|
|
22502
22771
|
|
|
22772
|
+
object.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
|
|
22773
|
+
|
|
22503
22774
|
}
|
|
22504
22775
|
|
|
22505
22776
|
}
|
|
@@ -22508,8 +22779,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22508
22779
|
|
|
22509
22780
|
const depthMaterial = getDepthMaterial( object, material, light, type );
|
|
22510
22781
|
|
|
22782
|
+
object.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
|
|
22783
|
+
|
|
22511
22784
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
|
|
22512
22785
|
|
|
22786
|
+
object.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
|
|
22787
|
+
|
|
22513
22788
|
}
|
|
22514
22789
|
|
|
22515
22790
|
}
|
|
@@ -22526,6 +22801,32 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22526
22801
|
|
|
22527
22802
|
}
|
|
22528
22803
|
|
|
22804
|
+
function onMaterialDispose( event ) {
|
|
22805
|
+
|
|
22806
|
+
const material = event.target;
|
|
22807
|
+
|
|
22808
|
+
material.removeEventListener( 'dispose', onMaterialDispose );
|
|
22809
|
+
|
|
22810
|
+
// make sure to remove the unique distance/depth materials used for shadow map rendering
|
|
22811
|
+
|
|
22812
|
+
for ( const id in _materialCache ) {
|
|
22813
|
+
|
|
22814
|
+
const cache = _materialCache[ id ];
|
|
22815
|
+
|
|
22816
|
+
const uuid = event.target.uuid;
|
|
22817
|
+
|
|
22818
|
+
if ( uuid in cache ) {
|
|
22819
|
+
|
|
22820
|
+
const shadowMaterial = cache[ uuid ];
|
|
22821
|
+
shadowMaterial.dispose();
|
|
22822
|
+
delete cache[ uuid ];
|
|
22823
|
+
|
|
22824
|
+
}
|
|
22825
|
+
|
|
22826
|
+
}
|
|
22827
|
+
|
|
22828
|
+
}
|
|
22829
|
+
|
|
22529
22830
|
}
|
|
22530
22831
|
|
|
22531
22832
|
function WebGLState( gl, extensions, capabilities ) {
|
|
@@ -23854,10 +24155,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23854
24155
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
|
|
23855
24156
|
|
|
23856
24157
|
const isWebGL2 = capabilities.isWebGL2;
|
|
23857
|
-
const maxTextures = capabilities.maxTextures;
|
|
23858
|
-
const maxCubemapSize = capabilities.maxCubemapSize;
|
|
23859
|
-
const maxTextureSize = capabilities.maxTextureSize;
|
|
23860
|
-
const maxSamples = capabilities.maxSamples;
|
|
23861
24158
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
23862
24159
|
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
|
|
23863
24160
|
const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
|
|
@@ -24280,9 +24577,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24280
24577
|
|
|
24281
24578
|
const textureUnit = textureUnits;
|
|
24282
24579
|
|
|
24283
|
-
if ( textureUnit >= maxTextures ) {
|
|
24580
|
+
if ( textureUnit >= capabilities.maxTextures ) {
|
|
24284
24581
|
|
|
24285
|
-
console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );
|
|
24582
|
+
console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );
|
|
24286
24583
|
|
|
24287
24584
|
}
|
|
24288
24585
|
|
|
@@ -24639,7 +24936,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24639
24936
|
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
24640
24937
|
|
|
24641
24938
|
const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
|
|
24642
|
-
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
24939
|
+
let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
|
|
24643
24940
|
image = verifyColorSpace( texture, image );
|
|
24644
24941
|
|
|
24645
24942
|
const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
|
|
@@ -24653,7 +24950,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24653
24950
|
let mipmap;
|
|
24654
24951
|
const mipmaps = texture.mipmaps;
|
|
24655
24952
|
|
|
24656
|
-
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
|
|
24953
|
+
const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
|
|
24657
24954
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
24658
24955
|
const levels = getMipLevels( texture, image, supportsMips );
|
|
24659
24956
|
|
|
@@ -25066,7 +25363,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
25066
25363
|
|
|
25067
25364
|
if ( ! isCompressed && ! isDataTexture ) {
|
|
25068
25365
|
|
|
25069
|
-
cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );
|
|
25366
|
+
cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );
|
|
25070
25367
|
|
|
25071
25368
|
} else {
|
|
25072
25369
|
|
|
@@ -26025,7 +26322,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
26025
26322
|
|
|
26026
26323
|
function getRenderTargetSamples( renderTarget ) {
|
|
26027
26324
|
|
|
26028
|
-
return Math.min( maxSamples, renderTarget.samples );
|
|
26325
|
+
return Math.min( capabilities.maxSamples, renderTarget.samples );
|
|
26029
26326
|
|
|
26030
26327
|
}
|
|
26031
26328
|
|
|
@@ -27358,60 +27655,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27358
27655
|
|
|
27359
27656
|
}
|
|
27360
27657
|
|
|
27361
|
-
class DepthTexture extends Texture {
|
|
27362
|
-
|
|
27363
|
-
constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
|
|
27364
|
-
|
|
27365
|
-
format = format !== undefined ? format : DepthFormat;
|
|
27366
|
-
|
|
27367
|
-
if ( format !== DepthFormat && format !== DepthStencilFormat ) {
|
|
27368
|
-
|
|
27369
|
-
throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
|
|
27370
|
-
|
|
27371
|
-
}
|
|
27372
|
-
|
|
27373
|
-
if ( type === undefined && format === DepthFormat ) type = UnsignedIntType;
|
|
27374
|
-
if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
|
|
27375
|
-
|
|
27376
|
-
super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
27377
|
-
|
|
27378
|
-
this.isDepthTexture = true;
|
|
27379
|
-
|
|
27380
|
-
this.image = { width: width, height: height };
|
|
27381
|
-
|
|
27382
|
-
this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
27383
|
-
this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
27384
|
-
|
|
27385
|
-
this.flipY = false;
|
|
27386
|
-
this.generateMipmaps = false;
|
|
27387
|
-
|
|
27388
|
-
this.compareFunction = null;
|
|
27389
|
-
|
|
27390
|
-
}
|
|
27391
|
-
|
|
27392
|
-
|
|
27393
|
-
copy( source ) {
|
|
27394
|
-
|
|
27395
|
-
super.copy( source );
|
|
27396
|
-
|
|
27397
|
-
this.compareFunction = source.compareFunction;
|
|
27398
|
-
|
|
27399
|
-
return this;
|
|
27400
|
-
|
|
27401
|
-
}
|
|
27402
|
-
|
|
27403
|
-
toJSON( meta ) {
|
|
27404
|
-
|
|
27405
|
-
const data = super.toJSON( meta );
|
|
27406
|
-
|
|
27407
|
-
if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
|
|
27408
|
-
|
|
27409
|
-
return data;
|
|
27410
|
-
|
|
27411
|
-
}
|
|
27412
|
-
|
|
27413
|
-
}
|
|
27414
|
-
|
|
27415
27658
|
class WebXRManager extends EventDispatcher {
|
|
27416
27659
|
|
|
27417
27660
|
constructor( renderer, gl, extensions, useMultiview ) {
|
|
@@ -27445,6 +27688,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27445
27688
|
const controllers = [];
|
|
27446
27689
|
const controllerInputSources = [];
|
|
27447
27690
|
|
|
27691
|
+
const currentSize = new Vector2();
|
|
27692
|
+
let currentPixelRatio = null;
|
|
27693
|
+
|
|
27448
27694
|
//
|
|
27449
27695
|
|
|
27450
27696
|
const cameraL = new PerspectiveCamera();
|
|
@@ -27588,6 +27834,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27588
27834
|
|
|
27589
27835
|
scope.isPresenting = false;
|
|
27590
27836
|
|
|
27837
|
+
renderer.setPixelRatio( currentPixelRatio );
|
|
27838
|
+
renderer.setSize( currentSize.width, currentSize.height, false );
|
|
27839
|
+
|
|
27591
27840
|
scope.dispatchEvent( { type: 'sessionend' } );
|
|
27592
27841
|
|
|
27593
27842
|
}
|
|
@@ -27675,6 +27924,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27675
27924
|
|
|
27676
27925
|
}
|
|
27677
27926
|
|
|
27927
|
+
currentPixelRatio = renderer.getPixelRatio();
|
|
27928
|
+
renderer.getSize( currentSize );
|
|
27929
|
+
|
|
27678
27930
|
if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
|
|
27679
27931
|
|
|
27680
27932
|
const layerInit = {
|
|
@@ -27689,6 +27941,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27689
27941
|
|
|
27690
27942
|
session.updateRenderState( { baseLayer: glBaseLayer } );
|
|
27691
27943
|
|
|
27944
|
+
renderer.setPixelRatio( 1 );
|
|
27945
|
+
renderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );
|
|
27946
|
+
|
|
27692
27947
|
newRenderTarget = new WebGLRenderTarget(
|
|
27693
27948
|
glBaseLayer.framebufferWidth,
|
|
27694
27949
|
glBaseLayer.framebufferHeight,
|
|
@@ -27734,6 +27989,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27734
27989
|
|
|
27735
27990
|
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
27736
27991
|
|
|
27992
|
+
renderer.setPixelRatio( 1 );
|
|
27993
|
+
renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );
|
|
27994
|
+
|
|
27737
27995
|
const renderTargetOptions = {
|
|
27738
27996
|
format: RGBAFormat,
|
|
27739
27997
|
type: UnsignedByteType,
|
|
@@ -28882,57 +29140,62 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
28882
29140
|
|
|
28883
29141
|
for ( let i = 0, il = uniforms.length; i < il; i ++ ) {
|
|
28884
29142
|
|
|
28885
|
-
const
|
|
29143
|
+
const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
|
|
28886
29144
|
|
|
28887
|
-
|
|
29145
|
+
for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
|
|
28888
29146
|
|
|
28889
|
-
|
|
29147
|
+
const uniform = uniformArray[ j ];
|
|
28890
29148
|
|
|
28891
|
-
|
|
29149
|
+
if ( hasUniformChanged( uniform, i, j, cache ) === true ) {
|
|
28892
29150
|
|
|
28893
|
-
|
|
29151
|
+
const offset = uniform.__offset;
|
|
28894
29152
|
|
|
28895
|
-
|
|
29153
|
+
const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
|
|
28896
29154
|
|
|
28897
|
-
|
|
29155
|
+
let arrayOffset = 0;
|
|
28898
29156
|
|
|
28899
|
-
|
|
29157
|
+
for ( let k = 0; k < values.length; k ++ ) {
|
|
28900
29158
|
|
|
28901
|
-
|
|
29159
|
+
const value = values[ k ];
|
|
28902
29160
|
|
|
28903
|
-
|
|
29161
|
+
const info = getUniformSize( value );
|
|
28904
29162
|
|
|
28905
|
-
|
|
28906
|
-
|
|
29163
|
+
// TODO add integer and struct support
|
|
29164
|
+
if ( typeof value === 'number' || typeof value === 'boolean' ) {
|
|
28907
29165
|
|
|
28908
|
-
|
|
29166
|
+
uniform.__data[ 0 ] = value;
|
|
29167
|
+
gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
|
|
28909
29168
|
|
|
28910
|
-
|
|
29169
|
+
} else if ( value.isMatrix3 ) {
|
|
28911
29170
|
|
|
28912
|
-
|
|
28913
|
-
uniform.__data[ 1 ] = value.elements[ 1 ];
|
|
28914
|
-
uniform.__data[ 2 ] = value.elements[ 2 ];
|
|
28915
|
-
uniform.__data[ 3 ] = value.elements[ 0 ];
|
|
28916
|
-
uniform.__data[ 4 ] = value.elements[ 3 ];
|
|
28917
|
-
uniform.__data[ 5 ] = value.elements[ 4 ];
|
|
28918
|
-
uniform.__data[ 6 ] = value.elements[ 5 ];
|
|
28919
|
-
uniform.__data[ 7 ] = value.elements[ 0 ];
|
|
28920
|
-
uniform.__data[ 8 ] = value.elements[ 6 ];
|
|
28921
|
-
uniform.__data[ 9 ] = value.elements[ 7 ];
|
|
28922
|
-
uniform.__data[ 10 ] = value.elements[ 8 ];
|
|
28923
|
-
uniform.__data[ 11 ] = value.elements[ 0 ];
|
|
29171
|
+
// manually converting 3x3 to 3x4
|
|
28924
29172
|
|
|
28925
|
-
|
|
29173
|
+
uniform.__data[ 0 ] = value.elements[ 0 ];
|
|
29174
|
+
uniform.__data[ 1 ] = value.elements[ 1 ];
|
|
29175
|
+
uniform.__data[ 2 ] = value.elements[ 2 ];
|
|
29176
|
+
uniform.__data[ 3 ] = 0;
|
|
29177
|
+
uniform.__data[ 4 ] = value.elements[ 3 ];
|
|
29178
|
+
uniform.__data[ 5 ] = value.elements[ 4 ];
|
|
29179
|
+
uniform.__data[ 6 ] = value.elements[ 5 ];
|
|
29180
|
+
uniform.__data[ 7 ] = 0;
|
|
29181
|
+
uniform.__data[ 8 ] = value.elements[ 6 ];
|
|
29182
|
+
uniform.__data[ 9 ] = value.elements[ 7 ];
|
|
29183
|
+
uniform.__data[ 10 ] = value.elements[ 8 ];
|
|
29184
|
+
uniform.__data[ 11 ] = 0;
|
|
29185
|
+
|
|
29186
|
+
} else {
|
|
28926
29187
|
|
|
28927
|
-
|
|
29188
|
+
value.toArray( uniform.__data, arrayOffset );
|
|
28928
29189
|
|
|
28929
|
-
|
|
29190
|
+
arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
|
|
29191
|
+
|
|
29192
|
+
}
|
|
28930
29193
|
|
|
28931
29194
|
}
|
|
28932
29195
|
|
|
28933
|
-
|
|
29196
|
+
gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
|
|
28934
29197
|
|
|
28935
|
-
|
|
29198
|
+
}
|
|
28936
29199
|
|
|
28937
29200
|
}
|
|
28938
29201
|
|
|
@@ -28942,31 +29205,22 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
28942
29205
|
|
|
28943
29206
|
}
|
|
28944
29207
|
|
|
28945
|
-
function hasUniformChanged( uniform, index, cache ) {
|
|
29208
|
+
function hasUniformChanged( uniform, index, indexArray, cache ) {
|
|
28946
29209
|
|
|
28947
29210
|
const value = uniform.value;
|
|
29211
|
+
const indexString = index + '_' + indexArray;
|
|
28948
29212
|
|
|
28949
|
-
if ( cache[
|
|
29213
|
+
if ( cache[ indexString ] === undefined ) {
|
|
28950
29214
|
|
|
28951
29215
|
// cache entry does not exist so far
|
|
28952
29216
|
|
|
28953
|
-
if ( typeof value === 'number' ) {
|
|
29217
|
+
if ( typeof value === 'number' || typeof value === 'boolean' ) {
|
|
28954
29218
|
|
|
28955
|
-
cache[
|
|
29219
|
+
cache[ indexString ] = value;
|
|
28956
29220
|
|
|
28957
29221
|
} else {
|
|
28958
29222
|
|
|
28959
|
-
|
|
28960
|
-
|
|
28961
|
-
const tempValues = [];
|
|
28962
|
-
|
|
28963
|
-
for ( let i = 0; i < values.length; i ++ ) {
|
|
28964
|
-
|
|
28965
|
-
tempValues.push( values[ i ].clone() );
|
|
28966
|
-
|
|
28967
|
-
}
|
|
28968
|
-
|
|
28969
|
-
cache[ index ] = tempValues;
|
|
29223
|
+
cache[ indexString ] = value.clone();
|
|
28970
29224
|
|
|
28971
29225
|
}
|
|
28972
29226
|
|
|
@@ -28974,32 +29228,25 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
28974
29228
|
|
|
28975
29229
|
} else {
|
|
28976
29230
|
|
|
29231
|
+
const cachedObject = cache[ indexString ];
|
|
29232
|
+
|
|
28977
29233
|
// compare current value with cached entry
|
|
28978
29234
|
|
|
28979
|
-
if ( typeof value === 'number' ) {
|
|
29235
|
+
if ( typeof value === 'number' || typeof value === 'boolean' ) {
|
|
28980
29236
|
|
|
28981
|
-
if (
|
|
29237
|
+
if ( cachedObject !== value ) {
|
|
28982
29238
|
|
|
28983
|
-
cache[
|
|
29239
|
+
cache[ indexString ] = value;
|
|
28984
29240
|
return true;
|
|
28985
29241
|
|
|
28986
29242
|
}
|
|
28987
29243
|
|
|
28988
29244
|
} else {
|
|
28989
29245
|
|
|
28990
|
-
|
|
28991
|
-
const values = Array.isArray( value ) ? value : [ value ];
|
|
28992
|
-
|
|
28993
|
-
for ( let i = 0; i < cachedObjects.length; i ++ ) {
|
|
28994
|
-
|
|
28995
|
-
const cachedObject = cachedObjects[ i ];
|
|
29246
|
+
if ( cachedObject.equals( value ) === false ) {
|
|
28996
29247
|
|
|
28997
|
-
|
|
28998
|
-
|
|
28999
|
-
cachedObject.copy( values[ i ] );
|
|
29000
|
-
return true;
|
|
29001
|
-
|
|
29002
|
-
}
|
|
29248
|
+
cachedObject.copy( value );
|
|
29249
|
+
return true;
|
|
29003
29250
|
|
|
29004
29251
|
}
|
|
29005
29252
|
|
|
@@ -29020,63 +29267,53 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29020
29267
|
|
|
29021
29268
|
let offset = 0; // global buffer offset in bytes
|
|
29022
29269
|
const chunkSize = 16; // size of a chunk in bytes
|
|
29023
|
-
let chunkOffset = 0; // offset within a single chunk in bytes
|
|
29024
29270
|
|
|
29025
29271
|
for ( let i = 0, l = uniforms.length; i < l; i ++ ) {
|
|
29026
29272
|
|
|
29027
|
-
const
|
|
29028
|
-
|
|
29029
|
-
const infos = {
|
|
29030
|
-
boundary: 0, // bytes
|
|
29031
|
-
storage: 0 // bytes
|
|
29032
|
-
};
|
|
29273
|
+
const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
|
|
29033
29274
|
|
|
29034
|
-
|
|
29275
|
+
for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
|
|
29035
29276
|
|
|
29036
|
-
|
|
29277
|
+
const uniform = uniformArray[ j ];
|
|
29037
29278
|
|
|
29038
|
-
const
|
|
29279
|
+
const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
|
|
29039
29280
|
|
|
29040
|
-
|
|
29281
|
+
for ( let k = 0, kl = values.length; k < kl; k ++ ) {
|
|
29041
29282
|
|
|
29042
|
-
|
|
29043
|
-
infos.storage += info.storage;
|
|
29283
|
+
const value = values[ k ];
|
|
29044
29284
|
|
|
29045
|
-
|
|
29046
|
-
|
|
29047
|
-
// the following two properties will be used for partial buffer updates
|
|
29285
|
+
const info = getUniformSize( value );
|
|
29048
29286
|
|
|
29049
|
-
|
|
29050
|
-
|
|
29287
|
+
// Calculate the chunk offset
|
|
29288
|
+
const chunkOffsetUniform = offset % chunkSize;
|
|
29051
29289
|
|
|
29052
|
-
|
|
29290
|
+
// Check for chunk overflow
|
|
29291
|
+
if ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {
|
|
29053
29292
|
|
|
29054
|
-
|
|
29293
|
+
// Add padding and adjust offset
|
|
29294
|
+
offset += ( chunkSize - chunkOffsetUniform );
|
|
29055
29295
|
|
|
29056
|
-
|
|
29296
|
+
}
|
|
29057
29297
|
|
|
29058
|
-
|
|
29298
|
+
// the following two properties will be used for partial buffer updates
|
|
29059
29299
|
|
|
29060
|
-
|
|
29300
|
+
uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
|
|
29301
|
+
uniform.__offset = offset;
|
|
29061
29302
|
|
|
29062
|
-
if ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {
|
|
29063
29303
|
|
|
29064
|
-
//
|
|
29304
|
+
// Update the global offset
|
|
29305
|
+
offset += info.storage;
|
|
29065
29306
|
|
|
29066
|
-
offset += ( chunkSize - chunkOffset );
|
|
29067
|
-
uniform.__offset = offset;
|
|
29068
29307
|
|
|
29069
29308
|
}
|
|
29070
29309
|
|
|
29071
29310
|
}
|
|
29072
29311
|
|
|
29073
|
-
offset += infos.storage;
|
|
29074
|
-
|
|
29075
29312
|
}
|
|
29076
29313
|
|
|
29077
29314
|
// ensure correct final padding
|
|
29078
29315
|
|
|
29079
|
-
chunkOffset = offset % chunkSize;
|
|
29316
|
+
const chunkOffset = offset % chunkSize;
|
|
29080
29317
|
|
|
29081
29318
|
if ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );
|
|
29082
29319
|
|
|
@@ -29098,9 +29335,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29098
29335
|
|
|
29099
29336
|
// determine sizes according to STD140
|
|
29100
29337
|
|
|
29101
|
-
if ( typeof value === 'number' ) {
|
|
29338
|
+
if ( typeof value === 'number' || typeof value === 'boolean' ) {
|
|
29102
29339
|
|
|
29103
|
-
// float/int
|
|
29340
|
+
// float/int/bool
|
|
29104
29341
|
|
|
29105
29342
|
info.boundary = 4;
|
|
29106
29343
|
info.storage = 4;
|
|
@@ -30031,7 +30268,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30031
30268
|
|
|
30032
30269
|
}
|
|
30033
30270
|
|
|
30034
|
-
if ( object.
|
|
30271
|
+
if ( object.isBatchedMesh ) {
|
|
30272
|
+
|
|
30273
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
30274
|
+
|
|
30275
|
+
} else if ( object.isInstancedMesh ) {
|
|
30035
30276
|
|
|
30036
30277
|
renderer.renderInstances( drawStart, drawCount, object.count );
|
|
30037
30278
|
|
|
@@ -30867,6 +31108,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30867
31108
|
const materialProperties = properties.get( material );
|
|
30868
31109
|
|
|
30869
31110
|
materialProperties.outputColorSpace = parameters.outputColorSpace;
|
|
31111
|
+
materialProperties.batching = parameters.batching;
|
|
30870
31112
|
materialProperties.instancing = parameters.instancing;
|
|
30871
31113
|
materialProperties.instancingColor = parameters.instancingColor;
|
|
30872
31114
|
materialProperties.skinning = parameters.skinning;
|
|
@@ -30950,6 +31192,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30950
31192
|
|
|
30951
31193
|
needsProgramChange = true;
|
|
30952
31194
|
|
|
31195
|
+
} else if ( object.isBatchedMesh && materialProperties.batching === false ) {
|
|
31196
|
+
|
|
31197
|
+
needsProgramChange = true;
|
|
31198
|
+
|
|
31199
|
+
} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {
|
|
31200
|
+
|
|
31201
|
+
needsProgramChange = true;
|
|
31202
|
+
|
|
30953
31203
|
} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {
|
|
30954
31204
|
|
|
30955
31205
|
needsProgramChange = true;
|
|
@@ -31139,7 +31389,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31139
31389
|
if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
|
|
31140
31390
|
|
|
31141
31391
|
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
|
|
31142
|
-
p_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );
|
|
31143
31392
|
|
|
31144
31393
|
} else {
|
|
31145
31394
|
|
|
@@ -31151,6 +31400,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31151
31400
|
|
|
31152
31401
|
}
|
|
31153
31402
|
|
|
31403
|
+
if ( object.isBatchedMesh ) {
|
|
31404
|
+
|
|
31405
|
+
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
31406
|
+
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
31407
|
+
|
|
31408
|
+
}
|
|
31409
|
+
|
|
31154
31410
|
const morphAttributes = geometry.morphAttributes;
|
|
31155
31411
|
|
|
31156
31412
|
if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
|
|
@@ -31625,7 +31881,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31625
31881
|
textures.setTexture3D( dstTexture, 0 );
|
|
31626
31882
|
glTarget = _gl.TEXTURE_3D;
|
|
31627
31883
|
|
|
31628
|
-
} else if ( dstTexture.isDataArrayTexture ) {
|
|
31884
|
+
} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {
|
|
31629
31885
|
|
|
31630
31886
|
textures.setTexture2DArray( dstTexture, 0 );
|
|
31631
31887
|
glTarget = _gl.TEXTURE_2D_ARRAY;
|
|
@@ -31647,7 +31903,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31647
31903
|
const unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
31648
31904
|
const unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
31649
31905
|
|
|
31650
|
-
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[
|
|
31906
|
+
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
31651
31907
|
|
|
31652
31908
|
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
31653
31909
|
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
@@ -31752,20 +32008,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31752
32008
|
|
|
31753
32009
|
}
|
|
31754
32010
|
|
|
31755
|
-
get physicallyCorrectLights() { // @deprecated, r150
|
|
31756
|
-
|
|
31757
|
-
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
31758
|
-
return ! this.useLegacyLights;
|
|
31759
|
-
|
|
31760
|
-
}
|
|
31761
|
-
|
|
31762
|
-
set physicallyCorrectLights( value ) { // @deprecated, r150
|
|
31763
|
-
|
|
31764
|
-
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
31765
|
-
this.useLegacyLights = ! value;
|
|
31766
|
-
|
|
31767
|
-
}
|
|
31768
|
-
|
|
31769
32011
|
get outputEncoding() { // @deprecated, r152
|
|
31770
32012
|
|
|
31771
32013
|
console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
|
|
@@ -31938,7 +32180,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31938
32180
|
this.count = array !== undefined ? array.length / stride : 0;
|
|
31939
32181
|
|
|
31940
32182
|
this.usage = StaticDrawUsage;
|
|
31941
|
-
this.
|
|
32183
|
+
this._updateRange = { offset: 0, count: - 1 };
|
|
32184
|
+
this.updateRanges = [];
|
|
31942
32185
|
|
|
31943
32186
|
this.version = 0;
|
|
31944
32187
|
|
|
@@ -31954,6 +32197,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31954
32197
|
|
|
31955
32198
|
}
|
|
31956
32199
|
|
|
32200
|
+
get updateRange() {
|
|
32201
|
+
|
|
32202
|
+
console.warn( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
32203
|
+
return this._updateRange;
|
|
32204
|
+
|
|
32205
|
+
}
|
|
32206
|
+
|
|
31957
32207
|
setUsage( value ) {
|
|
31958
32208
|
|
|
31959
32209
|
this.usage = value;
|
|
@@ -31962,6 +32212,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
31962
32212
|
|
|
31963
32213
|
}
|
|
31964
32214
|
|
|
32215
|
+
addUpdateRange( start, count ) {
|
|
32216
|
+
|
|
32217
|
+
this.updateRanges.push( { start, count } );
|
|
32218
|
+
|
|
32219
|
+
}
|
|
32220
|
+
|
|
32221
|
+
clearUpdateRanges() {
|
|
32222
|
+
|
|
32223
|
+
this.updateRanges.length = 0;
|
|
32224
|
+
|
|
32225
|
+
}
|
|
32226
|
+
|
|
31965
32227
|
copy( source ) {
|
|
31966
32228
|
|
|
31967
32229
|
this.array = new source.array.constructor( source.array );
|
|
@@ -32068,7 +32330,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32068
32330
|
|
|
32069
32331
|
}
|
|
32070
32332
|
|
|
32071
|
-
const _vector$
|
|
32333
|
+
const _vector$6 = /*@__PURE__*/ new Vector3();
|
|
32072
32334
|
|
|
32073
32335
|
class InterleavedBufferAttribute {
|
|
32074
32336
|
|
|
@@ -32108,11 +32370,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32108
32370
|
|
|
32109
32371
|
for ( let i = 0, l = this.data.count; i < l; i ++ ) {
|
|
32110
32372
|
|
|
32111
|
-
_vector$
|
|
32373
|
+
_vector$6.fromBufferAttribute( this, i );
|
|
32112
32374
|
|
|
32113
|
-
_vector$
|
|
32375
|
+
_vector$6.applyMatrix4( m );
|
|
32114
32376
|
|
|
32115
|
-
this.setXYZ( i, _vector$
|
|
32377
|
+
this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );
|
|
32116
32378
|
|
|
32117
32379
|
}
|
|
32118
32380
|
|
|
@@ -32124,11 +32386,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32124
32386
|
|
|
32125
32387
|
for ( let i = 0, l = this.count; i < l; i ++ ) {
|
|
32126
32388
|
|
|
32127
|
-
_vector$
|
|
32389
|
+
_vector$6.fromBufferAttribute( this, i );
|
|
32128
32390
|
|
|
32129
|
-
_vector$
|
|
32391
|
+
_vector$6.applyNormalMatrix( m );
|
|
32130
32392
|
|
|
32131
|
-
this.setXYZ( i, _vector$
|
|
32393
|
+
this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );
|
|
32132
32394
|
|
|
32133
32395
|
}
|
|
32134
32396
|
|
|
@@ -32140,11 +32402,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32140
32402
|
|
|
32141
32403
|
for ( let i = 0, l = this.count; i < l; i ++ ) {
|
|
32142
32404
|
|
|
32143
|
-
_vector$
|
|
32405
|
+
_vector$6.fromBufferAttribute( this, i );
|
|
32144
32406
|
|
|
32145
|
-
_vector$
|
|
32407
|
+
_vector$6.transformDirection( m );
|
|
32146
32408
|
|
|
32147
|
-
this.setXYZ( i, _vector$
|
|
32409
|
+
this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );
|
|
32148
32410
|
|
|
32149
32411
|
}
|
|
32150
32412
|
|
|
@@ -32831,7 +33093,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32831
33093
|
const _matrix4 = /*@__PURE__*/ new Matrix4();
|
|
32832
33094
|
const _vertex = /*@__PURE__*/ new Vector3();
|
|
32833
33095
|
|
|
32834
|
-
const _sphere$
|
|
33096
|
+
const _sphere$4 = /*@__PURE__*/ new Sphere();
|
|
32835
33097
|
const _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();
|
|
32836
33098
|
const _ray$2 = /*@__PURE__*/ new Ray();
|
|
32837
33099
|
|
|
@@ -32928,10 +33190,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32928
33190
|
|
|
32929
33191
|
if ( this.boundingSphere === null ) this.computeBoundingSphere();
|
|
32930
33192
|
|
|
32931
|
-
_sphere$
|
|
32932
|
-
_sphere$
|
|
33193
|
+
_sphere$4.copy( this.boundingSphere );
|
|
33194
|
+
_sphere$4.applyMatrix4( matrixWorld );
|
|
32933
33195
|
|
|
32934
|
-
if ( raycaster.ray.intersectsSphere( _sphere$
|
|
33196
|
+
if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;
|
|
32935
33197
|
|
|
32936
33198
|
// convert ray to local space of skinned mesh
|
|
32937
33199
|
|
|
@@ -33110,7 +33372,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33110
33372
|
}
|
|
33111
33373
|
|
|
33112
33374
|
const _offsetMatrix = /*@__PURE__*/ new Matrix4();
|
|
33113
|
-
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
33375
|
+
const _identityMatrix$1 = /*@__PURE__*/ new Matrix4();
|
|
33114
33376
|
|
|
33115
33377
|
class Skeleton {
|
|
33116
33378
|
|
|
@@ -33123,7 +33385,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33123
33385
|
this.boneMatrices = null;
|
|
33124
33386
|
|
|
33125
33387
|
this.boneTexture = null;
|
|
33126
|
-
this.boneTextureSize = 0;
|
|
33127
33388
|
|
|
33128
33389
|
this.init();
|
|
33129
33390
|
|
|
@@ -33240,7 +33501,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33240
33501
|
|
|
33241
33502
|
// compute the offset between the current and the original transform
|
|
33242
33503
|
|
|
33243
|
-
const matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;
|
|
33504
|
+
const matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix$1;
|
|
33244
33505
|
|
|
33245
33506
|
_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );
|
|
33246
33507
|
_offsetMatrix.toArray( boneMatrices, i * 16 );
|
|
@@ -33271,7 +33532,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33271
33532
|
// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)
|
|
33272
33533
|
|
|
33273
33534
|
let size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix
|
|
33274
|
-
size =
|
|
33535
|
+
size = Math.ceil( size / 4 ) * 4;
|
|
33275
33536
|
size = Math.max( size, 4 );
|
|
33276
33537
|
|
|
33277
33538
|
const boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
|
|
@@ -33282,7 +33543,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33282
33543
|
|
|
33283
33544
|
this.boneMatrices = boneMatrices;
|
|
33284
33545
|
this.boneTexture = boneTexture;
|
|
33285
|
-
this.boneTextureSize = size;
|
|
33286
33546
|
|
|
33287
33547
|
return this;
|
|
33288
33548
|
|
|
@@ -33421,8 +33681,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33421
33681
|
|
|
33422
33682
|
const _box3 = /*@__PURE__*/ new Box3();
|
|
33423
33683
|
const _identity = /*@__PURE__*/ new Matrix4();
|
|
33424
|
-
const _mesh = /*@__PURE__*/ new Mesh();
|
|
33425
|
-
const _sphere$
|
|
33684
|
+
const _mesh$1 = /*@__PURE__*/ new Mesh();
|
|
33685
|
+
const _sphere$3 = /*@__PURE__*/ new Sphere();
|
|
33426
33686
|
|
|
33427
33687
|
class InstancedMesh extends Mesh {
|
|
33428
33688
|
|
|
@@ -33502,9 +33762,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33502
33762
|
|
|
33503
33763
|
this.getMatrixAt( i, _instanceLocalMatrix );
|
|
33504
33764
|
|
|
33505
|
-
_sphere$
|
|
33765
|
+
_sphere$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );
|
|
33506
33766
|
|
|
33507
|
-
this.boundingSphere.union( _sphere$
|
|
33767
|
+
this.boundingSphere.union( _sphere$3 );
|
|
33508
33768
|
|
|
33509
33769
|
}
|
|
33510
33770
|
|
|
@@ -33544,19 +33804,19 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33544
33804
|
const matrixWorld = this.matrixWorld;
|
|
33545
33805
|
const raycastTimes = this.count;
|
|
33546
33806
|
|
|
33547
|
-
_mesh.geometry = this.geometry;
|
|
33548
|
-
_mesh.material = this.material;
|
|
33807
|
+
_mesh$1.geometry = this.geometry;
|
|
33808
|
+
_mesh$1.material = this.material;
|
|
33549
33809
|
|
|
33550
|
-
if ( _mesh.material === undefined ) return;
|
|
33810
|
+
if ( _mesh$1.material === undefined ) return;
|
|
33551
33811
|
|
|
33552
33812
|
// test with bounding sphere first
|
|
33553
33813
|
|
|
33554
33814
|
if ( this.boundingSphere === null ) this.computeBoundingSphere();
|
|
33555
33815
|
|
|
33556
|
-
_sphere$
|
|
33557
|
-
_sphere$
|
|
33816
|
+
_sphere$3.copy( this.boundingSphere );
|
|
33817
|
+
_sphere$3.applyMatrix4( matrixWorld );
|
|
33558
33818
|
|
|
33559
|
-
if ( raycaster.ray.intersectsSphere( _sphere$
|
|
33819
|
+
if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;
|
|
33560
33820
|
|
|
33561
33821
|
// now test each instance
|
|
33562
33822
|
|
|
@@ -33570,9 +33830,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33570
33830
|
|
|
33571
33831
|
// the mesh represents this single instance
|
|
33572
33832
|
|
|
33573
|
-
_mesh.matrixWorld = _instanceWorldMatrix;
|
|
33833
|
+
_mesh$1.matrixWorld = _instanceWorldMatrix;
|
|
33574
33834
|
|
|
33575
|
-
_mesh.raycast( raycaster, _instanceIntersects );
|
|
33835
|
+
_mesh$1.raycast( raycaster, _instanceIntersects );
|
|
33576
33836
|
|
|
33577
33837
|
// process the result of raycast
|
|
33578
33838
|
|
|
@@ -33621,6 +33881,1011 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
33621
33881
|
|
|
33622
33882
|
}
|
|
33623
33883
|
|
|
33884
|
+
function sortOpaque( a, b ) {
|
|
33885
|
+
|
|
33886
|
+
return a.z - b.z;
|
|
33887
|
+
|
|
33888
|
+
}
|
|
33889
|
+
|
|
33890
|
+
function sortTransparent( a, b ) {
|
|
33891
|
+
|
|
33892
|
+
return b.z - a.z;
|
|
33893
|
+
|
|
33894
|
+
}
|
|
33895
|
+
|
|
33896
|
+
class MultiDrawRenderList {
|
|
33897
|
+
|
|
33898
|
+
constructor() {
|
|
33899
|
+
|
|
33900
|
+
this.index = 0;
|
|
33901
|
+
this.pool = [];
|
|
33902
|
+
this.list = [];
|
|
33903
|
+
|
|
33904
|
+
}
|
|
33905
|
+
|
|
33906
|
+
push( drawRange, z ) {
|
|
33907
|
+
|
|
33908
|
+
const pool = this.pool;
|
|
33909
|
+
const list = this.list;
|
|
33910
|
+
if ( this.index >= pool.length ) {
|
|
33911
|
+
|
|
33912
|
+
pool.push( {
|
|
33913
|
+
|
|
33914
|
+
start: - 1,
|
|
33915
|
+
count: - 1,
|
|
33916
|
+
z: - 1,
|
|
33917
|
+
|
|
33918
|
+
} );
|
|
33919
|
+
|
|
33920
|
+
}
|
|
33921
|
+
|
|
33922
|
+
const item = pool[ this.index ];
|
|
33923
|
+
list.push( item );
|
|
33924
|
+
this.index ++;
|
|
33925
|
+
|
|
33926
|
+
item.start = drawRange.start;
|
|
33927
|
+
item.count = drawRange.count;
|
|
33928
|
+
item.z = z;
|
|
33929
|
+
|
|
33930
|
+
}
|
|
33931
|
+
|
|
33932
|
+
reset() {
|
|
33933
|
+
|
|
33934
|
+
this.list.length = 0;
|
|
33935
|
+
this.index = 0;
|
|
33936
|
+
|
|
33937
|
+
}
|
|
33938
|
+
|
|
33939
|
+
}
|
|
33940
|
+
|
|
33941
|
+
const ID_ATTR_NAME = 'batchId';
|
|
33942
|
+
const _matrix = /*@__PURE__*/ new Matrix4();
|
|
33943
|
+
const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
|
|
33944
|
+
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
33945
|
+
const _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();
|
|
33946
|
+
const _frustum = /*@__PURE__*/ new Frustum();
|
|
33947
|
+
const _box$1 = /*@__PURE__*/ new Box3();
|
|
33948
|
+
const _sphere$2 = /*@__PURE__*/ new Sphere();
|
|
33949
|
+
const _vector$5 = /*@__PURE__*/ new Vector3();
|
|
33950
|
+
const _renderList = /*@__PURE__*/ new MultiDrawRenderList();
|
|
33951
|
+
const _mesh = /*@__PURE__*/ new Mesh();
|
|
33952
|
+
const _batchIntersects = [];
|
|
33953
|
+
|
|
33954
|
+
// @TODO: SkinnedMesh support?
|
|
33955
|
+
// @TODO: geometry.groups support?
|
|
33956
|
+
// @TODO: geometry.drawRange support?
|
|
33957
|
+
// @TODO: geometry.morphAttributes support?
|
|
33958
|
+
// @TODO: Support uniform parameter per geometry
|
|
33959
|
+
// @TODO: Add an "optimize" function to pack geometry and remove data gaps
|
|
33960
|
+
|
|
33961
|
+
// copies data from attribute "src" into "target" starting at "targetOffset"
|
|
33962
|
+
function copyAttributeData( src, target, targetOffset = 0 ) {
|
|
33963
|
+
|
|
33964
|
+
const itemSize = target.itemSize;
|
|
33965
|
+
if ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {
|
|
33966
|
+
|
|
33967
|
+
// use the component getters and setters if the array data cannot
|
|
33968
|
+
// be copied directly
|
|
33969
|
+
const vertexCount = src.count;
|
|
33970
|
+
for ( let i = 0; i < vertexCount; i ++ ) {
|
|
33971
|
+
|
|
33972
|
+
for ( let c = 0; c < itemSize; c ++ ) {
|
|
33973
|
+
|
|
33974
|
+
target.setComponent( i + targetOffset, c, src.getComponent( i, c ) );
|
|
33975
|
+
|
|
33976
|
+
}
|
|
33977
|
+
|
|
33978
|
+
}
|
|
33979
|
+
|
|
33980
|
+
} else {
|
|
33981
|
+
|
|
33982
|
+
// faster copy approach using typed array set function
|
|
33983
|
+
target.array.set( src.array, targetOffset * itemSize );
|
|
33984
|
+
|
|
33985
|
+
}
|
|
33986
|
+
|
|
33987
|
+
target.needsUpdate = true;
|
|
33988
|
+
|
|
33989
|
+
}
|
|
33990
|
+
|
|
33991
|
+
class BatchedMesh extends Mesh {
|
|
33992
|
+
|
|
33993
|
+
get maxGeometryCount() {
|
|
33994
|
+
|
|
33995
|
+
return this._maxGeometryCount;
|
|
33996
|
+
|
|
33997
|
+
}
|
|
33998
|
+
|
|
33999
|
+
constructor( maxGeometryCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {
|
|
34000
|
+
|
|
34001
|
+
super( new BufferGeometry(), material );
|
|
34002
|
+
|
|
34003
|
+
this.isBatchedMesh = true;
|
|
34004
|
+
this.perObjectFrustumCulled = true;
|
|
34005
|
+
this.sortObjects = true;
|
|
34006
|
+
this.boundingBox = null;
|
|
34007
|
+
this.boundingSphere = null;
|
|
34008
|
+
this.customSort = null;
|
|
34009
|
+
|
|
34010
|
+
this._drawRanges = [];
|
|
34011
|
+
this._reservedRanges = [];
|
|
34012
|
+
|
|
34013
|
+
this._visibility = [];
|
|
34014
|
+
this._active = [];
|
|
34015
|
+
this._bounds = [];
|
|
34016
|
+
|
|
34017
|
+
this._maxGeometryCount = maxGeometryCount;
|
|
34018
|
+
this._maxVertexCount = maxVertexCount;
|
|
34019
|
+
this._maxIndexCount = maxIndexCount;
|
|
34020
|
+
|
|
34021
|
+
this._geometryInitialized = false;
|
|
34022
|
+
this._geometryCount = 0;
|
|
34023
|
+
this._multiDrawCounts = new Int32Array( maxGeometryCount );
|
|
34024
|
+
this._multiDrawStarts = new Int32Array( maxGeometryCount );
|
|
34025
|
+
this._multiDrawCount = 0;
|
|
34026
|
+
this._visibilityChanged = true;
|
|
34027
|
+
|
|
34028
|
+
// Local matrix per geometry by using data texture
|
|
34029
|
+
this._matricesTexture = null;
|
|
34030
|
+
|
|
34031
|
+
this._initMatricesTexture();
|
|
34032
|
+
|
|
34033
|
+
}
|
|
34034
|
+
|
|
34035
|
+
_initMatricesTexture() {
|
|
34036
|
+
|
|
34037
|
+
// layout (1 matrix = 4 pixels)
|
|
34038
|
+
// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
|
|
34039
|
+
// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)
|
|
34040
|
+
// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)
|
|
34041
|
+
// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)
|
|
34042
|
+
// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)
|
|
34043
|
+
|
|
34044
|
+
let size = Math.sqrt( this._maxGeometryCount * 4 ); // 4 pixels needed for 1 matrix
|
|
34045
|
+
size = Math.ceil( size / 4 ) * 4;
|
|
34046
|
+
size = Math.max( size, 4 );
|
|
34047
|
+
|
|
34048
|
+
const matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
|
|
34049
|
+
const matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );
|
|
34050
|
+
|
|
34051
|
+
this._matricesTexture = matricesTexture;
|
|
34052
|
+
|
|
34053
|
+
}
|
|
34054
|
+
|
|
34055
|
+
_initializeGeometry( reference ) {
|
|
34056
|
+
|
|
34057
|
+
const geometry = this.geometry;
|
|
34058
|
+
const maxVertexCount = this._maxVertexCount;
|
|
34059
|
+
const maxGeometryCount = this._maxGeometryCount;
|
|
34060
|
+
const maxIndexCount = this._maxIndexCount;
|
|
34061
|
+
if ( this._geometryInitialized === false ) {
|
|
34062
|
+
|
|
34063
|
+
for ( const attributeName in reference.attributes ) {
|
|
34064
|
+
|
|
34065
|
+
const srcAttribute = reference.getAttribute( attributeName );
|
|
34066
|
+
const { array, itemSize, normalized } = srcAttribute;
|
|
34067
|
+
|
|
34068
|
+
const dstArray = new array.constructor( maxVertexCount * itemSize );
|
|
34069
|
+
const dstAttribute = new srcAttribute.constructor( dstArray, itemSize, normalized );
|
|
34070
|
+
dstAttribute.setUsage( srcAttribute.usage );
|
|
34071
|
+
|
|
34072
|
+
geometry.setAttribute( attributeName, dstAttribute );
|
|
34073
|
+
|
|
34074
|
+
}
|
|
34075
|
+
|
|
34076
|
+
if ( reference.getIndex() !== null ) {
|
|
34077
|
+
|
|
34078
|
+
const indexArray = maxVertexCount > 65536
|
|
34079
|
+
? new Uint32Array( maxIndexCount )
|
|
34080
|
+
: new Uint16Array( maxIndexCount );
|
|
34081
|
+
|
|
34082
|
+
geometry.setIndex( new BufferAttribute( indexArray, 1 ) );
|
|
34083
|
+
|
|
34084
|
+
}
|
|
34085
|
+
|
|
34086
|
+
const idArray = maxGeometryCount > 65536
|
|
34087
|
+
? new Uint32Array( maxVertexCount )
|
|
34088
|
+
: new Uint16Array( maxVertexCount );
|
|
34089
|
+
geometry.setAttribute( ID_ATTR_NAME, new BufferAttribute( idArray, 1 ) );
|
|
34090
|
+
|
|
34091
|
+
this._geometryInitialized = true;
|
|
34092
|
+
|
|
34093
|
+
}
|
|
34094
|
+
|
|
34095
|
+
}
|
|
34096
|
+
|
|
34097
|
+
// Make sure the geometry is compatible with the existing combined geometry atributes
|
|
34098
|
+
_validateGeometry( geometry ) {
|
|
34099
|
+
|
|
34100
|
+
// check that the geometry doesn't have a version of our reserved id attribute
|
|
34101
|
+
if ( geometry.getAttribute( ID_ATTR_NAME ) ) {
|
|
34102
|
+
|
|
34103
|
+
throw new Error( `BatchedMesh: Geometry cannot use attribute "${ ID_ATTR_NAME }"` );
|
|
34104
|
+
|
|
34105
|
+
}
|
|
34106
|
+
|
|
34107
|
+
// check to ensure the geometries are using consistent attributes and indices
|
|
34108
|
+
const batchGeometry = this.geometry;
|
|
34109
|
+
if ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {
|
|
34110
|
+
|
|
34111
|
+
throw new Error( 'BatchedMesh: All geometries must consistently have "index".' );
|
|
34112
|
+
|
|
34113
|
+
}
|
|
34114
|
+
|
|
34115
|
+
for ( const attributeName in batchGeometry.attributes ) {
|
|
34116
|
+
|
|
34117
|
+
if ( attributeName === ID_ATTR_NAME ) {
|
|
34118
|
+
|
|
34119
|
+
continue;
|
|
34120
|
+
|
|
34121
|
+
}
|
|
34122
|
+
|
|
34123
|
+
if ( ! geometry.hasAttribute( attributeName ) ) {
|
|
34124
|
+
|
|
34125
|
+
throw new Error( `BatchedMesh: Added geometry missing "${ attributeName }". All geometries must have consistent attributes.` );
|
|
34126
|
+
|
|
34127
|
+
}
|
|
34128
|
+
|
|
34129
|
+
const srcAttribute = geometry.getAttribute( attributeName );
|
|
34130
|
+
const dstAttribute = batchGeometry.getAttribute( attributeName );
|
|
34131
|
+
if ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {
|
|
34132
|
+
|
|
34133
|
+
throw new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );
|
|
34134
|
+
|
|
34135
|
+
}
|
|
34136
|
+
|
|
34137
|
+
}
|
|
34138
|
+
|
|
34139
|
+
}
|
|
34140
|
+
|
|
34141
|
+
setCustomSort( func ) {
|
|
34142
|
+
|
|
34143
|
+
this.customSort = func;
|
|
34144
|
+
return this;
|
|
34145
|
+
|
|
34146
|
+
}
|
|
34147
|
+
|
|
34148
|
+
computeBoundingBox() {
|
|
34149
|
+
|
|
34150
|
+
if ( this.boundingBox === null ) {
|
|
34151
|
+
|
|
34152
|
+
this.boundingBox = new Box3();
|
|
34153
|
+
|
|
34154
|
+
}
|
|
34155
|
+
|
|
34156
|
+
const geometryCount = this._geometryCount;
|
|
34157
|
+
const boundingBox = this.boundingBox;
|
|
34158
|
+
const active = this._active;
|
|
34159
|
+
|
|
34160
|
+
boundingBox.makeEmpty();
|
|
34161
|
+
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
34162
|
+
|
|
34163
|
+
if ( active[ i ] === false ) continue;
|
|
34164
|
+
|
|
34165
|
+
this.getMatrixAt( i, _matrix );
|
|
34166
|
+
this.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix );
|
|
34167
|
+
boundingBox.union( _box$1 );
|
|
34168
|
+
|
|
34169
|
+
}
|
|
34170
|
+
|
|
34171
|
+
}
|
|
34172
|
+
|
|
34173
|
+
computeBoundingSphere() {
|
|
34174
|
+
|
|
34175
|
+
if ( this.boundingSphere === null ) {
|
|
34176
|
+
|
|
34177
|
+
this.boundingSphere = new Sphere();
|
|
34178
|
+
|
|
34179
|
+
}
|
|
34180
|
+
|
|
34181
|
+
const geometryCount = this._geometryCount;
|
|
34182
|
+
const boundingSphere = this.boundingSphere;
|
|
34183
|
+
const active = this._active;
|
|
34184
|
+
|
|
34185
|
+
boundingSphere.makeEmpty();
|
|
34186
|
+
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
34187
|
+
|
|
34188
|
+
if ( active[ i ] === false ) continue;
|
|
34189
|
+
|
|
34190
|
+
this.getMatrixAt( i, _matrix );
|
|
34191
|
+
this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
|
|
34192
|
+
boundingSphere.union( _sphere$2 );
|
|
34193
|
+
|
|
34194
|
+
}
|
|
34195
|
+
|
|
34196
|
+
}
|
|
34197
|
+
|
|
34198
|
+
addGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {
|
|
34199
|
+
|
|
34200
|
+
this._initializeGeometry( geometry );
|
|
34201
|
+
|
|
34202
|
+
this._validateGeometry( geometry );
|
|
34203
|
+
|
|
34204
|
+
// ensure we're not over geometry
|
|
34205
|
+
if ( this._geometryCount >= this._maxGeometryCount ) {
|
|
34206
|
+
|
|
34207
|
+
throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
|
|
34208
|
+
|
|
34209
|
+
}
|
|
34210
|
+
|
|
34211
|
+
// get the necessary range fo the geometry
|
|
34212
|
+
const reservedRange = {
|
|
34213
|
+
vertexStart: - 1,
|
|
34214
|
+
vertexCount: - 1,
|
|
34215
|
+
indexStart: - 1,
|
|
34216
|
+
indexCount: - 1,
|
|
34217
|
+
};
|
|
34218
|
+
|
|
34219
|
+
let lastRange = null;
|
|
34220
|
+
const reservedRanges = this._reservedRanges;
|
|
34221
|
+
const drawRanges = this._drawRanges;
|
|
34222
|
+
const bounds = this._bounds;
|
|
34223
|
+
if ( this._geometryCount !== 0 ) {
|
|
34224
|
+
|
|
34225
|
+
lastRange = reservedRanges[ reservedRanges.length - 1 ];
|
|
34226
|
+
|
|
34227
|
+
}
|
|
34228
|
+
|
|
34229
|
+
if ( vertexCount === - 1 ) {
|
|
34230
|
+
|
|
34231
|
+
reservedRange.vertexCount = geometry.getAttribute( 'position' ).count;
|
|
34232
|
+
|
|
34233
|
+
} else {
|
|
34234
|
+
|
|
34235
|
+
reservedRange.vertexCount = vertexCount;
|
|
34236
|
+
|
|
34237
|
+
}
|
|
34238
|
+
|
|
34239
|
+
if ( lastRange === null ) {
|
|
34240
|
+
|
|
34241
|
+
reservedRange.vertexStart = 0;
|
|
34242
|
+
|
|
34243
|
+
} else {
|
|
34244
|
+
|
|
34245
|
+
reservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;
|
|
34246
|
+
|
|
34247
|
+
}
|
|
34248
|
+
|
|
34249
|
+
const index = geometry.getIndex();
|
|
34250
|
+
const hasIndex = index !== null;
|
|
34251
|
+
if ( hasIndex ) {
|
|
34252
|
+
|
|
34253
|
+
if ( indexCount === - 1 ) {
|
|
34254
|
+
|
|
34255
|
+
reservedRange.indexCount = index.count;
|
|
34256
|
+
|
|
34257
|
+
} else {
|
|
34258
|
+
|
|
34259
|
+
reservedRange.indexCount = indexCount;
|
|
34260
|
+
|
|
34261
|
+
}
|
|
34262
|
+
|
|
34263
|
+
if ( lastRange === null ) {
|
|
34264
|
+
|
|
34265
|
+
reservedRange.indexStart = 0;
|
|
34266
|
+
|
|
34267
|
+
} else {
|
|
34268
|
+
|
|
34269
|
+
reservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;
|
|
34270
|
+
|
|
34271
|
+
}
|
|
34272
|
+
|
|
34273
|
+
}
|
|
34274
|
+
|
|
34275
|
+
if (
|
|
34276
|
+
reservedRange.indexStart !== - 1 &&
|
|
34277
|
+
reservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||
|
|
34278
|
+
reservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount
|
|
34279
|
+
) {
|
|
34280
|
+
|
|
34281
|
+
throw new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );
|
|
34282
|
+
|
|
34283
|
+
}
|
|
34284
|
+
|
|
34285
|
+
const visibility = this._visibility;
|
|
34286
|
+
const active = this._active;
|
|
34287
|
+
const matricesTexture = this._matricesTexture;
|
|
34288
|
+
const matricesArray = this._matricesTexture.image.data;
|
|
34289
|
+
|
|
34290
|
+
// push new visibility states
|
|
34291
|
+
visibility.push( true );
|
|
34292
|
+
active.push( true );
|
|
34293
|
+
|
|
34294
|
+
// update id
|
|
34295
|
+
const geometryId = this._geometryCount;
|
|
34296
|
+
this._geometryCount ++;
|
|
34297
|
+
|
|
34298
|
+
// initialize matrix information
|
|
34299
|
+
_identityMatrix.toArray( matricesArray, geometryId * 16 );
|
|
34300
|
+
matricesTexture.needsUpdate = true;
|
|
34301
|
+
|
|
34302
|
+
// add the reserved range and draw range objects
|
|
34303
|
+
reservedRanges.push( reservedRange );
|
|
34304
|
+
drawRanges.push( {
|
|
34305
|
+
start: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,
|
|
34306
|
+
count: - 1
|
|
34307
|
+
} );
|
|
34308
|
+
bounds.push( {
|
|
34309
|
+
boxInitialized: false,
|
|
34310
|
+
box: new Box3(),
|
|
34311
|
+
|
|
34312
|
+
sphereInitialized: false,
|
|
34313
|
+
sphere: new Sphere()
|
|
34314
|
+
} );
|
|
34315
|
+
|
|
34316
|
+
// set the id for the geometry
|
|
34317
|
+
const idAttribute = this.geometry.getAttribute( ID_ATTR_NAME );
|
|
34318
|
+
for ( let i = 0; i < reservedRange.vertexCount; i ++ ) {
|
|
34319
|
+
|
|
34320
|
+
idAttribute.setX( reservedRange.vertexStart + i, geometryId );
|
|
34321
|
+
|
|
34322
|
+
}
|
|
34323
|
+
|
|
34324
|
+
idAttribute.needsUpdate = true;
|
|
34325
|
+
|
|
34326
|
+
// update the geometry
|
|
34327
|
+
this.setGeometryAt( geometryId, geometry );
|
|
34328
|
+
|
|
34329
|
+
return geometryId;
|
|
34330
|
+
|
|
34331
|
+
}
|
|
34332
|
+
|
|
34333
|
+
setGeometryAt( id, geometry ) {
|
|
34334
|
+
|
|
34335
|
+
if ( id >= this._geometryCount ) {
|
|
34336
|
+
|
|
34337
|
+
throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
|
|
34338
|
+
|
|
34339
|
+
}
|
|
34340
|
+
|
|
34341
|
+
this._validateGeometry( geometry );
|
|
34342
|
+
|
|
34343
|
+
const batchGeometry = this.geometry;
|
|
34344
|
+
const hasIndex = batchGeometry.getIndex() !== null;
|
|
34345
|
+
const dstIndex = batchGeometry.getIndex();
|
|
34346
|
+
const srcIndex = geometry.getIndex();
|
|
34347
|
+
const reservedRange = this._reservedRanges[ id ];
|
|
34348
|
+
if (
|
|
34349
|
+
hasIndex &&
|
|
34350
|
+
srcIndex.count > reservedRange.indexCount ||
|
|
34351
|
+
geometry.attributes.position.count > reservedRange.vertexCount
|
|
34352
|
+
) {
|
|
34353
|
+
|
|
34354
|
+
throw new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );
|
|
34355
|
+
|
|
34356
|
+
}
|
|
34357
|
+
|
|
34358
|
+
// copy geometry over
|
|
34359
|
+
const vertexStart = reservedRange.vertexStart;
|
|
34360
|
+
const vertexCount = reservedRange.vertexCount;
|
|
34361
|
+
for ( const attributeName in batchGeometry.attributes ) {
|
|
34362
|
+
|
|
34363
|
+
if ( attributeName === ID_ATTR_NAME ) {
|
|
34364
|
+
|
|
34365
|
+
continue;
|
|
34366
|
+
|
|
34367
|
+
}
|
|
34368
|
+
|
|
34369
|
+
// copy attribute data
|
|
34370
|
+
const srcAttribute = geometry.getAttribute( attributeName );
|
|
34371
|
+
const dstAttribute = batchGeometry.getAttribute( attributeName );
|
|
34372
|
+
copyAttributeData( srcAttribute, dstAttribute, vertexStart );
|
|
34373
|
+
|
|
34374
|
+
// fill the rest in with zeroes
|
|
34375
|
+
const itemSize = srcAttribute.itemSize;
|
|
34376
|
+
for ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {
|
|
34377
|
+
|
|
34378
|
+
const index = vertexStart + i;
|
|
34379
|
+
for ( let c = 0; c < itemSize; c ++ ) {
|
|
34380
|
+
|
|
34381
|
+
dstAttribute.setComponent( index, c, 0 );
|
|
34382
|
+
|
|
34383
|
+
}
|
|
34384
|
+
|
|
34385
|
+
}
|
|
34386
|
+
|
|
34387
|
+
dstAttribute.needsUpdate = true;
|
|
34388
|
+
|
|
34389
|
+
}
|
|
34390
|
+
|
|
34391
|
+
// copy index
|
|
34392
|
+
if ( hasIndex ) {
|
|
34393
|
+
|
|
34394
|
+
const indexStart = reservedRange.indexStart;
|
|
34395
|
+
|
|
34396
|
+
// copy index data over
|
|
34397
|
+
for ( let i = 0; i < srcIndex.count; i ++ ) {
|
|
34398
|
+
|
|
34399
|
+
dstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );
|
|
34400
|
+
|
|
34401
|
+
}
|
|
34402
|
+
|
|
34403
|
+
// fill the rest in with zeroes
|
|
34404
|
+
for ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {
|
|
34405
|
+
|
|
34406
|
+
dstIndex.setX( indexStart + i, vertexStart );
|
|
34407
|
+
|
|
34408
|
+
}
|
|
34409
|
+
|
|
34410
|
+
dstIndex.needsUpdate = true;
|
|
34411
|
+
|
|
34412
|
+
}
|
|
34413
|
+
|
|
34414
|
+
// store the bounding boxes
|
|
34415
|
+
const bound = this._bounds[ id ];
|
|
34416
|
+
if ( geometry.boundingBox !== null ) {
|
|
34417
|
+
|
|
34418
|
+
bound.box.copy( geometry.boundingBox );
|
|
34419
|
+
bound.boxInitialized = true;
|
|
34420
|
+
|
|
34421
|
+
} else {
|
|
34422
|
+
|
|
34423
|
+
bound.boxInitialized = false;
|
|
34424
|
+
|
|
34425
|
+
}
|
|
34426
|
+
|
|
34427
|
+
if ( geometry.boundingSphere !== null ) {
|
|
34428
|
+
|
|
34429
|
+
bound.sphere.copy( geometry.boundingSphere );
|
|
34430
|
+
bound.sphereInitialized = true;
|
|
34431
|
+
|
|
34432
|
+
} else {
|
|
34433
|
+
|
|
34434
|
+
bound.sphereInitialized = false;
|
|
34435
|
+
|
|
34436
|
+
}
|
|
34437
|
+
|
|
34438
|
+
// set drawRange count
|
|
34439
|
+
const drawRange = this._drawRanges[ id ];
|
|
34440
|
+
const posAttr = geometry.getAttribute( 'position' );
|
|
34441
|
+
drawRange.count = hasIndex ? srcIndex.count : posAttr.count;
|
|
34442
|
+
this._visibilityChanged = true;
|
|
34443
|
+
|
|
34444
|
+
return id;
|
|
34445
|
+
|
|
34446
|
+
}
|
|
34447
|
+
|
|
34448
|
+
deleteGeometry( geometryId ) {
|
|
34449
|
+
|
|
34450
|
+
// Note: User needs to call optimize() afterward to pack the data.
|
|
34451
|
+
|
|
34452
|
+
const active = this._active;
|
|
34453
|
+
if ( geometryId >= active.length || active[ geometryId ] === false ) {
|
|
34454
|
+
|
|
34455
|
+
return this;
|
|
34456
|
+
|
|
34457
|
+
}
|
|
34458
|
+
|
|
34459
|
+
active[ geometryId ] = false;
|
|
34460
|
+
this._visibilityChanged = true;
|
|
34461
|
+
|
|
34462
|
+
return this;
|
|
34463
|
+
|
|
34464
|
+
}
|
|
34465
|
+
|
|
34466
|
+
// get bounding box and compute it if it doesn't exist
|
|
34467
|
+
getBoundingBoxAt( id, target ) {
|
|
34468
|
+
|
|
34469
|
+
const active = this._active;
|
|
34470
|
+
if ( active[ id ] === false ) {
|
|
34471
|
+
|
|
34472
|
+
return this;
|
|
34473
|
+
|
|
34474
|
+
}
|
|
34475
|
+
|
|
34476
|
+
// compute bounding box
|
|
34477
|
+
const bound = this._bounds[ id ];
|
|
34478
|
+
const box = bound.box;
|
|
34479
|
+
const geometry = this.geometry;
|
|
34480
|
+
if ( bound.boxInitialized === false ) {
|
|
34481
|
+
|
|
34482
|
+
box.makeEmpty();
|
|
34483
|
+
|
|
34484
|
+
const index = geometry.index;
|
|
34485
|
+
const position = geometry.attributes.position;
|
|
34486
|
+
const drawRange = this._drawRanges[ id ];
|
|
34487
|
+
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
34488
|
+
|
|
34489
|
+
let iv = i;
|
|
34490
|
+
if ( index ) {
|
|
34491
|
+
|
|
34492
|
+
iv = index.getX( iv );
|
|
34493
|
+
|
|
34494
|
+
}
|
|
34495
|
+
|
|
34496
|
+
box.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );
|
|
34497
|
+
|
|
34498
|
+
}
|
|
34499
|
+
|
|
34500
|
+
bound.boxInitialized = true;
|
|
34501
|
+
|
|
34502
|
+
}
|
|
34503
|
+
|
|
34504
|
+
target.copy( box );
|
|
34505
|
+
return target;
|
|
34506
|
+
|
|
34507
|
+
}
|
|
34508
|
+
|
|
34509
|
+
// get bounding sphere and compute it if it doesn't exist
|
|
34510
|
+
getBoundingSphereAt( id, target ) {
|
|
34511
|
+
|
|
34512
|
+
const active = this._active;
|
|
34513
|
+
if ( active[ id ] === false ) {
|
|
34514
|
+
|
|
34515
|
+
return this;
|
|
34516
|
+
|
|
34517
|
+
}
|
|
34518
|
+
|
|
34519
|
+
// compute bounding sphere
|
|
34520
|
+
const bound = this._bounds[ id ];
|
|
34521
|
+
const sphere = bound.sphere;
|
|
34522
|
+
const geometry = this.geometry;
|
|
34523
|
+
if ( bound.sphereInitialized === false ) {
|
|
34524
|
+
|
|
34525
|
+
sphere.makeEmpty();
|
|
34526
|
+
|
|
34527
|
+
this.getBoundingBoxAt( id, _box$1 );
|
|
34528
|
+
_box$1.getCenter( sphere.center );
|
|
34529
|
+
|
|
34530
|
+
const index = geometry.index;
|
|
34531
|
+
const position = geometry.attributes.position;
|
|
34532
|
+
const drawRange = this._drawRanges[ id ];
|
|
34533
|
+
|
|
34534
|
+
let maxRadiusSq = 0;
|
|
34535
|
+
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
34536
|
+
|
|
34537
|
+
let iv = i;
|
|
34538
|
+
if ( index ) {
|
|
34539
|
+
|
|
34540
|
+
iv = index.getX( iv );
|
|
34541
|
+
|
|
34542
|
+
}
|
|
34543
|
+
|
|
34544
|
+
_vector$5.fromBufferAttribute( position, iv );
|
|
34545
|
+
maxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );
|
|
34546
|
+
|
|
34547
|
+
}
|
|
34548
|
+
|
|
34549
|
+
sphere.radius = Math.sqrt( maxRadiusSq );
|
|
34550
|
+
bound.sphereInitialized = true;
|
|
34551
|
+
|
|
34552
|
+
}
|
|
34553
|
+
|
|
34554
|
+
target.copy( sphere );
|
|
34555
|
+
return target;
|
|
34556
|
+
|
|
34557
|
+
}
|
|
34558
|
+
|
|
34559
|
+
setMatrixAt( geometryId, matrix ) {
|
|
34560
|
+
|
|
34561
|
+
// @TODO: Map geometryId to index of the arrays because
|
|
34562
|
+
// optimize() can make geometryId mismatch the index
|
|
34563
|
+
|
|
34564
|
+
const active = this._active;
|
|
34565
|
+
const matricesTexture = this._matricesTexture;
|
|
34566
|
+
const matricesArray = this._matricesTexture.image.data;
|
|
34567
|
+
const geometryCount = this._geometryCount;
|
|
34568
|
+
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
34569
|
+
|
|
34570
|
+
return this;
|
|
34571
|
+
|
|
34572
|
+
}
|
|
34573
|
+
|
|
34574
|
+
matrix.toArray( matricesArray, geometryId * 16 );
|
|
34575
|
+
matricesTexture.needsUpdate = true;
|
|
34576
|
+
|
|
34577
|
+
return this;
|
|
34578
|
+
|
|
34579
|
+
}
|
|
34580
|
+
|
|
34581
|
+
getMatrixAt( geometryId, matrix ) {
|
|
34582
|
+
|
|
34583
|
+
const active = this._active;
|
|
34584
|
+
const matricesArray = this._matricesTexture.image.data;
|
|
34585
|
+
const geometryCount = this._geometryCount;
|
|
34586
|
+
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
34587
|
+
|
|
34588
|
+
return null;
|
|
34589
|
+
|
|
34590
|
+
}
|
|
34591
|
+
|
|
34592
|
+
return matrix.fromArray( matricesArray, geometryId * 16 );
|
|
34593
|
+
|
|
34594
|
+
}
|
|
34595
|
+
|
|
34596
|
+
setVisibleAt( geometryId, value ) {
|
|
34597
|
+
|
|
34598
|
+
const visibility = this._visibility;
|
|
34599
|
+
const active = this._active;
|
|
34600
|
+
const geometryCount = this._geometryCount;
|
|
34601
|
+
|
|
34602
|
+
// if the geometry is out of range, not active, or visibility state
|
|
34603
|
+
// does not change then return early
|
|
34604
|
+
if (
|
|
34605
|
+
geometryId >= geometryCount ||
|
|
34606
|
+
active[ geometryId ] === false ||
|
|
34607
|
+
visibility[ geometryId ] === value
|
|
34608
|
+
) {
|
|
34609
|
+
|
|
34610
|
+
return this;
|
|
34611
|
+
|
|
34612
|
+
}
|
|
34613
|
+
|
|
34614
|
+
visibility[ geometryId ] = value;
|
|
34615
|
+
this._visibilityChanged = true;
|
|
34616
|
+
|
|
34617
|
+
return this;
|
|
34618
|
+
|
|
34619
|
+
}
|
|
34620
|
+
|
|
34621
|
+
getVisibleAt( geometryId ) {
|
|
34622
|
+
|
|
34623
|
+
const visibility = this._visibility;
|
|
34624
|
+
const active = this._active;
|
|
34625
|
+
const geometryCount = this._geometryCount;
|
|
34626
|
+
|
|
34627
|
+
// return early if the geometry is out of range or not active
|
|
34628
|
+
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
34629
|
+
|
|
34630
|
+
return false;
|
|
34631
|
+
|
|
34632
|
+
}
|
|
34633
|
+
|
|
34634
|
+
return visibility[ geometryId ];
|
|
34635
|
+
|
|
34636
|
+
}
|
|
34637
|
+
|
|
34638
|
+
raycast( raycaster, intersects ) {
|
|
34639
|
+
|
|
34640
|
+
const visibility = this._visibility;
|
|
34641
|
+
const active = this._active;
|
|
34642
|
+
const drawRanges = this._drawRanges;
|
|
34643
|
+
const geometryCount = this._geometryCount;
|
|
34644
|
+
const matrixWorld = this.matrixWorld;
|
|
34645
|
+
const batchGeometry = this.geometry;
|
|
34646
|
+
|
|
34647
|
+
// iterate over each geometry
|
|
34648
|
+
_mesh.material = this.material;
|
|
34649
|
+
_mesh.geometry.index = batchGeometry.index;
|
|
34650
|
+
_mesh.geometry.attributes = batchGeometry.attributes;
|
|
34651
|
+
if ( _mesh.geometry.boundingBox === null ) {
|
|
34652
|
+
|
|
34653
|
+
_mesh.geometry.boundingBox = new Box3();
|
|
34654
|
+
|
|
34655
|
+
}
|
|
34656
|
+
|
|
34657
|
+
if ( _mesh.geometry.boundingSphere === null ) {
|
|
34658
|
+
|
|
34659
|
+
_mesh.geometry.boundingSphere = new Sphere();
|
|
34660
|
+
|
|
34661
|
+
}
|
|
34662
|
+
|
|
34663
|
+
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
34664
|
+
|
|
34665
|
+
if ( ! visibility[ i ] || ! active[ i ] ) {
|
|
34666
|
+
|
|
34667
|
+
continue;
|
|
34668
|
+
|
|
34669
|
+
}
|
|
34670
|
+
|
|
34671
|
+
const drawRange = drawRanges[ i ];
|
|
34672
|
+
_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );
|
|
34673
|
+
|
|
34674
|
+
// ge the intersects
|
|
34675
|
+
this.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );
|
|
34676
|
+
this.getBoundingBoxAt( i, _mesh.geometry.boundingBox );
|
|
34677
|
+
this.getBoundingSphereAt( i, _mesh.geometry.boundingSphere );
|
|
34678
|
+
_mesh.raycast( raycaster, _batchIntersects );
|
|
34679
|
+
|
|
34680
|
+
// add batch id to the intersects
|
|
34681
|
+
for ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {
|
|
34682
|
+
|
|
34683
|
+
const intersect = _batchIntersects[ j ];
|
|
34684
|
+
intersect.object = this;
|
|
34685
|
+
intersect.batchId = i;
|
|
34686
|
+
intersects.push( intersect );
|
|
34687
|
+
|
|
34688
|
+
}
|
|
34689
|
+
|
|
34690
|
+
_batchIntersects.length = 0;
|
|
34691
|
+
|
|
34692
|
+
}
|
|
34693
|
+
|
|
34694
|
+
_mesh.material = null;
|
|
34695
|
+
_mesh.geometry.index = null;
|
|
34696
|
+
_mesh.geometry.attributes = {};
|
|
34697
|
+
_mesh.geometry.setDrawRange( 0, Infinity );
|
|
34698
|
+
|
|
34699
|
+
}
|
|
34700
|
+
|
|
34701
|
+
copy( source ) {
|
|
34702
|
+
|
|
34703
|
+
super.copy( source );
|
|
34704
|
+
|
|
34705
|
+
this.geometry = source.geometry.clone();
|
|
34706
|
+
this.perObjectFrustumCulled = source.perObjectFrustumCulled;
|
|
34707
|
+
this.sortObjects = source.sortObjects;
|
|
34708
|
+
this.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;
|
|
34709
|
+
this.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;
|
|
34710
|
+
|
|
34711
|
+
this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
|
|
34712
|
+
this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
|
|
34713
|
+
|
|
34714
|
+
this._visibility = source._visibility.slice();
|
|
34715
|
+
this._active = source._active.slice();
|
|
34716
|
+
this._bounds = source._bounds.map( bound => ( {
|
|
34717
|
+
boxInitialized: bound.boxInitialized,
|
|
34718
|
+
box: bound.box.clone(),
|
|
34719
|
+
|
|
34720
|
+
sphereInitialized: bound.sphereInitialized,
|
|
34721
|
+
sphere: bound.sphere.clone()
|
|
34722
|
+
} ) );
|
|
34723
|
+
|
|
34724
|
+
this._maxGeometryCount = source._maxGeometryCount;
|
|
34725
|
+
this._maxVertexCount = source._maxVertexCount;
|
|
34726
|
+
this._maxIndexCount = source._maxIndexCount;
|
|
34727
|
+
|
|
34728
|
+
this._geometryInitialized = source._geometryInitialized;
|
|
34729
|
+
this._geometryCount = source._geometryCount;
|
|
34730
|
+
this._multiDrawCounts = source._multiDrawCounts.slice();
|
|
34731
|
+
this._multiDrawStarts = source._multiDrawStarts.slice();
|
|
34732
|
+
|
|
34733
|
+
this._matricesTexture = source._matricesTexture.clone();
|
|
34734
|
+
this._matricesTexture.image.data = this._matricesTexture.image.slice();
|
|
34735
|
+
|
|
34736
|
+
return this;
|
|
34737
|
+
|
|
34738
|
+
}
|
|
34739
|
+
|
|
34740
|
+
dispose() {
|
|
34741
|
+
|
|
34742
|
+
// Assuming the geometry is not shared with other meshes
|
|
34743
|
+
this.geometry.dispose();
|
|
34744
|
+
|
|
34745
|
+
this._matricesTexture.dispose();
|
|
34746
|
+
this._matricesTexture = null;
|
|
34747
|
+
return this;
|
|
34748
|
+
|
|
34749
|
+
}
|
|
34750
|
+
|
|
34751
|
+
onBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {
|
|
34752
|
+
|
|
34753
|
+
// if visibility has not changed and frustum culling and object sorting is not required
|
|
34754
|
+
// then skip iterating over all items
|
|
34755
|
+
if ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {
|
|
34756
|
+
|
|
34757
|
+
return;
|
|
34758
|
+
|
|
34759
|
+
}
|
|
34760
|
+
|
|
34761
|
+
// the indexed version of the multi draw function requires specifying the start
|
|
34762
|
+
// offset in bytes.
|
|
34763
|
+
const index = geometry.getIndex();
|
|
34764
|
+
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
34765
|
+
|
|
34766
|
+
const visibility = this._visibility;
|
|
34767
|
+
const multiDrawStarts = this._multiDrawStarts;
|
|
34768
|
+
const multiDrawCounts = this._multiDrawCounts;
|
|
34769
|
+
const drawRanges = this._drawRanges;
|
|
34770
|
+
const perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
34771
|
+
|
|
34772
|
+
// prepare the frustum in the local frame
|
|
34773
|
+
if ( perObjectFrustumCulled ) {
|
|
34774
|
+
|
|
34775
|
+
_projScreenMatrix$2
|
|
34776
|
+
.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
|
|
34777
|
+
.multiply( this.matrixWorld );
|
|
34778
|
+
_frustum.setFromProjectionMatrix(
|
|
34779
|
+
_projScreenMatrix$2,
|
|
34780
|
+
renderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem
|
|
34781
|
+
);
|
|
34782
|
+
|
|
34783
|
+
}
|
|
34784
|
+
|
|
34785
|
+
let count = 0;
|
|
34786
|
+
if ( this.sortObjects ) {
|
|
34787
|
+
|
|
34788
|
+
// get the camera position in the local frame
|
|
34789
|
+
_invMatrixWorld.copy( this.matrixWorld ).invert();
|
|
34790
|
+
_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );
|
|
34791
|
+
|
|
34792
|
+
for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
34793
|
+
|
|
34794
|
+
if ( visibility[ i ] ) {
|
|
34795
|
+
|
|
34796
|
+
// get the bounds in world space
|
|
34797
|
+
this.getMatrixAt( i, _matrix );
|
|
34798
|
+
this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
|
|
34799
|
+
|
|
34800
|
+
// determine whether the batched geometry is within the frustum
|
|
34801
|
+
let culled = false;
|
|
34802
|
+
if ( perObjectFrustumCulled ) {
|
|
34803
|
+
|
|
34804
|
+
culled = ! _frustum.intersectsSphere( _sphere$2 );
|
|
34805
|
+
|
|
34806
|
+
}
|
|
34807
|
+
|
|
34808
|
+
if ( ! culled ) {
|
|
34809
|
+
|
|
34810
|
+
// get the distance from camera used for sorting
|
|
34811
|
+
const z = _vector$5.distanceTo( _sphere$2.center );
|
|
34812
|
+
_renderList.push( drawRanges[ i ], z );
|
|
34813
|
+
|
|
34814
|
+
}
|
|
34815
|
+
|
|
34816
|
+
}
|
|
34817
|
+
|
|
34818
|
+
}
|
|
34819
|
+
|
|
34820
|
+
// Sort the draw ranges and prep for rendering
|
|
34821
|
+
const list = _renderList.list;
|
|
34822
|
+
const customSort = this.customSort;
|
|
34823
|
+
if ( customSort === null ) {
|
|
34824
|
+
|
|
34825
|
+
list.sort( material.transparent ? sortTransparent : sortOpaque );
|
|
34826
|
+
|
|
34827
|
+
} else {
|
|
34828
|
+
|
|
34829
|
+
customSort.call( this, list, camera );
|
|
34830
|
+
|
|
34831
|
+
}
|
|
34832
|
+
|
|
34833
|
+
for ( let i = 0, l = list.length; i < l; i ++ ) {
|
|
34834
|
+
|
|
34835
|
+
const item = list[ i ];
|
|
34836
|
+
multiDrawStarts[ count ] = item.start * bytesPerElement;
|
|
34837
|
+
multiDrawCounts[ count ] = item.count;
|
|
34838
|
+
count ++;
|
|
34839
|
+
|
|
34840
|
+
}
|
|
34841
|
+
|
|
34842
|
+
_renderList.reset();
|
|
34843
|
+
|
|
34844
|
+
} else {
|
|
34845
|
+
|
|
34846
|
+
for ( let i = 0, l = visibility.length; i < l; i ++ ) {
|
|
34847
|
+
|
|
34848
|
+
if ( visibility[ i ] ) {
|
|
34849
|
+
|
|
34850
|
+
// determine whether the batched geometry is within the frustum
|
|
34851
|
+
let culled = false;
|
|
34852
|
+
if ( perObjectFrustumCulled ) {
|
|
34853
|
+
|
|
34854
|
+
// get the bounds in world space
|
|
34855
|
+
this.getMatrixAt( i, _matrix );
|
|
34856
|
+
this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
|
|
34857
|
+
culled = ! _frustum.intersectsSphere( _sphere$2 );
|
|
34858
|
+
|
|
34859
|
+
}
|
|
34860
|
+
|
|
34861
|
+
if ( ! culled ) {
|
|
34862
|
+
|
|
34863
|
+
const range = drawRanges[ i ];
|
|
34864
|
+
multiDrawStarts[ count ] = range.start * bytesPerElement;
|
|
34865
|
+
multiDrawCounts[ count ] = range.count;
|
|
34866
|
+
count ++;
|
|
34867
|
+
|
|
34868
|
+
}
|
|
34869
|
+
|
|
34870
|
+
}
|
|
34871
|
+
|
|
34872
|
+
}
|
|
34873
|
+
|
|
34874
|
+
}
|
|
34875
|
+
|
|
34876
|
+
this._multiDrawCount = count;
|
|
34877
|
+
this._visibilityChanged = false;
|
|
34878
|
+
|
|
34879
|
+
}
|
|
34880
|
+
|
|
34881
|
+
onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {
|
|
34882
|
+
|
|
34883
|
+
this.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );
|
|
34884
|
+
|
|
34885
|
+
}
|
|
34886
|
+
|
|
34887
|
+
}
|
|
34888
|
+
|
|
33624
34889
|
class LineBasicMaterial extends Material {
|
|
33625
34890
|
|
|
33626
34891
|
constructor( parameters ) {
|
|
@@ -35436,6 +36701,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
35436
36701
|
this.v2 = v2;
|
|
35437
36702
|
|
|
35438
36703
|
}
|
|
36704
|
+
|
|
35439
36705
|
getPoint( t, optionalTarget = new Vector3() ) {
|
|
35440
36706
|
|
|
35441
36707
|
const point = optionalTarget;
|
|
@@ -35454,6 +36720,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
35454
36720
|
return point;
|
|
35455
36721
|
|
|
35456
36722
|
}
|
|
36723
|
+
|
|
35457
36724
|
// Line curve is linear, so we can overwrite default getPointAt
|
|
35458
36725
|
getPointAt( u, optionalTarget ) {
|
|
35459
36726
|
|
|
@@ -35483,6 +36750,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
35483
36750
|
return this;
|
|
35484
36751
|
|
|
35485
36752
|
}
|
|
36753
|
+
|
|
35486
36754
|
toJSON() {
|
|
35487
36755
|
|
|
35488
36756
|
const data = super.toJSON();
|
|
@@ -35493,6 +36761,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
35493
36761
|
return data;
|
|
35494
36762
|
|
|
35495
36763
|
}
|
|
36764
|
+
|
|
35496
36765
|
fromJSON( json ) {
|
|
35497
36766
|
|
|
35498
36767
|
super.fromJSON( json );
|
|
@@ -45395,13 +46664,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
45395
46664
|
if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
|
|
45396
46665
|
if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
|
|
45397
46666
|
|
|
45398
|
-
if ( attribute.updateRange !== undefined ) {
|
|
45399
|
-
|
|
45400
|
-
bufferAttribute.updateRange.offset = attribute.updateRange.offset;
|
|
45401
|
-
bufferAttribute.updateRange.count = attribute.updateRange.count;
|
|
45402
|
-
|
|
45403
|
-
}
|
|
45404
|
-
|
|
45405
46667
|
geometry.setAttribute( key, bufferAttribute );
|
|
45406
46668
|
|
|
45407
46669
|
}
|
|
@@ -46343,6 +47605,52 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
46343
47605
|
|
|
46344
47606
|
break;
|
|
46345
47607
|
|
|
47608
|
+
case 'BatchedMesh':
|
|
47609
|
+
|
|
47610
|
+
geometry = getGeometry( data.geometry );
|
|
47611
|
+
material = getMaterial( data.material );
|
|
47612
|
+
|
|
47613
|
+
object = new BatchedMesh( data.maxGeometryCount, data.maxVertexCount, data.maxIndexCount, material );
|
|
47614
|
+
object.geometry = geometry;
|
|
47615
|
+
object.perObjectFrustumCulled = data.perObjectFrustumCulled;
|
|
47616
|
+
object.sortObjects = data.sortObjects;
|
|
47617
|
+
|
|
47618
|
+
object._drawRanges = data.drawRanges;
|
|
47619
|
+
object._reservedRanges = data.reservedRanges;
|
|
47620
|
+
|
|
47621
|
+
object._visibility = data.visibility;
|
|
47622
|
+
object._active = data.active;
|
|
47623
|
+
object._bounds = data.bounds.map( bound => {
|
|
47624
|
+
|
|
47625
|
+
const box = new Box3();
|
|
47626
|
+
box.min.fromArray( bound.boxMin );
|
|
47627
|
+
box.max.fromArray( bound.boxMax );
|
|
47628
|
+
|
|
47629
|
+
const sphere = new Sphere();
|
|
47630
|
+
sphere.radius = bound.sphereRadius;
|
|
47631
|
+
sphere.center.fromArray( bound.sphereCenter );
|
|
47632
|
+
|
|
47633
|
+
return {
|
|
47634
|
+
boxInitialized: bound.boxInitialized,
|
|
47635
|
+
box: box,
|
|
47636
|
+
|
|
47637
|
+
sphereInitialized: bound.sphereInitialized,
|
|
47638
|
+
sphere: sphere
|
|
47639
|
+
};
|
|
47640
|
+
|
|
47641
|
+
} );
|
|
47642
|
+
|
|
47643
|
+
object._maxGeometryCount = data.maxGeometryCount;
|
|
47644
|
+
object._maxVertexCount = data.maxVertexCount;
|
|
47645
|
+
object._maxIndexCount = data.maxIndexCount;
|
|
47646
|
+
|
|
47647
|
+
object._geometryInitialized = data.geometryInitialized;
|
|
47648
|
+
object._geometryCount = data.geometryCount;
|
|
47649
|
+
|
|
47650
|
+
object._matricesTexture = getTexture( data.matricesTexture.uuid );
|
|
47651
|
+
|
|
47652
|
+
break;
|
|
47653
|
+
|
|
46346
47654
|
case 'LOD':
|
|
46347
47655
|
|
|
46348
47656
|
object = new LOD();
|
|
@@ -46590,6 +47898,25 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
46590
47898
|
|
|
46591
47899
|
scope.manager.itemStart( url );
|
|
46592
47900
|
|
|
47901
|
+
// If cached is a promise, wait for it to resolve
|
|
47902
|
+
if ( cached.then ) {
|
|
47903
|
+
|
|
47904
|
+
cached.then( imageBitmap => {
|
|
47905
|
+
|
|
47906
|
+
if ( onLoad ) onLoad( imageBitmap );
|
|
47907
|
+
|
|
47908
|
+
scope.manager.itemEnd( url );
|
|
47909
|
+
|
|
47910
|
+
} ).catch( e => {
|
|
47911
|
+
|
|
47912
|
+
if ( onError ) onError( e );
|
|
47913
|
+
|
|
47914
|
+
} );
|
|
47915
|
+
return;
|
|
47916
|
+
|
|
47917
|
+
}
|
|
47918
|
+
|
|
47919
|
+
// If cached is not a promise (i.e., it's already an imageBitmap)
|
|
46593
47920
|
setTimeout( function () {
|
|
46594
47921
|
|
|
46595
47922
|
if ( onLoad ) onLoad( cached );
|
|
@@ -46606,7 +47933,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
46606
47933
|
fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';
|
|
46607
47934
|
fetchOptions.headers = this.requestHeader;
|
|
46608
47935
|
|
|
46609
|
-
fetch( url, fetchOptions ).then( function ( res ) {
|
|
47936
|
+
const promise = fetch( url, fetchOptions ).then( function ( res ) {
|
|
46610
47937
|
|
|
46611
47938
|
return res.blob();
|
|
46612
47939
|
|
|
@@ -46622,15 +47949,20 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
46622
47949
|
|
|
46623
47950
|
scope.manager.itemEnd( url );
|
|
46624
47951
|
|
|
47952
|
+
return imageBitmap;
|
|
47953
|
+
|
|
46625
47954
|
} ).catch( function ( e ) {
|
|
46626
47955
|
|
|
46627
47956
|
if ( onError ) onError( e );
|
|
46628
47957
|
|
|
47958
|
+
Cache.remove( url );
|
|
47959
|
+
|
|
46629
47960
|
scope.manager.itemError( url );
|
|
46630
47961
|
scope.manager.itemEnd( url );
|
|
46631
47962
|
|
|
46632
47963
|
} );
|
|
46633
47964
|
|
|
47965
|
+
Cache.add( url, promise );
|
|
46634
47966
|
scope.manager.itemStart( url );
|
|
46635
47967
|
|
|
46636
47968
|
}
|
|
@@ -46691,7 +48023,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
46691
48023
|
|
|
46692
48024
|
onLoad( audioBuffer );
|
|
46693
48025
|
|
|
46694
|
-
}
|
|
48026
|
+
} ).catch( handleError );
|
|
46695
48027
|
|
|
46696
48028
|
} catch ( e ) {
|
|
46697
48029
|
|
|
@@ -50555,7 +51887,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
50555
51887
|
|
|
50556
51888
|
for ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {
|
|
50557
51889
|
|
|
50558
|
-
|
|
51890
|
+
const uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];
|
|
51891
|
+
|
|
51892
|
+
for ( let j = 0; j < uniforms.length; j ++ ) {
|
|
51893
|
+
|
|
51894
|
+
this.uniforms.push( uniforms[ j ].clone() );
|
|
51895
|
+
|
|
51896
|
+
}
|
|
50559
51897
|
|
|
50560
51898
|
}
|
|
50561
51899
|
|
|
@@ -52766,6 +54104,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52766
54104
|
exports.AddOperation = AddOperation;
|
|
52767
54105
|
exports.AdditiveAnimationBlendMode = AdditiveAnimationBlendMode;
|
|
52768
54106
|
exports.AdditiveBlending = AdditiveBlending;
|
|
54107
|
+
exports.AgXToneMapping = AgXToneMapping;
|
|
52769
54108
|
exports.AlphaFormat = AlphaFormat;
|
|
52770
54109
|
exports.AlwaysCompare = AlwaysCompare;
|
|
52771
54110
|
exports.AlwaysDepth = AlwaysDepth;
|
|
@@ -52790,6 +54129,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52790
54129
|
exports.BackSide = BackSide;
|
|
52791
54130
|
exports.BasicDepthPacking = BasicDepthPacking;
|
|
52792
54131
|
exports.BasicShadowMap = BasicShadowMap;
|
|
54132
|
+
exports.BatchedMesh = BatchedMesh;
|
|
52793
54133
|
exports.Bone = Bone;
|
|
52794
54134
|
exports.BooleanKeyframeTrack = BooleanKeyframeTrack;
|
|
52795
54135
|
exports.Box2 = Box2;
|