super-three 0.157.0 → 0.158.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/build/three.cjs +1486 -842
- package/build/three.js +1486 -842
- package/build/three.min.js +1 -1
- package/build/three.module.js +1481 -843
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +290 -0
- package/examples/jsm/controls/FlyControls.js +26 -0
- package/examples/jsm/controls/OrbitControls.js +12 -1
- package/examples/jsm/controls/TransformControls.js +27 -11
- package/examples/jsm/csm/CSMShader.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +72 -2
- package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
- package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
- package/examples/jsm/libs/lottie_canvas.module.js +6 -1
- package/examples/jsm/libs/opentype.module.js +13 -75
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/loaders/GLTFLoader.js +12 -3
- package/examples/jsm/loaders/LUTImageLoader.js +162 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +89 -93
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
- package/examples/jsm/math/Capsule.js +0 -55
- package/examples/jsm/math/Octree.js +70 -3
- package/examples/jsm/modifiers/SimplifyModifier.js +103 -11
- package/examples/jsm/modifiers/TessellateModifier.js +3 -3
- package/examples/jsm/nodes/Nodes.js +6 -6
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +3 -3
- package/examples/jsm/nodes/accessors/InstanceNode.js +3 -3
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +68 -31
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -2
- package/examples/jsm/nodes/accessors/MorphNode.js +5 -5
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/SkinningNode.js +13 -3
- package/examples/jsm/nodes/accessors/TextureNode.js +3 -3
- package/examples/jsm/nodes/code/FunctionNode.js +1 -1
- package/examples/jsm/nodes/core/AssignNode.js +72 -0
- package/examples/jsm/nodes/core/LightingModel.js +3 -1
- package/examples/jsm/nodes/core/Node.js +7 -12
- package/examples/jsm/nodes/core/NodeBuilder.js +126 -16
- package/examples/jsm/nodes/core/NodeUtils.js +4 -2
- package/examples/jsm/nodes/core/OutputStructNode.js +1 -1
- package/examples/jsm/nodes/core/ParameterNode.js +33 -0
- package/examples/jsm/nodes/core/PropertyNode.js +4 -10
- package/examples/jsm/nodes/core/StackNode.js +7 -17
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/VarNode.js +6 -35
- package/examples/jsm/nodes/core/VaryingNode.js +2 -0
- package/examples/jsm/nodes/display/BumpMapNode.js +35 -13
- package/examples/jsm/nodes/display/NormalMapNode.js +3 -1
- package/examples/jsm/nodes/display/ViewportNode.js +14 -4
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +20 -6
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +8 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +8 -3
- package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +8 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +8 -0
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +93 -43
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +19 -5
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +0 -6
- package/examples/jsm/nodes/lighting/LightingContextNode.js +21 -57
- package/examples/jsm/nodes/lighting/LightsNode.js +62 -4
- package/examples/jsm/nodes/lighting/PointLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +1 -1
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +70 -71
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +5 -5
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +47 -20
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/NodeMaterial.js +17 -20
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +5 -5
- package/examples/jsm/nodes/math/OperatorNode.js +5 -21
- package/examples/jsm/nodes/shadernode/ShaderNode.js +128 -9
- package/examples/jsm/nodes/utils/ArrayElementNode.js +2 -0
- package/examples/jsm/nodes/utils/DiscardNode.js +3 -2
- package/examples/jsm/nodes/utils/JoinNode.js +11 -1
- package/examples/jsm/nodes/utils/LoopNode.js +36 -24
- package/examples/jsm/nodes/utils/SplitNode.js +2 -0
- package/examples/jsm/objects/BatchedMesh.js +586 -0
- package/examples/jsm/objects/InstancedPoints.js +21 -0
- package/examples/jsm/objects/Lensflare.js +20 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +3 -0
- package/examples/jsm/objects/Refractor.js +3 -0
- package/examples/jsm/objects/Sky.js +5 -3
- package/examples/jsm/objects/Water.js +5 -2
- package/examples/jsm/objects/Water2.js +3 -0
- package/examples/jsm/physics/AmmoPhysics.js +21 -0
- package/examples/jsm/physics/RapierPhysics.js +21 -0
- package/examples/jsm/postprocessing/BokehPass.js +3 -2
- package/examples/jsm/postprocessing/LUTPass.js +2 -1
- package/examples/jsm/postprocessing/OutputPass.js +1 -0
- package/examples/jsm/postprocessing/Pass.js +14 -3
- package/examples/jsm/postprocessing/SAOPass.js +0 -1
- package/examples/jsm/postprocessing/SMAAPass.js +0 -2
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -2
- package/examples/jsm/renderers/CSS3DRenderer.js +3 -9
- package/examples/jsm/renderers/SVGRenderer.js +9 -6
- package/examples/jsm/renderers/common/Bindings.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +8 -1
- package/examples/jsm/renderers/common/RenderObjects.js +1 -1
- package/examples/jsm/renderers/common/Textures.js +4 -36
- package/examples/jsm/renderers/common/nodes/Nodes.js +53 -18
- package/examples/jsm/renderers/webgl/WebGLBackend.js +291 -50
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +88 -12
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +40 -5
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +14 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +2 -0
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +36 -4
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +2 -0
- package/examples/jsm/shaders/AfterimageShader.js +2 -0
- package/examples/jsm/shaders/BasicShader.js +2 -0
- package/examples/jsm/shaders/BlendShader.js +2 -0
- package/examples/jsm/shaders/BokehShader.js +2 -0
- package/examples/jsm/shaders/BokehShader2.js +4 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +2 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +2 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +2 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +5 -0
- package/examples/jsm/shaders/FXAAShader.js +2 -0
- package/examples/jsm/shaders/FilmShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +2 -0
- package/examples/jsm/shaders/FreiChenShader.js +2 -0
- package/examples/jsm/shaders/GodRaysShader.js +8 -0
- package/examples/jsm/shaders/HalftoneShader.js +2 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +2 -0
- package/examples/jsm/shaders/HueSaturationShader.js +2 -0
- package/examples/jsm/shaders/KaleidoShader.js +2 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +2 -0
- package/examples/jsm/shaders/LuminosityShader.js +2 -0
- package/examples/jsm/shaders/MMDToonShader.js +2 -0
- package/examples/jsm/shaders/MirrorShader.js +2 -0
- package/examples/jsm/shaders/NormalMapShader.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +4 -5
- package/examples/jsm/shaders/SAOShader.js +5 -0
- package/examples/jsm/shaders/SMAAShader.js +6 -0
- package/examples/jsm/shaders/SSAOShader.js +6 -0
- package/examples/jsm/shaders/SSRShader.js +6 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +2 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +2 -0
- package/examples/jsm/shaders/TechnicolorShader.js +2 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +2 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -0
- package/examples/jsm/shaders/VelocityShader.js +2 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +2 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +2 -0
- package/examples/jsm/transpiler/AST.js +231 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +899 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
- package/examples/jsm/transpiler/TSLEncoder.js +611 -0
- package/examples/jsm/transpiler/Transpiler.js +18 -0
- package/examples/jsm/webxr/VRButton.js +1 -1
- package/examples/jsm/webxr/XRButton.js +7 -5
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +4 -1
- package/src/constants.js +7 -1
- package/src/extras/PMREMGenerator.js +7 -1
- package/src/loaders/MaterialLoader.js +10 -2
- package/src/materials/Material.js +27 -13
- package/src/math/Box3.js +35 -18
- package/src/math/Vector3.js +11 -12
- package/src/objects/SkinnedMesh.js +6 -7
- package/src/renderers/WebGLMultiviewRenderTarget.js +35 -0
- package/src/renderers/WebGLRenderer.js +199 -45
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +8 -6
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +1 -1
- package/src/renderers/webgl/WebGLMultiview.js +100 -0
- package/src/renderers/webgl/WebGLProgram.js +130 -50
- package/src/renderers/webgl/WebGLPrograms.js +8 -0
- package/src/renderers/webgl/WebGLState.js +25 -4
- package/src/renderers/webgl/WebGLTextures.js +197 -20
- package/src/renderers/webxr/WebXRManager.js +36 -12
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +0 -76
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +0 -29
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 = '158';
|
|
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 };
|
|
@@ -48,6 +48,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
48
48
|
const DstColorFactor = 208;
|
|
49
49
|
const OneMinusDstColorFactor = 209;
|
|
50
50
|
const SrcAlphaSaturateFactor = 210;
|
|
51
|
+
const ConstantColorFactor = 211;
|
|
52
|
+
const OneMinusConstantColorFactor = 212;
|
|
53
|
+
const ConstantAlphaFactor = 213;
|
|
54
|
+
const OneMinusConstantAlphaFactor = 214;
|
|
51
55
|
const NeverDepth = 0;
|
|
52
56
|
const AlwaysDepth = 1;
|
|
53
57
|
const LessDepth = 2;
|
|
@@ -65,6 +69,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
65
69
|
const CineonToneMapping = 3;
|
|
66
70
|
const ACESFilmicToneMapping = 4;
|
|
67
71
|
const CustomToneMapping = 5;
|
|
72
|
+
const AttachedBindMode = 'attached';
|
|
73
|
+
const DetachedBindMode = 'detached';
|
|
68
74
|
|
|
69
75
|
const UVMapping = 300;
|
|
70
76
|
const CubeReflectionMapping = 301;
|
|
@@ -4159,21 +4165,20 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4159
4165
|
|
|
4160
4166
|
applyQuaternion( q ) {
|
|
4161
4167
|
|
|
4162
|
-
|
|
4163
|
-
const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
|
|
4168
|
+
// quaternion q is assumed to have unit length
|
|
4164
4169
|
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
const ix = qw * x + qy * z - qz * y;
|
|
4168
|
-
const iy = qw * y + qz * x - qx * z;
|
|
4169
|
-
const iz = qw * z + qx * y - qy * x;
|
|
4170
|
-
const iw = - qx * x - qy * y - qz * z;
|
|
4170
|
+
const vx = this.x, vy = this.y, vz = this.z;
|
|
4171
|
+
const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
|
|
4171
4172
|
|
|
4172
|
-
//
|
|
4173
|
+
// t = 2 * cross( q.xyz, v );
|
|
4174
|
+
const tx = 2 * ( qy * vz - qz * vy );
|
|
4175
|
+
const ty = 2 * ( qz * vx - qx * vz );
|
|
4176
|
+
const tz = 2 * ( qx * vy - qy * vx );
|
|
4173
4177
|
|
|
4174
|
-
|
|
4175
|
-
this.
|
|
4176
|
-
this.
|
|
4178
|
+
// v + q.w * t + cross( q.xyz, t );
|
|
4179
|
+
this.x = vx + qw * tx + qy * tz - qz * ty;
|
|
4180
|
+
this.y = vy + qw * ty + qz * tx - qx * tz;
|
|
4181
|
+
this.z = vz + qw * tz + qx * ty - qy * tx;
|
|
4177
4182
|
|
|
4178
4183
|
return this;
|
|
4179
4184
|
|
|
@@ -4789,37 +4794,53 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4789
4794
|
|
|
4790
4795
|
object.updateWorldMatrix( false, false );
|
|
4791
4796
|
|
|
4792
|
-
|
|
4797
|
+
const geometry = object.geometry;
|
|
4793
4798
|
|
|
4794
|
-
|
|
4799
|
+
if ( geometry !== undefined ) {
|
|
4795
4800
|
|
|
4796
|
-
|
|
4801
|
+
const positionAttribute = geometry.getAttribute( 'position' );
|
|
4797
4802
|
|
|
4798
|
-
|
|
4803
|
+
// precise AABB computation based on vertex data requires at least a position attribute.
|
|
4804
|
+
// instancing isn't supported so far and uses the normal (conservative) code path.
|
|
4799
4805
|
|
|
4800
|
-
|
|
4801
|
-
_box$3.applyMatrix4( object.matrixWorld );
|
|
4806
|
+
if ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {
|
|
4802
4807
|
|
|
4803
|
-
|
|
4808
|
+
for ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {
|
|
4804
4809
|
|
|
4805
|
-
|
|
4810
|
+
if ( object.isMesh === true ) {
|
|
4806
4811
|
|
|
4807
|
-
|
|
4812
|
+
object.getVertexPosition( i, _vector$a );
|
|
4808
4813
|
|
|
4809
|
-
|
|
4814
|
+
} else {
|
|
4815
|
+
|
|
4816
|
+
_vector$a.fromBufferAttribute( positionAttribute, i );
|
|
4817
|
+
|
|
4818
|
+
}
|
|
4810
4819
|
|
|
4811
|
-
|
|
4820
|
+
_vector$a.applyMatrix4( object.matrixWorld );
|
|
4821
|
+
this.expandByPoint( _vector$a );
|
|
4812
4822
|
|
|
4813
|
-
|
|
4814
|
-
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4825
|
+
} else {
|
|
4815
4826
|
|
|
4816
|
-
|
|
4817
|
-
|
|
4827
|
+
if ( object.boundingBox !== undefined ) {
|
|
4828
|
+
|
|
4829
|
+
// object-level bounding box
|
|
4830
|
+
|
|
4831
|
+
if ( object.boundingBox === null ) {
|
|
4832
|
+
|
|
4833
|
+
object.computeBoundingBox();
|
|
4818
4834
|
|
|
4819
4835
|
}
|
|
4820
4836
|
|
|
4837
|
+
_box$3.copy( object.boundingBox );
|
|
4838
|
+
|
|
4839
|
+
|
|
4821
4840
|
} else {
|
|
4822
4841
|
|
|
4842
|
+
// geometry-level bounding box
|
|
4843
|
+
|
|
4823
4844
|
if ( geometry.boundingBox === null ) {
|
|
4824
4845
|
|
|
4825
4846
|
geometry.computeBoundingBox();
|
|
@@ -4827,12 +4848,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
4827
4848
|
}
|
|
4828
4849
|
|
|
4829
4850
|
_box$3.copy( geometry.boundingBox );
|
|
4830
|
-
_box$3.applyMatrix4( object.matrixWorld );
|
|
4831
|
-
|
|
4832
|
-
this.union( _box$3 );
|
|
4833
4851
|
|
|
4834
4852
|
}
|
|
4835
4853
|
|
|
4854
|
+
_box$3.applyMatrix4( object.matrixWorld );
|
|
4855
|
+
|
|
4856
|
+
this.union( _box$3 );
|
|
4857
|
+
|
|
4836
4858
|
}
|
|
4837
4859
|
|
|
4838
4860
|
}
|
|
@@ -8428,1127 +8450,1140 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
8428
8450
|
|
|
8429
8451
|
}
|
|
8430
8452
|
|
|
8431
|
-
|
|
8453
|
+
const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,
|
|
8454
|
+
'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,
|
|
8455
|
+
'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,
|
|
8456
|
+
'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,
|
|
8457
|
+
'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,
|
|
8458
|
+
'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,
|
|
8459
|
+
'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,
|
|
8460
|
+
'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,
|
|
8461
|
+
'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,
|
|
8462
|
+
'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,
|
|
8463
|
+
'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,
|
|
8464
|
+
'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,
|
|
8465
|
+
'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,
|
|
8466
|
+
'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,
|
|
8467
|
+
'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,
|
|
8468
|
+
'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,
|
|
8469
|
+
'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,
|
|
8470
|
+
'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,
|
|
8471
|
+
'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,
|
|
8472
|
+
'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,
|
|
8473
|
+
'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,
|
|
8474
|
+
'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,
|
|
8475
|
+
'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,
|
|
8476
|
+
'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };
|
|
8432
8477
|
|
|
8433
|
-
|
|
8478
|
+
const _hslA = { h: 0, s: 0, l: 0 };
|
|
8479
|
+
const _hslB = { h: 0, s: 0, l: 0 };
|
|
8434
8480
|
|
|
8435
|
-
|
|
8481
|
+
function hue2rgb( p, q, t ) {
|
|
8436
8482
|
|
|
8437
|
-
|
|
8483
|
+
if ( t < 0 ) t += 1;
|
|
8484
|
+
if ( t > 1 ) t -= 1;
|
|
8485
|
+
if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
|
|
8486
|
+
if ( t < 1 / 2 ) return q;
|
|
8487
|
+
if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
|
|
8488
|
+
return p;
|
|
8438
8489
|
|
|
8439
|
-
|
|
8490
|
+
}
|
|
8440
8491
|
|
|
8441
|
-
|
|
8492
|
+
class Color {
|
|
8442
8493
|
|
|
8443
|
-
|
|
8494
|
+
constructor( r, g, b ) {
|
|
8444
8495
|
|
|
8445
|
-
this.
|
|
8446
|
-
this.type = 'Material';
|
|
8496
|
+
this.isColor = true;
|
|
8447
8497
|
|
|
8448
|
-
this.
|
|
8449
|
-
this.
|
|
8450
|
-
this.
|
|
8498
|
+
this.r = 1;
|
|
8499
|
+
this.g = 1;
|
|
8500
|
+
this.b = 1;
|
|
8451
8501
|
|
|
8452
|
-
this.
|
|
8453
|
-
this.transparent = false;
|
|
8454
|
-
this.alphaHash = false;
|
|
8502
|
+
return this.set( r, g, b );
|
|
8455
8503
|
|
|
8456
|
-
|
|
8457
|
-
this.blendDst = OneMinusSrcAlphaFactor;
|
|
8458
|
-
this.blendEquation = AddEquation;
|
|
8459
|
-
this.blendSrcAlpha = null;
|
|
8460
|
-
this.blendDstAlpha = null;
|
|
8461
|
-
this.blendEquationAlpha = null;
|
|
8504
|
+
}
|
|
8462
8505
|
|
|
8463
|
-
|
|
8464
|
-
this.depthTest = true;
|
|
8465
|
-
this.depthWrite = true;
|
|
8506
|
+
set( r, g, b ) {
|
|
8466
8507
|
|
|
8467
|
-
|
|
8468
|
-
this.stencilFunc = AlwaysStencilFunc;
|
|
8469
|
-
this.stencilRef = 0;
|
|
8470
|
-
this.stencilFuncMask = 0xff;
|
|
8471
|
-
this.stencilFail = KeepStencilOp;
|
|
8472
|
-
this.stencilZFail = KeepStencilOp;
|
|
8473
|
-
this.stencilZPass = KeepStencilOp;
|
|
8474
|
-
this.stencilWrite = false;
|
|
8508
|
+
if ( g === undefined && b === undefined ) {
|
|
8475
8509
|
|
|
8476
|
-
|
|
8477
|
-
this.clipIntersection = false;
|
|
8478
|
-
this.clipShadows = false;
|
|
8510
|
+
// r is THREE.Color, hex or string
|
|
8479
8511
|
|
|
8480
|
-
|
|
8512
|
+
const value = r;
|
|
8481
8513
|
|
|
8482
|
-
|
|
8514
|
+
if ( value && value.isColor ) {
|
|
8483
8515
|
|
|
8484
|
-
|
|
8516
|
+
this.copy( value );
|
|
8485
8517
|
|
|
8486
|
-
|
|
8487
|
-
this.polygonOffsetFactor = 0;
|
|
8488
|
-
this.polygonOffsetUnits = 0;
|
|
8518
|
+
} else if ( typeof value === 'number' ) {
|
|
8489
8519
|
|
|
8490
|
-
|
|
8520
|
+
this.setHex( value );
|
|
8491
8521
|
|
|
8492
|
-
|
|
8493
|
-
this.premultipliedAlpha = false;
|
|
8494
|
-
this.forceSinglePass = false;
|
|
8522
|
+
} else if ( typeof value === 'string' ) {
|
|
8495
8523
|
|
|
8496
|
-
|
|
8524
|
+
this.setStyle( value );
|
|
8497
8525
|
|
|
8498
|
-
|
|
8526
|
+
}
|
|
8499
8527
|
|
|
8500
|
-
|
|
8528
|
+
} else {
|
|
8501
8529
|
|
|
8502
|
-
|
|
8530
|
+
this.setRGB( r, g, b );
|
|
8503
8531
|
|
|
8504
|
-
|
|
8532
|
+
}
|
|
8533
|
+
|
|
8534
|
+
return this;
|
|
8505
8535
|
|
|
8506
8536
|
}
|
|
8507
8537
|
|
|
8508
|
-
|
|
8538
|
+
setScalar( scalar ) {
|
|
8509
8539
|
|
|
8510
|
-
|
|
8540
|
+
this.r = scalar;
|
|
8541
|
+
this.g = scalar;
|
|
8542
|
+
this.b = scalar;
|
|
8543
|
+
|
|
8544
|
+
return this;
|
|
8511
8545
|
|
|
8512
8546
|
}
|
|
8513
8547
|
|
|
8514
|
-
|
|
8548
|
+
setHex( hex, colorSpace = SRGBColorSpace ) {
|
|
8515
8549
|
|
|
8516
|
-
|
|
8550
|
+
hex = Math.floor( hex );
|
|
8517
8551
|
|
|
8518
|
-
|
|
8552
|
+
this.r = ( hex >> 16 & 255 ) / 255;
|
|
8553
|
+
this.g = ( hex >> 8 & 255 ) / 255;
|
|
8554
|
+
this.b = ( hex & 255 ) / 255;
|
|
8519
8555
|
|
|
8520
|
-
|
|
8556
|
+
ColorManagement.toWorkingColorSpace( this, colorSpace );
|
|
8521
8557
|
|
|
8522
|
-
this
|
|
8558
|
+
return this;
|
|
8523
8559
|
|
|
8524
8560
|
}
|
|
8525
8561
|
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
8562
|
+
setRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {
|
|
8529
8563
|
|
|
8530
|
-
|
|
8564
|
+
this.r = r;
|
|
8565
|
+
this.g = g;
|
|
8566
|
+
this.b = b;
|
|
8531
8567
|
|
|
8532
|
-
|
|
8568
|
+
ColorManagement.toWorkingColorSpace( this, colorSpace );
|
|
8533
8569
|
|
|
8534
|
-
return this
|
|
8570
|
+
return this;
|
|
8535
8571
|
|
|
8536
8572
|
}
|
|
8537
8573
|
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
if ( values === undefined ) return;
|
|
8574
|
+
setHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {
|
|
8541
8575
|
|
|
8542
|
-
|
|
8576
|
+
// h,s,l ranges are in 0.0 - 1.0
|
|
8577
|
+
h = euclideanModulo( h, 1 );
|
|
8578
|
+
s = clamp( s, 0, 1 );
|
|
8579
|
+
l = clamp( l, 0, 1 );
|
|
8543
8580
|
|
|
8544
|
-
|
|
8581
|
+
if ( s === 0 ) {
|
|
8545
8582
|
|
|
8546
|
-
|
|
8583
|
+
this.r = this.g = this.b = l;
|
|
8547
8584
|
|
|
8548
|
-
|
|
8549
|
-
continue;
|
|
8585
|
+
} else {
|
|
8550
8586
|
|
|
8551
|
-
|
|
8587
|
+
const p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
|
|
8588
|
+
const q = ( 2 * l ) - p;
|
|
8552
8589
|
|
|
8553
|
-
|
|
8590
|
+
this.r = hue2rgb( q, p, h + 1 / 3 );
|
|
8591
|
+
this.g = hue2rgb( q, p, h );
|
|
8592
|
+
this.b = hue2rgb( q, p, h - 1 / 3 );
|
|
8554
8593
|
|
|
8555
|
-
|
|
8594
|
+
}
|
|
8556
8595
|
|
|
8557
|
-
|
|
8558
|
-
continue;
|
|
8596
|
+
ColorManagement.toWorkingColorSpace( this, colorSpace );
|
|
8559
8597
|
|
|
8560
|
-
|
|
8598
|
+
return this;
|
|
8561
8599
|
|
|
8562
|
-
|
|
8600
|
+
}
|
|
8563
8601
|
|
|
8564
|
-
|
|
8602
|
+
setStyle( style, colorSpace = SRGBColorSpace ) {
|
|
8565
8603
|
|
|
8566
|
-
|
|
8604
|
+
function handleAlpha( string ) {
|
|
8567
8605
|
|
|
8568
|
-
|
|
8606
|
+
if ( string === undefined ) return;
|
|
8569
8607
|
|
|
8570
|
-
|
|
8608
|
+
if ( parseFloat( string ) < 1 ) {
|
|
8571
8609
|
|
|
8572
|
-
|
|
8610
|
+
console.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );
|
|
8573
8611
|
|
|
8574
8612
|
}
|
|
8575
8613
|
|
|
8576
8614
|
}
|
|
8577
8615
|
|
|
8578
|
-
}
|
|
8579
8616
|
|
|
8580
|
-
|
|
8617
|
+
let m;
|
|
8581
8618
|
|
|
8582
|
-
|
|
8619
|
+
if ( m = /^(\w+)\(([^\)]*)\)/.exec( style ) ) {
|
|
8583
8620
|
|
|
8584
|
-
|
|
8621
|
+
// rgb / hsl
|
|
8585
8622
|
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
};
|
|
8623
|
+
let color;
|
|
8624
|
+
const name = m[ 1 ];
|
|
8625
|
+
const components = m[ 2 ];
|
|
8590
8626
|
|
|
8591
|
-
|
|
8627
|
+
switch ( name ) {
|
|
8592
8628
|
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
version: 4.6,
|
|
8596
|
-
type: 'Material',
|
|
8597
|
-
generator: 'Material.toJSON'
|
|
8598
|
-
}
|
|
8599
|
-
};
|
|
8629
|
+
case 'rgb':
|
|
8630
|
+
case 'rgba':
|
|
8600
8631
|
|
|
8601
|
-
|
|
8602
|
-
data.uuid = this.uuid;
|
|
8603
|
-
data.type = this.type;
|
|
8632
|
+
if ( color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
|
|
8604
8633
|
|
|
8605
|
-
|
|
8634
|
+
// rgb(255,0,0) rgba(255,0,0,0.5)
|
|
8606
8635
|
|
|
8607
|
-
|
|
8636
|
+
handleAlpha( color[ 4 ] );
|
|
8608
8637
|
|
|
8609
|
-
|
|
8610
|
-
|
|
8638
|
+
return this.setRGB(
|
|
8639
|
+
Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,
|
|
8640
|
+
Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,
|
|
8641
|
+
Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,
|
|
8642
|
+
colorSpace
|
|
8643
|
+
);
|
|
8611
8644
|
|
|
8612
|
-
|
|
8613
|
-
if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
|
|
8614
|
-
if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
|
|
8615
|
-
if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
|
|
8616
|
-
if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
|
|
8645
|
+
}
|
|
8617
8646
|
|
|
8618
|
-
|
|
8619
|
-
if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
|
|
8620
|
-
if ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();
|
|
8621
|
-
if ( this.shininess !== undefined ) data.shininess = this.shininess;
|
|
8622
|
-
if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;
|
|
8623
|
-
if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;
|
|
8647
|
+
if ( color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
|
|
8624
8648
|
|
|
8625
|
-
|
|
8649
|
+
// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
|
|
8626
8650
|
|
|
8627
|
-
|
|
8651
|
+
handleAlpha( color[ 4 ] );
|
|
8628
8652
|
|
|
8629
|
-
|
|
8653
|
+
return this.setRGB(
|
|
8654
|
+
Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,
|
|
8655
|
+
Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,
|
|
8656
|
+
Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,
|
|
8657
|
+
colorSpace
|
|
8658
|
+
);
|
|
8630
8659
|
|
|
8631
|
-
|
|
8660
|
+
}
|
|
8632
8661
|
|
|
8633
|
-
|
|
8662
|
+
break;
|
|
8634
8663
|
|
|
8635
|
-
|
|
8664
|
+
case 'hsl':
|
|
8665
|
+
case 'hsla':
|
|
8636
8666
|
|
|
8637
|
-
|
|
8667
|
+
if ( color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec( components ) ) {
|
|
8638
8668
|
|
|
8639
|
-
|
|
8640
|
-
data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();
|
|
8669
|
+
// hsl(120,50%,50%) hsla(120,50%,50%,0.5)
|
|
8641
8670
|
|
|
8642
|
-
|
|
8671
|
+
handleAlpha( color[ 4 ] );
|
|
8643
8672
|
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8673
|
+
return this.setHSL(
|
|
8674
|
+
parseFloat( color[ 1 ] ) / 360,
|
|
8675
|
+
parseFloat( color[ 2 ] ) / 100,
|
|
8676
|
+
parseFloat( color[ 3 ] ) / 100,
|
|
8677
|
+
colorSpace
|
|
8678
|
+
);
|
|
8647
8679
|
|
|
8648
|
-
|
|
8680
|
+
}
|
|
8649
8681
|
|
|
8650
|
-
|
|
8682
|
+
break;
|
|
8651
8683
|
|
|
8652
|
-
|
|
8684
|
+
default:
|
|
8653
8685
|
|
|
8654
|
-
|
|
8686
|
+
console.warn( 'THREE.Color: Unknown color model ' + style );
|
|
8655
8687
|
|
|
8656
|
-
|
|
8688
|
+
}
|
|
8657
8689
|
|
|
8658
|
-
}
|
|
8690
|
+
} else if ( m = /^\#([A-Fa-f\d]+)$/.exec( style ) ) {
|
|
8659
8691
|
|
|
8660
|
-
|
|
8661
|
-
if ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;
|
|
8692
|
+
// hex color
|
|
8662
8693
|
|
|
8663
|
-
|
|
8694
|
+
const hex = m[ 1 ];
|
|
8695
|
+
const size = hex.length;
|
|
8664
8696
|
|
|
8665
|
-
|
|
8697
|
+
if ( size === 3 ) {
|
|
8666
8698
|
|
|
8667
|
-
|
|
8699
|
+
// #ff0
|
|
8700
|
+
return this.setRGB(
|
|
8701
|
+
parseInt( hex.charAt( 0 ), 16 ) / 15,
|
|
8702
|
+
parseInt( hex.charAt( 1 ), 16 ) / 15,
|
|
8703
|
+
parseInt( hex.charAt( 2 ), 16 ) / 15,
|
|
8704
|
+
colorSpace
|
|
8705
|
+
);
|
|
8668
8706
|
|
|
8669
|
-
|
|
8670
|
-
if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;
|
|
8671
|
-
if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
|
|
8707
|
+
} else if ( size === 6 ) {
|
|
8672
8708
|
|
|
8673
|
-
|
|
8709
|
+
// #ff0000
|
|
8710
|
+
return this.setHex( parseInt( hex, 16 ), colorSpace );
|
|
8674
8711
|
|
|
8675
|
-
|
|
8676
|
-
data.lightMapIntensity = this.lightMapIntensity;
|
|
8712
|
+
} else {
|
|
8677
8713
|
|
|
8678
|
-
|
|
8714
|
+
console.warn( 'THREE.Color: Invalid hex color ' + style );
|
|
8679
8715
|
|
|
8680
|
-
|
|
8716
|
+
}
|
|
8681
8717
|
|
|
8682
|
-
|
|
8683
|
-
|
|
8718
|
+
} else if ( style && style.length > 0 ) {
|
|
8719
|
+
|
|
8720
|
+
return this.setColorName( style, colorSpace );
|
|
8684
8721
|
|
|
8685
8722
|
}
|
|
8686
8723
|
|
|
8687
|
-
|
|
8724
|
+
return this;
|
|
8688
8725
|
|
|
8689
|
-
|
|
8690
|
-
data.bumpScale = this.bumpScale;
|
|
8726
|
+
}
|
|
8691
8727
|
|
|
8692
|
-
|
|
8728
|
+
setColorName( style, colorSpace = SRGBColorSpace ) {
|
|
8693
8729
|
|
|
8694
|
-
|
|
8730
|
+
// color keywords
|
|
8731
|
+
const hex = _colorKeywords[ style.toLowerCase() ];
|
|
8695
8732
|
|
|
8696
|
-
|
|
8697
|
-
data.normalMapType = this.normalMapType;
|
|
8698
|
-
data.normalScale = this.normalScale.toArray();
|
|
8733
|
+
if ( hex !== undefined ) {
|
|
8699
8734
|
|
|
8700
|
-
|
|
8735
|
+
// red
|
|
8736
|
+
this.setHex( hex, colorSpace );
|
|
8701
8737
|
|
|
8702
|
-
|
|
8738
|
+
} else {
|
|
8703
8739
|
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
data.displacementBias = this.displacementBias;
|
|
8740
|
+
// unknown color
|
|
8741
|
+
console.warn( 'THREE.Color: Unknown color ' + style );
|
|
8707
8742
|
|
|
8708
8743
|
}
|
|
8709
8744
|
|
|
8710
|
-
|
|
8711
|
-
if ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;
|
|
8745
|
+
return this;
|
|
8712
8746
|
|
|
8713
|
-
|
|
8714
|
-
if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
|
|
8715
|
-
if ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;
|
|
8716
|
-
if ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;
|
|
8747
|
+
}
|
|
8717
8748
|
|
|
8718
|
-
|
|
8749
|
+
clone() {
|
|
8719
8750
|
|
|
8720
|
-
|
|
8751
|
+
return new this.constructor( this.r, this.g, this.b );
|
|
8721
8752
|
|
|
8722
|
-
|
|
8753
|
+
}
|
|
8723
8754
|
|
|
8724
|
-
|
|
8755
|
+
copy( color ) {
|
|
8725
8756
|
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8757
|
+
this.r = color.r;
|
|
8758
|
+
this.g = color.g;
|
|
8759
|
+
this.b = color.b;
|
|
8729
8760
|
|
|
8730
|
-
|
|
8761
|
+
return this;
|
|
8731
8762
|
|
|
8732
|
-
|
|
8763
|
+
}
|
|
8733
8764
|
|
|
8734
|
-
|
|
8765
|
+
copySRGBToLinear( color ) {
|
|
8735
8766
|
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
|
|
8740
|
-
if ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;
|
|
8741
|
-
if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();
|
|
8767
|
+
this.r = SRGBToLinear( color.r );
|
|
8768
|
+
this.g = SRGBToLinear( color.g );
|
|
8769
|
+
this.b = SRGBToLinear( color.b );
|
|
8742
8770
|
|
|
8743
|
-
|
|
8744
|
-
if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
|
|
8745
|
-
if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;
|
|
8771
|
+
return this;
|
|
8746
8772
|
|
|
8747
|
-
|
|
8748
|
-
if ( this.side !== FrontSide ) data.side = this.side;
|
|
8749
|
-
if ( this.vertexColors === true ) data.vertexColors = true;
|
|
8773
|
+
}
|
|
8750
8774
|
|
|
8751
|
-
|
|
8752
|
-
if ( this.transparent === true ) data.transparent = true;
|
|
8775
|
+
copyLinearToSRGB( color ) {
|
|
8753
8776
|
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
data.colorWrite = this.colorWrite;
|
|
8777
|
+
this.r = LinearToSRGB( color.r );
|
|
8778
|
+
this.g = LinearToSRGB( color.g );
|
|
8779
|
+
this.b = LinearToSRGB( color.b );
|
|
8758
8780
|
|
|
8759
|
-
|
|
8760
|
-
data.stencilWriteMask = this.stencilWriteMask;
|
|
8761
|
-
data.stencilFunc = this.stencilFunc;
|
|
8762
|
-
data.stencilRef = this.stencilRef;
|
|
8763
|
-
data.stencilFuncMask = this.stencilFuncMask;
|
|
8764
|
-
data.stencilFail = this.stencilFail;
|
|
8765
|
-
data.stencilZFail = this.stencilZFail;
|
|
8766
|
-
data.stencilZPass = this.stencilZPass;
|
|
8781
|
+
return this;
|
|
8767
8782
|
|
|
8768
|
-
|
|
8769
|
-
if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
|
|
8783
|
+
}
|
|
8770
8784
|
|
|
8771
|
-
|
|
8772
|
-
if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
|
|
8773
|
-
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
8785
|
+
convertSRGBToLinear() {
|
|
8774
8786
|
|
|
8775
|
-
|
|
8776
|
-
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
|
|
8777
|
-
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
|
|
8778
|
-
if ( this.scale !== undefined ) data.scale = this.scale;
|
|
8787
|
+
this.copySRGBToLinear( this );
|
|
8779
8788
|
|
|
8780
|
-
|
|
8789
|
+
return this;
|
|
8781
8790
|
|
|
8782
|
-
|
|
8783
|
-
if ( this.alphaHash === true ) data.alphaHash = true;
|
|
8784
|
-
if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
|
|
8785
|
-
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
|
|
8786
|
-
if ( this.forceSinglePass === true ) data.forceSinglePass = true;
|
|
8791
|
+
}
|
|
8787
8792
|
|
|
8788
|
-
|
|
8789
|
-
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
8790
|
-
if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
|
|
8791
|
-
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
|
|
8793
|
+
convertLinearToSRGB() {
|
|
8792
8794
|
|
|
8793
|
-
|
|
8795
|
+
this.copyLinearToSRGB( this );
|
|
8794
8796
|
|
|
8795
|
-
|
|
8797
|
+
return this;
|
|
8796
8798
|
|
|
8797
|
-
|
|
8799
|
+
}
|
|
8798
8800
|
|
|
8799
|
-
|
|
8801
|
+
getHex( colorSpace = SRGBColorSpace ) {
|
|
8800
8802
|
|
|
8801
|
-
|
|
8803
|
+
ColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );
|
|
8802
8804
|
|
|
8803
|
-
|
|
8805
|
+
return Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );
|
|
8804
8806
|
|
|
8805
|
-
|
|
8807
|
+
}
|
|
8806
8808
|
|
|
8807
|
-
|
|
8809
|
+
getHexString( colorSpace = SRGBColorSpace ) {
|
|
8808
8810
|
|
|
8809
|
-
|
|
8811
|
+
return ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );
|
|
8810
8812
|
|
|
8811
|
-
|
|
8812
|
-
delete data.metadata;
|
|
8813
|
-
values.push( data );
|
|
8813
|
+
}
|
|
8814
8814
|
|
|
8815
|
-
|
|
8815
|
+
getHSL( target, colorSpace = ColorManagement.workingColorSpace ) {
|
|
8816
8816
|
|
|
8817
|
-
|
|
8817
|
+
// h,s,l ranges are in 0.0 - 1.0
|
|
8818
8818
|
|
|
8819
|
-
|
|
8819
|
+
ColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );
|
|
8820
8820
|
|
|
8821
|
-
|
|
8821
|
+
const r = _color.r, g = _color.g, b = _color.b;
|
|
8822
8822
|
|
|
8823
|
-
|
|
8824
|
-
|
|
8823
|
+
const max = Math.max( r, g, b );
|
|
8824
|
+
const min = Math.min( r, g, b );
|
|
8825
8825
|
|
|
8826
|
-
|
|
8827
|
-
|
|
8826
|
+
let hue, saturation;
|
|
8827
|
+
const lightness = ( min + max ) / 2.0;
|
|
8828
8828
|
|
|
8829
|
-
|
|
8829
|
+
if ( min === max ) {
|
|
8830
8830
|
|
|
8831
|
-
|
|
8831
|
+
hue = 0;
|
|
8832
|
+
saturation = 0;
|
|
8832
8833
|
|
|
8833
|
-
|
|
8834
|
+
} else {
|
|
8834
8835
|
|
|
8835
|
-
|
|
8836
|
+
const delta = max - min;
|
|
8836
8837
|
|
|
8837
|
-
|
|
8838
|
+
saturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );
|
|
8838
8839
|
|
|
8839
|
-
|
|
8840
|
+
switch ( max ) {
|
|
8840
8841
|
|
|
8841
|
-
|
|
8842
|
+
case r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;
|
|
8843
|
+
case g: hue = ( b - r ) / delta + 2; break;
|
|
8844
|
+
case b: hue = ( r - g ) / delta + 4; break;
|
|
8842
8845
|
|
|
8843
|
-
|
|
8846
|
+
}
|
|
8844
8847
|
|
|
8845
|
-
|
|
8846
|
-
this.side = source.side;
|
|
8847
|
-
this.vertexColors = source.vertexColors;
|
|
8848
|
+
hue /= 6;
|
|
8848
8849
|
|
|
8849
|
-
|
|
8850
|
-
this.transparent = source.transparent;
|
|
8850
|
+
}
|
|
8851
8851
|
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
this.blendSrcAlpha = source.blendSrcAlpha;
|
|
8856
|
-
this.blendDstAlpha = source.blendDstAlpha;
|
|
8857
|
-
this.blendEquationAlpha = source.blendEquationAlpha;
|
|
8852
|
+
target.h = hue;
|
|
8853
|
+
target.s = saturation;
|
|
8854
|
+
target.l = lightness;
|
|
8858
8855
|
|
|
8859
|
-
|
|
8860
|
-
this.depthTest = source.depthTest;
|
|
8861
|
-
this.depthWrite = source.depthWrite;
|
|
8856
|
+
return target;
|
|
8862
8857
|
|
|
8863
|
-
|
|
8864
|
-
this.stencilFunc = source.stencilFunc;
|
|
8865
|
-
this.stencilRef = source.stencilRef;
|
|
8866
|
-
this.stencilFuncMask = source.stencilFuncMask;
|
|
8867
|
-
this.stencilFail = source.stencilFail;
|
|
8868
|
-
this.stencilZFail = source.stencilZFail;
|
|
8869
|
-
this.stencilZPass = source.stencilZPass;
|
|
8870
|
-
this.stencilWrite = source.stencilWrite;
|
|
8858
|
+
}
|
|
8871
8859
|
|
|
8872
|
-
|
|
8873
|
-
let dstPlanes = null;
|
|
8860
|
+
getRGB( target, colorSpace = ColorManagement.workingColorSpace ) {
|
|
8874
8861
|
|
|
8875
|
-
|
|
8862
|
+
ColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );
|
|
8876
8863
|
|
|
8877
|
-
|
|
8878
|
-
|
|
8864
|
+
target.r = _color.r;
|
|
8865
|
+
target.g = _color.g;
|
|
8866
|
+
target.b = _color.b;
|
|
8879
8867
|
|
|
8880
|
-
|
|
8868
|
+
return target;
|
|
8881
8869
|
|
|
8882
|
-
|
|
8870
|
+
}
|
|
8883
8871
|
|
|
8884
|
-
|
|
8872
|
+
getStyle( colorSpace = SRGBColorSpace ) {
|
|
8885
8873
|
|
|
8886
|
-
|
|
8874
|
+
ColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );
|
|
8887
8875
|
|
|
8888
|
-
|
|
8889
|
-
this.clipIntersection = source.clipIntersection;
|
|
8890
|
-
this.clipShadows = source.clipShadows;
|
|
8876
|
+
const r = _color.r, g = _color.g, b = _color.b;
|
|
8891
8877
|
|
|
8892
|
-
|
|
8878
|
+
if ( colorSpace !== SRGBColorSpace ) {
|
|
8893
8879
|
|
|
8894
|
-
|
|
8880
|
+
// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
|
|
8881
|
+
return `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;
|
|
8895
8882
|
|
|
8896
|
-
|
|
8883
|
+
}
|
|
8897
8884
|
|
|
8898
|
-
|
|
8899
|
-
this.polygonOffsetFactor = source.polygonOffsetFactor;
|
|
8900
|
-
this.polygonOffsetUnits = source.polygonOffsetUnits;
|
|
8885
|
+
return `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;
|
|
8901
8886
|
|
|
8902
|
-
|
|
8887
|
+
}
|
|
8903
8888
|
|
|
8904
|
-
|
|
8905
|
-
this.alphaHash = source.alphaHash;
|
|
8906
|
-
this.alphaToCoverage = source.alphaToCoverage;
|
|
8907
|
-
this.premultipliedAlpha = source.premultipliedAlpha;
|
|
8908
|
-
this.forceSinglePass = source.forceSinglePass;
|
|
8889
|
+
offsetHSL( h, s, l ) {
|
|
8909
8890
|
|
|
8910
|
-
this.
|
|
8891
|
+
this.getHSL( _hslA );
|
|
8911
8892
|
|
|
8912
|
-
this.
|
|
8893
|
+
return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
|
|
8913
8894
|
|
|
8914
|
-
|
|
8895
|
+
}
|
|
8896
|
+
|
|
8897
|
+
add( color ) {
|
|
8898
|
+
|
|
8899
|
+
this.r += color.r;
|
|
8900
|
+
this.g += color.g;
|
|
8901
|
+
this.b += color.b;
|
|
8915
8902
|
|
|
8916
8903
|
return this;
|
|
8917
8904
|
|
|
8918
8905
|
}
|
|
8919
8906
|
|
|
8920
|
-
|
|
8907
|
+
addColors( color1, color2 ) {
|
|
8921
8908
|
|
|
8922
|
-
this.
|
|
8909
|
+
this.r = color1.r + color2.r;
|
|
8910
|
+
this.g = color1.g + color2.g;
|
|
8911
|
+
this.b = color1.b + color2.b;
|
|
8912
|
+
|
|
8913
|
+
return this;
|
|
8923
8914
|
|
|
8924
8915
|
}
|
|
8925
8916
|
|
|
8926
|
-
|
|
8917
|
+
addScalar( s ) {
|
|
8927
8918
|
|
|
8928
|
-
|
|
8919
|
+
this.r += s;
|
|
8920
|
+
this.g += s;
|
|
8921
|
+
this.b += s;
|
|
8922
|
+
|
|
8923
|
+
return this;
|
|
8929
8924
|
|
|
8930
8925
|
}
|
|
8931
8926
|
|
|
8932
|
-
|
|
8927
|
+
sub( color ) {
|
|
8933
8928
|
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,
|
|
8938
|
-
'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,
|
|
8939
|
-
'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,
|
|
8940
|
-
'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,
|
|
8941
|
-
'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,
|
|
8942
|
-
'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,
|
|
8943
|
-
'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,
|
|
8944
|
-
'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,
|
|
8945
|
-
'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,
|
|
8946
|
-
'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,
|
|
8947
|
-
'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,
|
|
8948
|
-
'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,
|
|
8949
|
-
'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,
|
|
8950
|
-
'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,
|
|
8951
|
-
'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,
|
|
8952
|
-
'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,
|
|
8953
|
-
'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,
|
|
8954
|
-
'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,
|
|
8955
|
-
'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,
|
|
8956
|
-
'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,
|
|
8957
|
-
'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };
|
|
8929
|
+
this.r = Math.max( 0, this.r - color.r );
|
|
8930
|
+
this.g = Math.max( 0, this.g - color.g );
|
|
8931
|
+
this.b = Math.max( 0, this.b - color.b );
|
|
8958
8932
|
|
|
8959
|
-
|
|
8960
|
-
const _hslB = { h: 0, s: 0, l: 0 };
|
|
8933
|
+
return this;
|
|
8961
8934
|
|
|
8962
|
-
|
|
8935
|
+
}
|
|
8963
8936
|
|
|
8964
|
-
|
|
8965
|
-
if ( t > 1 ) t -= 1;
|
|
8966
|
-
if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
|
|
8967
|
-
if ( t < 1 / 2 ) return q;
|
|
8968
|
-
if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
|
|
8969
|
-
return p;
|
|
8937
|
+
multiply( color ) {
|
|
8970
8938
|
|
|
8971
|
-
|
|
8939
|
+
this.r *= color.r;
|
|
8940
|
+
this.g *= color.g;
|
|
8941
|
+
this.b *= color.b;
|
|
8972
8942
|
|
|
8973
|
-
|
|
8943
|
+
return this;
|
|
8974
8944
|
|
|
8975
|
-
|
|
8945
|
+
}
|
|
8976
8946
|
|
|
8977
|
-
|
|
8947
|
+
multiplyScalar( s ) {
|
|
8978
8948
|
|
|
8979
|
-
this.r
|
|
8980
|
-
this.g
|
|
8981
|
-
this.b
|
|
8949
|
+
this.r *= s;
|
|
8950
|
+
this.g *= s;
|
|
8951
|
+
this.b *= s;
|
|
8982
8952
|
|
|
8983
|
-
return this
|
|
8953
|
+
return this;
|
|
8984
8954
|
|
|
8985
8955
|
}
|
|
8986
8956
|
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
if ( g === undefined && b === undefined ) {
|
|
8990
|
-
|
|
8991
|
-
// r is THREE.Color, hex or string
|
|
8957
|
+
lerp( color, alpha ) {
|
|
8992
8958
|
|
|
8993
|
-
|
|
8959
|
+
this.r += ( color.r - this.r ) * alpha;
|
|
8960
|
+
this.g += ( color.g - this.g ) * alpha;
|
|
8961
|
+
this.b += ( color.b - this.b ) * alpha;
|
|
8994
8962
|
|
|
8995
|
-
|
|
8963
|
+
return this;
|
|
8996
8964
|
|
|
8997
|
-
|
|
8965
|
+
}
|
|
8998
8966
|
|
|
8999
|
-
|
|
8967
|
+
lerpColors( color1, color2, alpha ) {
|
|
9000
8968
|
|
|
9001
|
-
|
|
8969
|
+
this.r = color1.r + ( color2.r - color1.r ) * alpha;
|
|
8970
|
+
this.g = color1.g + ( color2.g - color1.g ) * alpha;
|
|
8971
|
+
this.b = color1.b + ( color2.b - color1.b ) * alpha;
|
|
9002
8972
|
|
|
9003
|
-
|
|
8973
|
+
return this;
|
|
9004
8974
|
|
|
9005
|
-
|
|
8975
|
+
}
|
|
9006
8976
|
|
|
9007
|
-
|
|
8977
|
+
lerpHSL( color, alpha ) {
|
|
9008
8978
|
|
|
9009
|
-
|
|
8979
|
+
this.getHSL( _hslA );
|
|
8980
|
+
color.getHSL( _hslB );
|
|
9010
8981
|
|
|
9011
|
-
|
|
8982
|
+
const h = lerp( _hslA.h, _hslB.h, alpha );
|
|
8983
|
+
const s = lerp( _hslA.s, _hslB.s, alpha );
|
|
8984
|
+
const l = lerp( _hslA.l, _hslB.l, alpha );
|
|
9012
8985
|
|
|
9013
|
-
|
|
8986
|
+
this.setHSL( h, s, l );
|
|
9014
8987
|
|
|
9015
8988
|
return this;
|
|
9016
8989
|
|
|
9017
8990
|
}
|
|
9018
8991
|
|
|
9019
|
-
|
|
8992
|
+
setFromVector3( v ) {
|
|
9020
8993
|
|
|
9021
|
-
this.r =
|
|
9022
|
-
this.g =
|
|
9023
|
-
this.b =
|
|
8994
|
+
this.r = v.x;
|
|
8995
|
+
this.g = v.y;
|
|
8996
|
+
this.b = v.z;
|
|
9024
8997
|
|
|
9025
8998
|
return this;
|
|
9026
8999
|
|
|
9027
9000
|
}
|
|
9028
9001
|
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
hex = Math.floor( hex );
|
|
9002
|
+
applyMatrix3( m ) {
|
|
9032
9003
|
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
this.b = ( hex & 255 ) / 255;
|
|
9004
|
+
const r = this.r, g = this.g, b = this.b;
|
|
9005
|
+
const e = m.elements;
|
|
9036
9006
|
|
|
9037
|
-
|
|
9007
|
+
this.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;
|
|
9008
|
+
this.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;
|
|
9009
|
+
this.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;
|
|
9038
9010
|
|
|
9039
9011
|
return this;
|
|
9040
9012
|
|
|
9041
9013
|
}
|
|
9042
9014
|
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
this.r = r;
|
|
9046
|
-
this.g = g;
|
|
9047
|
-
this.b = b;
|
|
9048
|
-
|
|
9049
|
-
ColorManagement.toWorkingColorSpace( this, colorSpace );
|
|
9015
|
+
equals( c ) {
|
|
9050
9016
|
|
|
9051
|
-
return this;
|
|
9017
|
+
return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );
|
|
9052
9018
|
|
|
9053
9019
|
}
|
|
9054
9020
|
|
|
9055
|
-
|
|
9021
|
+
fromArray( array, offset = 0 ) {
|
|
9056
9022
|
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
l = clamp( l, 0, 1 );
|
|
9023
|
+
this.r = array[ offset ];
|
|
9024
|
+
this.g = array[ offset + 1 ];
|
|
9025
|
+
this.b = array[ offset + 2 ];
|
|
9061
9026
|
|
|
9062
|
-
|
|
9027
|
+
return this;
|
|
9063
9028
|
|
|
9064
|
-
|
|
9029
|
+
}
|
|
9065
9030
|
|
|
9066
|
-
|
|
9031
|
+
toArray( array = [], offset = 0 ) {
|
|
9067
9032
|
|
|
9068
|
-
|
|
9069
|
-
|
|
9033
|
+
array[ offset ] = this.r;
|
|
9034
|
+
array[ offset + 1 ] = this.g;
|
|
9035
|
+
array[ offset + 2 ] = this.b;
|
|
9070
9036
|
|
|
9071
|
-
|
|
9072
|
-
this.g = hue2rgb( q, p, h );
|
|
9073
|
-
this.b = hue2rgb( q, p, h - 1 / 3 );
|
|
9037
|
+
return array;
|
|
9074
9038
|
|
|
9075
|
-
|
|
9039
|
+
}
|
|
9076
9040
|
|
|
9077
|
-
|
|
9041
|
+
fromBufferAttribute( attribute, index ) {
|
|
9042
|
+
|
|
9043
|
+
this.r = attribute.getX( index );
|
|
9044
|
+
this.g = attribute.getY( index );
|
|
9045
|
+
this.b = attribute.getZ( index );
|
|
9078
9046
|
|
|
9079
9047
|
return this;
|
|
9080
9048
|
|
|
9081
9049
|
}
|
|
9082
9050
|
|
|
9083
|
-
|
|
9051
|
+
toJSON() {
|
|
9084
9052
|
|
|
9085
|
-
|
|
9053
|
+
return this.getHex();
|
|
9086
9054
|
|
|
9087
|
-
|
|
9055
|
+
}
|
|
9088
9056
|
|
|
9089
|
-
|
|
9057
|
+
*[ Symbol.iterator ]() {
|
|
9090
9058
|
|
|
9091
|
-
|
|
9059
|
+
yield this.r;
|
|
9060
|
+
yield this.g;
|
|
9061
|
+
yield this.b;
|
|
9092
9062
|
|
|
9093
|
-
|
|
9063
|
+
}
|
|
9094
9064
|
|
|
9095
|
-
|
|
9065
|
+
}
|
|
9096
9066
|
|
|
9067
|
+
const _color = /*@__PURE__*/ new Color();
|
|
9097
9068
|
|
|
9098
|
-
|
|
9069
|
+
Color.NAMES = _colorKeywords;
|
|
9099
9070
|
|
|
9100
|
-
|
|
9071
|
+
let _materialId = 0;
|
|
9101
9072
|
|
|
9102
|
-
|
|
9073
|
+
class Material extends EventDispatcher {
|
|
9103
9074
|
|
|
9104
|
-
|
|
9105
|
-
const name = m[ 1 ];
|
|
9106
|
-
const components = m[ 2 ];
|
|
9075
|
+
constructor() {
|
|
9107
9076
|
|
|
9108
|
-
|
|
9077
|
+
super();
|
|
9109
9078
|
|
|
9110
|
-
|
|
9111
|
-
case 'rgba':
|
|
9079
|
+
this.isMaterial = true;
|
|
9112
9080
|
|
|
9113
|
-
|
|
9081
|
+
Object.defineProperty( this, 'id', { value: _materialId ++ } );
|
|
9114
9082
|
|
|
9115
|
-
|
|
9083
|
+
this.uuid = generateUUID();
|
|
9116
9084
|
|
|
9117
|
-
|
|
9085
|
+
this.name = '';
|
|
9086
|
+
this.type = 'Material';
|
|
9118
9087
|
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,
|
|
9123
|
-
colorSpace
|
|
9124
|
-
);
|
|
9088
|
+
this.blending = NormalBlending;
|
|
9089
|
+
this.side = FrontSide;
|
|
9090
|
+
this.vertexColors = false;
|
|
9125
9091
|
|
|
9126
|
-
|
|
9092
|
+
this.opacity = 1;
|
|
9093
|
+
this.transparent = false;
|
|
9094
|
+
this.alphaHash = false;
|
|
9127
9095
|
|
|
9128
|
-
|
|
9096
|
+
this.blendSrc = SrcAlphaFactor;
|
|
9097
|
+
this.blendDst = OneMinusSrcAlphaFactor;
|
|
9098
|
+
this.blendEquation = AddEquation;
|
|
9099
|
+
this.blendSrcAlpha = null;
|
|
9100
|
+
this.blendDstAlpha = null;
|
|
9101
|
+
this.blendEquationAlpha = null;
|
|
9102
|
+
this.blendColor = new Color( 0, 0, 0 );
|
|
9103
|
+
this.blendAlpha = 0;
|
|
9129
9104
|
|
|
9130
|
-
|
|
9105
|
+
this.depthFunc = LessEqualDepth;
|
|
9106
|
+
this.depthTest = true;
|
|
9107
|
+
this.depthWrite = true;
|
|
9131
9108
|
|
|
9132
|
-
|
|
9109
|
+
this.stencilWriteMask = 0xff;
|
|
9110
|
+
this.stencilFunc = AlwaysStencilFunc;
|
|
9111
|
+
this.stencilRef = 0;
|
|
9112
|
+
this.stencilFuncMask = 0xff;
|
|
9113
|
+
this.stencilFail = KeepStencilOp;
|
|
9114
|
+
this.stencilZFail = KeepStencilOp;
|
|
9115
|
+
this.stencilZPass = KeepStencilOp;
|
|
9116
|
+
this.stencilWrite = false;
|
|
9133
9117
|
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,
|
|
9138
|
-
colorSpace
|
|
9139
|
-
);
|
|
9118
|
+
this.clippingPlanes = null;
|
|
9119
|
+
this.clipIntersection = false;
|
|
9120
|
+
this.clipShadows = false;
|
|
9140
9121
|
|
|
9141
|
-
|
|
9122
|
+
this.shadowSide = null;
|
|
9142
9123
|
|
|
9143
|
-
|
|
9124
|
+
this.colorWrite = true;
|
|
9144
9125
|
|
|
9145
|
-
|
|
9146
|
-
case 'hsla':
|
|
9126
|
+
this.precision = null; // override the renderer's default precision for this material
|
|
9147
9127
|
|
|
9148
|
-
|
|
9128
|
+
this.polygonOffset = false;
|
|
9129
|
+
this.polygonOffsetFactor = 0;
|
|
9130
|
+
this.polygonOffsetUnits = 0;
|
|
9149
9131
|
|
|
9150
|
-
|
|
9132
|
+
this.dithering = false;
|
|
9151
9133
|
|
|
9152
|
-
|
|
9134
|
+
this.alphaToCoverage = false;
|
|
9135
|
+
this.premultipliedAlpha = false;
|
|
9136
|
+
this.forceSinglePass = false;
|
|
9153
9137
|
|
|
9154
|
-
|
|
9155
|
-
parseFloat( color[ 1 ] ) / 360,
|
|
9156
|
-
parseFloat( color[ 2 ] ) / 100,
|
|
9157
|
-
parseFloat( color[ 3 ] ) / 100,
|
|
9158
|
-
colorSpace
|
|
9159
|
-
);
|
|
9138
|
+
this.visible = true;
|
|
9160
9139
|
|
|
9161
|
-
|
|
9140
|
+
this.toneMapped = true;
|
|
9162
9141
|
|
|
9163
|
-
|
|
9142
|
+
this.userData = {};
|
|
9164
9143
|
|
|
9165
|
-
|
|
9144
|
+
this.version = 0;
|
|
9166
9145
|
|
|
9167
|
-
|
|
9146
|
+
this._alphaTest = 0;
|
|
9168
9147
|
|
|
9169
|
-
|
|
9148
|
+
}
|
|
9170
9149
|
|
|
9171
|
-
|
|
9150
|
+
get alphaTest() {
|
|
9172
9151
|
|
|
9173
|
-
|
|
9152
|
+
return this._alphaTest;
|
|
9174
9153
|
|
|
9175
|
-
|
|
9176
|
-
const size = hex.length;
|
|
9154
|
+
}
|
|
9177
9155
|
|
|
9178
|
-
|
|
9156
|
+
set alphaTest( value ) {
|
|
9179
9157
|
|
|
9180
|
-
|
|
9181
|
-
return this.setRGB(
|
|
9182
|
-
parseInt( hex.charAt( 0 ), 16 ) / 15,
|
|
9183
|
-
parseInt( hex.charAt( 1 ), 16 ) / 15,
|
|
9184
|
-
parseInt( hex.charAt( 2 ), 16 ) / 15,
|
|
9185
|
-
colorSpace
|
|
9186
|
-
);
|
|
9158
|
+
if ( this._alphaTest > 0 !== value > 0 ) {
|
|
9187
9159
|
|
|
9188
|
-
|
|
9160
|
+
this.version ++;
|
|
9189
9161
|
|
|
9190
|
-
|
|
9191
|
-
return this.setHex( parseInt( hex, 16 ), colorSpace );
|
|
9162
|
+
}
|
|
9192
9163
|
|
|
9193
|
-
|
|
9164
|
+
this._alphaTest = value;
|
|
9194
9165
|
|
|
9195
|
-
|
|
9166
|
+
}
|
|
9196
9167
|
|
|
9197
|
-
|
|
9168
|
+
onBuild( /* shaderobject, renderer */ ) {}
|
|
9198
9169
|
|
|
9199
|
-
|
|
9170
|
+
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
9200
9171
|
|
|
9201
|
-
|
|
9172
|
+
onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
9202
9173
|
|
|
9203
|
-
|
|
9174
|
+
customProgramCacheKey() {
|
|
9204
9175
|
|
|
9205
|
-
return this;
|
|
9176
|
+
return this.onBeforeCompile.toString();
|
|
9206
9177
|
|
|
9207
9178
|
}
|
|
9208
9179
|
|
|
9209
|
-
|
|
9180
|
+
setValues( values ) {
|
|
9210
9181
|
|
|
9211
|
-
|
|
9212
|
-
const hex = _colorKeywords[ style.toLowerCase() ];
|
|
9182
|
+
if ( values === undefined ) return;
|
|
9213
9183
|
|
|
9214
|
-
|
|
9184
|
+
for ( const key in values ) {
|
|
9215
9185
|
|
|
9216
|
-
|
|
9217
|
-
this.setHex( hex, colorSpace );
|
|
9186
|
+
const newValue = values[ key ];
|
|
9218
9187
|
|
|
9219
|
-
|
|
9188
|
+
if ( newValue === undefined ) {
|
|
9220
9189
|
|
|
9221
|
-
|
|
9222
|
-
|
|
9190
|
+
console.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );
|
|
9191
|
+
continue;
|
|
9223
9192
|
|
|
9224
|
-
|
|
9193
|
+
}
|
|
9225
9194
|
|
|
9226
|
-
|
|
9195
|
+
const currentValue = this[ key ];
|
|
9227
9196
|
|
|
9228
|
-
|
|
9197
|
+
if ( currentValue === undefined ) {
|
|
9229
9198
|
|
|
9230
|
-
|
|
9199
|
+
console.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );
|
|
9200
|
+
continue;
|
|
9231
9201
|
|
|
9232
|
-
|
|
9202
|
+
}
|
|
9233
9203
|
|
|
9234
|
-
|
|
9204
|
+
if ( currentValue && currentValue.isColor ) {
|
|
9235
9205
|
|
|
9236
|
-
|
|
9206
|
+
currentValue.set( newValue );
|
|
9237
9207
|
|
|
9238
|
-
|
|
9239
|
-
this.g = color.g;
|
|
9240
|
-
this.b = color.b;
|
|
9208
|
+
} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {
|
|
9241
9209
|
|
|
9242
|
-
|
|
9210
|
+
currentValue.copy( newValue );
|
|
9243
9211
|
|
|
9244
|
-
|
|
9212
|
+
} else {
|
|
9245
9213
|
|
|
9246
|
-
|
|
9214
|
+
this[ key ] = newValue;
|
|
9247
9215
|
|
|
9248
|
-
|
|
9249
|
-
this.g = SRGBToLinear( color.g );
|
|
9250
|
-
this.b = SRGBToLinear( color.b );
|
|
9216
|
+
}
|
|
9251
9217
|
|
|
9252
|
-
|
|
9218
|
+
}
|
|
9253
9219
|
|
|
9254
9220
|
}
|
|
9255
9221
|
|
|
9256
|
-
|
|
9222
|
+
toJSON( meta ) {
|
|
9257
9223
|
|
|
9258
|
-
|
|
9259
|
-
this.g = LinearToSRGB( color.g );
|
|
9260
|
-
this.b = LinearToSRGB( color.b );
|
|
9224
|
+
const isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
9261
9225
|
|
|
9262
|
-
|
|
9226
|
+
if ( isRootObject ) {
|
|
9263
9227
|
|
|
9264
|
-
|
|
9228
|
+
meta = {
|
|
9229
|
+
textures: {},
|
|
9230
|
+
images: {}
|
|
9231
|
+
};
|
|
9265
9232
|
|
|
9266
|
-
|
|
9233
|
+
}
|
|
9267
9234
|
|
|
9268
|
-
|
|
9235
|
+
const data = {
|
|
9236
|
+
metadata: {
|
|
9237
|
+
version: 4.6,
|
|
9238
|
+
type: 'Material',
|
|
9239
|
+
generator: 'Material.toJSON'
|
|
9240
|
+
}
|
|
9241
|
+
};
|
|
9269
9242
|
|
|
9270
|
-
|
|
9243
|
+
// standard Material serialization
|
|
9244
|
+
data.uuid = this.uuid;
|
|
9245
|
+
data.type = this.type;
|
|
9271
9246
|
|
|
9272
|
-
|
|
9247
|
+
if ( this.name !== '' ) data.name = this.name;
|
|
9273
9248
|
|
|
9274
|
-
|
|
9249
|
+
if ( this.color && this.color.isColor ) data.color = this.color.getHex();
|
|
9275
9250
|
|
|
9276
|
-
|
|
9251
|
+
if ( this.roughness !== undefined ) data.roughness = this.roughness;
|
|
9252
|
+
if ( this.metalness !== undefined ) data.metalness = this.metalness;
|
|
9277
9253
|
|
|
9278
|
-
|
|
9254
|
+
if ( this.sheen !== undefined ) data.sheen = this.sheen;
|
|
9255
|
+
if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
|
|
9256
|
+
if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
|
|
9257
|
+
if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
|
|
9258
|
+
if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
|
|
9279
9259
|
|
|
9280
|
-
|
|
9260
|
+
if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
|
|
9261
|
+
if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
|
|
9262
|
+
if ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();
|
|
9263
|
+
if ( this.shininess !== undefined ) data.shininess = this.shininess;
|
|
9264
|
+
if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;
|
|
9265
|
+
if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;
|
|
9281
9266
|
|
|
9282
|
-
|
|
9267
|
+
if ( this.clearcoatMap && this.clearcoatMap.isTexture ) {
|
|
9283
9268
|
|
|
9284
|
-
|
|
9269
|
+
data.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;
|
|
9285
9270
|
|
|
9286
|
-
|
|
9271
|
+
}
|
|
9287
9272
|
|
|
9288
|
-
|
|
9273
|
+
if ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {
|
|
9289
9274
|
|
|
9290
|
-
|
|
9275
|
+
data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;
|
|
9291
9276
|
|
|
9292
|
-
|
|
9277
|
+
}
|
|
9293
9278
|
|
|
9294
|
-
|
|
9279
|
+
if ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {
|
|
9295
9280
|
|
|
9296
|
-
|
|
9281
|
+
data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;
|
|
9282
|
+
data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();
|
|
9297
9283
|
|
|
9298
|
-
|
|
9284
|
+
}
|
|
9299
9285
|
|
|
9300
|
-
|
|
9286
|
+
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
9287
|
+
if ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;
|
|
9288
|
+
if ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;
|
|
9301
9289
|
|
|
9302
|
-
|
|
9290
|
+
if ( this.iridescenceMap && this.iridescenceMap.isTexture ) {
|
|
9303
9291
|
|
|
9304
|
-
|
|
9305
|
-
const min = Math.min( r, g, b );
|
|
9292
|
+
data.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;
|
|
9306
9293
|
|
|
9307
|
-
|
|
9308
|
-
const lightness = ( min + max ) / 2.0;
|
|
9294
|
+
}
|
|
9309
9295
|
|
|
9310
|
-
if (
|
|
9296
|
+
if ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {
|
|
9311
9297
|
|
|
9312
|
-
|
|
9313
|
-
saturation = 0;
|
|
9298
|
+
data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;
|
|
9314
9299
|
|
|
9315
|
-
}
|
|
9300
|
+
}
|
|
9316
9301
|
|
|
9317
|
-
|
|
9302
|
+
if ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;
|
|
9303
|
+
if ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;
|
|
9318
9304
|
|
|
9319
|
-
|
|
9305
|
+
if ( this.anisotropyMap && this.anisotropyMap.isTexture ) {
|
|
9320
9306
|
|
|
9321
|
-
|
|
9307
|
+
data.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;
|
|
9322
9308
|
|
|
9323
|
-
|
|
9324
|
-
case g: hue = ( b - r ) / delta + 2; break;
|
|
9325
|
-
case b: hue = ( r - g ) / delta + 4; break;
|
|
9309
|
+
}
|
|
9326
9310
|
|
|
9327
|
-
|
|
9311
|
+
if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;
|
|
9312
|
+
if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;
|
|
9313
|
+
if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
|
|
9328
9314
|
|
|
9329
|
-
|
|
9315
|
+
if ( this.lightMap && this.lightMap.isTexture ) {
|
|
9316
|
+
|
|
9317
|
+
data.lightMap = this.lightMap.toJSON( meta ).uuid;
|
|
9318
|
+
data.lightMapIntensity = this.lightMapIntensity;
|
|
9330
9319
|
|
|
9331
9320
|
}
|
|
9332
9321
|
|
|
9333
|
-
|
|
9334
|
-
target.s = saturation;
|
|
9335
|
-
target.l = lightness;
|
|
9322
|
+
if ( this.aoMap && this.aoMap.isTexture ) {
|
|
9336
9323
|
|
|
9337
|
-
|
|
9324
|
+
data.aoMap = this.aoMap.toJSON( meta ).uuid;
|
|
9325
|
+
data.aoMapIntensity = this.aoMapIntensity;
|
|
9338
9326
|
|
|
9339
|
-
|
|
9327
|
+
}
|
|
9340
9328
|
|
|
9341
|
-
|
|
9329
|
+
if ( this.bumpMap && this.bumpMap.isTexture ) {
|
|
9342
9330
|
|
|
9343
|
-
|
|
9331
|
+
data.bumpMap = this.bumpMap.toJSON( meta ).uuid;
|
|
9332
|
+
data.bumpScale = this.bumpScale;
|
|
9344
9333
|
|
|
9345
|
-
|
|
9346
|
-
target.g = _color.g;
|
|
9347
|
-
target.b = _color.b;
|
|
9334
|
+
}
|
|
9348
9335
|
|
|
9349
|
-
|
|
9336
|
+
if ( this.normalMap && this.normalMap.isTexture ) {
|
|
9350
9337
|
|
|
9351
|
-
|
|
9338
|
+
data.normalMap = this.normalMap.toJSON( meta ).uuid;
|
|
9339
|
+
data.normalMapType = this.normalMapType;
|
|
9340
|
+
data.normalScale = this.normalScale.toArray();
|
|
9352
9341
|
|
|
9353
|
-
|
|
9342
|
+
}
|
|
9354
9343
|
|
|
9355
|
-
|
|
9344
|
+
if ( this.displacementMap && this.displacementMap.isTexture ) {
|
|
9356
9345
|
|
|
9357
|
-
|
|
9346
|
+
data.displacementMap = this.displacementMap.toJSON( meta ).uuid;
|
|
9347
|
+
data.displacementScale = this.displacementScale;
|
|
9348
|
+
data.displacementBias = this.displacementBias;
|
|
9358
9349
|
|
|
9359
|
-
|
|
9350
|
+
}
|
|
9360
9351
|
|
|
9361
|
-
|
|
9362
|
-
|
|
9352
|
+
if ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;
|
|
9353
|
+
if ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;
|
|
9363
9354
|
|
|
9364
|
-
|
|
9355
|
+
if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;
|
|
9356
|
+
if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
|
|
9357
|
+
if ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;
|
|
9358
|
+
if ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;
|
|
9365
9359
|
|
|
9366
|
-
|
|
9360
|
+
if ( this.envMap && this.envMap.isTexture ) {
|
|
9367
9361
|
|
|
9368
|
-
|
|
9362
|
+
data.envMap = this.envMap.toJSON( meta ).uuid;
|
|
9369
9363
|
|
|
9370
|
-
|
|
9364
|
+
if ( this.combine !== undefined ) data.combine = this.combine;
|
|
9371
9365
|
|
|
9372
|
-
|
|
9366
|
+
}
|
|
9373
9367
|
|
|
9374
|
-
|
|
9368
|
+
if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
|
|
9369
|
+
if ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;
|
|
9370
|
+
if ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;
|
|
9375
9371
|
|
|
9376
|
-
|
|
9372
|
+
if ( this.gradientMap && this.gradientMap.isTexture ) {
|
|
9377
9373
|
|
|
9378
|
-
|
|
9374
|
+
data.gradientMap = this.gradientMap.toJSON( meta ).uuid;
|
|
9379
9375
|
|
|
9380
|
-
|
|
9381
|
-
this.g += color.g;
|
|
9382
|
-
this.b += color.b;
|
|
9376
|
+
}
|
|
9383
9377
|
|
|
9384
|
-
|
|
9378
|
+
if ( this.transmission !== undefined ) data.transmission = this.transmission;
|
|
9379
|
+
if ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;
|
|
9380
|
+
if ( this.thickness !== undefined ) data.thickness = this.thickness;
|
|
9381
|
+
if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
|
|
9382
|
+
if ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;
|
|
9383
|
+
if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();
|
|
9385
9384
|
|
|
9386
|
-
|
|
9385
|
+
if ( this.size !== undefined ) data.size = this.size;
|
|
9386
|
+
if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
|
|
9387
|
+
if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;
|
|
9387
9388
|
|
|
9388
|
-
|
|
9389
|
+
if ( this.blending !== NormalBlending ) data.blending = this.blending;
|
|
9390
|
+
if ( this.side !== FrontSide ) data.side = this.side;
|
|
9391
|
+
if ( this.vertexColors === true ) data.vertexColors = true;
|
|
9389
9392
|
|
|
9390
|
-
this.
|
|
9391
|
-
this.
|
|
9392
|
-
this.b = color1.b + color2.b;
|
|
9393
|
+
if ( this.opacity < 1 ) data.opacity = this.opacity;
|
|
9394
|
+
if ( this.transparent === true ) data.transparent = true;
|
|
9393
9395
|
|
|
9394
|
-
|
|
9396
|
+
if ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;
|
|
9397
|
+
if ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;
|
|
9398
|
+
if ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;
|
|
9399
|
+
if ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;
|
|
9400
|
+
if ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;
|
|
9401
|
+
if ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;
|
|
9402
|
+
if ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();
|
|
9403
|
+
if ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;
|
|
9404
|
+
|
|
9405
|
+
if ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;
|
|
9406
|
+
if ( this.depthTest === false ) data.depthTest = this.depthTest;
|
|
9407
|
+
if ( this.depthWrite === false ) data.depthWrite = this.depthWrite;
|
|
9408
|
+
if ( this.colorWrite === false ) data.colorWrite = this.colorWrite;
|
|
9409
|
+
|
|
9410
|
+
if ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;
|
|
9411
|
+
if ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;
|
|
9412
|
+
if ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;
|
|
9413
|
+
if ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;
|
|
9414
|
+
if ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;
|
|
9415
|
+
if ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;
|
|
9416
|
+
if ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;
|
|
9417
|
+
if ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;
|
|
9395
9418
|
|
|
9396
|
-
|
|
9419
|
+
// rotation (SpriteMaterial)
|
|
9420
|
+
if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
|
|
9397
9421
|
|
|
9398
|
-
|
|
9422
|
+
if ( this.polygonOffset === true ) data.polygonOffset = true;
|
|
9423
|
+
if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
|
|
9424
|
+
if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
9399
9425
|
|
|
9400
|
-
this.
|
|
9401
|
-
this.
|
|
9402
|
-
this.
|
|
9426
|
+
if ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;
|
|
9427
|
+
if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
|
|
9428
|
+
if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
|
|
9429
|
+
if ( this.scale !== undefined ) data.scale = this.scale;
|
|
9403
9430
|
|
|
9404
|
-
|
|
9431
|
+
if ( this.dithering === true ) data.dithering = true;
|
|
9405
9432
|
|
|
9406
|
-
|
|
9433
|
+
if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
|
|
9434
|
+
if ( this.alphaHash === true ) data.alphaHash = true;
|
|
9435
|
+
if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
|
|
9436
|
+
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
|
|
9437
|
+
if ( this.forceSinglePass === true ) data.forceSinglePass = true;
|
|
9407
9438
|
|
|
9408
|
-
|
|
9439
|
+
if ( this.wireframe === true ) data.wireframe = true;
|
|
9440
|
+
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
9441
|
+
if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
|
|
9442
|
+
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
|
|
9409
9443
|
|
|
9410
|
-
this.
|
|
9411
|
-
this.g = Math.max( 0, this.g - color.g );
|
|
9412
|
-
this.b = Math.max( 0, this.b - color.b );
|
|
9444
|
+
if ( this.flatShading === true ) data.flatShading = true;
|
|
9413
9445
|
|
|
9414
|
-
|
|
9446
|
+
if ( this.visible === false ) data.visible = false;
|
|
9415
9447
|
|
|
9416
|
-
|
|
9448
|
+
if ( this.toneMapped === false ) data.toneMapped = false;
|
|
9417
9449
|
|
|
9418
|
-
|
|
9450
|
+
if ( this.fog === false ) data.fog = false;
|
|
9419
9451
|
|
|
9420
|
-
this.
|
|
9421
|
-
this.g *= color.g;
|
|
9422
|
-
this.b *= color.b;
|
|
9452
|
+
if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
|
|
9423
9453
|
|
|
9424
|
-
|
|
9454
|
+
// TODO: Copied from Object3D.toJSON
|
|
9425
9455
|
|
|
9426
|
-
|
|
9456
|
+
function extractFromCache( cache ) {
|
|
9427
9457
|
|
|
9428
|
-
|
|
9458
|
+
const values = [];
|
|
9429
9459
|
|
|
9430
|
-
|
|
9431
|
-
this.g *= s;
|
|
9432
|
-
this.b *= s;
|
|
9460
|
+
for ( const key in cache ) {
|
|
9433
9461
|
|
|
9434
|
-
|
|
9462
|
+
const data = cache[ key ];
|
|
9463
|
+
delete data.metadata;
|
|
9464
|
+
values.push( data );
|
|
9435
9465
|
|
|
9436
|
-
|
|
9466
|
+
}
|
|
9437
9467
|
|
|
9438
|
-
|
|
9468
|
+
return values;
|
|
9439
9469
|
|
|
9440
|
-
|
|
9441
|
-
this.g += ( color.g - this.g ) * alpha;
|
|
9442
|
-
this.b += ( color.b - this.b ) * alpha;
|
|
9470
|
+
}
|
|
9443
9471
|
|
|
9444
|
-
|
|
9472
|
+
if ( isRootObject ) {
|
|
9445
9473
|
|
|
9446
|
-
|
|
9474
|
+
const textures = extractFromCache( meta.textures );
|
|
9475
|
+
const images = extractFromCache( meta.images );
|
|
9447
9476
|
|
|
9448
|
-
|
|
9477
|
+
if ( textures.length > 0 ) data.textures = textures;
|
|
9478
|
+
if ( images.length > 0 ) data.images = images;
|
|
9449
9479
|
|
|
9450
|
-
|
|
9451
|
-
this.g = color1.g + ( color2.g - color1.g ) * alpha;
|
|
9452
|
-
this.b = color1.b + ( color2.b - color1.b ) * alpha;
|
|
9480
|
+
}
|
|
9453
9481
|
|
|
9454
|
-
return
|
|
9482
|
+
return data;
|
|
9455
9483
|
|
|
9456
9484
|
}
|
|
9457
9485
|
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
this.getHSL( _hslA );
|
|
9461
|
-
color.getHSL( _hslB );
|
|
9486
|
+
clone() {
|
|
9462
9487
|
|
|
9463
|
-
|
|
9464
|
-
const s = lerp( _hslA.s, _hslB.s, alpha );
|
|
9465
|
-
const l = lerp( _hslA.l, _hslB.l, alpha );
|
|
9488
|
+
return new this.constructor().copy( this );
|
|
9466
9489
|
|
|
9467
|
-
|
|
9490
|
+
}
|
|
9468
9491
|
|
|
9469
|
-
|
|
9492
|
+
copy( source ) {
|
|
9470
9493
|
|
|
9471
|
-
|
|
9494
|
+
this.name = source.name;
|
|
9472
9495
|
|
|
9473
|
-
|
|
9496
|
+
this.blending = source.blending;
|
|
9497
|
+
this.side = source.side;
|
|
9498
|
+
this.vertexColors = source.vertexColors;
|
|
9474
9499
|
|
|
9475
|
-
this.
|
|
9476
|
-
this.
|
|
9477
|
-
this.b = v.z;
|
|
9500
|
+
this.opacity = source.opacity;
|
|
9501
|
+
this.transparent = source.transparent;
|
|
9478
9502
|
|
|
9479
|
-
|
|
9503
|
+
this.blendSrc = source.blendSrc;
|
|
9504
|
+
this.blendDst = source.blendDst;
|
|
9505
|
+
this.blendEquation = source.blendEquation;
|
|
9506
|
+
this.blendSrcAlpha = source.blendSrcAlpha;
|
|
9507
|
+
this.blendDstAlpha = source.blendDstAlpha;
|
|
9508
|
+
this.blendEquationAlpha = source.blendEquationAlpha;
|
|
9509
|
+
this.blendColor.copy( source.blendColor );
|
|
9510
|
+
this.blendAlpha = source.blendAlpha;
|
|
9480
9511
|
|
|
9481
|
-
|
|
9512
|
+
this.depthFunc = source.depthFunc;
|
|
9513
|
+
this.depthTest = source.depthTest;
|
|
9514
|
+
this.depthWrite = source.depthWrite;
|
|
9482
9515
|
|
|
9483
|
-
|
|
9516
|
+
this.stencilWriteMask = source.stencilWriteMask;
|
|
9517
|
+
this.stencilFunc = source.stencilFunc;
|
|
9518
|
+
this.stencilRef = source.stencilRef;
|
|
9519
|
+
this.stencilFuncMask = source.stencilFuncMask;
|
|
9520
|
+
this.stencilFail = source.stencilFail;
|
|
9521
|
+
this.stencilZFail = source.stencilZFail;
|
|
9522
|
+
this.stencilZPass = source.stencilZPass;
|
|
9523
|
+
this.stencilWrite = source.stencilWrite;
|
|
9484
9524
|
|
|
9485
|
-
const
|
|
9486
|
-
|
|
9525
|
+
const srcPlanes = source.clippingPlanes;
|
|
9526
|
+
let dstPlanes = null;
|
|
9487
9527
|
|
|
9488
|
-
|
|
9489
|
-
this.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;
|
|
9490
|
-
this.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;
|
|
9528
|
+
if ( srcPlanes !== null ) {
|
|
9491
9529
|
|
|
9492
|
-
|
|
9530
|
+
const n = srcPlanes.length;
|
|
9531
|
+
dstPlanes = new Array( n );
|
|
9493
9532
|
|
|
9494
|
-
|
|
9533
|
+
for ( let i = 0; i !== n; ++ i ) {
|
|
9495
9534
|
|
|
9496
|
-
|
|
9535
|
+
dstPlanes[ i ] = srcPlanes[ i ].clone();
|
|
9497
9536
|
|
|
9498
|
-
|
|
9537
|
+
}
|
|
9499
9538
|
|
|
9500
|
-
|
|
9539
|
+
}
|
|
9501
9540
|
|
|
9502
|
-
|
|
9541
|
+
this.clippingPlanes = dstPlanes;
|
|
9542
|
+
this.clipIntersection = source.clipIntersection;
|
|
9543
|
+
this.clipShadows = source.clipShadows;
|
|
9503
9544
|
|
|
9504
|
-
this.
|
|
9505
|
-
this.g = array[ offset + 1 ];
|
|
9506
|
-
this.b = array[ offset + 2 ];
|
|
9545
|
+
this.shadowSide = source.shadowSide;
|
|
9507
9546
|
|
|
9508
|
-
|
|
9547
|
+
this.colorWrite = source.colorWrite;
|
|
9509
9548
|
|
|
9510
|
-
|
|
9549
|
+
this.precision = source.precision;
|
|
9511
9550
|
|
|
9512
|
-
|
|
9551
|
+
this.polygonOffset = source.polygonOffset;
|
|
9552
|
+
this.polygonOffsetFactor = source.polygonOffsetFactor;
|
|
9553
|
+
this.polygonOffsetUnits = source.polygonOffsetUnits;
|
|
9513
9554
|
|
|
9514
|
-
|
|
9515
|
-
array[ offset + 1 ] = this.g;
|
|
9516
|
-
array[ offset + 2 ] = this.b;
|
|
9555
|
+
this.dithering = source.dithering;
|
|
9517
9556
|
|
|
9518
|
-
|
|
9557
|
+
this.alphaTest = source.alphaTest;
|
|
9558
|
+
this.alphaHash = source.alphaHash;
|
|
9559
|
+
this.alphaToCoverage = source.alphaToCoverage;
|
|
9560
|
+
this.premultipliedAlpha = source.premultipliedAlpha;
|
|
9561
|
+
this.forceSinglePass = source.forceSinglePass;
|
|
9519
9562
|
|
|
9520
|
-
|
|
9563
|
+
this.visible = source.visible;
|
|
9521
9564
|
|
|
9522
|
-
|
|
9565
|
+
this.toneMapped = source.toneMapped;
|
|
9523
9566
|
|
|
9524
|
-
this.
|
|
9525
|
-
this.g = attribute.getY( index );
|
|
9526
|
-
this.b = attribute.getZ( index );
|
|
9567
|
+
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
9527
9568
|
|
|
9528
9569
|
return this;
|
|
9529
9570
|
|
|
9530
9571
|
}
|
|
9531
9572
|
|
|
9532
|
-
|
|
9573
|
+
dispose() {
|
|
9533
9574
|
|
|
9534
|
-
|
|
9575
|
+
this.dispatchEvent( { type: 'dispose' } );
|
|
9535
9576
|
|
|
9536
9577
|
}
|
|
9537
9578
|
|
|
9538
|
-
|
|
9579
|
+
set needsUpdate( value ) {
|
|
9539
9580
|
|
|
9540
|
-
|
|
9541
|
-
yield this.g;
|
|
9542
|
-
yield this.b;
|
|
9581
|
+
if ( value === true ) this.version ++;
|
|
9543
9582
|
|
|
9544
9583
|
}
|
|
9545
9584
|
|
|
9546
9585
|
}
|
|
9547
9586
|
|
|
9548
|
-
const _color = /*@__PURE__*/ new Color();
|
|
9549
|
-
|
|
9550
|
-
Color.NAMES = _colorKeywords;
|
|
9551
|
-
|
|
9552
9587
|
class MeshBasicMaterial extends Material {
|
|
9553
9588
|
|
|
9554
9589
|
constructor( parameters ) {
|
|
@@ -13711,7 +13746,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13711
13746
|
|
|
13712
13747
|
var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
|
|
13713
13748
|
|
|
13714
|
-
var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
|
|
13749
|
+
var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
|
|
13715
13750
|
|
|
13716
13751
|
var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
|
|
13717
13752
|
|
|
@@ -13723,7 +13758,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13723
13758
|
|
|
13724
13759
|
var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";
|
|
13725
13760
|
|
|
13726
|
-
var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
|
|
13761
|
+
var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
|
|
13727
13762
|
|
|
13728
13763
|
var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
|
|
13729
13764
|
|
|
@@ -13801,9 +13836,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13801
13836
|
|
|
13802
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 - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
13803
13838
|
|
|
13804
|
-
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 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = 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\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += 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\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += 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}";
|
|
13839
|
+
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}";
|
|
13805
13840
|
|
|
13806
|
-
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal;\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
13841
|
+
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
13807
13842
|
|
|
13808
13843
|
var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
|
|
13809
13844
|
|
|
@@ -13959,7 +13994,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
13959
13994
|
|
|
13960
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}";
|
|
13961
13996
|
|
|
13962
|
-
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 +
|
|
13997
|
+
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}";
|
|
13963
13998
|
|
|
13964
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}";
|
|
13965
14000
|
|
|
@@ -14754,7 +14789,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
14754
14789
|
if ( boxMesh === undefined ) {
|
|
14755
14790
|
|
|
14756
14791
|
boxMesh = new Mesh(
|
|
14757
|
-
new BoxGeometry(
|
|
14792
|
+
new BoxGeometry( 10000, 10000, 10000 ),
|
|
14758
14793
|
new ShaderMaterial( {
|
|
14759
14794
|
name: 'BackgroundCubeMaterial',
|
|
14760
14795
|
uniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),
|
|
@@ -16134,6 +16169,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
16134
16169
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
16135
16170
|
const _clearColor = /*@__PURE__*/ new Color();
|
|
16136
16171
|
let _oldTarget = null;
|
|
16172
|
+
let _oldActiveCubeFace = 0;
|
|
16173
|
+
let _oldActiveMipmapLevel = 0;
|
|
16137
16174
|
|
|
16138
16175
|
// Golden Ratio
|
|
16139
16176
|
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
@@ -16199,6 +16236,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
16199
16236
|
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
|
|
16200
16237
|
|
|
16201
16238
|
_oldTarget = this._renderer.getRenderTarget();
|
|
16239
|
+
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
16240
|
+
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
16202
16241
|
|
|
16203
16242
|
this._setSize( 256 );
|
|
16204
16243
|
|
|
@@ -16311,7 +16350,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
16311
16350
|
|
|
16312
16351
|
_cleanup( outputTarget ) {
|
|
16313
16352
|
|
|
16314
|
-
this._renderer.setRenderTarget( _oldTarget );
|
|
16353
|
+
this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
|
|
16315
16354
|
outputTarget.scissorTest = false;
|
|
16316
16355
|
_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
|
|
16317
16356
|
|
|
@@ -16330,6 +16369,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
16330
16369
|
}
|
|
16331
16370
|
|
|
16332
16371
|
_oldTarget = this._renderer.getRenderTarget();
|
|
16372
|
+
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
16373
|
+
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
16333
16374
|
|
|
16334
16375
|
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
16335
16376
|
this._textureToCubeUV( texture, cubeUVRenderTarget );
|
|
@@ -17850,6 +17891,103 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
17850
17891
|
|
|
17851
17892
|
}
|
|
17852
17893
|
|
|
17894
|
+
/**
|
|
17895
|
+
* @author fernandojsg / http://fernandojsg.com
|
|
17896
|
+
* @author Takahiro https://github.com/takahirox
|
|
17897
|
+
*/
|
|
17898
|
+
|
|
17899
|
+
class WebGLMultiview {
|
|
17900
|
+
|
|
17901
|
+
constructor( renderer, extensions, gl ) {
|
|
17902
|
+
|
|
17903
|
+
this.renderer = renderer;
|
|
17904
|
+
|
|
17905
|
+
this.DEFAULT_NUMVIEWS = 2;
|
|
17906
|
+
this.maxNumViews = 0;
|
|
17907
|
+
this.gl = gl;
|
|
17908
|
+
|
|
17909
|
+
this.extensions = extensions;
|
|
17910
|
+
|
|
17911
|
+
this.available = this.extensions.has( 'OCULUS_multiview' );
|
|
17912
|
+
|
|
17913
|
+
if ( this.available ) {
|
|
17914
|
+
|
|
17915
|
+
const extension = this.extensions.get( 'OCULUS_multiview' );
|
|
17916
|
+
|
|
17917
|
+
this.maxNumViews = this.gl.getParameter( extension.MAX_VIEWS_OVR );
|
|
17918
|
+
|
|
17919
|
+
this.mat4 = [];
|
|
17920
|
+
this.mat3 = [];
|
|
17921
|
+
this.cameraArray = [];
|
|
17922
|
+
|
|
17923
|
+
for ( var i = 0; i < this.maxNumViews; i ++ ) {
|
|
17924
|
+
|
|
17925
|
+
this.mat4[ i ] = new Matrix4();
|
|
17926
|
+
this.mat3[ i ] = new Matrix3();
|
|
17927
|
+
|
|
17928
|
+
}
|
|
17929
|
+
|
|
17930
|
+
}
|
|
17931
|
+
|
|
17932
|
+
}
|
|
17933
|
+
|
|
17934
|
+
//
|
|
17935
|
+
getCameraArray( camera ) {
|
|
17936
|
+
|
|
17937
|
+
if ( camera.isArrayCamera ) return camera.cameras;
|
|
17938
|
+
|
|
17939
|
+
this.cameraArray[ 0 ] = camera;
|
|
17940
|
+
|
|
17941
|
+
return this.cameraArray;
|
|
17942
|
+
|
|
17943
|
+
}
|
|
17944
|
+
|
|
17945
|
+
updateCameraProjectionMatricesUniform( camera, uniforms ) {
|
|
17946
|
+
|
|
17947
|
+
var cameras = this.getCameraArray( camera );
|
|
17948
|
+
|
|
17949
|
+
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
17950
|
+
|
|
17951
|
+
this.mat4[ i ].copy( cameras[ i ].projectionMatrix );
|
|
17952
|
+
|
|
17953
|
+
}
|
|
17954
|
+
|
|
17955
|
+
uniforms.setValue( this.gl, 'projectionMatrices', this.mat4 );
|
|
17956
|
+
|
|
17957
|
+
}
|
|
17958
|
+
|
|
17959
|
+
updateCameraViewMatricesUniform( camera, uniforms ) {
|
|
17960
|
+
|
|
17961
|
+
var cameras = this.getCameraArray( camera );
|
|
17962
|
+
|
|
17963
|
+
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
17964
|
+
|
|
17965
|
+
this.mat4[ i ].copy( cameras[ i ].matrixWorldInverse );
|
|
17966
|
+
|
|
17967
|
+
}
|
|
17968
|
+
|
|
17969
|
+
uniforms.setValue( this.gl, 'viewMatrices', this.mat4 );
|
|
17970
|
+
|
|
17971
|
+
}
|
|
17972
|
+
|
|
17973
|
+
updateObjectMatricesUniforms( object, camera, uniforms ) {
|
|
17974
|
+
|
|
17975
|
+
var cameras = this.getCameraArray( camera );
|
|
17976
|
+
|
|
17977
|
+
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
17978
|
+
|
|
17979
|
+
this.mat4[ i ].multiplyMatrices( cameras[ i ].matrixWorldInverse, object.matrixWorld );
|
|
17980
|
+
this.mat3[ i ].getNormalMatrix( this.mat4[ i ] );
|
|
17981
|
+
|
|
17982
|
+
}
|
|
17983
|
+
|
|
17984
|
+
uniforms.setValue( this.gl, 'modelViewMatrices', this.mat4 );
|
|
17985
|
+
uniforms.setValue( this.gl, 'normalMatrices', this.mat3 );
|
|
17986
|
+
|
|
17987
|
+
}
|
|
17988
|
+
|
|
17989
|
+
}
|
|
17990
|
+
|
|
17853
17991
|
function WebGLObjects( gl, geometries, attributes, info ) {
|
|
17854
17992
|
|
|
17855
17993
|
let updateMap = new WeakMap();
|
|
@@ -19092,6 +19230,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19092
19230
|
|
|
19093
19231
|
}
|
|
19094
19232
|
|
|
19233
|
+
// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/
|
|
19234
|
+
const COMPLETION_STATUS_KHR = 0x91B1;
|
|
19235
|
+
|
|
19095
19236
|
let programIdCount = 0;
|
|
19096
19237
|
|
|
19097
19238
|
function handleSource( string, errorLine ) {
|
|
@@ -19543,6 +19684,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19543
19684
|
let prefixVertex, prefixFragment;
|
|
19544
19685
|
let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
|
|
19545
19686
|
|
|
19687
|
+
const numMultiviewViews = parameters.numMultiviewViews;
|
|
19688
|
+
|
|
19546
19689
|
if ( parameters.isRawShaderMaterial ) {
|
|
19547
19690
|
|
|
19548
19691
|
prefixVertex = [
|
|
@@ -19934,6 +20077,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19934
20077
|
].join( '\n' ) + '\n' + prefixVertex;
|
|
19935
20078
|
|
|
19936
20079
|
prefixFragment = [
|
|
20080
|
+
'precision mediump sampler2DArray;',
|
|
19937
20081
|
'#define varying in',
|
|
19938
20082
|
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
|
|
19939
20083
|
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
@@ -19949,6 +20093,53 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19949
20093
|
'#define textureCubeGradEXT textureGrad'
|
|
19950
20094
|
].join( '\n' ) + '\n' + prefixFragment;
|
|
19951
20095
|
|
|
20096
|
+
// Multiview
|
|
20097
|
+
|
|
20098
|
+
if ( numMultiviewViews > 0 ) {
|
|
20099
|
+
|
|
20100
|
+
// TODO: fix light transforms here?
|
|
20101
|
+
|
|
20102
|
+
prefixVertex = [
|
|
20103
|
+
'#extension GL_OVR_multiview : require',
|
|
20104
|
+
'layout(num_views = ' + numMultiviewViews + ') in;',
|
|
20105
|
+
'#define VIEW_ID gl_ViewID_OVR'
|
|
20106
|
+
].join( '\n' ) + '\n' + prefixVertex;
|
|
20107
|
+
|
|
20108
|
+
prefixVertex = prefixVertex.replace(
|
|
20109
|
+
[
|
|
20110
|
+
'uniform mat4 modelViewMatrix;',
|
|
20111
|
+
'uniform mat4 projectionMatrix;',
|
|
20112
|
+
'uniform mat4 viewMatrix;',
|
|
20113
|
+
'uniform mat3 normalMatrix;'
|
|
20114
|
+
].join( '\n' ),
|
|
20115
|
+
[
|
|
20116
|
+
'uniform mat4 modelViewMatrices[' + numMultiviewViews + '];',
|
|
20117
|
+
'uniform mat4 projectionMatrices[' + numMultiviewViews + '];',
|
|
20118
|
+
'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
|
|
20119
|
+
'uniform mat3 normalMatrices[' + numMultiviewViews + '];',
|
|
20120
|
+
|
|
20121
|
+
'#define modelViewMatrix modelViewMatrices[VIEW_ID]',
|
|
20122
|
+
'#define projectionMatrix projectionMatrices[VIEW_ID]',
|
|
20123
|
+
'#define viewMatrix viewMatrices[VIEW_ID]',
|
|
20124
|
+
'#define normalMatrix normalMatrices[VIEW_ID]'
|
|
20125
|
+
].join( '\n' )
|
|
20126
|
+
);
|
|
20127
|
+
|
|
20128
|
+
prefixFragment = [
|
|
20129
|
+
'#extension GL_OVR_multiview : require',
|
|
20130
|
+
'#define VIEW_ID gl_ViewID_OVR'
|
|
20131
|
+
].join( '\n' ) + '\n' + prefixFragment;
|
|
20132
|
+
|
|
20133
|
+
prefixFragment = prefixFragment.replace(
|
|
20134
|
+
'uniform mat4 viewMatrix;',
|
|
20135
|
+
[
|
|
20136
|
+
'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
|
|
20137
|
+
'#define viewMatrix viewMatrices[VIEW_ID]'
|
|
20138
|
+
].join( '\n' )
|
|
20139
|
+
);
|
|
20140
|
+
|
|
20141
|
+
}
|
|
20142
|
+
|
|
19952
20143
|
}
|
|
19953
20144
|
|
|
19954
20145
|
const vertexGlsl = versionString + prefixVertex + vertexShader;
|
|
@@ -19978,87 +20169,94 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19978
20169
|
|
|
19979
20170
|
gl.linkProgram( program );
|
|
19980
20171
|
|
|
19981
|
-
|
|
19982
|
-
if ( renderer.debug.checkShaderErrors ) {
|
|
20172
|
+
function onFirstUse( self ) {
|
|
19983
20173
|
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();
|
|
20174
|
+
// check for link errors
|
|
20175
|
+
if ( renderer.debug.checkShaderErrors ) {
|
|
19987
20176
|
|
|
19988
|
-
|
|
19989
|
-
|
|
20177
|
+
const programLog = gl.getProgramInfoLog( program ).trim();
|
|
20178
|
+
const vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();
|
|
20179
|
+
const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();
|
|
19990
20180
|
|
|
19991
|
-
|
|
20181
|
+
let runnable = true;
|
|
20182
|
+
let haveDiagnostics = true;
|
|
19992
20183
|
|
|
19993
|
-
|
|
20184
|
+
if ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {
|
|
19994
20185
|
|
|
19995
|
-
|
|
20186
|
+
runnable = false;
|
|
19996
20187
|
|
|
19997
|
-
renderer.debug.onShaderError
|
|
20188
|
+
if ( typeof renderer.debug.onShaderError === 'function' ) {
|
|
19998
20189
|
|
|
19999
|
-
|
|
20190
|
+
renderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );
|
|
20000
20191
|
|
|
20001
|
-
|
|
20192
|
+
} else {
|
|
20002
20193
|
|
|
20003
|
-
|
|
20004
|
-
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
20194
|
+
// default error reporting
|
|
20005
20195
|
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
20009
|
-
'Program Info Log: ' + programLog + '\n' +
|
|
20010
|
-
vertexErrors + '\n' +
|
|
20011
|
-
fragmentErrors
|
|
20012
|
-
);
|
|
20196
|
+
const vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
20197
|
+
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
20013
20198
|
|
|
20014
|
-
|
|
20199
|
+
console.error(
|
|
20200
|
+
'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
20201
|
+
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
20202
|
+
'Program Info Log: ' + programLog + '\n' +
|
|
20203
|
+
vertexErrors + '\n' +
|
|
20204
|
+
fragmentErrors
|
|
20205
|
+
);
|
|
20015
20206
|
|
|
20016
|
-
|
|
20207
|
+
}
|
|
20017
20208
|
|
|
20018
|
-
|
|
20209
|
+
} else if ( programLog !== '' ) {
|
|
20019
20210
|
|
|
20020
|
-
|
|
20211
|
+
console.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );
|
|
20021
20212
|
|
|
20022
|
-
|
|
20213
|
+
} else if ( vertexLog === '' || fragmentLog === '' ) {
|
|
20023
20214
|
|
|
20024
|
-
|
|
20215
|
+
haveDiagnostics = false;
|
|
20025
20216
|
|
|
20026
|
-
|
|
20217
|
+
}
|
|
20027
20218
|
|
|
20028
|
-
|
|
20219
|
+
if ( haveDiagnostics ) {
|
|
20029
20220
|
|
|
20030
|
-
|
|
20221
|
+
self.diagnostics = {
|
|
20031
20222
|
|
|
20032
|
-
|
|
20223
|
+
runnable: runnable,
|
|
20033
20224
|
|
|
20034
|
-
|
|
20225
|
+
programLog: programLog,
|
|
20035
20226
|
|
|
20036
|
-
|
|
20037
|
-
prefix: prefixVertex
|
|
20227
|
+
vertexShader: {
|
|
20038
20228
|
|
|
20039
|
-
|
|
20229
|
+
log: vertexLog,
|
|
20230
|
+
prefix: prefixVertex
|
|
20040
20231
|
|
|
20041
|
-
|
|
20232
|
+
},
|
|
20042
20233
|
|
|
20043
|
-
|
|
20044
|
-
prefix: prefixFragment
|
|
20234
|
+
fragmentShader: {
|
|
20045
20235
|
|
|
20046
|
-
|
|
20236
|
+
log: fragmentLog,
|
|
20237
|
+
prefix: prefixFragment
|
|
20047
20238
|
|
|
20048
|
-
|
|
20239
|
+
}
|
|
20240
|
+
|
|
20241
|
+
};
|
|
20242
|
+
|
|
20243
|
+
}
|
|
20049
20244
|
|
|
20050
20245
|
}
|
|
20051
20246
|
|
|
20052
|
-
|
|
20247
|
+
// Clean up
|
|
20248
|
+
|
|
20249
|
+
// Crashes in iOS9 and iOS10. #18402
|
|
20250
|
+
// gl.detachShader( program, glVertexShader );
|
|
20251
|
+
// gl.detachShader( program, glFragmentShader );
|
|
20053
20252
|
|
|
20054
|
-
|
|
20253
|
+
gl.deleteShader( glVertexShader );
|
|
20254
|
+
gl.deleteShader( glFragmentShader );
|
|
20055
20255
|
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
// gl.detachShader( program, glFragmentShader );
|
|
20256
|
+
cachedUniforms = new WebGLUniforms( gl, program );
|
|
20257
|
+
cachedAttributes = fetchAttributeLocations( gl, program );
|
|
20059
20258
|
|
|
20060
|
-
|
|
20061
|
-
gl.deleteShader( glFragmentShader );
|
|
20259
|
+
}
|
|
20062
20260
|
|
|
20063
20261
|
// set up caching for uniform locations
|
|
20064
20262
|
|
|
@@ -20068,7 +20266,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20068
20266
|
|
|
20069
20267
|
if ( cachedUniforms === undefined ) {
|
|
20070
20268
|
|
|
20071
|
-
|
|
20269
|
+
// Populates cachedUniforms and cachedAttributes
|
|
20270
|
+
onFirstUse( this );
|
|
20072
20271
|
|
|
20073
20272
|
}
|
|
20074
20273
|
|
|
@@ -20084,7 +20283,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20084
20283
|
|
|
20085
20284
|
if ( cachedAttributes === undefined ) {
|
|
20086
20285
|
|
|
20087
|
-
|
|
20286
|
+
// Populates cachedAttributes and cachedUniforms
|
|
20287
|
+
onFirstUse( this );
|
|
20088
20288
|
|
|
20089
20289
|
}
|
|
20090
20290
|
|
|
@@ -20092,6 +20292,23 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20092
20292
|
|
|
20093
20293
|
};
|
|
20094
20294
|
|
|
20295
|
+
// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,
|
|
20296
|
+
// flag the program as ready immediately. It may cause a stall when it's first used.
|
|
20297
|
+
|
|
20298
|
+
let programReady = ( parameters.rendererExtensionParallelShaderCompile === false );
|
|
20299
|
+
|
|
20300
|
+
this.isReady = function () {
|
|
20301
|
+
|
|
20302
|
+
if ( programReady === false ) {
|
|
20303
|
+
|
|
20304
|
+
programReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );
|
|
20305
|
+
|
|
20306
|
+
}
|
|
20307
|
+
|
|
20308
|
+
return programReady;
|
|
20309
|
+
|
|
20310
|
+
};
|
|
20311
|
+
|
|
20095
20312
|
// free resource
|
|
20096
20313
|
|
|
20097
20314
|
this.destroy = function () {
|
|
@@ -20113,6 +20330,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20113
20330
|
this.program = program;
|
|
20114
20331
|
this.vertexShader = glVertexShader;
|
|
20115
20332
|
this.fragmentShader = glFragmentShader;
|
|
20333
|
+
this.numMultiviewViews = numMultiviewViews;
|
|
20116
20334
|
|
|
20117
20335
|
return this;
|
|
20118
20336
|
|
|
@@ -20342,6 +20560,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20342
20560
|
|
|
20343
20561
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
20344
20562
|
|
|
20563
|
+
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
20564
|
+
|
|
20345
20565
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
20346
20566
|
|
|
20347
20567
|
const HAS_MAP = !! material.map;
|
|
@@ -20432,6 +20652,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20432
20652
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
20433
20653
|
|
|
20434
20654
|
supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
|
|
20655
|
+
numMultiviewViews: numMultiviewViews,
|
|
20435
20656
|
outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
|
|
20436
20657
|
|
|
20437
20658
|
map: HAS_MAP,
|
|
@@ -20593,6 +20814,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20593
20814
|
rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
|
|
20594
20815
|
rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
|
|
20595
20816
|
rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
|
|
20817
|
+
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
20596
20818
|
|
|
20597
20819
|
customProgramCacheKey: material.customProgramCacheKey()
|
|
20598
20820
|
|
|
@@ -20735,6 +20957,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20735
20957
|
_programLayers.enable( 16 );
|
|
20736
20958
|
if ( parameters.anisotropy )
|
|
20737
20959
|
_programLayers.enable( 17 );
|
|
20960
|
+
if ( parameters.alphaHash )
|
|
20961
|
+
_programLayers.enable( 18 );
|
|
20738
20962
|
|
|
20739
20963
|
array.push( _programLayers.mask );
|
|
20740
20964
|
_programLayers.disableAll();
|
|
@@ -20779,6 +21003,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20779
21003
|
_programLayers.enable( 18 );
|
|
20780
21004
|
if ( parameters.decodeVideoTexture )
|
|
20781
21005
|
_programLayers.enable( 19 );
|
|
21006
|
+
if ( parameters.numMultiviewViews )
|
|
21007
|
+
_programLayers.enable( 20 );
|
|
20782
21008
|
|
|
20783
21009
|
array.push( _programLayers.mask );
|
|
20784
21010
|
|
|
@@ -22626,6 +22852,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22626
22852
|
let currentBlendEquationAlpha = null;
|
|
22627
22853
|
let currentBlendSrcAlpha = null;
|
|
22628
22854
|
let currentBlendDstAlpha = null;
|
|
22855
|
+
let currentBlendColor = new Color( 0, 0, 0 );
|
|
22856
|
+
let currentBlendAlpha = 0;
|
|
22629
22857
|
let currentPremultipledAlpha = false;
|
|
22630
22858
|
|
|
22631
22859
|
let currentFlipSided = null;
|
|
@@ -22901,10 +23129,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22901
23129
|
[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,
|
|
22902
23130
|
[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,
|
|
22903
23131
|
[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,
|
|
22904
|
-
[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA
|
|
23132
|
+
[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,
|
|
23133
|
+
[ ConstantColorFactor ]: gl.CONSTANT_COLOR,
|
|
23134
|
+
[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,
|
|
23135
|
+
[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,
|
|
23136
|
+
[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA
|
|
22905
23137
|
};
|
|
22906
23138
|
|
|
22907
|
-
function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {
|
|
23139
|
+
function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {
|
|
22908
23140
|
|
|
22909
23141
|
if ( blending === NoBlending ) {
|
|
22910
23142
|
|
|
@@ -22997,6 +23229,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22997
23229
|
currentBlendDst = null;
|
|
22998
23230
|
currentBlendSrcAlpha = null;
|
|
22999
23231
|
currentBlendDstAlpha = null;
|
|
23232
|
+
currentBlendColor.set( 0, 0, 0 );
|
|
23233
|
+
currentBlendAlpha = 0;
|
|
23000
23234
|
|
|
23001
23235
|
currentBlending = blending;
|
|
23002
23236
|
currentPremultipledAlpha = premultipliedAlpha;
|
|
@@ -23033,6 +23267,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23033
23267
|
|
|
23034
23268
|
}
|
|
23035
23269
|
|
|
23270
|
+
if ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {
|
|
23271
|
+
|
|
23272
|
+
gl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );
|
|
23273
|
+
|
|
23274
|
+
currentBlendColor.copy( blendColor );
|
|
23275
|
+
currentBlendAlpha = blendAlpha;
|
|
23276
|
+
|
|
23277
|
+
}
|
|
23278
|
+
|
|
23036
23279
|
currentBlending = blending;
|
|
23037
23280
|
currentPremultipledAlpha = false;
|
|
23038
23281
|
|
|
@@ -23051,7 +23294,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23051
23294
|
|
|
23052
23295
|
( material.blending === NormalBlending && material.transparent === false )
|
|
23053
23296
|
? setBlending( NoBlending )
|
|
23054
|
-
: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );
|
|
23297
|
+
: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );
|
|
23055
23298
|
|
|
23056
23299
|
depthBuffer.setFunc( material.depthFunc );
|
|
23057
23300
|
depthBuffer.setTest( material.depthTest );
|
|
@@ -23475,6 +23718,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23475
23718
|
gl.blendEquation( gl.FUNC_ADD );
|
|
23476
23719
|
gl.blendFunc( gl.ONE, gl.ZERO );
|
|
23477
23720
|
gl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );
|
|
23721
|
+
gl.blendColor( 0, 0, 0, 0 );
|
|
23478
23722
|
|
|
23479
23723
|
gl.colorMask( true, true, true, true );
|
|
23480
23724
|
gl.clearColor( 0, 0, 0, 0 );
|
|
@@ -23532,6 +23776,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23532
23776
|
currentBlendEquationAlpha = null;
|
|
23533
23777
|
currentBlendSrcAlpha = null;
|
|
23534
23778
|
currentBlendDstAlpha = null;
|
|
23779
|
+
currentBlendColor = new Color( 0, 0, 0 );
|
|
23780
|
+
currentBlendAlpha = 0;
|
|
23535
23781
|
currentPremultipledAlpha = false;
|
|
23536
23782
|
|
|
23537
23783
|
currentFlipSided = null;
|
|
@@ -23614,12 +23860,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23614
23860
|
const maxSamples = capabilities.maxSamples;
|
|
23615
23861
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
23616
23862
|
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
|
|
23863
|
+
const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
|
|
23617
23864
|
|
|
23618
23865
|
const _videoTextures = new WeakMap();
|
|
23619
23866
|
let _canvas;
|
|
23620
23867
|
|
|
23621
23868
|
const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source
|
|
23622
23869
|
|
|
23870
|
+
let _deferredUploads = [];
|
|
23871
|
+
let _deferTextureUploads = false;
|
|
23872
|
+
|
|
23623
23873
|
// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
|
|
23624
23874
|
// also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
|
|
23625
23875
|
// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
|
|
@@ -24087,8 +24337,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24087
24337
|
|
|
24088
24338
|
} else {
|
|
24089
24339
|
|
|
24090
|
-
uploadTexture( textureProperties, texture, slot )
|
|
24091
|
-
|
|
24340
|
+
if ( uploadTexture( textureProperties, texture, slot ) ) {
|
|
24341
|
+
|
|
24342
|
+
return;
|
|
24343
|
+
|
|
24344
|
+
}
|
|
24092
24345
|
|
|
24093
24346
|
}
|
|
24094
24347
|
|
|
@@ -24321,8 +24574,45 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24321
24574
|
|
|
24322
24575
|
}
|
|
24323
24576
|
|
|
24577
|
+
function setDeferTextureUploads( deferFlag ) {
|
|
24578
|
+
|
|
24579
|
+
_deferTextureUploads = deferFlag;
|
|
24580
|
+
|
|
24581
|
+
}
|
|
24582
|
+
|
|
24583
|
+
function runDeferredUploads() {
|
|
24584
|
+
|
|
24585
|
+
const previousDeferSetting = _deferTextureUploads;
|
|
24586
|
+
_deferTextureUploads = false;
|
|
24587
|
+
|
|
24588
|
+
for ( const upload of _deferredUploads ) {
|
|
24589
|
+
|
|
24590
|
+
uploadTexture( upload.textureProperties, upload.texture, upload.slot );
|
|
24591
|
+
upload.texture.isPendingDeferredUpload = false;
|
|
24592
|
+
|
|
24593
|
+
}
|
|
24594
|
+
|
|
24595
|
+
_deferredUploads = [];
|
|
24596
|
+
|
|
24597
|
+
_deferTextureUploads = previousDeferSetting;
|
|
24598
|
+
|
|
24599
|
+
}
|
|
24600
|
+
|
|
24324
24601
|
function uploadTexture( textureProperties, texture, slot ) {
|
|
24325
24602
|
|
|
24603
|
+
if ( _deferTextureUploads ) {
|
|
24604
|
+
|
|
24605
|
+
if ( ! texture.isPendingDeferredUpload ) {
|
|
24606
|
+
|
|
24607
|
+
texture.isPendingDeferredUpload = true;
|
|
24608
|
+
_deferredUploads.push( { textureProperties: textureProperties, texture: texture, slot: slot } );
|
|
24609
|
+
|
|
24610
|
+
}
|
|
24611
|
+
|
|
24612
|
+
return false;
|
|
24613
|
+
|
|
24614
|
+
}
|
|
24615
|
+
|
|
24326
24616
|
let textureType = _gl.TEXTURE_2D;
|
|
24327
24617
|
|
|
24328
24618
|
if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
@@ -24739,6 +25029,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24739
25029
|
}
|
|
24740
25030
|
|
|
24741
25031
|
textureProperties.__version = texture.version;
|
|
25032
|
+
return true;
|
|
24742
25033
|
|
|
24743
25034
|
}
|
|
24744
25035
|
|
|
@@ -24968,7 +25259,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24968
25259
|
const width = Math.max( 1, renderTarget.width >> level );
|
|
24969
25260
|
const height = Math.max( 1, renderTarget.height >> level );
|
|
24970
25261
|
|
|
24971
|
-
if (
|
|
25262
|
+
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
25263
|
+
|
|
25264
|
+
state.texStorage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.numViews );
|
|
25265
|
+
|
|
25266
|
+
} else if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
24972
25267
|
|
|
24973
25268
|
state.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );
|
|
24974
25269
|
|
|
@@ -24982,13 +25277,31 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
24982
25277
|
|
|
24983
25278
|
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
24984
25279
|
|
|
24985
|
-
|
|
25280
|
+
const multisampled = useMultisampledRTT( renderTarget );
|
|
25281
|
+
|
|
25282
|
+
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
24986
25283
|
|
|
24987
|
-
|
|
25284
|
+
if ( multisampled ) {
|
|
25285
|
+
|
|
25286
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ), 0, renderTarget.numViews );
|
|
25287
|
+
|
|
25288
|
+
} else {
|
|
25289
|
+
|
|
25290
|
+
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get( texture ).__webglTexture, 0, 0, renderTarget.numViews );
|
|
25291
|
+
|
|
25292
|
+
}
|
|
24988
25293
|
|
|
24989
25294
|
} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
|
|
24990
25295
|
|
|
24991
|
-
|
|
25296
|
+
if ( multisampled ) {
|
|
25297
|
+
|
|
25298
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
25299
|
+
|
|
25300
|
+
} else {
|
|
25301
|
+
|
|
25302
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );
|
|
25303
|
+
|
|
25304
|
+
}
|
|
24992
25305
|
|
|
24993
25306
|
}
|
|
24994
25307
|
|
|
@@ -25002,7 +25315,59 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
25002
25315
|
|
|
25003
25316
|
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
25004
25317
|
|
|
25005
|
-
if ( renderTarget.
|
|
25318
|
+
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
25319
|
+
|
|
25320
|
+
const useMultisample = useMultisampledRTT( renderTarget );
|
|
25321
|
+
const numViews = renderTarget.numViews;
|
|
25322
|
+
|
|
25323
|
+
const depthTexture = renderTarget.depthTexture;
|
|
25324
|
+
let glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
25325
|
+
let glDepthAttachment = _gl.DEPTH_ATTACHMENT;
|
|
25326
|
+
|
|
25327
|
+
if ( depthTexture && depthTexture.isDepthTexture ) {
|
|
25328
|
+
|
|
25329
|
+
if ( depthTexture.type === FloatType ) {
|
|
25330
|
+
|
|
25331
|
+
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
25332
|
+
|
|
25333
|
+
} else if ( depthTexture.type === UnsignedInt248Type ) {
|
|
25334
|
+
|
|
25335
|
+
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
25336
|
+
glDepthAttachment = _gl.DEPTH_STENCIL_ATTACHMENT;
|
|
25337
|
+
|
|
25338
|
+
}
|
|
25339
|
+
|
|
25340
|
+
// we're defaulting to _gl.DEPTH_COMPONENT24 so don't assign here
|
|
25341
|
+
// or else DeepScan will complain
|
|
25342
|
+
|
|
25343
|
+
// else if ( depthTexture.type === UnsignedIntType ) {
|
|
25344
|
+
|
|
25345
|
+
// glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
25346
|
+
|
|
25347
|
+
// }
|
|
25348
|
+
|
|
25349
|
+
}
|
|
25350
|
+
|
|
25351
|
+
let depthStencilTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
|
|
25352
|
+
if ( depthStencilTexture === undefined ) {
|
|
25353
|
+
|
|
25354
|
+
depthStencilTexture = _gl.createTexture();
|
|
25355
|
+
_gl.bindTexture( _gl.TEXTURE_2D_ARRAY, depthStencilTexture );
|
|
25356
|
+
_gl.texStorage3D( _gl.TEXTURE_2D_ARRAY, 1, glInternalFormat, renderTarget.width, renderTarget.height, numViews );
|
|
25357
|
+
|
|
25358
|
+
}
|
|
25359
|
+
|
|
25360
|
+
if ( useMultisample ) {
|
|
25361
|
+
|
|
25362
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, getRenderTargetSamples( renderTarget ), 0, numViews );
|
|
25363
|
+
|
|
25364
|
+
} else {
|
|
25365
|
+
|
|
25366
|
+
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, 0, numViews );
|
|
25367
|
+
|
|
25368
|
+
}
|
|
25369
|
+
|
|
25370
|
+
} else if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
25006
25371
|
|
|
25007
25372
|
let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
|
|
25008
25373
|
|
|
@@ -25126,37 +25491,85 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
25126
25491
|
}
|
|
25127
25492
|
|
|
25128
25493
|
setTexture2D( renderTarget.depthTexture, 0 );
|
|
25494
|
+
if ( renderTarget.depthTexture.image.depth != 1 ) {
|
|
25495
|
+
|
|
25496
|
+
setTexture2DArray( renderTarget.depthTexture, 0 );
|
|
25497
|
+
|
|
25498
|
+
} else {
|
|
25499
|
+
|
|
25500
|
+
setTexture2D( renderTarget.depthTexture, 0 );
|
|
25501
|
+
|
|
25502
|
+
}
|
|
25129
25503
|
|
|
25130
25504
|
const webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
|
|
25131
25505
|
const samples = getRenderTargetSamples( renderTarget );
|
|
25132
25506
|
|
|
25133
|
-
if ( renderTarget.
|
|
25507
|
+
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
25134
25508
|
|
|
25135
|
-
|
|
25509
|
+
const useMultisample = useMultisampledRTT( renderTarget );
|
|
25510
|
+
const numViews = renderTarget.numViews;
|
|
25136
25511
|
|
|
25137
|
-
|
|
25512
|
+
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
25138
25513
|
|
|
25139
|
-
|
|
25514
|
+
if ( useMultisample ) {
|
|
25140
25515
|
|
|
25141
|
-
|
|
25516
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, webglDepthTexture, 0, samples, 0, numViews );
|
|
25142
25517
|
|
|
25143
|
-
|
|
25518
|
+
} else {
|
|
25519
|
+
|
|
25520
|
+
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, webglDepthTexture, 0, 0, numViews );
|
|
25521
|
+
|
|
25522
|
+
}
|
|
25144
25523
|
|
|
25145
|
-
|
|
25524
|
+
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
25146
25525
|
|
|
25147
|
-
|
|
25526
|
+
if ( useMultisample ) {
|
|
25148
25527
|
|
|
25149
|
-
|
|
25528
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, webglDepthTexture, 0, samples, 0, numViews );
|
|
25529
|
+
|
|
25530
|
+
} else {
|
|
25531
|
+
|
|
25532
|
+
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, webglDepthTexture, 0, 0, numViews );
|
|
25533
|
+
|
|
25534
|
+
}
|
|
25150
25535
|
|
|
25151
25536
|
} else {
|
|
25152
25537
|
|
|
25153
|
-
|
|
25538
|
+
throw new Error( 'Unknown depthTexture format' );
|
|
25154
25539
|
|
|
25155
25540
|
}
|
|
25156
25541
|
|
|
25157
25542
|
} else {
|
|
25158
25543
|
|
|
25159
|
-
|
|
25544
|
+
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
25545
|
+
|
|
25546
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
25547
|
+
|
|
25548
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
25549
|
+
|
|
25550
|
+
} else {
|
|
25551
|
+
|
|
25552
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
25553
|
+
|
|
25554
|
+
}
|
|
25555
|
+
|
|
25556
|
+
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
25557
|
+
|
|
25558
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
25559
|
+
|
|
25560
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
25561
|
+
|
|
25562
|
+
} else {
|
|
25563
|
+
|
|
25564
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
25565
|
+
|
|
25566
|
+
}
|
|
25567
|
+
|
|
25568
|
+
} else {
|
|
25569
|
+
|
|
25570
|
+
throw new Error( 'Unknown depthTexture format' );
|
|
25571
|
+
|
|
25572
|
+
}
|
|
25160
25573
|
|
|
25161
25574
|
}
|
|
25162
25575
|
|
|
@@ -25435,6 +25848,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
25435
25848
|
|
|
25436
25849
|
}
|
|
25437
25850
|
|
|
25851
|
+
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
25852
|
+
|
|
25853
|
+
glTextureType = _gl.TEXTURE_2D_ARRAY;
|
|
25854
|
+
|
|
25855
|
+
}
|
|
25856
|
+
|
|
25438
25857
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
25439
25858
|
setTextureParameters( glTextureType, texture, supportsMips );
|
|
25440
25859
|
|
|
@@ -25464,9 +25883,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
25464
25883
|
|
|
25465
25884
|
// Setup depth and stencil buffers
|
|
25466
25885
|
|
|
25467
|
-
if ( renderTarget.depthBuffer ) {
|
|
25886
|
+
if ( renderTarget.depthBuffer || renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
25468
25887
|
|
|
25469
|
-
setupDepthRenderbuffer( renderTarget );
|
|
25888
|
+
this.setupDepthRenderbuffer( renderTarget );
|
|
25470
25889
|
|
|
25471
25890
|
}
|
|
25472
25891
|
|
|
@@ -25702,12 +26121,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
25702
26121
|
this.setTexture3D = setTexture3D;
|
|
25703
26122
|
this.setTextureCube = setTextureCube;
|
|
25704
26123
|
this.rebindTextures = rebindTextures;
|
|
26124
|
+
this.uploadTexture = uploadTexture;
|
|
25705
26125
|
this.setupRenderTarget = setupRenderTarget;
|
|
25706
26126
|
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
|
|
25707
26127
|
this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
|
|
26128
|
+
this.setupDepthTexture = setupDepthTexture;
|
|
25708
26129
|
this.setupDepthRenderbuffer = setupDepthRenderbuffer;
|
|
25709
26130
|
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
25710
26131
|
this.useMultisampledRTT = useMultisampledRTT;
|
|
26132
|
+
this.runDeferredUploads = runDeferredUploads;
|
|
26133
|
+
this.setDeferTextureUploads = setDeferTextureUploads;
|
|
25711
26134
|
|
|
25712
26135
|
}
|
|
25713
26136
|
|
|
@@ -26564,6 +26987,39 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
26564
26987
|
dispatchEvent: EventDispatcher.prototype.dispatchEvent
|
|
26565
26988
|
} );
|
|
26566
26989
|
|
|
26990
|
+
/**
|
|
26991
|
+
* @author fernandojsg / http://fernandojsg.com
|
|
26992
|
+
* @author Takahiro https://github.com/takahirox
|
|
26993
|
+
*/
|
|
26994
|
+
|
|
26995
|
+
|
|
26996
|
+
class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
26997
|
+
|
|
26998
|
+
constructor( width, height, numViews, options = {} ) {
|
|
26999
|
+
|
|
27000
|
+
super( width, height, options );
|
|
27001
|
+
|
|
27002
|
+
this.depthBuffer = false;
|
|
27003
|
+
this.stencilBuffer = false;
|
|
27004
|
+
|
|
27005
|
+
this.numViews = numViews;
|
|
27006
|
+
|
|
27007
|
+
}
|
|
27008
|
+
|
|
27009
|
+
copy( source ) {
|
|
27010
|
+
|
|
27011
|
+
super.copy( source );
|
|
27012
|
+
|
|
27013
|
+
this.numViews = source.numViews;
|
|
27014
|
+
|
|
27015
|
+
return this;
|
|
27016
|
+
|
|
27017
|
+
}
|
|
27018
|
+
|
|
27019
|
+
}
|
|
27020
|
+
|
|
27021
|
+
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
27022
|
+
|
|
26567
27023
|
const _moveEvent = { type: 'move' };
|
|
26568
27024
|
|
|
26569
27025
|
class WebXRController {
|
|
@@ -26958,7 +27414,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
26958
27414
|
|
|
26959
27415
|
class WebXRManager extends EventDispatcher {
|
|
26960
27416
|
|
|
26961
|
-
constructor( renderer, gl ) {
|
|
27417
|
+
constructor( renderer, gl, extensions, useMultiview ) {
|
|
26962
27418
|
|
|
26963
27419
|
super();
|
|
26964
27420
|
|
|
@@ -27014,6 +27470,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27014
27470
|
this.enabled = false;
|
|
27015
27471
|
|
|
27016
27472
|
this.isPresenting = false;
|
|
27473
|
+
this.isMultiview = false;
|
|
27017
27474
|
|
|
27018
27475
|
this.getCameraPose = function ( ) {
|
|
27019
27476
|
|
|
@@ -27257,29 +27714,51 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
27257
27714
|
|
|
27258
27715
|
}
|
|
27259
27716
|
|
|
27717
|
+
scope.isMultiview = useMultiview && extensions.has( 'OCULUS_multiview' );
|
|
27718
|
+
|
|
27260
27719
|
const projectionlayerInit = {
|
|
27261
27720
|
colorFormat: gl.RGBA8,
|
|
27262
27721
|
depthFormat: glDepthFormat,
|
|
27263
27722
|
scaleFactor: framebufferScaleFactor
|
|
27264
27723
|
};
|
|
27265
27724
|
|
|
27725
|
+
if ( scope.isMultiview ) {
|
|
27726
|
+
|
|
27727
|
+
projectionlayerInit.textureType = 'texture-array';
|
|
27728
|
+
|
|
27729
|
+
}
|
|
27730
|
+
|
|
27266
27731
|
glBinding = new XRWebGLBinding( session, gl );
|
|
27267
27732
|
|
|
27268
27733
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
27269
27734
|
|
|
27270
27735
|
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
27271
27736
|
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27737
|
+
const renderTargetOptions = {
|
|
27738
|
+
format: RGBAFormat,
|
|
27739
|
+
type: UnsignedByteType,
|
|
27740
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
27741
|
+
stencilBuffer: attributes.stencil,
|
|
27742
|
+
colorSpace: renderer.outputColorSpace,
|
|
27743
|
+
samples: attributes.antialias ? 4 : 0
|
|
27744
|
+
};
|
|
27745
|
+
|
|
27746
|
+
if ( scope.isMultiview ) {
|
|
27747
|
+
|
|
27748
|
+
const extension = extensions.get( 'OCULUS_multiview' );
|
|
27749
|
+
|
|
27750
|
+
this.maxNumViews = gl.getParameter( extension.MAX_VIEWS_OVR );
|
|
27751
|
+
|
|
27752
|
+
newRenderTarget = new WebGLMultiviewRenderTarget( glProjLayer.textureWidth, glProjLayer.textureHeight, 2, renderTargetOptions );
|
|
27753
|
+
|
|
27754
|
+
} else {
|
|
27755
|
+
|
|
27756
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
27757
|
+
glProjLayer.textureWidth,
|
|
27758
|
+
glProjLayer.textureHeight,
|
|
27759
|
+
renderTargetOptions );
|
|
27760
|
+
|
|
27761
|
+
}
|
|
27283
27762
|
|
|
27284
27763
|
const renderTargetProperties = renderer.properties.get( newRenderTarget );
|
|
27285
27764
|
renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
|
|
@@ -28731,6 +29210,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
28731
29210
|
preserveDrawingBuffer = false,
|
|
28732
29211
|
powerPreference = 'default',
|
|
28733
29212
|
failIfMajorPerformanceCaveat = false,
|
|
29213
|
+
multiviewStereo = false,
|
|
28734
29214
|
} = parameters;
|
|
28735
29215
|
|
|
28736
29216
|
this.isWebGLRenderer = true;
|
|
@@ -28965,6 +29445,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
28965
29445
|
let extensions, capabilities, state, info;
|
|
28966
29446
|
let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
|
|
28967
29447
|
let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
29448
|
+
let multiview;
|
|
28968
29449
|
|
|
28969
29450
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
28970
29451
|
|
|
@@ -28998,6 +29479,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
28998
29479
|
renderLists = new WebGLRenderLists();
|
|
28999
29480
|
renderStates = new WebGLRenderStates( extensions, capabilities );
|
|
29000
29481
|
background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
|
|
29482
|
+
multiview = new WebGLMultiview( _this, extensions, _gl );
|
|
29001
29483
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
29002
29484
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
29003
29485
|
|
|
@@ -29020,7 +29502,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29020
29502
|
|
|
29021
29503
|
// xr
|
|
29022
29504
|
|
|
29023
|
-
const xr = ( typeof navigator !== 'undefined' && 'xr' in navigator ) ? new WebXRManager( _this, _gl ) : new WebVRManager( _this );
|
|
29505
|
+
const xr = ( typeof navigator !== 'undefined' && 'xr' in navigator ) ? new WebXRManager( _this, _gl, extensions, multiviewStereo ) : new WebVRManager( _this );
|
|
29024
29506
|
|
|
29025
29507
|
this.xr = xr;
|
|
29026
29508
|
|
|
@@ -29282,7 +29764,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29282
29764
|
}
|
|
29283
29765
|
|
|
29284
29766
|
if ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;
|
|
29285
|
-
if ( stencil )
|
|
29767
|
+
if ( stencil ) {
|
|
29768
|
+
|
|
29769
|
+
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
29770
|
+
this.state.buffers.stencil.setMask( 0xffffffff );
|
|
29771
|
+
|
|
29772
|
+
}
|
|
29286
29773
|
|
|
29287
29774
|
_gl.clear( bits );
|
|
29288
29775
|
|
|
@@ -29565,36 +30052,40 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29565
30052
|
|
|
29566
30053
|
// Compile
|
|
29567
30054
|
|
|
29568
|
-
|
|
30055
|
+
function prepareMaterial( material, scene, object ) {
|
|
29569
30056
|
|
|
29570
|
-
|
|
30057
|
+
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
29571
30058
|
|
|
29572
|
-
|
|
30059
|
+
material.side = BackSide;
|
|
30060
|
+
material.needsUpdate = true;
|
|
30061
|
+
getProgram( material, scene, object );
|
|
29573
30062
|
|
|
29574
|
-
|
|
29575
|
-
|
|
29576
|
-
|
|
30063
|
+
material.side = FrontSide;
|
|
30064
|
+
material.needsUpdate = true;
|
|
30065
|
+
getProgram( material, scene, object );
|
|
29577
30066
|
|
|
29578
|
-
|
|
29579
|
-
|
|
29580
|
-
|
|
30067
|
+
material.side = DoubleSide;
|
|
30068
|
+
|
|
30069
|
+
} else {
|
|
29581
30070
|
|
|
29582
|
-
|
|
30071
|
+
getProgram( material, scene, object );
|
|
29583
30072
|
|
|
29584
|
-
|
|
30073
|
+
}
|
|
29585
30074
|
|
|
29586
|
-
|
|
30075
|
+
}
|
|
29587
30076
|
|
|
29588
|
-
|
|
30077
|
+
this.compile = function ( scene, camera, targetScene = null ) {
|
|
29589
30078
|
|
|
29590
|
-
|
|
30079
|
+
if ( targetScene === null ) targetScene = scene;
|
|
29591
30080
|
|
|
29592
|
-
currentRenderState = renderStates.get(
|
|
30081
|
+
currentRenderState = renderStates.get( targetScene );
|
|
29593
30082
|
currentRenderState.init();
|
|
29594
30083
|
|
|
29595
30084
|
renderStateStack.push( currentRenderState );
|
|
29596
30085
|
|
|
29597
|
-
scene
|
|
30086
|
+
// gather lights from both the target scene and the new object that will be added to the scene.
|
|
30087
|
+
|
|
30088
|
+
targetScene.traverseVisible( function ( object ) {
|
|
29598
30089
|
|
|
29599
30090
|
if ( object.isLight && object.layers.test( camera.layers ) ) {
|
|
29600
30091
|
|
|
@@ -29610,8 +30101,32 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29610
30101
|
|
|
29611
30102
|
} );
|
|
29612
30103
|
|
|
30104
|
+
if ( scene !== targetScene ) {
|
|
30105
|
+
|
|
30106
|
+
scene.traverseVisible( function ( object ) {
|
|
30107
|
+
|
|
30108
|
+
if ( object.isLight && object.layers.test( camera.layers ) ) {
|
|
30109
|
+
|
|
30110
|
+
currentRenderState.pushLight( object );
|
|
30111
|
+
|
|
30112
|
+
if ( object.castShadow ) {
|
|
30113
|
+
|
|
30114
|
+
currentRenderState.pushShadow( object );
|
|
30115
|
+
|
|
30116
|
+
}
|
|
30117
|
+
|
|
30118
|
+
}
|
|
30119
|
+
|
|
30120
|
+
} );
|
|
30121
|
+
|
|
30122
|
+
}
|
|
30123
|
+
|
|
29613
30124
|
currentRenderState.setupLights( _this._useLegacyLights );
|
|
29614
30125
|
|
|
30126
|
+
// Only initialize materials in the new scene, not the targetScene.
|
|
30127
|
+
|
|
30128
|
+
const materials = new Set();
|
|
30129
|
+
|
|
29615
30130
|
scene.traverse( function ( object ) {
|
|
29616
30131
|
|
|
29617
30132
|
const material = object.material;
|
|
@@ -29624,13 +30139,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29624
30139
|
|
|
29625
30140
|
const material2 = material[ i ];
|
|
29626
30141
|
|
|
29627
|
-
|
|
30142
|
+
prepareMaterial( material2, targetScene, object );
|
|
30143
|
+
materials.add( material2 );
|
|
29628
30144
|
|
|
29629
30145
|
}
|
|
29630
30146
|
|
|
29631
30147
|
} else {
|
|
29632
30148
|
|
|
29633
|
-
|
|
30149
|
+
prepareMaterial( material, targetScene, object );
|
|
30150
|
+
materials.add( material );
|
|
29634
30151
|
|
|
29635
30152
|
}
|
|
29636
30153
|
|
|
@@ -29641,6 +30158,70 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29641
30158
|
renderStateStack.pop();
|
|
29642
30159
|
currentRenderState = null;
|
|
29643
30160
|
|
|
30161
|
+
return materials;
|
|
30162
|
+
|
|
30163
|
+
};
|
|
30164
|
+
|
|
30165
|
+
// compileAsync
|
|
30166
|
+
|
|
30167
|
+
this.compileAsync = function ( scene, camera, targetScene = null ) {
|
|
30168
|
+
|
|
30169
|
+
const materials = this.compile( scene, camera, targetScene );
|
|
30170
|
+
|
|
30171
|
+
// Wait for all the materials in the new object to indicate that they're
|
|
30172
|
+
// ready to be used before resolving the promise.
|
|
30173
|
+
|
|
30174
|
+
return new Promise( ( resolve ) => {
|
|
30175
|
+
|
|
30176
|
+
function checkMaterialsReady() {
|
|
30177
|
+
|
|
30178
|
+
materials.forEach( function ( material ) {
|
|
30179
|
+
|
|
30180
|
+
const materialProperties = properties.get( material );
|
|
30181
|
+
const program = materialProperties.currentProgram;
|
|
30182
|
+
|
|
30183
|
+
if ( program.isReady() ) {
|
|
30184
|
+
|
|
30185
|
+
// remove any programs that report they're ready to use from the list
|
|
30186
|
+
materials.delete( material );
|
|
30187
|
+
|
|
30188
|
+
}
|
|
30189
|
+
|
|
30190
|
+
} );
|
|
30191
|
+
|
|
30192
|
+
// once the list of compiling materials is empty, call the callback
|
|
30193
|
+
|
|
30194
|
+
if ( materials.size === 0 ) {
|
|
30195
|
+
|
|
30196
|
+
resolve( scene );
|
|
30197
|
+
return;
|
|
30198
|
+
|
|
30199
|
+
}
|
|
30200
|
+
|
|
30201
|
+
// if some materials are still not ready, wait a bit and check again
|
|
30202
|
+
|
|
30203
|
+
setTimeout( checkMaterialsReady, 10 );
|
|
30204
|
+
|
|
30205
|
+
}
|
|
30206
|
+
|
|
30207
|
+
if ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {
|
|
30208
|
+
|
|
30209
|
+
// If we can check the compilation status of the materials without
|
|
30210
|
+
// blocking then do so right away.
|
|
30211
|
+
|
|
30212
|
+
checkMaterialsReady();
|
|
30213
|
+
|
|
30214
|
+
} else {
|
|
30215
|
+
|
|
30216
|
+
// Otherwise start by waiting a bit to give the materials we just
|
|
30217
|
+
// initialized a chance to finish.
|
|
30218
|
+
|
|
30219
|
+
setTimeout( checkMaterialsReady, 10 );
|
|
30220
|
+
|
|
30221
|
+
}
|
|
30222
|
+
|
|
30223
|
+
} );
|
|
30224
|
+
|
|
29644
30225
|
};
|
|
29645
30226
|
|
|
29646
30227
|
// Animation Loop
|
|
@@ -29767,13 +30348,23 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29767
30348
|
|
|
29768
30349
|
if ( camera.isArrayCamera ) {
|
|
29769
30350
|
|
|
29770
|
-
|
|
30351
|
+
if ( xr.enabled && xr.isMultiview ) {
|
|
30352
|
+
|
|
30353
|
+
textures.setDeferTextureUploads( true );
|
|
30354
|
+
|
|
30355
|
+
renderScene( currentRenderList, scene, camera, camera.cameras[ 0 ].viewport );
|
|
30356
|
+
|
|
30357
|
+
} else {
|
|
30358
|
+
|
|
30359
|
+
const cameras = camera.cameras;
|
|
29771
30360
|
|
|
29772
|
-
|
|
30361
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
29773
30362
|
|
|
29774
|
-
|
|
30363
|
+
const camera2 = cameras[ i ];
|
|
29775
30364
|
|
|
29776
|
-
|
|
30365
|
+
renderScene( currentRenderList, scene, camera2, camera2.viewport );
|
|
30366
|
+
|
|
30367
|
+
}
|
|
29777
30368
|
|
|
29778
30369
|
}
|
|
29779
30370
|
|
|
@@ -29801,6 +30392,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29801
30392
|
|
|
29802
30393
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
29803
30394
|
|
|
30395
|
+
textures.runDeferredUploads();
|
|
30396
|
+
|
|
29804
30397
|
if ( xr.enabled && xr.submitFrame ) {
|
|
29805
30398
|
|
|
29806
30399
|
xr.submitFrame();
|
|
@@ -29982,6 +30575,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29982
30575
|
|
|
29983
30576
|
function renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {
|
|
29984
30577
|
|
|
30578
|
+
const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
|
|
30579
|
+
|
|
30580
|
+
if ( overrideMaterial !== null ) {
|
|
30581
|
+
|
|
30582
|
+
return;
|
|
30583
|
+
|
|
30584
|
+
}
|
|
30585
|
+
|
|
29985
30586
|
const isWebGL2 = capabilities.isWebGL2;
|
|
29986
30587
|
|
|
29987
30588
|
if ( _transmissionRenderTarget === null ) {
|
|
@@ -30241,16 +30842,26 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30241
30842
|
|
|
30242
30843
|
}
|
|
30243
30844
|
|
|
30244
|
-
const progUniforms = program.getUniforms();
|
|
30245
|
-
const uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, uniforms );
|
|
30246
|
-
|
|
30247
30845
|
materialProperties.currentProgram = program;
|
|
30248
|
-
materialProperties.uniformsList =
|
|
30846
|
+
materialProperties.uniformsList = null;
|
|
30249
30847
|
|
|
30250
30848
|
return program;
|
|
30251
30849
|
|
|
30252
30850
|
}
|
|
30253
30851
|
|
|
30852
|
+
function getUniformList( materialProperties ) {
|
|
30853
|
+
|
|
30854
|
+
if ( materialProperties.uniformsList === null ) {
|
|
30855
|
+
|
|
30856
|
+
const progUniforms = materialProperties.currentProgram.getUniforms();
|
|
30857
|
+
materialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );
|
|
30858
|
+
|
|
30859
|
+
}
|
|
30860
|
+
|
|
30861
|
+
return materialProperties.uniformsList;
|
|
30862
|
+
|
|
30863
|
+
}
|
|
30864
|
+
|
|
30254
30865
|
function updateCommonMaterialProperties( material, parameters ) {
|
|
30255
30866
|
|
|
30256
30867
|
const materialProperties = properties.get( material );
|
|
@@ -30268,6 +30879,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30268
30879
|
materialProperties.vertexAlphas = parameters.vertexAlphas;
|
|
30269
30880
|
materialProperties.vertexTangents = parameters.vertexTangents;
|
|
30270
30881
|
materialProperties.toneMapping = parameters.toneMapping;
|
|
30882
|
+
materialProperties.numMultiviewViews = parameters.numMultiviewViews;
|
|
30271
30883
|
|
|
30272
30884
|
}
|
|
30273
30885
|
|
|
@@ -30299,6 +30911,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30299
30911
|
|
|
30300
30912
|
}
|
|
30301
30913
|
|
|
30914
|
+
const numMultiviewViews = _currentRenderTarget && _currentRenderTarget.isWebGLMultiviewRenderTarget ? _currentRenderTarget.numViews : 0;
|
|
30915
|
+
|
|
30302
30916
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
30303
30917
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
30304
30918
|
|
|
@@ -30402,6 +31016,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30402
31016
|
|
|
30403
31017
|
needsProgramChange = true;
|
|
30404
31018
|
|
|
31019
|
+
} else if ( materialProperties.numMultiviewViews !== numMultiviewViews ) {
|
|
31020
|
+
|
|
31021
|
+
needsProgramChange = true;
|
|
31022
|
+
|
|
30405
31023
|
}
|
|
30406
31024
|
|
|
30407
31025
|
} else {
|
|
@@ -30448,8 +31066,17 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30448
31066
|
|
|
30449
31067
|
// common camera uniforms
|
|
30450
31068
|
|
|
30451
|
-
|
|
30452
|
-
|
|
31069
|
+
if ( program.numMultiviewViews > 0 ) {
|
|
31070
|
+
|
|
31071
|
+
multiview.updateCameraProjectionMatricesUniform( camera, p_uniforms );
|
|
31072
|
+
multiview.updateCameraViewMatricesUniform( camera, p_uniforms );
|
|
31073
|
+
|
|
31074
|
+
} else {
|
|
31075
|
+
|
|
31076
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
31077
|
+
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
31078
|
+
|
|
31079
|
+
}
|
|
30453
31080
|
|
|
30454
31081
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
30455
31082
|
|
|
@@ -30578,13 +31205,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30578
31205
|
|
|
30579
31206
|
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );
|
|
30580
31207
|
|
|
30581
|
-
WebGLUniforms.upload( _gl, materialProperties
|
|
31208
|
+
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
30582
31209
|
|
|
30583
31210
|
}
|
|
30584
31211
|
|
|
30585
31212
|
if ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {
|
|
30586
31213
|
|
|
30587
|
-
WebGLUniforms.upload( _gl, materialProperties
|
|
31214
|
+
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
30588
31215
|
material.uniformsNeedUpdate = false;
|
|
30589
31216
|
|
|
30590
31217
|
}
|
|
@@ -30597,8 +31224,17 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30597
31224
|
|
|
30598
31225
|
// common matrices
|
|
30599
31226
|
|
|
30600
|
-
|
|
30601
|
-
|
|
31227
|
+
if ( program.numMultiviewViews > 0 ) {
|
|
31228
|
+
|
|
31229
|
+
multiview.updateObjectMatricesUniforms( object, camera, p_uniforms );
|
|
31230
|
+
|
|
31231
|
+
} else {
|
|
31232
|
+
|
|
31233
|
+
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
|
|
31234
|
+
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
|
|
31235
|
+
|
|
31236
|
+
}
|
|
31237
|
+
|
|
30602
31238
|
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
|
|
30603
31239
|
|
|
30604
31240
|
// UBOs
|
|
@@ -30708,20 +31344,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30708
31344
|
const renderTargetProperties = properties.get( renderTarget );
|
|
30709
31345
|
renderTargetProperties.__hasExternalTextures = true;
|
|
30710
31346
|
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
30714
|
-
|
|
30715
|
-
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
31347
|
+
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
30716
31348
|
|
|
30717
|
-
|
|
30718
|
-
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
30719
|
-
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
|
|
31349
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer && ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) {
|
|
30720
31350
|
|
|
30721
|
-
|
|
30722
|
-
|
|
31351
|
+
// The multisample_render_to_texture extension doesn't work properly if there
|
|
31352
|
+
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
31353
|
+
if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
|
|
30723
31354
|
|
|
30724
|
-
|
|
31355
|
+
console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
|
|
31356
|
+
renderTargetProperties.__useRenderToTexture = false;
|
|
30725
31357
|
|
|
30726
31358
|
}
|
|
30727
31359
|
|
|
@@ -32213,7 +32845,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32213
32845
|
|
|
32214
32846
|
this.type = 'SkinnedMesh';
|
|
32215
32847
|
|
|
32216
|
-
this.bindMode =
|
|
32848
|
+
this.bindMode = AttachedBindMode;
|
|
32217
32849
|
this.bindMatrix = new Matrix4();
|
|
32218
32850
|
this.bindMatrixInverse = new Matrix4();
|
|
32219
32851
|
|
|
@@ -32238,8 +32870,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32238
32870
|
|
|
32239
32871
|
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
32240
32872
|
|
|
32241
|
-
|
|
32242
|
-
this.applyBoneTransform( i, _vertex );
|
|
32873
|
+
this.getVertexPosition( i, _vertex );
|
|
32243
32874
|
this.boundingBox.expandByPoint( _vertex );
|
|
32244
32875
|
|
|
32245
32876
|
}
|
|
@@ -32262,8 +32893,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32262
32893
|
|
|
32263
32894
|
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
32264
32895
|
|
|
32265
|
-
|
|
32266
|
-
this.applyBoneTransform( i, _vertex );
|
|
32896
|
+
this.getVertexPosition( i, _vertex );
|
|
32267
32897
|
this.boundingSphere.expandByPoint( _vertex );
|
|
32268
32898
|
|
|
32269
32899
|
}
|
|
@@ -32389,11 +33019,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32389
33019
|
|
|
32390
33020
|
super.updateMatrixWorld( force );
|
|
32391
33021
|
|
|
32392
|
-
if ( this.bindMode ===
|
|
33022
|
+
if ( this.bindMode === AttachedBindMode ) {
|
|
32393
33023
|
|
|
32394
33024
|
this.bindMatrixInverse.copy( this.matrixWorld ).invert();
|
|
32395
33025
|
|
|
32396
|
-
} else if ( this.bindMode ===
|
|
33026
|
+
} else if ( this.bindMode === DetachedBindMode ) {
|
|
32397
33027
|
|
|
32398
33028
|
this.bindMatrixInverse.copy( this.bindMatrix ).invert();
|
|
32399
33029
|
|
|
@@ -44292,11 +44922,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
44292
44922
|
if ( json.transparent !== undefined ) material.transparent = json.transparent;
|
|
44293
44923
|
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
|
|
44294
44924
|
if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
|
|
44925
|
+
if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
|
|
44295
44926
|
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
|
|
44296
44927
|
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
|
|
44297
44928
|
if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
|
|
44298
|
-
|
|
44299
|
-
if ( json.
|
|
44929
|
+
if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
|
|
44930
|
+
if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
|
|
44931
|
+
if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
|
|
44932
|
+
if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
|
|
44933
|
+
if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
|
|
44934
|
+
if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
|
|
44935
|
+
if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
|
|
44936
|
+
if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
|
|
44300
44937
|
if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
|
|
44301
44938
|
if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
|
|
44302
44939
|
if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
|
|
@@ -44304,6 +44941,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
44304
44941
|
if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
|
|
44305
44942
|
if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
|
|
44306
44943
|
if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
|
|
44944
|
+
if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
|
|
44307
44945
|
|
|
44308
44946
|
if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
|
|
44309
44947
|
if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
|
|
@@ -52142,6 +52780,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52142
52780
|
exports.ArcCurve = ArcCurve;
|
|
52143
52781
|
exports.ArrayCamera = ArrayCamera;
|
|
52144
52782
|
exports.ArrowHelper = ArrowHelper;
|
|
52783
|
+
exports.AttachedBindMode = AttachedBindMode;
|
|
52145
52784
|
exports.Audio = Audio;
|
|
52146
52785
|
exports.AudioAnalyser = AudioAnalyser;
|
|
52147
52786
|
exports.AudioContext = AudioContext;
|
|
@@ -52180,6 +52819,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52180
52819
|
exports.CompressedTexture = CompressedTexture;
|
|
52181
52820
|
exports.CompressedTextureLoader = CompressedTextureLoader;
|
|
52182
52821
|
exports.ConeGeometry = ConeGeometry;
|
|
52822
|
+
exports.ConstantAlphaFactor = ConstantAlphaFactor;
|
|
52823
|
+
exports.ConstantColorFactor = ConstantColorFactor;
|
|
52183
52824
|
exports.CubeCamera = CubeCamera;
|
|
52184
52825
|
exports.CubeReflectionMapping = CubeReflectionMapping;
|
|
52185
52826
|
exports.CubeRefractionMapping = CubeRefractionMapping;
|
|
@@ -52210,6 +52851,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52210
52851
|
exports.DepthFormat = DepthFormat;
|
|
52211
52852
|
exports.DepthStencilFormat = DepthStencilFormat;
|
|
52212
52853
|
exports.DepthTexture = DepthTexture;
|
|
52854
|
+
exports.DetachedBindMode = DetachedBindMode;
|
|
52213
52855
|
exports.DirectionalLight = DirectionalLight;
|
|
52214
52856
|
exports.DirectionalLightHelper = DirectionalLightHelper;
|
|
52215
52857
|
exports.DiscreteInterpolant = DiscreteInterpolant;
|
|
@@ -52361,6 +53003,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52361
53003
|
exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
|
|
52362
53004
|
exports.OctahedronGeometry = OctahedronGeometry;
|
|
52363
53005
|
exports.OneFactor = OneFactor;
|
|
53006
|
+
exports.OneMinusConstantAlphaFactor = OneMinusConstantAlphaFactor;
|
|
53007
|
+
exports.OneMinusConstantColorFactor = OneMinusConstantColorFactor;
|
|
52364
53008
|
exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
|
|
52365
53009
|
exports.OneMinusDstColorFactor = OneMinusDstColorFactor;
|
|
52366
53010
|
exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;
|