super-three 0.165.0 → 0.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +706 -383
- package/build/three.module.js +702 -384
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +76086 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/exporters/GLTFExporter.js +7 -3
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +51 -2
- package/examples/jsm/libs/tween.module.js +64 -75
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/FBXLoader.js +23 -45
- package/examples/jsm/loaders/GLTFLoader.js +10 -4
- package/examples/jsm/loaders/MaterialXLoader.js +2 -9
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VTKLoader.js +76 -3
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -19
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/postprocessing/RenderTransitionPass.js +13 -38
- package/examples/jsm/postprocessing/SSAOPass.js +6 -9
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/transpiler/GLSLDecoder.js +46 -4
- package/examples/jsm/transpiler/TSLEncoder.js +17 -15
- package/package.json +7 -6
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +2 -0
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +22 -22
- package/src/extras/TextureUtils.js +210 -0
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/ObjectLoader.js +33 -2
- package/src/materials/Material.js +13 -4
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Vector4.js +13 -0
- package/{examples/jsm → src}/nodes/Nodes.js +30 -12
- package/{examples/jsm → src}/nodes/accessors/BatchNode.js +28 -10
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +36 -1
- package/src/nodes/accessors/CameraNode.js +19 -0
- package/{examples/jsm → src}/nodes/accessors/CubeTextureNode.js +22 -5
- package/src/nodes/accessors/InstanceNode.js +140 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +22 -2
- package/{examples/jsm → src}/nodes/accessors/ModelNode.js +2 -1
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +24 -20
- package/{examples/jsm → src}/nodes/accessors/NormalNode.js +1 -1
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +1 -1
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +1 -1
- package/{examples/jsm → src}/nodes/accessors/ReflectVectorNode.js +4 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +50 -1
- package/{examples/jsm → src}/nodes/accessors/StorageTextureNode.js +12 -3
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +55 -18
- package/{examples/jsm → src}/nodes/accessors/UniformsNode.js +7 -1
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +2 -1
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +14 -0
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +2 -1
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +20 -6
- package/{examples/jsm → src}/nodes/core/CacheNode.js +7 -10
- package/{examples/jsm → src}/nodes/core/IndexNode.js +6 -0
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +76 -0
- package/{examples/jsm → src}/nodes/core/Node.js +18 -12
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +175 -37
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +42 -0
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +6 -1
- package/{examples/jsm → src}/nodes/core/PropertyNode.js +1 -0
- package/{examples/jsm → src}/nodes/core/TempNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/UniformGroupNode.js +20 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +10 -1
- package/{examples/jsm → src}/nodes/core/VarNode.js +2 -6
- package/{examples/jsm → src}/nodes/core/VaryingNode.js +8 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +19 -27
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +18 -21
- package/src/nodes/display/BloomNode.js +333 -0
- package/{examples/jsm → src}/nodes/display/ColorAdjustmentNode.js +7 -2
- package/{examples/jsm → src}/nodes/display/ColorSpaceNode.js +1 -1
- package/src/nodes/display/DenoiseNode.js +198 -0
- package/src/nodes/display/DepthOfFieldNode.js +119 -0
- package/src/nodes/display/DotScreenNode.js +75 -0
- package/src/nodes/display/FXAANode.js +327 -0
- package/src/nodes/display/FilmNode.js +52 -0
- package/{examples/jsm → src}/nodes/display/FrontFacingNode.js +2 -1
- package/src/nodes/display/GTAONode.js +324 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +34 -17
- package/src/nodes/display/Lut3DNode.js +53 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +1 -1
- package/src/nodes/display/PassNode.js +291 -0
- package/src/nodes/display/PixelationPassNode.js +201 -0
- package/src/nodes/display/RGBShiftNode.js +49 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SobelOperatorNode.js +121 -0
- package/{examples/jsm → src}/nodes/display/ToneMappingNode.js +44 -5
- package/src/nodes/display/TransitionNode.js +76 -0
- package/{examples/jsm → src}/nodes/display/ViewportDepthNode.js +39 -16
- package/{examples/jsm → src}/nodes/display/ViewportDepthTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportSharedTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +5 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +5 -3
- package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +42 -1
- package/{examples/jsm → src}/nodes/functions/ToonLightingModel.js +3 -1
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +19 -6
- package/{examples/jsm → src}/nodes/lighting/AONode.js +1 -4
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +333 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +26 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +5 -4
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +2 -1
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +1 -1
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +2 -0
- package/{examples/jsm → src}/nodes/lighting/LightsNode.js +1 -3
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +2 -3
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/loaders/NodeLoader.js +3 -1
- package/{examples/jsm → src}/nodes/loaders/NodeMaterialLoader.js +2 -1
- package/{examples/jsm → src}/nodes/loaders/NodeObjectLoader.js +2 -1
- package/{examples/jsm → src}/nodes/materials/InstancedPointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/Line2NodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineBasicNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineDashedNodeMaterial.js +4 -3
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/{examples/jsm → src}/nodes/materials/MeshLambertNodeMaterial.js +12 -3
- package/{examples/jsm → src}/nodes/materials/MeshMatcapNodeMaterial.js +6 -5
- package/{examples/jsm → src}/nodes/materials/MeshNormalNodeMaterial.js +5 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhongNodeMaterial.js +11 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhysicalNodeMaterial.js +5 -4
- package/{examples/jsm → src}/nodes/materials/MeshStandardNodeMaterial.js +14 -3
- package/{examples/jsm → src}/nodes/materials/MeshToonNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/NodeMaterial.js +85 -20
- package/{examples/jsm → src}/nodes/materials/PointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/ShadowNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/SpriteNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +9 -17
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +474 -577
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +2 -8
- package/{examples/jsm → src}/nodes/math/CondNode.js +13 -6
- package/{examples/jsm → src}/nodes/math/MathNode.js +14 -1
- package/{examples/jsm → src}/nodes/math/OperatorNode.js +6 -6
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +2 -1
- package/{examples/jsm → src}/nodes/shadernode/ShaderNode.js +2 -0
- package/{examples/jsm → src}/nodes/utils/DiscardNode.js +1 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +2 -0
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +7 -6
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +8 -2
- package/src/nodes/utils/RTTNode.js +130 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +9 -1
- package/src/objects/BatchedMesh.js +168 -188
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +38 -25
- package/{examples/jsm → src}/renderers/common/Attributes.js +2 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +9 -3
- package/src/renderers/common/BindGroup.js +16 -0
- package/{examples/jsm → src}/renderers/common/Bindings.js +38 -23
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +4 -2
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +7 -1
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +34 -6
- package/src/renderers/common/PostProcessing.js +87 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +6 -3
- package/{examples/jsm → src}/renderers/common/RenderContext.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderObject.js +44 -11
- package/{examples/jsm → src}/renderers/common/Renderer.js +84 -32
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +2 -2
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +6 -2
- package/{examples/jsm → src}/renderers/common/Uniform.js +9 -4
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/{examples/jsm → src}/renderers/common/extras/PMREMGenerator.js +13 -12
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +6 -5
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +37 -16
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +16 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +2 -2
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +6 -0
- package/src/renderers/webgl/WebGLProgram.js +26 -0
- package/src/renderers/webgl/WebGLPrograms.js +1 -1
- package/src/renderers/webgl/WebGLTextures.js +14 -53
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +7 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +156 -54
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +178 -43
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +2 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +1 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +1 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +34 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +164 -76
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +2 -2
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +194 -56
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +20 -13
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +3 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +28 -21
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +40 -23
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +24 -3
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -0
- package/src/renderers/webxr/WebXRManager.js +6 -0
- package/src/textures/CompressedArrayTexture.js +1 -1
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -12
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/display/PassNode.js +0 -201
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -256
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/renderers/common/PostProcessing.js +0 -33
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- /package/{examples/jsm → src}/nodes/accessors/AccessorsUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/BitangentNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/BufferNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/InstancedPointsMaterialNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/PointUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/PositionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SceneNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SkinningNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TangentNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/Texture3DNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureBicubicNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/UVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/CodeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/ExpressionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/AssignNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/BypassNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ConstNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ContextNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/InputNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeKeywords.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/OutputStructNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ParameterNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StackNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StructTypeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BlendModeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BumpMapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/PosterizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getGeometryRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightingContextNode.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/Materials.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/MeshSSSNodeMaterial.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/VolumeNodeMaterial.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +0 -0
- /package/{examples/jsm → src}/nodes/math/HashNode.js +0 -0
- /package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/math/TriNoise3D.js +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/procedural/CheckerNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/ConvertNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/JoinNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/OscNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/PackingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RemapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SetNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SplitNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/TimerNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Animation.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ChainMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipelines.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderBundle.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderBundles.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderList.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderObjects.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBufferRenderer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +0 -0
package/build/three.module.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2010-2024 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
const REVISION = '
|
|
6
|
+
const REVISION = '167';
|
|
7
7
|
|
|
8
8
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
9
9
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -108,6 +108,7 @@ const RedFormat = 1028;
|
|
|
108
108
|
const RedIntegerFormat = 1029;
|
|
109
109
|
const RGFormat = 1030;
|
|
110
110
|
const RGIntegerFormat = 1031;
|
|
111
|
+
const RGBIntegerFormat = 1032;
|
|
111
112
|
const RGBAIntegerFormat = 1033;
|
|
112
113
|
|
|
113
114
|
const RGB_S3TC_DXT1_Format = 33776;
|
|
@@ -158,6 +159,8 @@ const TriangleStripDrawMode = 1;
|
|
|
158
159
|
const TriangleFanDrawMode = 2;
|
|
159
160
|
const BasicDepthPacking = 3200;
|
|
160
161
|
const RGBADepthPacking = 3201;
|
|
162
|
+
const RGBDepthPacking = 3202;
|
|
163
|
+
const RGDepthPacking = 3203;
|
|
161
164
|
const TangentSpaceNormalMap = 0;
|
|
162
165
|
const ObjectSpaceNormalMap = 1;
|
|
163
166
|
|
|
@@ -1621,24 +1624,28 @@ const COLOR_SPACES = {
|
|
|
1621
1624
|
[ LinearSRGBColorSpace ]: {
|
|
1622
1625
|
transfer: LinearTransfer,
|
|
1623
1626
|
primaries: Rec709Primaries,
|
|
1627
|
+
luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
|
|
1624
1628
|
toReference: ( color ) => color,
|
|
1625
1629
|
fromReference: ( color ) => color,
|
|
1626
1630
|
},
|
|
1627
1631
|
[ SRGBColorSpace ]: {
|
|
1628
1632
|
transfer: SRGBTransfer,
|
|
1629
1633
|
primaries: Rec709Primaries,
|
|
1634
|
+
luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
|
|
1630
1635
|
toReference: ( color ) => color.convertSRGBToLinear(),
|
|
1631
1636
|
fromReference: ( color ) => color.convertLinearToSRGB(),
|
|
1632
1637
|
},
|
|
1633
1638
|
[ LinearDisplayP3ColorSpace ]: {
|
|
1634
1639
|
transfer: LinearTransfer,
|
|
1635
1640
|
primaries: P3Primaries,
|
|
1641
|
+
luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
|
|
1636
1642
|
toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
1637
1643
|
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
|
|
1638
1644
|
},
|
|
1639
1645
|
[ DisplayP3ColorSpace ]: {
|
|
1640
1646
|
transfer: SRGBTransfer,
|
|
1641
1647
|
primaries: P3Primaries,
|
|
1648
|
+
luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
|
|
1642
1649
|
toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
1643
1650
|
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
|
|
1644
1651
|
},
|
|
@@ -1711,6 +1718,12 @@ const ColorManagement = {
|
|
|
1711
1718
|
|
|
1712
1719
|
},
|
|
1713
1720
|
|
|
1721
|
+
getLuminanceCoefficients: function ( target, colorSpace = this._workingColorSpace ) {
|
|
1722
|
+
|
|
1723
|
+
return target.fromArray( COLOR_SPACES[ colorSpace ].luminanceCoefficients );
|
|
1724
|
+
|
|
1725
|
+
},
|
|
1726
|
+
|
|
1714
1727
|
};
|
|
1715
1728
|
|
|
1716
1729
|
|
|
@@ -2692,6 +2705,19 @@ class Vector4 {
|
|
|
2692
2705
|
|
|
2693
2706
|
}
|
|
2694
2707
|
|
|
2708
|
+
setFromMatrixPosition( m ) {
|
|
2709
|
+
|
|
2710
|
+
const e = m.elements;
|
|
2711
|
+
|
|
2712
|
+
this.x = e[ 12 ];
|
|
2713
|
+
this.y = e[ 13 ];
|
|
2714
|
+
this.z = e[ 14 ];
|
|
2715
|
+
this.w = e[ 15 ];
|
|
2716
|
+
|
|
2717
|
+
return this;
|
|
2718
|
+
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2695
2721
|
min( v ) {
|
|
2696
2722
|
|
|
2697
2723
|
this.x = Math.min( this.x, v.x );
|
|
@@ -4832,9 +4858,9 @@ class Box3 {
|
|
|
4832
4858
|
|
|
4833
4859
|
containsPoint( point ) {
|
|
4834
4860
|
|
|
4835
|
-
return point.x
|
|
4836
|
-
point.y
|
|
4837
|
-
point.z
|
|
4861
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
4862
|
+
point.y >= this.min.y && point.y <= this.max.y &&
|
|
4863
|
+
point.z >= this.min.z && point.z <= this.max.z;
|
|
4838
4864
|
|
|
4839
4865
|
}
|
|
4840
4866
|
|
|
@@ -4862,9 +4888,9 @@ class Box3 {
|
|
|
4862
4888
|
intersectsBox( box ) {
|
|
4863
4889
|
|
|
4864
4890
|
// using 6 splitting planes to rule out intersections.
|
|
4865
|
-
return box.max.x
|
|
4866
|
-
box.max.y
|
|
4867
|
-
box.max.z
|
|
4891
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
4892
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y &&
|
|
4893
|
+
box.max.z >= this.min.z && box.min.z <= this.max.z;
|
|
4868
4894
|
|
|
4869
4895
|
}
|
|
4870
4896
|
|
|
@@ -4938,14 +4964,14 @@ class Box3 {
|
|
|
4938
4964
|
_extents.subVectors( this.max, _center );
|
|
4939
4965
|
|
|
4940
4966
|
// translate triangle to aabb origin
|
|
4941
|
-
_v0$
|
|
4967
|
+
_v0$3.subVectors( triangle.a, _center );
|
|
4942
4968
|
_v1$7.subVectors( triangle.b, _center );
|
|
4943
4969
|
_v2$4.subVectors( triangle.c, _center );
|
|
4944
4970
|
|
|
4945
4971
|
// compute edge vectors for triangle
|
|
4946
|
-
_f0.subVectors( _v1$7, _v0$
|
|
4972
|
+
_f0.subVectors( _v1$7, _v0$3 );
|
|
4947
4973
|
_f1.subVectors( _v2$4, _v1$7 );
|
|
4948
|
-
_f2.subVectors( _v0$
|
|
4974
|
+
_f2.subVectors( _v0$3, _v2$4 );
|
|
4949
4975
|
|
|
4950
4976
|
// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
|
|
4951
4977
|
// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
|
|
@@ -4955,7 +4981,7 @@ class Box3 {
|
|
|
4955
4981
|
_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,
|
|
4956
4982
|
- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0
|
|
4957
4983
|
];
|
|
4958
|
-
if ( ! satForAxes( axes, _v0$
|
|
4984
|
+
if ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {
|
|
4959
4985
|
|
|
4960
4986
|
return false;
|
|
4961
4987
|
|
|
@@ -4963,7 +4989,7 @@ class Box3 {
|
|
|
4963
4989
|
|
|
4964
4990
|
// test 3 face normals from the aabb
|
|
4965
4991
|
axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
|
|
4966
|
-
if ( ! satForAxes( axes, _v0$
|
|
4992
|
+
if ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {
|
|
4967
4993
|
|
|
4968
4994
|
return false;
|
|
4969
4995
|
|
|
@@ -4974,7 +5000,7 @@ class Box3 {
|
|
|
4974
5000
|
_triangleNormal.crossVectors( _f0, _f1 );
|
|
4975
5001
|
axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];
|
|
4976
5002
|
|
|
4977
|
-
return satForAxes( axes, _v0$
|
|
5003
|
+
return satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents );
|
|
4978
5004
|
|
|
4979
5005
|
}
|
|
4980
5006
|
|
|
@@ -5084,7 +5110,7 @@ const _box$4 = /*@__PURE__*/ new Box3();
|
|
|
5084
5110
|
|
|
5085
5111
|
// triangle centered vertices
|
|
5086
5112
|
|
|
5087
|
-
const _v0$
|
|
5113
|
+
const _v0$3 = /*@__PURE__*/ new Vector3();
|
|
5088
5114
|
const _v1$7 = /*@__PURE__*/ new Vector3();
|
|
5089
5115
|
const _v2$4 = /*@__PURE__*/ new Vector3();
|
|
5090
5116
|
|
|
@@ -7717,13 +7743,17 @@ class Object3D extends EventDispatcher {
|
|
|
7717
7743
|
|
|
7718
7744
|
if ( this.matrixWorldNeedsUpdate || force ) {
|
|
7719
7745
|
|
|
7720
|
-
if ( this.
|
|
7746
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
7721
7747
|
|
|
7722
|
-
|
|
7748
|
+
if ( this.parent === null ) {
|
|
7723
7749
|
|
|
7724
|
-
|
|
7750
|
+
this.matrixWorld.copy( this.matrix );
|
|
7725
7751
|
|
|
7726
|
-
|
|
7752
|
+
} else {
|
|
7753
|
+
|
|
7754
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
7755
|
+
|
|
7756
|
+
}
|
|
7727
7757
|
|
|
7728
7758
|
}
|
|
7729
7759
|
|
|
@@ -7733,7 +7763,7 @@ class Object3D extends EventDispatcher {
|
|
|
7733
7763
|
|
|
7734
7764
|
}
|
|
7735
7765
|
|
|
7736
|
-
//
|
|
7766
|
+
// make sure descendants are updated if required
|
|
7737
7767
|
|
|
7738
7768
|
const children = this.children;
|
|
7739
7769
|
|
|
@@ -7741,11 +7771,7 @@ class Object3D extends EventDispatcher {
|
|
|
7741
7771
|
|
|
7742
7772
|
const child = children[ i ];
|
|
7743
7773
|
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
child.updateMatrixWorld( force );
|
|
7747
|
-
|
|
7748
|
-
}
|
|
7774
|
+
child.updateMatrixWorld( force );
|
|
7749
7775
|
|
|
7750
7776
|
}
|
|
7751
7777
|
|
|
@@ -7755,7 +7781,7 @@ class Object3D extends EventDispatcher {
|
|
|
7755
7781
|
|
|
7756
7782
|
const parent = this.parent;
|
|
7757
7783
|
|
|
7758
|
-
if ( updateParents === true && parent !== null
|
|
7784
|
+
if ( updateParents === true && parent !== null ) {
|
|
7759
7785
|
|
|
7760
7786
|
parent.updateWorldMatrix( true, false );
|
|
7761
7787
|
|
|
@@ -7763,17 +7789,21 @@ class Object3D extends EventDispatcher {
|
|
|
7763
7789
|
|
|
7764
7790
|
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
7765
7791
|
|
|
7766
|
-
if ( this.
|
|
7792
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
7767
7793
|
|
|
7768
|
-
|
|
7794
|
+
if ( this.parent === null ) {
|
|
7769
7795
|
|
|
7770
|
-
|
|
7796
|
+
this.matrixWorld.copy( this.matrix );
|
|
7797
|
+
|
|
7798
|
+
} else {
|
|
7771
7799
|
|
|
7772
|
-
|
|
7800
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
7801
|
+
|
|
7802
|
+
}
|
|
7773
7803
|
|
|
7774
7804
|
}
|
|
7775
7805
|
|
|
7776
|
-
//
|
|
7806
|
+
// make sure descendants are updated
|
|
7777
7807
|
|
|
7778
7808
|
if ( updateChildren === true ) {
|
|
7779
7809
|
|
|
@@ -7783,11 +7813,7 @@ class Object3D extends EventDispatcher {
|
|
|
7783
7813
|
|
|
7784
7814
|
const child = children[ i ];
|
|
7785
7815
|
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
child.updateWorldMatrix( false, true );
|
|
7789
|
-
|
|
7790
|
-
}
|
|
7816
|
+
child.updateWorldMatrix( false, true );
|
|
7791
7817
|
|
|
7792
7818
|
}
|
|
7793
7819
|
|
|
@@ -7880,7 +7906,7 @@ class Object3D extends EventDispatcher {
|
|
|
7880
7906
|
sphereCenter: bound.sphere.center.toArray()
|
|
7881
7907
|
} ) );
|
|
7882
7908
|
|
|
7883
|
-
object.
|
|
7909
|
+
object.maxInstanceCount = this._maxInstanceCount;
|
|
7884
7910
|
object.maxVertexCount = this._maxVertexCount;
|
|
7885
7911
|
object.maxIndexCount = this._maxIndexCount;
|
|
7886
7912
|
|
|
@@ -8149,7 +8175,7 @@ Object3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );
|
|
|
8149
8175
|
Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
|
|
8150
8176
|
Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;
|
|
8151
8177
|
|
|
8152
|
-
const _v0$
|
|
8178
|
+
const _v0$2 = /*@__PURE__*/ new Vector3();
|
|
8153
8179
|
const _v1$3 = /*@__PURE__*/ new Vector3();
|
|
8154
8180
|
const _v2$2 = /*@__PURE__*/ new Vector3();
|
|
8155
8181
|
const _v3$2 = /*@__PURE__*/ new Vector3();
|
|
@@ -8174,8 +8200,8 @@ class Triangle {
|
|
|
8174
8200
|
static getNormal( a, b, c, target ) {
|
|
8175
8201
|
|
|
8176
8202
|
target.subVectors( c, b );
|
|
8177
|
-
_v0$
|
|
8178
|
-
target.cross( _v0$
|
|
8203
|
+
_v0$2.subVectors( a, b );
|
|
8204
|
+
target.cross( _v0$2 );
|
|
8179
8205
|
|
|
8180
8206
|
const targetLengthSq = target.lengthSq();
|
|
8181
8207
|
if ( targetLengthSq > 0 ) {
|
|
@@ -8192,13 +8218,13 @@ class Triangle {
|
|
|
8192
8218
|
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
|
|
8193
8219
|
static getBarycoord( point, a, b, c, target ) {
|
|
8194
8220
|
|
|
8195
|
-
_v0$
|
|
8221
|
+
_v0$2.subVectors( c, a );
|
|
8196
8222
|
_v1$3.subVectors( b, a );
|
|
8197
8223
|
_v2$2.subVectors( point, a );
|
|
8198
8224
|
|
|
8199
|
-
const dot00 = _v0$
|
|
8200
|
-
const dot01 = _v0$
|
|
8201
|
-
const dot02 = _v0$
|
|
8225
|
+
const dot00 = _v0$2.dot( _v0$2 );
|
|
8226
|
+
const dot01 = _v0$2.dot( _v1$3 );
|
|
8227
|
+
const dot02 = _v0$2.dot( _v2$2 );
|
|
8202
8228
|
const dot11 = _v1$3.dot( _v1$3 );
|
|
8203
8229
|
const dot12 = _v1$3.dot( _v2$2 );
|
|
8204
8230
|
|
|
@@ -8257,11 +8283,11 @@ class Triangle {
|
|
|
8257
8283
|
|
|
8258
8284
|
static isFrontFacing( a, b, c, direction ) {
|
|
8259
8285
|
|
|
8260
|
-
_v0$
|
|
8286
|
+
_v0$2.subVectors( c, b );
|
|
8261
8287
|
_v1$3.subVectors( a, b );
|
|
8262
8288
|
|
|
8263
8289
|
// strictly front facing
|
|
8264
|
-
return ( _v0$
|
|
8290
|
+
return ( _v0$2.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;
|
|
8265
8291
|
|
|
8266
8292
|
}
|
|
8267
8293
|
|
|
@@ -8313,10 +8339,10 @@ class Triangle {
|
|
|
8313
8339
|
|
|
8314
8340
|
getArea() {
|
|
8315
8341
|
|
|
8316
|
-
_v0$
|
|
8342
|
+
_v0$2.subVectors( this.c, this.b );
|
|
8317
8343
|
_v1$3.subVectors( this.a, this.b );
|
|
8318
8344
|
|
|
8319
|
-
return _v0$
|
|
8345
|
+
return _v0$2.cross( _v1$3 ).length() * 0.5;
|
|
8320
8346
|
|
|
8321
8347
|
}
|
|
8322
8348
|
|
|
@@ -9172,10 +9198,6 @@ class Material extends EventDispatcher {
|
|
|
9172
9198
|
|
|
9173
9199
|
}
|
|
9174
9200
|
|
|
9175
|
-
onBuild( /* shaderobject, renderer */ ) {}
|
|
9176
|
-
|
|
9177
|
-
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
9178
|
-
|
|
9179
9201
|
onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
9180
9202
|
|
|
9181
9203
|
customProgramCacheKey() {
|
|
@@ -9592,6 +9614,19 @@ class Material extends EventDispatcher {
|
|
|
9592
9614
|
|
|
9593
9615
|
}
|
|
9594
9616
|
|
|
9617
|
+
onBuild( /* shaderobject, renderer */ ) {
|
|
9618
|
+
|
|
9619
|
+
console.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166
|
|
9620
|
+
|
|
9621
|
+
}
|
|
9622
|
+
|
|
9623
|
+
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {
|
|
9624
|
+
|
|
9625
|
+
console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166
|
|
9626
|
+
|
|
9627
|
+
}
|
|
9628
|
+
|
|
9629
|
+
|
|
9595
9630
|
}
|
|
9596
9631
|
|
|
9597
9632
|
class MeshBasicMaterial extends Material {
|
|
@@ -13640,6 +13675,8 @@ function WebGLAttributes( gl ) {
|
|
|
13640
13675
|
|
|
13641
13676
|
function update( attribute, bufferType ) {
|
|
13642
13677
|
|
|
13678
|
+
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
13679
|
+
|
|
13643
13680
|
if ( attribute.isGLBufferAttribute ) {
|
|
13644
13681
|
|
|
13645
13682
|
const cached = buffers.get( attribute );
|
|
@@ -13659,8 +13696,6 @@ function WebGLAttributes( gl ) {
|
|
|
13659
13696
|
|
|
13660
13697
|
}
|
|
13661
13698
|
|
|
13662
|
-
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
13663
|
-
|
|
13664
13699
|
const data = buffers.get( attribute );
|
|
13665
13700
|
|
|
13666
13701
|
if ( data === undefined ) {
|
|
@@ -13803,9 +13838,9 @@ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D(
|
|
|
13803
13838
|
|
|
13804
13839
|
var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
|
|
13805
13840
|
|
|
13806
|
-
var batching_pars_vertex = "#ifdef USE_BATCHING\n\
|
|
13841
|
+
var batching_pars_vertex = "#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";
|
|
13807
13842
|
|
|
13808
|
-
var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix(
|
|
13843
|
+
var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif";
|
|
13809
13844
|
|
|
13810
13845
|
var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
|
|
13811
13846
|
|
|
@@ -13831,9 +13866,9 @@ var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor
|
|
|
13831
13866
|
|
|
13832
13867
|
var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif";
|
|
13833
13868
|
|
|
13834
|
-
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor(
|
|
13869
|
+
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif";
|
|
13835
13870
|
|
|
13836
|
-
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\
|
|
13871
|
+
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
|
|
13837
13872
|
|
|
13838
13873
|
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
13839
13874
|
|
|
@@ -13849,7 +13884,7 @@ var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emi
|
|
|
13849
13884
|
|
|
13850
13885
|
var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
13851
13886
|
|
|
13852
|
-
var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}
|
|
13887
|
+
var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
|
|
13853
13888
|
|
|
13854
13889
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
13855
13890
|
|
|
@@ -13893,7 +13928,7 @@ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColo
|
|
|
13893
13928
|
|
|
13894
13929
|
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
13895
13930
|
|
|
13896
|
-
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
13931
|
+
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
13897
13932
|
|
|
13898
13933
|
var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
|
|
13899
13934
|
|
|
@@ -13951,7 +13986,7 @@ var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D
|
|
|
13951
13986
|
|
|
13952
13987
|
var opaque_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
|
|
13953
13988
|
|
|
13954
|
-
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
|
|
13989
|
+
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.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in 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 depth, const in float near, const in float far ) {\n\treturn depth * ( 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 depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}";
|
|
13955
13990
|
|
|
13956
13991
|
var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
|
|
13957
13992
|
|
|
@@ -13965,13 +14000,13 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
13965
14000
|
|
|
13966
14001
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
13967
14002
|
|
|
13968
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform 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\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\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\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif";
|
|
14003
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform 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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, 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\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\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 mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";
|
|
13969
14004
|
|
|
13970
|
-
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying 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";
|
|
14005
|
+
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying 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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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";
|
|
13971
14006
|
|
|
13972
14007
|
var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#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#endif";
|
|
13973
14008
|
|
|
13974
|
-
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}";
|
|
14009
|
+
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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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}";
|
|
13975
14010
|
|
|
13976
14011
|
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";
|
|
13977
14012
|
|
|
@@ -14015,7 +14050,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
14015
14050
|
|
|
14016
14051
|
const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
14017
14052
|
|
|
14018
|
-
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
|
|
14053
|
+
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
14019
14054
|
|
|
14020
14055
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
14021
14056
|
|
|
@@ -14342,6 +14377,7 @@ const UniformsLib = {
|
|
|
14342
14377
|
} },
|
|
14343
14378
|
|
|
14344
14379
|
directionalLightShadows: { value: [], properties: {
|
|
14380
|
+
shadowIntensity: 1,
|
|
14345
14381
|
shadowBias: {},
|
|
14346
14382
|
shadowNormalBias: {},
|
|
14347
14383
|
shadowRadius: {},
|
|
@@ -14362,6 +14398,7 @@ const UniformsLib = {
|
|
|
14362
14398
|
} },
|
|
14363
14399
|
|
|
14364
14400
|
spotLightShadows: { value: [], properties: {
|
|
14401
|
+
shadowIntensity: 1,
|
|
14365
14402
|
shadowBias: {},
|
|
14366
14403
|
shadowNormalBias: {},
|
|
14367
14404
|
shadowRadius: {},
|
|
@@ -14380,6 +14417,7 @@ const UniformsLib = {
|
|
|
14380
14417
|
} },
|
|
14381
14418
|
|
|
14382
14419
|
pointLightShadows: { value: [], properties: {
|
|
14420
|
+
shadowIntensity: 1,
|
|
14383
14421
|
shadowBias: {},
|
|
14384
14422
|
shadowNormalBias: {},
|
|
14385
14423
|
shadowRadius: {},
|
|
@@ -15678,30 +15716,17 @@ function WebGLBufferRenderer( gl, extensions, info ) {
|
|
|
15678
15716
|
if ( drawCount === 0 ) return;
|
|
15679
15717
|
|
|
15680
15718
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15719
|
+
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
15681
15720
|
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15685
|
-
|
|
15686
|
-
this.render( starts[ i ], counts[ i ] );
|
|
15687
|
-
|
|
15688
|
-
}
|
|
15689
|
-
|
|
15690
|
-
} else {
|
|
15691
|
-
|
|
15692
|
-
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
15721
|
+
let elementCount = 0;
|
|
15722
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15693
15723
|
|
|
15694
|
-
|
|
15695
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15696
|
-
|
|
15697
|
-
elementCount += counts[ i ];
|
|
15698
|
-
|
|
15699
|
-
}
|
|
15700
|
-
|
|
15701
|
-
info.update( elementCount, mode, 1 );
|
|
15724
|
+
elementCount += counts[ i ];
|
|
15702
15725
|
|
|
15703
15726
|
}
|
|
15704
15727
|
|
|
15728
|
+
info.update( elementCount, mode, 1 );
|
|
15729
|
+
|
|
15705
15730
|
}
|
|
15706
15731
|
|
|
15707
15732
|
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
@@ -17631,29 +17656,17 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
|
17631
17656
|
if ( drawCount === 0 ) return;
|
|
17632
17657
|
|
|
17633
17658
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17659
|
+
extension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );
|
|
17634
17660
|
|
|
17635
|
-
|
|
17636
|
-
|
|
17637
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17638
|
-
|
|
17639
|
-
this.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
17661
|
+
let elementCount = 0;
|
|
17662
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17640
17663
|
|
|
17641
|
-
|
|
17642
|
-
|
|
17643
|
-
} else {
|
|
17664
|
+
elementCount += counts[ i ];
|
|
17644
17665
|
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
let elementCount = 0;
|
|
17648
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17649
|
-
|
|
17650
|
-
elementCount += counts[ i ];
|
|
17651
|
-
|
|
17652
|
-
}
|
|
17666
|
+
}
|
|
17653
17667
|
|
|
17654
|
-
|
|
17668
|
+
info.update( elementCount, mode, 1 );
|
|
17655
17669
|
|
|
17656
|
-
}
|
|
17657
17670
|
|
|
17658
17671
|
}
|
|
17659
17672
|
|
|
@@ -18219,7 +18232,6 @@ class DepthTexture extends Texture {
|
|
|
18219
18232
|
const emptyTexture = /*@__PURE__*/ new Texture();
|
|
18220
18233
|
|
|
18221
18234
|
const emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );
|
|
18222
|
-
emptyShadowTexture.compareFunction = LessEqualCompare;
|
|
18223
18235
|
|
|
18224
18236
|
const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
|
|
18225
18237
|
const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
|
|
@@ -18737,7 +18749,18 @@ function setValueT1( gl, v, textures ) {
|
|
|
18737
18749
|
|
|
18738
18750
|
}
|
|
18739
18751
|
|
|
18740
|
-
|
|
18752
|
+
let emptyTexture2D;
|
|
18753
|
+
|
|
18754
|
+
if ( this.type === gl.SAMPLER_2D_SHADOW ) {
|
|
18755
|
+
|
|
18756
|
+
emptyShadowTexture.compareFunction = LessEqualCompare; // #28670
|
|
18757
|
+
emptyTexture2D = emptyShadowTexture;
|
|
18758
|
+
|
|
18759
|
+
} else {
|
|
18760
|
+
|
|
18761
|
+
emptyTexture2D = emptyTexture;
|
|
18762
|
+
|
|
18763
|
+
}
|
|
18741
18764
|
|
|
18742
18765
|
textures.setTexture2D( v || emptyTexture2D, unit );
|
|
18743
18766
|
|
|
@@ -19470,6 +19493,30 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
19470
19493
|
|
|
19471
19494
|
}
|
|
19472
19495
|
|
|
19496
|
+
const _v0$1 = /*@__PURE__*/ new Vector3();
|
|
19497
|
+
|
|
19498
|
+
function getLuminanceFunction() {
|
|
19499
|
+
|
|
19500
|
+
ColorManagement.getLuminanceCoefficients( _v0$1 );
|
|
19501
|
+
|
|
19502
|
+
const r = _v0$1.x.toFixed( 4 );
|
|
19503
|
+
const g = _v0$1.y.toFixed( 4 );
|
|
19504
|
+
const b = _v0$1.z.toFixed( 4 );
|
|
19505
|
+
|
|
19506
|
+
return [
|
|
19507
|
+
|
|
19508
|
+
'float luminance( const in vec3 rgb ) {',
|
|
19509
|
+
|
|
19510
|
+
` const vec3 weights = vec3( ${ r }, ${ g }, ${ b } );`,
|
|
19511
|
+
|
|
19512
|
+
' return dot( weights, rgb );',
|
|
19513
|
+
|
|
19514
|
+
'}'
|
|
19515
|
+
|
|
19516
|
+
].join( '\n' );
|
|
19517
|
+
|
|
19518
|
+
}
|
|
19519
|
+
|
|
19473
19520
|
function generateVertexExtensions( parameters ) {
|
|
19474
19521
|
|
|
19475
19522
|
const chunks = [
|
|
@@ -20141,6 +20188,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20141
20188
|
|
|
20142
20189
|
ShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
20143
20190
|
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),
|
|
20191
|
+
getLuminanceFunction(),
|
|
20144
20192
|
|
|
20145
20193
|
parameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',
|
|
20146
20194
|
|
|
@@ -20906,7 +20954,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20906
20954
|
index0AttributeName: material.index0AttributeName,
|
|
20907
20955
|
|
|
20908
20956
|
extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
|
|
20909
|
-
extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
|
|
20957
|
+
extensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),
|
|
20910
20958
|
|
|
20911
20959
|
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
20912
20960
|
|
|
@@ -21588,6 +21636,7 @@ function ShadowUniformsCache() {
|
|
|
21588
21636
|
|
|
21589
21637
|
case 'DirectionalLight':
|
|
21590
21638
|
uniforms = {
|
|
21639
|
+
shadowIntensity: 1,
|
|
21591
21640
|
shadowBias: 0,
|
|
21592
21641
|
shadowNormalBias: 0,
|
|
21593
21642
|
shadowRadius: 1,
|
|
@@ -21597,6 +21646,7 @@ function ShadowUniformsCache() {
|
|
|
21597
21646
|
|
|
21598
21647
|
case 'SpotLight':
|
|
21599
21648
|
uniforms = {
|
|
21649
|
+
shadowIntensity: 1,
|
|
21600
21650
|
shadowBias: 0,
|
|
21601
21651
|
shadowNormalBias: 0,
|
|
21602
21652
|
shadowRadius: 1,
|
|
@@ -21606,6 +21656,7 @@ function ShadowUniformsCache() {
|
|
|
21606
21656
|
|
|
21607
21657
|
case 'PointLight':
|
|
21608
21658
|
uniforms = {
|
|
21659
|
+
shadowIntensity: 1,
|
|
21609
21660
|
shadowBias: 0,
|
|
21610
21661
|
shadowNormalBias: 0,
|
|
21611
21662
|
shadowRadius: 1,
|
|
@@ -21755,6 +21806,7 @@ function WebGLLights( extensions ) {
|
|
|
21755
21806
|
|
|
21756
21807
|
const shadowUniforms = shadowCache.get( light );
|
|
21757
21808
|
|
|
21809
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
21758
21810
|
shadowUniforms.shadowBias = shadow.bias;
|
|
21759
21811
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
21760
21812
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -21808,6 +21860,7 @@ function WebGLLights( extensions ) {
|
|
|
21808
21860
|
|
|
21809
21861
|
const shadowUniforms = shadowCache.get( light );
|
|
21810
21862
|
|
|
21863
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
21811
21864
|
shadowUniforms.shadowBias = shadow.bias;
|
|
21812
21865
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
21813
21866
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -21849,6 +21902,7 @@ function WebGLLights( extensions ) {
|
|
|
21849
21902
|
|
|
21850
21903
|
const shadowUniforms = shadowCache.get( light );
|
|
21851
21904
|
|
|
21905
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
21852
21906
|
shadowUniforms.shadowBias = shadow.bias;
|
|
21853
21907
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
21854
21908
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -23926,6 +23980,213 @@ function WebGLState( gl ) {
|
|
|
23926
23980
|
|
|
23927
23981
|
}
|
|
23928
23982
|
|
|
23983
|
+
function contain( texture, aspect ) {
|
|
23984
|
+
|
|
23985
|
+
const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
|
|
23986
|
+
|
|
23987
|
+
if ( imageAspect > aspect ) {
|
|
23988
|
+
|
|
23989
|
+
texture.repeat.x = 1;
|
|
23990
|
+
texture.repeat.y = imageAspect / aspect;
|
|
23991
|
+
|
|
23992
|
+
texture.offset.x = 0;
|
|
23993
|
+
texture.offset.y = ( 1 - texture.repeat.y ) / 2;
|
|
23994
|
+
|
|
23995
|
+
} else {
|
|
23996
|
+
|
|
23997
|
+
texture.repeat.x = aspect / imageAspect;
|
|
23998
|
+
texture.repeat.y = 1;
|
|
23999
|
+
|
|
24000
|
+
texture.offset.x = ( 1 - texture.repeat.x ) / 2;
|
|
24001
|
+
texture.offset.y = 0;
|
|
24002
|
+
|
|
24003
|
+
}
|
|
24004
|
+
|
|
24005
|
+
return texture;
|
|
24006
|
+
|
|
24007
|
+
}
|
|
24008
|
+
|
|
24009
|
+
function cover( texture, aspect ) {
|
|
24010
|
+
|
|
24011
|
+
const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
|
|
24012
|
+
|
|
24013
|
+
if ( imageAspect > aspect ) {
|
|
24014
|
+
|
|
24015
|
+
texture.repeat.x = aspect / imageAspect;
|
|
24016
|
+
texture.repeat.y = 1;
|
|
24017
|
+
|
|
24018
|
+
texture.offset.x = ( 1 - texture.repeat.x ) / 2;
|
|
24019
|
+
texture.offset.y = 0;
|
|
24020
|
+
|
|
24021
|
+
} else {
|
|
24022
|
+
|
|
24023
|
+
texture.repeat.x = 1;
|
|
24024
|
+
texture.repeat.y = imageAspect / aspect;
|
|
24025
|
+
|
|
24026
|
+
texture.offset.x = 0;
|
|
24027
|
+
texture.offset.y = ( 1 - texture.repeat.y ) / 2;
|
|
24028
|
+
|
|
24029
|
+
}
|
|
24030
|
+
|
|
24031
|
+
return texture;
|
|
24032
|
+
|
|
24033
|
+
}
|
|
24034
|
+
|
|
24035
|
+
function fill( texture ) {
|
|
24036
|
+
|
|
24037
|
+
texture.repeat.x = 1;
|
|
24038
|
+
texture.repeat.y = 1;
|
|
24039
|
+
|
|
24040
|
+
texture.offset.x = 0;
|
|
24041
|
+
texture.offset.y = 0;
|
|
24042
|
+
|
|
24043
|
+
return texture;
|
|
24044
|
+
|
|
24045
|
+
}
|
|
24046
|
+
|
|
24047
|
+
|
|
24048
|
+
|
|
24049
|
+
/**
|
|
24050
|
+
* Given the width, height, format, and type of a texture. Determines how many
|
|
24051
|
+
* bytes must be used to represent the texture.
|
|
24052
|
+
*/
|
|
24053
|
+
function getByteLength( width, height, format, type ) {
|
|
24054
|
+
|
|
24055
|
+
const typeByteLength = getTextureTypeByteLength( type );
|
|
24056
|
+
|
|
24057
|
+
switch ( format ) {
|
|
24058
|
+
|
|
24059
|
+
// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
|
|
24060
|
+
case AlphaFormat:
|
|
24061
|
+
return width * height;
|
|
24062
|
+
case LuminanceFormat:
|
|
24063
|
+
return width * height;
|
|
24064
|
+
case LuminanceAlphaFormat:
|
|
24065
|
+
return width * height * 2;
|
|
24066
|
+
case RedFormat:
|
|
24067
|
+
return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24068
|
+
case RedIntegerFormat:
|
|
24069
|
+
return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24070
|
+
case RGFormat:
|
|
24071
|
+
return ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24072
|
+
case RGIntegerFormat:
|
|
24073
|
+
return ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24074
|
+
case RGBFormat:
|
|
24075
|
+
return ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24076
|
+
case RGBAFormat:
|
|
24077
|
+
return ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24078
|
+
case RGBAIntegerFormat:
|
|
24079
|
+
return ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24080
|
+
|
|
24081
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/
|
|
24082
|
+
case RGB_S3TC_DXT1_Format:
|
|
24083
|
+
case RGBA_S3TC_DXT1_Format:
|
|
24084
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
24085
|
+
case RGBA_S3TC_DXT3_Format:
|
|
24086
|
+
case RGBA_S3TC_DXT5_Format:
|
|
24087
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24088
|
+
|
|
24089
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/
|
|
24090
|
+
case RGB_PVRTC_2BPPV1_Format:
|
|
24091
|
+
case RGBA_PVRTC_2BPPV1_Format:
|
|
24092
|
+
return ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;
|
|
24093
|
+
case RGB_PVRTC_4BPPV1_Format:
|
|
24094
|
+
case RGBA_PVRTC_4BPPV1_Format:
|
|
24095
|
+
return ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;
|
|
24096
|
+
|
|
24097
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
|
|
24098
|
+
case RGB_ETC1_Format:
|
|
24099
|
+
case RGB_ETC2_Format:
|
|
24100
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
24101
|
+
case RGBA_ETC2_EAC_Format:
|
|
24102
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24103
|
+
|
|
24104
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
|
|
24105
|
+
case RGBA_ASTC_4x4_Format:
|
|
24106
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24107
|
+
case RGBA_ASTC_5x4_Format:
|
|
24108
|
+
return Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24109
|
+
case RGBA_ASTC_5x5_Format:
|
|
24110
|
+
return Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24111
|
+
case RGBA_ASTC_6x5_Format:
|
|
24112
|
+
return Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24113
|
+
case RGBA_ASTC_6x6_Format:
|
|
24114
|
+
return Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
24115
|
+
case RGBA_ASTC_8x5_Format:
|
|
24116
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24117
|
+
case RGBA_ASTC_8x6_Format:
|
|
24118
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
24119
|
+
case RGBA_ASTC_8x8_Format:
|
|
24120
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;
|
|
24121
|
+
case RGBA_ASTC_10x5_Format:
|
|
24122
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24123
|
+
case RGBA_ASTC_10x6_Format:
|
|
24124
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
24125
|
+
case RGBA_ASTC_10x8_Format:
|
|
24126
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;
|
|
24127
|
+
case RGBA_ASTC_10x10_Format:
|
|
24128
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;
|
|
24129
|
+
case RGBA_ASTC_12x10_Format:
|
|
24130
|
+
return Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;
|
|
24131
|
+
case RGBA_ASTC_12x12_Format:
|
|
24132
|
+
return Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;
|
|
24133
|
+
|
|
24134
|
+
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/
|
|
24135
|
+
case RGBA_BPTC_Format:
|
|
24136
|
+
case RGB_BPTC_SIGNED_Format:
|
|
24137
|
+
case RGB_BPTC_UNSIGNED_Format:
|
|
24138
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;
|
|
24139
|
+
|
|
24140
|
+
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/
|
|
24141
|
+
case RED_RGTC1_Format:
|
|
24142
|
+
case SIGNED_RED_RGTC1_Format:
|
|
24143
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;
|
|
24144
|
+
case RED_GREEN_RGTC2_Format:
|
|
24145
|
+
case SIGNED_RED_GREEN_RGTC2_Format:
|
|
24146
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;
|
|
24147
|
+
|
|
24148
|
+
}
|
|
24149
|
+
|
|
24150
|
+
throw new Error(
|
|
24151
|
+
`Unable to determine texture byte length for ${format} format.`,
|
|
24152
|
+
);
|
|
24153
|
+
|
|
24154
|
+
}
|
|
24155
|
+
|
|
24156
|
+
function getTextureTypeByteLength( type ) {
|
|
24157
|
+
|
|
24158
|
+
switch ( type ) {
|
|
24159
|
+
|
|
24160
|
+
case UnsignedByteType:
|
|
24161
|
+
case ByteType:
|
|
24162
|
+
return { byteLength: 1, components: 1 };
|
|
24163
|
+
case UnsignedShortType:
|
|
24164
|
+
case ShortType:
|
|
24165
|
+
case HalfFloatType:
|
|
24166
|
+
return { byteLength: 2, components: 1 };
|
|
24167
|
+
case UnsignedShort4444Type:
|
|
24168
|
+
case UnsignedShort5551Type:
|
|
24169
|
+
return { byteLength: 2, components: 4 };
|
|
24170
|
+
case UnsignedIntType:
|
|
24171
|
+
case IntType:
|
|
24172
|
+
case FloatType:
|
|
24173
|
+
return { byteLength: 4, components: 1 };
|
|
24174
|
+
case UnsignedInt5999Type:
|
|
24175
|
+
return { byteLength: 4, components: 3 };
|
|
24176
|
+
|
|
24177
|
+
}
|
|
24178
|
+
|
|
24179
|
+
throw new Error( `Unknown texture type ${type}.` );
|
|
24180
|
+
|
|
24181
|
+
}
|
|
24182
|
+
|
|
24183
|
+
const TextureUtils = {
|
|
24184
|
+
contain,
|
|
24185
|
+
cover,
|
|
24186
|
+
fill,
|
|
24187
|
+
getByteLength
|
|
24188
|
+
};
|
|
24189
|
+
|
|
23929
24190
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
|
|
23930
24191
|
|
|
23931
24192
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
@@ -24821,10 +25082,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24821
25082
|
|
|
24822
25083
|
if ( texture.layerUpdates.size > 0 ) {
|
|
24823
25084
|
|
|
25085
|
+
const layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
|
|
25086
|
+
|
|
24824
25087
|
for ( const layerIndex of texture.layerUpdates ) {
|
|
24825
25088
|
|
|
24826
|
-
const
|
|
24827
|
-
|
|
25089
|
+
const layerData = mipmap.data.subarray(
|
|
25090
|
+
layerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,
|
|
25091
|
+
( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT
|
|
25092
|
+
);
|
|
25093
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );
|
|
24828
25094
|
|
|
24829
25095
|
}
|
|
24830
25096
|
|
|
@@ -24942,60 +25208,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24942
25208
|
|
|
24943
25209
|
if ( texture.layerUpdates.size > 0 ) {
|
|
24944
25210
|
|
|
24945
|
-
|
|
24946
|
-
// interpreted as one color component, depending on format. When
|
|
24947
|
-
// type is one of GL_UNSIGNED_SHORT_5_6_5,
|
|
24948
|
-
// GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, each
|
|
24949
|
-
// unsigned value is interpreted as containing all the components
|
|
24950
|
-
// for a single pixel, with the color components arranged
|
|
24951
|
-
// according to format.
|
|
24952
|
-
//
|
|
24953
|
-
// See https://registry.khronos.org/OpenGL-Refpages/es1.1/xhtml/glTexImage2D.xml
|
|
24954
|
-
let texelSize;
|
|
24955
|
-
switch ( glType ) {
|
|
24956
|
-
|
|
24957
|
-
case _gl.UNSIGNED_BYTE:
|
|
24958
|
-
switch ( glFormat ) {
|
|
24959
|
-
|
|
24960
|
-
case _gl.ALPHA:
|
|
24961
|
-
texelSize = 1;
|
|
24962
|
-
break;
|
|
24963
|
-
case _gl.LUMINANCE:
|
|
24964
|
-
texelSize = 1;
|
|
24965
|
-
break;
|
|
24966
|
-
case _gl.LUMINANCE_ALPHA:
|
|
24967
|
-
texelSize = 2;
|
|
24968
|
-
break;
|
|
24969
|
-
case _gl.RGB:
|
|
24970
|
-
texelSize = 3;
|
|
24971
|
-
break;
|
|
24972
|
-
case _gl.RGBA:
|
|
24973
|
-
texelSize = 4;
|
|
24974
|
-
break;
|
|
24975
|
-
|
|
24976
|
-
default:
|
|
24977
|
-
throw new Error( `Unknown texel size for format ${glFormat}.` );
|
|
24978
|
-
|
|
24979
|
-
}
|
|
24980
|
-
|
|
24981
|
-
break;
|
|
24982
|
-
|
|
24983
|
-
case _gl.UNSIGNED_SHORT_4_4_4_4:
|
|
24984
|
-
case _gl.UNSIGNED_SHORT_5_5_5_1:
|
|
24985
|
-
case _gl.UNSIGNED_SHORT_5_6_5:
|
|
24986
|
-
texelSize = 1;
|
|
24987
|
-
break;
|
|
24988
|
-
|
|
24989
|
-
default:
|
|
24990
|
-
throw new Error( `Unknown texel size for type ${glType}.` );
|
|
24991
|
-
|
|
24992
|
-
}
|
|
24993
|
-
|
|
24994
|
-
const layerSize = image.width * image.height * texelSize;
|
|
25211
|
+
const layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );
|
|
24995
25212
|
|
|
24996
25213
|
for ( const layerIndex of texture.layerUpdates ) {
|
|
24997
25214
|
|
|
24998
|
-
|
|
25215
|
+
const layerData = image.data.subarray(
|
|
25216
|
+
layerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,
|
|
25217
|
+
( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT
|
|
25218
|
+
);
|
|
25219
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );
|
|
24999
25220
|
|
|
25000
25221
|
}
|
|
25001
25222
|
|
|
@@ -27476,6 +27697,12 @@ class WebXRDepthSensing {
|
|
|
27476
27697
|
|
|
27477
27698
|
}
|
|
27478
27699
|
|
|
27700
|
+
getDepthTexture() {
|
|
27701
|
+
|
|
27702
|
+
return this.texture;
|
|
27703
|
+
|
|
27704
|
+
}
|
|
27705
|
+
|
|
27479
27706
|
}
|
|
27480
27707
|
|
|
27481
27708
|
class WebXRManager extends EventDispatcher {
|
|
@@ -27898,6 +28125,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
27898
28125
|
session.updateRenderState( { layers: layersCopy } );
|
|
27899
28126
|
};
|
|
27900
28127
|
|
|
28128
|
+
this.getDepthTexture = function () {
|
|
28129
|
+
|
|
28130
|
+
return depthSensing.getDepthTexture();
|
|
28131
|
+
|
|
28132
|
+
};
|
|
28133
|
+
|
|
27901
28134
|
function onInputSourcesChange( event ) {
|
|
27902
28135
|
|
|
27903
28136
|
// Notify disconnected
|
|
@@ -29176,27 +29409,27 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
29176
29409
|
|
|
29177
29410
|
const info = getUniformSize( value );
|
|
29178
29411
|
|
|
29179
|
-
//
|
|
29180
|
-
const
|
|
29412
|
+
const chunkOffset = offset % chunkSize; // offset in the current chunk
|
|
29413
|
+
const chunkPadding = chunkOffset % info.boundary; // required padding to match boundary
|
|
29414
|
+
const chunkStart = chunkOffset + chunkPadding; // the start position in the current chunk for the data
|
|
29415
|
+
|
|
29416
|
+
offset += chunkPadding;
|
|
29181
29417
|
|
|
29182
29418
|
// Check for chunk overflow
|
|
29183
|
-
if (
|
|
29419
|
+
if ( chunkStart !== 0 && ( chunkSize - chunkStart ) < info.storage ) {
|
|
29184
29420
|
|
|
29185
29421
|
// Add padding and adjust offset
|
|
29186
|
-
offset += ( chunkSize -
|
|
29422
|
+
offset += ( chunkSize - chunkStart );
|
|
29187
29423
|
|
|
29188
29424
|
}
|
|
29189
29425
|
|
|
29190
29426
|
// the following two properties will be used for partial buffer updates
|
|
29191
|
-
|
|
29192
29427
|
uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
|
|
29193
29428
|
uniform.__offset = offset;
|
|
29194
29429
|
|
|
29195
|
-
|
|
29196
29430
|
// Update the global offset
|
|
29197
29431
|
offset += info.storage;
|
|
29198
29432
|
|
|
29199
|
-
|
|
29200
29433
|
}
|
|
29201
29434
|
|
|
29202
29435
|
}
|
|
@@ -29468,6 +29701,8 @@ class WebGLRenderer {
|
|
|
29468
29701
|
|
|
29469
29702
|
const _vector3 = new Vector3();
|
|
29470
29703
|
|
|
29704
|
+
const _vector4 = new Vector4();
|
|
29705
|
+
|
|
29471
29706
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
29472
29707
|
|
|
29473
29708
|
let _renderBackground = false;
|
|
@@ -30127,7 +30362,25 @@ class WebGLRenderer {
|
|
|
30127
30362
|
|
|
30128
30363
|
} else {
|
|
30129
30364
|
|
|
30130
|
-
|
|
30365
|
+
if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {
|
|
30366
|
+
|
|
30367
|
+
const starts = object._multiDrawStarts;
|
|
30368
|
+
const counts = object._multiDrawCounts;
|
|
30369
|
+
const drawCount = object._multiDrawCount;
|
|
30370
|
+
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
30371
|
+
const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
30372
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
30373
|
+
|
|
30374
|
+
uniforms.setValue( _gl, '_gl_DrawID', i );
|
|
30375
|
+
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
30376
|
+
|
|
30377
|
+
}
|
|
30378
|
+
|
|
30379
|
+
} else {
|
|
30380
|
+
|
|
30381
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
30382
|
+
|
|
30383
|
+
}
|
|
30131
30384
|
|
|
30132
30385
|
}
|
|
30133
30386
|
|
|
@@ -30600,7 +30853,7 @@ class WebGLRenderer {
|
|
|
30600
30853
|
|
|
30601
30854
|
if ( sortObjects ) {
|
|
30602
30855
|
|
|
30603
|
-
|
|
30856
|
+
_vector4.setFromMatrixPosition( object.matrixWorld )
|
|
30604
30857
|
.applyMatrix4( _projScreenMatrix );
|
|
30605
30858
|
|
|
30606
30859
|
}
|
|
@@ -30610,7 +30863,7 @@ class WebGLRenderer {
|
|
|
30610
30863
|
|
|
30611
30864
|
if ( material.visible ) {
|
|
30612
30865
|
|
|
30613
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
30866
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
30614
30867
|
|
|
30615
30868
|
}
|
|
30616
30869
|
|
|
@@ -30628,16 +30881,16 @@ class WebGLRenderer {
|
|
|
30628
30881
|
if ( object.boundingSphere !== undefined ) {
|
|
30629
30882
|
|
|
30630
30883
|
if ( object.boundingSphere === null ) object.computeBoundingSphere();
|
|
30631
|
-
|
|
30884
|
+
_vector4.copy( object.boundingSphere.center );
|
|
30632
30885
|
|
|
30633
30886
|
} else {
|
|
30634
30887
|
|
|
30635
30888
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
30636
|
-
|
|
30889
|
+
_vector4.copy( geometry.boundingSphere.center );
|
|
30637
30890
|
|
|
30638
30891
|
}
|
|
30639
30892
|
|
|
30640
|
-
|
|
30893
|
+
_vector4
|
|
30641
30894
|
.applyMatrix4( object.matrixWorld )
|
|
30642
30895
|
.applyMatrix4( _projScreenMatrix );
|
|
30643
30896
|
|
|
@@ -30654,7 +30907,7 @@ class WebGLRenderer {
|
|
|
30654
30907
|
|
|
30655
30908
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
30656
30909
|
|
|
30657
|
-
currentRenderList.push( object, geometry, groupMaterial, groupOrder,
|
|
30910
|
+
currentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );
|
|
30658
30911
|
|
|
30659
30912
|
}
|
|
30660
30913
|
|
|
@@ -30662,7 +30915,7 @@ class WebGLRenderer {
|
|
|
30662
30915
|
|
|
30663
30916
|
} else if ( material.visible ) {
|
|
30664
30917
|
|
|
30665
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
30918
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
30666
30919
|
|
|
30667
30920
|
}
|
|
30668
30921
|
|
|
@@ -30757,15 +31010,9 @@ class WebGLRenderer {
|
|
|
30757
31010
|
_currentClearAlpha = _this.getClearAlpha();
|
|
30758
31011
|
if ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );
|
|
30759
31012
|
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
background.render( scene );
|
|
30763
|
-
|
|
30764
|
-
} else {
|
|
30765
|
-
|
|
30766
|
-
_this.clear();
|
|
31013
|
+
_this.clear();
|
|
30767
31014
|
|
|
30768
|
-
|
|
31015
|
+
if ( _renderBackground ) background.render( scene );
|
|
30769
31016
|
|
|
30770
31017
|
// Turn off the features which can affect the frag color for opaque objects pass.
|
|
30771
31018
|
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
|
|
@@ -30866,8 +31113,6 @@ class WebGLRenderer {
|
|
|
30866
31113
|
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
30867
31114
|
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
|
|
30868
31115
|
|
|
30869
|
-
material.onBeforeRender( _this, scene, camera, geometry, object, group );
|
|
30870
|
-
|
|
30871
31116
|
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
30872
31117
|
|
|
30873
31118
|
material.side = BackSide;
|
|
@@ -30942,8 +31187,6 @@ class WebGLRenderer {
|
|
|
30942
31187
|
|
|
30943
31188
|
parameters.uniforms = programCache.getUniforms( material );
|
|
30944
31189
|
|
|
30945
|
-
material.onBuild( object, parameters, _this );
|
|
30946
|
-
|
|
30947
31190
|
material.onBeforeCompile( parameters, _this );
|
|
30948
31191
|
|
|
30949
31192
|
program = programCache.acquireProgram( parameters, programCacheKey );
|
|
@@ -31328,6 +31571,9 @@ class WebGLRenderer {
|
|
|
31328
31571
|
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
31329
31572
|
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
31330
31573
|
|
|
31574
|
+
p_uniforms.setOptional( _gl, object, 'batchingIdTexture' );
|
|
31575
|
+
p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
|
|
31576
|
+
|
|
31331
31577
|
p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
|
|
31332
31578
|
if ( object._colorsTexture !== null ) {
|
|
31333
31579
|
|
|
@@ -31815,7 +32061,7 @@ class WebGLRenderer {
|
|
|
31815
32061
|
if ( texture.isTexture !== true ) {
|
|
31816
32062
|
|
|
31817
32063
|
// @deprecated, r165
|
|
31818
|
-
|
|
32064
|
+
warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
|
|
31819
32065
|
|
|
31820
32066
|
position = arguments[ 0 ] || null;
|
|
31821
32067
|
texture = arguments[ 1 ];
|
|
@@ -31843,7 +32089,7 @@ class WebGLRenderer {
|
|
|
31843
32089
|
if ( srcTexture.isTexture !== true ) {
|
|
31844
32090
|
|
|
31845
32091
|
// @deprecated, r165
|
|
31846
|
-
|
|
32092
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
|
|
31847
32093
|
|
|
31848
32094
|
dstPosition = arguments[ 0 ] || null;
|
|
31849
32095
|
srcTexture = arguments[ 1 ];
|
|
@@ -31919,7 +32165,7 @@ class WebGLRenderer {
|
|
|
31919
32165
|
|
|
31920
32166
|
} else {
|
|
31921
32167
|
|
|
31922
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, glFormat, glType, image );
|
|
32168
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image );
|
|
31923
32169
|
|
|
31924
32170
|
}
|
|
31925
32171
|
|
|
@@ -31944,7 +32190,7 @@ class WebGLRenderer {
|
|
|
31944
32190
|
if ( srcTexture.isTexture !== true ) {
|
|
31945
32191
|
|
|
31946
32192
|
// @deprecated, r165
|
|
31947
|
-
|
|
32193
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
31948
32194
|
|
|
31949
32195
|
srcRegion = arguments[ 0 ] || null;
|
|
31950
32196
|
dstPosition = arguments[ 1 ] || null;
|
|
@@ -33994,7 +34240,7 @@ class InstancedMesh extends Mesh {
|
|
|
33994
34240
|
|
|
33995
34241
|
if ( this.instanceColor === null ) {
|
|
33996
34242
|
|
|
33997
|
-
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );
|
|
34243
|
+
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
|
|
33998
34244
|
|
|
33999
34245
|
}
|
|
34000
34246
|
|
|
@@ -34083,7 +34329,7 @@ class MultiDrawRenderList {
|
|
|
34083
34329
|
|
|
34084
34330
|
}
|
|
34085
34331
|
|
|
34086
|
-
push( drawRange, z ) {
|
|
34332
|
+
push( drawRange, z, index ) {
|
|
34087
34333
|
|
|
34088
34334
|
const pool = this.pool;
|
|
34089
34335
|
const list = this.list;
|
|
@@ -34094,6 +34340,7 @@ class MultiDrawRenderList {
|
|
|
34094
34340
|
start: - 1,
|
|
34095
34341
|
count: - 1,
|
|
34096
34342
|
z: - 1,
|
|
34343
|
+
index: - 1,
|
|
34097
34344
|
|
|
34098
34345
|
} );
|
|
34099
34346
|
|
|
@@ -34106,6 +34353,7 @@ class MultiDrawRenderList {
|
|
|
34106
34353
|
item.start = drawRange.start;
|
|
34107
34354
|
item.count = drawRange.count;
|
|
34108
34355
|
item.z = z;
|
|
34356
|
+
item.index = index;
|
|
34109
34357
|
|
|
34110
34358
|
}
|
|
34111
34359
|
|
|
@@ -34118,7 +34366,6 @@ class MultiDrawRenderList {
|
|
|
34118
34366
|
|
|
34119
34367
|
}
|
|
34120
34368
|
|
|
34121
|
-
const ID_ATTR_NAME = 'batchId';
|
|
34122
34369
|
const _matrix$1 = /*@__PURE__*/ new Matrix4();
|
|
34123
34370
|
const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
|
|
34124
34371
|
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
@@ -34173,13 +34420,13 @@ function copyAttributeData( src, target, targetOffset = 0 ) {
|
|
|
34173
34420
|
|
|
34174
34421
|
class BatchedMesh extends Mesh {
|
|
34175
34422
|
|
|
34176
|
-
get
|
|
34423
|
+
get maxInstanceCount() {
|
|
34177
34424
|
|
|
34178
|
-
return this.
|
|
34425
|
+
return this._maxInstanceCount;
|
|
34179
34426
|
|
|
34180
34427
|
}
|
|
34181
34428
|
|
|
34182
|
-
constructor(
|
|
34429
|
+
constructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {
|
|
34183
34430
|
|
|
34184
34431
|
super( new BufferGeometry(), material );
|
|
34185
34432
|
|
|
@@ -34190,32 +34437,33 @@ class BatchedMesh extends Mesh {
|
|
|
34190
34437
|
this.boundingSphere = null;
|
|
34191
34438
|
this.customSort = null;
|
|
34192
34439
|
|
|
34440
|
+
// stores visible, active, and geometry id per object
|
|
34441
|
+
this._drawInfo = [];
|
|
34442
|
+
|
|
34443
|
+
// geometry information
|
|
34193
34444
|
this._drawRanges = [];
|
|
34194
34445
|
this._reservedRanges = [];
|
|
34195
|
-
|
|
34196
|
-
this._visibility = [];
|
|
34197
|
-
this._active = [];
|
|
34198
34446
|
this._bounds = [];
|
|
34199
34447
|
|
|
34200
|
-
this.
|
|
34448
|
+
this._maxInstanceCount = maxInstanceCount;
|
|
34201
34449
|
this._maxVertexCount = maxVertexCount;
|
|
34202
34450
|
this._maxIndexCount = maxIndexCount;
|
|
34203
34451
|
|
|
34204
34452
|
this._geometryInitialized = false;
|
|
34205
34453
|
this._geometryCount = 0;
|
|
34206
|
-
this._multiDrawCounts = new Int32Array(
|
|
34207
|
-
this._multiDrawStarts = new Int32Array(
|
|
34454
|
+
this._multiDrawCounts = new Int32Array( maxInstanceCount );
|
|
34455
|
+
this._multiDrawStarts = new Int32Array( maxInstanceCount );
|
|
34208
34456
|
this._multiDrawCount = 0;
|
|
34209
34457
|
this._multiDrawInstances = null;
|
|
34210
34458
|
this._visibilityChanged = true;
|
|
34211
34459
|
|
|
34212
34460
|
// Local matrix per geometry by using data texture
|
|
34213
34461
|
this._matricesTexture = null;
|
|
34462
|
+
this._indirectTexture = null;
|
|
34463
|
+
this._colorsTexture = null;
|
|
34214
34464
|
|
|
34215
34465
|
this._initMatricesTexture();
|
|
34216
|
-
|
|
34217
|
-
// Local color per geometry by using data texture
|
|
34218
|
-
this._colorsTexture = null;
|
|
34466
|
+
this._initIndirectTexture();
|
|
34219
34467
|
|
|
34220
34468
|
}
|
|
34221
34469
|
|
|
@@ -34228,7 +34476,7 @@ class BatchedMesh extends Mesh {
|
|
|
34228
34476
|
// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)
|
|
34229
34477
|
// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)
|
|
34230
34478
|
|
|
34231
|
-
let size = Math.sqrt( this.
|
|
34479
|
+
let size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix
|
|
34232
34480
|
size = Math.ceil( size / 4 ) * 4;
|
|
34233
34481
|
size = Math.max( size, 4 );
|
|
34234
34482
|
|
|
@@ -34239,9 +34487,21 @@ class BatchedMesh extends Mesh {
|
|
|
34239
34487
|
|
|
34240
34488
|
}
|
|
34241
34489
|
|
|
34490
|
+
_initIndirectTexture() {
|
|
34491
|
+
|
|
34492
|
+
let size = Math.sqrt( this._maxInstanceCount );
|
|
34493
|
+
size = Math.ceil( size );
|
|
34494
|
+
|
|
34495
|
+
const indirectArray = new Uint32Array( size * size );
|
|
34496
|
+
const indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );
|
|
34497
|
+
|
|
34498
|
+
this._indirectTexture = indirectTexture;
|
|
34499
|
+
|
|
34500
|
+
}
|
|
34501
|
+
|
|
34242
34502
|
_initColorsTexture() {
|
|
34243
34503
|
|
|
34244
|
-
let size = Math.sqrt( this.
|
|
34504
|
+
let size = Math.sqrt( this._maxIndexCount );
|
|
34245
34505
|
size = Math.ceil( size );
|
|
34246
34506
|
|
|
34247
34507
|
// 4 floats per RGBA pixel initialized to white
|
|
@@ -34257,7 +34517,6 @@ class BatchedMesh extends Mesh {
|
|
|
34257
34517
|
|
|
34258
34518
|
const geometry = this.geometry;
|
|
34259
34519
|
const maxVertexCount = this._maxVertexCount;
|
|
34260
|
-
const maxGeometryCount = this._maxGeometryCount;
|
|
34261
34520
|
const maxIndexCount = this._maxIndexCount;
|
|
34262
34521
|
if ( this._geometryInitialized === false ) {
|
|
34263
34522
|
|
|
@@ -34275,7 +34534,8 @@ class BatchedMesh extends Mesh {
|
|
|
34275
34534
|
|
|
34276
34535
|
if ( reference.getIndex() !== null ) {
|
|
34277
34536
|
|
|
34278
|
-
|
|
34537
|
+
// Reserve last u16 index for primitive restart.
|
|
34538
|
+
const indexArray = maxVertexCount > 65535
|
|
34279
34539
|
? new Uint32Array( maxIndexCount )
|
|
34280
34540
|
: new Uint16Array( maxIndexCount );
|
|
34281
34541
|
|
|
@@ -34283,11 +34543,6 @@ class BatchedMesh extends Mesh {
|
|
|
34283
34543
|
|
|
34284
34544
|
}
|
|
34285
34545
|
|
|
34286
|
-
const idArray = maxGeometryCount > 65536
|
|
34287
|
-
? new Uint32Array( maxVertexCount )
|
|
34288
|
-
: new Uint16Array( maxVertexCount );
|
|
34289
|
-
geometry.setAttribute( ID_ATTR_NAME, new BufferAttribute( idArray, 1 ) );
|
|
34290
|
-
|
|
34291
34546
|
this._geometryInitialized = true;
|
|
34292
34547
|
|
|
34293
34548
|
}
|
|
@@ -34297,13 +34552,6 @@ class BatchedMesh extends Mesh {
|
|
|
34297
34552
|
// Make sure the geometry is compatible with the existing combined geometry attributes
|
|
34298
34553
|
_validateGeometry( geometry ) {
|
|
34299
34554
|
|
|
34300
|
-
// check that the geometry doesn't have a version of our reserved id attribute
|
|
34301
|
-
if ( geometry.getAttribute( ID_ATTR_NAME ) ) {
|
|
34302
|
-
|
|
34303
|
-
throw new Error( `BatchedMesh: Geometry cannot use attribute "${ ID_ATTR_NAME }"` );
|
|
34304
|
-
|
|
34305
|
-
}
|
|
34306
|
-
|
|
34307
34555
|
// check to ensure the geometries are using consistent attributes and indices
|
|
34308
34556
|
const batchGeometry = this.geometry;
|
|
34309
34557
|
if ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {
|
|
@@ -34314,12 +34562,6 @@ class BatchedMesh extends Mesh {
|
|
|
34314
34562
|
|
|
34315
34563
|
for ( const attributeName in batchGeometry.attributes ) {
|
|
34316
34564
|
|
|
34317
|
-
if ( attributeName === ID_ATTR_NAME ) {
|
|
34318
|
-
|
|
34319
|
-
continue;
|
|
34320
|
-
|
|
34321
|
-
}
|
|
34322
|
-
|
|
34323
34565
|
if ( ! geometry.hasAttribute( attributeName ) ) {
|
|
34324
34566
|
|
|
34325
34567
|
throw new Error( `BatchedMesh: Added geometry missing "${ attributeName }". All geometries must have consistent attributes.` );
|
|
@@ -34355,15 +34597,16 @@ class BatchedMesh extends Mesh {
|
|
|
34355
34597
|
|
|
34356
34598
|
const geometryCount = this._geometryCount;
|
|
34357
34599
|
const boundingBox = this.boundingBox;
|
|
34358
|
-
const
|
|
34600
|
+
const drawInfo = this._drawInfo;
|
|
34359
34601
|
|
|
34360
34602
|
boundingBox.makeEmpty();
|
|
34361
34603
|
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
34362
34604
|
|
|
34363
|
-
if (
|
|
34605
|
+
if ( drawInfo[ i ].active === false ) continue;
|
|
34364
34606
|
|
|
34607
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
34365
34608
|
this.getMatrixAt( i, _matrix$1 );
|
|
34366
|
-
this.getBoundingBoxAt(
|
|
34609
|
+
this.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );
|
|
34367
34610
|
boundingBox.union( _box$1 );
|
|
34368
34611
|
|
|
34369
34612
|
}
|
|
@@ -34378,23 +34621,59 @@ class BatchedMesh extends Mesh {
|
|
|
34378
34621
|
|
|
34379
34622
|
}
|
|
34380
34623
|
|
|
34381
|
-
const geometryCount = this._geometryCount;
|
|
34382
34624
|
const boundingSphere = this.boundingSphere;
|
|
34383
|
-
const
|
|
34625
|
+
const drawInfo = this._drawInfo;
|
|
34384
34626
|
|
|
34385
34627
|
boundingSphere.makeEmpty();
|
|
34386
|
-
for ( let i = 0; i <
|
|
34628
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
34387
34629
|
|
|
34388
|
-
if (
|
|
34630
|
+
if ( drawInfo[ i ].active === false ) continue;
|
|
34389
34631
|
|
|
34632
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
34390
34633
|
this.getMatrixAt( i, _matrix$1 );
|
|
34391
|
-
this.getBoundingSphereAt(
|
|
34634
|
+
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
34392
34635
|
boundingSphere.union( _sphere$2 );
|
|
34393
34636
|
|
|
34394
34637
|
}
|
|
34395
34638
|
|
|
34396
34639
|
}
|
|
34397
34640
|
|
|
34641
|
+
addInstance( geometryId ) {
|
|
34642
|
+
|
|
34643
|
+
// ensure we're not over geometry
|
|
34644
|
+
if ( this._drawInfo.length >= this._maxInstanceCount ) {
|
|
34645
|
+
|
|
34646
|
+
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34647
|
+
|
|
34648
|
+
}
|
|
34649
|
+
|
|
34650
|
+
this._drawInfo.push( {
|
|
34651
|
+
|
|
34652
|
+
visible: true,
|
|
34653
|
+
active: true,
|
|
34654
|
+
geometryIndex: geometryId,
|
|
34655
|
+
|
|
34656
|
+
} );
|
|
34657
|
+
|
|
34658
|
+
// initialize the matrix
|
|
34659
|
+
const drawId = this._drawInfo.length - 1;
|
|
34660
|
+
const matricesTexture = this._matricesTexture;
|
|
34661
|
+
const matricesArray = matricesTexture.image.data;
|
|
34662
|
+
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
34663
|
+
matricesTexture.needsUpdate = true;
|
|
34664
|
+
|
|
34665
|
+
const colorsTexture = this._colorsTexture;
|
|
34666
|
+
if ( colorsTexture ) {
|
|
34667
|
+
|
|
34668
|
+
_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );
|
|
34669
|
+
colorsTexture.needsUpdate = true;
|
|
34670
|
+
|
|
34671
|
+
}
|
|
34672
|
+
|
|
34673
|
+
return drawId;
|
|
34674
|
+
|
|
34675
|
+
}
|
|
34676
|
+
|
|
34398
34677
|
addGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {
|
|
34399
34678
|
|
|
34400
34679
|
this._initializeGeometry( geometry );
|
|
@@ -34402,9 +34681,9 @@ class BatchedMesh extends Mesh {
|
|
|
34402
34681
|
this._validateGeometry( geometry );
|
|
34403
34682
|
|
|
34404
34683
|
// ensure we're not over geometry
|
|
34405
|
-
if ( this.
|
|
34684
|
+
if ( this._drawInfo.length >= this._maxInstanceCount ) {
|
|
34406
34685
|
|
|
34407
|
-
throw new Error( 'BatchedMesh: Maximum
|
|
34686
|
+
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34408
34687
|
|
|
34409
34688
|
}
|
|
34410
34689
|
|
|
@@ -34482,32 +34761,10 @@ class BatchedMesh extends Mesh {
|
|
|
34482
34761
|
|
|
34483
34762
|
}
|
|
34484
34763
|
|
|
34485
|
-
const visibility = this._visibility;
|
|
34486
|
-
const active = this._active;
|
|
34487
|
-
const matricesTexture = this._matricesTexture;
|
|
34488
|
-
const matricesArray = this._matricesTexture.image.data;
|
|
34489
|
-
const colorsTexture = this._colorsTexture;
|
|
34490
|
-
|
|
34491
|
-
// push new visibility states
|
|
34492
|
-
visibility.push( true );
|
|
34493
|
-
active.push( true );
|
|
34494
|
-
|
|
34495
34764
|
// update id
|
|
34496
34765
|
const geometryId = this._geometryCount;
|
|
34497
34766
|
this._geometryCount ++;
|
|
34498
34767
|
|
|
34499
|
-
// initialize matrix information
|
|
34500
|
-
_identityMatrix.toArray( matricesArray, geometryId * 16 );
|
|
34501
|
-
matricesTexture.needsUpdate = true;
|
|
34502
|
-
|
|
34503
|
-
// initialize the color to white
|
|
34504
|
-
if ( colorsTexture !== null ) {
|
|
34505
|
-
|
|
34506
|
-
_whiteColor.toArray( colorsTexture.image.data, geometryId * 4 );
|
|
34507
|
-
colorsTexture.needsUpdate = true;
|
|
34508
|
-
|
|
34509
|
-
}
|
|
34510
|
-
|
|
34511
34768
|
// add the reserved range and draw range objects
|
|
34512
34769
|
reservedRanges.push( reservedRange );
|
|
34513
34770
|
drawRanges.push( {
|
|
@@ -34522,16 +34779,6 @@ class BatchedMesh extends Mesh {
|
|
|
34522
34779
|
sphere: new Sphere()
|
|
34523
34780
|
} );
|
|
34524
34781
|
|
|
34525
|
-
// set the id for the geometry
|
|
34526
|
-
const idAttribute = this.geometry.getAttribute( ID_ATTR_NAME );
|
|
34527
|
-
for ( let i = 0; i < reservedRange.vertexCount; i ++ ) {
|
|
34528
|
-
|
|
34529
|
-
idAttribute.setX( reservedRange.vertexStart + i, geometryId );
|
|
34530
|
-
|
|
34531
|
-
}
|
|
34532
|
-
|
|
34533
|
-
idAttribute.needsUpdate = true;
|
|
34534
|
-
|
|
34535
34782
|
// update the geometry
|
|
34536
34783
|
this.setGeometryAt( geometryId, geometry );
|
|
34537
34784
|
|
|
@@ -34539,9 +34786,9 @@ class BatchedMesh extends Mesh {
|
|
|
34539
34786
|
|
|
34540
34787
|
}
|
|
34541
34788
|
|
|
34542
|
-
setGeometryAt(
|
|
34789
|
+
setGeometryAt( geometryId, geometry ) {
|
|
34543
34790
|
|
|
34544
|
-
if (
|
|
34791
|
+
if ( geometryId >= this._geometryCount ) {
|
|
34545
34792
|
|
|
34546
34793
|
throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
|
|
34547
34794
|
|
|
@@ -34553,7 +34800,7 @@ class BatchedMesh extends Mesh {
|
|
|
34553
34800
|
const hasIndex = batchGeometry.getIndex() !== null;
|
|
34554
34801
|
const dstIndex = batchGeometry.getIndex();
|
|
34555
34802
|
const srcIndex = geometry.getIndex();
|
|
34556
|
-
const reservedRange = this._reservedRanges[
|
|
34803
|
+
const reservedRange = this._reservedRanges[ geometryId ];
|
|
34557
34804
|
if (
|
|
34558
34805
|
hasIndex &&
|
|
34559
34806
|
srcIndex.count > reservedRange.indexCount ||
|
|
@@ -34569,12 +34816,6 @@ class BatchedMesh extends Mesh {
|
|
|
34569
34816
|
const vertexCount = reservedRange.vertexCount;
|
|
34570
34817
|
for ( const attributeName in batchGeometry.attributes ) {
|
|
34571
34818
|
|
|
34572
|
-
if ( attributeName === ID_ATTR_NAME ) {
|
|
34573
|
-
|
|
34574
|
-
continue;
|
|
34575
|
-
|
|
34576
|
-
}
|
|
34577
|
-
|
|
34578
34819
|
// copy attribute data
|
|
34579
34820
|
const srcAttribute = geometry.getAttribute( attributeName );
|
|
34580
34821
|
const dstAttribute = batchGeometry.getAttribute( attributeName );
|
|
@@ -34623,7 +34864,7 @@ class BatchedMesh extends Mesh {
|
|
|
34623
34864
|
}
|
|
34624
34865
|
|
|
34625
34866
|
// store the bounding boxes
|
|
34626
|
-
const bound = this._bounds[
|
|
34867
|
+
const bound = this._bounds[ geometryId ];
|
|
34627
34868
|
if ( geometry.boundingBox !== null ) {
|
|
34628
34869
|
|
|
34629
34870
|
bound.box.copy( geometry.boundingBox );
|
|
@@ -34647,67 +34888,54 @@ class BatchedMesh extends Mesh {
|
|
|
34647
34888
|
}
|
|
34648
34889
|
|
|
34649
34890
|
// set drawRange count
|
|
34650
|
-
const drawRange = this._drawRanges[
|
|
34891
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34651
34892
|
const posAttr = geometry.getAttribute( 'position' );
|
|
34652
34893
|
drawRange.count = hasIndex ? srcIndex.count : posAttr.count;
|
|
34653
34894
|
this._visibilityChanged = true;
|
|
34654
34895
|
|
|
34655
|
-
return
|
|
34896
|
+
return geometryId;
|
|
34656
34897
|
|
|
34657
34898
|
}
|
|
34658
34899
|
|
|
34900
|
+
/*
|
|
34659
34901
|
deleteGeometry( geometryId ) {
|
|
34660
34902
|
|
|
34661
|
-
//
|
|
34662
|
-
|
|
34663
|
-
const active = this._active;
|
|
34664
|
-
if ( geometryId >= active.length || active[ geometryId ] === false ) {
|
|
34665
|
-
|
|
34666
|
-
return this;
|
|
34667
|
-
|
|
34668
|
-
}
|
|
34669
|
-
|
|
34670
|
-
active[ geometryId ] = false;
|
|
34671
|
-
this._visibilityChanged = true;
|
|
34672
|
-
|
|
34673
|
-
return this;
|
|
34903
|
+
// TODO: delete geometry and associated instances
|
|
34674
34904
|
|
|
34675
34905
|
}
|
|
34906
|
+
*/
|
|
34676
34907
|
|
|
34677
|
-
|
|
34678
|
-
|
|
34679
|
-
if ( this._multiDrawInstances === null ) return null;
|
|
34680
|
-
|
|
34681
|
-
return this._multiDrawInstances[ id ];
|
|
34682
|
-
|
|
34683
|
-
}
|
|
34908
|
+
/*
|
|
34909
|
+
deleteInstance( instanceId ) {
|
|
34684
34910
|
|
|
34685
|
-
|
|
34911
|
+
// Note: User needs to call optimize() afterward to pack the data.
|
|
34686
34912
|
|
|
34687
|
-
|
|
34913
|
+
const drawInfo = this._drawInfo;
|
|
34914
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34688
34915
|
|
|
34689
|
-
|
|
34916
|
+
return this;
|
|
34690
34917
|
|
|
34691
34918
|
}
|
|
34692
34919
|
|
|
34693
|
-
|
|
34920
|
+
drawInfo[ instanceId ].active = false;
|
|
34921
|
+
this._visibilityChanged = true;
|
|
34694
34922
|
|
|
34695
|
-
return
|
|
34923
|
+
return this;
|
|
34696
34924
|
|
|
34697
34925
|
}
|
|
34926
|
+
*/
|
|
34698
34927
|
|
|
34699
34928
|
// get bounding box and compute it if it doesn't exist
|
|
34700
|
-
getBoundingBoxAt(
|
|
34929
|
+
getBoundingBoxAt( geometryId, target ) {
|
|
34701
34930
|
|
|
34702
|
-
|
|
34703
|
-
if ( active[ id ] === false ) {
|
|
34931
|
+
if ( geometryId >= this._geometryCount ) {
|
|
34704
34932
|
|
|
34705
34933
|
return null;
|
|
34706
34934
|
|
|
34707
34935
|
}
|
|
34708
34936
|
|
|
34709
34937
|
// compute bounding box
|
|
34710
|
-
const bound = this._bounds[
|
|
34938
|
+
const bound = this._bounds[ geometryId ];
|
|
34711
34939
|
const box = bound.box;
|
|
34712
34940
|
const geometry = this.geometry;
|
|
34713
34941
|
if ( bound.boxInitialized === false ) {
|
|
@@ -34716,7 +34944,7 @@ class BatchedMesh extends Mesh {
|
|
|
34716
34944
|
|
|
34717
34945
|
const index = geometry.index;
|
|
34718
34946
|
const position = geometry.attributes.position;
|
|
34719
|
-
const drawRange = this._drawRanges[
|
|
34947
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34720
34948
|
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
34721
34949
|
|
|
34722
34950
|
let iv = i;
|
|
@@ -34740,29 +34968,28 @@ class BatchedMesh extends Mesh {
|
|
|
34740
34968
|
}
|
|
34741
34969
|
|
|
34742
34970
|
// get bounding sphere and compute it if it doesn't exist
|
|
34743
|
-
getBoundingSphereAt(
|
|
34971
|
+
getBoundingSphereAt( geometryId, target ) {
|
|
34744
34972
|
|
|
34745
|
-
|
|
34746
|
-
if ( active[ id ] === false ) {
|
|
34973
|
+
if ( geometryId >= this._geometryCount ) {
|
|
34747
34974
|
|
|
34748
34975
|
return null;
|
|
34749
34976
|
|
|
34750
34977
|
}
|
|
34751
34978
|
|
|
34752
34979
|
// compute bounding sphere
|
|
34753
|
-
const bound = this._bounds[
|
|
34980
|
+
const bound = this._bounds[ geometryId ];
|
|
34754
34981
|
const sphere = bound.sphere;
|
|
34755
34982
|
const geometry = this.geometry;
|
|
34756
34983
|
if ( bound.sphereInitialized === false ) {
|
|
34757
34984
|
|
|
34758
34985
|
sphere.makeEmpty();
|
|
34759
34986
|
|
|
34760
|
-
this.getBoundingBoxAt(
|
|
34987
|
+
this.getBoundingBoxAt( geometryId, _box$1 );
|
|
34761
34988
|
_box$1.getCenter( sphere.center );
|
|
34762
34989
|
|
|
34763
34990
|
const index = geometry.index;
|
|
34764
34991
|
const position = geometry.attributes.position;
|
|
34765
|
-
const drawRange = this._drawRanges[
|
|
34992
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34766
34993
|
|
|
34767
34994
|
let maxRadiusSq = 0;
|
|
34768
34995
|
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
@@ -34789,44 +35016,42 @@ class BatchedMesh extends Mesh {
|
|
|
34789
35016
|
|
|
34790
35017
|
}
|
|
34791
35018
|
|
|
34792
|
-
setMatrixAt(
|
|
35019
|
+
setMatrixAt( instanceId, matrix ) {
|
|
34793
35020
|
|
|
34794
35021
|
// @TODO: Map geometryId to index of the arrays because
|
|
34795
35022
|
// optimize() can make geometryId mismatch the index
|
|
34796
35023
|
|
|
34797
|
-
const
|
|
35024
|
+
const drawInfo = this._drawInfo;
|
|
34798
35025
|
const matricesTexture = this._matricesTexture;
|
|
34799
35026
|
const matricesArray = this._matricesTexture.image.data;
|
|
34800
|
-
|
|
34801
|
-
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
35027
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34802
35028
|
|
|
34803
35029
|
return this;
|
|
34804
35030
|
|
|
34805
35031
|
}
|
|
34806
35032
|
|
|
34807
|
-
matrix.toArray( matricesArray,
|
|
35033
|
+
matrix.toArray( matricesArray, instanceId * 16 );
|
|
34808
35034
|
matricesTexture.needsUpdate = true;
|
|
34809
35035
|
|
|
34810
35036
|
return this;
|
|
34811
35037
|
|
|
34812
35038
|
}
|
|
34813
35039
|
|
|
34814
|
-
getMatrixAt(
|
|
35040
|
+
getMatrixAt( instanceId, matrix ) {
|
|
34815
35041
|
|
|
34816
|
-
const
|
|
35042
|
+
const drawInfo = this._drawInfo;
|
|
34817
35043
|
const matricesArray = this._matricesTexture.image.data;
|
|
34818
|
-
|
|
34819
|
-
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
35044
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34820
35045
|
|
|
34821
35046
|
return null;
|
|
34822
35047
|
|
|
34823
35048
|
}
|
|
34824
35049
|
|
|
34825
|
-
return matrix.fromArray( matricesArray,
|
|
35050
|
+
return matrix.fromArray( matricesArray, instanceId * 16 );
|
|
34826
35051
|
|
|
34827
35052
|
}
|
|
34828
35053
|
|
|
34829
|
-
setColorAt(
|
|
35054
|
+
setColorAt( instanceId, color ) {
|
|
34830
35055
|
|
|
34831
35056
|
if ( this._colorsTexture === null ) {
|
|
34832
35057
|
|
|
@@ -34834,89 +35059,79 @@ class BatchedMesh extends Mesh {
|
|
|
34834
35059
|
|
|
34835
35060
|
}
|
|
34836
35061
|
|
|
34837
|
-
// @TODO: Map
|
|
34838
|
-
// optimize() can make
|
|
35062
|
+
// @TODO: Map id to index of the arrays because
|
|
35063
|
+
// optimize() can make id mismatch the index
|
|
34839
35064
|
|
|
34840
|
-
const active = this._active;
|
|
34841
35065
|
const colorsTexture = this._colorsTexture;
|
|
34842
35066
|
const colorsArray = this._colorsTexture.image.data;
|
|
34843
|
-
const
|
|
34844
|
-
if (
|
|
35067
|
+
const drawInfo = this._drawInfo;
|
|
35068
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34845
35069
|
|
|
34846
35070
|
return this;
|
|
34847
35071
|
|
|
34848
35072
|
}
|
|
34849
35073
|
|
|
34850
|
-
color.toArray( colorsArray,
|
|
35074
|
+
color.toArray( colorsArray, instanceId * 4 );
|
|
34851
35075
|
colorsTexture.needsUpdate = true;
|
|
34852
35076
|
|
|
34853
35077
|
return this;
|
|
34854
35078
|
|
|
34855
35079
|
}
|
|
34856
35080
|
|
|
34857
|
-
getColorAt(
|
|
35081
|
+
getColorAt( instanceId, color ) {
|
|
34858
35082
|
|
|
34859
|
-
const active = this._active;
|
|
34860
35083
|
const colorsArray = this._colorsTexture.image.data;
|
|
34861
|
-
const
|
|
34862
|
-
if (
|
|
35084
|
+
const drawInfo = this._drawInfo;
|
|
35085
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34863
35086
|
|
|
34864
35087
|
return null;
|
|
34865
35088
|
|
|
34866
35089
|
}
|
|
34867
35090
|
|
|
34868
|
-
return color.fromArray( colorsArray,
|
|
35091
|
+
return color.fromArray( colorsArray, instanceId * 4 );
|
|
34869
35092
|
|
|
34870
35093
|
}
|
|
34871
35094
|
|
|
34872
|
-
setVisibleAt(
|
|
34873
|
-
|
|
34874
|
-
const visibility = this._visibility;
|
|
34875
|
-
const active = this._active;
|
|
34876
|
-
const geometryCount = this._geometryCount;
|
|
35095
|
+
setVisibleAt( instanceId, value ) {
|
|
34877
35096
|
|
|
34878
35097
|
// if the geometry is out of range, not active, or visibility state
|
|
34879
35098
|
// does not change then return early
|
|
35099
|
+
const drawInfo = this._drawInfo;
|
|
34880
35100
|
if (
|
|
34881
|
-
|
|
34882
|
-
|
|
34883
|
-
|
|
35101
|
+
instanceId >= drawInfo.length ||
|
|
35102
|
+
drawInfo[ instanceId ].active === false ||
|
|
35103
|
+
drawInfo[ instanceId ].visible === value
|
|
34884
35104
|
) {
|
|
34885
35105
|
|
|
34886
35106
|
return this;
|
|
34887
35107
|
|
|
34888
35108
|
}
|
|
34889
35109
|
|
|
34890
|
-
|
|
35110
|
+
drawInfo[ instanceId ].visible = value;
|
|
34891
35111
|
this._visibilityChanged = true;
|
|
34892
35112
|
|
|
34893
35113
|
return this;
|
|
34894
35114
|
|
|
34895
35115
|
}
|
|
34896
35116
|
|
|
34897
|
-
getVisibleAt(
|
|
34898
|
-
|
|
34899
|
-
const visibility = this._visibility;
|
|
34900
|
-
const active = this._active;
|
|
34901
|
-
const geometryCount = this._geometryCount;
|
|
35117
|
+
getVisibleAt( instanceId ) {
|
|
34902
35118
|
|
|
34903
35119
|
// return early if the geometry is out of range or not active
|
|
34904
|
-
|
|
35120
|
+
const drawInfo = this._drawInfo;
|
|
35121
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34905
35122
|
|
|
34906
35123
|
return false;
|
|
34907
35124
|
|
|
34908
35125
|
}
|
|
34909
35126
|
|
|
34910
|
-
return
|
|
35127
|
+
return drawInfo[ instanceId ].visible;
|
|
34911
35128
|
|
|
34912
35129
|
}
|
|
34913
35130
|
|
|
34914
35131
|
raycast( raycaster, intersects ) {
|
|
34915
35132
|
|
|
34916
|
-
const
|
|
34917
|
-
const active = this._active;
|
|
35133
|
+
const drawInfo = this._drawInfo;
|
|
34918
35134
|
const drawRanges = this._drawRanges;
|
|
34919
|
-
const geometryCount = this._geometryCount;
|
|
34920
35135
|
const matrixWorld = this.matrixWorld;
|
|
34921
35136
|
const batchGeometry = this.geometry;
|
|
34922
35137
|
|
|
@@ -34936,21 +35151,22 @@ class BatchedMesh extends Mesh {
|
|
|
34936
35151
|
|
|
34937
35152
|
}
|
|
34938
35153
|
|
|
34939
|
-
for ( let i = 0; i <
|
|
35154
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
34940
35155
|
|
|
34941
|
-
if ( !
|
|
35156
|
+
if ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {
|
|
34942
35157
|
|
|
34943
35158
|
continue;
|
|
34944
35159
|
|
|
34945
35160
|
}
|
|
34946
35161
|
|
|
34947
|
-
const
|
|
35162
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
35163
|
+
const drawRange = drawRanges[ geometryId ];
|
|
34948
35164
|
_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );
|
|
34949
35165
|
|
|
34950
35166
|
// ge the intersects
|
|
34951
35167
|
this.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );
|
|
34952
|
-
this.getBoundingBoxAt(
|
|
34953
|
-
this.getBoundingSphereAt(
|
|
35168
|
+
this.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );
|
|
35169
|
+
this.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );
|
|
34954
35170
|
_mesh.raycast( raycaster, _batchIntersects );
|
|
34955
35171
|
|
|
34956
35172
|
// add batch id to the intersects
|
|
@@ -34987,8 +35203,7 @@ class BatchedMesh extends Mesh {
|
|
|
34987
35203
|
this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
|
|
34988
35204
|
this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
|
|
34989
35205
|
|
|
34990
|
-
this.
|
|
34991
|
-
this._active = source._active.slice();
|
|
35206
|
+
this._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );
|
|
34992
35207
|
this._bounds = source._bounds.map( bound => ( {
|
|
34993
35208
|
boxInitialized: bound.boxInitialized,
|
|
34994
35209
|
box: bound.box.clone(),
|
|
@@ -34997,7 +35212,7 @@ class BatchedMesh extends Mesh {
|
|
|
34997
35212
|
sphere: bound.sphere.clone()
|
|
34998
35213
|
} ) );
|
|
34999
35214
|
|
|
35000
|
-
this.
|
|
35215
|
+
this._maxInstanceCount = source._maxInstanceCount;
|
|
35001
35216
|
this._maxVertexCount = source._maxVertexCount;
|
|
35002
35217
|
this._maxIndexCount = source._maxIndexCount;
|
|
35003
35218
|
|
|
@@ -35007,12 +35222,12 @@ class BatchedMesh extends Mesh {
|
|
|
35007
35222
|
this._multiDrawStarts = source._multiDrawStarts.slice();
|
|
35008
35223
|
|
|
35009
35224
|
this._matricesTexture = source._matricesTexture.clone();
|
|
35010
|
-
this._matricesTexture.image.data = this._matricesTexture.image.slice();
|
|
35225
|
+
this._matricesTexture.image.data = this._matricesTexture.image.data.slice();
|
|
35011
35226
|
|
|
35012
35227
|
if ( this._colorsTexture !== null ) {
|
|
35013
35228
|
|
|
35014
35229
|
this._colorsTexture = source._colorsTexture.clone();
|
|
35015
|
-
this._colorsTexture.image.data = this._colorsTexture.image.slice();
|
|
35230
|
+
this._colorsTexture.image.data = this._colorsTexture.image.data.slice();
|
|
35016
35231
|
|
|
35017
35232
|
}
|
|
35018
35233
|
|
|
@@ -35028,6 +35243,9 @@ class BatchedMesh extends Mesh {
|
|
|
35028
35243
|
this._matricesTexture.dispose();
|
|
35029
35244
|
this._matricesTexture = null;
|
|
35030
35245
|
|
|
35246
|
+
this._indirectTexture.dispose();
|
|
35247
|
+
this._indirectTexture = null;
|
|
35248
|
+
|
|
35031
35249
|
if ( this._colorsTexture !== null ) {
|
|
35032
35250
|
|
|
35033
35251
|
this._colorsTexture.dispose();
|
|
@@ -35054,12 +35272,13 @@ class BatchedMesh extends Mesh {
|
|
|
35054
35272
|
const index = geometry.getIndex();
|
|
35055
35273
|
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
35056
35274
|
|
|
35057
|
-
const
|
|
35058
|
-
const visibility = this._visibility;
|
|
35275
|
+
const drawInfo = this._drawInfo;
|
|
35059
35276
|
const multiDrawStarts = this._multiDrawStarts;
|
|
35060
35277
|
const multiDrawCounts = this._multiDrawCounts;
|
|
35061
35278
|
const drawRanges = this._drawRanges;
|
|
35062
35279
|
const perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
35280
|
+
const indirectTexture = this._indirectTexture;
|
|
35281
|
+
const indirectArray = indirectTexture.image.data;
|
|
35063
35282
|
|
|
35064
35283
|
// prepare the frustum in the local frame
|
|
35065
35284
|
if ( perObjectFrustumCulled ) {
|
|
@@ -35082,13 +35301,15 @@ class BatchedMesh extends Mesh {
|
|
|
35082
35301
|
_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );
|
|
35083
35302
|
_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );
|
|
35084
35303
|
|
|
35085
|
-
for ( let i = 0, l =
|
|
35304
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
35305
|
+
|
|
35306
|
+
if ( drawInfo[ i ].visible && drawInfo[ i ].active ) {
|
|
35086
35307
|
|
|
35087
|
-
|
|
35308
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
35088
35309
|
|
|
35089
35310
|
// get the bounds in world space
|
|
35090
35311
|
this.getMatrixAt( i, _matrix$1 );
|
|
35091
|
-
this.getBoundingSphereAt(
|
|
35312
|
+
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
35092
35313
|
|
|
35093
35314
|
// determine whether the batched geometry is within the frustum
|
|
35094
35315
|
let culled = false;
|
|
@@ -35102,7 +35323,7 @@ class BatchedMesh extends Mesh {
|
|
|
35102
35323
|
|
|
35103
35324
|
// get the distance from camera used for sorting
|
|
35104
35325
|
const z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward );
|
|
35105
|
-
_renderList.push( drawRanges[
|
|
35326
|
+
_renderList.push( drawRanges[ geometryId ], z, i );
|
|
35106
35327
|
|
|
35107
35328
|
}
|
|
35108
35329
|
|
|
@@ -35128,6 +35349,7 @@ class BatchedMesh extends Mesh {
|
|
|
35128
35349
|
const item = list[ i ];
|
|
35129
35350
|
multiDrawStarts[ count ] = item.start * bytesPerElement;
|
|
35130
35351
|
multiDrawCounts[ count ] = item.count;
|
|
35352
|
+
indirectArray[ count ] = item.index;
|
|
35131
35353
|
count ++;
|
|
35132
35354
|
|
|
35133
35355
|
}
|
|
@@ -35136,9 +35358,11 @@ class BatchedMesh extends Mesh {
|
|
|
35136
35358
|
|
|
35137
35359
|
} else {
|
|
35138
35360
|
|
|
35139
|
-
for ( let i = 0, l =
|
|
35361
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
35362
|
+
|
|
35363
|
+
if ( drawInfo[ i ].visible && drawInfo[ i ].active ) {
|
|
35140
35364
|
|
|
35141
|
-
|
|
35365
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
35142
35366
|
|
|
35143
35367
|
// determine whether the batched geometry is within the frustum
|
|
35144
35368
|
let culled = false;
|
|
@@ -35146,16 +35370,17 @@ class BatchedMesh extends Mesh {
|
|
|
35146
35370
|
|
|
35147
35371
|
// get the bounds in world space
|
|
35148
35372
|
this.getMatrixAt( i, _matrix$1 );
|
|
35149
|
-
this.getBoundingSphereAt(
|
|
35373
|
+
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
35150
35374
|
culled = ! _frustum.intersectsSphere( _sphere$2 );
|
|
35151
35375
|
|
|
35152
35376
|
}
|
|
35153
35377
|
|
|
35154
35378
|
if ( ! culled ) {
|
|
35155
35379
|
|
|
35156
|
-
const range = drawRanges[
|
|
35380
|
+
const range = drawRanges[ geometryId ];
|
|
35157
35381
|
multiDrawStarts[ count ] = range.start * bytesPerElement;
|
|
35158
35382
|
multiDrawCounts[ count ] = range.count;
|
|
35383
|
+
indirectArray[ count ] = i;
|
|
35159
35384
|
count ++;
|
|
35160
35385
|
|
|
35161
35386
|
}
|
|
@@ -35166,6 +35391,7 @@ class BatchedMesh extends Mesh {
|
|
|
35166
35391
|
|
|
35167
35392
|
}
|
|
35168
35393
|
|
|
35394
|
+
indirectTexture.needsUpdate = true;
|
|
35169
35395
|
this._multiDrawCount = count;
|
|
35170
35396
|
this._visibilityChanged = false;
|
|
35171
35397
|
|
|
@@ -35835,7 +36061,7 @@ class CompressedArrayTexture extends CompressedTexture {
|
|
|
35835
36061
|
|
|
35836
36062
|
}
|
|
35837
36063
|
|
|
35838
|
-
|
|
36064
|
+
addLayerUpdate( layerIndex ) {
|
|
35839
36065
|
|
|
35840
36066
|
this.layerUpdates.add( layerIndex );
|
|
35841
36067
|
|
|
@@ -45642,6 +45868,7 @@ class Light extends Object3D {
|
|
|
45642
45868
|
if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
|
|
45643
45869
|
|
|
45644
45870
|
if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
|
|
45871
|
+
if ( this.target !== undefined ) data.object.target = this.target.uuid;
|
|
45645
45872
|
|
|
45646
45873
|
return data;
|
|
45647
45874
|
|
|
@@ -45688,6 +45915,8 @@ class LightShadow {
|
|
|
45688
45915
|
|
|
45689
45916
|
this.camera = camera;
|
|
45690
45917
|
|
|
45918
|
+
this.intensity = 1;
|
|
45919
|
+
|
|
45691
45920
|
this.bias = 0;
|
|
45692
45921
|
this.normalBias = 0;
|
|
45693
45922
|
this.radius = 1;
|
|
@@ -45785,6 +46014,8 @@ class LightShadow {
|
|
|
45785
46014
|
|
|
45786
46015
|
this.camera = source.camera.clone();
|
|
45787
46016
|
|
|
46017
|
+
this.intensity = source.intensity;
|
|
46018
|
+
|
|
45788
46019
|
this.bias = source.bias;
|
|
45789
46020
|
this.radius = source.radius;
|
|
45790
46021
|
|
|
@@ -45804,6 +46035,7 @@ class LightShadow {
|
|
|
45804
46035
|
|
|
45805
46036
|
const object = {};
|
|
45806
46037
|
|
|
46038
|
+
if ( this.intensity !== 1 ) object.intensity = this.intensity;
|
|
45807
46039
|
if ( this.bias !== 0 ) object.bias = this.bias;
|
|
45808
46040
|
if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
|
|
45809
46041
|
if ( this.radius !== 1 ) object.radius = this.radius;
|
|
@@ -47232,6 +47464,7 @@ class ObjectLoader extends Loader {
|
|
|
47232
47464
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
47233
47465
|
|
|
47234
47466
|
this.bindSkeletons( object, skeletons );
|
|
47467
|
+
this.bindLightTargets( object );
|
|
47235
47468
|
|
|
47236
47469
|
//
|
|
47237
47470
|
|
|
@@ -47273,6 +47506,7 @@ class ObjectLoader extends Loader {
|
|
|
47273
47506
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
47274
47507
|
|
|
47275
47508
|
this.bindSkeletons( object, skeletons );
|
|
47509
|
+
this.bindLightTargets( object );
|
|
47276
47510
|
|
|
47277
47511
|
return object;
|
|
47278
47512
|
|
|
@@ -47917,6 +48151,7 @@ class ObjectLoader extends Loader {
|
|
|
47917
48151
|
case 'DirectionalLight':
|
|
47918
48152
|
|
|
47919
48153
|
object = new DirectionalLight( data.color, data.intensity );
|
|
48154
|
+
object.target = data.target || '';
|
|
47920
48155
|
|
|
47921
48156
|
break;
|
|
47922
48157
|
|
|
@@ -47935,6 +48170,7 @@ class ObjectLoader extends Loader {
|
|
|
47935
48170
|
case 'SpotLight':
|
|
47936
48171
|
|
|
47937
48172
|
object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
|
|
48173
|
+
object.target = data.target || '';
|
|
47938
48174
|
|
|
47939
48175
|
break;
|
|
47940
48176
|
|
|
@@ -47991,7 +48227,7 @@ class ObjectLoader extends Loader {
|
|
|
47991
48227
|
geometry = getGeometry( data.geometry );
|
|
47992
48228
|
material = getMaterial( data.material );
|
|
47993
48229
|
|
|
47994
|
-
object = new BatchedMesh( data.
|
|
48230
|
+
object = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );
|
|
47995
48231
|
object.geometry = geometry;
|
|
47996
48232
|
object.perObjectFrustumCulled = data.perObjectFrustumCulled;
|
|
47997
48233
|
object.sortObjects = data.sortObjects;
|
|
@@ -48021,7 +48257,7 @@ class ObjectLoader extends Loader {
|
|
|
48021
48257
|
|
|
48022
48258
|
} );
|
|
48023
48259
|
|
|
48024
|
-
object.
|
|
48260
|
+
object._maxInstanceCount = data.maxInstanceCount;
|
|
48025
48261
|
object._maxVertexCount = data.maxVertexCount;
|
|
48026
48262
|
object._maxIndexCount = data.maxIndexCount;
|
|
48027
48263
|
|
|
@@ -48115,6 +48351,7 @@ class ObjectLoader extends Loader {
|
|
|
48115
48351
|
|
|
48116
48352
|
if ( data.shadow ) {
|
|
48117
48353
|
|
|
48354
|
+
if ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;
|
|
48118
48355
|
if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
|
|
48119
48356
|
if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
|
|
48120
48357
|
if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
|
|
@@ -48206,6 +48443,32 @@ class ObjectLoader extends Loader {
|
|
|
48206
48443
|
|
|
48207
48444
|
}
|
|
48208
48445
|
|
|
48446
|
+
bindLightTargets( object ) {
|
|
48447
|
+
|
|
48448
|
+
object.traverse( function ( child ) {
|
|
48449
|
+
|
|
48450
|
+
if ( child.isDirectionalLight || child.isSpotLight ) {
|
|
48451
|
+
|
|
48452
|
+
const uuid = child.target;
|
|
48453
|
+
|
|
48454
|
+
const target = object.getObjectByProperty( 'uuid', uuid );
|
|
48455
|
+
|
|
48456
|
+
if ( target !== undefined ) {
|
|
48457
|
+
|
|
48458
|
+
child.target = target;
|
|
48459
|
+
|
|
48460
|
+
} else {
|
|
48461
|
+
|
|
48462
|
+
child.target = new Object3D();
|
|
48463
|
+
|
|
48464
|
+
}
|
|
48465
|
+
|
|
48466
|
+
}
|
|
48467
|
+
|
|
48468
|
+
} );
|
|
48469
|
+
|
|
48470
|
+
}
|
|
48471
|
+
|
|
48209
48472
|
}
|
|
48210
48473
|
|
|
48211
48474
|
const TEXTURE_MAPPING = {
|
|
@@ -52658,6 +52921,61 @@ class Cylindrical {
|
|
|
52658
52921
|
|
|
52659
52922
|
}
|
|
52660
52923
|
|
|
52924
|
+
class Matrix2 {
|
|
52925
|
+
|
|
52926
|
+
constructor( n11, n12, n21, n22 ) {
|
|
52927
|
+
|
|
52928
|
+
Matrix2.prototype.isMatrix2 = true;
|
|
52929
|
+
|
|
52930
|
+
this.elements = [
|
|
52931
|
+
1, 0,
|
|
52932
|
+
0, 1,
|
|
52933
|
+
];
|
|
52934
|
+
|
|
52935
|
+
if ( n11 !== undefined ) {
|
|
52936
|
+
|
|
52937
|
+
this.set( n11, n12, n21, n22 );
|
|
52938
|
+
|
|
52939
|
+
}
|
|
52940
|
+
|
|
52941
|
+
}
|
|
52942
|
+
|
|
52943
|
+
identity() {
|
|
52944
|
+
|
|
52945
|
+
this.set(
|
|
52946
|
+
1, 0,
|
|
52947
|
+
0, 1,
|
|
52948
|
+
);
|
|
52949
|
+
|
|
52950
|
+
return this;
|
|
52951
|
+
|
|
52952
|
+
}
|
|
52953
|
+
|
|
52954
|
+
fromArray( array, offset = 0 ) {
|
|
52955
|
+
|
|
52956
|
+
for ( let i = 0; i < 4; i ++ ) {
|
|
52957
|
+
|
|
52958
|
+
this.elements[ i ] = array[ i + offset ];
|
|
52959
|
+
|
|
52960
|
+
}
|
|
52961
|
+
|
|
52962
|
+
return this;
|
|
52963
|
+
|
|
52964
|
+
}
|
|
52965
|
+
|
|
52966
|
+
set( n11, n12, n21, n22 ) {
|
|
52967
|
+
|
|
52968
|
+
const te = this.elements;
|
|
52969
|
+
|
|
52970
|
+
te[ 0 ] = n11; te[ 2 ] = n12;
|
|
52971
|
+
te[ 1 ] = n21; te[ 3 ] = n22;
|
|
52972
|
+
|
|
52973
|
+
return this;
|
|
52974
|
+
|
|
52975
|
+
}
|
|
52976
|
+
|
|
52977
|
+
}
|
|
52978
|
+
|
|
52661
52979
|
const _vector$4 = /*@__PURE__*/ new Vector2();
|
|
52662
52980
|
|
|
52663
52981
|
class Box2 {
|
|
@@ -52777,8 +53095,8 @@ class Box2 {
|
|
|
52777
53095
|
|
|
52778
53096
|
containsPoint( point ) {
|
|
52779
53097
|
|
|
52780
|
-
return point.x
|
|
52781
|
-
point.y
|
|
53098
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
53099
|
+
point.y >= this.min.y && point.y <= this.max.y;
|
|
52782
53100
|
|
|
52783
53101
|
}
|
|
52784
53102
|
|
|
@@ -52805,8 +53123,8 @@ class Box2 {
|
|
|
52805
53123
|
|
|
52806
53124
|
// using 4 splitting planes to rule out intersections
|
|
52807
53125
|
|
|
52808
|
-
return box.max.x
|
|
52809
|
-
box.max.y
|
|
53126
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
53127
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y;
|
|
52810
53128
|
|
|
52811
53129
|
}
|
|
52812
53130
|
|
|
@@ -54531,4 +54849,4 @@ if ( typeof window !== 'undefined' ) {
|
|
|
54531
54849
|
|
|
54532
54850
|
}
|
|
54533
54851
|
|
|
54534
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement };
|
|
54852
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement };
|