super-three 0.147.0 → 0.152.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/LICENSE +1 -1
- package/build/three.cjs +36408 -21117
- package/build/three.js +37007 -21715
- package/build/three.min.js +3 -2
- package/build/three.module.js +6387 -5510
- package/build/three.module.min.js +6 -0
- package/examples/jsm/animation/AnimationClipCreator.js +5 -3
- package/examples/jsm/capabilities/WebGPU.js +2 -4
- package/examples/jsm/controls/ArcballControls.js +1828 -1821
- package/examples/jsm/controls/MapControls.js +28 -0
- package/examples/jsm/controls/OrbitControls.js +20 -45
- package/examples/jsm/controls/PointerLockControls.js +70 -65
- package/examples/jsm/controls/TrackballControls.js +18 -4
- package/examples/jsm/controls/TransformControls.js +0 -1
- package/examples/jsm/csm/CSM.js +11 -3
- package/examples/jsm/csm/CSMShader.js +7 -6
- package/examples/jsm/effects/AsciiEffect.js +3 -6
- package/examples/jsm/effects/OutlineEffect.js +1 -15
- package/examples/jsm/exporters/ColladaExporter.js +26 -14
- package/examples/jsm/exporters/DRACOExporter.js +53 -11
- package/examples/jsm/exporters/EXRExporter.js +3 -9
- package/examples/jsm/exporters/GLTFExporter.js +524 -111
- package/examples/jsm/exporters/KTX2Exporter.js +34 -23
- package/examples/jsm/exporters/MMDExporter.js +1 -1
- package/examples/jsm/exporters/PLYExporter.js +8 -1
- package/examples/jsm/exporters/STLExporter.js +8 -4
- package/examples/jsm/exporters/USDZExporter.js +22 -3
- package/examples/jsm/geometries/ConvexGeometry.js +0 -6
- package/examples/jsm/geometries/ParametricGeometry.js +10 -0
- package/examples/jsm/helpers/OctreeHelper.js +1 -0
- package/examples/jsm/helpers/ViewHelper.js +70 -56
- package/examples/jsm/interactive/HTMLMesh.js +16 -3
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/{js → jsm}/libs/basis/README.md +4 -4
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/lil-gui.module.min.js +2 -2
- package/examples/jsm/libs/tween.module.js +803 -0
- package/examples/jsm/lights/IESSpotLight.js +25 -0
- package/examples/jsm/lights/LightProbeGenerator.js +11 -9
- package/examples/jsm/lines/LineSegments2.js +12 -10
- package/examples/jsm/loaders/3DMLoader.js +8 -5
- package/examples/jsm/loaders/3MFLoader.js +12 -11
- package/examples/jsm/loaders/AMFLoader.js +2 -3
- package/examples/jsm/loaders/BVHLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +15 -16
- package/examples/jsm/loaders/DRACOLoader.js +67 -18
- package/examples/jsm/loaders/EXRLoader.js +23 -24
- package/examples/jsm/loaders/FBXLoader.js +32 -50
- package/examples/jsm/loaders/GCodeLoader.js +1 -2
- package/examples/jsm/loaders/GLTFLoader.js +249 -215
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +4 -4
- package/examples/jsm/loaders/IESLoader.js +337 -0
- package/examples/jsm/loaders/KMZLoader.js +4 -4
- package/examples/jsm/loaders/KTX2Loader.js +41 -24
- package/examples/jsm/loaders/LDrawLoader.js +20 -18
- package/examples/jsm/loaders/LWOLoader.js +12 -29
- package/examples/jsm/loaders/LottieLoader.js +3 -1
- package/examples/jsm/loaders/MMDLoader.js +17 -13
- package/examples/jsm/loaders/MTLLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +9 -3
- package/examples/jsm/loaders/NRRDLoader.js +33 -5
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PCDLoader.js +1 -2
- package/examples/jsm/loaders/PLYLoader.js +238 -105
- package/examples/jsm/loaders/RGBELoader.js +3 -3
- package/examples/jsm/loaders/STLLoader.js +1 -2
- package/examples/jsm/loaders/SVGLoader.js +36 -27
- package/examples/jsm/loaders/TTFLoader.js +1 -8
- package/examples/jsm/loaders/TiltLoader.js +13 -7
- package/examples/jsm/loaders/USDZLoader.js +5 -5
- package/examples/jsm/loaders/VOXLoader.js +8 -2
- package/examples/jsm/loaders/VRMLLoader.js +5 -13
- package/examples/jsm/loaders/VTKLoader.js +7 -6
- package/examples/jsm/loaders/lwo/IFFParser.js +19 -19
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -3
- package/examples/jsm/math/MeshSurfaceSampler.js +0 -6
- package/examples/jsm/misc/ConvexObjectBreaker.js +2 -8
- package/examples/jsm/misc/GPUComputationRenderer.js +5 -5
- package/examples/jsm/misc/MD2Character.js +2 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +2 -2
- package/examples/jsm/misc/ProgressiveLightMap.js +12 -10
- package/examples/jsm/misc/RollerCoaster.js +7 -1
- package/examples/jsm/misc/Volume.js +20 -5
- package/examples/jsm/modifiers/CurveModifier.js +1 -0
- package/examples/jsm/modifiers/TessellateModifier.js +19 -19
- package/examples/jsm/nodes/Nodes.js +143 -335
- package/examples/jsm/nodes/accessors/BitangentNode.js +43 -16
- package/examples/jsm/nodes/accessors/BufferNode.js +6 -0
- package/examples/jsm/nodes/accessors/CameraNode.js +12 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +27 -33
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +58 -0
- package/examples/jsm/nodes/accessors/InstanceNode.js +17 -21
- package/examples/jsm/nodes/accessors/MaterialNode.js +155 -38
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +16 -0
- package/examples/jsm/nodes/accessors/ModelNode.js +11 -0
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -8
- package/examples/jsm/nodes/accessors/NormalNode.js +35 -19
- package/examples/jsm/nodes/accessors/Object3DNode.js +32 -12
- package/examples/jsm/nodes/accessors/PointUVNode.js +6 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +38 -23
- package/examples/jsm/nodes/accessors/ReferenceNode.js +21 -14
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +11 -7
- package/examples/jsm/nodes/accessors/SkinningNode.js +43 -40
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +6 -0
- package/examples/jsm/nodes/accessors/TangentNode.js +28 -20
- package/examples/jsm/nodes/accessors/TextureNode.js +80 -12
- package/examples/jsm/nodes/accessors/UVNode.js +6 -0
- package/examples/jsm/nodes/accessors/UserDataNode.js +6 -0
- package/examples/jsm/nodes/{core → code}/CodeNode.js +27 -2
- package/examples/jsm/nodes/code/ExpressionNode.js +37 -0
- package/examples/jsm/nodes/{core → code}/FunctionCallNode.js +15 -1
- package/examples/jsm/nodes/{core → code}/FunctionNode.js +8 -7
- package/examples/jsm/nodes/code/ScriptableNode.js +488 -0
- package/examples/jsm/nodes/code/ScriptableValueNode.js +167 -0
- package/examples/jsm/nodes/core/ArrayUniformNode.js +3 -0
- package/examples/jsm/nodes/core/AttributeNode.js +16 -8
- package/examples/jsm/nodes/core/BypassNode.js +9 -2
- package/examples/jsm/nodes/core/CacheNode.js +46 -0
- package/examples/jsm/nodes/core/ConstNode.js +3 -0
- package/examples/jsm/nodes/core/ContextNode.js +8 -1
- package/examples/jsm/nodes/core/InputNode.js +26 -5
- package/examples/jsm/nodes/core/InstanceIndexNode.js +6 -1
- package/examples/jsm/nodes/core/LightingModel.js +16 -0
- package/examples/jsm/nodes/core/Node.js +128 -34
- package/examples/jsm/nodes/core/NodeBuilder.js +209 -118
- package/examples/jsm/nodes/core/NodeCache.js +26 -0
- package/examples/jsm/nodes/core/NodeFrame.js +56 -5
- package/examples/jsm/nodes/core/NodeUtils.js +105 -28
- package/examples/jsm/nodes/core/PropertyNode.js +19 -2
- package/examples/jsm/nodes/core/StackNode.js +92 -0
- package/examples/jsm/nodes/core/TempNode.js +11 -3
- package/examples/jsm/nodes/core/UniformNode.js +15 -0
- package/examples/jsm/nodes/core/VarNode.js +21 -29
- package/examples/jsm/nodes/core/VaryingNode.js +15 -2
- package/examples/jsm/nodes/core/constants.js +6 -0
- package/examples/jsm/nodes/display/BlendModeNode.js +25 -11
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +30 -14
- package/examples/jsm/nodes/display/ColorSpaceNode.js +39 -27
- package/examples/jsm/nodes/display/FrontFacingNode.js +7 -1
- package/examples/jsm/nodes/display/NormalMapNode.js +31 -18
- package/examples/jsm/nodes/display/PosterizeNode.js +10 -3
- package/examples/jsm/nodes/display/ToneMappingNode.js +92 -11
- package/examples/jsm/nodes/display/ViewportNode.js +27 -18
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +30 -0
- package/examples/jsm/nodes/display/ViewportTextureNode.js +61 -0
- package/examples/jsm/nodes/fog/FogExp2Node.js +35 -0
- package/examples/jsm/nodes/fog/FogNode.js +12 -6
- package/examples/jsm/nodes/fog/FogRangeNode.js +12 -5
- package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +30 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -13
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +8 -6
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +4 -4
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +3 -3
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +7 -5
- package/examples/jsm/nodes/functions/PhongLightingModel.js +28 -0
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +33 -36
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +4 -3
- package/examples/jsm/nodes/functions/material/getRoughness.js +4 -4
- package/examples/jsm/nodes/geometry/RangeNode.js +32 -19
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +9 -2
- package/examples/jsm/nodes/lighting/AONode.js +5 -3
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +27 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +112 -6
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +43 -0
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +104 -34
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +15 -10
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +39 -0
- package/examples/jsm/nodes/lighting/LightNode.js +57 -0
- package/examples/jsm/nodes/lighting/LightUtils.js +17 -0
- package/examples/jsm/nodes/lighting/LightingContextNode.js +30 -8
- package/examples/jsm/nodes/lighting/LightingNode.js +3 -1
- package/examples/jsm/nodes/lighting/LightsNode.js +18 -10
- package/examples/jsm/nodes/lighting/PointLightNode.js +71 -0
- package/examples/jsm/nodes/lighting/SpotLightNode.js +92 -0
- package/examples/jsm/nodes/loaders/NodeLoader.js +5 -4
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +4 -20
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +6 -9
- package/examples/jsm/nodes/materials/Materials.js +11 -55
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +5 -11
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +48 -0
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +74 -0
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +21 -96
- package/examples/jsm/nodes/materials/NodeMaterial.js +244 -61
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +7 -1
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +29 -25
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +31 -22
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +1 -1
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +2 -1
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +2 -1
- package/examples/jsm/nodes/math/CondNode.js +43 -17
- package/examples/jsm/nodes/math/MathNode.js +178 -73
- package/examples/jsm/nodes/math/OperatorNode.js +52 -2
- package/examples/jsm/nodes/procedural/CheckerNode.js +14 -6
- package/examples/jsm/nodes/shadernode/ShaderNode.js +158 -42
- package/examples/jsm/nodes/utils/ArrayElementNode.js +4 -2
- package/examples/jsm/nodes/utils/ConvertNode.js +19 -1
- package/examples/jsm/nodes/utils/DiscardNode.js +26 -0
- package/examples/jsm/nodes/utils/EquirectUVNode.js +11 -4
- package/examples/jsm/nodes/utils/JoinNode.js +4 -1
- package/examples/jsm/nodes/utils/MatcapUVNode.js +11 -4
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +18 -5
- package/examples/jsm/nodes/utils/OscNode.js +21 -14
- package/examples/jsm/nodes/utils/PackingNode.js +55 -0
- package/examples/jsm/nodes/utils/RemapNode.js +13 -5
- package/examples/jsm/nodes/utils/RotateUVNode.js +18 -7
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +37 -0
- package/examples/jsm/nodes/utils/SplitNode.js +7 -5
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +15 -30
- package/examples/jsm/nodes/utils/TimerNode.js +16 -6
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +21 -10
- package/examples/jsm/objects/GroundProjectedSkybox.js +172 -0
- package/examples/jsm/objects/Reflector.js +4 -4
- package/examples/jsm/objects/Refractor.js +4 -4
- package/examples/jsm/objects/ShadowMesh.js +3 -3
- package/examples/jsm/physics/AmmoPhysics.js +27 -28
- package/examples/jsm/physics/{OimoPhysics.js → RapierPhysics.js} +59 -51
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +0 -8
- package/examples/jsm/postprocessing/AfterimagePass.js +0 -2
- package/examples/jsm/postprocessing/BloomPass.js +0 -2
- package/examples/jsm/postprocessing/BokehPass.js +0 -6
- package/examples/jsm/postprocessing/DotScreenPass.js +0 -2
- package/examples/jsm/postprocessing/EffectComposer.js +3 -94
- package/examples/jsm/postprocessing/FilmPass.js +0 -2
- package/examples/jsm/postprocessing/GlitchPass.js +0 -2
- package/examples/jsm/postprocessing/HalftonePass.js +0 -6
- package/examples/jsm/postprocessing/OutlinePass.js +0 -1
- package/examples/jsm/postprocessing/Pass.js +2 -0
- package/examples/jsm/postprocessing/SAOPass.js +0 -24
- package/examples/jsm/postprocessing/SMAAPass.js +0 -6
- package/examples/jsm/postprocessing/SSAARenderPass.js +13 -5
- package/examples/jsm/postprocessing/SSAOPass.js +0 -12
- package/examples/jsm/postprocessing/SSRPass.js +0 -6
- package/examples/jsm/postprocessing/SavePass.js +0 -2
- package/examples/jsm/postprocessing/TexturePass.js +0 -2
- package/examples/jsm/postprocessing/UnrealBloomPass.js +0 -8
- package/examples/jsm/renderers/CSS2DRenderer.js +6 -1
- package/examples/jsm/renderers/CSS3DRenderer.js +27 -5
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +35 -31
- package/examples/jsm/renderers/webgpu/WebGPUAnimation.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +14 -4
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +72 -55
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +34 -19
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUGeometries.js +158 -26
- package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUProperties.js +6 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderLists.js +30 -14
- package/examples/jsm/renderers/webgpu/WebGPURenderObject.js +40 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderObjects.js +50 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +49 -111
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +40 -62
- package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +14 -26
- package/examples/jsm/renderers/webgpu/WebGPURenderTarget.js +15 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +244 -100
- package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +3 -1
- package/examples/jsm/renderers/webgpu/WebGPUTextureRenderer.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +2 -0
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +366 -110
- package/examples/jsm/renderers/webgpu/WebGPUUniformsGroup.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUUtils.js +13 -6
- package/examples/jsm/renderers/webgpu/WebGPUWeakMap.js +83 -0
- package/examples/jsm/renderers/webgpu/constants.js +68 -6
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +74 -57
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +241 -22
- package/examples/jsm/shaders/MMDToonShader.js +15 -4
- package/examples/jsm/shaders/RGBShiftShader.js +2 -2
- package/examples/jsm/shaders/VelocityShader.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +37 -35
- package/examples/jsm/utils/LDrawUtils.js +4 -4
- package/examples/jsm/utils/PackedPhongMaterial.js +5 -78
- package/examples/jsm/utils/SceneUtils.js +8 -4
- package/examples/jsm/utils/SkeletonUtils.js +27 -210
- package/examples/jsm/webxr/VRButton.js +1 -2
- package/examples/jsm/webxr/XRButton.js +198 -0
- package/package.json +33 -87
- package/src/Three.Legacy.js +19 -110
- package/src/Three.js +4 -3
- package/src/animation/AnimationUtils.js +13 -1
- package/src/animation/PropertyBinding.js +2 -2
- package/src/audio/Audio.js +7 -2
- package/src/constants.js +10 -2
- package/src/core/BufferAttribute.js +147 -8
- package/src/core/BufferGeometry.js +3 -9
- package/src/core/GLBufferAttribute.js +2 -0
- package/src/core/InterleavedBufferAttribute.js +1 -1
- package/src/core/Object3D.js +36 -7
- package/src/extras/DataUtils.js +7 -1
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +5 -5
- package/src/extras/curves/LineCurve.js +6 -4
- package/src/extras/curves/LineCurve3.js +13 -0
- package/src/geometries/BoxGeometry.js +10 -0
- package/src/geometries/CircleGeometry.js +11 -1
- package/src/geometries/ConeGeometry.js +1 -1
- package/src/geometries/CylinderGeometry.js +11 -1
- package/src/geometries/EdgesGeometry.js +10 -0
- package/src/geometries/ExtrudeGeometry.js +11 -1
- package/src/geometries/LatheGeometry.js +10 -0
- package/src/geometries/PlaneGeometry.js +10 -0
- package/src/geometries/PolyhedronGeometry.js +10 -0
- package/src/geometries/RingGeometry.js +11 -1
- package/src/geometries/ShapeGeometry.js +10 -0
- package/src/geometries/SphereGeometry.js +12 -2
- package/src/geometries/TorusGeometry.js +11 -1
- package/src/geometries/TorusKnotGeometry.js +10 -0
- package/src/geometries/TubeGeometry.js +10 -0
- package/src/geometries/WireframeGeometry.js +10 -0
- package/src/helpers/Box3Helper.js +1 -2
- package/src/lights/DirectionalLight.js +1 -1
- package/src/lights/HemisphereLight.js +1 -1
- package/src/lights/SpotLight.js +1 -1
- package/src/loaders/AudioLoader.js +14 -8
- package/src/loaders/DataTextureLoader.js +5 -1
- package/src/loaders/MaterialLoader.js +4 -0
- package/src/loaders/ObjectLoader.js +9 -2
- package/src/materials/LineBasicMaterial.js +4 -0
- package/src/materials/Material.js +6 -3
- package/src/materials/MeshDistanceMaterial.js +0 -9
- package/src/materials/ShaderMaterial.js +6 -1
- package/src/math/Box2.js +3 -2
- package/src/math/Box3.js +49 -64
- package/src/math/Color.js +72 -55
- package/src/math/ColorManagement.js +75 -16
- package/src/math/Euler.js +2 -11
- package/src/math/Frustum.js +13 -3
- package/src/math/MathUtils.js +27 -1
- package/src/math/Plane.js +2 -2
- package/src/math/Quaternion.js +6 -0
- package/src/math/Ray.js +7 -7
- package/src/math/Triangle.js +37 -7
- package/src/math/Vector2.js +16 -0
- package/src/math/Vector3.js +10 -0
- package/src/math/interpolants/CubicInterpolant.js +1 -2
- package/src/objects/InstancedMesh.js +79 -1
- package/src/objects/Mesh.js +101 -73
- package/src/objects/SkinnedMesh.js +95 -8
- package/src/objects/Sprite.js +1 -1
- package/src/renderers/WebGLCubeRenderTarget.js +12 -3
- package/src/renderers/WebGLMultipleRenderTargets.js +4 -2
- package/src/renderers/WebGLRenderTarget.js +14 -2
- package/src/renderers/WebGLRenderer.js +1340 -1258
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +0 -271
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +5 -5
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +2 -10
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +5 -5
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -11
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +13 -13
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +256 -10
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +1 -11
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +10 -2
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +32 -10
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +5 -13
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +7 -7
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +11 -5
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +4 -11
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +39 -34
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +91 -11
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +108 -1
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +128 -6
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +111 -1
- package/src/renderers/shaders/ShaderChunk.js +0 -6
- package/src/renderers/shaders/ShaderLib/background.glsl.js +0 -8
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +5 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -4
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -3
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +3 -3
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -3
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +8 -12
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -3
- package/src/renderers/shaders/ShaderLib/points.glsl.js +13 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +5 -0
- package/src/renderers/shaders/ShaderLib.js +15 -4
- package/src/renderers/shaders/UniformsLib.js +25 -15
- package/src/renderers/shaders/UniformsUtils.js +12 -3
- package/src/renderers/webgl/WebGLBackground.js +23 -12
- package/src/renderers/webgl/WebGLCapabilities.js +1 -2
- package/src/renderers/webgl/WebGLClipping.js +7 -3
- package/src/renderers/webgl/WebGLLights.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +105 -234
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -1
- package/src/renderers/webgl/WebGLProgram.js +111 -48
- package/src/renderers/webgl/WebGLPrograms.js +200 -129
- package/src/renderers/webgl/WebGLRenderStates.js +2 -2
- package/src/renderers/webgl/WebGLShadowMap.js +40 -27
- package/src/renderers/webgl/WebGLState.js +23 -9
- package/src/renderers/webgl/WebGLTextures.js +21 -19
- package/src/renderers/webgl/WebGLUniformsGroups.js +74 -33
- package/src/renderers/webgl/WebGLUtils.js +41 -29
- package/src/renderers/webxr/WebXRController.js +3 -0
- package/src/renderers/webxr/WebXRManager.js +70 -48
- package/src/scenes/Scene.js +4 -6
- package/src/textures/CompressedTexture.js +2 -2
- package/src/textures/CubeTexture.js +2 -2
- package/src/textures/DataTexture.js +2 -2
- package/src/textures/Texture.js +41 -12
- package/src/utils.js +13 -1
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
- package/examples/fonts/open-sans/open-sans.css +0 -9
- package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +0 -3966
- package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
- package/examples/fonts/tabler-icons/tabler-icons.min.css +0 -4
- package/examples/js/animation/AnimationClipCreator.js +0 -89
- package/examples/js/animation/CCDIKSolver.js +0 -416
- package/examples/js/animation/MMDAnimationHelper.js +0 -1046
- package/examples/js/animation/MMDPhysics.js +0 -1174
- package/examples/js/cameras/CinematicCamera.js +0 -168
- package/examples/js/controls/ArcballControls.js +0 -2770
- package/examples/js/controls/DragControls.js +0 -205
- package/examples/js/controls/FirstPersonControls.js +0 -312
- package/examples/js/controls/FlyControls.js +0 -321
- package/examples/js/controls/OrbitControls.js +0 -1101
- package/examples/js/controls/PointerLockControls.js +0 -144
- package/examples/js/controls/TrackballControls.js +0 -729
- package/examples/js/controls/TransformControls.js +0 -1301
- package/examples/js/csm/CSM.js +0 -347
- package/examples/js/csm/CSMFrustum.js +0 -127
- package/examples/js/csm/CSMHelper.js +0 -165
- package/examples/js/csm/CSMShader.js +0 -253
- package/examples/js/curves/CurveExtras.js +0 -348
- package/examples/js/curves/NURBSCurve.js +0 -63
- package/examples/js/curves/NURBSSurface.js +0 -48
- package/examples/js/curves/NURBSUtils.js +0 -439
- package/examples/js/effects/AnaglyphEffect.js +0 -86
- package/examples/js/effects/AsciiEffect.js +0 -260
- package/examples/js/effects/OutlineEffect.js +0 -450
- package/examples/js/effects/ParallaxBarrierEffect.js +0 -62
- package/examples/js/effects/PeppersGhostEffect.js +0 -139
- package/examples/js/effects/StereoEffect.js +0 -46
- package/examples/js/environments/DebugEnvironment.js +0 -53
- package/examples/js/environments/RoomEnvironment.js +0 -124
- package/examples/js/exporters/ColladaExporter.js +0 -487
- package/examples/js/exporters/DRACOExporter.js +0 -212
- package/examples/js/exporters/EXRExporter.js +0 -455
- package/examples/js/exporters/GLTFExporter.js +0 -2367
- package/examples/js/exporters/MMDExporter.js +0 -187
- package/examples/js/exporters/OBJExporter.js +0 -260
- package/examples/js/exporters/PLYExporter.js +0 -427
- package/examples/js/exporters/STLExporter.js +0 -188
- package/examples/js/exporters/USDZExporter.js +0 -608
- package/examples/js/geometries/BoxLineGeometry.js +0 -59
- package/examples/js/geometries/ConvexGeometry.js +0 -53
- package/examples/js/geometries/DecalGeometry.js +0 -324
- package/examples/js/geometries/LightningStrike.js +0 -861
- package/examples/js/geometries/ParametricGeometries.js +0 -216
- package/examples/js/geometries/ParametricGeometry.js +0 -121
- package/examples/js/geometries/RoundedBoxGeometry.js +0 -142
- package/examples/js/geometries/TeapotGeometry.js +0 -335
- package/examples/js/geometries/TextGeometry.js +0 -53
- package/examples/js/helpers/LightProbeHelper.js +0 -48
- package/examples/js/helpers/OctreeHelper.js +0 -76
- package/examples/js/helpers/PositionalAudioHelper.js +0 -91
- package/examples/js/helpers/RectAreaLightHelper.js +0 -73
- package/examples/js/helpers/VertexNormalsHelper.js +0 -74
- package/examples/js/helpers/VertexTangentsHelper.js +0 -68
- package/examples/js/helpers/ViewHelper.js +0 -281
- package/examples/js/interactive/HTMLMesh.js +0 -497
- package/examples/js/interactive/InteractiveGroup.js +0 -95
- package/examples/js/interactive/SelectionBox.js +0 -195
- package/examples/js/interactive/SelectionHelper.js +0 -83
- package/examples/js/libs/chevrotain.min.js +0 -3
- package/examples/js/libs/draco/draco_decoder.js +0 -52
- package/examples/js/libs/draco/draco_decoder.wasm +0 -0
- package/examples/js/libs/draco/draco_wasm_wrapper.js +0 -104
- package/examples/js/libs/draco/gltf/draco_decoder.js +0 -48
- package/examples/js/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/js/libs/draco/gltf/draco_wasm_wrapper.js +0 -104
- package/examples/js/libs/fflate.min.js +0 -7
- package/examples/js/libs/ktx-parse.umd.js +0 -1
- package/examples/js/libs/meshopt_decoder.js +0 -188
- package/examples/js/libs/opentype.min.js +0 -1
- package/examples/js/libs/stats.min.js +0 -5
- package/examples/js/lights/LightProbeGenerator.js +0 -221
- package/examples/js/lights/RectAreaLightUniformsLib.js +0 -60
- package/examples/js/lines/Line2.js +0 -19
- package/examples/js/lines/LineGeometry.js +0 -69
- package/examples/js/lines/LineMaterial.js +0 -635
- package/examples/js/lines/LineSegments2.js +0 -313
- package/examples/js/lines/LineSegmentsGeometry.js +0 -198
- package/examples/js/lines/Wireframe.js +0 -47
- package/examples/js/lines/WireframeGeometry2.js +0 -20
- package/examples/js/loaders/3DMLoader.js +0 -1273
- package/examples/js/loaders/3MFLoader.js +0 -1306
- package/examples/js/loaders/AMFLoader.js +0 -504
- package/examples/js/loaders/BVHLoader.js +0 -395
- package/examples/js/loaders/BasisTextureLoader.js +0 -706
- package/examples/js/loaders/ColladaLoader.js +0 -3690
- package/examples/js/loaders/DDSLoader.js +0 -244
- package/examples/js/loaders/DRACOLoader.js +0 -511
- package/examples/js/loaders/EXRLoader.js +0 -2039
- package/examples/js/loaders/FBXLoader.js +0 -3681
- package/examples/js/loaders/FontLoader.js +0 -160
- package/examples/js/loaders/GCodeLoader.js +0 -255
- package/examples/js/loaders/GLTFLoader.js +0 -3862
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -87
- package/examples/js/loaders/KMZLoader.js +0 -121
- package/examples/js/loaders/KTXLoader.js +0 -159
- package/examples/js/loaders/LDrawLoader.js +0 -2263
- package/examples/js/loaders/LUT3dlLoader.js +0 -135
- package/examples/js/loaders/LUTCubeLoader.js +0 -132
- package/examples/js/loaders/LWOLoader.js +0 -901
- package/examples/js/loaders/LogLuvLoader.js +0 -715
- package/examples/js/loaders/LottieLoader.js +0 -62
- package/examples/js/loaders/MD2Loader.js +0 -248
- package/examples/js/loaders/MDDLoader.js +0 -91
- package/examples/js/loaders/MMDLoader.js +0 -1915
- package/examples/js/loaders/MTLLoader.js +0 -472
- package/examples/js/loaders/NRRDLoader.js +0 -609
- package/examples/js/loaders/OBJLoader.js +0 -789
- package/examples/js/loaders/PCDLoader.js +0 -413
- package/examples/js/loaders/PDBLoader.js +0 -317
- package/examples/js/loaders/PLYLoader.js +0 -576
- package/examples/js/loaders/PRWMLoader.js +0 -249
- package/examples/js/loaders/PVRLoader.js +0 -218
- package/examples/js/loaders/RGBELoader.js +0 -442
- package/examples/js/loaders/RGBMLoader.js +0 -1354
- package/examples/js/loaders/STLLoader.js +0 -364
- package/examples/js/loaders/SVGLoader.js +0 -2783
- package/examples/js/loaders/TDSLoader.js +0 -992
- package/examples/js/loaders/TGALoader.js +0 -484
- package/examples/js/loaders/TIFFLoader.js +0 -30
- package/examples/js/loaders/TTFLoader.js +0 -203
- package/examples/js/loaders/TiltLoader.js +0 -459
- package/examples/js/loaders/VOXLoader.js +0 -240
- package/examples/js/loaders/VRMLLoader.js +0 -3140
- package/examples/js/loaders/VTKLoader.js +0 -1078
- package/examples/js/loaders/XYZLoader.js +0 -89
- package/examples/js/loaders/lwo/IFFParser.js +0 -1067
- package/examples/js/loaders/lwo/LWO2Parser.js +0 -397
- package/examples/js/loaders/lwo/LWO3Parser.js +0 -360
- package/examples/js/materials/MeshGouraudMaterial.js +0 -387
- package/examples/js/math/Capsule.js +0 -103
- package/examples/js/math/ColorConverter.js +0 -33
- package/examples/js/math/ConvexHull.js +0 -1154
- package/examples/js/math/ImprovedNoise.js +0 -66
- package/examples/js/math/Lut.js +0 -164
- package/examples/js/math/MeshSurfaceSampler.js +0 -171
- package/examples/js/math/OBB.js +0 -382
- package/examples/js/math/Octree.js +0 -410
- package/examples/js/math/SimplexNoise.js +0 -445
- package/examples/js/misc/ConvexObjectBreaker.js +0 -474
- package/examples/js/misc/GPUComputationRenderer.js +0 -393
- package/examples/js/misc/Gyroscope.js +0 -56
- package/examples/js/misc/MD2Character.js +0 -235
- package/examples/js/misc/MD2CharacterComplex.js +0 -513
- package/examples/js/misc/MorphAnimMesh.js +0 -63
- package/examples/js/misc/MorphBlendMesh.js +0 -265
- package/examples/js/misc/ProgressiveLightMap.js +0 -335
- package/examples/js/misc/RollerCoaster.js +0 -430
- package/examples/js/misc/TubePainter.js +0 -167
- package/examples/js/misc/Volume.js +0 -437
- package/examples/js/misc/VolumeSlice.js +0 -214
- package/examples/js/modifiers/CurveModifier.js +0 -309
- package/examples/js/modifiers/EdgeSplitModifier.js +0 -228
- package/examples/js/modifiers/SimplifyModifier.js +0 -465
- package/examples/js/modifiers/TessellateModifier.js +0 -276
- package/examples/js/objects/GroundProjectedEnv.js +0 -181
- package/examples/js/objects/Lensflare.js +0 -356
- package/examples/js/objects/LightningStorm.js +0 -206
- package/examples/js/objects/MarchingCubes.js +0 -759
- package/examples/js/objects/Reflector.js +0 -216
- package/examples/js/objects/ReflectorForSSRPass.js +0 -315
- package/examples/js/objects/Refractor.js +0 -283
- package/examples/js/objects/ShadowMesh.js +0 -59
- package/examples/js/objects/Sky.js +0 -218
- package/examples/js/objects/Water.js +0 -292
- package/examples/js/objects/Water2.js +0 -307
- package/examples/js/physics/AmmoPhysics.js +0 -259
- package/examples/js/physics/OimoPhysics.js +0 -217
- package/examples/js/postprocessing/AdaptiveToneMappingPass.js +0 -335
- package/examples/js/postprocessing/AfterimagePass.js +0 -77
- package/examples/js/postprocessing/BloomPass.js +0 -135
- package/examples/js/postprocessing/BokehPass.js +0 -120
- package/examples/js/postprocessing/ClearPass.js +0 -39
- package/examples/js/postprocessing/CubeTexturePass.js +0 -60
- package/examples/js/postprocessing/DotScreenPass.js +0 -51
- package/examples/js/postprocessing/EffectComposer.js +0 -272
- package/examples/js/postprocessing/FilmPass.js +0 -52
- package/examples/js/postprocessing/GlitchPass.js +0 -104
- package/examples/js/postprocessing/HalftonePass.js +0 -75
- package/examples/js/postprocessing/LUTPass.js +0 -171
- package/examples/js/postprocessing/MaskPass.js +0 -95
- package/examples/js/postprocessing/OutlinePass.js +0 -598
- package/examples/js/postprocessing/Pass.js +0 -72
- package/examples/js/postprocessing/RenderPass.js +0 -70
- package/examples/js/postprocessing/RenderPixelatedPass.js +0 -215
- package/examples/js/postprocessing/SAOPass.js +0 -374
- package/examples/js/postprocessing/SMAAPass.js +0 -170
- package/examples/js/postprocessing/SSAARenderPass.js +0 -156
- package/examples/js/postprocessing/SSAOPass.js +0 -365
- package/examples/js/postprocessing/SSRPass.js +0 -567
- package/examples/js/postprocessing/SavePass.js +0 -59
- package/examples/js/postprocessing/ShaderPass.js +0 -64
- package/examples/js/postprocessing/TAARenderPass.js +0 -130
- package/examples/js/postprocessing/TexturePass.js +0 -49
- package/examples/js/postprocessing/UnrealBloomPass.js +0 -375
- package/examples/js/renderers/CSS2DRenderer.js +0 -178
- package/examples/js/renderers/CSS3DRenderer.js +0 -237
- package/examples/js/renderers/Projector.js +0 -818
- package/examples/js/renderers/SVGRenderer.js +0 -491
- package/examples/js/shaders/ACESFilmicToneMappingShader.js +0 -89
- package/examples/js/shaders/AfterimageShader.js +0 -60
- package/examples/js/shaders/BasicShader.js +0 -27
- package/examples/js/shaders/BleachBypassShader.js +0 -62
- package/examples/js/shaders/BlendShader.js +0 -54
- package/examples/js/shaders/BokehShader.js +0 -156
- package/examples/js/shaders/BokehShader2.js +0 -419
- package/examples/js/shaders/BrightnessContrastShader.js +0 -58
- package/examples/js/shaders/ColorCorrectionShader.js +0 -52
- package/examples/js/shaders/ColorifyShader.js +0 -47
- package/examples/js/shaders/ConvolutionShader.js +0 -92
- package/examples/js/shaders/CopyShader.js +0 -45
- package/examples/js/shaders/DOFMipMapShader.js +0 -60
- package/examples/js/shaders/DepthLimitedBlurShader.js +0 -173
- package/examples/js/shaders/DigitalGlitch.js +0 -127
- package/examples/js/shaders/DotScreenShader.js +0 -72
- package/examples/js/shaders/FXAAShader.js +0 -284
- package/examples/js/shaders/FilmShader.js +0 -110
- package/examples/js/shaders/FocusShader.js +0 -95
- package/examples/js/shaders/FreiChenShader.js +0 -93
- package/examples/js/shaders/GammaCorrectionShader.js +0 -41
- package/examples/js/shaders/GodRaysShader.js +0 -284
- package/examples/js/shaders/HalftoneShader.js +0 -336
- package/examples/js/shaders/HorizontalBlurShader.js +0 -59
- package/examples/js/shaders/HorizontalTiltShiftShader.js +0 -65
- package/examples/js/shaders/HueSaturationShader.js +0 -69
- package/examples/js/shaders/KaleidoShader.js +0 -60
- package/examples/js/shaders/LuminosityHighPassShader.js +0 -67
- package/examples/js/shaders/LuminosityShader.js +0 -46
- package/examples/js/shaders/MMDToonShader.js +0 -94
- package/examples/js/shaders/MirrorShader.js +0 -56
- package/examples/js/shaders/NormalMapShader.js +0 -55
- package/examples/js/shaders/RGBShiftShader.js +0 -56
- package/examples/js/shaders/SAOShader.js +0 -209
- package/examples/js/shaders/SMAAShader.js +0 -454
- package/examples/js/shaders/SSAOShader.js +0 -295
- package/examples/js/shaders/SSRShader.js +0 -381
- package/examples/js/shaders/SepiaShader.js +0 -52
- package/examples/js/shaders/SobelOperatorShader.js +0 -88
- package/examples/js/shaders/SubsurfaceScatteringShader.js +0 -49
- package/examples/js/shaders/TechnicolorShader.js +0 -43
- package/examples/js/shaders/ToneMapShader.js +0 -84
- package/examples/js/shaders/ToonShader.js +0 -335
- package/examples/js/shaders/TriangleBlurShader.js +0 -70
- package/examples/js/shaders/UnpackDepthRGBAShader.js +0 -47
- package/examples/js/shaders/VelocityShader.js +0 -126
- package/examples/js/shaders/VerticalBlurShader.js +0 -59
- package/examples/js/shaders/VerticalTiltShiftShader.js +0 -65
- package/examples/js/shaders/VignetteShader.js +0 -53
- package/examples/js/shaders/VolumeShader.js +0 -296
- package/examples/js/shaders/WaterRefractionShader.js +0 -84
- package/examples/js/textures/FlakesTexture.js +0 -40
- package/examples/js/utils/BufferGeometryUtils.js +0 -1160
- package/examples/js/utils/CameraUtils.js +0 -71
- package/examples/js/utils/GPUStatsPanel.js +0 -125
- package/examples/js/utils/GeometryCompressionUtils.js +0 -549
- package/examples/js/utils/GeometryUtils.js +0 -168
- package/examples/js/utils/LDrawUtils.js +0 -179
- package/examples/js/utils/PackedPhongMaterial.js +0 -109
- package/examples/js/utils/SceneUtils.js +0 -214
- package/examples/js/utils/ShadowMapViewer.js +0 -183
- package/examples/js/utils/SkeletonUtils.js +0 -493
- package/examples/js/utils/UVsDebug.js +0 -143
- package/examples/js/utils/WorkerPool.js +0 -105
- package/examples/jsm/libs/OimoPhysics/OimoPhysics.js +0 -37071
- package/examples/jsm/libs/OimoPhysics/index.js +0 -43
- package/examples/jsm/libs/flow.module.js +0 -4552
- package/examples/jsm/libs/tween.module.min.js +0 -3
- package/examples/jsm/loaders/BasisTextureLoader.js +0 -790
- package/examples/jsm/loaders/IFCLoader.js +0 -2431
- package/examples/jsm/loaders/ifc/web-ifc-api.js +0 -47504
- package/examples/jsm/loaders/ifc/web-ifc.wasm +0 -0
- package/examples/jsm/node-editor/NodeEditor.js +0 -857
- package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +0 -14
- package/examples/jsm/node-editor/accessors/NormalEditor.js +0 -30
- package/examples/jsm/node-editor/accessors/PositionEditor.js +0 -30
- package/examples/jsm/node-editor/accessors/UVEditor.js +0 -25
- package/examples/jsm/node-editor/core/BaseNode.js +0 -96
- package/examples/jsm/node-editor/core/DataFile.js +0 -59
- package/examples/jsm/node-editor/core/FileEditor.js +0 -20
- package/examples/jsm/node-editor/core/FileURLEditor.js +0 -29
- package/examples/jsm/node-editor/display/BlendEditor.js +0 -44
- package/examples/jsm/node-editor/display/NormalMapEditor.js +0 -49
- package/examples/jsm/node-editor/examples/animate-uv.json +0 -1
- package/examples/jsm/node-editor/examples/fake-top-light.json +0 -1
- package/examples/jsm/node-editor/examples/matcap.json +0 -1
- package/examples/jsm/node-editor/examples/oscillator-color.json +0 -1
- package/examples/jsm/node-editor/examples/rim.json +0 -1
- package/examples/jsm/node-editor/inputs/ColorEditor.js +0 -96
- package/examples/jsm/node-editor/inputs/FloatEditor.js +0 -23
- package/examples/jsm/node-editor/inputs/SliderEditor.js +0 -67
- package/examples/jsm/node-editor/inputs/TextureEditor.js +0 -155
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +0 -28
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +0 -30
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +0 -37
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +0 -84
- package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +0 -102
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +0 -118
- package/examples/jsm/node-editor/math/AngleEditor.js +0 -40
- package/examples/jsm/node-editor/math/DotEditor.js +0 -35
- package/examples/jsm/node-editor/math/InvertEditor.js +0 -39
- package/examples/jsm/node-editor/math/LimiterEditor.js +0 -62
- package/examples/jsm/node-editor/math/NormalizeEditor.js +0 -28
- package/examples/jsm/node-editor/math/OperatorEditor.js +0 -63
- package/examples/jsm/node-editor/math/PowerEditor.js +0 -44
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +0 -45
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +0 -27
- package/examples/jsm/node-editor/scene/MeshEditor.js +0 -102
- package/examples/jsm/node-editor/scene/Object3DEditor.js +0 -160
- package/examples/jsm/node-editor/scene/PointsEditor.js +0 -99
- package/examples/jsm/node-editor/utils/JoinEditor.js +0 -58
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +0 -43
- package/examples/jsm/node-editor/utils/PreviewEditor.js +0 -170
- package/examples/jsm/node-editor/utils/SplitEditor.js +0 -39
- package/examples/jsm/node-editor/utils/TimerEditor.js +0 -58
- package/examples/jsm/nodes/core/ExpressionNode.js +0 -32
- package/examples/jsm/nodes/functions/light/getDistanceAttenuation.js +0 -22
- package/examples/jsm/nodes/lighting/PunctualLightNode.js +0 -68
- package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +0 -301
- package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +0 -149
- package/examples/jsm/objects/GroundProjectedEnv.js +0 -186
- package/examples/jsm/renderers/webgpu/WebGPUObjects.js +0 -36
- package/src/renderers/shaders/ShaderChunk/uv2_pars_fragment.glsl.js +0 -7
- package/src/renderers/shaders/ShaderChunk/uv2_pars_vertex.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/uv2_vertex.glsl.js +0 -7
- /package/examples/{js → jsm}/libs/ammo.wasm.js +0 -0
- /package/examples/{js → jsm}/libs/ammo.wasm.wasm +0 -0
- /package/examples/{js → jsm}/libs/basis/basis_transcoder.js +0 -0
- /package/examples/{js → jsm}/libs/basis/basis_transcoder.wasm +0 -0
- /package/examples/{js → jsm}/libs/draco/README.md +0 -0
- /package/examples/{js → jsm}/libs/draco/draco_encoder.js +0 -0
- /package/examples/{js → jsm}/libs/draco/gltf/draco_encoder.js +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { GPUTextureFormat, GPUAddressMode, GPUFilterMode, GPUTextureDimension } from './constants.js';
|
|
2
|
-
import { CubeTexture, Texture, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, RepeatWrapping, MirroredRepeatWrapping,
|
|
3
|
-
RGBAFormat, RedFormat, RGFormat, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, UnsignedByteType, FloatType, HalfFloatType,
|
|
1
|
+
import { GPUTextureFormat, GPUAddressMode, GPUFilterMode, GPUTextureDimension, GPUFeatureName } from './constants.js';
|
|
2
|
+
import { VideoTexture, CubeTexture, Texture, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, RepeatWrapping, MirroredRepeatWrapping, RGB_ETC2_Format, RGBA_ETC2_EAC_Format,
|
|
3
|
+
RGBAFormat, RedFormat, RGFormat, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, UnsignedByteType, FloatType, HalfFloatType, SRGBColorSpace, DepthFormat, DepthStencilFormat, DepthTexture,
|
|
4
|
+
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,
|
|
5
|
+
RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, UnsignedIntType, UnsignedShortType, UnsignedInt248Type
|
|
4
6
|
} from 'three';
|
|
5
7
|
import WebGPUTextureUtils from './WebGPUTextureUtils.js';
|
|
6
8
|
|
|
@@ -13,6 +15,8 @@ class WebGPUTextures {
|
|
|
13
15
|
this.info = info;
|
|
14
16
|
|
|
15
17
|
this.defaultTexture = null;
|
|
18
|
+
this.depthDefaultTexture = null;
|
|
19
|
+
this.defaultVideoTexture = null;
|
|
16
20
|
this.defaultCubeTexture = null;
|
|
17
21
|
this.defaultSampler = null;
|
|
18
22
|
|
|
@@ -33,6 +37,24 @@ class WebGPUTextures {
|
|
|
33
37
|
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
getDefaultDepthTexture() {
|
|
41
|
+
|
|
42
|
+
if ( this.depthDefaultTexture === null ) {
|
|
43
|
+
|
|
44
|
+
const depthTexture = new DepthTexture();
|
|
45
|
+
depthTexture.image.width = 1;
|
|
46
|
+
depthTexture.image.height = 1;
|
|
47
|
+
|
|
48
|
+
this._uploadTexture( depthTexture );
|
|
49
|
+
|
|
50
|
+
this.depthDefaultTexture = this.getTextureGPU( depthTexture );
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return this.depthDefaultTexture;
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
36
58
|
getDefaultTexture() {
|
|
37
59
|
|
|
38
60
|
if ( this.defaultTexture === null ) {
|
|
@@ -51,6 +73,26 @@ class WebGPUTextures {
|
|
|
51
73
|
|
|
52
74
|
}
|
|
53
75
|
|
|
76
|
+
getDefaultVideoTexture() {
|
|
77
|
+
|
|
78
|
+
if ( this.defaultVideoTexture === null ) {
|
|
79
|
+
|
|
80
|
+
const video = document.getElementById( 'video' );
|
|
81
|
+
|
|
82
|
+
const texture = new VideoTexture( video );
|
|
83
|
+
texture.minFilter = NearestFilter;
|
|
84
|
+
texture.magFilter = NearestFilter;
|
|
85
|
+
|
|
86
|
+
this._uploadVideoTexture( texture );
|
|
87
|
+
|
|
88
|
+
this.defaultVideoTexture = this.getTextureGPU( texture );
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return this.defaultVideoTexture;
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
54
96
|
getDefaultCubeTexture() {
|
|
55
97
|
|
|
56
98
|
if ( this.defaultCubeTexture === null ) {
|
|
@@ -122,7 +164,15 @@ class WebGPUTextures {
|
|
|
122
164
|
|
|
123
165
|
//
|
|
124
166
|
|
|
125
|
-
|
|
167
|
+
if ( texture.isVideoTexture ) {
|
|
168
|
+
|
|
169
|
+
needsUpdate = this._uploadVideoTexture( texture );
|
|
170
|
+
|
|
171
|
+
} else {
|
|
172
|
+
|
|
173
|
+
needsUpdate = this._uploadTexture( texture );
|
|
174
|
+
|
|
175
|
+
}
|
|
126
176
|
|
|
127
177
|
}
|
|
128
178
|
|
|
@@ -188,16 +238,24 @@ class WebGPUTextures {
|
|
|
188
238
|
|
|
189
239
|
const width = renderTarget.width;
|
|
190
240
|
const height = renderTarget.height;
|
|
191
|
-
|
|
241
|
+
|
|
242
|
+
const texture = renderTarget.texture;
|
|
243
|
+
|
|
244
|
+
const colorTextureFormat = texture.internalFormat || this._getFormat( texture );
|
|
245
|
+
const label = texture.name ? '_' + texture.name : '';
|
|
246
|
+
const needsMipmaps = this._needsMipmaps( texture );
|
|
247
|
+
const mipLevelCount = this._getMipLevelCount( texture, width, height, needsMipmaps );
|
|
192
248
|
|
|
193
249
|
const colorTextureGPU = device.createTexture( {
|
|
250
|
+
label: 'renderTarget' + label,
|
|
194
251
|
size: {
|
|
195
252
|
width: width,
|
|
196
253
|
height: height,
|
|
197
254
|
depthOrArrayLayers: 1
|
|
198
255
|
},
|
|
256
|
+
mipLevelCount: mipLevelCount,
|
|
199
257
|
format: colorTextureFormat,
|
|
200
|
-
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
258
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST
|
|
201
259
|
} );
|
|
202
260
|
|
|
203
261
|
this.info.memory.textures ++;
|
|
@@ -210,22 +268,23 @@ class WebGPUTextures {
|
|
|
210
268
|
// Since it's not possible to see just from a texture object whether it belongs to a render
|
|
211
269
|
// target or not, we need the initializedRTT flag.
|
|
212
270
|
|
|
213
|
-
const textureProperties = properties.get(
|
|
271
|
+
const textureProperties = properties.get( texture );
|
|
214
272
|
textureProperties.textureGPU = colorTextureGPU;
|
|
215
273
|
textureProperties.initializedRTT = false;
|
|
216
274
|
|
|
217
275
|
if ( renderTarget.depthBuffer === true ) {
|
|
218
276
|
|
|
219
|
-
const depthTextureFormat =
|
|
277
|
+
const depthTextureFormat = renderTarget.depthTexture !== null ? this._getFormat( renderTarget.depthTexture ) : GPUTextureFormat.Depth24PlusStencil8;
|
|
220
278
|
|
|
221
279
|
const depthTextureGPU = device.createTexture( {
|
|
280
|
+
label: 'renderTarget' + label + '_depthBuffer',
|
|
222
281
|
size: {
|
|
223
282
|
width: width,
|
|
224
283
|
height: height,
|
|
225
284
|
depthOrArrayLayers: 1
|
|
226
285
|
},
|
|
227
286
|
format: depthTextureFormat,
|
|
228
|
-
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
287
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST
|
|
229
288
|
} );
|
|
230
289
|
|
|
231
290
|
this.info.memory.textures ++;
|
|
@@ -296,6 +355,23 @@ class WebGPUTextures {
|
|
|
296
355
|
|
|
297
356
|
}
|
|
298
357
|
|
|
358
|
+
_uploadVideoTexture( texture ) {
|
|
359
|
+
|
|
360
|
+
const device = this.device;
|
|
361
|
+
|
|
362
|
+
const textureProperties = this.properties.get( texture );
|
|
363
|
+
|
|
364
|
+
const textureGPU = device.importExternalTexture( {
|
|
365
|
+
source: texture.source.data
|
|
366
|
+
} );
|
|
367
|
+
|
|
368
|
+
textureProperties.textureGPU = textureGPU;
|
|
369
|
+
//textureProperties.version = texture.version; // @TODO: Force update for now, study a better solution soon using native VideoTexture.update() to fix warns
|
|
370
|
+
|
|
371
|
+
return true;
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
|
|
299
375
|
_uploadTexture( texture ) {
|
|
300
376
|
|
|
301
377
|
let needsUpdate = false;
|
|
@@ -309,11 +385,11 @@ class WebGPUTextures {
|
|
|
309
385
|
const needsMipmaps = this._needsMipmaps( texture );
|
|
310
386
|
const dimension = this._getDimension( texture );
|
|
311
387
|
const mipLevelCount = this._getMipLevelCount( texture, width, height, needsMipmaps );
|
|
312
|
-
const format = this._getFormat( texture );
|
|
388
|
+
const format = texture.internalFormat || this._getFormat( texture );
|
|
313
389
|
|
|
314
390
|
let usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;
|
|
315
391
|
|
|
316
|
-
if ( needsMipmaps
|
|
392
|
+
if ( needsMipmaps ) {
|
|
317
393
|
|
|
318
394
|
// current mipmap generation requires RENDER_ATTACHMENT
|
|
319
395
|
|
|
@@ -322,6 +398,7 @@ class WebGPUTextures {
|
|
|
322
398
|
}
|
|
323
399
|
|
|
324
400
|
const textureGPUDescriptor = {
|
|
401
|
+
label: texture.name,
|
|
325
402
|
size: {
|
|
326
403
|
width: width,
|
|
327
404
|
height: height,
|
|
@@ -341,7 +418,6 @@ class WebGPUTextures {
|
|
|
341
418
|
if ( textureGPU === undefined ) {
|
|
342
419
|
|
|
343
420
|
textureGPU = device.createTexture( textureGPUDescriptor );
|
|
344
|
-
textureProperties.textureGPU = textureGPU;
|
|
345
421
|
|
|
346
422
|
needsUpdate = true;
|
|
347
423
|
|
|
@@ -351,61 +427,54 @@ class WebGPUTextures {
|
|
|
351
427
|
|
|
352
428
|
if ( texture.isDataTexture || texture.isDataArrayTexture || texture.isData3DTexture ) {
|
|
353
429
|
|
|
354
|
-
this._copyBufferToTexture( image,
|
|
355
|
-
|
|
356
|
-
if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor );
|
|
430
|
+
this._copyBufferToTexture( image, textureGPU, textureGPUDescriptor, needsMipmaps );
|
|
357
431
|
|
|
358
432
|
} else if ( texture.isCompressedTexture ) {
|
|
359
433
|
|
|
360
|
-
this._copyCompressedBufferToTexture( texture.mipmaps,
|
|
434
|
+
this._copyCompressedBufferToTexture( texture.mipmaps, textureGPU, textureGPUDescriptor );
|
|
361
435
|
|
|
362
436
|
} else if ( texture.isCubeTexture ) {
|
|
363
437
|
|
|
364
438
|
if ( image.length === 6 ) {
|
|
365
439
|
|
|
366
|
-
this._copyCubeMapToTexture( image,
|
|
440
|
+
this._copyCubeMapToTexture( image, texture, textureGPU, textureGPUDescriptor, needsMipmaps );
|
|
367
441
|
|
|
368
442
|
}
|
|
369
443
|
|
|
370
|
-
} else {
|
|
371
|
-
|
|
372
|
-
if ( image !== null ) {
|
|
444
|
+
} else if ( texture.isRenderTargetTexture ) {
|
|
373
445
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
this._getImageBitmap( image, texture ).then( imageBitmap => {
|
|
377
|
-
|
|
378
|
-
this._copyExternalImageToTexture( imageBitmap, textureGPU );
|
|
379
|
-
|
|
380
|
-
if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor );
|
|
446
|
+
if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor );
|
|
381
447
|
|
|
382
|
-
|
|
448
|
+
} else if ( texture.isDepthTexture !== true && image !== null ) {
|
|
383
449
|
|
|
384
|
-
|
|
450
|
+
this._copyImageToTexture( image, texture, textureGPU, textureGPUDescriptor, needsMipmaps );
|
|
385
451
|
|
|
386
452
|
}
|
|
387
453
|
|
|
454
|
+
//
|
|
455
|
+
|
|
456
|
+
textureProperties.textureGPU = textureGPU;
|
|
388
457
|
textureProperties.version = texture.version;
|
|
389
458
|
|
|
390
459
|
return needsUpdate;
|
|
391
460
|
|
|
392
461
|
}
|
|
393
462
|
|
|
394
|
-
_copyBufferToTexture( image,
|
|
463
|
+
_copyBufferToTexture( image, textureGPU, textureGPUDescriptor, needsMipmaps, originDepth = 0 ) {
|
|
395
464
|
|
|
396
465
|
// @TODO: Consider to use GPUCommandEncoder.copyBufferToTexture()
|
|
397
466
|
// @TODO: Consider to support valid buffer layouts with other formats like RGB
|
|
398
467
|
|
|
399
468
|
const data = image.data;
|
|
400
469
|
|
|
401
|
-
const bytesPerTexel = this._getBytesPerTexel( format );
|
|
402
|
-
const bytesPerRow =
|
|
470
|
+
const bytesPerTexel = this._getBytesPerTexel( textureGPUDescriptor.format );
|
|
471
|
+
const bytesPerRow = image.width * bytesPerTexel;
|
|
403
472
|
|
|
404
473
|
this.device.queue.writeTexture(
|
|
405
474
|
{
|
|
406
475
|
texture: textureGPU,
|
|
407
476
|
mipLevel: 0,
|
|
408
|
-
origin
|
|
477
|
+
origin: { x: 0, y: 0, z: originDepth }
|
|
409
478
|
},
|
|
410
479
|
data,
|
|
411
480
|
{
|
|
@@ -418,9 +487,11 @@ class WebGPUTextures {
|
|
|
418
487
|
depthOrArrayLayers: ( image.depth !== undefined ) ? image.depth : 1
|
|
419
488
|
} );
|
|
420
489
|
|
|
490
|
+
if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, originDepth );
|
|
491
|
+
|
|
421
492
|
}
|
|
422
493
|
|
|
423
|
-
_copyCubeMapToTexture( images,
|
|
494
|
+
_copyCubeMapToTexture( images, texture, textureGPU, textureGPUDescriptor, needsMipmaps ) {
|
|
424
495
|
|
|
425
496
|
for ( let i = 0; i < 6; i ++ ) {
|
|
426
497
|
|
|
@@ -428,19 +499,11 @@ class WebGPUTextures {
|
|
|
428
499
|
|
|
429
500
|
if ( image.isDataTexture ) {
|
|
430
501
|
|
|
431
|
-
this._copyBufferToTexture( image.image,
|
|
432
|
-
|
|
433
|
-
if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, i );
|
|
502
|
+
this._copyBufferToTexture( image.image, textureGPU, textureGPUDescriptor, needsMipmaps, i );
|
|
434
503
|
|
|
435
504
|
} else {
|
|
436
505
|
|
|
437
|
-
this.
|
|
438
|
-
|
|
439
|
-
this._copyExternalImageToTexture( imageBitmap, textureGPU, { z: i } );
|
|
440
|
-
|
|
441
|
-
if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, i );
|
|
442
|
-
|
|
443
|
-
} );
|
|
506
|
+
this._copyImageToTexture( image, texture, textureGPU, textureGPUDescriptor, needsMipmaps, i );
|
|
444
507
|
|
|
445
508
|
}
|
|
446
509
|
|
|
@@ -448,7 +511,7 @@ class WebGPUTextures {
|
|
|
448
511
|
|
|
449
512
|
}
|
|
450
513
|
|
|
451
|
-
_copyExternalImageToTexture( image, textureGPU,
|
|
514
|
+
_copyExternalImageToTexture( image, textureGPU, textureGPUDescriptor, needsMipmaps, originDepth = 0 ) {
|
|
452
515
|
|
|
453
516
|
this.device.queue.copyExternalImageToTexture(
|
|
454
517
|
{
|
|
@@ -456,7 +519,7 @@ class WebGPUTextures {
|
|
|
456
519
|
}, {
|
|
457
520
|
texture: textureGPU,
|
|
458
521
|
mipLevel: 0,
|
|
459
|
-
origin
|
|
522
|
+
origin: { x: 0, y: 0, z: originDepth }
|
|
460
523
|
}, {
|
|
461
524
|
width: image.width,
|
|
462
525
|
height: image.height,
|
|
@@ -464,13 +527,15 @@ class WebGPUTextures {
|
|
|
464
527
|
}
|
|
465
528
|
);
|
|
466
529
|
|
|
530
|
+
if ( needsMipmaps ) this._generateMipmaps( textureGPU, textureGPUDescriptor, originDepth );
|
|
531
|
+
|
|
467
532
|
}
|
|
468
533
|
|
|
469
|
-
_copyCompressedBufferToTexture( mipmaps,
|
|
534
|
+
_copyCompressedBufferToTexture( mipmaps, textureGPU, textureGPUDescriptor ) {
|
|
470
535
|
|
|
471
536
|
// @TODO: Consider to use GPUCommandEncoder.copyBufferToTexture()
|
|
472
537
|
|
|
473
|
-
const blockData = this._getBlockData( format );
|
|
538
|
+
const blockData = this._getBlockData( textureGPUDescriptor.format );
|
|
474
539
|
|
|
475
540
|
for ( let i = 0; i < mipmaps.length; i ++ ) {
|
|
476
541
|
|
|
@@ -495,7 +560,8 @@ class WebGPUTextures {
|
|
|
495
560
|
width: Math.ceil( width / blockData.width ) * blockData.width,
|
|
496
561
|
height: Math.ceil( height / blockData.width ) * blockData.width,
|
|
497
562
|
depthOrArrayLayers: 1
|
|
498
|
-
}
|
|
563
|
+
}
|
|
564
|
+
);
|
|
499
565
|
|
|
500
566
|
}
|
|
501
567
|
|
|
@@ -525,6 +591,29 @@ class WebGPUTextures {
|
|
|
525
591
|
if ( format === GPUTextureFormat.BC6HRGBUFloat || format === GPUTextureFormat.BC6HRGBFloat ) return { byteLength: 16, width: 4, height: 4 }; // BPTC (float)
|
|
526
592
|
if ( format === GPUTextureFormat.BC7RGBAUnorm || format === GPUTextureFormat.BC7RGBAUnormSRGB ) return { byteLength: 16, width: 4, height: 4 }; // BPTC (unorm)
|
|
527
593
|
|
|
594
|
+
if ( format === GPUTextureFormat.ETC2RGB8Unorm || format === GPUTextureFormat.ETC2RGB8UnormSRGB ) return { byteLength: 8, width: 4, height: 4 };
|
|
595
|
+
if ( format === GPUTextureFormat.ETC2RGB8A1Unorm || format === GPUTextureFormat.ETC2RGB8A1UnormSRGB ) return { byteLength: 8, width: 4, height: 4 };
|
|
596
|
+
if ( format === GPUTextureFormat.ETC2RGBA8Unorm || format === GPUTextureFormat.ETC2RGBA8UnormSRGB ) return { byteLength: 16, width: 4, height: 4 };
|
|
597
|
+
if ( format === GPUTextureFormat.EACR11Unorm ) return { byteLength: 8, width: 4, height: 4 };
|
|
598
|
+
if ( format === GPUTextureFormat.EACR11Snorm ) return { byteLength: 8, width: 4, height: 4 };
|
|
599
|
+
if ( format === GPUTextureFormat.EACRG11Unorm ) return { byteLength: 16, width: 4, height: 4 };
|
|
600
|
+
if ( format === GPUTextureFormat.EACRG11Snorm ) return { byteLength: 16, width: 4, height: 4 };
|
|
601
|
+
|
|
602
|
+
if ( format === GPUTextureFormat.ASTC4x4Unorm || format === GPUTextureFormat.ASTC4x4UnormSRGB ) return { byteLength: 16, width: 4, height: 4 };
|
|
603
|
+
if ( format === GPUTextureFormat.ASTC5x4Unorm || format === GPUTextureFormat.ASTC5x4UnormSRGB ) return { byteLength: 16, width: 5, height: 4 };
|
|
604
|
+
if ( format === GPUTextureFormat.ASTC5x5Unorm || format === GPUTextureFormat.ASTC5x5UnormSRGB ) return { byteLength: 16, width: 5, height: 5 };
|
|
605
|
+
if ( format === GPUTextureFormat.ASTC6x5Unorm || format === GPUTextureFormat.ASTC6x5UnormSRGB ) return { byteLength: 16, width: 6, height: 5 };
|
|
606
|
+
if ( format === GPUTextureFormat.ASTC6x6Unorm || format === GPUTextureFormat.ASTC6x6UnormSRGB ) return { byteLength: 16, width: 6, height: 6 };
|
|
607
|
+
if ( format === GPUTextureFormat.ASTC8x5Unorm || format === GPUTextureFormat.ASTC8x5UnormSRGB ) return { byteLength: 16, width: 8, height: 5 };
|
|
608
|
+
if ( format === GPUTextureFormat.ASTC8x6Unorm || format === GPUTextureFormat.ASTC8x6UnormSRGB ) return { byteLength: 16, width: 8, height: 6 };
|
|
609
|
+
if ( format === GPUTextureFormat.ASTC8x8Unorm || format === GPUTextureFormat.ASTC8x8UnormSRGB ) return { byteLength: 16, width: 8, height: 8 };
|
|
610
|
+
if ( format === GPUTextureFormat.ASTC10x5Unorm || format === GPUTextureFormat.ASTC10x5UnormSRGB ) return { byteLength: 16, width: 10, height: 5 };
|
|
611
|
+
if ( format === GPUTextureFormat.ASTC10x6Unorm || format === GPUTextureFormat.ASTC10x6UnormSRGB ) return { byteLength: 16, width: 10, height: 6 };
|
|
612
|
+
if ( format === GPUTextureFormat.ASTC10x8Unorm || format === GPUTextureFormat.ASTC10x8UnormSRGB ) return { byteLength: 16, width: 10, height: 8 };
|
|
613
|
+
if ( format === GPUTextureFormat.ASTC10x10Unorm || format === GPUTextureFormat.ASTC10x10UnormSRGB ) return { byteLength: 16, width: 10, height: 10 };
|
|
614
|
+
if ( format === GPUTextureFormat.ASTC12x10Unorm || format === GPUTextureFormat.ASTC12x10UnormSRGB ) return { byteLength: 16, width: 12, height: 10 };
|
|
615
|
+
if ( format === GPUTextureFormat.ASTC12x12Unorm || format === GPUTextureFormat.ASTC12x12UnormSRGB ) return { byteLength: 16, width: 12, height: 12 };
|
|
616
|
+
|
|
528
617
|
}
|
|
529
618
|
|
|
530
619
|
_getBytesPerTexel( format ) {
|
|
@@ -563,95 +652,222 @@ class WebGPUTextures {
|
|
|
563
652
|
|
|
564
653
|
const format = texture.format;
|
|
565
654
|
const type = texture.type;
|
|
566
|
-
const
|
|
655
|
+
const colorSpace = texture.colorSpace;
|
|
567
656
|
|
|
568
657
|
let formatGPU;
|
|
569
658
|
|
|
570
|
-
|
|
659
|
+
if ( texture.isCompressedTexture === true ) {
|
|
571
660
|
|
|
572
|
-
|
|
573
|
-
formatGPU = ( encoding === sRGBEncoding ) ? GPUTextureFormat.BC1RGBAUnormSRGB : GPUTextureFormat.BC1RGBAUnorm;
|
|
574
|
-
break;
|
|
661
|
+
switch ( format ) {
|
|
575
662
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
663
|
+
case RGBA_S3TC_DXT1_Format:
|
|
664
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.BC1RGBAUnormSRGB : GPUTextureFormat.BC1RGBAUnorm;
|
|
665
|
+
break;
|
|
579
666
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
667
|
+
case RGBA_S3TC_DXT3_Format:
|
|
668
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.BC2RGBAUnormSRGB : GPUTextureFormat.BC2RGBAUnorm;
|
|
669
|
+
break;
|
|
583
670
|
|
|
584
|
-
|
|
671
|
+
case RGBA_S3TC_DXT5_Format:
|
|
672
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.BC3RGBAUnormSRGB : GPUTextureFormat.BC3RGBAUnorm;
|
|
673
|
+
break;
|
|
585
674
|
|
|
586
|
-
|
|
675
|
+
case RGB_ETC2_Format:
|
|
676
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ETC2RGB8UnormSRGB : GPUTextureFormat.ETC2RGB8Unorm;
|
|
677
|
+
break;
|
|
587
678
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
679
|
+
case RGBA_ETC2_EAC_Format:
|
|
680
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ETC2RGBA8UnormSRGB : GPUTextureFormat.ETC2RGBA8Unorm;
|
|
681
|
+
break;
|
|
591
682
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
683
|
+
case RGBA_ASTC_4x4_Format:
|
|
684
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC4x4UnormSRGB : GPUTextureFormat.ASTC4x4Unorm;
|
|
685
|
+
break;
|
|
595
686
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
687
|
+
case RGBA_ASTC_5x4_Format:
|
|
688
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC5x4UnormSRGB : GPUTextureFormat.ASTC5x4Unorm;
|
|
689
|
+
break;
|
|
599
690
|
|
|
600
|
-
|
|
601
|
-
|
|
691
|
+
case RGBA_ASTC_5x5_Format:
|
|
692
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC5x5UnormSRGB : GPUTextureFormat.ASTC5x5Unorm;
|
|
693
|
+
break;
|
|
602
694
|
|
|
603
|
-
|
|
695
|
+
case RGBA_ASTC_6x5_Format:
|
|
696
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC6x5UnormSRGB : GPUTextureFormat.ASTC6x5Unorm;
|
|
697
|
+
break;
|
|
604
698
|
|
|
605
|
-
|
|
699
|
+
case RGBA_ASTC_6x6_Format:
|
|
700
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC6x6UnormSRGB : GPUTextureFormat.ASTC6x6Unorm;
|
|
701
|
+
break;
|
|
606
702
|
|
|
607
|
-
|
|
703
|
+
case RGBA_ASTC_8x5_Format:
|
|
704
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC8x5UnormSRGB : GPUTextureFormat.ASTC8x5Unorm;
|
|
705
|
+
break;
|
|
608
706
|
|
|
609
|
-
|
|
707
|
+
case RGBA_ASTC_8x6_Format:
|
|
708
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC8x6UnormSRGB : GPUTextureFormat.ASTC8x6Unorm;
|
|
709
|
+
break;
|
|
610
710
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
711
|
+
case RGBA_ASTC_8x8_Format:
|
|
712
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC8x8UnormSRGB : GPUTextureFormat.ASTC8x8Unorm;
|
|
713
|
+
break;
|
|
614
714
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
715
|
+
case RGBA_ASTC_10x5_Format:
|
|
716
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x5UnormSRGB : GPUTextureFormat.ASTC10x5Unorm;
|
|
717
|
+
break;
|
|
618
718
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
719
|
+
case RGBA_ASTC_10x6_Format:
|
|
720
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x6UnormSRGB : GPUTextureFormat.ASTC10x6Unorm;
|
|
721
|
+
break;
|
|
622
722
|
|
|
623
|
-
|
|
624
|
-
|
|
723
|
+
case RGBA_ASTC_10x8_Format:
|
|
724
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x8UnormSRGB : GPUTextureFormat.ASTC10x8Unorm;
|
|
725
|
+
break;
|
|
625
726
|
|
|
626
|
-
|
|
727
|
+
case RGBA_ASTC_10x10_Format:
|
|
728
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x10UnormSRGB : GPUTextureFormat.ASTC10x10Unorm;
|
|
729
|
+
break;
|
|
730
|
+
|
|
731
|
+
case RGBA_ASTC_12x10_Format:
|
|
732
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC12x10UnormSRGB : GPUTextureFormat.ASTC12x10Unorm;
|
|
733
|
+
break;
|
|
734
|
+
|
|
735
|
+
case RGBA_ASTC_12x12_Format:
|
|
736
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC12x12UnormSRGB : GPUTextureFormat.ASTC12x12Unorm;
|
|
737
|
+
break;
|
|
627
738
|
|
|
628
|
-
|
|
739
|
+
default:
|
|
740
|
+
console.error( 'WebGPURenderer: Unsupported texture format.', format );
|
|
629
741
|
|
|
630
|
-
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
} else {
|
|
631
745
|
|
|
632
|
-
|
|
746
|
+
switch ( format ) {
|
|
633
747
|
|
|
634
|
-
|
|
635
|
-
formatGPU = GPUTextureFormat.RG8Unorm;
|
|
636
|
-
break;
|
|
748
|
+
case RGBAFormat:
|
|
637
749
|
|
|
638
|
-
|
|
639
|
-
formatGPU = GPUTextureFormat.RG16Float;
|
|
640
|
-
break;
|
|
750
|
+
switch ( type ) {
|
|
641
751
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
752
|
+
case UnsignedByteType:
|
|
753
|
+
formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.RGBA8UnormSRGB : GPUTextureFormat.RGBA8Unorm;
|
|
754
|
+
break;
|
|
645
755
|
|
|
646
|
-
|
|
647
|
-
|
|
756
|
+
case HalfFloatType:
|
|
757
|
+
formatGPU = GPUTextureFormat.RGBA16Float;
|
|
758
|
+
break;
|
|
648
759
|
|
|
649
|
-
|
|
760
|
+
case FloatType:
|
|
761
|
+
formatGPU = GPUTextureFormat.RGBA32Float;
|
|
762
|
+
break;
|
|
650
763
|
|
|
651
|
-
|
|
764
|
+
default:
|
|
765
|
+
console.error( 'WebGPURenderer: Unsupported texture type with RGBAFormat.', type );
|
|
652
766
|
|
|
653
|
-
|
|
654
|
-
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
break;
|
|
770
|
+
|
|
771
|
+
case RedFormat:
|
|
772
|
+
|
|
773
|
+
switch ( type ) {
|
|
774
|
+
|
|
775
|
+
case UnsignedByteType:
|
|
776
|
+
formatGPU = GPUTextureFormat.R8Unorm;
|
|
777
|
+
break;
|
|
778
|
+
|
|
779
|
+
case HalfFloatType:
|
|
780
|
+
formatGPU = GPUTextureFormat.R16Float;
|
|
781
|
+
break;
|
|
782
|
+
|
|
783
|
+
case FloatType:
|
|
784
|
+
formatGPU = GPUTextureFormat.R32Float;
|
|
785
|
+
break;
|
|
786
|
+
|
|
787
|
+
default:
|
|
788
|
+
console.error( 'WebGPURenderer: Unsupported texture type with RedFormat.', type );
|
|
789
|
+
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
break;
|
|
793
|
+
|
|
794
|
+
case RGFormat:
|
|
795
|
+
|
|
796
|
+
switch ( type ) {
|
|
797
|
+
|
|
798
|
+
case UnsignedByteType:
|
|
799
|
+
formatGPU = GPUTextureFormat.RG8Unorm;
|
|
800
|
+
break;
|
|
801
|
+
|
|
802
|
+
case HalfFloatType:
|
|
803
|
+
formatGPU = GPUTextureFormat.RG16Float;
|
|
804
|
+
break;
|
|
805
|
+
|
|
806
|
+
case FloatType:
|
|
807
|
+
formatGPU = GPUTextureFormat.RG32Float;
|
|
808
|
+
break;
|
|
809
|
+
|
|
810
|
+
default:
|
|
811
|
+
console.error( 'WebGPURenderer: Unsupported texture type with RGFormat.', type );
|
|
812
|
+
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
break;
|
|
816
|
+
|
|
817
|
+
case DepthFormat:
|
|
818
|
+
|
|
819
|
+
switch ( type ) {
|
|
820
|
+
|
|
821
|
+
case UnsignedShortType:
|
|
822
|
+
formatGPU = GPUTextureFormat.Depth16Unorm;
|
|
823
|
+
break;
|
|
824
|
+
|
|
825
|
+
case UnsignedIntType:
|
|
826
|
+
formatGPU = GPUTextureFormat.Depth24Plus;
|
|
827
|
+
break;
|
|
828
|
+
|
|
829
|
+
case FloatType:
|
|
830
|
+
formatGPU = GPUTextureFormat.Depth32Float;
|
|
831
|
+
break;
|
|
832
|
+
|
|
833
|
+
default:
|
|
834
|
+
console.error( 'WebGPURenderer: Unsupported texture type with DepthFormat.', type );
|
|
835
|
+
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
break;
|
|
839
|
+
|
|
840
|
+
case DepthStencilFormat:
|
|
841
|
+
|
|
842
|
+
switch ( type ) {
|
|
843
|
+
|
|
844
|
+
case UnsignedInt248Type:
|
|
845
|
+
formatGPU = GPUTextureFormat.Depth24PlusStencil8;
|
|
846
|
+
break;
|
|
847
|
+
|
|
848
|
+
case FloatType:
|
|
849
|
+
|
|
850
|
+
if ( this.device.features.has( GPUFeatureName.Depth32FloatStencil8 ) === false ) {
|
|
851
|
+
|
|
852
|
+
console.error( 'WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.' );
|
|
853
|
+
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
formatGPU = GPUTextureFormat.Depth32FloatStencil8;
|
|
857
|
+
|
|
858
|
+
break;
|
|
859
|
+
|
|
860
|
+
default:
|
|
861
|
+
console.error( 'WebGPURenderer: Unsupported texture type with DepthStencilFormat.', type );
|
|
862
|
+
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
break;
|
|
866
|
+
|
|
867
|
+
default:
|
|
868
|
+
console.error( 'WebGPURenderer: Unsupported texture format.', format );
|
|
869
|
+
|
|
870
|
+
}
|
|
655
871
|
|
|
656
872
|
}
|
|
657
873
|
|
|
@@ -659,6 +875,46 @@ class WebGPUTextures {
|
|
|
659
875
|
|
|
660
876
|
}
|
|
661
877
|
|
|
878
|
+
_isHTMLImage( image ) {
|
|
879
|
+
|
|
880
|
+
return ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) || ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement );
|
|
881
|
+
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
_copyImageToTexture( image, texture, textureGPU, textureGPUDescriptor, needsMipmaps, originDepth ) {
|
|
885
|
+
|
|
886
|
+
if ( this._isHTMLImage( image ) ) {
|
|
887
|
+
|
|
888
|
+
this._getImageBitmapFromHTML( image, texture ).then( imageBitmap => {
|
|
889
|
+
|
|
890
|
+
this._copyExternalImageToTexture( imageBitmap, textureGPU, textureGPUDescriptor, needsMipmaps, originDepth );
|
|
891
|
+
|
|
892
|
+
} );
|
|
893
|
+
|
|
894
|
+
} else {
|
|
895
|
+
|
|
896
|
+
// assume ImageBitmap
|
|
897
|
+
|
|
898
|
+
this._copyExternalImageToTexture( image, textureGPU, textureGPUDescriptor, needsMipmaps, originDepth );
|
|
899
|
+
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
_getImageBitmapFromHTML( image, texture ) {
|
|
905
|
+
|
|
906
|
+
const width = image.width;
|
|
907
|
+
const height = image.height;
|
|
908
|
+
|
|
909
|
+
const options = {};
|
|
910
|
+
|
|
911
|
+
options.imageOrientation = ( texture.flipY === true ) ? 'flipY' : 'none';
|
|
912
|
+
options.premultiplyAlpha = ( texture.premultiplyAlpha === true ) ? 'premultiply' : 'default';
|
|
913
|
+
|
|
914
|
+
return createImageBitmap( image, 0, 0, width, height, options );
|
|
915
|
+
|
|
916
|
+
}
|
|
917
|
+
|
|
662
918
|
_getImageBitmap( image, texture ) {
|
|
663
919
|
|
|
664
920
|
const width = image.width;
|
|
@@ -692,7 +948,7 @@ class WebGPUTextures {
|
|
|
692
948
|
|
|
693
949
|
mipLevelCount = texture.mipmaps.length;
|
|
694
950
|
|
|
695
|
-
} else if ( needsMipmaps
|
|
951
|
+
} else if ( needsMipmaps ) {
|
|
696
952
|
|
|
697
953
|
mipLevelCount = Math.floor( Math.log2( Math.max( width, height ) ) ) + 1;
|
|
698
954
|
|
|
@@ -716,8 +972,8 @@ class WebGPUTextures {
|
|
|
716
972
|
|
|
717
973
|
const faceImage = image.length > 0 ? image[ 0 ].image || image[ 0 ] : null;
|
|
718
974
|
|
|
719
|
-
width = faceImage
|
|
720
|
-
height = faceImage
|
|
975
|
+
width = faceImage ? faceImage.width : 1;
|
|
976
|
+
height = faceImage ? faceImage.height : 1;
|
|
721
977
|
depth = 6; // one image for each side of the cube map
|
|
722
978
|
|
|
723
979
|
} else if ( image !== null ) {
|