super-three 0.164.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/README.md +3 -3
- package/build/three.cjs +1273 -503
- package/build/three.module.js +1269 -504
- 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/controls/TransformControls.js +1 -1
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +8 -4
- package/examples/jsm/exporters/USDZExporter.js +6 -4
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +75 -61
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/FBXLoader.js +47 -58
- package/examples/jsm/loaders/GLTFLoader.js +12 -4
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- 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/CurveModifier.js +11 -9
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- 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/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- 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/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/package.json +9 -7
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +2 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +24 -22
- package/src/core/Raycaster.js +6 -2
- 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/FileLoader.js +4 -0
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/ObjectLoader.js +34 -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 +39 -20
- package/{examples/jsm → src}/nodes/accessors/BatchNode.js +28 -10
- package/src/nodes/accessors/BitangentNode.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +36 -1
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +6 -0
- 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 +24 -2
- package/{examples/jsm → src}/nodes/accessors/ModelNode.js +4 -0
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +24 -20
- package/src/nodes/accessors/NormalNode.js +14 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/PositionNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +7 -1
- package/src/nodes/accessors/ReflectVectorNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +50 -1
- package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +28 -6
- package/src/nodes/accessors/TangentNode.js +23 -0
- package/src/nodes/accessors/Texture3DNode.js +100 -0
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +55 -18
- package/src/nodes/accessors/UVNode.js +3 -0
- 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 +34 -8
- package/{examples/jsm → src}/nodes/core/CacheNode.js +7 -10
- package/{examples/jsm → src}/nodes/core/ContextNode.js +6 -0
- 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 +33 -14
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +194 -45
- 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/NodeKeywords.js +1 -1
- 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/OutputStructNode.js +1 -5
- package/{examples/jsm → src}/nodes/core/PropertyNode.js +2 -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/src/nodes/core/VaryingNode.js +104 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +24 -20
- 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 +3 -2
- 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 +103 -18
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- 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 +18 -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 +4 -4
- package/{examples/jsm → src}/nodes/materials/LineBasicNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineDashedNodeMaterial.js +4 -3
- package/{examples/jsm → src}/nodes/materials/Materials.js +3 -0
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/{examples/jsm → src}/nodes/materials/MeshLambertNodeMaterial.js +12 -3
- package/src/nodes/materials/MeshMatcapNodeMaterial.js +53 -0
- 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 +26 -8
- package/{examples/jsm → src}/nodes/materials/MeshStandardNodeMaterial.js +14 -3
- package/src/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/{examples/jsm → src}/nodes/materials/NodeMaterial.js +97 -24
- 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/src/nodes/materials/VolumeNodeMaterial.js +106 -0
- 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/HashNode.js +2 -2
- 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 +57 -33
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +1 -1
- 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/MatcapUVNode.js +1 -1
- 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/{examples/jsm → src}/nodes/utils/TimerNode.js +1 -1
- package/src/objects/BatchedMesh.js +232 -162
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +312 -68
- package/{examples/jsm → src}/renderers/common/Attributes.js +4 -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 +54 -22
- package/src/renderers/common/ChainMap.js +59 -0
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +8 -6
- 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/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
- package/src/renderers/common/PostProcessing.js +87 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +6 -3
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- 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/RenderList.js +9 -0
- package/{examples/jsm → src}/renderers/common/RenderObject.js +50 -11
- package/{examples/jsm → src}/renderers/common/Renderer.js +220 -40
- 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 +10 -5
- 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 +19 -4
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -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 +31 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -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/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- 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/WebGLBackground.js +6 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +15 -12
- package/src/renderers/webgl/WebGLMaterials.js +1 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +28 -31
- package/src/renderers/webgl/WebGLPrograms.js +15 -15
- package/src/renderers/webgl/WebGLRenderStates.js +2 -2
- package/src/renderers/webgl/WebGLTextures.js +100 -70
- 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 +188 -41
- 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 +126 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +212 -78
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +2 -2
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +245 -49
- 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 +30 -14
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +9 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +74 -24
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +101 -25
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +24 -3
- package/src/renderers/webxr/WebXRDepthSensing.js +9 -3
- package/src/renderers/webxr/WebXRManager.js +12 -2
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -106
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/VaryingNode.js +0 -65
- package/examples/jsm/nodes/display/PassNode.js +0 -199
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -255
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- 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/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/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/TextureBicubicNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.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/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/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/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/MeshSSSNodeMaterial.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/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/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/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/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/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/ProgrammableStage.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
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { AlphaFormat, LuminanceFormat, LuminanceAlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type } from '../constants.js';
|
|
2
|
+
|
|
3
|
+
function contain( texture, aspect ) {
|
|
4
|
+
|
|
5
|
+
const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
|
|
6
|
+
|
|
7
|
+
if ( imageAspect > aspect ) {
|
|
8
|
+
|
|
9
|
+
texture.repeat.x = 1;
|
|
10
|
+
texture.repeat.y = imageAspect / aspect;
|
|
11
|
+
|
|
12
|
+
texture.offset.x = 0;
|
|
13
|
+
texture.offset.y = ( 1 - texture.repeat.y ) / 2;
|
|
14
|
+
|
|
15
|
+
} else {
|
|
16
|
+
|
|
17
|
+
texture.repeat.x = aspect / imageAspect;
|
|
18
|
+
texture.repeat.y = 1;
|
|
19
|
+
|
|
20
|
+
texture.offset.x = ( 1 - texture.repeat.x ) / 2;
|
|
21
|
+
texture.offset.y = 0;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return texture;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function cover( texture, aspect ) {
|
|
30
|
+
|
|
31
|
+
const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
|
|
32
|
+
|
|
33
|
+
if ( imageAspect > aspect ) {
|
|
34
|
+
|
|
35
|
+
texture.repeat.x = aspect / imageAspect;
|
|
36
|
+
texture.repeat.y = 1;
|
|
37
|
+
|
|
38
|
+
texture.offset.x = ( 1 - texture.repeat.x ) / 2;
|
|
39
|
+
texture.offset.y = 0;
|
|
40
|
+
|
|
41
|
+
} else {
|
|
42
|
+
|
|
43
|
+
texture.repeat.x = 1;
|
|
44
|
+
texture.repeat.y = imageAspect / aspect;
|
|
45
|
+
|
|
46
|
+
texture.offset.x = 0;
|
|
47
|
+
texture.offset.y = ( 1 - texture.repeat.y ) / 2;
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return texture;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function fill( texture ) {
|
|
56
|
+
|
|
57
|
+
texture.repeat.x = 1;
|
|
58
|
+
texture.repeat.y = 1;
|
|
59
|
+
|
|
60
|
+
texture.offset.x = 0;
|
|
61
|
+
texture.offset.y = 0;
|
|
62
|
+
|
|
63
|
+
return texture;
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Given the width, height, format, and type of a texture. Determines how many
|
|
71
|
+
* bytes must be used to represent the texture.
|
|
72
|
+
*/
|
|
73
|
+
function getByteLength( width, height, format, type ) {
|
|
74
|
+
|
|
75
|
+
const typeByteLength = getTextureTypeByteLength( type );
|
|
76
|
+
|
|
77
|
+
switch ( format ) {
|
|
78
|
+
|
|
79
|
+
// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
|
|
80
|
+
case AlphaFormat:
|
|
81
|
+
return width * height;
|
|
82
|
+
case LuminanceFormat:
|
|
83
|
+
return width * height;
|
|
84
|
+
case LuminanceAlphaFormat:
|
|
85
|
+
return width * height * 2;
|
|
86
|
+
case RedFormat:
|
|
87
|
+
return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
88
|
+
case RedIntegerFormat:
|
|
89
|
+
return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
90
|
+
case RGFormat:
|
|
91
|
+
return ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
92
|
+
case RGIntegerFormat:
|
|
93
|
+
return ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
94
|
+
case RGBFormat:
|
|
95
|
+
return ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
96
|
+
case RGBAFormat:
|
|
97
|
+
return ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
98
|
+
case RGBAIntegerFormat:
|
|
99
|
+
return ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;
|
|
100
|
+
|
|
101
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/
|
|
102
|
+
case RGB_S3TC_DXT1_Format:
|
|
103
|
+
case RGBA_S3TC_DXT1_Format:
|
|
104
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
105
|
+
case RGBA_S3TC_DXT3_Format:
|
|
106
|
+
case RGBA_S3TC_DXT5_Format:
|
|
107
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
108
|
+
|
|
109
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/
|
|
110
|
+
case RGB_PVRTC_2BPPV1_Format:
|
|
111
|
+
case RGBA_PVRTC_2BPPV1_Format:
|
|
112
|
+
return ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;
|
|
113
|
+
case RGB_PVRTC_4BPPV1_Format:
|
|
114
|
+
case RGBA_PVRTC_4BPPV1_Format:
|
|
115
|
+
return ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;
|
|
116
|
+
|
|
117
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
|
|
118
|
+
case RGB_ETC1_Format:
|
|
119
|
+
case RGB_ETC2_Format:
|
|
120
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
|
|
121
|
+
case RGBA_ETC2_EAC_Format:
|
|
122
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
123
|
+
|
|
124
|
+
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
|
|
125
|
+
case RGBA_ASTC_4x4_Format:
|
|
126
|
+
return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
127
|
+
case RGBA_ASTC_5x4_Format:
|
|
128
|
+
return Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
|
|
129
|
+
case RGBA_ASTC_5x5_Format:
|
|
130
|
+
return Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
131
|
+
case RGBA_ASTC_6x5_Format:
|
|
132
|
+
return Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
133
|
+
case RGBA_ASTC_6x6_Format:
|
|
134
|
+
return Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
135
|
+
case RGBA_ASTC_8x5_Format:
|
|
136
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
137
|
+
case RGBA_ASTC_8x6_Format:
|
|
138
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
139
|
+
case RGBA_ASTC_8x8_Format:
|
|
140
|
+
return Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;
|
|
141
|
+
case RGBA_ASTC_10x5_Format:
|
|
142
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;
|
|
143
|
+
case RGBA_ASTC_10x6_Format:
|
|
144
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;
|
|
145
|
+
case RGBA_ASTC_10x8_Format:
|
|
146
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;
|
|
147
|
+
case RGBA_ASTC_10x10_Format:
|
|
148
|
+
return Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;
|
|
149
|
+
case RGBA_ASTC_12x10_Format:
|
|
150
|
+
return Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;
|
|
151
|
+
case RGBA_ASTC_12x12_Format:
|
|
152
|
+
return Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;
|
|
153
|
+
|
|
154
|
+
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/
|
|
155
|
+
case RGBA_BPTC_Format:
|
|
156
|
+
case RGB_BPTC_SIGNED_Format:
|
|
157
|
+
case RGB_BPTC_UNSIGNED_Format:
|
|
158
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;
|
|
159
|
+
|
|
160
|
+
// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/
|
|
161
|
+
case RED_RGTC1_Format:
|
|
162
|
+
case SIGNED_RED_RGTC1_Format:
|
|
163
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;
|
|
164
|
+
case RED_GREEN_RGTC2_Format:
|
|
165
|
+
case SIGNED_RED_GREEN_RGTC2_Format:
|
|
166
|
+
return Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
throw new Error(
|
|
171
|
+
`Unable to determine texture byte length for ${format} format.`,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function getTextureTypeByteLength( type ) {
|
|
177
|
+
|
|
178
|
+
switch ( type ) {
|
|
179
|
+
|
|
180
|
+
case UnsignedByteType:
|
|
181
|
+
case ByteType:
|
|
182
|
+
return { byteLength: 1, components: 1 };
|
|
183
|
+
case UnsignedShortType:
|
|
184
|
+
case ShortType:
|
|
185
|
+
case HalfFloatType:
|
|
186
|
+
return { byteLength: 2, components: 1 };
|
|
187
|
+
case UnsignedShort4444Type:
|
|
188
|
+
case UnsignedShort5551Type:
|
|
189
|
+
return { byteLength: 2, components: 4 };
|
|
190
|
+
case UnsignedIntType:
|
|
191
|
+
case IntType:
|
|
192
|
+
case FloatType:
|
|
193
|
+
return { byteLength: 4, components: 1 };
|
|
194
|
+
case UnsignedInt5999Type:
|
|
195
|
+
return { byteLength: 4, components: 3 };
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
throw new Error( `Unknown texture type ${type}.` );
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const TextureUtils = {
|
|
204
|
+
contain,
|
|
205
|
+
cover,
|
|
206
|
+
fill,
|
|
207
|
+
getByteLength
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export { contain, cover, fill, getByteLength, TextureUtils };
|
package/src/lights/Light.js
CHANGED
|
@@ -48,6 +48,7 @@ class Light extends Object3D {
|
|
|
48
48
|
if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
|
|
49
49
|
|
|
50
50
|
if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
|
|
51
|
+
if ( this.target !== undefined ) data.object.target = this.target.uuid;
|
|
51
52
|
|
|
52
53
|
return data;
|
|
53
54
|
|
|
@@ -14,6 +14,8 @@ class LightShadow {
|
|
|
14
14
|
|
|
15
15
|
this.camera = camera;
|
|
16
16
|
|
|
17
|
+
this.intensity = 1;
|
|
18
|
+
|
|
17
19
|
this.bias = 0;
|
|
18
20
|
this.normalBias = 0;
|
|
19
21
|
this.radius = 1;
|
|
@@ -111,6 +113,8 @@ class LightShadow {
|
|
|
111
113
|
|
|
112
114
|
this.camera = source.camera.clone();
|
|
113
115
|
|
|
116
|
+
this.intensity = source.intensity;
|
|
117
|
+
|
|
114
118
|
this.bias = source.bias;
|
|
115
119
|
this.radius = source.radius;
|
|
116
120
|
|
|
@@ -130,6 +134,7 @@ class LightShadow {
|
|
|
130
134
|
|
|
131
135
|
const object = {};
|
|
132
136
|
|
|
137
|
+
if ( this.intensity !== 1 ) object.intensity = this.intensity;
|
|
133
138
|
if ( this.bias !== 0 ) object.bias = this.bias;
|
|
134
139
|
if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
|
|
135
140
|
if ( this.radius !== 1 ) object.radius = this.radius;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
class LoaderUtils {
|
|
2
2
|
|
|
3
|
-
static decodeText( array ) {
|
|
3
|
+
static decodeText( array ) { // @deprecated, r165
|
|
4
|
+
|
|
5
|
+
console.warn( 'THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.' );
|
|
4
6
|
|
|
5
7
|
if ( typeof TextDecoder !== 'undefined' ) {
|
|
6
8
|
|
|
@@ -164,6 +164,7 @@ class ObjectLoader extends Loader {
|
|
|
164
164
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
165
165
|
|
|
166
166
|
this.bindSkeletons( object, skeletons );
|
|
167
|
+
this.bindLightTargets( object );
|
|
167
168
|
|
|
168
169
|
//
|
|
169
170
|
|
|
@@ -205,6 +206,7 @@ class ObjectLoader extends Loader {
|
|
|
205
206
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
206
207
|
|
|
207
208
|
this.bindSkeletons( object, skeletons );
|
|
209
|
+
this.bindLightTargets( object );
|
|
208
210
|
|
|
209
211
|
return object;
|
|
210
212
|
|
|
@@ -849,6 +851,7 @@ class ObjectLoader extends Loader {
|
|
|
849
851
|
case 'DirectionalLight':
|
|
850
852
|
|
|
851
853
|
object = new DirectionalLight( data.color, data.intensity );
|
|
854
|
+
object.target = data.target || '';
|
|
852
855
|
|
|
853
856
|
break;
|
|
854
857
|
|
|
@@ -867,6 +870,7 @@ class ObjectLoader extends Loader {
|
|
|
867
870
|
case 'SpotLight':
|
|
868
871
|
|
|
869
872
|
object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
|
|
873
|
+
object.target = data.target || '';
|
|
870
874
|
|
|
871
875
|
break;
|
|
872
876
|
|
|
@@ -923,7 +927,7 @@ class ObjectLoader extends Loader {
|
|
|
923
927
|
geometry = getGeometry( data.geometry );
|
|
924
928
|
material = getMaterial( data.material );
|
|
925
929
|
|
|
926
|
-
object = new BatchedMesh( data.
|
|
930
|
+
object = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );
|
|
927
931
|
object.geometry = geometry;
|
|
928
932
|
object.perObjectFrustumCulled = data.perObjectFrustumCulled;
|
|
929
933
|
object.sortObjects = data.sortObjects;
|
|
@@ -953,7 +957,7 @@ class ObjectLoader extends Loader {
|
|
|
953
957
|
|
|
954
958
|
} );
|
|
955
959
|
|
|
956
|
-
object.
|
|
960
|
+
object._maxInstanceCount = data.maxInstanceCount;
|
|
957
961
|
object._maxVertexCount = data.maxVertexCount;
|
|
958
962
|
object._maxIndexCount = data.maxIndexCount;
|
|
959
963
|
|
|
@@ -961,6 +965,7 @@ class ObjectLoader extends Loader {
|
|
|
961
965
|
object._geometryCount = data.geometryCount;
|
|
962
966
|
|
|
963
967
|
object._matricesTexture = getTexture( data.matricesTexture.uuid );
|
|
968
|
+
if ( data.colorsTexture !== undefined ) object._colorsTexture = getTexture( data.colorsTexture.uuid );
|
|
964
969
|
|
|
965
970
|
break;
|
|
966
971
|
|
|
@@ -1046,6 +1051,7 @@ class ObjectLoader extends Loader {
|
|
|
1046
1051
|
|
|
1047
1052
|
if ( data.shadow ) {
|
|
1048
1053
|
|
|
1054
|
+
if ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;
|
|
1049
1055
|
if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
|
|
1050
1056
|
if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
|
|
1051
1057
|
if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
|
|
@@ -1137,6 +1143,32 @@ class ObjectLoader extends Loader {
|
|
|
1137
1143
|
|
|
1138
1144
|
}
|
|
1139
1145
|
|
|
1146
|
+
bindLightTargets( object ) {
|
|
1147
|
+
|
|
1148
|
+
object.traverse( function ( child ) {
|
|
1149
|
+
|
|
1150
|
+
if ( child.isDirectionalLight || child.isSpotLight ) {
|
|
1151
|
+
|
|
1152
|
+
const uuid = child.target;
|
|
1153
|
+
|
|
1154
|
+
const target = object.getObjectByProperty( 'uuid', uuid );
|
|
1155
|
+
|
|
1156
|
+
if ( target !== undefined ) {
|
|
1157
|
+
|
|
1158
|
+
child.target = target;
|
|
1159
|
+
|
|
1160
|
+
} else {
|
|
1161
|
+
|
|
1162
|
+
child.target = new Object3D();
|
|
1163
|
+
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
} );
|
|
1169
|
+
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1140
1172
|
}
|
|
1141
1173
|
|
|
1142
1174
|
const TEXTURE_MAPPING = {
|
|
@@ -100,10 +100,6 @@ class Material extends EventDispatcher {
|
|
|
100
100
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
onBuild( /* shaderobject, renderer */ ) {}
|
|
104
|
-
|
|
105
|
-
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
106
|
-
|
|
107
103
|
onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
108
104
|
|
|
109
105
|
customProgramCacheKey() {
|
|
@@ -520,6 +516,19 @@ class Material extends EventDispatcher {
|
|
|
520
516
|
|
|
521
517
|
}
|
|
522
518
|
|
|
519
|
+
onBuild( /* shaderobject, renderer */ ) {
|
|
520
|
+
|
|
521
|
+
console.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166
|
|
522
|
+
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {
|
|
526
|
+
|
|
527
|
+
console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166
|
|
528
|
+
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
|
|
523
532
|
}
|
|
524
533
|
|
|
525
534
|
export { Material };
|
package/src/math/Box2.js
CHANGED
|
@@ -119,8 +119,8 @@ class Box2 {
|
|
|
119
119
|
|
|
120
120
|
containsPoint( point ) {
|
|
121
121
|
|
|
122
|
-
return point.x
|
|
123
|
-
point.y
|
|
122
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
123
|
+
point.y >= this.min.y && point.y <= this.max.y;
|
|
124
124
|
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -147,8 +147,8 @@ class Box2 {
|
|
|
147
147
|
|
|
148
148
|
// using 4 splitting planes to rule out intersections
|
|
149
149
|
|
|
150
|
-
return box.max.x
|
|
151
|
-
box.max.y
|
|
150
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
151
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y;
|
|
152
152
|
|
|
153
153
|
}
|
|
154
154
|
|
package/src/math/Box3.js
CHANGED
|
@@ -238,9 +238,9 @@ class Box3 {
|
|
|
238
238
|
|
|
239
239
|
containsPoint( point ) {
|
|
240
240
|
|
|
241
|
-
return point.x
|
|
242
|
-
point.y
|
|
243
|
-
point.z
|
|
241
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
242
|
+
point.y >= this.min.y && point.y <= this.max.y &&
|
|
243
|
+
point.z >= this.min.z && point.z <= this.max.z;
|
|
244
244
|
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -268,9 +268,9 @@ class Box3 {
|
|
|
268
268
|
intersectsBox( box ) {
|
|
269
269
|
|
|
270
270
|
// using 6 splitting planes to rule out intersections.
|
|
271
|
-
return box.max.x
|
|
272
|
-
box.max.y
|
|
273
|
-
box.max.z
|
|
271
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
272
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y &&
|
|
273
|
+
box.max.z >= this.min.z && box.min.z <= this.max.z;
|
|
274
274
|
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -33,24 +33,28 @@ const COLOR_SPACES = {
|
|
|
33
33
|
[ LinearSRGBColorSpace ]: {
|
|
34
34
|
transfer: LinearTransfer,
|
|
35
35
|
primaries: Rec709Primaries,
|
|
36
|
+
luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
|
|
36
37
|
toReference: ( color ) => color,
|
|
37
38
|
fromReference: ( color ) => color,
|
|
38
39
|
},
|
|
39
40
|
[ SRGBColorSpace ]: {
|
|
40
41
|
transfer: SRGBTransfer,
|
|
41
42
|
primaries: Rec709Primaries,
|
|
43
|
+
luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
|
|
42
44
|
toReference: ( color ) => color.convertSRGBToLinear(),
|
|
43
45
|
fromReference: ( color ) => color.convertLinearToSRGB(),
|
|
44
46
|
},
|
|
45
47
|
[ LinearDisplayP3ColorSpace ]: {
|
|
46
48
|
transfer: LinearTransfer,
|
|
47
49
|
primaries: P3Primaries,
|
|
50
|
+
luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
|
|
48
51
|
toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
49
52
|
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
|
|
50
53
|
},
|
|
51
54
|
[ DisplayP3ColorSpace ]: {
|
|
52
55
|
transfer: SRGBTransfer,
|
|
53
56
|
primaries: P3Primaries,
|
|
57
|
+
luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
|
|
54
58
|
toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
55
59
|
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
|
|
56
60
|
},
|
|
@@ -123,6 +127,12 @@ export const ColorManagement = {
|
|
|
123
127
|
|
|
124
128
|
},
|
|
125
129
|
|
|
130
|
+
getLuminanceCoefficients: function ( target, colorSpace = this._workingColorSpace ) {
|
|
131
|
+
|
|
132
|
+
return target.fromArray( COLOR_SPACES[ colorSpace ].luminanceCoefficients );
|
|
133
|
+
|
|
134
|
+
},
|
|
135
|
+
|
|
126
136
|
};
|
|
127
137
|
|
|
128
138
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class Matrix2 {
|
|
2
|
+
|
|
3
|
+
constructor( n11, n12, n21, n22 ) {
|
|
4
|
+
|
|
5
|
+
Matrix2.prototype.isMatrix2 = true;
|
|
6
|
+
|
|
7
|
+
this.elements = [
|
|
8
|
+
1, 0,
|
|
9
|
+
0, 1,
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
if ( n11 !== undefined ) {
|
|
13
|
+
|
|
14
|
+
this.set( n11, n12, n21, n22 );
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
identity() {
|
|
21
|
+
|
|
22
|
+
this.set(
|
|
23
|
+
1, 0,
|
|
24
|
+
0, 1,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return this;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fromArray( array, offset = 0 ) {
|
|
32
|
+
|
|
33
|
+
for ( let i = 0; i < 4; i ++ ) {
|
|
34
|
+
|
|
35
|
+
this.elements[ i ] = array[ i + offset ];
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return this;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
set( n11, n12, n21, n22 ) {
|
|
44
|
+
|
|
45
|
+
const te = this.elements;
|
|
46
|
+
|
|
47
|
+
te[ 0 ] = n11; te[ 2 ] = n12;
|
|
48
|
+
te[ 1 ] = n21; te[ 3 ] = n22;
|
|
49
|
+
|
|
50
|
+
return this;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
package/src/math/Vector4.js
CHANGED
|
@@ -413,6 +413,19 @@ class Vector4 {
|
|
|
413
413
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
setFromMatrixPosition( m ) {
|
|
417
|
+
|
|
418
|
+
const e = m.elements;
|
|
419
|
+
|
|
420
|
+
this.x = e[ 12 ];
|
|
421
|
+
this.y = e[ 13 ];
|
|
422
|
+
this.z = e[ 14 ];
|
|
423
|
+
this.w = e[ 15 ];
|
|
424
|
+
|
|
425
|
+
return this;
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
416
429
|
min( v ) {
|
|
417
430
|
|
|
418
431
|
this.x = Math.min( this.x, v.x );
|