super-three 0.184.0 → 0.185.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 +1260 -927
- package/build/three.core.js +1104 -829
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +156 -98
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +11 -4
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +7538 -3367
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +7538 -3366
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -0
- package/examples/jsm/controls/ArcballControls.js +6 -2
- package/examples/jsm/controls/FirstPersonControls.js +79 -42
- package/examples/jsm/controls/TransformControls.js +68 -15
- package/examples/jsm/csm/CSMFrustum.js +31 -6
- package/examples/jsm/csm/CSMShadowNode.js +4 -1
- package/examples/jsm/effects/AsciiEffect.js +14 -1
- package/examples/jsm/exporters/DRACOExporter.js +27 -6
- package/examples/jsm/exporters/GLTFExporter.js +114 -12
- package/examples/jsm/exporters/PLYExporter.js +286 -73
- package/examples/jsm/exporters/USDZExporter.js +347 -112
- package/examples/jsm/generators/CityGenerator.js +346 -0
- package/examples/jsm/generators/ForestGenerator.js +347 -0
- package/examples/jsm/generators/TerrainGenerator.js +504 -0
- package/examples/jsm/generators/TreeGenerator.js +377 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
- package/examples/jsm/geometries/LoftGeometry.js +355 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +5 -4
- package/examples/jsm/helpers/ViewHelper.js +16 -6
- package/examples/jsm/inspector/Inspector.js +53 -15
- package/examples/jsm/inspector/RendererInspector.js +152 -36
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
- package/examples/jsm/inspector/tabs/Console.js +200 -18
- package/examples/jsm/inspector/tabs/Memory.js +8 -0
- package/examples/jsm/inspector/tabs/Parameters.js +64 -4
- package/examples/jsm/inspector/tabs/Performance.js +21 -6
- package/examples/jsm/inspector/tabs/Settings.js +51 -9
- package/examples/jsm/inspector/tabs/Timeline.js +178 -93
- package/examples/jsm/inspector/tabs/Viewer.js +628 -16
- package/examples/jsm/inspector/ui/Graph.js +162 -25
- package/examples/jsm/inspector/ui/Item.js +92 -13
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +90 -45
- package/examples/jsm/inspector/ui/Style.js +1788 -1401
- package/examples/jsm/inspector/ui/Tab.js +5 -3
- package/examples/jsm/inspector/ui/Values.js +71 -6
- package/examples/jsm/inspector/ui/utils.js +130 -10
- package/examples/jsm/libs/basis/README.md +0 -1
- package/examples/jsm/libs/demuxer_mp4.js +3 -3
- package/examples/jsm/libs/draco/README.md +0 -1
- package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
- package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
- package/examples/jsm/libs/mikktspace.module.js +34 -9
- package/examples/jsm/lighting/ClusteredLighting.js +55 -0
- package/examples/jsm/lighting/LightProbeGrid.js +106 -76
- package/examples/jsm/lines/LineMaterial.js +38 -15
- package/examples/jsm/lines/LineSegments2.js +8 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +46 -13
- package/examples/jsm/loaders/EXRLoader.js +27 -55
- package/examples/jsm/loaders/HDRLoader.js +6 -28
- package/examples/jsm/loaders/KTX2Loader.js +31 -12
- package/examples/jsm/loaders/LDrawLoader.js +8 -8
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
- package/examples/jsm/loaders/LWOLoader.js +4 -0
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MaterialXLoader.js +31 -9
- package/examples/jsm/loaders/NRRDLoader.js +3 -3
- package/examples/jsm/loaders/PCDLoader.js +7 -7
- package/examples/jsm/loaders/PLYLoader.js +218 -55
- package/examples/jsm/loaders/SVGLoader.js +547 -495
- package/examples/jsm/loaders/TTFLoader.js +1 -1
- package/examples/jsm/loaders/USDLoader.js +33 -9
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +93 -20
- package/examples/jsm/loaders/usd/USDCParser.js +1 -1
- package/examples/jsm/loaders/usd/USDComposer.js +52 -19
- package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
- package/examples/jsm/misc/Volume.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +1 -1
- package/examples/jsm/objects/Reflector.js +2 -3
- package/examples/jsm/objects/Water2Mesh.js +1 -1
- package/examples/jsm/physics/AmmoPhysics.js +15 -8
- package/examples/jsm/physics/RapierPhysics.js +27 -2
- package/examples/jsm/shaders/VolumeShader.js +31 -44
- package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
- package/examples/jsm/transpiler/Linker.js +1 -1
- package/examples/jsm/tsl/display/BloomNode.js +59 -19
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
- package/examples/jsm/tsl/display/FXAANode.js +11 -12
- package/examples/jsm/tsl/display/GTAONode.js +34 -13
- package/examples/jsm/tsl/display/GodraysNode.js +1 -1
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
- package/examples/jsm/tsl/display/SSGINode.js +89 -39
- package/examples/jsm/tsl/display/SSRNode.js +829 -132
- package/examples/jsm/tsl/display/SSSNode.js +2 -2
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
- package/examples/jsm/tsl/math/curlNoise.js +107 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
- package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
- package/examples/jsm/tsl/utils/RNoise.js +51 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
- package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
- package/examples/jsm/utils/SceneOptimizer.js +1 -1
- package/examples/jsm/webxr/ARButton.js +1 -1
- package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
- package/package.json +7 -7
- package/src/Three.TSL.js +10 -3
- package/src/Three.WebGPU.js +4 -0
- package/src/animation/AnimationAction.js +15 -11
- package/src/animation/AnimationClip.js +0 -139
- package/src/animation/KeyframeTrack.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/Camera.js +2 -2
- package/src/cameras/StereoCamera.js +5 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +29 -7
- package/src/core/Object3D.js +17 -7
- package/src/core/Raycaster.js +1 -1
- package/src/core/RenderTarget.js +15 -2
- package/src/extras/PMREMGenerator.js +6 -4
- package/src/extras/TextureUtils.js +1 -1
- package/src/extras/core/ShapePath.js +149 -160
- package/src/geometries/SphereGeometry.js +8 -3
- package/src/helpers/DirectionalLightHelper.js +2 -0
- package/src/helpers/HemisphereLightHelper.js +2 -0
- package/src/helpers/PointLightHelper.js +2 -0
- package/src/helpers/SpotLightHelper.js +1 -1
- package/src/loaders/DataTextureLoader.js +69 -38
- package/src/loaders/LoadingManager.js +5 -0
- package/src/loaders/MaterialLoader.js +36 -266
- package/src/loaders/ObjectLoader.js +3 -1
- package/src/materials/LineBasicMaterial.js +4 -0
- package/src/materials/Material.js +196 -1
- package/src/materials/MeshBasicMaterial.js +24 -0
- package/src/materials/MeshDepthMaterial.js +10 -0
- package/src/materials/MeshDistanceMaterial.js +10 -0
- package/src/materials/MeshLambertMaterial.js +40 -1
- package/src/materials/MeshMatcapMaterial.js +25 -1
- package/src/materials/MeshNormalMaterial.js +9 -1
- package/src/materials/MeshPhongMaterial.js +40 -1
- package/src/materials/MeshPhysicalMaterial.js +38 -0
- package/src/materials/MeshStandardMaterial.js +42 -1
- package/src/materials/MeshToonMaterial.js +34 -1
- package/src/materials/PointsMaterial.js +7 -0
- package/src/materials/ShaderMaterial.js +86 -0
- package/src/materials/SpriteMaterial.js +7 -0
- package/src/materials/nodes/Line2NodeMaterial.js +378 -322
- package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
- package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
- package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
- package/src/materials/nodes/NodeMaterial.js +115 -71
- package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
- package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
- package/src/math/Box3.js +5 -0
- package/src/math/FrustumArray.js +103 -133
- package/src/math/Interpolant.js +1 -1
- package/src/math/MathUtils.js +2 -2
- package/src/math/Matrix3.js +11 -0
- package/src/math/Matrix4.js +28 -3
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +2 -2
- package/src/math/Vector4.js +2 -2
- package/src/math/interpolants/BezierInterpolant.js +4 -6
- package/src/nodes/Nodes.js +2 -5
- package/src/nodes/TSL.js +8 -6
- package/src/nodes/accessors/Arrays.js +4 -4
- package/src/nodes/accessors/Batch.js +108 -0
- package/src/nodes/accessors/Bitangent.js +2 -2
- package/src/nodes/accessors/BufferAttributeNode.js +13 -2
- package/src/nodes/accessors/Camera.js +7 -7
- package/src/nodes/accessors/ClippingNode.js +1 -1
- package/src/nodes/accessors/Instance.js +264 -0
- package/src/nodes/accessors/MaterialNode.js +18 -2
- package/src/nodes/accessors/MaterialProperties.js +4 -3
- package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
- package/src/nodes/accessors/Normal.js +13 -13
- package/src/nodes/accessors/Position.js +5 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -0
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneProperties.js +1 -1
- package/src/nodes/accessors/Skinning.js +263 -0
- package/src/nodes/accessors/StorageBufferNode.js +2 -2
- package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
- package/src/nodes/accessors/StorageTextureNode.js +39 -7
- package/src/nodes/accessors/Tangent.js +4 -4
- package/src/nodes/accessors/TextureNode.js +60 -5
- package/src/nodes/code/FunctionNode.js +2 -16
- package/src/nodes/core/MRTNode.js +7 -2
- package/src/nodes/core/Node.js +39 -2
- package/src/nodes/core/NodeBuilder.js +201 -41
- package/src/nodes/core/NodeUtils.js +13 -13
- package/src/nodes/core/OutputStructNode.js +1 -1
- package/src/nodes/core/OverrideContextNode.js +153 -0
- package/src/nodes/core/PropertyNode.js +51 -5
- package/src/nodes/core/StackNode.js +56 -34
- package/src/nodes/core/StructNode.js +4 -6
- package/src/nodes/core/StructTypeNode.js +6 -6
- package/src/nodes/core/VarNode.js +8 -0
- package/src/nodes/core/VaryingNode.js +12 -2
- package/src/nodes/display/BlendModes.js +1 -41
- package/src/nodes/display/BumpMapNode.js +6 -1
- package/src/nodes/display/ColorAdjustment.js +10 -9
- package/src/nodes/display/FrontFacingNode.js +38 -9
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +35 -43
- package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
- package/src/nodes/display/RenderOutputNode.js +12 -3
- package/src/nodes/functions/VolumetricLightingModel.js +40 -7
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
- package/src/nodes/lighting/EnvironmentNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +40 -2
- package/src/nodes/lighting/LightingContextNode.js +10 -2
- package/src/nodes/lighting/LightsNode.js +90 -37
- package/src/nodes/lighting/PointShadowNode.js +6 -1
- package/src/nodes/lighting/ShadowFilterNode.js +21 -52
- package/src/nodes/lighting/ShadowNode.js +34 -14
- package/src/nodes/materialx/lib/mx_noise.js +2 -2
- package/src/nodes/math/ConditionalNode.js +3 -3
- package/src/nodes/math/MathNode.js +39 -11
- package/src/nodes/math/OperatorNode.js +23 -23
- package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
- package/src/nodes/pmrem/PMREMNode.js +33 -2
- package/src/nodes/tsl/TSLCore.js +63 -18
- package/src/nodes/utils/EquirectUV.js +30 -5
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/Packing.js +35 -4
- package/src/nodes/utils/RTTNode.js +40 -24
- package/src/nodes/utils/ReflectorNode.js +1 -0
- package/src/nodes/utils/StorageArrayElementNode.js +1 -1
- package/src/objects/BatchedMesh.js +22 -14
- package/src/objects/InstancedMesh.js +0 -11
- package/src/objects/Skeleton.js +0 -9
- package/src/renderers/WebGLRenderer.js +19 -15
- package/src/renderers/common/Backend.js +49 -5
- package/src/renderers/common/Bindings.js +114 -45
- package/src/renderers/common/Buffer.js +9 -0
- package/src/renderers/common/ClippingContext.js +10 -2
- package/src/renderers/common/Info.js +63 -22
- package/src/renderers/common/Lighting.js +53 -5
- package/src/renderers/common/RenderList.js +41 -4
- package/src/renderers/common/RenderObject.js +73 -13
- package/src/renderers/common/Renderer.js +281 -108
- package/src/renderers/common/Sampler.js +16 -48
- package/src/renderers/common/Textures.js +32 -5
- package/src/renderers/common/TimestampQueryPool.js +1 -1
- package/src/renderers/common/UniformsGroup.js +31 -9
- package/src/renderers/common/XRManager.js +340 -22
- package/src/renderers/common/extras/PMREMGenerator.js +15 -38
- package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
- package/src/renderers/common/nodes/NodeLibrary.js +4 -4
- package/src/renderers/common/nodes/NodeManager.js +63 -14
- package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
- package/src/renderers/webgl/WebGLOutput.js +2 -1
- package/src/renderers/webgl/WebGLProgram.js +5 -4
- package/src/renderers/webgl/WebGLPrograms.js +12 -5
- package/src/renderers/webgl/WebGLRenderLists.js +9 -1
- package/src/renderers/webgl/WebGLShaderCache.js +5 -11
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
- package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
- package/src/renderers/webgpu/WebGPUBackend.js +480 -169
- package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
- package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
- package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
- package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
- package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
- package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
- package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
- package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
- package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
- package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
- package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
- package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
- package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
- package/src/textures/DepthTexture.js +1 -1
- package/src/textures/ExternalTexture.js +0 -3
- package/examples/fonts/LICENSE +0 -13
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
- package/examples/fonts/README.md +0 -11
- package/examples/fonts/droid/NOTICE +0 -190
- package/examples/fonts/droid/README.txt +0 -18
- package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
- package/examples/fonts/gentilis_bold.typeface.json +0 -1
- package/examples/fonts/gentilis_regular.typeface.json +0 -1
- package/examples/fonts/helvetiker_bold.typeface.json +0 -1
- package/examples/fonts/helvetiker_regular.typeface.json +0 -1
- package/examples/fonts/optimer_bold.typeface.json +0 -1
- package/examples/fonts/optimer_regular.typeface.json +0 -1
- package/examples/fonts/ttf/README.md +0 -9
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/inspector/extensions/extensions.json +0 -6
- package/examples/jsm/libs/ammo.wasm.js +0 -822
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +0 -33
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
- package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
- package/examples/jsm/libs/opentype.module.js +0 -14506
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lighting/TiledLighting.js +0 -42
- package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
- package/src/nodes/accessors/BatchNode.js +0 -163
- package/src/nodes/accessors/InstanceNode.js +0 -349
- package/src/nodes/accessors/InstancedMeshNode.js +0 -50
- package/src/nodes/accessors/SkinningNode.js +0 -328
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Color } from '../../math/Color.js';
|
|
2
|
+
import { Box2 } from '../../math/Box2.js';
|
|
3
|
+
import { Vector2 } from '../../math/Vector2.js';
|
|
2
4
|
import { Path } from './Path.js';
|
|
3
5
|
import { Shape } from './Shape.js';
|
|
4
6
|
import { ShapeUtils } from '../ShapeUtils.js';
|
|
7
|
+
import { warn } from '../../utils.js';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* This class is used to convert a series of paths to an array of
|
|
@@ -39,6 +42,14 @@ class ShapePath {
|
|
|
39
42
|
*/
|
|
40
43
|
this.currentPath = null;
|
|
41
44
|
|
|
45
|
+
/**
|
|
46
|
+
* An object that can be used to store custom data about the shape path.
|
|
47
|
+
* Mainly used by SVGLoader to store style information.
|
|
48
|
+
*
|
|
49
|
+
* @type {Object}
|
|
50
|
+
*/
|
|
51
|
+
this.userData = {};
|
|
52
|
+
|
|
42
53
|
}
|
|
43
54
|
|
|
44
55
|
/**
|
|
@@ -130,235 +141,213 @@ class ShapePath {
|
|
|
130
141
|
/**
|
|
131
142
|
* Converts the paths into an array of shapes.
|
|
132
143
|
*
|
|
133
|
-
* @param {boolean} isCCW - By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
|
|
134
|
-
* If this flag is set to `true`, then those are flipped.
|
|
135
144
|
* @return {Array<Shape>} An array of shapes.
|
|
136
145
|
*/
|
|
137
|
-
toShapes(
|
|
146
|
+
toShapes() {
|
|
138
147
|
|
|
139
|
-
|
|
148
|
+
// Point-in-polygon test using the even-odd ray-casting rule. Valid for
|
|
149
|
+
// simple (non self-intersecting) polygons.
|
|
150
|
+
function pointInPolygon( p, polygon ) {
|
|
140
151
|
|
|
141
|
-
|
|
152
|
+
let inside = false;
|
|
153
|
+
const n = polygon.length;
|
|
154
|
+
|
|
155
|
+
for ( let i = 0, j = n - 1; i < n; j = i ++ ) {
|
|
142
156
|
|
|
143
|
-
|
|
157
|
+
const a = polygon[ i ];
|
|
158
|
+
const b = polygon[ j ];
|
|
144
159
|
|
|
145
|
-
|
|
160
|
+
if ( ( a.y > p.y ) !== ( b.y > p.y ) &&
|
|
161
|
+
p.x < ( b.x - a.x ) * ( p.y - a.y ) / ( b.y - a.y ) + a.x ) {
|
|
146
162
|
|
|
147
|
-
|
|
148
|
-
tmpShape.curves = tmpPath.curves;
|
|
163
|
+
inside = ! inside;
|
|
149
164
|
|
|
150
|
-
|
|
165
|
+
}
|
|
151
166
|
|
|
152
167
|
}
|
|
153
168
|
|
|
154
|
-
return
|
|
169
|
+
return inside;
|
|
155
170
|
|
|
156
171
|
}
|
|
157
172
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
let inside = false;
|
|
167
|
-
for ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
|
|
168
|
-
|
|
169
|
-
let edgeLowPt = inPolygon[ p ];
|
|
170
|
-
let edgeHighPt = inPolygon[ q ];
|
|
171
|
-
|
|
172
|
-
let edgeDx = edgeHighPt.x - edgeLowPt.x;
|
|
173
|
-
let edgeDy = edgeHighPt.y - edgeLowPt.y;
|
|
174
|
-
|
|
175
|
-
if ( Math.abs( edgeDy ) > Number.EPSILON ) {
|
|
176
|
-
|
|
177
|
-
// not parallel
|
|
178
|
-
if ( edgeDy < 0 ) {
|
|
179
|
-
|
|
180
|
-
edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;
|
|
181
|
-
edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;
|
|
173
|
+
// Returns a point guaranteed to be strictly inside the given simple
|
|
174
|
+
// polygon. First tries the bounding-box center; if that falls outside
|
|
175
|
+
// the polygon, casts a horizontal ray at the center's y and picks the
|
|
176
|
+
// midpoint between the first two sorted intercepts.
|
|
177
|
+
//
|
|
178
|
+
// Port of paper.js' Path#getInteriorPoint()
|
|
179
|
+
// https://github.com/paperjs/paper.js/blob/develop/src/path/PathItem.Boolean.js
|
|
180
|
+
function getInteriorPoint( polygon, boundingBox ) {
|
|
182
181
|
|
|
183
|
-
|
|
182
|
+
const point = boundingBox.getCenter( new Vector2() );
|
|
184
183
|
|
|
185
|
-
|
|
184
|
+
if ( pointInPolygon( point, polygon ) ) return point;
|
|
186
185
|
|
|
187
|
-
|
|
186
|
+
const y = point.y;
|
|
187
|
+
const intercepts = [];
|
|
188
|
+
const n = polygon.length;
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
// continue; // no intersection or edgeLowPt => doesn't count !!!
|
|
190
|
+
for ( let i = 0; i < n; i ++ ) {
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
const a = polygon[ i ];
|
|
193
|
+
const b = polygon[ ( i + 1 ) % n ];
|
|
193
194
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
inside = ! inside; // true intersection left of inPt
|
|
195
|
+
// Half-open crossing rule — counts each vertex exactly once and
|
|
196
|
+
// skips horizontal edges.
|
|
197
|
+
if ( ( a.y > y ) !== ( b.y > y ) ) {
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
} else {
|
|
202
|
-
|
|
203
|
-
// parallel or collinear
|
|
204
|
-
if ( inPt.y !== edgeLowPt.y ) continue; // parallel
|
|
205
|
-
// edge lies on the same horizontal line as inPt
|
|
206
|
-
if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||
|
|
207
|
-
( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour !
|
|
208
|
-
// continue;
|
|
199
|
+
const x = a.x + ( y - a.y ) * ( b.x - a.x ) / ( b.y - a.y );
|
|
200
|
+
intercepts.push( x );
|
|
209
201
|
|
|
210
202
|
}
|
|
211
203
|
|
|
212
204
|
}
|
|
213
205
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
206
|
+
if ( intercepts.length > 1 ) {
|
|
217
207
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const subPaths = this.subPaths;
|
|
221
|
-
if ( subPaths.length === 0 ) return [];
|
|
222
|
-
|
|
223
|
-
let solid, tmpPath, tmpShape;
|
|
224
|
-
const shapes = [];
|
|
208
|
+
intercepts.sort( ( a, b ) => a - b );
|
|
209
|
+
point.x = ( intercepts[ 0 ] + intercepts[ 1 ] ) / 2;
|
|
225
210
|
|
|
226
|
-
|
|
211
|
+
}
|
|
227
212
|
|
|
228
|
-
|
|
229
|
-
tmpShape = new Shape();
|
|
230
|
-
tmpShape.curves = tmpPath.curves;
|
|
231
|
-
shapes.push( tmpShape );
|
|
232
|
-
return shapes;
|
|
213
|
+
return point;
|
|
233
214
|
|
|
234
215
|
}
|
|
235
216
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
// log("Holes first", holesFirst);
|
|
217
|
+
// Resolve fill-rule. Defaults to 'nonzero'.
|
|
218
|
+
let fillRule = ( this.userData.style && this.userData.style.fillRule ) || 'nonzero';
|
|
240
219
|
|
|
241
|
-
|
|
242
|
-
const newShapes = [];
|
|
243
|
-
let newShapeHoles = [];
|
|
244
|
-
let mainIdx = 0;
|
|
245
|
-
let tmpPoints;
|
|
220
|
+
if ( fillRule !== 'nonzero' && fillRule !== 'evenodd' ) {
|
|
246
221
|
|
|
247
|
-
|
|
248
|
-
|
|
222
|
+
warn( 'Fill-rule "' + fillRule + '" is not supported, falling back to "nonzero".' );
|
|
223
|
+
fillRule = 'nonzero';
|
|
249
224
|
|
|
250
|
-
|
|
225
|
+
}
|
|
251
226
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
227
|
+
// Predicate that decides whether a winding number falls inside the fill
|
|
228
|
+
// region, per the SVG fill-rule spec. Works for negative windings too,
|
|
229
|
+
// because JavaScript's bitwise AND preserves odd/even under two's
|
|
230
|
+
// complement.
|
|
231
|
+
const isInside = fillRule === 'nonzero'
|
|
232
|
+
? ( w => w !== 0 )
|
|
233
|
+
: ( w => ( w & 1 ) !== 0 );
|
|
234
|
+
|
|
235
|
+
// Build an entry per usable subpath. Self-winding follows the standard
|
|
236
|
+
// convention used by ShapeUtils: counter-clockwise (signed area > 0)
|
|
237
|
+
// contributes +1 to the winding number at an interior point,
|
|
238
|
+
// clockwise contributes -1.
|
|
239
|
+
const entries = [];
|
|
240
|
+
|
|
241
|
+
for ( const subPath of this.subPaths ) {
|
|
242
|
+
|
|
243
|
+
const points = subPath.getPoints();
|
|
244
|
+
if ( points.length < 3 ) continue;
|
|
245
|
+
|
|
246
|
+
const area = ShapeUtils.area( points );
|
|
247
|
+
if ( area === 0 ) continue;
|
|
248
|
+
|
|
249
|
+
const boundingBox = new Box2();
|
|
250
|
+
for ( let i = 0; i < points.length; i ++ ) boundingBox.expandByPoint( points[ i ] );
|
|
251
|
+
|
|
252
|
+
entries.push( {
|
|
253
|
+
subPath: subPath,
|
|
254
|
+
points: points,
|
|
255
|
+
boundingBox: boundingBox,
|
|
256
|
+
interiorPoint: getInteriorPoint( points, boundingBox ),
|
|
257
|
+
absArea: Math.abs( area ),
|
|
258
|
+
winding: area < 0 ? - 1 : 1,
|
|
259
|
+
container: null,
|
|
260
|
+
exclude: false,
|
|
261
|
+
role: null
|
|
262
|
+
} );
|
|
256
263
|
|
|
257
|
-
|
|
264
|
+
}
|
|
258
265
|
|
|
259
|
-
|
|
266
|
+
// Sort by area descending. This guarantees that any subpath that could
|
|
267
|
+
// contain `entries[i]` is located at a smaller index and has already
|
|
268
|
+
// been processed when it's entries[i]'s turn. Port of paper.js'
|
|
269
|
+
// reorientPaths() algorithm.
|
|
270
|
+
entries.sort( ( a, b ) => b.absArea - a.absArea );
|
|
260
271
|
|
|
261
|
-
|
|
262
|
-
|
|
272
|
+
// Walk already-processed entries from closest-in-size to largest,
|
|
273
|
+
// stopping at the innermost container. Accumulate the container's
|
|
274
|
+
// cumulative winding into this entry's winding so that the final value
|
|
275
|
+
// equals the winding number at this entry's interior point.
|
|
276
|
+
//
|
|
277
|
+
// A subpath only contributes to the fill boundary when crossing it
|
|
278
|
+
// actually flips the "insideness" per the fill rule; otherwise it's a
|
|
279
|
+
// redundant overlap and gets excluded to avoid double-counting.
|
|
280
|
+
for ( let i = 0; i < entries.length; i ++ ) {
|
|
263
281
|
|
|
264
|
-
|
|
265
|
-
|
|
282
|
+
const entry = entries[ i ];
|
|
283
|
+
let containerWinding = 0;
|
|
266
284
|
|
|
267
|
-
|
|
285
|
+
for ( let j = i - 1; j >= 0; j -- ) {
|
|
268
286
|
|
|
269
|
-
|
|
287
|
+
const candidate = entries[ j ];
|
|
270
288
|
|
|
271
|
-
|
|
289
|
+
if ( ! candidate.boundingBox.containsBox( entry.boundingBox ) ) continue;
|
|
290
|
+
if ( ! pointInPolygon( entry.interiorPoint, candidate.points ) ) continue;
|
|
272
291
|
|
|
273
|
-
|
|
292
|
+
entry.container = candidate.exclude ? candidate.container : candidate;
|
|
293
|
+
containerWinding = candidate.winding;
|
|
294
|
+
entry.winding += containerWinding;
|
|
295
|
+
break;
|
|
274
296
|
|
|
275
297
|
}
|
|
276
298
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
// only Holes? -> probably all Shapes with wrong orientation
|
|
280
|
-
if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths );
|
|
281
|
-
|
|
299
|
+
if ( isInside( entry.winding ) === isInside( containerWinding ) ) {
|
|
282
300
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
let ambiguous = false;
|
|
286
|
-
let toChange = 0;
|
|
287
|
-
|
|
288
|
-
for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
|
|
289
|
-
|
|
290
|
-
betterShapeHoles[ sIdx ] = [];
|
|
301
|
+
entry.exclude = true;
|
|
291
302
|
|
|
292
303
|
}
|
|
293
304
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
const sho = newShapeHoles[ sIdx ];
|
|
297
|
-
|
|
298
|
-
for ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {
|
|
299
|
-
|
|
300
|
-
const ho = sho[ hIdx ];
|
|
301
|
-
let hole_unassigned = true;
|
|
302
|
-
|
|
303
|
-
for ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
|
|
304
|
-
|
|
305
|
-
if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
|
|
306
|
-
|
|
307
|
-
if ( sIdx !== s2Idx ) toChange ++;
|
|
308
|
-
|
|
309
|
-
if ( hole_unassigned ) {
|
|
310
|
-
|
|
311
|
-
hole_unassigned = false;
|
|
312
|
-
betterShapeHoles[ s2Idx ].push( ho );
|
|
313
|
-
|
|
314
|
-
} else {
|
|
315
|
-
|
|
316
|
-
ambiguous = true;
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if ( hole_unassigned ) {
|
|
305
|
+
}
|
|
325
306
|
|
|
326
|
-
|
|
307
|
+
// Classify retained entries. An entry is an outer shape if it has no
|
|
308
|
+
// container or if its container is itself a hole (a solid nested inside
|
|
309
|
+
// a hole becomes a new top-level shape); otherwise it's a hole in its
|
|
310
|
+
// container. Entries were already sorted outermost-first, so each
|
|
311
|
+
// container's role is known by the time we look at it.
|
|
312
|
+
for ( const entry of entries ) {
|
|
327
313
|
|
|
328
|
-
|
|
314
|
+
if ( entry.exclude ) continue;
|
|
315
|
+
entry.role = ( entry.container === null || entry.container.role === 'hole' ) ? 'outer' : 'hole';
|
|
329
316
|
|
|
330
|
-
|
|
317
|
+
}
|
|
331
318
|
|
|
332
|
-
|
|
319
|
+
// Build Shapes for outers first, then attach holes to their container's
|
|
320
|
+
// Shape.
|
|
321
|
+
const shapes = [];
|
|
322
|
+
const shapeByEntry = new Map();
|
|
333
323
|
|
|
334
|
-
|
|
324
|
+
for ( const entry of entries ) {
|
|
335
325
|
|
|
336
|
-
|
|
326
|
+
if ( entry.exclude || entry.role !== 'outer' ) continue;
|
|
337
327
|
|
|
338
|
-
|
|
328
|
+
const shape = new Shape();
|
|
329
|
+
shape.curves = entry.subPath.curves;
|
|
330
|
+
shapes.push( shape );
|
|
331
|
+
shapeByEntry.set( entry, shape );
|
|
339
332
|
|
|
340
333
|
}
|
|
341
334
|
|
|
342
|
-
|
|
335
|
+
for ( const entry of entries ) {
|
|
343
336
|
|
|
344
|
-
|
|
337
|
+
if ( entry.exclude || entry.role !== 'hole' ) continue;
|
|
345
338
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
tmpHoles = newShapeHoles[ i ];
|
|
339
|
+
const shape = shapeByEntry.get( entry.container );
|
|
340
|
+
if ( ! shape ) continue;
|
|
349
341
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
342
|
+
const hole = new Path();
|
|
343
|
+
hole.curves = entry.subPath.curves;
|
|
344
|
+
shape.holes.push( hole );
|
|
355
345
|
|
|
356
346
|
}
|
|
357
347
|
|
|
358
|
-
//log("shape", shapes);
|
|
359
|
-
|
|
360
348
|
return shapes;
|
|
361
349
|
|
|
350
|
+
|
|
362
351
|
}
|
|
363
352
|
|
|
364
353
|
}
|
|
@@ -76,6 +76,10 @@ class SphereGeometry extends BufferGeometry {
|
|
|
76
76
|
const verticesRow = [];
|
|
77
77
|
|
|
78
78
|
const v = iy / heightSegments;
|
|
79
|
+
const theta = thetaStart + v * thetaLength;
|
|
80
|
+
|
|
81
|
+
const y = radius * Math.cos( theta );
|
|
82
|
+
const ringRadius = Math.sqrt( radius * radius - y * y );
|
|
79
83
|
|
|
80
84
|
// special case for the poles
|
|
81
85
|
|
|
@@ -94,12 +98,13 @@ class SphereGeometry extends BufferGeometry {
|
|
|
94
98
|
for ( let ix = 0; ix <= widthSegments; ix ++ ) {
|
|
95
99
|
|
|
96
100
|
const u = ix / widthSegments;
|
|
101
|
+
const phi = phiStart + u * phiLength;
|
|
97
102
|
|
|
98
103
|
// vertex
|
|
99
104
|
|
|
100
|
-
vertex.x = -
|
|
101
|
-
vertex.y =
|
|
102
|
-
vertex.z =
|
|
105
|
+
vertex.x = - ringRadius * Math.cos( phi );
|
|
106
|
+
vertex.y = y;
|
|
107
|
+
vertex.z = ringRadius * Math.sin( phi );
|
|
103
108
|
|
|
104
109
|
vertices.push( vertex.x, vertex.y, vertex.z );
|
|
105
110
|
|
|
@@ -125,7 +125,7 @@ class SpotLightHelper extends Object3D {
|
|
|
125
125
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
this.
|
|
128
|
+
this.matrixWorldNeedsUpdate = true;
|
|
129
129
|
|
|
130
130
|
const coneLength = this.light.distance ? this.light.distance : 1000;
|
|
131
131
|
const coneWidth = coneLength * Math.tan( this.light.angle );
|
|
@@ -74,77 +74,108 @@ class DataTextureLoader extends Loader {
|
|
|
74
74
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
scope._applyTexData( texture, texData );
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
if ( onLoad ) onLoad( texture, texData );
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
}, onProgress, onError );
|
|
82
82
|
|
|
83
|
-
texture.image.width = texData.width;
|
|
84
|
-
texture.image.height = texData.height;
|
|
85
|
-
texture.image.data = texData.data;
|
|
86
83
|
|
|
87
|
-
|
|
84
|
+
return texture;
|
|
88
85
|
|
|
89
|
-
|
|
90
|
-
texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
|
|
86
|
+
}
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Parses the given buffer and returns a configured data texture. Use this method
|
|
90
|
+
* for parsing texture data that is already in memory (e.g. drag and drop or data
|
|
91
|
+
* loaded from a server) without going through {@link DataTextureLoader#load}.
|
|
92
|
+
*
|
|
93
|
+
* @param {ArrayBuffer} buffer - The raw texture data.
|
|
94
|
+
* @return {DataTexture} The data texture.
|
|
95
|
+
*/
|
|
96
|
+
createDataTexture( buffer ) {
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
const texture = new DataTexture();
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
this._applyTexData( texture, this.parse( buffer ) );
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
return texture;
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
}
|
|
102
105
|
|
|
103
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Applies the given parsed texture data to the given data texture.
|
|
108
|
+
*
|
|
109
|
+
* @private
|
|
110
|
+
* @param {DataTexture} texture - The data texture.
|
|
111
|
+
* @param {DataTextureLoader~TexData} texData - The parsed texture data.
|
|
112
|
+
*/
|
|
113
|
+
_applyTexData( texture, texData ) {
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
if ( texData.image !== undefined ) {
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
texture.image = texData.image;
|
|
108
118
|
|
|
109
|
-
|
|
119
|
+
} else if ( texData.data !== undefined ) {
|
|
110
120
|
|
|
111
|
-
|
|
121
|
+
texture.image.width = texData.width;
|
|
122
|
+
texture.image.height = texData.height;
|
|
123
|
+
texture.image.data = texData.data;
|
|
112
124
|
|
|
113
|
-
|
|
125
|
+
}
|
|
114
126
|
|
|
115
|
-
|
|
127
|
+
texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
|
|
128
|
+
texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
|
|
116
129
|
|
|
117
|
-
|
|
130
|
+
texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
|
|
131
|
+
texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
|
|
118
132
|
|
|
119
|
-
|
|
133
|
+
texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
|
|
120
134
|
|
|
121
|
-
|
|
135
|
+
if ( texData.colorSpace !== undefined ) {
|
|
122
136
|
|
|
123
|
-
|
|
124
|
-
texture.minFilter = LinearMipmapLinearFilter; // presumably...
|
|
137
|
+
texture.colorSpace = texData.colorSpace;
|
|
125
138
|
|
|
126
|
-
|
|
139
|
+
}
|
|
127
140
|
|
|
128
|
-
|
|
141
|
+
if ( texData.flipY !== undefined ) {
|
|
129
142
|
|
|
130
|
-
|
|
143
|
+
texture.flipY = texData.flipY;
|
|
131
144
|
|
|
132
|
-
|
|
145
|
+
}
|
|
133
146
|
|
|
134
|
-
|
|
147
|
+
if ( texData.format !== undefined ) {
|
|
135
148
|
|
|
136
|
-
|
|
149
|
+
texture.format = texData.format;
|
|
137
150
|
|
|
138
|
-
|
|
151
|
+
}
|
|
139
152
|
|
|
140
|
-
|
|
153
|
+
if ( texData.type !== undefined ) {
|
|
141
154
|
|
|
142
|
-
|
|
155
|
+
texture.type = texData.type;
|
|
143
156
|
|
|
144
|
-
}
|
|
157
|
+
}
|
|
145
158
|
|
|
159
|
+
if ( texData.mipmaps !== undefined ) {
|
|
146
160
|
|
|
147
|
-
|
|
161
|
+
texture.mipmaps = texData.mipmaps;
|
|
162
|
+
texture.minFilter = LinearMipmapLinearFilter; // presumably...
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if ( texData.mipmapCount === 1 ) {
|
|
167
|
+
|
|
168
|
+
texture.minFilter = LinearFilter;
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if ( texData.generateMipmaps !== undefined ) {
|
|
173
|
+
|
|
174
|
+
texture.generateMipmaps = texData.generateMipmaps;
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
texture.needsUpdate = true;
|
|
148
179
|
|
|
149
180
|
}
|
|
150
181
|
|
|
@@ -156,6 +156,11 @@ class LoadingManager {
|
|
|
156
156
|
*/
|
|
157
157
|
this.resolveURL = function ( url ) {
|
|
158
158
|
|
|
159
|
+
// Normalize to NFC so that Unicode URIs (e.g. from glTF)
|
|
160
|
+
// are percent-encoded correctly per RFC 3987.
|
|
161
|
+
|
|
162
|
+
url = url.normalize( 'NFC' );
|
|
163
|
+
|
|
159
164
|
if ( urlModifier ) {
|
|
160
165
|
|
|
161
166
|
return urlModifier( url );
|