super-three 0.157.1 → 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 +1013 -790
- package/build/three.js +1013 -790
- package/build/three.min.js +1 -1
- package/build/three.module.js +1008 -791
- 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/WebGLRenderer.js +142 -25
- 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/WebGLProgram.js +80 -50
- package/src/renderers/webgl/WebGLPrograms.js +3 -0
- package/src/renderers/webgl/WebGLState.js +25 -4
- 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 );
|
|
4813
|
+
|
|
4814
|
+
} else {
|
|
4815
|
+
|
|
4816
|
+
_vector$a.fromBufferAttribute( positionAttribute, i );
|
|
4817
|
+
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
_vector$a.applyMatrix4( object.matrixWorld );
|
|
4821
|
+
this.expandByPoint( _vector$a );
|
|
4822
|
+
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4825
|
+
} else {
|
|
4808
4826
|
|
|
4809
|
-
|
|
4827
|
+
if ( object.boundingBox !== undefined ) {
|
|
4810
4828
|
|
|
4811
|
-
|
|
4829
|
+
// object-level bounding box
|
|
4812
4830
|
|
|
4813
|
-
|
|
4814
|
-
for ( let i = 0, l = position.count; i < l; i ++ ) {
|
|
4831
|
+
if ( object.boundingBox === null ) {
|
|
4815
4832
|
|
|
4816
|
-
|
|
4817
|
-
this.expandByPoint( _vector$a );
|
|
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
|
-
|
|
9210
|
-
|
|
9211
|
-
// color keywords
|
|
9212
|
-
const hex = _colorKeywords[ style.toLowerCase() ];
|
|
9180
|
+
setValues( values ) {
|
|
9213
9181
|
|
|
9214
|
-
if (
|
|
9182
|
+
if ( values === undefined ) return;
|
|
9215
9183
|
|
|
9216
|
-
|
|
9217
|
-
this.setHex( hex, colorSpace );
|
|
9184
|
+
for ( const key in values ) {
|
|
9218
9185
|
|
|
9219
|
-
|
|
9186
|
+
const newValue = values[ key ];
|
|
9220
9187
|
|
|
9221
|
-
|
|
9222
|
-
console.warn( 'THREE.Color: Unknown color ' + style );
|
|
9188
|
+
if ( newValue === undefined ) {
|
|
9223
9189
|
|
|
9224
|
-
|
|
9190
|
+
console.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );
|
|
9191
|
+
continue;
|
|
9225
9192
|
|
|
9226
|
-
|
|
9193
|
+
}
|
|
9227
9194
|
|
|
9228
|
-
|
|
9195
|
+
const currentValue = this[ key ];
|
|
9229
9196
|
|
|
9230
|
-
|
|
9197
|
+
if ( currentValue === undefined ) {
|
|
9231
9198
|
|
|
9232
|
-
|
|
9199
|
+
console.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );
|
|
9200
|
+
continue;
|
|
9233
9201
|
|
|
9234
|
-
|
|
9202
|
+
}
|
|
9235
9203
|
|
|
9236
|
-
|
|
9204
|
+
if ( currentValue && currentValue.isColor ) {
|
|
9237
9205
|
|
|
9238
|
-
|
|
9239
|
-
this.g = color.g;
|
|
9240
|
-
this.b = color.b;
|
|
9206
|
+
currentValue.set( newValue );
|
|
9241
9207
|
|
|
9242
|
-
|
|
9208
|
+
} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {
|
|
9243
9209
|
|
|
9244
|
-
|
|
9210
|
+
currentValue.copy( newValue );
|
|
9245
9211
|
|
|
9246
|
-
|
|
9212
|
+
} else {
|
|
9247
9213
|
|
|
9248
|
-
|
|
9249
|
-
this.g = SRGBToLinear( color.g );
|
|
9250
|
-
this.b = SRGBToLinear( color.b );
|
|
9214
|
+
this[ key ] = newValue;
|
|
9251
9215
|
|
|
9252
|
-
|
|
9216
|
+
}
|
|
9217
|
+
|
|
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
|
|
|
@@ -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 );
|
|
@@ -19189,6 +19230,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
19189
19230
|
|
|
19190
19231
|
}
|
|
19191
19232
|
|
|
19233
|
+
// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/
|
|
19234
|
+
const COMPLETION_STATUS_KHR = 0x91B1;
|
|
19235
|
+
|
|
19192
19236
|
let programIdCount = 0;
|
|
19193
19237
|
|
|
19194
19238
|
function handleSource( string, errorLine ) {
|
|
@@ -20033,6 +20077,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20033
20077
|
].join( '\n' ) + '\n' + prefixVertex;
|
|
20034
20078
|
|
|
20035
20079
|
prefixFragment = [
|
|
20080
|
+
'precision mediump sampler2DArray;',
|
|
20036
20081
|
'#define varying in',
|
|
20037
20082
|
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
|
|
20038
20083
|
( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
|
|
@@ -20124,87 +20169,94 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20124
20169
|
|
|
20125
20170
|
gl.linkProgram( program );
|
|
20126
20171
|
|
|
20127
|
-
|
|
20128
|
-
if ( renderer.debug.checkShaderErrors ) {
|
|
20172
|
+
function onFirstUse( self ) {
|
|
20129
20173
|
|
|
20130
|
-
|
|
20131
|
-
|
|
20132
|
-
const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();
|
|
20174
|
+
// check for link errors
|
|
20175
|
+
if ( renderer.debug.checkShaderErrors ) {
|
|
20133
20176
|
|
|
20134
|
-
|
|
20135
|
-
|
|
20177
|
+
const programLog = gl.getProgramInfoLog( program ).trim();
|
|
20178
|
+
const vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();
|
|
20179
|
+
const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();
|
|
20136
20180
|
|
|
20137
|
-
|
|
20181
|
+
let runnable = true;
|
|
20182
|
+
let haveDiagnostics = true;
|
|
20138
20183
|
|
|
20139
|
-
|
|
20184
|
+
if ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {
|
|
20140
20185
|
|
|
20141
|
-
|
|
20186
|
+
runnable = false;
|
|
20142
20187
|
|
|
20143
|
-
renderer.debug.onShaderError
|
|
20188
|
+
if ( typeof renderer.debug.onShaderError === 'function' ) {
|
|
20144
20189
|
|
|
20145
|
-
|
|
20190
|
+
renderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );
|
|
20146
20191
|
|
|
20147
|
-
|
|
20192
|
+
} else {
|
|
20148
20193
|
|
|
20149
|
-
|
|
20150
|
-
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
20194
|
+
// default error reporting
|
|
20151
20195
|
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
20155
|
-
'Program Info Log: ' + programLog + '\n' +
|
|
20156
|
-
vertexErrors + '\n' +
|
|
20157
|
-
fragmentErrors
|
|
20158
|
-
);
|
|
20196
|
+
const vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
20197
|
+
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
20159
20198
|
|
|
20160
|
-
|
|
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
|
+
);
|
|
20206
|
+
|
|
20207
|
+
}
|
|
20161
20208
|
|
|
20162
|
-
|
|
20209
|
+
} else if ( programLog !== '' ) {
|
|
20163
20210
|
|
|
20164
|
-
|
|
20211
|
+
console.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );
|
|
20165
20212
|
|
|
20166
|
-
|
|
20213
|
+
} else if ( vertexLog === '' || fragmentLog === '' ) {
|
|
20167
20214
|
|
|
20168
|
-
|
|
20215
|
+
haveDiagnostics = false;
|
|
20169
20216
|
|
|
20170
|
-
|
|
20217
|
+
}
|
|
20171
20218
|
|
|
20172
|
-
|
|
20219
|
+
if ( haveDiagnostics ) {
|
|
20173
20220
|
|
|
20174
|
-
|
|
20221
|
+
self.diagnostics = {
|
|
20175
20222
|
|
|
20176
|
-
|
|
20223
|
+
runnable: runnable,
|
|
20177
20224
|
|
|
20178
|
-
|
|
20225
|
+
programLog: programLog,
|
|
20179
20226
|
|
|
20180
|
-
|
|
20227
|
+
vertexShader: {
|
|
20181
20228
|
|
|
20182
|
-
|
|
20183
|
-
|
|
20229
|
+
log: vertexLog,
|
|
20230
|
+
prefix: prefixVertex
|
|
20184
20231
|
|
|
20185
|
-
|
|
20232
|
+
},
|
|
20186
20233
|
|
|
20187
|
-
|
|
20234
|
+
fragmentShader: {
|
|
20188
20235
|
|
|
20189
|
-
|
|
20190
|
-
|
|
20236
|
+
log: fragmentLog,
|
|
20237
|
+
prefix: prefixFragment
|
|
20191
20238
|
|
|
20192
|
-
|
|
20239
|
+
}
|
|
20193
20240
|
|
|
20194
|
-
|
|
20241
|
+
};
|
|
20242
|
+
|
|
20243
|
+
}
|
|
20195
20244
|
|
|
20196
20245
|
}
|
|
20197
20246
|
|
|
20198
|
-
|
|
20247
|
+
// Clean up
|
|
20248
|
+
|
|
20249
|
+
// Crashes in iOS9 and iOS10. #18402
|
|
20250
|
+
// gl.detachShader( program, glVertexShader );
|
|
20251
|
+
// gl.detachShader( program, glFragmentShader );
|
|
20199
20252
|
|
|
20200
|
-
|
|
20253
|
+
gl.deleteShader( glVertexShader );
|
|
20254
|
+
gl.deleteShader( glFragmentShader );
|
|
20201
20255
|
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
// gl.detachShader( program, glFragmentShader );
|
|
20256
|
+
cachedUniforms = new WebGLUniforms( gl, program );
|
|
20257
|
+
cachedAttributes = fetchAttributeLocations( gl, program );
|
|
20205
20258
|
|
|
20206
|
-
|
|
20207
|
-
gl.deleteShader( glFragmentShader );
|
|
20259
|
+
}
|
|
20208
20260
|
|
|
20209
20261
|
// set up caching for uniform locations
|
|
20210
20262
|
|
|
@@ -20214,7 +20266,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20214
20266
|
|
|
20215
20267
|
if ( cachedUniforms === undefined ) {
|
|
20216
20268
|
|
|
20217
|
-
|
|
20269
|
+
// Populates cachedUniforms and cachedAttributes
|
|
20270
|
+
onFirstUse( this );
|
|
20218
20271
|
|
|
20219
20272
|
}
|
|
20220
20273
|
|
|
@@ -20230,7 +20283,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20230
20283
|
|
|
20231
20284
|
if ( cachedAttributes === undefined ) {
|
|
20232
20285
|
|
|
20233
|
-
|
|
20286
|
+
// Populates cachedAttributes and cachedUniforms
|
|
20287
|
+
onFirstUse( this );
|
|
20234
20288
|
|
|
20235
20289
|
}
|
|
20236
20290
|
|
|
@@ -20238,6 +20292,23 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20238
20292
|
|
|
20239
20293
|
};
|
|
20240
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
|
+
|
|
20241
20312
|
// free resource
|
|
20242
20313
|
|
|
20243
20314
|
this.destroy = function () {
|
|
@@ -20743,6 +20814,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20743
20814
|
rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
|
|
20744
20815
|
rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
|
|
20745
20816
|
rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
|
|
20817
|
+
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
20746
20818
|
|
|
20747
20819
|
customProgramCacheKey: material.customProgramCacheKey()
|
|
20748
20820
|
|
|
@@ -20885,6 +20957,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
20885
20957
|
_programLayers.enable( 16 );
|
|
20886
20958
|
if ( parameters.anisotropy )
|
|
20887
20959
|
_programLayers.enable( 17 );
|
|
20960
|
+
if ( parameters.alphaHash )
|
|
20961
|
+
_programLayers.enable( 18 );
|
|
20888
20962
|
|
|
20889
20963
|
array.push( _programLayers.mask );
|
|
20890
20964
|
_programLayers.disableAll();
|
|
@@ -22778,6 +22852,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
22778
22852
|
let currentBlendEquationAlpha = null;
|
|
22779
22853
|
let currentBlendSrcAlpha = null;
|
|
22780
22854
|
let currentBlendDstAlpha = null;
|
|
22855
|
+
let currentBlendColor = new Color( 0, 0, 0 );
|
|
22856
|
+
let currentBlendAlpha = 0;
|
|
22781
22857
|
let currentPremultipledAlpha = false;
|
|
22782
22858
|
|
|
22783
22859
|
let currentFlipSided = null;
|
|
@@ -23053,10 +23129,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23053
23129
|
[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,
|
|
23054
23130
|
[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,
|
|
23055
23131
|
[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,
|
|
23056
|
-
[ 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
|
|
23057
23137
|
};
|
|
23058
23138
|
|
|
23059
|
-
function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {
|
|
23139
|
+
function setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {
|
|
23060
23140
|
|
|
23061
23141
|
if ( blending === NoBlending ) {
|
|
23062
23142
|
|
|
@@ -23149,6 +23229,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23149
23229
|
currentBlendDst = null;
|
|
23150
23230
|
currentBlendSrcAlpha = null;
|
|
23151
23231
|
currentBlendDstAlpha = null;
|
|
23232
|
+
currentBlendColor.set( 0, 0, 0 );
|
|
23233
|
+
currentBlendAlpha = 0;
|
|
23152
23234
|
|
|
23153
23235
|
currentBlending = blending;
|
|
23154
23236
|
currentPremultipledAlpha = premultipliedAlpha;
|
|
@@ -23185,6 +23267,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23185
23267
|
|
|
23186
23268
|
}
|
|
23187
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
|
+
|
|
23188
23279
|
currentBlending = blending;
|
|
23189
23280
|
currentPremultipledAlpha = false;
|
|
23190
23281
|
|
|
@@ -23203,7 +23294,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23203
23294
|
|
|
23204
23295
|
( material.blending === NormalBlending && material.transparent === false )
|
|
23205
23296
|
? setBlending( NoBlending )
|
|
23206
|
-
: 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 );
|
|
23207
23298
|
|
|
23208
23299
|
depthBuffer.setFunc( material.depthFunc );
|
|
23209
23300
|
depthBuffer.setTest( material.depthTest );
|
|
@@ -23627,6 +23718,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23627
23718
|
gl.blendEquation( gl.FUNC_ADD );
|
|
23628
23719
|
gl.blendFunc( gl.ONE, gl.ZERO );
|
|
23629
23720
|
gl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );
|
|
23721
|
+
gl.blendColor( 0, 0, 0, 0 );
|
|
23630
23722
|
|
|
23631
23723
|
gl.colorMask( true, true, true, true );
|
|
23632
23724
|
gl.clearColor( 0, 0, 0, 0 );
|
|
@@ -23684,6 +23776,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
23684
23776
|
currentBlendEquationAlpha = null;
|
|
23685
23777
|
currentBlendSrcAlpha = null;
|
|
23686
23778
|
currentBlendDstAlpha = null;
|
|
23779
|
+
currentBlendColor = new Color( 0, 0, 0 );
|
|
23780
|
+
currentBlendAlpha = 0;
|
|
23687
23781
|
currentPremultipledAlpha = false;
|
|
23688
23782
|
|
|
23689
23783
|
currentFlipSided = null;
|
|
@@ -29670,7 +29764,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29670
29764
|
}
|
|
29671
29765
|
|
|
29672
29766
|
if ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;
|
|
29673
|
-
if ( stencil )
|
|
29767
|
+
if ( stencil ) {
|
|
29768
|
+
|
|
29769
|
+
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
29770
|
+
this.state.buffers.stencil.setMask( 0xffffffff );
|
|
29771
|
+
|
|
29772
|
+
}
|
|
29674
29773
|
|
|
29675
29774
|
_gl.clear( bits );
|
|
29676
29775
|
|
|
@@ -29953,36 +30052,40 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29953
30052
|
|
|
29954
30053
|
// Compile
|
|
29955
30054
|
|
|
29956
|
-
|
|
30055
|
+
function prepareMaterial( material, scene, object ) {
|
|
30056
|
+
|
|
30057
|
+
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
29957
30058
|
|
|
29958
|
-
|
|
30059
|
+
material.side = BackSide;
|
|
30060
|
+
material.needsUpdate = true;
|
|
30061
|
+
getProgram( material, scene, object );
|
|
29959
30062
|
|
|
29960
|
-
|
|
30063
|
+
material.side = FrontSide;
|
|
30064
|
+
material.needsUpdate = true;
|
|
30065
|
+
getProgram( material, scene, object );
|
|
29961
30066
|
|
|
29962
|
-
|
|
29963
|
-
material.needsUpdate = true;
|
|
29964
|
-
getProgram( material, scene, object );
|
|
30067
|
+
material.side = DoubleSide;
|
|
29965
30068
|
|
|
29966
|
-
|
|
29967
|
-
material.needsUpdate = true;
|
|
29968
|
-
getProgram( material, scene, object );
|
|
30069
|
+
} else {
|
|
29969
30070
|
|
|
29970
|
-
|
|
30071
|
+
getProgram( material, scene, object );
|
|
29971
30072
|
|
|
29972
|
-
|
|
30073
|
+
}
|
|
29973
30074
|
|
|
29974
|
-
|
|
30075
|
+
}
|
|
29975
30076
|
|
|
29976
|
-
|
|
30077
|
+
this.compile = function ( scene, camera, targetScene = null ) {
|
|
29977
30078
|
|
|
29978
|
-
|
|
30079
|
+
if ( targetScene === null ) targetScene = scene;
|
|
29979
30080
|
|
|
29980
|
-
currentRenderState = renderStates.get(
|
|
30081
|
+
currentRenderState = renderStates.get( targetScene );
|
|
29981
30082
|
currentRenderState.init();
|
|
29982
30083
|
|
|
29983
30084
|
renderStateStack.push( currentRenderState );
|
|
29984
30085
|
|
|
29985
|
-
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 ) {
|
|
29986
30089
|
|
|
29987
30090
|
if ( object.isLight && object.layers.test( camera.layers ) ) {
|
|
29988
30091
|
|
|
@@ -29998,8 +30101,32 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
29998
30101
|
|
|
29999
30102
|
} );
|
|
30000
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
|
+
|
|
30001
30124
|
currentRenderState.setupLights( _this._useLegacyLights );
|
|
30002
30125
|
|
|
30126
|
+
// Only initialize materials in the new scene, not the targetScene.
|
|
30127
|
+
|
|
30128
|
+
const materials = new Set();
|
|
30129
|
+
|
|
30003
30130
|
scene.traverse( function ( object ) {
|
|
30004
30131
|
|
|
30005
30132
|
const material = object.material;
|
|
@@ -30012,13 +30139,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30012
30139
|
|
|
30013
30140
|
const material2 = material[ i ];
|
|
30014
30141
|
|
|
30015
|
-
|
|
30142
|
+
prepareMaterial( material2, targetScene, object );
|
|
30143
|
+
materials.add( material2 );
|
|
30016
30144
|
|
|
30017
30145
|
}
|
|
30018
30146
|
|
|
30019
30147
|
} else {
|
|
30020
30148
|
|
|
30021
|
-
|
|
30149
|
+
prepareMaterial( material, targetScene, object );
|
|
30150
|
+
materials.add( material );
|
|
30022
30151
|
|
|
30023
30152
|
}
|
|
30024
30153
|
|
|
@@ -30029,6 +30158,70 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30029
30158
|
renderStateStack.pop();
|
|
30030
30159
|
currentRenderState = null;
|
|
30031
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
|
+
|
|
30032
30225
|
};
|
|
30033
30226
|
|
|
30034
30227
|
// Animation Loop
|
|
@@ -30382,6 +30575,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30382
30575
|
|
|
30383
30576
|
function renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {
|
|
30384
30577
|
|
|
30578
|
+
const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
|
|
30579
|
+
|
|
30580
|
+
if ( overrideMaterial !== null ) {
|
|
30581
|
+
|
|
30582
|
+
return;
|
|
30583
|
+
|
|
30584
|
+
}
|
|
30585
|
+
|
|
30385
30586
|
const isWebGL2 = capabilities.isWebGL2;
|
|
30386
30587
|
|
|
30387
30588
|
if ( _transmissionRenderTarget === null ) {
|
|
@@ -30641,16 +30842,26 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30641
30842
|
|
|
30642
30843
|
}
|
|
30643
30844
|
|
|
30644
|
-
const progUniforms = program.getUniforms();
|
|
30645
|
-
const uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, uniforms );
|
|
30646
|
-
|
|
30647
30845
|
materialProperties.currentProgram = program;
|
|
30648
|
-
materialProperties.uniformsList =
|
|
30846
|
+
materialProperties.uniformsList = null;
|
|
30649
30847
|
|
|
30650
30848
|
return program;
|
|
30651
30849
|
|
|
30652
30850
|
}
|
|
30653
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
|
+
|
|
30654
30865
|
function updateCommonMaterialProperties( material, parameters ) {
|
|
30655
30866
|
|
|
30656
30867
|
const materialProperties = properties.get( material );
|
|
@@ -30994,13 +31205,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
30994
31205
|
|
|
30995
31206
|
materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );
|
|
30996
31207
|
|
|
30997
|
-
WebGLUniforms.upload( _gl, materialProperties
|
|
31208
|
+
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
30998
31209
|
|
|
30999
31210
|
}
|
|
31000
31211
|
|
|
31001
31212
|
if ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {
|
|
31002
31213
|
|
|
31003
|
-
WebGLUniforms.upload( _gl, materialProperties
|
|
31214
|
+
WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
|
|
31004
31215
|
material.uniformsNeedUpdate = false;
|
|
31005
31216
|
|
|
31006
31217
|
}
|
|
@@ -32634,7 +32845,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32634
32845
|
|
|
32635
32846
|
this.type = 'SkinnedMesh';
|
|
32636
32847
|
|
|
32637
|
-
this.bindMode =
|
|
32848
|
+
this.bindMode = AttachedBindMode;
|
|
32638
32849
|
this.bindMatrix = new Matrix4();
|
|
32639
32850
|
this.bindMatrixInverse = new Matrix4();
|
|
32640
32851
|
|
|
@@ -32659,8 +32870,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32659
32870
|
|
|
32660
32871
|
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
32661
32872
|
|
|
32662
|
-
|
|
32663
|
-
this.applyBoneTransform( i, _vertex );
|
|
32873
|
+
this.getVertexPosition( i, _vertex );
|
|
32664
32874
|
this.boundingBox.expandByPoint( _vertex );
|
|
32665
32875
|
|
|
32666
32876
|
}
|
|
@@ -32683,8 +32893,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32683
32893
|
|
|
32684
32894
|
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
32685
32895
|
|
|
32686
|
-
|
|
32687
|
-
this.applyBoneTransform( i, _vertex );
|
|
32896
|
+
this.getVertexPosition( i, _vertex );
|
|
32688
32897
|
this.boundingSphere.expandByPoint( _vertex );
|
|
32689
32898
|
|
|
32690
32899
|
}
|
|
@@ -32810,11 +33019,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
32810
33019
|
|
|
32811
33020
|
super.updateMatrixWorld( force );
|
|
32812
33021
|
|
|
32813
|
-
if ( this.bindMode ===
|
|
33022
|
+
if ( this.bindMode === AttachedBindMode ) {
|
|
32814
33023
|
|
|
32815
33024
|
this.bindMatrixInverse.copy( this.matrixWorld ).invert();
|
|
32816
33025
|
|
|
32817
|
-
} else if ( this.bindMode ===
|
|
33026
|
+
} else if ( this.bindMode === DetachedBindMode ) {
|
|
32818
33027
|
|
|
32819
33028
|
this.bindMatrixInverse.copy( this.bindMatrix ).invert();
|
|
32820
33029
|
|
|
@@ -44713,11 +44922,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
44713
44922
|
if ( json.transparent !== undefined ) material.transparent = json.transparent;
|
|
44714
44923
|
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
|
|
44715
44924
|
if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
|
|
44925
|
+
if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
|
|
44716
44926
|
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
|
|
44717
44927
|
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
|
|
44718
44928
|
if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
|
|
44719
|
-
|
|
44720
|
-
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;
|
|
44721
44937
|
if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
|
|
44722
44938
|
if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
|
|
44723
44939
|
if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
|
|
@@ -44725,6 +44941,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
44725
44941
|
if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
|
|
44726
44942
|
if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
|
|
44727
44943
|
if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
|
|
44944
|
+
if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
|
|
44728
44945
|
|
|
44729
44946
|
if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
|
|
44730
44947
|
if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
|
|
@@ -52563,6 +52780,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52563
52780
|
exports.ArcCurve = ArcCurve;
|
|
52564
52781
|
exports.ArrayCamera = ArrayCamera;
|
|
52565
52782
|
exports.ArrowHelper = ArrowHelper;
|
|
52783
|
+
exports.AttachedBindMode = AttachedBindMode;
|
|
52566
52784
|
exports.Audio = Audio;
|
|
52567
52785
|
exports.AudioAnalyser = AudioAnalyser;
|
|
52568
52786
|
exports.AudioContext = AudioContext;
|
|
@@ -52601,6 +52819,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52601
52819
|
exports.CompressedTexture = CompressedTexture;
|
|
52602
52820
|
exports.CompressedTextureLoader = CompressedTextureLoader;
|
|
52603
52821
|
exports.ConeGeometry = ConeGeometry;
|
|
52822
|
+
exports.ConstantAlphaFactor = ConstantAlphaFactor;
|
|
52823
|
+
exports.ConstantColorFactor = ConstantColorFactor;
|
|
52604
52824
|
exports.CubeCamera = CubeCamera;
|
|
52605
52825
|
exports.CubeReflectionMapping = CubeReflectionMapping;
|
|
52606
52826
|
exports.CubeRefractionMapping = CubeRefractionMapping;
|
|
@@ -52631,6 +52851,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52631
52851
|
exports.DepthFormat = DepthFormat;
|
|
52632
52852
|
exports.DepthStencilFormat = DepthStencilFormat;
|
|
52633
52853
|
exports.DepthTexture = DepthTexture;
|
|
52854
|
+
exports.DetachedBindMode = DetachedBindMode;
|
|
52634
52855
|
exports.DirectionalLight = DirectionalLight;
|
|
52635
52856
|
exports.DirectionalLightHelper = DirectionalLightHelper;
|
|
52636
52857
|
exports.DiscreteInterpolant = DiscreteInterpolant;
|
|
@@ -52782,6 +53003,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
52782
53003
|
exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
|
|
52783
53004
|
exports.OctahedronGeometry = OctahedronGeometry;
|
|
52784
53005
|
exports.OneFactor = OneFactor;
|
|
53006
|
+
exports.OneMinusConstantAlphaFactor = OneMinusConstantAlphaFactor;
|
|
53007
|
+
exports.OneMinusConstantColorFactor = OneMinusConstantColorFactor;
|
|
52785
53008
|
exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
|
|
52786
53009
|
exports.OneMinusDstColorFactor = OneMinusDstColorFactor;
|
|
52787
53010
|
exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;
|