super-three 0.141.0 → 0.144.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 +8 -8
- package/build/three.cjs +1558 -1034
- package/build/three.js +1558 -1034
- package/build/three.min.js +1 -1
- package/build/three.module.js +2012 -1243
- package/examples/js/animation/MMDPhysics.js +1 -16
- package/examples/js/controls/ArcballControls.js +16 -3
- package/examples/js/controls/FirstPersonControls.js +0 -7
- package/examples/js/controls/FlyControls.js +0 -8
- package/examples/js/controls/OrbitControls.js +0 -4
- package/examples/js/controls/PointerLockControls.js +0 -8
- package/examples/js/controls/TrackballControls.js +0 -2
- package/examples/js/controls/TransformControls.js +20 -16
- package/examples/js/effects/AnaglyphEffect.js +2 -2
- package/examples/js/effects/OutlineEffect.js +4 -24
- package/examples/js/effects/ParallaxBarrierEffect.js +2 -2
- package/examples/js/effects/PeppersGhostEffect.js +2 -2
- package/examples/js/effects/StereoEffect.js +2 -2
- package/examples/js/environments/RoomEnvironment.js +22 -0
- package/examples/js/exporters/ColladaExporter.js +4 -13
- package/examples/js/exporters/DRACOExporter.js +0 -12
- package/examples/js/exporters/GLTFExporter.js +28 -29
- package/examples/js/exporters/OBJExporter.js +2 -23
- package/examples/js/exporters/PLYExporter.js +12 -24
- package/examples/js/exporters/STLExporter.js +0 -7
- package/examples/js/exporters/USDZExporter.js +6 -0
- package/examples/js/geometries/ConvexGeometry.js +1 -1
- package/examples/js/geometries/ParametricGeometry.js +1 -8
- package/examples/js/interactive/SelectionHelper.js +2 -0
- package/examples/js/libs/ktx-parse.umd.js +1 -0
- package/examples/js/libs/meshopt_decoder.js +98 -32
- package/examples/js/loaders/ColladaLoader.js +1 -0
- package/examples/js/loaders/DRACOLoader.js +2 -25
- package/examples/js/loaders/EXRLoader.js +2 -13
- package/examples/js/loaders/FBXLoader.js +10 -3
- package/examples/js/loaders/FontLoader.js +3 -16
- package/examples/js/loaders/GLTFLoader.js +52 -36
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -11
- package/examples/js/loaders/LDrawLoader.js +139 -74
- package/examples/js/loaders/OBJLoader.js +7 -13
- package/examples/js/loaders/PCDLoader.js +59 -14
- package/examples/js/loaders/PLYLoader.js +3 -3
- package/examples/js/loaders/SVGLoader.js +4 -3
- package/examples/js/loaders/TIFFLoader.js +31 -0
- package/examples/js/loaders/VRMLLoader.js +33 -24
- package/examples/js/loaders/VTKLoader.js +1 -1
- package/examples/js/loaders/lwo/LWO2Parser.js +8 -7
- package/examples/js/loaders/lwo/LWO3Parser.js +8 -7
- package/examples/js/materials/MeshGouraudMaterial.js +385 -0
- package/examples/js/math/ColorConverter.js +0 -50
- package/examples/js/misc/GPUComputationRenderer.js +23 -0
- package/examples/js/misc/Volume.js +198 -190
- package/examples/js/misc/VolumeSlice.js +90 -88
- package/examples/js/modifiers/SimplifyModifier.js +1 -1
- package/examples/js/objects/GroundProjectedEnv.js +193 -0
- package/examples/js/objects/Reflector.js +9 -2
- package/examples/js/objects/ReflectorForSSRPass.js +3 -4
- package/examples/js/objects/Refractor.js +10 -4
- package/examples/js/objects/ShadowMesh.js +5 -1
- package/examples/js/postprocessing/OutlinePass.js +5 -3
- package/examples/js/renderers/CSS2DRenderer.js +2 -2
- package/examples/js/renderers/CSS3DRenderer.js +2 -2
- package/examples/js/renderers/Projector.js +2 -23
- package/examples/js/shaders/LuminosityShader.js +1 -1
- package/examples/js/shaders/MMDToonShader.js +6 -2
- package/examples/js/shaders/ToneMapShader.js +1 -1
- package/examples/js/utils/BufferGeometryUtils.js +1 -1
- package/examples/js/utils/GeometryUtils.js +2 -18
- package/examples/js/utils/PackedPhongMaterial.js +1 -1
- package/examples/js/utils/SceneUtils.js +0 -16
- package/examples/jsm/animation/MMDPhysics.js +3 -22
- package/examples/jsm/controls/ArcballControls.js +17 -2
- package/examples/jsm/controls/FirstPersonControls.js +0 -7
- package/examples/jsm/controls/FlyControls.js +0 -7
- package/examples/jsm/controls/OrbitControls.js +0 -5
- package/examples/jsm/controls/PointerLockControls.js +0 -7
- package/examples/jsm/controls/TrackballControls.js +0 -3
- package/examples/jsm/controls/TransformControls.js +18 -16
- package/examples/jsm/effects/AnaglyphEffect.js +2 -2
- package/examples/jsm/effects/OutlineEffect.js +4 -25
- package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -2
- package/examples/jsm/effects/PeppersGhostEffect.js +2 -2
- package/examples/jsm/effects/StereoEffect.js +2 -2
- package/examples/jsm/environments/RoomEnvironment.js +23 -0
- package/examples/jsm/exporters/ColladaExporter.js +4 -13
- package/examples/jsm/exporters/DRACOExporter.js +0 -13
- package/examples/jsm/exporters/GLTFExporter.js +29 -31
- package/examples/jsm/exporters/KTX2Exporter.js +29 -29
- package/examples/jsm/exporters/OBJExporter.js +0 -18
- package/examples/jsm/exporters/PLYExporter.js +14 -22
- package/examples/jsm/exporters/STLExporter.js +1 -9
- package/examples/jsm/exporters/USDZExporter.js +14 -3
- package/examples/jsm/geometries/ConvexGeometry.js +1 -1
- package/examples/jsm/geometries/ParametricGeometry.js +0 -6
- package/examples/jsm/interactive/HTMLMesh.js +9 -9
- package/examples/jsm/interactive/SelectionHelper.js +5 -3
- package/examples/jsm/libs/meshopt_decoder.module.js +97 -32
- package/examples/jsm/libs/utif.module.js +1579 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/loaders/ColladaLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -28
- package/examples/jsm/loaders/EXRLoader.js +3 -13
- package/examples/jsm/loaders/FBXLoader.js +10 -3
- package/examples/jsm/loaders/FontLoader.js +3 -16
- package/examples/jsm/loaders/GLTFLoader.js +52 -36
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +0 -13
- package/examples/jsm/loaders/KTX2Loader.js +192 -30
- package/examples/jsm/loaders/LDrawLoader.js +135 -74
- package/examples/jsm/loaders/OBJLoader.js +6 -14
- package/examples/jsm/loaders/PCDLoader.js +59 -13
- package/examples/jsm/loaders/PLYLoader.js +3 -3
- package/examples/jsm/loaders/RGBELoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +4 -3
- package/examples/jsm/loaders/TIFFLoader.js +36 -0
- package/examples/jsm/loaders/USDZLoader.js +393 -0
- package/examples/jsm/loaders/VRMLLoader.js +23 -25
- package/examples/jsm/loaders/VTKLoader.js +1 -1
- package/examples/jsm/loaders/lwo/LWO2Parser.js +6 -8
- package/examples/jsm/loaders/lwo/LWO3Parser.js +6 -8
- package/examples/jsm/materials/MeshGouraudMaterial.js +423 -0
- package/examples/jsm/math/ColorConverter.js +1 -49
- package/examples/jsm/misc/GPUComputationRenderer.js +43 -0
- package/examples/jsm/misc/Volume.js +169 -171
- package/examples/jsm/misc/VolumeSlice.js +78 -80
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +1 -1
- package/examples/jsm/node-editor/accessors/NormalEditor.js +1 -1
- package/examples/jsm/node-editor/accessors/PositionEditor.js +1 -1
- package/examples/jsm/node-editor/accessors/UVEditor.js +1 -1
- package/examples/jsm/node-editor/display/BlendEditor.js +1 -1
- package/examples/jsm/node-editor/display/NormalMapEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/ColorEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/FloatEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/SliderEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/TextureEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +1 -1
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +1 -1
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +1 -1
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +1 -1
- package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +1 -1
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +1 -1
- package/examples/jsm/node-editor/math/AngleEditor.js +1 -1
- package/examples/jsm/node-editor/math/DotEditor.js +1 -1
- package/examples/jsm/node-editor/math/InvertEditor.js +1 -1
- package/examples/jsm/node-editor/math/LimiterEditor.js +1 -1
- package/examples/jsm/node-editor/math/NormalizeEditor.js +1 -1
- package/examples/jsm/node-editor/math/OperatorEditor.js +1 -1
- package/examples/jsm/node-editor/math/PowerEditor.js +1 -1
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +1 -1
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +1 -1
- package/examples/jsm/node-editor/utils/JoinEditor.js +1 -1
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
- package/examples/jsm/node-editor/utils/PreviewEditor.js +3 -3
- package/examples/jsm/node-editor/utils/SplitEditor.js +1 -1
- package/examples/jsm/node-editor/utils/TimerEditor.js +1 -1
- package/examples/jsm/nodes/Nodes.js +43 -13
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +9 -5
- package/examples/jsm/nodes/accessors/NormalNode.js +4 -4
- package/examples/jsm/nodes/accessors/PositionNode.js +5 -5
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +31 -0
- package/examples/jsm/nodes/core/AttributeNode.js +3 -3
- package/examples/jsm/nodes/core/CodeNode.js +3 -3
- package/examples/jsm/nodes/core/FunctionCallNode.js +20 -5
- package/examples/jsm/nodes/core/FunctionNode.js +2 -2
- package/examples/jsm/nodes/core/Node.js +14 -12
- package/examples/jsm/nodes/core/NodeBuilder.js +12 -12
- package/examples/jsm/nodes/core/NodeUtils.js +23 -1
- package/examples/jsm/nodes/core/{NodeVary.js → NodeVarying.js} +3 -3
- package/examples/jsm/nodes/core/{VaryNode.js → VaryingNode.js} +7 -7
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +94 -0
- package/examples/jsm/nodes/geometry/RangeNode.js +109 -0
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -0
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -7
- package/examples/jsm/nodes/lighting/LightingContextNode.js +4 -4
- package/examples/jsm/nodes/loaders/NodeLoader.js +2 -2
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +31 -0
- package/examples/jsm/nodes/materials/Materials.js +13 -25
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +70 -0
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +4 -7
- package/examples/jsm/nodes/materials/NodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +28 -17
- package/examples/jsm/nodes/materialx/Disclaimer.md +199 -0
- package/examples/jsm/nodes/materialx/functions/lib/mx_hsv.js +56 -0
- package/examples/jsm/nodes/materialx/functions/lib/mx_noise.js +607 -0
- package/examples/jsm/nodes/math/MathNode.js +2 -12
- package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +21 -6
- package/examples/jsm/nodes/procedural/CheckerNode.js +2 -2
- package/examples/jsm/nodes/shadernode/ShaderNode.js +5 -5
- package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +8 -5
- package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +20 -6
- package/examples/jsm/nodes/utils/ConvertNode.js +8 -3
- package/examples/jsm/nodes/utils/JoinNode.js +7 -7
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +2 -1
- package/examples/jsm/nodes/utils/RotateUVNode.js +32 -0
- package/examples/jsm/nodes/utils/SplitNode.js +21 -5
- package/examples/jsm/nodes/utils/TimerNode.js +2 -2
- package/examples/jsm/objects/GroundProjectedEnv.js +186 -0
- package/examples/jsm/objects/Reflector.js +12 -5
- package/examples/jsm/objects/ReflectorForSSRPass.js +3 -5
- package/examples/jsm/objects/Refractor.js +12 -6
- package/examples/jsm/objects/ShadowMesh.js +8 -2
- package/examples/jsm/postprocessing/OutlinePass.js +5 -3
- package/examples/jsm/renderers/CSS2DRenderer.js +2 -2
- package/examples/jsm/renderers/CSS3DRenderer.js +2 -2
- package/examples/jsm/renderers/Projector.js +2 -24
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +9 -5
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +329 -218
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +7 -3
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +39 -3
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +6 -0
- package/examples/jsm/renderers/webgpu/WebGPUGeometries.js +6 -0
- package/examples/jsm/renderers/webgpu/WebGPUObjects.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +17 -19
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +16 -14
- package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +66 -81
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +5 -3
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUUtils.js +81 -0
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +25 -30
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
- package/examples/jsm/shaders/LuminosityShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +2 -2
- package/examples/jsm/shaders/ToneMapShader.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +2 -1
- package/examples/jsm/utils/GeometryUtils.js +17 -25
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -1
- package/examples/jsm/utils/SceneUtils.js +1 -21
- package/examples/jsm/webxr/OculusHandPointerModel.js +6 -1
- package/examples/jsm/webxr/VRButton.js +1 -7
- package/package.json +18 -14
- package/src/Three.Legacy.js +262 -36
- package/src/Three.js +3 -2
- package/src/animation/AnimationAction.js +6 -5
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/AnimationMixer.js +1 -1
- package/src/animation/AnimationUtils.js +204 -199
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/PropertyBinding.js +24 -5
- package/src/cameras/CubeCamera.js +0 -7
- package/src/constants.js +2 -4
- package/src/core/BufferAttribute.js +81 -111
- package/src/core/BufferGeometry.js +3 -41
- package/src/core/InstancedBufferAttribute.js +0 -10
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +56 -7
- package/src/core/Object3D.js +22 -5
- package/src/core/Uniform.js +0 -7
- package/src/core/UniformsGroup.js +92 -0
- package/src/extras/DataUtils.js +104 -88
- package/src/extras/core/Path.js +1 -0
- package/src/extras/core/ShapePath.js +1 -4
- package/src/extras/curves/CatmullRomCurve3.js +4 -2
- package/src/geometries/BoxGeometry.js +1 -1
- package/src/geometries/CapsuleGeometry.js +1 -1
- package/src/geometries/CircleGeometry.js +1 -1
- package/src/geometries/ConeGeometry.js +1 -1
- package/src/geometries/CylinderGeometry.js +2 -1
- package/src/geometries/DodecahedronGeometry.js +1 -1
- package/src/geometries/EdgesGeometry.js +5 -4
- package/src/geometries/ExtrudeGeometry.js +2 -11
- package/src/geometries/IcosahedronGeometry.js +1 -1
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/geometries/OctahedronGeometry.js +1 -1
- package/src/geometries/PlaneGeometry.js +2 -1
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/geometries/RingGeometry.js +1 -1
- package/src/geometries/ShapeGeometry.js +2 -1
- package/src/geometries/SphereGeometry.js +2 -1
- package/src/geometries/TetrahedronGeometry.js +1 -1
- package/src/geometries/TorusGeometry.js +2 -1
- package/src/geometries/TorusKnotGeometry.js +2 -1
- package/src/geometries/TubeGeometry.js +2 -1
- package/src/geometries/WireframeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +97 -38
- package/src/helpers/DirectionalLightHelper.js +1 -0
- package/src/helpers/HemisphereLightHelper.js +1 -0
- package/src/helpers/PlaneHelper.js +6 -9
- package/src/helpers/PolarGridHelper.js +18 -14
- package/src/helpers/SpotLightHelper.js +1 -0
- package/src/lights/SpotLight.js +2 -0
- package/src/loaders/FileLoader.js +12 -1
- package/src/loaders/LoadingManager.js +1 -1
- package/src/loaders/MaterialLoader.js +49 -7
- package/src/loaders/ObjectLoader.js +4 -41
- package/src/materials/Material.js +1 -33
- package/src/materials/Materials.js +0 -27
- package/src/materials/MeshLambertMaterial.js +28 -1
- package/src/materials/ShaderMaterial.js +3 -7
- package/src/math/Color.js +3 -13
- package/src/math/MathUtils.js +1 -7
- package/src/math/Matrix3.js +1 -7
- package/src/math/Matrix4.js +3 -27
- package/src/math/Quaternion.js +1 -21
- package/src/math/Vector2.js +4 -24
- package/src/math/Vector3.js +7 -46
- package/src/math/Vector4.js +4 -24
- package/src/renderers/WebGLRenderer.js +84 -8
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +12 -12
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -5
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -5
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +24 -24
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +2 -1
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +113 -99
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +34 -12
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +30 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +3 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +13 -1
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +2 -4
- package/src/renderers/shaders/ShaderChunk/output_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +18 -7
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +8 -3
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +9 -6
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +14 -10
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +22 -50
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib.js +31 -31
- package/src/renderers/shaders/UniformsLib.js +12 -11
- package/src/renderers/shaders/UniformsUtils.js +14 -0
- package/src/renderers/webgl/WebGLBackground.js +2 -2
- package/src/renderers/webgl/WebGLLights.js +37 -13
- package/src/renderers/webgl/WebGLMorphtargets.js +0 -20
- package/src/renderers/webgl/WebGLProgram.js +6 -11
- package/src/renderers/webgl/WebGLPrograms.js +30 -26
- package/src/renderers/webgl/WebGLRenderLists.js +5 -4
- package/src/renderers/webgl/WebGLRenderStates.js +5 -4
- package/src/renderers/webgl/WebGLShaderCache.js +9 -6
- package/src/renderers/webgl/WebGLShadowMap.js +10 -15
- package/src/renderers/webgl/WebGLState.js +47 -0
- package/src/renderers/webgl/WebGLUniforms.js +4 -4
- package/src/renderers/webgl/WebGLUniformsGroups.js +372 -0
- package/src/renderers/webgl/WebGLUtils.js +2 -0
- package/src/renderers/webvr/WebVRManager.js +42 -9
- package/src/renderers/webvr/WebVRUtils.js +1 -1
- package/src/renderers/webxr/WebXRController.js +45 -37
- package/src/renderers/webxr/WebXRManager.js +58 -33
- package/src/scenes/Scene.js +16 -3
- package/src/textures/Source.js +1 -1
- package/src/utils.js +1 -1
- package/examples/js/controls/experimental/CameraControls.js +0 -1048
- package/examples/js/loaders/KTX2Loader.js +0 -558
- package/examples/jsm/controls/experimental/CameraControls.js +0 -1248
- package/examples/jsm/nodes/accessors/ReflectNode.js +0 -70
- package/examples/jsm/package.json +0 -3
- package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +0 -45
- package/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl.js +0 -122
package/build/three.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
|
|
10
10
|
})(this, (function (exports) { 'use strict';
|
|
11
11
|
|
|
12
|
-
const REVISION = '
|
|
12
|
+
const REVISION = '144';
|
|
13
13
|
const MOUSE = {
|
|
14
14
|
LEFT: 0,
|
|
15
15
|
MIDDLE: 1,
|
|
@@ -35,8 +35,6 @@
|
|
|
35
35
|
const FrontSide = 0;
|
|
36
36
|
const BackSide = 1;
|
|
37
37
|
const DoubleSide = 2;
|
|
38
|
-
const FlatShading = 1;
|
|
39
|
-
const SmoothShading = 2;
|
|
40
38
|
const NoBlending = 0;
|
|
41
39
|
const NormalBlending = 1;
|
|
42
40
|
const AdditiveBlending = 2;
|
|
@@ -107,7 +105,8 @@
|
|
|
107
105
|
const UnsignedShort5551Type = 1018;
|
|
108
106
|
const UnsignedInt248Type = 1020;
|
|
109
107
|
const AlphaFormat = 1021;
|
|
110
|
-
const RGBFormat = 1022;
|
|
108
|
+
const RGBFormat = 1022; // @deprecated since r137
|
|
109
|
+
|
|
111
110
|
const RGBAFormat = 1023;
|
|
112
111
|
const LuminanceFormat = 1024;
|
|
113
112
|
const LuminanceAlphaFormat = 1025;
|
|
@@ -254,12 +253,7 @@
|
|
|
254
253
|
|
|
255
254
|
}
|
|
256
255
|
|
|
257
|
-
const _lut = [];
|
|
258
|
-
|
|
259
|
-
for (let i = 0; i < 256; i++) {
|
|
260
|
-
_lut[i] = (i < 16 ? '0' : '') + i.toString(16);
|
|
261
|
-
}
|
|
262
|
-
|
|
256
|
+
const _lut = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff'];
|
|
263
257
|
let _seed = 1234567;
|
|
264
258
|
const DEG2RAD = Math.PI / 180;
|
|
265
259
|
const RAD2DEG = 180 / Math.PI; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
|
|
@@ -419,7 +413,7 @@
|
|
|
419
413
|
}
|
|
420
414
|
}
|
|
421
415
|
|
|
422
|
-
function denormalize
|
|
416
|
+
function denormalize(value, array) {
|
|
423
417
|
switch (array.constructor) {
|
|
424
418
|
case Float32Array:
|
|
425
419
|
return value;
|
|
@@ -488,12 +482,12 @@
|
|
|
488
482
|
floorPowerOfTwo: floorPowerOfTwo,
|
|
489
483
|
setQuaternionFromProperEuler: setQuaternionFromProperEuler,
|
|
490
484
|
normalize: normalize,
|
|
491
|
-
denormalize: denormalize
|
|
485
|
+
denormalize: denormalize
|
|
492
486
|
});
|
|
493
487
|
|
|
494
488
|
class Vector2 {
|
|
495
489
|
constructor(x = 0, y = 0) {
|
|
496
|
-
|
|
490
|
+
Vector2.prototype.isVector2 = true;
|
|
497
491
|
this.x = x;
|
|
498
492
|
this.y = y;
|
|
499
493
|
}
|
|
@@ -576,12 +570,7 @@
|
|
|
576
570
|
return this;
|
|
577
571
|
}
|
|
578
572
|
|
|
579
|
-
add(v
|
|
580
|
-
if (w !== undefined) {
|
|
581
|
-
console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
|
|
582
|
-
return this.addVectors(v, w);
|
|
583
|
-
}
|
|
584
|
-
|
|
573
|
+
add(v) {
|
|
585
574
|
this.x += v.x;
|
|
586
575
|
this.y += v.y;
|
|
587
576
|
return this;
|
|
@@ -605,12 +594,7 @@
|
|
|
605
594
|
return this;
|
|
606
595
|
}
|
|
607
596
|
|
|
608
|
-
sub(v
|
|
609
|
-
if (w !== undefined) {
|
|
610
|
-
console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
|
|
611
|
-
return this.subVectors(v, w);
|
|
612
|
-
}
|
|
613
|
-
|
|
597
|
+
sub(v) {
|
|
614
598
|
this.x -= v.x;
|
|
615
599
|
this.y -= v.y;
|
|
616
600
|
return this;
|
|
@@ -795,11 +779,7 @@
|
|
|
795
779
|
return array;
|
|
796
780
|
}
|
|
797
781
|
|
|
798
|
-
fromBufferAttribute(attribute, index
|
|
799
|
-
if (offset !== undefined) {
|
|
800
|
-
console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');
|
|
801
|
-
}
|
|
802
|
-
|
|
782
|
+
fromBufferAttribute(attribute, index) {
|
|
803
783
|
this.x = attribute.getX(index);
|
|
804
784
|
this.y = attribute.getY(index);
|
|
805
785
|
return this;
|
|
@@ -830,12 +810,8 @@
|
|
|
830
810
|
|
|
831
811
|
class Matrix3 {
|
|
832
812
|
constructor() {
|
|
833
|
-
|
|
813
|
+
Matrix3.prototype.isMatrix3 = true;
|
|
834
814
|
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
835
|
-
|
|
836
|
-
if (arguments.length > 0) {
|
|
837
|
-
console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.');
|
|
838
|
-
}
|
|
839
815
|
}
|
|
840
816
|
|
|
841
817
|
set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
|
|
@@ -1107,7 +1083,7 @@
|
|
|
1107
1083
|
function arrayNeedsUint32(array) {
|
|
1108
1084
|
// assumes larger values usually on last
|
|
1109
1085
|
for (let i = array.length - 1; i >= 0; --i) {
|
|
1110
|
-
if (array[i]
|
|
1086
|
+
if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
|
|
1111
1087
|
}
|
|
1112
1088
|
|
|
1113
1089
|
return false;
|
|
@@ -1480,11 +1456,11 @@
|
|
|
1480
1456
|
|
|
1481
1457
|
case 'hsl':
|
|
1482
1458
|
case 'hsla':
|
|
1483
|
-
if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
|
|
1459
|
+
if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
|
|
1484
1460
|
// hsl(120,50%,50%) hsla(120,50%,50%,0.5)
|
|
1485
1461
|
const h = parseFloat(color[1]) / 360;
|
|
1486
|
-
const s =
|
|
1487
|
-
const l =
|
|
1462
|
+
const s = parseFloat(color[2]) / 100;
|
|
1463
|
+
const l = parseFloat(color[3]) / 100;
|
|
1488
1464
|
handleAlpha(color[4]);
|
|
1489
1465
|
return this.setHSL(h, s, l, colorSpace);
|
|
1490
1466
|
}
|
|
@@ -1736,14 +1712,6 @@
|
|
|
1736
1712
|
this.r = attribute.getX(index);
|
|
1737
1713
|
this.g = attribute.getY(index);
|
|
1738
1714
|
this.b = attribute.getZ(index);
|
|
1739
|
-
|
|
1740
|
-
if (attribute.normalized === true) {
|
|
1741
|
-
// assuming Uint8Array
|
|
1742
|
-
this.r /= 255;
|
|
1743
|
-
this.g /= 255;
|
|
1744
|
-
this.b /= 255;
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
1715
|
return this;
|
|
1748
1716
|
}
|
|
1749
1717
|
|
|
@@ -1906,7 +1874,7 @@
|
|
|
1906
1874
|
if (image.data) {
|
|
1907
1875
|
// images of DataTexture
|
|
1908
1876
|
return {
|
|
1909
|
-
data: Array.
|
|
1877
|
+
data: Array.from(image.data),
|
|
1910
1878
|
width: image.width,
|
|
1911
1879
|
height: image.height,
|
|
1912
1880
|
type: image.data.constructor.name
|
|
@@ -2123,7 +2091,7 @@
|
|
|
2123
2091
|
|
|
2124
2092
|
class Vector4 {
|
|
2125
2093
|
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
2126
|
-
|
|
2094
|
+
Vector4.prototype.isVector4 = true;
|
|
2127
2095
|
this.x = x;
|
|
2128
2096
|
this.y = y;
|
|
2129
2097
|
this.z = z;
|
|
@@ -2238,12 +2206,7 @@
|
|
|
2238
2206
|
return this;
|
|
2239
2207
|
}
|
|
2240
2208
|
|
|
2241
|
-
add(v
|
|
2242
|
-
if (w !== undefined) {
|
|
2243
|
-
console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
|
|
2244
|
-
return this.addVectors(v, w);
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2209
|
+
add(v) {
|
|
2247
2210
|
this.x += v.x;
|
|
2248
2211
|
this.y += v.y;
|
|
2249
2212
|
this.z += v.z;
|
|
@@ -2275,12 +2238,7 @@
|
|
|
2275
2238
|
return this;
|
|
2276
2239
|
}
|
|
2277
2240
|
|
|
2278
|
-
sub(v
|
|
2279
|
-
if (w !== undefined) {
|
|
2280
|
-
console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
|
|
2281
|
-
return this.subVectors(v, w);
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2241
|
+
sub(v) {
|
|
2284
2242
|
this.x -= v.x;
|
|
2285
2243
|
this.y -= v.y;
|
|
2286
2244
|
this.z -= v.z;
|
|
@@ -2585,11 +2543,7 @@
|
|
|
2585
2543
|
return array;
|
|
2586
2544
|
}
|
|
2587
2545
|
|
|
2588
|
-
fromBufferAttribute(attribute, index
|
|
2589
|
-
if (offset !== undefined) {
|
|
2590
|
-
console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2546
|
+
fromBufferAttribute(attribute, index) {
|
|
2593
2547
|
this.x = attribute.getX(index);
|
|
2594
2548
|
this.y = attribute.getY(index);
|
|
2595
2549
|
this.z = attribute.getZ(index);
|
|
@@ -2824,11 +2778,6 @@
|
|
|
2824
2778
|
this._w = w;
|
|
2825
2779
|
}
|
|
2826
2780
|
|
|
2827
|
-
static slerp(qa, qb, qm, t) {
|
|
2828
|
-
console.warn('THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.');
|
|
2829
|
-
return qm.slerpQuaternions(qa, qb, t);
|
|
2830
|
-
}
|
|
2831
|
-
|
|
2832
2781
|
static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
|
|
2833
2782
|
// fuzz-free, array-based Quaternion SLERP operation
|
|
2834
2783
|
let x0 = src0[srcOffset0 + 0],
|
|
@@ -2973,10 +2922,6 @@
|
|
|
2973
2922
|
}
|
|
2974
2923
|
|
|
2975
2924
|
setFromEuler(euler, update) {
|
|
2976
|
-
if (!(euler && euler.isEuler)) {
|
|
2977
|
-
throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
2925
|
const x = euler._x,
|
|
2981
2926
|
y = euler._y,
|
|
2982
2927
|
z = euler._z,
|
|
@@ -3199,12 +3144,7 @@
|
|
|
3199
3144
|
return this;
|
|
3200
3145
|
}
|
|
3201
3146
|
|
|
3202
|
-
multiply(q
|
|
3203
|
-
if (p !== undefined) {
|
|
3204
|
-
console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.');
|
|
3205
|
-
return this.multiplyQuaternions(q, p);
|
|
3206
|
-
}
|
|
3207
|
-
|
|
3147
|
+
multiply(q) {
|
|
3208
3148
|
return this.multiplyQuaternions(this, q);
|
|
3209
3149
|
}
|
|
3210
3150
|
|
|
@@ -3354,7 +3294,7 @@
|
|
|
3354
3294
|
|
|
3355
3295
|
class Vector3 {
|
|
3356
3296
|
constructor(x = 0, y = 0, z = 0) {
|
|
3357
|
-
|
|
3297
|
+
Vector3.prototype.isVector3 = true;
|
|
3358
3298
|
this.x = x;
|
|
3359
3299
|
this.y = y;
|
|
3360
3300
|
this.z = z;
|
|
@@ -3439,12 +3379,7 @@
|
|
|
3439
3379
|
return this;
|
|
3440
3380
|
}
|
|
3441
3381
|
|
|
3442
|
-
add(v
|
|
3443
|
-
if (w !== undefined) {
|
|
3444
|
-
console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
|
|
3445
|
-
return this.addVectors(v, w);
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3382
|
+
add(v) {
|
|
3448
3383
|
this.x += v.x;
|
|
3449
3384
|
this.y += v.y;
|
|
3450
3385
|
this.z += v.z;
|
|
@@ -3472,12 +3407,7 @@
|
|
|
3472
3407
|
return this;
|
|
3473
3408
|
}
|
|
3474
3409
|
|
|
3475
|
-
sub(v
|
|
3476
|
-
if (w !== undefined) {
|
|
3477
|
-
console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
|
|
3478
|
-
return this.subVectors(v, w);
|
|
3479
|
-
}
|
|
3480
|
-
|
|
3410
|
+
sub(v) {
|
|
3481
3411
|
this.x -= v.x;
|
|
3482
3412
|
this.y -= v.y;
|
|
3483
3413
|
this.z -= v.z;
|
|
@@ -3498,12 +3428,7 @@
|
|
|
3498
3428
|
return this;
|
|
3499
3429
|
}
|
|
3500
3430
|
|
|
3501
|
-
multiply(v
|
|
3502
|
-
if (w !== undefined) {
|
|
3503
|
-
console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.');
|
|
3504
|
-
return this.multiplyVectors(v, w);
|
|
3505
|
-
}
|
|
3506
|
-
|
|
3431
|
+
multiply(v) {
|
|
3507
3432
|
this.x *= v.x;
|
|
3508
3433
|
this.y *= v.y;
|
|
3509
3434
|
this.z *= v.z;
|
|
@@ -3525,10 +3450,6 @@
|
|
|
3525
3450
|
}
|
|
3526
3451
|
|
|
3527
3452
|
applyEuler(euler) {
|
|
3528
|
-
if (!(euler && euler.isEuler)) {
|
|
3529
|
-
console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.');
|
|
3530
|
-
}
|
|
3531
|
-
|
|
3532
3453
|
return this.applyQuaternion(_quaternion$4.setFromEuler(euler));
|
|
3533
3454
|
}
|
|
3534
3455
|
|
|
@@ -3723,12 +3644,7 @@
|
|
|
3723
3644
|
return this;
|
|
3724
3645
|
}
|
|
3725
3646
|
|
|
3726
|
-
cross(v
|
|
3727
|
-
if (w !== undefined) {
|
|
3728
|
-
console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.');
|
|
3729
|
-
return this.crossVectors(v, w);
|
|
3730
|
-
}
|
|
3731
|
-
|
|
3647
|
+
cross(v) {
|
|
3732
3648
|
return this.crossVectors(this, v);
|
|
3733
3649
|
}
|
|
3734
3650
|
|
|
@@ -3861,11 +3777,7 @@
|
|
|
3861
3777
|
return array;
|
|
3862
3778
|
}
|
|
3863
3779
|
|
|
3864
|
-
fromBufferAttribute(attribute, index
|
|
3865
|
-
if (offset !== undefined) {
|
|
3866
|
-
console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');
|
|
3867
|
-
}
|
|
3868
|
-
|
|
3780
|
+
fromBufferAttribute(attribute, index) {
|
|
3869
3781
|
this.x = attribute.getX(index);
|
|
3870
3782
|
this.y = attribute.getY(index);
|
|
3871
3783
|
this.z = attribute.getZ(index);
|
|
@@ -4817,12 +4729,8 @@
|
|
|
4817
4729
|
|
|
4818
4730
|
class Matrix4 {
|
|
4819
4731
|
constructor() {
|
|
4820
|
-
|
|
4732
|
+
Matrix4.prototype.isMatrix4 = true;
|
|
4821
4733
|
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
4822
|
-
|
|
4823
|
-
if (arguments.length > 0) {
|
|
4824
|
-
console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.');
|
|
4825
|
-
}
|
|
4826
4734
|
}
|
|
4827
4735
|
|
|
4828
4736
|
set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
|
|
@@ -4935,10 +4843,6 @@
|
|
|
4935
4843
|
}
|
|
4936
4844
|
|
|
4937
4845
|
makeRotationFromEuler(euler) {
|
|
4938
|
-
if (!(euler && euler.isEuler)) {
|
|
4939
|
-
console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');
|
|
4940
|
-
}
|
|
4941
|
-
|
|
4942
4846
|
const te = this.elements;
|
|
4943
4847
|
const x = euler.x,
|
|
4944
4848
|
y = euler.y,
|
|
@@ -5095,12 +4999,7 @@
|
|
|
5095
4999
|
return this;
|
|
5096
5000
|
}
|
|
5097
5001
|
|
|
5098
|
-
multiply(m
|
|
5099
|
-
if (n !== undefined) {
|
|
5100
|
-
console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.');
|
|
5101
|
-
return this.multiplyMatrices(m, n);
|
|
5102
|
-
}
|
|
5103
|
-
|
|
5002
|
+
multiply(m) {
|
|
5104
5003
|
return this.multiplyMatrices(this, m);
|
|
5105
5004
|
}
|
|
5106
5005
|
|
|
@@ -5448,10 +5347,6 @@
|
|
|
5448
5347
|
}
|
|
5449
5348
|
|
|
5450
5349
|
makePerspective(left, right, top, bottom, near, far) {
|
|
5451
|
-
if (far === undefined) {
|
|
5452
|
-
console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');
|
|
5453
|
-
}
|
|
5454
|
-
|
|
5455
5350
|
const te = this.elements;
|
|
5456
5351
|
const x = 2 * near / (right - left);
|
|
5457
5352
|
const y = 2 * near / (top - bottom);
|
|
@@ -5935,6 +5830,8 @@
|
|
|
5935
5830
|
this.matrixWorld = new Matrix4();
|
|
5936
5831
|
this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;
|
|
5937
5832
|
this.matrixWorldNeedsUpdate = false;
|
|
5833
|
+
this.matrixWorldAutoUpdate = Object3D.DefaultMatrixWorldAutoUpdate; // checked by the renderer
|
|
5834
|
+
|
|
5938
5835
|
this.layers = new Layers();
|
|
5939
5836
|
this.visible = true;
|
|
5940
5837
|
this.castShadow = false;
|
|
@@ -6257,14 +6154,18 @@
|
|
|
6257
6154
|
const children = this.children;
|
|
6258
6155
|
|
|
6259
6156
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
6260
|
-
children[i]
|
|
6157
|
+
const child = children[i];
|
|
6158
|
+
|
|
6159
|
+
if (child.matrixWorldAutoUpdate === true || force === true) {
|
|
6160
|
+
child.updateMatrixWorld(force);
|
|
6161
|
+
}
|
|
6261
6162
|
}
|
|
6262
6163
|
}
|
|
6263
6164
|
|
|
6264
6165
|
updateWorldMatrix(updateParents, updateChildren) {
|
|
6265
6166
|
const parent = this.parent;
|
|
6266
6167
|
|
|
6267
|
-
if (updateParents === true && parent !== null) {
|
|
6168
|
+
if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) {
|
|
6268
6169
|
parent.updateWorldMatrix(true, false);
|
|
6269
6170
|
}
|
|
6270
6171
|
|
|
@@ -6281,7 +6182,11 @@
|
|
|
6281
6182
|
const children = this.children;
|
|
6282
6183
|
|
|
6283
6184
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
6284
|
-
children[i]
|
|
6185
|
+
const child = children[i];
|
|
6186
|
+
|
|
6187
|
+
if (child.matrixWorldAutoUpdate === true) {
|
|
6188
|
+
child.updateWorldMatrix(false, true);
|
|
6189
|
+
}
|
|
6285
6190
|
}
|
|
6286
6191
|
}
|
|
6287
6192
|
}
|
|
@@ -6352,7 +6257,7 @@
|
|
|
6352
6257
|
}
|
|
6353
6258
|
}
|
|
6354
6259
|
|
|
6355
|
-
if (this.environment && this.environment.isTexture) {
|
|
6260
|
+
if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) {
|
|
6356
6261
|
object.environment = this.environment.toJSON(meta).uuid;
|
|
6357
6262
|
}
|
|
6358
6263
|
} else if (this.isMesh || this.isLine || this.isPoints) {
|
|
@@ -6468,6 +6373,7 @@
|
|
|
6468
6373
|
this.matrixWorld.copy(source.matrixWorld);
|
|
6469
6374
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
6470
6375
|
this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
6376
|
+
this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
|
|
6471
6377
|
this.layers.mask = source.layers.mask;
|
|
6472
6378
|
this.visible = source.visible;
|
|
6473
6379
|
this.castShadow = source.castShadow;
|
|
@@ -6488,8 +6394,9 @@
|
|
|
6488
6394
|
|
|
6489
6395
|
}
|
|
6490
6396
|
|
|
6491
|
-
Object3D.DefaultUp = new Vector3(0, 1, 0);
|
|
6397
|
+
Object3D.DefaultUp = /*@__PURE__*/new Vector3(0, 1, 0);
|
|
6492
6398
|
Object3D.DefaultMatrixAutoUpdate = true;
|
|
6399
|
+
Object3D.DefaultMatrixWorldAutoUpdate = true;
|
|
6493
6400
|
|
|
6494
6401
|
const _v0$1 = /*@__PURE__*/new Vector3();
|
|
6495
6402
|
|
|
@@ -6834,13 +6741,6 @@
|
|
|
6834
6741
|
if (newValue === undefined) {
|
|
6835
6742
|
console.warn('THREE.Material: \'' + key + '\' parameter is undefined.');
|
|
6836
6743
|
continue;
|
|
6837
|
-
} // for backward compatibility if shading is set in the constructor
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
if (key === 'shading') {
|
|
6841
|
-
console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
|
|
6842
|
-
this.flatShading = newValue === FlatShading ? true : false;
|
|
6843
|
-
continue;
|
|
6844
6744
|
}
|
|
6845
6745
|
|
|
6846
6746
|
const currentValue = this[key];
|
|
@@ -7110,27 +7010,10 @@
|
|
|
7110
7010
|
|
|
7111
7011
|
set needsUpdate(value) {
|
|
7112
7012
|
if (value === true) this.version++;
|
|
7113
|
-
} // @deprecated since r131, f5803c62cc4a29d90744e9dc7811d086e354c1d8
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
get vertexTangents() {
|
|
7117
|
-
console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
|
|
7118
|
-
return false;
|
|
7119
|
-
}
|
|
7120
|
-
|
|
7121
|
-
set vertexTangents(value) {
|
|
7122
|
-
console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
|
|
7123
7013
|
}
|
|
7124
7014
|
|
|
7125
7015
|
}
|
|
7126
7016
|
|
|
7127
|
-
Material.fromType = function
|
|
7128
|
-
/*type*/
|
|
7129
|
-
() {
|
|
7130
|
-
// TODO: Behavior added in Materials.js
|
|
7131
|
-
return null;
|
|
7132
|
-
};
|
|
7133
|
-
|
|
7134
7017
|
class MeshBasicMaterial extends Material {
|
|
7135
7018
|
constructor(parameters) {
|
|
7136
7019
|
super();
|
|
@@ -7242,86 +7125,6 @@
|
|
|
7242
7125
|
return this;
|
|
7243
7126
|
}
|
|
7244
7127
|
|
|
7245
|
-
copyColorsArray(colors) {
|
|
7246
|
-
const array = this.array;
|
|
7247
|
-
let offset = 0;
|
|
7248
|
-
|
|
7249
|
-
for (let i = 0, l = colors.length; i < l; i++) {
|
|
7250
|
-
let color = colors[i];
|
|
7251
|
-
|
|
7252
|
-
if (color === undefined) {
|
|
7253
|
-
console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i);
|
|
7254
|
-
color = new Color();
|
|
7255
|
-
}
|
|
7256
|
-
|
|
7257
|
-
array[offset++] = color.r;
|
|
7258
|
-
array[offset++] = color.g;
|
|
7259
|
-
array[offset++] = color.b;
|
|
7260
|
-
}
|
|
7261
|
-
|
|
7262
|
-
return this;
|
|
7263
|
-
}
|
|
7264
|
-
|
|
7265
|
-
copyVector2sArray(vectors) {
|
|
7266
|
-
const array = this.array;
|
|
7267
|
-
let offset = 0;
|
|
7268
|
-
|
|
7269
|
-
for (let i = 0, l = vectors.length; i < l; i++) {
|
|
7270
|
-
let vector = vectors[i];
|
|
7271
|
-
|
|
7272
|
-
if (vector === undefined) {
|
|
7273
|
-
console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i);
|
|
7274
|
-
vector = new Vector2();
|
|
7275
|
-
}
|
|
7276
|
-
|
|
7277
|
-
array[offset++] = vector.x;
|
|
7278
|
-
array[offset++] = vector.y;
|
|
7279
|
-
}
|
|
7280
|
-
|
|
7281
|
-
return this;
|
|
7282
|
-
}
|
|
7283
|
-
|
|
7284
|
-
copyVector3sArray(vectors) {
|
|
7285
|
-
const array = this.array;
|
|
7286
|
-
let offset = 0;
|
|
7287
|
-
|
|
7288
|
-
for (let i = 0, l = vectors.length; i < l; i++) {
|
|
7289
|
-
let vector = vectors[i];
|
|
7290
|
-
|
|
7291
|
-
if (vector === undefined) {
|
|
7292
|
-
console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i);
|
|
7293
|
-
vector = new Vector3();
|
|
7294
|
-
}
|
|
7295
|
-
|
|
7296
|
-
array[offset++] = vector.x;
|
|
7297
|
-
array[offset++] = vector.y;
|
|
7298
|
-
array[offset++] = vector.z;
|
|
7299
|
-
}
|
|
7300
|
-
|
|
7301
|
-
return this;
|
|
7302
|
-
}
|
|
7303
|
-
|
|
7304
|
-
copyVector4sArray(vectors) {
|
|
7305
|
-
const array = this.array;
|
|
7306
|
-
let offset = 0;
|
|
7307
|
-
|
|
7308
|
-
for (let i = 0, l = vectors.length; i < l; i++) {
|
|
7309
|
-
let vector = vectors[i];
|
|
7310
|
-
|
|
7311
|
-
if (vector === undefined) {
|
|
7312
|
-
console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i);
|
|
7313
|
-
vector = new Vector4();
|
|
7314
|
-
}
|
|
7315
|
-
|
|
7316
|
-
array[offset++] = vector.x;
|
|
7317
|
-
array[offset++] = vector.y;
|
|
7318
|
-
array[offset++] = vector.z;
|
|
7319
|
-
array[offset++] = vector.w;
|
|
7320
|
-
}
|
|
7321
|
-
|
|
7322
|
-
return this;
|
|
7323
|
-
}
|
|
7324
|
-
|
|
7325
7128
|
applyMatrix3(m) {
|
|
7326
7129
|
if (this.itemSize === 2) {
|
|
7327
7130
|
for (let i = 0, l = this.count; i < l; i++) {
|
|
@@ -7381,48 +7184,67 @@
|
|
|
7381
7184
|
}
|
|
7382
7185
|
|
|
7383
7186
|
set(value, offset = 0) {
|
|
7187
|
+
// Matching BufferAttribute constructor, do not normalize the array.
|
|
7384
7188
|
this.array.set(value, offset);
|
|
7385
7189
|
return this;
|
|
7386
7190
|
}
|
|
7387
7191
|
|
|
7388
7192
|
getX(index) {
|
|
7389
|
-
|
|
7193
|
+
let x = this.array[index * this.itemSize];
|
|
7194
|
+
if (this.normalized) x = denormalize(x, this.array);
|
|
7195
|
+
return x;
|
|
7390
7196
|
}
|
|
7391
7197
|
|
|
7392
7198
|
setX(index, x) {
|
|
7199
|
+
if (this.normalized) x = normalize(x, this.array);
|
|
7393
7200
|
this.array[index * this.itemSize] = x;
|
|
7394
7201
|
return this;
|
|
7395
7202
|
}
|
|
7396
7203
|
|
|
7397
7204
|
getY(index) {
|
|
7398
|
-
|
|
7205
|
+
let y = this.array[index * this.itemSize + 1];
|
|
7206
|
+
if (this.normalized) y = denormalize(y, this.array);
|
|
7207
|
+
return y;
|
|
7399
7208
|
}
|
|
7400
7209
|
|
|
7401
7210
|
setY(index, y) {
|
|
7211
|
+
if (this.normalized) y = normalize(y, this.array);
|
|
7402
7212
|
this.array[index * this.itemSize + 1] = y;
|
|
7403
7213
|
return this;
|
|
7404
7214
|
}
|
|
7405
7215
|
|
|
7406
7216
|
getZ(index) {
|
|
7407
|
-
|
|
7217
|
+
let z = this.array[index * this.itemSize + 2];
|
|
7218
|
+
if (this.normalized) z = denormalize(z, this.array);
|
|
7219
|
+
return z;
|
|
7408
7220
|
}
|
|
7409
7221
|
|
|
7410
7222
|
setZ(index, z) {
|
|
7223
|
+
if (this.normalized) z = normalize(z, this.array);
|
|
7411
7224
|
this.array[index * this.itemSize + 2] = z;
|
|
7412
7225
|
return this;
|
|
7413
7226
|
}
|
|
7414
7227
|
|
|
7415
7228
|
getW(index) {
|
|
7416
|
-
|
|
7229
|
+
let w = this.array[index * this.itemSize + 3];
|
|
7230
|
+
if (this.normalized) w = denormalize(w, this.array);
|
|
7231
|
+
return w;
|
|
7417
7232
|
}
|
|
7418
7233
|
|
|
7419
7234
|
setW(index, w) {
|
|
7235
|
+
if (this.normalized) w = normalize(w, this.array);
|
|
7420
7236
|
this.array[index * this.itemSize + 3] = w;
|
|
7421
7237
|
return this;
|
|
7422
7238
|
}
|
|
7423
7239
|
|
|
7424
7240
|
setXY(index, x, y) {
|
|
7425
7241
|
index *= this.itemSize;
|
|
7242
|
+
|
|
7243
|
+
if (this.normalized) {
|
|
7244
|
+
x = normalize(x, this.array);
|
|
7245
|
+
y = normalize(y, this.array);
|
|
7246
|
+
}
|
|
7247
|
+
|
|
7426
7248
|
this.array[index + 0] = x;
|
|
7427
7249
|
this.array[index + 1] = y;
|
|
7428
7250
|
return this;
|
|
@@ -7430,6 +7252,13 @@
|
|
|
7430
7252
|
|
|
7431
7253
|
setXYZ(index, x, y, z) {
|
|
7432
7254
|
index *= this.itemSize;
|
|
7255
|
+
|
|
7256
|
+
if (this.normalized) {
|
|
7257
|
+
x = normalize(x, this.array);
|
|
7258
|
+
y = normalize(y, this.array);
|
|
7259
|
+
z = normalize(z, this.array);
|
|
7260
|
+
}
|
|
7261
|
+
|
|
7433
7262
|
this.array[index + 0] = x;
|
|
7434
7263
|
this.array[index + 1] = y;
|
|
7435
7264
|
this.array[index + 2] = z;
|
|
@@ -7438,6 +7267,14 @@
|
|
|
7438
7267
|
|
|
7439
7268
|
setXYZW(index, x, y, z, w) {
|
|
7440
7269
|
index *= this.itemSize;
|
|
7270
|
+
|
|
7271
|
+
if (this.normalized) {
|
|
7272
|
+
x = normalize(x, this.array);
|
|
7273
|
+
y = normalize(y, this.array);
|
|
7274
|
+
z = normalize(z, this.array);
|
|
7275
|
+
w = normalize(w, this.array);
|
|
7276
|
+
}
|
|
7277
|
+
|
|
7441
7278
|
this.array[index + 0] = x;
|
|
7442
7279
|
this.array[index + 1] = y;
|
|
7443
7280
|
this.array[index + 2] = z;
|
|
@@ -7458,13 +7295,30 @@
|
|
|
7458
7295
|
const data = {
|
|
7459
7296
|
itemSize: this.itemSize,
|
|
7460
7297
|
type: this.array.constructor.name,
|
|
7461
|
-
array: Array.
|
|
7298
|
+
array: Array.from(this.array),
|
|
7462
7299
|
normalized: this.normalized
|
|
7463
7300
|
};
|
|
7464
7301
|
if (this.name !== '') data.name = this.name;
|
|
7465
7302
|
if (this.usage !== StaticDrawUsage) data.usage = this.usage;
|
|
7466
7303
|
if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;
|
|
7467
7304
|
return data;
|
|
7305
|
+
} // @deprecated
|
|
7306
|
+
|
|
7307
|
+
|
|
7308
|
+
copyColorsArray() {
|
|
7309
|
+
console.error('THREE.BufferAttribute: copyColorsArray() was removed in r144.');
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7312
|
+
copyVector2sArray() {
|
|
7313
|
+
console.error('THREE.BufferAttribute: copyVector2sArray() was removed in r144.');
|
|
7314
|
+
}
|
|
7315
|
+
|
|
7316
|
+
copyVector3sArray() {
|
|
7317
|
+
console.error('THREE.BufferAttribute: copyVector3sArray() was removed in r144.');
|
|
7318
|
+
}
|
|
7319
|
+
|
|
7320
|
+
copyVector4sArray() {
|
|
7321
|
+
console.error('THREE.BufferAttribute: copyVector4sArray() was removed in r144.');
|
|
7468
7322
|
}
|
|
7469
7323
|
|
|
7470
7324
|
} //
|
|
@@ -8047,35 +7901,11 @@
|
|
|
8047
7901
|
this.normalizeNormals();
|
|
8048
7902
|
normalAttribute.needsUpdate = true;
|
|
8049
7903
|
}
|
|
8050
|
-
}
|
|
8051
|
-
|
|
8052
|
-
merge(geometry, offset) {
|
|
8053
|
-
if (!(geometry && geometry.isBufferGeometry)) {
|
|
8054
|
-
console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry);
|
|
8055
|
-
return;
|
|
8056
|
-
}
|
|
8057
|
-
|
|
8058
|
-
if (offset === undefined) {
|
|
8059
|
-
offset = 0;
|
|
8060
|
-
console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.');
|
|
8061
|
-
}
|
|
8062
|
-
|
|
8063
|
-
const attributes = this.attributes;
|
|
8064
|
-
|
|
8065
|
-
for (const key in attributes) {
|
|
8066
|
-
if (geometry.attributes[key] === undefined) continue;
|
|
8067
|
-
const attribute1 = attributes[key];
|
|
8068
|
-
const attributeArray1 = attribute1.array;
|
|
8069
|
-
const attribute2 = geometry.attributes[key];
|
|
8070
|
-
const attributeArray2 = attribute2.array;
|
|
8071
|
-
const attributeOffset = attribute2.itemSize * offset;
|
|
8072
|
-
const length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset);
|
|
7904
|
+
} // @deprecated since r144
|
|
8073
7905
|
|
|
8074
|
-
for (let i = 0, j = attributeOffset; i < length; i++, j++) {
|
|
8075
|
-
attributeArray1[j] = attributeArray2[i];
|
|
8076
|
-
}
|
|
8077
|
-
}
|
|
8078
7906
|
|
|
7907
|
+
merge() {
|
|
7908
|
+
console.error('THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead.');
|
|
8079
7909
|
return this;
|
|
8080
7910
|
}
|
|
8081
7911
|
|
|
@@ -8795,6 +8625,15 @@
|
|
|
8795
8625
|
}
|
|
8796
8626
|
|
|
8797
8627
|
return merged;
|
|
8628
|
+
}
|
|
8629
|
+
function cloneUniformsGroups(src) {
|
|
8630
|
+
const dst = [];
|
|
8631
|
+
|
|
8632
|
+
for (let u = 0; u < src.length; u++) {
|
|
8633
|
+
dst.push(src[u].clone());
|
|
8634
|
+
}
|
|
8635
|
+
|
|
8636
|
+
return dst;
|
|
8798
8637
|
} // Legacy
|
|
8799
8638
|
|
|
8800
8639
|
const UniformsUtils = {
|
|
@@ -8813,6 +8652,7 @@
|
|
|
8813
8652
|
this.type = 'ShaderMaterial';
|
|
8814
8653
|
this.defines = {};
|
|
8815
8654
|
this.uniforms = {};
|
|
8655
|
+
this.uniformsGroups = [];
|
|
8816
8656
|
this.vertexShader = default_vertex;
|
|
8817
8657
|
this.fragmentShader = default_fragment;
|
|
8818
8658
|
this.linewidth = 1;
|
|
@@ -8846,10 +8686,6 @@
|
|
|
8846
8686
|
this.glslVersion = null;
|
|
8847
8687
|
|
|
8848
8688
|
if (parameters !== undefined) {
|
|
8849
|
-
if (parameters.attributes !== undefined) {
|
|
8850
|
-
console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.');
|
|
8851
|
-
}
|
|
8852
|
-
|
|
8853
8689
|
this.setValues(parameters);
|
|
8854
8690
|
}
|
|
8855
8691
|
}
|
|
@@ -8859,6 +8695,7 @@
|
|
|
8859
8695
|
this.fragmentShader = source.fragmentShader;
|
|
8860
8696
|
this.vertexShader = source.vertexShader;
|
|
8861
8697
|
this.uniforms = cloneUniforms(source.uniforms);
|
|
8698
|
+
this.uniformsGroups = cloneUniformsGroups(source.uniformsGroups);
|
|
8862
8699
|
this.defines = Object.assign({}, source.defines);
|
|
8863
8700
|
this.wireframe = source.wireframe;
|
|
8864
8701
|
this.wireframeLinewidth = source.wireframeLinewidth;
|
|
@@ -9163,12 +9000,6 @@
|
|
|
9163
9000
|
constructor(near, far, renderTarget) {
|
|
9164
9001
|
super();
|
|
9165
9002
|
this.type = 'CubeCamera';
|
|
9166
|
-
|
|
9167
|
-
if (renderTarget.isWebGLCubeRenderTarget !== true) {
|
|
9168
|
-
console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.');
|
|
9169
|
-
return;
|
|
9170
|
-
}
|
|
9171
|
-
|
|
9172
9003
|
this.renderTarget = renderTarget;
|
|
9173
9004
|
const cameraPX = new PerspectiveCamera(fov, aspect, near, far);
|
|
9174
9005
|
cameraPX.layers = this.layers;
|
|
@@ -9855,11 +9686,11 @@
|
|
|
9855
9686
|
|
|
9856
9687
|
var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
|
|
9857
9688
|
|
|
9858
|
-
var bsdfs = "vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\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}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float 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\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\
|
|
9689
|
+
var bsdfs = "vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\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}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float 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\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\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 = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\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\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}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\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";
|
|
9859
9690
|
|
|
9860
|
-
var iridescence_fragment = "#ifdef USE_IRIDESCENCE\
|
|
9691
|
+
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\t return 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 R21 = R12;\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";
|
|
9861
9692
|
|
|
9862
|
-
var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 =
|
|
9693
|
+
var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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";
|
|
9863
9694
|
|
|
9864
9695
|
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";
|
|
9865
9696
|
|
|
@@ -9877,9 +9708,9 @@
|
|
|
9877
9708
|
|
|
9878
9709
|
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
|
|
9879
9710
|
|
|
9880
|
-
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3
|
|
9711
|
+
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
|
|
9881
9712
|
|
|
9882
|
-
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define
|
|
9713
|
+
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
9883
9714
|
|
|
9884
9715
|
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
|
|
9885
9716
|
|
|
@@ -9899,9 +9730,9 @@
|
|
|
9899
9730
|
|
|
9900
9731
|
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
|
|
9901
9732
|
|
|
9902
|
-
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
9733
|
+
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
9903
9734
|
|
|
9904
|
-
var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
|
|
9735
|
+
var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
|
|
9905
9736
|
|
|
9906
9737
|
var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";
|
|
9907
9738
|
|
|
@@ -9913,13 +9744,15 @@
|
|
|
9913
9744
|
|
|
9914
9745
|
var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
|
|
9915
9746
|
|
|
9916
|
-
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\
|
|
9747
|
+
var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
|
|
9917
9748
|
|
|
9918
9749
|
var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
|
|
9919
9750
|
|
|
9920
9751
|
var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
|
|
9921
9752
|
|
|
9922
|
-
var
|
|
9753
|
+
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
9754
|
+
|
|
9755
|
+
var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)";
|
|
9923
9756
|
|
|
9924
9757
|
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
|
|
9925
9758
|
|
|
@@ -9933,11 +9766,11 @@
|
|
|
9933
9766
|
|
|
9934
9767
|
var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)";
|
|
9935
9768
|
|
|
9936
|
-
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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( ( ior - 1.0 ) / ( 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).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_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
|
|
9769
|
+
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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 SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).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_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
|
|
9937
9770
|
|
|
9938
|
-
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};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, 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( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, 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}";
|
|
9771
|
+
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};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, 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( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, 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}";
|
|
9939
9772
|
|
|
9940
|
-
var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\
|
|
9773
|
+
var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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, geometry, 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 *= all( bvec2( 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, geometry, 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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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, geometry, 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\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\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 ], geometry.normal );\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";
|
|
9941
9774
|
|
|
9942
9775
|
var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\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( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
|
|
9943
9776
|
|
|
@@ -9981,7 +9814,7 @@
|
|
|
9981
9814
|
|
|
9982
9815
|
var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
|
|
9983
9816
|
|
|
9984
|
-
var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 =
|
|
9817
|
+
var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
|
|
9985
9818
|
|
|
9986
9819
|
var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
|
|
9987
9820
|
|
|
@@ -9991,7 +9824,7 @@
|
|
|
9991
9824
|
|
|
9992
9825
|
var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif";
|
|
9993
9826
|
|
|
9994
|
-
var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
|
|
9827
|
+
var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
|
|
9995
9828
|
|
|
9996
9829
|
var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
|
|
9997
9830
|
|
|
@@ -10007,13 +9840,13 @@
|
|
|
10007
9840
|
|
|
10008
9841
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
10009
9842
|
|
|
10010
|
-
var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\
|
|
9843
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
|
|
10011
9844
|
|
|
10012
|
-
var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\
|
|
9845
|
+
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
10013
9846
|
|
|
10014
|
-
var shadowmap_vertex = "#
|
|
9847
|
+
var shadowmap_vertex = "#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif";
|
|
10015
9848
|
|
|
10016
|
-
var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius,
|
|
9849
|
+
var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
|
|
10017
9850
|
|
|
10018
9851
|
var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
|
|
10019
9852
|
|
|
@@ -10031,7 +9864,7 @@
|
|
|
10031
9864
|
|
|
10032
9865
|
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
10033
9866
|
|
|
10034
|
-
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\
|
|
9867
|
+
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif";
|
|
10035
9868
|
|
|
10036
9869
|
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
|
|
10037
9870
|
|
|
@@ -10047,7 +9880,7 @@
|
|
|
10047
9880
|
|
|
10048
9881
|
var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif";
|
|
10049
9882
|
|
|
10050
|
-
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
|
|
9883
|
+
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
|
|
10051
9884
|
|
|
10052
9885
|
const vertex$g = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
10053
9886
|
const fragment$g = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
|
|
@@ -10068,10 +9901,10 @@
|
|
|
10068
9901
|
const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
|
|
10069
9902
|
|
|
10070
9903
|
const vertex$a = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
10071
|
-
const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <
|
|
9904
|
+
const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
10072
9905
|
|
|
10073
|
-
const vertex$9 = "#define LAMBERT\nvarying vec3
|
|
10074
|
-
const fragment$9 = "
|
|
9906
|
+
const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
9907
|
+
const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
10075
9908
|
|
|
10076
9909
|
const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
|
|
10077
9910
|
const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
@@ -10080,7 +9913,7 @@
|
|
|
10080
9913
|
const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
|
|
10081
9914
|
|
|
10082
9915
|
const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
10083
|
-
const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <
|
|
9916
|
+
const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
10084
9917
|
|
|
10085
9918
|
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 <uv2_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 <uv2_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}";
|
|
10086
9919
|
const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\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_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\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 <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 + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
|
|
@@ -10139,7 +9972,8 @@
|
|
|
10139
9972
|
gradientmap_pars_fragment: gradientmap_pars_fragment,
|
|
10140
9973
|
lightmap_fragment: lightmap_fragment,
|
|
10141
9974
|
lightmap_pars_fragment: lightmap_pars_fragment,
|
|
10142
|
-
|
|
9975
|
+
lights_lambert_fragment: lights_lambert_fragment,
|
|
9976
|
+
lights_lambert_pars_fragment: lights_lambert_pars_fragment,
|
|
10143
9977
|
lights_pars_begin: lights_pars_begin,
|
|
10144
9978
|
lights_toon_fragment: lights_toon_fragment,
|
|
10145
9979
|
lights_toon_pars_fragment: lights_toon_pars_fragment,
|
|
@@ -10244,7 +10078,7 @@
|
|
|
10244
10078
|
const UniformsLib = {
|
|
10245
10079
|
common: {
|
|
10246
10080
|
diffuse: {
|
|
10247
|
-
value: new Color(0xffffff)
|
|
10081
|
+
value: /*@__PURE__*/new Color(0xffffff)
|
|
10248
10082
|
},
|
|
10249
10083
|
opacity: {
|
|
10250
10084
|
value: 1.0
|
|
@@ -10253,10 +10087,10 @@
|
|
|
10253
10087
|
value: null
|
|
10254
10088
|
},
|
|
10255
10089
|
uvTransform: {
|
|
10256
|
-
value: new Matrix3()
|
|
10090
|
+
value: /*@__PURE__*/new Matrix3()
|
|
10257
10091
|
},
|
|
10258
10092
|
uv2Transform: {
|
|
10259
|
-
value: new Matrix3()
|
|
10093
|
+
value: /*@__PURE__*/new Matrix3()
|
|
10260
10094
|
},
|
|
10261
10095
|
alphaMap: {
|
|
10262
10096
|
value: null
|
|
@@ -10324,7 +10158,7 @@
|
|
|
10324
10158
|
value: null
|
|
10325
10159
|
},
|
|
10326
10160
|
normalScale: {
|
|
10327
|
-
value: new Vector2(1, 1)
|
|
10161
|
+
value: /*@__PURE__*/new Vector2(1, 1)
|
|
10328
10162
|
}
|
|
10329
10163
|
},
|
|
10330
10164
|
displacementmap: {
|
|
@@ -10364,7 +10198,7 @@
|
|
|
10364
10198
|
value: 2000
|
|
10365
10199
|
},
|
|
10366
10200
|
fogColor: {
|
|
10367
|
-
value: new Color(0xffffff)
|
|
10201
|
+
value: /*@__PURE__*/new Color(0xffffff)
|
|
10368
10202
|
}
|
|
10369
10203
|
},
|
|
10370
10204
|
lights: {
|
|
@@ -10417,10 +10251,13 @@
|
|
|
10417
10251
|
shadowMapSize: {}
|
|
10418
10252
|
}
|
|
10419
10253
|
},
|
|
10254
|
+
spotLightMap: {
|
|
10255
|
+
value: []
|
|
10256
|
+
},
|
|
10420
10257
|
spotShadowMap: {
|
|
10421
10258
|
value: []
|
|
10422
10259
|
},
|
|
10423
|
-
|
|
10260
|
+
spotLightMatrix: {
|
|
10424
10261
|
value: []
|
|
10425
10262
|
},
|
|
10426
10263
|
pointLights: {
|
|
@@ -10476,7 +10313,7 @@
|
|
|
10476
10313
|
},
|
|
10477
10314
|
points: {
|
|
10478
10315
|
diffuse: {
|
|
10479
|
-
value: new Color(0xffffff)
|
|
10316
|
+
value: /*@__PURE__*/new Color(0xffffff)
|
|
10480
10317
|
},
|
|
10481
10318
|
opacity: {
|
|
10482
10319
|
value: 1.0
|
|
@@ -10497,18 +10334,18 @@
|
|
|
10497
10334
|
value: 0
|
|
10498
10335
|
},
|
|
10499
10336
|
uvTransform: {
|
|
10500
|
-
value: new Matrix3()
|
|
10337
|
+
value: /*@__PURE__*/new Matrix3()
|
|
10501
10338
|
}
|
|
10502
10339
|
},
|
|
10503
10340
|
sprite: {
|
|
10504
10341
|
diffuse: {
|
|
10505
|
-
value: new Color(0xffffff)
|
|
10342
|
+
value: /*@__PURE__*/new Color(0xffffff)
|
|
10506
10343
|
},
|
|
10507
10344
|
opacity: {
|
|
10508
10345
|
value: 1.0
|
|
10509
10346
|
},
|
|
10510
10347
|
center: {
|
|
10511
|
-
value: new Vector2(0.5, 0.5)
|
|
10348
|
+
value: /*@__PURE__*/new Vector2(0.5, 0.5)
|
|
10512
10349
|
},
|
|
10513
10350
|
rotation: {
|
|
10514
10351
|
value: 0.0
|
|
@@ -10523,33 +10360,33 @@
|
|
|
10523
10360
|
value: 0
|
|
10524
10361
|
},
|
|
10525
10362
|
uvTransform: {
|
|
10526
|
-
value: new Matrix3()
|
|
10363
|
+
value: /*@__PURE__*/new Matrix3()
|
|
10527
10364
|
}
|
|
10528
10365
|
}
|
|
10529
10366
|
};
|
|
10530
10367
|
|
|
10531
10368
|
const ShaderLib = {
|
|
10532
10369
|
basic: {
|
|
10533
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),
|
|
10370
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),
|
|
10534
10371
|
vertexShader: ShaderChunk.meshbasic_vert,
|
|
10535
10372
|
fragmentShader: ShaderChunk.meshbasic_frag
|
|
10536
10373
|
},
|
|
10537
10374
|
lambert: {
|
|
10538
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.fog, UniformsLib.lights, {
|
|
10375
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10539
10376
|
emissive: {
|
|
10540
|
-
value: new Color(0x000000)
|
|
10377
|
+
value: /*@__PURE__*/new Color(0x000000)
|
|
10541
10378
|
}
|
|
10542
10379
|
}]),
|
|
10543
10380
|
vertexShader: ShaderChunk.meshlambert_vert,
|
|
10544
10381
|
fragmentShader: ShaderChunk.meshlambert_frag
|
|
10545
10382
|
},
|
|
10546
10383
|
phong: {
|
|
10547
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10384
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10548
10385
|
emissive: {
|
|
10549
|
-
value: new Color(0x000000)
|
|
10386
|
+
value: /*@__PURE__*/new Color(0x000000)
|
|
10550
10387
|
},
|
|
10551
10388
|
specular: {
|
|
10552
|
-
value: new Color(0x111111)
|
|
10389
|
+
value: /*@__PURE__*/new Color(0x111111)
|
|
10553
10390
|
},
|
|
10554
10391
|
shininess: {
|
|
10555
10392
|
value: 30
|
|
@@ -10559,9 +10396,9 @@
|
|
|
10559
10396
|
fragmentShader: ShaderChunk.meshphong_frag
|
|
10560
10397
|
},
|
|
10561
10398
|
standard: {
|
|
10562
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10399
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10563
10400
|
emissive: {
|
|
10564
|
-
value: new Color(0x000000)
|
|
10401
|
+
value: /*@__PURE__*/new Color(0x000000)
|
|
10565
10402
|
},
|
|
10566
10403
|
roughness: {
|
|
10567
10404
|
value: 1.0
|
|
@@ -10578,16 +10415,16 @@
|
|
|
10578
10415
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
10579
10416
|
},
|
|
10580
10417
|
toon: {
|
|
10581
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10418
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {
|
|
10582
10419
|
emissive: {
|
|
10583
|
-
value: new Color(0x000000)
|
|
10420
|
+
value: /*@__PURE__*/new Color(0x000000)
|
|
10584
10421
|
}
|
|
10585
10422
|
}]),
|
|
10586
10423
|
vertexShader: ShaderChunk.meshtoon_vert,
|
|
10587
10424
|
fragmentShader: ShaderChunk.meshtoon_frag
|
|
10588
10425
|
},
|
|
10589
10426
|
matcap: {
|
|
10590
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {
|
|
10427
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {
|
|
10591
10428
|
matcap: {
|
|
10592
10429
|
value: null
|
|
10593
10430
|
}
|
|
@@ -10596,12 +10433,12 @@
|
|
|
10596
10433
|
fragmentShader: ShaderChunk.meshmatcap_frag
|
|
10597
10434
|
},
|
|
10598
10435
|
points: {
|
|
10599
|
-
uniforms: mergeUniforms([UniformsLib.points, UniformsLib.fog]),
|
|
10436
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.points, UniformsLib.fog]),
|
|
10600
10437
|
vertexShader: ShaderChunk.points_vert,
|
|
10601
10438
|
fragmentShader: ShaderChunk.points_frag
|
|
10602
10439
|
},
|
|
10603
10440
|
dashed: {
|
|
10604
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.fog, {
|
|
10441
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.fog, {
|
|
10605
10442
|
scale: {
|
|
10606
10443
|
value: 1
|
|
10607
10444
|
},
|
|
@@ -10616,12 +10453,12 @@
|
|
|
10616
10453
|
fragmentShader: ShaderChunk.linedashed_frag
|
|
10617
10454
|
},
|
|
10618
10455
|
depth: {
|
|
10619
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),
|
|
10456
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),
|
|
10620
10457
|
vertexShader: ShaderChunk.depth_vert,
|
|
10621
10458
|
fragmentShader: ShaderChunk.depth_frag
|
|
10622
10459
|
},
|
|
10623
10460
|
normal: {
|
|
10624
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {
|
|
10461
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {
|
|
10625
10462
|
opacity: {
|
|
10626
10463
|
value: 1.0
|
|
10627
10464
|
}
|
|
@@ -10630,14 +10467,14 @@
|
|
|
10630
10467
|
fragmentShader: ShaderChunk.meshnormal_frag
|
|
10631
10468
|
},
|
|
10632
10469
|
sprite: {
|
|
10633
|
-
uniforms: mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),
|
|
10470
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),
|
|
10634
10471
|
vertexShader: ShaderChunk.sprite_vert,
|
|
10635
10472
|
fragmentShader: ShaderChunk.sprite_frag
|
|
10636
10473
|
},
|
|
10637
10474
|
background: {
|
|
10638
10475
|
uniforms: {
|
|
10639
10476
|
uvTransform: {
|
|
10640
|
-
value: new Matrix3()
|
|
10477
|
+
value: /*@__PURE__*/new Matrix3()
|
|
10641
10478
|
},
|
|
10642
10479
|
t2D: {
|
|
10643
10480
|
value: null
|
|
@@ -10646,12 +10483,8 @@
|
|
|
10646
10483
|
vertexShader: ShaderChunk.background_vert,
|
|
10647
10484
|
fragmentShader: ShaderChunk.background_frag
|
|
10648
10485
|
},
|
|
10649
|
-
|
|
10650
|
-
/* -------------------------------------------------------------------------
|
|
10651
|
-
// Cube map shader
|
|
10652
|
-
------------------------------------------------------------------------- */
|
|
10653
10486
|
cube: {
|
|
10654
|
-
uniforms: mergeUniforms([UniformsLib.envmap, {
|
|
10487
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.envmap, {
|
|
10655
10488
|
opacity: {
|
|
10656
10489
|
value: 1.0
|
|
10657
10490
|
}
|
|
@@ -10669,9 +10502,9 @@
|
|
|
10669
10502
|
fragmentShader: ShaderChunk.equirect_frag
|
|
10670
10503
|
},
|
|
10671
10504
|
distanceRGBA: {
|
|
10672
|
-
uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {
|
|
10505
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {
|
|
10673
10506
|
referencePosition: {
|
|
10674
|
-
value: new Vector3()
|
|
10507
|
+
value: /*@__PURE__*/new Vector3()
|
|
10675
10508
|
},
|
|
10676
10509
|
nearDistance: {
|
|
10677
10510
|
value: 1
|
|
@@ -10684,9 +10517,9 @@
|
|
|
10684
10517
|
fragmentShader: ShaderChunk.distanceRGBA_frag
|
|
10685
10518
|
},
|
|
10686
10519
|
shadow: {
|
|
10687
|
-
uniforms: mergeUniforms([UniformsLib.lights, UniformsLib.fog, {
|
|
10520
|
+
uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.lights, UniformsLib.fog, {
|
|
10688
10521
|
color: {
|
|
10689
|
-
value: new Color(0x00000)
|
|
10522
|
+
value: /*@__PURE__*/new Color(0x00000)
|
|
10690
10523
|
},
|
|
10691
10524
|
opacity: {
|
|
10692
10525
|
value: 1.0
|
|
@@ -10697,7 +10530,7 @@
|
|
|
10697
10530
|
}
|
|
10698
10531
|
};
|
|
10699
10532
|
ShaderLib.physical = {
|
|
10700
|
-
uniforms: mergeUniforms([ShaderLib.standard.uniforms, {
|
|
10533
|
+
uniforms: /*@__PURE__*/mergeUniforms([ShaderLib.standard.uniforms, {
|
|
10701
10534
|
clearcoat: {
|
|
10702
10535
|
value: 0
|
|
10703
10536
|
},
|
|
@@ -10711,7 +10544,7 @@
|
|
|
10711
10544
|
value: null
|
|
10712
10545
|
},
|
|
10713
10546
|
clearcoatNormalScale: {
|
|
10714
|
-
value: new Vector2(1, 1)
|
|
10547
|
+
value: /*@__PURE__*/new Vector2(1, 1)
|
|
10715
10548
|
},
|
|
10716
10549
|
clearcoatNormalMap: {
|
|
10717
10550
|
value: null
|
|
@@ -10738,7 +10571,7 @@
|
|
|
10738
10571
|
value: 0
|
|
10739
10572
|
},
|
|
10740
10573
|
sheenColor: {
|
|
10741
|
-
value: new Color(0x000000)
|
|
10574
|
+
value: /*@__PURE__*/new Color(0x000000)
|
|
10742
10575
|
},
|
|
10743
10576
|
sheenColorMap: {
|
|
10744
10577
|
value: null
|
|
@@ -10756,7 +10589,7 @@
|
|
|
10756
10589
|
value: null
|
|
10757
10590
|
},
|
|
10758
10591
|
transmissionSamplerSize: {
|
|
10759
|
-
value: new Vector2()
|
|
10592
|
+
value: /*@__PURE__*/new Vector2()
|
|
10760
10593
|
},
|
|
10761
10594
|
transmissionSamplerMap: {
|
|
10762
10595
|
value: null
|
|
@@ -10771,7 +10604,7 @@
|
|
|
10771
10604
|
value: 0
|
|
10772
10605
|
},
|
|
10773
10606
|
attenuationColor: {
|
|
10774
|
-
value: new Color(0x000000)
|
|
10607
|
+
value: /*@__PURE__*/new Color(0x000000)
|
|
10775
10608
|
},
|
|
10776
10609
|
specularIntensity: {
|
|
10777
10610
|
value: 1
|
|
@@ -10780,7 +10613,7 @@
|
|
|
10780
10613
|
value: null
|
|
10781
10614
|
},
|
|
10782
10615
|
specularColor: {
|
|
10783
|
-
value: new Color(1, 1, 1)
|
|
10616
|
+
value: /*@__PURE__*/new Color(1, 1, 1)
|
|
10784
10617
|
},
|
|
10785
10618
|
specularColorMap: {
|
|
10786
10619
|
value: null
|
|
@@ -10844,7 +10677,7 @@
|
|
|
10844
10677
|
|
|
10845
10678
|
boxMesh.onBeforeRender = function (renderer, scene, camera) {
|
|
10846
10679
|
this.matrixWorld.copyPosition(camera.matrixWorld);
|
|
10847
|
-
}; //
|
|
10680
|
+
}; // add "envMap" material property so the renderer can evaluate it like for built-in materials
|
|
10848
10681
|
|
|
10849
10682
|
|
|
10850
10683
|
Object.defineProperty(boxMesh.material, 'envMap', {
|
|
@@ -10880,7 +10713,7 @@
|
|
|
10880
10713
|
depthWrite: false,
|
|
10881
10714
|
fog: false
|
|
10882
10715
|
}));
|
|
10883
|
-
planeMesh.geometry.deleteAttribute('normal'); //
|
|
10716
|
+
planeMesh.geometry.deleteAttribute('normal'); // add "map" material property so the renderer can evaluate it like for built-in materials
|
|
10884
10717
|
|
|
10885
10718
|
Object.defineProperty(planeMesh.material, 'map', {
|
|
10886
10719
|
get: function () {
|
|
@@ -12860,13 +12693,6 @@
|
|
|
12860
12693
|
return Math.abs(b[1]) - Math.abs(a[1]);
|
|
12861
12694
|
}
|
|
12862
12695
|
|
|
12863
|
-
function denormalize(morph, attribute) {
|
|
12864
|
-
let denominator = 1;
|
|
12865
|
-
const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
|
|
12866
|
-
if (array instanceof Int8Array) denominator = 127;else if (array instanceof Int16Array) denominator = 32767;else if (array instanceof Int32Array) denominator = 2147483647;else console.error('THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array);
|
|
12867
|
-
morph.divideScalar(denominator);
|
|
12868
|
-
}
|
|
12869
|
-
|
|
12870
12696
|
function WebGLMorphtargets(gl, capabilities, textures) {
|
|
12871
12697
|
const influencesList = {};
|
|
12872
12698
|
const morphInfluences = new Float32Array(8);
|
|
@@ -12926,7 +12752,6 @@
|
|
|
12926
12752
|
|
|
12927
12753
|
if (hasMorphPosition === true) {
|
|
12928
12754
|
morph.fromBufferAttribute(morphTarget, j);
|
|
12929
|
-
if (morphTarget.normalized === true) denormalize(morph, morphTarget);
|
|
12930
12755
|
buffer[offset + stride + 0] = morph.x;
|
|
12931
12756
|
buffer[offset + stride + 1] = morph.y;
|
|
12932
12757
|
buffer[offset + stride + 2] = morph.z;
|
|
@@ -12935,7 +12760,6 @@
|
|
|
12935
12760
|
|
|
12936
12761
|
if (hasMorphNormals === true) {
|
|
12937
12762
|
morph.fromBufferAttribute(morphNormal, j);
|
|
12938
|
-
if (morphNormal.normalized === true) denormalize(morph, morphNormal);
|
|
12939
12763
|
buffer[offset + stride + 4] = morph.x;
|
|
12940
12764
|
buffer[offset + stride + 5] = morph.y;
|
|
12941
12765
|
buffer[offset + stride + 6] = morph.z;
|
|
@@ -12944,7 +12768,6 @@
|
|
|
12944
12768
|
|
|
12945
12769
|
if (hasMorphColors === true) {
|
|
12946
12770
|
morph.fromBufferAttribute(morphColor, j);
|
|
12947
|
-
if (morphColor.normalized === true) denormalize(morph, morphColor);
|
|
12948
12771
|
buffer[offset + stride + 8] = morph.x;
|
|
12949
12772
|
buffer[offset + stride + 9] = morph.y;
|
|
12950
12773
|
buffer[offset + stride + 10] = morph.z;
|
|
@@ -13152,10 +12975,10 @@
|
|
|
13152
12975
|
* like .set for an optional property of the object
|
|
13153
12976
|
*
|
|
13154
12977
|
*/
|
|
13155
|
-
const emptyTexture = new Texture();
|
|
13156
|
-
const emptyArrayTexture = new DataArrayTexture();
|
|
13157
|
-
const empty3dTexture = new Data3DTexture();
|
|
13158
|
-
const emptyCubeTexture = new CubeTexture(); // --- Utilities ---
|
|
12978
|
+
const emptyTexture = /*@__PURE__*/new Texture();
|
|
12979
|
+
const emptyArrayTexture = /*@__PURE__*/new DataArrayTexture();
|
|
12980
|
+
const empty3dTexture = /*@__PURE__*/new Data3DTexture();
|
|
12981
|
+
const emptyCubeTexture = /*@__PURE__*/new CubeTexture(); // --- Utilities ---
|
|
13159
12982
|
// Array Caches (provide typed arrays for temporary by size)
|
|
13160
12983
|
|
|
13161
12984
|
const arrayCacheF32 = [];
|
|
@@ -14054,7 +13877,8 @@
|
|
|
14054
13877
|
}
|
|
14055
13878
|
|
|
14056
13879
|
function replaceLightNums(string, parameters) {
|
|
14057
|
-
|
|
13880
|
+
const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;
|
|
13881
|
+
return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
|
|
14058
13882
|
}
|
|
14059
13883
|
|
|
14060
13884
|
function replaceClippingPlaneNums(string, parameters) {
|
|
@@ -14079,16 +13903,10 @@
|
|
|
14079
13903
|
} // Unroll Loops
|
|
14080
13904
|
|
|
14081
13905
|
|
|
14082
|
-
const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
|
|
14083
13906
|
const unrollLoopPattern = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
|
|
14084
13907
|
|
|
14085
13908
|
function unrollLoops(string) {
|
|
14086
|
-
return string.replace(unrollLoopPattern, loopReplacer)
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
function deprecatedLoopReplacer(match, start, end, snippet) {
|
|
14090
|
-
console.warn('WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.');
|
|
14091
|
-
return loopReplacer(match, start, end, snippet);
|
|
13909
|
+
return string.replace(unrollLoopPattern, loopReplacer);
|
|
14092
13910
|
}
|
|
14093
13911
|
|
|
14094
13912
|
function loopReplacer(match, start, end, snippet) {
|
|
@@ -14407,23 +14225,26 @@
|
|
|
14407
14225
|
|
|
14408
14226
|
_getShaderCacheForMaterial(material) {
|
|
14409
14227
|
const cache = this.materialCache;
|
|
14228
|
+
let set = cache.get(material);
|
|
14410
14229
|
|
|
14411
|
-
if (
|
|
14412
|
-
|
|
14230
|
+
if (set === undefined) {
|
|
14231
|
+
set = new Set();
|
|
14232
|
+
cache.set(material, set);
|
|
14413
14233
|
}
|
|
14414
14234
|
|
|
14415
|
-
return
|
|
14235
|
+
return set;
|
|
14416
14236
|
}
|
|
14417
14237
|
|
|
14418
14238
|
_getShaderStage(code) {
|
|
14419
14239
|
const cache = this.shaderCache;
|
|
14240
|
+
let stage = cache.get(code);
|
|
14420
14241
|
|
|
14421
|
-
if (
|
|
14422
|
-
|
|
14242
|
+
if (stage === undefined) {
|
|
14243
|
+
stage = new WebGLShaderStage(code);
|
|
14423
14244
|
cache.set(code, stage);
|
|
14424
14245
|
}
|
|
14425
14246
|
|
|
14426
|
-
return
|
|
14247
|
+
return stage;
|
|
14427
14248
|
}
|
|
14428
14249
|
|
|
14429
14250
|
}
|
|
@@ -14584,11 +14405,13 @@
|
|
|
14584
14405
|
numDirLights: lights.directional.length,
|
|
14585
14406
|
numPointLights: lights.point.length,
|
|
14586
14407
|
numSpotLights: lights.spot.length,
|
|
14408
|
+
numSpotLightMaps: lights.spotLightMap.length,
|
|
14587
14409
|
numRectAreaLights: lights.rectArea.length,
|
|
14588
14410
|
numHemiLights: lights.hemi.length,
|
|
14589
14411
|
numDirLightShadows: lights.directionalShadowMap.length,
|
|
14590
14412
|
numPointLightShadows: lights.pointShadowMap.length,
|
|
14591
14413
|
numSpotLightShadows: lights.spotShadowMap.length,
|
|
14414
|
+
numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
|
|
14592
14415
|
numClippingPlanes: clipping.numPlanes,
|
|
14593
14416
|
numClipIntersection: clipping.numIntersection,
|
|
14594
14417
|
dithering: material.dithering,
|
|
@@ -14655,11 +14478,13 @@
|
|
|
14655
14478
|
array.push(parameters.numDirLights);
|
|
14656
14479
|
array.push(parameters.numPointLights);
|
|
14657
14480
|
array.push(parameters.numSpotLights);
|
|
14481
|
+
array.push(parameters.numSpotLightMaps);
|
|
14658
14482
|
array.push(parameters.numHemiLights);
|
|
14659
14483
|
array.push(parameters.numRectAreaLights);
|
|
14660
14484
|
array.push(parameters.numDirLightShadows);
|
|
14661
14485
|
array.push(parameters.numPointLightShadows);
|
|
14662
14486
|
array.push(parameters.numSpotLightShadows);
|
|
14487
|
+
array.push(parameters.numSpotLightShadowsWithMaps);
|
|
14663
14488
|
array.push(parameters.shadowMapType);
|
|
14664
14489
|
array.push(parameters.toneMapping);
|
|
14665
14490
|
array.push(parameters.numClippingPlanes);
|
|
@@ -14703,35 +14528,35 @@
|
|
|
14703
14528
|
if (parameters.vertexUvs) _programLayers.enable(30);
|
|
14704
14529
|
if (parameters.vertexTangents) _programLayers.enable(31);
|
|
14705
14530
|
if (parameters.uvsVertexOnly) _programLayers.enable(32);
|
|
14706
|
-
if (parameters.fog) _programLayers.enable(33);
|
|
14707
14531
|
array.push(_programLayers.mask);
|
|
14708
14532
|
|
|
14709
14533
|
_programLayers.disableAll();
|
|
14710
14534
|
|
|
14711
|
-
if (parameters.
|
|
14712
|
-
if (parameters.
|
|
14713
|
-
if (parameters.
|
|
14714
|
-
if (parameters.
|
|
14715
|
-
if (parameters.
|
|
14716
|
-
if (parameters.
|
|
14717
|
-
if (parameters.
|
|
14718
|
-
if (parameters.
|
|
14719
|
-
if (parameters.
|
|
14720
|
-
if (parameters.
|
|
14721
|
-
if (parameters.
|
|
14722
|
-
if (parameters.
|
|
14723
|
-
if (parameters.
|
|
14724
|
-
if (parameters.
|
|
14725
|
-
if (parameters.
|
|
14726
|
-
if (parameters.
|
|
14727
|
-
if (parameters.
|
|
14728
|
-
if (parameters.
|
|
14729
|
-
if (parameters.
|
|
14730
|
-
if (parameters.
|
|
14731
|
-
if (parameters.
|
|
14732
|
-
if (parameters.
|
|
14733
|
-
if (parameters.
|
|
14734
|
-
if (parameters.
|
|
14535
|
+
if (parameters.fog) _programLayers.enable(0);
|
|
14536
|
+
if (parameters.useFog) _programLayers.enable(1);
|
|
14537
|
+
if (parameters.flatShading) _programLayers.enable(2);
|
|
14538
|
+
if (parameters.logarithmicDepthBuffer) _programLayers.enable(3);
|
|
14539
|
+
if (parameters.skinning) _programLayers.enable(4);
|
|
14540
|
+
if (parameters.morphTargets) _programLayers.enable(5);
|
|
14541
|
+
if (parameters.morphNormals) _programLayers.enable(6);
|
|
14542
|
+
if (parameters.morphColors) _programLayers.enable(7);
|
|
14543
|
+
if (parameters.premultipliedAlpha) _programLayers.enable(8);
|
|
14544
|
+
if (parameters.shadowMapEnabled) _programLayers.enable(9);
|
|
14545
|
+
if (parameters.physicallyCorrectLights) _programLayers.enable(10);
|
|
14546
|
+
if (parameters.doubleSided) _programLayers.enable(11);
|
|
14547
|
+
if (parameters.flipSided) _programLayers.enable(12);
|
|
14548
|
+
if (parameters.useDepthPacking) _programLayers.enable(13);
|
|
14549
|
+
if (parameters.dithering) _programLayers.enable(14);
|
|
14550
|
+
if (parameters.specularIntensityMap) _programLayers.enable(15);
|
|
14551
|
+
if (parameters.specularColorMap) _programLayers.enable(16);
|
|
14552
|
+
if (parameters.transmission) _programLayers.enable(17);
|
|
14553
|
+
if (parameters.transmissionMap) _programLayers.enable(18);
|
|
14554
|
+
if (parameters.thicknessMap) _programLayers.enable(19);
|
|
14555
|
+
if (parameters.sheen) _programLayers.enable(20);
|
|
14556
|
+
if (parameters.sheenColorMap) _programLayers.enable(21);
|
|
14557
|
+
if (parameters.sheenRoughnessMap) _programLayers.enable(22);
|
|
14558
|
+
if (parameters.decodeVideoTexture) _programLayers.enable(23);
|
|
14559
|
+
if (parameters.opaque) _programLayers.enable(24);
|
|
14735
14560
|
array.push(_programLayers.mask);
|
|
14736
14561
|
}
|
|
14737
14562
|
|
|
@@ -14965,17 +14790,18 @@
|
|
|
14965
14790
|
let lists = new WeakMap();
|
|
14966
14791
|
|
|
14967
14792
|
function get(scene, renderCallDepth) {
|
|
14793
|
+
const listArray = lists.get(scene);
|
|
14968
14794
|
let list;
|
|
14969
14795
|
|
|
14970
|
-
if (
|
|
14796
|
+
if (listArray === undefined) {
|
|
14971
14797
|
list = new WebGLRenderList();
|
|
14972
14798
|
lists.set(scene, [list]);
|
|
14973
14799
|
} else {
|
|
14974
|
-
if (renderCallDepth >=
|
|
14800
|
+
if (renderCallDepth >= listArray.length) {
|
|
14975
14801
|
list = new WebGLRenderList();
|
|
14976
|
-
|
|
14802
|
+
listArray.push(list);
|
|
14977
14803
|
} else {
|
|
14978
|
-
list =
|
|
14804
|
+
list = listArray[renderCallDepth];
|
|
14979
14805
|
}
|
|
14980
14806
|
}
|
|
14981
14807
|
|
|
@@ -15105,8 +14931,8 @@
|
|
|
15105
14931
|
|
|
15106
14932
|
let nextVersion = 0;
|
|
15107
14933
|
|
|
15108
|
-
function
|
|
15109
|
-
return (lightB.castShadow ?
|
|
14934
|
+
function shadowCastingAndTexturingLightsFirst(lightA, lightB) {
|
|
14935
|
+
return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0);
|
|
15110
14936
|
}
|
|
15111
14937
|
|
|
15112
14938
|
function WebGLLights(extensions, capabilities) {
|
|
@@ -15122,7 +14948,8 @@
|
|
|
15122
14948
|
hemiLength: -1,
|
|
15123
14949
|
numDirectionalShadows: -1,
|
|
15124
14950
|
numPointShadows: -1,
|
|
15125
|
-
numSpotShadows: -1
|
|
14951
|
+
numSpotShadows: -1,
|
|
14952
|
+
numSpotMaps: -1
|
|
15126
14953
|
},
|
|
15127
14954
|
ambient: [0, 0, 0],
|
|
15128
14955
|
probe: [],
|
|
@@ -15131,9 +14958,10 @@
|
|
|
15131
14958
|
directionalShadowMap: [],
|
|
15132
14959
|
directionalShadowMatrix: [],
|
|
15133
14960
|
spot: [],
|
|
14961
|
+
spotLightMap: [],
|
|
15134
14962
|
spotShadow: [],
|
|
15135
14963
|
spotShadowMap: [],
|
|
15136
|
-
|
|
14964
|
+
spotLightMatrix: [],
|
|
15137
14965
|
rectArea: [],
|
|
15138
14966
|
rectAreaLTC1: null,
|
|
15139
14967
|
rectAreaLTC2: null,
|
|
@@ -15141,7 +14969,8 @@
|
|
|
15141
14969
|
pointShadow: [],
|
|
15142
14970
|
pointShadowMap: [],
|
|
15143
14971
|
pointShadowMatrix: [],
|
|
15144
|
-
hemi: []
|
|
14972
|
+
hemi: [],
|
|
14973
|
+
numSpotLightShadowsWithMaps: 0
|
|
15145
14974
|
};
|
|
15146
14975
|
|
|
15147
14976
|
for (let i = 0; i < 9; i++) state.probe.push(new Vector3());
|
|
@@ -15165,7 +14994,10 @@
|
|
|
15165
14994
|
let numDirectionalShadows = 0;
|
|
15166
14995
|
let numPointShadows = 0;
|
|
15167
14996
|
let numSpotShadows = 0;
|
|
15168
|
-
|
|
14997
|
+
let numSpotMaps = 0;
|
|
14998
|
+
let numSpotShadowsWithMaps = 0; // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
|
|
14999
|
+
|
|
15000
|
+
lights.sort(shadowCastingAndTexturingLightsFirst); // artist-friendly light intensity scaling factor
|
|
15169
15001
|
|
|
15170
15002
|
const scaleFactor = physicallyCorrectLights !== true ? Math.PI : 1;
|
|
15171
15003
|
|
|
@@ -15211,9 +15043,21 @@
|
|
|
15211
15043
|
uniforms.coneCos = Math.cos(light.angle);
|
|
15212
15044
|
uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));
|
|
15213
15045
|
uniforms.decay = light.decay;
|
|
15046
|
+
state.spot[spotLength] = uniforms;
|
|
15047
|
+
const shadow = light.shadow;
|
|
15048
|
+
|
|
15049
|
+
if (light.map) {
|
|
15050
|
+
state.spotLightMap[numSpotMaps] = light.map;
|
|
15051
|
+
numSpotMaps++; // make sure the lightMatrix is up to date
|
|
15052
|
+
// TODO : do it if required only
|
|
15053
|
+
|
|
15054
|
+
shadow.updateMatrices(light);
|
|
15055
|
+
if (light.castShadow) numSpotShadowsWithMaps++;
|
|
15056
|
+
}
|
|
15057
|
+
|
|
15058
|
+
state.spotLightMatrix[spotLength] = shadow.matrix;
|
|
15214
15059
|
|
|
15215
15060
|
if (light.castShadow) {
|
|
15216
|
-
const shadow = light.shadow;
|
|
15217
15061
|
const shadowUniforms = shadowCache.get(light);
|
|
15218
15062
|
shadowUniforms.shadowBias = shadow.bias;
|
|
15219
15063
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
@@ -15221,11 +15065,9 @@
|
|
|
15221
15065
|
shadowUniforms.shadowMapSize = shadow.mapSize;
|
|
15222
15066
|
state.spotShadow[spotLength] = shadowUniforms;
|
|
15223
15067
|
state.spotShadowMap[spotLength] = shadowMap;
|
|
15224
|
-
state.spotShadowMatrix[spotLength] = light.shadow.matrix;
|
|
15225
15068
|
numSpotShadows++;
|
|
15226
15069
|
}
|
|
15227
15070
|
|
|
15228
|
-
state.spot[spotLength] = uniforms;
|
|
15229
15071
|
spotLength++;
|
|
15230
15072
|
} else if (light.isRectAreaLight) {
|
|
15231
15073
|
const uniforms = cache.get(light); // (a) intensity is the total visible light emitted
|
|
@@ -15293,7 +15135,7 @@
|
|
|
15293
15135
|
state.ambient[2] = b;
|
|
15294
15136
|
const hash = state.hash;
|
|
15295
15137
|
|
|
15296
|
-
if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) {
|
|
15138
|
+
if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps) {
|
|
15297
15139
|
state.directional.length = directionalLength;
|
|
15298
15140
|
state.spot.length = spotLength;
|
|
15299
15141
|
state.rectArea.length = rectAreaLength;
|
|
@@ -15307,7 +15149,9 @@
|
|
|
15307
15149
|
state.spotShadowMap.length = numSpotShadows;
|
|
15308
15150
|
state.directionalShadowMatrix.length = numDirectionalShadows;
|
|
15309
15151
|
state.pointShadowMatrix.length = numPointShadows;
|
|
15310
|
-
state.
|
|
15152
|
+
state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
|
|
15153
|
+
state.spotLightMap.length = numSpotMaps;
|
|
15154
|
+
state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
|
|
15311
15155
|
hash.directionalLength = directionalLength;
|
|
15312
15156
|
hash.pointLength = pointLength;
|
|
15313
15157
|
hash.spotLength = spotLength;
|
|
@@ -15316,6 +15160,7 @@
|
|
|
15316
15160
|
hash.numDirectionalShadows = numDirectionalShadows;
|
|
15317
15161
|
hash.numPointShadows = numPointShadows;
|
|
15318
15162
|
hash.numSpotShadows = numSpotShadows;
|
|
15163
|
+
hash.numSpotMaps = numSpotMaps;
|
|
15319
15164
|
state.version = nextVersion++;
|
|
15320
15165
|
}
|
|
15321
15166
|
}
|
|
@@ -15427,17 +15272,18 @@
|
|
|
15427
15272
|
let renderStates = new WeakMap();
|
|
15428
15273
|
|
|
15429
15274
|
function get(scene, renderCallDepth = 0) {
|
|
15275
|
+
const renderStateArray = renderStates.get(scene);
|
|
15430
15276
|
let renderState;
|
|
15431
15277
|
|
|
15432
|
-
if (
|
|
15278
|
+
if (renderStateArray === undefined) {
|
|
15433
15279
|
renderState = new WebGLRenderState(extensions, capabilities);
|
|
15434
15280
|
renderStates.set(scene, [renderState]);
|
|
15435
15281
|
} else {
|
|
15436
|
-
if (renderCallDepth >=
|
|
15282
|
+
if (renderCallDepth >= renderStateArray.length) {
|
|
15437
15283
|
renderState = new WebGLRenderState(extensions, capabilities);
|
|
15438
|
-
|
|
15284
|
+
renderStateArray.push(renderState);
|
|
15439
15285
|
} else {
|
|
15440
|
-
renderState =
|
|
15286
|
+
renderState = renderStateArray[renderCallDepth];
|
|
15441
15287
|
}
|
|
15442
15288
|
}
|
|
15443
15289
|
|
|
@@ -15621,19 +15467,11 @@
|
|
|
15621
15467
|
}
|
|
15622
15468
|
}
|
|
15623
15469
|
|
|
15624
|
-
if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) {
|
|
15625
|
-
shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);
|
|
15626
|
-
shadow.map.texture.name = light.name + '.shadowMap';
|
|
15627
|
-
shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);
|
|
15628
|
-
shadow.camera.updateProjectionMatrix();
|
|
15629
|
-
}
|
|
15630
|
-
|
|
15631
15470
|
if (shadow.map === null) {
|
|
15632
|
-
const pars = {
|
|
15471
|
+
const pars = this.type !== VSMShadowMap ? {
|
|
15633
15472
|
minFilter: NearestFilter,
|
|
15634
|
-
magFilter: NearestFilter
|
|
15635
|
-
|
|
15636
|
-
};
|
|
15473
|
+
magFilter: NearestFilter
|
|
15474
|
+
} : {};
|
|
15637
15475
|
shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
|
|
15638
15476
|
shadow.map.texture.name = light.name + '.shadowMap';
|
|
15639
15477
|
shadow.camera.updateProjectionMatrix();
|
|
@@ -15658,7 +15496,7 @@
|
|
|
15658
15496
|
} // do blur pass for VSM
|
|
15659
15497
|
|
|
15660
15498
|
|
|
15661
|
-
if (
|
|
15499
|
+
if (shadow.isPointLightShadow !== true && this.type === VSMShadowMap) {
|
|
15662
15500
|
VSMPass(shadow, camera);
|
|
15663
15501
|
}
|
|
15664
15502
|
|
|
@@ -15678,6 +15516,10 @@
|
|
|
15678
15516
|
shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;
|
|
15679
15517
|
shadowMaterialVertical.needsUpdate = true;
|
|
15680
15518
|
shadowMaterialHorizontal.needsUpdate = true;
|
|
15519
|
+
}
|
|
15520
|
+
|
|
15521
|
+
if (shadow.mapPass === null) {
|
|
15522
|
+
shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);
|
|
15681
15523
|
} // vertical pass
|
|
15682
15524
|
|
|
15683
15525
|
|
|
@@ -15713,7 +15555,7 @@
|
|
|
15713
15555
|
result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
|
|
15714
15556
|
}
|
|
15715
15557
|
|
|
15716
|
-
if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
|
|
15558
|
+
if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
|
|
15717
15559
|
// in this case we need a unique material instance reflecting the
|
|
15718
15560
|
// appropriate state
|
|
15719
15561
|
const keyA = result.uuid,
|
|
@@ -15997,6 +15839,8 @@
|
|
|
15997
15839
|
const colorBuffer = new ColorBuffer();
|
|
15998
15840
|
const depthBuffer = new DepthBuffer();
|
|
15999
15841
|
const stencilBuffer = new StencilBuffer();
|
|
15842
|
+
const uboBindings = new WeakMap();
|
|
15843
|
+
const uboProgamMap = new WeakMap();
|
|
16000
15844
|
let enabledCapabilities = {};
|
|
16001
15845
|
let currentBoundFramebuffers = {};
|
|
16002
15846
|
let currentDrawbuffers = new WeakMap();
|
|
@@ -16495,6 +16339,33 @@
|
|
|
16495
16339
|
gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);
|
|
16496
16340
|
currentViewport.copy(viewport);
|
|
16497
16341
|
}
|
|
16342
|
+
}
|
|
16343
|
+
|
|
16344
|
+
function updateUBOMapping(uniformsGroup, program) {
|
|
16345
|
+
let mapping = uboProgamMap.get(program);
|
|
16346
|
+
|
|
16347
|
+
if (mapping === undefined) {
|
|
16348
|
+
mapping = new WeakMap();
|
|
16349
|
+
uboProgamMap.set(program, mapping);
|
|
16350
|
+
}
|
|
16351
|
+
|
|
16352
|
+
let blockIndex = mapping.get(uniformsGroup);
|
|
16353
|
+
|
|
16354
|
+
if (blockIndex === undefined) {
|
|
16355
|
+
blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name);
|
|
16356
|
+
mapping.set(uniformsGroup, blockIndex);
|
|
16357
|
+
}
|
|
16358
|
+
}
|
|
16359
|
+
|
|
16360
|
+
function uniformBlockBinding(uniformsGroup, program) {
|
|
16361
|
+
const mapping = uboProgamMap.get(program);
|
|
16362
|
+
const blockIndex = mapping.get(uniformsGroup);
|
|
16363
|
+
|
|
16364
|
+
if (uboBindings.get(uniformsGroup) !== blockIndex) {
|
|
16365
|
+
// bind shader specific block index to global block point
|
|
16366
|
+
gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex);
|
|
16367
|
+
uboBindings.set(uniformsGroup, blockIndex);
|
|
16368
|
+
}
|
|
16498
16369
|
} //
|
|
16499
16370
|
|
|
16500
16371
|
|
|
@@ -16587,6 +16458,8 @@
|
|
|
16587
16458
|
compressedTexImage2D: compressedTexImage2D,
|
|
16588
16459
|
texImage2D: texImage2D,
|
|
16589
16460
|
texImage3D: texImage3D,
|
|
16461
|
+
updateUBOMapping: updateUBOMapping,
|
|
16462
|
+
uniformBlockBinding: uniformBlockBinding,
|
|
16590
16463
|
texStorage2D: texStorage2D,
|
|
16591
16464
|
texStorage3D: texStorage3D,
|
|
16592
16465
|
texSubImage2D: texSubImage2D,
|
|
@@ -17935,7 +17808,7 @@
|
|
|
17935
17808
|
if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;
|
|
17936
17809
|
if (p === DepthFormat) return gl.DEPTH_COMPONENT;
|
|
17937
17810
|
if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;
|
|
17938
|
-
if (p === RedFormat) return gl.RED;
|
|
17811
|
+
if (p === RedFormat) return gl.RED; // @deprecated since r137
|
|
17939
17812
|
|
|
17940
17813
|
if (p === RGBFormat) {
|
|
17941
17814
|
console.warn('THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228');
|
|
@@ -18135,7 +18008,7 @@
|
|
|
18135
18008
|
camera.translateX(xOffset);
|
|
18136
18009
|
camera.translateZ(zOffset);
|
|
18137
18010
|
camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);
|
|
18138
|
-
camera.matrixWorldInverse.
|
|
18011
|
+
camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); // Find the union of the frustum values of the cameras and scale
|
|
18139
18012
|
// the values so that the near plane's position does not change in world space,
|
|
18140
18013
|
// although must now be relative to the new union camera.
|
|
18141
18014
|
|
|
@@ -18337,9 +18210,12 @@
|
|
|
18337
18210
|
|
|
18338
18211
|
this.setPoseTarget = function (object) {
|
|
18339
18212
|
if (object !== undefined) poseTarget = object;
|
|
18340
|
-
};
|
|
18213
|
+
}; //
|
|
18341
18214
|
|
|
18342
|
-
|
|
18215
|
+
|
|
18216
|
+
this.cameraAutoUpdate = true;
|
|
18217
|
+
|
|
18218
|
+
this.updateCamera = function (camera) {
|
|
18343
18219
|
var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
|
|
18344
18220
|
device.depthNear = camera.near;
|
|
18345
18221
|
device.depthFar = camera.far;
|
|
@@ -18388,7 +18264,7 @@
|
|
|
18388
18264
|
cameraL.matrixWorldInverse.fromArray(frameData.leftViewMatrix);
|
|
18389
18265
|
cameraR.matrixWorldInverse.fromArray(frameData.rightViewMatrix); // TODO (mrdoob) Double check this code
|
|
18390
18266
|
|
|
18391
|
-
standingMatrixInverse.
|
|
18267
|
+
standingMatrixInverse.copy(standingMatrix).invert();
|
|
18392
18268
|
|
|
18393
18269
|
if (referenceSpaceType === 'local-floor') {
|
|
18394
18270
|
cameraL.matrixWorldInverse.multiply(standingMatrixInverse);
|
|
@@ -18398,14 +18274,14 @@
|
|
|
18398
18274
|
var parent = poseObject.parent;
|
|
18399
18275
|
|
|
18400
18276
|
if (parent !== null) {
|
|
18401
|
-
matrixWorldInverse.
|
|
18277
|
+
matrixWorldInverse.copy(parent.matrixWorld).invert();
|
|
18402
18278
|
cameraL.matrixWorldInverse.multiply(matrixWorldInverse);
|
|
18403
18279
|
cameraR.matrixWorldInverse.multiply(matrixWorldInverse);
|
|
18404
18280
|
} // envMap and Mirror needs camera.matrixWorld
|
|
18405
18281
|
|
|
18406
18282
|
|
|
18407
|
-
cameraL.matrixWorld.
|
|
18408
|
-
cameraR.matrixWorld.
|
|
18283
|
+
cameraL.matrixWorld.copy(cameraL.matrixWorldInverse).invert();
|
|
18284
|
+
cameraR.matrixWorld.copy(cameraR.matrixWorldInverse).invert();
|
|
18409
18285
|
cameraL.projectionMatrix.fromArray(frameData.leftProjectionMatrix);
|
|
18410
18286
|
cameraR.projectionMatrix.fromArray(frameData.rightProjectionMatrix);
|
|
18411
18287
|
setProjectionFromUnion(cameraVR, cameraL, cameraR); //
|
|
@@ -18422,6 +18298,22 @@
|
|
|
18422
18298
|
return cameraVR;
|
|
18423
18299
|
};
|
|
18424
18300
|
|
|
18301
|
+
this.getCamera = function () {
|
|
18302
|
+
return cameraVR;
|
|
18303
|
+
}; // Dummy getFoveation/setFoveation to have the same API as WebXR
|
|
18304
|
+
|
|
18305
|
+
|
|
18306
|
+
this.getFoveation = function () {
|
|
18307
|
+
return 1;
|
|
18308
|
+
};
|
|
18309
|
+
|
|
18310
|
+
this.setFoveation = function (foveation) {
|
|
18311
|
+
if (foveation !== 1) {
|
|
18312
|
+
console.warn('THREE.WebVRManager: setFoveation() not used in WebVR.');
|
|
18313
|
+
}
|
|
18314
|
+
}; //
|
|
18315
|
+
|
|
18316
|
+
|
|
18425
18317
|
this.getStandingMatrix = function () {
|
|
18426
18318
|
return standingMatrix;
|
|
18427
18319
|
};
|
|
@@ -18449,13 +18341,14 @@
|
|
|
18449
18341
|
this.setFrameOfReferenceType = function () {
|
|
18450
18342
|
console.warn('THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.');
|
|
18451
18343
|
};
|
|
18452
|
-
|
|
18453
|
-
this.addEventListener = function () {
|
|
18454
|
-
/* Stub */
|
|
18455
|
-
};
|
|
18456
18344
|
}
|
|
18457
18345
|
|
|
18458
|
-
Object.assign(WebVRManager.prototype,
|
|
18346
|
+
Object.assign(WebVRManager.prototype, {
|
|
18347
|
+
addEventListener: EventDispatcher.prototype.addEventListener,
|
|
18348
|
+
hasEventListener: EventDispatcher.prototype.hasEventListener,
|
|
18349
|
+
removeEventListener: EventDispatcher.prototype.removeEventListener,
|
|
18350
|
+
dispatchEvent: EventDispatcher.prototype.dispatchEvent
|
|
18351
|
+
});
|
|
18459
18352
|
|
|
18460
18353
|
const _moveEvent = {
|
|
18461
18354
|
type: 'move'
|
|
@@ -18556,31 +18449,6 @@
|
|
|
18556
18449
|
const hand = this._hand;
|
|
18557
18450
|
|
|
18558
18451
|
if (inputSource && frame.session.visibilityState !== 'visible-blurred') {
|
|
18559
|
-
if (targetRay !== null) {
|
|
18560
|
-
inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);
|
|
18561
|
-
|
|
18562
|
-
if (inputPose !== null) {
|
|
18563
|
-
targetRay.matrix.fromArray(inputPose.transform.matrix);
|
|
18564
|
-
targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);
|
|
18565
|
-
|
|
18566
|
-
if (inputPose.linearVelocity) {
|
|
18567
|
-
targetRay.hasLinearVelocity = true;
|
|
18568
|
-
targetRay.linearVelocity.copy(inputPose.linearVelocity);
|
|
18569
|
-
} else {
|
|
18570
|
-
targetRay.hasLinearVelocity = false;
|
|
18571
|
-
}
|
|
18572
|
-
|
|
18573
|
-
if (inputPose.angularVelocity) {
|
|
18574
|
-
targetRay.hasAngularVelocity = true;
|
|
18575
|
-
targetRay.angularVelocity.copy(inputPose.angularVelocity);
|
|
18576
|
-
} else {
|
|
18577
|
-
targetRay.hasAngularVelocity = false;
|
|
18578
|
-
}
|
|
18579
|
-
|
|
18580
|
-
this.dispatchEvent(_moveEvent);
|
|
18581
|
-
}
|
|
18582
|
-
}
|
|
18583
|
-
|
|
18584
18452
|
if (hand && inputSource.hand) {
|
|
18585
18453
|
handPose = true;
|
|
18586
18454
|
|
|
@@ -18656,6 +18524,35 @@
|
|
|
18656
18524
|
}
|
|
18657
18525
|
}
|
|
18658
18526
|
}
|
|
18527
|
+
|
|
18528
|
+
if (targetRay !== null) {
|
|
18529
|
+
inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace); // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it
|
|
18530
|
+
|
|
18531
|
+
if (inputPose === null && gripPose !== null) {
|
|
18532
|
+
inputPose = gripPose;
|
|
18533
|
+
}
|
|
18534
|
+
|
|
18535
|
+
if (inputPose !== null) {
|
|
18536
|
+
targetRay.matrix.fromArray(inputPose.transform.matrix);
|
|
18537
|
+
targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);
|
|
18538
|
+
|
|
18539
|
+
if (inputPose.linearVelocity) {
|
|
18540
|
+
targetRay.hasLinearVelocity = true;
|
|
18541
|
+
targetRay.linearVelocity.copy(inputPose.linearVelocity);
|
|
18542
|
+
} else {
|
|
18543
|
+
targetRay.hasLinearVelocity = false;
|
|
18544
|
+
}
|
|
18545
|
+
|
|
18546
|
+
if (inputPose.angularVelocity) {
|
|
18547
|
+
targetRay.hasAngularVelocity = true;
|
|
18548
|
+
targetRay.angularVelocity.copy(inputPose.angularVelocity);
|
|
18549
|
+
} else {
|
|
18550
|
+
targetRay.hasAngularVelocity = false;
|
|
18551
|
+
}
|
|
18552
|
+
|
|
18553
|
+
this.dispatchEvent(_moveEvent);
|
|
18554
|
+
}
|
|
18555
|
+
}
|
|
18659
18556
|
}
|
|
18660
18557
|
|
|
18661
18558
|
if (targetRay !== null) {
|
|
@@ -18719,7 +18616,7 @@
|
|
|
18719
18616
|
let initialRenderTarget = null;
|
|
18720
18617
|
let newRenderTarget = null;
|
|
18721
18618
|
const controllers = [];
|
|
18722
|
-
const
|
|
18619
|
+
const controllerInputSources = []; //
|
|
18723
18620
|
|
|
18724
18621
|
const cameraL = new PerspectiveCamera();
|
|
18725
18622
|
cameraL.layers.enable(1);
|
|
@@ -18778,7 +18675,13 @@
|
|
|
18778
18675
|
|
|
18779
18676
|
|
|
18780
18677
|
function onSessionEvent(event) {
|
|
18781
|
-
const
|
|
18678
|
+
const controllerIndex = controllerInputSources.indexOf(event.inputSource);
|
|
18679
|
+
|
|
18680
|
+
if (controllerIndex === -1) {
|
|
18681
|
+
return;
|
|
18682
|
+
}
|
|
18683
|
+
|
|
18684
|
+
const controller = controllers[controllerIndex];
|
|
18782
18685
|
|
|
18783
18686
|
if (controller !== undefined) {
|
|
18784
18687
|
controller.dispatchEvent({
|
|
@@ -18797,12 +18700,14 @@
|
|
|
18797
18700
|
session.removeEventListener('squeezeend', onSessionEvent);
|
|
18798
18701
|
session.removeEventListener('end', onSessionEnd);
|
|
18799
18702
|
session.removeEventListener('inputsourceschange', onInputSourcesChange);
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18805
|
-
|
|
18703
|
+
|
|
18704
|
+
for (let i = 0; i < controllers.length; i++) {
|
|
18705
|
+
const inputSource = controllerInputSources[i];
|
|
18706
|
+
if (inputSource === null) continue;
|
|
18707
|
+
controllerInputSources[i] = null;
|
|
18708
|
+
controllers[i].disconnect(inputSource);
|
|
18709
|
+
}
|
|
18710
|
+
|
|
18806
18711
|
_currentDepthNear = null;
|
|
18807
18712
|
_currentDepthFar = null; // restore framebuffer/rendering state
|
|
18808
18713
|
|
|
@@ -18893,7 +18798,8 @@
|
|
|
18893
18798
|
newRenderTarget = new WebGLRenderTarget(glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, {
|
|
18894
18799
|
format: RGBAFormat,
|
|
18895
18800
|
type: UnsignedByteType,
|
|
18896
|
-
encoding: renderer.outputEncoding
|
|
18801
|
+
encoding: renderer.outputEncoding,
|
|
18802
|
+
stencilBuffer: attributes.stencil
|
|
18897
18803
|
});
|
|
18898
18804
|
} else {
|
|
18899
18805
|
let depthFormat = null;
|
|
@@ -18907,7 +18813,7 @@
|
|
|
18907
18813
|
}
|
|
18908
18814
|
|
|
18909
18815
|
const projectionlayerInit = {
|
|
18910
|
-
colorFormat:
|
|
18816
|
+
colorFormat: gl.RGBA8,
|
|
18911
18817
|
depthFormat: glDepthFormat,
|
|
18912
18818
|
scaleFactor: framebufferScaleFactor
|
|
18913
18819
|
};
|
|
@@ -18972,31 +18878,44 @@
|
|
|
18972
18878
|
};
|
|
18973
18879
|
|
|
18974
18880
|
function onInputSourcesChange(event) {
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
for (let i = 0; i < inputSources.length; i++) {
|
|
18978
|
-
const index = inputSources[i].handedness === 'right' ? 1 : 0;
|
|
18979
|
-
inputSourcesMap.set(inputSources[i], controllers[index]);
|
|
18980
|
-
} // Notify disconnected
|
|
18981
|
-
|
|
18982
|
-
|
|
18881
|
+
// Notify disconnected
|
|
18983
18882
|
for (let i = 0; i < event.removed.length; i++) {
|
|
18984
18883
|
const inputSource = event.removed[i];
|
|
18985
|
-
const
|
|
18884
|
+
const index = controllerInputSources.indexOf(inputSource);
|
|
18986
18885
|
|
|
18987
|
-
if (
|
|
18988
|
-
|
|
18886
|
+
if (index >= 0) {
|
|
18887
|
+
controllerInputSources[index] = null;
|
|
18888
|
+
controllers[index].dispatchEvent({
|
|
18989
18889
|
type: 'disconnected',
|
|
18990
18890
|
data: inputSource
|
|
18991
18891
|
});
|
|
18992
|
-
inputSourcesMap.delete(inputSource);
|
|
18993
18892
|
}
|
|
18994
18893
|
} // Notify connected
|
|
18995
18894
|
|
|
18996
18895
|
|
|
18997
18896
|
for (let i = 0; i < event.added.length; i++) {
|
|
18998
18897
|
const inputSource = event.added[i];
|
|
18999
|
-
|
|
18898
|
+
let controllerIndex = controllerInputSources.indexOf(inputSource);
|
|
18899
|
+
|
|
18900
|
+
if (controllerIndex === -1) {
|
|
18901
|
+
// Assign input source a controller that currently has no input source
|
|
18902
|
+
for (let i = 0; i < controllers.length; i++) {
|
|
18903
|
+
if (i >= controllerInputSources.length) {
|
|
18904
|
+
controllerInputSources.push(inputSource);
|
|
18905
|
+
controllerIndex = i;
|
|
18906
|
+
break;
|
|
18907
|
+
} else if (controllerInputSources[i] === null) {
|
|
18908
|
+
controllerInputSources[i] = inputSource;
|
|
18909
|
+
controllerIndex = i;
|
|
18910
|
+
break;
|
|
18911
|
+
}
|
|
18912
|
+
} // If all controllers do currently receive input we ignore new ones
|
|
18913
|
+
|
|
18914
|
+
|
|
18915
|
+
if (controllerIndex === -1) break;
|
|
18916
|
+
}
|
|
18917
|
+
|
|
18918
|
+
const controller = controllers[controllerIndex];
|
|
19000
18919
|
|
|
19001
18920
|
if (controller) {
|
|
19002
18921
|
controller.dispatchEvent({
|
|
@@ -19204,13 +19123,11 @@
|
|
|
19204
19123
|
} //
|
|
19205
19124
|
|
|
19206
19125
|
|
|
19207
|
-
const inputSources = session.inputSources;
|
|
19208
|
-
|
|
19209
19126
|
for (let i = 0; i < controllers.length; i++) {
|
|
19210
|
-
const inputSource =
|
|
19211
|
-
const controller =
|
|
19127
|
+
const inputSource = controllerInputSources[i];
|
|
19128
|
+
const controller = controllers[i];
|
|
19212
19129
|
|
|
19213
|
-
if (controller !== undefined) {
|
|
19130
|
+
if (inputSource !== null && controller !== undefined) {
|
|
19214
19131
|
controller.update(inputSource, frame, customReferenceSpace || referenceSpace);
|
|
19215
19132
|
}
|
|
19216
19133
|
}
|
|
@@ -19680,6 +19597,249 @@
|
|
|
19680
19597
|
};
|
|
19681
19598
|
}
|
|
19682
19599
|
|
|
19600
|
+
function WebGLUniformsGroups(gl, info, capabilities, state) {
|
|
19601
|
+
let buffers = {};
|
|
19602
|
+
let updateList = {};
|
|
19603
|
+
let allocatedBindingPoints = [];
|
|
19604
|
+
const maxBindingPoints = capabilities.isWebGL2 ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0; // binding points are global whereas block indices are per shader program
|
|
19605
|
+
|
|
19606
|
+
function bind(uniformsGroup, program) {
|
|
19607
|
+
const webglProgram = program.program;
|
|
19608
|
+
state.uniformBlockBinding(uniformsGroup, webglProgram);
|
|
19609
|
+
}
|
|
19610
|
+
|
|
19611
|
+
function update(uniformsGroup, program) {
|
|
19612
|
+
let buffer = buffers[uniformsGroup.id];
|
|
19613
|
+
|
|
19614
|
+
if (buffer === undefined) {
|
|
19615
|
+
prepareUniformsGroup(uniformsGroup);
|
|
19616
|
+
buffer = createBuffer(uniformsGroup);
|
|
19617
|
+
buffers[uniformsGroup.id] = buffer;
|
|
19618
|
+
uniformsGroup.addEventListener('dispose', onUniformsGroupsDispose);
|
|
19619
|
+
} // ensure to update the binding points/block indices mapping for this program
|
|
19620
|
+
|
|
19621
|
+
|
|
19622
|
+
const webglProgram = program.program;
|
|
19623
|
+
state.updateUBOMapping(uniformsGroup, webglProgram); // update UBO once per frame
|
|
19624
|
+
|
|
19625
|
+
const frame = info.render.frame;
|
|
19626
|
+
|
|
19627
|
+
if (updateList[uniformsGroup.id] !== frame) {
|
|
19628
|
+
updateBufferData(uniformsGroup);
|
|
19629
|
+
updateList[uniformsGroup.id] = frame;
|
|
19630
|
+
}
|
|
19631
|
+
}
|
|
19632
|
+
|
|
19633
|
+
function createBuffer(uniformsGroup) {
|
|
19634
|
+
// the setup of an UBO is independent of a particular shader program but global
|
|
19635
|
+
const bindingPointIndex = allocateBindingPointIndex();
|
|
19636
|
+
uniformsGroup.__bindingPointIndex = bindingPointIndex;
|
|
19637
|
+
const buffer = gl.createBuffer();
|
|
19638
|
+
const size = uniformsGroup.__size;
|
|
19639
|
+
const usage = uniformsGroup.usage;
|
|
19640
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
|
|
19641
|
+
gl.bufferData(gl.UNIFORM_BUFFER, size, usage);
|
|
19642
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
19643
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPointIndex, buffer);
|
|
19644
|
+
return buffer;
|
|
19645
|
+
}
|
|
19646
|
+
|
|
19647
|
+
function allocateBindingPointIndex() {
|
|
19648
|
+
for (let i = 0; i < maxBindingPoints; i++) {
|
|
19649
|
+
if (allocatedBindingPoints.indexOf(i) === -1) {
|
|
19650
|
+
allocatedBindingPoints.push(i);
|
|
19651
|
+
return i;
|
|
19652
|
+
}
|
|
19653
|
+
}
|
|
19654
|
+
|
|
19655
|
+
console.error('THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.');
|
|
19656
|
+
return 0;
|
|
19657
|
+
}
|
|
19658
|
+
|
|
19659
|
+
function updateBufferData(uniformsGroup) {
|
|
19660
|
+
const buffer = buffers[uniformsGroup.id];
|
|
19661
|
+
const uniforms = uniformsGroup.uniforms;
|
|
19662
|
+
const cache = uniformsGroup.__cache;
|
|
19663
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
|
|
19664
|
+
|
|
19665
|
+
for (let i = 0, il = uniforms.length; i < il; i++) {
|
|
19666
|
+
const uniform = uniforms[i]; // partly update the buffer if necessary
|
|
19667
|
+
|
|
19668
|
+
if (hasUniformChanged(uniform, i, cache) === true) {
|
|
19669
|
+
const value = uniform.value;
|
|
19670
|
+
const offset = uniform.__offset;
|
|
19671
|
+
|
|
19672
|
+
if (typeof value === 'number') {
|
|
19673
|
+
uniform.__data[0] = value;
|
|
19674
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data);
|
|
19675
|
+
} else {
|
|
19676
|
+
if (uniform.value.isMatrix3) {
|
|
19677
|
+
// manually converting 3x3 to 3x4
|
|
19678
|
+
uniform.__data[0] = uniform.value.elements[0];
|
|
19679
|
+
uniform.__data[1] = uniform.value.elements[1];
|
|
19680
|
+
uniform.__data[2] = uniform.value.elements[2];
|
|
19681
|
+
uniform.__data[3] = uniform.value.elements[0];
|
|
19682
|
+
uniform.__data[4] = uniform.value.elements[3];
|
|
19683
|
+
uniform.__data[5] = uniform.value.elements[4];
|
|
19684
|
+
uniform.__data[6] = uniform.value.elements[5];
|
|
19685
|
+
uniform.__data[7] = uniform.value.elements[0];
|
|
19686
|
+
uniform.__data[8] = uniform.value.elements[6];
|
|
19687
|
+
uniform.__data[9] = uniform.value.elements[7];
|
|
19688
|
+
uniform.__data[10] = uniform.value.elements[8];
|
|
19689
|
+
uniform.__data[11] = uniform.value.elements[0];
|
|
19690
|
+
} else {
|
|
19691
|
+
value.toArray(uniform.__data);
|
|
19692
|
+
}
|
|
19693
|
+
|
|
19694
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data);
|
|
19695
|
+
}
|
|
19696
|
+
}
|
|
19697
|
+
}
|
|
19698
|
+
|
|
19699
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
19700
|
+
}
|
|
19701
|
+
|
|
19702
|
+
function hasUniformChanged(uniform, index, cache) {
|
|
19703
|
+
const value = uniform.value;
|
|
19704
|
+
|
|
19705
|
+
if (cache[index] === undefined) {
|
|
19706
|
+
// cache entry does not exist so far
|
|
19707
|
+
if (typeof value === 'number') {
|
|
19708
|
+
cache[index] = value;
|
|
19709
|
+
} else {
|
|
19710
|
+
cache[index] = value.clone();
|
|
19711
|
+
}
|
|
19712
|
+
|
|
19713
|
+
return true;
|
|
19714
|
+
} else {
|
|
19715
|
+
// compare current value with cached entry
|
|
19716
|
+
if (typeof value === 'number') {
|
|
19717
|
+
if (cache[index] !== value) {
|
|
19718
|
+
cache[index] = value;
|
|
19719
|
+
return true;
|
|
19720
|
+
}
|
|
19721
|
+
} else {
|
|
19722
|
+
const cachedObject = cache[index];
|
|
19723
|
+
|
|
19724
|
+
if (cachedObject.equals(value) === false) {
|
|
19725
|
+
cachedObject.copy(value);
|
|
19726
|
+
return true;
|
|
19727
|
+
}
|
|
19728
|
+
}
|
|
19729
|
+
}
|
|
19730
|
+
|
|
19731
|
+
return false;
|
|
19732
|
+
}
|
|
19733
|
+
|
|
19734
|
+
function prepareUniformsGroup(uniformsGroup) {
|
|
19735
|
+
// determine total buffer size according to the STD140 layout
|
|
19736
|
+
// Hint: STD140 is the only supported layout in WebGL 2
|
|
19737
|
+
const uniforms = uniformsGroup.uniforms;
|
|
19738
|
+
let offset = 0; // global buffer offset in bytes
|
|
19739
|
+
|
|
19740
|
+
const chunkSize = 16; // size of a chunk in bytes
|
|
19741
|
+
|
|
19742
|
+
let chunkOffset = 0; // offset within a single chunk in bytes
|
|
19743
|
+
|
|
19744
|
+
for (let i = 0, l = uniforms.length; i < l; i++) {
|
|
19745
|
+
const uniform = uniforms[i];
|
|
19746
|
+
const info = getUniformSize(uniform); // the following two properties will be used for partial buffer updates
|
|
19747
|
+
|
|
19748
|
+
uniform.__data = new Float32Array(info.storage / Float32Array.BYTES_PER_ELEMENT);
|
|
19749
|
+
uniform.__offset = offset; //
|
|
19750
|
+
|
|
19751
|
+
if (i > 0) {
|
|
19752
|
+
chunkOffset = offset % chunkSize;
|
|
19753
|
+
const remainingSizeInChunk = chunkSize - chunkOffset; // check for chunk overflow
|
|
19754
|
+
|
|
19755
|
+
if (chunkOffset !== 0 && remainingSizeInChunk - info.boundary < 0) {
|
|
19756
|
+
// add padding and adjust offset
|
|
19757
|
+
offset += chunkSize - chunkOffset;
|
|
19758
|
+
uniform.__offset = offset;
|
|
19759
|
+
}
|
|
19760
|
+
}
|
|
19761
|
+
|
|
19762
|
+
offset += info.storage;
|
|
19763
|
+
} // ensure correct final padding
|
|
19764
|
+
|
|
19765
|
+
|
|
19766
|
+
chunkOffset = offset % chunkSize;
|
|
19767
|
+
if (chunkOffset > 0) offset += chunkSize - chunkOffset; //
|
|
19768
|
+
|
|
19769
|
+
uniformsGroup.__size = offset;
|
|
19770
|
+
uniformsGroup.__cache = {};
|
|
19771
|
+
return this;
|
|
19772
|
+
}
|
|
19773
|
+
|
|
19774
|
+
function getUniformSize(uniform) {
|
|
19775
|
+
const value = uniform.value;
|
|
19776
|
+
const info = {
|
|
19777
|
+
boundary: 0,
|
|
19778
|
+
// bytes
|
|
19779
|
+
storage: 0 // bytes
|
|
19780
|
+
|
|
19781
|
+
}; // determine sizes according to STD140
|
|
19782
|
+
|
|
19783
|
+
if (typeof value === 'number') {
|
|
19784
|
+
// float/int
|
|
19785
|
+
info.boundary = 4;
|
|
19786
|
+
info.storage = 4;
|
|
19787
|
+
} else if (value.isVector2) {
|
|
19788
|
+
// vec2
|
|
19789
|
+
info.boundary = 8;
|
|
19790
|
+
info.storage = 8;
|
|
19791
|
+
} else if (value.isVector3 || value.isColor) {
|
|
19792
|
+
// vec3
|
|
19793
|
+
info.boundary = 16;
|
|
19794
|
+
info.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes
|
|
19795
|
+
} else if (value.isVector4) {
|
|
19796
|
+
// vec4
|
|
19797
|
+
info.boundary = 16;
|
|
19798
|
+
info.storage = 16;
|
|
19799
|
+
} else if (value.isMatrix3) {
|
|
19800
|
+
// mat3 (in STD140 a 3x3 matrix is represented as 3x4)
|
|
19801
|
+
info.boundary = 48;
|
|
19802
|
+
info.storage = 48;
|
|
19803
|
+
} else if (value.isMatrix4) {
|
|
19804
|
+
// mat4
|
|
19805
|
+
info.boundary = 64;
|
|
19806
|
+
info.storage = 64;
|
|
19807
|
+
} else if (value.isTexture) {
|
|
19808
|
+
console.warn('THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.');
|
|
19809
|
+
} else {
|
|
19810
|
+
console.warn('THREE.WebGLRenderer: Unsupported uniform value type.', value);
|
|
19811
|
+
}
|
|
19812
|
+
|
|
19813
|
+
return info;
|
|
19814
|
+
}
|
|
19815
|
+
|
|
19816
|
+
function onUniformsGroupsDispose(event) {
|
|
19817
|
+
const uniformsGroup = event.target;
|
|
19818
|
+
uniformsGroup.removeEventListener('dispose', onUniformsGroupsDispose);
|
|
19819
|
+
const index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);
|
|
19820
|
+
allocatedBindingPoints.splice(index, 1);
|
|
19821
|
+
gl.deleteBuffer(buffers[uniformsGroup.id]);
|
|
19822
|
+
delete buffers[uniformsGroup.id];
|
|
19823
|
+
delete updateList[uniformsGroup.id];
|
|
19824
|
+
}
|
|
19825
|
+
|
|
19826
|
+
function dispose() {
|
|
19827
|
+
for (const id in buffers) {
|
|
19828
|
+
gl.deleteBuffer(buffers[id]);
|
|
19829
|
+
}
|
|
19830
|
+
|
|
19831
|
+
allocatedBindingPoints = [];
|
|
19832
|
+
buffers = {};
|
|
19833
|
+
updateList = {};
|
|
19834
|
+
}
|
|
19835
|
+
|
|
19836
|
+
return {
|
|
19837
|
+
bind: bind,
|
|
19838
|
+
update: update,
|
|
19839
|
+
dispose: dispose
|
|
19840
|
+
};
|
|
19841
|
+
}
|
|
19842
|
+
|
|
19683
19843
|
function createCanvasElement() {
|
|
19684
19844
|
const canvas = createElementNS('canvas');
|
|
19685
19845
|
canvas.style.display = 'block';
|
|
@@ -19882,7 +20042,7 @@
|
|
|
19882
20042
|
let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
|
|
19883
20043
|
let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
19884
20044
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
19885
|
-
let utils, bindingStates;
|
|
20045
|
+
let utils, bindingStates, uniformsGroups;
|
|
19886
20046
|
|
|
19887
20047
|
function initGLContext() {
|
|
19888
20048
|
extensions = new WebGLExtensions(_gl);
|
|
@@ -19907,6 +20067,7 @@
|
|
|
19907
20067
|
renderStates = new WebGLRenderStates(extensions, capabilities);
|
|
19908
20068
|
background = new WebGLBackground(_this, cubemaps, state, objects, _alpha, _premultipliedAlpha);
|
|
19909
20069
|
shadowMap = new WebGLShadowMap(_this, objects, capabilities);
|
|
20070
|
+
uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state);
|
|
19910
20071
|
bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
|
|
19911
20072
|
indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);
|
|
19912
20073
|
info.programs = programCache.programs;
|
|
@@ -20088,6 +20249,7 @@
|
|
|
20088
20249
|
cubeuvmaps.dispose();
|
|
20089
20250
|
objects.dispose();
|
|
20090
20251
|
bindingStates.dispose();
|
|
20252
|
+
uniformsGroups.dispose();
|
|
20091
20253
|
programCache.dispose();
|
|
20092
20254
|
xr.dispose();
|
|
20093
20255
|
xr.removeEventListener('sessionstart', onXRSessionStart);
|
|
@@ -20241,6 +20403,20 @@
|
|
|
20241
20403
|
|
|
20242
20404
|
|
|
20243
20405
|
this.compile = function (scene, camera) {
|
|
20406
|
+
function prepare(material, scene, object) {
|
|
20407
|
+
if (material.transparent === true && material.side === DoubleSide) {
|
|
20408
|
+
material.side = BackSide;
|
|
20409
|
+
material.needsUpdate = true;
|
|
20410
|
+
getProgram(material, scene, object);
|
|
20411
|
+
material.side = FrontSide;
|
|
20412
|
+
material.needsUpdate = true;
|
|
20413
|
+
getProgram(material, scene, object);
|
|
20414
|
+
material.side = DoubleSide;
|
|
20415
|
+
} else {
|
|
20416
|
+
getProgram(material, scene, object);
|
|
20417
|
+
}
|
|
20418
|
+
}
|
|
20419
|
+
|
|
20244
20420
|
currentRenderState = renderStates.get(scene);
|
|
20245
20421
|
currentRenderState.init();
|
|
20246
20422
|
renderStateStack.push(currentRenderState);
|
|
@@ -20261,10 +20437,10 @@
|
|
|
20261
20437
|
if (Array.isArray(material)) {
|
|
20262
20438
|
for (let i = 0; i < material.length; i++) {
|
|
20263
20439
|
const material2 = material[i];
|
|
20264
|
-
|
|
20440
|
+
prepare(material2, scene, object);
|
|
20265
20441
|
}
|
|
20266
20442
|
} else {
|
|
20267
|
-
|
|
20443
|
+
prepare(material, scene, object);
|
|
20268
20444
|
}
|
|
20269
20445
|
}
|
|
20270
20446
|
});
|
|
@@ -20308,9 +20484,9 @@
|
|
|
20308
20484
|
|
|
20309
20485
|
if (_isContextLost === true) return; // update scene graph
|
|
20310
20486
|
|
|
20311
|
-
if (scene.
|
|
20487
|
+
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum
|
|
20312
20488
|
|
|
20313
|
-
if (camera.parent === null) camera.updateMatrixWorld();
|
|
20489
|
+
if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();
|
|
20314
20490
|
|
|
20315
20491
|
if (xr.enabled === true && xr.isPresenting === true) {
|
|
20316
20492
|
if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);
|
|
@@ -20632,7 +20808,8 @@
|
|
|
20632
20808
|
uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;
|
|
20633
20809
|
uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
|
|
20634
20810
|
uniforms.spotShadowMap.value = lights.state.spotShadowMap;
|
|
20635
|
-
uniforms.
|
|
20811
|
+
uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;
|
|
20812
|
+
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
20636
20813
|
uniforms.pointShadowMap.value = lights.state.pointShadowMap;
|
|
20637
20814
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms
|
|
20638
20815
|
}
|
|
@@ -20819,6 +20996,12 @@
|
|
|
20819
20996
|
if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {
|
|
20820
20997
|
materialProperties.receiveShadow = object.receiveShadow;
|
|
20821
20998
|
p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow);
|
|
20999
|
+
} // https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512
|
|
21000
|
+
|
|
21001
|
+
|
|
21002
|
+
if (material.isMeshGouraudMaterial && material.envMap !== null) {
|
|
21003
|
+
m_uniforms.envMap.value = envMap;
|
|
21004
|
+
m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
|
|
20822
21005
|
}
|
|
20823
21006
|
|
|
20824
21007
|
if (refreshMaterial) {
|
|
@@ -20856,7 +21039,22 @@
|
|
|
20856
21039
|
|
|
20857
21040
|
p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix);
|
|
20858
21041
|
p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix);
|
|
20859
|
-
p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld);
|
|
21042
|
+
p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld); // UBOs
|
|
21043
|
+
|
|
21044
|
+
if (material.isShaderMaterial || material.isRawShaderMaterial) {
|
|
21045
|
+
const groups = material.uniformsGroups;
|
|
21046
|
+
|
|
21047
|
+
for (let i = 0, l = groups.length; i < l; i++) {
|
|
21048
|
+
if (capabilities.isWebGL2) {
|
|
21049
|
+
const group = groups[i];
|
|
21050
|
+
uniformsGroups.update(group, program);
|
|
21051
|
+
uniformsGroups.bind(group, program);
|
|
21052
|
+
} else {
|
|
21053
|
+
console.warn('THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.');
|
|
21054
|
+
}
|
|
21055
|
+
}
|
|
21056
|
+
}
|
|
21057
|
+
|
|
20860
21058
|
return program;
|
|
20861
21059
|
} // If uniforms are marked as clean, they don't need to be loaded to the GPU.
|
|
20862
21060
|
|
|
@@ -21179,7 +21377,16 @@
|
|
|
21179
21377
|
};
|
|
21180
21378
|
|
|
21181
21379
|
this.initTexture = function (texture) {
|
|
21182
|
-
|
|
21380
|
+
if (texture.isCubeTexture) {
|
|
21381
|
+
textures.setTextureCube(texture, 0);
|
|
21382
|
+
} else if (texture.isData3DTexture) {
|
|
21383
|
+
textures.setTexture3D(texture, 0);
|
|
21384
|
+
} else if (texture.isDataArrayTexture) {
|
|
21385
|
+
textures.setTexture2DArray(texture, 0);
|
|
21386
|
+
} else {
|
|
21387
|
+
textures.setTexture2D(texture, 0);
|
|
21388
|
+
}
|
|
21389
|
+
|
|
21183
21390
|
state.unbindTexture();
|
|
21184
21391
|
};
|
|
21185
21392
|
|
|
@@ -21257,7 +21464,6 @@
|
|
|
21257
21464
|
this.environment = null;
|
|
21258
21465
|
this.fog = null;
|
|
21259
21466
|
this.overrideMaterial = null;
|
|
21260
|
-
this.autoUpdate = true; // checked by the renderer
|
|
21261
21467
|
|
|
21262
21468
|
if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
|
|
21263
21469
|
__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {
|
|
@@ -21272,7 +21478,6 @@
|
|
|
21272
21478
|
if (source.environment !== null) this.environment = source.environment.clone();
|
|
21273
21479
|
if (source.fog !== null) this.fog = source.fog.clone();
|
|
21274
21480
|
if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();
|
|
21275
|
-
this.autoUpdate = source.autoUpdate;
|
|
21276
21481
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
21277
21482
|
return this;
|
|
21278
21483
|
}
|
|
@@ -21281,6 +21486,17 @@
|
|
|
21281
21486
|
const data = super.toJSON(meta);
|
|
21282
21487
|
if (this.fog !== null) data.object.fog = this.fog.toJSON();
|
|
21283
21488
|
return data;
|
|
21489
|
+
} // @deprecated
|
|
21490
|
+
|
|
21491
|
+
|
|
21492
|
+
get autoUpdate() {
|
|
21493
|
+
console.warn('THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144.');
|
|
21494
|
+
return this.matrixWorldAutoUpdate;
|
|
21495
|
+
}
|
|
21496
|
+
|
|
21497
|
+
set autoUpdate(value) {
|
|
21498
|
+
console.warn('THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144.');
|
|
21499
|
+
this.matrixWorldAutoUpdate = value;
|
|
21284
21500
|
}
|
|
21285
21501
|
|
|
21286
21502
|
}
|
|
@@ -21370,7 +21586,7 @@
|
|
|
21370
21586
|
}
|
|
21371
21587
|
|
|
21372
21588
|
if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
|
|
21373
|
-
data.arrayBuffers[this.array.buffer._uuid] = Array.
|
|
21589
|
+
data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));
|
|
21374
21590
|
} //
|
|
21375
21591
|
|
|
21376
21592
|
|
|
@@ -21445,43 +21661,61 @@
|
|
|
21445
21661
|
}
|
|
21446
21662
|
|
|
21447
21663
|
setX(index, x) {
|
|
21664
|
+
if (this.normalized) x = normalize(x, this.array);
|
|
21448
21665
|
this.data.array[index * this.data.stride + this.offset] = x;
|
|
21449
21666
|
return this;
|
|
21450
21667
|
}
|
|
21451
21668
|
|
|
21452
21669
|
setY(index, y) {
|
|
21670
|
+
if (this.normalized) y = normalize(y, this.array);
|
|
21453
21671
|
this.data.array[index * this.data.stride + this.offset + 1] = y;
|
|
21454
21672
|
return this;
|
|
21455
21673
|
}
|
|
21456
21674
|
|
|
21457
21675
|
setZ(index, z) {
|
|
21676
|
+
if (this.normalized) z = normalize(z, this.array);
|
|
21458
21677
|
this.data.array[index * this.data.stride + this.offset + 2] = z;
|
|
21459
21678
|
return this;
|
|
21460
21679
|
}
|
|
21461
21680
|
|
|
21462
21681
|
setW(index, w) {
|
|
21682
|
+
if (this.normalized) w = normalize(w, this.array);
|
|
21463
21683
|
this.data.array[index * this.data.stride + this.offset + 3] = w;
|
|
21464
21684
|
return this;
|
|
21465
21685
|
}
|
|
21466
21686
|
|
|
21467
21687
|
getX(index) {
|
|
21468
|
-
|
|
21688
|
+
let x = this.data.array[index * this.data.stride + this.offset];
|
|
21689
|
+
if (this.normalized) x = denormalize(x, this.array);
|
|
21690
|
+
return x;
|
|
21469
21691
|
}
|
|
21470
21692
|
|
|
21471
21693
|
getY(index) {
|
|
21472
|
-
|
|
21694
|
+
let y = this.data.array[index * this.data.stride + this.offset + 1];
|
|
21695
|
+
if (this.normalized) y = denormalize(y, this.array);
|
|
21696
|
+
return y;
|
|
21473
21697
|
}
|
|
21474
21698
|
|
|
21475
21699
|
getZ(index) {
|
|
21476
|
-
|
|
21700
|
+
let z = this.data.array[index * this.data.stride + this.offset + 2];
|
|
21701
|
+
if (this.normalized) z = denormalize(z, this.array);
|
|
21702
|
+
return z;
|
|
21477
21703
|
}
|
|
21478
21704
|
|
|
21479
21705
|
getW(index) {
|
|
21480
|
-
|
|
21706
|
+
let w = this.data.array[index * this.data.stride + this.offset + 3];
|
|
21707
|
+
if (this.normalized) w = denormalize(w, this.array);
|
|
21708
|
+
return w;
|
|
21481
21709
|
}
|
|
21482
21710
|
|
|
21483
21711
|
setXY(index, x, y) {
|
|
21484
21712
|
index = index * this.data.stride + this.offset;
|
|
21713
|
+
|
|
21714
|
+
if (this.normalized) {
|
|
21715
|
+
x = normalize(x, this.array);
|
|
21716
|
+
y = normalize(y, this.array);
|
|
21717
|
+
}
|
|
21718
|
+
|
|
21485
21719
|
this.data.array[index + 0] = x;
|
|
21486
21720
|
this.data.array[index + 1] = y;
|
|
21487
21721
|
return this;
|
|
@@ -21489,6 +21723,13 @@
|
|
|
21489
21723
|
|
|
21490
21724
|
setXYZ(index, x, y, z) {
|
|
21491
21725
|
index = index * this.data.stride + this.offset;
|
|
21726
|
+
|
|
21727
|
+
if (this.normalized) {
|
|
21728
|
+
x = normalize(x, this.array);
|
|
21729
|
+
y = normalize(y, this.array);
|
|
21730
|
+
z = normalize(z, this.array);
|
|
21731
|
+
}
|
|
21732
|
+
|
|
21492
21733
|
this.data.array[index + 0] = x;
|
|
21493
21734
|
this.data.array[index + 1] = y;
|
|
21494
21735
|
this.data.array[index + 2] = z;
|
|
@@ -21497,6 +21738,14 @@
|
|
|
21497
21738
|
|
|
21498
21739
|
setXYZW(index, x, y, z, w) {
|
|
21499
21740
|
index = index * this.data.stride + this.offset;
|
|
21741
|
+
|
|
21742
|
+
if (this.normalized) {
|
|
21743
|
+
x = normalize(x, this.array);
|
|
21744
|
+
y = normalize(y, this.array);
|
|
21745
|
+
z = normalize(z, this.array);
|
|
21746
|
+
w = normalize(w, this.array);
|
|
21747
|
+
}
|
|
21748
|
+
|
|
21500
21749
|
this.data.array[index + 0] = x;
|
|
21501
21750
|
this.data.array[index + 1] = y;
|
|
21502
21751
|
this.data.array[index + 2] = z;
|
|
@@ -21506,7 +21755,7 @@
|
|
|
21506
21755
|
|
|
21507
21756
|
clone(data) {
|
|
21508
21757
|
if (data === undefined) {
|
|
21509
|
-
console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an
|
|
21758
|
+
console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.');
|
|
21510
21759
|
const array = [];
|
|
21511
21760
|
|
|
21512
21761
|
for (let i = 0; i < this.count; i++) {
|
|
@@ -21533,7 +21782,7 @@
|
|
|
21533
21782
|
|
|
21534
21783
|
toJSON(data) {
|
|
21535
21784
|
if (data === undefined) {
|
|
21536
|
-
console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an
|
|
21785
|
+
console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.');
|
|
21537
21786
|
const array = [];
|
|
21538
21787
|
|
|
21539
21788
|
for (let i = 0; i < this.count; i++) {
|
|
@@ -21552,7 +21801,7 @@
|
|
|
21552
21801
|
normalized: this.normalized
|
|
21553
21802
|
};
|
|
21554
21803
|
} else {
|
|
21555
|
-
// save as true
|
|
21804
|
+
// save as true interleaved attribtue
|
|
21556
21805
|
if (data.interleavedBuffers === undefined) {
|
|
21557
21806
|
data.interleavedBuffers = {};
|
|
21558
21807
|
}
|
|
@@ -22196,12 +22445,6 @@
|
|
|
22196
22445
|
|
|
22197
22446
|
class InstancedBufferAttribute extends BufferAttribute {
|
|
22198
22447
|
constructor(array, itemSize, normalized, meshPerAttribute = 1) {
|
|
22199
|
-
if (typeof normalized === 'number') {
|
|
22200
|
-
meshPerAttribute = normalized;
|
|
22201
|
-
normalized = false;
|
|
22202
|
-
console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.');
|
|
22203
|
-
}
|
|
22204
|
-
|
|
22205
22448
|
super(array, itemSize, normalized);
|
|
22206
22449
|
this.isInstancedBufferAttribute = true;
|
|
22207
22450
|
this.meshPerAttribute = meshPerAttribute;
|
|
@@ -23221,10 +23464,10 @@
|
|
|
23221
23464
|
} //
|
|
23222
23465
|
|
|
23223
23466
|
|
|
23224
|
-
const tmp = new Vector3();
|
|
23225
|
-
const px = new CubicPoly()
|
|
23226
|
-
|
|
23227
|
-
|
|
23467
|
+
const tmp = /*@__PURE__*/new Vector3();
|
|
23468
|
+
const px = /*@__PURE__*/new CubicPoly();
|
|
23469
|
+
const py = /*@__PURE__*/new CubicPoly();
|
|
23470
|
+
const pz = /*@__PURE__*/new CubicPoly();
|
|
23228
23471
|
|
|
23229
23472
|
class CatmullRomCurve3 extends Curve {
|
|
23230
23473
|
constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) {
|
|
@@ -24053,7 +24296,7 @@
|
|
|
24053
24296
|
}
|
|
24054
24297
|
|
|
24055
24298
|
class LatheGeometry extends BufferGeometry {
|
|
24056
|
-
constructor(points = [new Vector2(0, 0.5), new Vector2(0.5, 0), new Vector2(0,
|
|
24299
|
+
constructor(points = [new Vector2(0, -0.5), new Vector2(0.5, 0), new Vector2(0, 0.5)], segments = 12, phiStart = 0, phiLength = Math.PI * 2) {
|
|
24057
24300
|
super();
|
|
24058
24301
|
this.type = 'LatheGeometry';
|
|
24059
24302
|
this.parameters = {
|
|
@@ -24657,13 +24900,13 @@
|
|
|
24657
24900
|
|
|
24658
24901
|
}
|
|
24659
24902
|
|
|
24660
|
-
const _v0 = new Vector3();
|
|
24903
|
+
const _v0 = /*@__PURE__*/new Vector3();
|
|
24661
24904
|
|
|
24662
|
-
const _v1$1 = new Vector3();
|
|
24905
|
+
const _v1$1 = /*@__PURE__*/new Vector3();
|
|
24663
24906
|
|
|
24664
|
-
const _normal = new Vector3();
|
|
24907
|
+
const _normal = /*@__PURE__*/new Vector3();
|
|
24665
24908
|
|
|
24666
|
-
const _triangle = new Triangle();
|
|
24909
|
+
const _triangle = /*@__PURE__*/new Triangle();
|
|
24667
24910
|
|
|
24668
24911
|
class EdgesGeometry extends BufferGeometry {
|
|
24669
24912
|
constructor(geometry = null, thresholdAngle = 1) {
|
|
@@ -25537,20 +25780,14 @@
|
|
|
25537
25780
|
|
|
25538
25781
|
const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
|
|
25539
25782
|
const steps = options.steps !== undefined ? options.steps : 1;
|
|
25540
|
-
|
|
25783
|
+
const depth = options.depth !== undefined ? options.depth : 1;
|
|
25541
25784
|
let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
|
|
25542
25785
|
let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;
|
|
25543
25786
|
let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;
|
|
25544
25787
|
let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
|
|
25545
25788
|
let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
|
|
25546
25789
|
const extrudePath = options.extrudePath;
|
|
25547
|
-
const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; //
|
|
25548
|
-
|
|
25549
|
-
if (options.amount !== undefined) {
|
|
25550
|
-
console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.');
|
|
25551
|
-
depth = options.amount;
|
|
25552
|
-
} //
|
|
25553
|
-
|
|
25790
|
+
const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; //
|
|
25554
25791
|
|
|
25555
25792
|
let extrudePts,
|
|
25556
25793
|
extrudeByPath = false;
|
|
@@ -26717,44 +26954,25 @@
|
|
|
26717
26954
|
var Geometries = /*#__PURE__*/Object.freeze({
|
|
26718
26955
|
__proto__: null,
|
|
26719
26956
|
BoxGeometry: BoxGeometry,
|
|
26720
|
-
BoxBufferGeometry: BoxGeometry,
|
|
26721
26957
|
CapsuleGeometry: CapsuleGeometry,
|
|
26722
|
-
CapsuleBufferGeometry: CapsuleGeometry,
|
|
26723
26958
|
CircleGeometry: CircleGeometry,
|
|
26724
|
-
CircleBufferGeometry: CircleGeometry,
|
|
26725
26959
|
ConeGeometry: ConeGeometry,
|
|
26726
|
-
ConeBufferGeometry: ConeGeometry,
|
|
26727
26960
|
CylinderGeometry: CylinderGeometry,
|
|
26728
|
-
CylinderBufferGeometry: CylinderGeometry,
|
|
26729
26961
|
DodecahedronGeometry: DodecahedronGeometry,
|
|
26730
|
-
DodecahedronBufferGeometry: DodecahedronGeometry,
|
|
26731
26962
|
EdgesGeometry: EdgesGeometry,
|
|
26732
26963
|
ExtrudeGeometry: ExtrudeGeometry,
|
|
26733
|
-
ExtrudeBufferGeometry: ExtrudeGeometry,
|
|
26734
26964
|
IcosahedronGeometry: IcosahedronGeometry,
|
|
26735
|
-
IcosahedronBufferGeometry: IcosahedronGeometry,
|
|
26736
26965
|
LatheGeometry: LatheGeometry,
|
|
26737
|
-
LatheBufferGeometry: LatheGeometry,
|
|
26738
26966
|
OctahedronGeometry: OctahedronGeometry,
|
|
26739
|
-
OctahedronBufferGeometry: OctahedronGeometry,
|
|
26740
26967
|
PlaneGeometry: PlaneGeometry,
|
|
26741
|
-
PlaneBufferGeometry: PlaneGeometry,
|
|
26742
26968
|
PolyhedronGeometry: PolyhedronGeometry,
|
|
26743
|
-
PolyhedronBufferGeometry: PolyhedronGeometry,
|
|
26744
26969
|
RingGeometry: RingGeometry,
|
|
26745
|
-
RingBufferGeometry: RingGeometry,
|
|
26746
26970
|
ShapeGeometry: ShapeGeometry,
|
|
26747
|
-
ShapeBufferGeometry: ShapeGeometry,
|
|
26748
26971
|
SphereGeometry: SphereGeometry,
|
|
26749
|
-
SphereBufferGeometry: SphereGeometry,
|
|
26750
26972
|
TetrahedronGeometry: TetrahedronGeometry,
|
|
26751
|
-
TetrahedronBufferGeometry: TetrahedronGeometry,
|
|
26752
26973
|
TorusGeometry: TorusGeometry,
|
|
26753
|
-
TorusBufferGeometry: TorusGeometry,
|
|
26754
26974
|
TorusKnotGeometry: TorusKnotGeometry,
|
|
26755
|
-
TorusKnotBufferGeometry: TorusKnotGeometry,
|
|
26756
26975
|
TubeGeometry: TubeGeometry,
|
|
26757
|
-
TubeBufferGeometry: TubeGeometry,
|
|
26758
26976
|
WireframeGeometry: WireframeGeometry
|
|
26759
26977
|
});
|
|
26760
26978
|
|
|
@@ -27198,6 +27416,14 @@
|
|
|
27198
27416
|
this.emissive = new Color(0x000000);
|
|
27199
27417
|
this.emissiveIntensity = 1.0;
|
|
27200
27418
|
this.emissiveMap = null;
|
|
27419
|
+
this.bumpMap = null;
|
|
27420
|
+
this.bumpScale = 1;
|
|
27421
|
+
this.normalMap = null;
|
|
27422
|
+
this.normalMapType = TangentSpaceNormalMap;
|
|
27423
|
+
this.normalScale = new Vector2(1, 1);
|
|
27424
|
+
this.displacementMap = null;
|
|
27425
|
+
this.displacementScale = 1;
|
|
27426
|
+
this.displacementBias = 0;
|
|
27201
27427
|
this.specularMap = null;
|
|
27202
27428
|
this.alphaMap = null;
|
|
27203
27429
|
this.envMap = null;
|
|
@@ -27208,6 +27434,7 @@
|
|
|
27208
27434
|
this.wireframeLinewidth = 1;
|
|
27209
27435
|
this.wireframeLinecap = 'round';
|
|
27210
27436
|
this.wireframeLinejoin = 'round';
|
|
27437
|
+
this.flatShading = false;
|
|
27211
27438
|
this.fog = true;
|
|
27212
27439
|
this.setValues(parameters);
|
|
27213
27440
|
}
|
|
@@ -27223,6 +27450,14 @@
|
|
|
27223
27450
|
this.emissive.copy(source.emissive);
|
|
27224
27451
|
this.emissiveMap = source.emissiveMap;
|
|
27225
27452
|
this.emissiveIntensity = source.emissiveIntensity;
|
|
27453
|
+
this.bumpMap = source.bumpMap;
|
|
27454
|
+
this.bumpScale = source.bumpScale;
|
|
27455
|
+
this.normalMap = source.normalMap;
|
|
27456
|
+
this.normalMapType = source.normalMapType;
|
|
27457
|
+
this.normalScale.copy(source.normalScale);
|
|
27458
|
+
this.displacementMap = source.displacementMap;
|
|
27459
|
+
this.displacementScale = source.displacementScale;
|
|
27460
|
+
this.displacementBias = source.displacementBias;
|
|
27226
27461
|
this.specularMap = source.specularMap;
|
|
27227
27462
|
this.alphaMap = source.alphaMap;
|
|
27228
27463
|
this.envMap = source.envMap;
|
|
@@ -27233,6 +27468,7 @@
|
|
|
27233
27468
|
this.wireframeLinewidth = source.wireframeLinewidth;
|
|
27234
27469
|
this.wireframeLinecap = source.wireframeLinecap;
|
|
27235
27470
|
this.wireframeLinejoin = source.wireframeLinejoin;
|
|
27471
|
+
this.flatShading = source.flatShading;
|
|
27236
27472
|
this.fog = source.fog;
|
|
27237
27473
|
return this;
|
|
27238
27474
|
}
|
|
@@ -27310,261 +27546,252 @@
|
|
|
27310
27546
|
|
|
27311
27547
|
}
|
|
27312
27548
|
|
|
27313
|
-
|
|
27314
|
-
|
|
27315
|
-
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
MeshPhysicalMaterial,
|
|
27320
|
-
MeshStandardMaterial,
|
|
27321
|
-
MeshPhongMaterial,
|
|
27322
|
-
MeshToonMaterial,
|
|
27323
|
-
MeshNormalMaterial,
|
|
27324
|
-
MeshLambertMaterial,
|
|
27325
|
-
MeshDepthMaterial,
|
|
27326
|
-
MeshDistanceMaterial,
|
|
27327
|
-
MeshBasicMaterial,
|
|
27328
|
-
MeshMatcapMaterial,
|
|
27329
|
-
LineDashedMaterial,
|
|
27330
|
-
LineBasicMaterial,
|
|
27331
|
-
Material
|
|
27332
|
-
};
|
|
27549
|
+
function arraySlice(array, from, to) {
|
|
27550
|
+
if (isTypedArray(array)) {
|
|
27551
|
+
// in ios9 array.subarray(from, undefined) will return empty array
|
|
27552
|
+
// but array.subarray(from) or array.subarray(from, len) is correct
|
|
27553
|
+
return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));
|
|
27554
|
+
}
|
|
27333
27555
|
|
|
27334
|
-
|
|
27335
|
-
|
|
27336
|
-
};
|
|
27556
|
+
return array.slice(from, to);
|
|
27557
|
+
} // converts an array to a specific type
|
|
27337
27558
|
|
|
27338
|
-
const AnimationUtils = {
|
|
27339
|
-
// same as Array.prototype.slice, but also works on typed arrays
|
|
27340
|
-
arraySlice: function (array, from, to) {
|
|
27341
|
-
if (AnimationUtils.isTypedArray(array)) {
|
|
27342
|
-
// in ios9 array.subarray(from, undefined) will return empty array
|
|
27343
|
-
// but array.subarray(from) or array.subarray(from, len) is correct
|
|
27344
|
-
return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));
|
|
27345
|
-
}
|
|
27346
27559
|
|
|
27347
|
-
|
|
27348
|
-
|
|
27349
|
-
|
|
27350
|
-
convertArray: function (array, type, forceClone) {
|
|
27351
|
-
if (!array || // let 'undefined' and 'null' pass
|
|
27352
|
-
!forceClone && array.constructor === type) return array;
|
|
27560
|
+
function convertArray(array, type, forceClone) {
|
|
27561
|
+
if (!array || // let 'undefined' and 'null' pass
|
|
27562
|
+
!forceClone && array.constructor === type) return array;
|
|
27353
27563
|
|
|
27354
|
-
|
|
27355
|
-
|
|
27356
|
-
|
|
27564
|
+
if (typeof type.BYTES_PER_ELEMENT === 'number') {
|
|
27565
|
+
return new type(array); // create typed array
|
|
27566
|
+
}
|
|
27357
27567
|
|
|
27358
|
-
|
|
27359
|
-
|
|
27360
|
-
isTypedArray: function (object) {
|
|
27361
|
-
return ArrayBuffer.isView(object) && !(object instanceof DataView);
|
|
27362
|
-
},
|
|
27363
|
-
// returns an array by which times and values can be sorted
|
|
27364
|
-
getKeyframeOrder: function (times) {
|
|
27365
|
-
function compareTime(i, j) {
|
|
27366
|
-
return times[i] - times[j];
|
|
27367
|
-
}
|
|
27568
|
+
return Array.prototype.slice.call(array); // create Array
|
|
27569
|
+
}
|
|
27368
27570
|
|
|
27369
|
-
|
|
27370
|
-
|
|
27571
|
+
function isTypedArray(object) {
|
|
27572
|
+
return ArrayBuffer.isView(object) && !(object instanceof DataView);
|
|
27573
|
+
} // returns an array by which times and values can be sorted
|
|
27371
27574
|
|
|
27372
|
-
for (let i = 0; i !== n; ++i) result[i] = i;
|
|
27373
27575
|
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
sortedArray: function (values, stride, order) {
|
|
27379
|
-
const nValues = values.length;
|
|
27380
|
-
const result = new values.constructor(nValues);
|
|
27576
|
+
function getKeyframeOrder(times) {
|
|
27577
|
+
function compareTime(i, j) {
|
|
27578
|
+
return times[i] - times[j];
|
|
27579
|
+
}
|
|
27381
27580
|
|
|
27382
|
-
|
|
27383
|
-
|
|
27581
|
+
const n = times.length;
|
|
27582
|
+
const result = new Array(n);
|
|
27384
27583
|
|
|
27385
|
-
|
|
27386
|
-
result[dstOffset++] = values[srcOffset + j];
|
|
27387
|
-
}
|
|
27388
|
-
}
|
|
27584
|
+
for (let i = 0; i !== n; ++i) result[i] = i;
|
|
27389
27585
|
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
|
|
27393
|
-
flattenJSON: function (jsonKeys, times, values, valuePropertyName) {
|
|
27394
|
-
let i = 1,
|
|
27395
|
-
key = jsonKeys[0];
|
|
27586
|
+
result.sort(compareTime);
|
|
27587
|
+
return result;
|
|
27588
|
+
} // uses the array previously returned by 'getKeyframeOrder' to sort data
|
|
27396
27589
|
|
|
27397
|
-
|
|
27398
|
-
|
|
27590
|
+
|
|
27591
|
+
function sortedArray(values, stride, order) {
|
|
27592
|
+
const nValues = values.length;
|
|
27593
|
+
const result = new values.constructor(nValues);
|
|
27594
|
+
|
|
27595
|
+
for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {
|
|
27596
|
+
const srcOffset = order[i] * stride;
|
|
27597
|
+
|
|
27598
|
+
for (let j = 0; j !== stride; ++j) {
|
|
27599
|
+
result[dstOffset++] = values[srcOffset + j];
|
|
27399
27600
|
}
|
|
27601
|
+
}
|
|
27400
27602
|
|
|
27401
|
-
|
|
27603
|
+
return result;
|
|
27604
|
+
} // function for parsing AOS keyframe formats
|
|
27402
27605
|
|
|
27403
|
-
let value = key[valuePropertyName];
|
|
27404
|
-
if (value === undefined) return; // no data
|
|
27405
27606
|
|
|
27406
|
-
|
|
27407
|
-
|
|
27408
|
-
|
|
27607
|
+
function flattenJSON(jsonKeys, times, values, valuePropertyName) {
|
|
27608
|
+
let i = 1,
|
|
27609
|
+
key = jsonKeys[0];
|
|
27409
27610
|
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
}
|
|
27611
|
+
while (key !== undefined && key[valuePropertyName] === undefined) {
|
|
27612
|
+
key = jsonKeys[i++];
|
|
27613
|
+
}
|
|
27414
27614
|
|
|
27415
|
-
|
|
27416
|
-
} while (key !== undefined);
|
|
27417
|
-
} else if (value.toArray !== undefined) {
|
|
27418
|
-
// ...assume THREE.Math-ish
|
|
27419
|
-
do {
|
|
27420
|
-
value = key[valuePropertyName];
|
|
27615
|
+
if (key === undefined) return; // no data
|
|
27421
27616
|
|
|
27422
|
-
|
|
27423
|
-
|
|
27424
|
-
value.toArray(values, values.length);
|
|
27425
|
-
}
|
|
27617
|
+
let value = key[valuePropertyName];
|
|
27618
|
+
if (value === undefined) return; // no data
|
|
27426
27619
|
|
|
27427
|
-
|
|
27428
|
-
|
|
27429
|
-
|
|
27430
|
-
// otherwise push as-is
|
|
27431
|
-
do {
|
|
27432
|
-
value = key[valuePropertyName];
|
|
27620
|
+
if (Array.isArray(value)) {
|
|
27621
|
+
do {
|
|
27622
|
+
value = key[valuePropertyName];
|
|
27433
27623
|
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27624
|
+
if (value !== undefined) {
|
|
27625
|
+
times.push(key.time);
|
|
27626
|
+
values.push.apply(values, value); // push all elements
|
|
27627
|
+
}
|
|
27438
27628
|
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
clip.name = name;
|
|
27446
|
-
const tracks = [];
|
|
27629
|
+
key = jsonKeys[i++];
|
|
27630
|
+
} while (key !== undefined);
|
|
27631
|
+
} else if (value.toArray !== undefined) {
|
|
27632
|
+
// ...assume THREE.Math-ish
|
|
27633
|
+
do {
|
|
27634
|
+
value = key[valuePropertyName];
|
|
27447
27635
|
|
|
27448
|
-
|
|
27449
|
-
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
const values = [];
|
|
27636
|
+
if (value !== undefined) {
|
|
27637
|
+
times.push(key.time);
|
|
27638
|
+
value.toArray(values, values.length);
|
|
27639
|
+
}
|
|
27453
27640
|
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
|
|
27457
|
-
|
|
27641
|
+
key = jsonKeys[i++];
|
|
27642
|
+
} while (key !== undefined);
|
|
27643
|
+
} else {
|
|
27644
|
+
// otherwise push as-is
|
|
27645
|
+
do {
|
|
27646
|
+
value = key[valuePropertyName];
|
|
27458
27647
|
|
|
27459
|
-
|
|
27460
|
-
|
|
27461
|
-
|
|
27648
|
+
if (value !== undefined) {
|
|
27649
|
+
times.push(key.time);
|
|
27650
|
+
values.push(value);
|
|
27462
27651
|
}
|
|
27463
27652
|
|
|
27464
|
-
|
|
27465
|
-
|
|
27466
|
-
|
|
27467
|
-
|
|
27468
|
-
}
|
|
27653
|
+
key = jsonKeys[i++];
|
|
27654
|
+
} while (key !== undefined);
|
|
27655
|
+
}
|
|
27656
|
+
}
|
|
27469
27657
|
|
|
27470
|
-
|
|
27658
|
+
function subclip(sourceClip, name, startFrame, endFrame, fps = 30) {
|
|
27659
|
+
const clip = sourceClip.clone();
|
|
27660
|
+
clip.name = name;
|
|
27661
|
+
const tracks = [];
|
|
27471
27662
|
|
|
27472
|
-
|
|
27663
|
+
for (let i = 0; i < clip.tracks.length; ++i) {
|
|
27664
|
+
const track = clip.tracks[i];
|
|
27665
|
+
const valueSize = track.getValueSize();
|
|
27666
|
+
const times = [];
|
|
27667
|
+
const values = [];
|
|
27473
27668
|
|
|
27474
|
-
for (let
|
|
27475
|
-
|
|
27476
|
-
|
|
27669
|
+
for (let j = 0; j < track.times.length; ++j) {
|
|
27670
|
+
const frame = track.times[j] * fps;
|
|
27671
|
+
if (frame < startFrame || frame >= endFrame) continue;
|
|
27672
|
+
times.push(track.times[j]);
|
|
27673
|
+
|
|
27674
|
+
for (let k = 0; k < valueSize; ++k) {
|
|
27675
|
+
values.push(track.values[j * valueSize + k]);
|
|
27477
27676
|
}
|
|
27478
|
-
}
|
|
27677
|
+
}
|
|
27479
27678
|
|
|
27679
|
+
if (times.length === 0) continue;
|
|
27680
|
+
track.times = convertArray(times, track.times.constructor);
|
|
27681
|
+
track.values = convertArray(values, track.values.constructor);
|
|
27682
|
+
tracks.push(track);
|
|
27683
|
+
}
|
|
27480
27684
|
|
|
27481
|
-
|
|
27482
|
-
|
|
27685
|
+
clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip
|
|
27686
|
+
|
|
27687
|
+
let minStartTime = Infinity;
|
|
27688
|
+
|
|
27689
|
+
for (let i = 0; i < clip.tracks.length; ++i) {
|
|
27690
|
+
if (minStartTime > clip.tracks[i].times[0]) {
|
|
27691
|
+
minStartTime = clip.tracks[i].times[0];
|
|
27483
27692
|
}
|
|
27693
|
+
} // shift all tracks such that clip begins at t=0
|
|
27484
27694
|
|
|
27485
|
-
clip.resetDuration();
|
|
27486
|
-
return clip;
|
|
27487
|
-
},
|
|
27488
|
-
makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {
|
|
27489
|
-
if (fps <= 0) fps = 30;
|
|
27490
|
-
const numTracks = referenceClip.tracks.length;
|
|
27491
|
-
const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame
|
|
27492
27695
|
|
|
27493
|
-
|
|
27494
|
-
|
|
27495
|
-
|
|
27696
|
+
for (let i = 0; i < clip.tracks.length; ++i) {
|
|
27697
|
+
clip.tracks[i].shift(-1 * minStartTime);
|
|
27698
|
+
}
|
|
27496
27699
|
|
|
27497
|
-
|
|
27700
|
+
clip.resetDuration();
|
|
27701
|
+
return clip;
|
|
27702
|
+
}
|
|
27498
27703
|
|
|
27499
|
-
|
|
27500
|
-
|
|
27501
|
-
|
|
27502
|
-
|
|
27503
|
-
let referenceOffset = 0;
|
|
27504
|
-
const referenceValueSize = referenceTrack.getValueSize();
|
|
27704
|
+
function makeClipAdditive(targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {
|
|
27705
|
+
if (fps <= 0) fps = 30;
|
|
27706
|
+
const numTracks = referenceClip.tracks.length;
|
|
27707
|
+
const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame
|
|
27505
27708
|
|
|
27506
|
-
|
|
27507
|
-
|
|
27508
|
-
|
|
27709
|
+
for (let i = 0; i < numTracks; ++i) {
|
|
27710
|
+
const referenceTrack = referenceClip.tracks[i];
|
|
27711
|
+
const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric
|
|
27509
27712
|
|
|
27510
|
-
|
|
27511
|
-
const targetValueSize = targetTrack.getValueSize();
|
|
27713
|
+
if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track
|
|
27512
27714
|
|
|
27513
|
-
|
|
27514
|
-
|
|
27515
|
-
|
|
27715
|
+
const targetTrack = targetClip.tracks.find(function (track) {
|
|
27716
|
+
return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;
|
|
27717
|
+
});
|
|
27718
|
+
if (targetTrack === undefined) continue;
|
|
27719
|
+
let referenceOffset = 0;
|
|
27720
|
+
const referenceValueSize = referenceTrack.getValueSize();
|
|
27516
27721
|
|
|
27517
|
-
|
|
27518
|
-
|
|
27722
|
+
if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
|
|
27723
|
+
referenceOffset = referenceValueSize / 3;
|
|
27724
|
+
}
|
|
27519
27725
|
|
|
27520
|
-
|
|
27521
|
-
|
|
27522
|
-
|
|
27523
|
-
|
|
27524
|
-
|
|
27525
|
-
|
|
27526
|
-
// Reference frame is after the last keyframe, so just use the last keyframe
|
|
27527
|
-
const startIndex = lastIndex * referenceValueSize + referenceOffset;
|
|
27528
|
-
const endIndex = startIndex + referenceValueSize - referenceOffset;
|
|
27529
|
-
referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
|
|
27530
|
-
} else {
|
|
27531
|
-
// Interpolate to the reference value
|
|
27532
|
-
const interpolant = referenceTrack.createInterpolant();
|
|
27533
|
-
const startIndex = referenceOffset;
|
|
27534
|
-
const endIndex = referenceValueSize - referenceOffset;
|
|
27535
|
-
interpolant.evaluate(referenceTime);
|
|
27536
|
-
referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex);
|
|
27537
|
-
} // Conjugate the quaternion
|
|
27726
|
+
let targetOffset = 0;
|
|
27727
|
+
const targetValueSize = targetTrack.getValueSize();
|
|
27728
|
+
|
|
27729
|
+
if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
|
|
27730
|
+
targetOffset = targetValueSize / 3;
|
|
27731
|
+
}
|
|
27538
27732
|
|
|
27733
|
+
const lastIndex = referenceTrack.times.length - 1;
|
|
27734
|
+
let referenceValue; // Find the value to subtract out of the track
|
|
27539
27735
|
|
|
27540
|
-
|
|
27541
|
-
|
|
27542
|
-
|
|
27543
|
-
|
|
27736
|
+
if (referenceTime <= referenceTrack.times[0]) {
|
|
27737
|
+
// Reference frame is earlier than the first keyframe, so just use the first keyframe
|
|
27738
|
+
const startIndex = referenceOffset;
|
|
27739
|
+
const endIndex = referenceValueSize - referenceOffset;
|
|
27740
|
+
referenceValue = arraySlice(referenceTrack.values, startIndex, endIndex);
|
|
27741
|
+
} else if (referenceTime >= referenceTrack.times[lastIndex]) {
|
|
27742
|
+
// Reference frame is after the last keyframe, so just use the last keyframe
|
|
27743
|
+
const startIndex = lastIndex * referenceValueSize + referenceOffset;
|
|
27744
|
+
const endIndex = startIndex + referenceValueSize - referenceOffset;
|
|
27745
|
+
referenceValue = arraySlice(referenceTrack.values, startIndex, endIndex);
|
|
27746
|
+
} else {
|
|
27747
|
+
// Interpolate to the reference value
|
|
27748
|
+
const interpolant = referenceTrack.createInterpolant();
|
|
27749
|
+
const startIndex = referenceOffset;
|
|
27750
|
+
const endIndex = referenceValueSize - referenceOffset;
|
|
27751
|
+
interpolant.evaluate(referenceTime);
|
|
27752
|
+
referenceValue = arraySlice(interpolant.resultBuffer, startIndex, endIndex);
|
|
27753
|
+
} // Conjugate the quaternion
|
|
27544
27754
|
|
|
27545
27755
|
|
|
27546
|
-
|
|
27756
|
+
if (referenceTrackType === 'quaternion') {
|
|
27757
|
+
const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate();
|
|
27758
|
+
referenceQuat.toArray(referenceValue);
|
|
27759
|
+
} // Subtract the reference value from all of the track values
|
|
27547
27760
|
|
|
27548
|
-
for (let j = 0; j < numTimes; ++j) {
|
|
27549
|
-
const valueStart = j * targetValueSize + targetOffset;
|
|
27550
27761
|
|
|
27551
|
-
|
|
27552
|
-
// Multiply the conjugate for quaternion track types
|
|
27553
|
-
Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);
|
|
27554
|
-
} else {
|
|
27555
|
-
const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types
|
|
27762
|
+
const numTimes = targetTrack.times.length;
|
|
27556
27763
|
|
|
27557
|
-
|
|
27558
|
-
|
|
27559
|
-
|
|
27764
|
+
for (let j = 0; j < numTimes; ++j) {
|
|
27765
|
+
const valueStart = j * targetValueSize + targetOffset;
|
|
27766
|
+
|
|
27767
|
+
if (referenceTrackType === 'quaternion') {
|
|
27768
|
+
// Multiply the conjugate for quaternion track types
|
|
27769
|
+
Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);
|
|
27770
|
+
} else {
|
|
27771
|
+
const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types
|
|
27772
|
+
|
|
27773
|
+
for (let k = 0; k < valueEnd; ++k) {
|
|
27774
|
+
targetTrack.values[valueStart + k] -= referenceValue[k];
|
|
27560
27775
|
}
|
|
27561
27776
|
}
|
|
27562
27777
|
}
|
|
27563
|
-
|
|
27564
|
-
targetClip.blendMode = AdditiveAnimationBlendMode;
|
|
27565
|
-
return targetClip;
|
|
27566
27778
|
}
|
|
27567
|
-
|
|
27779
|
+
|
|
27780
|
+
targetClip.blendMode = AdditiveAnimationBlendMode;
|
|
27781
|
+
return targetClip;
|
|
27782
|
+
}
|
|
27783
|
+
|
|
27784
|
+
var AnimationUtils = /*#__PURE__*/Object.freeze({
|
|
27785
|
+
__proto__: null,
|
|
27786
|
+
arraySlice: arraySlice,
|
|
27787
|
+
convertArray: convertArray,
|
|
27788
|
+
isTypedArray: isTypedArray,
|
|
27789
|
+
getKeyframeOrder: getKeyframeOrder,
|
|
27790
|
+
sortedArray: sortedArray,
|
|
27791
|
+
flattenJSON: flattenJSON,
|
|
27792
|
+
subclip: subclip,
|
|
27793
|
+
makeClipAdditive: makeClipAdditive
|
|
27794
|
+
});
|
|
27568
27795
|
|
|
27569
27796
|
/**
|
|
27570
27797
|
* Abstract base class of interpolants over parametric samples.
|
|
@@ -27898,8 +28125,8 @@
|
|
|
27898
28125
|
if (name === undefined) throw new Error('THREE.KeyframeTrack: track name is undefined');
|
|
27899
28126
|
if (times === undefined || times.length === 0) throw new Error('THREE.KeyframeTrack: no keyframes in track named ' + name);
|
|
27900
28127
|
this.name = name;
|
|
27901
|
-
this.times =
|
|
27902
|
-
this.values =
|
|
28128
|
+
this.times = convertArray(times, this.TimeBufferType);
|
|
28129
|
+
this.values = convertArray(values, this.ValueBufferType);
|
|
27903
28130
|
this.setInterpolation(interpolation || this.DefaultInterpolation);
|
|
27904
28131
|
} // Serialization (in static context, because of constructor invocation
|
|
27905
28132
|
// and automatic invocation of .toJSON):
|
|
@@ -27915,8 +28142,8 @@
|
|
|
27915
28142
|
// by default, we assume the data can be serialized as-is
|
|
27916
28143
|
json = {
|
|
27917
28144
|
'name': track.name,
|
|
27918
|
-
'times':
|
|
27919
|
-
'values':
|
|
28145
|
+
'times': convertArray(track.times, Array),
|
|
28146
|
+
'values': convertArray(track.values, Array)
|
|
27920
28147
|
};
|
|
27921
28148
|
const interpolation = track.getInterpolation();
|
|
27922
28149
|
|
|
@@ -28048,8 +28275,8 @@
|
|
|
28048
28275
|
}
|
|
28049
28276
|
|
|
28050
28277
|
const stride = this.getValueSize();
|
|
28051
|
-
this.times =
|
|
28052
|
-
this.values =
|
|
28278
|
+
this.times = arraySlice(times, from, to);
|
|
28279
|
+
this.values = arraySlice(this.values, from * stride, to * stride);
|
|
28053
28280
|
}
|
|
28054
28281
|
|
|
28055
28282
|
return this;
|
|
@@ -28095,7 +28322,7 @@
|
|
|
28095
28322
|
}
|
|
28096
28323
|
|
|
28097
28324
|
if (values !== undefined) {
|
|
28098
|
-
if (
|
|
28325
|
+
if (isTypedArray(values)) {
|
|
28099
28326
|
for (let i = 0, n = values.length; i !== n; ++i) {
|
|
28100
28327
|
const value = values[i];
|
|
28101
28328
|
|
|
@@ -28115,8 +28342,8 @@
|
|
|
28115
28342
|
|
|
28116
28343
|
optimize() {
|
|
28117
28344
|
// times or values may be shared with other tracks, so overwriting is unsafe
|
|
28118
|
-
const times =
|
|
28119
|
-
values =
|
|
28345
|
+
const times = arraySlice(this.times),
|
|
28346
|
+
values = arraySlice(this.values),
|
|
28120
28347
|
stride = this.getValueSize(),
|
|
28121
28348
|
smoothInterpolation = this.getInterpolation() === InterpolateSmooth,
|
|
28122
28349
|
lastIndex = times.length - 1;
|
|
@@ -28175,8 +28402,8 @@
|
|
|
28175
28402
|
}
|
|
28176
28403
|
|
|
28177
28404
|
if (writeIndex !== times.length) {
|
|
28178
|
-
this.times =
|
|
28179
|
-
this.values =
|
|
28405
|
+
this.times = arraySlice(times, 0, writeIndex);
|
|
28406
|
+
this.values = arraySlice(values, 0, writeIndex * stride);
|
|
28180
28407
|
} else {
|
|
28181
28408
|
this.times = times;
|
|
28182
28409
|
this.values = values;
|
|
@@ -28186,8 +28413,8 @@
|
|
|
28186
28413
|
}
|
|
28187
28414
|
|
|
28188
28415
|
clone() {
|
|
28189
|
-
const times =
|
|
28190
|
-
const values =
|
|
28416
|
+
const times = arraySlice(this.times, 0);
|
|
28417
|
+
const values = arraySlice(this.values, 0);
|
|
28191
28418
|
const TypedKeyframeTrack = this.constructor;
|
|
28192
28419
|
const track = new TypedKeyframeTrack(this.name, times, values); // Interpolant argument to constructor is not saved, so copy the factory method directly.
|
|
28193
28420
|
|
|
@@ -28344,9 +28571,9 @@
|
|
|
28344
28571
|
let values = [];
|
|
28345
28572
|
times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);
|
|
28346
28573
|
values.push(0, 1, 0);
|
|
28347
|
-
const order =
|
|
28348
|
-
times =
|
|
28349
|
-
values =
|
|
28574
|
+
const order = getKeyframeOrder(times);
|
|
28575
|
+
times = sortedArray(times, 1, order);
|
|
28576
|
+
values = sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the
|
|
28350
28577
|
// last frame as well for perfect loop.
|
|
28351
28578
|
|
|
28352
28579
|
if (!noLoop && times[0] === 0) {
|
|
@@ -28421,7 +28648,7 @@
|
|
|
28421
28648
|
if (animationKeys.length !== 0) {
|
|
28422
28649
|
const times = [];
|
|
28423
28650
|
const values = [];
|
|
28424
|
-
|
|
28651
|
+
flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again
|
|
28425
28652
|
|
|
28426
28653
|
if (times.length !== 0) {
|
|
28427
28654
|
destTracks.push(new trackType(trackName, times, values));
|
|
@@ -28586,7 +28813,7 @@
|
|
|
28586
28813
|
if (json.times === undefined) {
|
|
28587
28814
|
const times = [],
|
|
28588
28815
|
values = [];
|
|
28589
|
-
|
|
28816
|
+
flattenJSON(json.keys, times, values, 'value');
|
|
28590
28817
|
json.times = times;
|
|
28591
28818
|
json.values = values;
|
|
28592
28819
|
} // derived classes can define a static parse method
|
|
@@ -28715,7 +28942,7 @@
|
|
|
28715
28942
|
|
|
28716
28943
|
}
|
|
28717
28944
|
|
|
28718
|
-
const DefaultLoadingManager = new LoadingManager();
|
|
28945
|
+
const DefaultLoadingManager = /*@__PURE__*/new LoadingManager();
|
|
28719
28946
|
|
|
28720
28947
|
class Loader {
|
|
28721
28948
|
constructor(manager) {
|
|
@@ -28767,6 +28994,14 @@
|
|
|
28767
28994
|
|
|
28768
28995
|
const loading = {};
|
|
28769
28996
|
|
|
28997
|
+
class HttpError extends Error {
|
|
28998
|
+
constructor(message, response) {
|
|
28999
|
+
super(message);
|
|
29000
|
+
this.response = response;
|
|
29001
|
+
}
|
|
29002
|
+
|
|
29003
|
+
}
|
|
29004
|
+
|
|
28770
29005
|
class FileLoader extends Loader {
|
|
28771
29006
|
constructor(manager) {
|
|
28772
29007
|
super(manager);
|
|
@@ -28868,7 +29103,7 @@
|
|
|
28868
29103
|
});
|
|
28869
29104
|
return new Response(stream);
|
|
28870
29105
|
} else {
|
|
28871
|
-
throw
|
|
29106
|
+
throw new HttpError(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`, response);
|
|
28872
29107
|
}
|
|
28873
29108
|
}).then(response => {
|
|
28874
29109
|
switch (responseType) {
|
|
@@ -29455,6 +29690,7 @@
|
|
|
29455
29690
|
this.penumbra = penumbra;
|
|
29456
29691
|
this.decay = decay; // for physically correct lights, should be 2.
|
|
29457
29692
|
|
|
29693
|
+
this.map = null;
|
|
29458
29694
|
this.shadow = new SpotLightShadow();
|
|
29459
29695
|
}
|
|
29460
29696
|
|
|
@@ -29909,7 +30145,7 @@
|
|
|
29909
30145
|
return textures[name];
|
|
29910
30146
|
}
|
|
29911
30147
|
|
|
29912
|
-
const material =
|
|
30148
|
+
const material = MaterialLoader.createMaterialFromType(json.type);
|
|
29913
30149
|
if (json.uuid !== undefined) material.uuid = json.uuid;
|
|
29914
30150
|
if (json.name !== undefined) material.name = json.name;
|
|
29915
30151
|
if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);
|
|
@@ -30023,17 +30259,15 @@
|
|
|
30023
30259
|
if (json.defines !== undefined) material.defines = json.defines;
|
|
30024
30260
|
if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;
|
|
30025
30261
|
if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;
|
|
30262
|
+
if (json.glslVersion !== undefined) material.glslVersion = json.glslVersion;
|
|
30026
30263
|
|
|
30027
30264
|
if (json.extensions !== undefined) {
|
|
30028
30265
|
for (const key in json.extensions) {
|
|
30029
30266
|
material.extensions[key] = json.extensions[key];
|
|
30030
30267
|
}
|
|
30031
|
-
} //
|
|
30268
|
+
} // for PointsMaterial
|
|
30032
30269
|
|
|
30033
30270
|
|
|
30034
|
-
if (json.shading !== undefined) material.flatShading = json.shading === 1; // THREE.FlatShading
|
|
30035
|
-
// for PointsMaterial
|
|
30036
|
-
|
|
30037
30271
|
if (json.size !== undefined) material.size = json.size;
|
|
30038
30272
|
if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; // maps
|
|
30039
30273
|
|
|
@@ -30093,6 +30327,30 @@
|
|
|
30093
30327
|
return this;
|
|
30094
30328
|
}
|
|
30095
30329
|
|
|
30330
|
+
static createMaterialFromType(type) {
|
|
30331
|
+
const materialLib = {
|
|
30332
|
+
ShadowMaterial,
|
|
30333
|
+
SpriteMaterial,
|
|
30334
|
+
RawShaderMaterial,
|
|
30335
|
+
ShaderMaterial,
|
|
30336
|
+
PointsMaterial,
|
|
30337
|
+
MeshPhysicalMaterial,
|
|
30338
|
+
MeshStandardMaterial,
|
|
30339
|
+
MeshPhongMaterial,
|
|
30340
|
+
MeshToonMaterial,
|
|
30341
|
+
MeshNormalMaterial,
|
|
30342
|
+
MeshLambertMaterial,
|
|
30343
|
+
MeshDepthMaterial,
|
|
30344
|
+
MeshDistanceMaterial,
|
|
30345
|
+
MeshBasicMaterial,
|
|
30346
|
+
MeshMatcapMaterial,
|
|
30347
|
+
LineDashedMaterial,
|
|
30348
|
+
LineBasicMaterial,
|
|
30349
|
+
Material
|
|
30350
|
+
};
|
|
30351
|
+
return new materialLib[type]();
|
|
30352
|
+
}
|
|
30353
|
+
|
|
30096
30354
|
}
|
|
30097
30355
|
|
|
30098
30356
|
class LoaderUtils {
|
|
@@ -30502,28 +30760,11 @@
|
|
|
30502
30760
|
for (let i = 0, l = json.length; i < l; i++) {
|
|
30503
30761
|
const data = json[i];
|
|
30504
30762
|
|
|
30505
|
-
if (data.
|
|
30506
|
-
|
|
30507
|
-
const array = [];
|
|
30508
|
-
|
|
30509
|
-
for (let j = 0; j < data.materials.length; j++) {
|
|
30510
|
-
const material = data.materials[j];
|
|
30511
|
-
|
|
30512
|
-
if (cache[material.uuid] === undefined) {
|
|
30513
|
-
cache[material.uuid] = loader.parse(material);
|
|
30514
|
-
}
|
|
30515
|
-
|
|
30516
|
-
array.push(cache[material.uuid]);
|
|
30517
|
-
}
|
|
30518
|
-
|
|
30519
|
-
materials[data.uuid] = array;
|
|
30520
|
-
} else {
|
|
30521
|
-
if (cache[data.uuid] === undefined) {
|
|
30522
|
-
cache[data.uuid] = loader.parse(data);
|
|
30523
|
-
}
|
|
30524
|
-
|
|
30525
|
-
materials[data.uuid] = cache[data.uuid];
|
|
30763
|
+
if (cache[data.uuid] === undefined) {
|
|
30764
|
+
cache[data.uuid] = loader.parse(data);
|
|
30526
30765
|
}
|
|
30766
|
+
|
|
30767
|
+
materials[data.uuid] = cache[data.uuid];
|
|
30527
30768
|
}
|
|
30528
30769
|
}
|
|
30529
30770
|
|
|
@@ -31004,13 +31245,6 @@
|
|
|
31004
31245
|
}
|
|
31005
31246
|
});
|
|
31006
31247
|
}
|
|
31007
|
-
/* DEPRECATED */
|
|
31008
|
-
|
|
31009
|
-
|
|
31010
|
-
setTexturePath(value) {
|
|
31011
|
-
console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().');
|
|
31012
|
-
return this.setResourcePath(value);
|
|
31013
|
-
}
|
|
31014
31248
|
|
|
31015
31249
|
}
|
|
31016
31250
|
|
|
@@ -32012,22 +32246,22 @@
|
|
|
32012
32246
|
// be matched to parse the rest of the track name.
|
|
32013
32247
|
|
|
32014
32248
|
|
|
32015
|
-
const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
|
|
32249
|
+
const _directoryRe = /*@__PURE__*/ /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
|
|
32016
32250
|
|
|
32017
32251
|
|
|
32018
|
-
const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved
|
|
32252
|
+
const _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved
|
|
32019
32253
|
// characters. Accessor may contain any character except closing bracket.
|
|
32020
32254
|
|
|
32021
32255
|
|
|
32022
|
-
const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may
|
|
32256
|
+
const _objectRe = /*@__PURE__*/ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may
|
|
32023
32257
|
// contain any non-bracket characters.
|
|
32024
32258
|
|
|
32025
32259
|
|
|
32026
|
-
const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar);
|
|
32260
|
+
const _propertyRe = /*@__PURE__*/ /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar);
|
|
32027
32261
|
|
|
32028
32262
|
const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$');
|
|
32029
32263
|
|
|
32030
|
-
const _supportedObjectNames = ['material', 'materials', 'bones'];
|
|
32264
|
+
const _supportedObjectNames = ['material', 'materials', 'bones', 'map'];
|
|
32031
32265
|
|
|
32032
32266
|
class Composite {
|
|
32033
32267
|
constructor(targetGroup, path, optionalParsedPath) {
|
|
@@ -32354,6 +32588,20 @@
|
|
|
32354
32588
|
|
|
32355
32589
|
break;
|
|
32356
32590
|
|
|
32591
|
+
case 'map':
|
|
32592
|
+
if (!targetObject.material) {
|
|
32593
|
+
console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);
|
|
32594
|
+
return;
|
|
32595
|
+
}
|
|
32596
|
+
|
|
32597
|
+
if (!targetObject.material.map) {
|
|
32598
|
+
console.error('THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this);
|
|
32599
|
+
return;
|
|
32600
|
+
}
|
|
32601
|
+
|
|
32602
|
+
targetObject = targetObject.material.map;
|
|
32603
|
+
break;
|
|
32604
|
+
|
|
32357
32605
|
default:
|
|
32358
32606
|
if (targetObject[objectName] === undefined) {
|
|
32359
32607
|
console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this);
|
|
@@ -33001,13 +33249,12 @@
|
|
|
33001
33249
|
const timeRunning = (time - startTime) * timeDirection;
|
|
33002
33250
|
|
|
33003
33251
|
if (timeRunning < 0 || timeDirection === 0) {
|
|
33004
|
-
|
|
33005
|
-
}
|
|
33006
|
-
|
|
33007
|
-
|
|
33008
|
-
this._startTime = null; // unschedule
|
|
33252
|
+
deltaTime = 0;
|
|
33253
|
+
} else {
|
|
33254
|
+
this._startTime = null; // unschedule
|
|
33009
33255
|
|
|
33010
|
-
|
|
33256
|
+
deltaTime = timeDirection * timeRunning;
|
|
33257
|
+
}
|
|
33011
33258
|
} // apply time scale and advance time
|
|
33012
33259
|
|
|
33013
33260
|
|
|
@@ -33248,7 +33495,7 @@
|
|
|
33248
33495
|
|
|
33249
33496
|
}
|
|
33250
33497
|
|
|
33251
|
-
const _controlInterpolantsResultBuffer =
|
|
33498
|
+
const _controlInterpolantsResultBuffer = new Float32Array(1);
|
|
33252
33499
|
|
|
33253
33500
|
class AnimationMixer extends EventDispatcher {
|
|
33254
33501
|
constructor(root) {
|
|
@@ -33791,11 +34038,6 @@
|
|
|
33791
34038
|
|
|
33792
34039
|
class Uniform {
|
|
33793
34040
|
constructor(value) {
|
|
33794
|
-
if (typeof value === 'string') {
|
|
33795
|
-
console.warn('THREE.Uniform: Type parameter is no longer needed.');
|
|
33796
|
-
value = arguments[1];
|
|
33797
|
-
}
|
|
33798
|
-
|
|
33799
34041
|
this.value = value;
|
|
33800
34042
|
}
|
|
33801
34043
|
|
|
@@ -33805,6 +34047,67 @@
|
|
|
33805
34047
|
|
|
33806
34048
|
}
|
|
33807
34049
|
|
|
34050
|
+
let id = 0;
|
|
34051
|
+
|
|
34052
|
+
class UniformsGroup extends EventDispatcher {
|
|
34053
|
+
constructor() {
|
|
34054
|
+
super();
|
|
34055
|
+
this.isUniformsGroup = true;
|
|
34056
|
+
Object.defineProperty(this, 'id', {
|
|
34057
|
+
value: id++
|
|
34058
|
+
});
|
|
34059
|
+
this.name = '';
|
|
34060
|
+
this.usage = StaticDrawUsage;
|
|
34061
|
+
this.uniforms = [];
|
|
34062
|
+
}
|
|
34063
|
+
|
|
34064
|
+
add(uniform) {
|
|
34065
|
+
this.uniforms.push(uniform);
|
|
34066
|
+
return this;
|
|
34067
|
+
}
|
|
34068
|
+
|
|
34069
|
+
remove(uniform) {
|
|
34070
|
+
const index = this.uniforms.indexOf(uniform);
|
|
34071
|
+
if (index !== -1) this.uniforms.splice(index, 1);
|
|
34072
|
+
return this;
|
|
34073
|
+
}
|
|
34074
|
+
|
|
34075
|
+
setName(name) {
|
|
34076
|
+
this.name = name;
|
|
34077
|
+
return this;
|
|
34078
|
+
}
|
|
34079
|
+
|
|
34080
|
+
setUsage(value) {
|
|
34081
|
+
this.usage = value;
|
|
34082
|
+
return this;
|
|
34083
|
+
}
|
|
34084
|
+
|
|
34085
|
+
dispose() {
|
|
34086
|
+
this.dispatchEvent({
|
|
34087
|
+
type: 'dispose'
|
|
34088
|
+
});
|
|
34089
|
+
return this;
|
|
34090
|
+
}
|
|
34091
|
+
|
|
34092
|
+
copy(source) {
|
|
34093
|
+
this.name = source.name;
|
|
34094
|
+
this.usage = source.usage;
|
|
34095
|
+
const uniformsSource = source.uniforms;
|
|
34096
|
+
this.uniforms.length = 0;
|
|
34097
|
+
|
|
34098
|
+
for (let i = 0, l = uniformsSource.length; i < l; i++) {
|
|
34099
|
+
this.uniforms.push(uniformsSource[i].clone());
|
|
34100
|
+
}
|
|
34101
|
+
|
|
34102
|
+
return this;
|
|
34103
|
+
}
|
|
34104
|
+
|
|
34105
|
+
clone() {
|
|
34106
|
+
return new this.constructor().copy(this);
|
|
34107
|
+
}
|
|
34108
|
+
|
|
34109
|
+
}
|
|
34110
|
+
|
|
33808
34111
|
class InstancedInterleavedBuffer extends InterleavedBuffer {
|
|
33809
34112
|
constructor(array, stride, meshPerAttribute = 1) {
|
|
33810
34113
|
super(array, stride);
|
|
@@ -34565,27 +34868,29 @@
|
|
|
34565
34868
|
}
|
|
34566
34869
|
|
|
34567
34870
|
class PolarGridHelper extends LineSegments {
|
|
34568
|
-
constructor(radius = 10,
|
|
34871
|
+
constructor(radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888) {
|
|
34569
34872
|
color1 = new Color(color1);
|
|
34570
34873
|
color2 = new Color(color2);
|
|
34571
34874
|
const vertices = [];
|
|
34572
|
-
const colors = []; // create the
|
|
34875
|
+
const colors = []; // create the sectors
|
|
34573
34876
|
|
|
34574
|
-
|
|
34575
|
-
|
|
34576
|
-
|
|
34577
|
-
|
|
34578
|
-
|
|
34579
|
-
|
|
34580
|
-
|
|
34581
|
-
|
|
34582
|
-
|
|
34583
|
-
|
|
34877
|
+
if (sectors > 1) {
|
|
34878
|
+
for (let i = 0; i < sectors; i++) {
|
|
34879
|
+
const v = i / sectors * (Math.PI * 2);
|
|
34880
|
+
const x = Math.sin(v) * radius;
|
|
34881
|
+
const z = Math.cos(v) * radius;
|
|
34882
|
+
vertices.push(0, 0, 0);
|
|
34883
|
+
vertices.push(x, 0, z);
|
|
34884
|
+
const color = i & 1 ? color1 : color2;
|
|
34885
|
+
colors.push(color.r, color.g, color.b);
|
|
34886
|
+
colors.push(color.r, color.g, color.b);
|
|
34887
|
+
}
|
|
34888
|
+
} // create the rings
|
|
34584
34889
|
|
|
34585
34890
|
|
|
34586
|
-
for (let i = 0; i
|
|
34891
|
+
for (let i = 0; i < rings; i++) {
|
|
34587
34892
|
const color = i & 1 ? color1 : color2;
|
|
34588
|
-
const r = radius - radius /
|
|
34893
|
+
const r = radius - radius / rings * i;
|
|
34589
34894
|
|
|
34590
34895
|
for (let j = 0; j < divisions; j++) {
|
|
34591
34896
|
// first vertex
|
|
@@ -34697,54 +35002,48 @@
|
|
|
34697
35002
|
});
|
|
34698
35003
|
const vertices = [];
|
|
34699
35004
|
const colors = [];
|
|
34700
|
-
const pointMap = {}; //
|
|
34701
|
-
|
|
34702
|
-
const colorFrustum = new Color(0xffaa00);
|
|
34703
|
-
const colorCone = new Color(0xff0000);
|
|
34704
|
-
const colorUp = new Color(0x00aaff);
|
|
34705
|
-
const colorTarget = new Color(0xffffff);
|
|
34706
|
-
const colorCross = new Color(0x333333); // near
|
|
35005
|
+
const pointMap = {}; // near
|
|
34707
35006
|
|
|
34708
|
-
addLine('n1', 'n2'
|
|
34709
|
-
addLine('n2', 'n4'
|
|
34710
|
-
addLine('n4', 'n3'
|
|
34711
|
-
addLine('n3', 'n1'
|
|
35007
|
+
addLine('n1', 'n2');
|
|
35008
|
+
addLine('n2', 'n4');
|
|
35009
|
+
addLine('n4', 'n3');
|
|
35010
|
+
addLine('n3', 'n1'); // far
|
|
34712
35011
|
|
|
34713
|
-
addLine('f1', 'f2'
|
|
34714
|
-
addLine('f2', 'f4'
|
|
34715
|
-
addLine('f4', 'f3'
|
|
34716
|
-
addLine('f3', 'f1'
|
|
35012
|
+
addLine('f1', 'f2');
|
|
35013
|
+
addLine('f2', 'f4');
|
|
35014
|
+
addLine('f4', 'f3');
|
|
35015
|
+
addLine('f3', 'f1'); // sides
|
|
34717
35016
|
|
|
34718
|
-
addLine('n1', 'f1'
|
|
34719
|
-
addLine('n2', 'f2'
|
|
34720
|
-
addLine('n3', 'f3'
|
|
34721
|
-
addLine('n4', 'f4'
|
|
35017
|
+
addLine('n1', 'f1');
|
|
35018
|
+
addLine('n2', 'f2');
|
|
35019
|
+
addLine('n3', 'f3');
|
|
35020
|
+
addLine('n4', 'f4'); // cone
|
|
34722
35021
|
|
|
34723
|
-
addLine('p', 'n1'
|
|
34724
|
-
addLine('p', 'n2'
|
|
34725
|
-
addLine('p', 'n3'
|
|
34726
|
-
addLine('p', 'n4'
|
|
35022
|
+
addLine('p', 'n1');
|
|
35023
|
+
addLine('p', 'n2');
|
|
35024
|
+
addLine('p', 'n3');
|
|
35025
|
+
addLine('p', 'n4'); // up
|
|
34727
35026
|
|
|
34728
|
-
addLine('u1', 'u2'
|
|
34729
|
-
addLine('u2', 'u3'
|
|
34730
|
-
addLine('u3', 'u1'
|
|
35027
|
+
addLine('u1', 'u2');
|
|
35028
|
+
addLine('u2', 'u3');
|
|
35029
|
+
addLine('u3', 'u1'); // target
|
|
34731
35030
|
|
|
34732
|
-
addLine('c', 't'
|
|
34733
|
-
addLine('p', 'c'
|
|
35031
|
+
addLine('c', 't');
|
|
35032
|
+
addLine('p', 'c'); // cross
|
|
34734
35033
|
|
|
34735
|
-
addLine('cn1', 'cn2'
|
|
34736
|
-
addLine('cn3', 'cn4'
|
|
34737
|
-
addLine('cf1', 'cf2'
|
|
34738
|
-
addLine('cf3', 'cf4'
|
|
35034
|
+
addLine('cn1', 'cn2');
|
|
35035
|
+
addLine('cn3', 'cn4');
|
|
35036
|
+
addLine('cf1', 'cf2');
|
|
35037
|
+
addLine('cf3', 'cf4');
|
|
34739
35038
|
|
|
34740
|
-
function addLine(a, b
|
|
34741
|
-
addPoint(a
|
|
34742
|
-
addPoint(b
|
|
35039
|
+
function addLine(a, b) {
|
|
35040
|
+
addPoint(a);
|
|
35041
|
+
addPoint(b);
|
|
34743
35042
|
}
|
|
34744
35043
|
|
|
34745
|
-
function addPoint(id
|
|
35044
|
+
function addPoint(id) {
|
|
34746
35045
|
vertices.push(0, 0, 0);
|
|
34747
|
-
colors.push(
|
|
35046
|
+
colors.push(0, 0, 0);
|
|
34748
35047
|
|
|
34749
35048
|
if (pointMap[id] === undefined) {
|
|
34750
35049
|
pointMap[id] = [];
|
|
@@ -34762,7 +35061,102 @@
|
|
|
34762
35061
|
this.matrix = camera.matrixWorld;
|
|
34763
35062
|
this.matrixAutoUpdate = false;
|
|
34764
35063
|
this.pointMap = pointMap;
|
|
34765
|
-
this.update();
|
|
35064
|
+
this.update(); // colors
|
|
35065
|
+
|
|
35066
|
+
const colorFrustum = new Color(0xffaa00);
|
|
35067
|
+
const colorCone = new Color(0xff0000);
|
|
35068
|
+
const colorUp = new Color(0x00aaff);
|
|
35069
|
+
const colorTarget = new Color(0xffffff);
|
|
35070
|
+
const colorCross = new Color(0x333333);
|
|
35071
|
+
this.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross);
|
|
35072
|
+
}
|
|
35073
|
+
|
|
35074
|
+
setColors(frustum, cone, up, target, cross) {
|
|
35075
|
+
const geometry = this.geometry;
|
|
35076
|
+
const colorAttribute = geometry.getAttribute('color'); // near
|
|
35077
|
+
|
|
35078
|
+
colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b);
|
|
35079
|
+
colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); // n1, n2
|
|
35080
|
+
|
|
35081
|
+
colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b);
|
|
35082
|
+
colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); // n2, n4
|
|
35083
|
+
|
|
35084
|
+
colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b);
|
|
35085
|
+
colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); // n4, n3
|
|
35086
|
+
|
|
35087
|
+
colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b);
|
|
35088
|
+
colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); // n3, n1
|
|
35089
|
+
// far
|
|
35090
|
+
|
|
35091
|
+
colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b);
|
|
35092
|
+
colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); // f1, f2
|
|
35093
|
+
|
|
35094
|
+
colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b);
|
|
35095
|
+
colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); // f2, f4
|
|
35096
|
+
|
|
35097
|
+
colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b);
|
|
35098
|
+
colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); // f4, f3
|
|
35099
|
+
|
|
35100
|
+
colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b);
|
|
35101
|
+
colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); // f3, f1
|
|
35102
|
+
// sides
|
|
35103
|
+
|
|
35104
|
+
colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b);
|
|
35105
|
+
colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); // n1, f1
|
|
35106
|
+
|
|
35107
|
+
colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b);
|
|
35108
|
+
colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); // n2, f2
|
|
35109
|
+
|
|
35110
|
+
colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b);
|
|
35111
|
+
colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); // n3, f3
|
|
35112
|
+
|
|
35113
|
+
colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b);
|
|
35114
|
+
colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); // n4, f4
|
|
35115
|
+
// cone
|
|
35116
|
+
|
|
35117
|
+
colorAttribute.setXYZ(24, cone.r, cone.g, cone.b);
|
|
35118
|
+
colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); // p, n1
|
|
35119
|
+
|
|
35120
|
+
colorAttribute.setXYZ(26, cone.r, cone.g, cone.b);
|
|
35121
|
+
colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); // p, n2
|
|
35122
|
+
|
|
35123
|
+
colorAttribute.setXYZ(28, cone.r, cone.g, cone.b);
|
|
35124
|
+
colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); // p, n3
|
|
35125
|
+
|
|
35126
|
+
colorAttribute.setXYZ(30, cone.r, cone.g, cone.b);
|
|
35127
|
+
colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); // p, n4
|
|
35128
|
+
// up
|
|
35129
|
+
|
|
35130
|
+
colorAttribute.setXYZ(32, up.r, up.g, up.b);
|
|
35131
|
+
colorAttribute.setXYZ(33, up.r, up.g, up.b); // u1, u2
|
|
35132
|
+
|
|
35133
|
+
colorAttribute.setXYZ(34, up.r, up.g, up.b);
|
|
35134
|
+
colorAttribute.setXYZ(35, up.r, up.g, up.b); // u2, u3
|
|
35135
|
+
|
|
35136
|
+
colorAttribute.setXYZ(36, up.r, up.g, up.b);
|
|
35137
|
+
colorAttribute.setXYZ(37, up.r, up.g, up.b); // u3, u1
|
|
35138
|
+
// target
|
|
35139
|
+
|
|
35140
|
+
colorAttribute.setXYZ(38, target.r, target.g, target.b);
|
|
35141
|
+
colorAttribute.setXYZ(39, target.r, target.g, target.b); // c, t
|
|
35142
|
+
|
|
35143
|
+
colorAttribute.setXYZ(40, cross.r, cross.g, cross.b);
|
|
35144
|
+
colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); // p, c
|
|
35145
|
+
// cross
|
|
35146
|
+
|
|
35147
|
+
colorAttribute.setXYZ(42, cross.r, cross.g, cross.b);
|
|
35148
|
+
colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); // cn1, cn2
|
|
35149
|
+
|
|
35150
|
+
colorAttribute.setXYZ(44, cross.r, cross.g, cross.b);
|
|
35151
|
+
colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); // cn3, cn4
|
|
35152
|
+
|
|
35153
|
+
colorAttribute.setXYZ(46, cross.r, cross.g, cross.b);
|
|
35154
|
+
colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); // cf1, cf2
|
|
35155
|
+
|
|
35156
|
+
colorAttribute.setXYZ(48, cross.r, cross.g, cross.b);
|
|
35157
|
+
colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); // cf3, cf4
|
|
35158
|
+
|
|
35159
|
+
colorAttribute.needsUpdate = true;
|
|
34766
35160
|
}
|
|
34767
35161
|
|
|
34768
35162
|
update() {
|
|
@@ -34944,7 +35338,7 @@
|
|
|
34944
35338
|
class PlaneHelper extends Line {
|
|
34945
35339
|
constructor(plane, size = 1, hex = 0xffff00) {
|
|
34946
35340
|
const color = hex;
|
|
34947
|
-
const positions = [1, -1,
|
|
35341
|
+
const positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];
|
|
34948
35342
|
const geometry = new BufferGeometry();
|
|
34949
35343
|
geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
|
|
34950
35344
|
geometry.computeBoundingSphere();
|
|
@@ -34955,7 +35349,7 @@
|
|
|
34955
35349
|
this.type = 'PlaneHelper';
|
|
34956
35350
|
this.plane = plane;
|
|
34957
35351
|
this.size = size;
|
|
34958
|
-
const positions2 = [1, 1,
|
|
35352
|
+
const positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0];
|
|
34959
35353
|
const geometry2 = new BufferGeometry();
|
|
34960
35354
|
geometry2.setAttribute('position', new Float32BufferAttribute(positions2, 3));
|
|
34961
35355
|
geometry2.computeBoundingSphere();
|
|
@@ -34969,13 +35363,10 @@
|
|
|
34969
35363
|
}
|
|
34970
35364
|
|
|
34971
35365
|
updateMatrixWorld(force) {
|
|
34972
|
-
|
|
34973
|
-
|
|
34974
|
-
|
|
34975
|
-
this.scale.set(0.5 * this.size, 0.5 * this.size, scale);
|
|
34976
|
-
this.children[0].material.side = scale < 0 ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here
|
|
34977
|
-
|
|
35366
|
+
this.position.set(0, 0, 0);
|
|
35367
|
+
this.scale.set(0.5 * this.size, 0.5 * this.size, 1);
|
|
34978
35368
|
this.lookAt(this.plane.normal);
|
|
35369
|
+
this.translateZ(-this.plane.constant);
|
|
34979
35370
|
super.updateMatrixWorld(force);
|
|
34980
35371
|
}
|
|
34981
35372
|
|
|
@@ -35128,7 +35519,7 @@
|
|
|
35128
35519
|
return this;
|
|
35129
35520
|
}
|
|
35130
35521
|
|
|
35131
|
-
toShapes(isCCW
|
|
35522
|
+
toShapes(isCCW) {
|
|
35132
35523
|
function toShapesNoHoles(inSubpaths) {
|
|
35133
35524
|
const shapes = [];
|
|
35134
35525
|
|
|
@@ -35193,7 +35584,6 @@
|
|
|
35193
35584
|
const isClockWise = ShapeUtils.isClockWise;
|
|
35194
35585
|
const subPaths = this.subPaths;
|
|
35195
35586
|
if (subPaths.length === 0) return [];
|
|
35196
|
-
if (noHoles === true) return toShapesNoHoles(subPaths);
|
|
35197
35587
|
let solid, tmpPath, tmpShape;
|
|
35198
35588
|
const shapes = [];
|
|
35199
35589
|
|
|
@@ -35299,139 +35689,126 @@
|
|
|
35299
35689
|
|
|
35300
35690
|
}
|
|
35301
35691
|
|
|
35302
|
-
|
|
35303
|
-
|
|
35304
|
-
|
|
35305
|
-
|
|
35306
|
-
|
|
35307
|
-
|
|
35308
|
-
|
|
35309
|
-
|
|
35310
|
-
|
|
35311
|
-
|
|
35312
|
-
|
|
35313
|
-
|
|
35314
|
-
|
|
35315
|
-
|
|
35316
|
-
|
|
35317
|
-
|
|
35318
|
-
|
|
35319
|
-
|
|
35320
|
-
|
|
35692
|
+
const _tables = /*@__PURE__*/_generateTables();
|
|
35693
|
+
|
|
35694
|
+
function _generateTables() {
|
|
35695
|
+
// float32 to float16 helpers
|
|
35696
|
+
const buffer = new ArrayBuffer(4);
|
|
35697
|
+
const floatView = new Float32Array(buffer);
|
|
35698
|
+
const uint32View = new Uint32Array(buffer);
|
|
35699
|
+
const baseTable = new Uint32Array(512);
|
|
35700
|
+
const shiftTable = new Uint32Array(512);
|
|
35701
|
+
|
|
35702
|
+
for (let i = 0; i < 256; ++i) {
|
|
35703
|
+
const e = i - 127; // very small number (0, -0)
|
|
35704
|
+
|
|
35705
|
+
if (e < -27) {
|
|
35706
|
+
baseTable[i] = 0x0000;
|
|
35707
|
+
baseTable[i | 0x100] = 0x8000;
|
|
35708
|
+
shiftTable[i] = 24;
|
|
35709
|
+
shiftTable[i | 0x100] = 24; // small number (denorm)
|
|
35710
|
+
} else if (e < -14) {
|
|
35711
|
+
baseTable[i] = 0x0400 >> -e - 14;
|
|
35712
|
+
baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
|
35713
|
+
shiftTable[i] = -e - 1;
|
|
35714
|
+
shiftTable[i | 0x100] = -e - 1; // normal number
|
|
35715
|
+
} else if (e <= 15) {
|
|
35716
|
+
baseTable[i] = e + 15 << 10;
|
|
35717
|
+
baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
|
35718
|
+
shiftTable[i] = 13;
|
|
35719
|
+
shiftTable[i | 0x100] = 13; // large number (Infinity, -Infinity)
|
|
35720
|
+
} else if (e < 128) {
|
|
35721
|
+
baseTable[i] = 0x7c00;
|
|
35722
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
35723
|
+
shiftTable[i] = 24;
|
|
35724
|
+
shiftTable[i | 0x100] = 24; // stay (NaN, Infinity, -Infinity)
|
|
35725
|
+
} else {
|
|
35726
|
+
baseTable[i] = 0x7c00;
|
|
35727
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
35728
|
+
shiftTable[i] = 13;
|
|
35729
|
+
shiftTable[i | 0x100] = 13;
|
|
35730
|
+
}
|
|
35731
|
+
} // float16 to float32 helpers
|
|
35321
35732
|
|
|
35322
35733
|
|
|
35323
|
-
|
|
35734
|
+
const mantissaTable = new Uint32Array(2048);
|
|
35735
|
+
const exponentTable = new Uint32Array(64);
|
|
35736
|
+
const offsetTable = new Uint32Array(64);
|
|
35324
35737
|
|
|
35325
|
-
|
|
35738
|
+
for (let i = 1; i < 1024; ++i) {
|
|
35739
|
+
let m = i << 13; // zero pad mantissa bits
|
|
35326
35740
|
|
|
35327
|
-
|
|
35741
|
+
let e = 0; // zero exponent
|
|
35742
|
+
// normalized
|
|
35328
35743
|
|
|
35329
|
-
|
|
35744
|
+
while ((m & 0x00800000) === 0) {
|
|
35745
|
+
m <<= 1;
|
|
35746
|
+
e -= 0x00800000; // decrement exponent
|
|
35747
|
+
}
|
|
35330
35748
|
|
|
35331
|
-
|
|
35749
|
+
m &= ~0x00800000; // clear leading 1 bit
|
|
35332
35750
|
|
|
35333
|
-
|
|
35334
|
-
const e = i - 127; // very small number (0, -0)
|
|
35751
|
+
e += 0x38800000; // adjust bias
|
|
35335
35752
|
|
|
35336
|
-
|
|
35337
|
-
_baseTable[i] = 0x0000;
|
|
35338
|
-
_baseTable[i | 0x100] = 0x8000;
|
|
35339
|
-
_shiftTable[i] = 24;
|
|
35340
|
-
_shiftTable[i | 0x100] = 24; // small number (denorm)
|
|
35341
|
-
} else if (e < -14) {
|
|
35342
|
-
_baseTable[i] = 0x0400 >> -e - 14;
|
|
35343
|
-
_baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
|
35344
|
-
_shiftTable[i] = -e - 1;
|
|
35345
|
-
_shiftTable[i | 0x100] = -e - 1; // normal number
|
|
35346
|
-
} else if (e <= 15) {
|
|
35347
|
-
_baseTable[i] = e + 15 << 10;
|
|
35348
|
-
_baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
|
35349
|
-
_shiftTable[i] = 13;
|
|
35350
|
-
_shiftTable[i | 0x100] = 13; // large number (Infinity, -Infinity)
|
|
35351
|
-
} else if (e < 128) {
|
|
35352
|
-
_baseTable[i] = 0x7c00;
|
|
35353
|
-
_baseTable[i | 0x100] = 0xfc00;
|
|
35354
|
-
_shiftTable[i] = 24;
|
|
35355
|
-
_shiftTable[i | 0x100] = 24; // stay (NaN, Infinity, -Infinity)
|
|
35356
|
-
} else {
|
|
35357
|
-
_baseTable[i] = 0x7c00;
|
|
35358
|
-
_baseTable[i | 0x100] = 0xfc00;
|
|
35359
|
-
_shiftTable[i] = 13;
|
|
35360
|
-
_shiftTable[i | 0x100] = 13;
|
|
35753
|
+
mantissaTable[i] = m | e;
|
|
35361
35754
|
}
|
|
35362
|
-
} // float16 to float32 helpers
|
|
35363
|
-
|
|
35364
|
-
|
|
35365
|
-
const _mantissaTable = new Uint32Array(2048);
|
|
35366
|
-
|
|
35367
|
-
const _exponentTable = new Uint32Array(64);
|
|
35368
|
-
|
|
35369
|
-
const _offsetTable = new Uint32Array(64);
|
|
35370
|
-
|
|
35371
|
-
for (let i = 1; i < 1024; ++i) {
|
|
35372
|
-
let m = i << 13; // zero pad mantissa bits
|
|
35373
|
-
|
|
35374
|
-
let e = 0; // zero exponent
|
|
35375
|
-
// normalized
|
|
35376
35755
|
|
|
35377
|
-
|
|
35378
|
-
|
|
35379
|
-
e -= 0x00800000; // decrement exponent
|
|
35756
|
+
for (let i = 1024; i < 2048; ++i) {
|
|
35757
|
+
mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
|
|
35380
35758
|
}
|
|
35381
35759
|
|
|
35382
|
-
|
|
35383
|
-
|
|
35384
|
-
|
|
35385
|
-
|
|
35386
|
-
_mantissaTable[i] = m | e;
|
|
35387
|
-
}
|
|
35388
|
-
|
|
35389
|
-
for (let i = 1024; i < 2048; ++i) {
|
|
35390
|
-
_mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
|
|
35391
|
-
}
|
|
35392
|
-
|
|
35393
|
-
for (let i = 1; i < 31; ++i) {
|
|
35394
|
-
_exponentTable[i] = i << 23;
|
|
35395
|
-
}
|
|
35760
|
+
for (let i = 1; i < 31; ++i) {
|
|
35761
|
+
exponentTable[i] = i << 23;
|
|
35762
|
+
}
|
|
35396
35763
|
|
|
35397
|
-
|
|
35398
|
-
|
|
35764
|
+
exponentTable[31] = 0x47800000;
|
|
35765
|
+
exponentTable[32] = 0x80000000;
|
|
35399
35766
|
|
|
35400
|
-
|
|
35401
|
-
|
|
35402
|
-
|
|
35767
|
+
for (let i = 33; i < 63; ++i) {
|
|
35768
|
+
exponentTable[i] = 0x80000000 + (i - 32 << 23);
|
|
35769
|
+
}
|
|
35403
35770
|
|
|
35404
|
-
|
|
35771
|
+
exponentTable[63] = 0xc7800000;
|
|
35405
35772
|
|
|
35406
|
-
|
|
35407
|
-
|
|
35408
|
-
|
|
35773
|
+
for (let i = 1; i < 64; ++i) {
|
|
35774
|
+
if (i !== 32) {
|
|
35775
|
+
offsetTable[i] = 1024;
|
|
35776
|
+
}
|
|
35409
35777
|
}
|
|
35410
|
-
}
|
|
35411
35778
|
|
|
35412
|
-
|
|
35413
|
-
|
|
35414
|
-
|
|
35415
|
-
|
|
35416
|
-
|
|
35779
|
+
return {
|
|
35780
|
+
floatView: floatView,
|
|
35781
|
+
uint32View: uint32View,
|
|
35782
|
+
baseTable: baseTable,
|
|
35783
|
+
shiftTable: shiftTable,
|
|
35784
|
+
mantissaTable: mantissaTable,
|
|
35785
|
+
exponentTable: exponentTable,
|
|
35786
|
+
offsetTable: offsetTable
|
|
35787
|
+
};
|
|
35788
|
+
} // float32 to float16
|
|
35417
35789
|
|
|
35418
|
-
} // r133, eb58ff153119090d3bbb24474ea0ffc40c70dc92
|
|
35419
35790
|
|
|
35420
|
-
|
|
35421
|
-
|
|
35422
|
-
|
|
35423
|
-
|
|
35424
|
-
|
|
35791
|
+
function toHalfFloat(val) {
|
|
35792
|
+
if (Math.abs(val) > 65504) console.warn('THREE.DataUtils.toHalfFloat(): Value out of range.');
|
|
35793
|
+
val = clamp(val, -65504, 65504);
|
|
35794
|
+
_tables.floatView[0] = val;
|
|
35795
|
+
const f = _tables.uint32View[0];
|
|
35796
|
+
const e = f >> 23 & 0x1ff;
|
|
35797
|
+
return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);
|
|
35798
|
+
} // float16 to float32
|
|
35425
35799
|
|
|
35426
|
-
} // r133, eb58ff153119090d3bbb24474ea0ffc40c70dc92
|
|
35427
35800
|
|
|
35428
|
-
function
|
|
35429
|
-
|
|
35430
|
-
|
|
35801
|
+
function fromHalfFloat(val) {
|
|
35802
|
+
const m = val >> 10;
|
|
35803
|
+
_tables.uint32View[0] = _tables.mantissaTable[_tables.offsetTable[m] + (val & 0x3ff)] + _tables.exponentTable[m];
|
|
35804
|
+
return _tables.floatView[0];
|
|
35805
|
+
}
|
|
35431
35806
|
|
|
35432
|
-
|
|
35433
|
-
|
|
35434
|
-
|
|
35807
|
+
var DataUtils = /*#__PURE__*/Object.freeze({
|
|
35808
|
+
__proto__: null,
|
|
35809
|
+
toHalfFloat: toHalfFloat,
|
|
35810
|
+
fromHalfFloat: fromHalfFloat
|
|
35811
|
+
});
|
|
35435
35812
|
|
|
35436
35813
|
function ImmediateRenderObject() {
|
|
35437
35814
|
console.error('THREE.ImmediateRenderObject has been removed.');
|
|
@@ -35460,6 +35837,158 @@
|
|
|
35460
35837
|
super(data, width, height, depth);
|
|
35461
35838
|
}
|
|
35462
35839
|
|
|
35840
|
+
} // r144
|
|
35841
|
+
|
|
35842
|
+
class BoxBufferGeometry extends BoxGeometry {
|
|
35843
|
+
constructor(width, height, depth, widthSegments, heightSegments, depthSegments) {
|
|
35844
|
+
console.warn('THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry.');
|
|
35845
|
+
super(width, height, depth, widthSegments, heightSegments, depthSegments);
|
|
35846
|
+
}
|
|
35847
|
+
|
|
35848
|
+
} // r144
|
|
35849
|
+
|
|
35850
|
+
class CapsuleBufferGeometry extends CapsuleGeometry {
|
|
35851
|
+
constructor(radius, length, capSegments, radialSegments) {
|
|
35852
|
+
console.warn('THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry.');
|
|
35853
|
+
super(radius, length, capSegments, radialSegments);
|
|
35854
|
+
}
|
|
35855
|
+
|
|
35856
|
+
} // r144
|
|
35857
|
+
|
|
35858
|
+
class CircleBufferGeometry extends CircleGeometry {
|
|
35859
|
+
constructor(radius, segments, thetaStart, thetaLength) {
|
|
35860
|
+
console.warn('THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry.');
|
|
35861
|
+
super(radius, segments, thetaStart, thetaLength);
|
|
35862
|
+
}
|
|
35863
|
+
|
|
35864
|
+
} // r144
|
|
35865
|
+
|
|
35866
|
+
class ConeBufferGeometry extends ConeGeometry {
|
|
35867
|
+
constructor(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) {
|
|
35868
|
+
console.warn('THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry.');
|
|
35869
|
+
super(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
|
|
35870
|
+
}
|
|
35871
|
+
|
|
35872
|
+
} // r144
|
|
35873
|
+
|
|
35874
|
+
class CylinderBufferGeometry extends CylinderGeometry {
|
|
35875
|
+
constructor(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) {
|
|
35876
|
+
console.warn('THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry.');
|
|
35877
|
+
super(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
|
|
35878
|
+
}
|
|
35879
|
+
|
|
35880
|
+
} // r144
|
|
35881
|
+
|
|
35882
|
+
class DodecahedronBufferGeometry extends DodecahedronGeometry {
|
|
35883
|
+
constructor(radius, detail) {
|
|
35884
|
+
console.warn('THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry.');
|
|
35885
|
+
super(radius, detail);
|
|
35886
|
+
}
|
|
35887
|
+
|
|
35888
|
+
} // r144
|
|
35889
|
+
|
|
35890
|
+
class ExtrudeBufferGeometry extends ExtrudeGeometry {
|
|
35891
|
+
constructor(shapes, options) {
|
|
35892
|
+
console.warn('THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry.');
|
|
35893
|
+
super(shapes, options);
|
|
35894
|
+
}
|
|
35895
|
+
|
|
35896
|
+
} // r144
|
|
35897
|
+
|
|
35898
|
+
class IcosahedronBufferGeometry extends IcosahedronGeometry {
|
|
35899
|
+
constructor(radius, detail) {
|
|
35900
|
+
console.warn('THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry.');
|
|
35901
|
+
super(radius, detail);
|
|
35902
|
+
}
|
|
35903
|
+
|
|
35904
|
+
} // r144
|
|
35905
|
+
|
|
35906
|
+
class LatheBufferGeometry extends LatheGeometry {
|
|
35907
|
+
constructor(points, segments, phiStart, phiLength) {
|
|
35908
|
+
console.warn('THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry.');
|
|
35909
|
+
super(points, segments, phiStart, phiLength);
|
|
35910
|
+
}
|
|
35911
|
+
|
|
35912
|
+
} // r144
|
|
35913
|
+
|
|
35914
|
+
class OctahedronBufferGeometry extends OctahedronGeometry {
|
|
35915
|
+
constructor(radius, detail) {
|
|
35916
|
+
console.warn('THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry.');
|
|
35917
|
+
super(radius, detail);
|
|
35918
|
+
}
|
|
35919
|
+
|
|
35920
|
+
} // r144
|
|
35921
|
+
|
|
35922
|
+
class PlaneBufferGeometry extends PlaneGeometry {
|
|
35923
|
+
constructor(width, height, widthSegments, heightSegments) {
|
|
35924
|
+
console.warn('THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry.');
|
|
35925
|
+
super(width, height, widthSegments, heightSegments);
|
|
35926
|
+
}
|
|
35927
|
+
|
|
35928
|
+
} // r144
|
|
35929
|
+
|
|
35930
|
+
class PolyhedronBufferGeometry extends PolyhedronGeometry {
|
|
35931
|
+
constructor(vertices, indices, radius, detail) {
|
|
35932
|
+
console.warn('THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry.');
|
|
35933
|
+
super(vertices, indices, radius, detail);
|
|
35934
|
+
}
|
|
35935
|
+
|
|
35936
|
+
} // r144
|
|
35937
|
+
|
|
35938
|
+
class RingBufferGeometry extends RingGeometry {
|
|
35939
|
+
constructor(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength) {
|
|
35940
|
+
console.warn('THREE.RingBufferGeometry has been renamed to THREE.RingGeometry.');
|
|
35941
|
+
super(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength);
|
|
35942
|
+
}
|
|
35943
|
+
|
|
35944
|
+
} // r144
|
|
35945
|
+
|
|
35946
|
+
class ShapeBufferGeometry extends ShapeGeometry {
|
|
35947
|
+
constructor(shapes, curveSegments) {
|
|
35948
|
+
console.warn('THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry.');
|
|
35949
|
+
super(shapes, curveSegments);
|
|
35950
|
+
}
|
|
35951
|
+
|
|
35952
|
+
} // r144
|
|
35953
|
+
|
|
35954
|
+
class SphereBufferGeometry extends SphereGeometry {
|
|
35955
|
+
constructor(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength) {
|
|
35956
|
+
console.warn('THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry.');
|
|
35957
|
+
super(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength);
|
|
35958
|
+
}
|
|
35959
|
+
|
|
35960
|
+
} // r144
|
|
35961
|
+
|
|
35962
|
+
class TetrahedronBufferGeometry extends TetrahedronGeometry {
|
|
35963
|
+
constructor(radius, detail) {
|
|
35964
|
+
console.warn('THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry.');
|
|
35965
|
+
super(radius, detail);
|
|
35966
|
+
}
|
|
35967
|
+
|
|
35968
|
+
} // r144
|
|
35969
|
+
|
|
35970
|
+
class TorusBufferGeometry extends TorusGeometry {
|
|
35971
|
+
constructor(radius, tube, radialSegments, tubularSegments, arc) {
|
|
35972
|
+
console.warn('THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry.');
|
|
35973
|
+
super(radius, tube, radialSegments, tubularSegments, arc);
|
|
35974
|
+
}
|
|
35975
|
+
|
|
35976
|
+
} // r144
|
|
35977
|
+
|
|
35978
|
+
class TorusKnotBufferGeometry extends TorusKnotGeometry {
|
|
35979
|
+
constructor(radius, tube, tubularSegments, radialSegments, p, q) {
|
|
35980
|
+
console.warn('THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry.');
|
|
35981
|
+
super(radius, tube, tubularSegments, radialSegments, p, q);
|
|
35982
|
+
}
|
|
35983
|
+
|
|
35984
|
+
} // r144
|
|
35985
|
+
|
|
35986
|
+
class TubeBufferGeometry extends TubeGeometry {
|
|
35987
|
+
constructor(path, tubularSegments, radius, radialSegments, closed) {
|
|
35988
|
+
console.warn('THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry.');
|
|
35989
|
+
super(path, tubularSegments, radius, radialSegments, closed);
|
|
35990
|
+
}
|
|
35991
|
+
|
|
35463
35992
|
}
|
|
35464
35993
|
|
|
35465
35994
|
if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
|
|
@@ -35510,7 +36039,7 @@
|
|
|
35510
36039
|
exports.Box2 = Box2;
|
|
35511
36040
|
exports.Box3 = Box3;
|
|
35512
36041
|
exports.Box3Helper = Box3Helper;
|
|
35513
|
-
exports.BoxBufferGeometry =
|
|
36042
|
+
exports.BoxBufferGeometry = BoxBufferGeometry;
|
|
35514
36043
|
exports.BoxGeometry = BoxGeometry;
|
|
35515
36044
|
exports.BoxHelper = BoxHelper;
|
|
35516
36045
|
exports.BufferAttribute = BufferAttribute;
|
|
@@ -35521,11 +36050,11 @@
|
|
|
35521
36050
|
exports.Camera = Camera;
|
|
35522
36051
|
exports.CameraHelper = CameraHelper;
|
|
35523
36052
|
exports.CanvasTexture = CanvasTexture;
|
|
35524
|
-
exports.CapsuleBufferGeometry =
|
|
36053
|
+
exports.CapsuleBufferGeometry = CapsuleBufferGeometry;
|
|
35525
36054
|
exports.CapsuleGeometry = CapsuleGeometry;
|
|
35526
36055
|
exports.CatmullRomCurve3 = CatmullRomCurve3;
|
|
35527
36056
|
exports.CineonToneMapping = CineonToneMapping;
|
|
35528
|
-
exports.CircleBufferGeometry =
|
|
36057
|
+
exports.CircleBufferGeometry = CircleBufferGeometry;
|
|
35529
36058
|
exports.CircleGeometry = CircleGeometry;
|
|
35530
36059
|
exports.ClampToEdgeWrapping = ClampToEdgeWrapping;
|
|
35531
36060
|
exports.Clock = Clock;
|
|
@@ -35534,7 +36063,7 @@
|
|
|
35534
36063
|
exports.ColorManagement = ColorManagement;
|
|
35535
36064
|
exports.CompressedTexture = CompressedTexture;
|
|
35536
36065
|
exports.CompressedTextureLoader = CompressedTextureLoader;
|
|
35537
|
-
exports.ConeBufferGeometry =
|
|
36066
|
+
exports.ConeBufferGeometry = ConeBufferGeometry;
|
|
35538
36067
|
exports.ConeGeometry = ConeGeometry;
|
|
35539
36068
|
exports.CubeCamera = CubeCamera;
|
|
35540
36069
|
exports.CubeReflectionMapping = CubeReflectionMapping;
|
|
@@ -35553,7 +36082,7 @@
|
|
|
35553
36082
|
exports.CurvePath = CurvePath;
|
|
35554
36083
|
exports.CustomBlending = CustomBlending;
|
|
35555
36084
|
exports.CustomToneMapping = CustomToneMapping;
|
|
35556
|
-
exports.CylinderBufferGeometry =
|
|
36085
|
+
exports.CylinderBufferGeometry = CylinderBufferGeometry;
|
|
35557
36086
|
exports.CylinderGeometry = CylinderGeometry;
|
|
35558
36087
|
exports.Cylindrical = Cylindrical;
|
|
35559
36088
|
exports.Data3DTexture = Data3DTexture;
|
|
@@ -35572,7 +36101,7 @@
|
|
|
35572
36101
|
exports.DirectionalLight = DirectionalLight;
|
|
35573
36102
|
exports.DirectionalLightHelper = DirectionalLightHelper;
|
|
35574
36103
|
exports.DiscreteInterpolant = DiscreteInterpolant;
|
|
35575
|
-
exports.DodecahedronBufferGeometry =
|
|
36104
|
+
exports.DodecahedronBufferGeometry = DodecahedronBufferGeometry;
|
|
35576
36105
|
exports.DodecahedronGeometry = DodecahedronGeometry;
|
|
35577
36106
|
exports.DoubleSide = DoubleSide;
|
|
35578
36107
|
exports.DstAlphaFactor = DstAlphaFactor;
|
|
@@ -35588,18 +36117,15 @@
|
|
|
35588
36117
|
exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
|
|
35589
36118
|
exports.Euler = Euler;
|
|
35590
36119
|
exports.EventDispatcher = EventDispatcher;
|
|
35591
|
-
exports.ExtrudeBufferGeometry =
|
|
36120
|
+
exports.ExtrudeBufferGeometry = ExtrudeBufferGeometry;
|
|
35592
36121
|
exports.ExtrudeGeometry = ExtrudeGeometry;
|
|
35593
36122
|
exports.FileLoader = FileLoader;
|
|
35594
|
-
exports.FlatShading = FlatShading;
|
|
35595
36123
|
exports.Float16BufferAttribute = Float16BufferAttribute;
|
|
35596
36124
|
exports.Float32BufferAttribute = Float32BufferAttribute;
|
|
35597
36125
|
exports.Float64BufferAttribute = Float64BufferAttribute;
|
|
35598
36126
|
exports.FloatType = FloatType;
|
|
35599
36127
|
exports.Fog = Fog;
|
|
35600
36128
|
exports.FogExp2 = FogExp2;
|
|
35601
|
-
exports.Font = Font;
|
|
35602
|
-
exports.FontLoader = FontLoader;
|
|
35603
36129
|
exports.FramebufferTexture = FramebufferTexture;
|
|
35604
36130
|
exports.FrontSide = FrontSide;
|
|
35605
36131
|
exports.Frustum = Frustum;
|
|
@@ -35616,7 +36142,7 @@
|
|
|
35616
36142
|
exports.HemisphereLight = HemisphereLight;
|
|
35617
36143
|
exports.HemisphereLightHelper = HemisphereLightHelper;
|
|
35618
36144
|
exports.HemisphereLightProbe = HemisphereLightProbe;
|
|
35619
|
-
exports.IcosahedronBufferGeometry =
|
|
36145
|
+
exports.IcosahedronBufferGeometry = IcosahedronBufferGeometry;
|
|
35620
36146
|
exports.IcosahedronGeometry = IcosahedronGeometry;
|
|
35621
36147
|
exports.ImageBitmapLoader = ImageBitmapLoader;
|
|
35622
36148
|
exports.ImageLoader = ImageLoader;
|
|
@@ -35642,7 +36168,7 @@
|
|
|
35642
36168
|
exports.KeepStencilOp = KeepStencilOp;
|
|
35643
36169
|
exports.KeyframeTrack = KeyframeTrack;
|
|
35644
36170
|
exports.LOD = LOD;
|
|
35645
|
-
exports.LatheBufferGeometry =
|
|
36171
|
+
exports.LatheBufferGeometry = LatheBufferGeometry;
|
|
35646
36172
|
exports.LatheGeometry = LatheGeometry;
|
|
35647
36173
|
exports.Layers = Layers;
|
|
35648
36174
|
exports.LessDepth = LessDepth;
|
|
@@ -35717,7 +36243,7 @@
|
|
|
35717
36243
|
exports.Object3D = Object3D;
|
|
35718
36244
|
exports.ObjectLoader = ObjectLoader;
|
|
35719
36245
|
exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
|
|
35720
|
-
exports.OctahedronBufferGeometry =
|
|
36246
|
+
exports.OctahedronBufferGeometry = OctahedronBufferGeometry;
|
|
35721
36247
|
exports.OctahedronGeometry = OctahedronGeometry;
|
|
35722
36248
|
exports.OneFactor = OneFactor;
|
|
35723
36249
|
exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
|
|
@@ -35728,11 +36254,10 @@
|
|
|
35728
36254
|
exports.PCFShadowMap = PCFShadowMap;
|
|
35729
36255
|
exports.PCFSoftShadowMap = PCFSoftShadowMap;
|
|
35730
36256
|
exports.PMREMGenerator = PMREMGenerator;
|
|
35731
|
-
exports.ParametricGeometry = ParametricGeometry;
|
|
35732
36257
|
exports.Path = Path;
|
|
35733
36258
|
exports.PerspectiveCamera = PerspectiveCamera;
|
|
35734
36259
|
exports.Plane = Plane;
|
|
35735
|
-
exports.PlaneBufferGeometry =
|
|
36260
|
+
exports.PlaneBufferGeometry = PlaneBufferGeometry;
|
|
35736
36261
|
exports.PlaneGeometry = PlaneGeometry;
|
|
35737
36262
|
exports.PlaneHelper = PlaneHelper;
|
|
35738
36263
|
exports.PointLight = PointLight;
|
|
@@ -35740,7 +36265,7 @@
|
|
|
35740
36265
|
exports.Points = Points;
|
|
35741
36266
|
exports.PointsMaterial = PointsMaterial;
|
|
35742
36267
|
exports.PolarGridHelper = PolarGridHelper;
|
|
35743
|
-
exports.PolyhedronBufferGeometry =
|
|
36268
|
+
exports.PolyhedronBufferGeometry = PolyhedronBufferGeometry;
|
|
35744
36269
|
exports.PolyhedronGeometry = PolyhedronGeometry;
|
|
35745
36270
|
exports.PositionalAudio = PositionalAudio;
|
|
35746
36271
|
exports.PropertyBinding = PropertyBinding;
|
|
@@ -35793,7 +36318,7 @@
|
|
|
35793
36318
|
exports.RepeatWrapping = RepeatWrapping;
|
|
35794
36319
|
exports.ReplaceStencilOp = ReplaceStencilOp;
|
|
35795
36320
|
exports.ReverseSubtractEquation = ReverseSubtractEquation;
|
|
35796
|
-
exports.RingBufferGeometry =
|
|
36321
|
+
exports.RingBufferGeometry = RingBufferGeometry;
|
|
35797
36322
|
exports.RingGeometry = RingGeometry;
|
|
35798
36323
|
exports.SRGBColorSpace = SRGBColorSpace;
|
|
35799
36324
|
exports.Scene = Scene;
|
|
@@ -35802,7 +36327,7 @@
|
|
|
35802
36327
|
exports.ShaderMaterial = ShaderMaterial;
|
|
35803
36328
|
exports.ShadowMaterial = ShadowMaterial;
|
|
35804
36329
|
exports.Shape = Shape;
|
|
35805
|
-
exports.ShapeBufferGeometry =
|
|
36330
|
+
exports.ShapeBufferGeometry = ShapeBufferGeometry;
|
|
35806
36331
|
exports.ShapeGeometry = ShapeGeometry;
|
|
35807
36332
|
exports.ShapePath = ShapePath;
|
|
35808
36333
|
exports.ShapeUtils = ShapeUtils;
|
|
@@ -35810,10 +36335,9 @@
|
|
|
35810
36335
|
exports.Skeleton = Skeleton;
|
|
35811
36336
|
exports.SkeletonHelper = SkeletonHelper;
|
|
35812
36337
|
exports.SkinnedMesh = SkinnedMesh;
|
|
35813
|
-
exports.SmoothShading = SmoothShading;
|
|
35814
36338
|
exports.Source = Source;
|
|
35815
36339
|
exports.Sphere = Sphere;
|
|
35816
|
-
exports.SphereBufferGeometry =
|
|
36340
|
+
exports.SphereBufferGeometry = SphereBufferGeometry;
|
|
35817
36341
|
exports.SphereGeometry = SphereGeometry;
|
|
35818
36342
|
exports.Spherical = Spherical;
|
|
35819
36343
|
exports.SphericalHarmonics3 = SphericalHarmonics3;
|
|
@@ -35837,20 +36361,19 @@
|
|
|
35837
36361
|
exports.SubtractiveBlending = SubtractiveBlending;
|
|
35838
36362
|
exports.TOUCH = TOUCH;
|
|
35839
36363
|
exports.TangentSpaceNormalMap = TangentSpaceNormalMap;
|
|
35840
|
-
exports.TetrahedronBufferGeometry =
|
|
36364
|
+
exports.TetrahedronBufferGeometry = TetrahedronBufferGeometry;
|
|
35841
36365
|
exports.TetrahedronGeometry = TetrahedronGeometry;
|
|
35842
|
-
exports.TextGeometry = TextGeometry;
|
|
35843
36366
|
exports.Texture = Texture;
|
|
35844
36367
|
exports.TextureLoader = TextureLoader;
|
|
35845
|
-
exports.TorusBufferGeometry =
|
|
36368
|
+
exports.TorusBufferGeometry = TorusBufferGeometry;
|
|
35846
36369
|
exports.TorusGeometry = TorusGeometry;
|
|
35847
|
-
exports.TorusKnotBufferGeometry =
|
|
36370
|
+
exports.TorusKnotBufferGeometry = TorusKnotBufferGeometry;
|
|
35848
36371
|
exports.TorusKnotGeometry = TorusKnotGeometry;
|
|
35849
36372
|
exports.Triangle = Triangle;
|
|
35850
36373
|
exports.TriangleFanDrawMode = TriangleFanDrawMode;
|
|
35851
36374
|
exports.TriangleStripDrawMode = TriangleStripDrawMode;
|
|
35852
36375
|
exports.TrianglesDrawMode = TrianglesDrawMode;
|
|
35853
|
-
exports.TubeBufferGeometry =
|
|
36376
|
+
exports.TubeBufferGeometry = TubeBufferGeometry;
|
|
35854
36377
|
exports.TubeGeometry = TubeGeometry;
|
|
35855
36378
|
exports.UVMapping = UVMapping;
|
|
35856
36379
|
exports.Uint16BufferAttribute = Uint16BufferAttribute;
|
|
@@ -35858,6 +36381,7 @@
|
|
|
35858
36381
|
exports.Uint8BufferAttribute = Uint8BufferAttribute;
|
|
35859
36382
|
exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;
|
|
35860
36383
|
exports.Uniform = Uniform;
|
|
36384
|
+
exports.UniformsGroup = UniformsGroup;
|
|
35861
36385
|
exports.UniformsLib = UniformsLib;
|
|
35862
36386
|
exports.UniformsUtils = UniformsUtils;
|
|
35863
36387
|
exports.UnsignedByteType = UnsignedByteType;
|