super-three 0.152.0 → 0.154.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 +779 -557
- package/build/three.js +779 -557
- package/build/three.min.js +2 -1
- package/build/three.module.js +770 -539
- package/build/three.module.min.js +2 -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
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
DoubleSide
|
|
3
|
-
} from 'three';
|
|
4
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
5
2
|
import * as fflate from '../libs/fflate.module.js';
|
|
6
3
|
|
|
7
4
|
class USDZExporter {
|
|
@@ -12,7 +9,8 @@ class USDZExporter {
|
|
|
12
9
|
ar: {
|
|
13
10
|
anchoring: { type: 'plane' },
|
|
14
11
|
planeAnchoring: { alignment: 'horizontal' }
|
|
15
|
-
}
|
|
12
|
+
},
|
|
13
|
+
quickLookCompatible: false,
|
|
16
14
|
}, options );
|
|
17
15
|
|
|
18
16
|
const files = {};
|
|
@@ -37,7 +35,7 @@ class USDZExporter {
|
|
|
37
35
|
|
|
38
36
|
if ( material.isMeshStandardMaterial ) {
|
|
39
37
|
|
|
40
|
-
const geometryFileName = 'geometries/Geometry_' + geometry.id + '.
|
|
38
|
+
const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usda';
|
|
41
39
|
|
|
42
40
|
if ( ! ( geometryFileName in files ) ) {
|
|
43
41
|
|
|
@@ -71,7 +69,7 @@ class USDZExporter {
|
|
|
71
69
|
|
|
72
70
|
output += buildSceneEnd();
|
|
73
71
|
|
|
74
|
-
output += buildMaterials( materials, textures );
|
|
72
|
+
output += buildMaterials( materials, textures, options.quickLookCompatible );
|
|
75
73
|
|
|
76
74
|
files[ modelFileName ] = fflate.strToU8( output );
|
|
77
75
|
output = null;
|
|
@@ -79,13 +77,11 @@ class USDZExporter {
|
|
|
79
77
|
for ( const id in textures ) {
|
|
80
78
|
|
|
81
79
|
const texture = textures[ id ];
|
|
82
|
-
const color = id.split( '_' )[ 1 ];
|
|
83
|
-
const isRGBA = texture.format === 1023;
|
|
84
80
|
|
|
85
|
-
const canvas = imageToCanvas( texture.image,
|
|
86
|
-
const blob = await new Promise( resolve => canvas.toBlob( resolve,
|
|
81
|
+
const canvas = imageToCanvas( texture.image, texture.flipY );
|
|
82
|
+
const blob = await new Promise( resolve => canvas.toBlob( resolve, 'image/png', 1 ) );
|
|
87
83
|
|
|
88
|
-
files[ `textures/Texture_${ id }
|
|
84
|
+
files[ `textures/Texture_${ id }.png` ] = new Uint8Array( await blob.arrayBuffer() );
|
|
89
85
|
|
|
90
86
|
}
|
|
91
87
|
|
|
@@ -122,7 +118,7 @@ class USDZExporter {
|
|
|
122
118
|
|
|
123
119
|
}
|
|
124
120
|
|
|
125
|
-
function imageToCanvas( image,
|
|
121
|
+
function imageToCanvas( image, flipY ) {
|
|
126
122
|
|
|
127
123
|
if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
|
|
128
124
|
( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
|
|
@@ -137,6 +133,8 @@ function imageToCanvas( image, color, flipY ) {
|
|
|
137
133
|
|
|
138
134
|
const context = canvas.getContext( '2d' );
|
|
139
135
|
|
|
136
|
+
// TODO: We should be able to do this in the UsdTransform2d?
|
|
137
|
+
|
|
140
138
|
if ( flipY === true ) {
|
|
141
139
|
|
|
142
140
|
context.translate( 0, canvas.height );
|
|
@@ -146,29 +144,6 @@ function imageToCanvas( image, color, flipY ) {
|
|
|
146
144
|
|
|
147
145
|
context.drawImage( image, 0, 0, canvas.width, canvas.height );
|
|
148
146
|
|
|
149
|
-
if ( color !== undefined ) {
|
|
150
|
-
|
|
151
|
-
const hex = parseInt( color, 16 );
|
|
152
|
-
|
|
153
|
-
const r = ( hex >> 16 & 255 ) / 255;
|
|
154
|
-
const g = ( hex >> 8 & 255 ) / 255;
|
|
155
|
-
const b = ( hex & 255 ) / 255;
|
|
156
|
-
|
|
157
|
-
const imagedata = context.getImageData( 0, 0, canvas.width, canvas.height );
|
|
158
|
-
const data = imagedata.data;
|
|
159
|
-
|
|
160
|
-
for ( let i = 0; i < data.length; i += 4 ) {
|
|
161
|
-
|
|
162
|
-
data[ i + 0 ] = data[ i + 0 ] * r;
|
|
163
|
-
data[ i + 1 ] = data[ i + 1 ] * g;
|
|
164
|
-
data[ i + 2 ] = data[ i + 2 ] * b;
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
context.putImageData( imagedata, 0, 0 );
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
147
|
return canvas;
|
|
173
148
|
|
|
174
149
|
} else {
|
|
@@ -187,11 +162,11 @@ function buildHeader() {
|
|
|
187
162
|
|
|
188
163
|
return `#usda 1.0
|
|
189
164
|
(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
165
|
+
customLayerData = {
|
|
166
|
+
string creator = "Three.js USDZExporter"
|
|
167
|
+
}
|
|
168
|
+
metersPerUnit = 1
|
|
169
|
+
upAxis = "Y"
|
|
195
170
|
)
|
|
196
171
|
|
|
197
172
|
`;
|
|
@@ -202,20 +177,20 @@ function buildSceneStart( options ) {
|
|
|
202
177
|
|
|
203
178
|
return `def Xform "Root"
|
|
204
179
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
180
|
+
def Scope "Scenes" (
|
|
181
|
+
kind = "sceneLibrary"
|
|
182
|
+
)
|
|
183
|
+
{
|
|
184
|
+
def Xform "Scene" (
|
|
185
|
+
customData = {
|
|
186
|
+
bool preliminary_collidesWithEnvironment = 0
|
|
187
|
+
string sceneName = "Scene"
|
|
188
|
+
}
|
|
189
|
+
sceneName = "Scene"
|
|
190
|
+
)
|
|
191
|
+
{
|
|
192
|
+
token preliminary:anchoring:type = "${options.ar.anchoring.type}"
|
|
193
|
+
token preliminary:planeAnchoring:alignment = "${options.ar.planeAnchoring.alignment}"
|
|
219
194
|
|
|
220
195
|
`;
|
|
221
196
|
|
|
@@ -224,8 +199,8 @@ function buildSceneStart( options ) {
|
|
|
224
199
|
function buildSceneEnd() {
|
|
225
200
|
|
|
226
201
|
return `
|
|
227
|
-
|
|
228
|
-
|
|
202
|
+
}
|
|
203
|
+
}
|
|
229
204
|
}
|
|
230
205
|
|
|
231
206
|
`;
|
|
@@ -254,13 +229,14 @@ function buildXform( object, geometry, material ) {
|
|
|
254
229
|
}
|
|
255
230
|
|
|
256
231
|
return `def Xform "${ name }" (
|
|
257
|
-
|
|
232
|
+
prepend references = @./geometries/Geometry_${ geometry.id }.usda@</Geometry>
|
|
233
|
+
prepend apiSchemas = ["MaterialBindingAPI"]
|
|
258
234
|
)
|
|
259
235
|
{
|
|
260
|
-
|
|
261
|
-
|
|
236
|
+
matrix4d xformOp:transform = ${ transform }
|
|
237
|
+
uniform token[] xformOpOrder = ["xformOp:transform"]
|
|
262
238
|
|
|
263
|
-
|
|
239
|
+
rel material:binding = </Materials/Material_${ material.id }>
|
|
264
240
|
}
|
|
265
241
|
|
|
266
242
|
`;
|
|
@@ -289,7 +265,7 @@ function buildMeshObject( geometry ) {
|
|
|
289
265
|
return `
|
|
290
266
|
def "Geometry"
|
|
291
267
|
{
|
|
292
|
-
|
|
268
|
+
${mesh}
|
|
293
269
|
}
|
|
294
270
|
`;
|
|
295
271
|
|
|
@@ -302,19 +278,17 @@ function buildMesh( geometry ) {
|
|
|
302
278
|
const count = attributes.position.count;
|
|
303
279
|
|
|
304
280
|
return `
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
uniform token subdivisionScheme = "none"
|
|
317
|
-
}
|
|
281
|
+
def Mesh "${ name }"
|
|
282
|
+
{
|
|
283
|
+
int[] faceVertexCounts = [${ buildMeshVertexCount( geometry ) }]
|
|
284
|
+
int[] faceVertexIndices = [${ buildMeshVertexIndices( geometry ) }]
|
|
285
|
+
normal3f[] normals = [${ buildVector3Array( attributes.normal, count )}] (
|
|
286
|
+
interpolation = "vertex"
|
|
287
|
+
)
|
|
288
|
+
point3f[] points = [${ buildVector3Array( attributes.position, count )}]
|
|
289
|
+
${ buildPrimvars( attributes, count ) }
|
|
290
|
+
uniform token subdivisionScheme = "none"
|
|
291
|
+
}
|
|
318
292
|
`;
|
|
319
293
|
|
|
320
294
|
}
|
|
@@ -405,9 +379,33 @@ function buildVector2Array( attribute, count ) {
|
|
|
405
379
|
|
|
406
380
|
}
|
|
407
381
|
|
|
382
|
+
function buildPrimvars( attributes, count ) {
|
|
383
|
+
|
|
384
|
+
let string = '';
|
|
385
|
+
|
|
386
|
+
for ( let i = 0; i < 4; i ++ ) {
|
|
387
|
+
|
|
388
|
+
const id = ( i > 0 ? i : '' );
|
|
389
|
+
const attribute = attributes[ 'uv' + id ];
|
|
390
|
+
|
|
391
|
+
if ( attribute !== undefined ) {
|
|
392
|
+
|
|
393
|
+
string += `
|
|
394
|
+
texCoord2f[] primvars:st${ id } = [${ buildVector2Array( attribute, count )}] (
|
|
395
|
+
interpolation = "vertex"
|
|
396
|
+
)`;
|
|
397
|
+
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return string;
|
|
403
|
+
|
|
404
|
+
}
|
|
405
|
+
|
|
408
406
|
// Materials
|
|
409
407
|
|
|
410
|
-
function buildMaterials( materials, textures ) {
|
|
408
|
+
function buildMaterials( materials, textures, quickLookCompatible = false ) {
|
|
411
409
|
|
|
412
410
|
const array = [];
|
|
413
411
|
|
|
@@ -415,7 +413,7 @@ function buildMaterials( materials, textures ) {
|
|
|
415
413
|
|
|
416
414
|
const material = materials[ uuid ];
|
|
417
415
|
|
|
418
|
-
array.push( buildMaterial( material, textures ) );
|
|
416
|
+
array.push( buildMaterial( material, textures, quickLookCompatible ) );
|
|
419
417
|
|
|
420
418
|
}
|
|
421
419
|
|
|
@@ -428,53 +426,99 @@ ${ array.join( '' ) }
|
|
|
428
426
|
|
|
429
427
|
}
|
|
430
428
|
|
|
431
|
-
function buildMaterial( material, textures ) {
|
|
429
|
+
function buildMaterial( material, textures, quickLookCompatible = false ) {
|
|
432
430
|
|
|
433
431
|
// https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html
|
|
434
432
|
|
|
435
|
-
const pad = '
|
|
433
|
+
const pad = ' ';
|
|
436
434
|
const inputs = [];
|
|
437
435
|
const samplers = [];
|
|
438
436
|
|
|
439
437
|
function buildTexture( texture, mapType, color ) {
|
|
440
438
|
|
|
441
|
-
const id = texture.id +
|
|
442
|
-
const isRGBA = texture.format === 1023;
|
|
439
|
+
const id = texture.source.id + '_' + texture.flipY;
|
|
443
440
|
|
|
444
441
|
textures[ id ] = texture;
|
|
445
442
|
|
|
443
|
+
const uv = texture.channel > 0 ? 'st' + texture.channel : 'st';
|
|
444
|
+
|
|
445
|
+
const WRAPPINGS = {
|
|
446
|
+
1000: 'repeat', // RepeatWrapping
|
|
447
|
+
1001: 'clamp', // ClampToEdgeWrapping
|
|
448
|
+
1002: 'mirror' // MirroredRepeatWrapping
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
const repeat = texture.repeat.clone();
|
|
452
|
+
const offset = texture.offset.clone();
|
|
453
|
+
const rotation = texture.rotation;
|
|
454
|
+
|
|
455
|
+
// rotation is around the wrong point. after rotation we need to shift offset again so that we're rotating around the right spot
|
|
456
|
+
const xRotationOffset = Math.sin( rotation );
|
|
457
|
+
const yRotationOffset = Math.cos( rotation );
|
|
458
|
+
|
|
459
|
+
// texture coordinates start in the opposite corner, need to correct
|
|
460
|
+
offset.y = 1 - offset.y - repeat.y;
|
|
461
|
+
|
|
462
|
+
// turns out QuickLook is buggy and interprets texture repeat inverted/applies operations in a different order.
|
|
463
|
+
// Apple Feedback: FB10036297 and FB11442287
|
|
464
|
+
if ( quickLookCompatible ) {
|
|
465
|
+
|
|
466
|
+
// This is NOT correct yet in QuickLook, but comes close for a range of models.
|
|
467
|
+
// It becomes more incorrect the bigger the offset is
|
|
468
|
+
|
|
469
|
+
offset.x = offset.x / repeat.x;
|
|
470
|
+
offset.y = offset.y / repeat.y;
|
|
471
|
+
|
|
472
|
+
offset.x += xRotationOffset / repeat.x;
|
|
473
|
+
offset.y += yRotationOffset - 1;
|
|
474
|
+
|
|
475
|
+
} else {
|
|
476
|
+
|
|
477
|
+
// results match glTF results exactly. verified correct in usdview.
|
|
478
|
+
offset.x += xRotationOffset * repeat.x;
|
|
479
|
+
offset.y += ( 1 - yRotationOffset ) * repeat.y;
|
|
480
|
+
|
|
481
|
+
}
|
|
482
|
+
|
|
446
483
|
return `
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
484
|
+
def Shader "PrimvarReader_${ mapType }"
|
|
485
|
+
{
|
|
486
|
+
uniform token info:id = "UsdPrimvarReader_float2"
|
|
487
|
+
float2 inputs:fallback = (0.0, 0.0)
|
|
488
|
+
token inputs:varname = "${ uv }"
|
|
489
|
+
float2 outputs:result
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
def Shader "Transform2d_${ mapType }"
|
|
493
|
+
{
|
|
494
|
+
uniform token info:id = "UsdTransform2d"
|
|
495
|
+
token inputs:in.connect = </Materials/Material_${ material.id }/PrimvarReader_${ mapType }.outputs:result>
|
|
496
|
+
float inputs:rotation = ${ ( rotation * ( 180 / Math.PI ) ).toFixed( PRECISION ) }
|
|
497
|
+
float2 inputs:scale = ${ buildVector2( repeat ) }
|
|
498
|
+
float2 inputs:translation = ${ buildVector2( offset ) }
|
|
499
|
+
float2 outputs:result
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
def Shader "Texture_${ texture.id }_${ mapType }"
|
|
503
|
+
{
|
|
504
|
+
uniform token info:id = "UsdUVTexture"
|
|
505
|
+
asset inputs:file = @textures/Texture_${ id }.png@
|
|
506
|
+
float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
|
|
507
|
+
${ color !== undefined ? 'float4 inputs:scale = ' + buildColor4( color ) : '' }
|
|
508
|
+
token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
|
|
509
|
+
token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
|
|
510
|
+
token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
|
|
511
|
+
float outputs:r
|
|
512
|
+
float outputs:g
|
|
513
|
+
float outputs:b
|
|
514
|
+
float3 outputs:rgb
|
|
515
|
+
${ material.transparent || material.alphaTest > 0.0 ? 'float outputs:a' : '' }
|
|
516
|
+
}`;
|
|
473
517
|
|
|
474
518
|
}
|
|
475
519
|
|
|
476
520
|
|
|
477
|
-
if ( material.side === DoubleSide ) {
|
|
521
|
+
if ( material.side === THREE.DoubleSide ) {
|
|
478
522
|
|
|
479
523
|
console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material );
|
|
480
524
|
|
|
@@ -577,30 +621,21 @@ function buildMaterial( material, textures ) {
|
|
|
577
621
|
}
|
|
578
622
|
|
|
579
623
|
return `
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
624
|
+
def Material "Material_${ material.id }"
|
|
625
|
+
{
|
|
626
|
+
def Shader "PreviewSurface"
|
|
627
|
+
{
|
|
628
|
+
uniform token info:id = "UsdPreviewSurface"
|
|
585
629
|
${ inputs.join( '\n' ) }
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
token outputs:surface.connect = </Materials/Material_${ material.id }/PreviewSurface.outputs:surface>
|
|
591
|
-
token inputs:frame:stPrimvarName = "st"
|
|
630
|
+
int inputs:useSpecularWorkflow = 0
|
|
631
|
+
token outputs:surface
|
|
632
|
+
}
|
|
592
633
|
|
|
593
|
-
|
|
594
|
-
{
|
|
595
|
-
uniform token info:id = "UsdPrimvarReader_float2"
|
|
596
|
-
token inputs:varname.connect = </Materials/Material_${ material.id }.inputs:frame:stPrimvarName>
|
|
597
|
-
float2 inputs:fallback = (0.0, 0.0)
|
|
598
|
-
float2 outputs:result
|
|
599
|
-
}
|
|
634
|
+
token outputs:surface.connect = </Materials/Material_${ material.id }/PreviewSurface.outputs:surface>
|
|
600
635
|
|
|
601
636
|
${ samplers.join( '\n' ) }
|
|
602
637
|
|
|
603
|
-
|
|
638
|
+
}
|
|
604
639
|
`;
|
|
605
640
|
|
|
606
641
|
}
|
|
@@ -611,6 +646,12 @@ function buildColor( color ) {
|
|
|
611
646
|
|
|
612
647
|
}
|
|
613
648
|
|
|
649
|
+
function buildColor4( color ) {
|
|
650
|
+
|
|
651
|
+
return `(${ color.r }, ${ color.g }, ${ color.b }, 1.0)`;
|
|
652
|
+
|
|
653
|
+
}
|
|
654
|
+
|
|
614
655
|
function buildVector2( vector ) {
|
|
615
656
|
|
|
616
657
|
return `(${ vector.x }, ${ vector.y })`;
|
|
@@ -636,7 +677,7 @@ function buildCamera( camera ) {
|
|
|
636
677
|
{
|
|
637
678
|
matrix4d xformOp:transform = ${ transform }
|
|
638
679
|
uniform token[] xformOpOrder = ["xformOp:transform"]
|
|
639
|
-
|
|
680
|
+
|
|
640
681
|
float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) })
|
|
641
682
|
float horizontalAperture = ${ ( ( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10 ).toPrecision( PRECISION ) }
|
|
642
683
|
float verticalAperture = ${ ( ( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10 ).toPrecision( PRECISION ) }
|
|
@@ -651,7 +692,7 @@ function buildCamera( camera ) {
|
|
|
651
692
|
{
|
|
652
693
|
matrix4d xformOp:transform = ${ transform }
|
|
653
694
|
uniform token[] xformOpOrder = ["xformOp:transform"]
|
|
654
|
-
|
|
695
|
+
|
|
655
696
|
float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) })
|
|
656
697
|
float focalLength = ${ camera.getFocalLength().toPrecision( PRECISION ) }
|
|
657
698
|
float focusDistance = ${ camera.focus.toPrecision( PRECISION ) }
|
|
@@ -167,7 +167,7 @@ class ViewHelper extends Object3D {
|
|
|
167
167
|
const rect = domElement.getBoundingClientRect();
|
|
168
168
|
const offsetX = rect.left + ( domElement.offsetWidth - dim );
|
|
169
169
|
const offsetY = rect.top + ( domElement.offsetHeight - dim );
|
|
170
|
-
mouse.x = ( ( event.clientX - offsetX ) / ( rect.
|
|
170
|
+
mouse.x = ( ( event.clientX - offsetX ) / ( rect.right - offsetX ) ) * 2 - 1;
|
|
171
171
|
mouse.y = - ( ( event.clientY - offsetY ) / ( rect.bottom - offsetY ) ) * 2 + 1;
|
|
172
172
|
|
|
173
173
|
raycaster.setFromCamera( mouse, orthoCamera );
|
|
@@ -426,7 +426,7 @@ ShaderLib[ 'line' ] = {
|
|
|
426
426
|
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
427
427
|
|
|
428
428
|
#include <tonemapping_fragment>
|
|
429
|
-
#include <
|
|
429
|
+
#include <colorspace_fragment>
|
|
430
430
|
#include <fog_fragment>
|
|
431
431
|
#include <premultiplied_alpha_fragment>
|
|
432
432
|
|
|
@@ -1067,7 +1067,11 @@ class ThreeMFLoader extends Loader {
|
|
|
1067
1067
|
geometry.setIndex( new BufferAttribute( meshData[ 'triangles' ], 1 ) );
|
|
1068
1068
|
geometry.setAttribute( 'position', new BufferAttribute( meshData[ 'vertices' ], 3 ) );
|
|
1069
1069
|
|
|
1070
|
-
const material = new MeshPhongMaterial( {
|
|
1070
|
+
const material = new MeshPhongMaterial( {
|
|
1071
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1072
|
+
color: 0xffffff,
|
|
1073
|
+
flatShading: true
|
|
1074
|
+
} );
|
|
1071
1075
|
|
|
1072
1076
|
const mesh = new Mesh( geometry, material );
|
|
1073
1077
|
|
|
@@ -432,7 +432,11 @@ class AMFLoader extends Loader {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
const sceneObject = new Group();
|
|
435
|
-
const defaultMaterial = new MeshPhongMaterial( {
|
|
435
|
+
const defaultMaterial = new MeshPhongMaterial( {
|
|
436
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
437
|
+
color: 0xaaaaff,
|
|
438
|
+
flatShading: true
|
|
439
|
+
} );
|
|
436
440
|
|
|
437
441
|
sceneObject.name = amfName;
|
|
438
442
|
sceneObject.userData.author = amfAuthor;
|
|
@@ -3710,7 +3710,10 @@ class ColladaLoader extends Loader {
|
|
|
3710
3710
|
|
|
3711
3711
|
}
|
|
3712
3712
|
|
|
3713
|
-
const fallbackMaterial = new MeshBasicMaterial( {
|
|
3713
|
+
const fallbackMaterial = new MeshBasicMaterial( {
|
|
3714
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
3715
|
+
color: 0xff00ff
|
|
3716
|
+
} );
|
|
3714
3717
|
|
|
3715
3718
|
function resolveMaterialBinding( keys, instanceMaterials ) {
|
|
3716
3719
|
|
|
@@ -1270,7 +1270,10 @@ class FBXTreeParser {
|
|
|
1270
1270
|
|
|
1271
1271
|
} else {
|
|
1272
1272
|
|
|
1273
|
-
material = new MeshPhongMaterial( {
|
|
1273
|
+
material = new MeshPhongMaterial( {
|
|
1274
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1275
|
+
color: 0xcccccc
|
|
1276
|
+
} );
|
|
1274
1277
|
materials.push( material );
|
|
1275
1278
|
|
|
1276
1279
|
}
|
|
@@ -1311,7 +1314,11 @@ class FBXTreeParser {
|
|
|
1311
1314
|
}, null );
|
|
1312
1315
|
|
|
1313
1316
|
// FBX does not list materials for Nurbs lines, so we'll just put our own in here.
|
|
1314
|
-
const material = new LineBasicMaterial( {
|
|
1317
|
+
const material = new LineBasicMaterial( {
|
|
1318
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1319
|
+
color: 0x3300ff,
|
|
1320
|
+
linewidth: 1
|
|
1321
|
+
} );
|
|
1315
1322
|
return new Line( geometry, material );
|
|
1316
1323
|
|
|
1317
1324
|
}
|