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.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '167';
|
|
9
9
|
|
|
10
10
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
11
11
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -110,6 +110,7 @@ const RedFormat = 1028;
|
|
|
110
110
|
const RedIntegerFormat = 1029;
|
|
111
111
|
const RGFormat = 1030;
|
|
112
112
|
const RGIntegerFormat = 1031;
|
|
113
|
+
const RGBIntegerFormat = 1032;
|
|
113
114
|
const RGBAIntegerFormat = 1033;
|
|
114
115
|
|
|
115
116
|
const RGB_S3TC_DXT1_Format = 33776;
|
|
@@ -160,6 +161,8 @@ const TriangleStripDrawMode = 1;
|
|
|
160
161
|
const TriangleFanDrawMode = 2;
|
|
161
162
|
const BasicDepthPacking = 3200;
|
|
162
163
|
const RGBADepthPacking = 3201;
|
|
164
|
+
const RGBDepthPacking = 3202;
|
|
165
|
+
const RGDepthPacking = 3203;
|
|
163
166
|
const TangentSpaceNormalMap = 0;
|
|
164
167
|
const ObjectSpaceNormalMap = 1;
|
|
165
168
|
|
|
@@ -1623,24 +1626,28 @@ const COLOR_SPACES = {
|
|
|
1623
1626
|
[ LinearSRGBColorSpace ]: {
|
|
1624
1627
|
transfer: LinearTransfer,
|
|
1625
1628
|
primaries: Rec709Primaries,
|
|
1629
|
+
luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
|
|
1626
1630
|
toReference: ( color ) => color,
|
|
1627
1631
|
fromReference: ( color ) => color,
|
|
1628
1632
|
},
|
|
1629
1633
|
[ SRGBColorSpace ]: {
|
|
1630
1634
|
transfer: SRGBTransfer,
|
|
1631
1635
|
primaries: Rec709Primaries,
|
|
1636
|
+
luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
|
|
1632
1637
|
toReference: ( color ) => color.convertSRGBToLinear(),
|
|
1633
1638
|
fromReference: ( color ) => color.convertLinearToSRGB(),
|
|
1634
1639
|
},
|
|
1635
1640
|
[ LinearDisplayP3ColorSpace ]: {
|
|
1636
1641
|
transfer: LinearTransfer,
|
|
1637
1642
|
primaries: P3Primaries,
|
|
1643
|
+
luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
|
|
1638
1644
|
toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
1639
1645
|
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
|
|
1640
1646
|
},
|
|
1641
1647
|
[ DisplayP3ColorSpace ]: {
|
|
1642
1648
|
transfer: SRGBTransfer,
|
|
1643
1649
|
primaries: P3Primaries,
|
|
1650
|
+
luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
|
|
1644
1651
|
toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
1645
1652
|
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
|
|
1646
1653
|
},
|
|
@@ -1713,6 +1720,12 @@ const ColorManagement = {
|
|
|
1713
1720
|
|
|
1714
1721
|
},
|
|
1715
1722
|
|
|
1723
|
+
getLuminanceCoefficients: function ( target, colorSpace = this._workingColorSpace ) {
|
|
1724
|
+
|
|
1725
|
+
return target.fromArray( COLOR_SPACES[ colorSpace ].luminanceCoefficients );
|
|
1726
|
+
|
|
1727
|
+
},
|
|
1728
|
+
|
|
1716
1729
|
};
|
|
1717
1730
|
|
|
1718
1731
|
|
|
@@ -2694,6 +2707,19 @@ class Vector4 {
|
|
|
2694
2707
|
|
|
2695
2708
|
}
|
|
2696
2709
|
|
|
2710
|
+
setFromMatrixPosition( m ) {
|
|
2711
|
+
|
|
2712
|
+
const e = m.elements;
|
|
2713
|
+
|
|
2714
|
+
this.x = e[ 12 ];
|
|
2715
|
+
this.y = e[ 13 ];
|
|
2716
|
+
this.z = e[ 14 ];
|
|
2717
|
+
this.w = e[ 15 ];
|
|
2718
|
+
|
|
2719
|
+
return this;
|
|
2720
|
+
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2697
2723
|
min( v ) {
|
|
2698
2724
|
|
|
2699
2725
|
this.x = Math.min( this.x, v.x );
|
|
@@ -4834,9 +4860,9 @@ class Box3 {
|
|
|
4834
4860
|
|
|
4835
4861
|
containsPoint( point ) {
|
|
4836
4862
|
|
|
4837
|
-
return point.x
|
|
4838
|
-
point.y
|
|
4839
|
-
point.z
|
|
4863
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
4864
|
+
point.y >= this.min.y && point.y <= this.max.y &&
|
|
4865
|
+
point.z >= this.min.z && point.z <= this.max.z;
|
|
4840
4866
|
|
|
4841
4867
|
}
|
|
4842
4868
|
|
|
@@ -4864,9 +4890,9 @@ class Box3 {
|
|
|
4864
4890
|
intersectsBox( box ) {
|
|
4865
4891
|
|
|
4866
4892
|
// using 6 splitting planes to rule out intersections.
|
|
4867
|
-
return box.max.x
|
|
4868
|
-
box.max.y
|
|
4869
|
-
box.max.z
|
|
4893
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
4894
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y &&
|
|
4895
|
+
box.max.z >= this.min.z && box.min.z <= this.max.z;
|
|
4870
4896
|
|
|
4871
4897
|
}
|
|
4872
4898
|
|
|
@@ -4940,14 +4966,14 @@ class Box3 {
|
|
|
4940
4966
|
_extents.subVectors( this.max, _center );
|
|
4941
4967
|
|
|
4942
4968
|
// translate triangle to aabb origin
|
|
4943
|
-
_v0$
|
|
4969
|
+
_v0$3.subVectors( triangle.a, _center );
|
|
4944
4970
|
_v1$7.subVectors( triangle.b, _center );
|
|
4945
4971
|
_v2$4.subVectors( triangle.c, _center );
|
|
4946
4972
|
|
|
4947
4973
|
// compute edge vectors for triangle
|
|
4948
|
-
_f0.subVectors( _v1$7, _v0$
|
|
4974
|
+
_f0.subVectors( _v1$7, _v0$3 );
|
|
4949
4975
|
_f1.subVectors( _v2$4, _v1$7 );
|
|
4950
|
-
_f2.subVectors( _v0$
|
|
4976
|
+
_f2.subVectors( _v0$3, _v2$4 );
|
|
4951
4977
|
|
|
4952
4978
|
// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
|
|
4953
4979
|
// 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
|
|
@@ -4957,7 +4983,7 @@ class Box3 {
|
|
|
4957
4983
|
_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,
|
|
4958
4984
|
- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0
|
|
4959
4985
|
];
|
|
4960
|
-
if ( ! satForAxes( axes, _v0$
|
|
4986
|
+
if ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {
|
|
4961
4987
|
|
|
4962
4988
|
return false;
|
|
4963
4989
|
|
|
@@ -4965,7 +4991,7 @@ class Box3 {
|
|
|
4965
4991
|
|
|
4966
4992
|
// test 3 face normals from the aabb
|
|
4967
4993
|
axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
|
|
4968
|
-
if ( ! satForAxes( axes, _v0$
|
|
4994
|
+
if ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {
|
|
4969
4995
|
|
|
4970
4996
|
return false;
|
|
4971
4997
|
|
|
@@ -4976,7 +5002,7 @@ class Box3 {
|
|
|
4976
5002
|
_triangleNormal.crossVectors( _f0, _f1 );
|
|
4977
5003
|
axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];
|
|
4978
5004
|
|
|
4979
|
-
return satForAxes( axes, _v0$
|
|
5005
|
+
return satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents );
|
|
4980
5006
|
|
|
4981
5007
|
}
|
|
4982
5008
|
|
|
@@ -5086,7 +5112,7 @@ const _box$4 = /*@__PURE__*/ new Box3();
|
|
|
5086
5112
|
|
|
5087
5113
|
// triangle centered vertices
|
|
5088
5114
|
|
|
5089
|
-
const _v0$
|
|
5115
|
+
const _v0$3 = /*@__PURE__*/ new Vector3();
|
|
5090
5116
|
const _v1$7 = /*@__PURE__*/ new Vector3();
|
|
5091
5117
|
const _v2$4 = /*@__PURE__*/ new Vector3();
|
|
5092
5118
|
|
|
@@ -7719,13 +7745,17 @@ class Object3D extends EventDispatcher {
|
|
|
7719
7745
|
|
|
7720
7746
|
if ( this.matrixWorldNeedsUpdate || force ) {
|
|
7721
7747
|
|
|
7722
|
-
if ( this.
|
|
7748
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
7723
7749
|
|
|
7724
|
-
|
|
7750
|
+
if ( this.parent === null ) {
|
|
7725
7751
|
|
|
7726
|
-
|
|
7752
|
+
this.matrixWorld.copy( this.matrix );
|
|
7727
7753
|
|
|
7728
|
-
|
|
7754
|
+
} else {
|
|
7755
|
+
|
|
7756
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
7757
|
+
|
|
7758
|
+
}
|
|
7729
7759
|
|
|
7730
7760
|
}
|
|
7731
7761
|
|
|
@@ -7735,7 +7765,7 @@ class Object3D extends EventDispatcher {
|
|
|
7735
7765
|
|
|
7736
7766
|
}
|
|
7737
7767
|
|
|
7738
|
-
//
|
|
7768
|
+
// make sure descendants are updated if required
|
|
7739
7769
|
|
|
7740
7770
|
const children = this.children;
|
|
7741
7771
|
|
|
@@ -7743,11 +7773,7 @@ class Object3D extends EventDispatcher {
|
|
|
7743
7773
|
|
|
7744
7774
|
const child = children[ i ];
|
|
7745
7775
|
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
child.updateMatrixWorld( force );
|
|
7749
|
-
|
|
7750
|
-
}
|
|
7776
|
+
child.updateMatrixWorld( force );
|
|
7751
7777
|
|
|
7752
7778
|
}
|
|
7753
7779
|
|
|
@@ -7757,7 +7783,7 @@ class Object3D extends EventDispatcher {
|
|
|
7757
7783
|
|
|
7758
7784
|
const parent = this.parent;
|
|
7759
7785
|
|
|
7760
|
-
if ( updateParents === true && parent !== null
|
|
7786
|
+
if ( updateParents === true && parent !== null ) {
|
|
7761
7787
|
|
|
7762
7788
|
parent.updateWorldMatrix( true, false );
|
|
7763
7789
|
|
|
@@ -7765,17 +7791,21 @@ class Object3D extends EventDispatcher {
|
|
|
7765
7791
|
|
|
7766
7792
|
if ( this.matrixAutoUpdate ) this.updateMatrix();
|
|
7767
7793
|
|
|
7768
|
-
if ( this.
|
|
7794
|
+
if ( this.matrixWorldAutoUpdate === true ) {
|
|
7769
7795
|
|
|
7770
|
-
|
|
7796
|
+
if ( this.parent === null ) {
|
|
7771
7797
|
|
|
7772
|
-
|
|
7798
|
+
this.matrixWorld.copy( this.matrix );
|
|
7799
|
+
|
|
7800
|
+
} else {
|
|
7773
7801
|
|
|
7774
|
-
|
|
7802
|
+
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
|
7803
|
+
|
|
7804
|
+
}
|
|
7775
7805
|
|
|
7776
7806
|
}
|
|
7777
7807
|
|
|
7778
|
-
//
|
|
7808
|
+
// make sure descendants are updated
|
|
7779
7809
|
|
|
7780
7810
|
if ( updateChildren === true ) {
|
|
7781
7811
|
|
|
@@ -7785,11 +7815,7 @@ class Object3D extends EventDispatcher {
|
|
|
7785
7815
|
|
|
7786
7816
|
const child = children[ i ];
|
|
7787
7817
|
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
child.updateWorldMatrix( false, true );
|
|
7791
|
-
|
|
7792
|
-
}
|
|
7818
|
+
child.updateWorldMatrix( false, true );
|
|
7793
7819
|
|
|
7794
7820
|
}
|
|
7795
7821
|
|
|
@@ -7882,7 +7908,7 @@ class Object3D extends EventDispatcher {
|
|
|
7882
7908
|
sphereCenter: bound.sphere.center.toArray()
|
|
7883
7909
|
} ) );
|
|
7884
7910
|
|
|
7885
|
-
object.
|
|
7911
|
+
object.maxInstanceCount = this._maxInstanceCount;
|
|
7886
7912
|
object.maxVertexCount = this._maxVertexCount;
|
|
7887
7913
|
object.maxIndexCount = this._maxIndexCount;
|
|
7888
7914
|
|
|
@@ -8151,7 +8177,7 @@ Object3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );
|
|
|
8151
8177
|
Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
|
|
8152
8178
|
Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;
|
|
8153
8179
|
|
|
8154
|
-
const _v0$
|
|
8180
|
+
const _v0$2 = /*@__PURE__*/ new Vector3();
|
|
8155
8181
|
const _v1$3 = /*@__PURE__*/ new Vector3();
|
|
8156
8182
|
const _v2$2 = /*@__PURE__*/ new Vector3();
|
|
8157
8183
|
const _v3$2 = /*@__PURE__*/ new Vector3();
|
|
@@ -8176,8 +8202,8 @@ class Triangle {
|
|
|
8176
8202
|
static getNormal( a, b, c, target ) {
|
|
8177
8203
|
|
|
8178
8204
|
target.subVectors( c, b );
|
|
8179
|
-
_v0$
|
|
8180
|
-
target.cross( _v0$
|
|
8205
|
+
_v0$2.subVectors( a, b );
|
|
8206
|
+
target.cross( _v0$2 );
|
|
8181
8207
|
|
|
8182
8208
|
const targetLengthSq = target.lengthSq();
|
|
8183
8209
|
if ( targetLengthSq > 0 ) {
|
|
@@ -8194,13 +8220,13 @@ class Triangle {
|
|
|
8194
8220
|
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
|
|
8195
8221
|
static getBarycoord( point, a, b, c, target ) {
|
|
8196
8222
|
|
|
8197
|
-
_v0$
|
|
8223
|
+
_v0$2.subVectors( c, a );
|
|
8198
8224
|
_v1$3.subVectors( b, a );
|
|
8199
8225
|
_v2$2.subVectors( point, a );
|
|
8200
8226
|
|
|
8201
|
-
const dot00 = _v0$
|
|
8202
|
-
const dot01 = _v0$
|
|
8203
|
-
const dot02 = _v0$
|
|
8227
|
+
const dot00 = _v0$2.dot( _v0$2 );
|
|
8228
|
+
const dot01 = _v0$2.dot( _v1$3 );
|
|
8229
|
+
const dot02 = _v0$2.dot( _v2$2 );
|
|
8204
8230
|
const dot11 = _v1$3.dot( _v1$3 );
|
|
8205
8231
|
const dot12 = _v1$3.dot( _v2$2 );
|
|
8206
8232
|
|
|
@@ -8259,11 +8285,11 @@ class Triangle {
|
|
|
8259
8285
|
|
|
8260
8286
|
static isFrontFacing( a, b, c, direction ) {
|
|
8261
8287
|
|
|
8262
|
-
_v0$
|
|
8288
|
+
_v0$2.subVectors( c, b );
|
|
8263
8289
|
_v1$3.subVectors( a, b );
|
|
8264
8290
|
|
|
8265
8291
|
// strictly front facing
|
|
8266
|
-
return ( _v0$
|
|
8292
|
+
return ( _v0$2.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;
|
|
8267
8293
|
|
|
8268
8294
|
}
|
|
8269
8295
|
|
|
@@ -8315,10 +8341,10 @@ class Triangle {
|
|
|
8315
8341
|
|
|
8316
8342
|
getArea() {
|
|
8317
8343
|
|
|
8318
|
-
_v0$
|
|
8344
|
+
_v0$2.subVectors( this.c, this.b );
|
|
8319
8345
|
_v1$3.subVectors( this.a, this.b );
|
|
8320
8346
|
|
|
8321
|
-
return _v0$
|
|
8347
|
+
return _v0$2.cross( _v1$3 ).length() * 0.5;
|
|
8322
8348
|
|
|
8323
8349
|
}
|
|
8324
8350
|
|
|
@@ -9174,10 +9200,6 @@ class Material extends EventDispatcher {
|
|
|
9174
9200
|
|
|
9175
9201
|
}
|
|
9176
9202
|
|
|
9177
|
-
onBuild( /* shaderobject, renderer */ ) {}
|
|
9178
|
-
|
|
9179
|
-
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
9180
|
-
|
|
9181
9203
|
onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
9182
9204
|
|
|
9183
9205
|
customProgramCacheKey() {
|
|
@@ -9594,6 +9616,19 @@ class Material extends EventDispatcher {
|
|
|
9594
9616
|
|
|
9595
9617
|
}
|
|
9596
9618
|
|
|
9619
|
+
onBuild( /* shaderobject, renderer */ ) {
|
|
9620
|
+
|
|
9621
|
+
console.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166
|
|
9622
|
+
|
|
9623
|
+
}
|
|
9624
|
+
|
|
9625
|
+
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {
|
|
9626
|
+
|
|
9627
|
+
console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166
|
|
9628
|
+
|
|
9629
|
+
}
|
|
9630
|
+
|
|
9631
|
+
|
|
9597
9632
|
}
|
|
9598
9633
|
|
|
9599
9634
|
class MeshBasicMaterial extends Material {
|
|
@@ -13642,6 +13677,8 @@ function WebGLAttributes( gl ) {
|
|
|
13642
13677
|
|
|
13643
13678
|
function update( attribute, bufferType ) {
|
|
13644
13679
|
|
|
13680
|
+
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
13681
|
+
|
|
13645
13682
|
if ( attribute.isGLBufferAttribute ) {
|
|
13646
13683
|
|
|
13647
13684
|
const cached = buffers.get( attribute );
|
|
@@ -13661,8 +13698,6 @@ function WebGLAttributes( gl ) {
|
|
|
13661
13698
|
|
|
13662
13699
|
}
|
|
13663
13700
|
|
|
13664
|
-
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
13665
|
-
|
|
13666
13701
|
const data = buffers.get( attribute );
|
|
13667
13702
|
|
|
13668
13703
|
if ( data === undefined ) {
|
|
@@ -13805,9 +13840,9 @@ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D(
|
|
|
13805
13840
|
|
|
13806
13841
|
var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
|
|
13807
13842
|
|
|
13808
|
-
var batching_pars_vertex = "#ifdef USE_BATCHING\n\
|
|
13843
|
+
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";
|
|
13809
13844
|
|
|
13810
|
-
var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix(
|
|
13845
|
+
var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif";
|
|
13811
13846
|
|
|
13812
13847
|
var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
|
|
13813
13848
|
|
|
@@ -13833,9 +13868,9 @@ var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor
|
|
|
13833
13868
|
|
|
13834
13869
|
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";
|
|
13835
13870
|
|
|
13836
|
-
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(
|
|
13871
|
+
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";
|
|
13837
13872
|
|
|
13838
|
-
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}\
|
|
13873
|
+
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";
|
|
13839
13874
|
|
|
13840
13875
|
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";
|
|
13841
13876
|
|
|
@@ -13851,7 +13886,7 @@ var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emi
|
|
|
13851
13886
|
|
|
13852
13887
|
var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
13853
13888
|
|
|
13854
|
-
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}
|
|
13889
|
+
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}";
|
|
13855
13890
|
|
|
13856
13891
|
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";
|
|
13857
13892
|
|
|
@@ -13895,7 +13930,7 @@ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColo
|
|
|
13895
13930
|
|
|
13896
13931
|
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}";
|
|
13897
13932
|
|
|
13898
|
-
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";
|
|
13933
|
+
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";
|
|
13899
13934
|
|
|
13900
13935
|
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";
|
|
13901
13936
|
|
|
@@ -13953,7 +13988,7 @@ var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D
|
|
|
13953
13988
|
|
|
13954
13989
|
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 );";
|
|
13955
13990
|
|
|
13956
|
-
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
|
|
13991
|
+
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}";
|
|
13957
13992
|
|
|
13958
13993
|
var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
|
|
13959
13994
|
|
|
@@ -13967,13 +14002,13 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
13967
14002
|
|
|
13968
14003
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
13969
14004
|
|
|
13970
|
-
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";
|
|
14005
|
+
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";
|
|
13971
14006
|
|
|
13972
|
-
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";
|
|
14007
|
+
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";
|
|
13973
14008
|
|
|
13974
14009
|
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";
|
|
13975
14010
|
|
|
13976
|
-
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}";
|
|
14011
|
+
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}";
|
|
13977
14012
|
|
|
13978
14013
|
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";
|
|
13979
14014
|
|
|
@@ -14017,7 +14052,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
14017
14052
|
|
|
14018
14053
|
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}";
|
|
14019
14054
|
|
|
14020
|
-
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}";
|
|
14055
|
+
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}";
|
|
14021
14056
|
|
|
14022
14057
|
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}";
|
|
14023
14058
|
|
|
@@ -14344,6 +14379,7 @@ const UniformsLib = {
|
|
|
14344
14379
|
} },
|
|
14345
14380
|
|
|
14346
14381
|
directionalLightShadows: { value: [], properties: {
|
|
14382
|
+
shadowIntensity: 1,
|
|
14347
14383
|
shadowBias: {},
|
|
14348
14384
|
shadowNormalBias: {},
|
|
14349
14385
|
shadowRadius: {},
|
|
@@ -14364,6 +14400,7 @@ const UniformsLib = {
|
|
|
14364
14400
|
} },
|
|
14365
14401
|
|
|
14366
14402
|
spotLightShadows: { value: [], properties: {
|
|
14403
|
+
shadowIntensity: 1,
|
|
14367
14404
|
shadowBias: {},
|
|
14368
14405
|
shadowNormalBias: {},
|
|
14369
14406
|
shadowRadius: {},
|
|
@@ -14382,6 +14419,7 @@ const UniformsLib = {
|
|
|
14382
14419
|
} },
|
|
14383
14420
|
|
|
14384
14421
|
pointLightShadows: { value: [], properties: {
|
|
14422
|
+
shadowIntensity: 1,
|
|
14385
14423
|
shadowBias: {},
|
|
14386
14424
|
shadowNormalBias: {},
|
|
14387
14425
|
shadowRadius: {},
|
|
@@ -15680,30 +15718,17 @@ function WebGLBufferRenderer( gl, extensions, info ) {
|
|
|
15680
15718
|
if ( drawCount === 0 ) return;
|
|
15681
15719
|
|
|
15682
15720
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
15721
|
+
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
15683
15722
|
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15687
|
-
|
|
15688
|
-
this.render( starts[ i ], counts[ i ] );
|
|
15689
|
-
|
|
15690
|
-
}
|
|
15691
|
-
|
|
15692
|
-
} else {
|
|
15693
|
-
|
|
15694
|
-
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
15723
|
+
let elementCount = 0;
|
|
15724
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15695
15725
|
|
|
15696
|
-
|
|
15697
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
15698
|
-
|
|
15699
|
-
elementCount += counts[ i ];
|
|
15700
|
-
|
|
15701
|
-
}
|
|
15702
|
-
|
|
15703
|
-
info.update( elementCount, mode, 1 );
|
|
15726
|
+
elementCount += counts[ i ];
|
|
15704
15727
|
|
|
15705
15728
|
}
|
|
15706
15729
|
|
|
15730
|
+
info.update( elementCount, mode, 1 );
|
|
15731
|
+
|
|
15707
15732
|
}
|
|
15708
15733
|
|
|
15709
15734
|
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
@@ -17633,29 +17658,17 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
|
17633
17658
|
if ( drawCount === 0 ) return;
|
|
17634
17659
|
|
|
17635
17660
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
17661
|
+
extension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );
|
|
17636
17662
|
|
|
17637
|
-
|
|
17638
|
-
|
|
17639
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17640
|
-
|
|
17641
|
-
this.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
17663
|
+
let elementCount = 0;
|
|
17664
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17642
17665
|
|
|
17643
|
-
|
|
17644
|
-
|
|
17645
|
-
} else {
|
|
17666
|
+
elementCount += counts[ i ];
|
|
17646
17667
|
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
let elementCount = 0;
|
|
17650
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
17651
|
-
|
|
17652
|
-
elementCount += counts[ i ];
|
|
17653
|
-
|
|
17654
|
-
}
|
|
17668
|
+
}
|
|
17655
17669
|
|
|
17656
|
-
|
|
17670
|
+
info.update( elementCount, mode, 1 );
|
|
17657
17671
|
|
|
17658
|
-
}
|
|
17659
17672
|
|
|
17660
17673
|
}
|
|
17661
17674
|
|
|
@@ -18221,7 +18234,6 @@ class DepthTexture extends Texture {
|
|
|
18221
18234
|
const emptyTexture = /*@__PURE__*/ new Texture();
|
|
18222
18235
|
|
|
18223
18236
|
const emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );
|
|
18224
|
-
emptyShadowTexture.compareFunction = LessEqualCompare;
|
|
18225
18237
|
|
|
18226
18238
|
const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
|
|
18227
18239
|
const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
|
|
@@ -18739,7 +18751,18 @@ function setValueT1( gl, v, textures ) {
|
|
|
18739
18751
|
|
|
18740
18752
|
}
|
|
18741
18753
|
|
|
18742
|
-
|
|
18754
|
+
let emptyTexture2D;
|
|
18755
|
+
|
|
18756
|
+
if ( this.type === gl.SAMPLER_2D_SHADOW ) {
|
|
18757
|
+
|
|
18758
|
+
emptyShadowTexture.compareFunction = LessEqualCompare; // #28670
|
|
18759
|
+
emptyTexture2D = emptyShadowTexture;
|
|
18760
|
+
|
|
18761
|
+
} else {
|
|
18762
|
+
|
|
18763
|
+
emptyTexture2D = emptyTexture;
|
|
18764
|
+
|
|
18765
|
+
}
|
|
18743
18766
|
|
|
18744
18767
|
textures.setTexture2D( v || emptyTexture2D, unit );
|
|
18745
18768
|
|
|
@@ -19472,6 +19495,30 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
19472
19495
|
|
|
19473
19496
|
}
|
|
19474
19497
|
|
|
19498
|
+
const _v0$1 = /*@__PURE__*/ new Vector3();
|
|
19499
|
+
|
|
19500
|
+
function getLuminanceFunction() {
|
|
19501
|
+
|
|
19502
|
+
ColorManagement.getLuminanceCoefficients( _v0$1 );
|
|
19503
|
+
|
|
19504
|
+
const r = _v0$1.x.toFixed( 4 );
|
|
19505
|
+
const g = _v0$1.y.toFixed( 4 );
|
|
19506
|
+
const b = _v0$1.z.toFixed( 4 );
|
|
19507
|
+
|
|
19508
|
+
return [
|
|
19509
|
+
|
|
19510
|
+
'float luminance( const in vec3 rgb ) {',
|
|
19511
|
+
|
|
19512
|
+
` const vec3 weights = vec3( ${ r }, ${ g }, ${ b } );`,
|
|
19513
|
+
|
|
19514
|
+
' return dot( weights, rgb );',
|
|
19515
|
+
|
|
19516
|
+
'}'
|
|
19517
|
+
|
|
19518
|
+
].join( '\n' );
|
|
19519
|
+
|
|
19520
|
+
}
|
|
19521
|
+
|
|
19475
19522
|
function generateVertexExtensions( parameters ) {
|
|
19476
19523
|
|
|
19477
19524
|
const chunks = [
|
|
@@ -20143,6 +20190,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20143
20190
|
|
|
20144
20191
|
ShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
20145
20192
|
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),
|
|
20193
|
+
getLuminanceFunction(),
|
|
20146
20194
|
|
|
20147
20195
|
parameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',
|
|
20148
20196
|
|
|
@@ -20908,7 +20956,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20908
20956
|
index0AttributeName: material.index0AttributeName,
|
|
20909
20957
|
|
|
20910
20958
|
extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
|
|
20911
|
-
extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
|
|
20959
|
+
extensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),
|
|
20912
20960
|
|
|
20913
20961
|
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
20914
20962
|
|
|
@@ -21590,6 +21638,7 @@ function ShadowUniformsCache() {
|
|
|
21590
21638
|
|
|
21591
21639
|
case 'DirectionalLight':
|
|
21592
21640
|
uniforms = {
|
|
21641
|
+
shadowIntensity: 1,
|
|
21593
21642
|
shadowBias: 0,
|
|
21594
21643
|
shadowNormalBias: 0,
|
|
21595
21644
|
shadowRadius: 1,
|
|
@@ -21599,6 +21648,7 @@ function ShadowUniformsCache() {
|
|
|
21599
21648
|
|
|
21600
21649
|
case 'SpotLight':
|
|
21601
21650
|
uniforms = {
|
|
21651
|
+
shadowIntensity: 1,
|
|
21602
21652
|
shadowBias: 0,
|
|
21603
21653
|
shadowNormalBias: 0,
|
|
21604
21654
|
shadowRadius: 1,
|
|
@@ -21608,6 +21658,7 @@ function ShadowUniformsCache() {
|
|
|
21608
21658
|
|
|
21609
21659
|
case 'PointLight':
|
|
21610
21660
|
uniforms = {
|
|
21661
|
+
shadowIntensity: 1,
|
|
21611
21662
|
shadowBias: 0,
|
|
21612
21663
|
shadowNormalBias: 0,
|
|
21613
21664
|
shadowRadius: 1,
|
|
@@ -21757,6 +21808,7 @@ function WebGLLights( extensions ) {
|
|
|
21757
21808
|
|
|
21758
21809
|
const shadowUniforms = shadowCache.get( light );
|
|
21759
21810
|
|
|
21811
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
21760
21812
|
shadowUniforms.shadowBias = shadow.bias;
|
|
21761
21813
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
21762
21814
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -21810,6 +21862,7 @@ function WebGLLights( extensions ) {
|
|
|
21810
21862
|
|
|
21811
21863
|
const shadowUniforms = shadowCache.get( light );
|
|
21812
21864
|
|
|
21865
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
21813
21866
|
shadowUniforms.shadowBias = shadow.bias;
|
|
21814
21867
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
21815
21868
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -21851,6 +21904,7 @@ function WebGLLights( extensions ) {
|
|
|
21851
21904
|
|
|
21852
21905
|
const shadowUniforms = shadowCache.get( light );
|
|
21853
21906
|
|
|
21907
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
21854
21908
|
shadowUniforms.shadowBias = shadow.bias;
|
|
21855
21909
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
21856
21910
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -23928,6 +23982,213 @@ function WebGLState( gl ) {
|
|
|
23928
23982
|
|
|
23929
23983
|
}
|
|
23930
23984
|
|
|
23985
|
+
function contain( texture, aspect ) {
|
|
23986
|
+
|
|
23987
|
+
const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
|
|
23988
|
+
|
|
23989
|
+
if ( imageAspect > aspect ) {
|
|
23990
|
+
|
|
23991
|
+
texture.repeat.x = 1;
|
|
23992
|
+
texture.repeat.y = imageAspect / aspect;
|
|
23993
|
+
|
|
23994
|
+
texture.offset.x = 0;
|
|
23995
|
+
texture.offset.y = ( 1 - texture.repeat.y ) / 2;
|
|
23996
|
+
|
|
23997
|
+
} else {
|
|
23998
|
+
|
|
23999
|
+
texture.repeat.x = aspect / imageAspect;
|
|
24000
|
+
texture.repeat.y = 1;
|
|
24001
|
+
|
|
24002
|
+
texture.offset.x = ( 1 - texture.repeat.x ) / 2;
|
|
24003
|
+
texture.offset.y = 0;
|
|
24004
|
+
|
|
24005
|
+
}
|
|
24006
|
+
|
|
24007
|
+
return texture;
|
|
24008
|
+
|
|
24009
|
+
}
|
|
24010
|
+
|
|
24011
|
+
function cover( texture, aspect ) {
|
|
24012
|
+
|
|
24013
|
+
const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
|
|
24014
|
+
|
|
24015
|
+
if ( imageAspect > aspect ) {
|
|
24016
|
+
|
|
24017
|
+
texture.repeat.x = aspect / imageAspect;
|
|
24018
|
+
texture.repeat.y = 1;
|
|
24019
|
+
|
|
24020
|
+
texture.offset.x = ( 1 - texture.repeat.x ) / 2;
|
|
24021
|
+
texture.offset.y = 0;
|
|
24022
|
+
|
|
24023
|
+
} else {
|
|
24024
|
+
|
|
24025
|
+
texture.repeat.x = 1;
|
|
24026
|
+
texture.repeat.y = imageAspect / aspect;
|
|
24027
|
+
|
|
24028
|
+
texture.offset.x = 0;
|
|
24029
|
+
texture.offset.y = ( 1 - texture.repeat.y ) / 2;
|
|
24030
|
+
|
|
24031
|
+
}
|
|
24032
|
+
|
|
24033
|
+
return texture;
|
|
24034
|
+
|
|
24035
|
+
}
|
|
24036
|
+
|
|
24037
|
+
function fill( texture ) {
|
|
24038
|
+
|
|
24039
|
+
texture.repeat.x = 1;
|
|
24040
|
+
texture.repeat.y = 1;
|
|
24041
|
+
|
|
24042
|
+
texture.offset.x = 0;
|
|
24043
|
+
texture.offset.y = 0;
|
|
24044
|
+
|
|
24045
|
+
return texture;
|
|
24046
|
+
|
|
24047
|
+
}
|
|
24048
|
+
|
|
24049
|
+
|
|
24050
|
+
|
|
24051
|
+
/**
|
|
24052
|
+
* Given the width, height, format, and type of a texture. Determines how many
|
|
24053
|
+
* bytes must be used to represent the texture.
|
|
24054
|
+
*/
|
|
24055
|
+
function getByteLength( width, height, format, type ) {
|
|
24056
|
+
|
|
24057
|
+
const typeByteLength = getTextureTypeByteLength( type );
|
|
24058
|
+
|
|
24059
|
+
switch ( format ) {
|
|
24060
|
+
|
|
24061
|
+
// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
|
|
24062
|
+
case AlphaFormat:
|
|
24063
|
+
return width * height;
|
|
24064
|
+
case LuminanceFormat:
|
|
24065
|
+
return width * height;
|
|
24066
|
+
case LuminanceAlphaFormat:
|
|
24067
|
+
return width * height * 2;
|
|
24068
|
+
case RedFormat:
|
|
24069
|
+
return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24070
|
+
case RedIntegerFormat:
|
|
24071
|
+
return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24072
|
+
case RGFormat:
|
|
24073
|
+
return ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24074
|
+
case RGIntegerFormat:
|
|
24075
|
+
return ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24076
|
+
case RGBFormat:
|
|
24077
|
+
return ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24078
|
+
case RGBAFormat:
|
|
24079
|
+
return ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24080
|
+
case RGBAIntegerFormat:
|
|
24081
|
+
return ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
24082
|
+
|
|
24083
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/
|
|
24084
|
+
case RGB_S3TC_DXT1_Format:
|
|
24085
|
+
case RGBA_S3TC_DXT1_Format:
|
|
24086
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
24087
|
+
case RGBA_S3TC_DXT3_Format:
|
|
24088
|
+
case RGBA_S3TC_DXT5_Format:
|
|
24089
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24090
|
+
|
|
24091
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/
|
|
24092
|
+
case RGB_PVRTC_2BPPV1_Format:
|
|
24093
|
+
case RGBA_PVRTC_2BPPV1_Format:
|
|
24094
|
+
return ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;
|
|
24095
|
+
case RGB_PVRTC_4BPPV1_Format:
|
|
24096
|
+
case RGBA_PVRTC_4BPPV1_Format:
|
|
24097
|
+
return ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;
|
|
24098
|
+
|
|
24099
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
|
|
24100
|
+
case RGB_ETC1_Format:
|
|
24101
|
+
case RGB_ETC2_Format:
|
|
24102
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
24103
|
+
case RGBA_ETC2_EAC_Format:
|
|
24104
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24105
|
+
|
|
24106
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
|
|
24107
|
+
case RGBA_ASTC_4x4_Format:
|
|
24108
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24109
|
+
case RGBA_ASTC_5x4_Format:
|
|
24110
|
+
return Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
24111
|
+
case RGBA_ASTC_5x5_Format:
|
|
24112
|
+
return Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24113
|
+
case RGBA_ASTC_6x5_Format:
|
|
24114
|
+
return Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24115
|
+
case RGBA_ASTC_6x6_Format:
|
|
24116
|
+
return Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
24117
|
+
case RGBA_ASTC_8x5_Format:
|
|
24118
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24119
|
+
case RGBA_ASTC_8x6_Format:
|
|
24120
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
24121
|
+
case RGBA_ASTC_8x8_Format:
|
|
24122
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;
|
|
24123
|
+
case RGBA_ASTC_10x5_Format:
|
|
24124
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
24125
|
+
case RGBA_ASTC_10x6_Format:
|
|
24126
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
24127
|
+
case RGBA_ASTC_10x8_Format:
|
|
24128
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;
|
|
24129
|
+
case RGBA_ASTC_10x10_Format:
|
|
24130
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;
|
|
24131
|
+
case RGBA_ASTC_12x10_Format:
|
|
24132
|
+
return Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;
|
|
24133
|
+
case RGBA_ASTC_12x12_Format:
|
|
24134
|
+
return Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;
|
|
24135
|
+
|
|
24136
|
+
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/
|
|
24137
|
+
case RGBA_BPTC_Format:
|
|
24138
|
+
case RGB_BPTC_SIGNED_Format:
|
|
24139
|
+
case RGB_BPTC_UNSIGNED_Format:
|
|
24140
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;
|
|
24141
|
+
|
|
24142
|
+
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/
|
|
24143
|
+
case RED_RGTC1_Format:
|
|
24144
|
+
case SIGNED_RED_RGTC1_Format:
|
|
24145
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;
|
|
24146
|
+
case RED_GREEN_RGTC2_Format:
|
|
24147
|
+
case SIGNED_RED_GREEN_RGTC2_Format:
|
|
24148
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;
|
|
24149
|
+
|
|
24150
|
+
}
|
|
24151
|
+
|
|
24152
|
+
throw new Error(
|
|
24153
|
+
`Unable to determine texture byte length for ${format} format.`,
|
|
24154
|
+
);
|
|
24155
|
+
|
|
24156
|
+
}
|
|
24157
|
+
|
|
24158
|
+
function getTextureTypeByteLength( type ) {
|
|
24159
|
+
|
|
24160
|
+
switch ( type ) {
|
|
24161
|
+
|
|
24162
|
+
case UnsignedByteType:
|
|
24163
|
+
case ByteType:
|
|
24164
|
+
return { byteLength: 1, components: 1 };
|
|
24165
|
+
case UnsignedShortType:
|
|
24166
|
+
case ShortType:
|
|
24167
|
+
case HalfFloatType:
|
|
24168
|
+
return { byteLength: 2, components: 1 };
|
|
24169
|
+
case UnsignedShort4444Type:
|
|
24170
|
+
case UnsignedShort5551Type:
|
|
24171
|
+
return { byteLength: 2, components: 4 };
|
|
24172
|
+
case UnsignedIntType:
|
|
24173
|
+
case IntType:
|
|
24174
|
+
case FloatType:
|
|
24175
|
+
return { byteLength: 4, components: 1 };
|
|
24176
|
+
case UnsignedInt5999Type:
|
|
24177
|
+
return { byteLength: 4, components: 3 };
|
|
24178
|
+
|
|
24179
|
+
}
|
|
24180
|
+
|
|
24181
|
+
throw new Error( `Unknown texture type ${type}.` );
|
|
24182
|
+
|
|
24183
|
+
}
|
|
24184
|
+
|
|
24185
|
+
const TextureUtils = {
|
|
24186
|
+
contain,
|
|
24187
|
+
cover,
|
|
24188
|
+
fill,
|
|
24189
|
+
getByteLength
|
|
24190
|
+
};
|
|
24191
|
+
|
|
23931
24192
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
|
|
23932
24193
|
|
|
23933
24194
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
@@ -24823,10 +25084,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24823
25084
|
|
|
24824
25085
|
if ( texture.layerUpdates.size > 0 ) {
|
|
24825
25086
|
|
|
25087
|
+
const layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
|
|
25088
|
+
|
|
24826
25089
|
for ( const layerIndex of texture.layerUpdates ) {
|
|
24827
25090
|
|
|
24828
|
-
const
|
|
24829
|
-
|
|
25091
|
+
const layerData = mipmap.data.subarray(
|
|
25092
|
+
layerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,
|
|
25093
|
+
( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT
|
|
25094
|
+
);
|
|
25095
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );
|
|
24830
25096
|
|
|
24831
25097
|
}
|
|
24832
25098
|
|
|
@@ -24944,60 +25210,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24944
25210
|
|
|
24945
25211
|
if ( texture.layerUpdates.size > 0 ) {
|
|
24946
25212
|
|
|
24947
|
-
|
|
24948
|
-
// interpreted as one color component, depending on format. When
|
|
24949
|
-
// type is one of GL_UNSIGNED_SHORT_5_6_5,
|
|
24950
|
-
// GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, each
|
|
24951
|
-
// unsigned value is interpreted as containing all the components
|
|
24952
|
-
// for a single pixel, with the color components arranged
|
|
24953
|
-
// according to format.
|
|
24954
|
-
//
|
|
24955
|
-
// See https://registry.khronos.org/OpenGL-Refpages/es1.1/xhtml/glTexImage2D.xml
|
|
24956
|
-
let texelSize;
|
|
24957
|
-
switch ( glType ) {
|
|
24958
|
-
|
|
24959
|
-
case _gl.UNSIGNED_BYTE:
|
|
24960
|
-
switch ( glFormat ) {
|
|
24961
|
-
|
|
24962
|
-
case _gl.ALPHA:
|
|
24963
|
-
texelSize = 1;
|
|
24964
|
-
break;
|
|
24965
|
-
case _gl.LUMINANCE:
|
|
24966
|
-
texelSize = 1;
|
|
24967
|
-
break;
|
|
24968
|
-
case _gl.LUMINANCE_ALPHA:
|
|
24969
|
-
texelSize = 2;
|
|
24970
|
-
break;
|
|
24971
|
-
case _gl.RGB:
|
|
24972
|
-
texelSize = 3;
|
|
24973
|
-
break;
|
|
24974
|
-
case _gl.RGBA:
|
|
24975
|
-
texelSize = 4;
|
|
24976
|
-
break;
|
|
24977
|
-
|
|
24978
|
-
default:
|
|
24979
|
-
throw new Error( `Unknown texel size for format ${glFormat}.` );
|
|
24980
|
-
|
|
24981
|
-
}
|
|
24982
|
-
|
|
24983
|
-
break;
|
|
24984
|
-
|
|
24985
|
-
case _gl.UNSIGNED_SHORT_4_4_4_4:
|
|
24986
|
-
case _gl.UNSIGNED_SHORT_5_5_5_1:
|
|
24987
|
-
case _gl.UNSIGNED_SHORT_5_6_5:
|
|
24988
|
-
texelSize = 1;
|
|
24989
|
-
break;
|
|
24990
|
-
|
|
24991
|
-
default:
|
|
24992
|
-
throw new Error( `Unknown texel size for type ${glType}.` );
|
|
24993
|
-
|
|
24994
|
-
}
|
|
24995
|
-
|
|
24996
|
-
const layerSize = image.width * image.height * texelSize;
|
|
25213
|
+
const layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );
|
|
24997
25214
|
|
|
24998
25215
|
for ( const layerIndex of texture.layerUpdates ) {
|
|
24999
25216
|
|
|
25000
|
-
|
|
25217
|
+
const layerData = image.data.subarray(
|
|
25218
|
+
layerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,
|
|
25219
|
+
( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT
|
|
25220
|
+
);
|
|
25221
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );
|
|
25001
25222
|
|
|
25002
25223
|
}
|
|
25003
25224
|
|
|
@@ -27478,6 +27699,12 @@ class WebXRDepthSensing {
|
|
|
27478
27699
|
|
|
27479
27700
|
}
|
|
27480
27701
|
|
|
27702
|
+
getDepthTexture() {
|
|
27703
|
+
|
|
27704
|
+
return this.texture;
|
|
27705
|
+
|
|
27706
|
+
}
|
|
27707
|
+
|
|
27481
27708
|
}
|
|
27482
27709
|
|
|
27483
27710
|
class WebXRManager extends EventDispatcher {
|
|
@@ -27900,6 +28127,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
27900
28127
|
session.updateRenderState( { layers: layersCopy } );
|
|
27901
28128
|
};
|
|
27902
28129
|
|
|
28130
|
+
this.getDepthTexture = function () {
|
|
28131
|
+
|
|
28132
|
+
return depthSensing.getDepthTexture();
|
|
28133
|
+
|
|
28134
|
+
};
|
|
28135
|
+
|
|
27903
28136
|
function onInputSourcesChange( event ) {
|
|
27904
28137
|
|
|
27905
28138
|
// Notify disconnected
|
|
@@ -29178,27 +29411,27 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
29178
29411
|
|
|
29179
29412
|
const info = getUniformSize( value );
|
|
29180
29413
|
|
|
29181
|
-
//
|
|
29182
|
-
const
|
|
29414
|
+
const chunkOffset = offset % chunkSize; // offset in the current chunk
|
|
29415
|
+
const chunkPadding = chunkOffset % info.boundary; // required padding to match boundary
|
|
29416
|
+
const chunkStart = chunkOffset + chunkPadding; // the start position in the current chunk for the data
|
|
29417
|
+
|
|
29418
|
+
offset += chunkPadding;
|
|
29183
29419
|
|
|
29184
29420
|
// Check for chunk overflow
|
|
29185
|
-
if (
|
|
29421
|
+
if ( chunkStart !== 0 && ( chunkSize - chunkStart ) < info.storage ) {
|
|
29186
29422
|
|
|
29187
29423
|
// Add padding and adjust offset
|
|
29188
|
-
offset += ( chunkSize -
|
|
29424
|
+
offset += ( chunkSize - chunkStart );
|
|
29189
29425
|
|
|
29190
29426
|
}
|
|
29191
29427
|
|
|
29192
29428
|
// the following two properties will be used for partial buffer updates
|
|
29193
|
-
|
|
29194
29429
|
uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
|
|
29195
29430
|
uniform.__offset = offset;
|
|
29196
29431
|
|
|
29197
|
-
|
|
29198
29432
|
// Update the global offset
|
|
29199
29433
|
offset += info.storage;
|
|
29200
29434
|
|
|
29201
|
-
|
|
29202
29435
|
}
|
|
29203
29436
|
|
|
29204
29437
|
}
|
|
@@ -29470,6 +29703,8 @@ class WebGLRenderer {
|
|
|
29470
29703
|
|
|
29471
29704
|
const _vector3 = new Vector3();
|
|
29472
29705
|
|
|
29706
|
+
const _vector4 = new Vector4();
|
|
29707
|
+
|
|
29473
29708
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
29474
29709
|
|
|
29475
29710
|
let _renderBackground = false;
|
|
@@ -30129,7 +30364,25 @@ class WebGLRenderer {
|
|
|
30129
30364
|
|
|
30130
30365
|
} else {
|
|
30131
30366
|
|
|
30132
|
-
|
|
30367
|
+
if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {
|
|
30368
|
+
|
|
30369
|
+
const starts = object._multiDrawStarts;
|
|
30370
|
+
const counts = object._multiDrawCounts;
|
|
30371
|
+
const drawCount = object._multiDrawCount;
|
|
30372
|
+
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
30373
|
+
const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
30374
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
30375
|
+
|
|
30376
|
+
uniforms.setValue( _gl, '_gl_DrawID', i );
|
|
30377
|
+
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
30378
|
+
|
|
30379
|
+
}
|
|
30380
|
+
|
|
30381
|
+
} else {
|
|
30382
|
+
|
|
30383
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
30384
|
+
|
|
30385
|
+
}
|
|
30133
30386
|
|
|
30134
30387
|
}
|
|
30135
30388
|
|
|
@@ -30602,7 +30855,7 @@ class WebGLRenderer {
|
|
|
30602
30855
|
|
|
30603
30856
|
if ( sortObjects ) {
|
|
30604
30857
|
|
|
30605
|
-
|
|
30858
|
+
_vector4.setFromMatrixPosition( object.matrixWorld )
|
|
30606
30859
|
.applyMatrix4( _projScreenMatrix );
|
|
30607
30860
|
|
|
30608
30861
|
}
|
|
@@ -30612,7 +30865,7 @@ class WebGLRenderer {
|
|
|
30612
30865
|
|
|
30613
30866
|
if ( material.visible ) {
|
|
30614
30867
|
|
|
30615
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
30868
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
30616
30869
|
|
|
30617
30870
|
}
|
|
30618
30871
|
|
|
@@ -30630,16 +30883,16 @@ class WebGLRenderer {
|
|
|
30630
30883
|
if ( object.boundingSphere !== undefined ) {
|
|
30631
30884
|
|
|
30632
30885
|
if ( object.boundingSphere === null ) object.computeBoundingSphere();
|
|
30633
|
-
|
|
30886
|
+
_vector4.copy( object.boundingSphere.center );
|
|
30634
30887
|
|
|
30635
30888
|
} else {
|
|
30636
30889
|
|
|
30637
30890
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
30638
|
-
|
|
30891
|
+
_vector4.copy( geometry.boundingSphere.center );
|
|
30639
30892
|
|
|
30640
30893
|
}
|
|
30641
30894
|
|
|
30642
|
-
|
|
30895
|
+
_vector4
|
|
30643
30896
|
.applyMatrix4( object.matrixWorld )
|
|
30644
30897
|
.applyMatrix4( _projScreenMatrix );
|
|
30645
30898
|
|
|
@@ -30656,7 +30909,7 @@ class WebGLRenderer {
|
|
|
30656
30909
|
|
|
30657
30910
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
30658
30911
|
|
|
30659
|
-
currentRenderList.push( object, geometry, groupMaterial, groupOrder,
|
|
30912
|
+
currentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );
|
|
30660
30913
|
|
|
30661
30914
|
}
|
|
30662
30915
|
|
|
@@ -30664,7 +30917,7 @@ class WebGLRenderer {
|
|
|
30664
30917
|
|
|
30665
30918
|
} else if ( material.visible ) {
|
|
30666
30919
|
|
|
30667
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
30920
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
30668
30921
|
|
|
30669
30922
|
}
|
|
30670
30923
|
|
|
@@ -30759,15 +31012,9 @@ class WebGLRenderer {
|
|
|
30759
31012
|
_currentClearAlpha = _this.getClearAlpha();
|
|
30760
31013
|
if ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );
|
|
30761
31014
|
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
background.render( scene );
|
|
30765
|
-
|
|
30766
|
-
} else {
|
|
30767
|
-
|
|
30768
|
-
_this.clear();
|
|
31015
|
+
_this.clear();
|
|
30769
31016
|
|
|
30770
|
-
|
|
31017
|
+
if ( _renderBackground ) background.render( scene );
|
|
30771
31018
|
|
|
30772
31019
|
// Turn off the features which can affect the frag color for opaque objects pass.
|
|
30773
31020
|
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
|
|
@@ -30868,8 +31115,6 @@ class WebGLRenderer {
|
|
|
30868
31115
|
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
30869
31116
|
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
|
|
30870
31117
|
|
|
30871
|
-
material.onBeforeRender( _this, scene, camera, geometry, object, group );
|
|
30872
|
-
|
|
30873
31118
|
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
30874
31119
|
|
|
30875
31120
|
material.side = BackSide;
|
|
@@ -30944,8 +31189,6 @@ class WebGLRenderer {
|
|
|
30944
31189
|
|
|
30945
31190
|
parameters.uniforms = programCache.getUniforms( material );
|
|
30946
31191
|
|
|
30947
|
-
material.onBuild( object, parameters, _this );
|
|
30948
|
-
|
|
30949
31192
|
material.onBeforeCompile( parameters, _this );
|
|
30950
31193
|
|
|
30951
31194
|
program = programCache.acquireProgram( parameters, programCacheKey );
|
|
@@ -31330,6 +31573,9 @@ class WebGLRenderer {
|
|
|
31330
31573
|
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
31331
31574
|
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
31332
31575
|
|
|
31576
|
+
p_uniforms.setOptional( _gl, object, 'batchingIdTexture' );
|
|
31577
|
+
p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
|
|
31578
|
+
|
|
31333
31579
|
p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
|
|
31334
31580
|
if ( object._colorsTexture !== null ) {
|
|
31335
31581
|
|
|
@@ -31817,7 +32063,7 @@ class WebGLRenderer {
|
|
|
31817
32063
|
if ( texture.isTexture !== true ) {
|
|
31818
32064
|
|
|
31819
32065
|
// @deprecated, r165
|
|
31820
|
-
|
|
32066
|
+
warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
|
|
31821
32067
|
|
|
31822
32068
|
position = arguments[ 0 ] || null;
|
|
31823
32069
|
texture = arguments[ 1 ];
|
|
@@ -31845,7 +32091,7 @@ class WebGLRenderer {
|
|
|
31845
32091
|
if ( srcTexture.isTexture !== true ) {
|
|
31846
32092
|
|
|
31847
32093
|
// @deprecated, r165
|
|
31848
|
-
|
|
32094
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
|
|
31849
32095
|
|
|
31850
32096
|
dstPosition = arguments[ 0 ] || null;
|
|
31851
32097
|
srcTexture = arguments[ 1 ];
|
|
@@ -31921,7 +32167,7 @@ class WebGLRenderer {
|
|
|
31921
32167
|
|
|
31922
32168
|
} else {
|
|
31923
32169
|
|
|
31924
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, glFormat, glType, image );
|
|
32170
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image );
|
|
31925
32171
|
|
|
31926
32172
|
}
|
|
31927
32173
|
|
|
@@ -31946,7 +32192,7 @@ class WebGLRenderer {
|
|
|
31946
32192
|
if ( srcTexture.isTexture !== true ) {
|
|
31947
32193
|
|
|
31948
32194
|
// @deprecated, r165
|
|
31949
|
-
|
|
32195
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
31950
32196
|
|
|
31951
32197
|
srcRegion = arguments[ 0 ] || null;
|
|
31952
32198
|
dstPosition = arguments[ 1 ] || null;
|
|
@@ -33996,7 +34242,7 @@ class InstancedMesh extends Mesh {
|
|
|
33996
34242
|
|
|
33997
34243
|
if ( this.instanceColor === null ) {
|
|
33998
34244
|
|
|
33999
|
-
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );
|
|
34245
|
+
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
|
|
34000
34246
|
|
|
34001
34247
|
}
|
|
34002
34248
|
|
|
@@ -34085,7 +34331,7 @@ class MultiDrawRenderList {
|
|
|
34085
34331
|
|
|
34086
34332
|
}
|
|
34087
34333
|
|
|
34088
|
-
push( drawRange, z ) {
|
|
34334
|
+
push( drawRange, z, index ) {
|
|
34089
34335
|
|
|
34090
34336
|
const pool = this.pool;
|
|
34091
34337
|
const list = this.list;
|
|
@@ -34096,6 +34342,7 @@ class MultiDrawRenderList {
|
|
|
34096
34342
|
start: - 1,
|
|
34097
34343
|
count: - 1,
|
|
34098
34344
|
z: - 1,
|
|
34345
|
+
index: - 1,
|
|
34099
34346
|
|
|
34100
34347
|
} );
|
|
34101
34348
|
|
|
@@ -34108,6 +34355,7 @@ class MultiDrawRenderList {
|
|
|
34108
34355
|
item.start = drawRange.start;
|
|
34109
34356
|
item.count = drawRange.count;
|
|
34110
34357
|
item.z = z;
|
|
34358
|
+
item.index = index;
|
|
34111
34359
|
|
|
34112
34360
|
}
|
|
34113
34361
|
|
|
@@ -34120,7 +34368,6 @@ class MultiDrawRenderList {
|
|
|
34120
34368
|
|
|
34121
34369
|
}
|
|
34122
34370
|
|
|
34123
|
-
const ID_ATTR_NAME = 'batchId';
|
|
34124
34371
|
const _matrix$1 = /*@__PURE__*/ new Matrix4();
|
|
34125
34372
|
const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
|
|
34126
34373
|
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
@@ -34175,13 +34422,13 @@ function copyAttributeData( src, target, targetOffset = 0 ) {
|
|
|
34175
34422
|
|
|
34176
34423
|
class BatchedMesh extends Mesh {
|
|
34177
34424
|
|
|
34178
|
-
get
|
|
34425
|
+
get maxInstanceCount() {
|
|
34179
34426
|
|
|
34180
|
-
return this.
|
|
34427
|
+
return this._maxInstanceCount;
|
|
34181
34428
|
|
|
34182
34429
|
}
|
|
34183
34430
|
|
|
34184
|
-
constructor(
|
|
34431
|
+
constructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {
|
|
34185
34432
|
|
|
34186
34433
|
super( new BufferGeometry(), material );
|
|
34187
34434
|
|
|
@@ -34192,32 +34439,33 @@ class BatchedMesh extends Mesh {
|
|
|
34192
34439
|
this.boundingSphere = null;
|
|
34193
34440
|
this.customSort = null;
|
|
34194
34441
|
|
|
34442
|
+
// stores visible, active, and geometry id per object
|
|
34443
|
+
this._drawInfo = [];
|
|
34444
|
+
|
|
34445
|
+
// geometry information
|
|
34195
34446
|
this._drawRanges = [];
|
|
34196
34447
|
this._reservedRanges = [];
|
|
34197
|
-
|
|
34198
|
-
this._visibility = [];
|
|
34199
|
-
this._active = [];
|
|
34200
34448
|
this._bounds = [];
|
|
34201
34449
|
|
|
34202
|
-
this.
|
|
34450
|
+
this._maxInstanceCount = maxInstanceCount;
|
|
34203
34451
|
this._maxVertexCount = maxVertexCount;
|
|
34204
34452
|
this._maxIndexCount = maxIndexCount;
|
|
34205
34453
|
|
|
34206
34454
|
this._geometryInitialized = false;
|
|
34207
34455
|
this._geometryCount = 0;
|
|
34208
|
-
this._multiDrawCounts = new Int32Array(
|
|
34209
|
-
this._multiDrawStarts = new Int32Array(
|
|
34456
|
+
this._multiDrawCounts = new Int32Array( maxInstanceCount );
|
|
34457
|
+
this._multiDrawStarts = new Int32Array( maxInstanceCount );
|
|
34210
34458
|
this._multiDrawCount = 0;
|
|
34211
34459
|
this._multiDrawInstances = null;
|
|
34212
34460
|
this._visibilityChanged = true;
|
|
34213
34461
|
|
|
34214
34462
|
// Local matrix per geometry by using data texture
|
|
34215
34463
|
this._matricesTexture = null;
|
|
34464
|
+
this._indirectTexture = null;
|
|
34465
|
+
this._colorsTexture = null;
|
|
34216
34466
|
|
|
34217
34467
|
this._initMatricesTexture();
|
|
34218
|
-
|
|
34219
|
-
// Local color per geometry by using data texture
|
|
34220
|
-
this._colorsTexture = null;
|
|
34468
|
+
this._initIndirectTexture();
|
|
34221
34469
|
|
|
34222
34470
|
}
|
|
34223
34471
|
|
|
@@ -34230,7 +34478,7 @@ class BatchedMesh extends Mesh {
|
|
|
34230
34478
|
// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)
|
|
34231
34479
|
// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)
|
|
34232
34480
|
|
|
34233
|
-
let size = Math.sqrt( this.
|
|
34481
|
+
let size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix
|
|
34234
34482
|
size = Math.ceil( size / 4 ) * 4;
|
|
34235
34483
|
size = Math.max( size, 4 );
|
|
34236
34484
|
|
|
@@ -34241,9 +34489,21 @@ class BatchedMesh extends Mesh {
|
|
|
34241
34489
|
|
|
34242
34490
|
}
|
|
34243
34491
|
|
|
34492
|
+
_initIndirectTexture() {
|
|
34493
|
+
|
|
34494
|
+
let size = Math.sqrt( this._maxInstanceCount );
|
|
34495
|
+
size = Math.ceil( size );
|
|
34496
|
+
|
|
34497
|
+
const indirectArray = new Uint32Array( size * size );
|
|
34498
|
+
const indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );
|
|
34499
|
+
|
|
34500
|
+
this._indirectTexture = indirectTexture;
|
|
34501
|
+
|
|
34502
|
+
}
|
|
34503
|
+
|
|
34244
34504
|
_initColorsTexture() {
|
|
34245
34505
|
|
|
34246
|
-
let size = Math.sqrt( this.
|
|
34506
|
+
let size = Math.sqrt( this._maxIndexCount );
|
|
34247
34507
|
size = Math.ceil( size );
|
|
34248
34508
|
|
|
34249
34509
|
// 4 floats per RGBA pixel initialized to white
|
|
@@ -34259,7 +34519,6 @@ class BatchedMesh extends Mesh {
|
|
|
34259
34519
|
|
|
34260
34520
|
const geometry = this.geometry;
|
|
34261
34521
|
const maxVertexCount = this._maxVertexCount;
|
|
34262
|
-
const maxGeometryCount = this._maxGeometryCount;
|
|
34263
34522
|
const maxIndexCount = this._maxIndexCount;
|
|
34264
34523
|
if ( this._geometryInitialized === false ) {
|
|
34265
34524
|
|
|
@@ -34277,7 +34536,8 @@ class BatchedMesh extends Mesh {
|
|
|
34277
34536
|
|
|
34278
34537
|
if ( reference.getIndex() !== null ) {
|
|
34279
34538
|
|
|
34280
|
-
|
|
34539
|
+
// Reserve last u16 index for primitive restart.
|
|
34540
|
+
const indexArray = maxVertexCount > 65535
|
|
34281
34541
|
? new Uint32Array( maxIndexCount )
|
|
34282
34542
|
: new Uint16Array( maxIndexCount );
|
|
34283
34543
|
|
|
@@ -34285,11 +34545,6 @@ class BatchedMesh extends Mesh {
|
|
|
34285
34545
|
|
|
34286
34546
|
}
|
|
34287
34547
|
|
|
34288
|
-
const idArray = maxGeometryCount > 65536
|
|
34289
|
-
? new Uint32Array( maxVertexCount )
|
|
34290
|
-
: new Uint16Array( maxVertexCount );
|
|
34291
|
-
geometry.setAttribute( ID_ATTR_NAME, new BufferAttribute( idArray, 1 ) );
|
|
34292
|
-
|
|
34293
34548
|
this._geometryInitialized = true;
|
|
34294
34549
|
|
|
34295
34550
|
}
|
|
@@ -34299,13 +34554,6 @@ class BatchedMesh extends Mesh {
|
|
|
34299
34554
|
// Make sure the geometry is compatible with the existing combined geometry attributes
|
|
34300
34555
|
_validateGeometry( geometry ) {
|
|
34301
34556
|
|
|
34302
|
-
// check that the geometry doesn't have a version of our reserved id attribute
|
|
34303
|
-
if ( geometry.getAttribute( ID_ATTR_NAME ) ) {
|
|
34304
|
-
|
|
34305
|
-
throw new Error( `BatchedMesh: Geometry cannot use attribute "${ ID_ATTR_NAME }"` );
|
|
34306
|
-
|
|
34307
|
-
}
|
|
34308
|
-
|
|
34309
34557
|
// check to ensure the geometries are using consistent attributes and indices
|
|
34310
34558
|
const batchGeometry = this.geometry;
|
|
34311
34559
|
if ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {
|
|
@@ -34316,12 +34564,6 @@ class BatchedMesh extends Mesh {
|
|
|
34316
34564
|
|
|
34317
34565
|
for ( const attributeName in batchGeometry.attributes ) {
|
|
34318
34566
|
|
|
34319
|
-
if ( attributeName === ID_ATTR_NAME ) {
|
|
34320
|
-
|
|
34321
|
-
continue;
|
|
34322
|
-
|
|
34323
|
-
}
|
|
34324
|
-
|
|
34325
34567
|
if ( ! geometry.hasAttribute( attributeName ) ) {
|
|
34326
34568
|
|
|
34327
34569
|
throw new Error( `BatchedMesh: Added geometry missing "${ attributeName }". All geometries must have consistent attributes.` );
|
|
@@ -34357,15 +34599,16 @@ class BatchedMesh extends Mesh {
|
|
|
34357
34599
|
|
|
34358
34600
|
const geometryCount = this._geometryCount;
|
|
34359
34601
|
const boundingBox = this.boundingBox;
|
|
34360
|
-
const
|
|
34602
|
+
const drawInfo = this._drawInfo;
|
|
34361
34603
|
|
|
34362
34604
|
boundingBox.makeEmpty();
|
|
34363
34605
|
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
34364
34606
|
|
|
34365
|
-
if (
|
|
34607
|
+
if ( drawInfo[ i ].active === false ) continue;
|
|
34366
34608
|
|
|
34609
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
34367
34610
|
this.getMatrixAt( i, _matrix$1 );
|
|
34368
|
-
this.getBoundingBoxAt(
|
|
34611
|
+
this.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );
|
|
34369
34612
|
boundingBox.union( _box$1 );
|
|
34370
34613
|
|
|
34371
34614
|
}
|
|
@@ -34380,23 +34623,59 @@ class BatchedMesh extends Mesh {
|
|
|
34380
34623
|
|
|
34381
34624
|
}
|
|
34382
34625
|
|
|
34383
|
-
const geometryCount = this._geometryCount;
|
|
34384
34626
|
const boundingSphere = this.boundingSphere;
|
|
34385
|
-
const
|
|
34627
|
+
const drawInfo = this._drawInfo;
|
|
34386
34628
|
|
|
34387
34629
|
boundingSphere.makeEmpty();
|
|
34388
|
-
for ( let i = 0; i <
|
|
34630
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
34389
34631
|
|
|
34390
|
-
if (
|
|
34632
|
+
if ( drawInfo[ i ].active === false ) continue;
|
|
34391
34633
|
|
|
34634
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
34392
34635
|
this.getMatrixAt( i, _matrix$1 );
|
|
34393
|
-
this.getBoundingSphereAt(
|
|
34636
|
+
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
34394
34637
|
boundingSphere.union( _sphere$2 );
|
|
34395
34638
|
|
|
34396
34639
|
}
|
|
34397
34640
|
|
|
34398
34641
|
}
|
|
34399
34642
|
|
|
34643
|
+
addInstance( geometryId ) {
|
|
34644
|
+
|
|
34645
|
+
// ensure we're not over geometry
|
|
34646
|
+
if ( this._drawInfo.length >= this._maxInstanceCount ) {
|
|
34647
|
+
|
|
34648
|
+
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34649
|
+
|
|
34650
|
+
}
|
|
34651
|
+
|
|
34652
|
+
this._drawInfo.push( {
|
|
34653
|
+
|
|
34654
|
+
visible: true,
|
|
34655
|
+
active: true,
|
|
34656
|
+
geometryIndex: geometryId,
|
|
34657
|
+
|
|
34658
|
+
} );
|
|
34659
|
+
|
|
34660
|
+
// initialize the matrix
|
|
34661
|
+
const drawId = this._drawInfo.length - 1;
|
|
34662
|
+
const matricesTexture = this._matricesTexture;
|
|
34663
|
+
const matricesArray = matricesTexture.image.data;
|
|
34664
|
+
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
34665
|
+
matricesTexture.needsUpdate = true;
|
|
34666
|
+
|
|
34667
|
+
const colorsTexture = this._colorsTexture;
|
|
34668
|
+
if ( colorsTexture ) {
|
|
34669
|
+
|
|
34670
|
+
_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );
|
|
34671
|
+
colorsTexture.needsUpdate = true;
|
|
34672
|
+
|
|
34673
|
+
}
|
|
34674
|
+
|
|
34675
|
+
return drawId;
|
|
34676
|
+
|
|
34677
|
+
}
|
|
34678
|
+
|
|
34400
34679
|
addGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {
|
|
34401
34680
|
|
|
34402
34681
|
this._initializeGeometry( geometry );
|
|
@@ -34404,9 +34683,9 @@ class BatchedMesh extends Mesh {
|
|
|
34404
34683
|
this._validateGeometry( geometry );
|
|
34405
34684
|
|
|
34406
34685
|
// ensure we're not over geometry
|
|
34407
|
-
if ( this.
|
|
34686
|
+
if ( this._drawInfo.length >= this._maxInstanceCount ) {
|
|
34408
34687
|
|
|
34409
|
-
throw new Error( 'BatchedMesh: Maximum
|
|
34688
|
+
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34410
34689
|
|
|
34411
34690
|
}
|
|
34412
34691
|
|
|
@@ -34484,32 +34763,10 @@ class BatchedMesh extends Mesh {
|
|
|
34484
34763
|
|
|
34485
34764
|
}
|
|
34486
34765
|
|
|
34487
|
-
const visibility = this._visibility;
|
|
34488
|
-
const active = this._active;
|
|
34489
|
-
const matricesTexture = this._matricesTexture;
|
|
34490
|
-
const matricesArray = this._matricesTexture.image.data;
|
|
34491
|
-
const colorsTexture = this._colorsTexture;
|
|
34492
|
-
|
|
34493
|
-
// push new visibility states
|
|
34494
|
-
visibility.push( true );
|
|
34495
|
-
active.push( true );
|
|
34496
|
-
|
|
34497
34766
|
// update id
|
|
34498
34767
|
const geometryId = this._geometryCount;
|
|
34499
34768
|
this._geometryCount ++;
|
|
34500
34769
|
|
|
34501
|
-
// initialize matrix information
|
|
34502
|
-
_identityMatrix.toArray( matricesArray, geometryId * 16 );
|
|
34503
|
-
matricesTexture.needsUpdate = true;
|
|
34504
|
-
|
|
34505
|
-
// initialize the color to white
|
|
34506
|
-
if ( colorsTexture !== null ) {
|
|
34507
|
-
|
|
34508
|
-
_whiteColor.toArray( colorsTexture.image.data, geometryId * 4 );
|
|
34509
|
-
colorsTexture.needsUpdate = true;
|
|
34510
|
-
|
|
34511
|
-
}
|
|
34512
|
-
|
|
34513
34770
|
// add the reserved range and draw range objects
|
|
34514
34771
|
reservedRanges.push( reservedRange );
|
|
34515
34772
|
drawRanges.push( {
|
|
@@ -34524,16 +34781,6 @@ class BatchedMesh extends Mesh {
|
|
|
34524
34781
|
sphere: new Sphere()
|
|
34525
34782
|
} );
|
|
34526
34783
|
|
|
34527
|
-
// set the id for the geometry
|
|
34528
|
-
const idAttribute = this.geometry.getAttribute( ID_ATTR_NAME );
|
|
34529
|
-
for ( let i = 0; i < reservedRange.vertexCount; i ++ ) {
|
|
34530
|
-
|
|
34531
|
-
idAttribute.setX( reservedRange.vertexStart + i, geometryId );
|
|
34532
|
-
|
|
34533
|
-
}
|
|
34534
|
-
|
|
34535
|
-
idAttribute.needsUpdate = true;
|
|
34536
|
-
|
|
34537
34784
|
// update the geometry
|
|
34538
34785
|
this.setGeometryAt( geometryId, geometry );
|
|
34539
34786
|
|
|
@@ -34541,9 +34788,9 @@ class BatchedMesh extends Mesh {
|
|
|
34541
34788
|
|
|
34542
34789
|
}
|
|
34543
34790
|
|
|
34544
|
-
setGeometryAt(
|
|
34791
|
+
setGeometryAt( geometryId, geometry ) {
|
|
34545
34792
|
|
|
34546
|
-
if (
|
|
34793
|
+
if ( geometryId >= this._geometryCount ) {
|
|
34547
34794
|
|
|
34548
34795
|
throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
|
|
34549
34796
|
|
|
@@ -34555,7 +34802,7 @@ class BatchedMesh extends Mesh {
|
|
|
34555
34802
|
const hasIndex = batchGeometry.getIndex() !== null;
|
|
34556
34803
|
const dstIndex = batchGeometry.getIndex();
|
|
34557
34804
|
const srcIndex = geometry.getIndex();
|
|
34558
|
-
const reservedRange = this._reservedRanges[
|
|
34805
|
+
const reservedRange = this._reservedRanges[ geometryId ];
|
|
34559
34806
|
if (
|
|
34560
34807
|
hasIndex &&
|
|
34561
34808
|
srcIndex.count > reservedRange.indexCount ||
|
|
@@ -34571,12 +34818,6 @@ class BatchedMesh extends Mesh {
|
|
|
34571
34818
|
const vertexCount = reservedRange.vertexCount;
|
|
34572
34819
|
for ( const attributeName in batchGeometry.attributes ) {
|
|
34573
34820
|
|
|
34574
|
-
if ( attributeName === ID_ATTR_NAME ) {
|
|
34575
|
-
|
|
34576
|
-
continue;
|
|
34577
|
-
|
|
34578
|
-
}
|
|
34579
|
-
|
|
34580
34821
|
// copy attribute data
|
|
34581
34822
|
const srcAttribute = geometry.getAttribute( attributeName );
|
|
34582
34823
|
const dstAttribute = batchGeometry.getAttribute( attributeName );
|
|
@@ -34625,7 +34866,7 @@ class BatchedMesh extends Mesh {
|
|
|
34625
34866
|
}
|
|
34626
34867
|
|
|
34627
34868
|
// store the bounding boxes
|
|
34628
|
-
const bound = this._bounds[
|
|
34869
|
+
const bound = this._bounds[ geometryId ];
|
|
34629
34870
|
if ( geometry.boundingBox !== null ) {
|
|
34630
34871
|
|
|
34631
34872
|
bound.box.copy( geometry.boundingBox );
|
|
@@ -34649,67 +34890,54 @@ class BatchedMesh extends Mesh {
|
|
|
34649
34890
|
}
|
|
34650
34891
|
|
|
34651
34892
|
// set drawRange count
|
|
34652
|
-
const drawRange = this._drawRanges[
|
|
34893
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34653
34894
|
const posAttr = geometry.getAttribute( 'position' );
|
|
34654
34895
|
drawRange.count = hasIndex ? srcIndex.count : posAttr.count;
|
|
34655
34896
|
this._visibilityChanged = true;
|
|
34656
34897
|
|
|
34657
|
-
return
|
|
34898
|
+
return geometryId;
|
|
34658
34899
|
|
|
34659
34900
|
}
|
|
34660
34901
|
|
|
34902
|
+
/*
|
|
34661
34903
|
deleteGeometry( geometryId ) {
|
|
34662
34904
|
|
|
34663
|
-
//
|
|
34664
|
-
|
|
34665
|
-
const active = this._active;
|
|
34666
|
-
if ( geometryId >= active.length || active[ geometryId ] === false ) {
|
|
34667
|
-
|
|
34668
|
-
return this;
|
|
34669
|
-
|
|
34670
|
-
}
|
|
34671
|
-
|
|
34672
|
-
active[ geometryId ] = false;
|
|
34673
|
-
this._visibilityChanged = true;
|
|
34674
|
-
|
|
34675
|
-
return this;
|
|
34905
|
+
// TODO: delete geometry and associated instances
|
|
34676
34906
|
|
|
34677
34907
|
}
|
|
34908
|
+
*/
|
|
34678
34909
|
|
|
34679
|
-
|
|
34680
|
-
|
|
34681
|
-
if ( this._multiDrawInstances === null ) return null;
|
|
34682
|
-
|
|
34683
|
-
return this._multiDrawInstances[ id ];
|
|
34684
|
-
|
|
34685
|
-
}
|
|
34910
|
+
/*
|
|
34911
|
+
deleteInstance( instanceId ) {
|
|
34686
34912
|
|
|
34687
|
-
|
|
34913
|
+
// Note: User needs to call optimize() afterward to pack the data.
|
|
34688
34914
|
|
|
34689
|
-
|
|
34915
|
+
const drawInfo = this._drawInfo;
|
|
34916
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34690
34917
|
|
|
34691
|
-
|
|
34918
|
+
return this;
|
|
34692
34919
|
|
|
34693
34920
|
}
|
|
34694
34921
|
|
|
34695
|
-
|
|
34922
|
+
drawInfo[ instanceId ].active = false;
|
|
34923
|
+
this._visibilityChanged = true;
|
|
34696
34924
|
|
|
34697
|
-
return
|
|
34925
|
+
return this;
|
|
34698
34926
|
|
|
34699
34927
|
}
|
|
34928
|
+
*/
|
|
34700
34929
|
|
|
34701
34930
|
// get bounding box and compute it if it doesn't exist
|
|
34702
|
-
getBoundingBoxAt(
|
|
34931
|
+
getBoundingBoxAt( geometryId, target ) {
|
|
34703
34932
|
|
|
34704
|
-
|
|
34705
|
-
if ( active[ id ] === false ) {
|
|
34933
|
+
if ( geometryId >= this._geometryCount ) {
|
|
34706
34934
|
|
|
34707
34935
|
return null;
|
|
34708
34936
|
|
|
34709
34937
|
}
|
|
34710
34938
|
|
|
34711
34939
|
// compute bounding box
|
|
34712
|
-
const bound = this._bounds[
|
|
34940
|
+
const bound = this._bounds[ geometryId ];
|
|
34713
34941
|
const box = bound.box;
|
|
34714
34942
|
const geometry = this.geometry;
|
|
34715
34943
|
if ( bound.boxInitialized === false ) {
|
|
@@ -34718,7 +34946,7 @@ class BatchedMesh extends Mesh {
|
|
|
34718
34946
|
|
|
34719
34947
|
const index = geometry.index;
|
|
34720
34948
|
const position = geometry.attributes.position;
|
|
34721
|
-
const drawRange = this._drawRanges[
|
|
34949
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34722
34950
|
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
34723
34951
|
|
|
34724
34952
|
let iv = i;
|
|
@@ -34742,29 +34970,28 @@ class BatchedMesh extends Mesh {
|
|
|
34742
34970
|
}
|
|
34743
34971
|
|
|
34744
34972
|
// get bounding sphere and compute it if it doesn't exist
|
|
34745
|
-
getBoundingSphereAt(
|
|
34973
|
+
getBoundingSphereAt( geometryId, target ) {
|
|
34746
34974
|
|
|
34747
|
-
|
|
34748
|
-
if ( active[ id ] === false ) {
|
|
34975
|
+
if ( geometryId >= this._geometryCount ) {
|
|
34749
34976
|
|
|
34750
34977
|
return null;
|
|
34751
34978
|
|
|
34752
34979
|
}
|
|
34753
34980
|
|
|
34754
34981
|
// compute bounding sphere
|
|
34755
|
-
const bound = this._bounds[
|
|
34982
|
+
const bound = this._bounds[ geometryId ];
|
|
34756
34983
|
const sphere = bound.sphere;
|
|
34757
34984
|
const geometry = this.geometry;
|
|
34758
34985
|
if ( bound.sphereInitialized === false ) {
|
|
34759
34986
|
|
|
34760
34987
|
sphere.makeEmpty();
|
|
34761
34988
|
|
|
34762
|
-
this.getBoundingBoxAt(
|
|
34989
|
+
this.getBoundingBoxAt( geometryId, _box$1 );
|
|
34763
34990
|
_box$1.getCenter( sphere.center );
|
|
34764
34991
|
|
|
34765
34992
|
const index = geometry.index;
|
|
34766
34993
|
const position = geometry.attributes.position;
|
|
34767
|
-
const drawRange = this._drawRanges[
|
|
34994
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34768
34995
|
|
|
34769
34996
|
let maxRadiusSq = 0;
|
|
34770
34997
|
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
@@ -34791,44 +35018,42 @@ class BatchedMesh extends Mesh {
|
|
|
34791
35018
|
|
|
34792
35019
|
}
|
|
34793
35020
|
|
|
34794
|
-
setMatrixAt(
|
|
35021
|
+
setMatrixAt( instanceId, matrix ) {
|
|
34795
35022
|
|
|
34796
35023
|
// @TODO: Map geometryId to index of the arrays because
|
|
34797
35024
|
// optimize() can make geometryId mismatch the index
|
|
34798
35025
|
|
|
34799
|
-
const
|
|
35026
|
+
const drawInfo = this._drawInfo;
|
|
34800
35027
|
const matricesTexture = this._matricesTexture;
|
|
34801
35028
|
const matricesArray = this._matricesTexture.image.data;
|
|
34802
|
-
|
|
34803
|
-
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
35029
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34804
35030
|
|
|
34805
35031
|
return this;
|
|
34806
35032
|
|
|
34807
35033
|
}
|
|
34808
35034
|
|
|
34809
|
-
matrix.toArray( matricesArray,
|
|
35035
|
+
matrix.toArray( matricesArray, instanceId * 16 );
|
|
34810
35036
|
matricesTexture.needsUpdate = true;
|
|
34811
35037
|
|
|
34812
35038
|
return this;
|
|
34813
35039
|
|
|
34814
35040
|
}
|
|
34815
35041
|
|
|
34816
|
-
getMatrixAt(
|
|
35042
|
+
getMatrixAt( instanceId, matrix ) {
|
|
34817
35043
|
|
|
34818
|
-
const
|
|
35044
|
+
const drawInfo = this._drawInfo;
|
|
34819
35045
|
const matricesArray = this._matricesTexture.image.data;
|
|
34820
|
-
|
|
34821
|
-
if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
|
|
35046
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34822
35047
|
|
|
34823
35048
|
return null;
|
|
34824
35049
|
|
|
34825
35050
|
}
|
|
34826
35051
|
|
|
34827
|
-
return matrix.fromArray( matricesArray,
|
|
35052
|
+
return matrix.fromArray( matricesArray, instanceId * 16 );
|
|
34828
35053
|
|
|
34829
35054
|
}
|
|
34830
35055
|
|
|
34831
|
-
setColorAt(
|
|
35056
|
+
setColorAt( instanceId, color ) {
|
|
34832
35057
|
|
|
34833
35058
|
if ( this._colorsTexture === null ) {
|
|
34834
35059
|
|
|
@@ -34836,89 +35061,79 @@ class BatchedMesh extends Mesh {
|
|
|
34836
35061
|
|
|
34837
35062
|
}
|
|
34838
35063
|
|
|
34839
|
-
// @TODO: Map
|
|
34840
|
-
// optimize() can make
|
|
35064
|
+
// @TODO: Map id to index of the arrays because
|
|
35065
|
+
// optimize() can make id mismatch the index
|
|
34841
35066
|
|
|
34842
|
-
const active = this._active;
|
|
34843
35067
|
const colorsTexture = this._colorsTexture;
|
|
34844
35068
|
const colorsArray = this._colorsTexture.image.data;
|
|
34845
|
-
const
|
|
34846
|
-
if (
|
|
35069
|
+
const drawInfo = this._drawInfo;
|
|
35070
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34847
35071
|
|
|
34848
35072
|
return this;
|
|
34849
35073
|
|
|
34850
35074
|
}
|
|
34851
35075
|
|
|
34852
|
-
color.toArray( colorsArray,
|
|
35076
|
+
color.toArray( colorsArray, instanceId * 4 );
|
|
34853
35077
|
colorsTexture.needsUpdate = true;
|
|
34854
35078
|
|
|
34855
35079
|
return this;
|
|
34856
35080
|
|
|
34857
35081
|
}
|
|
34858
35082
|
|
|
34859
|
-
getColorAt(
|
|
35083
|
+
getColorAt( instanceId, color ) {
|
|
34860
35084
|
|
|
34861
|
-
const active = this._active;
|
|
34862
35085
|
const colorsArray = this._colorsTexture.image.data;
|
|
34863
|
-
const
|
|
34864
|
-
if (
|
|
35086
|
+
const drawInfo = this._drawInfo;
|
|
35087
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34865
35088
|
|
|
34866
35089
|
return null;
|
|
34867
35090
|
|
|
34868
35091
|
}
|
|
34869
35092
|
|
|
34870
|
-
return color.fromArray( colorsArray,
|
|
35093
|
+
return color.fromArray( colorsArray, instanceId * 4 );
|
|
34871
35094
|
|
|
34872
35095
|
}
|
|
34873
35096
|
|
|
34874
|
-
setVisibleAt(
|
|
34875
|
-
|
|
34876
|
-
const visibility = this._visibility;
|
|
34877
|
-
const active = this._active;
|
|
34878
|
-
const geometryCount = this._geometryCount;
|
|
35097
|
+
setVisibleAt( instanceId, value ) {
|
|
34879
35098
|
|
|
34880
35099
|
// if the geometry is out of range, not active, or visibility state
|
|
34881
35100
|
// does not change then return early
|
|
35101
|
+
const drawInfo = this._drawInfo;
|
|
34882
35102
|
if (
|
|
34883
|
-
|
|
34884
|
-
|
|
34885
|
-
|
|
35103
|
+
instanceId >= drawInfo.length ||
|
|
35104
|
+
drawInfo[ instanceId ].active === false ||
|
|
35105
|
+
drawInfo[ instanceId ].visible === value
|
|
34886
35106
|
) {
|
|
34887
35107
|
|
|
34888
35108
|
return this;
|
|
34889
35109
|
|
|
34890
35110
|
}
|
|
34891
35111
|
|
|
34892
|
-
|
|
35112
|
+
drawInfo[ instanceId ].visible = value;
|
|
34893
35113
|
this._visibilityChanged = true;
|
|
34894
35114
|
|
|
34895
35115
|
return this;
|
|
34896
35116
|
|
|
34897
35117
|
}
|
|
34898
35118
|
|
|
34899
|
-
getVisibleAt(
|
|
34900
|
-
|
|
34901
|
-
const visibility = this._visibility;
|
|
34902
|
-
const active = this._active;
|
|
34903
|
-
const geometryCount = this._geometryCount;
|
|
35119
|
+
getVisibleAt( instanceId ) {
|
|
34904
35120
|
|
|
34905
35121
|
// return early if the geometry is out of range or not active
|
|
34906
|
-
|
|
35122
|
+
const drawInfo = this._drawInfo;
|
|
35123
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34907
35124
|
|
|
34908
35125
|
return false;
|
|
34909
35126
|
|
|
34910
35127
|
}
|
|
34911
35128
|
|
|
34912
|
-
return
|
|
35129
|
+
return drawInfo[ instanceId ].visible;
|
|
34913
35130
|
|
|
34914
35131
|
}
|
|
34915
35132
|
|
|
34916
35133
|
raycast( raycaster, intersects ) {
|
|
34917
35134
|
|
|
34918
|
-
const
|
|
34919
|
-
const active = this._active;
|
|
35135
|
+
const drawInfo = this._drawInfo;
|
|
34920
35136
|
const drawRanges = this._drawRanges;
|
|
34921
|
-
const geometryCount = this._geometryCount;
|
|
34922
35137
|
const matrixWorld = this.matrixWorld;
|
|
34923
35138
|
const batchGeometry = this.geometry;
|
|
34924
35139
|
|
|
@@ -34938,21 +35153,22 @@ class BatchedMesh extends Mesh {
|
|
|
34938
35153
|
|
|
34939
35154
|
}
|
|
34940
35155
|
|
|
34941
|
-
for ( let i = 0; i <
|
|
35156
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
34942
35157
|
|
|
34943
|
-
if ( !
|
|
35158
|
+
if ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {
|
|
34944
35159
|
|
|
34945
35160
|
continue;
|
|
34946
35161
|
|
|
34947
35162
|
}
|
|
34948
35163
|
|
|
34949
|
-
const
|
|
35164
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
35165
|
+
const drawRange = drawRanges[ geometryId ];
|
|
34950
35166
|
_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );
|
|
34951
35167
|
|
|
34952
35168
|
// ge the intersects
|
|
34953
35169
|
this.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );
|
|
34954
|
-
this.getBoundingBoxAt(
|
|
34955
|
-
this.getBoundingSphereAt(
|
|
35170
|
+
this.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );
|
|
35171
|
+
this.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );
|
|
34956
35172
|
_mesh.raycast( raycaster, _batchIntersects );
|
|
34957
35173
|
|
|
34958
35174
|
// add batch id to the intersects
|
|
@@ -34989,8 +35205,7 @@ class BatchedMesh extends Mesh {
|
|
|
34989
35205
|
this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
|
|
34990
35206
|
this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
|
|
34991
35207
|
|
|
34992
|
-
this.
|
|
34993
|
-
this._active = source._active.slice();
|
|
35208
|
+
this._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );
|
|
34994
35209
|
this._bounds = source._bounds.map( bound => ( {
|
|
34995
35210
|
boxInitialized: bound.boxInitialized,
|
|
34996
35211
|
box: bound.box.clone(),
|
|
@@ -34999,7 +35214,7 @@ class BatchedMesh extends Mesh {
|
|
|
34999
35214
|
sphere: bound.sphere.clone()
|
|
35000
35215
|
} ) );
|
|
35001
35216
|
|
|
35002
|
-
this.
|
|
35217
|
+
this._maxInstanceCount = source._maxInstanceCount;
|
|
35003
35218
|
this._maxVertexCount = source._maxVertexCount;
|
|
35004
35219
|
this._maxIndexCount = source._maxIndexCount;
|
|
35005
35220
|
|
|
@@ -35009,12 +35224,12 @@ class BatchedMesh extends Mesh {
|
|
|
35009
35224
|
this._multiDrawStarts = source._multiDrawStarts.slice();
|
|
35010
35225
|
|
|
35011
35226
|
this._matricesTexture = source._matricesTexture.clone();
|
|
35012
|
-
this._matricesTexture.image.data = this._matricesTexture.image.slice();
|
|
35227
|
+
this._matricesTexture.image.data = this._matricesTexture.image.data.slice();
|
|
35013
35228
|
|
|
35014
35229
|
if ( this._colorsTexture !== null ) {
|
|
35015
35230
|
|
|
35016
35231
|
this._colorsTexture = source._colorsTexture.clone();
|
|
35017
|
-
this._colorsTexture.image.data = this._colorsTexture.image.slice();
|
|
35232
|
+
this._colorsTexture.image.data = this._colorsTexture.image.data.slice();
|
|
35018
35233
|
|
|
35019
35234
|
}
|
|
35020
35235
|
|
|
@@ -35030,6 +35245,9 @@ class BatchedMesh extends Mesh {
|
|
|
35030
35245
|
this._matricesTexture.dispose();
|
|
35031
35246
|
this._matricesTexture = null;
|
|
35032
35247
|
|
|
35248
|
+
this._indirectTexture.dispose();
|
|
35249
|
+
this._indirectTexture = null;
|
|
35250
|
+
|
|
35033
35251
|
if ( this._colorsTexture !== null ) {
|
|
35034
35252
|
|
|
35035
35253
|
this._colorsTexture.dispose();
|
|
@@ -35056,12 +35274,13 @@ class BatchedMesh extends Mesh {
|
|
|
35056
35274
|
const index = geometry.getIndex();
|
|
35057
35275
|
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
35058
35276
|
|
|
35059
|
-
const
|
|
35060
|
-
const visibility = this._visibility;
|
|
35277
|
+
const drawInfo = this._drawInfo;
|
|
35061
35278
|
const multiDrawStarts = this._multiDrawStarts;
|
|
35062
35279
|
const multiDrawCounts = this._multiDrawCounts;
|
|
35063
35280
|
const drawRanges = this._drawRanges;
|
|
35064
35281
|
const perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
35282
|
+
const indirectTexture = this._indirectTexture;
|
|
35283
|
+
const indirectArray = indirectTexture.image.data;
|
|
35065
35284
|
|
|
35066
35285
|
// prepare the frustum in the local frame
|
|
35067
35286
|
if ( perObjectFrustumCulled ) {
|
|
@@ -35084,13 +35303,15 @@ class BatchedMesh extends Mesh {
|
|
|
35084
35303
|
_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );
|
|
35085
35304
|
_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );
|
|
35086
35305
|
|
|
35087
|
-
for ( let i = 0, l =
|
|
35306
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
35307
|
+
|
|
35308
|
+
if ( drawInfo[ i ].visible && drawInfo[ i ].active ) {
|
|
35088
35309
|
|
|
35089
|
-
|
|
35310
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
35090
35311
|
|
|
35091
35312
|
// get the bounds in world space
|
|
35092
35313
|
this.getMatrixAt( i, _matrix$1 );
|
|
35093
|
-
this.getBoundingSphereAt(
|
|
35314
|
+
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
35094
35315
|
|
|
35095
35316
|
// determine whether the batched geometry is within the frustum
|
|
35096
35317
|
let culled = false;
|
|
@@ -35104,7 +35325,7 @@ class BatchedMesh extends Mesh {
|
|
|
35104
35325
|
|
|
35105
35326
|
// get the distance from camera used for sorting
|
|
35106
35327
|
const z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward );
|
|
35107
|
-
_renderList.push( drawRanges[
|
|
35328
|
+
_renderList.push( drawRanges[ geometryId ], z, i );
|
|
35108
35329
|
|
|
35109
35330
|
}
|
|
35110
35331
|
|
|
@@ -35130,6 +35351,7 @@ class BatchedMesh extends Mesh {
|
|
|
35130
35351
|
const item = list[ i ];
|
|
35131
35352
|
multiDrawStarts[ count ] = item.start * bytesPerElement;
|
|
35132
35353
|
multiDrawCounts[ count ] = item.count;
|
|
35354
|
+
indirectArray[ count ] = item.index;
|
|
35133
35355
|
count ++;
|
|
35134
35356
|
|
|
35135
35357
|
}
|
|
@@ -35138,9 +35360,11 @@ class BatchedMesh extends Mesh {
|
|
|
35138
35360
|
|
|
35139
35361
|
} else {
|
|
35140
35362
|
|
|
35141
|
-
for ( let i = 0, l =
|
|
35363
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
35364
|
+
|
|
35365
|
+
if ( drawInfo[ i ].visible && drawInfo[ i ].active ) {
|
|
35142
35366
|
|
|
35143
|
-
|
|
35367
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
35144
35368
|
|
|
35145
35369
|
// determine whether the batched geometry is within the frustum
|
|
35146
35370
|
let culled = false;
|
|
@@ -35148,16 +35372,17 @@ class BatchedMesh extends Mesh {
|
|
|
35148
35372
|
|
|
35149
35373
|
// get the bounds in world space
|
|
35150
35374
|
this.getMatrixAt( i, _matrix$1 );
|
|
35151
|
-
this.getBoundingSphereAt(
|
|
35375
|
+
this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
|
|
35152
35376
|
culled = ! _frustum.intersectsSphere( _sphere$2 );
|
|
35153
35377
|
|
|
35154
35378
|
}
|
|
35155
35379
|
|
|
35156
35380
|
if ( ! culled ) {
|
|
35157
35381
|
|
|
35158
|
-
const range = drawRanges[
|
|
35382
|
+
const range = drawRanges[ geometryId ];
|
|
35159
35383
|
multiDrawStarts[ count ] = range.start * bytesPerElement;
|
|
35160
35384
|
multiDrawCounts[ count ] = range.count;
|
|
35385
|
+
indirectArray[ count ] = i;
|
|
35161
35386
|
count ++;
|
|
35162
35387
|
|
|
35163
35388
|
}
|
|
@@ -35168,6 +35393,7 @@ class BatchedMesh extends Mesh {
|
|
|
35168
35393
|
|
|
35169
35394
|
}
|
|
35170
35395
|
|
|
35396
|
+
indirectTexture.needsUpdate = true;
|
|
35171
35397
|
this._multiDrawCount = count;
|
|
35172
35398
|
this._visibilityChanged = false;
|
|
35173
35399
|
|
|
@@ -35837,7 +36063,7 @@ class CompressedArrayTexture extends CompressedTexture {
|
|
|
35837
36063
|
|
|
35838
36064
|
}
|
|
35839
36065
|
|
|
35840
|
-
|
|
36066
|
+
addLayerUpdate( layerIndex ) {
|
|
35841
36067
|
|
|
35842
36068
|
this.layerUpdates.add( layerIndex );
|
|
35843
36069
|
|
|
@@ -45644,6 +45870,7 @@ class Light extends Object3D {
|
|
|
45644
45870
|
if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
|
|
45645
45871
|
|
|
45646
45872
|
if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
|
|
45873
|
+
if ( this.target !== undefined ) data.object.target = this.target.uuid;
|
|
45647
45874
|
|
|
45648
45875
|
return data;
|
|
45649
45876
|
|
|
@@ -45690,6 +45917,8 @@ class LightShadow {
|
|
|
45690
45917
|
|
|
45691
45918
|
this.camera = camera;
|
|
45692
45919
|
|
|
45920
|
+
this.intensity = 1;
|
|
45921
|
+
|
|
45693
45922
|
this.bias = 0;
|
|
45694
45923
|
this.normalBias = 0;
|
|
45695
45924
|
this.radius = 1;
|
|
@@ -45787,6 +46016,8 @@ class LightShadow {
|
|
|
45787
46016
|
|
|
45788
46017
|
this.camera = source.camera.clone();
|
|
45789
46018
|
|
|
46019
|
+
this.intensity = source.intensity;
|
|
46020
|
+
|
|
45790
46021
|
this.bias = source.bias;
|
|
45791
46022
|
this.radius = source.radius;
|
|
45792
46023
|
|
|
@@ -45806,6 +46037,7 @@ class LightShadow {
|
|
|
45806
46037
|
|
|
45807
46038
|
const object = {};
|
|
45808
46039
|
|
|
46040
|
+
if ( this.intensity !== 1 ) object.intensity = this.intensity;
|
|
45809
46041
|
if ( this.bias !== 0 ) object.bias = this.bias;
|
|
45810
46042
|
if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
|
|
45811
46043
|
if ( this.radius !== 1 ) object.radius = this.radius;
|
|
@@ -47234,6 +47466,7 @@ class ObjectLoader extends Loader {
|
|
|
47234
47466
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
47235
47467
|
|
|
47236
47468
|
this.bindSkeletons( object, skeletons );
|
|
47469
|
+
this.bindLightTargets( object );
|
|
47237
47470
|
|
|
47238
47471
|
//
|
|
47239
47472
|
|
|
@@ -47275,6 +47508,7 @@ class ObjectLoader extends Loader {
|
|
|
47275
47508
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
47276
47509
|
|
|
47277
47510
|
this.bindSkeletons( object, skeletons );
|
|
47511
|
+
this.bindLightTargets( object );
|
|
47278
47512
|
|
|
47279
47513
|
return object;
|
|
47280
47514
|
|
|
@@ -47919,6 +48153,7 @@ class ObjectLoader extends Loader {
|
|
|
47919
48153
|
case 'DirectionalLight':
|
|
47920
48154
|
|
|
47921
48155
|
object = new DirectionalLight( data.color, data.intensity );
|
|
48156
|
+
object.target = data.target || '';
|
|
47922
48157
|
|
|
47923
48158
|
break;
|
|
47924
48159
|
|
|
@@ -47937,6 +48172,7 @@ class ObjectLoader extends Loader {
|
|
|
47937
48172
|
case 'SpotLight':
|
|
47938
48173
|
|
|
47939
48174
|
object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
|
|
48175
|
+
object.target = data.target || '';
|
|
47940
48176
|
|
|
47941
48177
|
break;
|
|
47942
48178
|
|
|
@@ -47993,7 +48229,7 @@ class ObjectLoader extends Loader {
|
|
|
47993
48229
|
geometry = getGeometry( data.geometry );
|
|
47994
48230
|
material = getMaterial( data.material );
|
|
47995
48231
|
|
|
47996
|
-
object = new BatchedMesh( data.
|
|
48232
|
+
object = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );
|
|
47997
48233
|
object.geometry = geometry;
|
|
47998
48234
|
object.perObjectFrustumCulled = data.perObjectFrustumCulled;
|
|
47999
48235
|
object.sortObjects = data.sortObjects;
|
|
@@ -48023,7 +48259,7 @@ class ObjectLoader extends Loader {
|
|
|
48023
48259
|
|
|
48024
48260
|
} );
|
|
48025
48261
|
|
|
48026
|
-
object.
|
|
48262
|
+
object._maxInstanceCount = data.maxInstanceCount;
|
|
48027
48263
|
object._maxVertexCount = data.maxVertexCount;
|
|
48028
48264
|
object._maxIndexCount = data.maxIndexCount;
|
|
48029
48265
|
|
|
@@ -48117,6 +48353,7 @@ class ObjectLoader extends Loader {
|
|
|
48117
48353
|
|
|
48118
48354
|
if ( data.shadow ) {
|
|
48119
48355
|
|
|
48356
|
+
if ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;
|
|
48120
48357
|
if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
|
|
48121
48358
|
if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
|
|
48122
48359
|
if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
|
|
@@ -48208,6 +48445,32 @@ class ObjectLoader extends Loader {
|
|
|
48208
48445
|
|
|
48209
48446
|
}
|
|
48210
48447
|
|
|
48448
|
+
bindLightTargets( object ) {
|
|
48449
|
+
|
|
48450
|
+
object.traverse( function ( child ) {
|
|
48451
|
+
|
|
48452
|
+
if ( child.isDirectionalLight || child.isSpotLight ) {
|
|
48453
|
+
|
|
48454
|
+
const uuid = child.target;
|
|
48455
|
+
|
|
48456
|
+
const target = object.getObjectByProperty( 'uuid', uuid );
|
|
48457
|
+
|
|
48458
|
+
if ( target !== undefined ) {
|
|
48459
|
+
|
|
48460
|
+
child.target = target;
|
|
48461
|
+
|
|
48462
|
+
} else {
|
|
48463
|
+
|
|
48464
|
+
child.target = new Object3D();
|
|
48465
|
+
|
|
48466
|
+
}
|
|
48467
|
+
|
|
48468
|
+
}
|
|
48469
|
+
|
|
48470
|
+
} );
|
|
48471
|
+
|
|
48472
|
+
}
|
|
48473
|
+
|
|
48211
48474
|
}
|
|
48212
48475
|
|
|
48213
48476
|
const TEXTURE_MAPPING = {
|
|
@@ -52660,6 +52923,61 @@ class Cylindrical {
|
|
|
52660
52923
|
|
|
52661
52924
|
}
|
|
52662
52925
|
|
|
52926
|
+
class Matrix2 {
|
|
52927
|
+
|
|
52928
|
+
constructor( n11, n12, n21, n22 ) {
|
|
52929
|
+
|
|
52930
|
+
Matrix2.prototype.isMatrix2 = true;
|
|
52931
|
+
|
|
52932
|
+
this.elements = [
|
|
52933
|
+
1, 0,
|
|
52934
|
+
0, 1,
|
|
52935
|
+
];
|
|
52936
|
+
|
|
52937
|
+
if ( n11 !== undefined ) {
|
|
52938
|
+
|
|
52939
|
+
this.set( n11, n12, n21, n22 );
|
|
52940
|
+
|
|
52941
|
+
}
|
|
52942
|
+
|
|
52943
|
+
}
|
|
52944
|
+
|
|
52945
|
+
identity() {
|
|
52946
|
+
|
|
52947
|
+
this.set(
|
|
52948
|
+
1, 0,
|
|
52949
|
+
0, 1,
|
|
52950
|
+
);
|
|
52951
|
+
|
|
52952
|
+
return this;
|
|
52953
|
+
|
|
52954
|
+
}
|
|
52955
|
+
|
|
52956
|
+
fromArray( array, offset = 0 ) {
|
|
52957
|
+
|
|
52958
|
+
for ( let i = 0; i < 4; i ++ ) {
|
|
52959
|
+
|
|
52960
|
+
this.elements[ i ] = array[ i + offset ];
|
|
52961
|
+
|
|
52962
|
+
}
|
|
52963
|
+
|
|
52964
|
+
return this;
|
|
52965
|
+
|
|
52966
|
+
}
|
|
52967
|
+
|
|
52968
|
+
set( n11, n12, n21, n22 ) {
|
|
52969
|
+
|
|
52970
|
+
const te = this.elements;
|
|
52971
|
+
|
|
52972
|
+
te[ 0 ] = n11; te[ 2 ] = n12;
|
|
52973
|
+
te[ 1 ] = n21; te[ 3 ] = n22;
|
|
52974
|
+
|
|
52975
|
+
return this;
|
|
52976
|
+
|
|
52977
|
+
}
|
|
52978
|
+
|
|
52979
|
+
}
|
|
52980
|
+
|
|
52663
52981
|
const _vector$4 = /*@__PURE__*/ new Vector2();
|
|
52664
52982
|
|
|
52665
52983
|
class Box2 {
|
|
@@ -52779,8 +53097,8 @@ class Box2 {
|
|
|
52779
53097
|
|
|
52780
53098
|
containsPoint( point ) {
|
|
52781
53099
|
|
|
52782
|
-
return point.x
|
|
52783
|
-
point.y
|
|
53100
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
53101
|
+
point.y >= this.min.y && point.y <= this.max.y;
|
|
52784
53102
|
|
|
52785
53103
|
}
|
|
52786
53104
|
|
|
@@ -52807,8 +53125,8 @@ class Box2 {
|
|
|
52807
53125
|
|
|
52808
53126
|
// using 4 splitting planes to rule out intersections
|
|
52809
53127
|
|
|
52810
|
-
return box.max.x
|
|
52811
|
-
box.max.y
|
|
53128
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
53129
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y;
|
|
52812
53130
|
|
|
52813
53131
|
}
|
|
52814
53132
|
|
|
@@ -54734,6 +55052,7 @@ exports.MOUSE = MOUSE;
|
|
|
54734
55052
|
exports.Material = Material;
|
|
54735
55053
|
exports.MaterialLoader = MaterialLoader;
|
|
54736
55054
|
exports.MathUtils = MathUtils;
|
|
55055
|
+
exports.Matrix2 = Matrix2;
|
|
54737
55056
|
exports.Matrix3 = Matrix3;
|
|
54738
55057
|
exports.Matrix4 = Matrix4;
|
|
54739
55058
|
exports.MaxEquation = MaxEquation;
|
|
@@ -54833,7 +55152,9 @@ exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
|
|
|
54833
55152
|
exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
|
|
54834
55153
|
exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
|
|
54835
55154
|
exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
|
|
55155
|
+
exports.RGBDepthPacking = RGBDepthPacking;
|
|
54836
55156
|
exports.RGBFormat = RGBFormat;
|
|
55157
|
+
exports.RGBIntegerFormat = RGBIntegerFormat;
|
|
54837
55158
|
exports.RGB_BPTC_SIGNED_Format = RGB_BPTC_SIGNED_Format;
|
|
54838
55159
|
exports.RGB_BPTC_UNSIGNED_Format = RGB_BPTC_UNSIGNED_Format;
|
|
54839
55160
|
exports.RGB_ETC1_Format = RGB_ETC1_Format;
|
|
@@ -54841,6 +55162,7 @@ exports.RGB_ETC2_Format = RGB_ETC2_Format;
|
|
|
54841
55162
|
exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
|
|
54842
55163
|
exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format;
|
|
54843
55164
|
exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format;
|
|
55165
|
+
exports.RGDepthPacking = RGDepthPacking;
|
|
54844
55166
|
exports.RGFormat = RGFormat;
|
|
54845
55167
|
exports.RGIntegerFormat = RGIntegerFormat;
|
|
54846
55168
|
exports.RawShaderMaterial = RawShaderMaterial;
|
|
@@ -54901,6 +55223,7 @@ exports.TangentSpaceNormalMap = TangentSpaceNormalMap;
|
|
|
54901
55223
|
exports.TetrahedronGeometry = TetrahedronGeometry;
|
|
54902
55224
|
exports.Texture = Texture;
|
|
54903
55225
|
exports.TextureLoader = TextureLoader;
|
|
55226
|
+
exports.TextureUtils = TextureUtils;
|
|
54904
55227
|
exports.TorusGeometry = TorusGeometry;
|
|
54905
55228
|
exports.TorusKnotGeometry = TorusKnotGeometry;
|
|
54906
55229
|
exports.Triangle = Triangle;
|