super-three 0.152.0 → 0.154.1
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 +778 -557
- package/build/three.js +778 -557
- package/build/three.min.js +1 -1
- package/build/three.module.js +769 -539
- package/build/three.module.min.js +1 -1
- package/examples/jsm/cameras/CinematicCamera.js +1 -2
- package/examples/jsm/capabilities/WebGPU.js +15 -1
- package/examples/jsm/controls/ArcballControls.js +2 -1
- package/examples/jsm/controls/FlyControls.js +25 -9
- package/examples/jsm/controls/OrbitControls.js +5 -1
- package/examples/jsm/csm/CSM.js +1 -3
- package/examples/jsm/effects/AnaglyphEffect.js +6 -20
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/effects/ParallaxBarrierEffect.js +3 -0
- package/examples/jsm/environments/RoomEnvironment.js +6 -2
- package/examples/jsm/exporters/GLTFExporter.js +74 -2
- package/examples/jsm/exporters/USDZExporter.js +170 -129
- package/examples/jsm/helpers/ViewHelper.js +1 -1
- package/examples/jsm/lines/LineMaterial.js +1 -1
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +5 -1
- package/examples/jsm/loaders/AMFLoader.js +5 -1
- package/examples/jsm/loaders/ColladaLoader.js +4 -1
- package/examples/jsm/loaders/DRACOLoader.js +2 -0
- package/examples/jsm/loaders/FBXLoader.js +9 -2
- package/examples/jsm/loaders/GLTFLoader.js +230 -94
- package/examples/jsm/loaders/KTX2Loader.js +106 -47
- package/examples/jsm/loaders/LDrawLoader.js +4 -7
- package/examples/jsm/loaders/MMDLoader.js +40 -13
- package/examples/jsm/loaders/PCDLoader.js +25 -10
- package/examples/jsm/loaders/PDBLoader.js +7 -2
- package/examples/jsm/loaders/PLYLoader.js +30 -8
- package/examples/jsm/loaders/STLLoader.js +8 -3
- package/examples/jsm/loaders/VRMLLoader.js +55 -7
- package/examples/jsm/loaders/VTKLoader.js +12 -4
- package/examples/jsm/loaders/XYZLoader.js +9 -3
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -2
- package/examples/jsm/math/Lut.js +5 -4
- package/examples/jsm/math/MeshSurfaceSampler.js +82 -37
- package/examples/jsm/misc/GPUComputationRenderer.js +1 -0
- package/examples/jsm/misc/VolumeSlice.js +3 -1
- package/examples/jsm/nodes/Nodes.js +22 -16
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +99 -0
- package/examples/jsm/nodes/accessors/BufferNode.js +2 -2
- package/examples/jsm/nodes/accessors/CameraNode.js +25 -4
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +7 -1
- package/examples/jsm/nodes/accessors/InstanceNode.js +29 -12
- package/examples/jsm/nodes/accessors/MaterialNode.js +55 -47
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +3 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +4 -9
- package/examples/jsm/nodes/accessors/MorphNode.js +70 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +3 -2
- package/examples/jsm/nodes/accessors/Object3DNode.js +10 -2
- package/examples/jsm/nodes/accessors/ReferenceNode.js +2 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +46 -0
- package/examples/jsm/nodes/accessors/SkinningNode.js +43 -62
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +2 -2
- package/examples/jsm/nodes/accessors/TangentNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +68 -6
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -0
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/code/CodeNode.js +3 -0
- package/examples/jsm/nodes/code/FunctionNode.js +25 -4
- package/examples/jsm/nodes/core/AttributeNode.js +1 -1
- package/examples/jsm/nodes/core/BypassNode.js +2 -2
- package/examples/jsm/nodes/core/ContextNode.js +2 -0
- package/examples/jsm/nodes/core/IndexNode.js +66 -0
- package/examples/jsm/nodes/core/LightingModel.js +2 -1
- package/examples/jsm/nodes/core/Node.js +13 -16
- package/examples/jsm/nodes/core/NodeAttribute.js +2 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +86 -8
- package/examples/jsm/nodes/core/NodeUtils.js +10 -0
- package/examples/jsm/nodes/core/PropertyNode.js +6 -2
- package/examples/jsm/nodes/core/StackNode.js +8 -1
- package/examples/jsm/nodes/core/UniformNode.js +1 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -3
- package/examples/jsm/nodes/display/BlendModeNode.js +9 -9
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +7 -7
- package/examples/jsm/nodes/display/ColorSpaceNode.js +50 -49
- package/examples/jsm/nodes/display/NormalMapNode.js +3 -3
- package/examples/jsm/nodes/display/ToneMappingNode.js +24 -15
- package/examples/jsm/nodes/display/ViewportDepthNode.js +69 -0
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +34 -0
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +7 -6
- package/examples/jsm/nodes/display/ViewportTextureNode.js +33 -19
- package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +5 -5
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -8
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +4 -4
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +2 -4
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/examples/jsm/nodes/functions/PhongLightingModel.js +7 -7
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +132 -19
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/examples/jsm/nodes/functions/material/getRoughness.js +3 -3
- package/examples/jsm/nodes/geometry/RangeNode.js +33 -51
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +6 -3
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +107 -62
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightUtils.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +17 -15
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +3 -3
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -15
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -15
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -9
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +41 -0
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +1 -14
- package/examples/jsm/nodes/materials/NodeMaterial.js +119 -29
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -9
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +3 -3
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +14 -14
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +4 -4
- package/examples/jsm/nodes/math/MathNode.js +6 -0
- package/examples/jsm/nodes/math/OperatorNode.js +1 -1
- package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +60 -33
- package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -3
- package/examples/jsm/nodes/utils/LoopNode.js +186 -0
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +1 -1
- package/examples/jsm/objects/GroundProjectedSkybox.js +1 -1
- package/examples/jsm/objects/Lensflare.js +3 -4
- package/examples/jsm/objects/MarchingCubes.js +5 -1
- package/examples/jsm/objects/Reflector.js +4 -1
- package/examples/jsm/objects/Refractor.js +1 -1
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/Water.js +2 -1
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/offscreen/scene.js +1 -0
- package/examples/jsm/physics/RapierPhysics.js +93 -133
- package/examples/jsm/postprocessing/AfterimagePass.js +3 -0
- package/examples/jsm/postprocessing/BloomPass.js +7 -2
- package/examples/jsm/postprocessing/BokehPass.js +3 -2
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +4 -1
- package/examples/jsm/postprocessing/FilmPass.js +1 -0
- package/examples/jsm/postprocessing/OutlinePass.js +8 -9
- package/examples/jsm/postprocessing/OutputPass.js +72 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +4 -3
- package/examples/jsm/postprocessing/SAOPass.js +4 -2
- package/examples/jsm/postprocessing/SMAAPass.js +5 -2
- package/examples/jsm/postprocessing/SSAARenderPass.js +5 -13
- package/examples/jsm/postprocessing/SSAOPass.js +4 -2
- package/examples/jsm/postprocessing/SSRPass.js +3 -1
- package/examples/jsm/postprocessing/SavePass.js +5 -2
- package/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +17 -4
- package/examples/jsm/postprocessing/TexturePass.js +2 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +13 -13
- package/examples/jsm/renderers/{webgpu/WebGPUAnimation.js → common/Animation.js} +2 -2
- package/examples/jsm/renderers/common/Attributes.js +75 -0
- package/examples/jsm/renderers/common/Backend.js +162 -0
- package/examples/jsm/renderers/common/Background.js +134 -0
- package/examples/jsm/renderers/common/Binding.js +11 -0
- package/examples/jsm/renderers/common/Bindings.js +169 -0
- package/examples/jsm/renderers/common/Buffer.js +38 -0
- package/examples/jsm/renderers/{webgpu/WebGPUBufferUtils.js → common/BufferUtils.js} +2 -2
- package/examples/jsm/renderers/{webgpu/WebGPUWeakMap.js → common/ChainMap.js} +11 -5
- package/examples/jsm/renderers/common/ComputePipeline.js +17 -0
- package/examples/jsm/renderers/common/Constants.js +14 -0
- package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -0
- package/examples/jsm/renderers/common/DataMap.js +54 -0
- package/examples/jsm/renderers/{webgpu/WebGPUGeometries.js → common/Geometries.js} +38 -37
- package/examples/jsm/renderers/{webgpu/WebGPUInfo.js → common/Info.js} +2 -3
- package/examples/jsm/renderers/common/Pipeline.js +13 -0
- package/examples/jsm/renderers/common/Pipelines.js +321 -0
- package/examples/jsm/renderers/common/ProgrammableStage.js +18 -0
- package/examples/jsm/renderers/common/RenderContext.js +37 -0
- package/examples/jsm/renderers/common/RenderContexts.js +38 -0
- package/examples/jsm/renderers/{webgpu/WebGPURenderLists.js → common/RenderList.js} +2 -39
- package/examples/jsm/renderers/common/RenderLists.js +38 -0
- package/examples/jsm/renderers/common/RenderObject.js +113 -0
- package/examples/jsm/renderers/common/RenderObjects.js +92 -0
- package/examples/jsm/renderers/common/RenderPipeline.js +16 -0
- package/examples/jsm/renderers/{webgpu/WebGPURenderTarget.js → common/RenderTarget.js} +2 -2
- package/examples/jsm/renderers/common/Renderer.js +864 -0
- package/examples/jsm/renderers/common/SampledTexture.js +80 -0
- package/examples/jsm/renderers/common/Sampler.js +18 -0
- package/examples/jsm/renderers/common/StorageBuffer.js +17 -0
- package/examples/jsm/renderers/common/Textures.js +206 -0
- package/examples/jsm/renderers/{webgpu/WebGPUUniform.js → common/Uniform.js} +13 -9
- package/examples/jsm/renderers/common/UniformBuffer.js +15 -0
- package/examples/jsm/renderers/{webgpu/WebGPUUniformsGroup.js → common/UniformsGroup.js} +13 -13
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodes.js → common/nodes/NodeRender.js} +3 -3
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampledTexture.js → common/nodes/NodeSampledTexture.js} +4 -4
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampler.js → common/nodes/NodeSampler.js} +3 -3
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeUniform.js → common/nodes/NodeUniform.js} +1 -1
- package/examples/jsm/renderers/common/nodes/Nodes.js +319 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +340 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +23 -19
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +847 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +15 -1131
- package/examples/jsm/renderers/webgpu/nodes/{WebGPUNodeBuilder.js → WGSLNodeBuilder.js} +75 -45
- package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeFunction.js +2 -2
- package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeParser.js +1 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +255 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +145 -0
- package/examples/jsm/renderers/webgpu/{constants.js → utils/WebGPUConstants.js} +6 -7
- package/examples/jsm/renderers/webgpu/{WebGPURenderPipeline.js → utils/WebGPUPipelineUtils.js} +154 -247
- package/examples/jsm/renderers/webgpu/{WebGPUTextureUtils.js → utils/WebGPUTextureMipmapUtils.js} +3 -25
- package/examples/jsm/renderers/webgpu/{WebGPUTextures.js → utils/WebGPUTextureUtils.js} +392 -505
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +92 -0
- package/examples/jsm/shaders/BleachBypassShader.js +2 -0
- package/examples/jsm/shaders/BlendShader.js +1 -2
- package/examples/jsm/shaders/BokehShader2.js +3 -0
- package/examples/jsm/shaders/ColorifyShader.js +2 -0
- package/examples/jsm/shaders/ConvolutionShader.js +2 -0
- package/examples/jsm/shaders/CopyShader.js +4 -2
- package/examples/jsm/shaders/DotScreenShader.js +2 -0
- package/examples/jsm/shaders/ExposureShader.js +44 -0
- package/examples/jsm/shaders/FilmShader.js +2 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +2 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +61 -0
- package/examples/jsm/shaders/RGBShiftShader.js +2 -0
- package/examples/jsm/shaders/SepiaShader.js +2 -0
- package/examples/jsm/shaders/ToonShader.js +13 -5
- package/examples/jsm/shaders/VerticalBlurShader.js +2 -0
- package/examples/jsm/shaders/VignetteShader.js +2 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +5 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +17 -1
- package/examples/jsm/utils/TextureUtils.js +86 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +34 -13
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +1 -0
- package/examples/jsm/webxr/XRPlanes.js +100 -0
- package/package.json +3 -1
- package/src/Three.Legacy.js +0 -228
- package/src/audio/PositionalAudio.js +8 -0
- package/src/cameras/Camera.js +5 -0
- package/src/cameras/CubeCamera.js +76 -13
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +13 -1
- package/src/core/BufferAttribute.js +3 -25
- package/src/core/BufferGeometry.js +1 -8
- package/src/core/Object3D.js +1 -1
- package/src/extras/core/Curve.js +1 -1
- package/src/loaders/CubeTextureLoader.js +2 -0
- package/src/loaders/Loader.js +2 -0
- package/src/loaders/MaterialLoader.js +5 -0
- package/src/loaders/ObjectLoader.js +1 -0
- package/src/materials/Material.js +13 -1
- package/src/materials/MeshPhysicalMaterial.js +32 -6
- package/src/math/Color.js +16 -11
- package/src/math/Frustum.js +16 -2
- package/src/math/MathUtils.js +16 -0
- package/src/math/Matrix3.js +26 -6
- package/src/math/Matrix4.js +74 -19
- package/src/objects/InstancedMesh.js +3 -0
- package/src/objects/Mesh.js +14 -10
- package/src/objects/Skeleton.js +1 -3
- package/src/objects/SkinnedMesh.js +36 -8
- package/src/renderers/WebGLRenderer.js +126 -21
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +26 -3
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -2
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +10 -2
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/{output_fragment.glsl.js → opaque_fragment.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +10 -5
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +6 -1
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +7 -1
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +6 -1
- package/src/renderers/shaders/ShaderChunk.js +10 -6
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +12 -2
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/points.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib.js +4 -1
- package/src/renderers/shaders/UniformsLib.js +2 -0
- package/src/renderers/webgl/WebGLBindingStates.js +13 -5
- package/src/renderers/webgl/WebGLGeometries.js +12 -0
- package/src/renderers/webgl/WebGLInfo.js +0 -1
- package/src/renderers/webgl/WebGLMaterials.js +18 -0
- package/src/renderers/webgl/WebGLObjects.js +23 -3
- package/src/renderers/webgl/WebGLProgram.js +43 -5
- package/src/renderers/webgl/WebGLPrograms.js +19 -7
- package/src/renderers/webgl/WebGLTextures.js +19 -1
- package/src/renderers/webvr/WebVRManager.js +12 -0
- package/src/renderers/webxr/WebXRManager.js +39 -99
- package/src/scenes/Scene.js +0 -14
- package/src/textures/DepthTexture.js +22 -0
- package/src/textures/FramebufferTexture.js +1 -3
- package/src/textures/Source.js +4 -0
- package/src/textures/Texture.js +1 -1
- package/examples/jsm/exporters/ColladaExporter.js +0 -725
- package/examples/jsm/geometries/LightningStrike.js +0 -1017
- package/examples/jsm/loaders/PRWMLoader.js +0 -299
- package/examples/jsm/nodes/core/InstanceIndexNode.js +0 -26
- package/examples/jsm/objects/LightningStorm.js +0 -245
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +0 -361
- package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +0 -197
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +0 -190
- package/examples/jsm/renderers/webgpu/WebGPUBinding.js +0 -22
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +0 -270
- package/examples/jsm/renderers/webgpu/WebGPUBuffer.js +0 -43
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +0 -78
- package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +0 -22
- package/examples/jsm/renderers/webgpu/WebGPUProperties.js +0 -44
- package/examples/jsm/renderers/webgpu/WebGPURenderObject.js +0 -40
- package/examples/jsm/renderers/webgpu/WebGPURenderObjects.js +0 -50
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +0 -274
- package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +0 -54
- package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +0 -75
- package/examples/jsm/renderers/webgpu/WebGPUSampler.js +0 -29
- package/examples/jsm/renderers/webgpu/WebGPUStorageBuffer.js +0 -20
- package/examples/jsm/renderers/webgpu/WebGPUTextureRenderer.js +0 -38
- package/examples/jsm/renderers/webgpu/WebGPUUniformBuffer.js +0 -18
- package/examples/jsm/renderers/webgpu/WebGPUUtils.js +0 -88
- package/examples/jsm/shaders/ToneMapShader.js +0 -73
- /package/src/renderers/shaders/ShaderChunk/{encodings_fragment.glsl.js → colorspace_fragment.glsl.js} +0 -0
- /package/src/renderers/shaders/ShaderChunk/{encodings_pars_fragment.glsl.js → colorspace_pars_fragment.glsl.js} +0 -0
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
Bone,
|
|
5
5
|
BufferGeometry,
|
|
6
6
|
Color,
|
|
7
|
-
ColorManagement,
|
|
8
7
|
CustomBlending,
|
|
9
8
|
TangentSpaceNormalMap,
|
|
10
9
|
DoubleSide,
|
|
@@ -226,7 +225,15 @@ class MMDLoader extends Loader {
|
|
|
226
225
|
.setWithCredentials( this.withCredentials )
|
|
227
226
|
.load( url, function ( buffer ) {
|
|
228
227
|
|
|
229
|
-
|
|
228
|
+
try {
|
|
229
|
+
|
|
230
|
+
onLoad( parser.parsePmd( buffer, true ) );
|
|
231
|
+
|
|
232
|
+
} catch ( e ) {
|
|
233
|
+
|
|
234
|
+
if ( onError ) onError( e );
|
|
235
|
+
|
|
236
|
+
}
|
|
230
237
|
|
|
231
238
|
}, onProgress, onError );
|
|
232
239
|
|
|
@@ -252,7 +259,15 @@ class MMDLoader extends Loader {
|
|
|
252
259
|
.setWithCredentials( this.withCredentials )
|
|
253
260
|
.load( url, function ( buffer ) {
|
|
254
261
|
|
|
255
|
-
|
|
262
|
+
try {
|
|
263
|
+
|
|
264
|
+
onLoad( parser.parsePmx( buffer, true ) );
|
|
265
|
+
|
|
266
|
+
} catch ( e ) {
|
|
267
|
+
|
|
268
|
+
if ( onError ) onError( e );
|
|
269
|
+
|
|
270
|
+
}
|
|
256
271
|
|
|
257
272
|
}, onProgress, onError );
|
|
258
273
|
|
|
@@ -287,9 +302,17 @@ class MMDLoader extends Loader {
|
|
|
287
302
|
|
|
288
303
|
this.loader.load( urls[ i ], function ( buffer ) {
|
|
289
304
|
|
|
290
|
-
|
|
305
|
+
try {
|
|
306
|
+
|
|
307
|
+
vmds.push( parser.parseVmd( buffer, true ) );
|
|
308
|
+
|
|
309
|
+
if ( vmds.length === vmdNum ) onLoad( parser.mergeVmds( vmds ) );
|
|
291
310
|
|
|
292
|
-
|
|
311
|
+
} catch ( e ) {
|
|
312
|
+
|
|
313
|
+
if ( onError ) onError( e );
|
|
314
|
+
|
|
315
|
+
}
|
|
293
316
|
|
|
294
317
|
}, onProgress, onError );
|
|
295
318
|
|
|
@@ -318,7 +341,15 @@ class MMDLoader extends Loader {
|
|
|
318
341
|
.setWithCredentials( this.withCredentials )
|
|
319
342
|
.load( url, function ( text ) {
|
|
320
343
|
|
|
321
|
-
|
|
344
|
+
try {
|
|
345
|
+
|
|
346
|
+
onLoad( parser.parseVpd( text, true ) );
|
|
347
|
+
|
|
348
|
+
} catch ( e ) {
|
|
349
|
+
|
|
350
|
+
if ( onError ) onError( e );
|
|
351
|
+
|
|
352
|
+
}
|
|
322
353
|
|
|
323
354
|
}, onProgress, onError );
|
|
324
355
|
|
|
@@ -1109,13 +1140,9 @@ class MaterialBuilder {
|
|
|
1109
1140
|
params.emissive = new Color().fromArray( material.ambient );
|
|
1110
1141
|
params.transparent = params.opacity !== 1.0;
|
|
1111
1142
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
params.specular.convertSRGBToLinear();
|
|
1116
|
-
params.emissive.convertSRGBToLinear();
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1143
|
+
params.diffuse.convertSRGBToLinear();
|
|
1144
|
+
params.specular.convertSRGBToLinear();
|
|
1145
|
+
params.emissive.convertSRGBToLinear();
|
|
1119
1146
|
|
|
1120
1147
|
//
|
|
1121
1148
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferGeometry,
|
|
3
|
+
Color,
|
|
3
4
|
FileLoader,
|
|
4
5
|
Float32BufferAttribute,
|
|
5
6
|
Int32BufferAttribute,
|
|
@@ -232,6 +233,8 @@ class PCDLoader extends Loader {
|
|
|
232
233
|
const intensity = [];
|
|
233
234
|
const label = [];
|
|
234
235
|
|
|
236
|
+
const c = new Color();
|
|
237
|
+
|
|
235
238
|
// ascii
|
|
236
239
|
|
|
237
240
|
if ( PCDheader.data === 'ascii' ) {
|
|
@@ -272,10 +275,13 @@ class PCDLoader extends Loader {
|
|
|
272
275
|
|
|
273
276
|
}
|
|
274
277
|
|
|
275
|
-
const r = ( rgb >> 16 ) & 0x0000ff;
|
|
276
|
-
const g = ( rgb >> 8 ) & 0x0000ff;
|
|
277
|
-
const b = ( rgb >> 0 ) & 0x0000ff;
|
|
278
|
-
|
|
278
|
+
const r = ( ( rgb >> 16 ) & 0x0000ff ) / 255;
|
|
279
|
+
const g = ( ( rgb >> 8 ) & 0x0000ff ) / 255;
|
|
280
|
+
const b = ( ( rgb >> 0 ) & 0x0000ff ) / 255;
|
|
281
|
+
|
|
282
|
+
c.set( r, g, b ).convertSRGBToLinear();
|
|
283
|
+
|
|
284
|
+
color.push( c.r, c.g, c.b );
|
|
279
285
|
|
|
280
286
|
}
|
|
281
287
|
|
|
@@ -335,9 +341,14 @@ class PCDLoader extends Loader {
|
|
|
335
341
|
if ( offset.rgb !== undefined ) {
|
|
336
342
|
|
|
337
343
|
const rgbIndex = PCDheader.fields.indexOf( 'rgb' );
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
344
|
+
|
|
345
|
+
const r = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 2 ) / 255.0;
|
|
346
|
+
const g = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 1 ) / 255.0;
|
|
347
|
+
const b = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 0 ) / 255.0;
|
|
348
|
+
|
|
349
|
+
c.set( r, g, b ).convertSRGBToLinear();
|
|
350
|
+
|
|
351
|
+
color.push( c.r, c.g, c.b );
|
|
341
352
|
|
|
342
353
|
}
|
|
343
354
|
|
|
@@ -389,9 +400,13 @@ class PCDLoader extends Loader {
|
|
|
389
400
|
|
|
390
401
|
if ( offset.rgb !== undefined ) {
|
|
391
402
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
403
|
+
const r = dataview.getUint8( row + offset.rgb + 2 ) / 255.0;
|
|
404
|
+
const g = dataview.getUint8( row + offset.rgb + 1 ) / 255.0;
|
|
405
|
+
const b = dataview.getUint8( row + offset.rgb + 0 ) / 255.0;
|
|
406
|
+
|
|
407
|
+
c.set( r, g, b ).convertSRGBToLinear();
|
|
408
|
+
|
|
409
|
+
color.push( c.r, c.g, c.b );
|
|
395
410
|
|
|
396
411
|
}
|
|
397
412
|
|
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
BufferGeometry,
|
|
3
3
|
FileLoader,
|
|
4
4
|
Float32BufferAttribute,
|
|
5
|
-
Loader
|
|
5
|
+
Loader,
|
|
6
|
+
Color
|
|
6
7
|
} from 'three';
|
|
7
8
|
|
|
8
9
|
class PDBLoader extends Loader {
|
|
@@ -114,6 +115,8 @@ class PDBLoader extends Loader {
|
|
|
114
115
|
|
|
115
116
|
// atoms
|
|
116
117
|
|
|
118
|
+
const c = new Color();
|
|
119
|
+
|
|
117
120
|
for ( let i = 0, l = atoms.length; i < l; i ++ ) {
|
|
118
121
|
|
|
119
122
|
const atom = atoms[ i ];
|
|
@@ -128,7 +131,9 @@ class PDBLoader extends Loader {
|
|
|
128
131
|
const g = atom[ 3 ][ 1 ] / 255;
|
|
129
132
|
const b = atom[ 3 ][ 2 ] / 255;
|
|
130
133
|
|
|
131
|
-
|
|
134
|
+
c.set( r, g, b ).convertSRGBToLinear();
|
|
135
|
+
|
|
136
|
+
colorsAtoms.push( c.r, c.g, c.b );
|
|
132
137
|
|
|
133
138
|
}
|
|
134
139
|
|
|
@@ -104,17 +104,15 @@ class PLYLoader extends Loader {
|
|
|
104
104
|
|
|
105
105
|
parse( data ) {
|
|
106
106
|
|
|
107
|
-
function parseHeader( data ) {
|
|
107
|
+
function parseHeader( data, headerLength = 0 ) {
|
|
108
108
|
|
|
109
109
|
const patternHeader = /^ply([\s\S]*)end_header(\r\n|\r|\n)/;
|
|
110
110
|
let headerText = '';
|
|
111
|
-
let headerLength = 0;
|
|
112
111
|
const result = patternHeader.exec( data );
|
|
113
112
|
|
|
114
113
|
if ( result !== null ) {
|
|
115
114
|
|
|
116
115
|
headerText = result[ 1 ];
|
|
117
|
-
headerLength = new Blob( [ result[ 0 ] ] ).size;
|
|
118
116
|
|
|
119
117
|
}
|
|
120
118
|
|
|
@@ -287,6 +285,7 @@ class PLYLoader extends Loader {
|
|
|
287
285
|
uvs: [],
|
|
288
286
|
faceVertexUvs: [],
|
|
289
287
|
colors: [],
|
|
288
|
+
faceVertexColors: []
|
|
290
289
|
};
|
|
291
290
|
|
|
292
291
|
for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {
|
|
@@ -413,10 +412,12 @@ class PLYLoader extends Loader {
|
|
|
413
412
|
|
|
414
413
|
}
|
|
415
414
|
|
|
416
|
-
if ( buffer.faceVertexUvs.length > 0 ) {
|
|
415
|
+
if ( buffer.faceVertexUvs.length > 0 || buffer.faceVertexColors.length > 0 ) {
|
|
417
416
|
|
|
418
417
|
geometry = geometry.toNonIndexed();
|
|
419
|
-
|
|
418
|
+
|
|
419
|
+
if ( buffer.faceVertexUvs.length > 0 ) geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
|
|
420
|
+
if ( buffer.faceVertexColors.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.faceVertexColors, 3 ) );
|
|
420
421
|
|
|
421
422
|
}
|
|
422
423
|
|
|
@@ -508,6 +509,21 @@ class PLYLoader extends Loader {
|
|
|
508
509
|
|
|
509
510
|
}
|
|
510
511
|
|
|
512
|
+
// face colors
|
|
513
|
+
|
|
514
|
+
if ( cacheEntry.attrR !== null && cacheEntry.attrG !== null && cacheEntry.attrB !== null ) {
|
|
515
|
+
|
|
516
|
+
_color.setRGB(
|
|
517
|
+
element[ cacheEntry.attrR ] / 255.0,
|
|
518
|
+
element[ cacheEntry.attrG ] / 255.0,
|
|
519
|
+
element[ cacheEntry.attrB ] / 255.0
|
|
520
|
+
).convertSRGBToLinear();
|
|
521
|
+
buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
522
|
+
buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
523
|
+
buffer.faceVertexColors.push( _color.r, _color.g, _color.b );
|
|
524
|
+
|
|
525
|
+
}
|
|
526
|
+
|
|
511
527
|
}
|
|
512
528
|
|
|
513
529
|
}
|
|
@@ -662,6 +678,9 @@ class PLYLoader extends Loader {
|
|
|
662
678
|
let line = '';
|
|
663
679
|
const lines = [];
|
|
664
680
|
|
|
681
|
+
const startLine = new TextDecoder().decode( bytes.subarray( 0, 5 ) );
|
|
682
|
+
const hasCRNL = /^ply\r\n/.test( startLine );
|
|
683
|
+
|
|
665
684
|
do {
|
|
666
685
|
|
|
667
686
|
const c = String.fromCharCode( bytes[ i ++ ] );
|
|
@@ -684,7 +703,10 @@ class PLYLoader extends Loader {
|
|
|
684
703
|
|
|
685
704
|
} while ( cont && i < bytes.length );
|
|
686
705
|
|
|
687
|
-
|
|
706
|
+
// ascii section using \r\n as line endings
|
|
707
|
+
if ( hasCRNL === true ) i ++;
|
|
708
|
+
|
|
709
|
+
return { headerText: lines.join( '\r' ) + '\r', headerLength: i };
|
|
688
710
|
|
|
689
711
|
}
|
|
690
712
|
|
|
@@ -696,8 +718,8 @@ class PLYLoader extends Loader {
|
|
|
696
718
|
if ( data instanceof ArrayBuffer ) {
|
|
697
719
|
|
|
698
720
|
const bytes = new Uint8Array( data );
|
|
699
|
-
const headerText = extractHeaderText( bytes );
|
|
700
|
-
const header = parseHeader( headerText );
|
|
721
|
+
const { headerText, headerLength } = extractHeaderText( bytes );
|
|
722
|
+
const header = parseHeader( headerText, headerLength );
|
|
701
723
|
|
|
702
724
|
if ( header.format === 'ascii' ) {
|
|
703
725
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferAttribute,
|
|
3
3
|
BufferGeometry,
|
|
4
|
+
Color,
|
|
4
5
|
FileLoader,
|
|
5
6
|
Float32BufferAttribute,
|
|
6
7
|
Loader,
|
|
@@ -195,6 +196,8 @@ class STLLoader extends Loader {
|
|
|
195
196
|
const vertices = new Float32Array( faces * 3 * 3 );
|
|
196
197
|
const normals = new Float32Array( faces * 3 * 3 );
|
|
197
198
|
|
|
199
|
+
const color = new Color();
|
|
200
|
+
|
|
198
201
|
for ( let face = 0; face < faces; face ++ ) {
|
|
199
202
|
|
|
200
203
|
const start = dataOffset + face * faceLength;
|
|
@@ -239,9 +242,11 @@ class STLLoader extends Loader {
|
|
|
239
242
|
|
|
240
243
|
if ( hasColors ) {
|
|
241
244
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
colors[ componentIdx
|
|
245
|
+
color.set( r, g, b ).convertSRGBToLinear();
|
|
246
|
+
|
|
247
|
+
colors[ componentIdx ] = color.r;
|
|
248
|
+
colors[ componentIdx + 1 ] = color.g;
|
|
249
|
+
colors[ componentIdx + 2 ] = color.b;
|
|
245
250
|
|
|
246
251
|
}
|
|
247
252
|
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
Scene,
|
|
29
29
|
ShapeUtils,
|
|
30
30
|
SphereGeometry,
|
|
31
|
+
SRGBColorSpace,
|
|
31
32
|
TextureLoader,
|
|
32
33
|
Vector2,
|
|
33
34
|
Vector3
|
|
@@ -918,6 +919,7 @@ class VRMLLoader extends Loader {
|
|
|
918
919
|
} else {
|
|
919
920
|
|
|
920
921
|
skyMaterial.color.setRGB( skyColor[ 0 ], skyColor[ 1 ], skyColor[ 2 ] );
|
|
922
|
+
skyMaterial.color.convertSRGBToLinear();
|
|
921
923
|
|
|
922
924
|
}
|
|
923
925
|
|
|
@@ -958,7 +960,10 @@ class VRMLLoader extends Loader {
|
|
|
958
960
|
|
|
959
961
|
// if the appearance field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
960
962
|
|
|
961
|
-
let material = new MeshBasicMaterial( {
|
|
963
|
+
let material = new MeshBasicMaterial( {
|
|
964
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
965
|
+
color: 0x000000
|
|
966
|
+
} );
|
|
962
967
|
let geometry;
|
|
963
968
|
|
|
964
969
|
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
@@ -1005,7 +1010,10 @@ class VRMLLoader extends Loader {
|
|
|
1005
1010
|
|
|
1006
1011
|
if ( type === 'points' ) { // points
|
|
1007
1012
|
|
|
1008
|
-
const pointsMaterial = new PointsMaterial( {
|
|
1013
|
+
const pointsMaterial = new PointsMaterial( {
|
|
1014
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1015
|
+
color: 0xffffff
|
|
1016
|
+
} );
|
|
1009
1017
|
|
|
1010
1018
|
if ( geometry.attributes.color !== undefined ) {
|
|
1011
1019
|
|
|
@@ -1027,7 +1035,10 @@ class VRMLLoader extends Loader {
|
|
|
1027
1035
|
|
|
1028
1036
|
} else if ( type === 'line' ) { // lines
|
|
1029
1037
|
|
|
1030
|
-
const lineMaterial = new LineBasicMaterial( {
|
|
1038
|
+
const lineMaterial = new LineBasicMaterial( {
|
|
1039
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1040
|
+
color: 0xffffff
|
|
1041
|
+
} );
|
|
1031
1042
|
|
|
1032
1043
|
if ( geometry.attributes.color !== undefined ) {
|
|
1033
1044
|
|
|
@@ -1114,7 +1125,10 @@ class VRMLLoader extends Loader {
|
|
|
1114
1125
|
|
|
1115
1126
|
// if the material field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
1116
1127
|
|
|
1117
|
-
material = new MeshBasicMaterial( {
|
|
1128
|
+
material = new MeshBasicMaterial( {
|
|
1129
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1130
|
+
color: 0x000000
|
|
1131
|
+
} );
|
|
1118
1132
|
|
|
1119
1133
|
}
|
|
1120
1134
|
|
|
@@ -1223,10 +1237,12 @@ class VRMLLoader extends Loader {
|
|
|
1223
1237
|
|
|
1224
1238
|
case 'diffuseColor':
|
|
1225
1239
|
materialData.diffuseColor = new Color( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
1240
|
+
materialData.diffuseColor.convertSRGBToLinear();
|
|
1226
1241
|
break;
|
|
1227
1242
|
|
|
1228
1243
|
case 'emissiveColor':
|
|
1229
1244
|
materialData.emissiveColor = new Color( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
1245
|
+
materialData.emissiveColor.convertSRGBToLinear();
|
|
1230
1246
|
break;
|
|
1231
1247
|
|
|
1232
1248
|
case 'shininess':
|
|
@@ -1234,7 +1250,8 @@ class VRMLLoader extends Loader {
|
|
|
1234
1250
|
break;
|
|
1235
1251
|
|
|
1236
1252
|
case 'specularColor':
|
|
1237
|
-
materialData.
|
|
1253
|
+
materialData.specularColor = new Color( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
1254
|
+
materialData.specularColor.convertSRGBToLinear();
|
|
1238
1255
|
break;
|
|
1239
1256
|
|
|
1240
1257
|
case 'transparency':
|
|
@@ -1370,6 +1387,7 @@ class VRMLLoader extends Loader {
|
|
|
1370
1387
|
}
|
|
1371
1388
|
|
|
1372
1389
|
texture = new DataTexture( data, width, height );
|
|
1390
|
+
texture.colorSpace = SRGBColorSpace;
|
|
1373
1391
|
texture.needsUpdate = true;
|
|
1374
1392
|
texture.__type = textureType; // needed for material modifications
|
|
1375
1393
|
break;
|
|
@@ -1442,6 +1460,7 @@ class VRMLLoader extends Loader {
|
|
|
1442
1460
|
|
|
1443
1461
|
texture.wrapS = wrapS;
|
|
1444
1462
|
texture.wrapT = wrapT;
|
|
1463
|
+
texture.colorSpace = SRGBColorSpace;
|
|
1445
1464
|
|
|
1446
1465
|
}
|
|
1447
1466
|
|
|
@@ -1700,6 +1719,8 @@ class VRMLLoader extends Loader {
|
|
|
1700
1719
|
|
|
1701
1720
|
}
|
|
1702
1721
|
|
|
1722
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
1723
|
+
|
|
1703
1724
|
}
|
|
1704
1725
|
|
|
1705
1726
|
if ( normal ) {
|
|
@@ -1901,6 +1922,8 @@ class VRMLLoader extends Loader {
|
|
|
1901
1922
|
|
|
1902
1923
|
}
|
|
1903
1924
|
|
|
1925
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
1926
|
+
|
|
1904
1927
|
}
|
|
1905
1928
|
|
|
1906
1929
|
//
|
|
@@ -1966,7 +1989,15 @@ class VRMLLoader extends Loader {
|
|
|
1966
1989
|
const geometry = new BufferGeometry();
|
|
1967
1990
|
|
|
1968
1991
|
geometry.setAttribute( 'position', new Float32BufferAttribute( coord, 3 ) );
|
|
1969
|
-
|
|
1992
|
+
|
|
1993
|
+
if ( color ) {
|
|
1994
|
+
|
|
1995
|
+
const colorAttribute = new Float32BufferAttribute( color, 3 );
|
|
1996
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
1997
|
+
|
|
1998
|
+
geometry.setAttribute( 'color', colorAttribute );
|
|
1999
|
+
|
|
2000
|
+
}
|
|
1970
2001
|
|
|
1971
2002
|
geometry._type = 'points';
|
|
1972
2003
|
|
|
@@ -2380,6 +2411,8 @@ class VRMLLoader extends Loader {
|
|
|
2380
2411
|
|
|
2381
2412
|
}
|
|
2382
2413
|
|
|
2414
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
2415
|
+
|
|
2383
2416
|
}
|
|
2384
2417
|
|
|
2385
2418
|
// normal attribute
|
|
@@ -3067,6 +3100,21 @@ class VRMLLoader extends Loader {
|
|
|
3067
3100
|
|
|
3068
3101
|
}
|
|
3069
3102
|
|
|
3103
|
+
function convertColorsToLinearSRGB( attribute ) {
|
|
3104
|
+
|
|
3105
|
+
const color = new Color();
|
|
3106
|
+
|
|
3107
|
+
for ( let i = 0; i < attribute.count; i ++ ) {
|
|
3108
|
+
|
|
3109
|
+
color.fromBufferAttribute( attribute, i );
|
|
3110
|
+
color.convertSRGBToLinear();
|
|
3111
|
+
|
|
3112
|
+
attribute.setXYZ( i, color.r, color.g, color.b );
|
|
3113
|
+
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3070
3118
|
/**
|
|
3071
3119
|
* Vertically paints the faces interpolating between the
|
|
3072
3120
|
* specified colors at the specified angels. This is used for the Background
|
|
@@ -3164,7 +3212,7 @@ class VRMLLoader extends Loader {
|
|
|
3164
3212
|
const colorA = colors[ thresholdIndexA ];
|
|
3165
3213
|
const colorB = colors[ thresholdIndexB ];
|
|
3166
3214
|
|
|
3167
|
-
color.copy( colorA ).lerp( colorB, t );
|
|
3215
|
+
color.copy( colorA ).lerp( colorB, t ).convertSRGBToLinear();
|
|
3168
3216
|
|
|
3169
3217
|
colorAttribute.setXYZ( index, color.r, color.g, color.b );
|
|
3170
3218
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferAttribute,
|
|
3
3
|
BufferGeometry,
|
|
4
|
+
Color,
|
|
4
5
|
FileLoader,
|
|
5
6
|
Float32BufferAttribute,
|
|
6
7
|
Loader
|
|
@@ -107,6 +108,8 @@ class VTKLoader extends Loader {
|
|
|
107
108
|
let inColorSection = false;
|
|
108
109
|
let inNormalsSection = false;
|
|
109
110
|
|
|
111
|
+
const color = new Color();
|
|
112
|
+
|
|
110
113
|
const lines = data.split( '\n' );
|
|
111
114
|
|
|
112
115
|
for ( const i in lines ) {
|
|
@@ -207,7 +210,10 @@ class VTKLoader extends Loader {
|
|
|
207
210
|
const r = parseFloat( result[ 1 ] );
|
|
208
211
|
const g = parseFloat( result[ 2 ] );
|
|
209
212
|
const b = parseFloat( result[ 3 ] );
|
|
210
|
-
|
|
213
|
+
|
|
214
|
+
color.set( r, g, b ).convertSRGBToLinear();
|
|
215
|
+
|
|
216
|
+
colors.push( color.r, color.g, color.b );
|
|
211
217
|
|
|
212
218
|
}
|
|
213
219
|
|
|
@@ -319,9 +325,11 @@ class VTKLoader extends Loader {
|
|
|
319
325
|
const g = colors[ 3 * i + 1 ];
|
|
320
326
|
const b = colors[ 3 * i + 2 ];
|
|
321
327
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
newColors.push( r, g, b );
|
|
328
|
+
color.set( r, g, b ).convertSRGBToLinear();
|
|
329
|
+
|
|
330
|
+
newColors.push( color.r, color.g, color.b );
|
|
331
|
+
newColors.push( color.r, color.g, color.b );
|
|
332
|
+
newColors.push( color.r, color.g, color.b );
|
|
325
333
|
|
|
326
334
|
}
|
|
327
335
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferGeometry,
|
|
3
|
+
Color,
|
|
3
4
|
FileLoader,
|
|
4
5
|
Float32BufferAttribute,
|
|
5
6
|
Loader
|
|
@@ -47,6 +48,7 @@ class XYZLoader extends Loader {
|
|
|
47
48
|
|
|
48
49
|
const vertices = [];
|
|
49
50
|
const colors = [];
|
|
51
|
+
const color = new Color();
|
|
50
52
|
|
|
51
53
|
for ( let line of lines ) {
|
|
52
54
|
|
|
@@ -74,9 +76,13 @@ class XYZLoader extends Loader {
|
|
|
74
76
|
vertices.push( parseFloat( lineValues[ 1 ] ) );
|
|
75
77
|
vertices.push( parseFloat( lineValues[ 2 ] ) );
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
const r = parseFloat( lineValues[ 3 ] ) / 255;
|
|
80
|
+
const g = parseFloat( lineValues[ 4 ] ) / 255;
|
|
81
|
+
const b = parseFloat( lineValues[ 5 ] ) / 255;
|
|
82
|
+
|
|
83
|
+
color.set( r, g, b ).convertSRGBToLinear();
|
|
84
|
+
|
|
85
|
+
colors.push( color.r, color.g, color.b );
|
|
80
86
|
|
|
81
87
|
}
|
|
82
88
|
|
|
@@ -288,9 +288,9 @@ const GouraudShader = {
|
|
|
288
288
|
|
|
289
289
|
#include <envmap_fragment>
|
|
290
290
|
|
|
291
|
-
#include <
|
|
291
|
+
#include <opaque_fragment>
|
|
292
292
|
#include <tonemapping_fragment>
|
|
293
|
-
#include <
|
|
293
|
+
#include <colorspace_fragment>
|
|
294
294
|
#include <fog_fragment>
|
|
295
295
|
#include <premultiplied_alpha_fragment>
|
|
296
296
|
#include <dithering_fragment>
|
package/examples/jsm/math/Lut.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Color,
|
|
3
|
+
LinearSRGBColorSpace,
|
|
3
4
|
MathUtils
|
|
4
5
|
} from 'three';
|
|
5
6
|
|
|
@@ -75,8 +76,8 @@ class Lut {
|
|
|
75
76
|
const min = this.map[ j ][ 0 ];
|
|
76
77
|
const max = this.map[ j + 1 ][ 0 ];
|
|
77
78
|
|
|
78
|
-
minColor.
|
|
79
|
-
maxColor.
|
|
79
|
+
minColor.setHex( this.map[ j ][ 1 ], LinearSRGBColorSpace );
|
|
80
|
+
maxColor.setHex( this.map[ j + 1 ][ 1 ], LinearSRGBColorSpace );
|
|
80
81
|
|
|
81
82
|
const color = new Color().lerpColors( minColor, maxColor, ( alpha - min ) / ( max - min ) );
|
|
82
83
|
|
|
@@ -165,8 +166,8 @@ class Lut {
|
|
|
165
166
|
const min = this.map[ j - 1 ][ 0 ];
|
|
166
167
|
const max = this.map[ j ][ 0 ];
|
|
167
168
|
|
|
168
|
-
minColor.
|
|
169
|
-
maxColor.
|
|
169
|
+
minColor.setHex( this.map[ j - 1 ][ 1 ], LinearSRGBColorSpace );
|
|
170
|
+
maxColor.setHex( this.map[ j ][ 1 ], LinearSRGBColorSpace );
|
|
170
171
|
|
|
171
172
|
finalColor.lerpColors( minColor, maxColor, ( i - min ) / ( max - min ) );
|
|
172
173
|
|