super-three 0.167.0 → 0.169.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 +532 -173
- package/build/three.module.js +532 -174
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +18173 -14266
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -4
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +27 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +40 -14
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +21 -1
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +2 -1
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +3 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +7 -0
- package/src/Three.js +1 -0
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +32 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +25 -5
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +21 -18
- package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +19 -0
- package/src/materials/Material.js +4 -7
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +56 -59
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +12 -10
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +16 -12
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +10 -6
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshNormalNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +14 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +22 -18
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +22 -12
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +71 -115
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +3 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +47 -14
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +24 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +53 -21
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +8 -5
- package/src/nodes/accessors/BufferNode.js +7 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/src/nodes/accessors/ClippingNode.js +19 -13
- package/src/nodes/accessors/CubeTextureNode.js +9 -8
- package/src/nodes/accessors/InstanceNode.js +19 -15
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +8 -5
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +56 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +9 -4
- package/src/nodes/accessors/ModelNode.js +47 -12
- package/src/nodes/accessors/ModelViewProjectionNode.js +12 -9
- package/src/nodes/accessors/MorphNode.js +17 -13
- package/src/nodes/accessors/Normal.js +88 -0
- package/src/nodes/accessors/Object3DNode.js +17 -33
- package/src/nodes/accessors/PointUVNode.js +9 -5
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/src/nodes/accessors/ReferenceNode.js +50 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +12 -6
- package/src/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +88 -21
- package/src/nodes/accessors/StorageBufferNode.js +22 -5
- package/src/nodes/accessors/StorageTextureNode.js +9 -6
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +16 -13
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +29 -23
- package/src/nodes/accessors/TextureSizeNode.js +10 -9
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +26 -14
- package/src/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/src/nodes/accessors/VertexColorNode.js +7 -4
- package/src/nodes/code/CodeNode.js +9 -5
- package/src/nodes/code/ExpressionNode.js +10 -6
- package/src/nodes/code/FunctionCallNode.js +8 -5
- package/src/nodes/code/FunctionNode.js +8 -23
- package/src/nodes/code/ScriptableNode.js +13 -10
- package/src/nodes/code/ScriptableValueNode.js +9 -7
- package/src/nodes/core/AssignNode.js +12 -9
- package/src/nodes/core/AttributeNode.js +12 -21
- package/src/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +10 -6
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +21 -11
- package/src/nodes/core/IndexNode.js +35 -8
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +16 -7
- package/src/nodes/core/Node.js +19 -40
- package/src/nodes/core/NodeBuilder.js +117 -38
- package/src/nodes/core/NodeUtils.js +49 -6
- package/src/nodes/core/OutputStructNode.js +10 -6
- package/src/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +36 -32
- package/src/nodes/core/StackNode.js +31 -11
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +14 -11
- package/src/nodes/core/UniformNode.js +7 -4
- package/src/nodes/core/VarNode.js +12 -8
- package/src/nodes/core/VaryingNode.js +10 -6
- package/src/nodes/display/AfterImageNode.js +15 -9
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/src/nodes/display/AnamorphicNode.js +17 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +27 -19
- package/src/nodes/display/BumpMapNode.js +13 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +67 -61
- package/src/nodes/display/DenoiseNode.js +23 -17
- package/src/nodes/display/DepthOfFieldNode.js +12 -7
- package/src/nodes/display/DotScreenNode.js +13 -22
- package/src/nodes/display/FXAANode.js +21 -16
- package/src/nodes/display/FilmNode.js +11 -7
- package/src/nodes/display/FrontFacingNode.js +10 -6
- package/src/nodes/display/GTAONode.js +22 -15
- package/src/nodes/display/GaussianBlurNode.js +14 -8
- package/src/nodes/display/Lut3DNode.js +10 -6
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +13 -13
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +95 -8
- package/src/nodes/display/PixelationPassNode.js +20 -8
- package/src/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +11 -7
- package/src/nodes/display/RenderOutputNode.js +15 -11
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +13 -8
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +15 -175
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +12 -8
- package/src/nodes/display/ViewportDepthNode.js +34 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +10 -9
- package/src/nodes/display/ViewportSharedTextureNode.js +10 -9
- package/src/nodes/display/ViewportTextureNode.js +11 -11
- package/src/nodes/fog/FogExp2Node.js +8 -7
- package/src/nodes/fog/FogNode.js +10 -8
- package/src/nodes/fog/FogRangeNode.js +8 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +34 -33
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +9 -5
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +225 -36
- package/src/nodes/lighting/BasicEnvironmentNode.js +8 -4
- package/src/nodes/lighting/BasicLightMapNode.js +7 -4
- package/src/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +23 -19
- package/src/nodes/lighting/HemisphereLightNode.js +11 -11
- package/src/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +19 -18
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +112 -75
- package/src/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +11 -11
- package/src/nodes/lighting/SpotLightNode.js +14 -16
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +38 -10
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +127 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +97 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +61 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +9 -6
- package/src/nodes/utils/FlipNode.js +68 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +9 -5
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +16 -6
- package/src/nodes/utils/MatcapUVNode.js +10 -7
- package/src/nodes/utils/MaxMipLevelNode.js +8 -5
- package/src/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +11 -8
- package/src/nodes/utils/ReflectorNode.js +12 -4
- package/src/nodes/utils/RemapNode.js +12 -8
- package/src/nodes/utils/RotateNode.js +8 -13
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +11 -12
- package/src/nodes/utils/TimerNode.js +8 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +78 -13
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +88 -41
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +15 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +23 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +117 -6
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +128 -94
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +19 -22
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +65 -19
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +3 -1
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +83 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +135 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +60 -12
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +20 -2
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +89 -37
- package/src/renderers/webgpu/WebGPUBackend.js +112 -86
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +9 -6
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +189 -73
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +7 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +43 -26
- package/src/renderers/webgpu/utils/WebGPUUtils.js +19 -2
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/accessors/CameraNode.js +0 -19
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/display/ViewportNode.js +0 -137
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
BufferGeometry,
|
|
6
6
|
ClampToEdgeWrapping,
|
|
7
7
|
Color,
|
|
8
|
+
ColorManagement,
|
|
8
9
|
DirectionalLight,
|
|
9
10
|
EquirectangularReflectionMapping,
|
|
10
11
|
Euler,
|
|
@@ -23,13 +24,14 @@ import {
|
|
|
23
24
|
MeshPhongMaterial,
|
|
24
25
|
NumberKeyframeTrack,
|
|
25
26
|
Object3D,
|
|
26
|
-
OrthographicCamera,
|
|
27
27
|
PerspectiveCamera,
|
|
28
28
|
PointLight,
|
|
29
29
|
PropertyBinding,
|
|
30
30
|
Quaternion,
|
|
31
31
|
QuaternionKeyframeTrack,
|
|
32
32
|
RepeatWrapping,
|
|
33
|
+
SRGBColorSpace,
|
|
34
|
+
ShapeUtils,
|
|
33
35
|
Skeleton,
|
|
34
36
|
SkinnedMesh,
|
|
35
37
|
SpotLight,
|
|
@@ -39,10 +41,9 @@ import {
|
|
|
39
41
|
Vector2,
|
|
40
42
|
Vector3,
|
|
41
43
|
Vector4,
|
|
42
|
-
VectorKeyframeTrack
|
|
43
|
-
SRGBColorSpace,
|
|
44
|
-
ShapeUtils
|
|
44
|
+
VectorKeyframeTrack
|
|
45
45
|
} from 'three';
|
|
46
|
+
|
|
46
47
|
import * as fflate from '../libs/fflate.module.js';
|
|
47
48
|
import { NURBSCurve } from '../curves/NURBSCurve.js';
|
|
48
49
|
|
|
@@ -538,12 +539,12 @@ class FBXTreeParser {
|
|
|
538
539
|
|
|
539
540
|
if ( materialNode.Diffuse ) {
|
|
540
541
|
|
|
541
|
-
parameters.color = new Color().fromArray( materialNode.Diffuse.value )
|
|
542
|
+
parameters.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Diffuse.value ), SRGBColorSpace );
|
|
542
543
|
|
|
543
544
|
} else if ( materialNode.DiffuseColor && ( materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB' ) ) {
|
|
544
545
|
|
|
545
546
|
// The blender exporter exports diffuse here instead of in materialNode.Diffuse
|
|
546
|
-
parameters.color = new Color().fromArray( materialNode.DiffuseColor.value )
|
|
547
|
+
parameters.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.DiffuseColor.value ), SRGBColorSpace );
|
|
547
548
|
|
|
548
549
|
}
|
|
549
550
|
|
|
@@ -555,12 +556,12 @@ class FBXTreeParser {
|
|
|
555
556
|
|
|
556
557
|
if ( materialNode.Emissive ) {
|
|
557
558
|
|
|
558
|
-
parameters.emissive = new Color().fromArray( materialNode.Emissive.value )
|
|
559
|
+
parameters.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Emissive.value ), SRGBColorSpace );
|
|
559
560
|
|
|
560
561
|
} else if ( materialNode.EmissiveColor && ( materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB' ) ) {
|
|
561
562
|
|
|
562
563
|
// The blender exporter exports emissive color here instead of in materialNode.Emissive
|
|
563
|
-
parameters.emissive = new Color().fromArray( materialNode.EmissiveColor.value )
|
|
564
|
+
parameters.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.EmissiveColor.value ), SRGBColorSpace );
|
|
564
565
|
|
|
565
566
|
}
|
|
566
567
|
|
|
@@ -596,12 +597,12 @@ class FBXTreeParser {
|
|
|
596
597
|
|
|
597
598
|
if ( materialNode.Specular ) {
|
|
598
599
|
|
|
599
|
-
parameters.specular = new Color().fromArray( materialNode.Specular.value )
|
|
600
|
+
parameters.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Specular.value ), SRGBColorSpace );
|
|
600
601
|
|
|
601
602
|
} else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) {
|
|
602
603
|
|
|
603
604
|
// The blender exporter exports specular color here instead of in materialNode.Specular
|
|
604
|
-
parameters.specular = new Color().fromArray( materialNode.SpecularColor.value )
|
|
605
|
+
parameters.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.SpecularColor.value ), SRGBColorSpace );
|
|
605
606
|
|
|
606
607
|
}
|
|
607
608
|
|
|
@@ -1094,7 +1095,8 @@ class FBXTreeParser {
|
|
|
1094
1095
|
break;
|
|
1095
1096
|
|
|
1096
1097
|
case 1: // Orthographic
|
|
1097
|
-
|
|
1098
|
+
console.warn( 'THREE.FBXLoader: Orthographic cameras not supported yet.' );
|
|
1099
|
+
model = new Object3D();
|
|
1098
1100
|
break;
|
|
1099
1101
|
|
|
1100
1102
|
default:
|
|
@@ -1151,7 +1153,7 @@ class FBXTreeParser {
|
|
|
1151
1153
|
|
|
1152
1154
|
if ( lightAttribute.Color !== undefined ) {
|
|
1153
1155
|
|
|
1154
|
-
color = new Color().fromArray( lightAttribute.Color.value )
|
|
1156
|
+
color = ColorManagement.toWorkingColorSpace( new Color().fromArray( lightAttribute.Color.value ), SRGBColorSpace );
|
|
1155
1157
|
|
|
1156
1158
|
}
|
|
1157
1159
|
|
|
@@ -1329,7 +1331,7 @@ class FBXTreeParser {
|
|
|
1329
1331
|
if ( 'InheritType' in modelNode ) transformData.inheritType = parseInt( modelNode.InheritType.value );
|
|
1330
1332
|
|
|
1331
1333
|
if ( 'RotationOrder' in modelNode ) transformData.eulerOrder = getEulerOrder( modelNode.RotationOrder.value );
|
|
1332
|
-
else transformData.eulerOrder =
|
|
1334
|
+
else transformData.eulerOrder = getEulerOrder( 0 );
|
|
1333
1335
|
|
|
1334
1336
|
if ( 'Lcl_Translation' in modelNode ) transformData.translation = modelNode.Lcl_Translation.value;
|
|
1335
1337
|
|
|
@@ -1477,7 +1479,7 @@ class FBXTreeParser {
|
|
|
1477
1479
|
|
|
1478
1480
|
if ( r !== 0 || g !== 0 || b !== 0 ) {
|
|
1479
1481
|
|
|
1480
|
-
const color = new Color( r, g, b )
|
|
1482
|
+
const color = new Color().setRGB( r, g, b, SRGBColorSpace );
|
|
1481
1483
|
sceneGraph.add( new AmbientLight( color, 1 ) );
|
|
1482
1484
|
|
|
1483
1485
|
}
|
|
@@ -2319,7 +2321,9 @@ class GeometryParser {
|
|
|
2319
2321
|
|
|
2320
2322
|
for ( let i = 0, c = new Color(); i < buffer.length; i += 4 ) {
|
|
2321
2323
|
|
|
2322
|
-
c.fromArray( buffer, i )
|
|
2324
|
+
c.fromArray( buffer, i );
|
|
2325
|
+
ColorManagement.toWorkingColorSpace( c, SRGBColorSpace );
|
|
2326
|
+
c.toArray( buffer, i );
|
|
2323
2327
|
|
|
2324
2328
|
}
|
|
2325
2329
|
|
|
@@ -2809,10 +2813,13 @@ class AnimationParser {
|
|
|
2809
2813
|
|
|
2810
2814
|
}
|
|
2811
2815
|
|
|
2816
|
+
// For Maya models using "Joint Orient", Euler order only applies to rotation, not pre/post-rotations
|
|
2817
|
+
const defaultEulerOrder = getEulerOrder( 0 );
|
|
2818
|
+
|
|
2812
2819
|
if ( preRotation !== undefined ) {
|
|
2813
2820
|
|
|
2814
2821
|
preRotation = preRotation.map( MathUtils.degToRad );
|
|
2815
|
-
preRotation.push(
|
|
2822
|
+
preRotation.push( defaultEulerOrder );
|
|
2816
2823
|
|
|
2817
2824
|
preRotation = new Euler().fromArray( preRotation );
|
|
2818
2825
|
preRotation = new Quaternion().setFromEuler( preRotation );
|
|
@@ -2822,7 +2829,7 @@ class AnimationParser {
|
|
|
2822
2829
|
if ( postRotation !== undefined ) {
|
|
2823
2830
|
|
|
2824
2831
|
postRotation = postRotation.map( MathUtils.degToRad );
|
|
2825
|
-
postRotation.push(
|
|
2832
|
+
postRotation.push( defaultEulerOrder );
|
|
2826
2833
|
|
|
2827
2834
|
postRotation = new Euler().fromArray( postRotation );
|
|
2828
2835
|
postRotation = new Quaternion().setFromEuler( postRotation ).invert();
|
|
@@ -4134,10 +4141,13 @@ function generateTransform( transformData ) {
|
|
|
4134
4141
|
|
|
4135
4142
|
if ( transformData.translation ) lTranslationM.setPosition( tempVec.fromArray( transformData.translation ) );
|
|
4136
4143
|
|
|
4144
|
+
// For Maya models using "Joint Orient", Euler order only applies to rotation, not pre/post-rotations
|
|
4145
|
+
const defaultEulerOrder = getEulerOrder( 0 );
|
|
4146
|
+
|
|
4137
4147
|
if ( transformData.preRotation ) {
|
|
4138
4148
|
|
|
4139
4149
|
const array = transformData.preRotation.map( MathUtils.degToRad );
|
|
4140
|
-
array.push(
|
|
4150
|
+
array.push( defaultEulerOrder );
|
|
4141
4151
|
lPreRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
|
|
4142
4152
|
|
|
4143
4153
|
}
|
|
@@ -4145,7 +4155,7 @@ function generateTransform( transformData ) {
|
|
|
4145
4155
|
if ( transformData.rotation ) {
|
|
4146
4156
|
|
|
4147
4157
|
const array = transformData.rotation.map( MathUtils.degToRad );
|
|
4148
|
-
array.push( transformData.eulerOrder ||
|
|
4158
|
+
array.push( transformData.eulerOrder || defaultEulerOrder );
|
|
4149
4159
|
lRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
|
|
4150
4160
|
|
|
4151
4161
|
}
|
|
@@ -4153,7 +4163,7 @@ function generateTransform( transformData ) {
|
|
|
4153
4163
|
if ( transformData.postRotation ) {
|
|
4154
4164
|
|
|
4155
4165
|
const array = transformData.postRotation.map( MathUtils.degToRad );
|
|
4156
|
-
array.push(
|
|
4166
|
+
array.push( defaultEulerOrder );
|
|
4157
4167
|
lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
|
|
4158
4168
|
lPostRotationM.invert();
|
|
4159
4169
|
|
|
@@ -267,16 +267,6 @@ class GLTFLoader extends Loader {
|
|
|
267
267
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
setDDSLoader() {
|
|
271
|
-
|
|
272
|
-
throw new Error(
|
|
273
|
-
|
|
274
|
-
'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
|
|
275
|
-
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
270
|
setKTX2Loader( ktx2Loader ) {
|
|
281
271
|
|
|
282
272
|
this.ktx2Loader = ktx2Loader;
|
|
@@ -3153,6 +3143,9 @@ class GLTFParser {
|
|
|
3153
3143
|
|
|
3154
3144
|
}
|
|
3155
3145
|
|
|
3146
|
+
// Ignore normalized since we copy from sparse
|
|
3147
|
+
bufferAttribute.normalized = false;
|
|
3148
|
+
|
|
3156
3149
|
for ( let i = 0, il = sparseIndices.length; i < il; i ++ ) {
|
|
3157
3150
|
|
|
3158
3151
|
const index = sparseIndices[ i ];
|
|
@@ -3165,6 +3158,8 @@ class GLTFParser {
|
|
|
3165
3158
|
|
|
3166
3159
|
}
|
|
3167
3160
|
|
|
3161
|
+
bufferAttribute.normalized = normalized;
|
|
3162
|
+
|
|
3168
3163
|
}
|
|
3169
3164
|
|
|
3170
3165
|
return bufferAttribute;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* References:
|
|
10
10
|
* - KTX: http://github.khronos.org/KTX-Specification/
|
|
11
11
|
* - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor
|
|
12
|
+
* - BasisU HDR: https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import {
|
|
@@ -63,6 +64,7 @@ import {
|
|
|
63
64
|
VK_FORMAT_R8G8_UNORM,
|
|
64
65
|
VK_FORMAT_R8G8B8A8_SRGB,
|
|
65
66
|
VK_FORMAT_R8G8B8A8_UNORM,
|
|
67
|
+
VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT,
|
|
66
68
|
VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
|
|
67
69
|
VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
|
|
68
70
|
KHR_DF_PRIMARIES_UNSPECIFIED,
|
|
@@ -251,21 +253,33 @@ class KTX2Loader extends Loader {
|
|
|
251
253
|
|
|
252
254
|
loader.load( url, ( buffer ) => {
|
|
253
255
|
|
|
254
|
-
|
|
255
|
-
// again from this thread.
|
|
256
|
-
if ( _taskCache.has( buffer ) ) {
|
|
256
|
+
this.parse( buffer, onLoad, onError );
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
}, onProgress, onError );
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
}
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
parse( buffer, onLoad, onError ) {
|
|
263
263
|
|
|
264
|
-
|
|
265
|
-
.then( ( texture ) => onLoad ? onLoad( texture ) : null )
|
|
266
|
-
.catch( onError );
|
|
264
|
+
if ( this.workerConfig === null ) {
|
|
267
265
|
|
|
268
|
-
|
|
266
|
+
throw new Error( 'THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.' );
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Check for an existing task using this buffer. A transferred buffer cannot be transferred
|
|
271
|
+
// again from this thread.
|
|
272
|
+
if ( _taskCache.has( buffer ) ) {
|
|
273
|
+
|
|
274
|
+
const cachedTask = _taskCache.get( buffer );
|
|
275
|
+
|
|
276
|
+
return cachedTask.promise.then( onLoad ).catch( onError );
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
this._createTexture( buffer )
|
|
281
|
+
.then( ( texture ) => onLoad ? onLoad( texture ) : null )
|
|
282
|
+
.catch( onError );
|
|
269
283
|
|
|
270
284
|
}
|
|
271
285
|
|
|
@@ -718,8 +732,7 @@ KTX2Loader.BasisWorker = function () {
|
|
|
718
732
|
|
|
719
733
|
};
|
|
720
734
|
|
|
721
|
-
//
|
|
722
|
-
// Parsing for non-Basis textures. These textures are may have supercompression
|
|
735
|
+
// Parsing for non-Basis textures. These textures may have supercompression
|
|
723
736
|
// like Zstd, but they do not require transcoding.
|
|
724
737
|
|
|
725
738
|
const UNCOMPRESSED_FORMATS = new Set( [ RGBAFormat, RGFormat, RedFormat ] );
|
|
@@ -741,6 +754,7 @@ const FORMAT_MAP = {
|
|
|
741
754
|
[ VK_FORMAT_R8_SRGB ]: RedFormat,
|
|
742
755
|
[ VK_FORMAT_R8_UNORM ]: RedFormat,
|
|
743
756
|
|
|
757
|
+
[ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: RGBA_ASTC_4x4_Format,
|
|
744
758
|
[ VK_FORMAT_ASTC_6x6_SRGB_BLOCK ]: RGBA_ASTC_6x6_Format,
|
|
745
759
|
[ VK_FORMAT_ASTC_6x6_UNORM_BLOCK ]: RGBA_ASTC_6x6_Format,
|
|
746
760
|
|
|
@@ -763,6 +777,7 @@ const TYPE_MAP = {
|
|
|
763
777
|
[ VK_FORMAT_R8_SRGB ]: UnsignedByteType,
|
|
764
778
|
[ VK_FORMAT_R8_UNORM ]: UnsignedByteType,
|
|
765
779
|
|
|
780
|
+
[ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: HalfFloatType,
|
|
766
781
|
[ VK_FORMAT_ASTC_6x6_SRGB_BLOCK ]: UnsignedByteType,
|
|
767
782
|
[ VK_FORMAT_ASTC_6x6_UNORM_BLOCK ]: UnsignedByteType,
|
|
768
783
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Color,
|
|
3
|
+
ColorManagement,
|
|
3
4
|
DefaultLoadingManager,
|
|
4
5
|
FileLoader,
|
|
5
6
|
FrontSide,
|
|
@@ -384,21 +385,21 @@ class MaterialCreator {
|
|
|
384
385
|
|
|
385
386
|
// Diffuse color (color under white light) using RGB values
|
|
386
387
|
|
|
387
|
-
params.color = new Color().fromArray( value )
|
|
388
|
+
params.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( value ), SRGBColorSpace );
|
|
388
389
|
|
|
389
390
|
break;
|
|
390
391
|
|
|
391
392
|
case 'ks':
|
|
392
393
|
|
|
393
394
|
// Specular color (color when light is reflected from shiny surface) using RGB values
|
|
394
|
-
params.specular = new Color().fromArray( value )
|
|
395
|
+
params.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( value ), SRGBColorSpace );
|
|
395
396
|
|
|
396
397
|
break;
|
|
397
398
|
|
|
398
399
|
case 'ke':
|
|
399
400
|
|
|
400
401
|
// Emissive using RGB values
|
|
401
|
-
params.emissive = new Color().fromArray( value )
|
|
402
|
+
params.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( value ), SRGBColorSpace );
|
|
402
403
|
|
|
403
404
|
break;
|
|
404
405
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import { FileLoader, Loader, TextureLoader, MeshBasicNodeMaterial, MeshPhysicalNodeMaterial, RepeatWrapping } from 'three';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
|
-
FileLoader, Loader, TextureLoader, MeshBasicNodeMaterial, MeshPhysicalNodeMaterial, RepeatWrapping,
|
|
3
4
|
float, bool, int, vec2, vec3, vec4, color, texture,
|
|
4
5
|
positionLocal, positionWorld, uv, vertexColor,
|
|
5
6
|
normalLocal, normalWorld, tangentLocal, tangentWorld,
|
|
6
7
|
add, sub, mul, div, mod, abs, sign, floor, ceil, round, pow, sin, cos, tan,
|
|
7
8
|
asin, acos, atan2, sqrt, exp, clamp, min, max, normalize, length, dot, cross, normalMap,
|
|
8
9
|
remap, smoothstep, luminance, mx_rgbtohsv, mx_hsvtorgb,
|
|
9
|
-
mix,
|
|
10
|
+
mix, split,
|
|
10
11
|
mx_ramplr, mx_ramptb, mx_splitlr, mx_splittb,
|
|
11
12
|
mx_fractal_noise_float, mx_noise_float, mx_cell_noise_float, mx_worley_noise_float,
|
|
12
13
|
mx_transform_uv,
|
|
13
14
|
mx_safepower, mx_contrast,
|
|
14
15
|
mx_srgb_texture_to_lin_rec709,
|
|
15
|
-
saturation
|
|
16
|
-
|
|
16
|
+
saturation,
|
|
17
|
+
timerLocal, frameId
|
|
18
|
+
} from 'three/tsl';
|
|
17
19
|
|
|
18
20
|
const colorSpaceLib = {
|
|
19
21
|
mx_srgb_texture_to_lin_rec709
|
|
@@ -21,7 +23,7 @@ const colorSpaceLib = {
|
|
|
21
23
|
|
|
22
24
|
class MXElement {
|
|
23
25
|
|
|
24
|
-
constructor( name, nodeFunc, params =
|
|
26
|
+
constructor( name, nodeFunc, params = [] ) {
|
|
25
27
|
|
|
26
28
|
this.name = name;
|
|
27
29
|
this.nodeFunc = nodeFunc;
|
|
@@ -40,6 +42,12 @@ const mx_divide = ( in1, in2 = float( 1 ) ) => div( in1, in2 );
|
|
|
40
42
|
const mx_modulo = ( in1, in2 = float( 1 ) ) => mod( in1, in2 );
|
|
41
43
|
const mx_power = ( in1, in2 = float( 1 ) ) => pow( in1, in2 );
|
|
42
44
|
const mx_atan2 = ( in1 = float( 0 ), in2 = float( 1 ) ) => atan2( in1, in2 );
|
|
45
|
+
const mx_timer = () => timerLocal();
|
|
46
|
+
const mx_frame = () => frameId;
|
|
47
|
+
const mx_invert = ( in1, amount = float( 1 ) ) => sub( amount, in1 );
|
|
48
|
+
|
|
49
|
+
const separate = ( in1, channel ) => split( in1, channel.at( - 1 ) );
|
|
50
|
+
const extract = ( in1, index ) => in1.element( index );
|
|
43
51
|
|
|
44
52
|
const MXElements = [
|
|
45
53
|
|
|
@@ -71,6 +79,7 @@ const MXElements = [
|
|
|
71
79
|
new MXElement( 'magnitude', length, [ 'in1', 'in2' ] ),
|
|
72
80
|
new MXElement( 'dotproduct', dot, [ 'in1', 'in2' ] ),
|
|
73
81
|
new MXElement( 'crossproduct', cross, [ 'in' ] ),
|
|
82
|
+
new MXElement( 'invert', mx_invert, [ 'in', 'amount' ] ),
|
|
74
83
|
//new MtlXElement( 'transformpoint', ... ),
|
|
75
84
|
//new MtlXElement( 'transformvector', ... ),
|
|
76
85
|
//new MtlXElement( 'transformnormal', ... ),
|
|
@@ -123,10 +132,13 @@ const MXElements = [
|
|
|
123
132
|
new MXElement( 'contrast', mx_contrast, [ 'in', 'amount', 'pivot' ] ),
|
|
124
133
|
//new MtlXElement( 'hsvadjust', ... ),
|
|
125
134
|
new MXElement( 'saturate', saturation, [ 'in', 'amount' ] ),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
new MXElement( 'extract', extract, [ 'in', 'index' ] ),
|
|
136
|
+
new MXElement( 'separate2', separate, [ 'in' ] ),
|
|
137
|
+
new MXElement( 'separate3', separate, [ 'in' ] ),
|
|
138
|
+
new MXElement( 'separate4', separate, [ 'in' ] ),
|
|
139
|
+
|
|
140
|
+
new MXElement( 'time', mx_timer ),
|
|
141
|
+
new MXElement( 'frame', mx_frame )
|
|
130
142
|
|
|
131
143
|
];
|
|
132
144
|
|
|
@@ -362,11 +374,11 @@ class MaterialXNode {
|
|
|
362
374
|
|
|
363
375
|
}
|
|
364
376
|
|
|
365
|
-
getNode() {
|
|
377
|
+
getNode( out = null ) {
|
|
366
378
|
|
|
367
379
|
let node = this.node;
|
|
368
380
|
|
|
369
|
-
if ( node !== null ) {
|
|
381
|
+
if ( node !== null && out === null ) {
|
|
370
382
|
|
|
371
383
|
return node;
|
|
372
384
|
|
|
@@ -384,7 +396,13 @@ class MaterialXNode {
|
|
|
384
396
|
|
|
385
397
|
} else if ( this.hasReference ) {
|
|
386
398
|
|
|
387
|
-
|
|
399
|
+
if ( this.element === 'output' && this.output && out === null ) {
|
|
400
|
+
|
|
401
|
+
out = this.output;
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
node = this.materialX.getMaterialXNode( this.referencePath ).getNode( out );
|
|
388
406
|
|
|
389
407
|
} else {
|
|
390
408
|
|
|
@@ -467,7 +485,15 @@ class MaterialXNode {
|
|
|
467
485
|
|
|
468
486
|
const nodeElement = MtlXLibrary[ element ];
|
|
469
487
|
|
|
470
|
-
|
|
488
|
+
if ( out !== null ) {
|
|
489
|
+
|
|
490
|
+
node = nodeElement.nodeFunc( ...this.getNodesByNames( ...nodeElement.params ), out );
|
|
491
|
+
|
|
492
|
+
} else {
|
|
493
|
+
|
|
494
|
+
node = nodeElement.nodeFunc( ...this.getNodesByNames( ...nodeElement.params ) );
|
|
495
|
+
|
|
496
|
+
}
|
|
471
497
|
|
|
472
498
|
}
|
|
473
499
|
|
|
@@ -535,7 +561,7 @@ class MaterialXNode {
|
|
|
535
561
|
|
|
536
562
|
const child = this.getChildByName( name );
|
|
537
563
|
|
|
538
|
-
return child ? child.getNode() : undefined;
|
|
564
|
+
return child ? child.getNode( child.output ) : undefined;
|
|
539
565
|
|
|
540
566
|
}
|
|
541
567
|
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
Points,
|
|
13
13
|
PointsMaterial,
|
|
14
14
|
Vector3,
|
|
15
|
-
Color
|
|
15
|
+
Color,
|
|
16
|
+
SRGBColorSpace
|
|
16
17
|
} from 'three';
|
|
17
18
|
|
|
18
19
|
// o object_name | g group_name
|
|
@@ -534,8 +535,9 @@ class OBJLoader extends Loader {
|
|
|
534
535
|
_color.setRGB(
|
|
535
536
|
parseFloat( data[ 4 ] ),
|
|
536
537
|
parseFloat( data[ 5 ] ),
|
|
537
|
-
parseFloat( data[ 6 ] )
|
|
538
|
-
|
|
538
|
+
parseFloat( data[ 6 ] ),
|
|
539
|
+
SRGBColorSpace
|
|
540
|
+
);
|
|
539
541
|
|
|
540
542
|
state.colors.push( _color.r, _color.g, _color.b );
|
|
541
543
|
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
Int32BufferAttribute,
|
|
7
7
|
Loader,
|
|
8
8
|
Points,
|
|
9
|
-
PointsMaterial
|
|
9
|
+
PointsMaterial,
|
|
10
|
+
SRGBColorSpace
|
|
10
11
|
} from 'three';
|
|
11
12
|
|
|
12
13
|
class PCDLoader extends Loader {
|
|
@@ -127,15 +128,15 @@ class PCDLoader extends Loader {
|
|
|
127
128
|
|
|
128
129
|
// parse
|
|
129
130
|
|
|
130
|
-
PCDheader.version =
|
|
131
|
-
PCDheader.fields =
|
|
132
|
-
PCDheader.size =
|
|
133
|
-
PCDheader.type =
|
|
134
|
-
PCDheader.count =
|
|
135
|
-
PCDheader.width =
|
|
136
|
-
PCDheader.height =
|
|
137
|
-
PCDheader.viewpoint =
|
|
138
|
-
PCDheader.points =
|
|
131
|
+
PCDheader.version = /^VERSION (.*)/im.exec( PCDheader.str );
|
|
132
|
+
PCDheader.fields = /^FIELDS (.*)/im.exec( PCDheader.str );
|
|
133
|
+
PCDheader.size = /^SIZE (.*)/im.exec( PCDheader.str );
|
|
134
|
+
PCDheader.type = /^TYPE (.*)/im.exec( PCDheader.str );
|
|
135
|
+
PCDheader.count = /^COUNT (.*)/im.exec( PCDheader.str );
|
|
136
|
+
PCDheader.width = /^WIDTH (.*)/im.exec( PCDheader.str );
|
|
137
|
+
PCDheader.height = /^HEIGHT (.*)/im.exec( PCDheader.str );
|
|
138
|
+
PCDheader.viewpoint = /^VIEWPOINT (.*)/im.exec( PCDheader.str );
|
|
139
|
+
PCDheader.points = /^POINTS (.*)/im.exec( PCDheader.str );
|
|
139
140
|
|
|
140
141
|
// evaluate
|
|
141
142
|
|
|
@@ -279,7 +280,7 @@ class PCDLoader extends Loader {
|
|
|
279
280
|
const g = ( ( rgb >> 8 ) & 0x0000ff ) / 255;
|
|
280
281
|
const b = ( ( rgb >> 0 ) & 0x0000ff ) / 255;
|
|
281
282
|
|
|
282
|
-
c.
|
|
283
|
+
c.setRGB( r, g, b, SRGBColorSpace );
|
|
283
284
|
|
|
284
285
|
color.push( c.r, c.g, c.b );
|
|
285
286
|
|
|
@@ -346,7 +347,7 @@ class PCDLoader extends Loader {
|
|
|
346
347
|
const g = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 1 ) / 255.0;
|
|
347
348
|
const b = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 0 ) / 255.0;
|
|
348
349
|
|
|
349
|
-
c.
|
|
350
|
+
c.setRGB( r, g, b, SRGBColorSpace );
|
|
350
351
|
|
|
351
352
|
color.push( c.r, c.g, c.b );
|
|
352
353
|
|
|
@@ -404,7 +405,7 @@ class PCDLoader extends Loader {
|
|
|
404
405
|
const g = dataview.getUint8( row + offset.rgb + 1 ) / 255.0;
|
|
405
406
|
const b = dataview.getUint8( row + offset.rgb + 0 ) / 255.0;
|
|
406
407
|
|
|
407
|
-
c.
|
|
408
|
+
c.setRGB( r, g, b, SRGBColorSpace );
|
|
408
409
|
|
|
409
410
|
color.push( c.r, c.g, c.b );
|
|
410
411
|
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
FileLoader,
|
|
4
4
|
Float32BufferAttribute,
|
|
5
5
|
Loader,
|
|
6
|
-
Color
|
|
6
|
+
Color,
|
|
7
|
+
SRGBColorSpace
|
|
7
8
|
} from 'three';
|
|
8
9
|
|
|
9
10
|
class PDBLoader extends Loader {
|
|
@@ -131,7 +132,7 @@ class PDBLoader extends Loader {
|
|
|
131
132
|
const g = atom[ 3 ][ 1 ] / 255;
|
|
132
133
|
const b = atom[ 3 ][ 2 ] / 255;
|
|
133
134
|
|
|
134
|
-
c.
|
|
135
|
+
c.setRGB( r, g, b, SRGBColorSpace );
|
|
135
136
|
|
|
136
137
|
colorsAtoms.push( c.r, c.g, c.b );
|
|
137
138
|
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
FileLoader,
|
|
4
4
|
Float32BufferAttribute,
|
|
5
5
|
Loader,
|
|
6
|
-
Color
|
|
6
|
+
Color,
|
|
7
|
+
SRGBColorSpace
|
|
7
8
|
} from 'three';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -468,8 +469,9 @@ class PLYLoader extends Loader {
|
|
|
468
469
|
_color.setRGB(
|
|
469
470
|
element[ cacheEntry.attrR ] / 255.0,
|
|
470
471
|
element[ cacheEntry.attrG ] / 255.0,
|
|
471
|
-
element[ cacheEntry.attrB ] / 255.0
|
|
472
|
-
|
|
472
|
+
element[ cacheEntry.attrB ] / 255.0,
|
|
473
|
+
SRGBColorSpace
|
|
474
|
+
);
|
|
473
475
|
|
|
474
476
|
buffer.colors.push( _color.r, _color.g, _color.b );
|
|
475
477
|
|
|
@@ -516,8 +518,9 @@ class PLYLoader extends Loader {
|
|
|
516
518
|
_color.setRGB(
|
|
517
519
|
element[ cacheEntry.attrR ] / 255.0,
|
|
518
520
|
element[ cacheEntry.attrG ] / 255.0,
|
|
519
|
-
element[ cacheEntry.attrB ] / 255.0
|
|
520
|
-
|
|
521
|
+
element[ cacheEntry.attrB ] / 255.0,
|
|
522
|
+
SRGBColorSpace
|
|
523
|
+
);
|
|
521
524
|
buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
522
525
|
buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
523
526
|
buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
FileLoader,
|
|
6
6
|
Float32BufferAttribute,
|
|
7
7
|
Loader,
|
|
8
|
-
Vector3
|
|
8
|
+
Vector3,
|
|
9
|
+
SRGBColorSpace
|
|
9
10
|
} from 'three';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -242,7 +243,7 @@ class STLLoader extends Loader {
|
|
|
242
243
|
|
|
243
244
|
if ( hasColors ) {
|
|
244
245
|
|
|
245
|
-
color.
|
|
246
|
+
color.setRGB( r, g, b, SRGBColorSpace );
|
|
246
247
|
|
|
247
248
|
colors[ componentIdx ] = color.r;
|
|
248
249
|
colors[ componentIdx + 1 ] = color.g;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
BufferGeometry,
|
|
6
6
|
ClampToEdgeWrapping,
|
|
7
7
|
Color,
|
|
8
|
+
ColorManagement,
|
|
8
9
|
ConeGeometry,
|
|
9
10
|
CylinderGeometry,
|
|
10
11
|
DataTexture,
|
|
@@ -918,8 +919,7 @@ class VRMLLoader extends Loader {
|
|
|
918
919
|
|
|
919
920
|
} else {
|
|
920
921
|
|
|
921
|
-
skyMaterial.color.setRGB( skyColor[ 0 ], skyColor[ 1 ], skyColor[ 2 ] );
|
|
922
|
-
skyMaterial.color.convertSRGBToLinear();
|
|
922
|
+
skyMaterial.color.setRGB( skyColor[ 0 ], skyColor[ 1 ], skyColor[ 2 ], SRGBColorSpace );
|
|
923
923
|
|
|
924
924
|
}
|
|
925
925
|
|
|
@@ -1240,13 +1240,11 @@ class VRMLLoader extends Loader {
|
|
|
1240
1240
|
break;
|
|
1241
1241
|
|
|
1242
1242
|
case 'diffuseColor':
|
|
1243
|
-
materialData.diffuseColor = new Color( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
1244
|
-
materialData.diffuseColor.convertSRGBToLinear();
|
|
1243
|
+
materialData.diffuseColor = new Color().setRGB( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ], SRGBColorSpace );
|
|
1245
1244
|
break;
|
|
1246
1245
|
|
|
1247
1246
|
case 'emissiveColor':
|
|
1248
|
-
materialData.emissiveColor = new Color( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
1249
|
-
materialData.emissiveColor.convertSRGBToLinear();
|
|
1247
|
+
materialData.emissiveColor = new Color().setRGB( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ], SRGBColorSpace );
|
|
1250
1248
|
break;
|
|
1251
1249
|
|
|
1252
1250
|
case 'shininess':
|
|
@@ -1254,8 +1252,7 @@ class VRMLLoader extends Loader {
|
|
|
1254
1252
|
break;
|
|
1255
1253
|
|
|
1256
1254
|
case 'specularColor':
|
|
1257
|
-
materialData.specularColor = new Color( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
1258
|
-
materialData.specularColor.convertSRGBToLinear();
|
|
1255
|
+
materialData.specularColor = new Color().setRGB( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ], SRGBColorSpace );
|
|
1259
1256
|
break;
|
|
1260
1257
|
|
|
1261
1258
|
case 'transparency':
|
|
@@ -3111,7 +3108,8 @@ class VRMLLoader extends Loader {
|
|
|
3111
3108
|
for ( let i = 0; i < attribute.count; i ++ ) {
|
|
3112
3109
|
|
|
3113
3110
|
color.fromBufferAttribute( attribute, i );
|
|
3114
|
-
|
|
3111
|
+
|
|
3112
|
+
ColorManagement.toWorkingColorSpace( color, SRGBColorSpace );
|
|
3115
3113
|
|
|
3116
3114
|
attribute.setXYZ( i, color.r, color.g, color.b );
|
|
3117
3115
|
|
|
@@ -3216,7 +3214,9 @@ class VRMLLoader extends Loader {
|
|
|
3216
3214
|
const colorA = colors[ thresholdIndexA ];
|
|
3217
3215
|
const colorB = colors[ thresholdIndexB ];
|
|
3218
3216
|
|
|
3219
|
-
color.copy( colorA ).lerp( colorB, t )
|
|
3217
|
+
color.copy( colorA ).lerp( colorB, t );
|
|
3218
|
+
|
|
3219
|
+
ColorManagement.toWorkingColorSpace( color, SRGBColorSpace );
|
|
3220
3220
|
|
|
3221
3221
|
colorAttribute.setXYZ( index, color.r, color.g, color.b );
|
|
3222
3222
|
|